aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-08-14 04:26:41 -0700
committerFriendika <info@friendika.com>2011-08-14 04:26:41 -0700
commitbbd545b9caa278d61ad423725dc591b3eb0e61f7 (patch)
treeb4e8da86ec53e26eeeb0eb31f3a60dd7aa966492 /mod
parent025485ea69a8c40ae0357987c285c47d51a7b284 (diff)
downloadvolse-hubzilla-bbd545b9caa278d61ad423725dc591b3eb0e61f7.tar.gz
volse-hubzilla-bbd545b9caa278d61ad423725dc591b3eb0e61f7.tar.bz2
volse-hubzilla-bbd545b9caa278d61ad423725dc591b3eb0e61f7.zip
honour "post to xxx network by default" when using API
Diffstat (limited to 'mod')
-rw-r--r--mod/item.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/mod/item.php b/mod/item.php
index 62c1d4a87..cc4e1e1a8 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -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()) {
+ $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'))