From f60cf54bab1fac27c7ccfc4d729901b47a0124c1 Mon Sep 17 00:00:00 2001 From: leosw Date: Tue, 1 Feb 2022 22:35:08 +0100 Subject: [PATCH] User can change his timezone --- controllers/d.users.php | 1 + models/d.users.php | 8 ++++---- views/d.user.profile.edit.html | 7 +++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/controllers/d.users.php b/controllers/d.users.php index bd9753d..bb67720 100755 --- a/controllers/d.users.php +++ b/controllers/d.users.php @@ -126,6 +126,7 @@ if(isset($controller->splitted_url[1])) { if($_POST['password']!='') $userProfile->password=sha1($_POST['password']); $userProfile->locale=$_POST['locale']; + $userProfile->timezone=$_POST['timezone']; if($user->rankIsHigher("administrator")) $userProfile->rank = $_POST['rank']; $userProfile->website=$_POST['website']; diff --git a/models/d.users.php b/models/d.users.php index 5307af9..fd7eaee 100755 --- a/models/d.users.php +++ b/models/d.users.php @@ -245,17 +245,17 @@ class User or die ("Could not connect to server\n"); if($this->password=='') { - $query = "UPDATE users SET version = $1, name = $2, is_avatar_present = $3, locale = $4, rank = $5, email = $6, website = $7 WHERE id = $8"; + $query = "UPDATE users SET version = $1, name = $2, is_avatar_present = $3, locale = $4, rank = $5, email = $6, website = $7, timezone = $8 WHERE id = $9"; pg_prepare($con, "prepare1", $query) or die ("Cannot prepare statement\n"); - pg_execute($con, "prepare1", array($this->version, $this->name, $this->is_avatar_present, $this->locale, $this->rank, $this->email, $this->website, $this->id)) + pg_execute($con, "prepare1", array($this->version, $this->name, $this->is_avatar_present, $this->locale, $this->rank, $this->email, $this->website, $this->timezone, $this->id)) or die ("Cannot execute statement\n"); } else { - $query = "UPDATE users SET name = $1, is_avatar_present = $2, locale = $3, rank = $4, email = $5, website = $6, password = $7 WHERE id = $8"; + $query = "UPDATE users SET name = $1, is_avatar_present = $2, locale = $3, rank = $4, email = $5, website = $6, password = $7, timezone = $8, version = $9 WHERE id = $10"; pg_prepare($con, "prepare1", $query) or die ("Cannot prepare statement\n"); - pg_execute($con, "prepare1", array($this->name, $this->is_avatar_present, $this->locale, $this->rank, $this->email, $this->website, $this->password, $this->id)) + pg_execute($con, "prepare1", array($this->name, $this->is_avatar_present, $this->locale, $this->rank, $this->email, $this->website, $this->password, $this->timezone, $this->version, $this->id)) or die ("Cannot execute statement\n"); } diff --git a/views/d.user.profile.edit.html b/views/d.user.profile.edit.html index 6fcd688..cb43245 100755 --- a/views/d.user.profile.edit.html +++ b/views/d.user.profile.edit.html @@ -47,6 +47,13 @@ +
  • +
  • rankIsHigher("administrator")) { ?>