]> git.mxchange.org Git - friendica.git/commitdiff
increase visibility of visibility settings
authorMike Macgirvin <mike@macgirvin.com>
Fri, 20 Aug 2010 05:04:18 +0000 (22:04 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Fri, 20 Aug 2010 05:04:18 +0000 (22:04 -0700)
mod/profiles.php
mod/settings.php
view/profile-in-netdir.tpl
view/profile_edit.tpl
view/settings.tpl

index 853aac6de8248be01a8fee2126de6383e363525f..3cf2aca80a53a18bf43e18d93dc74e5cf02653b5 100644 (file)
@@ -72,10 +72,7 @@ function profiles_post(&$a) {
                $romance = escape_tags(trim($_POST['romance']));
                $work = escape_tags(trim($_POST['work']));
                $education = escape_tags(trim($_POST['education']));
-               if(x($_POST,'profile_in_directory'))
-                       $publish = (($_POST['profile_in_directory'] == 1) ? 1: 0);
-               if(x($_POST,'profile_in_netdirectory'))
-                       $net_publish = (($_POST['profile_in_netdirectory'] == 1) ? 1: 0);
+               $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0);
 
 
                $r = q("UPDATE `profile` 
@@ -102,7 +99,8 @@ function profiles_post(&$a) {
                        `film` = '%s',
                        `romance` = '%s',
                        `work` = '%s',
-                       `education` = '%s'
+                       `education` = '%s',
+                       `hide-friends` = %d
                        WHERE `id` = %d AND `uid` = %d LIMIT 1",
                        dbesc($profile_name),
                        dbesc($name),
@@ -128,6 +126,7 @@ function profiles_post(&$a) {
                        dbesc($romance),
                        dbesc($work),
                        dbesc($education),
+                       intval($hide_friends),
                        intval($a->argv[1]),
                        intval($_SESSION['uid'])
                );
@@ -136,23 +135,13 @@ function profiles_post(&$a) {
                        notice( t('Profile updated.') . EOL);
 
 
-               if($is_default) {
-                       $r = q("UPDATE `profile` 
-                       SET `publish` = %d, `net-publish` = %d
-                       WHERE `id` = %d AND `uid` = %d LIMIT 1",
-                       intval($publish),
-                       intval($net_publish),
-                       intval($a->argv[1]),
-                       intval($_SESSION['uid'])
-
-                       );
-               }
                if($namechanged && $is_default) {
                        $r = q("UPDATE `contact` SET `name-date` = '%s' WHERE `self` = 1 AND `uid` = %d LIMIT 1",
                                dbesc(datetime_convert()),
                                intval($_SESSION['uid'])
                        );
                }
+
                if($is_default) {
                        // Update global directory in background
                        $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
@@ -253,6 +242,7 @@ function profiles_content(&$a) {
                unset($r1[0]['id']);
                $r1[0]['is-default'] = 0;
                $r1[0]['publish'] = 0;  
+               $r1[0]['net-publish'] = 0;      
                $r1[0]['profile-name'] = dbesc($name);
 
                dbesc_array($r1[0]);
@@ -291,23 +281,6 @@ function profiles_content(&$a) {
                require_once('view/profile_selectors.php');
 
                $tpl = file_get_contents('view/profed_head.tpl');
-               $opt_tpl = file_get_contents("view/profile-in-directory.tpl");
-               $profile_in_dir = replace_macros($opt_tpl,array(
-                       '$yes_selected' => (($r[0]['publish']) ? " checked=\"checked\" " : ""),
-                       '$no_selected' => (($r[0]['publish'] == 0) ? " checked=\"checked\" " : "")
-               ));
-
-               if(strlen(get_config('system','directory_submit_url'))) {
-                       $opt_tpl = file_get_contents("view/profile-in-netdir.tpl");
-
-                       $profile_in_net_dir = replace_macros($opt_tpl,array(
-                               '$yes_selected' => (($r[0]['net-publish']) ? " checked=\"checked\" " : ""),
-                               '$no_selected' => (($r[0]['net-publish'] == 0) ? " checked=\"checked\" " : "")
-                       ));
-               }
-               else
-                       $profile_in_net_dir = '';
-
 
                $opt_tpl = file_get_contents("view/profile-hide-friends.tpl");
                $hide_friends = replace_macros($opt_tpl,array(
@@ -355,9 +328,7 @@ function profiles_content(&$a) {
                        '$romance' => $r[0]['romance'],
                        '$work' => $r[0]['work'],
                        '$education' => $r[0]['education'],
-                       '$contact' => $r[0]['contact'],
-                       '$profile_in_dir' => (($is_default) ? $profile_in_dir : ''),
-                       '$profile_in_net_dir' => (($is_default) ? $profile_in_net_dir : '')
+                       '$contact' => $r[0]['contact']
                ));
 
                return $o;
index 0d65bf9ba8fa2a1d44b75104259fb2ee5565cea0..0cac6e0de706160921e1e2e549117b856f82cf4f 100644 (file)
@@ -57,6 +57,10 @@ function settings_post(&$a) {
        $email = notags(trim($_POST['email']));
        $timezone = notags(trim($_POST['timezone']));
 
+       $publish = (($_POST['profile_in_directory'] == 1) ? 1: 0);
+       $net_publish = (($_POST['profile_in_netdirectory'] == 1) ? 1: 0);
+       $old_visibility = ((intval($_POST['visibility']) == 1) ? 1 : 0);
+
        $notify = 0;
 
        if($_POST['notify1'])
@@ -146,6 +150,24 @@ function settings_post(&$a) {
        );
        if($r)
                notice( t('Settings updated.') . EOL);
+
+       $r = q("UPDATE `profile` 
+               SET `publish` = %d, `net-publish` = %d
+               WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
+               intval($publish),
+               intval($net_publish),
+               intval($_SESSION['uid'])
+       );
+
+       if($old_visibility != $net_publish) {
+               // Update global directory in background
+               $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
+               $url = $_SESSION['my_url'];
+               if($url && strlen(get_config('system','directory_submit_url')))
+                       proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &",
+                               array(),$foo));
+       }
+
        $_SESSION['theme'] = $theme;
        if($email_changed && $a->config['register_policy'] == REGISTER_VERIFY) {
 
@@ -167,6 +189,12 @@ function settings_content(&$a) {
 
        require_once('view/acl_selectors.php');
 
+       $p = q("SELECT * FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
+               intval($_SESSION['uid'])
+       );
+       if(count($p))
+               $profile = $p[0];
+
        $username = $a->user['username'];
        $email    = $a->user['email'];
        $nickname = $a->user['nickname'];
@@ -176,6 +204,28 @@ function settings_content(&$a) {
        if(! strlen($a->user['timezone']))
                $timezone = date_default_timezone_get();
 
+
+       $opt_tpl = file_get_contents("view/profile-in-directory.tpl");
+       $profile_in_dir = replace_macros($opt_tpl,array(
+               '$yes_selected' => (($profile['publish']) ? " checked=\"checked\" " : ""),
+               '$no_selected' => (($profile['publish'] == 0) ? " checked=\"checked\" " : "")
+       ));
+
+       if(strlen(get_config('system','directory_submit_url'))) {
+               $opt_tpl = file_get_contents("view/profile-in-netdir.tpl");
+
+               $profile_in_net_dir = replace_macros($opt_tpl,array(
+                       '$yes_selected' => (($profile['net-publish']) ? " checked=\"checked\" " : ""),
+                       '$no_selected' => (($profile['net-publish'] == 0) ? " checked=\"checked\" " : "")
+               ));
+       }
+       else
+               $profile_in_net_dir = '';
+
+
+
+
+
        $nickname_block = file_get_contents("view/settings_nick_set.tpl");
        
 
@@ -219,7 +269,10 @@ function settings_content(&$a) {
                '$nickname_block' => $nickname_block,
                '$timezone' => $timezone,
                '$zoneselect' => select_timezone($timezone),
+               '$profile_in_dir' => $profile_in_dir,
+               '$profile_in_net_dir' => $profile_in_net_dir,
                '$permissions' => t('Default Post Permissions'),
+               '$visibility' => $profile['net-publish'],
                '$aclselect' => populate_acl($a->user),
                '$sel_notify1' => (($notify & NOTIFY_INTRO)   ? ' checked="checked" ' : ''),
                '$sel_notify2' => (($notify & NOTIFY_CONFIRM) ? ' checked="checked" ' : ''),
index d5a320a3f949108b2d762c68f954634dffe68293..be111aa67f80d924b8031c65223054bd96ef1e84 100644 (file)
@@ -1,5 +1,5 @@
 <p id="profile-in-directory">
-Publish this profile in global social directory? 
+Publish your default profile in global social directory? 
 </p>
 
                <div id="profile-in-netdir-yes-wrapper">
index a28471325fddb90778a636124ffbf692dc5923e2..7bbd4091bc298ffcc1c996ea72dbdd462ec20ae8 100644 (file)
@@ -42,10 +42,6 @@ $dob $age
 </div>
 <div id="profile-edit-dob-end"></div>
 
-$profile_in_dir
-
-$profile_in_net_dir
-
 $hide_friends
 
 <div class="profile-edit-submit-wrapper" >
index b9c2c7ecba9c01becf845ff12da22ccea06b2cd4..00c85cb405dfab08f01bd9ea404dda06f041a4a7 100644 (file)
@@ -31,6 +31,12 @@ $theme
 </div>
 <div id="settings-theme-end"></div>
 
+<input type="hidden" name="visibility" value="$visibility" />
+
+$profile_in_dir
+
+$profile_in_net_dir
+
 <div id="settings-default-perms" class="settings-default-perms" >
        <div id="settings-default-perms-menu" onClick="openClose('settings-default-perms-select');" />$permissions</div>
        <div id="settings-default-perms-menu-end"></div>