aboutsummaryrefslogtreecommitdiffstats
path: root/mod/item.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/item.php')
-rw-r--r--mod/item.php22
1 files changed, 17 insertions, 5 deletions
diff --git a/mod/item.php b/mod/item.php
index dd42014eb..b4ec7666f 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -332,6 +332,15 @@ function item_post(&$a) {
}
}
+ // embedded bookmark in post? convert to regular url and set bookmark flag
+
+ $bookmark = 0;
+ if(preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/m",$body,$match)) {
+ $bookmark = 1;
+ $body = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/m",'[url=$1]$2[/url]',$body);
+ }
+
+
/**
* Fold multi-line [code] sequences
*/
@@ -353,7 +362,7 @@ function item_post(&$a) {
* and we are replying, and there isn't one already
*/
- if(($parent_contact) && ($parent_contact['network'] === 'stat')
+ if(($parent_contact) && ($parent_contact['network'] === NETWORK_OSTATUS)
&& ($parent_contact['nick']) && (! in_array('@' . $parent_contact['nick'],$tags))) {
$body = '@' . $parent_contact['nick'] . ' ' . $body;
$tags[] = '@' . $parent_contact['nick'];
@@ -404,7 +413,8 @@ function item_post(&$a) {
);
}
else {
- $r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
+ $r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
+ dbesc($name),
dbesc($name),
intval($profile_uid)
);
@@ -508,6 +518,7 @@ function item_post(&$a) {
$datarray['private'] = $private;
$datarray['pubmail'] = $pubmail_enable;
$datarray['attach'] = $attachments;
+ $datarray['bookmark'] = intval($bookmark);
$datarray['thr-parent'] = $thr_parent;
/**
@@ -550,8 +561,8 @@ function item_post(&$a) {
$r = q("INSERT INTO `item` (`guid`, `uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
`author-name`, `author-link`, `author-avatar`, `created`, `edited`, `received`, `changed`, `uri`, `thr-parent`, `title`, `body`, `app`, `location`, `coord`,
- `tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach` )
- VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s' )",
+ `tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark` )
+ VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d )",
dbesc($datarray['guid']),
intval($datarray['uid']),
dbesc($datarray['type']),
@@ -584,7 +595,8 @@ function item_post(&$a) {
dbesc($datarray['deny_gid']),
intval($datarray['private']),
intval($datarray['pubmail']),
- dbesc($datarray['attach'])
+ dbesc($datarray['attach']),
+ intval($datarray['bookmark'])
);
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",