aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/acl.php51
-rw-r--r--mod/admin.php6
-rw-r--r--mod/channel.php1
-rw-r--r--mod/cloud.php10
-rw-r--r--mod/connections.php3
-rw-r--r--mod/connedit.php26
-rw-r--r--mod/dav.php144
-rw-r--r--mod/display.php1
-rwxr-xr-xmod/events.php4
-rw-r--r--mod/home.php6
-rw-r--r--mod/impel.php4
-rw-r--r--mod/item.php74
-rwxr-xr-xmod/like.php20
-rw-r--r--mod/mail.php3
-rw-r--r--mod/manage.php2
-rwxr-xr-xmod/mood.php2
-rw-r--r--mod/network.php9
-rw-r--r--mod/photos.php63
-rw-r--r--mod/profile_photo.php1
-rw-r--r--mod/profiles.php21
-rw-r--r--mod/search.php1
-rw-r--r--mod/search_ac.php48
-rw-r--r--mod/settings.php5
-rwxr-xr-xmod/setup.php1
-rw-r--r--mod/siteinfo.php3
25 files changed, 315 insertions, 194 deletions
diff --git a/mod/acl.php b/mod/acl.php
index e6733351b..d406942c3 100644
--- a/mod/acl.php
+++ b/mod/acl.php
@@ -182,49 +182,29 @@ function acl_init(&$a){
);
}
elseif($type == 'x') {
-
$r = navbar_complete($a);
- $x = array();
- $x['query'] = $search;
- $x['photos'] = array();
- $x['links'] = array();
- $x['suggestions'] = array();
- $x['data'] = array();
+ $contacts = array();
if($r) {
foreach($r as $g) {
- $x['photos'][] = $g['photo'];
- $x['links'][] = $g['url'];
- $x['suggestions'][] = '@' . $g['name'];
- $x['data'][] = $g['name'];
+ $contacts[] = array(
+ "photo" => $g['photo'],
+ "name" => $g['name'],
+ "nick" => $g['address'],
+ );
}
}
- echo json_encode($x);
- killme();
+ $o = array(
+ 'start' => $start,
+ 'count' => $count,
+ 'items' => $contacts,
+ );
+ echo json_encode($o);
+ killme();
}
else
$r = array();
-
- if($type == 'm' || $type == 'a' || $type == 'p') {
- $x = array();
- $x['query'] = $search;
- $x['photos'] = array();
- $x['links'] = array();
- $x['suggestions'] = array();
- $x['data'] = array();
- if(count($r)) {
- foreach($r as $g) {
- $x['photos'][] = $g['micro'];
- $x['links'][] = $g['url'];
- $x['suggestions'][] = $g['name'];
- $x['data'][] = (($type === 'p') ? '@' . str_replace(' ','_',$g['name']) : $g['id']);
- }
- }
- echo json_encode($x);
- killme();
- }
-
if(count($r)) {
foreach($r as $g){
@@ -284,7 +264,7 @@ function navbar_complete(&$a) {
}
$dirmode = intval(get_config('system','directory_mode'));
- $search = ((x($_REQUEST,'query')) ? htmlentities($_REQUEST['query'],ENT_COMPAT,'UTF-8',false) : '');
+ $search = ((x($_REQUEST,'search')) ? htmlentities($_REQUEST['search'],ENT_COMPAT,'UTF-8',false) : '');
if(! $search || mb_strlen($search) < 2)
return array();
@@ -313,9 +293,10 @@ function navbar_complete(&$a) {
$url = $directory['url'] . '/dirsearch';
}
+ $count = (x($_REQUEST,'count')?$_REQUEST['count']:100);
if($url) {
$query = $url . '?f=' ;
- $query .= '&name=' . urlencode($search) . '&limit=50' . (($address) ? '&address=' . urlencode($search) : '');
+ $query .= '&name=' . urlencode($search) . "&limit=$count" . (($address) ? '&address=' . urlencode($search) : '');
$x = z_fetch_url($query);
if($x['success']) {
diff --git a/mod/admin.php b/mod/admin.php
index 0e580960a..1503bf18e 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -288,6 +288,8 @@ function admin_page_site_post(&$a){
del_config('system','admininfo');
}
else {
+ require_once('include/text.php');
+ linkify_tags($a, $admininfo, local_user());
set_config('system','admininfo', $admininfo);
}
set_config('system','language', $language);
@@ -827,7 +829,7 @@ function admin_page_channels(&$a){
/* get channels */
$total = q("SELECT count(*) as total FROM channel where not (channel_pageflags & %d)>0",
- intval(PAGE_REMOVED)
+ intval(PAGE_REMOVED|PAGE_SYSTEM)
);
if($total) {
$a->set_pager_total($total[0]['total']);
@@ -837,7 +839,7 @@ function admin_page_channels(&$a){
$order = " order by channel_name asc ";
$channels = q("SELECT * from channel where not ( channel_pageflags & %d )>0 $order limit %d offset %d ",
- intval(PAGE_REMOVED),
+ intval(PAGE_REMOVED|PAGE_SYSTEM),
intval($a->pager['itemspage']),
intval($a->pager['start'])
);
diff --git a/mod/channel.php b/mod/channel.php
index e819de0e0..c8ac83baf 100644
--- a/mod/channel.php
+++ b/mod/channel.php
@@ -286,6 +286,7 @@ function channel_content(&$a, $update = 0, $load = false) {
'$cats' => (($category) ? $category : ''),
'$tags' => (($hashtags) ? $hashtags : ''),
'$mid' => $mid,
+ '$verb' => '',
'$dend' => $datequery,
'$dbegin' => $datequery2
));
diff --git a/mod/cloud.php b/mod/cloud.php
index 27724f6b0..ad85eba34 100644
--- a/mod/cloud.php
+++ b/mod/cloud.php
@@ -37,16 +37,6 @@ if (x($_SERVER, 'HTTP_AUTHORIZATION')) {
* @param App &$a
*/
function cloud_init(&$a) {
- // call ($currenttheme)_init since we're operating outside of index.php
- $theme_info_file = "view/theme/" . current_theme() . "/php/theme.php";
- if (file_exists($theme_info_file)){
- require_once($theme_info_file);
- if (function_exists(str_replace('-', '_', current_theme()) . '_init')) {
- $func = str_replace('-', '_', current_theme()) . '_init';
- $func($a);
- }
- }
-
require_once('include/reddav.php');
if (! is_dir('store'))
diff --git a/mod/connections.php b/mod/connections.php
index 70e28913a..d36734ccb 100644
--- a/mod/connections.php
+++ b/mod/connections.php
@@ -179,7 +179,8 @@ function connections_content(&$a) {
$unconnected = false;
$all = false;
- $_SESSION['return_url'] = $a->query_string;
+ if(! $_REQUEST['aj'])
+ $_SESSION['return_url'] = $a->query_string;
$search_flags = 0;
$head = '';
diff --git a/mod/connedit.php b/mod/connedit.php
index 6729029ac..5c36c3184 100644
--- a/mod/connedit.php
+++ b/mod/connedit.php
@@ -55,6 +55,15 @@ function connedit_post(&$a) {
if(! $contact_id)
return;
+ // TODO if configured for hassle-free permissions, we'll post the form with ajax as soon as the
+ // connection enable is toggled to a special autopost url and set permissions immediately, leaving
+ // the other form elements alone pending a manual submit of the form. The downside is that there
+ // will be a window of opportunity when the permissions have been set but before you've had a chance
+ // to review and possibly restrict them. The upside is we won't have to warn you that your connection
+ // can't do anything until you save the bloody form.
+
+ $autopost = (((argc() > 2) && (argv(2) === 'auto')) ? true : false);
+
$orig_record = q("SELECT * FROM abook WHERE abook_id = %d AND abook_channel = %d LIMIT 1",
intval($contact_id),
intval(local_user())
@@ -216,10 +225,9 @@ function connedit_post(&$a) {
$arr = array('channel_id' => local_user(), 'abook' => $a->poi);
call_hooks('accept_follow', $arr);
}
-dbg(1);
+
if(! is_null($autoperms))
set_pconfig(local_user(),'system','autoperms',(($autoperms) ? $abook_my_perms : 0));
-dbg(0);
connedit_clone($a);
@@ -288,7 +296,7 @@ function connedit_content(&$a) {
$o .= "\$('#me_id_perms_" . $p . "').attr('checked','checked'); \n";
}
}
- $o .= "abook_perms_msg(); }\n</script>\n";
+ $o .= " }\n</script>\n";
}
if(argc() == 3) {
@@ -403,9 +411,9 @@ function connedit_content(&$a) {
contact_remove(local_user(), $orig_record[0]['abook_id']);
build_sync_packet(0 /* use the current local_user */,
- array('abook' => array(
+ array('abook' => array(array(
'abook_xchan' => $orig_record[0]['abook_xchan'],
- 'entry_deleted' => true)
+ 'entry_deleted' => true))
)
);
@@ -550,14 +558,13 @@ function connedit_content(&$a) {
'$slide' => $slide,
'$tabs' => $t,
'$tab_str' => $tab_str,
- '$perms_step1' => t('<p>Step #1. (Completed).</p><p>Create connection with minimal or no permissions.</p>'),
- '$perms_step2' => t('<p>Step #2. (Incomplete).</p><p>Review and/or edit the default individual permissions on this page, if desired.</p>'),
- '$perms_step3' => t('<p>Step #3. (Incomplete).</p><p>Submit this page to apply the selected permissions.</p><p>Until this is complete, this connection may have insufficient permission to communicate with you.</p>'),
+ '$perms_step1' => t('Default permissions for your channel type have (just) been applied. They have not yet been submitted. Please review the permissions on this page and make any desired changes at this time. This new connection may <em>not</em> be able to communicate with you until you submit this page, which will install and apply the selected permissions.'),
'$is_pending' => (($contact['abook_flags'] & ABOOK_FLAG_PENDING) ? 1 : ''),
'$unapproved' => $unapproved,
'$inherited' => t('inherited'),
'$approve' => t('Approve this connection'),
- '$noperms' => (((! $self) && (! $contact['abook_my_perms'])) ? t('Connection has no individual permissions!') : ''),
+ '$noperms' => (($contact['abook_my_perms']) ? false : true),
+ '$no_perms' => (((! $self) && (! $contact['abook_my_perms'])) ? t('Connection has no individual permissions!') : ''),
'$noperm_desc' => (((! $self) && (! $contact['abook_my_perms'])) ? t('This may be appropriate based on your <a href="settings">privacy settings</a>, though you may wish to review the "Advanced Permissions".') : ''),
'$submit' => t('Submit'),
'$lbl_vis1' => t('Profile Visibility'),
@@ -568,6 +575,7 @@ function connedit_content(&$a) {
'$them' => t('Their Settings'),
'$me' => t('My Settings'),
'$perms' => $perms,
+ '$perms_new' => t('Default permissions for this channel type have (just) been applied. They have <em>not</em> been saved and there are currently no stored default permissions. Please review/edit the applied settings and click [Submit] to finalize.'),
'$clear' => t('Clear/Disable Automatic Permissions'),
'$forum' => t('Forum Members'),
'$soapbox' => t('Soapbox'),
diff --git a/mod/dav.php b/mod/dav.php
new file mode 100644
index 000000000..e3719cb93
--- /dev/null
+++ b/mod/dav.php
@@ -0,0 +1,144 @@
+<?php
+/**
+ * @file mod/dav.php
+ * @brief Initialize RedMatrix's cloud (SabreDAV).
+ *
+ * Module for accessing the DAV storage area from a DAV client.
+ */
+
+use Sabre\DAV;
+use RedMatrix\RedDAV;
+
+// composer autoloader for SabreDAV
+require_once('vendor/autoload.php');
+
+// workaround for HTTP-auth in CGI mode
+if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
+ $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ;
+ if(strlen($userpass)) {
+ list($name, $password) = explode(':', $userpass);
+ $_SERVER['PHP_AUTH_USER'] = $name;
+ $_SERVER['PHP_AUTH_PW'] = $password;
+ }
+}
+
+if (x($_SERVER, 'HTTP_AUTHORIZATION')) {
+ $userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6)) ;
+ if(strlen($userpass)) {
+ list($name, $password) = explode(':', $userpass);
+ $_SERVER['PHP_AUTH_USER'] = $name;
+ $_SERVER['PHP_AUTH_PW'] = $password;
+ }
+}
+
+/**
+ * @brief Fires up the SabreDAV server.
+ *
+ * @param App &$a
+ */
+function dav_init(&$a) {
+
+ require_once('include/reddav.php');
+
+ if (! is_dir('store'))
+ os_mkdir('store', STORAGE_DEFAULT_PERMISSIONS, false);
+
+ $which = null;
+ if (argc() > 1)
+ $which = argv(1);
+
+ $profile = 0;
+
+ $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which . '" />' . "\r\n";
+
+ if ($which)
+ profile_load($a, $which, $profile);
+
+ $auth = new RedDAV\RedBasicAuth();
+
+ $ob_hash = get_observer_hash();
+
+ if ($ob_hash) {
+ if (local_user()) {
+ $channel = $a->get_channel();
+ $auth->setCurrentUser($channel['channel_address']);
+ $auth->channel_id = $channel['channel_id'];
+ $auth->channel_hash = $channel['channel_hash'];
+ $auth->channel_account_id = $channel['channel_account_id'];
+ if($channel['channel_timezone'])
+ $auth->setTimezone($channel['channel_timezone']);
+ }
+ $auth->observer = $ob_hash;
+ }
+
+ if ($_GET['davguest'])
+ $_SESSION['davguest'] = true;
+
+ $_SERVER['QUERY_STRING'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['QUERY_STRING']);
+ $_SERVER['QUERY_STRING'] = strip_zids($_SERVER['QUERY_STRING']);
+ $_SERVER['QUERY_STRING'] = preg_replace('/[\?&]davguest=(.*?)([\?&]|$)/ism', '', $_SERVER['QUERY_STRING']);
+
+ $_SERVER['REQUEST_URI'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['REQUEST_URI']);
+ $_SERVER['REQUEST_URI'] = strip_zids($_SERVER['REQUEST_URI']);
+ $_SERVER['REQUEST_URI'] = preg_replace('/[\?&]davguest=(.*?)([\?&]|$)/ism', '', $_SERVER['REQUEST_URI']);
+
+ $rootDirectory = new RedDAV\RedDirectory('/', $auth);
+
+ // A SabreDAV server-object
+ $server = new DAV\Server($rootDirectory);
+ // prevent overwriting changes each other with a lock backend
+ $lockBackend = new DAV\Locks\Backend\File('store/[data]/locks');
+ $lockPlugin = new DAV\Locks\Plugin($lockBackend);
+
+ $server->addPlugin($lockPlugin);
+
+ // The next section of code allows us to bypass prompting for http-auth if a
+ // FILE is being accessed anonymously and permissions allow this. This way
+ // one can create hotlinks to public media files in their cloud and anonymous
+ // viewers won't get asked to login.
+ // If a DIRECTORY is accessed or there are permission issues accessing the
+ // file and we aren't previously authenticated via zot, prompt for HTTP-auth.
+ // This will be the default case for mounting a DAV directory.
+ // In order to avoid prompting for passwords for viewing a DIRECTORY, add
+ // the URL query parameter 'davguest=1'.
+
+ $isapublic_file = false;
+ $davguest = ((x($_SESSION, 'davguest')) ? true : false);
+
+ if ((! $auth->observer) && ($_SERVER['REQUEST_METHOD'] === 'GET')) {
+ try {
+ $x = RedFileData('/' . $a->cmd, $auth);
+ if($x instanceof RedDAV\RedFile)
+ $isapublic_file = true;
+ }
+ catch (Exception $e) {
+ $isapublic_file = false;
+ }
+ }
+
+ if ((! $auth->observer) && (! $isapublic_file) && (! $davguest)) {
+ try {
+ $auth->Authenticate($server, t('RedMatrix channel'));
+ }
+ catch (Exception $e) {
+ logger('mod_cloud: auth exception' . $e->getMessage());
+ http_status_exit($e->getHTTPCode(), $e->getMessage());
+ }
+ }
+
+ require_once('include/RedDAV/RedBrowser.php');
+ // provide a directory view for the cloud in Red Matrix
+ $browser = new RedDAV\RedBrowser($auth);
+ $auth->setBrowserPlugin($browser);
+
+ $server->addPlugin($browser);
+
+ // Experimental QuotaPlugin
+// require_once('include/RedDAV/QuotaPlugin.php');
+// $server->addPlugin(new RedDAV\QuotaPlugin($auth));
+
+ // All we need to do now, is to fire up the server
+ $server->exec();
+
+ killme();
+}
diff --git a/mod/display.php b/mod/display.php
index 7d7f4ca13..f14aca6da 100644
--- a/mod/display.php
+++ b/mod/display.php
@@ -136,6 +136,7 @@ function display_content(&$a, $update = 0, $load = false) {
'$tags' => '',
'$dend' => '',
'$dbegin' => '',
+ '$verb' => '',
'$mid' => $item_hash
));
diff --git a/mod/events.php b/mod/events.php
index e016311d5..28a816ea4 100755
--- a/mod/events.php
+++ b/mod/events.php
@@ -75,6 +75,10 @@ function events_post(&$a) {
$location = escape_tags(trim($_POST['location']));
$type = 'event';
+ require_once('include/text.php');
+ linkify_tags($a, $desc, local_user());
+ linkify_tags($a, $location, local_user());
+
$action = ($event_hash == '') ? 'new' : "event/" . $event_hash;
$onerror_url = $a->get_baseurl() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish";
if(strcmp($finish,$start) < 0 && !$nofinish) {
diff --git a/mod/home.php b/mod/home.php
index b2538795f..2e57a2ab9 100644
--- a/mod/home.php
+++ b/mod/home.php
@@ -109,6 +109,11 @@ function home_content(&$a, $update = 0, $load = false) {
}
else {
+ if(get_config('system','disable_discover_tab')) {
+ call_hooks('home_content',$o);
+ return $o;
+ }
+
if(! $update) {
$maxheight = get_config('system','home_divmore_height');
@@ -144,6 +149,7 @@ function home_content(&$a, $update = 0, $load = false) {
'$tags' => '',
'$dend' => '',
'$mid' => '',
+ '$verb' => '',
'$dbegin' => ''
));
}
diff --git a/mod/impel.php b/mod/impel.php
index 1c7541bef..60e80ff9f 100644
--- a/mod/impel.php
+++ b/mod/impel.php
@@ -75,11 +75,11 @@ function impel_init(&$a) {
$execflag = false;
if($arr['mimetype'] === 'application/x-php') {
- $z = q("select account_id, account_roles from account left join channel on channel_account_id = account_id where channel_id = %d limit 1",
+ $z = q("select account_id, account_roles, channel_pageflags from account left join channel on channel_account_id = account_id where channel_id = %d limit 1",
intval(local_user())
);
- if($z && ($z[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE)) {
+ if($z && (($z[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($z[0]['channel_pageflags'] & PAGE_ALLOWCODE))) {
$execflag = true;
}
}
diff --git a/mod/item.php b/mod/item.php
index 894e23a0f..b3370fecf 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -88,6 +88,7 @@ function item_post(&$a) {
$pagetitle = ((x($_REQUEST,'pagetitle')) ? escape_tags(urlencode($_REQUEST['pagetitle'])) : '');
$layout_mid = ((x($_REQUEST,'layout_mid')) ? escape_tags($_REQUEST['layout_mid']): '');
$plink = ((x($_REQUEST,'permalink')) ? escape_tags($_REQUEST['permalink']) : '');
+ $obj_type = ((x($_REQUEST,'obj_type')) ? escape_tags($_REQUEST['obj_type']) : ACTIVITY_OBJ_NOTE);
// allow API to bulk load a bunch of imported items with sending out a bunch of posts.
$nopush = ((x($_REQUEST,'nopush')) ? intval($_REQUEST['nopush']) : 0);
@@ -132,6 +133,9 @@ function item_post(&$a) {
if(! x($_REQUEST,'type'))
$_REQUEST['type'] = 'net-comment';
+ if($obj_type == ACTIVITY_OBJ_POST)
+ $obj_type = ACTIVITY_OBJ_COMMENT;
+
if($parent) {
$r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1",
intval($parent)
@@ -449,10 +453,10 @@ function item_post(&$a) {
$execflag = false;
if($mimetype === 'application/x-php') {
- $z = q("select account_id, account_roles from account left join channel on channel_account_id = account_id where channel_id = %d limit 1",
+ $z = q("select account_id, account_roles, channel_pageflags from account left join channel on channel_account_id = account_id where channel_id = %d limit 1",
intval($profile_uid)
);
- if($z && ($z[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE)) {
+ if($z && (($z[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($z[0]['channel_pageflags'] & PAGE_ALLOWCODE))) {
if($uid && (get_account_id() == $z[0]['account_id'])) {
$execflag = true;
}
@@ -575,63 +579,18 @@ function item_post(&$a) {
$body = scale_external_images($body,false);
- /**
- * Look for any tags and linkify them
- */
-
- $str_tags = '';
- $inform = '';
- $post_tags = array();
-
- $tags = get_tags($body);
+ // Look for tags and linkify them
+ $results = linkify_tags($a, $body, ($uid) ? $uid : $profile_uid);
- $tagged = array();
-
- if(count($tags)) {
- $first_access_tag = true;
- foreach($tags as $tag) {
-
- // If we already tagged 'Robert Johnson', don't try and tag 'Robert'.
- // Robert Johnson should be first in the $tags array
-
- $fullnametagged = false;
- for($x = 0; $x < count($tagged); $x ++) {
- if(stristr($tagged[$x],$tag . ' ')) {
- $fullnametagged = true;
- break;
- }
- }
- if($fullnametagged)
- continue;
+ if($results) {
- $success = handle_tag($a, $body, $access_tag, $str_tags, ($uid) ? $uid : $profile_uid , $tag);
- logger('handle_tag: ' . print_r($success,true), LOGGER_DATA);
- if(($access_tag) && (! $parent_item)) {
- logger('access_tag: ' . $tag . ' ' . print_r($access_tag,true), LOGGER_DATA);
- if ($first_access_tag && (! get_pconfig($profile_uid,'system','no_private_mention_acl_override'))) {
-
- // This is a tough call, hence configurable. The issue is that one can type in a @!privacy mention
- // and also have a default ACL (perhaps from viewing a collection) and could be suprised that the
- // privacy mention wasn't the only recipient. So the default is to wipe out the existing ACL if a
- // private mention is found. This can be over-ridden if you wish private mentions to be in
- // addition to the current ACL settings.
-
- $str_contact_allow = '';
- $str_group_allow = '';
- $first_access_tag = false;
- }
- if(strpos($access_tag,'cid:') === 0) {
- $str_contact_allow .= '<' . substr($access_tag,4) . '>';
- $access_tag = '';
- }
- elseif(strpos($access_tag,'gid:') === 0) {
- $str_group_allow .= '<' . substr($access_tag,4) . '>';
- $access_tag = '';
- }
- }
+ // Set permissions based on tag replacements
+ set_linkified_perms($results, $str_contact_allow, $str_group_allow, $profile_uid, $parent_item);
+ $post_tags = array();
+ foreach($results as $result) {
+ $success = $result['success'];
if($success['replaced']) {
- $tagged[] = $tag;
$post_tags[] = array(
'uid' => $profile_uid,
'type' => $success['termtype'],
@@ -643,10 +602,6 @@ function item_post(&$a) {
}
}
-
-// logger('post_tags: ' . print_r($post_tags,true));
-
-
$attachments = '';
$match = false;
@@ -751,6 +706,7 @@ function item_post(&$a) {
$datarray['location'] = $location;
$datarray['coord'] = $coord;
$datarray['verb'] = $verb;
+ $datarray['obj_type'] = $obj_type;
$datarray['allow_cid'] = $str_contact_allow;
$datarray['allow_gid'] = $str_group_allow;
$datarray['deny_cid'] = $str_contact_deny;
diff --git a/mod/like.php b/mod/like.php
index 04a2b43cd..b3afd910f 100755
--- a/mod/like.php
+++ b/mod/like.php
@@ -37,6 +37,18 @@ function like_content(&$a) {
case 'undislike':
$activity = ACTIVITY_DISLIKE;
break;
+ case 'agree':
+ case 'unagree':
+ $activity = ACTIVITY_AGREE;
+ break;
+ case 'disagree':
+ case 'undisagree':
+ $activity = ACTIVITY_DISAGREE;
+ break;
+ case 'abstain':
+ case 'unabstain':
+ $activity = ACTIVITY_ABSTAIN;
+ break;
default:
return;
break;
@@ -336,6 +348,14 @@ function like_content(&$a) {
$bodyverb = t('%1$s likes %2$s\'s %3$s');
if($verb === 'dislike')
$bodyverb = t('%1$s doesn\'t like %2$s\'s %3$s');
+ if($verb === 'agree')
+ $bodyverb = t('%1$s agrees with %2$s\'s %3$s');
+ if($verb === 'disagree')
+ $bodyverb = t('%1$s doesn\'t agree with %2$s\'s %3$s');
+ if($verb === 'abstain')
+ $bodyverb = t('%1$s abstains from a decision on %2$s\'s %3$s');
+
+
if(! isset($bodyverb))
killme();
diff --git a/mod/mail.php b/mod/mail.php
index 6c778b956..37679aebf 100644
--- a/mod/mail.php
+++ b/mod/mail.php
@@ -83,6 +83,9 @@ function mail_post(&$a) {
// $body = fix_mce_lf($body);
// }
+ require_once('include/text.php');
+ linkify_tags($a, $body, local_user());
+
if(! $recipient) {
notice('No recipient found.');
$a->argc = 2;
diff --git a/mod/manage.php b/mod/manage.php
index b0de945bf..b6e10bf46 100644
--- a/mod/manage.php
+++ b/mod/manage.php
@@ -133,7 +133,7 @@ function manage_content(&$a) {
intval(get_account_id()),
intval(PAGE_REMOVED)
);
- $limit = service_class_fetch(local_user(),'total_identities');
+ $limit = account_service_class_fetch(get_account_id(),'total_identities');
if($limit !== false) {
$channel_usage_message = sprintf( t("You have created %1$.0f of %2$.0f allowed channels."), $r[0]['total'], $limit);
}
diff --git a/mod/mood.php b/mod/mood.php
index ff765fcac..e6f4760e0 100755
--- a/mod/mood.php
+++ b/mod/mood.php
@@ -137,4 +137,4 @@ function mood_content(&$a) {
return $o;
-} \ No newline at end of file
+}
diff --git a/mod/network.php b/mod/network.php
index d444dbd59..65332e3f6 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -47,7 +47,7 @@ function network_content(&$a, $update = 0, $load = false) {
$gid = ((x($_GET,'gid')) ? intval($_GET['gid']) : 0);
$category = ((x($_REQUEST,'cat')) ? $_REQUEST['cat'] : '');
$hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : '');
-
+ $verb = ((x($_REQUEST,'verb')) ? $_REQUEST['verb'] : '');
$search = (($_GET['search']) ? $_GET['search'] : '');
if($search) {
@@ -251,6 +251,7 @@ function network_content(&$a, $update = 0, $load = false) {
'$tags' => $hashtags,
'$dend' => $datequery,
'$mid' => '',
+ '$verb' => $verb,
'$dbegin' => $datequery2
));
}
@@ -279,6 +280,12 @@ function network_content(&$a, $update = 0, $load = false) {
}
}
+ if($verb) {
+ $sql_extra .= sprintf(" AND item.verb like '%s' ",
+ dbesc(protect_sprintf('%' . $verb . '%'))
+ );
+ }
+
if(strlen($file)) {
$sql_extra .= term_query('item',$file,TERM_FILE);
}
diff --git a/mod/photos.php b/mod/photos.php
index 8a54eca4f..b2eb2847f 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -140,7 +140,7 @@ function photos_post(&$a) {
);
if($r) {
foreach($r as $i) {
- drop_item($i['id'],false);
+ drop_item($i['id'],false,DROPITEM_PHASE1,true /* force removal of linked items */);
if(! $item_restrict)
proc_run('php','include/notifier.php','drop',$i['id']);
}
@@ -351,56 +351,27 @@ function photos_post(&$a) {
if($x !== '@' && $x !== '#')
$rawtags = '@' . $rawtags;
- $taginfo = array();
- $tags = get_tags($rawtags);
+ require_once('include/text.php');
+ $profile_uid = $a->profile['profile_uid'];
- if(count($tags)) {
- foreach($tags as $tag) {
+ $results = linkify_tags($a, $rawtags, (local_user()) ? local_user() : $profile_uid);
- // If we already tagged 'Robert Johnson', don't try and tag 'Robert'.
- // Robert Johnson should be first in the $tags array
+ $success = $results['success'];
+ $post_tags = array();
- $fullnametagged = false;
- for($x = 0; $x < count($tagged); $x ++) {
- if(stristr($tagged[$x],$tag . ' ')) {
- $fullnametagged = true;
- break;
- }
- }
- if($fullnametagged)
- continue;
-
- require_once('include/text.php');
- $body = $access_tag = '';
-
- $success = handle_tag($a, $body, $access_tag, $str_tags, (local_user()) ? local_user() : $a->profile['profile_uid'] , $tag);
- logger('handle_tag: ' . print_r($success,tue), LOGGER_DEBUG);
- if($access_tag) {
- logger('access_tag: ' . $tag . ' ' . print_r($access_tag,true), LOGGER_DEBUG);
- if(strpos($access_tag,'cid:') === 0) {
- $str_contact_allow .= '<' . substr($access_tag,4) . '>';
- $access_tag = '';
- }
- elseif(strpos($access_tag,'gid:') === 0) {
- $str_group_allow .= '<' . substr($access_tag,4) . '>';
- $access_tag = '';
- }
- }
-
- if($success['replaced']) {
- $tagged[] = $tag;
-
- $post_tags[] = array(
- 'uid' => $a->profile['profile_uid'],
- 'type' => $success['termtype'],
- 'otype' => TERM_OBJ_POST,
- 'term' => $success['term'],
- 'url' => $success['url']
- );
- }
+ foreach($results as $result) {
+ $success = $result['success'];
+ if($success['replaced']) {
+ $post_tags[] = array(
+ 'uid' => $profile_uid,
+ 'type' => $success['termtype'],
+ 'otype' => TERM_OBJ_POST,
+ 'term' => $success['term'],
+ 'url' => $success['url']
+ );
}
}
-
+
$r = q("select * from item where id = %d and uid = %d limit 1",
intval($item_id),
intval($page_owner_uid)
diff --git a/mod/profile_photo.php b/mod/profile_photo.php
index e9dad6f51..13d3cd756 100644
--- a/mod/profile_photo.php
+++ b/mod/profile_photo.php
@@ -130,6 +130,7 @@ function profile_photo_post(&$a) {
if($r) {
$base_image = $r[0];
+ $base_image['data'] = dbunescbin($base_image['data']);
$im = photo_factory($base_image['data'], $base_image['type']);
if($im->is_valid()) {
diff --git a/mod/profiles.php b/mod/profiles.php
index fa6a6e35c..ef5f6b379 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -296,7 +296,24 @@ function profiles_post(&$a) {
$work = fix_mce_lf(escape_tags(trim($_POST['work'])));
$education = fix_mce_lf(escape_tags(trim($_POST['education'])));
- $hide_friends = (($_POST['hide_friends'] == 1) ? 1: 0);
+ $hide_friends = ((intval($_POST['hide_friends'])) ? 1: 0);
+
+ require_once('include/text.php');
+ linkify_tags($a, $likes, local_user());
+ linkify_tags($a, $dislikes, local_user());
+ linkify_tags($a, $about, local_user());
+ linkify_tags($a, $interest, local_user());
+ linkify_tags($a, $interest, local_user());
+ linkify_tags($a, $contact, local_user());
+ linkify_tags($a, $channels, local_user());
+ linkify_tags($a, $music, local_user());
+ linkify_tags($a, $book, local_user());
+ linkify_tags($a, $tv, local_user());
+ linkify_tags($a, $film, local_user());
+ linkify_tags($a, $romance, local_user());
+ linkify_tags($a, $work, local_user());
+ linkify_tags($a, $education, local_user());
+
$with = ((x($_POST,'with')) ? escape_tags(trim($_POST['with'])) : '');
@@ -605,7 +622,7 @@ function profiles_content(&$a) {
$opt_tpl = get_markup_template("profile_hide_friends.tpl");
$hide_friends = replace_macros($opt_tpl,array('$field' => array(
- 'hide-friends',
+ 'hide_friends',
t('Hide your contact/friend list from viewers of this profile?'),
$r[0]['hide_friends'],
'',
diff --git a/mod/search.php b/mod/search.php
index 6df9d631a..2ea6ad86f 100644
--- a/mod/search.php
+++ b/mod/search.php
@@ -109,6 +109,7 @@ function search_content(&$a,$update = 0, $load = false) {
'$cats' => '',
'$tags' => '',
'$mid' => '',
+ '$verb' => '',
'$dend' => '',
'$dbegin' => ''
));
diff --git a/mod/search_ac.php b/mod/search_ac.php
index 36da21376..b4f5c9600 100644
--- a/mod/search_ac.php
+++ b/mod/search_ac.php
@@ -1,8 +1,9 @@
<?php
+// Autocomplete for saved searches. Should probably be put in the same place as the other autocompletes
function search_ac_init(&$a){
if(!local_user())
- return "";
+ killme();
$start = (x($_REQUEST,'start')?$_REQUEST['start']:0);
@@ -13,17 +14,6 @@ function search_ac_init(&$a){
$search = $_REQUEST['query'];
}
-
- $sql_extra = '';
-
- $x = array();
- $x['query'] = $search;
- $x['photos'] = array();
- $x['links'] = array();
- $x['suggestions'] = array();
- $x['data'] = array();
-
-
// Priority to people searches
if ($search) {
@@ -32,18 +22,23 @@ function search_ac_init(&$a){
}
- $r = q("SELECT `abook_id`, `xchan_name`, `xchan_photo_s`, `xchan_url` FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d
+ $r = q("SELECT `abook_id`, `xchan_name`, `xchan_photo_s`, `xchan_url`, `xchan_addr` FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d
$people_sql_extra
ORDER BY `xchan_name` ASC ",
intval(local_user())
);
+ $results = array();
if($r) {
foreach($r as $g) {
- $x['photos'][] = $g['xchan_photo_s'];
- $x['links'][] = $g['xchan_url'];
- $x['suggestions'][] = '@' . $g['xchan_name'];
- $x['data'][] = 'cid=' . intval($g['abook_id']);
+ $results[] = array(
+ "photo" => $g['xchan_photo_s'],
+ "name" => '@'.$g['xchan_name'],
+ "id" => $g['abook_id'],
+ "link" => $g['xchan_url'],
+ "label" => '',
+ "nick" => '',
+ );
}
}
@@ -53,15 +48,24 @@ function search_ac_init(&$a){
if(count($r)) {
foreach($r as $g) {
- $x['photos'][] = $a->get_baseurl() . '/images/hashtag.png';
- $x['links'][] = $g['url'];
- $x['suggestions'][] = '#' . $g['term'];
- $x['data'][] = intval($g['tid']);
+ $results[] = array(
+ "photo" => $a->get_baseurl() . '/images/hashtag.png',
+ "name" => '#'.$g['term'],
+ "id" => $g['tid'],
+ "link" => $g['url'],
+ "label" => '',
+ "nick" => '',
+ );
}
}
header("content-type: application/json");
- echo json_encode($x);
+ $o = array(
+ 'start' => $start,
+ 'count' => $count,
+ 'items' => $results,
+ );
+ echo json_encode($o);
logger('search_ac: ' . print_r($x,true));
diff --git a/mod/settings.php b/mod/settings.php
index 59ce98a2a..902213446 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -1004,7 +1004,10 @@ function settings_content(&$a) {
$evdays = 3;
$permissions_role = get_pconfig(local_user(),'system','permissions_role');
- $permissions_set = (($permissions_role && $permissions_role != 'custom') ? true : false);
+ if(! $permissions_role)
+ $permissions_role = 'custom';
+
+ $permissions_set = (($permissions_role != 'custom') ? true : false);
$vnotify = get_pconfig(local_user(),'system','vnotify');
$always_show_in_notices = get_pconfig(local_user(),'system','always_show_in_notices');
if($vnotify === false)
diff --git a/mod/setup.php b/mod/setup.php
index 6f2c7c074..d192eaf21 100755
--- a/mod/setup.php
+++ b/mod/setup.php
@@ -615,7 +615,6 @@ function load_database_rem($v, $i){
function load_database($db) {
- file_put_contents('debug-foo.log', 'Loading schema: '.$db->get_install_script());
$str = file_get_contents($db->get_install_script());
$arr = explode(';',$str);
$errors = false;
diff --git a/mod/siteinfo.php b/mod/siteinfo.php
index 01804e62a..1f3cd4479 100644
--- a/mod/siteinfo.php
+++ b/mod/siteinfo.php
@@ -126,7 +126,8 @@ function siteinfo_content(&$a) {
else
$plugins_text = t('No installed plugins/addons/apps');
- $admininfo = bbcode(get_config('system','admininfo'));
+ $txt = get_config('system','admininfo');
+ $admininfo = bbcode($txt);
if(file_exists('doc/site_donate.html'))
$donate .= file_get_contents('doc/site_donate.html');