aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-01-29 00:28:23 -0800
committerfriendica <info@friendica.com>2015-01-29 00:28:23 -0800
commitfd0b6c967fce4d8a82e9dad121ae7d8301d3f342 (patch)
tree5c37812ef7baeadc17fce088c4394d25f75b593c /include
parentc993ddd86ee25832e35e65333fa25b396e7aefdf (diff)
parent872b165eb2bb5d632a12f2d7e1a28e195c2d5348 (diff)
downloadvolse-hubzilla-fd0b6c967fce4d8a82e9dad121ae7d8301d3f342.tar.gz
volse-hubzilla-fd0b6c967fce4d8a82e9dad121ae7d8301d3f342.tar.bz2
volse-hubzilla-fd0b6c967fce4d8a82e9dad121ae7d8301d3f342.zip
Merge branch 'master' into pocorate
Diffstat (limited to 'include')
-rw-r--r--include/Contact.php6
-rw-r--r--include/ConversationObject.php4
-rw-r--r--include/ItemObject.php20
-rw-r--r--include/RedDAV/RedBrowser.php2
-rw-r--r--include/account.php4
-rw-r--r--include/acl_selectors.php6
-rw-r--r--include/activities.php6
-rw-r--r--include/api.php4
-rw-r--r--include/apps.php26
-rw-r--r--include/attach.php2
-rw-r--r--include/auth.php2
-rw-r--r--include/chat.php2
-rw-r--r--include/comanche.php6
-rw-r--r--include/config.php2
-rw-r--r--include/contact_widgets.php12
-rw-r--r--include/conversation.php52
-rwxr-xr-xinclude/diaspora.php25
-rw-r--r--include/follow.php2
-rw-r--r--include/group.php8
-rw-r--r--include/identity.php42
-rwxr-xr-xinclude/items.php10
-rw-r--r--include/menu.php4
-rw-r--r--include/message.php8
-rw-r--r--include/nav.php24
-rw-r--r--include/security.php22
-rw-r--r--include/socgraph.php2
-rw-r--r--include/text.php20
-rw-r--r--include/widgets.php58
-rw-r--r--include/zot.php2
29 files changed, 183 insertions, 200 deletions
diff --git a/include/Contact.php b/include/Contact.php
index 4c80f5d6a..66062c279 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -98,10 +98,10 @@ function vcard_from_xchan($xchan, $observer = null, $mode = '') {
// FIXME - show connect button to observer if appropriate
$connect = false;
- if(local_user()) {
+ if(local_channel()) {
$r = q("select * from abook where abook_xchan = '%s' and abook_channel = %d limit 1",
dbesc($xchan['xchan_hash']),
- intval(local_user())
+ intval(local_channel())
);
if(! $r)
$connect = t('Connect');
@@ -351,7 +351,7 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
proc_run('php','include/directory.php',$channel_id);
- if($channel_id == local_user() && $unset_session) {
+ if($channel_id == local_channel() && $unset_session) {
unset($_SESSION['authenticated']);
unset($_SESSION['uid']);
goaway($a->get_baseurl());
diff --git a/include/ConversationObject.php b/include/ConversationObject.php
index 7dc4c8c19..af0bb8d2c 100644
--- a/include/ConversationObject.php
+++ b/include/ConversationObject.php
@@ -33,7 +33,7 @@ class Conversation extends BaseObject {
$this->set_mode($mode);
$this->preview = $preview;
$this->prepared_item = $prepared_item;
- $c = ((local_user()) ? get_pconfig(local_user(),'system','default_cipher') : '');
+ $c = ((local_channel()) ? get_pconfig(local_channel(),'system','default_cipher') : '');
if($c)
$this->cipher = $c;
}
@@ -57,7 +57,7 @@ class Conversation extends BaseObject {
// $this->writable = false;
// }
// else {
- $this->profile_owner = local_user();
+ $this->profile_owner = local_channel();
$this->writable = true;
// }
break;
diff --git a/include/ItemObject.php b/include/ItemObject.php
index 82a321732..344664fd2 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -84,11 +84,11 @@ class Item extends BaseObject {
$conv = $this->get_conversation();
$observer = $conv->get_observer();
- $lock = ((($item['item_private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
+ $lock = ((($item['item_private'] == 1) || (($item['uid'] == local_channel()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
|| strlen($item['deny_cid']) || strlen($item['deny_gid']))))
? t('Private Message')
: false);
- $shareable = ((($conv->get_profile_owner() == local_user() && local_user()) && ($item['item_private'] != 1)) ? true : false);
+ $shareable = ((($conv->get_profile_owner() == local_channel() && local_channel()) && ($item['item_private'] != 1)) ? true : false);
// allow an exemption for sharing stuff from your private feeds
if($item['author']['xchan_network'] === 'rss')
@@ -96,7 +96,7 @@ class Item extends BaseObject {
$mode = $conv->get_mode();
- if(local_user() && $observer['xchan_hash'] === $item['author_xchan'])
+ if(local_channel() && $observer['xchan_hash'] === $item['author_xchan'])
$edpost = array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit"));
else
$edpost = false;
@@ -104,7 +104,7 @@ class Item extends BaseObject {
if($observer['xchan_hash'] == $this->get_data_value('author_xchan')
|| $observer['xchan_hash'] == $this->get_data_value('owner_xchan')
- || $this->get_data_value('uid') == local_user())
+ || $this->get_data_value('uid') == local_channel())
$dropping = true;
@@ -127,7 +127,7 @@ class Item extends BaseObject {
);
}
- $filer = ((($conv->get_profile_owner() == local_user()) && (! array_key_exists('real_uid',$item))) ? t("Save to Folder") : false);
+ $filer = ((($conv->get_profile_owner() == local_channel()) && (! array_key_exists('real_uid',$item))) ? t("Save to Folder") : false);
$profile_avatar = $item['author']['xchan_photo_m'];
$profile_link = chanlink_url($item['author']['xchan_url']);
@@ -171,7 +171,7 @@ class Item extends BaseObject {
if($this->is_toplevel()) {
// FIXME check this permission
- if(($conv->get_profile_owner() == local_user()) && (! array_key_exists('real_uid',$item))) {
+ if(($conv->get_profile_owner() == local_channel()) && (! array_key_exists('real_uid',$item))) {
// FIXME we don't need all this stuff, some can be done in the template
@@ -198,7 +198,7 @@ class Item extends BaseObject {
// FIXME - check this permission
- if($conv->get_profile_owner() == local_user()) {
+ if($conv->get_profile_owner() == local_channel()) {
$tagger = array(
'tagit' => t("Add Tag"),
'classtagger' => "",
@@ -214,7 +214,7 @@ class Item extends BaseObject {
}
$has_event = false;
- if(($item['obj_type'] === ACTIVITY_OBJ_EVENT) && $conv->get_profile_owner() == local_user())
+ if(($item['obj_type'] === ACTIVITY_OBJ_EVENT) && $conv->get_profile_owner() == local_channel())
$has_event = true;
if($this->is_commentable()) {
@@ -296,7 +296,7 @@ class Item extends BaseObject {
'star' => ((feature_enabled($conv->get_profile_owner(),'star_posts')) ? $star : ''),
'tagger' => ((feature_enabled($conv->get_profile_owner(),'commtag')) ? $tagger : ''),
'filer' => ((feature_enabled($conv->get_profile_owner(),'filing')) ? $filer : ''),
- 'bookmark' => (($conv->get_profile_owner() == local_user() && local_user() && $has_bookmarks) ? t('Save Bookmarks') : ''),
+ 'bookmark' => (($conv->get_profile_owner() == local_channel() && local_channel() && $has_bookmarks) ? t('Save Bookmarks') : ''),
'addtocal' => (($has_event) ? t('Add to Calendar') : ''),
'drop' => $drop,
'multidrop' => ((feature_enabled($conv->get_profile_owner(),'multi_delete')) ? $multidrop : ''),
@@ -610,7 +610,7 @@ class Item extends BaseObject {
$a = $this->get_app();
$observer = $conv->get_observer();
- $qc = ((local_user()) ? get_pconfig(local_user(),'system','qcomment') : null);
+ $qc = ((local_channel()) ? get_pconfig(local_channel(),'system','qcomment') : null);
$qcomment = (($qc) ? explode("\n",$qc) : null);
$comment_box = replace_macros($template,array(
diff --git a/include/RedDAV/RedBrowser.php b/include/RedDAV/RedBrowser.php
index 8093aebc9..e651562ec 100644
--- a/include/RedDAV/RedBrowser.php
+++ b/include/RedDAV/RedBrowser.php
@@ -76,7 +76,7 @@ class RedBrowser extends DAV\Browser\Plugin {
*/
public function generateDirectoryIndex($path) {
// (owner_id = channel_id) is visitor owner of this directory?
- $is_owner = ((local_user() && $this->auth->owner_id == local_user()) ? true : false);
+ $is_owner = ((local_channel() && $this->auth->owner_id == local_channel()) ? true : false);
if ($this->auth->getTimezone())
date_default_timezone_set($this->auth->getTimezone());
diff --git a/include/account.php b/include/account.php
index 88036e2ef..19c13d5bd 100644
--- a/include/account.php
+++ b/include/account.php
@@ -561,7 +561,7 @@ function downgrade_accounts() {
function service_class_allows($uid,$property,$usage = false) {
$a = get_app();
- if($uid == local_user()) {
+ if($uid == local_channel()) {
$service_class = $a->account['account_service_class'];
}
else {
@@ -619,7 +619,7 @@ function account_service_class_allows($aid,$property,$usage = false) {
function service_class_fetch($uid,$property) {
$a = get_app();
- if($uid == local_user()) {
+ if($uid == local_channel()) {
$service_class = $a->account['account_service_class'];
}
else {
diff --git a/include/acl_selectors.php b/include/acl_selectors.php
index 243e7a549..ae740b281 100644
--- a/include/acl_selectors.php
+++ b/include/acl_selectors.php
@@ -15,7 +15,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" >\r\n";
$r = q("SELECT * FROM `groups` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC",
- intval(local_user())
+ intval(local_channel())
);
@@ -119,7 +119,7 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != ''
$sql_extra
ORDER BY `name` ASC ",
- intval(local_user())
+ intval(local_channel())
);
@@ -175,7 +175,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
$sql_extra
ORDER BY xchan_name ASC ",
intval(ABOOK_FLAG_SELF),
- intval(local_user())
+ intval(local_channel())
);
diff --git a/include/activities.php b/include/activities.php
index d770ccb23..ca8863e51 100644
--- a/include/activities.php
+++ b/include/activities.php
@@ -3,10 +3,10 @@
function profile_activity($changed, $value) {
$a = get_app();
- if(! local_user() || ! is_array($changed) || ! count($changed))
+ if(! local_channel() || ! is_array($changed) || ! count($changed))
return;
- if(! get_pconfig(local_user(),'system','post_profilechange'))
+ if(! get_pconfig(local_channel(),'system','post_profilechange'))
return;
require_once('include/items.php');
@@ -18,7 +18,7 @@ function profile_activity($changed, $value) {
$arr = array();
$arr['mid'] = $arr['parent_mid'] = item_message_id();
- $arr['uid'] = local_user();
+ $arr['uid'] = local_channel();
$arr['aid'] = $self['channel_account_id'];
$arr['owner_xchan'] = $arr['author_xchan'] = $self['xchan_hash'];
$arr['item_flags'] = ITEM_WALL|ITEM_ORIGIN|ITEM_THREAD_TOP;
diff --git a/include/api.php b/include/api.php
index 51de412cf..d00cdcf8a 100644
--- a/include/api.php
+++ b/include/api.php
@@ -48,7 +48,7 @@ require_once('include/items.php');
}
}
if ($_SESSION["allow_api"])
- return local_user();
+ return local_channel();
return false;
}
@@ -308,7 +308,7 @@ require_once('include/items.php');
api_login($a);
return False;
} else {
- $user = local_user();
+ $user = local_channel();
$extra_query = " AND abook_channel = %d AND (abook_flags & " . ABOOK_FLAG_SELF . " )>0 ";
}
diff --git a/include/apps.php b/include/apps.php
index e08e6a6f5..504641102 100644
--- a/include/apps.php
+++ b/include/apps.php
@@ -88,15 +88,15 @@ function parse_app_description($f) {
$require = trim(strtolower($require));
switch($require) {
case 'nologin':
- if(local_user())
+ if(local_channel())
unset($ret);
break;
case 'admin':
if(! is_site_admin())
unset($ret);
break;
- case 'local_user':
- if(! local_user())
+ case 'local_channel':
+ if(! local_channel())
unset($ret);
break;
case 'public_profile':
@@ -108,7 +108,7 @@ function parse_app_description($f) {
unset($ret);
break;
default:
- if(! (local_user() && feature_enabled(local_user(),$require)))
+ if(! (local_channel() && feature_enabled(local_channel(),$require)))
unset($ret);
break;
@@ -196,15 +196,15 @@ function app_render($papp,$mode = 'view') {
$require = trim(strtolower($require));
switch($require) {
case 'nologin':
- if(local_user())
+ if(local_channel())
return '';
break;
case 'admin':
if(! is_site_admin())
return '';
break;
- case 'local_user':
- if(! local_user())
+ case 'local_channel':
+ if(! local_channel())
return '';
break;
case 'public_profile':
@@ -217,7 +217,7 @@ function app_render($papp,$mode = 'view') {
return '';
break;
default:
- if(! (local_user() && feature_enabled(local_user(),$require)))
+ if(! (local_channel() && feature_enabled(local_channel(),$require)))
return '';
break;
@@ -229,11 +229,11 @@ function app_render($papp,$mode = 'view') {
$hosturl = '';
- if(local_user()) {
- $installed = app_installed(local_user(),$papp);
+ if(local_channel()) {
+ $installed = app_installed(local_channel(),$papp);
$hosturl = z_root() . '/';
}
- elseif(remote_user()) {
+ elseif(remote_channel()) {
$observer = get_app()->get_observer();
if($observer && $observer['xchan_network'] === 'zot') {
// some folks might have xchan_url redirected offsite, use the connurl
@@ -251,8 +251,8 @@ function app_render($papp,$mode = 'view') {
'$hosturl' => $hosturl,
'$purchase' => (($papp['page'] && (! $installed)) ? t('Purchase') : ''),
'$install' => (($hosturl && $mode == 'view') ? $install_action : ''),
- '$edit' => ((local_user() && $installed && $mode == 'edit') ? t('Edit') : ''),
- '$delete' => ((local_user() && $installed && $mode == 'edit') ? t('Delete') : '')
+ '$edit' => ((local_channel() && $installed && $mode == 'edit') ? t('Edit') : ''),
+ '$delete' => ((local_channel() && $installed && $mode == 'edit') ? t('Delete') : '')
));
}
diff --git a/include/attach.php b/include/attach.php
index c7216df7a..155ddbc96 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -985,7 +985,7 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid,
dbesc(ACTIVITY_POST),
dbesc($objtype),
dbesc($object['hash']),
- intval(local_user())
+ intval(local_channel())
);
if($y) {
diff --git a/include/auth.php b/include/auth.php
index c4bbaf546..6c9c33861 100644
--- a/include/auth.php
+++ b/include/auth.php
@@ -124,7 +124,7 @@ if((isset($_SESSION)) && (x($_SESSION, 'authenticated')) &&
if(((x($_POST, 'auth-params')) && ($_POST['auth-params'] === 'logout')) || ($a->module === 'logout')) {
// process logout request
- $args = array('channel_id' => local_user());
+ $args = array('channel_id' => local_channel());
call_hooks('logging_out', $args);
nuke_session();
info( t('Logged out.') . EOL);
diff --git a/include/chat.php b/include/chat.php
index 533c03dde..b19d495bb 100644
--- a/include/chat.php
+++ b/include/chat.php
@@ -185,7 +185,7 @@ function chatroom_list($uid) {
require_once('include/security.php');
$sql_extra = permissions_sql($uid);
- $r = q("select cr_name, cr_id, count(cp_id) as cr_inroom from chatroom left join chatpresence on cr_id = cp_room where cr_uid = %d $sql_extra group by cr_name order by cr_name",
+ $r = q("select cr_name, cr_id, count(cp_id) as cr_inroom from chatroom left join chatpresence on cr_id = cp_room where cr_uid = %d $sql_extra group by cr_name, cr_id order by cr_name",
intval($uid)
);
diff --git a/include/comanche.php b/include/comanche.php
index b0eac475d..b181d415a 100644
--- a/include/comanche.php
+++ b/include/comanche.php
@@ -113,14 +113,14 @@ function comanche_replace_region($match) {
/**
* @function comanche_get_channel_id()
- * Returns the channel_id of the profile owner of the page, or the local_user if there is no profile owner.
+ * Returns the channel_id of the profile owner of the page, or the local_channel if there is no profile owner.
* Otherwise returns 0
*/
function comanche_get_channel_id() {
$channel_id = ((is_array(get_app()->profile)) ? get_app()->profile['profile_uid'] : 0);
- if((! $channel_id) && (local_user()))
- $channel_id = local_user();
+ if((! $channel_id) && (local_channel()))
+ $channel_id = local_channel();
return $channel_id;
}
diff --git a/include/config.php b/include/config.php
index 87b91e51a..b459e2c7d 100644
--- a/include/config.php
+++ b/include/config.php
@@ -18,7 +18,7 @@
* - <b>pconfig</b> is used for channel specific configurations and takes a
* <i>channel_id</i> as identifier. It stores for example which features are
* enabled per channel. The storage is of size MEDIUMTEXT.
- * @code $var = get_pconfig(local_user(), 'category', 'key');@endcode
+ * @code $var = get_pconfig(local_channel(), 'category', 'key');@endcode
* - <b>xconfig</b> is the same as pconfig, except that it uses <i>xchan</i> as
* an identifier. This is for example for people who do not have a local account.
* The storage is of size MEDIUMTEXT.
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index ee9394e95..a02fea523 100644
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -8,7 +8,7 @@ function findpeople_widget() {
$a = get_app();
if(get_config('system','invitation_only')) {
- $x = get_pconfig(local_user(),'system','invites_remaining');
+ $x = get_pconfig(local_channel(),'system','invites_remaining');
if($x || is_site_admin()) {
$a->page['aside'] .= '<div class="side-link" id="side-invite-remain">'
. sprintf( tt('%d invitation available','%d invitations available',$x), $x)
@@ -16,7 +16,7 @@ function findpeople_widget() {
}
}
- $advanced_search = ((local_user() && get_pconfig(local_user(),'feature','expert')) ? t('Advanced') : false);
+ $advanced_search = ((local_channel() && get_pconfig(local_channel(),'feature','expert')) ? t('Advanced') : false);
return replace_macros(get_markup_template('peoplefind.tpl'),array(
'$findpeople' => t('Find Channels'),
@@ -30,7 +30,7 @@ function findpeople_widget() {
'$inv' => t('Invite Friends'),
'$advanced_search' => $advanced_search,
'$advanced_hint' => "\r\n" . t('Advanced example: name=fred and country=iceland'),
- '$loggedin' => local_user()
+ '$loggedin' => local_channel()
));
}
@@ -39,12 +39,12 @@ function findpeople_widget() {
function fileas_widget($baseurl,$selected = '') {
$a = get_app();
- if(! local_user())
+ if(! local_channel())
return '';
$terms = array();
$r = q("select distinct(term) from term where uid = %d and type = %d order by term asc",
- intval(local_user()),
+ intval(local_channel()),
intval(TERM_FILE)
);
if(! $r)
@@ -105,7 +105,7 @@ function common_friends_visitor_widget($profile_uid) {
$a = get_app();
- if(local_user() == $profile_uid)
+ if(local_channel() == $profile_uid)
return;
$observer_hash = get_observer_hash();
diff --git a/include/conversation.php b/include/conversation.php
index 25c844fef..9429af754 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -430,16 +430,16 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
require_once('bbcode.php');
- $ssl_state = ((local_user()) ? true : false);
+ $ssl_state = ((local_channel()) ? true : false);
- if(local_user())
- load_pconfig(local_user(),'');
+ if(local_channel())
+ load_pconfig(local_channel(),'');
$arr_blocked = null;
- if(local_user())
- $str_blocked = get_pconfig(local_user(),'system','blocked');
- if(! local_user() && ($mode == 'network')) {
+ if(local_channel())
+ $str_blocked = get_pconfig(local_channel(),'system','blocked');
+ if(! local_channel() && ($mode == 'network')) {
$sys = get_sys_channel();
$id = $sys['channel_id'];
$str_blocked = get_pconfig($id,'system','blocked');
@@ -461,7 +461,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
if($mode === 'network') {
- $profile_owner = local_user();
+ $profile_owner = local_channel();
$page_writeable = true;
if(!$update) {
@@ -492,7 +492,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
elseif($mode === 'channel') {
$profile_owner = $a->profile['profile_uid'];
- $page_writeable = ($profile_owner == local_user());
+ $page_writeable = ($profile_owner == local_channel());
if(!$update) {
$tab = notags(trim($_GET['tab']));
@@ -508,14 +508,14 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
}
elseif($mode === 'display') {
- $profile_owner = local_user();
+ $profile_owner = local_channel();
$page_writeable = false;
$live_update_div = '<div id="live-display"></div>' . "\r\n";
}
elseif($mode === 'page') {
$profile_owner = $a->profile['uid'];
- $page_writeable = ($profile_owner == local_user());
+ $page_writeable = ($profile_owner == local_channel());
$live_update_div = '<div id="live-page"></div>' . "\r\n";
}
@@ -525,13 +525,13 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
elseif($mode === 'photos') {
$profile_onwer = $a->profile['profile_uid'];
- $page_writeable = ($profile_owner == local_user());
+ $page_writeable = ($profile_owner == local_channel());
$live_update_div = '<div id="live-photos"></div>' . "\r\n";
// for photos we've already formatted the top-level item (the photo)
$content_html = $a->data['photo_html'];
}
- $page_dropping = ((local_user() && local_user() == $profile_owner) ? true : false);
+ $page_dropping = ((local_channel() && local_channel() == $profile_owner) ? true : false);
if(! feature_enabled($profile_owner,'multi_delete'))
$page_dropping = false;
@@ -545,7 +545,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
else
$return_url = $_SESSION['return_url'] = $a->query_string;
- load_contact_links(local_user());
+ load_contact_links(local_channel());
$cb = array('items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview);
call_hooks('conversation_start',$cb);
@@ -863,7 +863,7 @@ function best_link_url($item) {
$clean_url = normalise_link($item['author-link']);
- if((local_user()) && (local_user() == $item['uid'])) {
+ if((local_channel()) && (local_channel() == $item['uid'])) {
if(isset($a->contacts) && x($a->contacts,$clean_url)) {
if($a->contacts[$clean_url]['network'] === NETWORK_DFRN) {
$best_url = $a->get_baseurl($ssl_state) . '/redir/' . $a->contacts[$clean_url]['id'];
@@ -899,17 +899,17 @@ function item_photo_menu($item){
$follow_url = "";
- $local_user = local_user();
+ $local_channel = local_channel();
- if($local_user) {
+ if($local_channel) {
$ssl_state = true;
if(! count($a->contacts))
- load_contact_links($local_user);
+ load_contact_links($local_channel);
$channel = $a->get_channel();
$channel_hash = (($channel) ? $channel['channel_hash'] : '');
}
- if(($local_user) && $local_user == $item['uid']) {
+ if(($local_channel) && $local_channel == $item['uid']) {
$vsrc_link = 'javascript:viewsrc(' . $item['id'] . '); return false;';
if($item['parent'] == $item['id'] && $channel && ($channel_hash != $item['author_xchan'])) {
$sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;';
@@ -923,7 +923,7 @@ function item_photo_menu($item){
if($a->contacts && array_key_exists($item['author_xchan'],$a->contacts))
$contact = $a->contacts[$item['author_xchan']];
else
- if($local_user && $item['author']['xchan_addr'])
+ if($local_channel && $item['author']['xchan_addr'])
$follow_url = z_root() . '/follow/?f=&url=' . $item['author']['xchan_addr'];
if($contact) {
@@ -1075,7 +1075,7 @@ function status_editor($a,$x,$popup=false) {
$plaintext = true;
-// if(feature_enabled(local_user(),'richtext'))
+// if(feature_enabled(local_channel(),'richtext'))
// $plaintext = false;
$mimeselect = '';
@@ -1467,7 +1467,7 @@ function network_tabs() {
'title' => t('Sort by Post Date'),
);
- if(feature_enabled(local_user(),'personal_tab')) {
+ if(feature_enabled(local_channel(),'personal_tab')) {
$tabs[] = array(
'label' => t('Personal'),
'url' => z_root() . '/' . $cmd . '?f=' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . '&conv=1',
@@ -1476,7 +1476,7 @@ function network_tabs() {
);
}
- if(feature_enabled(local_user(),'new_tab')) {
+ if(feature_enabled(local_channel(),'new_tab')) {
$tabs[] = array(
'label' => t('New'),
'url' => z_root() . '/' . $cmd . '?f=' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . '&new=1' . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''),
@@ -1485,7 +1485,7 @@ function network_tabs() {
);
}
- if(feature_enabled(local_user(),'star_posts')) {
+ if(feature_enabled(local_channel(),'star_posts')) {
$tabs[] = array(
'label' => t('Starred'),
'url'=>z_root() . '/' . $cmd . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&star=1',
@@ -1495,7 +1495,7 @@ function network_tabs() {
}
// Not yet implemented
- if(feature_enabled(local_user(),'spam_filter')) {
+ if(feature_enabled(local_channel(),'spam_filter')) {
$tabs[] = array(
'label' => t('Spam'),
'url'=> z_root() . '/network?f=&spam=1',
@@ -1527,7 +1527,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
if (is_null($nickname))
$nickname = $channel['channel_address'];
- $uid = (($a->profile['profile_uid']) ? $a->profile['profile_uid'] : local_user());
+ $uid = (($a->profile['profile_uid']) ? $a->profile['profile_uid'] : local_channel());
if (get_pconfig($uid,'system','noprofiletabs'))
return;
@@ -1593,7 +1593,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
}
require_once('include/menu.php');
- $has_bookmarks = menu_list_count(local_user(),'',MENU_BOOKMARK) + menu_list_count(local_user(),'',MENU_SYSTEM|MENU_BOOKMARK);
+ $has_bookmarks = menu_list_count(local_channel(),'',MENU_BOOKMARK) + menu_list_count(local_channel(),'',MENU_SYSTEM|MENU_BOOKMARK);
if($is_owner && $has_bookmarks) {
$tabs[] = array(
'label' => t('Bookmarks'),
diff --git a/include/diaspora.php b/include/diaspora.php
index 767758164..8f2f93209 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -2168,8 +2168,7 @@ function diaspora_profile($importer,$xml,$msg) {
if($name === '') {
$name = $handle_parts[0];
}
-
-
+
if( preg_match("|^https?://|", $image_url) === 0) {
$image_url = "http://" . $handle_parts[1] . $image_url;
}
@@ -2190,32 +2189,16 @@ function diaspora_profile($importer,$xml,$msg) {
if(substr($birthday,5) === substr($contact['bd'],5))
$birthday = $contact['bd'];
- // TODO: update name on item['author-name'] if the name changed. See consume_feed()
- // Not doing this currently because D* protocol is scheduled for revision soon.
-
-/* $r = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' , `bd` = '%s' WHERE `id` = %d AND `uid` = %d",
+ $r = q("update xchan set xchan_name = '%s', xchan_name_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s' ",
dbesc($name),
dbesc(datetime_convert()),
dbesc($images[0]),
dbesc($images[1]),
dbesc($images[2]),
+ dbesc($images[3]),
dbesc(datetime_convert()),
- dbesc($birthday),
- intval($contact['id']),
- intval($importer['channel_id'])
+ intval($contact['xchan_hash'])
);
-*/
-/* if($r) {
- if($oldphotos) {
- foreach($oldphotos as $ph) {
- q("DELETE FROM `photo` WHERE `uid` = %d AND `contact-id` = %d AND `album` = 'Contact Photos' AND `resource-id` = '%s' ",
- intval($importer['channel_id']),
- intval($contact['id']),
- dbesc($ph['resource-id'])
- );
- }
- }
- } */
return;
diff --git a/include/follow.php b/include/follow.php
index 06c0c5c62..2d6791420 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -172,7 +172,7 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
return $result;
}
- if((local_user()) && $uid == local_user()) {
+ if((local_channel()) && $uid == local_channel()) {
$aid = get_account_id();
$hash = get_observer_hash();
$ch = $a->get_channel();
diff --git a/include/group.php b/include/group.php
index 28cf5d80d..be19f6efe 100644
--- a/include/group.php
+++ b/include/group.php
@@ -202,8 +202,8 @@ function group_get_members($gid) {
LEFT JOIN abook ON abook_xchan = `group_member`.`xchan` left join xchan on xchan_hash = abook_xchan
WHERE `gid` = %d AND abook_channel = %d and `group_member`.`uid` = %d and not ( xchan_flags & %d )>0 and not ( abook_flags & %d )>0 and not ( abook_flags & %d )>0 ORDER BY xchan_name ASC ",
intval($gid),
- intval(local_user()),
- intval(local_user()),
+ intval(local_channel()),
+ intval(local_channel()),
intval(XCHAN_FLAGS_DELETED),
intval(ABOOK_FLAG_BLOCKED),
intval(ABOOK_FLAG_PENDING)
@@ -245,7 +245,7 @@ function group_side($every="connections",$each="group",$edit = false, $group_id
$o = '';
- if(! local_user())
+ if(! local_channel())
return '';
$groups = array();
@@ -263,7 +263,7 @@ function group_side($every="connections",$each="group",$edit = false, $group_id
);
$member_of = array();
if($cid) {
- $member_of = groups_containing(local_user(),$cid);
+ $member_of = groups_containing(local_channel(),$cid);
}
if(count($r)) {
diff --git a/include/identity.php b/include/identity.php
index d98f39cb7..2fc183368 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -705,7 +705,7 @@ function profile_load(&$a, $nickname, $profile = '') {
$profile_fields_basic = get_profile_fields_basic();
$profile_fields_advanced = get_profile_fields_advanced();
- $advanced = ((feature_enabled(local_user(),'advanced_profiles')) ? true : false);
+ $advanced = ((feature_enabled(local_channel(),'advanced_profiles')) ? true : false);
if($advanced)
$fields = $profile_fields_advanced;
else
@@ -760,8 +760,8 @@ function profile_load(&$a, $nickname, $profile = '') {
}
- if(local_user()) {
- $a->profile['channel_mobile_theme'] = get_pconfig(local_user(),'system', 'mobile_theme');
+ if(local_channel()) {
+ $a->profile['channel_mobile_theme'] = get_pconfig(local_channel(),'system', 'mobile_theme');
$_SESSION['mobile_theme'] = $a->profile['channel_mobile_theme'];
}
@@ -783,7 +783,7 @@ function profile_load(&$a, $nickname, $profile = '') {
function profile_create_sidebar(&$a,$connect = true) {
- $block = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);
+ $block = (((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) ? true : false);
$a->set_widget('profile',profile_sidebar($a->profile, $block, $connect));
return;
@@ -824,7 +824,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) {
head_set_icon($profile['thumb']);
- $is_owner = (($profile['uid'] == local_user()) ? true : false);
+ $is_owner = (($profile['uid'] == local_channel()) ? true : false);
$profile['picdate'] = urlencode($profile['picdate']);
@@ -856,7 +856,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) {
);
- $multi_profiles = feature_enabled(local_user(), 'multi_profiles');
+ $multi_profiles = feature_enabled(local_channel(), 'multi_profiles');
if($multi_profiles) {
$profile['edit'] = array($a->get_baseurl(). '/profiles', t('Profiles'),"", t('Manage/edit profiles'));
$profile['menu']['cr_new'] = t('Create New Profile');
@@ -865,7 +865,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) {
$profile['edit'] = array($a->get_baseurl() . '/profiles/' . $profile['id'], t('Edit Profile'),'',t('Edit Profile'));
$r = q("SELECT * FROM `profile` WHERE `uid` = %d",
- local_user());
+ local_channel());
if($r) {
@@ -905,7 +905,7 @@ logger('online: ' . $profile['online']);
$block = true;
}
- if(($profile['hidewall'] && (! local_user()) && (! remote_user())) || $block ) {
+ if(($profile['hidewall'] && (! local_channel()) && (! remote_channel())) || $block ) {
$location = $pdesc = $gender = $marital = $homepage = $online = False;
}
@@ -973,7 +973,7 @@ logger('online: ' . $profile['online']);
$a = get_app();
$o = '';
- if(! local_user())
+ if(! local_channel())
return $o;
$bd_format = t('g A l F d') ; // 8 AM Friday January 18
@@ -983,7 +983,7 @@ logger('online: ' . $profile['online']);
LEFT JOIN `contact` ON `contact`.`id` = `event`.`cid`
WHERE `event`.`uid` = %d AND `type` = 'birthday' AND `start` < '%s' AND `finish` > '%s'
ORDER BY `start` ASC ",
- intval(local_user()),
+ intval(local_channel()),
dbesc(datetime_convert('UTC','UTC','now + 6 days')),
dbesc(datetime_convert('UTC','UTC','now'))
);
@@ -1053,7 +1053,7 @@ logger('online: ' . $profile['online']);
$a = get_app();
- if(! local_user())
+ if(! local_channel())
return $o;
$bd_format = t('g A l F d') ; // 8 AM Friday January 18
@@ -1062,7 +1062,7 @@ logger('online: ' . $profile['online']);
$r = q("SELECT `event`.* FROM `event`
WHERE `event`.`uid` = %d AND `type` != 'birthday' AND `start` < '%s' AND `start` > '%s'
ORDER BY `start` ASC ",
- intval(local_user()),
+ intval(local_channel()),
dbesc(datetime_convert('UTC','UTC','now + 6 days')),
dbesc(datetime_convert('UTC','UTC','now - 1 days'))
);
@@ -1286,11 +1286,11 @@ function zid_init(&$a) {
proc_run('php','include/gprobe.php',bin2hex($tmp_str));
$arr = array('zid' => $tmp_str, 'url' => $a->cmd);
call_hooks('zid_init',$arr);
- if(! local_user()) {
+ if(! local_channel()) {
$r = q("select * from hubloc where hubloc_addr = '%s' order by hubloc_connected desc limit 1",
dbesc($tmp_str)
);
- if($r && remote_user() && remote_user() === $r[0]['hubloc_hash'])
+ if($r && remote_channel() && remote_channel() === $r[0]['hubloc_hash'])
return;
logger('zid_init: not authenticated. Invoking reverse magic-auth for ' . $tmp_str);
// try to avoid recursion - but send them home to do a proper magic auth
@@ -1356,9 +1356,9 @@ function zid($s,$address = '') {
function get_theme_uid() {
$uid = (($_REQUEST['puid']) ? intval($_REQUEST['puid']) : 0);
- if(local_user()) {
- if((get_pconfig(local_user(),'system','always_my_theme')) || (! $uid))
- return local_user();
+ if(local_channel()) {
+ if((get_pconfig(local_channel(),'system','always_my_theme')) || (! $uid))
+ return local_channel();
}
if(! $uid) {
$x = get_sys_channel();
@@ -1421,7 +1421,7 @@ function get_online_status($nick) {
$ret = array('result' => false);
- if(get_config('system','block_public') && ! local_user() && ! remote_user())
+ if(get_config('system','block_public') && ! local_channel() && ! remote_channel())
return $ret;
$r = q("select channel_id, channel_hash from channel where channel_address = '%s' limit 1",
@@ -1474,7 +1474,7 @@ function get_channel_by_nick($nick) {
function identity_selector() {
- if(local_user()) {
+ if(local_channel()) {
$r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel.channel_account_id = %d and (channel_pageflags & %d) = 0 order by channel_name ",
intval(get_account_id()),
intval(PAGE_REMOVED)
@@ -1484,7 +1484,7 @@ function identity_selector() {
$account = get_app()->get_account();
$o = replace_macros(get_markup_template('channel_id_select.tpl'),array(
'$channels' => $r,
- '$selected' => local_user()
+ '$selected' => local_channel()
));
return $o;
}
@@ -1495,7 +1495,7 @@ function identity_selector() {
function is_public_profile() {
- if(! local_user())
+ if(! local_channel())
return false;
if(intval(get_config('system','block_public')))
return false;
diff --git a/include/items.php b/include/items.php
index 756625d85..c34e694ac 100755
--- a/include/items.php
+++ b/include/items.php
@@ -1967,7 +1967,7 @@ function item_store($arr,$allow_exec = false) {
$arr['body'] = z_input_filter($arr['uid'],$arr['body'],$arr['mimetype']);
- if(local_user() && (! $arr['sig'])) {
+ if(local_channel() && (! $arr['sig'])) {
$channel = get_app()->get_channel();
if($channel['channel_hash'] === $arr['author_xchan']) {
$arr['sig'] = base64url_encode(rsa_sign($arr['body'],$channel['channel_prvkey']));
@@ -2355,7 +2355,7 @@ function item_store_update($arr,$allow_exec = false) {
// apply the input filter here - if it is obscured it has been filtered already
$arr['body'] = z_input_filter($arr['uid'],$arr['body'],$arr['mimetype']);
- if(local_user() && (! $arr['sig'])) {
+ if(local_channel() && (! $arr['sig'])) {
$channel = get_app()->get_channel();
if($channel['channel_hash'] === $arr['author_xchan']) {
$arr['sig'] = base64url_encode(rsa_sign($arr['body'],$channel['channel_prvkey']));
@@ -3949,7 +3949,7 @@ function retain_item($id) {
function drop_items($items) {
$uid = 0;
- if(! local_user() && ! remote_user())
+ if(! local_channel() && ! remote_channel())
return;
if(count($items)) {
@@ -4005,7 +4005,7 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = fal
$ok_to_delete = true;
// owner deletion
- if(local_user() && local_user() == $item['uid'])
+ if(local_channel() && local_channel() == $item['uid'])
$ok_to_delete = true;
// author deletion
@@ -4472,7 +4472,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$r = q("SELECT abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where abook_id = %d and abook_channel = %d and not ( abook_flags & " . intval(ABOOK_FLAG_BLOCKED) . ")>0 limit 1",
intval($arr['cid']),
- intval(local_user())
+ intval(local_channel())
);
if($r) {
$sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval($arr['uid']) . " AND ( author_xchan = '" . dbesc($r[0]['abook_xchan']) . "' or owner_xchan = '" . dbesc($r[0]['abook_xchan']) . "' ) and item_restrict = 0 ) ";
diff --git a/include/menu.php b/include/menu.php
index 9dc236605..81e986132 100644
--- a/include/menu.php
+++ b/include/menu.php
@@ -223,7 +223,7 @@ function menu_add_item($menu_id, $uid, $arr) {
$mitem_order = intval($arr['mitem_order']);
$mitem_flags = intval($arr['mitem_flags']);
- if(local_user() == $uid) {
+ if(local_channel() == $uid) {
$channel = get_app()->get_channel();
}
@@ -279,7 +279,7 @@ function menu_edit_item($menu_id, $uid, $arr) {
$mitem_flags = intval($arr['mitem_flags']);
- if(local_user() == $uid) {
+ if(local_channel() == $uid) {
$channel = get_app()->get_channel();
}
diff --git a/include/message.php b/include/message.php
index 49278f273..34fa2cd8d 100644
--- a/include/message.php
+++ b/include/message.php
@@ -51,7 +51,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
if(strlen($replyto)) {
$r = q("select convid from mail where channel_id = %d and ( mid = '%s' or parent_mid = '%s' ) limit 1",
- intval(local_user()),
+ intval(local_channel()),
dbesc($replyto),
dbesc($replyto)
);
@@ -76,7 +76,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
$handles = $recip_handle . ';' . $sender_handle;
$r = q("insert into conv (uid,guid,creator,created,updated,subject,recips) values(%d, '%s', '%s', '%s', '%s', '%s', '%s') ",
- intval(local_user()),
+ intval(local_channel()),
dbesc($conv_guid),
dbesc($sender_handle),
dbesc(datetime_convert()),
@@ -87,7 +87,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
$r = q("select * from conv where guid = '%s' and uid = %d limit 1",
dbesc($conv_guid),
- intval(local_user())
+ intval(local_channel())
);
if($r)
$convid = $r[0]['id'];
@@ -261,7 +261,7 @@ function private_messages_list($uid, $mailbox = '', $start = 0, $numitems = 0) {
// inside this function or having some preset sorts, but don't wish to limit app developers.
$r = q("SELECT * from mail WHERE channel_id = %d $where order by created desc $limit",
- intval(local_user())
+ intval(local_channel())
);
if(! $r) {
return array();
diff --git a/include/nav.php b/include/nav.php
index a567f83c5..5e8317cfa 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -23,7 +23,7 @@ EOT;
- if(local_user()) {
+ if(local_channel()) {
$channel = $a->get_channel();
$observer = $a->get_observer();
$prof = q("select id from profile where uid = %d and is_default = 1",
@@ -39,7 +39,7 @@ EOT;
}
- elseif(remote_user())
+ elseif(remote_channel())
$observer = $a->get_observer();
@@ -78,10 +78,10 @@ EOT;
$userinfo = null;
$nav['loginmenu']=array();
- if(local_user()) {
+ if(local_channel()) {
- if($chans && count($chans) > 1 && feature_enabled(local_user(),'nav_channel_select'))
+ if($chans && count($chans) > 1 && feature_enabled(local_channel(),'nav_channel_select'))
$nav['channels'] = $chans;
$nav['logout'] = Array('logout',t('Logout'), "", t('End this session'),'logout_nav_btn');
@@ -89,7 +89,7 @@ EOT;
// user menu
$nav['usermenu'][] = Array('channel/' . $channel['channel_address'], t('Home'), "", t('Your posts and conversations'),'channel_nav_btn');
$nav['usermenu'][] = Array('profile/' . $channel['channel_address'], t('View Profile'), "", t('Your profile page'),'profile_nav_btn');
- if(feature_enabled(local_user(),'multi_profiles'))
+ if(feature_enabled(local_channel(),'multi_profiles'))
$nav['usermenu'][] = Array('profiles', t('Edit Profiles'),"", t('Manage/Edit profiles'),'profiles_nav_btn');
else
$nav['usermenu'][] = Array('profiles/' . $prof[0]['id'], t('Edit Profile'),"", t('Edit your profile'),'profiles_nav_btn');
@@ -98,13 +98,13 @@ EOT;
$nav['usermenu'][] = Array('cloud/' . $channel['channel_address'],t('Files'),"",t('Your files'),'cloud_nav_btn');
require_once('include/chat.php');
- $has_chats = chatroom_list_count(local_user());
+ $has_chats = chatroom_list_count(local_channel());
if($has_chats) {
$nav['usermenu'][] = Array('chat/' . $channel['channel_address'],t('Chat'),"",t('Your chatrooms'),'chat_nav_btn');
}
require_once('include/menu.php');
- $has_bookmarks = menu_list_count(local_user(),'',MENU_BOOKMARK) + menu_list_count(local_user(),'',MENU_SYSTEM|MENU_BOOKMARK);
+ $has_bookmarks = menu_list_count(local_channel(),'',MENU_BOOKMARK) + menu_list_count(local_channel(),'',MENU_SYSTEM|MENU_BOOKMARK);
if($has_bookmarks) {
$nav['usermenu'][] = Array('bookmarks', t('Bookmarks'), "", t('Your bookmarks'),'bookmarks_nav_btn');
}
@@ -147,11 +147,11 @@ EOT;
$homelink = (($observer) ? $observer['xchan_url'] : '');
}
- if(($a->module != 'home') && (! (local_user())))
+ if(($a->module != 'home') && (! (local_channel())))
$nav['home'] = array($homelink, t('Home'), "", t('Home Page'),'home_nav_btn');
- if(($a->config['system']['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user()))
+ if(($a->config['system']['register_policy'] == REGISTER_OPEN) && (! local_channel()) && (! remote_channel()))
$nav['register'] = array('register',t('Register'), "", t('Create an account'),'register_nav_btn');
$help_url = z_root() . '/help?f=&cmd=' . $a->cmd;
@@ -174,9 +174,9 @@ EOT;
*
*/
- if(local_user()) {
+ if(local_channel()) {
- $network_options = get_pconfig(local_user(),'system','network_page_default');
+ $network_options = get_pconfig(local_channel(),'system','network_page_default');
$nav['network'] = array('network' . (($network_options) ? '?f=&' . $network_options : ''),
t('Matrix'), "", t('Your matrix'),'network_nav_btn');
@@ -248,7 +248,7 @@ $powered_by = '';
'$banner' => $banner,
'$emptynotifications' => t('Loading...'),
'$userinfo' => $x['usermenu'],
- '$localuser' => local_user(),
+ '$localuser' => local_channel(),
'$sel' => $a->nav_sel,
'$powered_by' => $powered_by,
'$help' => t('@name, #tag, content'),
diff --git a/include/security.php b/include/security.php
index 07b6a96aa..216299099 100644
--- a/include/security.php
+++ b/include/security.php
@@ -118,7 +118,7 @@ function change_channel($change_channel) {
$_SESSION['uid'] = intval($r[0]['channel_id']);
get_app()->set_channel($r[0]);
$_SESSION['theme'] = $r[0]['channel_theme'];
- $_SESSION['mobile_theme'] = get_pconfig(local_user(),'system', 'mobile_theme');
+ $_SESSION['mobile_theme'] = get_pconfig(local_channel(),'system', 'mobile_theme');
date_default_timezone_set($r[0]['channel_timezone']);
$ret = $r[0];
}
@@ -130,7 +130,7 @@ function change_channel($change_channel) {
$_SESSION['my_address'] = $r[0]['channel_address'] . '@' . substr(get_app()->get_baseurl(), strpos(get_app()->get_baseurl(), '://') + 3);
get_app()->set_observer($x[0]);
- get_app()->set_perms(get_all_perms(local_user(), $hash));
+ get_app()->set_perms(get_all_perms(local_channel(), $hash));
}
if(! is_dir('store/' . $r[0]['channel_address']))
@os_mkdir('store/' . $r[0]['channel_address'], STORAGE_DEFAULT_PERMISSIONS,true);
@@ -153,8 +153,8 @@ function permissions_sql($owner_id, $remote_verified = false, $groups = null) {
if(defined('STATUSNET_PRIVACY_COMPATIBILITY'))
return '';
- $local_user = local_user();
- $remote_user = remote_user();
+ $local_channel = local_channel();
+ $remote_channel = remote_channel();
/**
* Construct permissions
@@ -172,7 +172,7 @@ function permissions_sql($owner_id, $remote_verified = false, $groups = null) {
* Profile owner - everything is visible
*/
- if(($local_user) && ($local_user == $owner_id)) {
+ if(($local_channel) && ($local_channel == $owner_id)) {
$sql = '';
}
@@ -226,8 +226,8 @@ function item_permissions_sql($owner_id, $remote_verified = false, $groups = nul
if(defined('STATUSNET_PRIVACY_COMPATIBILITY'))
return '';
- $local_user = local_user();
- $remote_user = remote_user();
+ $local_channel = local_channel();
+ $remote_channel = remote_channel();
/**
* Construct permissions
@@ -241,7 +241,7 @@ function item_permissions_sql($owner_id, $remote_verified = false, $groups = nul
* Profile owner - everything is visible
*/
- if(($local_user) && ($local_user == $owner_id)) {
+ if(($local_channel) && ($local_channel == $owner_id)) {
$sql = '';
}
@@ -408,8 +408,8 @@ function stream_perms_api_uids($perms = NULL ) {
$perms = is_null($perms) ? (PERMS_SITE|PERMS_NETWORK|PERMS_PUBLIC) : $perms;
$ret = array();
- if(local_user())
- $ret[] = local_user();
+ if(local_channel())
+ $ret[] = local_channel();
$r = q("select channel_id from channel where channel_r_stream > 0 and (channel_r_stream & %d)>0 and not (channel_pageflags & %d)>0",
intval($perms),
intval(PAGE_ADULT|PAGE_CENSORED|PAGE_SYSTEM|PAGE_REMOVED)
@@ -437,7 +437,7 @@ function stream_perms_xchans($perms = NULL ) {
$perms = is_null($perms) ? (PERMS_SITE|PERMS_NETWORK|PERMS_PUBLIC) : $perms;
$ret = array();
- if(local_user())
+ if(local_channel())
$ret[] = get_observer_hash();
$r = q("select channel_hash from channel where channel_r_stream > 0 and (channel_r_stream & %d)>0 and not (channel_pageflags & %d)>0",
diff --git a/include/socgraph.php b/include/socgraph.php
index 542ec7074..13957e814 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -426,7 +426,7 @@ function poco($a,$extended = false) {
$system_mode = false;
- if(intval(get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
+ if(intval(get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) {
logger('mod_poco: block_public');
http_status_exit(401);
}
diff --git a/include/text.php b/include/text.php
index cfe87991c..5c8242e79 100644
--- a/include/text.php
+++ b/include/text.php
@@ -96,7 +96,7 @@ function z_input_filter($channel_id,$s,$type = 'text/bbcode') {
intval($channel_id)
);
if($r && (($r[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($r[0]['channel_pageflags'] & PAGE_ALLOWCODE))) {
- if(local_user() && (get_account_id() == $r[0]['account_id'])) {
+ if(local_channel() && (get_account_id() == $r[0]['account_id'])) {
return $s;
}
}
@@ -727,7 +727,7 @@ function contact_block() {
if($shown == 0)
return;
- $is_owner = ((local_user() && local_user() == $a->profile['uid']) ? true : false);
+ $is_owner = ((local_channel() && local_channel() == $a->profile['uid']) ? true : false);
$abook_flags = ABOOK_FLAG_PENDING|ABOOK_FLAG_SELF;
$xchan_flags = XCHAN_FLAGS_ORPHAN|XCHAN_FLAGS_DELETED;
@@ -835,7 +835,7 @@ function search($s,$id='search-box',$url='/search',$save = false) {
'$action_url' => $a->get_baseurl((stristr($url,'network')) ? true : false) . $url,
'$search_label' => t('Search'),
'$save_label' => t('Save'),
- '$savedsearch' => feature_enabled(local_user(),'savedsearch')
+ '$savedsearch' => feature_enabled(local_channel(),'savedsearch')
));
}
@@ -847,7 +847,7 @@ function searchbox($s,$id='search-box',$url='/search',$save = false) {
'$action_url' => z_root() . '/' . $url,
'$search_label' => t('Search'),
'$save_label' => t('Save'),
- '$savedsearch' => feature_enabled(local_user(),'savedsearch')
+ '$savedsearch' => feature_enabled(local_channel(),'savedsearch')
));
}
@@ -1063,7 +1063,7 @@ function smilies($s, $sample = false) {
$a = get_app();
if(intval(get_config('system','no_smilies'))
- || (local_user() && intval(get_pconfig(local_user(),'system','no_smilies'))))
+ || (local_channel() && intval(get_pconfig(local_channel(),'system','no_smilies'))))
return $s;
$s = preg_replace_callback('{<(pre|code)>.*?</\1>}ism','smile_shield',$s);
@@ -1359,7 +1359,7 @@ function prepare_body(&$item,$attach = false) {
$s .= format_categories($item,$writeable);
- if(local_user() == $item['uid'])
+ if(local_channel() == $item['uid'])
$s .= format_filer($item);
$s = sslify($s);
@@ -1466,14 +1466,14 @@ function prepare_text($text,$content_type = 'text/bbcode') {
function zidify_callback($match) {
- $is_zid = ((feature_enabled(local_user(),'sendzid')) || (strpos($match[1],'zrl')) ? true : false);
+ $is_zid = ((feature_enabled(local_channel(),'sendzid')) || (strpos($match[1],'zrl')) ? true : false);
$replace = '<a' . $match[1] . ' href="' . (($is_zid) ? zid($match[2]) : $match[2]) . '"';
$x = str_replace($match[0],$replace,$match[0]);
return $x;
}
function zidify_img_callback($match) {
- $is_zid = ((feature_enabled(local_user(),'sendzid')) || (strpos($match[1],'zrl')) ? true : false);
+ $is_zid = ((feature_enabled(local_channel(),'sendzid')) || (strpos($match[1],'zrl')) ? true : false);
$replace = '<img' . $match[1] . ' src="' . (($is_zid) ? zid($match[2]) : $match[2]) . '"';
$x = str_replace($match[0],$replace,$match[0]);
@@ -1586,7 +1586,7 @@ function mimetype_select($channel_id, $current = 'text/bbcode') {
if($r) {
if(($r[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE) || ($r[0]['channel_pageflags'] & PAGE_ALLOWCODE)) {
- if(local_user() && get_account_id() == $r[0]['account_id'])
+ if(local_channel() && get_account_id() == $r[0]['account_id'])
$x[] = 'application/x-php';
}
}
@@ -2304,7 +2304,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
// access control. The link points to out own channel just so it doesn't look
// weird - as all the other tags are linked to something.
- if(local_user() && local_user() == $profile_uid) {
+ if(local_channel() && local_channel() == $profile_uid) {
require_once('include/group.php');
$grp = group_byname($profile_uid,$name);
diff --git a/include/widgets.php b/include/widgets.php
index 9f9268055..523318850 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -11,7 +11,7 @@ require_once('include/contact_widgets.php');
function widget_profile($args) {
$a = get_app();
- $block = (((get_config('system', 'block_public')) && (! local_user()) && (! remote_user())) ? true : false);
+ $block = (((get_config('system', 'block_public')) && (! local_channel()) && (! remote_channel())) ? true : false);
return profile_sidebar($a->profile, $block, true);
}
@@ -90,7 +90,7 @@ function widget_appselect($arr) {
return replace_macros(get_markup_template('app_select.tpl'),array(
'$title' => t('Apps'),
'$system' => t('System'),
- '$authed' => ((local_user()) ? true : false),
+ '$authed' => ((local_channel()) ? true : false),
'$personal' => t('Personal'),
'$new' => t('Create Personal App'),
'$edit' => t('Edit Personal App')
@@ -100,12 +100,12 @@ function widget_appselect($arr) {
function widget_suggestions($arr) {
- if((! local_user()) || (! feature_enabled(local_user(),'suggest')))
+ if((! local_channel()) || (! feature_enabled(local_channel(),'suggest')))
return '';
require_once('include/socgraph.php');
- $r = suggestion_query(local_user(),get_observer_hash(),0,20);
+ $r = suggestion_query(local_channel(),get_observer_hash(),0,20);
if(! $r) {
return;
@@ -150,7 +150,7 @@ function widget_suggestions($arr) {
function widget_follow($args) {
- if(! local_user())
+ if(! local_channel())
return '';
$a = get_app();
@@ -179,12 +179,12 @@ function widget_follow($args) {
function widget_notes($arr) {
- if(! local_user())
+ if(! local_channel())
return '';
- if(! feature_enabled(local_user(),'private_notes'))
+ if(! feature_enabled(local_channel(),'private_notes'))
return '';
- $text = get_pconfig(local_user(),'notes','text');
+ $text = get_pconfig(local_channel(),'notes','text');
$o = replace_macros(get_markup_template('notes.tpl'), array(
'$banner' => t('Notes'),
@@ -197,7 +197,7 @@ function widget_notes($arr) {
function widget_savedsearch($arr) {
- if((! local_user()) || (! feature_enabled(local_user(),'savedsearch')))
+ if((! local_channel()) || (! feature_enabled(local_channel(),'savedsearch')))
return '';
$a = get_app();
@@ -206,13 +206,13 @@ function widget_savedsearch($arr) {
if(x($_GET,'searchsave') && $search) {
$r = q("select * from `term` where `uid` = %d and `type` = %d and `term` = '%s' limit 1",
- intval(local_user()),
+ intval(local_channel()),
intval(TERM_SAVEDSEARCH),
dbesc($search)
);
if(! $r) {
q("insert into `term` ( `uid`,`type`,`term` ) values ( %d, %d, '%s') ",
- intval(local_user()),
+ intval(local_channel()),
intval(TERM_SAVEDSEARCH),
dbesc($search)
);
@@ -221,7 +221,7 @@ function widget_savedsearch($arr) {
if(x($_GET,'searchremove') && $search) {
q("delete from `term` where `uid` = %d and `type` = %d and `term` = '%s'",
- intval(local_user()),
+ intval(local_channel()),
intval(TERM_SAVEDSEARCH),
dbesc($search)
);
@@ -246,7 +246,7 @@ function widget_savedsearch($arr) {
$o = '';
$r = q("select `tid`,`term` from `term` WHERE `uid` = %d and `type` = %d ",
- intval(local_user()),
+ intval(local_channel()),
intval(TERM_SAVEDSEARCH)
);
@@ -280,7 +280,7 @@ function widget_savedsearch($arr) {
function widget_filer($arr) {
- if(! local_user())
+ if(! local_channel())
return '';
$a = get_app();
@@ -289,7 +289,7 @@ function widget_filer($arr) {
$terms = array();
$r = q("select distinct(term) from term where uid = %d and type = %d order by term asc",
- intval(local_user()),
+ intval(local_channel()),
intval(TERM_FILE)
);
if(! $r)
@@ -362,7 +362,7 @@ function widget_fullprofile($arr) {
if(! $a->profile['profile_uid'])
return;
- $block = (((get_config('system', 'block_public')) && (! local_user()) && (! remote_user())) ? true : false);
+ $block = (((get_config('system', 'block_public')) && (! local_channel()) && (! remote_channel())) ? true : false);
return profile_sidebar($a->profile, $block);
}
@@ -412,13 +412,13 @@ function widget_catcloud_wall($arr) {
function widget_affinity($arr) {
- if(! local_user())
+ if(! local_channel())
return '';
$cmin = ((x($_REQUEST,'cmin')) ? intval($_REQUEST['cmin']) : 0);
$cmax = ((x($_REQUEST,'cmax')) ? intval($_REQUEST['cmax']) : 99);
- if(feature_enabled(local_user(),'affinity')) {
+ if(feature_enabled(local_channel(),'affinity')) {
$tpl = get_markup_template('main_slider.tpl');
$x = replace_macros($tpl,array(
'$val' => $cmin . ',' . $cmax,
@@ -442,7 +442,7 @@ function widget_affinity($arr) {
function widget_settings_menu($arr) {
- if(! local_user())
+ if(! local_channel())
return;
$a = get_app();
@@ -452,10 +452,10 @@ function widget_settings_menu($arr) {
// Retrieve the 'self' address book entry for use in the auto-permissions link
- $role = get_pconfig(local_user(),'system','permissions_role');
+ $role = get_pconfig(local_channel(),'system','permissions_role');
$abk = q("select abook_id from abook where abook_channel = %d and ( abook_flags & %d )>0 limit 1",
- intval(local_user()),
+ intval(local_channel()),
intval(ABOOK_FLAG_SELF)
);
if($abk)
@@ -514,7 +514,7 @@ function widget_settings_menu($arr) {
);
}
- if(feature_enabled(local_user(),'premium_channel')) {
+ if(feature_enabled(local_channel(),'premium_channel')) {
$tabs[] = array(
'label' => t('Premium Channel Settings'),
'url' => $a->get_baseurl(true) . '/connect/' . $channel['channel_address'],
@@ -522,7 +522,7 @@ function widget_settings_menu($arr) {
);
}
- if(feature_enabled(local_user(),'channel_sources')) {
+ if(feature_enabled(local_channel(),'channel_sources')) {
$tabs[] = array(
'label' => t('Channel Sources'),
'url' => $a->get_baseurl(true) . '/sources',
@@ -540,7 +540,7 @@ function widget_settings_menu($arr) {
function widget_mailmenu($arr) {
- if (! local_user())
+ if (! local_channel())
return;
$a = get_app();
@@ -564,13 +564,13 @@ function widget_design_tools($arr) {
$a = get_app();
// mod menu doesn't load a profile. For any modules which load a profile, check it.
- // otherwise local_user() is sufficient for permissions.
+ // otherwise local_channel() is sufficient for permissions.
if($a->profile['profile_uid'])
- if(($a->profile['profile_uid'] != local_user()) && (! $a->is_sys))
+ if(($a->profile['profile_uid'] != local_channel()) && (! $a->is_sys))
return '';
- if(! local_user())
+ if(! local_channel())
return '';
return design_tools();
@@ -642,7 +642,7 @@ function widget_bookmarkedchats($arr) {
$h = get_observer_hash();
if(! $h)
return;
- $r = q("select * from xchat where xchat_xchan = '%s' group by xchat_url order by xchat_desc",
+ $r = q("select xchat_url, xchat_desc from xchat where xchat_xchan = '%s' order by xchat_desc",
dbesc($h)
);
if($r) {
@@ -664,7 +664,7 @@ function widget_suggestedchats($arr) {
$h = get_observer_hash();
if(! $h)
return;
- $r = q("select *, count(xchat_url) as total from xchat group by xchat_url order by total desc, xchat_desc limit 24");
+ $r = q("select xchat_url, xchat_desc, count(xchat_xchan) as total from xchat group by xchat_url, xchat_desc order by total desc, xchat_desc limit 24");
if($r) {
for($x = 0; $x < count($r); $x ++) {
$r[$x]['xchat_url'] = zid($r[$x]['xchat_url']);
diff --git a/include/zot.php b/include/zot.php
index 33ac16abf..f3933d030 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -2438,7 +2438,7 @@ function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) {
logger('packet: ' . print_r($packet,true),LOGGER_DATA);
if(! $uid)
- $uid = local_user();
+ $uid = local_channel();
if(! $uid)
return;