If there is no photo, default publicity is 'private'.
[platal.git] / modules / profile / general.inc.php
index 66d94b3..cd3b394 100644 (file)
@@ -574,7 +574,11 @@ class ProfilePageGeneral extends ProfilePage
         $res = XDB::query("SELECT  pub
                              FROM  profile_photos
                             WHERE  pid = {?}", $this->pid());
-        $this->values['photo_pub'] = $res->fetchOneCell();
+        if ($res->numRows() == 0) {
+            $this->values['photo_pub'] = 'private';
+        } else {
+            $this->values['photo_pub'] = $res->fetchOneCell();
+        }
 
         if ($this->owner) {
             $res = XDB::query("SELECT  COUNT(*)
@@ -636,7 +640,7 @@ class ProfilePageGeneral extends ProfilePage
                            WHERE  pid = {?}",
                          $this->values['photo_pub'], $this->pid());
         }
-        if ($this->changed['yourself']) {
+        if (S::user()->isMe($this->owner) && $this->changed['yourself']) {
             if ($this->owner) {
                 XDB::execute('UPDATE  accounts
                                  SET  display_name = {?}
@@ -661,7 +665,7 @@ class ProfilePageGeneral extends ProfilePage
                 }
             }
         }
-        if ($this->changed['deathdate']) {
+        if (!S::user()->isMe($this->owner) && $this->changed['deathdate']) {
             XDB::execute('UPDATE  profiles
                              SET  deathdate = {?}, deathdate_rec = NOW()
                            WHERE  pid = {?} AND deathdate_rec IS NULL',