Merge branch 'master' into tres

Conflicts:
	include/group.php
	include/text.php
	mod/acl.php
	mod/channel.php
	mod/connections.php
	mod/display.php
	mod/group.php
	mod/item.php
	mod/locs.php
	mod/network.php
	mod/photos.php
	mod/ping.php
	mod/starred.php
	mod/viewsrc.php
This commit is contained in:
friendica 2015-01-29 15:09:35 -08:00
commit 912be23e16
167 changed files with 1001 additions and 954 deletions

View File

@ -1,4 +1,4 @@
url: $baseurl/bookmarks
requires: local_user
requires: local_channel
name: View bookmarks
photo: $baseurl/app/bookmarks.png

View File

@ -1,4 +1,4 @@
url: $baseurl/channel/$nick
requires: local_user
requires: local_channel
name: Channel Home
photo: $baseurl/app/home.png

View File

@ -1,4 +1,4 @@
url: $baseurl/chat/$nick
requires: local_user
requires: local_channel
name: My chatrooms
photo: $baseurl/app/chat.png

View File

@ -1,4 +1,4 @@
url: $baseurl/connections
requires: local_user
requires: local_channel
name: Connections
photo: $baseurl/app/connections.png

View File

@ -1,4 +1,4 @@
url: $baseurl/events
requires: local_user
requires: local_channel
name: Events
photo: $baseurl/app/events.png

View File

@ -1,4 +1,4 @@
url: $baseurl/settings/features
requires: local_user
requires: local_channel
name: Features
photo: $baseurl/app/features.png

View File

@ -1,4 +1,4 @@
url: $baseurl/invite
requires: local_user
requires: local_channel
name: Invite
photo: $baseurl/app/invite.png

View File

@ -1,4 +1,4 @@
url: $baseurl/message
requires: local_user
requires: local_channel
name: Mail
photo: $baseurl/app/mail.png

View File

@ -1,4 +1,4 @@
url: $baseurl/manage
requires: local_user
requires: local_channel
name: Channel Manager
photo: $baseurl/app/manage.png

View File

@ -1,4 +1,4 @@
url: $baseurl/network
requires: local_user
requires: local_channel
name: Matrix
photo: $baseurl/app/matrix.png

View File

@ -1,4 +1,4 @@
url: $baseurl/mood
requires: local_user
requires: local_channel
name: Mood
photo: $baseurl/app/mood.png

View File

@ -1,4 +1,4 @@
url: $baseurl/photos/$nick
requires: local_user
requires: local_channel
name: Photos
photo: $baseurl/app/photos.png

View File

@ -1,4 +1,4 @@
url: $baseurl/poke
requires: local_user
requires: local_channel
name: Poke
photo: $baseurl/app/poke.png

View File

@ -1,4 +1,4 @@
url: $baseurl/profile_photo
requires: local_user
requires: local_channel
name: Profile Photo
photo: $baseurl/app/pphoto.png

View File

@ -1,4 +1,4 @@
url: $baseurl/probe
requires: local_user
requires: local_channel
name: Remote diagnostics
photo: $baseurl/app/probe.png

View File

@ -1,4 +1,4 @@
url: $baseurl/profile/$nick
requires: local_user
requires: local_channel
name: View profile
photo: $baseurl/app/profile.png

View File

@ -1,4 +1,4 @@
url: $baseurl/settings
requires: local_user
requires: local_channel
name: Settings
photo: $baseurl/app/settings.png

View File

@ -1,4 +1,4 @@
url: $baseurl/cloud/$nick
requires: local_user
requires: local_channel
name: Files
photo: $baseurl/app/storage.png

View File

@ -1,4 +1,4 @@
url: $baseurl/suggest
requires: local_user
requires: local_channel
name: Suggest channels
photo: $baseurl/app/suggest.png

View File

@ -1,4 +1,4 @@
url: $baseurl/webpages/$nick
requires: local_user, webpages
requires: local_channel, webpages
name: Webpages
photo: $baseurl/app/webpages.png

View File

@ -958,11 +958,11 @@ class App {
function build_pagehead() {
$user_scalable = ((local_user()) ? get_pconfig(local_user(),'system','user_scalable') : 1);
$user_scalable = ((local_channel()) ? get_pconfig(local_channel(),'system','user_scalable') : 1);
if ($user_scalable === false)
$user_scalable = 1;
$interval = ((local_user()) ? get_pconfig(local_user(),'system','update_interval') : 80000);
$interval = ((local_channel()) ? get_pconfig(local_channel(),'system','update_interval') : 80000);
if($interval < 10000)
$interval = 80000;
@ -977,7 +977,7 @@ class App {
$this->page['htmlhead'] = replace_macros($tpl, array(
'$user_scalable' => $user_scalable,
'$baseurl' => $this->get_baseurl(),
'$local_user' => local_user(),
'$local_channel' => local_channel(),
'$generator' => RED_PLATFORM . ' ' . RED_VERSION,
'$update_interval' => $interval,
'$icon' => head_get_icon(),
@ -1483,7 +1483,7 @@ function login($register = false, $form_id = 'main-login', $hiddens=false) {
$dest_url = $a->get_baseurl(true) . '/' . $a->query_string;
if(local_user()) {
if(local_channel()) {
$tpl = get_markup_template("logout.tpl");
}
else {
@ -1557,25 +1557,37 @@ function get_account_id() {
*
* @return int|bool channel_id or false
*/
function local_user() {
function local_channel() {
if((x($_SESSION, 'authenticated')) && (x($_SESSION, 'uid')))
return intval($_SESSION['uid']);
return false;
}
function local_user() {
// DEPRECATED
return local_channel();
}
/**
* @brief Returns contact id (visitor_id) of authenticated site visitor or false.
*
* @return int|bool visitor_id or false
*/
function remote_user() {
function remote_channel() {
if((x($_SESSION, 'authenticated')) && (x($_SESSION, 'visitor_id')))
return $_SESSION['visitor_id'];
return false;
}
function remote_user() {
// DEPRECATED
return remote_channel();
}
/**
* Contents of $s are displayed prominently on the page the next time
* a page is loaded. Usually used for errors or alerts.
@ -1698,7 +1710,7 @@ function current_theme(){
// Find the theme that belongs to the channel whose stuff we are looking at
if($a->profile_uid && $a->profile_uid != local_user()) {
if($a->profile_uid && $a->profile_uid != local_channel()) {
$r = q("select channel_theme from channel where channel_id = %d limit 1",
intval($a->profile_uid)
);
@ -1713,8 +1725,8 @@ function current_theme(){
// The default is for channel themes to take precedence over your own on pages belonging
// to that channel.
if($page_theme && local_user() && local_user() != $a->profile_url) {
if(get_pconfig(local_user(),'system','always_my_theme'))
if($page_theme && local_channel() && local_channel() != $a->profile_url) {
if(get_pconfig(local_channel(),'system','always_my_theme'))
$page_theme = null;
}

View File

@ -93,10 +93,10 @@ Let's go ahead and add some code to implement our post_local hook handler.
logger('randplace invoked');
if(! local_user()) /* non-zero if this is a logged in user of this system */
if(! local_channel()) /* non-zero if this is a logged in user of this system */
return;
if(local_user() != $item['uid']) /* Does this person own the post? */
if(local_channel() != $item['uid']) /* Does this person own the post? */
return;
if(($item['parent']) || ($item['item_restrict'])) {
@ -106,7 +106,7 @@ Let's go ahead and add some code to implement our post_local hook handler.
/* Retrieve our personal config setting */
$active = get_pconfig(local_user(), 'randplace', 'enable');
$active = get_pconfig(local_channel(), 'randplace', 'enable');
if(! $active)
return;
@ -148,10 +148,10 @@ Now let's add our functions to create and store preference settings.
*/
function randplace_settings_post($a,$post) {
if(! local_user())
if(! local_channel())
return;
if($_POST['randplace-submit'])
set_pconfig(local_user(),'randplace','enable',intval($_POST['randplace']));
set_pconfig(local_channel(),'randplace','enable',intval($_POST['randplace']));
}
@ -175,7 +175,7 @@ Now let's add our functions to create and store preference settings.
function randplace_settings(&$a,&$s) {
if(! local_user())
if(! local_channel())
return;
/* Add our stylesheet to the page so we can make our settings look nice */
@ -184,7 +184,7 @@ Now let's add our functions to create and store preference settings.
/* Get the current state of our config variable */
$enabled = get_pconfig(local_user(),'randplace','enable');
$enabled = get_pconfig(local_channel(),'randplace','enable');
$checked = (($enabled) ? ' checked="checked" ' : '');

View File

@ -7,11 +7,11 @@ Red development - some useful basic functions
Returns numeric account_id if authenticated or 0. It is possible to be authenticated and not connected to a channel.
* local_user()
* local_channel()
Returns authenticated numeric channel_id if authenticated and connected to a channel or 0. Sometimes referred to as $uid in the code.
* remote_user()
* remote_channel()
Returns authenticated string hash of Red global identifier, if authenticated via remote auth, or an empty string.

View File

@ -4,11 +4,11 @@
Returns numeric account_id if authenticated or 0. It is possible to be authenticated and not connected to a channel.
[b]local_user()[/b]
[b]local_channel()[/b]
Returns authenticated numeric channel_id if authenticated and connected to a channel or 0. Sometimes referred to as $uid in the code.
[b]remote_user()[/b]
[b]remote_channel()[/b]
Returns authenticated string hash of Red global identifier, if authenticated via remote auth, or an empty string.

File diff suppressed because one or more lines are too long

View File

@ -32,12 +32,12 @@ var boot_8php =
[ "killme", "boot_8php.html#aea7fc57a4d8e9dcb42f2601b0b9b761c", null ],
[ "load_contact_links", "boot_8php.html#a719c7f3972d5f9268f37a41c76cd4ef6", null ],
[ "load_pdl", "boot_8php.html#a50a6707a28c7d05d3f49eaabc7994501", null ],
[ "local_user", "boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44", null ],
[ "local_channel", "boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44", null ],
[ "login", "boot_8php.html#aefecf8599036df7f1b95d6820e0e2fa4", null ],
[ "notice", "boot_8php.html#a9255af5ae9c887520091ea04763c1a88", null ],
[ "os_mkdir", "boot_8php.html#a5fbebdf7a1c0ea8f904dbd9d78c2c06c", null ],
[ "proc_run", "boot_8php.html#ab346a2ece14993861f3e4206befa94f0", null ],
[ "remote_user", "boot_8php.html#a5542c5c2806ab8bca04bad53d47b5209", null ],
[ "remote_channel", "boot_8php.html#a5542c5c2806ab8bca04bad53d47b5209", null ],
[ "startup", "boot_8php.html#aca47505b8732177f52bb2d647eb2741c", null ],
[ "system_unavailable", "boot_8php.html#ac608a34f3bc180e7724192e0fd31f9b0", null ],
[ "x", "boot_8php.html#ae97836b0547953be182a2334c9c91d3c", null ],

View File

@ -164,7 +164,7 @@ Functions</h2></td></tr>
</tr>
</table>
</div><div class="memdoc">
<p><a class="el" href="comanche_8php.html#aed39ecad69234f3ddf61f0dedb49a58e">comanche_get_channel_id()</a> Returns the channel_id of the profile owner of the page, or the local_user if there is no profile owner. Otherwise returns 0 </p>
<p><a class="el" href="comanche_8php.html#aed39ecad69234f3ddf61f0dedb49a58e">comanche_get_channel_id()</a> Returns the channel_id of the profile owner of the page, or the local_channel if there is no profile owner. Otherwise returns 0 </p>
<p>Referenced by <a class="el" href="comanche_8php.html#a5a7ab801717d38e91ac910b933973887">comanche_block()</a>, <a class="el" href="comanche_8php.html#ad5a44e42231759aba1dda49e0490501e">comanche_menu()</a>, and <a class="el" href="boot_8php.html#a50a6707a28c7d05d3f49eaabc7994501">load_pdl()</a>.</p>

View File

@ -229,7 +229,7 @@ $(document).ready(function(){initNavTree('globals_0x6c.html','');});
<li>local_dir_update()
: <a class="el" href="dir__fns_8php.html#acd37b17dce3bdec6d5a6344a20598c1e">dir_fns.php</a>
</li>
<li>local_user()
<li>local_channel()
: <a class="el" href="boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44">boot.php</a>
</li>
<li>localize_item()

View File

@ -316,7 +316,7 @@ $(document).ready(function(){initNavTree('globals_0x72.html','');});
<li>remote_online_status()
: <a class="el" href="identity_8php.html#a47d6f53216f23a3484061793bef29854">identity.php</a>
</li>
<li>remote_user()
<li>remote_channel()
: <a class="el" href="boot_8php.html#a5542c5c2806ab8bca04bad53d47b5209">boot.php</a>
</li>
<li>remove_all_xchan_resources()

View File

@ -222,7 +222,7 @@ $(document).ready(function(){initNavTree('globals_func_0x6c.html','');});
<li>local_dir_update()
: <a class="el" href="dir__fns_8php.html#acd37b17dce3bdec6d5a6344a20598c1e">dir_fns.php</a>
</li>
<li>local_user()
<li>local_channel()
: <a class="el" href="boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44">boot.php</a>
</li>
<li>localize_item()

View File

@ -273,7 +273,7 @@ $(document).ready(function(){initNavTree('globals_func_0x72.html','');});
<li>remote_online_status()
: <a class="el" href="identity_8php.html#a47d6f53216f23a3484061793bef29854">identity.php</a>
</li>
<li>remote_user()
<li>remote_channel()
: <a class="el" href="boot_8php.html#a5542c5c2806ab8bca04bad53d47b5209">boot.php</a>
</li>
<li>remove_all_xchan_resources()

View File

@ -162,7 +162,7 @@ Functions</h2></td></tr>
<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000002">Todo:</a></b></dt><dd>There are a few places in the code (such as the admin panel) where boolean configurations need to be fixed as of 10/08/2011.</dd></dl>
<ul>
<li><b>config</b> is used for hub specific configurations. It overrides the configurations from .htconfig file. The storage is of size TEXT.</li>
<li><b>pconfig</b> is used for channel specific configurations and takes a <em>channel_id</em> as identifier. It stores for example which features are enabled per channel. The storage is of size MEDIUMTEXT. <div class="fragment"><div class="line">$var = <a class="code" href="include_2config_8php.html#ad58a4913937179adb13201c2ee3261ad" title="Get a particular channel&#39;s config variable given the category name ($family) and a key...">get_pconfig</a>(<a class="code" href="boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44" title="Returns the entity id (channel_id) of locally logged in user or false.">local_user</a>(), <span class="stringliteral">&#39;category&#39;</span>, <span class="stringliteral">&#39;key&#39;</span>);</div>
<li><b>pconfig</b> is used for channel specific configurations and takes a <em>channel_id</em> as identifier. It stores for example which features are enabled per channel. The storage is of size MEDIUMTEXT. <div class="fragment"><div class="line">$var = <a class="code" href="include_2config_8php.html#ad58a4913937179adb13201c2ee3261ad" title="Get a particular channel&#39;s config variable given the category name ($family) and a key...">get_pconfig</a>(<a class="code" href="boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44" title="Returns the entity id (channel_id) of locally logged in user or false.">local_channel</a>(), <span class="stringliteral">&#39;category&#39;</span>, <span class="stringliteral">&#39;key&#39;</span>);</div>
</div><!-- fragment --></li>
<li><b>xconfig</b> is the same as pconfig, except that it uses <em>xchan</em> as an identifier. This is for example for people who do not have a local account. The storage is of size MEDIUMTEXT. <div class="fragment"><div class="line"> $observer = <a class="code" href="typo_8php.html#acebf83966ef6d7e5645a6b62ba368f9f">$a</a>-&gt;get_observer_hash();</div>
<div class="line"><span class="keywordflow">if</span> ($observer) {</div>

View File

@ -144,7 +144,7 @@ Variables</h2></td></tr>
<tr class="separator:a45e6fafa363bc4586fa91dce1786be4f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a02d39b683a42fffbb27823d3860283bd"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="redstrap_2php_2style_8php.html#a02d39b683a42fffbb27823d3860283bd">$site_colour</a> = <a class="el" href="include_2config_8php.html#af02c96e6b37335774b548914ede1d22e">get_config</a>(&quot;redbasic&quot;, &quot;colour&quot; )</td></tr>
<tr class="separator:a02d39b683a42fffbb27823d3860283bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0c4684da834439885ae2285649d1aaea"><td class="memItemLeft" align="right" valign="top">if(<a class="el" href="boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44">local_user</a>()) if($line_height===false) <br class="typebreak"/>
<tr class="memitem:a0c4684da834439885ae2285649d1aaea"><td class="memItemLeft" align="right" valign="top">if(<a class="el" href="boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44">local_channel</a>()) if($line_height===false) <br class="typebreak"/>
if($line_height===false) if($redbasic_font_size===false) <br class="typebreak"/>
if($redbasic_font_size===false) <br class="typebreak"/>
if($colour===false) if($colour===false) <br class="typebreak"/>
@ -365,7 +365,7 @@ if($navcolour===&quot;black&quot;)&#160;</td><td class="memItemRight" valign="bo
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">if (<a class="el" href="boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44">local_user</a>()) if ($line_height===false) if ($line_height===false) if ($redbasic_font_size===false) if ($redbasic_font_size===false) if ($colour===false) if ($colour===false) if ($navcolour===&quot;black&quot;) if(file_exists('view/theme/'.<a class="el" href="boot_8php.html#ad206598b909e8eb67eb0e0bb5ef69c13">current_theme</a>(). '/css/style.css'))</td>
<td class="memname">if (<a class="el" href="boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44">local_channel</a>()) if ($line_height===false) if ($line_height===false) if ($redbasic_font_size===false) if ($redbasic_font_size===false) if ($colour===false) if ($colour===false) if ($navcolour===&quot;black&quot;) if(file_exists('view/theme/'.<a class="el" href="boot_8php.html#ad206598b909e8eb67eb0e0bb5ef69c13">current_theme</a>(). '/css/style.css'))</td>
</tr>
</table>
</div><div class="memdoc">

View File

@ -34,7 +34,7 @@ var searchData=
['load_5ftranslation_5ftable',['load_translation_table',['../language_8php.html#a7e9904c730bb24ddcb0ff50fc96f6b05',1,'language.php']]],
['load_5fxconfig',['load_xconfig',['../include_2config_8php.html#aee4b619839cf4b64220f34edf5c67b52',1,'config.php']]],
['local_5fdir_5fupdate',['local_dir_update',['../dir__fns_8php.html#acd37b17dce3bdec6d5a6344a20598c1e',1,'dir_fns.php']]],
['local_5fuser',['local_user',['../boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44',1,'boot.php']]],
['local_5fuser',['local_channel',['../boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44',1,'boot.php']]],
['localize_5fitem',['localize_item',['../conversation_8php.html#a9bd7f9fb6678736c581bcba3b17f471c',1,'conversation.php']]],
['lockview_2ephp',['lockview.php',['../lockview_8php.html',1,'']]],
['lockview_5fcontent',['lockview_content',['../lockview_8php.html#a851e26ab9a1008df5c5ebebea31e9b44',1,'lockview.php']]],

View File

@ -81,7 +81,7 @@ var searchData=
['reload_5fplugins',['reload_plugins',['../plugin_8php.html#af9ac19004dca49adae1ac7a0d9f3b025',1,'plugin.php']]],
['reltoabs',['reltoabs',['../text_8php.html#ad855a32bee22c3f3b9734e3a334b96f2',1,'text.php']]],
['remote_5fonline_5fstatus',['remote_online_status',['../identity_8php.html#a47d6f53216f23a3484061793bef29854',1,'identity.php']]],
['remote_5fuser',['remote_user',['../boot_8php.html#a5542c5c2806ab8bca04bad53d47b5209',1,'boot.php']]],
['remote_5fuser',['remote_channel',['../boot_8php.html#a5542c5c2806ab8bca04bad53d47b5209',1,'boot.php']]],
['remove_5fall_5fxchan_5fresources',['remove_all_xchan_resources',['../Contact_8php.html#acc12cda999c88c4d6185cca967c15125',1,'Contact.php']]],
['remove_5fchild',['remove_child',['../classItem.html#a2ce70ef63f9f4d86a09c351678806925',1,'Item']]],
['remove_5fcommunity_5ftag',['remove_community_tag',['../zot_8php.html#aad25a3fe0e1566121d6fb8222979bc10',1,'zot.php']]],

View File

@ -27,7 +27,7 @@ var searchData=
['load_5ftranslation_5ftable',['load_translation_table',['../language_8php.html#a7e9904c730bb24ddcb0ff50fc96f6b05',1,'language.php']]],
['load_5fxconfig',['load_xconfig',['../include_2config_8php.html#aee4b619839cf4b64220f34edf5c67b52',1,'config.php']]],
['local_5fdir_5fupdate',['local_dir_update',['../dir__fns_8php.html#acd37b17dce3bdec6d5a6344a20598c1e',1,'dir_fns.php']]],
['local_5fuser',['local_user',['../boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44',1,'boot.php']]],
['local_5fuser',['local_channel',['../boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44',1,'boot.php']]],
['localize_5fitem',['localize_item',['../conversation_8php.html#a9bd7f9fb6678736c581bcba3b17f471c',1,'conversation.php']]],
['lockview_5fcontent',['lockview_content',['../lockview_8php.html#a851e26ab9a1008df5c5ebebea31e9b44',1,'lockview.php']]],
['locs_5fcontent',['locs_content',['../locs_8php.html#a6c900f53970c0d0e738d2fe06d27ca44',1,'locs.php']]],

View File

@ -44,7 +44,7 @@ var searchData=
['reload_5fplugins',['reload_plugins',['../plugin_8php.html#af9ac19004dca49adae1ac7a0d9f3b025',1,'plugin.php']]],
['reltoabs',['reltoabs',['../text_8php.html#ad855a32bee22c3f3b9734e3a334b96f2',1,'text.php']]],
['remote_5fonline_5fstatus',['remote_online_status',['../identity_8php.html#a47d6f53216f23a3484061793bef29854',1,'identity.php']]],
['remote_5fuser',['remote_user',['../boot_8php.html#a5542c5c2806ab8bca04bad53d47b5209',1,'boot.php']]],
['remote_5fuser',['remote_channel',['../boot_8php.html#a5542c5c2806ab8bca04bad53d47b5209',1,'boot.php']]],
['remove_5fall_5fxchan_5fresources',['remove_all_xchan_resources',['../Contact_8php.html#acc12cda999c88c4d6185cca967c15125',1,'Contact.php']]],
['remove_5fchild',['remove_child',['../classItem.html#a2ce70ef63f9f4d86a09c351678806925',1,'Item']]],
['remove_5fcommunity_5ftag',['remove_community_tag',['../zot_8php.html#aad25a3fe0e1566121d6fb8222979bc10',1,'zot.php']]],

View File

@ -144,7 +144,7 @@ Variables</h2></td></tr>
<tr class="separator:a45e6fafa363bc4586fa91dce1786be4f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a02d39b683a42fffbb27823d3860283bd"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="style_8php.html#a02d39b683a42fffbb27823d3860283bd">$site_colour</a> = <a class="el" href="include_2config_8php.html#a5d19130818ea4c6b8726ab62cd989c15">get_config</a>(&quot;redbasic&quot;, &quot;colour&quot; )</td></tr>
<tr class="separator:a02d39b683a42fffbb27823d3860283bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0a473a25349f07563d6c56d14031f02a"><td class="memItemLeft" align="right" valign="top">if(<a class="el" href="boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44">local_user</a>()) if(!<a class="el" href="features_8php.html#a52b5bdfb61b256713efecf7a7b20b0c0">feature_enabled</a>(<a class="el" href="boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44">local_user</a>(),'expert')) <br class="typebreak"/>
<tr class="memitem:a0a473a25349f07563d6c56d14031f02a"><td class="memItemLeft" align="right" valign="top">if(<a class="el" href="boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44">local_channel</a>()) if(!<a class="el" href="features_8php.html#a52b5bdfb61b256713efecf7a7b20b0c0">feature_enabled</a>(<a class="el" href="boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44">local_channel</a>(),'expert')) <br class="typebreak"/>
if($line_height===false) if($line_height===false) <br class="typebreak"/>
if($redbasic_font_size===false) <br class="typebreak"/>
if($redbasic_font_size===false) <br class="typebreak"/>

View File

@ -137,7 +137,7 @@ Variables</h2></td></tr>
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="theme_2mytheme_2php_2default_8php.html#a3987f5547ceb7e36a210a66a06241a5a">if</a> (<a class="el" href="boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44">local_user</a>()) $headimg = <a class="el" href="include_2config_8php.html#af02c96e6b37335774b548914ede1d22e">get_config</a>('blogtheme', 'headimg')</td>
<td class="memname"><a class="el" href="theme_2mytheme_2php_2default_8php.html#a3987f5547ceb7e36a210a66a06241a5a">if</a> (<a class="el" href="boot_8php.html#ad4c9dc2c8a82e8f52b7404c1655eab44">local_channel</a>()) $headimg = <a class="el" href="include_2config_8php.html#af02c96e6b37335774b548914ede1d22e">get_config</a>('blogtheme', 'headimg')</td>
</tr>
</table>
</div><div class="memdoc">

View File

@ -91,10 +91,10 @@ Let's go ahead and add some code to implement our post_local hook handler.
logger('randplace invoked');
if(! local_user()) /* non-zero if this is a logged in user of this system */
if(! local_channel()) /* non-zero if this is a logged in user of this system */
return;
if(local_user() != $item['uid']) /* Does this person own the post? */
if(local_channel() != $item['uid']) /* Does this person own the post? */
return;
if(($item['parent']) || ($item['item_restrict'])) {
@ -104,7 +104,7 @@ Let's go ahead and add some code to implement our post_local hook handler.
/* Retrieve our personal config setting */
$active = get_pconfig(local_user(), 'randplace', 'enable');
$active = get_pconfig(local_channel(), 'randplace', 'enable');
if(! $active)
return;
@ -146,10 +146,10 @@ Now let's add our functions to create and store preference settings.
*/
function randplace_settings_post($a,$post) {
if(! local_user())
if(! local_channel())
return;
if($_POST['randplace-submit'])
set_pconfig(local_user(),'randplace','enable',intval($_POST['randplace']));
set_pconfig(local_channel(),'randplace','enable',intval($_POST['randplace']));
}
@ -173,7 +173,7 @@ Now let's add our functions to create and store preference settings.
function randplace_settings(&amp;$a,&amp;$s) {
if(! local_user())
if(! local_channel())
return;
/* Add our stylesheet to the page so we can make our settings look nice */
@ -182,7 +182,7 @@ Now let's add our functions to create and store preference settings.
/* Get the current state of our config variable */
$enabled = get_pconfig(local_user(),'randplace','enable');
$enabled = get_pconfig(local_channel(),'randplace','enable');
$checked = (($enabled) ? ' checked=&quot;checked&quot; ' : '');

View File

@ -10,7 +10,7 @@ Worth Repeating: Don't use non-standard SQL. This goes for addons as well. If yo
To be written
[code]// Example
$r = q("SELECT * FROM profile WHERE uid = %d",
local_user()
local_channel()
);
[/code][/li]

View File

@ -97,10 +97,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');
@ -345,7 +345,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());

View File

@ -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;

View File

@ -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(

View File

@ -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());
@ -252,7 +252,8 @@ class RedBrowser extends DAV\Browser\Plugin {
'$actionspanel' => $output,
'$shared' => t('Shared'),
'$create' => t('Create'),
'upload' => t('Upload')
'$upload' => t('Upload'),
'$is_owner' => $is_owner
));
$html .= replace_macros(get_markup_template('cloud_directory.tpl'), array(

View File

@ -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 {

View File

@ -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())
);

View File

@ -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_wall'] = 1;

View File

@ -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 ";
}

View File

@ -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') : '')
));
}

View File

@ -990,7 +990,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) {

View File

@ -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);

View File

@ -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)
);

View File

@ -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;
}

View File

@ -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.

View File

@ -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();

View File

@ -421,16 +421,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');
@ -452,7 +452,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) {
@ -483,7 +483,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']));
@ -499,14 +499,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";
}
@ -516,13 +516,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;
@ -536,7 +536,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);
@ -854,7 +854,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'];
@ -890,17 +890,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;';
@ -914,7 +914,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) {
@ -1066,7 +1066,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 = '';
@ -1458,7 +1458,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',
@ -1467,7 +1467,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'] : ''),
@ -1476,7 +1476,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',
@ -1486,7 +1486,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',
@ -1518,7 +1518,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;
@ -1584,7 +1584,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'),

View File

@ -15,8 +15,14 @@ function diaspora_dispatch_public($msg) {
return;
}
// find everybody following or allowing this author
$sys_disabled = true;
if(! get_config('system','disable_discover_tab')) {
$sys_disabled = get_config('system','disable_diaspora_discover_tab');
}
$sys = (($sys_disabled) ? null : get_sys_channel());
// find everybody following or allowing this author
$r = q("SELECT * from channel where channel_id in ( SELECT abook_channel from abook left join xchan on abook_xchan = xchan_hash WHERE xchan_network like '%%diaspora%%' and xchan_addr = '%s' )",
dbesc($msg['author'])
@ -29,6 +35,8 @@ function diaspora_dispatch_public($msg) {
logger('diaspora_public: delivering to: ' . $rr['channel_name'] . ' (' . $rr['channel_address'] . ') ');
diaspora_dispatch($rr,$msg);
}
if($sys)
diaspora_dispatch($sys,$msg);
}
else
logger('diaspora_public: no subscribers');
@ -2153,8 +2161,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;
}
@ -2175,32 +2182,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;

View File

@ -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();

View File

@ -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 xchan_deleted = 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(ABOOK_FLAG_BLOCKED),
intval(ABOOK_FLAG_PENDING)
);
@ -244,7 +244,7 @@ function group_side($every="connections",$each="group",$edit = false, $group_id
$o = '';
if(! local_user())
if(! local_channel())
return '';
$groups = array();
@ -262,7 +262,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)) {

View File

@ -703,7 +703,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
@ -758,8 +758,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'];
}
@ -781,7 +781,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;
@ -822,7 +822,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']);
@ -854,7 +854,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');
@ -863,7 +863,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) {
@ -903,7 +903,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;
}
@ -971,7 +971,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
@ -981,7 +981,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'))
);
@ -1051,7 +1051,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
@ -1060,7 +1060,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'))
);
@ -1284,11 +1284,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
@ -1354,9 +1354,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();
@ -1419,7 +1419,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",
@ -1472,7 +1472,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)
@ -1482,7 +1482,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;
}
@ -1493,7 +1493,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;

View File

@ -1963,7 +1963,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']));
@ -2342,7 +2342,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']));
@ -2838,12 +2838,27 @@ function tag_deliver($uid,$item_id) {
if(preg_match($pattern,$body,$matches))
$tagged = true;
$pattern = '/@\!?\[zrl\=' . preg_quote($term['url'],'/') . '\]' . preg_quote($term['term'] . '+','/') . '\[\/zrl\]/';
if(preg_match($pattern,$body,$matches))
$plustagged = true;
$pattern = '/@\!?\[zrl\=(.*?)\](.*?)\+\[\/zrl\]/';
if(preg_match_all($pattern,$body,$matches,PREG_SET_ORDER)) {
$max_forums = get_config('system','max_tagged_forums');
if(! $max_forums)
$max_forums = 2;
$matched_forums = 0;
foreach($matches as $match) {
$matched_forums ++;
if($term['url'] === $match[1] && $term['term'] === $match[2]) {
if($matched_forums <= $max_forums) {
$plustagged = true;
break;
}
logger('forum ' . $term['term'] . ' exceeded max_tagged_forums - ignoring');
}
}
}
if(! ($tagged || $plustagged)) {
logger('tag_deliver: mention was in a reshare - ignoring');
logger('tag_deliver: mention was in a reshare or exceeded max_tagged_forums - ignoring');
return;
}
@ -2956,6 +2971,7 @@ function tgroup_check($uid,$item) {
}
}
if($mention) {
logger('tgroup_check: mention found for ' . $u[0]['channel_name']);
}
@ -2964,6 +2980,7 @@ function tgroup_check($uid,$item) {
// At this point we've determined that the person receiving this post was mentioned in it.
// Now let's check if this mention was inside a reshare so we don't spam a forum
// note: $term has been set to the matching term
$body = $item['body'];
@ -2975,13 +2992,34 @@ function tgroup_check($uid,$item) {
$body = preg_replace('/\[share(.*?)\[\/share\]/','',$body);
$pattern = '/@\!?\[zrl\=' . preg_quote($term['url'],'/') . '\]' . preg_quote($term['term'] . '+','/') . '\[\/zrl\]/';
// $pattern = '/@\!?\[zrl\=' . preg_quote($term['url'],'/') . '\]' . preg_quote($term['term'] . '+','/') . '\[\/zrl\]/';
if(! preg_match($pattern,$body,$matches)) {
logger('tgroup_check: mention was in a reshare - ignoring');
return false;
$pattern = '/@\!?\[zrl\=(.*?)\](.*?)\+\[\/zrl\]/';
$found = false;
if(preg_match_all($pattern,$body,$matches,PREG_SET_ORDER)) {
$max_forums = get_config('system','max_tagged_forums');
if(! $max_forums)
$max_forums = 2;
$matched_forums = 0;
foreach($matches as $match) {
$matched_forums ++;
if($term['url'] === $match[1] && $term['term'] === $match[2]) {
if($matched_forums <= $max_forums) {
$found = true;
break;
}
logger('forum ' . $term['term'] . ' exceeded max_tagged_forums - ignoring');
}
}
}
if(! $found) {
logger('tgroup_check: mention was in a reshare or exceeded max_tagged_forums - ignoring');
return false;
}
return true;
@ -3897,7 +3935,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)) {
@ -3953,7 +3991,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
@ -4430,7 +4468,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 ) ";

View File

@ -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();
}

View File

@ -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();

View File

@ -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'),

View File

@ -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",

View File

@ -422,7 +422,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);
}

View File

@ -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);
$sql_extra = '';
$abook_flags = ABOOK_FLAG_PENDING|ABOOK_FLAG_SELF;
@ -834,7 +834,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')
));
}
@ -846,7 +846,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')
));
}
@ -1062,7 +1062,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);
@ -1358,7 +1358,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);
@ -1465,14 +1465,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]);
@ -1585,7 +1585,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';
}
}
@ -2303,7 +2303,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);

View File

@ -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']);

View File

@ -1503,7 +1503,7 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$reque
// sent it to us originally. Ignore it if it came from another source
// (with potentially different permissions).
// only compare the last hop since it could have arrived at the last location any number of ways.
// Always accept empty routes.
// Always accept empty routes and firehose items (route contains 'undefined') .
$existing_route = explode(',', $r[0]['route']);
$routes = count($existing_route);
@ -1515,10 +1515,13 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$reque
$last_hop = '';
$last_prior_route = '';
}
if(in_array('undefined',$existing_route) || $last_hop == 'undefined' || $sender['hash'] == 'undefined')
$last_hop = '';
$current_route = (($arr['route']) ? $arr['route'] . ',' : '') . $sender['hash'];
if($last_hop && $last_hop != $sender['hash'] && $sender['hash'] != 'undefined') {
if($last_hop && $last_hop != $sender['hash']) {
logger('comment route mismatch: parent route = ' . $r[0]['route'] . ' expected = ' . $current_route, LOGGER_DEBUG);
logger('comment route mismatch: parent msg = ' . $r[0]['id'],LOGGER_DEBUG);
$result[] = array($d['hash'],'comment route mismatch',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']);
@ -2404,7 +2407,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;

View File

@ -107,7 +107,7 @@ if((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) {
if((x($_GET,'zid')) && (! $a->install)) {
$a->query_string = strip_zids($a->query_string);
if(! local_user()) {
if(! local_channel()) {
$_SESSION['my_address'] = $_GET['zid'];
zid_init($a);
}
@ -377,7 +377,7 @@ if($a->module_loaded) {
if(x($_SESSION,'visitor_home'))
$homebase = $_SESSION['visitor_home'];
elseif(local_user())
elseif(local_channel())
$homebase = $a->get_baseurl() . '/channel/' . $a->channel['channel_address'];
if(isset($homebase))

View File

@ -1540,7 +1540,9 @@ function update_r1133() {
function update_r1134() {
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
$r = q("ALTER TABLE xlink ADD xlink_static numeric(1) NOT NULL DEFAULT '0', create index xlink_static on xlink ( \"xlink_static\" ) ");
$r1 = q("ALTER TABLE xlink ADD xlink_static numeric(1) NOT NULL DEFAULT '0' ");
$r2 = q("create index xlink_static on xlink ( xlink_static ) ");
$r = $r1 && $r2;
}
else
$r = q("ALTER TABLE xlink ADD xlink_static TINYINT( 1 ) NOT NULL DEFAULT '0', ADD INDEX ( xlink_static ) ");

View File

@ -24,7 +24,7 @@ function acl_init(&$a){
$search = $_REQUEST['query'];
}
if(!(local_user()))
if(!(local_channel()))
if(!($type == 'x' || $type == 'c'))
killme();
@ -58,7 +58,7 @@ function acl_init(&$a){
ORDER BY `groups`.`name`
LIMIT %d OFFSET %d",
db_concat('group_member.xchan', ','),
intval(local_user()),
intval(local_channel()),
intval($count),
intval($start)
);
@ -88,14 +88,14 @@ function acl_init(&$a){
$extra_channels_sql = substr($extra_channels_sql,1); // Remove initial comma
// Getting info from the abook is better for local users because it contains info about permissions
if(local_user()) {
if(local_channel()) {
if($extra_channels_sql != '')
$extra_channels_sql = " OR (abook_channel IN ($extra_channels_sql)) and not (abook_flags & ". intval(ABOOK_FLAG_HIDDEN) . ') > 0';
$r = q("SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, abook_their_perms, abook_flags
FROM abook left join xchan on abook_xchan = xchan_hash
WHERE (abook_channel = %d $extra_channels_sql) AND not ( abook_flags & %d )>0 and xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc" ,
intval(local_user()),
intval(local_channel()),
intval(ABOOK_FLAG_BLOCKED|ABOOK_FLAG_PENDING|ABOOK_FLAG_ARCHIVED)
);
}
@ -145,7 +145,7 @@ function acl_init(&$a){
});
}
}
if(intval(get_config('system','taganyone')) || intval(get_pconfig(local_user(),'system','taganyone'))) {
if(intval(get_config('system','taganyone')) || intval(get_pconfig(local_channel(),'system','taganyone'))) {
if((! $r) && $type == 'c') {
$r = q("SELECT substr(xchan_hash,1,18) as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, 0 as abook_their_perms, 0 as abook_flags
FROM xchan
@ -162,7 +162,7 @@ function acl_init(&$a){
and xchan_deleted = 0
$sql_extra3
ORDER BY `xchan_name` ASC ",
intval(local_user()),
intval(local_channel()),
intval(PERMS_W_MAIL)
);
}
@ -173,7 +173,7 @@ function acl_init(&$a){
and xchan_deleted = 0
$sql_extra3
ORDER BY xchan_name ASC ",
intval(local_user())
intval(local_channel())
);
}
@ -257,7 +257,7 @@ function navbar_complete(&$a) {
// logger('navbar_complete');
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) {
return;
}

View File

@ -289,7 +289,7 @@ function admin_page_site_post(&$a){
}
else {
require_once('include/text.php');
linkify_tags($a, $admininfo, local_user());
linkify_tags($a, $admininfo, local_channel());
set_config('system','admininfo', $admininfo);
}
set_config('system','language', $language);

View File

@ -22,12 +22,12 @@ function oauth_get_client($request){
function api_post(&$a) {
if(! local_user()) {
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
return;
}
if(count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_user()) {
if(count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_channel()) {
notice( t('Permission denied.') . EOL);
return;
}
@ -57,8 +57,8 @@ function api_content(&$a) {
if (is_null($app)) return "Invalid request. Unknown token.";
$consumer = new OAuthConsumer($app['client_id'], $app['pw'], $app['redirect_uri']);
$verifier = md5($app['secret'].local_user());
set_config("oauth", $verifier, local_user());
$verifier = md5($app['secret'].local_channel());
set_config("oauth", $verifier, local_channel());
if ($consumer->callback_url!=null) {
@ -84,7 +84,7 @@ function api_content(&$a) {
}
if(! local_user()) {
if(! local_channel()) {
//TODO: we need login form to redirect to this page
notice( t('Please login to continue.') . EOL );
return login(false,'api-login',$request->get_parameters());

View File

@ -4,7 +4,7 @@ require_once('include/apps.php');
function appman_post(&$a) {
if(! local_user())
if(! local_channel())
return;
if($_POST['url']) {
@ -22,9 +22,9 @@ function appman_post(&$a) {
'sig' => escape_tags($_REQUEST['sig'])
);
$_REQUEST['appid'] = app_install(local_user(),$arr);
$_REQUEST['appid'] = app_install(local_channel(),$arr);
if(app_installed(local_user(),$arr))
if(app_installed(local_channel(),$arr))
info( t('App installed.') . EOL);
return;
@ -39,13 +39,13 @@ function appman_post(&$a) {
}
if($_POST['install']) {
app_install(local_user(),$papp);
if(app_installed(local_user(),$papp))
app_install(local_channel(),$papp);
if(app_installed(local_channel(),$papp))
info( t('App installed.') . EOL);
}
if($_POST['delete']) {
app_destroy(local_user(),$papp);
app_destroy(local_channel(),$papp);
}
if($_POST['edit']) {
@ -62,7 +62,7 @@ function appman_post(&$a) {
function appman_content(&$a) {
if(! local_user()) {
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
return;
}
@ -73,7 +73,7 @@ function appman_content(&$a) {
if($_REQUEST['appid']) {
$r = q("select * from app where app_id = '%s' and app_channel = %d limit 1",
dbesc($_REQUEST['appid']),
dbesc(local_user())
dbesc(local_channel())
);
if($r)
$app = $r[0];

View File

@ -13,8 +13,8 @@ function apps_content(&$a) {
$syslist = get_system_apps();
if(local_user()) {
$list = app_list(local_user());
if(local_channel()) {
$list = app_list(local_channel());
if($list) {
foreach($list as $x) {
$syslist[] = app_encode($x);

View File

@ -9,7 +9,7 @@ function authtest_content(&$a) {
$auth_success = false;
$o .= '<h3>Magic-Auth Diagnostic</h3>';
if(! local_user()) {
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
return $o;
}

View File

@ -33,7 +33,7 @@ function blocks_content(&$a) {
$which = argv(1);
$uid = local_user();
$uid = local_channel();
$owner = 0;
$channel = null;
$observer = $a->get_observer();

View File

@ -1,7 +1,7 @@
<?php
function bookmarks_init(&$a) {
if(! local_user())
if(! local_channel())
return;
$item_id = intval($_REQUEST['item']);
if(! $item_id)
@ -11,7 +11,7 @@ function bookmarks_init(&$a) {
$i = q("select * from item where id = %d and uid = %d limit 1",
intval($item_id),
intval(local_user())
intval(local_channel())
);
if(! $i)
@ -42,7 +42,7 @@ function bookmarks_init(&$a) {
}
function bookmarks_content(&$a) {
if(! local_user()) {
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
return;
}
@ -59,11 +59,11 @@ function bookmarks_content(&$a) {
$o .= '<h3>' . t('My Bookmarks') . '</h3>';
$x = menu_list(local_user(),'',MENU_BOOKMARK);
$x = menu_list(local_channel(),'',MENU_BOOKMARK);
if($x) {
foreach($x as $xx) {
$y = menu_fetch($xx['menu_name'],local_user(),get_observer_hash());
$y = menu_fetch($xx['menu_name'],local_channel(),get_observer_hash());
$o .= menu_render($y,'',true);
}
}
@ -71,11 +71,11 @@ function bookmarks_content(&$a) {
$o .= '<h3>' . t('My Connections Bookmarks') . '</h3>';
$x = menu_list(local_user(),'',MENU_SYSTEM|MENU_BOOKMARK);
$x = menu_list(local_channel(),'',MENU_SYSTEM|MENU_BOOKMARK);
if($x) {
foreach($x as $xx) {
$y = menu_fetch($xx['menu_name'],local_user(),get_observer_hash());
$y = menu_fetch($xx['menu_name'],local_channel(),get_observer_hash());
$o .= menu_render($y,'',true);
}
}

View File

@ -15,7 +15,7 @@ function channel_init(&$a) {
if(argc() > 1)
$which = argv(1);
if(! $which) {
if(local_user()) {
if(local_channel()) {
$channel = $a->get_channel();
if($channel && $channel['channel_address'])
$which = $channel['channel_address'];
@ -29,7 +29,7 @@ function channel_init(&$a) {
$profile = 0;
$channel = $a->get_channel();
if((local_user()) && (argc() > 2) && (argv(2) === 'view')) {
if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) {
$which = $channel['channel_address'];
$profile = argv(1);
}
@ -52,7 +52,7 @@ function channel_content(&$a, $update = 0, $load = false) {
$datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : '');
$datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : '');
if(get_config('system','block_public') && (! get_account_id()) && (! remote_user())) {
if(get_config('system','block_public') && (! get_account_id()) && (! remote_channel())) {
return login();
}
@ -68,12 +68,12 @@ function channel_content(&$a, $update = 0, $load = false) {
$a->profile['profile_uid'] = $a->profile_uid = $update;
}
else {
if($a->profile['profile_uid'] == local_user()) {
if($a->profile['profile_uid'] == local_channel()) {
nav_set_selected('home');
}
}
$is_owner = (((local_user()) && ($a->profile['profile_uid'] == local_user())) ? true : false);
$is_owner = (((local_channel()) && ($a->profile['profile_uid'] == local_channel())) ? true : false);
$channel = $a->get_channel();
$observer = $a->get_observer();
@ -181,7 +181,7 @@ function channel_content(&$a, $update = 0, $load = false) {
$sql_extra2 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
}
$itemspage = get_pconfig(local_user(),'system','itemspage');
$itemspage = get_pconfig(local_channel(),'system','itemspage');
$a->set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($a->pager['itemspage']), intval($a->pager['start']));
@ -311,7 +311,7 @@ function channel_content(&$a, $update = 0, $load = false) {
if($is_owner && $update_unseen) {
$r = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 and item_wall = 1 AND uid = %d $update_unseen",
intval(local_user())
intval(local_channel())
);
}

View File

@ -20,11 +20,11 @@ function chanview_content(&$a) {
dbesc($_REQUEST['address'])
);
}
elseif(local_user() && intval($_REQUEST['cid'])) {
elseif(local_channel() && intval($_REQUEST['cid'])) {
$r = q("SELECT abook.*, xchan.*
FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d and abook_id = %d LIMIT 1",
intval(local_user()),
intval(local_channel()),
intval($_REQUEST['cid'])
);
}
@ -90,7 +90,7 @@ function chanview_content(&$a) {
// let somebody over-ride the iframed viewport presentation
// or let's just declare this a failed experiment.
// if((! local_user()) || (get_pconfig(local_user(),'system','chanview_full')))
// if((! local_channel()) || (get_pconfig(local_channel(),'system','chanview_full')))
goaway($url);

View File

@ -9,7 +9,7 @@ function chat_init(&$a) {
if(argc() > 1)
$which = argv(1);
if(! $which) {
if(local_user()) {
if(local_channel()) {
$channel = $a->get_channel();
if($channel && $channel['channel_address'])
$which = $channel['channel_address'];
@ -23,7 +23,7 @@ function chat_init(&$a) {
$profile = 0;
$channel = $a->get_channel();
if((local_user()) && (argc() > 2) && (argv(2) === 'view')) {
if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) {
$which = $channel['channel_address'];
$profile = argv(1);
}
@ -42,7 +42,7 @@ function chat_post(&$a) {
if($_POST['room_name'])
$room = strip_tags(trim($_POST['room_name']));
if((! $room) || (! local_user()))
if((! $room) || (! local_channel()))
return;
$channel = $a->get_channel();
@ -65,7 +65,7 @@ function chat_post(&$a) {
$x = q("select cr_id from chatroom where cr_name = '%s' and cr_uid = %d limit 1",
dbesc($room),
intval(local_user())
intval(local_channel())
);
if($x)
@ -81,7 +81,7 @@ function chat_post(&$a) {
function chat_content(&$a) {
if(local_user())
if(local_channel())
$channel = $a->get_channel();
$ob = $a->get_observer();
@ -169,7 +169,7 @@ function chat_content(&$a) {
}
$o = replace_macros(get_markup_template('chat.tpl'),array(
'$is_owner' => ((local_user() && local_user() == $x[0]['cr_uid']) ? true : false),
'$is_owner' => ((local_channel() && local_channel() == $x[0]['cr_uid']) ? true : false),
'$room_name' => $room_name,
'$room_id' => $room_id,
'$baseurl' => z_root(),
@ -190,7 +190,7 @@ function chat_content(&$a) {
if(local_user() && argc() > 2 && argv(2) === 'new') {
if(local_channel() && argc() > 2 && argv(2) === 'new') {
@ -217,7 +217,7 @@ function chat_content(&$a) {
require_once('include/conversation.php');
$o = profile_tabs($a,((local_user() && local_user() == $a->profile['profile_uid']) ? true : false),$a->profile['channel_address']);
$o = profile_tabs($a,((local_channel() && local_channel() == $a->profile['profile_uid']) ? true : false),$a->profile['channel_address']);
require_once('include/widgets.php');
@ -227,7 +227,7 @@ function chat_content(&$a) {
'$nickname' => $channel['channel_address'],
'$rooms' => widget_chatroom_list(array()),
'$newroom' => t('New Chatroom'),
'$is_owner' => ((local_user() && local_user() == $a->profile['profile_uid']) ? 1 : 0)
'$is_owner' => ((local_channel() && local_channel() == $a->profile['profile_uid']) ? 1 : 0)
));
return $o;

View File

@ -58,7 +58,7 @@ function cloud_init(&$a) {
$ob_hash = get_observer_hash();
if ($ob_hash) {
if (local_user()) {
if (local_channel()) {
$channel = $a->get_channel();
$auth->setCurrentUser($channel['channel_address']);
$auth->channel_id = $channel['channel_id'];

View File

@ -30,7 +30,7 @@ function connect_post(&$a) {
if(! array_key_exists('channel', $a->data))
return;
$edit = ((local_user() && (local_user() == $a->data['channel']['channel_id'])) ? true : false);
$edit = ((local_channel() && (local_channel() == $a->data['channel']['channel_id'])) ? true : false);
if($edit) {
$has_premium = (($a->data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? 1 : 0);
@ -41,7 +41,7 @@ function connect_post(&$a) {
$r = q("update channel set channel_pageflags = ( channel_pageflags %s %d ) where channel_id = %d",
db_getfunc('^'),
intval(PAGE_PREMIUM),
intval(local_user())
intval(local_channel())
);
proc_run('php','include/notifier.php','refresh_all',$a->data['channel']['channel_id']);
}
@ -75,7 +75,7 @@ function connect_post(&$a) {
function connect_content(&$a) {
$edit = ((local_user() && (local_user() == $a->data['channel']['channel_id'])) ? true : false);
$edit = ((local_channel() && (local_channel() == $a->data['channel']['channel_id'])) ? true : false);
$text = get_pconfig($a->data['channel']['channel_id'],'system','selltext');

View File

@ -10,7 +10,7 @@ require_once('include/widgets.php');
function connections_init(&$a) {
if(! local_user())
if(! local_channel())
return;
$channel = $a->get_channel();
@ -21,7 +21,7 @@ function connections_init(&$a) {
function connections_post(&$a) {
if(! local_user())
if(! local_channel())
return;
$contact_id = intval(argv(1));
@ -30,7 +30,7 @@ function connections_post(&$a) {
$orig_record = q("SELECT * FROM abook WHERE abook_id = %d AND abook_channel = %d LIMIT 1",
intval($contact_id),
intval(local_user())
intval(local_channel())
);
if(! $orig_record) {
@ -45,7 +45,7 @@ function connections_post(&$a) {
if($profile_id) {
$r = q("SELECT profile_guid FROM profile WHERE profile_guid = '%s' AND `uid` = %d LIMIT 1",
dbesc($profile_id),
intval(local_user())
intval(local_channel())
);
if(! count($r)) {
notice( t('Could not locate selected profile.') . EOL);
@ -87,7 +87,7 @@ function connections_post(&$a) {
intval($closeness),
intval($abook_flags),
intval($contact_id),
intval(local_user())
intval(local_channel())
);
if($r)
@ -105,9 +105,9 @@ function connections_post(&$a) {
$default_group = $channel['channel_default_group'];
if($default_group) {
require_once('include/group.php');
$g = group_rec_byhash(local_user(),$default_group);
$g = group_rec_byhash(local_channel(),$default_group);
if($g)
group_add_member(local_user(),'',$a->data['abook_xchan'],$g['id']);
group_add_member(local_channel(),'',$a->data['abook_xchan'],$g['id']);
}
@ -127,7 +127,7 @@ function connections_post(&$a) {
$r = q("SELECT abook.*, xchan.*
FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d and abook_id = %d LIMIT 1",
intval(local_user()),
intval(local_channel()),
intval($contact_id)
);
if($r) {
@ -135,7 +135,7 @@ function connections_post(&$a) {
}
if($new_friend) {
$arr = array('channel_id' => local_user(), 'abook' => $a->data['abook']);
$arr = array('channel_id' => local_channel(), 'abook' => $a->data['abook']);
call_hooks('accept_follow', $arr);
}
@ -155,7 +155,7 @@ function connections_clone(&$a) {
unset($clone['abook_account']);
unset($clone['abook_channel']);
build_sync_packet(0 /* use the current local_user */, array('abook' => array($clone)));
build_sync_packet(0 /* use the current local_channel */, array('abook' => array($clone)));
}
@ -165,7 +165,7 @@ function connections_content(&$a) {
$o = '';
if(! local_user()) {
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
return login();
}
@ -215,7 +215,7 @@ function connections_content(&$a) {
break;
case 'ifpending':
$r = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d)>0 and not ((abook_flags & %d)>0 or xchan_deleted = 1 or xchan_orphan = 1)",
intval(local_user()),
intval(local_channel()),
intval(ABOOK_FLAG_PENDING),
intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED)
);
@ -338,12 +338,12 @@ function connections_content(&$a) {
$sql_extra .= (($searching) ? protect_sprintf(" AND xchan_name like '%$search_txt%' ") : "");
if($_REQUEST['gid']) {
$sql_extra .= " and xchan_hash in ( select xchan from group_member where gid = " . intval($_REQUEST['gid']) . " and uid = " . intval(local_user()) . " ) ";
$sql_extra .= " and xchan_hash in ( select xchan from group_member where gid = " . intval($_REQUEST['gid']) . " and uid = " . intval(local_channel()) . " ) ";
}
$r = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash
where abook_channel = %d and not (abook_flags & %d)>0 and xchan_deleted = 0 and xchan_orphan = 0 $sql_extra $sql_extra2 ",
intval(local_user()),
intval(local_channel()),
intval(ABOOK_FLAG_SELF)
);
if($r) {
@ -353,7 +353,7 @@ function connections_content(&$a) {
$r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash
WHERE abook_channel = %d and not (abook_flags & %d)>0 and xchan_deleted = 0 and xchan_orphan = 0 $sql_extra $sql_extra2 ORDER BY xchan_name LIMIT %d OFFSET %d ",
intval(local_user()),
intval(local_channel()),
intval(ABOOK_FLAG_SELF),
intval($a->pager['itemspage']),
intval($a->pager['start'])

View File

@ -21,14 +21,14 @@ require_once('include/widgets.php');
function connedit_init(&$a) {
if(! local_user())
if(! local_channel())
return;
if((argc() >= 2) && intval(argv(1))) {
$r = q("SELECT abook.*, xchan.*
FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d and abook_id = %d LIMIT 1",
intval(local_user()),
intval(local_channel()),
intval(argv(1))
);
if($r) {
@ -48,7 +48,7 @@ function connedit_init(&$a) {
function connedit_post(&$a) {
if(! local_user())
if(! local_channel())
return;
$contact_id = intval(argv(1));
@ -66,7 +66,7 @@ function connedit_post(&$a) {
$orig_record = q("SELECT * FROM abook WHERE abook_id = %d AND abook_channel = %d LIMIT 1",
intval($contact_id),
intval(local_user())
intval(local_channel())
);
if(! $orig_record) {
@ -89,7 +89,7 @@ function connedit_post(&$a) {
if($profile_id) {
$r = q("SELECT profile_guid FROM profile WHERE profile_guid = '%s' AND `uid` = %d LIMIT 1",
dbesc($profile_id),
intval(local_user())
intval(local_channel())
);
if(! count($r)) {
notice( t('Could not locate selected profile.') . EOL);
@ -143,7 +143,7 @@ function connedit_post(&$a) {
dbesc($rating_text),
intval($abook_flags),
intval($contact_id),
intval(local_user())
intval(local_channel())
);
if($orig_record[0]['abook_profile'] != $profile_id) {
@ -171,9 +171,9 @@ function connedit_post(&$a) {
$default_group = $channel['channel_default_group'];
if($default_group) {
require_once('include/group.php');
$g = group_rec_byhash(local_user(),$default_group);
$g = group_rec_byhash(local_channel(),$default_group);
if($g)
group_add_member(local_user(),'',$a->poi['abook_xchan'],$g['id']);
group_add_member(local_channel(),'',$a->poi['abook_xchan'],$g['id']);
}
// Check if settings permit ("post new friend activity" is allowed, and
@ -227,7 +227,7 @@ function connedit_post(&$a) {
$r = q("SELECT abook.*, xchan.*
FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d and abook_id = %d LIMIT 1",
intval(local_user()),
intval(local_channel()),
intval($contact_id)
);
if($r) {
@ -235,12 +235,12 @@ function connedit_post(&$a) {
}
if($new_friend) {
$arr = array('channel_id' => local_user(), 'abook' => $a->poi);
$arr = array('channel_id' => local_channel(), 'abook' => $a->poi);
call_hooks('accept_follow', $arr);
}
if(! is_null($autoperms))
set_pconfig(local_user(),'system','autoperms',(($autoperms) ? $abook_my_perms : 0));
set_pconfig(local_channel(),'system','autoperms',(($autoperms) ? $abook_my_perms : 0));
connedit_clone($a);
@ -263,7 +263,7 @@ function connedit_clone(&$a) {
unset($clone['abook_account']);
unset($clone['abook_channel']);
build_sync_packet(0 /* use the current local_user */, array('abook' => array($clone)));
build_sync_packet(0 /* use the current local_channel */, array('abook' => array($clone)));
}
/* @brief Generate content of connection edit page
@ -276,13 +276,13 @@ function connedit_content(&$a) {
$sort_type = 0;
$o = '';
if(! local_user()) {
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
return login();
}
$my_perms = get_channel_default_perms(local_user());
$role = get_pconfig(local_user(),'system','permissions_role');
$my_perms = get_channel_default_perms(local_channel());
$role = get_pconfig(local_channel(),'system','permissions_role');
if($role) {
$x = get_role_perms($role);
if($x['perms_accept'])
@ -315,7 +315,7 @@ function connedit_content(&$a) {
$orig_record = 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 & %d )>0 LIMIT 1",
intval($contact_id),
intval(local_user()),
intval(local_channel()),
intval(ABOOK_FLAG_SELF)
);
@ -414,8 +414,8 @@ function connedit_content(&$a) {
// in the background there could be a race condition preventing this packet from being sent in all cases.
// PLACEHOLDER
contact_remove(local_user(), $orig_record[0]['abook_id']);
build_sync_packet(0 /* use the current local_user */,
contact_remove(local_channel(), $orig_record[0]['abook_id']);
build_sync_packet(0 /* use the current local_channel */,
array('abook' => array(array(
'abook_xchan' => $orig_record[0]['abook_xchan'],
'entry_deleted' => true))
@ -514,7 +514,7 @@ function connedit_content(&$a) {
$tpl = get_markup_template("abook_edit.tpl");
if(feature_enabled(local_user(),'affinity')) {
if(feature_enabled(local_channel(),'affinity')) {
$slider_tpl = get_markup_template('contact_slider.tpl');
$slide = replace_macros($slider_tpl,array(
@ -549,7 +549,7 @@ function connedit_content(&$a) {
$channel = $a->get_channel();
$global_perms = get_perms();
$existing = get_all_perms(local_user(),$contact['abook_xchan']);
$existing = get_all_perms(local_channel(),$contact['abook_xchan']);
$unapproved = array('pending', t('Approve this connection'), '', t('Accept connection to allow communication'));
@ -568,7 +568,7 @@ function connedit_content(&$a) {
$o .= replace_macros($tpl,array(
'$header' => (($self) ? t('Connection Default Permissions') : sprintf( t('Connections: settings for %s'),$contact['xchan_name'])),
'$autoperms' => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_user(),'system','autoperms')) ? 1 : 0), ''),
'$autoperms' => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), ''),
'$addr' => $contact['xchan_addr'],
'$notself' => (($self) ? '' : '1'),
'$self' => (($self) ? '1' : ''),
@ -613,7 +613,7 @@ function connedit_content(&$a) {
'$permnote' => t('Some permissions may be inherited from your channel <a href="settings">privacy settings</a>, which have higher priority than individual settings. Changing those inherited settings on this page will have no effect.'),
'$advanced' => t('Advanced Permissions'),
'$quick' => t('Simple Permissions (select one and submit)'),
'$common_link' => $a->get_baseurl(true) . '/common/loc/' . local_user() . '/' . $contact['id'],
'$common_link' => $a->get_baseurl(true) . '/common/loc/' . local_channel() . '/' . $contact['id'],
'$all_friends' => $all_friends,
'$relation_text' => $relation_text,
'$visit' => sprintf( t('Visit %s\'s profile - %s'),$contact['xchan_name'],$contact['xchan_url']),
@ -632,7 +632,7 @@ function connedit_content(&$a) {
'$last_update' => relative_date($contact['abook_connected']),
'$udnow' => t('Update now'),
'$profile_select' => contact_profile_assign($contact['abook_profile']),
'$multiprofs' => feature_enabled(local_user(),'multi_profiles'),
'$multiprofs' => feature_enabled(local_channel(),'multi_profiles'),
'$contact_id' => $contact['abook_id'],
'$block_text' => (($contact['blocked']) ? t('Unblock') : t('Block') ),
'$ignore_text' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ),

View File

@ -4,14 +4,14 @@ require_once('include/group.php');
function contactgroup_content(&$a) {
if(! local_user()) {
if(! local_channel()) {
killme();
}
if((argc() > 2) && (intval(argv(1))) && (argv(2))) {
$r = q("SELECT abook_xchan from abook where abook_xchan = '%s' and abook_channel = %d and not ( abook_flags & %d )>0 limit 1",
dbesc(base64url_decode(argv(2))),
intval(local_user()),
intval(local_channel()),
intval(ABOOK_FLAG_SELF)
);
if($r)
@ -22,7 +22,7 @@ function contactgroup_content(&$a) {
$r = q("SELECT * FROM `groups` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1",
intval(argv(1)),
intval(local_user())
intval(local_channel())
);
if(! $r) {
killme();
@ -38,10 +38,10 @@ function contactgroup_content(&$a) {
if($change) {
if(in_array($change,$preselected)) {
group_rmv_member(local_user(),$group['name'],$change);
group_rmv_member(local_channel(),$group['name'],$change);
}
else {
group_add_member(local_user(),$group['name'],$change);
group_add_member(local_channel(),$group['name'],$change);
}
}
}

View File

@ -59,7 +59,7 @@ function dav_init(&$a) {
$ob_hash = get_observer_hash();
if ($ob_hash) {
if (local_user()) {
if (local_channel()) {
$channel = $a->get_channel();
$auth->setCurrentUser($channel['channel_address']);
$auth->channel_id = $channel['channel_id'];

View File

@ -2,7 +2,7 @@
function delegate_content(&$a) {
if(! local_user()) {
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
return;
}
@ -22,13 +22,13 @@ function delegate_content(&$a) {
);
if(count($r)) {
$r = q("select id from contact where uid = %d and nurl = '%s' limit 1",
intval(local_user()),
intval(local_channel()),
dbesc(normalise_link($a->get_baseurl() . '/channel/' . $r[0]['nickname']))
);
if(count($r)) {
q("insert into manage ( uid, mid ) values ( %d , %d ) ",
intval($a->argv[2]),
intval(local_user())
intval(local_channel())
);
}
}
@ -44,7 +44,7 @@ function delegate_content(&$a) {
q("delete from manage where uid = %d and mid = %d",
intval($a->argv[2]),
intval(local_user())
intval(local_channel())
);
goaway($a->get_baseurl() . '/delegate');
@ -66,7 +66,7 @@ function delegate_content(&$a) {
// find everybody that currently has delegated management to this account/page
$r = q("select * from user where uid in ( select uid from manage where mid = %d ) ",
intval(local_user())
intval(local_channel())
);
if(count($r))
@ -87,7 +87,7 @@ function delegate_content(&$a) {
$r = q("select nurl from contact where substring_index(contact.nurl,'/',3) = '%s'
and contact.uid = %d and contact.self = 0 and network = '%s' ",
dbesc(normalise_link($a->get_baseurl())),
intval(local_user()),
intval(local_channel()),
dbesc(NETWORK_DFRN)
);

View File

@ -10,7 +10,7 @@ function directory_init(&$a) {
if(x($_GET,'ignore')) {
q("insert into xign ( uid, xchan ) values ( %d, '%s' ) ",
intval(local_user()),
intval(local_channel()),
dbesc($_GET['ignore'])
);
}
@ -18,7 +18,7 @@ function directory_init(&$a) {
function directory_content(&$a) {
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) {
notice( t('Public access denied.') . EOL);
return;
}
@ -51,17 +51,17 @@ function directory_content(&$a) {
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
if(strpos($search,'=') && local_user() && get_pconfig(local_user(),'feature','expert'))
if(strpos($search,'=') && local_channel() && get_pconfig(local_channel(),'feature','expert'))
$advanced = $search;
$keywords = (($_GET['keywords']) ? $_GET['keywords'] : '');
// Suggest channels if no search terms or keywords are given
$suggest = (local_user() && x($_REQUEST,'suggest')) ? $_REQUEST['suggest'] : '';
$suggest = (local_channel() && x($_REQUEST,'suggest')) ? $_REQUEST['suggest'] : '';
if($suggest) {
$r = suggestion_query(local_user(),get_observer_hash());
$r = suggestion_query(local_channel(),get_observer_hash());
// Remember in which order the suggestions were
$addresses = array();
@ -96,9 +96,9 @@ function directory_content(&$a) {
$contacts = array();
if(local_user()) {
if(local_channel()) {
$x = q("select abook_xchan from abook where abook_channel = %d",
intval(local_user())
intval(local_channel())
);
if($x) {
foreach($x as $xx)
@ -161,7 +161,7 @@ function directory_content(&$a) {
$profile_link = chanlink_url($rr['url']);
$pdesc = (($rr['description']) ? $rr['description'] . '<br />' : '');
$connect_link = ((local_user()) ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : '');
$connect_link = ((local_channel()) ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : '');
// Checking status is disabled ATM until someone checks the performance impact more carefully
//$online = remote_online_status($rr['address']);
@ -219,9 +219,9 @@ function directory_content(&$a) {
$karr = explode(' ', $keywords);
if($karr) {
if(local_user()) {
if(local_channel()) {
$r = q("select keywords from profile where uid = %d and is_default = 1 limit 1",
intval(local_user())
intval(local_channel())
);
if($r) {
$keywords = str_replace(',',' ', $r[0]['keywords']);

View File

@ -5,7 +5,7 @@ function display_content(&$a, $update = 0, $load = false) {
// logger("mod-display: update = $update load = $load");
if(intval(get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
if(intval(get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) {
notice( t('Public access denied.') . EOL);
return;
}
@ -36,7 +36,7 @@ function display_content(&$a, $update = 0, $load = false) {
$observer_is_owner = false;
if(local_user() && (! $update)) {
if(local_channel() && (! $update)) {
$channel = $a->get_channel();
@ -58,7 +58,7 @@ function display_content(&$a, $update = 0, $load = false) {
'acl' => populate_acl($channel_acl),
'bang' => '',
'visitor' => true,
'profile_uid' => local_user(),
'profile_uid' => local_channel(),
'return_path' => 'channel/' . $channel['channel_address']
);
@ -109,7 +109,7 @@ function display_content(&$a, $update = 0, $load = false) {
$o .= '<div id="live-display"></div>' . "\r\n";
$o .= "<script> var profile_uid = " . ((intval(local_user())) ? local_user() : (-1))
$o .= "<script> var profile_uid = " . ((intval(local_channel())) ? local_channel() : (-1))
. "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
$a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
@ -160,13 +160,13 @@ function display_content(&$a, $update = 0, $load = false) {
$sys = get_sys_channel();
$sysid = $sys['channel_id'];
if(local_user()) {
if(local_channel()) {
$r = q("SELECT * from item
WHERE item_restrict = 0
and uid = %d
and mid = '%s'
limit 1",
intval(local_user()),
intval(local_channel()),
dbesc($target_item['parent_mid'])
);
if($r) {
@ -232,7 +232,7 @@ function display_content(&$a, $update = 0, $load = false) {
if($updateable) {
$x = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 AND uid = %d and parent = %d ",
intval(local_user()),
intval(local_channel()),
intval($r[0]['parent'])
);
}

View File

@ -33,7 +33,7 @@ function editblock_content(&$a) {
$which = argv(1);
$uid = local_user();
$uid = local_channel();
$owner = 0;
$channel = null;
$observer = $a->get_observer();

View File

@ -32,7 +32,7 @@ function editlayout_content(&$a) {
$which = argv(1);
$uid = local_user();
$uid = local_channel();
$owner = 0;
$channel = null;
$observer = $a->get_observer();

View File

@ -9,7 +9,7 @@ function editpost_content(&$a) {
$o = '';
if(! local_user()) {
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
return;
}
@ -23,7 +23,7 @@ function editpost_content(&$a) {
$itm = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d and author_xchan = '%s' LIMIT 1",
intval($post_id),
intval(local_user()),
intval(local_channel()),
dbesc(get_observer_hash())
);
@ -33,7 +33,7 @@ function editpost_content(&$a) {
}
$plaintext = true;
// if(feature_enabled(local_user(),'richtext'))
// if(feature_enabled(local_channel(),'richtext'))
// $plaintext = false;
$channel = $a->get_channel();
@ -77,7 +77,7 @@ function editpost_content(&$a) {
$category = '';
$catsenabled = ((feature_enabled(local_user(),'categories')) ? 'categories' : '');
$catsenabled = ((feature_enabled(local_channel(),'categories')) ? 'categories' : '');
if ($catsenabled){
$itm = fetch_post_tags($itm);
@ -136,8 +136,8 @@ function editpost_content(&$a) {
'$lockstate' => $lockstate,
'$acl' => '',
'$bang' => '',
'$profile_uid' => local_user(),
'$preview' => true, // ((feature_enabled(local_user(),'preview')) ? t('Preview') : ''),
'$profile_uid' => local_channel(),
'$preview' => true, // ((feature_enabled(local_channel(),'preview')) ? t('Preview') : ''),
'$jotplugins' => $jotplugins,
'$sourceapp' => t($a->sourcename),
'$catsenabled' => $catsenabled,

View File

@ -32,7 +32,7 @@ function editwebpage_content(&$a) {
$which = argv(1);
$uid = local_user();
$uid = local_channel();
$owner = 0;
$channel = null;
$observer = $a->get_observer();

View File

@ -8,14 +8,14 @@ require_once('include/items.php');
function events_post(&$a) {
if(! local_user())
if(! local_channel())
return;
$event_id = ((x($_POST,'event_id')) ? intval($_POST['event_id']) : 0);
$event_hash = ((x($_POST,'event_hash')) ? $_POST['event_hash'] : '');
$xchan = ((x($_POST,'xchan')) ? dbesc($_POST['xchan']) : '');
$uid = local_user();
$uid = local_channel();
$start_text = escape_tags($_REQUEST['start_text']);
$finish_text = escape_tags($_REQUEST['finish_text']);
@ -76,8 +76,8 @@ function events_post(&$a) {
$type = 'event';
require_once('include/text.php');
linkify_tags($a, $desc, local_user());
linkify_tags($a, $location, local_user());
linkify_tags($a, $desc, local_channel());
linkify_tags($a, $location, local_channel());
$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";
@ -98,7 +98,7 @@ function events_post(&$a) {
if($event_id) {
$x = q("select * from event where id = %d and uid = %d limit 1",
intval($event_id),
intval(local_user())
intval(local_channel())
);
if(! $x) {
notice( t('Event not found.') . EOL);
@ -166,7 +166,7 @@ function events_post(&$a) {
$datarray['type'] = $type;
$datarray['adjust'] = $adjust;
$datarray['nofinish'] = $nofinish;
$datarray['uid'] = local_user();
$datarray['uid'] = local_channel();
$datarray['account'] = get_account_id();
$datarray['event_xchan'] = $channel['channel_hash'];
$datarray['allow_cid'] = $str_contact_allow;
@ -195,7 +195,7 @@ function events_post(&$a) {
function events_content(&$a) {
if(! local_user()) {
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
return;
}
@ -205,21 +205,21 @@ function events_content(&$a) {
if((argc() > 2) && (argv(1) === 'ignore') && intval(argv(2))) {
$r = q("update event set ignore = 1 where id = %d and uid = %d",
intval(argv(2)),
intval(local_user())
intval(local_channel())
);
}
if((argc() > 2) && (argv(1) === 'unignore') && intval(argv(2))) {
$r = q("update event set ignore = 0 where id = %d and uid = %d",
intval(argv(2)),
intval(local_user())
intval(local_channel())
);
}
$plaintext = true;
// if(feature_enabled(local_user(),'richtext'))
// if(feature_enabled(local_channel(),'richtext'))
// $plaintext = false;
@ -265,7 +265,7 @@ function events_content(&$a) {
}
if($mode === 'add') {
event_addtocal($item_id,local_user());
event_addtocal($item_id,local_channel());
killme();
}
@ -326,7 +326,7 @@ function events_content(&$a) {
if (x($_GET,'id')){
$r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan
from event left join item on resource_id = event_hash where resource_type = 'event' and event.uid = %d and event.id = %d limit 1",
intval(local_user()),
intval(local_channel()),
intval($_GET['id'])
);
} else {
@ -341,7 +341,7 @@ function events_content(&$a) {
where resource_type = 'event' and event.uid = %d and event.ignore = %d
AND (( `adjust` = 0 AND ( `finish` >= '%s' or nofinish = 1 ) AND `start` <= '%s' )
OR ( `adjust` = 1 AND ( `finish` >= '%s' or nofinish = 1 ) AND `start` <= '%s' )) ",
intval(local_user()),
intval(local_channel()),
intval($ignored),
dbesc($start),
dbesc($finish),
@ -463,7 +463,7 @@ function events_content(&$a) {
if($mode === 'edit' && $event_id) {
$r = q("SELECT * FROM `event` WHERE event_hash = '%s' AND `uid` = %d LIMIT 1",
dbesc($event_id),
intval(local_user())
intval(local_channel())
);
if(count($r))
$orig_event = $r[0];
@ -534,14 +534,14 @@ function events_content(&$a) {
if(! $f)
$f = 'ymd';
$catsenabled = feature_enabled(local_user(),'categories');
$catsenabled = feature_enabled(local_channel(),'categories');
$category = '';
if($catsenabled && x($orig_event)){
$itm = q("select * from item where resource_type = 'event' and resource_id = '%s' and uid = %d limit 1",
dbesc($orig_event['event_hash']),
intval(local_user())
intval(local_channel())
);
$itm = fetch_post_tags($itm);
if($itm) {

View File

@ -12,7 +12,7 @@ require_once('include/photo/photo_driver.php');
*/
function fbrowser_content($a){
if (!local_user())
if (!local_channel())
killme();
if ($a->argc==1)
@ -29,7 +29,7 @@ function fbrowser_content($a){
if ($a->argc==2){
$albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d ",
intval(local_user())
intval(local_channel())
);
// anon functions only from 5.3.0... meglio tardi che mai..
function folder1($el){return array(bin2hex($el['album']),$el['album']);}
@ -48,7 +48,7 @@ function fbrowser_content($a){
$r = q("SELECT `resource_id`, `id`, `filename`, type, min(`scale`) AS `hiq`,max(`scale`) AS `loq`, `description`
FROM `photo` WHERE `uid` = %d $sql_extra
GROUP BY `resource_id` $sql_extra2",
intval(local_user())
intval(local_channel())
);
function files1($rr){
@ -87,7 +87,7 @@ function fbrowser_content($a){
case "file":
if ($a->argc==2){
$files = q("SELECT id, filename, filetype FROM `attach` WHERE `uid` = %d ",
intval(local_user())
intval(local_channel())
);
function files2($rr){ global $a;

View File

@ -7,7 +7,7 @@ require_once('include/items.php');
function filer_content(&$a) {
if(! local_user()) {
if(! local_channel()) {
killme();
}
@ -18,25 +18,25 @@ function filer_content(&$a) {
if($item_id && strlen($term)){
// file item
store_item_tag(local_user(),$item_id,TERM_OBJ_POST,TERM_FILE,$term,'');
store_item_tag(local_channel(),$item_id,TERM_OBJ_POST,TERM_FILE,$term,'');
// protect the entire conversation from periodic expiration
$r = q("select parent from item where id = %d and uid = %d limit 1",
intval($item_id),
intval(local_user())
intval(local_channel())
);
if($r) {
$x = q("update item set item_retained = 1 where id = %d and uid = %d",
intval($r[0]['parent']),
intval(local_user())
intval(local_channel())
);
}
}
else {
$filetags = 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(count($r)) {

View File

@ -2,7 +2,7 @@
function filerm_content(&$a) {
if(! local_user()) {
if(! local_channel()) {
killme();
}
@ -19,7 +19,7 @@ function filerm_content(&$a) {
if($item_id && strlen($term)) {
$r = q("delete from term where uid = %d and type = %d and oid = %d and term = '%s'",
intval(local_user()),
intval(local_channel()),
intval(($category) ? TERM_CATEGORY : TERM_FILE),
intval($item_id),
dbesc($term)

Some files were not shown because too many files have changed in this diff Show More