turn all Red links into zrls (not the old zrls, the new bbcode zrl which means we can zidify them)

This commit is contained in:
friendica 2013-04-15 03:00:08 -07:00
parent ab5151c470
commit 7e6890832b
16 changed files with 60 additions and 59 deletions

View File

@ -991,7 +991,7 @@ require_once('include/security.php');
if(perm_is_allowed($r[0]['uid'],$observer['xchan_hash'],'view_stream')) { if(perm_is_allowed($r[0]['uid'],$observer['xchan_hash'],'view_stream')) {
if ($r[0]['body'] != "") { if ($r[0]['body'] != "") {
$_REQUEST['body'] = html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8')."[url=".$r[0]['reply_url']."]".$r[0]['reply_author']."[/url] \n".$r[0]['body']; $_REQUEST['body'] = html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8')."[zrl=".$r[0]['reply_url']."]".$r[0]['reply_author']."[/zrl] \n".$r[0]['body'];
$_REQUEST['profile_uid'] = api_user(); $_REQUEST['profile_uid'] = api_user();
$_REQUEST['type'] = 'wall'; $_REQUEST['type'] = 'wall';
$_REQUEST['api_source'] = true; $_REQUEST['api_source'] = true;

View File

@ -66,7 +66,7 @@ function notification($params) {
$subject = sprintf( t('[Red:Notify] New mail received at %s'),$sitename); $subject = sprintf( t('[Red:Notify] New mail received at %s'),$sitename);
$preamble = sprintf( t('%1$s sent you a new private message at %2$s.'),$sender['xchan_name'],$sitename); $preamble = sprintf( t('%1$s sent you a new private message at %2$s.'),$sender['xchan_name'],$sitename);
$epreamble = sprintf( t('%1$s sent you %2$s.'),'[url=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/url]', '[url=$itemlink]' . t('a private message') . '[/url]'); $epreamble = sprintf( t('%1$s sent you %2$s.'),'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', '[zrl=$itemlink]' . t('a private message') . '[/zrl]');
$sitelink = t('Please visit %s to view and/or reply to your private messages.'); $sitelink = t('Please visit %s to view and/or reply to your private messages.');
$tsitelink = sprintf( $sitelink, $siteurl . '/message/' . $params['item']['id'] ); $tsitelink = sprintf( $sitelink, $siteurl . '/message/' . $params['item']['id'] );
$hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '/message/' . $params['item']['id'] . '">' . $sitename . '</a>'); $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '/message/' . $params['item']['id'] . '">' . $sitename . '</a>');
@ -111,23 +111,23 @@ function notification($params) {
//$possess_desc = str_replace('<!item_type!>',$possess_desc); //$possess_desc = str_replace('<!item_type!>',$possess_desc);
// "a post" // "a post"
$dest_str = sprintf(t('%1$s commented on [url=%2$s]a %3$s[/url]'), $dest_str = sprintf(t('%1$s commented on [zrl=%2$s]a %3$s[/zrl]'),
'[url=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/url]', '[url=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/url]',
$itemlink, $itemlink,
$item_post_type); $item_post_type);
// "George Bull's post" // "George Bull's post"
if($p) if($p)
$dest_str = sprintf(t('%1$s commented on [url=%2$s]%3$s\'s %4$s[/url]'), $dest_str = sprintf(t('%1$s commented on [zrl=%2$s]%3$s\'s %4$s[/zrl]'),
'[url=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/url]', '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
$itemlink, $itemlink,
$p[0]['author']['xchan_name'], $p[0]['author']['xchan_name'],
$item_post_type); $item_post_type);
// "your post" // "your post"
if($p[0]['owner']['xchan_name'] == $p[0]['author']['xchan_name'] && ($p[0]['item_flags'] & ITEM_WALL)) if($p[0]['owner']['xchan_name'] == $p[0]['author']['xchan_name'] && ($p[0]['item_flags'] & ITEM_WALL))
$dest_str = sprintf(t('%1$s commented on [url=%2$s]your %3$s[/url]'), $dest_str = sprintf(t('%1$s commented on [zrl=%2$s]your %3$s[/zrl]'),
'[url=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/url]', '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
$itemlink, $itemlink,
$item_post_type); $item_post_type);
@ -151,8 +151,8 @@ function notification($params) {
$preamble = sprintf( t('%1$s posted to your profile wall at %2$s') , $sender['xchan_name'], $sitename); $preamble = sprintf( t('%1$s posted to your profile wall at %2$s') , $sender['xchan_name'], $sitename);
$epreamble = sprintf( t('%1$s posted to [url=%2$s]your wall[/url]') , $epreamble = sprintf( t('%1$s posted to [zrl=%2$s]your wall[/zrl]') ,
'[url=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/url]', '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
$params['link']); $params['link']);
$sitelink = t('Please visit %s to view and/or reply to the conversation.'); $sitelink = t('Please visit %s to view and/or reply to the conversation.');
@ -164,8 +164,8 @@ function notification($params) {
if($params['type'] == NOTIFY_TAGSELF) { if($params['type'] == NOTIFY_TAGSELF) {
$subject = sprintf( t('[Red:Notify] %s tagged you') , $sender['xchan_name']); $subject = sprintf( t('[Red:Notify] %s tagged you') , $sender['xchan_name']);
$preamble = sprintf( t('%1$s tagged you at %2$s') , $sender['xchan_name'], $sitename); $preamble = sprintf( t('%1$s tagged you at %2$s') , $sender['xchan_name'], $sitename);
$epreamble = sprintf( t('%1$s [url=%2$s]tagged you[/url].') , $epreamble = sprintf( t('%1$s [zrl=%2$s]tagged you[/zrl].') ,
'[url=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/url]', '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
$params['link']); $params['link']);
$sitelink = t('Please visit %s to view and/or reply to the conversation.'); $sitelink = t('Please visit %s to view and/or reply to the conversation.');
@ -178,8 +178,8 @@ function notification($params) {
$subject = sprintf( t('[Red:Notify] %1$s poked you') , $sender['xchan_name']); $subject = sprintf( t('[Red:Notify] %1$s poked you') , $sender['xchan_name']);
$preamble = sprintf( t('%1$s poked you at %2$s') , $sender['xchan_name'], $sitename); $preamble = sprintf( t('%1$s poked you at %2$s') , $sender['xchan_name'], $sitename);
$epreamble = sprintf( t('%1$s [url=%2$s]poked you[/url].') , $epreamble = sprintf( t('%1$s [zrl=%2$s]poked you[/zrl].') ,
'[url=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/url]', '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
$params['link']); $params['link']);
$subject = str_replace('poked', t($params['activity']), $subject); $subject = str_replace('poked', t($params['activity']), $subject);
@ -195,8 +195,8 @@ function notification($params) {
if($params['type'] == NOTIFY_TAGSHARE) { if($params['type'] == NOTIFY_TAGSHARE) {
$subject = sprintf( t('[Red:Notify] %s tagged your post') , $sender['xchan_name']); $subject = sprintf( t('[Red:Notify] %s tagged your post') , $sender['xchan_name']);
$preamble = sprintf( t('%1$s tagged your post at %2$s') , $sender['xchan_name'], $sitename); $preamble = sprintf( t('%1$s tagged your post at %2$s') , $sender['xchan_name'], $sitename);
$epreamble = sprintf( t('%1$s tagged [url=%2$s]your post[/url]') , $epreamble = sprintf( t('%1$s tagged [zrl=%2$s]your post[/zrl]') ,
'[url=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/url]', '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
$itemlink); $itemlink);
$sitelink = t('Please visit %s to view and/or reply to the conversation.'); $sitelink = t('Please visit %s to view and/or reply to the conversation.');
@ -208,9 +208,9 @@ function notification($params) {
if($params['type'] == NOTIFY_INTRO) { if($params['type'] == NOTIFY_INTRO) {
$subject = sprintf( t('[Red:Notify] Introduction received')); $subject = sprintf( t('[Red:Notify] Introduction received'));
$preamble = sprintf( t('You\'ve received an introduction from \'%1$s\' at %2$s'), $sender['xchan_name'], $sitename); $preamble = sprintf( t('You\'ve received an introduction from \'%1$s\' at %2$s'), $sender['xchan_name'], $sitename);
$epreamble = sprintf( t('You\'ve received [url=%1$s]an introduction[/url] from %2$s.'), $epreamble = sprintf( t('You\'ve received [zrl=%1$s]an introduction[/zrl] from %2$s.'),
$itemlink, $itemlink,
'[url=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/url]'); '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]');
$body = sprintf( t('You may visit their profile at %s'),$sender['xchan_url']); $body = sprintf( t('You may visit their profile at %s'),$sender['xchan_url']);
$sitelink = t('Please visit %s to approve or reject the introduction.'); $sitelink = t('Please visit %s to approve or reject the introduction.');
@ -222,10 +222,10 @@ function notification($params) {
if($params['type'] == NOTIFY_SUGGEST) { if($params['type'] == NOTIFY_SUGGEST) {
$subject = sprintf( t('[Red:Notify] Friend suggestion received')); $subject = sprintf( t('[Red:Notify] Friend suggestion received'));
$preamble = sprintf( t('You\'ve received a friend suggestion from \'%1$s\' at %2$s'), $sender['xchan_name'], $sitename); $preamble = sprintf( t('You\'ve received a friend suggestion from \'%1$s\' at %2$s'), $sender['xchan_name'], $sitename);
$epreamble = sprintf( t('You\'ve received [url=%1$s]a friend suggestion[/url] for %2$s from %3$s.'), $epreamble = sprintf( t('You\'ve received [zrl=%1$s]a friend suggestion[/zrl] for %2$s from %3$s.'),
$itemlink, $itemlink,
'[url=' . $params['item']['url'] . ']' . $params['item']['name'] . '[/url]', '[zrl=' . $params['item']['url'] . ']' . $params['item']['name'] . '[/zrl]',
'[url=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/url]'); '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]');
$body = t('Name:') . ' ' . $params['item']['name'] . "\n"; $body = t('Name:') . ' ' . $params['item']['name'] . "\n";
$body .= t('Photo:') . ' ' . $params['item']['photo'] . "\n"; $body .= t('Photo:') . ' ' . $params['item']['photo'] . "\n";

View File

@ -1918,7 +1918,7 @@ function tag_deliver($uid,$item_id) {
$body = preg_replace('/\[share(.*?)\[\/share\]/','',$item['body']); $body = preg_replace('/\[share(.*?)\[\/share\]/','',$item['body']);
$pattern = '/@\[url\=' . preg_quote($term['url'],'/') . '\]' . preg_quote($u[0]['channel_name'],'/') . '\[\/url\]/'; $pattern = '/@\[zrl\=' . preg_quote($term['url'],'/') . '\]' . preg_quote($u[0]['channel_name'],'/') . '\[\/zrl\]/';
if(! preg_match($pattern,$body,$matches)) { if(! preg_match($pattern,$body,$matches)) {
logger('tag_deliver: mention was in a reshare - ignoring'); logger('tag_deliver: mention was in a reshare - ignoring');
@ -2012,7 +2012,7 @@ function tgroup_check($uid,$item) {
$body = preg_replace("/\[share\](.*?)\[\/share\]/ism", '', $item['body']); $body = preg_replace("/\[share\](.*?)\[\/share\]/ism", '', $item['body']);
$cnt = preg_match_all('/[\@\!]\[url\=(.*?)\](.*?)\[\/url\]/ism',$body,$matches,PREG_SET_ORDER); $cnt = preg_match_all('/[\@\!]\[zrl\=(.*?)\](.*?)\[\/zrl\]/ism',$body,$matches,PREG_SET_ORDER);
if($cnt) { if($cnt) {
foreach($matches as $mtch) { foreach($matches as $mtch) {
if(link_compare($link,$mtch[1]) || link_compare($dlink,$mtch[1])) { if(link_compare($link,$mtch[1]) || link_compare($dlink,$mtch[1])) {
@ -2504,7 +2504,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
*/ */
$bdtext = sprintf( t('%s\'s birthday'), $contact['name']); $bdtext = sprintf( t('%s\'s birthday'), $contact['name']);
$bdtext2 = sprintf( t('Happy Birthday %s'), ' [url=' . $contact['url'] . ']' . $contact['name'] . '[/url]' ) ; $bdtext2 = sprintf( t('Happy Birthday %s'), ' [zrl=' . $contact['url'] . ']' . $contact['name'] . '[/zrl]' ) ;
$r = q("INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`summary`,`desc`,`type`) $r = q("INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`summary`,`desc`,`type`)
@ -2752,7 +2752,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
// extract tag, if not duplicate, add to parent item // extract tag, if not duplicate, add to parent item
if($xo->id && $xo->content) { if($xo->id && $xo->content) {
$newtag = '#[url=' . $xo->id . ']'. $xo->content . '[/url]'; $newtag = '#[zrl=' . $xo->id . ']'. $xo->content . '[/zrl]';
if(! (stristr($r[0]['tag'],$newtag))) { if(! (stristr($r[0]['tag'],$newtag))) {
q("UPDATE item SET tag = '%s' WHERE id = %d LIMIT 1", q("UPDATE item SET tag = '%s' WHERE id = %d LIMIT 1",
dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . $newtag), dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . $newtag),
@ -3535,7 +3535,7 @@ function local_delivery($importer,$data) {
// extract tag, if not duplicate, and this user allows tags, add to parent item // extract tag, if not duplicate, and this user allows tags, add to parent item
//FIXME //FIXME
if($xo->id && $xo->content) { if($xo->id && $xo->content) {
$newtag = '#[url=' . $xo->id . ']'. $xo->content . '[/url]'; $newtag = '#[zrl=' . $xo->id . ']'. $xo->content . '[/zrl]';
if(! (stristr($tagp[0]['tag'],$newtag))) { if(! (stristr($tagp[0]['tag'],$newtag))) {
$i = q("SELECT `blocktags` FROM `user` where `uid` = %d LIMIT 1", $i = q("SELECT `blocktags` FROM `user` where `uid` = %d LIMIT 1",
intval($importer['importer_uid']) intval($importer['importer_uid'])
@ -3687,7 +3687,7 @@ function local_delivery($importer,$data) {
if($xo->content) { if($xo->content) {
if(! (stristr($r[0]['tag'],trim($xo->content)))) { if(! (stristr($r[0]['tag'],trim($xo->content)))) {
q("UPDATE item SET tag = '%s' WHERE id = %d LIMIT 1", q("UPDATE item SET tag = '%s' WHERE id = %d LIMIT 1",
dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . '#[url=' . $xo->id . ']'. $xo->content . '[/url]'), dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . '#[zrl=' . $xo->id . ']'. $xo->content . '[/zrl]'),
intval($r[0]['id']) intval($r[0]['id'])
); );
} }

View File

@ -1093,7 +1093,7 @@ function scale_external_images($s, $include_link = true, $scale_replace = false)
logger('scale_external_images: ' . $orig_width . '->' . $new_width . 'w ' . $orig_height . '->' . $new_height . 'h' . ' match: ' . $mtch[0], LOGGER_DEBUG); logger('scale_external_images: ' . $orig_width . '->' . $new_width . 'w ' . $orig_height . '->' . $new_height . 'h' . ' match: ' . $mtch[0], LOGGER_DEBUG);
$s = str_replace($mtch[0],'[img=' . $new_width . 'x' . $new_height. ']' . $scaled . '[/img]' $s = str_replace($mtch[0],'[img=' . $new_width . 'x' . $new_height. ']' . $scaled . '[/img]'
. "\n" . (($include_link) . "\n" . (($include_link)
? '[url=' . $mtch[1] . ']' . t('view full size') . '[/url]' . "\n" ? '[zrl=' . $mtch[1] . ']' . t('view full size') . '[/zrl]' . "\n"
: ''),$s); : ''),$s);
logger('scale_external_images: new string: ' . $s, LOGGER_DEBUG); logger('scale_external_images: new string: ' . $s, LOGGER_DEBUG);
} }

View File

@ -208,9 +208,9 @@ function photo_upload($channel, $observer, $args) {
$arr['deny_gid'] = $str_group_deny; $arr['deny_gid'] = $str_group_deny;
$arr['body'] = '[url=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo_hash . ']' $arr['body'] = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo_hash . ']'
. '[img]' . z_root() . "/photo/{$photo_hash}-{$smallest}.".$ph->getExt() . '[/img]' . '[img]' . z_root() . "/photo/{$photo_hash}-{$smallest}.".$ph->getExt() . '[/img]'
. '[/url]'; . '[/zrl]';
$item_id = item_store($arr); $item_id = item_store($arr);
@ -350,9 +350,9 @@ function photos_create_item($channel, $creator_hash, $photo, $visible = false) {
$arr['deny_cid'] = $photo['deny_cid']; $arr['deny_cid'] = $photo['deny_cid'];
$arr['deny_gid'] = $photo['deny_gid']; $arr['deny_gid'] = $photo['deny_gid'];
$arr['body'] = '[url=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo['resource_id'] . ']' $arr['body'] = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo['resource_id'] . ']'
. '[img]' . z_root() . '/photo/' . $photo['resource_id'] . '-' . $photo['scale'] . '[/img]' . '[img]' . z_root() . '/photo/' . $photo['resource_id'] . '-' . $photo['scale'] . '[/img]'
. '[/url]'; . '[/zrl]';
$item_id = item_store($arr); $item_id = item_store($arr);
return $item_id; return $item_id;

View File

@ -397,7 +397,7 @@ function upgrade_link($bbcode = false) {
if(! $l) if(! $l)
return ''; return '';
if($bbcode) if($bbcode)
$t = sprintf('[url=%s]' . t('Click here to upgrade.') . '[/url]', $l); $t = sprintf('[zrl=%s]' . t('Click here to upgrade.') . '[/zrl]', $l);
else else
$t = sprintf('<a href="%s">' . t('Click here to upgrade.') . '</div>', $l); $t = sprintf('<a href="%s">' . t('Click here to upgrade.') . '</div>', $l);
return $t; return $t;

View File

@ -1662,7 +1662,7 @@ function normalise_openid($s) {
function undo_post_tagging($s) { function undo_post_tagging($s) {
$matches = null; $matches = null;
$cnt = preg_match_all('/([@#])\[url=(.*?)\](.*?)\[\/url\]/ism',$s,$matches,PREG_SET_ORDER); $cnt = preg_match_all('/([@#])\[zrl=(.*?)\](.*?)\[\/zrl\]/ism',$s,$matches,PREG_SET_ORDER);
if($cnt) { if($cnt) {
foreach($matches as $mtch) { foreach($matches as $mtch) {
$s = str_replace($mtch[0], $mtch[1] . $mtch[3],$s); $s = str_replace($mtch[0], $mtch[1] . $mtch[3],$s);

View File

@ -785,14 +785,14 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
//is it a hash tag? //is it a hash tag?
if(strpos($tag,'#') === 0) { if(strpos($tag,'#') === 0) {
//if the tag is replaced... //if the tag is replaced...
if(strpos($tag,'[url=')) if(strpos($tag,'[zrl='))
//...do nothing //...do nothing
return $replaced; return $replaced;
//base tag has the tags name only //base tag has the tags name only
$basetag = str_replace('_',' ',substr($tag,1)); $basetag = str_replace('_',' ',substr($tag,1));
//create text for link //create text for link
$url = $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag); $url = $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag);
$newtag = '#[url=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]'; $newtag = '#[zrl=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/zrl]';
//replace tag by the link //replace tag by the link
$body = str_replace($tag, $newtag, $body); $body = str_replace($tag, $newtag, $body);
$replaced = true; $replaced = true;
@ -809,7 +809,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
//is it a person tag? //is it a person tag?
if(strpos($tag,'@') === 0) { if(strpos($tag,'@') === 0) {
//is it already replaced? //is it already replaced?
if(strpos($tag,'[url=')) if(strpos($tag,'[zrl='))
return $replaced; return $replaced;
$stat = false; $stat = false;
//get the person's name //get the person's name
@ -905,7 +905,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
//create profile link //create profile link
$profile = str_replace(',','%2c',$profile); $profile = str_replace(',','%2c',$profile);
$url = $profile; $url = $profile;
$newtag = '@[url=' . $profile . ']' . $newname . '[/url]'; $newtag = '@[zrl=' . $profile . ']' . $newname . '[/zrl]';
$body = str_replace('@' . $name, $newtag, $body); $body = str_replace('@' . $name, $newtag, $body);
//append tag to str_tags //append tag to str_tags
if(! stristr($str_tags,$newtag)) { if(! stristr($str_tags,$newtag)) {

View File

@ -153,9 +153,9 @@ function like_content(&$a) {
$arr['author_xchan'] = $observer['xchan_hash']; $arr['author_xchan'] = $observer['xchan_hash'];
$ulink = '[url=' . $thread_owner['xchan_url'] . ']' . $thread_owner['xchan_name'] . '[/url]'; $ulink = '[zrl=' . $thread_owner['xchan_url'] . ']' . $thread_owner['xchan_name'] . '[/zrl]';
$alink = '[url=' . $observer['xchan_url'] . ']' . $observer['xchan_name'] . '[/url]'; $alink = '[zrl=' . $observer['xchan_url'] . ']' . $observer['xchan_name'] . '[/zrl]';
$plink = '[url=' . $a->get_baseurl() . '/display/' . $item['mid'] . ']' . $post_type . '[/url]'; $plink = '[zrl=' . $a->get_baseurl() . '/display/' . $item['mid'] . ']' . $post_type . '[/zrl]';
$arr['body'] = sprintf( $bodyverb, $alink, $ulink, $plink ); $arr['body'] = sprintf( $bodyverb, $alink, $ulink, $plink );

View File

@ -160,9 +160,10 @@ function item_redir_and_replace_images($body, $images, $cid) {
$newbody = ''; $newbody = '';
for($i = 0; $i < count($images); $i++) { for($i = 0; $i < count($images); $i++) {
$search = '/\[url\=(.*?)\]\[!#saved_image' . $i . '#!\]\[\/url\]' . '/is'; $search = '/\[zrl\=(.*?)\]\[!#saved_image' . $i . '#!\]\[\/zrl\]' . '/is';
$replace = '[url=' . z_path() . '/redir/' . $cid //FIXME
. '?f=1&url=' . '$1' . '][!#saved_image' . $i . '#!][/url]' ; $replace = '[zrl=' . z_path() . '/redir/' . $cid
. '?f=1&url=' . '$1' . '][!#saved_image' . $i . '#!][/zrl]' ;
$img_end = strpos($origbody, '[!#saved_image' . $i . '#!][/url]') + strlen('[!#saved_image' . $i . '#!][/url]'); $img_end = strpos($origbody, '[!#saved_image' . $i . '#!][/url]') + strlen('[!#saved_image' . $i . '#!][/url]');
$process_part = substr($origbody, 0, $img_end); $process_part = substr($origbody, 0, $img_end);

View File

@ -60,7 +60,7 @@ function mood_init(&$a) {
$mid = item_message_id(); $mid = item_message_id();
$action = sprintf( t('%1$s is currently %2$s'), '[url=' . $poster['xchan_url'] . ']' . $poster['xchan_name'] . '[/url]' , $verbs[$verb]); $action = sprintf( t('%1$s is currently %2$s'), '[zrl=' . $poster['xchan_url'] . ']' . $poster['xchan_name'] . '[/zrl]' , $verbs[$verb]);
$item_flags = ITEM_WALL|ITEM_ORIGIN|ITEM_UNSEEN; $item_flags = ITEM_WALL|ITEM_ORIGIN|ITEM_UNSEEN;
if(! $parent_mid) if(! $parent_mid)
$item_flags |= ITEM_THREAD_TOP; $item_flags |= ITEM_THREAD_TOP;

View File

@ -413,13 +413,13 @@ function photos_post(&$a) {
} }
if($profile) { if($profile) {
if(substr($notify,0,4) === 'cid:') if(substr($notify,0,4) === 'cid:')
$taginfo[] = array($newname,$profile,$notify,$r[0],'@[url=' . str_replace(',','%2c',$profile) . ']' . $newname . '[/url]'); $taginfo[] = array($newname,$profile,$notify,$r[0],'@[zrl=' . str_replace(',','%2c',$profile) . ']' . $newname . '[/zrl]');
else else
$taginfo[] = array($newname,$profile,$notify,null,$str_tags .= '@[url=' . $profile . ']' . $newname . '[/url]'); $taginfo[] = array($newname,$profile,$notify,null,$str_tags .= '@[url=' . $profile . ']' . $newname . '[/url]');
if(strlen($str_tags)) if(strlen($str_tags))
$str_tags .= ','; $str_tags .= ',';
$profile = str_replace(',','%2c',$profile); $profile = str_replace(',','%2c',$profile);
$str_tags .= '@[url=' . $profile . ']' . $newname . '[/url]'; $str_tags .= '@[zrl=' . $profile . ']' . $newname . '[/zrl]';
} }
} }
} }
@ -487,9 +487,9 @@ function photos_post(&$a) {
$arr['tag'] = $tagged[4]; $arr['tag'] = $tagged[4];
$arr['inform'] = $tagged[2]; $arr['inform'] = $tagged[2];
$arr['origin'] = 1; $arr['origin'] = 1;
$arr['body'] = sprintf( t('%1$s was tagged in %2$s by %3$s'), '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]', '[url=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . t('a photo') . '[/url]', '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]') ; $arr['body'] = sprintf( t('%1$s was tagged in %2$s by %3$s'), '[zrl=' . $tagged[1] . ']' . $tagged[0] . '[/zrl]', '[zrl=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . t('a photo') . '[/zrl]', '[zrl=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/zrl]') ;
$arr['body'] .= "\n\n" . '[url=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource_id'] . ']' . '[img]' . $a->get_baseurl() . "/photo/" . $p[0]['resource_id'] . '-' . $best . '.' . $ext . '[/img][/url]' . "\n" ; $arr['body'] .= "\n\n" . '[zrl=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource_id'] . ']' . '[img]' . $a->get_baseurl() . "/photo/" . $p[0]['resource_id'] . '-' . $best . '.' . $ext . '[/img][/zrl]' . "\n" ;
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id>'; $arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id>';
$arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $tagged[1] . '" />' . "\n"); $arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $tagged[1] . '" />' . "\n");

View File

@ -104,7 +104,7 @@ function poke_init(&$a) {
$arr['obj_type'] = ACTIVITY_OBJ_PERSON; $arr['obj_type'] = ACTIVITY_OBJ_PERSON;
$arr['origin'] = 1; $arr['origin'] = 1;
$arr['body'] = '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' . ' ' . t($verbs[$verb][0]) . ' ' . '[url=' . $target['url'] . ']' . $target['name'] . '[/url]'; $arr['body'] = '[zrl=' . $poster['url'] . ']' . $poster['name'] . '[/zrl]' . ' ' . t($verbs[$verb][0]) . ' ' . '[zrl=' . $target['url'] . ']' . $target['name'] . '[/zrl]';
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $target['name'] . '</title><id>' . $a->get_baseurl() . '/contact/' . $target['id'] . '</id>'; $arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $target['name'] . '</title><id>' . $a->get_baseurl() . '/contact/' . $target['id'] . '</id>';
$arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $target['url'] . '" />' . "\n"); $arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $target['url'] . '" />' . "\n");

View File

@ -126,9 +126,9 @@ EOT;
$arr['author-link'] = $contact['url']; $arr['author-link'] = $contact['url'];
$arr['author-avatar'] = $contact['thumb']; $arr['author-avatar'] = $contact['thumb'];
$ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]'; $ulink = '[zrl=' . $contact['url'] . ']' . $contact['name'] . '[/zrl]';
$alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]'; $alink = '[zrl=' . $item['author-link'] . ']' . $item['author-name'] . '[/zrl]';
$plink = '[url=' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . ']' . $post_type . '[/url]'; $plink = '[zrl=' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . ']' . $post_type . '[/zrl]';
$arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink ); $arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink );
$arr['verb'] = $activity; $arr['verb'] = $activity;

View File

@ -97,7 +97,7 @@ EOT;
if(! isset($bodyverb)) if(! isset($bodyverb))
return; return;
$termlink = html_entity_decode('&#x2317;') . '[url=' . $a->get_baseurl() . '/search?tag=' . urlencode($term) . ']'. $term . '[/url]'; $termlink = html_entity_decode('&#x2317;') . '[zrl=' . $a->get_baseurl() . '/search?tag=' . urlencode($term) . ']'. $term . '[/zrl]';
$arr = array(); $arr = array();
@ -116,9 +116,9 @@ EOT;
$arr['author-link'] = $contact['url']; $arr['author-link'] = $contact['url'];
$arr['author-avatar'] = $contact['thumb']; $arr['author-avatar'] = $contact['thumb'];
$ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]'; $ulink = '[zrl=' . $contact['url'] . ']' . $contact['name'] . '[/zrl]';
$alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]'; $alink = '[zrl=' . $item['author-link'] . ']' . $item['author-name'] . '[/zrl]';
$plink = '[url=' . $item['plink'] . ']' . $post_type . '[/url]'; $plink = '[zrl=' . $item['plink'] . ']' . $post_type . '[/zrl]';
$arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink, $termlink ); $arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink, $termlink );
$arr['verb'] = ACTIVITY_TAG; $arr['verb'] = ACTIVITY_TAG;
@ -152,7 +152,7 @@ EOT;
if((! $blocktags) && (! stristr($item['tag'], ']' . $term . '[' ))) { if((! $blocktags) && (! stristr($item['tag'], ']' . $term . '[' ))) {
q("update item set tag = '%s' where id = %d limit 1", q("update item set tag = '%s' where id = %d limit 1",
dbesc($item['tag'] . (strlen($item['tag']) ? ',' : '') . '#[url=' . $a->get_baseurl() . '/search?tag=' . $term . ']'. $term . '[/url]'), dbesc($item['tag'] . (strlen($item['tag']) ? ',' : '') . '#[zrl=' . $a->get_baseurl() . '/search?tag=' . $term . ']'. $term . '[/zrl]'),
intval($item['id']) intval($item['id'])
); );
} }
@ -168,7 +168,7 @@ EOT;
); );
if(count($x) && !$x[0]['blocktags'] && (! stristr($r[0]['tag'], ']' . $term . '['))) { if(count($x) && !$x[0]['blocktags'] && (! stristr($r[0]['tag'], ']' . $term . '['))) {
q("update item set tag = '%s' where id = %d limit 1", q("update item set tag = '%s' where id = %d limit 1",
dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . '#[url=' . $a->get_baseurl() . '/search?tag=' . $term . ']'. $term . '[/url]'), dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . '#[zrl=' . $a->get_baseurl() . '/search?tag=' . $term . ']'. $term . '[/zrl]'),
intval($r[0]['id']) intval($r[0]['id'])
); );
} }

View File

@ -1 +1 @@
2013-04-14.283 2013-04-15.284