Changeset 394 for trunk/admin/update.php


Ignore:
Timestamp:
Mar 26, 2004, 6:08:09 PM (20 years ago)
Author:
gweltas
Message:
  • Template migration
  • Admin Control Panel migration
  • Category management
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/update.php

    r393 r394  
    2828include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
    2929//------------------------------------------------------------------- functions
     30function ordering( $id_uppercat )
     31{
     32  $rank = 1;
     33               
     34  $query = 'SELECT id';
     35  $query.= ' FROM '.CATEGORIES_TABLE;
     36  if ( !is_numeric( $id_uppercat ) )
     37  {
     38    $query.= ' WHERE id_uppercat IS NULL';
     39  }
     40  else
     41  {
     42    $query.= ' WHERE id_uppercat = '.$id_uppercat;
     43  }
     44  $query.= ' ORDER BY rank ASC, dir ASC';
     45  $query.= ';';
     46  $result = mysql_query( $query );
     47  while ( $row = mysql_fetch_array( $result ) )
     48  {
     49    $query = 'UPDATE '.CATEGORIES_TABLE;
     50    $query.= ' SET rank = '.$rank;
     51    $query.= ' WHERE id = '.$row['id'];
     52    $query.= ';';
     53    mysql_query( $query );
     54    $rank++;
     55    ordering( $row['id'] );
     56  }
     57}
     58
    3059function insert_local_category( $id_uppercat )
    3160{
     
    678707  ));
    679708 
    680 $tpl = array('remote_site');
    681709//-------------------------------------------- introduction : choices of update
    682710// Display choice if "update" var is not specified
     
    733761  $start = get_moment();
    734762  update_category( 'all' );
     763  ordering('NULL');
    735764  $end = get_moment();
    736765  echo get_elapsed_time( $start, $end ).' for update_category( all )<br />';
Note: See TracChangeset for help on using the changeset viewer.