aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2012-10-09 19:47:22 +0000
committerrvelices <rv-github@modusoptimus.com>2012-10-09 19:47:22 +0000
commit1afee20ed24e9a9d171e9d90ffe0341a5dad7c89 (patch)
treeaec329a738f4397ba64167379f489cb990589bde /include
parent05671cf18cfa0eff7757930fda00bdc19f83dbc6 (diff)
some code simplification
git-svn-id: http://piwigo.org/svn/trunk@18579 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/functions_category.inc.php32
1 files changed, 6 insertions, 26 deletions
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index ec61b5c1a..d93c5be19 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -128,7 +128,7 @@ WHERE '.$where.'
{
$row['icon_ts'] = get_icon($row['max_date_last'], $child_date_last);
}
- array_push($cats, $row);
+ $cats[] = $row;
if ($row['id']==@$page['category']['id']) //save the number of subcats for later optim
$page['category']['count_categories'] = $row['count_categories'];
}
@@ -195,7 +195,6 @@ SELECT *
}
else
{
- $names = array();
$query = '
SELECT id, name, permalink
FROM '.CATEGORIES_TABLE.'
@@ -207,7 +206,7 @@ SELECT *
$cat['upper_names'] = array();
foreach ($upper_ids as $cat_id)
{
- array_push( $cat['upper_names'], $names[$cat_id]);
+ $cat['upper_names'][] = $names[$cat_id];
}
}
return $cat;
@@ -219,13 +218,13 @@ SELECT *
function get_category_preferred_image_orders()
{
global $conf, $page;
-
+
return trigger_event('get_category_preferred_image_orders', array(
array(l10n('Default'), '', true),
array(l10n('Photo title, A &rarr; Z'), 'name ASC', true),
array(l10n('Photo title, Z &rarr; A'), 'name DESC', true),
array(l10n('Date created, new &rarr; old'), 'date_creation DESC', true),
- array(l10n('Date created, old &rarr; new'), 'date_creation ASC', true),
+ array(l10n('Date created, old &rarr; new'), 'date_creation ASC', true),
array(l10n('Date posted, new &rarr; old'), 'date_available DESC', true),
array(l10n('Date posted, old &rarr; new'), 'date_available ASC', true),
array(l10n('Rating score, high &rarr; low'), 'rating_score DESC', $conf['rate']),
@@ -246,10 +245,6 @@ function display_select_categories($categories,
$tpl_cats = array();
foreach ($categories as $category)
{
- if (!empty($category['permalink']))
- {
- $category['name'] .= ' &radic;';
- }
if ($fullname)
{
$option = strip_tags(
@@ -283,15 +278,7 @@ function display_select_categories($categories,
function display_select_cat_wrapper($query, $selecteds, $blockname,
$fullname = true)
{
- $result = pwg_query($query);
- $categories = array();
- if (!empty($result))
- {
- while ($row = pwg_db_fetch_assoc($result))
- {
- array_push($categories, $row);
- }
- }
+ $categories = array_from_query($query);
usort($categories, 'global_rank_compare');
display_select_categories($categories, $selecteds, $blockname, $fullname);
}
@@ -324,14 +311,7 @@ SELECT DISTINCT(id)
}
$query.= '
;';
- $result = pwg_query($query);
-
- $subcats = array();
- while ($row = pwg_db_fetch_assoc($result))
- {
- array_push($subcats, $row['id']);
- }
- return $subcats;
+ return array_from_query($query, 'id');
}
/** finds a matching category id from a potential list of permalinks