Changeset 17302 for trunk/admin
- Timestamp:
- Aug 1, 2012, 9:03:17 PM (12 years ago)
- Location:
- trunk/admin
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/configuration.php
r16928 r17302 107 107 'privacy_level', 108 108 ); 109 109 110 110 // image order management 111 111 $sort_fields = array( … … 127 127 'rank ASC' => l10n('Manual sort order'), 128 128 ); 129 129 130 130 $comments_order = array( 131 131 'ASC' => l10n('Show oldest comments first'), … … 142 142 { 143 143 case 'main' : 144 { 144 { 145 145 if ( !isset($conf['order_by_custom']) and !isset($conf['order_by_inside_category_custom']) ) 146 146 { … … 159 159 // limit to the number of available parameters 160 160 $order_by = $order_by_inside_category = array_slice($_POST['order_by'], 0, ceil(count($sort_fields)/2)); 161 161 162 162 // there is no rank outside categories 163 163 if ( ($i = array_search('rank ASC', $order_by)) !== false) … … 165 165 unset($order_by[$i]); 166 166 } 167 167 168 168 // must define a default order_by if user want to order by rank only 169 169 if ( count($order_by) == 0 ) … … 171 171 $order_by = array('id ASC'); 172 172 } 173 173 174 174 $_POST['order_by'] = 'ORDER BY '.implode(', ', $order_by); 175 175 $_POST['order_by_inside_category'] = 'ORDER BY '.implode(', ', $order_by_inside_category); … … 181 181 } 182 182 } 183 183 184 184 foreach( $main_checkboxes as $checkbox) 185 185 { … … 190 190 case 'watermark' : 191 191 { 192 include(PHPWG_ROOT_PATH.'admin/include/configuration_watermark_process.inc.php'); 192 include(PHPWG_ROOT_PATH.'admin/include/configuration_watermark_process.inc.php'); 193 193 break; 194 194 } 195 195 case 'sizes' : 196 196 { 197 include(PHPWG_ROOT_PATH.'admin/include/configuration_sizes_process.inc.php'); 197 include(PHPWG_ROOT_PATH.'admin/include/configuration_sizes_process.inc.php'); 198 198 break; 199 199 } … … 303 303 { 304 304 case 'main' : 305 { 306 305 { 306 307 307 function order_by_is_local() 308 308 { … … 312 312 @include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR. 'config/config.inc.php'); 313 313 } 314 314 315 315 return isset($conf['order_by']) or isset($conf['order_by_inside_category']); 316 316 } 317 317 318 318 if (order_by_is_local()) 319 319 { 320 320 array_push($page['warnings'], l10n('You have specified <i>$conf[\'order_by\']</i> in your local configuration file, this parameter in deprecated, please remove it or rename it into <i>$conf[\'order_by_custom\']</i> !')); 321 321 } 322 322 323 323 if ( isset($conf['order_by_custom']) or isset($conf['order_by_inside_category_custom']) ) 324 324 { … … 333 333 $order_by = explode(', ', $order_by); 334 334 } 335 335 336 336 $template->assign( 337 337 'main', … … 441 441 ) 442 442 ); 443 443 444 444 foreach ($sizes_checkboxes as $checkbox) 445 445 { … … 452 452 ); 453 453 } 454 454 455 455 // derivatives = multiple size 456 456 $enabled = ImageStdParams::get_defined_type_map(); … … 465 465 { 466 466 $tpl_var = array(); 467 467 468 468 $tpl_var['must_square'] = ($type==IMG_SQUARE ? true : false); 469 469 $tpl_var['must_enable'] = ($type==IMG_SQUARE || $type==IMG_THUMB)? true : false; 470 470 471 471 if ($params = @$enabled[$type]) 472 472 { … … 478 478 $params=@$disabled[$type]; 479 479 } 480 480 481 481 if ($params) 482 482 { … … 496 496 $template->assign('derivatives', $tpl_vars); 497 497 $template->assign('resize_quality', ImageStdParams::$quality); 498 499 $tpl_vars = array(); 500 $now = time(); 501 foreach(ImageStdParams::$custom as $custom=>$time) 502 { 503 $tpl_vars[$custom] = ($now-$time<=24*3600) ? l10n('today') : time_since($time, 'day'); 504 } 505 $template->assign('custom_derivatives', $tpl_vars); 498 506 } 499 507 … … 547 555 $position = 'bottomright'; 548 556 } 549 557 550 558 if ($wm->xrepeat != 0) 551 559 { 552 560 $position = 'custom'; 553 561 } 554 562 555 563 $template->assign( 556 564 'watermark', … … 567 575 ); 568 576 } 569 577 570 578 break; 571 579 } -
trunk/admin/include/configuration_sizes_process.inc.php
r14649 r17302 229 229 } 230 230 231 foreach( array_keys(ImageStdParams::$custom) as $custom) 232 { 233 if (isset($_POST['delete_custom_derivative_'.$custom])) 234 { 235 $changed_types[] = $custom; 236 unset(ImageStdParams::$custom[$custom]); 237 } 238 } 239 231 240 ImageStdParams::set_and_save($enabled_by); 232 241 if (count($disabled) == 0) -
trunk/admin/include/configuration_watermark_process.inc.php
r14584 r17302 49 49 50 50 $new_name = get_filename_wo_extension($_FILES['watermarkImage']['name']).'.png'; 51 $file_path = $upload_dir.'/'.$new_name; 52 51 $file_path = $upload_dir.'/'.$new_name; 52 53 53 move_uploaded_file($_FILES['watermarkImage']['tmp_name'], $file_path); 54 54 55 55 $pwatermark['file'] = substr($file_path, strlen(PHPWG_ROOT_PATH)); 56 56 } … … 135 135 // do we have to regenerate the derivatives (and which types)? 136 136 $changed_types = array(); 137 137 138 138 foreach (ImageStdParams::get_defined_type_map() as $type => $params) 139 139 { … … 141 141 ImageStdParams::apply_global($params); 142 142 143 if ($params->use_watermark != $old_use_watermark 144 or $params->use_watermark and $watermark_changed) 143 $changed = $params->use_watermark != $old_use_watermark; 144 if (!$changed and $params->use_watermark) 145 { 146 $changed = $watermark_changed; 147 } 148 if (!$changed and $params->use_watermark) 149 { 150 // if thresholds change and before/after the threshold is lower than the corresponding derivative side -> some derivatives might switch the watermark 151 $changed |= $watermark->min_size[0]!=$old_watermark->min_size[0] and ($watermark->min_size[0]<$params->max_width() or $old_watermark->min_size[0]<$params->max_width()); 152 $changed |= $watermark->min_size[1]!=$old_watermark->min_size[1] and ($watermark->min_size[1]<$params->max_height() or $old_watermark->min_size[1]<$params->max_height()); 153 } 154 155 if ($changed) 145 156 { 146 157 $params->last_mod_time = time(); -
trunk/admin/include/functions.php
r17210 r17302 1570 1570 return false; 1571 1571 } 1572 1572 1573 1573 // let's first break links with all albums but their "storage album" 1574 1574 $query = ' … … 1580 1580 ;'; 1581 1581 pwg_query($query); 1582 1582 1583 1583 if (is_array($categories) and count($categories) > 0) 1584 1584 { … … 2277 2277 function clear_derivative_cache($types='all') 2278 2278 { 2279 $pattern='#.*-'; 2280 if ($types == 'all') 2279 if ($types === 'all') 2281 2280 { 2282 2281 $types = ImageStdParams::get_all_types(); … … 2288 2287 } 2289 2288 2289 for ($i=0; $i<count($types); $i++) 2290 { 2291 $type = $types[$i]; 2292 if ($type == IMG_CUSTOM) 2293 { 2294 $type = derivative_to_url($type).'[a-zA-Z0-9]+'; 2295 } 2296 elseif (in_array($type, ImageStdParams::get_all_types())) 2297 { 2298 $type = derivative_to_url($type); 2299 } 2300 else 2301 {//assume a custom type 2302 $type = derivative_to_url(IMG_CUSTOM).'_'.$type; 2303 } 2304 $types[$i] = $type; 2305 } 2306 2307 $pattern='#.*-'; 2290 2308 if (count($types)>1) 2291 2309 { 2292 $type_urls = array(); 2293 foreach($types as $dtype) 2294 { 2295 $type_urls[] = derivative_to_url($dtype); 2296 } 2297 $pattern .= '(' . implode('|',$type_urls) . ')'; 2310 $pattern .= '(' . implode('|',$types) . ')'; 2298 2311 } 2299 2312 else 2300 2313 { 2301 $pattern .= derivative_to_url($types[0]);2302 } 2303 2304 $pattern.='(_[a-zA-Z0-9]+)*\.[a-zA-Z0-9]{3,4}$#'; 2314 $pattern .= $types[0]; 2315 } 2316 $pattern.='\.[a-zA-Z0-9]{3,4}$#'; 2317 2305 2318 if ($contents = @opendir(PHPWG_ROOT_PATH.PWG_DERIVATIVE_DIR)) 2306 2319 { -
trunk/admin/themes/default/template/configuration.tpl
r15551 r17302 455 455 <a href="{$F_ACTION}&action=restore_settings" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');">{'Reset to default values'|@translate}</a> 456 456 </p> 457 458 {if !empty($custom_derivatives)} 459 <fieldset class="sizeDetails"><legend>{'custom'|@translate}</legend><table style="margin:0"> 460 {foreach from=$custom_derivatives item=time key=custom} 461 <tr><td><label><input type="checkbox" name="delete_custom_derivative_{$custom}"> {'Delete'|@translate} {$custom} ({'Last hit'|@translate}: {$time})</label></td></tr> 462 {/foreach} 463 </table></fieldset> 464 {/if} 465 457 466 </fieldset> 458 467 {/if}
Note: See TracChangeset
for help on using the changeset viewer.