Add Timezone to user data
This commit is contained in:
@@ -114,7 +114,7 @@ class Media extends PhpObject {
|
||||
$asDbInfo = array(
|
||||
Db::getId(Project::PROJ_TABLE) => $this->oProject->getProjectId(),
|
||||
'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
|
||||
'rotate' => $asMediaInfo['rotate'],
|
||||
'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'),
|
||||
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'),
|
||||
User::USER_TABLE => array('name', 'email', 'language', 'active')
|
||||
User::USER_TABLE => array('name', 'email', 'language', 'timezone', 'active', 'frequency')
|
||||
),
|
||||
'types' => array
|
||||
(
|
||||
'ref_msg_id' => "INT",
|
||||
'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' => "BOOLEAN",
|
||||
'active_from' => "TIMESTAMP DEFAULT 0",
|
||||
'active_to' => "TIMESTAMP DEFAULT 0",
|
||||
'timezone' => "VARCHAR(100)",
|
||||
'last_update' => "TIMESTAMP DEFAULT 0",
|
||||
'filename' => "VARCHAR(100) NOT NULL",
|
||||
'taken_on' => "TIMESTAMP DEFAULT 0",
|
||||
'posted_on' => "TIMESTAMP DEFAULT 0",
|
||||
'rotate' => "SMALLINT",
|
||||
'battery_state' => "VARCHAR(10)",
|
||||
'codename' => "VARCHAR(100)",
|
||||
'content' => "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)",
|
||||
'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
|
||||
(
|
||||
@@ -248,7 +249,7 @@ class Spot extends Main
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
//Send Confirmation Email
|
||||
|
||||
@@ -22,7 +22,7 @@ class User extends PhpObject {
|
||||
parent::__construct(__CLASS__, Settings::DEBUG);
|
||||
$this->oDb = &$oDb;
|
||||
$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();
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class User extends PhpObject {
|
||||
return $this->asUserInfo['language'];
|
||||
}
|
||||
|
||||
public function addUser($sEmail, $sLang) {
|
||||
public function addUser($sEmail, $sLang, $sTimezone) {
|
||||
$bSuccess = false;
|
||||
$sDesc = '';
|
||||
$sEmail = trim($sEmail);
|
||||
@@ -45,7 +45,7 @@ class User extends PhpObject {
|
||||
}
|
||||
else {
|
||||
//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';
|
||||
else {
|
||||
$sDesc = 'lang:nl_subscribed';
|
||||
|
||||
Reference in New Issue
Block a user