aboutsummaryrefslogtreecommitdiffstats
path: root/admin/update.php
diff options
context:
space:
mode:
authorgweltas <gweltas@piwigo.org>2004-03-26 17:08:09 +0000
committergweltas <gweltas@piwigo.org>2004-03-26 17:08:09 +0000
commit9fd459d0510534ab6f92b7f4e9a3a4598ff3c1ab (patch)
tree95e08d38d2604c350c1b200e0cb2c20cc53bbfc8 /admin/update.php
parent4128835db8d7b8e619951d4c31e23bd934758f09 (diff)
- Template migration
- Admin Control Panel migration - Category management git-svn-id: http://piwigo.org/svn/trunk@394 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/update.php31
1 files changed, 30 insertions, 1 deletions
diff --git a/admin/update.php b/admin/update.php
index 1803d5468..db8790bdf 100644
--- a/admin/update.php
+++ b/admin/update.php
@@ -27,6 +27,35 @@
include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
//------------------------------------------------------------------- functions
+function ordering( $id_uppercat )
+{
+ $rank = 1;
+
+ $query = 'SELECT id';
+ $query.= ' FROM '.CATEGORIES_TABLE;
+ if ( !is_numeric( $id_uppercat ) )
+ {
+ $query.= ' WHERE id_uppercat IS NULL';
+ }
+ else
+ {
+ $query.= ' WHERE id_uppercat = '.$id_uppercat;
+ }
+ $query.= ' ORDER BY rank ASC, dir ASC';
+ $query.= ';';
+ $result = mysql_query( $query );
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ $query = 'UPDATE '.CATEGORIES_TABLE;
+ $query.= ' SET rank = '.$rank;
+ $query.= ' WHERE id = '.$row['id'];
+ $query.= ';';
+ mysql_query( $query );
+ $rank++;
+ ordering( $row['id'] );
+ }
+}
+
function insert_local_category( $id_uppercat )
{
global $conf, $page, $user, $lang;
@@ -677,7 +706,6 @@ $template->assign_vars(array(
'U_ALL_UPDATE'=>add_session_id( PHPWG_ROOT_PATH.'admin.php?page=update&amp;update=all' )
));
-$tpl = array('remote_site');
//-------------------------------------------- introduction : choices of update
// Display choice if "update" var is not specified
if (!isset( $_GET['update'] ))
@@ -732,6 +760,7 @@ if ( isset( $_GET['update'] )
{
$start = get_moment();
update_category( 'all' );
+ ordering('NULL');
$end = get_moment();
echo get_elapsed_time( $start, $end ).' for update_category( all )<br />';