aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSebastian Egbers <sebastian@egbers.info>2012-06-26 08:33:41 +0200
committerSebastian Egbers <sebastian@egbers.info>2012-06-26 08:33:41 +0200
commit0f0fb2e2f3b9819e4f1b65c3ea1b96e78c008381 (patch)
tree8f38f64f6239f1c132b0e2118a4a9b42ba801752 /include
parent8c251aebc77a6daacfe20598fc861df4c243a726 (diff)
parenta4b407eb54c67a0c9b8137b44fbd20b43eccb224 (diff)
downloadvolse-hubzilla-0f0fb2e2f3b9819e4f1b65c3ea1b96e78c008381.tar.gz
volse-hubzilla-0f0fb2e2f3b9819e4f1b65c3ea1b96e78c008381.tar.bz2
volse-hubzilla-0f0fb2e2f3b9819e4f1b65c3ea1b96e78c008381.zip
Merge branch 'master' of https://github.com/friendica/friendica
Diffstat (limited to 'include')
-rw-r--r--include/api.php19
-rw-r--r--include/bb2diaspora.php14
-rw-r--r--include/bbcode.php20
-rw-r--r--include/datetime.php9
-rw-r--r--include/delivery.php2
-rw-r--r--include/event.php16
-rwxr-xr-xinclude/items.php163
-rw-r--r--include/notifier.php2
-rw-r--r--include/onepoll.php2
-rw-r--r--include/plugin.php21
10 files changed, 190 insertions, 78 deletions
diff --git a/include/api.php b/include/api.php
index 191ed6fcd..0a038b038 100644
--- a/include/api.php
+++ b/include/api.php
@@ -565,18 +565,19 @@
if(requestdata('lat') && requestdata('long'))
$_REQUEST['coord'] = sprintf("%s %s",requestdata('lat'),requestdata('long'));
$_REQUEST['profile_uid'] = local_user();
- if(requestdata('parent'))
+
+ if($parent)
$_REQUEST['type'] = 'net-comment';
else {
$_REQUEST['type'] = 'wall';
- if(x($_FILES,'media')) {
- // upload the image if we have one
- $_REQUEST['hush']='yeah'; //tell wall_upload function to return img info instead of echo
- require_once('mod/wall_upload.php');
- $media = wall_upload_post($a);
- if(strlen($media)>0)
- $_REQUEST['body'] .= "\n\n".$media;
- }
+ if(x($_FILES,'media')) {
+ // upload the image if we have one
+ $_REQUEST['hush']='yeah'; //tell wall_upload function to return img info instead of echo
+ require_once('mod/wall_upload.php');
+ $media = wall_upload_post($a);
+ if(strlen($media)>0)
+ $_REQUEST['body'] .= "\n\n".$media;
+ }
}
// set this so that the item_post() function is quiet and doesn't redirect or emit json
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index ac693127b..25edb28d7 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -109,20 +109,22 @@ function bb2diaspora($Text,$preserve_nl = false) {
// "<li>" into a deeper nested element until it crashes. So pre-format
// the lists as Diaspora lists before sending the $Text to bbcode()
//
- // Note that regular expressions are really not suitable for parsing
- // text with opening and closing tags, so nested lists may make things
- // wonky
+ // Note that to get nested lists to work for Diaspora, we would need
+ // to define the closing tag for the list elements. So nested lists
+ // are going to be flattened out in Diaspora for now
$endlessloop = 0;
- while ((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false) && (++$endlessloop < 20)) {
+ while ((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false) &&
+ (strpos($Text, "[/ol]") !== false) && (strpos($Text, "[ol]") !== false) &&
+ (strpos($Text, "[/ul]") !== false) && (strpos($Text, "[ul]") !== false) && (++$endlessloop < 20)) {
$Text = preg_replace_callback("/\[list\](.*?)\[\/list\]/is", 'diaspora_ul', $Text);
$Text = preg_replace_callback("/\[list=1\](.*?)\[\/list\]/is", 'diaspora_ol', $Text);
$Text = preg_replace_callback("/\[list=i\](.*?)\[\/list\]/s",'diaspora_ol', $Text);
$Text = preg_replace_callback("/\[list=I\](.*?)\[\/list\]/s", 'diaspora_ol', $Text);
$Text = preg_replace_callback("/\[list=a\](.*?)\[\/list\]/s", 'diaspora_ol', $Text);
$Text = preg_replace_callback("/\[list=A\](.*?)\[\/list\]/s", 'diaspora_ol', $Text);
+ $Text = preg_replace_callback("/\[ul\](.*?)\[\/ul\]/is", 'diaspora_ul', $Text);
+ $Text = preg_replace_callback("/\[ol\](.*?)\[\/ol\]/is", 'diaspora_ol', $Text);
}
- $Text = preg_replace_callback("/\[ul\](.*?)\[\/ul\]/is", 'diaspora_ul', $Text);
- $Text = preg_replace_callback("/\[ol\](.*?)\[\/ol\]/is", 'diaspora_ol', $Text);
// Convert it to HTML - don't try oembed
$Text = bbcode($Text, $preserve_nl, false);
diff --git a/include/bbcode.php b/include/bbcode.php
index f542ad263..ee31b4a1a 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -162,7 +162,10 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
// handle nested lists
$endlessloop = 0;
- while ((strpos($Text, "[/list]") !== false) and (strpos($Text, "[list") !== false) and (++$endlessloop < 20)) {
+
+ while ((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false) &&
+ (strpos($Text, "[/ol]") !== false) && (strpos($Text, "[ol]") !== false) &&
+ (strpos($Text, "[/ul]") !== false) && (strpos($Text, "[ul]") !== false) && (++$endlessloop < 20)) {
$Text = preg_replace("/\[list\](.*?)\[\/list\]/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);
@@ -170,11 +173,10 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
$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("/\[ul\](.*?)\[\/ul\]/ism", '<ul class="listbullet" style="list-style-type: circle;">$1</ul>' ,$Text);
+ $Text = preg_replace("/\[ol\](.*?)\[\/ol\]/ism", '<ul class="listdecimal" style="list-style-type: decimal;">$1</ul>' ,$Text);
}
- $Text = preg_replace("/\[ul\](.*?)\[\/ul\]/ism", '<ul class="listbullet" style="list-style-type: circle;">$1</ul>' ,$Text);
- $Text = preg_replace("/\[ol\](.*?)\[\/ol\]/ism", '<ul class="listdecimal" style="list-style-type: decimal;">$1</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);
@@ -295,12 +297,16 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
$Text = oembed_bbcode2html($Text);
// If we found an event earlier, strip out all the event code and replace with a reformatted version.
+ // Replace the event-start section with the entire formatted event. The other bbcode is stripped.
+ // Summary (e.g. title) is required, earlier revisions only required description (in addition to
+ // start which is always required). Allow desc with a missing summary for compatibility.
- if(x($ev,'desc') && x($ev,'start')) {
+ if((x($ev,'desc') || x($ev,'summary')) && x($ev,'start')) {
$sub = format_event_html($ev);
- $Text = preg_replace("/\[event\-description\](.*?)\[\/event\-description\]/ism",$sub,$Text);
- $Text = preg_replace("/\[event\-start\](.*?)\[\/event\-start\]/ism",'',$Text);
+ $Text = preg_replace("/\[event\-summary\](.*?)\[\/event\-summary\]/ism",'',$Text);
+ $Text = preg_replace("/\[event\-description\](.*?)\[\/event\-description\]/ism",'',$Text);
+ $Text = preg_replace("/\[event\-start\](.*?)\[\/event\-start\]/ism",$sub,$Text);
$Text = preg_replace("/\[event\-finish\](.*?)\[\/event\-finish\]/ism",'',$Text);
$Text = preg_replace("/\[event\-location\](.*?)\[\/event\-location\]/ism",'',$Text);
$Text = preg_replace("/\[event\-adjust\](.*?)\[\/event\-adjust\]/ism",'',$Text);
diff --git a/include/datetime.php b/include/datetime.php
index 58a618610..75ae685f3 100644
--- a/include/datetime.php
+++ b/include/datetime.php
@@ -447,11 +447,13 @@ function update_contact_birthdays() {
*
*/
- $bdtext = t('Birthday:') . ' [url=' . $rr['url'] . ']' . $rr['name'] . '[/url]' ;
+ $bdtext = sprintf( t('%s\'s birthday'), $rr['name']);
+ $bdtext2 = sprintf( t('Happy Birthday %s'), ' [url=' . $rr['url'] . ']' . $rr['name'] . '[/url]') ;
- $r = q("INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`desc`,`type`,`adjust`)
- VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%d' ) ",
+
+ $r = q("INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`summary`,`desc`,`type`,`adjust`)
+ VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d' ) ",
intval($rr['uid']),
intval($rr['id']),
dbesc(datetime_convert()),
@@ -459,6 +461,7 @@ function update_contact_birthdays() {
dbesc(datetime_convert('UTC','UTC', $nextbd)),
dbesc(datetime_convert('UTC','UTC', $nextbd . ' + 1 day ')),
dbesc($bdtext),
+ dbesc($bdtext2),
dbesc('birthday'),
intval(0)
);
diff --git a/include/delivery.php b/include/delivery.php
index e6cfc8155..815287668 100644
--- a/include/delivery.php
+++ b/include/delivery.php
@@ -113,7 +113,7 @@ function delivery_run($argv, $argc){
$uid = $r[0]['uid'];
$updated = $r[0]['edited'];
- // The following seems superfluous. We've already checked for "if (! intval($r[0]['parent']))" a few lines up
+ // POSSIBLE CLEANUP --> The following seems superfluous. We've already checked for "if (! intval($r[0]['parent']))" a few lines up
if(! $parent_id)
continue;
diff --git a/include/event.php b/include/event.php
index 866ae8c3f..8aef0a263 100644
--- a/include/event.php
+++ b/include/event.php
@@ -12,6 +12,9 @@ function format_event_html($ev) {
$o = '<div class="vevent">' . "\r\n";
+
+ $o .= '<p class="summary event-summary">' . bbcode($ev['summary']) . '</p>' . "\r\n";
+
$o .= '<p class="description event-description">' . bbcode($ev['desc']) . '</p>' . "\r\n";
$o .= '<p class="event-start">' . t('Starts:') . ' <abbr class="dtstart" title="'
@@ -114,6 +117,9 @@ function format_event_bbcode($ev) {
$o = '';
+ if($ev['summary'])
+ $o .= '[event-summary]' . $ev['summary'] . '[/event-summary]';
+
if($ev['desc'])
$o .= '[event-description]' . $ev['desc'] . '[/event-description]';
@@ -148,6 +154,9 @@ function bbtoevent($s) {
$ev = array();
$match = '';
+ if(preg_match("/\[event\-summary\](.*?)\[\/event\-summary\]/is",$s,$match))
+ $ev['summary'] = $match[1];
+ $match = '';
if(preg_match("/\[event\-description\](.*?)\[\/event\-description\]/is",$s,$match))
$ev['desc'] = $match[1];
$match = '';
@@ -244,6 +253,7 @@ function event_store($arr) {
`edited` = '%s',
`start` = '%s',
`finish` = '%s',
+ `summary` = '%s',
`desc` = '%s',
`location` = '%s',
`type` = '%s',
@@ -258,6 +268,7 @@ function event_store($arr) {
dbesc($arr['edited']),
dbesc($arr['start']),
dbesc($arr['finish']),
+ dbesc($arr['summary']),
dbesc($arr['desc']),
dbesc($arr['location']),
dbesc($arr['type']),
@@ -306,9 +317,9 @@ function event_store($arr) {
// New event. Store it.
- $r = q("INSERT INTO `event` ( `uid`,`cid`,`uri`,`created`,`edited`,`start`,`finish`,`desc`,`location`,`type`,
+ $r = q("INSERT INTO `event` ( `uid`,`cid`,`uri`,`created`,`edited`,`start`,`finish`,`summary`, `desc`,`location`,`type`,
`adjust`,`nofinish`,`allow_cid`,`allow_gid`,`deny_cid`,`deny_gid`)
- VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",
+ VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",
intval($arr['uid']),
intval($arr['cid']),
dbesc($arr['uri']),
@@ -316,6 +327,7 @@ function event_store($arr) {
dbesc($arr['edited']),
dbesc($arr['start']),
dbesc($arr['finish']),
+ dbesc($arr['summary']),
dbesc($arr['desc']),
dbesc($arr['location']),
dbesc($arr['type']),
diff --git a/include/items.php b/include/items.php
index e495393fa..1f0571968 100755
--- a/include/items.php
+++ b/include/items.php
@@ -1457,11 +1457,12 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
*
*/
- $bdtext = t('Birthday:') . ' [url=' . $contact['url'] . ']' . $contact['name'] . '[/url]' ;
+ $bdtext = sprintf( t('%s\'s birthday'), $contact['name']);
+ $bdtext2 = sprintf( t('Happy Birthday %s'), ' [url=' . $contact['url'] . ']' . $contact['name'] . '[/url]' ) ;
- $r = q("INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`desc`,`type`)
- VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s' ) ",
+ $r = q("INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`summary`,`desc`,`type`)
+ VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ",
intval($contact['uid']),
intval($contact['id']),
dbesc(datetime_convert()),
@@ -1469,6 +1470,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
dbesc(datetime_convert('UTC','UTC', $birthday)),
dbesc(datetime_convert('UTC','UTC', $birthday . ' + 1 day ')),
dbesc($bdtext),
+ dbesc($bdtext2),
dbesc('birthday')
);
@@ -2148,6 +2150,67 @@ function local_delivery($importer,$data) {
}
if($deleted) {
+ // check for relayed deletes to our conversation
+
+ $is_reply = false;
+ $r = q("select * from item where uri = '%s' and uid = %d limit 1",
+ dbesc($uri),
+ intval($importer['importer_uid'])
+ );
+ if(count($r)) {
+ $parent_uri = $r[0]['parent-uri'];
+ if($r[0]['id'] != $r[0]['parent'])
+ $is_reply = true;
+ }
+
+ if($is_reply) {
+ $community = false;
+
+ if($importer['page-flags'] == PAGE_COMMUNITY || $importer['page-flags'] == PAGE_PRVGROUP ) {
+ $sql_extra = '';
+ $community = true;
+ logger('local_delivery: possible community delete');
+ }
+ else
+ $sql_extra = " and contact.self = 1 and item.wall = 1 ";
+
+ // was the top-level post for this reply written by somebody on this site?
+ // Specifically, the recipient?
+
+ $is_a_remote_delete = false;
+
+ $r = q("select `item`.`id`, `item`.`uri`, `item`.`tag`, `item`.`forum_mode`,`item`.`origin`,`item`.`wall`,
+ `contact`.`name`, `contact`.`url`, `contact`.`thumb` from `item`
+ LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
+ WHERE `item`.`uri` = '%s' AND (`item`.`parent-uri` = '%s' or `item`.`thr-parent` = '%s')
+ AND `item`.`uid` = %d
+ $sql_extra
+ LIMIT 1",
+ dbesc($parent_uri),
+ dbesc($parent_uri),
+ dbesc($parent_uri),
+ intval($importer['importer_uid'])
+ );
+ if($r && count($r))
+ $is_a_remote_delete = true;
+
+ // Does this have the characteristics of a community or private group comment?
+ // If it's a reply to a wall post on a community/prvgroup page it's a
+ // valid community comment. Also forum_mode makes it valid for sure.
+ // If neither, it's not.
+
+ if($is_a_remote_delete && $community) {
+ if((! $r[0]['forum_mode']) && (! $r[0]['wall'])) {
+ $is_a_remote_delete = false;
+ logger('local_delivery: not a community delete');
+ }
+ }
+
+ if($is_a_remote_delete) {
+ logger('local_delivery: received remote delete');
+ }
+ }
+
$r = q("SELECT `item`.*, `contact`.`self` FROM `item` left join contact on `item`.`contact-id` = `contact`.`id`
WHERE `uri` = '%s' AND `item`.`uid` = %d AND `contact-id` = %d AND NOT `item`.`file` LIKE '%%[%%' LIMIT 1",
dbesc($uri),
@@ -2235,7 +2298,11 @@ function local_delivery($importer,$data) {
);
}
}
- }
+ // if this is a relayed delete, propagate it to other recipients
+
+ if($is_a_remote_delete)
+ proc_run('php',"include/notifier.php","drop",$item['id']);
+ }
}
}
}
@@ -2268,6 +2335,7 @@ function local_delivery($importer,$data) {
$is_a_remote_comment = false;
+ // POSSIBLE CLEANUP --> Why select so many fields when only forum_mode and wall are used?
$r = q("select `item`.`id`, `item`.`uri`, `item`.`tag`, `item`.`forum_mode`,`item`.`origin`,`item`.`wall`,
`contact`.`name`, `contact`.`url`, `contact`.`thumb` from `item`
LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
@@ -3359,40 +3427,8 @@ function drop_item($id,$interactive = true) {
);
}
- // Add a relayable_retraction signature for Diaspora. Note that we can't add a target_author_signature
- // if the comment was deleted by a remote user. That should be ok, because if a remote user is deleting
- // the comment, that means we're the home of the post, and Diaspora will only
- // check the parent_author_signature of retractions that it doesn't have to relay further
- //
- // I don't think this function gets called for an "unlike," but I'll check anyway
- $signed_text = $item['guid'] . ';' . ( ($item['verb'] === ACTIVITY_LIKE) ? 'Like' : 'Comment');
-
- if(local_user() == $item['uid']) {
-
- $handle = $a->user['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
- $authorsig = base64_encode(rsa_sign($signed_text,$a->user['prvkey'],'sha256'));
- }
- else {
- $r = q("SELECT `nick`, `url` FROM `contact` WHERE `id` = '%d' LIMIT 1",
- $item['contact-id']
- );
- if(count($r)) {
- // The below handle only works for NETWORK_DFRN. I think that's ok, because this function
- // only handles DFRN deletes
- $handle_baseurl_start = strpos($r['url'],'://') + 3;
- $handle_baseurl_length = strpos($r['url'],'/profile') - $handle_baseurl_start;
- $handle = $r['nick'] . '@' . substr($r['url'], $handle_baseurl_start, $handle_baseurl_length);
- $authorsig = '';
- }
- }
-
- if(isset($handle))
- q("insert into sign (`retract_iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
- intval($item['id']),
- dbesc($signed_text),
- dbesc($authorsig),
- dbesc($handle)
- );
+ // Add a relayable_retraction signature for Diaspora.
+ store_diaspora_retract_sig($item, $a->user, $a->get_baseurl());
}
$drop_id = intval($item['id']);
@@ -3479,4 +3515,53 @@ function posted_date_widget($url,$uid,$wall) {
'$dates' => $ret
));
return $o;
-} \ No newline at end of file
+}
+
+
+function store_diaspora_retract_sig($item, $user, $baseurl) {
+ // Note that we can't add a target_author_signature
+ // if the comment was deleted by a remote user. That should be ok, because if a remote user is deleting
+ // the comment, that means we're the home of the post, and Diaspora will only
+ // check the parent_author_signature of retractions that it doesn't have to relay further
+ //
+ // I don't think this function gets called for an "unlike," but I'll check anyway
+
+ $enabled = intval(get_config('system','diaspora_enabled'));
+ if(! $enabled) {
+ logger('drop_item: diaspora support disabled, not storing retraction signature', LOGGER_DEBUG);
+ return;
+ }
+
+ logger('drop_item: storing diaspora retraction signature');
+
+ $signed_text = $item['guid'] . ';' . ( ($item['verb'] === ACTIVITY_LIKE) ? 'Like' : 'Comment');
+
+ if(local_user() == $item['uid']) {
+
+ $handle = $user['nickname'] . '@' . substr($baseurl, strpos($baseurl,'://') + 3);
+ $authorsig = base64_encode(rsa_sign($signed_text,$user['prvkey'],'sha256'));
+ }
+ else {
+ $r = q("SELECT `nick`, `url` FROM `contact` WHERE `id` = '%d' LIMIT 1",
+ $item['contact-id']
+ );
+ if(count($r)) {
+ // The below handle only works for NETWORK_DFRN. I think that's ok, because this function
+ // only handles DFRN deletes
+ $handle_baseurl_start = strpos($r['url'],'://') + 3;
+ $handle_baseurl_length = strpos($r['url'],'/profile') - $handle_baseurl_start;
+ $handle = $r['nick'] . '@' . substr($r['url'], $handle_baseurl_start, $handle_baseurl_length);
+ $authorsig = '';
+ }
+ }
+
+ if(isset($handle))
+ q("insert into sign (`retract_iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
+ intval($item['id']),
+ dbesc($signed_text),
+ dbesc($authorsig),
+ dbesc($handle)
+ );
+
+ return;
+}
diff --git a/include/notifier.php b/include/notifier.php
index f0a1940d4..443cc3014 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -125,7 +125,7 @@ function notifier_run($argv, $argc){
$uid = $r[0]['uid'];
$updated = $r[0]['edited'];
- // The following seems superfluous. We've already checked for "if (! intval($r[0]['parent']))" a few lines up
+ // POSSIBLE CLEANUP --> The following seems superfluous. We've already checked for "if (! intval($r[0]['parent']))" a few lines up
if(! $parent_id)
return;
diff --git a/include/onepoll.php b/include/onepoll.php
index d68f26883..09e7bb763 100644
--- a/include/onepoll.php
+++ b/include/onepoll.php
@@ -449,7 +449,7 @@ function onepoll_run($argv, $argc){
if($xml) {
logger('poller: received xml : ' . $xml, LOGGER_DATA);
- if((! strstr($xml,'<?xml')) && (! strstr($xml,'<rss'))) {
+ if((! strstr($xml,'<?xml')) && (! strstr($xml,'<rss'))) {
logger('poller: post_handshake: response from ' . $url . ' did not contain XML.');
$r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1",
dbesc(datetime_convert()),
diff --git a/include/plugin.php b/include/plugin.php
index d762e8717..ffa562273 100644
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -380,20 +380,23 @@ function service_class_fetch($uid,$property) {
}
-function upgrade_link() {
+function upgrade_link($bbcode = false) {
$l = get_config('service_class','upgrade_link');
- $t = sprintf('<a href="%s">' . t('Click here to upgrade.') . '</div>', $l);
- if($l)
- return $t;
- return '';
+ if(! $l)
+ return '';
+ if($bbcode)
+ $t = sprintf('[url=%s]' . t('Click here to upgrade.') . '[/url]', $l);
+ else
+ $t = sprintf('<a href="%s">' . t('Click here to upgrade.') . '</div>', $l);
+ return $t;
}
-function upgrade_message() {
- $x = upgrade_link();
+function upgrade_message($bbcode = false) {
+ $x = upgrade_link($bbcode);
return t('This action exceeds the limits set by your subscription plan.') . (($x) ? ' ' . $x : '') ;
}
-function upgrade_bool_message() {
- $x = upgrade_link();
+function upgrade_bool_message($bbcode = false) {
+ $x = upgrade_link($bbcode);
return t('This action is not available under your subscription plan.') . (($x) ? ' ' . $x : '') ;
}