aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-07-16 21:52:26 -0700
committerfriendica <info@friendica.com>2012-07-16 21:52:26 -0700
commit54ffc32d7c4d9c9d1231bdfa2147b7dc6ef12743 (patch)
tree4cb5736d404790ef19e5bdb940de4328d227732c
parentd3279a615726efb0147a14140a16d6b62f650f77 (diff)
downloadvolse-hubzilla-54ffc32d7c4d9c9d1231bdfa2147b7dc6ef12743.tar.gz
volse-hubzilla-54ffc32d7c4d9c9d1231bdfa2147b7dc6ef12743.tar.bz2
volse-hubzilla-54ffc32d7c4d9c9d1231bdfa2147b7dc6ef12743.zip
working towards getting rid of item['tag'] and item['file'] - still some dependencies
-rwxr-xr-xinclude/items.php25
-rw-r--r--include/text.php15
-rw-r--r--mod/item.php27
3 files changed, 32 insertions, 35 deletions
diff --git a/include/items.php b/include/items.php
index b66a325a5..b7890e602 100755
--- a/include/items.php
+++ b/include/items.php
@@ -882,7 +882,6 @@ function item_store($arr,$force_parent = false) {
$arr['deny_gid'] = ((x($arr,'deny_gid')) ? trim($arr['deny_gid']) : '');
$arr['private'] = ((x($arr,'private')) ? intval($arr['private']) : 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'])) : '');
$arr['app'] = ((x($arr,'app')) ? notags(trim($arr['app'])) : '');
$arr['origin'] = ((x($arr,'origin')) ? intval($arr['origin']) : 0 );
@@ -1839,10 +1838,9 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
if(datetime_convert('UTC','UTC',$datarray['edited']) < $r[0]['edited'])
continue;
- $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+ $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($datarray['title']),
dbesc($datarray['body']),
- dbesc($datarray['tag']),
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
dbesc($item_id),
intval($importer['uid'])
@@ -1986,10 +1984,9 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
if(datetime_convert('UTC','UTC',$datarray['edited']) < $r[0]['edited'])
continue;
- $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+ $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($datarray['title']),
dbesc($datarray['body']),
- dbesc($datarray['tag']),
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
dbesc($item_id),
intval($importer['uid'])
@@ -2337,7 +2334,7 @@ function local_delivery($importer,$data) {
$is_a_remote_delete = false;
- $r = q("select `item`.`id`, `item`.`uri`, `item`.`tag`, `item`.`forum_mode`,`item`.`origin`,`item`.`wall`,
+ $r = q("select `item`.`id`, `item`.`uri`, `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')
@@ -2404,6 +2401,7 @@ function local_delivery($importer,$data) {
if($owner_remove && $author_copy)
continue;
if($author_remove || $owner_remove) {
+//FIXME
$tags = explode(',',$i[0]['tag']);
$newtags = array();
if(count($tags)) {
@@ -2496,7 +2494,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`,
+ $r = q("select `item`.`id`, `item`.`uri`, `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')
@@ -2546,10 +2544,9 @@ function local_delivery($importer,$data) {
continue;
logger('received updated comment' , LOGGER_DEBUG);
- $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+ $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($datarray['title']),
dbesc($datarray['body']),
- dbesc($datarray['tag']),
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
dbesc($item_id),
intval($importer['importer_uid'])
@@ -2622,7 +2619,7 @@ function local_delivery($importer,$data) {
continue;
// extract tag, if not duplicate, and this user allows tags, add to parent item
-
+//FIXME
if($xo->id && $xo->content) {
$newtag = '#[url=' . $xo->id . ']'. $xo->content . '[/url]';
if(! (stristr($tagp[0]['tag'],$newtag))) {
@@ -2731,10 +2728,9 @@ function local_delivery($importer,$data) {
if(datetime_convert('UTC','UTC',$datarray['edited']) < $r[0]['edited'])
continue;
- $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+ $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($datarray['title']),
dbesc($datarray['body']),
- dbesc($datarray['tag']),
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
dbesc($item_id),
intval($importer['importer_uid'])
@@ -2904,10 +2900,9 @@ function local_delivery($importer,$data) {
if(datetime_convert('UTC','UTC',$datarray['edited']) < $r[0]['edited'])
continue;
- $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+ $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($datarray['title']),
dbesc($datarray['body']),
- dbesc($datarray['tag']),
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
dbesc($item_id),
intval($importer['importer_uid'])
@@ -3225,7 +3220,7 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) {
$o .= item_getfeedattach($item);
- $mentioned = get_mentions($item);
+ $mentioned = get_mentions($item,$tags);
if($mentioned)
$o .= $mentioned;
diff --git a/include/text.php b/include/text.php
index 1825ec572..d7fc5808f 100644
--- a/include/text.php
+++ b/include/text.php
@@ -554,17 +554,16 @@ return str_replace ("%","=",rawurlencode($s));
if(! function_exists('get_mentions')) {
-function get_mentions($item) {
+function get_mentions($item,$tags) {
$o = '';
- if(! strlen($item['tag']))
+
+ if(! count($tags))
return $o;
- $arr = explode(',',$item['tag']);
- foreach($arr as $x) {
- $matches = null;
- if(preg_match('/@\[url=([^\]]*)\]/',$x,$matches)) {
- $o .= "\t\t" . '<link rel="mentioned" href="' . $matches[1] . '" />' . "\r\n";
- $o .= "\t\t" . '<link rel="ostatus:attention" href="' . $matches[1] . '" />' . "\r\n";
+ foreach($tags as $x) {
+ if($x['type'] == TERM_MENTION) {
+ $o .= "\t\t" . '<link rel="mentioned" href="' . $x['url'] . '" />' . "\r\n";
+ $o .= "\t\t" . '<link rel="ostatus:attention" href="' . $x['url'] . '" />' . "\r\n";
}
}
return $o;
diff --git a/mod/item.php b/mod/item.php
index 2a34f7d82..3bfa3ebe7 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -565,8 +565,6 @@ function item_post(&$a) {
$datarray['lang'] = $language;
$datarray['location'] = $location;
$datarray['coord'] = $coord;
- $datarray['tag'] = $str_tags;
- $datarray['file'] = $categories;
$datarray['inform'] = $inform;
$datarray['verb'] = $verb;
$datarray['allow_cid'] = $str_contact_allow;
@@ -640,19 +638,26 @@ function item_post(&$a) {
if($orig_post) {
- $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `attach` = '%s', `file` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `attach` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
dbesc($datarray['title']),
dbesc($datarray['body']),
- dbesc($datarray['tag']),
dbesc($datarray['attach']),
- dbesc($datarray['file']),
dbesc(datetime_convert()),
intval($post_id),
intval($profile_uid)
);
- // update filetags in pconfig
- file_tag_update_pconfig($uid,$categories_old,$categories_new,'category');
+ // remove taxonomy items for this post - we'll recreate them
+
+ q("delete from term where otype = %d and oid = %d and type in (%d, %d, %d, %d) ",
+ intval(TERM_OBJ_POST),
+ intval($post_id),
+ intval(TERM_UNKNOWN),
+ intval(TERM_HASHTAG),
+ intval(TERM_MENTION),
+ intval(TERM_CATEGORY)
+ );
+
proc_run('php', "include/notifier.php", 'edit_post', "$post_id");
if((x($_REQUEST,'return')) && strlen($return_path)) {
@@ -667,8 +672,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`, `lang`, `location`, `coord`,
- `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', '%s', %d, %d, '%s', %d, %d, '%s' )",
+ `inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`,`origin`, `moderated`)
+ 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 )",
dbesc($datarray['guid']),
intval($datarray['uid']),
dbesc($datarray['type']),
@@ -694,7 +699,6 @@ function item_post(&$a) {
dbesc($datarray['lang']),
dbesc($datarray['location']),
dbesc($datarray['coord']),
- dbesc($datarray['tag']),
dbesc($datarray['inform']),
dbesc($datarray['verb']),
dbesc($datarray['postopts']),
@@ -706,8 +710,7 @@ function item_post(&$a) {
intval($datarray['pubmail']),
dbesc($datarray['attach']),
intval($datarray['origin']),
- intval($datarray['moderated']),
- dbesc($datarray['file'])
+ intval($datarray['moderated'])
);
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",