Changeset 1121 for trunk/admin/picture_modify.php
- Timestamp:
- Apr 5, 2006, 12:29:35 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/picture_modify.php
r1119 r1121 122 122 and count($_POST['cat_dissociated']) > 0) 123 123 { 124 $datas = array(); 125 126 foreach ($_POST['cat_dissociated'] as $category_id) 127 { 128 array_push( 129 $datas, 130 array( 131 'image_id' => $_GET['image_id'], 132 'category_id' => $category_id 133 ) 134 ); 135 } 136 137 mass_inserts( 138 IMAGE_CATEGORY_TABLE, 139 array('image_id', 'category_id'), 140 $datas 124 associate_images_to_categories( 125 array($_GET['image_id']), 126 $_POST['cat_dissociated'] 141 127 ); 142 143 check_links();144 update_category($_POST['cat_dissociated']);145 128 } 146 129 // dissociate the element from categories (but not from its storage category) … … 149 132 and count($_POST['cat_associated']) > 0) 150 133 { 151 $associated_categories = $_POST['cat_associated'];152 153 // If the same element is associated to a source and its destinations,154 // dissociating the element with the source implies dissociating the155 // element fwith the destination.156 $destinations_of = get_destinations($_POST['cat_associated']);157 foreach ($destinations_of as $source => $destinations)158 {159 $associated_categories = array_merge(160 $associated_categories,161 $destinations162 );163 }164 165 134 $query = ' 166 135 DELETE FROM '.IMAGE_CATEGORY_TABLE.' 167 136 WHERE image_id = '.$_GET['image_id'].' 168 AND category_id IN ('.implode(',', $associated_categories).') 169 AND is_storage = \'false\' 137 AND category_id IN ('.implode(',', $_POST['cat_associated']).') 170 138 '; 171 139 pwg_query($query); 172 173 check_links(); 140 174 141 update_category($_POST['cat_associated']); 175 142 } … … 202 169 SELECT * 203 170 FROM '.IMAGES_TABLE.' 204 INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON image_id = id205 171 WHERE id = '.$_GET['image_id'].' 206 AND is_storage = \'true\'207 172 ;'; 208 173 $row = mysql_fetch_array(pwg_query($query)); 209 174 210 $storage_category_id = $row[' category_id'];175 $storage_category_id = $row['storage_category_id']; 211 176 $image_file = $row['file']; 212 177 … … 397 362 INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = category_id 398 363 WHERE image_id = '.$_GET['image_id'].' 399 AND i s_storage = \'false\'364 AND id != '.$storage_category_id.' 400 365 ;'; 401 366 display_select_cat_wrapper($query, array(), 'associated_option');
Note: See TracChangeset
for help on using the changeset viewer.