]> git.mxchange.org Git - friendica.git/commitdiff
ability to change tags in edited posts
authorfriendica <info@friendica.com>
Thu, 22 Mar 2012 23:17:10 +0000 (16:17 -0700)
committerfriendica <info@friendica.com>
Thu, 22 Mar 2012 23:17:10 +0000 (16:17 -0700)
boot.php
include/items.php
include/text.php
mod/editpost.php
mod/item.php

index 04e16e64dc46682485026e6563dd6299c4d6957e..f976ef6368c98b26c2c874d0196bce383048320f 100755 (executable)
--- a/boot.php
+++ b/boot.php
@@ -9,7 +9,7 @@ require_once('include/nav.php');
 require_once('include/cache.php');
 
 define ( 'FRIENDICA_PLATFORM',     'Friendica');
-define ( 'FRIENDICA_VERSION',      '2.3.1288' );
+define ( 'FRIENDICA_VERSION',      '2.3.1289' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
 define ( 'DB_UPDATE_VERSION',      1133      );
 
index 5a297c83ef5422690bf2eb542861025fd0c33e6f..b96f88566db1a08b784005794d8fb1bc58f72915 100755 (executable)
@@ -1582,9 +1582,10 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
 
                                if(count($r)) {
                                        if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {  
-                                               $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+                                               $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%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'])
@@ -1727,9 +1728,10 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
 
                                if(count($r)) {
                                        if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {  
-                                               $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+                                               $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%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'])
@@ -1800,7 +1802,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
                                        // but otherwise there's a possible data mixup on the sender's system.
                                        // the tgroup delivery code called from item_store will correct it if it's a forum,
                                        // but we're going to unconditionally correct it here so that the post will always be owned by our contact. 
-                                       logger('local_delivery: Correcting item owner.', LOGGER_DEBUG);
+                                       logger('consume_feed: Correcting item owner.', LOGGER_DEBUG);
                                        $datarray['owner-name']   = $contact['name'];
                                        $datarray['owner-link']   = $contact['url'];
                                        $datarray['owner-avatar'] = $contact['thumb'];
@@ -2332,9 +2334,10 @@ function local_delivery($importer,$data) {
 
                                if(count($r)) {
                                        if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {  
-                                               $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+                                               $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%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'])
@@ -2497,9 +2500,10 @@ function local_delivery($importer,$data) {
 
                        if(count($r)) {
                                if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {  
-                                       $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+                                       $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%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'])
index 92a74eb49ee94ad542793caac0543417f8e85488..6f66cef651d35344196cebce4165cee2be9ad615 100644 (file)
@@ -1338,3 +1338,16 @@ function file_tag_unsave_file($uid,$item,$file) {
 function normalise_openid($s) {
        return trim(str_replace(array('http://','https://'),array('',''),$s),'/');
 }
+
+
+function undo_post_tagging($s) {
+       $matches = null;
+       $cnt = preg_match_all('/([@#])\[url=(.*?)\](.*?)\[\/url\]/ism',$s,$matches,PREG_SET_ORDER);
+       if($cnt) {
+               foreach($matches as $mtch) {
+                       $s = str_replace($mtch[0], $mtch[1] . $mtch[3],$s);
+               }
+       }
+       return $s;
+}
+
index 778ac3dccd5e8343bdab20315c151dc723a8c5c2..2ddba36aad11e98fe7e75744993f7f04ecc488f9 100755 (executable)
@@ -104,7 +104,7 @@ function editpost_content(&$a) {
                '$wait' => t('Please wait'),
                '$permset' => t('Permission settings'),
                '$ptyp' => $itm[0]['type'],
-               '$content' => $itm[0]['body'],
+               '$content' => undo_post_tagging($itm[0]['body']),
                '$post_id' => $post_id,
                '$baseurl' => $a->get_baseurl(),
                '$defloc' => $a->user['default-location'],
index ee6c5c9a7390ff69418f4f91afefeb626bd0d7f9..fc1c5fd0f4c91844cfb0b6c3f070abb7223b7246 100755 (executable)
@@ -177,10 +177,11 @@ function item_post(&$a) {
                $verb              = $orig_post['verb'];
                $emailcc           = $orig_post['emailcc'];
                $app                       = $orig_post['app'];
-
+               $categories        = $orig_post['file'];
                $body              = escape_tags(trim($_REQUEST['body']));
                $private           = $orig_post['private'];
                $pubmail_enable    = $orig_post['pubmail'];
+
        }
        else {
 
@@ -213,8 +214,10 @@ function item_post(&$a) {
                $coord             = notags(trim($_REQUEST['coord']));
                $verb              = notags(trim($_REQUEST['verb']));
                $emailcc           = notags(trim($_REQUEST['emailcc']));
-
                $body              = escape_tags(trim($_REQUEST['body']));
+
+               // $categories = TODO
+
                $private = ((strlen($str_group_allow) || strlen($str_contact_allow) || strlen($str_group_deny) || strlen($str_contact_deny)) ? 1 : 0);
 
                if(($parent_item) && 
@@ -242,8 +245,6 @@ function item_post(&$a) {
                        }
                }
 
-
-
                if(! strlen($body)) {
                        if($preview)
                                killme();
@@ -500,6 +501,7 @@ function item_post(&$a) {
        $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;
@@ -559,9 +561,12 @@ function item_post(&$a) {
 
 
        if($orig_post) {
-               $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
-                       dbesc($title),
-                       dbesc($body),
+               $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",
+                       dbesc($datarray['title']),
+                       dbesc($datarray['body']),
+                       dbesc($datarray['tag']),
+                       dbesc($datarray['attach']),
+                       dbesc($datarray['file']),
                        dbesc(datetime_convert()),
                        intval($post_id),
                        intval($profile_uid)