User can change his timezone

This commit is contained in:
Léo Serre 2022-02-01 22:35:08 +01:00
parent 507bf492a0
commit f60cf54bab
3 changed files with 12 additions and 4 deletions

View File

@ -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'];

View File

@ -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");
}

View File

@ -47,6 +47,13 @@
<option <?=$userProfile->get_locale()==$locale->display_name?'selected':''?> value="<?=$locale->name?>"><?=$locale->display_name?></option>
<? } ?>
</select></li>
<li><label for="timezone">Fuseau horaire :</label>
<select name="timezone" id="timezone">
<? $timezones = timezone_identifiers_list();
foreach($timezones as $timezone) { ?>
<option <?=$userProfile->timezone==$timezone?'selected':''?> value="<?=$timezone?>"><?=$timezone?></option>
<? } ?>
</select></li>
<? if($user->rankIsHigher("administrator")) { ?>
<li><label for="rank">Rang : </label>
<select name="rank" id="rank">