Merge remote-tracking branch 'friendica/master' into mobile
This commit is contained in:
commit
850560519a
46 changed files with 8965 additions and 4072 deletions
|
@ -11,7 +11,7 @@ function stripcode_br_cb($s) {
|
|||
|
||||
function tryoembed($match){
|
||||
$url = ((count($match)==2)?$match[1]:$match[2]);
|
||||
logger("tryoembed: $url");
|
||||
// logger("tryoembed: $url");
|
||||
|
||||
$o = oembed_fetch_url($url);
|
||||
|
||||
|
@ -24,13 +24,40 @@ function tryoembed($match){
|
|||
|
||||
}
|
||||
|
||||
// [noparse][i]italic[/i][/noparse] turns into
|
||||
// [noparse][ i ]italic[ /i ][/noparse],
|
||||
// to hide them from parser.
|
||||
|
||||
function bb_spacefy($st) {
|
||||
$whole_match = $st[0];
|
||||
$captured = $st[1];
|
||||
$spacefied = preg_replace("/\[(.*?)\]/", "[ $1 ]", $captured);
|
||||
$new_str = str_replace($captured, $spacefied, $whole_match);
|
||||
return $new_str;
|
||||
}
|
||||
|
||||
// The previously spacefied [noparse][ i ]italic[ /i ][/noparse],
|
||||
// now turns back and the [noparse] tags are trimed
|
||||
// returning [i]italic[/i]
|
||||
|
||||
function bb_unspacefy_and_trim($st) {
|
||||
$whole_match = $st[0];
|
||||
$captured = $st[1];
|
||||
$unspacefied = preg_replace("/\[ (.*?)\ ]/", "[$1]", $captured);
|
||||
return $unspacefied;
|
||||
}
|
||||
|
||||
// BBcode 2 HTML was written by WAY2WEB.net
|
||||
// extended to work with Mistpark/Friendica - Mike Macgirvin
|
||||
|
||||
function bbcode($Text,$preserve_nl = false) {
|
||||
|
||||
// Hide all [noparse] contained bbtags spacefying them
|
||||
|
||||
$Text = preg_replace_callback("/\[noparse\](.*?)\[\/noparse\]/ism", 'bb_spacefy',$Text);
|
||||
$Text = preg_replace_callback("/\[nobb\](.*?)\[\/nobb\]/ism", 'bb_spacefy',$Text);
|
||||
$Text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'bb_spacefy',$Text);
|
||||
|
||||
|
||||
// Extract a single private image which uses data url's since preg has issues with
|
||||
// large data sizes. Stash it away while we do bbcode conversion, and then put it back
|
||||
|
@ -111,25 +138,34 @@ function bbcode($Text,$preserve_nl = false) {
|
|||
$Text = preg_replace("(\[color=(.*?)\](.*?)\[\/color\])ism","<span style=\"color: $1;\">$2</span>",$Text);
|
||||
|
||||
// Check for sized text
|
||||
// [size=50] --> font-size: 50px (with the unit).
|
||||
$Text = preg_replace("(\[size=(\d*?)\](.*?)\[\/size\])ism","<span style=\"font-size: $1px;\">$2</span>",$Text);
|
||||
$Text = preg_replace("(\[size=(.*?)\](.*?)\[\/size\])ism","<span style=\"font-size: $1;\">$2</span>",$Text);
|
||||
|
||||
// Check for centered text
|
||||
$Text = preg_replace("(\[center\](.*?)\[\/center\])ism","<div style=\"text-align:center;\">$1</div>",$Text);
|
||||
|
||||
// Check for list text
|
||||
|
||||
if(stristr($Text,'[/list]'))
|
||||
$Text = str_replace("[*]", "<li>", $Text);
|
||||
|
||||
if(stristr($Text,'[/list]'))
|
||||
$Text = str_replace("[*]", "<li>", $Text);
|
||||
$Text = str_replace("[*]", "<li>", $Text);
|
||||
$Text = preg_replace("/\[li\](.*?)\[\/li\]/ism", '<li>$1</li>' ,$Text);
|
||||
|
||||
$Text = preg_replace("/\[list\](.*?)\[\/list\]/ism", '<ul class="listbullet" style="list-style-type: circle;">$1</ul>' ,$Text);
|
||||
$Text = preg_replace("/\[ul\](.*?)\[\/ul\]/ism", '<ul class="listbullet" style="list-style-type: circle;">$1</ul>'
|
||||
,$Text);
|
||||
$Text = preg_replace("/\[list=\](.*?)\[\/list\]/ism", '<ul class="listnone" style="list-style-type: none;">$1</ul>' ,$Text);
|
||||
$Text = preg_replace("/\[list=1\](.*?)\[\/list\]/ism", '<ul class="listdecimal" style="list-style-type: decimal;">$1</ul>' ,$Text);
|
||||
$Text = preg_replace("/\[list=i\](.*?)\[\/list\]/sm",'<ul class="listlowerroman" style="list-style-type: lower-roman;">$1</ul>' ,$Text);
|
||||
$Text = preg_replace("/\[list=I\](.*?)\[\/list\]/sm", '<ul class="listupperroman" style="list-style-type: upper-roman;">$1</ul>' ,$Text);
|
||||
$Text = preg_replace("/\[list=a\](.*?)\[\/list\]/sm", '<ul class="listloweralpha" style="list-style-type: lower-alpha;">$1</ul>' ,$Text);
|
||||
$Text = preg_replace("/\[list=A\](.*?)\[\/list\]/sm", '<ul class="listupperalpha" style="list-style-type: upper-alpha;">$1</ul>' ,$Text);
|
||||
$Text = preg_replace("/\[li\](.*?)\[\/li\]/sm", '<li>$1</li>' ,$Text);
|
||||
$Text = preg_replace("/\[ol\](.*?)\[\/ol\]/ism", '<ul class="listdecimal" style="list-style-type: decimal;">$1</ul>'
|
||||
,$Text);
|
||||
$Text = preg_replace("/\[list=((?-i)i)\](.*?)\[\/list\]/ism",'<ul class="listlowerroman" style="list-style-type:
|
||||
lower-roman;">$2</ul>' ,$Text);
|
||||
$Text = preg_replace("/\[list=((?-i)I)\](.*?)\[\/list\]/ism", '<ul class="listupperroman" style="list-style-type:
|
||||
upper-roman;">$2</ul>' ,$Text);
|
||||
$Text = preg_replace("/\[list=((?-i)a)\](.*?)\[\/list\]/ism", '<ul class="listloweralpha" style="list-style-type:
|
||||
lower-alpha;">$2</ul>' ,$Text);
|
||||
$Text = preg_replace("/\[list=((?-i)A)\](.*?)\[\/list\]/ism", '<ul class="listupperalpha" style="list-style-type:
|
||||
upper-alpha;">$2</ul>' ,$Text);
|
||||
|
||||
$Text = preg_replace("/\[th\](.*?)\[\/th\]/sm", '<th>$1</th>' ,$Text);
|
||||
$Text = preg_replace("/\[td\](.*?)\[\/td\]/sm", '<td>$1</td>' ,$Text);
|
||||
$Text = preg_replace("/\[tr\](.*?)\[\/tr\]/sm", '<tr>$1</tr>' ,$Text);
|
||||
$Text = preg_replace("/\[table\](.*?)\[\/table\]/sm", '<table>$1</table>' ,$Text);
|
||||
|
@ -157,7 +193,15 @@ function bbcode($Text,$preserve_nl = false) {
|
|||
$QuoteLayout = '<blockquote>$1</blockquote>';
|
||||
// Check for [quote] text
|
||||
$Text = preg_replace("/\[quote\](.*?)\[\/quote\]/ism","$QuoteLayout", $Text);
|
||||
|
||||
|
||||
// Check for [quote=Author] text
|
||||
|
||||
$t_wrote = t('$1 wrote:');
|
||||
|
||||
$Text = preg_replace("/\[quote=[\"\']*(.*?)[\"\']*\](.*?)\[\/quote\]/ism",
|
||||
"<blockquote><strong>" . $t_wrote . "</strong> $2</blockquote>",
|
||||
$Text);
|
||||
|
||||
// [img=widthxheight]image source[/img]
|
||||
$Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '<img src="$3" style="height: $2px; width: $1px;" >', $Text);
|
||||
|
||||
|
@ -219,6 +263,13 @@ function bbcode($Text,$preserve_nl = false) {
|
|||
$Text = preg_replace("/\[event\-adjust\](.*?)\[\/event\-adjust\]/ism",'',$Text);
|
||||
}
|
||||
|
||||
// Unhide all [noparse] contained bbtags unspacefying them
|
||||
// and triming the [noparse] tag.
|
||||
|
||||
$Text = preg_replace_callback("/\[noparse\](.*?)\[\/noparse\]/ism", 'bb_unspacefy_and_trim',$Text);
|
||||
$Text = preg_replace_callback("/\[nobb\](.*?)\[\/nobb\]/ism", 'bb_unspacefy_and_trim',$Text);
|
||||
$Text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'bb_unspacefy_and_trim',$Text);
|
||||
|
||||
// fix any escaped ampersands that may have been converted into links
|
||||
$Text = preg_replace("/\<(.*?)(src|href)=(.*?)\&\;(.*?)\>/ism",'<$1$2=$3&$4>',$Text);
|
||||
if(strlen($saved_image))
|
||||
|
|
|
@ -262,15 +262,10 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
else
|
||||
$profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']);
|
||||
|
||||
$location = (($item['location']) ? '<a target="map" title="' . $item['location'] . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
|
||||
$coord = (($item['coord']) ? '<a target="map" title="' . $item['coord'] . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');
|
||||
if($coord) {
|
||||
if($location)
|
||||
$location .= '<br /><span class="smalltext">(' . $coord . ')</span>';
|
||||
else
|
||||
$location = '<span class="smalltext">' . $coord . '</span>';
|
||||
}
|
||||
$locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
|
||||
call_hooks('render_location',$locate);
|
||||
|
||||
$location = ((strlen($locate['html'])) ? $locate['html'] : render_location_google($locate));
|
||||
|
||||
localize_item($item);
|
||||
if($mode === 'network-new')
|
||||
|
@ -594,16 +589,10 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
$like = ((x($alike,$item['id'])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
|
||||
$dislike = ((x($dlike,$item['id'])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : '');
|
||||
|
||||
$location = (($item['location']) ? '<a target="map" title="' . $item['location']
|
||||
. '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
|
||||
$coord = (($item['coord']) ? '<a target="map" title="' . $item['coord']
|
||||
. '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');
|
||||
if($coord) {
|
||||
if($location)
|
||||
$location .= '<br /><span class="smalltext">(' . $coord . ')</span>';
|
||||
else
|
||||
$location = '<span class="smalltext">' . $coord . '</span>';
|
||||
}
|
||||
$locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
|
||||
call_hooks('render_location',$locate);
|
||||
|
||||
$location = ((strlen($locate['html'])) ? $locate['html'] : render_location_google($locate));
|
||||
|
||||
$indent = (($toplevelpost) ? '' : ' comment');
|
||||
|
||||
|
@ -1014,3 +1003,17 @@ function find_thread_parent_index($arr,$x) {
|
|||
return $k;
|
||||
return false;
|
||||
}
|
||||
|
||||
function render_location_google($item) {
|
||||
$location = '';
|
||||
$location = (($item['location']) ? '<a target="map" title="' . $item['location'] . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
|
||||
$coord = (($item['coord']) ? '<a target="map" title="' . $item['coord'] . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');
|
||||
if($coord) {
|
||||
if($location)
|
||||
$location .= '<br /><span class="smalltext">(' . $coord . ')</span>';
|
||||
else
|
||||
$location = '<span class="smalltext">' . $coord . '</span>';
|
||||
}
|
||||
return $location;
|
||||
}
|
||||
|
||||
|
|
|
@ -260,10 +260,11 @@ function relative_date($posted_date) {
|
|||
);
|
||||
|
||||
foreach ($a as $secs => $str) {
|
||||
$d = $etime / $secs;
|
||||
if ($d >= 1) {
|
||||
$r = round($d);
|
||||
return $r . ' ' . (($r == 1) ? $str[0] : $str[1]) . t(' ago');
|
||||
$d = $etime / $secs;
|
||||
if ($d >= 1) {
|
||||
$r = round($d);
|
||||
// translators - e.g. 22 hours ago, 1 minute ago
|
||||
return sprintf( t('%1$d %2$s ago'),$r, (($r == 1) ? $str[0] : $str[1]));
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
|
|
@ -54,6 +54,24 @@ function notification($params) {
|
|||
$itemlink = $params['link'];
|
||||
}
|
||||
|
||||
if($params['type'] == NOTIFY_TAGSELF) {
|
||||
$preamble = $subject = sprintf( t('%s tagged you at %s') , $params['source_name'], $sitename);
|
||||
|
||||
$sitelink = t('Please visit %s to view and/or reply to the conversation.');
|
||||
$tsitelink = sprintf( $sitelink, $siteurl );
|
||||
$hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '">' . $sitename . '</a>');
|
||||
$itemlink = $params['link'];
|
||||
}
|
||||
|
||||
if($params['type'] == NOTIFY_TAGSHARE) {
|
||||
$preamble = $subject = sprintf( t('%s tagged your post at %s') , $params['source_name'], $sitename);
|
||||
|
||||
$sitelink = t('Please visit %s to view and/or reply to the conversation.');
|
||||
$tsitelink = sprintf( $sitelink, $siteurl );
|
||||
$hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '">' . $sitename . '</a>');
|
||||
$itemlink = $params['link'];
|
||||
}
|
||||
|
||||
if($params['type'] == NOTIFY_INTRO) {
|
||||
$subject = sprintf( t('Introduction received at %s'), $sitename);
|
||||
$preamble = sprintf( t('You\'ve received an introduction from \'%s\' at %s'), $params['source_name'], $sitename);
|
||||
|
|
|
@ -905,7 +905,7 @@ function item_store($arr,$force_parent = false) {
|
|||
);
|
||||
}
|
||||
|
||||
tgroup_deliver($arr['uid'],$current_post);
|
||||
tag_deliver($arr['uid'],$current_post);
|
||||
|
||||
return $current_post;
|
||||
}
|
||||
|
@ -923,22 +923,22 @@ function get_item_contact($item,$contacts) {
|
|||
}
|
||||
|
||||
|
||||
function tgroup_deliver($uid,$item_id) {
|
||||
function tag_deliver($uid,$item_id) {
|
||||
|
||||
|
||||
// setup a second delivery chain for forum/community posts if appropriate
|
||||
// look for mention tags and setup a second delivery chain for forum/community posts if appropriate
|
||||
|
||||
$a = get_app();
|
||||
|
||||
$deliver_to_tgroup = false;
|
||||
$mention = false;
|
||||
|
||||
$u = q("select * from user where uid = %d and `page-flags` = %d limit 1",
|
||||
intval($uid),
|
||||
intval(PAGE_COMMUNITY)
|
||||
$u = q("select uid, nickname, language, username, email, `page-flags`, `notify-flags` from user where uid = %d limit 1",
|
||||
intval($uid)
|
||||
);
|
||||
if(! count($u))
|
||||
return;
|
||||
|
||||
$community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
|
||||
|
||||
$i = q("select * from item where id = %d and uid = %d limit 1",
|
||||
intval($item_id),
|
||||
intval($uid)
|
||||
|
@ -948,13 +948,6 @@ function tgroup_deliver($uid,$item_id) {
|
|||
|
||||
$item = $i[0];
|
||||
|
||||
// prevent delivery looping - only proceed
|
||||
// if the message originated elsewhere and is a top-level post
|
||||
|
||||
if(($item['wall']) || ($item['origin']) || ($item['id'] != $item['parent']))
|
||||
return;
|
||||
|
||||
|
||||
$link = normalise_link($a->get_baseurl() . '/profile/' . $u[0]['nickname']);
|
||||
|
||||
// Diaspora uses their own hardwired link URL in @-tags
|
||||
|
@ -966,13 +959,41 @@ function tgroup_deliver($uid,$item_id) {
|
|||
if($cnt) {
|
||||
foreach($matches as $mtch) {
|
||||
if(link_compare($link,$mtch[1]) || link_compare($dlink,$mtch[1])) {
|
||||
$deliver_to_tgroup = true;
|
||||
logger('tgroup_deliver: local group mention found: ' . $mtch[2]);
|
||||
$mention = true;
|
||||
logger('tag_deliver: mention found: ' . $mtch[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(! $deliver_to_tgroup)
|
||||
if(! $mention)
|
||||
return;
|
||||
|
||||
// send a notification
|
||||
|
||||
require_once('include/enotify.php');
|
||||
notification(array(
|
||||
'type' => NOTIFY_TAGSELF,
|
||||
'notify_flags' => $u[0]['notify-flags'],
|
||||
'language' => $u[0]['language'],
|
||||
'to_name' => $u[0]['username'],
|
||||
'to_email' => $u[0]['email'],
|
||||
'item' => $item,
|
||||
'link' => $a->get_baseurl() . '/display/' . $u[0]['nickname'] . '/' . $item['id'],
|
||||
'source_name' => $item['author-name'],
|
||||
'source_link' => $item['author-link'],
|
||||
'source_photo' => $item['author-avatar'],
|
||||
'verb' => ACTIVITY_TAG,
|
||||
'otype' => 'item'
|
||||
));
|
||||
|
||||
if(! $community_page)
|
||||
return;
|
||||
|
||||
// tgroup delivery - setup a second delivery chain
|
||||
// prevent delivery looping - only proceed
|
||||
// if the message originated elsewhere and is a top-level post
|
||||
|
||||
if(($item['wall']) || ($item['origin']) || ($item['id'] != $item['parent']))
|
||||
return;
|
||||
|
||||
// now change this copy of the post to a forum head message and deliver to all the tgroup members
|
||||
|
@ -1047,7 +1068,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
|
|||
$final_dfrn_id = '';
|
||||
|
||||
|
||||
if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
|
||||
if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY && strlen($contact['pubkey']))) {
|
||||
openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']);
|
||||
openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']);
|
||||
}
|
||||
|
@ -1090,7 +1111,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
|
|||
|
||||
|
||||
if($dfrn_version >= 2.1) {
|
||||
if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
|
||||
if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY && strlen($contact['pubkey']))) {
|
||||
openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']);
|
||||
}
|
||||
else {
|
||||
|
@ -1486,7 +1507,8 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
|
||||
if(count($r)) {
|
||||
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
|
||||
$r = q("UPDATE `item` SET `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($datarray['title']),
|
||||
dbesc($datarray['body']),
|
||||
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
|
||||
dbesc($item_id),
|
||||
|
@ -1616,7 +1638,8 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
|
||||
if(count($r)) {
|
||||
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
|
||||
$r = q("UPDATE `item` SET `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($datarray['title']),
|
||||
dbesc($datarray['body']),
|
||||
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
|
||||
dbesc($item_id),
|
||||
|
@ -2167,7 +2190,8 @@ function local_delivery($importer,$data) {
|
|||
|
||||
if(count($r)) {
|
||||
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
|
||||
$r = q("UPDATE `item` SET `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($datarray['title']),
|
||||
dbesc($datarray['body']),
|
||||
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
|
||||
dbesc($item_id),
|
||||
|
@ -2309,7 +2333,8 @@ function local_delivery($importer,$data) {
|
|||
|
||||
if(count($r)) {
|
||||
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
|
||||
$r = q("UPDATE `item` SET `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($datarray['title']),
|
||||
dbesc($datarray['body']),
|
||||
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
|
||||
dbesc($item_id),
|
||||
|
@ -2805,7 +2830,7 @@ function drop_item($id,$interactive = true) {
|
|||
|
||||
// delete the item
|
||||
|
||||
$r = q("UPDATE `item` SET `deleted` = 1, `body` = '', `edited` = '%s', `changed` = '%s' WHERE `id` = %d LIMIT 1",
|
||||
$r = q("UPDATE `item` SET `deleted` = 1, `title` = '', `body` = '', `edited` = '%s', `changed` = '%s' WHERE `id` = %d LIMIT 1",
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
intval($item['id'])
|
||||
|
@ -2838,7 +2863,7 @@ function drop_item($id,$interactive = true) {
|
|||
// If it's the parent of a comment thread, kill all the kids
|
||||
|
||||
if($item['uri'] == $item['parent-uri']) {
|
||||
$r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s', `body` = ''
|
||||
$r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s', `body` = '' , `title` = ''
|
||||
WHERE `parent-uri` = '%s' AND `uid` = %d ",
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
|
|
|
@ -579,6 +579,9 @@ function fetch_xrd_links($url) {
|
|||
|
||||
if(! function_exists('validate_url')) {
|
||||
function validate_url(&$url) {
|
||||
// no naked subdomains
|
||||
if(strpos($url,'.') === false)
|
||||
return false;
|
||||
if(substr($url,0,4) != 'http')
|
||||
$url = 'http://' . $url;
|
||||
$h = @parse_url($url);
|
||||
|
|
|
@ -56,25 +56,29 @@ function reload_plugins() {
|
|||
if(count($parr)) {
|
||||
foreach($parr as $pl) {
|
||||
$pl = trim($pl);
|
||||
|
||||
$t = filemtime('addon/' . $pl . '/' . $pl . '.php');
|
||||
foreach($installed as $i) {
|
||||
if(($i['name'] == $pl) && ($i['timestamp'] != $t)) {
|
||||
logger('Reloading plugin: ' . $i['name']);
|
||||
@include_once('addon/' . $pl . '/' . $pl . '.php');
|
||||
|
||||
if(function_exists($pl . '_uninstall')) {
|
||||
$func = $pl . '_uninstall';
|
||||
$func();
|
||||
$fname = 'addon/' . $pl . '/' . $pl . '.php';
|
||||
|
||||
if(file_exists($fname)) {
|
||||
$t = @filemtime($fname);
|
||||
foreach($installed as $i) {
|
||||
if(($i['name'] == $pl) && ($i['timestamp'] != $t)) {
|
||||
logger('Reloading plugin: ' . $i['name']);
|
||||
@include_once($fname);
|
||||
|
||||
if(function_exists($pl . '_uninstall')) {
|
||||
$func = $pl . '_uninstall';
|
||||
$func();
|
||||
}
|
||||
if(function_exists($pl . '_install')) {
|
||||
$func = $pl . '_install';
|
||||
$func();
|
||||
}
|
||||
q("UPDATE `addon` SET `timestamp` = %d WHERE `id` = %d LIMIT 1",
|
||||
intval($t),
|
||||
intval($i['id'])
|
||||
);
|
||||
}
|
||||
if(function_exists($pl . '_install')) {
|
||||
$func = $pl . '_install';
|
||||
$func();
|
||||
}
|
||||
q("UPDATE `addon` SET `timestamp` = %d WHERE `id` = %d LIMIT 1",
|
||||
intval($t),
|
||||
intval($i['id'])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,8 @@ function advanced_profile(&$a) {
|
|||
|
||||
if($a->profile['homepage']) $profile['homepage'] = array( t('Homepage:'), linkify($a->profile['homepage']) );
|
||||
|
||||
if($a->profile['pub_keywords']) $profile['pub_keywords'] = array( t('Tags:'), $a->profile['pub_keywords']);
|
||||
|
||||
if($a->profile['politic']) $profile['politic'] = array( t('Political Views:'), $a->profile['politic']);
|
||||
|
||||
if($a->profile['religion']) $profile['religion'] = array( t('Religion:'), $a->profile['religion']);
|
||||
|
|
|
@ -428,8 +428,10 @@ if(! function_exists('logger')) {
|
|||
function logger($msg,$level = 0) {
|
||||
// turn off logger in install mode
|
||||
global $a;
|
||||
if ($a->module == 'install') return;
|
||||
|
||||
global $db;
|
||||
|
||||
if(($a->module == 'install') || (! ($db && $db->connected))) return;
|
||||
|
||||
$debugging = get_config('system','debugging');
|
||||
$loglevel = intval(get_config('system','loglevel'));
|
||||
$logfile = get_config('system','logfile');
|
||||
|
@ -538,8 +540,10 @@ function contact_block() {
|
|||
$a = get_app();
|
||||
|
||||
$shown = get_pconfig($a->profile['uid'],'system','display_friend_count');
|
||||
if(! $shown)
|
||||
if($shown === false)
|
||||
$shown = 24;
|
||||
if($shown == 0)
|
||||
return;
|
||||
|
||||
if((! is_array($a->profile)) || ($a->profile['hide-friends']))
|
||||
return $o;
|
||||
|
@ -678,9 +682,9 @@ function smilies($s) {
|
|||
$a = get_app();
|
||||
|
||||
$s = str_replace(
|
||||
array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O', '\\o/', 'o.O', 'O.o', '\\.../', '\\ooo/',
|
||||
array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', ';)', ':-(', ':(', ':-P', ':P', ':-"', ':-"', ':-x', ':-X', ':-D', ':D', '8-|', '8-O', ':-O', '\\o/', 'o.O', 'O.o', '\\.../', '\\ooo/',
|
||||
':beer', ':homebrew', ':coffee',
|
||||
'~friendika', '~friendica', 'Diaspora*' ),
|
||||
'~friendika', '~friendica', 'Diaspora*' ),
|
||||
array(
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-heart.gif" alt="<3" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="</3" />',
|
||||
|
@ -688,21 +692,26 @@ function smilies($s) {
|
|||
'<img src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":-)" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":)" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-wink.gif" alt=";-)" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-wink.gif" alt=";)"/>',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-frown.gif" alt=":-(" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-frown.gif" alt=":(" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-tongue-out.gif" alt=":-P" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-tongue-out.gif" alt=":P" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-\"" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-\"" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-x" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-X" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-laughing.gif" alt=":-D" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-laughing.gif" alt=":D"/>',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt="8-|" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt="8-O" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt=":-O" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-thumbsup.gif" alt="\\o/" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="o.O" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="O.o" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-shaka.gif" alt="\\.../" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-shaka.gif" alt="\\ooo/" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-shaka.gif" alt="\\ooo/" />',
|
||||
|
||||
'<img src="' . $a->get_baseurl() . '/images/beer_mug.gif" alt=":beer" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/beer_mug.gif" alt=":homebrew" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/coffee.gif" alt=":coffee" />',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue