aboutsummaryrefslogtreecommitdiffstats
path: root/include/section_init.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2014-02-11 21:47:44 +0000
committerrvelices <rv-github@modusoptimus.com>2014-02-11 21:47:44 +0000
commit2d9887993cc2c5dbbc22106c07906220bf33836f (patch)
treec9b07b57c5ab93d8be9356105e317c051267e8c4 /include/section_init.inc.php
parent78621a34878093fe2fed7bcf76ac61aca9acb249 (diff)
arrayfromquery optimizations: move double if from inside loop to outside + use directly mysqli calls to avoid function call overhead for every row retrieved from db
git-svn-id: http://piwigo.org/svn/trunk@27336 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/section_init.inc.php')
-rw-r--r--include/section_init.inc.php26
1 files changed, 13 insertions, 13 deletions
diff --git a/include/section_init.inc.php b/include/section_init.inc.php
index 61d8bf5e3..1e35ab587 100644
--- a/include/section_init.inc.php
+++ b/include/section_init.inc.php
@@ -92,7 +92,7 @@ if (script_basename() == 'picture')
{
// url compatibility with versions below 1.6
if ( isset($_GET['image_id'])
- and isset($_GET['cat'])
+ and isset($_GET['cat'])
and is_numeric($_GET['cat']) )
{
$url = make_picture_url( array(
@@ -102,7 +102,7 @@ if (script_basename() == 'picture')
) );
redirect($url);
}
-
+
$token = $tokens[$next_token];
$next_token++;
if ( is_numeric($token) )
@@ -242,7 +242,7 @@ if ('categories' == $page['section'])
if (isset($page['category']))
{
$page = array_merge(
- $page,
+ $page,
array(
'comment' => trigger_event(
'render_category_description',
@@ -292,8 +292,8 @@ SELECT id
),
"\n AND"
);
-
- $subcat_ids = array_from_query($query, 'id');
+
+ $subcat_ids = query2array($query,null, 'id');
$subcat_ids[] = $page['category']['id'];
$where_sql = 'category_id IN ('.implode(',',$subcat_ids).')';
// remove categories from forbidden because just checked above
@@ -325,7 +325,7 @@ SELECT DISTINCT(image_id)
'.$conf['order_by'].'
;';
- $page['items'] = array_from_query($query, 'image_id');
+ $page['items'] = query2array($query,null, 'image_id');
}
}
// special sections
@@ -416,7 +416,7 @@ SELECT image_id
$page = array_merge(
$page,
array(
- 'items' => array_from_query($query, 'image_id'),
+ 'items' => query2array($query,null, 'image_id'),
)
);
@@ -463,7 +463,7 @@ SELECT DISTINCT(id)
array(
'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
.l10n('Recent photos').'</a>',
- 'items' => array_from_query($query, 'id'),
+ 'items' => query2array($query,null, 'id'),
)
);
}
@@ -486,7 +486,7 @@ SELECT DISTINCT(id)
{
$page['super_order_by'] = true;
$conf['order_by'] = ' ORDER BY hit DESC, id DESC';
-
+
$query = '
SELECT DISTINCT(id)
FROM '.IMAGES_TABLE.'
@@ -502,7 +502,7 @@ SELECT DISTINCT(id)
array(
'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
.$conf['top_number'].' '.l10n('Most visited').'</a>',
- 'items' => array_from_query($query, 'id'),
+ 'items' => query2array($query,null, 'id'),
)
);
}
@@ -528,7 +528,7 @@ SELECT DISTINCT(id)
array(
'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
.$conf['top_number'].' '.l10n('Best rated').'</a>',
- 'items' => array_from_query($query, 'id'),
+ 'items' => query2array($query,null, 'id'),
)
);
}
@@ -551,7 +551,7 @@ SELECT DISTINCT(id)
array(
'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
.l10n('Random photos').'</a>',
- 'items' => array_from_query($query, 'id'),
+ 'items' => query2array($query,null, 'id'),
)
);
}
@@ -632,7 +632,7 @@ if ( 'categories'==$page['section'] and isset($page['category']) )
if ($need_redirect)
{
$redirect_url = script_basename()=='picture' ? duplicate_picture_url() : duplicate_index_url();
-
+
if (!headers_sent())
{ // this is a permanent redirection
set_status_header(301);