From 16362e186da377289bd4d2661d77e633ed731b00 Mon Sep 17 00:00:00 2001 From: franzz Date: Thu, 23 Jun 2016 21:11:24 +0200 Subject: [PATCH] sort messages by timestamp --- inc/spot.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/inc/spot.php b/inc/spot.php index a7196a1..fd603bb 100755 --- a/inc/spot.php +++ b/inc/spot.php @@ -126,8 +126,8 @@ class Spot extends Main 'type' => $asMsg['messageType'], 'latitude' => $asMsg['latitude'], 'longitude' => $asMsg['longitude'], - 'timestamp' => date(MySqlManager::MYSQL_TIMESTAMP, strtotime($asMsg['dateTime'])), //Stored in Paris Time :s - 'unix_timestamp' => $asMsg['unixTime'], + 'timestamp' => date(MySqlManager::MYSQL_TIMESTAMP, strtotime($asMsg['dateTime'])), //Stored in Local Time + 'unix_timestamp' => $asMsg['unixTime'], //Stored in UNIX time 'content' => $asMsg['messageContent'], 'battery_state' => $asMsg['batteryState']); $this->oMySql->insertUpdateRow(self::MSG_TABLE, $asMsg, array('ref_msg_id')); @@ -149,7 +149,7 @@ class Spot extends Main //Check last message & update feed if necessary (max once a day) $sLastMsg = $this->oMySql->selectValue(self::FEED_TABLE, 'led', array('ref_feed_id'=>$sRefFeedId)); - if(mb_substr($sLastMsg, 0, 10) != date('Y-m-d')) $this->updateFeed($sRefFeedId); + if(Settings::MODE!=self::MODE_HISTO && mb_substr($sLastMsg, 0, 10) != date('Y-m-d')) $this->updateFeed($sRefFeedId); //Extract messages $asMessages = $this->getSpotMessages(); @@ -161,7 +161,7 @@ class Spot extends Main private function getSpotMessages() { - $asMessages = $this->oMySql->selectRows(array('from'=>self::MSG_TABLE)); + $asMessages = $this->oMySql->selectRows(array('from'=>self::MSG_TABLE, 'orderBy'=>array('timestamp'=>'ASC'))); foreach($asMessages as $iKey=>$asMessage) { $iUnixTimeStamp = strtotime($asMessage['timestamp']); @@ -246,7 +246,7 @@ class Spot extends Main public static function getPicInfo($sPicPath) { $iPicTimeStamp = 0; - $asExif = exif_read_data($sPicPath, 0, true); + $asExif = @exif_read_data($sPicPath, 0, true); //Timestamp if(array_key_exists('DateTimeOriginal', $asExif['EXIF'])) $iPicTimeStamp = strtotime($asExif['EXIF']['DateTimeOriginal']);