Changeset 2304
- Timestamp:
- Apr 19, 2008, 5:00:11 AM (16 years ago)
- Location:
- trunk/admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/functions.php
r2299 r2304 60 60 function delete_categories($ids) 61 61 { 62 global $counts;63 64 62 if (count($ids) == 0) 65 63 { … … 122 120 pwg_query($query); 123 121 124 if (isset($counts['del_categories']))125 {126 $counts['del_categories']+= count($ids);127 }128 122 trigger_action('delete_categories', $ids); 129 123 } … … 136 130 function delete_elements($ids) 137 131 { 138 global $counts;139 140 132 if (count($ids) == 0) 141 133 { … … 199 191 pwg_query($query); 200 192 201 if (isset($counts['del_elements']))202 {203 $counts['del_elements']+= count($ids);204 }205 193 trigger_action('delete_elements', $ids); 206 194 } … … 437 425 } 438 426 439 function date_convert_back( $date )440 {441 // date arrives at this format : YYYY-MM-DD442 // It must be transformed in DD/MM/YYYY443 if ( $date != '' )444 {445 list($year,$month,$day) = explode( '-', $date );446 return $day.'/'.$month.'/'.$year;447 }448 else449 {450 return '';451 }452 }453 454 427 /** 455 428 * returns an array containing sub-directories which can be a category, … … 576 549 // depending on the MySQL version, we use the multi table update or N 577 550 // update queries 578 $query = 'SELECT VERSION() AS version;'; 579 list($mysql_version) = mysql_fetch_array(pwg_query($query)); 580 if (count($datas) < 10 or version_compare($mysql_version, '4.0.4') < 0) 551 if (count($datas) < 10 or version_compare(mysql_get_server_info(), '4.0.4') < 0) 581 552 { 582 553 // MySQL is prior to version 4.0.4, multi table update feature is not … … 1185 1156 function update_uppercats() 1186 1157 { 1187 $uppercat_ids = array(); 1188 1189 $query = ' 1190 SELECT id, id_uppercat 1158 $query = ' 1159 SELECT id, id_uppercat, uppercats 1191 1160 FROM '.CATEGORIES_TABLE.' 1192 1161 ;'; 1193 $result = pwg_query($query); 1194 while ($row = mysql_fetch_array($result)) 1195 { 1196 $uppercat_ids[$row['id']] = 1197 !empty($row['id_uppercat']) ? $row['id_uppercat'] : 'NULL'; 1198 } 1199 1200 // uppercats array associates a category id to the list of uppercats id. 1201 $uppercats = array(); 1202 1203 foreach (array_keys($uppercat_ids) as $id) 1204 { 1205 $uppercats[$id] = array(); 1162 $cat_map = hash_from_query($query, 'id'); 1163 1164 $datas = array(); 1165 foreach ($cat_map as $id => $cat) 1166 { 1167 $upper_list = array(); 1206 1168 1207 1169 $uppercat = $id; 1208 1209 while ($uppercat != 'NULL') 1210 { 1211 array_push($uppercats[$id], $uppercat); 1212 $uppercat = $uppercat_ids[$uppercat]; 1213 } 1214 } 1215 1216 $datas = array(); 1217 1218 foreach ($uppercats as $id => $list) 1219 { 1220 array_push( 1221 $datas, 1222 array( 1223 'id' => $id, 1224 'uppercats' => implode(',', array_reverse($list)) 1225 ) 1226 ); 1227 } 1228 1170 while ($uppercat) 1171 { 1172 array_push($upper_list, $uppercat); 1173 $uppercat = $cat_map[$uppercat]['id_uppercat']; 1174 } 1175 1176 $new_uppercats = implode(',', array_reverse($upper_list)); 1177 if ($new_uppercats != $cat['uppercats']) 1178 { 1179 array_push( 1180 $datas, 1181 array( 1182 'id' => $id, 1183 'uppercats' => $new_uppercats 1184 ) 1185 ); 1186 } 1187 } 1229 1188 $fields = array('primary' => array('id'), 'update' => array('uppercats')); 1230 1189 mass_updates(CATEGORIES_TABLE, $fields, $datas); -
trunk/admin/picture_modify.php
r2299 r2304 189 189 $selected_tags = array_from_query($query, 'tag_id'); 190 190 191 // Navigation path192 193 $date = isset($_POST['date_creation']) && empty($page['errors'])194 ?$_POST['date_creation']:date_convert_back(@$row['date_creation']);195 196 191 // +-----------------------------------------------------------------------+ 197 192 // | template init | … … 225 220 array( 226 221 'U_SYNC' => 227 PHPWG_ROOT_PATH.'admin.php?page=picture_modify'.222 get_root_url().'admin.php?page=picture_modify'. 228 223 '&image_id='.$_GET['image_id']. 229 224 (isset($_GET['cat_id']) ? '&cat_id='.$_GET['cat_id'] : ''). … … 247 242 'AUTHOR' => isset($_POST['author']) ? $_POST['author'] : @$row['author'], 248 243 249 'CREATION_DATE' => $date,250 251 244 'TAG_SELECTION' => $tag_selection, 252 245 … … 256 249 257 250 'F_ACTION' => 258 PHPWG_ROOT_PATH.'admin.php'251 get_root_url().'admin.php' 259 252 .get_query_string_diff(array('sync_metadata')) 260 253 )
Note: See TracChangeset
for help on using the changeset viewer.