]> git.mxchange.org Git - friendica.git/blobdiff - mod/settings.php
statusnet improvements
[friendica.git] / mod / settings.php
index 0550429161f492ac50792c96bc4c3ebbe3f3a1b1..2e942231a8cbbcd3e8cefd51b509ac13f639cfce 100644 (file)
@@ -6,6 +6,32 @@ function settings_init(&$a) {
                profile_load($a,$a->user['nickname']);
        }
 
+       $a->page['htmlhead'] .= "<script> var ispublic = '" . t('everybody') . "';" ;
+
+       $a->page['htmlhead'] .= <<< EOT
+
+       $(document).ready(function() {
+
+               $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
+                       var selstr;
+                       $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
+                               selstr = $(this).text();
+                               $('#jot-perms-icon').removeClass('unlock').addClass('lock');
+                               $('#jot-public').hide();
+                       });
+                       if(selstr == null) { 
+                               $('#jot-perms-icon').removeClass('lock').addClass('unlock');
+                               $('#jot-public').show();
+                       }
+
+               }).trigger('change');
+
+       });
+
+       </script>
+EOT;
+
+
 }
 
 
@@ -73,6 +99,12 @@ function settings_post(&$a) {
        $page_flags       = (((x($_POST,'page-flags')) && (intval($_POST['page-flags']))) ? intval($_POST['page-flags']) : 0);
        $blockwall        = (((x($_POST,'blockwall')) && (intval($_POST['blockwall']) == 1)) ? 0: 1); // this setting is inverted!
 
+       $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0);
+       $hidewall = (($_POST['hidewall'] == 1) ? 1: 0);
+
+
+
+
        $mail_server      = ((x($_POST,'mail_server')) ? $_POST['mail_server'] : '');
        $mail_port        = ((x($_POST,'mail_port')) ? $_POST['mail_port'] : '');
        $mail_ssl         = ((x($_POST,'mail_ssl')) ? strtolower(trim($_POST['mail_ssl'])) : '');
@@ -111,6 +143,22 @@ function settings_post(&$a) {
                        intval($mail_pubmail),
                        intval(local_user())
                );
+               $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
+                       intval(local_user())
+               );
+               if(count($r)) {
+                       $eacct = $r[0];
+                       require_once('include/email.php');
+                       $mb = construct_mailbox_name($eacct);
+                       if(strlen($eacct['server'])) {
+                               $dcrpass = '';
+                               openssl_private_decrypt(hex2bin($eacct['pass']),$dcrpass,$a->user['prvkey']);
+                               $mbox = email_connect($mb,$mail_user,$dcrpass);
+                               unset($dcrpass);
+                               if(! $mbox)
+                                       notice( t('Failed to connect with email account using the settings provided.') . EOL);
+                       }
+               }
        }
 
        $notify = 0;
@@ -206,10 +254,15 @@ function settings_post(&$a) {
                info( t('Settings updated.') . EOL);
 
        $r = q("UPDATE `profile` 
-               SET `publish` = %d, `net-publish` = %d
+               SET `publish` = %d, 
+               `net-publish` = %d,
+               `hide-friends` = %d,
+               `hidewall` = %d
                WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
                intval($publish),
                intval($net_publish),
+               intval($hide_friends),
+               intval($hidewall),
                intval(local_user())
        );
 
@@ -308,7 +361,7 @@ function settings_content(&$a) {
        $mail_user    = ((count($r)) ? $r[0]['user'] : '');
        $mail_replyto = ((count($r)) ? $r[0]['reply_to'] : '');
        $mail_pubmail = ((count($r)) ? $r[0]['pubmail'] : 0);
-
+       $mail_chk     = ((count($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00');
 
        $pageset_tpl = get_markup_template('pagetypes.tpl');
        $pagetype = replace_macros($pageset_tpl,array(
@@ -346,7 +399,7 @@ function settings_content(&$a) {
        else {
                $opt_tpl = get_markup_template("profile-in-directory.tpl");
                $profile_in_dir = replace_macros($opt_tpl,array(
-                       '$desc'         => t('Publish your default profile in site directory?'),
+                       '$desc'         => t('Publish your default profile in your local site directory?'),
                        '$yes_str'      => t('Yes'),
                        '$no_str'       => t('No'),
                        '$yes_selected' => (($profile['publish'])      ? " checked=\"checked\" " : ""),
@@ -358,7 +411,7 @@ function settings_content(&$a) {
                $opt_tpl = get_markup_template("profile-in-netdir.tpl");
 
                $profile_in_net_dir = replace_macros($opt_tpl,array(
-                       '$desc'         => t('Publish your default profile in global social directory?'),
+                       '$desc'         => t('Publish your default profile in the global social directory?'),
                        '$yes_str'      => t('Yes'),
                        '$no_str'       => t('No'),
                        '$yes_selected' => (($profile['net-publish'])      ? " checked=\"checked\" " : ""),
@@ -368,6 +421,30 @@ function settings_content(&$a) {
        else
                $profile_in_net_dir = '';
 
+
+       $opt_tpl = get_markup_template("profile-hide-friends.tpl");
+       $hide_friends = replace_macros($opt_tpl,array(
+               '$desc' => t('Hide your contact/friend list from viewers of your default profile?'),
+               '$yes_str' => t('Yes'),
+               '$no_str' => t('No'),
+               '$yes_selected' => (($profile['hide-friends']) ? " checked=\"checked\" " : ""),
+               '$no_selected' => (($profile['hide-friends'] == 0) ? " checked=\"checked\" " : "")
+       ));
+
+       $opt_tpl = get_markup_template("profile-hide-wall.tpl");
+       $hide_wall = replace_macros($opt_tpl,array(
+               '$desc' => t('Hide profile details and all your messages from unknown viewers?'),
+               '$yes_str' => t('Yes'),
+               '$no_str' => t('No'),
+               '$yes_selected' => (($profile['hidewall']) ? " checked=\"checked\" " : ""),
+               '$no_selected' => (($profile['hidewall'] == 0) ? " checked=\"checked\" " : "")
+       ));
+
+
+
+
+
+
        $loc_checked = (($a->user['allow_location'] == 1)      ? " checked=\"checked\" " : "");
 
        $invisible = (((! $profile['publish']) && (! $profile['net-publish']))
@@ -389,7 +466,8 @@ function settings_content(&$a) {
                        $f = basename($file);
                        $selected = (($f == $_SESSION['theme']) || ($f === $default_theme && (! x($_SESSION,'theme')))
                                ? ' selected="selected" ' : '' );
-                       $theme_selector .= '<option val="' . basename($file) . '"' . $selected . '>' . basename($file) . '</option>';
+                       $theme_name = ((file_exists($file . '/experimental')) ?  sprintf("%s - \x28Experimental\x29", $f) : $f);
+                       $theme_selector .= '<option value="' . $f . '"' . $selected . '>' . $theme_name . '</option>';
                }
        }
 
@@ -443,6 +521,8 @@ function settings_content(&$a) {
                '$lbl_pass4' => t('Confirm:'),
                '$lbl_advn' => t('Advanced Page Settings'),
                '$baseurl' => $a->get_baseurl(),
+               '$hide_friends' => $hide_friends,
+               '$hide_wall' => $hide_wall,
                '$oidhtml' => $oidhtml,
                '$uexport' => $uexport,
                '$uid' => local_user(),
@@ -484,6 +564,8 @@ function settings_content(&$a) {
                '$lbl_imap6' => t("Reply-to address \x28Optional\x29:"),
                '$imap_replyto' => $mail_replyto,
                '$lbl_imap7' => t('Send public posts to all email contacts:'),
+               '$lbl_imap8' => t('Last successful email check:'),
+               '$lbl_imap9' => (($mail_chk === '0000-00-00 00:00:00') ? t('never') : datetime_convert('UTC', date_default_timezone_get(), $mail_chk, t('g A l F d Y'))), 
                '$pubmail_checked' => (($mail_pubmail) ? ' checked="checked" ' : ''),
                '$mail_disabled' => (($mail_disabled) ? '<div class="info-message">' . t('Email access is disabled on this site.') . '</div>' : ''),
                '$imap_disabled' => $imap_disabled