aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/api.php7
-rw-r--r--include/comanche.php9
-rwxr-xr-xinclude/items.php2
-rw-r--r--include/message.php11
-rwxr-xr-xinclude/plugin.php11
5 files changed, 26 insertions, 14 deletions
diff --git a/include/api.php b/include/api.php
index f279b2aa3..e60583a01 100644
--- a/include/api.php
+++ b/include/api.php
@@ -382,7 +382,6 @@ require_once('include/api_auth.php');
function api_item_get_user(&$a, $item) {
- global $usercache;
// The author is our direct contact, in a conversation with us.
@@ -396,11 +395,11 @@ require_once('include/api_auth.php');
$name = $item['author']['xchan_name'];
// Generating a random ID
- if (is_null($usercache[$nick]) or !array_key_exists($nick, $usercache))
- $usercache[$nick] = mt_rand(2000000, 2100000);
+ if (! $nick)
+ $nick = mt_rand(2000000, 2100000);
$ret = array(
- 'id' => $usercache[$nick],
+ 'id' => $nick,
'name' => $name,
'screen_name' => $nick,
'location' => '', //$uinfo[0]['default-location'],
diff --git a/include/comanche.php b/include/comanche.php
index 9585a6578..ef71886f2 100644
--- a/include/comanche.php
+++ b/include/comanche.php
@@ -282,15 +282,16 @@ function comanche_widget($name, $text) {
}
}
- if(file_exists('widget/' . trim($name) . '.php'))
+ $func = 'widget_' . trim($name);
+
+ if((! function_exists($func)) && file_exists('widget/' . trim($name) . '.php'))
require_once('widget/' . trim($name) . '.php');
else {
- $theme_widget = 'widget_' . trim($name) . '.php';
- if(theme_include($theme_widget))
+ $theme_widget = $func . '.php';
+ if((! function_exists($func)) && theme_include($theme_widget))
require_once(theme_include($theme_widget));
}
- $func = 'widget_' . trim($name);
if (function_exists($func))
return $func($vars);
}
diff --git a/include/items.php b/include/items.php
index 46b396ad2..ef1867c14 100755
--- a/include/items.php
+++ b/include/items.php
@@ -3474,7 +3474,7 @@ function post_is_importable($item,$abook) {
unobscure($item);
$text = prepare_text($item['body'],$item['mimetype']);
- $text = html2plain($text);
+ $text = html2plain(($item['title']) ? $item['title'] . ' ' . $text : $text);
$lang = null;
diff --git a/include/message.php b/include/message.php
index 820d814b6..6a9e8328a 100644
--- a/include/message.php
+++ b/include/message.php
@@ -13,6 +13,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
$ret = array('success' => false);
$a = get_app();
+ $observer_hash = get_observer_hash();
if(! $recipient) {
$ret['message'] = t('No recipient provided.');
@@ -148,8 +149,8 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
$match = null;
$images = null;
- if(preg_match_all("/\[zmg\](.*?)\[\/zmg\]/",((strpos($body,'[/crypt]')) ? $_POST['media_str'] : $body),$match))
- $images = $match[1];
+ if(preg_match_all("/\[zmg\=([0-9]*)x([0-9]*)\](.*?)\[\/zmg\]/",((strpos($body,'[/crypt]')) ? $_POST['media_str'] : $body),$match))
+ $images = $match[3];
$match = false;
@@ -173,7 +174,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
'revision' => $r['data']['revision']
);
}
- $body = str_replace($match[1],'',$body);
+ $body = trim(str_replace($match[1],'',$body));
}
}
@@ -230,7 +231,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
dbesc($image_uri),
intval($channel['channel_id']),
dbesc('<' . $channel['channel_hash'] . '>')
- );
+ );
$r = q("UPDATE attach SET allow_cid = '%s' WHERE hash = '%s' AND is_photo = 1 and uid = %d and allow_cid = '%s'",
dbesc('<' . $recipient . '>'),
dbesc($image_uri),
@@ -239,7 +240,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
);
}
}
-
+
if($attaches) {
foreach($attaches as $attach) {
$hash = substr($attach,0,strpos($attach,','));
diff --git a/include/plugin.php b/include/plugin.php
index 8749f3fbf..1d4caac0f 100755
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -616,3 +616,14 @@ function get_markup_template($s, $root = '') {
$template = $t->get_markup_template($s, $root);
return $template;
}
+
+// return the standardised version. Since we can't easily compare
+// before the STD_VERSION definition was applied, we have to treat
+// all prior release versions the same. You can dig through them
+// with other means (such as RED_VERSION) if necessary.
+
+function get_std_version() {
+ if(defined('STD_VERSION'))
+ return STD_VERSION;
+ return '0.0.0';
+}