Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/YOURLS/YOURLS.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgmo <gmolop@users.noreply.github.com>2016-03-04 14:53:56 +0300
committergmo <gmolop@users.noreply.github.com>2016-03-04 14:53:56 +0300
commit7ae2d6db775ca2294568c4fdfd5e9886f20180db (patch)
treebc84445b97717a17b248f83eef755acf53db3333 /yourls-infos.php
parent04fb92e1321e757e85e0951e4f754822d6379a40 (diff)
Time zone offset in Stats Graph
Stats page graph updated to use time zone offset defined in config file (YOURLS_HOURS_OFFSET).
Diffstat (limited to 'yourls-infos.php')
-rw-r--r--yourls-infos.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/yourls-infos.php b/yourls-infos.php
index 81d26285..ab729d24 100644
--- a/yourls-infos.php
+++ b/yourls-infos.php
@@ -148,10 +148,10 @@ if( yourls_do_log_redirect() ) {
// *** Last 24 hours : array of $last_24h[ $hour ] = number of click ***
$query = "SELECT
- DATE_FORMAT(`click_time`, '%H %p') AS `time`,
+ DATE_FORMAT(DATE_ADD(`click_time`, INTERVAL " . YOURLS_HOURS_OFFSET . " HOUR), '%H %p') AS `time`,
COUNT(*) AS `count`
FROM `$table`
- WHERE `shorturl` $keyword_range AND `click_time` > (CURRENT_TIMESTAMP - INTERVAL 1 DAY)
+ WHERE `shorturl` $keyword_range AND DATE_ADD(`click_time`, INTERVAL " . YOURLS_HOURS_OFFSET . " HOUR) > (CURRENT_TIMESTAMP - INTERVAL 1 DAY)
GROUP BY `time`;";
$rows = $ydb->get_results( yourls_apply_filter( 'stat_query_last24h', $query ) );
@@ -163,7 +163,7 @@ if( yourls_do_log_redirect() ) {
$now = intval( date('U') );
for ($i = 23; $i >= 0; $i--) {
- $h = date('H A', $now - ($i * 60 * 60) );
+ $h = date('H A', ($now - ($i * 60 * 60) + (YOURLS_HOURS_OFFSET * 60 * 60)) );
// If the $last_24h doesn't have all the hours, insert missing hours with value 0
$last_24h[ $h ] = array_key_exists( $h, $_last_24h ) ? $_last_24h[ $h ] : 0 ;
}