]> git.mxchange.org Git - friendica.git/blobdiff - mod/item.php
update DE strings
[friendica.git] / mod / item.php
index 884e730e6b3e96eef9d9fb7d3988715f06a2f74f..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')) 
@@ -536,8 +550,8 @@ function item_post(&$a) {
                `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( '%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' )",
-               intval($datarray['uid']),
                dbesc($datarray['guid']),
+               intval($datarray['uid']),
                dbesc($datarray['type']),
                intval($datarray['wall']),
                intval($datarray['gravity']),