From: Marcel Werk Date: Sat, 19 Apr 2014 22:51:20 +0000 (+0200) Subject: Fixed multiple issues X-Git-Tag: 2.1.0_Alpha_1~875 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=da926b42cf13ac47512ebb6f74aa4862b8b49a20;p=GitHub%2FWoltLab%2FWCF.git Fixed multiple issues --- diff --git a/wcfsetup/install/files/lib/acp/page/StatPage.class.php b/wcfsetup/install/files/lib/acp/page/StatPage.class.php index 715acd9ace..b96cc97b93 100644 --- a/wcfsetup/install/files/lib/acp/page/StatPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/StatPage.class.php @@ -51,7 +51,7 @@ class StatPage extends AbstractPage { parent::readData(); // set default values - $d = DateUtil::getDateTimeByTimestamp(1366416000); // @todo TIME_NOW + $d = DateUtil::getDateTimeByTimestamp(TIME_NOW); $d->setTimezone(WCF::getUser()->getTimeZone()); $this->endDate = $d->format('Y-m-d'); $d->sub(new \DateInterval('P1M')); diff --git a/wcfsetup/install/files/lib/data/stat/daily/StatDailyAction.class.php b/wcfsetup/install/files/lib/data/stat/daily/StatDailyAction.class.php index 6183c22ff4..772fec6c4f 100644 --- a/wcfsetup/install/files/lib/data/stat/daily/StatDailyAction.class.php +++ b/wcfsetup/install/files/lib/data/stat/daily/StatDailyAction.class.php @@ -29,12 +29,12 @@ class StatDailyAction extends AbstractDatabaseObjectAction { WCF::getSession()->checkPermissions(array('admin.system.canViewLog')); // validate start date - if (empty($this->parameters['startDate']) || !preg_match('/^\d{4}\-\d{2}\-\d{2}$/')) { + if (empty($this->parameters['startDate']) || !preg_match('/^\d{4}\-\d{2}\-\d{2}$/', $this->parameters['startDate'])) { throw new UserInputException('startDate'); } // validate end date - if (empty($this->parameters['endDate']) || !preg_match('/^\d{4}\-\d{2}\-\d{2}$/')) { + if (empty($this->parameters['endDate']) || !preg_match('/^\d{4}\-\d{2}\-\d{2}$/', $this->parameters['endDate'])) { throw new UserInputException('endDate'); } diff --git a/wcfsetup/install/files/lib/system/stat/AttachmentDiskUsageStatDailyHandler.class.php b/wcfsetup/install/files/lib/system/stat/AttachmentDiskUsageStatDailyHandler.class.php index f53c58ceeb..ffc0c0b1bf 100644 --- a/wcfsetup/install/files/lib/system/stat/AttachmentDiskUsageStatDailyHandler.class.php +++ b/wcfsetup/install/files/lib/system/stat/AttachmentDiskUsageStatDailyHandler.class.php @@ -17,14 +17,14 @@ class AttachmentDiskUsageStatDailyHandler extends AbstractStatDailyHandler { * @see \wcf\system\stat\IStatDailyHandler::getData() */ public function getData($date) { - $sql = "SELECT SUM(filesize) + $sql = "SELECT CEIL(SUM(filesize) / 1000) FROM wcf".WCF_N."_attachment WHERE uploadTime BETWEEN ? AND ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($date, $date + 86399)); $counter = intval($statement->fetchColumn()); - $sql = "SELECT SUM(filesize) + $sql = "SELECT CEIL(SUM(filesize) / 1000) FROM wcf".WCF_N."_attachment WHERE uploadTime < ?"; $statement = WCF::getDB()->prepareStatement($sql); @@ -41,6 +41,6 @@ class AttachmentDiskUsageStatDailyHandler extends AbstractStatDailyHandler { * @see \wcf\system\stat\IStatDailyHandler::getFormattedCounter() */ public function getFormattedCounter($counter) { - return round($counter / 1000000); // return mb + return round($counter / 1000, 2); // return mb } } diff --git a/wcfsetup/install/files/lib/system/stat/LikeStatDailyHandler.class.php b/wcfsetup/install/files/lib/system/stat/LikeStatDailyHandler.class.php index 57daad6273..89f57cc028 100644 --- a/wcfsetup/install/files/lib/system/stat/LikeStatDailyHandler.class.php +++ b/wcfsetup/install/files/lib/system/stat/LikeStatDailyHandler.class.php @@ -23,14 +23,15 @@ class LikeStatDailyHandler extends AbstractStatDailyHandler { $sql = "SELECT COUNT(*) FROM wcf".WCF_N."_like WHERE time BETWEEN ? AND ? - AND likeValue"; + AND likeValue = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($date, $date + 86399, $this->likeValue)); $counter = intval($statement->fetchColumn()); $sql = "SELECT COUNT(*) FROM wcf".WCF_N."_like - WHERE time < ?"; + WHERE time < ? + AND likeValue = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($date + 86400, $this->likeValue)); $total = intval($statement->fetchColumn());