Changeset 12917 for trunk/admin/include/functions.php
- Timestamp:
- Jan 17, 2012, 10:02:16 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/functions.php
r12906 r12917 3 3 // | Piwigo - a PHP based photo gallery | 4 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 2008-201 1Piwigo Team http://piwigo.org |5 // | Copyright(C) 2008-2012 Piwigo Team http://piwigo.org | 6 6 // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | 7 7 // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | … … 176 176 } 177 177 178 include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');179 180 178 $new_ids = array(); 181 179 … … 184 182 id, 185 183 path, 186 tn_ext,187 has_high,188 184 representative_ext 189 185 FROM '.IMAGES_TABLE.' … … 197 193 continue; 198 194 } 199 195 200 196 $files = array(); 201 197 $files[] = get_element_path($row); … … 216 212 } 217 213 } 218 214 219 215 if ($ok) 220 216 { 217 delete_element_derivatives($row); 221 218 $new_ids[] += $row['id']; 222 219 } … … 389 386 { 390 387 $orphan_tags = get_orphan_tags(); 391 388 392 389 if (count($orphan_tags) > 0) 393 390 { … … 413 410 { 414 411 $orphan_tags = array(); 415 412 416 413 $query = ' 417 414 SELECT … … 1390 1387 return false; 1391 1388 } 1392 1389 1393 1390 $query = ' 1394 1391 DELETE … … 1397 1394 ;'; 1398 1395 pwg_query($query); 1399 1396 1400 1397 $query = ' 1401 1398 DELETE … … 2039 2036 { 2040 2037 $result = pwg_query($query); 2041 2038 2042 2039 $taglist = array(); 2043 2040 while ($row = pwg_db_fetch_assoc($result)) … … 2058 2055 $row['name'] = preg_replace('#\[lang=(.*?)\](.*?)\[/lang\]#is', null, $row['name']); 2059 2056 } 2060 2057 2061 2058 if (strlen($row['name']) > 0) 2062 2059 { … … 2070 2067 } 2071 2068 } 2072 2069 2073 2070 $cmp = create_function('$a,$b', 'return strcasecmp($a["name"], $b["name"]);'); 2074 2071 usort($taglist, $cmp); … … 2137 2134 return; 2138 2135 } 2139 2136 2140 2137 // make sure categories are private and select uppercats or subcats 2141 2138 $cat_ids = (isset($_POST['apply_on_sub'])) ? implode(',', get_subcat_ids($category_ids)).",".implode(',', get_uppercat_ids($category_ids)) : implode(',', get_uppercat_ids($category_ids)); … … 2153 2150 return; 2154 2151 } 2155 2152 2156 2153 // We must not reinsert already existing lines in user_access table 2157 2154 $granteds = array(); … … 2160 2157 $granteds[$cat_id] = array(); 2161 2158 } 2162 2159 2163 2160 $query = ' 2164 2161 SELECT … … 2176 2173 2177 2174 $inserts = array(); 2178 2175 2179 2176 foreach ($private_cats as $cat_id) 2180 2177 { 2181 2178 $grant_to_users = array_diff($user_ids, $granteds[$cat_id]); 2182 2179 2183 2180 foreach ($grant_to_users as $user_id) 2184 2181 { … … 2208 2205 $status_list[] = 'webmaster'; 2209 2206 } 2210 2207 2211 2208 $query = ' 2212 2209 SELECT … … 2246 2243 $pattern .= derivative_to_url($types[0]); 2247 2244 } 2248 2245 2249 2246 $pattern.='(_[a-zA-Z0-9]+)*\.[a-zA-Z0-9]{3,4}$#'; 2250 2247 if ($contents = opendir(PHPWG_ROOT_PATH.PWG_DERIVATIVE_DIR)) … … 2295 2292 } 2296 2293 closedir($contents); 2297 2294 2298 2295 if ($rmdir) 2299 2296 { … … 2309 2306 } 2310 2307 2311 function delete_element_derivatives($ids) 2312 { 2313 // todo 2314 if (!is_array($ids)) 2315 { 2316 $ids = array($ids); 2317 } 2318 2319 // for now I do a massive clear, to be removed once the function is 2320 // properly implemented 2321 clear_derivative_cache(); 2308 function delete_element_derivatives($infos) 2309 { 2310 $path = $infos['path']; 2311 if (!empty($infos['representative_ext'])) 2312 { 2313 $path = original_to_representative( $path, $infos['representative_ext']); 2314 } 2315 if (substr_compare($path, '../', 0, 3)==0) 2316 { 2317 $path = substr($path, 3); 2318 } 2319 $dot = strpos($path, '.'); 2320 $path = substr_replace($path, '-*', $dot, 0); 2321 foreach( glob(PHPWG_ROOT_PATH.PWG_DERIVATIVE_DIR.$path) as $file) 2322 { 2323 @unlink($file); 2324 } 2322 2325 } 2323 2326 ?>
Note: See TracChangeset
for help on using the changeset viewer.