X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=mod%2Fitem.php;h=8bf922d97c6b11164d7bdaa31d1daaf5ffd11476;hb=f146c85e75314462823076a9d89ac2e698e6de45;hp=bcf7a4b4693699db540603e27e4ba72e3e7280ad;hpb=8824da8962396b89aa42c885242bc2b4852a8eba;p=friendica.git diff --git a/mod/item.php b/mod/item.php index bcf7a4b469..8bf922d97c 100644 --- a/mod/item.php +++ b/mod/item.php @@ -29,7 +29,7 @@ require_once 'include/Contact.php'; function item_post(App $a) { - if ((! local_user()) && (! remote_user()) && (! x($_REQUEST,'commenter'))) { + if ((! local_user()) && (! remote_user()) && (! x($_REQUEST, 'commenter'))) { return; } @@ -71,8 +71,8 @@ function item_post(App $a) { } // Is this a reply to something? - $parent = ((x($_REQUEST,'parent')) ? intval($_REQUEST['parent']) : 0); - $parent_uri = ((x($_REQUEST,'parent_uri')) ? trim($_REQUEST['parent_uri']) : ''); + $parent = ((x($_REQUEST, 'parent')) ? intval($_REQUEST['parent']) : 0); + $parent_uri = ((x($_REQUEST, 'parent_uri')) ? trim($_REQUEST['parent_uri']) : ''); $parent_item = null; $parent_contact = null; @@ -85,7 +85,7 @@ function item_post(App $a) { $objecttype = ACTIVITY_OBJ_COMMENT; - if (! x($_REQUEST,'type')) { + if (! x($_REQUEST, 'type')) { $_REQUEST['type'] = 'net-comment'; } @@ -114,7 +114,7 @@ function item_post(App $a) { if (! dbm::is_result($r)) { notice( t('Unable to locate original post.') . EOL); - if (x($_REQUEST,'return')) { + if (x($_REQUEST, 'return')) { goaway($return_path); } killme(); @@ -167,11 +167,11 @@ function item_post(App $a) { logger('mod_item: item_post parent=' . $parent); } - $profile_uid = ((x($_REQUEST,'profile_uid')) ? intval($_REQUEST['profile_uid']) : 0); - $post_id = ((x($_REQUEST,'post_id')) ? intval($_REQUEST['post_id']) : 0); - $app = ((x($_REQUEST,'source')) ? strip_tags($_REQUEST['source']) : ''); - $extid = ((x($_REQUEST,'extid')) ? strip_tags($_REQUEST['extid']) : ''); - $object = ((x($_REQUEST,'object')) ? $_REQUEST['object'] : ''); + $profile_uid = ((x($_REQUEST, 'profile_uid')) ? intval($_REQUEST['profile_uid']) : 0); + $post_id = ((x($_REQUEST, 'post_id')) ? intval($_REQUEST['post_id']) : 0); + $app = ((x($_REQUEST, 'source')) ? strip_tags($_REQUEST['source']) : ''); + $extid = ((x($_REQUEST, 'extid')) ? strip_tags($_REQUEST['extid']) : ''); + $object = ((x($_REQUEST, 'object')) ? $_REQUEST['object'] : ''); // Check for multiple posts with the same message id (when the post was created via API) if (($message_id != '') AND ($profile_uid != 0)) { @@ -325,8 +325,9 @@ function item_post(App $a) { // if using the API, we won't see pubmail_enable - figure out if it should be set if ($api_source && $profile_uid && $profile_uid == local_user() && (! $private)) { - $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1); + $mail_disabled = ((function_exists('imap_open') && (! get_config('system', 'imap_disabled'))) ? 0 : 1); if (! $mail_disabled) { + /// @TODO Check if only pubmail is loaded, * loads all columns $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", intval(local_user()) ); @@ -372,7 +373,7 @@ function item_post(App $a) { $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", intval($_SESSION['uid'])); } elseif(remote_user()) { - if (is_array($_SESSION['remote'])) { + if (x($_SESSION, 'remote') && is_array($_SESSION['remote'])) { foreach ($_SESSION['remote'] as $v) { if ($v['uid'] == $profile_uid) { $contact_id = $v['cid']; @@ -544,7 +545,7 @@ function item_post(App $a) { if ($parent AND ($parent_contact['network'] == NETWORK_OSTATUS)) { $contact = '@[url=' . $parent_contact['url'] . ']' . $parent_contact['nick'] . '[/url]'; - if (!in_array($contact,$tags)) { + if (!in_array($contact, $tags)) { $body = $contact . ' ' . $body; $tags[] = $contact; } @@ -581,6 +582,7 @@ function item_post(App $a) { * Robert Johnson should be first in the $tags array */ $fullnametagged = false; + /// @TODO $tagged is initialized above if() block and is not filled, maybe old-lost code? foreach ($tagged as $nextTag) { if (stristr($nextTag, $tag . ' ')) { $fullnametagged = true; @@ -647,7 +649,7 @@ function item_post(App $a) { // even if the post arrived via API we are considering that it // originated on this site by default for determining relayability. - $origin = ((x($_REQUEST,'origin')) ? intval($_REQUEST['origin']) : 1); + $origin = ((x($_REQUEST, 'origin')) ? intval($_REQUEST['origin']) : 1); $notify_type = (($parent) ? 'comment-new' : 'wall-new' ); @@ -749,7 +751,7 @@ function item_post(App $a) { } $json = array('cancel' => 1); - if (x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload'])) { + if (x($_REQUEST, 'jsreload') && strlen($_REQUEST['jsreload'])) { $json['reload'] = App::get_baseurl() . '/' . $_REQUEST['jsreload']; } @@ -783,7 +785,7 @@ function item_post(App $a) { file_tag_update_pconfig($uid,$categories_old,$categories_new,'category'); proc_run(PRIORITY_HIGH, "include/notifier.php", 'edit_post', $post_id); - if ((x($_REQUEST,'return')) && strlen($return_path)) { + if ((x($_REQUEST, 'return')) && strlen($return_path)) { logger('return: ' . $return_path); goaway($return_path); } @@ -976,7 +978,7 @@ function item_post(App $a) { if (! strlen($addr)) { continue; } - $disclaimer = '
' . sprintf( t('This message was sent to you by %s, a member of the Friendica social network.'),$a->user['username']) + $disclaimer = '
' . sprintf( t('This message was sent to you by %s, a member of the Friendica social network.'), $a->user['username']) . '
'; $disclaimer .= sprintf( t('You may visit them online at %s'), App::get_baseurl() . '/profile/' . $a->user['nickname']) . EOL; $disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL; @@ -1200,9 +1202,9 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n } } else { $r = false; - if (strrpos($name,'+')) { + if (strrpos($name, '+')) { // Is it in format @nick+number? - $tagcid = intval(substr($name,strrpos($name,'+') + 1)); + $tagcid = intval(substr($name, strrpos($name, '+') + 1)); $r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($tagcid), @@ -1271,22 +1273,24 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n $replaced = true; // create profile link - $profile = str_replace(',','%2c',$profile); - $newtag = '@[url='.$profile.']'.$newname.'[/url]'; - $body = str_replace('@'.$name, $newtag, $body); + $profile = str_replace(',', '%2c', $profile); + $newtag = '@[url=' . $profile . ']' . $newname . '[/url]'; + $body = str_replace('@' . $name, $newtag, $body); // append tag to str_tags - if (! stristr($str_tags,$newtag)) { + if (! stristr($str_tags, $newtag)) { if (strlen($str_tags)) { $str_tags .= ','; } $str_tags .= $newtag; } - // Status.Net seems to require the numeric ID URL in a mention if the person isn't - // subscribed to you. But the nickname URL is OK if they are. Grrr. We'll tag both. + /* + * Status.Net seems to require the numeric ID URL in a mention if the person isn't + * subscribed to you. But the nickname URL is OK if they are. Grrr. We'll tag both. + */ if (strlen($alias)) { - $newtag = '@[url='.$alias.']'.$newname.'[/url]'; - if (! stristr($str_tags,$newtag)) { + $newtag = '@[url=' . $alias . ']' . $newname . '[/url]'; + if (! stristr($str_tags, $newtag)) { if (strlen($str_tags)) { $str_tags .= ','; }