Add Timezone to user data
This commit is contained in:
6
files/db/update_v9_to_v10.sql
Normal file
6
files/db/update_v9_to_v10.sql
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
ALTER TABLE users ADD COLUMN timezone char(64) AFTER language;
|
||||||
|
ALTER TABLE users MODIFY COLUMN email VARCHAR(320) NOT NULL;
|
||||||
|
ALTER TABLE users ADD COLUMN frequency VARCHAR(1) NOT NULL AFTER active;
|
||||||
|
UPDATE users SET timezone = 'Europe/Paris', frequency = 'P';
|
||||||
|
|
||||||
|
ALTER TABLE projects MODIFY COLUMN timezone char(64);
|
||||||
@@ -114,7 +114,7 @@ class Media extends PhpObject {
|
|||||||
$asDbInfo = array(
|
$asDbInfo = array(
|
||||||
Db::getId(Project::PROJ_TABLE) => $this->oProject->getProjectId(),
|
Db::getId(Project::PROJ_TABLE) => $this->oProject->getProjectId(),
|
||||||
'filename' => $sMediaName,
|
'filename' => $sMediaName,
|
||||||
'taken_on' => ($asMediaInfo['taken_ts'] > 0)?date(Db::TIMESTAMP_FORMAT, $asMediaInfo['taken_ts']):0, //Site Time (Settings::TIMEZONE)
|
'taken_on' => ($asMediaInfo['taken_ts'] > 0)?date(Db::TIMESTAMP_FORMAT, $asMediaInfo['taken_ts']):0, //Site Time
|
||||||
'posted_on' => date(Db::TIMESTAMP_FORMAT, $asMediaInfo['file_ts']), //Site Time
|
'posted_on' => date(Db::TIMESTAMP_FORMAT, $asMediaInfo['file_ts']), //Site Time
|
||||||
'rotate' => $asMediaInfo['rotate'],
|
'rotate' => $asMediaInfo['rotate'],
|
||||||
'type' => $asMediaInfo['type']
|
'type' => $asMediaInfo['type']
|
||||||
|
|||||||
53
inc/spot.php
53
inc/spot.php
@@ -80,38 +80,39 @@ class Spot extends Main
|
|||||||
Project::PROJ_TABLE => array('name', 'codename', 'active_from', 'active_to', 'timezone'),
|
Project::PROJ_TABLE => array('name', 'codename', 'active_from', 'active_to', 'timezone'),
|
||||||
self::POST_TABLE => array(Db::getId(Project::PROJ_TABLE), Db::getId(User::USER_TABLE), 'name', 'content', 'site_time'),
|
self::POST_TABLE => array(Db::getId(Project::PROJ_TABLE), Db::getId(User::USER_TABLE), 'name', 'content', 'site_time'),
|
||||||
Media::MEDIA_TABLE => array(Db::getId(Project::PROJ_TABLE), 'filename', 'type', 'taken_on', 'posted_on', 'rotate', 'comment'),
|
Media::MEDIA_TABLE => array(Db::getId(Project::PROJ_TABLE), 'filename', 'type', 'taken_on', 'posted_on', 'rotate', 'comment'),
|
||||||
User::USER_TABLE => array('name', 'email', 'language', 'active')
|
User::USER_TABLE => array('name', 'email', 'language', 'timezone', 'active', 'frequency')
|
||||||
),
|
),
|
||||||
'types' => array
|
'types' => array
|
||||||
(
|
(
|
||||||
'ref_msg_id' => "INT",
|
'active' => "BOOLEAN",
|
||||||
'type' => "VARCHAR(20)",
|
|
||||||
'latitude' => "DECIMAL(7,5)",
|
|
||||||
'longitude' => "DECIMAL(8,5)",
|
|
||||||
'iso_time' => "VARCHAR(24)",
|
|
||||||
'site_time' => "TIMESTAMP DEFAULT 0", //DEFAULT 0 removes auto-set to current time
|
|
||||||
'unix_time' => "INT",
|
|
||||||
'content' => "LONGTEXT",
|
|
||||||
'battery_state' => "VARCHAR(10)",
|
|
||||||
'ref_spot_id' => "VARCHAR(10)",
|
|
||||||
'name' => "VARCHAR(100)",
|
|
||||||
'codename' => "VARCHAR(100)",
|
|
||||||
'model' => "VARCHAR(20)",
|
|
||||||
'ref_feed_id' => "VARCHAR(40)",
|
|
||||||
'description' => "VARCHAR(100)",
|
|
||||||
'status' => "VARCHAR(10)",
|
|
||||||
'active_from' => "TIMESTAMP DEFAULT 0",
|
'active_from' => "TIMESTAMP DEFAULT 0",
|
||||||
'active_to' => "TIMESTAMP DEFAULT 0",
|
'active_to' => "TIMESTAMP DEFAULT 0",
|
||||||
'timezone' => "VARCHAR(100)",
|
'battery_state' => "VARCHAR(10)",
|
||||||
'last_update' => "TIMESTAMP DEFAULT 0",
|
'codename' => "VARCHAR(100)",
|
||||||
'filename' => "VARCHAR(100) NOT NULL",
|
'content' => "LONGTEXT",
|
||||||
'taken_on' => "TIMESTAMP DEFAULT 0",
|
|
||||||
'posted_on' => "TIMESTAMP DEFAULT 0",
|
|
||||||
'rotate' => "SMALLINT",
|
|
||||||
'comment' => "LONGTEXT",
|
'comment' => "LONGTEXT",
|
||||||
'email' => "VARCHAR(320)",
|
'description' => "VARCHAR(100)",
|
||||||
|
'email' => "VARCHAR(320) NOT NULL",
|
||||||
|
'filename' => "VARCHAR(100) NOT NULL",
|
||||||
|
'frequency' => "VARCHAR(1) NOT NULL",
|
||||||
|
'iso_time' => "VARCHAR(24)",
|
||||||
'language' => "VARCHAR(2)",
|
'language' => "VARCHAR(2)",
|
||||||
'active' => "BOOLEAN"
|
'last_update' => "TIMESTAMP DEFAULT 0",
|
||||||
|
'latitude' => "DECIMAL(7,5)",
|
||||||
|
'longitude' => "DECIMAL(8,5)",
|
||||||
|
'model' => "VARCHAR(20)",
|
||||||
|
'name' => "VARCHAR(100)",
|
||||||
|
'posted_on' => "TIMESTAMP DEFAULT 0",
|
||||||
|
'ref_feed_id' => "VARCHAR(40)",
|
||||||
|
'ref_msg_id' => "INT",
|
||||||
|
'ref_spot_id' => "VARCHAR(10)",
|
||||||
|
'rotate' => "SMALLINT",
|
||||||
|
'site_time' => "TIMESTAMP DEFAULT 0", //DEFAULT 0 removes auto-set to current time
|
||||||
|
'status' => "VARCHAR(10)",
|
||||||
|
'taken_on' => "TIMESTAMP DEFAULT 0",
|
||||||
|
'timezone' => "CHAR(64)", //see mysql.time_zone_name
|
||||||
|
'type' => "VARCHAR(20)",
|
||||||
|
'unix_time' => "INT"
|
||||||
),
|
),
|
||||||
'constraints' => array
|
'constraints' => array
|
||||||
(
|
(
|
||||||
@@ -248,7 +249,7 @@ class Spot extends Main
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function subscribe($sEmail) {
|
public function subscribe($sEmail) {
|
||||||
$asResult = $this->oUser->addUser($sEmail, $this->oLang->getLanguage());
|
$asResult = $this->oUser->addUser($sEmail, $this->oLang->getLanguage(), date_default_timezone_get());
|
||||||
$asUserInfo = $this->oUser->getUserInfo();
|
$asUserInfo = $this->oUser->getUserInfo();
|
||||||
|
|
||||||
//Send Confirmation Email
|
//Send Confirmation Email
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class User extends PhpObject {
|
|||||||
parent::__construct(__CLASS__, Settings::DEBUG);
|
parent::__construct(__CLASS__, Settings::DEBUG);
|
||||||
$this->oDb = &$oDb;
|
$this->oDb = &$oDb;
|
||||||
$this->iUserId = 0;
|
$this->iUserId = 0;
|
||||||
$this->asUserInfo = array(Db::getId(self::USER_TABLE)=>0, 'name'=>'', 'email'=>'', 'language'=>'', 'active'=>'0');
|
$this->asUserInfo = array(Db::getId(self::USER_TABLE)=>0, 'name'=>'', 'email'=>'', 'language'=>'', 'timezone'=>'', 'active'=>'0');
|
||||||
$this->checkUserCookie();
|
$this->checkUserCookie();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ class User extends PhpObject {
|
|||||||
return $this->asUserInfo['language'];
|
return $this->asUserInfo['language'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addUser($sEmail, $sLang) {
|
public function addUser($sEmail, $sLang, $sTimezone) {
|
||||||
$bSuccess = false;
|
$bSuccess = false;
|
||||||
$sDesc = '';
|
$sDesc = '';
|
||||||
$sEmail = trim($sEmail);
|
$sEmail = trim($sEmail);
|
||||||
@@ -45,7 +45,7 @@ class User extends PhpObject {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//Add/Reactivate user
|
//Add/Reactivate user
|
||||||
$iUserId = $this->oDb->insertUpdateRow(self::USER_TABLE, array('email'=>$sEmail, 'language'=>$sLang, 'active'=>'1'), array('email'));
|
$iUserId = $this->oDb->insertUpdateRow(self::USER_TABLE, array('email'=>$sEmail, 'language'=>$sLang, 'timezone'=>$sTimezone, 'active'=>'1'), array('email'));
|
||||||
if($iUserId==0) $sDesc = 'lang:error_commit_db';
|
if($iUserId==0) $sDesc = 'lang:error_commit_db';
|
||||||
else {
|
else {
|
||||||
$sDesc = 'lang:nl_subscribed';
|
$sDesc = 'lang:nl_subscribed';
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ unit_hour = h
|
|||||||
|
|
||||||
newsletter = Keep in touch!
|
newsletter = Keep in touch!
|
||||||
nl_email_placeholder= my@email.com
|
nl_email_placeholder= my@email.com
|
||||||
|
nl_invalid_email = It doesn't look like an email
|
||||||
nl_subscribed_desc = You're all set. We'll send you updates as soon as we get them
|
nl_subscribed_desc = You're all set. We'll send you updates as soon as we get them
|
||||||
nl_unsubscribed_desc= Write down your email address and we'll send you François' position as soon as we get it :)
|
nl_unsubscribed_desc= Write down your email address and we'll send you François' position as soon as we get it :)
|
||||||
nl_email_exists = This email is already subscribed. You can unsubscribe by clicking on the button above.
|
nl_email_exists = This email is already subscribed. You can unsubscribe by clicking on the button above.
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ unit_hour = h
|
|||||||
|
|
||||||
newsletter = Rester en contact
|
newsletter = Rester en contact
|
||||||
nl_email_placeholder= mon@email.com
|
nl_email_placeholder= mon@email.com
|
||||||
|
nl_invalid_email = Ceci ne ressemble pas à une adresse email
|
||||||
nl_subscribed_desc = C'est tout bon. On t'enverra les nouvelles posititions dès qu'on les reçoit
|
nl_subscribed_desc = C'est tout bon. On t'enverra les nouvelles posititions dès qu'on les reçoit
|
||||||
nl_unsubscribed_desc= Ajoute ton adresse email et on t'enverra la nouvelle position de François dès qu'on la reçoit :)
|
nl_unsubscribed_desc= Ajoute ton adresse email et on t'enverra la nouvelle position de François dès qu'on la reçoit :)
|
||||||
nl_email_exists = Cette adresse email est déjà enregistrée. Vous pouvez vous désinscrire en cliquant sur le bouton ci-dessus.
|
nl_email_exists = Cette adresse email est déjà enregistrée. Vous pouvez vous désinscrire en cliquant sur le bouton ci-dessus.
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ function initSettings(){
|
|||||||
var sAction = $(this).prop('name');
|
var sAction = $(this).prop('name');
|
||||||
var sEmail = $('#email').val();
|
var sEmail = $('#email').val();
|
||||||
var regexEmail = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
var regexEmail = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||||
if(!regexEmail.test(sEmail)) settingsFeedback('error', 'this is not an email');
|
if(!regexEmail.test(sEmail)) settingsFeedback('error', oSpot.lang('nl_invalid_email'));
|
||||||
else {
|
else {
|
||||||
oSpot.get(
|
oSpot.get(
|
||||||
sAction,
|
sAction,
|
||||||
|
|||||||
@@ -15,4 +15,5 @@
|
|||||||
* Fix lightbox portrait mode: push text under
|
* Fix lightbox portrait mode: push text under
|
||||||
* Subscribe to message feed
|
* Subscribe to message feed
|
||||||
* Add mail frequency slider
|
* Add mail frequency slider
|
||||||
* Add Timezone to user table
|
* Add Timezone to user table
|
||||||
|
* Replace Project Time Zone with browser Time Zone when uploading media?
|
||||||
Reference in New Issue
Block a user