aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/functions.inc.php25
-rw-r--r--include/functions_tag.inc.php8
2 files changed, 13 insertions, 20 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php
index be071e349..624e84934 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -564,19 +564,6 @@ function pwg_log($image_id = null, $image_type = null)
$tags_string = implode(',', $tag_ids);
}
- // here we ask the database the current date and time, and we extract
- // {year, month, day} from the current date. We could do this during the
- // insert query with a CURDATE(), CURTIME(), DATE_FORMAT(CURDATE(), '%Y')
- // ... but I (plg) think it would cost more than a double query and a PHP
- // extraction.
- $query = '
-SELECT CURDATE(), CURTIME()
-;';
- list($curdate, $curtime) = mysql_fetch_row(pwg_query($query));
-
- list($curyear, $curmonth, $curday) = explode('-', $curdate);
- list($curhour) = explode(':', $curtime);
-
$query = '
INSERT INTO '.HISTORY_TABLE.'
(
@@ -596,12 +583,12 @@ INSERT INTO '.HISTORY_TABLE.'
)
VALUES
(
- \''.$curdate.'\',
- \''.$curtime.'\',
- '.$curyear.',
- '.$curmonth.',
- '.$curday.',
- '.$curhour.',
+ CURDATE(),
+ CURTIME(),
+ YEAR( CURDATE() ),
+ MONTH( CURDATE() ),
+ DAYOFMONTH( CURDATE() ),
+ HOUR( CURTIME() ),
'.$user['id'].',
\''.$_SERVER['REMOTE_ADDR'].'\',
'.(isset($page['section']) ? "'".$page['section']."'" : 'NULL').',
diff --git a/include/functions_tag.inc.php b/include/functions_tag.inc.php
index fff7cdf90..7bd5d8408 100644
--- a/include/functions_tag.inc.php
+++ b/include/functions_tag.inc.php
@@ -49,7 +49,8 @@ SELECT tag_id, COUNT(DISTINCT(it.image_id)) counter
'
WHERE'
).'
- GROUP BY tag_id';
+ GROUP BY tag_id
+ ORDER BY NULL';
$tag_counters = simple_hash_from_query($query, 'tag_id', 'counter');
if ( empty($tag_counters) )
@@ -243,6 +244,11 @@ SELECT id, name, url_name, count(*) counter
ORDER BY counter DESC
LIMIT 0,'.$max_tags;
}
+ else
+ {
+ $query .= '
+ ORDER BY NULL';
+ }
$result = pwg_query($query);
$tags = array();