Commit 48c87d03 authored by friendica's avatar friendica

local_user, remote_user => local_channel, remote_channel

parent 8f16c598
......@@ -21,7 +21,7 @@ function bookmarker_uninstall() {
function bookmarker_prepare_body(&$a,&$b) {
if(get_pconfig(local_user(),'bookmarker','disable'))
if(get_pconfig(local_channel(),'bookmarker','disable'))
return;
if(! strpos($b['html'],'bookmark-identifier'))
......@@ -31,7 +31,7 @@ function bookmarker_prepare_body(&$a,&$b) {
return;
$id = $b['item']['id'];
if(local_user())
if(local_channel())
$link = '<a class="fakelink" onclick="itemBookmark(' . $id . '); return false;" title="' . t('Save Bookmarks') . '" href="#"><i class="icon-bookmark"></i></a> ';
else
$link = '<i class="icon-bookmark"></i></a> ';
......
......@@ -26,12 +26,12 @@ function diaspora_unload() {
function diaspora_jot_nets(&$a,&$b) {
if((! local_user()) || (! perm_is_allowed(local_user(),'','view_stream')))
if((! local_channel()) || (! perm_is_allowed(local_channel(),'','view_stream')))
return;
$diaspora_post = get_pconfig(local_user(),'diaspora','post');
$diaspora_post = get_pconfig(local_channel(),'diaspora','post');
if(intval($diaspora_post) == 1) {
$diaspora_defpost = get_pconfig(local_user(),'diaspora','post_by_default');
$diaspora_defpost = get_pconfig(local_channel(),'diaspora','post_by_default');
$selected = ((intval($diaspora_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="diaspora_enable"' . $selected . ' value="1" /> <img src="addon/diaspora/diaspora.png" /> ' . t('Post to Diaspora') . '</div>';
}
......@@ -108,7 +108,7 @@ function diaspora_queue_hook(&$a,&$b) {
function diaspora_settings(&$a,&$s) {
if(! local_user())
if(! local_channel())
return;
/* Add our stylesheet to the page so we can make our settings look nice */
......@@ -117,17 +117,17 @@ function diaspora_settings(&$a,&$s) {
/* Get the current state of our config variables */
$enabled = get_pconfig(local_user(),'diaspora','post');
$enabled = get_pconfig(local_channel(),'diaspora','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
$css = (($enabled) ? '' : '-disabled');
$def_enabled = get_pconfig(local_user(),'diaspora','post_by_default');
$def_enabled = get_pconfig(local_channel(),'diaspora','post_by_default');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
$diaspora_username = get_pconfig(local_user(), 'diaspora', 'diaspora_username');
$diaspora_password = get_pconfig(local_user(), 'diaspora', 'diaspora_password');
$diaspora_url = get_pconfig(local_user(), 'diaspora', 'diaspora_url');
$diaspora_username = get_pconfig(local_channel(), 'diaspora', 'diaspora_username');
$diaspora_password = get_pconfig(local_channel(), 'diaspora', 'diaspora_password');
$diaspora_url = get_pconfig(local_channel(), 'diaspora', 'diaspora_url');
$status = "";
......@@ -190,11 +190,11 @@ function diaspora_settings_post(&$a,&$b) {
if(x($_POST,'diaspora-submit')) {
set_pconfig(local_user(),'diaspora','post',intval($_POST['diaspora']));
set_pconfig(local_user(),'diaspora','post_by_default',intval($_POST['diaspora_bydefault']));
set_pconfig(local_user(),'diaspora','diaspora_username',trim($_POST['diaspora_username']));
set_pconfig(local_user(),'diaspora','diaspora_password',trim($_POST['diaspora_password']));
set_pconfig(local_user(),'diaspora','diaspora_url',trim($_POST['diaspora_url']));
set_pconfig(local_channel(),'diaspora','post',intval($_POST['diaspora']));
set_pconfig(local_channel(),'diaspora','post_by_default',intval($_POST['diaspora_bydefault']));
set_pconfig(local_channel(),'diaspora','diaspora_username',trim($_POST['diaspora_username']));
set_pconfig(local_channel(),'diaspora','diaspora_password',trim($_POST['diaspora_password']));
set_pconfig(local_channel(),'diaspora','diaspora_url',trim($_POST['diaspora_url']));
}
......@@ -209,17 +209,17 @@ function diaspora_post_local(&$a,&$b) {
return;
if((! local_user()) || (local_user() != $b['uid']))
if((! local_channel()) || (local_channel() != $b['uid']))
return;
if($b['item_private'])
return;
$diaspora_post = intval(get_pconfig(local_user(),'diaspora','post'));
$diaspora_post = intval(get_pconfig(local_channel(),'diaspora','post'));
$diaspora_enable = (($diaspora_post && x($_REQUEST,'diaspora_enable')) ? intval($_REQUEST['diaspora_enable']) : 0);
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'diaspora','post_by_default')))
if($_REQUEST['api_source'] && intval(get_pconfig(local_channel(),'diaspora','post_by_default')))
$diaspora_enable = 1;
if(! $diaspora_enable)
......
......@@ -30,12 +30,12 @@ function dwpost_unload() {
function dwpost_jot_nets(&$a,&$b) {
if((! local_user()) || (! perm_is_allowed(local_user(),'','view_stream')))
if((! local_channel()) || (! perm_is_allowed(local_channel(),'','view_stream')))
return;
$dw_post = get_pconfig(local_user(),'dwpost','post');
$dw_post = get_pconfig(local_channel(),'dwpost','post');
if(intval($dw_post) == 1) {
$dw_defpost = get_pconfig(local_user(),'dwpost','post_by_default');
$dw_defpost = get_pconfig(local_channel(),'dwpost','post_by_default');
$selected = ((intval($dw_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="dwpost_enable" ' . $selected . ' value="1" /> '
. t('Post to Dreamwidth') . '</div>';
......@@ -45,7 +45,7 @@ function dwpost_jot_nets(&$a,&$b) {
function dwpost_settings(&$a,&$s) {
if(! local_user())
if(! local_channel())
return;
/* Add our stylesheet to the page so we can make our settings look nice */
......@@ -54,16 +54,16 @@ function dwpost_settings(&$a,&$s) {
/* Get the current state of our config variables */
$enabled = get_pconfig(local_user(),'dwpost','post');
$enabled = get_pconfig(local_channel(),'dwpost','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
$def_enabled = get_pconfig(local_user(),'dwpost','post_by_default');
$def_enabled = get_pconfig(local_channel(),'dwpost','post_by_default');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
$dw_username = get_pconfig(local_user(), 'dwpost', 'dw_username');
$dw_password = get_pconfig(local_user(), 'dwpost', 'dw_password');
$dw_username = get_pconfig(local_channel(), 'dwpost', 'dw_username');
$dw_password = get_pconfig(local_channel(), 'dwpost', 'dw_password');
/* Add some HTML to the existing form */
......@@ -103,10 +103,10 @@ function dwpost_settings_post(&$a,&$b) {
if(x($_POST,'dwpost-submit')) {
set_pconfig(local_user(),'dwpost','post',intval($_POST['dwpost']));
set_pconfig(local_user(),'dwpost','post_by_default',intval($_POST['dw_bydefault']));
set_pconfig(local_user(),'dwpost','dw_username',trim($_POST['dw_username']));
set_pconfig(local_user(),'dwpost','dw_password',trim($_POST['dw_password']));
set_pconfig(local_channel(),'dwpost','post',intval($_POST['dwpost']));
set_pconfig(local_channel(),'dwpost','post_by_default',intval($_POST['dw_bydefault']));
set_pconfig(local_channel(),'dwpost','dw_username',trim($_POST['dw_username']));
set_pconfig(local_channel(),'dwpost','dw_password',trim($_POST['dw_password']));
}
......@@ -119,7 +119,7 @@ function dwpost_post_local(&$a,&$b) {
if($b['edit'])
return;
if((! local_user()) || (local_user() != $b['uid']))
if((! local_channel()) || (local_channel() != $b['uid']))
return;
if($b['item_private'] || $b['parent'])
......@@ -127,11 +127,11 @@ function dwpost_post_local(&$a,&$b) {
logger('Dreamwidth xpost invoked');
$dw_post = intval(get_pconfig(local_user(),'dwpost','post'));
$dw_post = intval(get_pconfig(local_channel(),'dwpost','post'));
$dw_enable = (($dw_post && x($_REQUEST,'dwpost_enable')) ? intval($_REQUEST['dwpost_enable']) : 0);
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'dwpost','post_by_default')))
if($_REQUEST['api_source'] && intval(get_pconfig(local_channel(),'dwpost','post_by_default')))
$dw_enable = 1;
if(! $dw_enable)
......
......@@ -63,27 +63,27 @@ function flattrwidget_construct_page(&$a,&$b) {
}
}
function flattrwidget_settings_post($a,$s) {
if(! local_user() || (! x($_POST,'flattrwidget-settings-submit')))
if(! local_channel() || (! x($_POST,'flattrwidget-settings-submit')))
return;
$c = $a->get_channel();
set_pconfig( local_user(), 'flattrwidget', 'align', $_POST['flattrwidget-align'] );
set_pconfig( local_user(), 'flattrwidget', 'sd', $_POST['flattrwidget-static'] );
set_pconfig( local_channel(), 'flattrwidget', 'align', $_POST['flattrwidget-align'] );
set_pconfig( local_channel(), 'flattrwidget', 'sd', $_POST['flattrwidget-static'] );
$thing = $_POST['flattrwidget-thing'];
if ($thing == '') {
$thing = $a->get_baseurl().'/channel/'.$c['channel_address'];
}
set_pconfig( local_user(), 'flattrwidget', 'thing', $thing);
set_pconfig( local_user(), 'flattrwidget', 'user', $_POST['flattrwidget-user']);
set_pconfig( local_channel(), 'flattrwidget', 'thing', $thing);
set_pconfig( local_channel(), 'flattrwidget', 'user', $_POST['flattrwidget-user']);
$ftitle = $_POST['flattrwidget-thingtitle'];
if ($ftitle == '') {
$ftitle = $c['channel_name'].' on The Red Matrix';
}
set_pconfig( local_user(), 'flattrwidget', 'title', $ftitle);
set_pconfig( local_user(), 'flattrwidget', 'enable', intval($_POST['flattrwidget-enable']));
set_pconfig( local_channel(), 'flattrwidget', 'title', $ftitle);
set_pconfig( local_channel(), 'flattrwidget', 'enable', intval($_POST['flattrwidget-enable']));
info(t('Flattr widget settings updated.').EOL);
}
function flattrwidget_settings(&$a,&$s) {
$id = local_user();
$id = local_channel();
if (! $id)
return;
......@@ -93,7 +93,7 @@ function flattrwidget_settings(&$a,&$s) {
$thing = get_pconfig( $id, 'flattrwidget', 'thing');
$user = get_pconfig( $id, 'flattrwidget', 'user');
$ftitle = get_pconfig( $id, 'flattrwidget', 'title');
$enable = intval(get_pconfig(local_user(),'flattrwidget','enable'));
$enable = intval(get_pconfig(local_channel(),'flattrwidget','enable'));
$enable_checked = (($enable) ? ' checked="checked" ' : '');
$s .= '<div class="settings-block">';
......
......@@ -15,10 +15,10 @@ function frphotos_module() {}
function frphotos_init(&$a) {
if(! local_user())
if(! local_channel())
return;
if(intval(get_pconfig(local_user(),'frphotos','complete')))
if(intval(get_pconfig(local_channel(),'frphotos','complete')))
return;
$channel = $a->get_channel();
......@@ -66,7 +66,7 @@ function frphotos_init(&$a) {
}
}
if($total) {
set_pconfig(local_user(),'frphotos','complete','1');
set_pconfig(local_channel(),'frphotos','complete','1');
}
@unlink($cookies);
goaway(z_root() . '/photos/' . $channel['channel_address']);
......@@ -76,12 +76,12 @@ function frphotos_init(&$a) {
function frphotos_content(&$a) {
if(! local_user()) {
if(! local_channel()) {
notice( t('Permission denied') . EOL);
return;
}
if(intval(get_pconfig(local_user(),'frphotos','complete'))) {
if(intval(get_pconfig(local_channel(),'frphotos','complete'))) {
info('Friendica photos have already been imported into this channel.');
return;
}
......
......@@ -30,12 +30,12 @@ function ijpost_unload() {
function ijpost_jot_nets(&$a,&$b) {
if((! local_user()) || (! perm_is_allowed(local_user(),'','view_stream')))
if((! local_channel()) || (! perm_is_allowed(local_channel(),'','view_stream')))
return;
$ij_post = get_pconfig(local_user(),'ijpost','post');
$ij_post = get_pconfig(local_channel(),'ijpost','post');
if(intval($ij_post) == 1) {
$ij_defpost = get_pconfig(local_user(),'ijpost','post_by_default');
$ij_defpost = get_pconfig(local_channel(),'ijpost','post_by_default');
$selected = ((intval($ij_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="ijpost_enable" ' . $selected . ' value="1" /> '
. t('Post to Insanejournal') . '</div>';
......@@ -45,7 +45,7 @@ function ijpost_jot_nets(&$a,&$b) {
function ijpost_settings(&$a,&$s) {
if(! local_user())
if(! local_channel())
return;
/* Add our stylesheet to the page so we can make our settings look nice */
......@@ -54,16 +54,16 @@ function ijpost_settings(&$a,&$s) {
/* Get the current state of our config variables */
$enabled = get_pconfig(local_user(),'ijpost','post');
$enabled = get_pconfig(local_channel(),'ijpost','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
$def_enabled = get_pconfig(local_user(),'ijpost','post_by_default');
$def_enabled = get_pconfig(local_channel(),'ijpost','post_by_default');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
$ij_username = get_pconfig(local_user(), 'ijpost', 'ij_username');
$ij_password = get_pconfig(local_user(), 'ijpost', 'ij_password');
$ij_username = get_pconfig(local_channel(), 'ijpost', 'ij_username');
$ij_password = get_pconfig(local_channel(), 'ijpost', 'ij_password');
/* Add some HTML to the existing form */
......@@ -103,10 +103,10 @@ function ijpost_settings_post(&$a,&$b) {
if(x($_POST,'ijpost-submit')) {
set_pconfig(local_user(),'ijpost','post',intval($_POST['ijpost']));
set_pconfig(local_user(),'ijpost','post_by_default',intval($_POST['ij_bydefault']));
set_pconfig(local_user(),'ijpost','ij_username',trim($_POST['ij_username']));
set_pconfig(local_user(),'ijpost','ij_password',trim($_POST['ij_password']));
set_pconfig(local_channel(),'ijpost','post',intval($_POST['ijpost']));
set_pconfig(local_channel(),'ijpost','post_by_default',intval($_POST['ij_bydefault']));
set_pconfig(local_channel(),'ijpost','ij_username',trim($_POST['ij_username']));
set_pconfig(local_channel(),'ijpost','ij_password',trim($_POST['ij_password']));
info( t('Insane Journal Settings saved.') . EOL);
}
......@@ -119,17 +119,17 @@ function ijpost_post_local(&$a,&$b) {
if($b['edit'])
return;
if((! local_user()) || (local_user() != $b['uid']))
if((! local_channel()) || (local_channel() != $b['uid']))
return;
if($b['item_private'] || $b['parent'])
return;
$ij_post = intval(get_pconfig(local_user(),'ijpost','post'));
$ij_post = intval(get_pconfig(local_channel(),'ijpost','post'));
$ij_enable = (($ij_post && x($_REQUEST,'ijpost_enable')) ? intval($_REQUEST['ijpost_enable']) : 0);
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'ijpost','post_by_default')))
if($_REQUEST['api_source'] && intval(get_pconfig(local_channel(),'ijpost','post_by_default')))
$ij_enable = 1;
if(! $ij_enable)
......
......@@ -245,28 +245,28 @@ function jappixmini_settings(&$a, &$s) {
// addon settings for a user
$activate = get_pconfig(local_user(),'jappixmini','activate');
$activate = get_pconfig(local_channel(),'jappixmini','activate');
$activate = intval($activate) ? ' checked="checked"' : '';
$dontinsertchat = get_pconfig(local_user(),'jappixmini','dontinsertchat');
$dontinsertchat = get_pconfig(local_channel(),'jappixmini','dontinsertchat');
$insertchat = !(intval($dontinsertchat) ? ' checked="checked"' : '');
$defaultbosh = get_config("jappixmini", "bosh_address");
if ($defaultbosh != "")
set_pconfig(local_user(),'jappixmini','bosh', $defaultbosh);
set_pconfig(local_channel(),'jappixmini','bosh', $defaultbosh);
$username = get_pconfig(local_user(),'jappixmini','username');
$username = get_pconfig(local_channel(),'jappixmini','username');
$username = htmlentities($username);
$server = get_pconfig(local_user(),'jappixmini','server');
$server = get_pconfig(local_channel(),'jappixmini','server');
$server = htmlentities($server);
$bosh = get_pconfig(local_user(),'jappixmini','bosh');
$bosh = get_pconfig(local_channel(),'jappixmini','bosh');
$bosh = htmlentities($bosh);
$password = get_pconfig(local_user(),'jappixmini','password');
$autosubscribe = get_pconfig(local_user(),'jappixmini','autosubscribe');
$password = get_pconfig(local_channel(),'jappixmini','password');
$autosubscribe = get_pconfig(local_channel(),'jappixmini','autosubscribe');
$autosubscribe = intval($autosubscribe) ? ' checked="checked"' : '';
$autoapprove = get_pconfig(local_user(),'jappixmini','autoapprove');
$autoapprove = get_pconfig(local_channel(),'jappixmini','autoapprove');
$autoapprove = intval($autoapprove) ? ' checked="checked"' : '';
$encrypt = intval(get_pconfig(local_user(),'jappixmini','encrypt'));
$encrypt = intval(get_pconfig(local_channel(),'jappixmini','encrypt'));
$encrypt_checked = $encrypt ? ' checked="checked"' : '';
$encrypt_disabled = $encrypt ? '' : ' disabled="disabled"';
......@@ -281,12 +281,12 @@ function jappixmini_settings(&$a, &$s) {
$info_text = str_replace("\n", "<br />", $info_text);
// count contacts
$r = q("SELECT COUNT(1) as `cnt` FROM `pconfig` WHERE `uid`=%d AND `cat`='jappixmini' AND `k` LIKE 'id:%%'", local_user());
$r = q("SELECT COUNT(1) as `cnt` FROM `pconfig` WHERE `uid`=%d AND `cat`='jappixmini' AND `k` LIKE 'id:%%'", local_channel());
if (count($r)) $contact_cnt = $r[0]["cnt"];
else $contact_cnt = 0;
// count jabber addresses
$r = q("SELECT COUNT(1) as `cnt` FROM `pconfig` WHERE `uid`=%d AND `cat`='jappixmini' AND `k` LIKE 'id:%%' AND `v` LIKE '%%@%%'", local_user());
$r = q("SELECT COUNT(1) as `cnt` FROM `pconfig` WHERE `uid`=%d AND `cat`='jappixmini' AND `k` LIKE 'id:%%' AND `v` LIKE '%%@%%'", local_channel());
if (count($r)) $address_cnt = $r[0]["cnt"];
else $address_cnt = 0;
......@@ -387,8 +387,8 @@ function jappixmini_settings(&$a, &$s) {
function jappixmini_settings_post(&$a,&$b) {
// save addon settings for a user
if(! local_user()) return;
$uid = local_user();
if(! local_channel()) return;
$uid = local_channel();
$account_id = get_account_id();
if(! $account_id)
......@@ -451,10 +451,10 @@ function jappixmini_settings_post(&$a,&$b) {
function jappixmini_script(&$a,&$s) {
// adds the script to the page header which starts Jappix Mini
if(! local_user()) return;
if(! local_channel()) return;
$activate = get_pconfig(local_user(),'jappixmini','activate');
$dontinsertchat = get_pconfig(local_user(), 'jappixmini','dontinsertchat');
$activate = get_pconfig(local_channel(),'jappixmini','activate');
$dontinsertchat = get_pconfig(local_channel(), 'jappixmini','dontinsertchat');
if (!$activate or $dontinsertchat) return;
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;g=mini.xml"></script>'."\r\n";
......@@ -462,20 +462,20 @@ function jappixmini_script(&$a,&$s) {
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/jappixmini/lib.js"></script>'."\r\n";
$username = get_pconfig(local_user(),'jappixmini','username');
$username = get_pconfig(local_channel(),'jappixmini','username');
$username = str_replace("'", "\\'", $username);
$server = get_pconfig(local_user(),'jappixmini','server');
$server = get_pconfig(local_channel(),'jappixmini','server');
$server = str_replace("'", "\\'", $server);
$bosh = get_pconfig(local_user(),'jappixmini','bosh');
$bosh = get_pconfig(local_channel(),'jappixmini','bosh');
$bosh = str_replace("'", "\\'", $bosh);
$encrypt = get_pconfig(local_user(),'jappixmini','encrypt');
$encrypt = get_pconfig(local_channel(),'jappixmini','encrypt');
$encrypt = intval($encrypt);
$password = get_pconfig(local_user(),'jappixmini','password');
$password = get_pconfig(local_channel(),'jappixmini','password');
$password = str_replace("'", "\\'", $password);
$autoapprove = get_pconfig(local_user(),'jappixmini','autoapprove');
$autoapprove = get_pconfig(local_channel(),'jappixmini','autoapprove');
$autoapprove = intval($autoapprove);
$autosubscribe = get_pconfig(local_user(),'jappixmini','autosubscribe');
$autosubscribe = get_pconfig(local_channel(),'jappixmini','autosubscribe');
$autosubscribe = intval($autosubscribe);
// set proxy if necessary
......@@ -489,7 +489,7 @@ function jappixmini_script(&$a,&$s) {
// get a list of jabber accounts of the contacts
$contacts = Array();
$uid = local_user();
$uid = local_channel();
$rows = q("SELECT * FROM `pconfig` WHERE `uid`=$uid AND `cat`='jappixmini' AND `k` LIKE 'id:%%'");
foreach ($rows as $row) {
$key = $row['k'];
......
......@@ -27,12 +27,12 @@ function libertree_unload() {
function libertree_jot_nets(&$a,&$b) {
if((! local_user()) || (! perm_is_allowed(local_user(),'','view_stream')))
if((! local_channel()) || (! perm_is_allowed(local_channel(),'','view_stream')))
return;
$ltree_post = get_pconfig(local_user(),'libertree','post');
$ltree_post = get_pconfig(local_channel(),'libertree','post');
if(intval($ltree_post) == 1) {
$ltree_defpost = get_pconfig(local_user(),'libertree','post_by_default');
$ltree_defpost = get_pconfig(local_channel(),'libertree','post_by_default');
$selected = ((intval($ltree_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="libertree_enable"' . $selected . ' value="1" /> <img src="addon/libertree/libertree.png" /> ' . t('Post to Libertree') . '</div>';
}
......@@ -41,7 +41,7 @@ function libertree_jot_nets(&$a,&$b) {
function libertree_settings(&$a,&$s) {
if(! local_user())
if(! local_channel())
return;
/* Add our stylesheet to the page so we can make our settings look nice */
......@@ -50,16 +50,16 @@ function libertree_settings(&$a,&$s) {
/* Get the current state of our config variables */
$enabled = get_pconfig(local_user(),'libertree','post');
$enabled = get_pconfig(local_channel(),'libertree','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
$def_enabled = get_pconfig(local_user(),'libertree','post_by_default');
$def_enabled = get_pconfig(local_channel(),'libertree','post_by_default');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
$ltree_api_token = get_pconfig(local_user(), 'libertree', 'libertree_api_token');
$ltree_url = get_pconfig(local_user(), 'libertree', 'libertree_url');
$ltree_api_token = get_pconfig(local_channel(), 'libertree', 'libertree_api_token');
$ltree_url = get_pconfig(local_channel(), 'libertree', 'libertree_url');
/* Add some HTML to the existing form */
......@@ -99,10 +99,10 @@ function libertree_settings_post(&$a,&$b) {
if(x($_POST,'libertree-submit')) {
set_pconfig(local_user(),'libertree','post',intval($_POST['libertree']));
set_pconfig(local_user(),'libertree','post_by_default',intval($_POST['libertree_bydefault']));
set_pconfig(local_user(),'libertree','libertree_api_token',trim($_POST['libertree_api_token']));
set_pconfig(local_user(),'libertree','libertree_url',trim($_POST['libertree_url']));
set_pconfig(local_channel(),'libertree','post',intval($_POST['libertree']));
set_pconfig(local_channel(),'libertree','post_by_default',intval($_POST['libertree_bydefault']));
set_pconfig(local_channel(),'libertree','libertree_api_token',trim($_POST['libertree_api_token']));
set_pconfig(local_channel(),'libertree','libertree_url',trim($_POST['libertree_url']));
info( t('Libertree Settings saved.') . EOL);
}
......@@ -116,17 +116,17 @@ function libertree_post_local(&$a,&$b) {
if($b['edit'])
return;
if((! local_user()) || (local_user() != $b['uid']))
if((! local_channel()) || (local_channel() != $b['uid']))
return;
if($b['item_private'] || ($b['mid'] != $b['parent_mid']))
return;
$ltree_post = intval(get_pconfig(local_user(),'libertree','post'));
$ltree_post = intval(get_pconfig(local_channel(),'libertree','post'));
$ltree_enable = (($ltree_post && x($_REQUEST,'libertree_enable')) ? intval($_REQUEST['libertree_enable']) : 0);
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'libertree','post_by_default')))
if($_REQUEST['api_source'] && intval(get_pconfig(local_channel(),'libertree','post_by_default')))
$ltree_enable = 1;
if(! $ltree_enable)
......
......@@ -23,7 +23,7 @@ function likebanner_init(&$a) {
function likebanner_content(&$a) {
if(local_user()) {
if(local_channel()) {
$channel = $a->get_channel();
}
else
......
......@@ -30,12 +30,12 @@ function ljpost_unload() {
function ljpost_jot_nets(&$a,&$b) {
if((! local_user()) || (! perm_is_allowed(local_user(),'','view_stream')))
if((! local_channel()) || (! perm_is_allowed(local_channel(),'','view_stream')))
return;
$lj_post = get_pconfig(local_user(),'ljpost','post');
$lj_post = get_pconfig(local_channel(),'ljpost','post');
if(intval($lj_post) == 1) {
$lj_defpost = get_pconfig(local_user(),'ljpost','post_by_default');
$lj_defpost = get_pconfig(local_channel(),'ljpost','post_by_default');
$selected = ((intval($lj_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="ljpost_enable" ' . $selected . ' value="1" /> '
. t('Post to LiveJournal') . '</div>';
......@@ -45,7 +45,7 @@ function ljpost_jot_nets(&$a,&$b) {
function ljpost_settings(&$a,&$s) {
if(! local_user())
if(! local_channel())
return;
/* Add our stylesheet to the page so we can make our settings look nice */
......@@ -54,16 +54,16 @@ function ljpost_settings(&$a,&$s) {
/* Get the current state of our config variables */
$enabled = get_pconfig(local_user(),'ljpost','post');
$enabled = get_pconfig(local_channel(),'ljpost','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
$def_enabled = get_pconfig(local_user(),'ljpost','post_by_default');
$def_enabled = get_pconfig(local_channel(),'ljpost','post_by_default');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
$lj_username = get_pconfig(local_user(), 'ljpost', 'lj_username');
$lj_password = get_pconfig(local_user(), 'ljpost', 'lj_password');
$lj_username = get_pconfig(local_channel(), 'ljpost', 'lj_username');
$lj_password = get_pconfig(local_channel(), 'ljpost', 'lj_password');
/* Add some HTML to the existing form */
......@@ -103,10 +103,10 @@ function ljpost_settings_post(&$a,&$b) {
if(x($_POST,'ljpost-submit')) {
set_pconfig(local_user(),'ljpost','post',intval($_POST['ljpost']));
set_pconfig(local_user(),'ljpost','post_by_default',intval($_POST['lj_bydefault']));
set_pconfig(local_user(),'ljpost','lj_username',trim($_POST['lj_username']));
set_pconfig(local_user(),'ljpost','lj_password',trim($_POST['lj_password']));
set_pconfig(local_channel(),'ljpost','post',intval($_POST['ljpost']));
set_pconfig(local_channel(),'ljpost','post_by_default',intval($_POST['lj_bydefault']));
set_pconfig(local_channel(),'ljpost','lj_username',trim($_POST['lj_username']));
set_pconfig(local_channel(),'ljpost','lj_password',trim($_POST['lj_password']));
info( t('Livejournal Settings saved.') . EOL);
}
......@@ -119,17 +119,17 @@ function ljpost_post_local(&$a,&$b) {
if($b['edit'])
return;
if((! local_user()) || (local_user() != $b['uid']))
if((! local_channel()) || (local_channel() != $b['uid']))
return;
if($b['item_private'] || $b['parent'])
return;
$lj_post = intval(get_pconfig(local_user(),'ljpost','post'));
$lj_post = intval(get_pconfig(local_channel(),'ljpost','post'));
$lj_enable = (($lj_post && x($_REQUEST,'ljpost_enable')) ? intval($_REQUEST['ljpost_enable']) : 0);
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'ljpost','post_by_default')))
if($_REQUEST['api_source'] && intval(get_pconfig(local_channel(),'ljpost','post_by_default')))
$lj_enable = 1;
if(! $lj_enable)
......
......@@ -22,14 +22,14 @@ function mailhost_uninstall() {
function mailhost_addon_settings(&$a,&$s) {
if(! local_user())
if(! local_channel())
return;
/* Add our stylesheet to the page so we can make our settings look nice */
head_add_css('/addon/mailhost/mailhost.css');
$mailhost = get_pconfig(local_user(),'system','email_notify_host');
$mailhost = get_pconfig(local_channel(),'system','email_notify_host');
if(! $mailhost)
$mailhost = $a->get_hostname();
......@@ -52,11 +52,11 @@ function mailhost_addon_settings(&$a,&$s) {
function mailhost_addon_settings_post(&$a,&$b) {
if(! local_user())
if(! local_channel())
return;
if($_POST['mailhost-submit']) {
set_pconfig(local_user(),'system','email_notify_host',trim($_POST['mailhost-mailhost']));
set_pconfig(local_channel(),'system','email_notify_host',trim($_POST['mailhost-mailhost']));
info( t('MAILHOST Settings saved.') . EOL);
}
}
......
......@@ -66,10 +66,10 @@ function nsabait_post_hook($a, &$req) {
logger('nsabait 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() != $req['profile_uid']) /* Does this person own the post? */
if(local_channel() != $req['profile_uid']) /* Does this person own the post? */
return;
if($req['parent']) /* If the req has a parent, this is a comment or something else, not a status post. */
......@@ -80,7 +80,7 @@ function nsabait_post_hook($a, &$req) {
/* Retrieve our personal config setting */
$active = get_pconfig(local_user(), 'nsabait', 'enable');
$active = get_pconfig(local_channel(), 'nsabait', 'enable');
if(! $active)
return;
......@@ -118,10 +118,10 @@ function nsabait_post_hook($a, &$req) {
*/
function nsabait_settings_post($a,$post) {
if(! local_user())
if(! local_channel())
return;
if($_POST['nsabait-submit']) {
set_pconfig(local_user(),'nsabait','enable',intval($_POST['nsabait']));
set_pconfig(local_channel(),'nsabait','enable',intval($_POST['nsabait']));
info( t('Nsabait Settings updated.') . EOL);
}
}
......@@ -138,7 +138,7 @@ function nsabait_settings_post($a,$post) {
function nsabait_settings(&$a,&$s) {
if(! local_user())
if(! local_channel())
return;
/* Add our stylesheet to the page so