]> git.mxchange.org Git - friendica.git/blobdiff - mod/item.php
update DE strings
[friendica.git] / mod / item.php
index fd5d405ff6cac3a071a431f95220c4eaf37dd147..ef0b232d56b12b96374f3c2356fed80be5b24afa 100644 (file)
@@ -35,7 +35,7 @@ function item_post(&$a) {
 
        call_hooks('post_local_start', $_POST);
 
-       $api_source = ((x($_POST,'api_source')) ? true : false);
+       $api_source = ((x($_POST,'api_source') && $_POST['api_source']) ? true : false);
 
        /**
         * Is this a reply to something?
@@ -178,6 +178,20 @@ function item_post(&$a) {
        
                $pubmail_enable    = ((x($_POST,'pubmail_enable') && intval($_POST['pubmail_enable']) && (! $private)) ? 1 : 0);
 
+               // if using the API, we won't see pubmail_enable - figure out if it should be set
+
+               if($api_source && $profile_uid && $profile_uid == local_user() && (! $private)) {
+                       $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
+                       if(! $mail_disabled) {
+                               $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
+                                       intval(local_user())
+                               );
+                               if(count($r) && intval($r[0]['pubmail']))
+                                       $pubmail_enabled = true;
+                       }
+               }
+
+
                if(! strlen($body)) {
                        info( t('Empty post discarded.') . EOL );
                        if(x($_POST,'return')) 
@@ -506,6 +520,9 @@ function item_post(&$a) {
 
        if($orig_post)
                $datarray['edit']      = true;
+       else
+               $datarray['guid']      = get_guid();
+
 
        call_hooks('post_local',$datarray);
 
@@ -529,10 +546,11 @@ function item_post(&$a) {
                $post_id = 0;
 
 
-       $r = q("INSERT INTO `item` (`uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`, 
+       $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`, `received`, `changed`, `uri`, `thr-parent`, `title`, `body`, `app`, `location`, `coord`, 
                `tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach` )
-               VALUES( %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', %d, %d, '%s' )",
+               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', %d, %d, '%s' )",
+               dbesc($datarray['guid']),
                intval($datarray['uid']),
                dbesc($datarray['type']),
                intval($datarray['wall']),