| | 406 | if ('regenerateThumbnails' == $action) |
| | 407 | { |
| | 408 | if ($_POST['regenerateSuccess'] != '0') |
| | 409 | array_push($page['infos'], sprintf(l10n('%s thumbnails have been regenerated'), $_POST['regenerateSuccess'])); |
| | 410 | |
| | 411 | if ($_POST['regenerateError'] != '0') |
| | 412 | array_push($page['warnings'], sprintf(l10n('%s thumbnails have been regenerated'), $_POST['regenerateError'])); |
| | 413 | |
| | 414 | // Update configuration |
| | 415 | $fields = array('thumb_maxwidth', 'thumb_maxheight', 'thumb_quality'); |
| | 416 | $updates = array(); |
| | 417 | foreach ($fields as $field) |
| | 418 | { |
| | 419 | $value = null; |
| | 420 | if (!empty($_POST[$field])) |
| | 421 | { |
| | 422 | $value = $_POST[$field]; |
| | 423 | } |
| | 424 | |
| | 425 | if (preg_match($upload_form_config[$field]['pattern'], $value) |
| | 426 | and $value >= $upload_form_config[$field]['min'] |
| | 427 | and $value <= $upload_form_config[$field]['max']) |
| | 428 | { |
| | 429 | $conf['upload_form_'.$field] = $value; |
| | 430 | $updates[] = array( |
| | 431 | 'param' => 'upload_form_'.$field, |
| | 432 | 'value' => $value |
| | 433 | ); |
| | 434 | } |
| | 435 | else |
| | 436 | { |
| | 437 | $updates = null; |
| | 438 | break; |
| | 439 | } |
| | 440 | $form_values[$field] = $value; |
| | 441 | } |
| | 442 | if (!empty($updates)) |
| | 443 | { |
| | 444 | mass_updates( |
| | 445 | CONFIG_TABLE, |
| | 446 | array( |
| | 447 | 'primary' => array('param'), |
| | 448 | 'update' => array('value') |
| | 449 | ), |
| | 450 | $updates |
| | 451 | ); |
| | 452 | } |
| | 453 | function regenerateThumbnails_prefilter($content, $smarty) |
| | 454 | { |
| | 455 | return str_replace('{$thumbnail.TN_SRC}', '{$thumbnail.TN_SRC}?rand='.md5(uniqid(rand(), true)), $content); |
| | 456 | } |
| | 457 | $template->set_prefilter('batch_manager_global', 'regenerateThumbnails_prefilter'); |
| | 458 | $template->delete_compiled_templates(); |
| | 459 | } |
| | 460 | |