aboutsummaryrefslogtreecommitdiffstats
path: root/admin/permalinks.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2007-10-03 23:38:37 +0000
committerrvelices <rv-github@modusoptimus.com>2007-10-03 23:38:37 +0000
commitd446a221cde74616db3715f665b0ee7210cb133c (patch)
treed78b4b3796286bbaeb8852ac07b9e5b96fee5c14 /admin/permalinks.php
parent530e3e6974f95be5a5cca823b33ec8f7562fbcf6 (diff)
merge rev 2119 from trunk
- bug 755: admin permalinks page - fix category field sort - web service functions: 1 fix and 3 optimizations git-svn-id: http://piwigo.org/svn/branches/branch-1_7@2120 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/permalinks.php')
-rw-r--r--admin/permalinks.php26
1 files changed, 15 insertions, 11 deletions
diff --git a/admin/permalinks.php b/admin/permalinks.php
index cbbbbc4e5..77becf76f 100644
--- a/admin/permalinks.php
+++ b/admin/permalinks.php
@@ -30,11 +30,11 @@ function parse_sort_variables(
$anchor = '' )
{
global $template;
-
+
$url_components = parse_url( $_SERVER['REQUEST_URI'] );
$base_url = $url_components['path'];
-
+
parse_str($url_components['query'], $vars);
$is_first = true;
foreach ($vars as $key => $value)
@@ -51,18 +51,24 @@ function parse_sort_variables(
foreach( $sortable_by as $field)
{
$url = $base_url;
+ $disp = '&dArr;'; // TODO: an small image is better
+
if ( $field !== @$_GET[$get_param] )
{
if ( !isset($default_field) or $default_field!=$field )
{ // the first should be the default
$url = add_url_params($url, array($get_param=>$field) );
}
- $disp = '&dArr;'; // TODO: an small image is better
+ elseif (isset($default_field) and !isset($_GET[$get_param]) )
+ {
+ array_push($ret, $field);
+ $disp = '<em>'.$disp.'</em>';
+ }
}
else
{
array_push($ret, $field);
- $disp = '<em>&dArr;</em>'; // TODO: an small image is better
+ $disp = '<em>'.$disp.'</em>';
}
if ( isset($template_var) )
{
@@ -103,10 +109,10 @@ DELETE FROM '.OLD_PERMALINKS_TABLE.'
$template->set_filename('permalinks', 'admin/permalinks.tpl' );
$query = '
-SELECT
- id,
+SELECT
+ id,
CONCAT(id, " - ", name, IF(permalink IS NULL, "", " &radic;") ) AS name,
- uppercats, global_rank
+ uppercats, global_rank
FROM '.CATEGORIES_TABLE;
display_select_cat_wrapper( $query, $selected_cat, 'categories', false );
@@ -124,9 +130,7 @@ SELECT id, permalink, uppercats, global_rank
FROM '.CATEGORIES_TABLE.'
WHERE permalink IS NOT NULL
';
-if ( count($sort_by) and
- ($sort_by[0]=='id' or $sort_by[0]=='permalink')
- )
+if ( $sort_by[0]=='id' or $sort_by[0]=='permalink' )
{
$query .= ' ORDER BY '.$sort_by[0];
}
@@ -138,7 +142,7 @@ while ( $row=mysql_fetch_assoc($result) )
$categories[] = $row;
}
-if ( !count($sort_by) or $sort_by[0]=='name')
+if ( $sort_by[0]=='name')
{
usort($categories, 'global_rank_compare');
}