aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xinclude/items.php8
-rw-r--r--mod/content.php2
-rw-r--r--mod/item.php48
-rw-r--r--mod/network.php21
4 files changed, 22 insertions, 57 deletions
diff --git a/include/items.php b/include/items.php
index 36a027eec..5ae769244 100755
--- a/include/items.php
+++ b/include/items.php
@@ -488,11 +488,6 @@ function get_atom_elements($feed,$item) {
if($dguid)
$res['guid'] = unxmlify($dguid[0]['data']);
- $bm = $item->get_item_tags(NAMESPACE_DFRN,'bookmark');
- if($bm)
- $res['bookmark'] = ((unxmlify($bm[0]['data']) === 'true') ? 1 : 0);
-
-
/**
* If there's a copy of the body content which is guaranteed to have survived mangling in transit, use it.
*/
@@ -849,7 +844,6 @@ function item_store($arr,$force_parent = false) {
$arr['deny_cid'] = ((x($arr,'deny_cid')) ? trim($arr['deny_cid']) : '');
$arr['deny_gid'] = ((x($arr,'deny_gid')) ? trim($arr['deny_gid']) : '');
$arr['private'] = ((x($arr,'private')) ? intval($arr['private']) : 0 );
- $arr['bookmark'] = ((x($arr,'bookmark')) ? intval($arr['bookmark']) : 0 );
$arr['body'] = ((x($arr,'body')) ? trim($arr['body']) : '');
$arr['tag'] = ((x($arr,'tag')) ? notags(trim($arr['tag'])) : '');
$arr['attach'] = ((x($arr,'attach')) ? notags(trim($arr['attach'])) : '');
@@ -3138,8 +3132,6 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) {
if($item['extid'])
$o .= '<dfrn:extid>' . xmlify($item['extid']) . '</dfrn:extid>' . "\r\n";
- if($item['bookmark'])
- $o .= '<dfrn:bookmark>true</dfrn:bookmark>' . "\r\n";
if($item['app'])
$o .= '<statusnet:notice_info local_id="' . $item['id'] . '" source="' . xmlify($item['app']) . '" ></statusnet:notice_info>' . "\r\n";
diff --git a/mod/content.php b/mod/content.php
index 5f3e954f6..01856d88d 100644
--- a/mod/content.php
+++ b/mod/content.php
@@ -69,7 +69,6 @@ function content_content(&$a, $update = 0) {
$cid = ((x($_GET,'cid')) ? intval($_GET['cid']) : 0);
$star = ((x($_GET,'star')) ? intval($_GET['star']) : 0);
- $bmark = ((x($_GET,'bmark')) ? intval($_GET['bmark']) : 0);
$order = ((x($_GET,'order')) ? notags($_GET['order']) : 'comment');
$liked = ((x($_GET,'liked')) ? intval($_GET['liked']) : 0);
$conv = ((x($_GET,'conv')) ? intval($_GET['conv']) : 0);
@@ -102,7 +101,6 @@ function content_content(&$a, $update = 0) {
$sql_options = (($star) ? " and starred = 1 " : '');
- $sql_options .= (($bmark) ? " and bookmark = 1 " : '');
$sql_nets = (($nets) ? sprintf(" and `contact`.`network` = '%s' ", dbesc($nets)) : '');
diff --git a/mod/item.php b/mod/item.php
index 554e97fe4..2236fd536 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -177,7 +177,7 @@ function item_post(&$a) {
$emailcc = $orig_post['emailcc'];
$app = $orig_post['app'];
$categories = $orig_post['file'];
- $title = notags(trim($_REQUEST['title']));
+ $title = escape_tags(trim($_REQUEST['title']));
$body = escape_tags(trim($_REQUEST['body']));
$private = $orig_post['private'];
$pubmail_enable = $orig_post['pubmail'];
@@ -209,7 +209,7 @@ function item_post(&$a) {
$str_contact_deny = perms2str($_REQUEST['contact_deny']);
}
- $title = notags(trim($_REQUEST['title']));
+ $title = escape_tags(trim($_REQUEST['title']));
$location = notags(trim($_REQUEST['location']));
$coord = notags(trim($_REQUEST['coord']));
$verb = notags(trim($_REQUEST['verb']));
@@ -413,13 +413,6 @@ function item_post(&$a) {
}
}
- // embedded bookmark in post? set bookmark flag
-
- $bookmark = 0;
- if(preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",$body,$match,PREG_SET_ORDER)) {
- $bookmark = 1;
- }
-
$body = bb_translate_video($body);
/**
@@ -436,7 +429,7 @@ function item_post(&$a) {
$str_tags = '';
$inform = '';
-
+ $post_tags = array();
$tags = get_tags($body);
@@ -472,8 +465,16 @@ function item_post(&$a) {
continue;
$success = handle_tag($a, $body, $inform, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag);
- if($success['replaced'])
+ if($success['replaced']) {
$tagged[] = $tag;
+ $post_tags[] = array(
+ 'uid' => $profile_uid,
+ 'type' => $success['termtype'],
+ 'otype' => TAG_OBJ_POST,
+ 'term' => substr($tag,1),
+ 'url' => $success['url']
+ );
+ }
if(is_array($success['contact']) && intval($success['contact']['prv'])) {
$private_forum = true;
$private_id = $success['contact']['id'];
@@ -559,7 +560,6 @@ function item_post(&$a) {
$datarray['private'] = $private;
$datarray['pubmail'] = $pubmail_enable;
$datarray['attach'] = $attachments;
- $datarray['bookmark'] = intval($bookmark);
$datarray['thr-parent'] = $thr_parent;
$datarray['postopts'] = '';
$datarray['origin'] = $origin;
@@ -636,8 +636,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`, `commented`, `received`, `changed`, `uri`, `thr-parent`, `title`, `body`, `app`, `location`, `coord`,
- `tag`, `inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark`,`origin`, `moderated`, `file` )
- 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', '%s', '%s', %d, %d, '%s', %d, %d, %d, '%s' )",
+ `tag`, `inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`,`origin`, `moderated`, `file` )
+ 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', '%s', '%s', %d, %d, '%s', %d, %d, '%s' )",
dbesc($datarray['guid']),
intval($datarray['uid']),
dbesc($datarray['type']),
@@ -673,7 +673,6 @@ function item_post(&$a) {
intval($datarray['private']),
intval($datarray['pubmail']),
dbesc($datarray['attach']),
- intval($datarray['bookmark']),
intval($datarray['origin']),
intval($datarray['moderated']),
dbesc($datarray['file'])
@@ -891,6 +890,9 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
$replaced = false;
$r = null;
+ $termtype = ((strpos($tag,'#') === 0) ? TERM_HASHTAG : TERM_UNKNOWN);
+ $termtype = ((strpos($tag,'@') === 0) ? TERM_MENTION : $termtype);
+
//is it a hash tag?
if(strpos($tag,'#') === 0) {
//if the tag is replaced...
@@ -900,6 +902,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
//base tag has the tags name only
$basetag = str_replace('_',' ',substr($tag,1));
//create text for link
+ $url = $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag);
$newtag = '#[url=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]';
//replace tag by the link
$body = str_replace($tag, $newtag, $body);
@@ -997,6 +1000,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
$replaced = true;
//create profile link
$profile = str_replace(',','%2c',$profile);
+ $url = $profile;
$newtag = '@[url=' . $profile . ']' . $newname . '[/url]';
$body = str_replace('@' . $name, $newtag, $body);
//append tag to str_tags
@@ -1005,22 +1009,10 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
$str_tags .= ',';
$str_tags .= $newtag;
}
-
- // Status.Net seems to require the numeric ID URL in a mention if the person isn't
- // subscribed to you. But the nickname URL is OK if they are. Grrr. We'll tag both.
-
- if(strlen($alias)) {
- $newtag = '@[url=' . $alias . ']' . $newname . '[/url]';
- if(! stristr($str_tags,$newtag)) {
- if(strlen($str_tags))
- $str_tags .= ',';
- $str_tags .= $newtag;
- }
- }
}
}
- return array('replaced' => $replaced, 'contact' => $r[0]);
+ return array('replaced' => $replaced, 'termtype' => $termtype, 'url' => $url, 'contact' => $r[0]);
}
diff --git a/mod/network.php b/mod/network.php
index 5f009dacd..35a981512 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -33,7 +33,6 @@ function network_init(&$a) {
'/network?f=&conv=1', //conv
'/network/new', //new
'/network?f=&star=1', //starred
- '/network?f=&bmark=1', //bookmarked
'/network?f=&spam=1', //spam
);
@@ -112,7 +111,6 @@ function saved_searches($search) {
$srchurl = '/network?f='
. ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '')
. ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '')
- . ((x($_GET,'bmark')) ? '&bmark=' . $_GET['bmark'] : '')
. ((x($_GET,'conv')) ? '&conv=' . $_GET['conv'] : '')
. ((x($_GET,'nets')) ? '&nets=' . $_GET['nets'] : '')
. ((x($_GET,'cmin')) ? '&cmin=' . $_GET['cmin'] : '')
@@ -163,10 +161,9 @@ function saved_searches($search) {
* '/network?f=&conv=1', => $conv_active = 'active'
* '/network/new', => $new_active = 'active'
* '/network?f=&star=1', => $starred_active = 'active'
- * '/network?f=&bmark=1', => $bookmarked_active = 'active'
* '/network?f=&spam=1', => $spam_active = 'active'
*
- * @return Array ( $no_active, $comment_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active );
+ * @return Array ( $no_active, $comment_active, $postord_active, $conv_active, $new_active, $starred_active, $spam_active );
*/
function network_query_get_sel_tab($a) {
$no_active='';
@@ -192,10 +189,6 @@ function network_query_get_sel_tab($a) {
$starred_active = 'active';
}
- if(x($_GET,'bmark')) {
- $bookmarked_active = 'active';
- }
-
if(x($_GET,'conv')) {
$conv_active = 'active';
}
@@ -208,7 +201,6 @@ function network_query_get_sel_tab($a) {
if (($new_active == '')
&& ($starred_active == '')
- && ($bookmarked_active == '')
&& ($conv_active == '')
&& ($search_active == '')
&& ($spam_active == '')) {
@@ -222,7 +214,7 @@ function network_query_get_sel_tab($a) {
}
}
- return array($no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active);
+ return array($no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $spam_active);
}
@@ -314,12 +306,6 @@ function network_content(&$a, $update = 0) {
'sel'=>$starred_active,
'title' => t('Favourite Posts'),
),
- array(
- 'label' => t('Shared Links'),
- 'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&bmark=1',
- 'sel'=>$bookmarked_active,
- 'title'=> t('Interesting Links'),
- ),
// array(
// 'label' => t('Spam'),
// 'url'=>$a->get_baseurl(true) . '/network?f=&spam=1'
@@ -351,7 +337,6 @@ function network_content(&$a, $update = 0) {
$cid = ((x($_GET,'cid')) ? intval($_GET['cid']) : 0);
$star = ((x($_GET,'star')) ? intval($_GET['star']) : 0);
- $bmark = ((x($_GET,'bmark')) ? intval($_GET['bmark']) : 0);
$order = ((x($_GET,'order')) ? notags($_GET['order']) : 'comment');
$liked = ((x($_GET,'liked')) ? intval($_GET['liked']) : 0);
$conv = ((x($_GET,'conv')) ? intval($_GET['conv']) : 0);
@@ -419,7 +404,6 @@ function network_content(&$a, $update = 0) {
$sql_options = (($star) ? " and starred = 1 " : '');
- $sql_options .= (($bmark) ? " and bookmark = 1 " : '');
$sql_nets = (($nets) ? sprintf(" and `contact`.`network` = '%s' ", dbesc($nets)) : '');
@@ -489,7 +473,6 @@ function network_content(&$a, $update = 0) {
. ((x($_GET,'search')) ? '&search=' . $_GET['search'] : '')
. ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '')
. ((x($_GET,'order')) ? '&order=' . $_GET['order'] : '')
- . ((x($_GET,'bmark')) ? '&bmark=' . $_GET['bmark'] : '')
. ((x($_GET,'liked')) ? '&liked=' . $_GET['liked'] : '')
. ((x($_GET,'conv')) ? '&conv=' . $_GET['conv'] : '')
. ((x($_GET,'spam')) ? '&spam=' . $_GET['spam'] : '')