From c3387d74a4f09e96e6135b9a031077af6eb6a106 Mon Sep 17 00:00:00 2001 From: Pierre-Henry Soria Date: Sun, 9 Jul 2017 03:16:08 +0100 Subject: [PATCH] Fix coding style issue + import classes --- .../app/system/core/assets/cron/96h/DatabaseCoreCron.php | 9 ++++++--- .../modules/user/controllers/AccountController.php | 1 + .../modules/user/controllers/CountryController.php | 6 ++---- .../system/modules/user/controllers/MainController.php | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/_protected/app/system/core/assets/cron/96h/DatabaseCoreCron.php b/_protected/app/system/core/assets/cron/96h/DatabaseCoreCron.php index 876664bfa1..6886eee9ae 100755 --- a/_protected/app/system/core/assets/cron/96h/DatabaseCoreCron.php +++ b/_protected/app/system/core/assets/cron/96h/DatabaseCoreCron.php @@ -14,9 +14,12 @@ defined('PH7') or exit('Restricted access'); +use PH7\Framework\Date\CDateTime; +use PH7\Framework\Http\Http; use PH7\Framework\Mvc\Model\DbConfig; use PH7\Framework\Mvc\Model\Engine\Db; use PH7\Framework\Mvc\Model\Engine\Util\Backup; +use PH7\Framework\Mvc\Model\Engine\Util\Various as DbVarious; class DatabaseCoreCron extends Cron { @@ -48,7 +51,7 @@ public function __construct() break; default: - Framework\Http\Http::setHeadersByCode(400); + Http::setHeadersByCode(400); exit('Bad Request Error!'); } } @@ -112,7 +115,7 @@ protected function stat() protected function backup() { - (new Backup(PH7_PATH_BACKUP_SQL . 'Periodic-database-update.' . (new Framework\Date\CDateTime)->get()->date() . '.sql.gz'))->back()->saveArchive(); + (new Backup(PH7_PATH_BACKUP_SQL . 'Periodic-database-update.' . (new CDateTime)->get()->date() . '.sql.gz'))->back()->saveArchive(); echo t('Backup of the Database... Ok!') . '
'; } @@ -204,7 +207,7 @@ protected function cleanData() protected function pruningDb($iOlderThanXDay, $sTable, $sDateColumn) { if (strstr($sTable, 'Comments') === false && $sTable !== 'Messages' && $sTable !== 'Messenger') { - Framework\Mvc\Model\Engine\Util\Various::launchErr($sTable); + DbVarious::launchErr($sTable); } $rStmt = Db::getInstance()->prepare('DELETE FROM' . Db::prefix($sTable) . 'WHERE (' . $sDateColumn . ' < NOW() - INTERVAL :dayNumber DAY)'); diff --git a/_protected/app/system/modules/user/controllers/AccountController.php b/_protected/app/system/modules/user/controllers/AccountController.php index 20b666b345..04c5a050ed 100755 --- a/_protected/app/system/modules/user/controllers/AccountController.php +++ b/_protected/app/system/modules/user/controllers/AccountController.php @@ -5,6 +5,7 @@ * @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory. * @package PH7 / App / System / Module / User / Controller */ + namespace PH7; use PH7\Framework\Module\Various as SysMod; diff --git a/_protected/app/system/modules/user/controllers/CountryController.php b/_protected/app/system/modules/user/controllers/CountryController.php index 70dbe795b9..30f3acf66b 100755 --- a/_protected/app/system/modules/user/controllers/CountryController.php +++ b/_protected/app/system/modules/user/controllers/CountryController.php @@ -5,6 +5,7 @@ * @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory. * @package PH7 / App / System / Module / User / Controller */ + namespace PH7; use PH7\Framework\Geo\Map\Map; @@ -60,9 +61,7 @@ public function index() $sMemberTxt = nt('%n% member', '%n% members', $iTotalUsers); $this->view->h3_title = t('%0% lives near %1% %2%', $sMemberTxt, $this->registry->country, $this->registry->city); - } - else - { + } else { // Not found page Framework\Http\Http::setHeadersByCode(404); $this->view->error = t('Error, country is empty.'); @@ -76,5 +75,4 @@ private function getCountryCode() $sCountryCode = Framework\CArray\CArray::getKeyByValIgnoreCase($this->registry->country, $this->registry->lang); return (strlen($sCountryCode) == 2) ? $sCountryCode : substr($this->registry->country, 0, 2); } - } diff --git a/_protected/app/system/modules/user/controllers/MainController.php b/_protected/app/system/modules/user/controllers/MainController.php index 87a20d9395..b8b788a012 100755 --- a/_protected/app/system/modules/user/controllers/MainController.php +++ b/_protected/app/system/modules/user/controllers/MainController.php @@ -147,11 +147,11 @@ private function _getPageForced() switch ($this->httpRequest->get('force')) { case 'classic': $sPage = static::GUEST_FILE; - break; + break; case 'splash': $sPage = static::GUEST_SPLASH_FILE; - break; + break; default: throw new PH7InvalidArgumentException('You can only choose between "classic" or "splash"');