From 7a21a000a2b02e7dd443fd0f3ee09172de825b08 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Sun, 11 Jul 2010 02:52:47 -0700 Subject: [PATCH] lots of little stuff --- include/group.php | 34 +++++++++++++++++++++++++++++++++- include/nav.php | 6 ++++++ mod/contacts.php | 17 ++++------------- mod/profiles.php | 8 +++++++- updates.sql | 3 ++- view/contact_edit.tpl | 2 +- view/profile-hide-friends.tpl | 16 ++++++++++++++++ view/profile_edit.tpl | 2 ++ view/style.css | 21 +++++++++++++++++---- 9 files changed, 88 insertions(+), 21 deletions(-) create mode 100644 view/profile-hide-friends.tpl diff --git a/include/group.php b/include/group.php index e92e4480ba..598d09c2ea 100644 --- a/include/group.php +++ b/include/group.php @@ -25,7 +25,7 @@ function group_rmv($uid,$name) { $r = q("SELECT * FROM `group` WHERE `uid` = %d AND `name` = '%s' LIMIT 1", intval($uid), dbesc($name) - } + ); if(count($r)) $group_id = $r[0]['id']; if(! $group_id) @@ -102,4 +102,36 @@ function group_add_member($uid,$name,$member) { intval($member) ); return $r; +} + + + +function group_side() { + + if(! local_user()) + return; +$o .= <<< EOT + +
+

Groups

+ + + +
'; + + return $o; } \ No newline at end of file diff --git a/include/nav.php b/include/nav.php index c51c56ad22..d24abd4ac5 100644 --- a/include/nav.php +++ b/include/nav.php @@ -2,6 +2,11 @@ page['nav'] .= "\r\n"; + if(($a->module != 'home') && (! (x($_SESSION['uid'])))) + $a->page['nav'] .= "Home\r\n"; + + $a->page['nav'] .= "Site Directory\r\n"; + if(x($_SESSION,'uid')) { $a->page['nav'] .= "Notifications\r\n"; @@ -20,4 +25,5 @@ $a->page['nav'] .= "Home\r\n"; } + $a->page['nav'] .= "\r\n\r\n"; diff --git a/mod/contacts.php b/mod/contacts.php index 38b49475ac..5bf906e060 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -1,6 +1,8 @@ page['aside'] .= group_side(); } function contacts_post(&$a) { @@ -12,8 +14,7 @@ function contacts_post(&$a) { $contact_id = intval($a->argv[1]); if(! $contact_id) return; -dbg(2); -print_r($_POST); + $orig_record = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($contact_id), intval($_SESSION['uid']) @@ -60,14 +61,6 @@ print_r($_POST); - - - - - - - - function contacts_content(&$a) { if(! local_user()) { @@ -75,8 +68,6 @@ function contacts_content(&$a) { return; } - - if($a->argc == 3) { $contact_id = intval($a->argv[1]); diff --git a/mod/profiles.php b/mod/profiles.php index 3f5980ba69..4bbfbb44cb 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -278,6 +278,12 @@ function profiles_content(&$a) { '$no_selected' => (($r[0]['publish'] == 0) ? " checked=\"checked\" " : "") )); + $opt_tpl = file_get_contents("view/profile-hide-friends.tpl"); + $hide_friends = replace_macros($opt_tpl,array( + '$yes_selected' => (($r[0]['hide-friends']) ? " checked=\"checked\" " : ""), + '$no_selected' => (($r[0]['hide-friends'] == 0) ? " checked=\"checked\" " : "") + )); + $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl())); $a->page['htmlhead'] .= ""; @@ -295,7 +301,7 @@ function profiles_content(&$a) { '$default' => (($is_default) ? "

This is your public profile.
It may be visible to anybody using the internet.

" : ""), '$name' => $r[0]['name'], '$dob' => dob($r[0]['dob']), - '$hide_birth' => (($r[0]['dob_hide']) ? " checked=\"checked\" " : ""), + '$hide_friends' => $hide_friends, '$address' => $r[0]['address'], '$locality' => $r[0]['locality'], '$region' => $r[0]['region'], diff --git a/updates.sql b/updates.sql index de7bfa1e42..b7e2ab3ea4 100644 --- a/updates.sql +++ b/updates.sql @@ -25,4 +25,5 @@ ALTER TABLE `profile` DROP `age`; ALTER TABLE `profile` CHANGE `school` `education` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ; ALTER TABLE `profile` DROP `employer` ; -ALTER TABLE `profile` ADD `contact` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `education` ; \ No newline at end of file +ALTER TABLE `profile` ADD `contact` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `education` ; +ALTER TABLE `profile` ADD `hide-friends` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `is-default` ; diff --git a/view/contact_edit.tpl b/view/contact_edit.tpl index 91ae30ec16..4a94f70837 100644 --- a/view/contact_edit.tpl +++ b/view/contact_edit.tpl @@ -28,7 +28,7 @@ $blocked
-
+

Profile Visibility

Please choose the profile you would like to display to $name - when he/she connects securely to your profile page.

diff --git a/view/profile-hide-friends.tpl b/view/profile-hide-friends.tpl new file mode 100644 index 0000000000..54ade00fec --- /dev/null +++ b/view/profile-hide-friends.tpl @@ -0,0 +1,16 @@ +

+Hide my contact/friend list from viewers of this profile? +

+ +
+ + + +
+
+
+ + + +
+
diff --git a/view/profile_edit.tpl b/view/profile_edit.tpl index 789da873c2..3dcf8df2cd 100644 --- a/view/profile_edit.tpl +++ b/view/profile_edit.tpl @@ -32,6 +32,8 @@ $dob $age
+$hide_friends +
diff --git a/view/style.css b/view/style.css index 169a89589e..86876a697d 100644 --- a/view/style.css +++ b/view/style.css @@ -316,12 +316,17 @@ input#dfrn-url { #profile-edit-politic, #profile-edit-religion, #profile-in-dir-yes, -#profile-in-dir-no { +#profile-in-dir-no, +#hide-friends-yes, +#hide-friends-no { float: left; margin-bottom: 20px; } -#profile-in-dir-yes-label, #profile-in-dir-no-label { +#profile-in-dir-yes-label, +#profile-in-dir-no-label, +#hide-friends-yes-label, +#hide-friends-no-label { margin-left: 125px; float: left; width: 50px; @@ -347,10 +352,16 @@ input#dfrn-url { #profile-edit-religion-end, #profile-edit-homepage-end, #profile-in-dir-break, -#profile-in-dir-end { +#profile-in-dir-end, +#hide-friends-break, +#hide-friends-end { clear: both; } + + + + #gender-select, #marital-select, #sexual-select { width: 220px; } @@ -663,7 +674,9 @@ input#dfrn-url { margin-left: 30px; } - +#contact-edit-photo-wrapper { + margin-bottom: 20px; +} #contact-edit-links img { margin-left: 20px; border: none;