a couple of places where we need to look for a sys channel euid.

This commit is contained in:
friendica 2014-11-11 18:05:50 -08:00
parent 06e5d0798c
commit 570577a990
2 changed files with 25 additions and 10 deletions

View file

@ -2021,7 +2021,14 @@ function json_decode_plus($s) {
function design_tools() {
$channel = get_app()->get_channel();
if(array_key_exists('sys',$_REQUEST) && $_REQUEST['sys'] == 1 && is_site_admin()) {
require_once('include/identity.php');
$channel = get_sys_channel();
}
$who = $channel['channel_address'];
return replace_macros(get_markup_template('design_tools.tpl'), array(

View file

@ -32,9 +32,17 @@ function item_post(&$a) {
require_once('include/security.php');
$uid = local_user();
$channel = null;
if(array_key_exists('sys',$_REQUEST) && $_REQUEST['sys'] == 1 && is_site_admin()) {
require_once('include/identity.php');
$sys = get_sys_channel();
if($sys && intval($sys['channel_id'])) {
$uid = intval($sys['channel_id']);
$channel = $sys;
}
}
if(x($_REQUEST,'dropitems')) {
require_once('include/items.php');
$arr_drop = explode(',',$_REQUEST['dropitems']);
@ -87,8 +95,8 @@ function item_post(&$a) {
/*
* Check service class limits
*/
if (local_user() && !(x($_REQUEST,'parent')) && !(x($_REQUEST,'post_id'))) {
$ret = item_check_service_class(local_user(),x($_REQUEST,'webpage'));
if ($uid && !(x($_REQUEST,'parent')) && !(x($_REQUEST,'post_id'))) {
$ret = item_check_service_class($uid,x($_REQUEST,'webpage'));
if (!$ret['success']) {
notice( t($ret['message']) . EOL) ;
if(x($_REQUEST,'return'))
@ -129,11 +137,11 @@ function item_post(&$a) {
intval($parent)
);
}
elseif($parent_mid && local_user()) {
elseif($parent_mid && $uid) {
// This is coming from an API source, and we are logged in
$r = q("SELECT * FROM `item` WHERE `mid` = '%s' AND `uid` = %d LIMIT 1",
dbesc($parent_mid),
intval(local_user())
intval($uid)
);
}
// if this isn't the real parent of the conversation, find it
@ -223,7 +231,7 @@ function item_post(&$a) {
if(! $channel) {
if(local_user() && local_user() == $profile_uid) {
if($uid && $uid == $profile_uid) {
$channel = $a->get_channel();
}
else {
@ -446,7 +454,7 @@ function item_post(&$a) {
intval($profile_uid)
);
if($z && ($z[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE)) {
if(local_user() && (get_account_id() == $z[0]['account_id'])) {
if($uid && (get_account_id() == $z[0]['account_id'])) {
$execflag = true;
}
else {
@ -461,7 +469,7 @@ function item_post(&$a) {
if($mimetype === 'text/bbcode') {
if(local_user() && local_user() == $profile_uid && feature_enabled(local_user(),'markdown')) {
if($uid && $uid == $profile_uid && feature_enabled($uid,'markdown')) {
require_once('include/bb2diaspora.php');
$body = diaspora2bb(escape_tags($body),true);
}
@ -594,7 +602,7 @@ function item_post(&$a) {
if($fullnametagged)
continue;
$success = handle_tag($a, $body, $access_tag, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag);
$success = handle_tag($a, $body, $access_tag, $str_tags, ($uid) ? $uid : $profile_uid , $tag);
logger('handle_tag: ' . print_r($success,tue), LOGGER_DATA);
if(($access_tag) && (! $parent_item)) {
logger('access_tag: ' . $tag . ' ' . print_r($access_tag,true), LOGGER_DATA);
@ -797,7 +805,7 @@ function item_post(&$a) {
$datarray['body'] = z_input_filter($datarray['uid'],$datarray['body'],$datarray['mimetype']);
if(local_user()) {
if($uid) {
if($channel['channel_hash'] === $datarray['author_xchan']) {
$datarray['sig'] = base64url_encode(rsa_sign($datarray['body'],$channel['channel_prvkey']));
$datarray['item_flags'] = $datarray['item_flags'] | ITEM_VERIFIED;