]> git.mxchange.org Git - friendica.git/commitdiff
ability to hide profile and wall from unknown people
authorFriendika <info@friendika.com>
Tue, 24 May 2011 23:30:52 +0000 (16:30 -0700)
committerFriendika <info@friendika.com>
Tue, 24 May 2011 23:30:52 +0000 (16:30 -0700)
boot.php
database.sql
include/template_processor.php
mod/profile.php
mod/profiles.php
update.php
view/profile-hide-wall.tpl [new file with mode: 0644]
view/profile_edit.tpl
view/theme/duepuntozero/style.css
view/theme/loozah/style.css

index f72f4dd7fc11488e76a91a05b2c1399d5ee0bb0e..faf3c4db4affdb7ffe270c9380402008f948985a 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -4,9 +4,9 @@ set_time_limit(0);
 ini_set('pcre.backtrack_limit', 250000);
 
 
-define ( 'FRIENDIKA_VERSION',      '2.2.989' );
+define ( 'FRIENDIKA_VERSION',      '2.2.990' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.21'    );
-define ( 'DB_UPDATE_VERSION',      1055      );
+define ( 'DB_UPDATE_VERSION',      1056      );
 
 define ( 'EOL',                    "<br />\r\n"     );
 define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
@@ -2361,6 +2361,10 @@ function profile_sidebar($profile) {
 
        $homepage = ((x($profile,'homepage') == 1) ? '<div class="homepage"><span class="homepage-label">' . t('Homepage:') . ' </span><span class="homepage-url">' . linkify($profile['homepage']) . '</span></div><div class="profile-clear"></div>' : '');
 
+       if($profile['hidewall'] && (! local_user()) && (! remote_user())) {
+               $location = $gender = $marital = $homepage = '';
+       }
+
        $tpl = get_markup_template('profile_vcard.tpl');
 
        $o .= replace_macros($tpl, array(
index fdc08b7c833675b42b8b7cc6720466fd3192eb77..d9cd016f071182f764d06f5fb32238d79c21bcc2 100644 (file)
@@ -288,6 +288,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
   `profile-name` char(255) NOT NULL,
   `is-default` tinyint(1) NOT NULL DEFAULT '0',
   `hide-friends` tinyint(1) NOT NULL DEFAULT '0',
+  `hidewall` tinyint(1) NOT NULL DEFAULT '0',
   `name` char(255) NOT NULL,
   `pdesc` char(255) NOT NULL,
   `dob` char(32) NOT NULL DEFAULT '0000-00-00',
index efdfbaecb78a73fb61bdf90c4b259015bbfe49c6..d8dfbaedb109dd0746a00e918ec7e47a75af1556 100644 (file)
                        #$s = str_replace(array("\n","\r"),array("§n§","§r§"),$s);
                        $s = $this->_build_nodes($s);
                        $s = preg_replace_callback('/\|\|([0-9]+)\|\|/', array($this, "_replcb_node"), $s);
-                       $s = str_replace($this->search,$this->replace, (string) $s);
+                       $s = str_replace($this->search,$this->replace, $s);
                        
                        return $s;
                }
index 634aec460be3c48621901de5a17082b442e8c9a1..8d46d6c5ba5fb0a7dff07a9ce2b7c6c8aea00031 100644 (file)
@@ -51,11 +51,14 @@ function profile_init(&$a) {
 
 function profile_content(&$a, $update = 0) {
 
-       if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
+       if(get_config('system','block_public') && (! local_user()) && (! remote_user())) {
                return login();
        }
 
-
+       if($a->profile['hidewall'] && (! local_user()) && (! remote_user())) {
+               notice( t('Access to this profile has been restricted.') . EOL);
+               return;
+       }
 
        require_once("include/bbcode.php");
        require_once('include/security.php');
index 9c92d81bad906779f0cc9b198cbc8e77ac2ddcb2..b64c1294e31ee1b42bd4ddb3580ba118ec561c82 100644 (file)
@@ -129,6 +129,7 @@ function profiles_post(&$a) {
                $work = escape_tags(trim($_POST['work']));
                $education = escape_tags(trim($_POST['education']));
                $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0);
+               $hidewall = (($_POST['hidewall'] == 1) ? 1: 0);
 
 
                $r = q("UPDATE `profile` 
@@ -160,7 +161,8 @@ function profiles_post(&$a) {
                        `romance` = '%s',
                        `work` = '%s',
                        `education` = '%s',
-                       `hide-friends` = %d
+                       `hide-friends` = %d,
+                       `hidewall` = %d
                        WHERE `id` = %d AND `uid` = %d LIMIT 1",
                        dbesc($profile_name),
                        dbesc($name),
@@ -191,6 +193,7 @@ function profiles_post(&$a) {
                        dbesc($work),
                        dbesc($education),
                        intval($hide_friends),
+                       intval($hidewall),
                        intval($a->argv[1]),
                        intval($_SESSION['uid'])
                );
@@ -351,13 +354,23 @@ function profiles_content(&$a) {
 
                $opt_tpl = get_markup_template("profile-hide-friends.tpl");
                $hide_friends = replace_macros($opt_tpl,array(
-                       '$desc' => t('Hide my contact/friend list from viewers of this profile?'),
+                       '$desc' => t('Hide your contact/friend list from viewers of this profile?'),
                        '$yes_str' => t('Yes'),
                        '$no_str' => t('No'),
                        '$yes_selected' => (($r[0]['hide-friends']) ? " checked=\"checked\" " : ""),
                        '$no_selected' => (($r[0]['hide-friends'] == 0) ? " checked=\"checked\" " : "")
                ));
 
+               $opt_tpl = get_markup_template("profile-hide-wall.tpl");
+               $hide_wall = replace_macros($opt_tpl,array(
+                       '$desc' => t('Hide your messages from unknown viewers of this profile?'),
+                       '$yes_str' => t('Yes'),
+                       '$no_str' => t('No'),
+                       '$yes_selected' => (($r[0]['hidewall']) ? " checked=\"checked\" " : ""),
+                       '$no_selected' => (($r[0]['hidewall'] == 0) ? " checked=\"checked\" " : "")
+               ));
+
+
 
                $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl()));
                $a->page['htmlhead'] .= "<script type=\"text/javascript\" src=\"include/country.js\" ></script>";
@@ -413,6 +426,7 @@ function profiles_content(&$a) {
                        '$pdesc' => $r[0]['pdesc'],
                        '$dob' => dob($r[0]['dob']),
                        '$hide_friends' => $hide_friends,
+                       '$hide_wall' => $hide_wall,
                        '$address' => $r[0]['address'],
                        '$locality' => $r[0]['locality'],
                        '$region' => $r[0]['region'],
index 488648791262a8e45d49748f79efaa1c62918ea7..603b93b631271e7447998b341385ef167c20fb2b 100644 (file)
@@ -483,3 +483,7 @@ function update_1053() {
 function update_1054() {
        q("ALTER TABLE `register` ADD `language` CHAR( 16 ) NOT NULL AFTER `password` ");
 }
+
+function update_1055() {
+       q("ALTER TABLE `profile` ADD `hidewall` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `hide-friends` ");
+}
\ No newline at end of file
diff --git a/view/profile-hide-wall.tpl b/view/profile-hide-wall.tpl
new file mode 100644 (file)
index 0000000..10185e2
--- /dev/null
@@ -0,0 +1,16 @@
+<p id="hide-wall-text">
+$desc
+</p>
+
+               <div id="hide-wall-yes-wrapper">
+               <label id="hide-wall-yes-label" for="hide-wall-yes">$yes_str</label>
+               <input type="radio" name="hidewall" id="hide-wall-yes" $yes_selected value="1" />
+
+               <div id="hide-wall-break" ></div>       
+               </div>
+               <div id="hide-wall-no-wrapper">
+               <label id="hide-wall-no-label" for="hide-wall-no">$no_str</label>
+               <input type="radio" name="hidewall" id="hide-wall-no" $no_selected value="0"  />
+
+               <div id="hide-wall-end"></div>
+               </div>
index 053e19594bae2739501359faae799d024b04ac46..564746e6a59bf49b5f759ee33ef80227badf45d0 100644 (file)
@@ -52,6 +52,8 @@ $dob $age
 
 $hide_friends
 
+$hide_wall
+
 <div class="profile-edit-submit-wrapper" >
 <input type="submit" name="submit" class="profile-edit-submit-button" value="$submit" />
 </div>
index 61da542312353c268d538741955c2828486d2455..176fc0fd96d225bccfc3f4f44ce03bf155c20ef1 100644 (file)
@@ -701,6 +701,8 @@ input#dfrn-url {
 #profile-in-dir-no,
 #profile-in-netdir-yes,
 #profile-in-netdir-no,
+#hide-wall-yes,
+#hide-wall-no,
 #hide-friends-yes,
 #hide-friends-no {
        float: left;
@@ -718,6 +720,8 @@ input#dfrn-url {
 #profile-in-dir-no-label,
 #profile-in-netdir-yes-label,
 #profile-in-netdir-no-label,
+#hide-wall-yes-label,
+#hide-wall-no-label,
 #hide-friends-yes-label,
 #hide-friends-no-label {
        margin-left: 125px;
@@ -801,6 +805,8 @@ input#dfrn-url {
 #profile-in-dir-end,
 #profile-in-netdir-break,
 #profile-in-netdir-end,
+#hide-wall-break,
+#hide-wall-end,
 #hide-friends-break,
 #hide-friends-end,
 #settings-normal-break,
index 92c2c20a771693bd4765e5ad9f6f685c1e729b82..d1a0019cebfd35ecd24e5d6d93e939f61f452331 100644 (file)
@@ -825,6 +825,8 @@ input#dfrn-url {
 #profile-in-dir-no,
 #profile-in-netdir-yes,
 #profile-in-netdir-no,
+#hide-wall-yes,
+#hide-wall-no,
 #hide-friends-yes,
 #hide-friends-no,
 #settings-normal,
@@ -839,6 +841,8 @@ input#dfrn-url {
 #profile-in-dir-no-label,
 #profile-in-netdir-yes-label,
 #profile-in-netdir-no-label,
+#hide-wall-yes-label,
+#hide-wall-no-label,
 #hide-friends-yes-label,
 #hide-friends-no-label {
        margin-left: 125px;
@@ -917,6 +921,8 @@ input#dfrn-url {
 #profile-in-dir-end,
 #profile-in-netdir-break,
 #profile-in-netdir-end,
+#hide-wall-break,
+#hide-wall-end,
 #hide-friends-break,
 #hide-friends-end,
 #settings-normal-break,