diff --git a/inc/Spot.php b/inc/Spot.php index 130d958..bbc1121 100755 --- a/inc/Spot.php +++ b/inc/Spot.php @@ -361,7 +361,7 @@ class Spot extends Main * Get valid medias based on $sTimeRefField: * - taken_on: Date/time on which the media was taken * - posted_on: Date/time on which the media was uploaded - * @param String $sTimeRefField Field to calculate relative times + * @param String $sTimeRefField Field to calculate relative times: 'taken_on' or 'posted_on' * @return Array Medias info */ private function getMedias($sTimeRefField) @@ -397,13 +397,15 @@ class Spot extends Main 'select' => array(Db::getFullColumnName(self::POST_TABLE, '*'), 'gravatar'), 'from' => self::POST_TABLE, 'join' => array(User::USER_TABLE => Db::getId(User::USER_TABLE)), - 'constraint'=> array(Db::getId(Project::PROJ_TABLE) => $this->oProject->getProjectId()), - 'constOpe' => array(Db::getId(Project::PROJ_TABLE) => "=") + 'constraint'=> array( + Db::getId(Project::PROJ_TABLE) => $this->oProject->getProjectId(), + 'site_time' => $this->oProject->getActivePeriod('to') + ), + 'constOpe' => array( + Db::getId(Project::PROJ_TABLE) => "=", + 'site_time' => "<=" + ) ); - if($this->oProject->getMode()==Project::MODE_HISTO) { - $asInfo['constraint']['site_time'] = $this->oProject->getActivePeriod('to'); - $asInfo['constOpe']['site_time'] = "<="; - } $asPosts = $this->oDb->selectRows($asInfo); foreach($asPosts as &$asPost) {