Changeset 659 for trunk/admin/cat_list.php
- Timestamp:
- Dec 27, 2004, 3:30:49 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/cat_list.php
r647 r659 44 44 if (isset($_GET['delete']) and is_numeric($_GET['delete'])) 45 45 { 46 $to_delete_categories = array(); 47 array_push($to_delete_categories,$_GET['delete']); 48 delete_categories($to_delete_categories); 46 delete_categories(array($_GET['delete'])); 49 47 array_push($infos, $lang['cat_virtual_deleted']); 48 ordering(); 49 update_global_rank(); 50 50 } 51 51 // request to add a virtual category … … 77 77 } 78 78 79 // what will be the inserted id ? 80 $query = ' 81 SELECT MAX(id)+1 82 FROM '.CATEGORIES_TABLE.' 83 ;'; 84 list($next_id) = mysql_fetch_array(pwg_query($query)); 85 79 86 $insert = array(); 87 $insert{'id'} = $next_id++; 80 88 $insert{'name'} = $_POST['virtual_name']; 81 89 $insert{'rank'} = $_POST['rank']; 82 90 $insert{'commentable'} = $conf['newcat_default_commentable']; 83 $insert{'uploadable'} = $conf['newcat_default_uploadable']; 91 92 // a virtual category can't be uploadable 93 $insert{'uploadable'} = 'false'; 84 94 85 95 if (isset($parent)) 86 96 { 87 97 $insert{'id_uppercat'} = $parent{'id'}; 98 $insert{'uppercats'} = $parent{'uppercats'}.','.$insert{'id'}; 99 $insert{'global_rank'} = $parent{'global_rank'}.'.'.$insert{'rank'}; 88 100 // at creation, must a category be visible or not ? Warning : if 89 101 // the parent category is invisible, the category is automatically … … 113 125 $insert{'visible'} = $conf['newcat_default_visible']; 114 126 $insert{'status'} = $conf['newcat_default_status']; 127 $insert{'uppercats'} = $insert{'id'}; 128 $insert{'global_rank'} = $insert{'rank'}; 115 129 } 116 130 … … 118 132 119 133 // we have then to add the virtual category 120 $dbfields = array('site_id','name','id_uppercat','rank','commentable', 121 'uploadable','visible','status'); 134 $dbfields = array('id','site_id','name','id_uppercat','rank', 135 'commentable','uploadable','visible','status', 136 'uppercats','global_rank'); 122 137 mass_inserts(CATEGORIES_TABLE, $dbfields, $inserts); 123 124 // And last we update the uppercats 125 $query = ' 126 SELECT MAX(id) 127 FROM '.CATEGORIES_TABLE.' 128 ;'; 129 $my_id = array_pop(mysql_fetch_array(pwg_query($query))); 130 131 $query = ' 132 UPDATE '.CATEGORIES_TABLE; 133 if (isset($parent)) 134 { 135 $query.= " 136 SET uppercats = CONCAT('".$parent['uppercats']."',',',id) 137 , global_rank = CONCAT('".$parent['global_rank']."','.',rank)"; 138 } 139 else 140 { 141 $query.= ' 142 SET uppercats = id 143 , global_rank = id'; 144 } 145 $query.= ' 146 WHERE id = '.$my_id.' 147 ;'; 148 pwg_query($query); 138 149 139 array_push($infos, $lang['cat_virtual_added']); 150 140 }
Note: See TracChangeset
for help on using the changeset viewer.