]> git.mxchange.org Git - friendica.git/blobdiff - mod/item.php
autocomplete contacts nickname while writting in a comment box.
[friendica.git] / mod / item.php
index b8c0683aaca90144b5844d27374584109bf161e0..0e855d54d91d3315cbf950a39d6971065ca152ca 100644 (file)
@@ -338,10 +338,11 @@ function item_post(&$a) {
        $bookmark = 0;
        if(preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",$body,$match)) {
                $bookmark = 1;
-               $body = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",'[url=$1]$2[/url]',$body);
        }
 
 
+       $body = bb_translate_video($body);
+
        /**
         * Fold multi-line [code] sequences
         */
@@ -482,7 +483,12 @@ function item_post(&$a) {
                $verb = ACTIVITY_POST ;
 
        $gravity = (($parent) ? 6 : 0 );
+
+       // even if the post arrived via API we are considering that it 
+       // originated on this site by default for determining relayability.
+
+       $origin = ((x($_REQUEST,'origin')) ? intval($_REQUEST['origin']) : 1);
+       
        $notify_type = (($parent) ? 'comment-new' : 'wall-new' );
 
        $uri = item_new_uri($a->get_hostname(),$profile_uid);
@@ -522,6 +528,8 @@ function item_post(&$a) {
        $datarray['attach']        = $attachments;
        $datarray['bookmark']      = intval($bookmark);
        $datarray['thr-parent']    = $thr_parent;
+       $datarray['postopts']      = '';
+       $datarray['origin']        = $origin;
 
        /**
         * These fields are for the convenience of plugins...
@@ -531,7 +539,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 +571,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`,`origin` )
+               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']),
@@ -592,6 +600,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']),
@@ -599,7 +608,8 @@ function item_post(&$a) {
                intval($datarray['private']),
                intval($datarray['pubmail']),
                dbesc($datarray['attach']),
-               intval($datarray['bookmark'])
+               intval($datarray['bookmark']),
+               intval($datarray['origin'])
        );
 
        $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
@@ -703,7 +713,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),