aboutsummaryrefslogtreecommitdiffstats
path: root/include/section_init.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2008-07-05 22:13:28 +0000
committerrvelices <rv-github@modusoptimus.com>2008-07-05 22:13:28 +0000
commitf9927090e09be93a66c4705a760d94add583e84e (patch)
tree488c1591a565f66e9070e6ac9dd42b13167f2b93 /include/section_init.inc.php
parent154420540b059b028e0c9aca9e31cfca2edbeea6 (diff)
- feature 832: Folders with no images sql optimization
- recent pics are sorted by date descending, and only then by conf['order_by'] - updated prototype.js to version 1.6 git-svn-id: http://piwigo.org/svn/trunk@2424 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/section_init.inc.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/include/section_init.inc.php b/include/section_init.inc.php
index ffd6cac1a..305025ff3 100644
--- a/include/section_init.inc.php
+++ b/include/section_init.inc.php
@@ -235,9 +235,9 @@ if ('categories' == $page['section'])
if ( isset($page['category']) )
{ // get all allowed sub-categories
$query = '
-SELECT id
+SELECT id
FROM '.CATEGORIES_TABLE.'
- WHERE
+ WHERE
uppercats LIKE "'.$page['category']['uppercats'].',%" '
.get_sql_condition_FandF(
array
@@ -394,6 +394,15 @@ SELECT image_id
// +-----------------------------------------------------------------------+
else if ($page['section'] == 'recent_pics')
{
+ if ( !isset($page['super_order_by']) )
+ {
+ $conf['order_by'] = str_replace(
+ 'ORDER BY ',
+ 'ORDER BY date_available DESC,',
+ $conf['order_by']
+ );
+ }
+
$query = '
SELECT DISTINCT(id)
FROM '.IMAGES_TABLE.'
@@ -523,7 +532,7 @@ SELECT id,file
FROM '.IMAGES_TABLE .'
WHERE file LIKE "' . $page['image_file'] . '.%" ESCAPE "|"';
if ( count($page['items']) < 500)
- {// for very large item sets do not add IN - because slow
+ {// for very large item sets do not add IN - because slow
$query .= '
AND id IN ('.implode(',',$page['items']).')
LIMIT 0,1';
@@ -533,7 +542,7 @@ SELECT id,file
{
case 0: break;
case 1:
- list($page['image_id'], $page['image_file']) = mysql_fetch_row($result);
+ list($page['image_id'], $page['image_file']) = mysql_fetch_row($result);
break;
default: // more than 1 file name match
while ($row = mysql_fetch_row($result) )