]> git.mxchange.org Git - friendica.git/blobdiff - mod/item.php
preparation for some possibly killer features
[friendica.git] / mod / item.php
index fe570075f2f6eca655909f6e063bd3e18295236e..5baae2bde7673e120af4b6e8ddde49ac18aad0cf 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,7 +245,6 @@ function item_post(&$a) {
                        }
                }
 
-
                if(! strlen($body)) {
                        if($preview)
                                killme();
@@ -253,6 +255,15 @@ function item_post(&$a) {
                }
        }
 
+       // Work around doubled linefeeds in Tinymce 3.5b2
+       // First figure out if it's a status post that would've been
+       // created using tinymce. Otherwise leave it alone. 
+
+       $plaintext = (local_user() ? intval(get_pconfig(local_user(),'system','plaintext')) : 0);
+       if((! $parent) && (! $api_source) && (! $plaintext)) {
+               $body = str_replace("\r\n","\n",$body);
+               $body = str_replace("\n\n","\n",$body);
+       }
 
 
        // get contact info for poster
@@ -490,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;
@@ -549,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)
@@ -609,7 +624,7 @@ function item_post(&$a) {
                dbesc($datarray['attach']),
                intval($datarray['bookmark']),
                intval($datarray['origin']),
-               intval($datarry['moderated'])
+               intval($datarray['moderated'])
        );
 
        $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",