]> git.mxchange.org Git - friendica.git/blobdiff - mod/item.php
common tabs to notifications and mail
[friendica.git] / mod / item.php
index cad72122b8c00c51dea6d843f98b9eea75c50944..9e6d33230a57100dc3936df422d9442293784efe 100644 (file)
@@ -336,17 +336,19 @@ 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)) {
+       if(preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",$body,$match)) {
                $bookmark = 1;
-               $body = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/m",'[url=$1]$2[/url]',$body);
+               $body = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",'[url=$1]$2[/url]',$body);
        }
 
 
+       $body = bb_translate_video($body);
+
        /**
         * Fold multi-line [code] sequences
         */
 
-       $body = preg_replace('/\[\/code\]\s*\[code\]/m',"\n",$body); 
+       $body = preg_replace('/\[\/code\]\s*\[code\]/ism',"\n",$body); 
 
        /**
         * Look for any tags and linkify them
@@ -522,6 +524,7 @@ function item_post(&$a) {
        $datarray['attach']        = $attachments;
        $datarray['bookmark']      = intval($bookmark);
        $datarray['thr-parent']    = $thr_parent;
+       $datarray['postopts']      = '';
 
        /**
         * These fields are for the convenience of plugins...
@@ -531,7 +534,7 @@ function item_post(&$a) {
 
        $datarray['parent']        = $parent;
        $datarray['self']          = $self;
-       $datarray['prvnets']       = $user['prvnets'];
+//     $datarray['prvnets']       = $user['prvnets'];
 
        if($orig_post)
                $datarray['edit']      = true;
@@ -563,8 +566,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`, `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', '%s', %d, %d, '%s', %d )",
+               `tag`, `inform`, `verb`, `postopts`, `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', '%s', '%s', %d, %d, '%s', %d )",
                dbesc($datarray['guid']),
                intval($datarray['uid']),
                dbesc($datarray['type']),
@@ -592,6 +595,7 @@ function item_post(&$a) {
                dbesc($datarray['tag']),
                dbesc($datarray['inform']),
                dbesc($datarray['verb']),
+               dbesc($datarray['postopts']),
                dbesc($datarray['allow_cid']),
                dbesc($datarray['allow_gid']),
                dbesc($datarray['deny_cid']),
@@ -703,7 +707,7 @@ function item_post(&$a) {
                                else
                                $signed_text = $datarray['guid'] . ';' . $parent_item['guid'] . ';' . $signed_body . ';' . $myaddr;
 
-                               $authorsig = base64_encode(rsa_sign($signed_text,$a->user['prvkey'],'sha'));
+                               $authorsig = base64_encode(rsa_sign($signed_text,$a->user['prvkey'],'sha256'));
 
                                q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
                                        intval($post_id),
@@ -779,6 +783,11 @@ function item_post(&$a) {
                        }
                }
 
+               // fallback so that parent always gets set to non-zero.
+
+               if(! $parent)
+                       $parent = $post_id;
+
                $r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s', `plink` = '%s', `changed` = '%s', `last-child` = 1, `visible` = 1
                        WHERE `id` = %d LIMIT 1",
                        intval($parent),