- Timestamp:
- Oct 18, 2013, 10:56:05 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.5/admin/include/functions.php
r21566 r24986 1140 1140 foreach ($categories as $cat_id => $category) 1141 1141 { 1142 switch ($category['status'])1142 if ('public' == $category['status']) 1143 1143 { 1144 case 'public' : 1145 { 1146 set_cat_status(array($cat_id), 'private'); 1147 break; 1148 } 1149 case 'private' : 1150 { 1151 $subcats = get_subcat_ids(array($cat_id)); 1152 1153 foreach ($tables as $table => $field) 1154 { 1155 $query = ' 1144 set_cat_status(array($cat_id), 'private'); 1145 } 1146 1147 $subcats = get_subcat_ids(array($cat_id)); 1148 1149 foreach ($tables as $table => $field) 1150 { 1151 $query = ' 1156 1152 SELECT '.$field.' 1157 1153 FROM '.$table.' 1158 1154 WHERE cat_id = '.$cat_id.' 1159 1155 ;'; 1160 1161 1162 1156 $category_access = array_from_query($query, $field); 1157 1158 $query = ' 1163 1159 SELECT '.$field.' 1164 1160 FROM '.$table.' 1165 1161 WHERE cat_id = '.$new_parent.' 1166 1162 ;'; 1167 1168 1169 $to_delete = array_diff($parent_access, $category_access);1170 1171 1172 1173 1163 $parent_access = array_from_query($query, $field); 1164 1165 $to_delete = array_diff($category_access, $parent_access); 1166 1167 if (count($to_delete) > 0) 1168 { 1169 $query = ' 1174 1170 DELETE FROM '.$table.' 1175 1171 WHERE '.$field.' IN ('.implode(',', $to_delete).') 1176 1172 AND cat_id IN ('.implode(',', $subcats).') 1177 1173 ;'; 1178 pwg_query($query); 1179 } 1180 } 1181 break; 1174 pwg_query($query); 1182 1175 } 1183 1176 }
Note: See TracChangeset
for help on using the changeset viewer.