X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fitem.php;h=ffac1c8e445deb4dddb6c824212d77d83b7bb3fe;hb=3359f3f5c7ecc4b6a34c4fcfc095ab4dd5fab0f1;hp=8bf922d97c6b11164d7bdaa31d1daaf5ffd11476;hpb=49527b70d34cfc899b8ba1a3876a14bb11ed9e8a;p=friendica.git diff --git a/mod/item.php b/mod/item.php index 8bf922d97c..ffac1c8e44 100644 --- a/mod/item.php +++ b/mod/item.php @@ -1,4 +1,7 @@ ')) { + $private_forum = false; + $only_to_forum = true; + $private_id = $success['contact']['id']; + $forum_contact = $success['contact']; + } + } + } + + $original_contact_id = $contact_id; + + if (!$parent && count($forum_contact) && ($private_forum || $only_to_forum)) { + // we tagged a forum in a top level post. Now we change the post + $private = $private_forum; + + $str_group_allow = ''; + $str_contact_deny = ''; + $str_group_deny = ''; + if ($private_forum) { + $str_contact_allow = '<' . $private_id . '>'; + } else { + $str_contact_allow = ''; + } + $contact_id = $private_id; + $contact_record = $forum_contact; + $_REQUEST['origin'] = false; + } + /* * When a photo was uploaded into the message using the (profile wall) ajax * uploader, The permissions are initially set to disallow anybody but the @@ -428,22 +545,22 @@ function item_post(App $a) { $match = null; - if ((! $preview) && preg_match_all("/\[img([\=0-9x]*?)\](.*?)\[\/img\]/",$body,$match)) { + if (!$preview && preg_match_all("/\[img([\=0-9x]*?)\](.*?)\[\/img\]/",$body,$match)) { $images = $match[2]; if (count($images)) { $objecttype = ACTIVITY_OBJ_IMAGE; foreach ($images as $image) { - if (! stristr($image,App::get_baseurl() . '/photo/')) { + if (!stristr($image, System::baseUrl() . '/photo/')) { continue; } $image_uri = substr($image,strrpos($image,'/') + 1); $image_uri = substr($image_uri,0, strpos($image_uri,'-')); - if (! strlen($image_uri)) { + if (!strlen($image_uri)) { continue; } - $srch = '<' . intval($contact_id) . '>'; + $srch = '<' . intval($original_contact_id) . '>'; $r = q("SELECT `id` FROM `photo` WHERE `allow_cid` = '%s' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = '' AND `resource-id` = '%s' AND `uid` = %d LIMIT 1", @@ -452,7 +569,7 @@ function item_post(App $a) { intval($profile_uid) ); - if (! dbm::is_result($r)) { + if (! DBM::is_result($r)) { continue; } @@ -464,7 +581,7 @@ function item_post(App $a) { dbesc($str_group_deny), dbesc($image_uri), intval($profile_uid), - dbesc( t('Wall Photos')) + dbesc(t('Wall Photos')) ); } } @@ -484,7 +601,7 @@ function item_post(App $a) { intval($profile_uid), intval($attach) ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $r = q("UPDATE `attach` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' WHERE `uid` = %d AND `id` = %d", dbesc($str_contact_allow), @@ -503,7 +620,7 @@ function item_post(App $a) { $bookmark = 0; $data = get_attachment_data($body); - if (preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $body, $match, PREG_SET_ORDER) OR isset($data["type"])) { + if (preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $body, $match, PREG_SET_ORDER) || isset($data["type"])) { $objecttype = ACTIVITY_OBJ_BOOKMARK; $bookmark = 1; } @@ -522,95 +639,16 @@ function item_post(App $a) { require_once 'include/plaintext.php'; $objectdata = get_attached_data($body); - if ($post["type"] == "link") { + if ($objectdata["type"] == "link") { $objecttype = ACTIVITY_OBJ_BOOKMARK; - } elseif ($post["type"] == "video") { + } elseif ($objectdata["type"] == "video") { $objecttype = ACTIVITY_OBJ_VIDEO; - } elseif ($post["type"] == "photo") { + } elseif ($objectdata["type"] == "photo") { $objecttype = ACTIVITY_OBJ_IMAGE; } } - // Look for any tags and linkify them - $str_tags = ''; - $inform = ''; - - $tags = get_tags($body); - - /* - * add a statusnet style reply tag if the original post was from there - * and we are replying, and there isn't one already - */ - if ($parent AND ($parent_contact['network'] == NETWORK_OSTATUS)) { - $contact = '@[url=' . $parent_contact['url'] . ']' . $parent_contact['nick'] . '[/url]'; - - if (!in_array($contact, $tags)) { - $body = $contact . ' ' . $body; - $tags[] = $contact; - } - - $toplevel_contact = ""; - $toplevel_parent = q("SELECT `contact`.* FROM `contact` - INNER JOIN `item` ON `item`.`contact-id` = `contact`.`id` AND `contact`.`url` = `item`.`author-link` - WHERE `item`.`id` = `item`.`parent` AND `item`.`parent` = %d", intval($parent)); - if (dbm::is_result($toplevel_parent)) { - $toplevel_contact = '@' . $toplevel_parent[0]['nick'] . '+' . $toplevel_parent[0]['id']; - } else { - $toplevel_parent = q("SELECT `author-link`, `author-name` FROM `item` WHERE `id` = `parent` AND `parent` = %d", intval($parent)); - $toplevel_contact = '@[url=' . $toplevel_parent[0]['author-link'] . ']' . $toplevel_parent[0]['author-name'] . '[/url]'; - } - - if (!in_array($toplevel_contact, $tags)) { - $tags[] = $toplevel_contact; - } - } - - $tagged = array(); - - $private_forum = false; - - if (count($tags)) { - foreach ($tags as $tag) { - - if (strpos($tag, '#') === 0) { - continue; - } - - /* - * If we already tagged 'Robert Johnson', don't try and tag 'Robert'. - * 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; - break; - } - } - if ($fullnametagged) { - continue; - } - - $success = handle_tag($a, $body, $inform, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag, $network); - if ($success['replaced']) { - $tagged[] = $tag; - } - if (is_array($success['contact']) && intval($success['contact']['prv'])) { - $private_forum = true; - $private_id = $success['contact']['id']; - } - } - } - - if (($private_forum) && (! $parent) && (! $private)) { - // we tagged a private forum in a top level post and the message was public. - // Restrict it. - $private = 1; - $str_contact_allow = '<' . $private_id . '>'; - } - $attachments = ''; $match = false; @@ -620,11 +658,11 @@ function item_post(App $a) { intval($profile_uid), intval($mtch) ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { if (strlen($attachments)) { $attachments .= ','; } - $attachments .= '[attach]href="' . App::get_baseurl() . '/attach/' . $r[0]['id'] . '" length="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . (($r[0]['filename']) ? $r[0]['filename'] : '') . '"[/attach]'; + $attachments .= '[attach]href="' . System::baseUrl() . '/attach/' . $r[0]['id'] . '" length="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . (($r[0]['filename']) ? $r[0]['filename'] : '') . '"[/attach]'; } $body = str_replace($match[1],'',$body); } @@ -632,7 +670,7 @@ function item_post(App $a) { $wall = 0; - if ($post_type === 'wall' || $post_type === 'wall-comment') { + if (($post_type === 'wall' || $post_type === 'wall-comment') && !count($forum_contact)) { $wall = 1; } @@ -670,11 +708,11 @@ function item_post(App $a) { $datarray['owner-name'] = $contact_record['name']; $datarray['owner-link'] = $contact_record['url']; $datarray['owner-avatar'] = $contact_record['thumb']; - $datarray['owner-id'] = get_contact($datarray['owner-link'], 0); + $datarray['owner-id'] = Contact::getIdForURL($datarray['owner-link'], 0); $datarray['author-name'] = $author['name']; $datarray['author-link'] = $author['url']; $datarray['author-avatar'] = $author['thumb']; - $datarray['author-id'] = get_contact($datarray['author-link'], 0); + $datarray['author-id'] = Contact::getIdForURL($datarray['author-link'], 0); $datarray['created'] = datetime_convert(); $datarray['edited'] = datetime_convert(); $datarray['commented'] = datetime_convert(); @@ -705,7 +743,7 @@ function item_post(App $a) { $datarray['postopts'] = $postopts; $datarray['origin'] = $origin; $datarray['moderated'] = $allow_moderated; - $datarray['gcontact-id'] = get_gcontact_id(array("url" => $datarray['author-link'], "network" => $datarray['network'], + $datarray['gcontact-id'] = GlobalContact::getId(array("url" => $datarray['author-link'], "network" => $datarray['network'], "photo" => $datarray['author-avatar'], "name" => $datarray['author-name'])); $datarray['object'] = $object; @@ -718,11 +756,26 @@ function item_post(App $a) { $datarray['self'] = $self; // $datarray['prvnets'] = $user['prvnets']; + // This triggers posts via API and the mirror functions + $datarray['api_source'] = $api_source; + $datarray['parent-uri'] = ($parent == 0) ? $uri : $parent_item['uri']; - $datarray['plink'] = App::get_baseurl() . '/display/' . urlencode($datarray['guid']); + $datarray['plink'] = System::baseUrl() . '/display/' . urlencode($datarray['guid']); $datarray['last-child'] = 1; $datarray['visible'] = 1; + $datarray['protocol'] = PROTOCOL_DFRN; + + $r = dba::fetch_first("SELECT `conversation-uri`, `conversation-href` FROM `conversation` WHERE `item-uri` = ?", $datarray['parent-uri']); + if (DBM::is_result($r)) { + if ($r['conversation-uri'] != '') { + $datarray['conversation-uri'] = $r['conversation-uri']; + } + if ($r['conversation-href'] != '') { + $datarray['conversation-href'] = $r['conversation-href']; + } + } + if ($orig_post) { $datarray['edit'] = true; } @@ -752,7 +805,7 @@ function item_post(App $a) { $json = array('cancel' => 1); if (x($_REQUEST, 'jsreload') && strlen($_REQUEST['jsreload'])) { - $json['reload'] = App::get_baseurl() . '/' . $_REQUEST['jsreload']; + $json['reload'] = System::baseUrl() . '/' . $_REQUEST['jsreload']; } echo json_encode($json); @@ -762,6 +815,8 @@ function item_post(App $a) { // Fill the cache field put_item_in_cache($datarray); + $datarray = store_conversation($datarray); + if ($orig_post) { $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `attach` = '%s', `file` = '%s', `rendered-html` = '%s', `rendered-hash` = '%s', `edited` = '%s', `changed` = '%s' WHERE `id` = %d AND `uid` = %d", dbesc($datarray['title']), @@ -784,7 +839,7 @@ function item_post(App $a) { // update filetags in pconfig file_tag_update_pconfig($uid,$categories_old,$categories_new,'category'); - proc_run(PRIORITY_HIGH, "include/notifier.php", 'edit_post', $post_id); + Worker::add(PRIORITY_HIGH, "Notifier", 'edit_post', $post_id); if ((x($_REQUEST, 'return')) && strlen($return_path)) { logger('return: ' . $return_path); goaway($return_path); @@ -794,8 +849,7 @@ function item_post(App $a) { $post_id = 0; } - q("COMMIT"); - q("START TRANSACTION;"); + dba::transaction(); $r = q("INSERT INTO `item` (`guid`, `extid`, `uid`,`type`,`wall`,`gravity`, `network`, `contact-id`, `owner-name`,`owner-link`,`owner-avatar`, `owner-id`, @@ -872,20 +926,15 @@ function item_post(App $a) { intval($datarray['visible']) ); - if (dbm::is_result($r)) { - $r = q("SELECT LAST_INSERT_ID() AS `item-id`"); - if (dbm::is_result($r)) { - $post_id = $r[0]['item-id']; - } else { - $post_id = 0; - } + if (DBM::is_result($r)) { + $post_id = dba::lastInsertId(); } else { logger('mod_item: unable to create post.'); $post_id = 0; } if ($post_id == 0) { - q("COMMIT"); + dba::commit(); logger('mod_item: unable to retrieve post that was just stored.'); notice(t('System error. Post not saved.') . EOL); goaway($return_path); @@ -926,7 +975,7 @@ function item_post(App $a) { 'to_email' => $user['email'], 'uid' => $user['uid'], 'item' => $datarray, - 'link' => App::get_baseurl().'/display/'.urlencode($datarray['guid']), + 'link' => System::baseUrl().'/display/'.urlencode($datarray['guid']), 'source_name' => $datarray['author-name'], 'source_link' => $datarray['author-link'], 'source_photo' => $datarray['author-avatar'], @@ -940,7 +989,7 @@ function item_post(App $a) { // Store the comment signature information in case we need to relay to Diaspora - Diaspora::store_comment_signature($datarray, $author, ($self ? $user['prvkey'] : false), $post_id); + Diaspora::storeCommentSignature($datarray, $author, ($self ? $user['prvkey'] : false), $post_id); } else { $parent = $post_id; @@ -949,7 +998,7 @@ function item_post(App $a) { intval($parent), intval($post_id)); - if ($contact_record != $author) { + if (($contact_record != $author) && !count($forum_contact)) { notification(array( 'type' => NOTIFY_WALL, 'notify_flags' => $user['notify-flags'], @@ -958,7 +1007,7 @@ function item_post(App $a) { 'to_email' => $user['email'], 'uid' => $user['uid'], 'item' => $datarray, - 'link' => App::get_baseurl().'/display/'.urlencode($datarray['guid']), + 'link' => System::baseUrl().'/display/'.urlencode($datarray['guid']), 'source_name' => $datarray['author-name'], 'source_link' => $datarray['author-link'], 'source_photo' => $datarray['author-avatar'], @@ -980,25 +1029,25 @@ function item_post(App $a) { } $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 .= sprintf( t('You may visit them online at %s'), System::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; if (!$datarray['title']=='') { - $subject = email_header_encode($datarray['title'], 'UTF-8'); + $subject = Email::encodeHeader($datarray['title'], 'UTF-8'); } else { - $subject = email_header_encode('[Friendica]' . ' ' . sprintf( t('%s posted an update.'), $a->user['username']), 'UTF-8'); + $subject = Email::encodeHeader('[Friendica]' . ' ' . sprintf( t('%s posted an update.'), $a->user['username']), 'UTF-8'); } - $link = '' . $a->user['username'] . '

'; + $link = '' . $a->user['username'] . '

'; $html = prepare_body($datarray); $message = '' . $link . $html . $disclaimer . ''; include_once 'include/html2plain.php'; $params = array ( - 'fromName' => $a->user['username'], - 'fromEmail' => $a->user['email'], - 'toEmail' => $addr, - 'replyTo' => $a->user['email'], - 'messageSubject' => $subject, - 'htmlVersion' => $message, - 'textVersion' => html2plain($html.$disclaimer), + 'fromName' => $a->user['username'], + 'fromEmail' => $a->user['email'], + 'toEmail' => $addr, + 'replyTo' => $a->user['email'], + 'messageSubject' => $subject, + 'htmlVersion' => $message, + 'textVersion' => html2plain($html.$disclaimer) ); Emailer::send($params); } @@ -1011,7 +1060,7 @@ function item_post(App $a) { update_thread($parent, true); } - q("COMMIT"); + dba::commit(); create_tags_from_item($post_id); create_files_from_item($post_id); @@ -1020,14 +1069,14 @@ function item_post(App $a) { // We now do it in the background to save some time. // This is important in interactive environments like the frontend or the API. // We don't fork a new process since this is done anyway with the following command - proc_run(array('priority' => PRIORITY_HIGH, 'dont_fork' => true), "include/create_shadowentry.php", $post_id); + Worker::add(array('priority' => PRIORITY_HIGH, 'dont_fork' => true), "CreateShadowEntry", $post_id); // Call the background process that is delivering the item to the receivers - proc_run(PRIORITY_HIGH, "include/notifier.php", $notify_type, $post_id); + Worker::add(PRIORITY_HIGH, "Notifier", $notify_type, $post_id); logger('post_complete'); - item_post_return(App::get_baseurl(), $api_source, $return_path); + item_post_return(System::baseUrl(), $api_source, $return_path); // NOTREACHED } @@ -1089,15 +1138,15 @@ function item_content(App $a) { * * @return boolean true if replaced, false if not replaced */ -function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $network = "") { - require_once 'include/Scrape.php'; - require_once 'include/socgraph.php'; - +function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $network = "") +{ $replaced = false; $r = null; + $tag_type = '@'; //is it a person tag? - if (strpos($tag, '@') === 0) { + if ((strpos($tag, '@') === 0) || (strpos($tag, '!') === 0)) { + $tag_type = substr($tag, 0, 1); //is it already replaced? if (strpos($tag, '[url=')) { //append tag to str_tags @@ -1109,19 +1158,19 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n } // Checking for the alias that is used for OStatus - $pattern = "/@\[url\=(.*?)\](.*?)\[\/url\]/ism"; + $pattern = "/[@!]\[url\=(.*?)\](.*?)\[\/url\]/ism"; if (preg_match($pattern, $tag, $matches)) { $r = q("SELECT `alias`, `name` FROM `contact` WHERE `nurl` = '%s' AND `alias` != '' AND `uid` = 0", normalise_link($matches[1])); - if (!dbm::is_result($r)) { + if (!DBM::is_result($r)) { $r = q("SELECT `alias`, `name` FROM `gcontact` WHERE `nurl` = '%s' AND `alias` != ''", normalise_link($matches[1])); } - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $data = $r[0]; } else { - $data = probe_url($matches[1]); + $data = Probe::uri($matches[1]); } if ($data["alias"] != "") { @@ -1151,7 +1200,7 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n // Is it in format @user@domain.tld or @http://domain.tld/...? // First check the contact table for the address - $r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network`, `notify` FROM `contact` + $r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network`, `notify`, `forum`, `prv` FROM `contact` WHERE `addr` = '%s' AND `uid` = %d AND (`network` != '%s' OR (`notify` != '' AND `alias` != '')) LIMIT 1", @@ -1161,8 +1210,8 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n ); // Then check in the contact table for the url - if (!dbm::is_result($r)) { - $r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network`, `notify` FROM `contact` + if (!DBM::is_result($r)) { + $r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network`, `notify`, `forum`, `prv` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND (`network` != '%s' OR (`notify` != '' AND `alias` != '')) LIMIT 1", @@ -1173,7 +1222,7 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n } // Then check in the global contacts for the address - if (!dbm::is_result($r)) { + if (!DBM::is_result($r)) { $r = q("SELECT `url`, `nick`, `name`, `alias`, `network`, `notify` FROM `gcontact` WHERE `addr` = '%s' AND (`network` != '%s' OR (`notify` != '' AND `alias` != '')) LIMIT 1", @@ -1183,7 +1232,7 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n } // Then check in the global contacts for the url - if (!dbm::is_result($r)) { + if (!DBM::is_result($r)) { $r = q("SELECT `url`, `nick`, `name`, `alias`, `network`, `notify` FROM `gcontact` WHERE `nurl` = '%s' AND (`network` != '%s' OR (`notify` != '' AND `alias` != '')) LIMIT 1", @@ -1192,10 +1241,10 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n ); } - if (!dbm::is_result($r)) { - $probed = probe_url($name); + if (!DBM::is_result($r)) { + $probed = Probe::uri($name); if ($result['network'] != NETWORK_PHANTOM) { - update_gcontact($probed); + GlobalContact::update($probed); $r = q("SELECT `url`, `name`, `nick`, `network`, `alias`, `notify` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1", dbesc(normalise_link($probed["url"]))); } @@ -1213,7 +1262,7 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n } // select someone by attag or nick and the name passed in the current network - if(!dbm::is_result($r) AND ($network != "")) + if(!DBM::is_result($r) && ($network != "")) $r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `network` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1", dbesc($name), dbesc($name), @@ -1222,7 +1271,7 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n ); //select someone from this user's contacts by name in the current network - if (!dbm::is_result($r) AND ($network != "")) { + if (!DBM::is_result($r) && ($network != "")) { $r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `name` = '%s' AND `network` = '%s' AND `uid` = %d LIMIT 1", dbesc($name), dbesc($network), @@ -1231,7 +1280,7 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n } // select someone by attag or nick and the name passed in - if(!dbm::is_result($r)) { + if(!DBM::is_result($r)) { $r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1", dbesc($name), dbesc($name), @@ -1240,7 +1289,7 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n } // select someone from this user's contacts by name - if(!dbm::is_result($r)) { + if(!DBM::is_result($r)) { $r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1", dbesc($name), intval($profile_uid) @@ -1248,8 +1297,8 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n } } - if (dbm::is_result($r)) { - if (strlen($inform) AND (isset($r[0]["notify"]) OR isset($r[0]["id"]))) { + if (DBM::is_result($r)) { + if (strlen($inform) && (isset($r[0]["notify"]) || isset($r[0]["id"]))) { $inform .= ','; } @@ -1262,20 +1311,19 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n $profile = $r[0]["url"]; $alias = $r[0]["alias"]; $newname = $r[0]["nick"]; - if (($newname == "") OR (($r[0]["network"] != NETWORK_OSTATUS) AND ($r[0]["network"] != NETWORK_TWITTER) - AND ($r[0]["network"] != NETWORK_STATUSNET) AND ($r[0]["network"] != NETWORK_APPNET))) { + if (($newname == "") || (($r[0]["network"] != NETWORK_OSTATUS) && ($r[0]["network"] != NETWORK_TWITTER) + && ($r[0]["network"] != NETWORK_STATUSNET) && ($r[0]["network"] != NETWORK_APPNET))) { $newname = $r[0]["name"]; } } //if there is an url for this persons profile - if (isset($profile) AND ($newname != "")) { - + if (isset($profile) && ($newname != "")) { $replaced = true; // create profile link $profile = str_replace(',', '%2c', $profile); - $newtag = '@[url=' . $profile . ']' . $newname . '[/url]'; - $body = str_replace('@' . $name, $newtag, $body); + $newtag = $tag_type.'[url=' . $profile . ']' . $newname . '[/url]'; + $body = str_replace($tag_type . $name, $newtag, $body); // append tag to str_tags if (! stristr($str_tags, $newtag)) { if (strlen($str_tags)) {