aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/bbcode.php21
-rw-r--r--include/notifier.php10
2 files changed, 25 insertions, 6 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 5504dce7a..7067fcd39 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -57,7 +57,7 @@ function bb_unspacefy_and_trim($st) {
return $unspacefied;
}
-if(! function_exists('bb_extract_images')) {
+
function bb_extract_images($body) {
$saved_image = array();
@@ -97,24 +97,27 @@ function bb_extract_images($body) {
$new_body = $new_body . $orig_body;
return array('body' => $new_body, 'images' => $saved_image);
-}}
+}
+
-if(! function_exists('bb_replace_images')) {
function bb_replace_images($body, $images) {
$newbody = $body;
$cnt = 0;
+ if(! $images)
+ return $newbody;
+
foreach($images as $image) {
// We're depending on the property of 'foreach' (specified on the PHP website) that
// it loops over the array starting from the first element and going sequentially
// to the last element
- $newbody = str_replace('[$#saved_image' . $cnt . '#$]', '<img class="zrl" src="' . $image .'" alt="' . t('Image/photo') . '" />', $newbody);
+ $newbody = str_replace('[$#saved_image' . $cnt . '#$]', '<img src="' . $image .'" alt="' . t('Image/photo') . '" />', $newbody);
$cnt++;
}
-
+// logger('replace_images: ' . $newbody);
return $newbody;
-}}
+}
@@ -404,6 +407,10 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
}
+ $x = bb_extract_images($Text);
+ $Text = $x['body'];
+ $saved_images = $x['images'];
+
$Text = str_replace(array('[baseurl]','[sitename]'),array(z_root(),get_config('system','sitename')),$Text);
@@ -853,6 +860,8 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
$Text = preg_replace("/\<(.*?)(src|href)=\"[^hfm#](.*?)\>/ism",'<$1$2="">',$Text);
+ $Text = bb_replace_images($Text,$saved_images);
+
call_hooks('bbcode',$Text);
return $Text;
diff --git a/include/notifier.php b/include/notifier.php
index 06ef7bc94..edb2f1946 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -59,6 +59,7 @@ require_once('include/html2plain.php');
* relay item_id (item was relayed to owner, we will deliver it as owner)
* location channel_id
* request channel_id xchan_hash message_id
+ * rating xlink_id
*
*/
@@ -296,6 +297,15 @@ function notifier_run($argv, $argc){
$private = false;
$packet_type = 'purge';
}
+ elseif($cmd === 'rating') {
+ $r = q("select * from xlink where xlink_id = %d and xlink_static = 1 limit 1",
+ intval($item_id)
+ );
+ if($r) {
+ logger('rating message: ' . print_r($r[0],true));
+ return;
+ }
+ }
else {
// Normal items