| 1 |
1035
|
Ruebenwurz
|
<?php
|
| 2 |
|
|
|
| 3 |
|
|
// $Id$
|
| 4 |
|
|
|
| 5 |
|
|
/*
|
| 6 |
|
|
|
| 7 |
|
|
Website Baker Project <http://www.websitebaker.org/>
|
| 8 |
|
|
Copyright (C) 2004-2009, Ryan Djurovich
|
| 9 |
|
|
|
| 10 |
|
|
Website Baker is free software; you can redistribute it and/or modify
|
| 11 |
|
|
it under the terms of the GNU General Public License as published by
|
| 12 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
| 13 |
|
|
(at your option) any later version.
|
| 14 |
|
|
|
| 15 |
|
|
Website Baker is distributed in the hope that it will be useful,
|
| 16 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 17 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 18 |
|
|
GNU General Public License for more details.
|
| 19 |
|
|
|
| 20 |
|
|
You should have received a copy of the GNU General Public License
|
| 21 |
|
|
along with Website Baker; if not, write to the Free Software
|
| 22 |
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
| 23 |
|
|
|
| 24 |
|
|
*/
|
| 25 |
|
|
|
| 26 |
|
|
require('../../config.php');
|
| 27 |
|
|
require_once(WB_PATH.'/framework/class.admin.php');
|
| 28 |
|
|
$admin = new admin('Media', 'media', false);
|
| 29 |
|
|
// Include the WB functions file
|
| 30 |
|
|
require_once(WB_PATH.'/framework/functions.php');
|
| 31 |
|
|
|
| 32 |
|
|
//Save post vars to the parameters file
|
| 33 |
|
|
if ( !is_null($admin->get_post_escaped("save"))) {
|
| 34 |
|
|
//Check for existing settings entry, if not existing, create a record first!
|
| 35 |
|
|
if (!$database->query ( "SELECT * FROM ".TABLE_PREFIX."settings where `name`='mediasettings'" )) {
|
| 36 |
|
|
$database->query ( "INSERT INTO ".TABLE_PREFIX."settings (`name`,`value`) VALUES ('mediasettings','')" );
|
| 37 |
|
|
}
|
| 38 |
|
|
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
|
| 39 |
|
|
$dirs[] = WB_PATH.MEDIA_DIRECTORY;
|
| 40 |
|
|
foreach($dirs AS $name) {
|
| 41 |
|
|
$r = str_replace(WB_PATH, '', $name);
|
| 42 |
|
|
$r = str_replace('/','_',$r);
|
| 43 |
|
|
$w = (int)$admin->get_post_escaped($r.'-w');
|
| 44 |
|
|
$h = (int)$admin->get_post_escaped($r.'-h');
|
| 45 |
|
|
$pathsettings[$r]['width']=$w;
|
| 46 |
|
|
$pathsettings[$r]['height']=$h;
|
| 47 |
|
|
}
|
| 48 |
|
|
$pathsettings['global']['admin_only'] = ($admin->get_post_escaped('admin_only')!=''?'checked':'');
|
| 49 |
|
|
$pathsettings['global']['show_thumbs'] = ($admin->get_post_escaped('show_thumbs')!=''?'checked':'');
|
| 50 |
|
|
$fieldSerialized = serialize($pathsettings);
|
| 51 |
|
|
$database->query ( "UPDATE ".TABLE_PREFIX."settings SET `value` = '$fieldSerialized' WHERE `name`='mediasettings'" );
|
| 52 |
|
|
header ("Location: browse.php");
|
| 53 |
|
|
}
|
| 54 |
|
|
|
| 55 |
|
|
include ('parameters.php');
|
| 56 |
|
|
if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) {
|
| 57 |
|
|
echo "Sorry, settings not available";
|
| 58 |
|
|
exit();
|
| 59 |
|
|
}
|
| 60 |
|
|
|
| 61 |
|
|
// Read data to display
|
| 62 |
|
|
$caller = "setparameter";
|
| 63 |
|
|
|
| 64 |
|
|
$template = new Template(THEME_PATH.'/templates');
|
| 65 |
|
|
$template->set_file('page', 'setparameter.htt');
|
| 66 |
|
|
$template->set_block('page', 'main_block', 'main');
|
| 67 |
|
|
if ($_SESSION['GROUP_ID'] != 1) {
|
| 68 |
|
|
$template->set_var('DISPLAY_ADMIN', 'hide');
|
| 69 |
|
|
}
|
| 70 |
|
|
$template->set_var(array(
|
| 71 |
|
|
'TEXT_HEADER' => 'Set maximum imagesize for a folder</b><br><small><i>(resizing on new uploads only)</i></small>',
|
| 72 |
|
|
'SAVE_TEXT' => $TEXT['SAVE'],
|
| 73 |
|
|
'BACK' => $TEXT['BACK']
|
| 74 |
|
|
)
|
| 75 |
|
|
);
|
| 76 |
|
|
|
| 77 |
|
|
|
| 78 |
|
|
$template->set_block('main_block', 'list_block', 'list');
|
| 79 |
|
|
$row_bg_color = '';
|
| 80 |
|
|
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
|
| 81 |
|
|
$dirs[] = WB_PATH.MEDIA_DIRECTORY;
|
| 82 |
|
|
|
| 83 |
|
|
$array_lowercase = array_map('strtolower', $dirs);
|
| 84 |
|
|
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs);
|
| 85 |
|
|
|
| 86 |
|
|
foreach($dirs AS $name) {
|
| 87 |
|
|
$relative = str_replace(WB_PATH, '', $name);
|
| 88 |
|
|
$safepath = str_replace('/','_',$relative);
|
| 89 |
|
|
$cur_width = $cur_height = '';
|
| 90 |
|
|
if (isset($pathsettings[$safepath]['width'])) $cur_width = $pathsettings[$safepath]['width'];
|
| 91 |
|
|
if (isset($pathsettings[$safepath]['height'])) $cur_height = $pathsettings[$safepath]['height'];
|
| 92 |
|
|
$cur_width = ($cur_width ? (int)$cur_width : '-');
|
| 93 |
|
|
$cur_height = ($cur_height ? (int)$cur_height : '-');
|
| 94 |
|
|
|
| 95 |
|
|
if($row_bg_color == 'DEDEDE') $row_bg_color = 'EEEEEE';
|
| 96 |
|
|
else $row_bg_color = 'DEDEDE';
|
| 97 |
|
|
|
| 98 |
|
|
$template->set_var(array(
|
| 99 |
|
|
'ADMIN_URL' => ADMIN_URL,
|
| 100 |
|
|
'PATH_NAME' => $relative,
|
| 101 |
|
|
'WIDTH' => $TEXT['WIDTH'],
|
| 102 |
|
|
'HEIGHT' => $TEXT['HEIGHT'],
|
| 103 |
|
|
'FIELD_NAME_W' => $safepath.'-w',
|
| 104 |
|
|
'FIELD_NAME_H' => $safepath.'-h',
|
| 105 |
|
|
'CUR_WIDTH' => $cur_width,
|
| 106 |
|
|
'CUR_HEIGHT' => $cur_height,
|
| 107 |
|
|
'SETTINGS' => $TEXT['SETTINGS'],
|
| 108 |
|
|
'ADMIN_ONLY' => 'Settings for administrator only',
|
| 109 |
|
|
'ADMIN_ONLY_SELECTED' => $pathsettings['global']['admin_only'],
|
| 110 |
|
|
'NO_SHOW_THUMBS' => 'Hide thumbnails',
|
| 111 |
|
|
'NO_SHOW_THUMBS_SELECTED' => $pathsettings['global']['show_thumbs'],
|
| 112 |
|
|
'ROW_BG_COLOR' => $row_bg_color
|
| 113 |
|
|
)
|
| 114 |
|
|
);
|
| 115 |
|
|
$template->parse('list', 'list_block', true);
|
| 116 |
|
|
}
|
| 117 |
|
|
|
| 118 |
|
|
$template->parse('main', 'main_block', false);
|
| 119 |
|
|
$template->pparse('output', 'page');
|
| 120 |
|
|
|
| 121 |
|
|
|
| 122 |
|
|
?>
|