Revision 1818
Added by Dietmar about 12 years ago
setparameter.php | ||
---|---|---|
3 | 3 |
* |
4 | 4 |
* @category admin |
5 | 5 |
* @package media |
6 |
* @author Ryan Djurovich, WebsiteBaker Project |
|
7 |
* @copyright 2009-2011, Website Baker Org. e.V.
|
|
6 |
* @author Ryan Djurovich (2004-2009), WebsiteBaker Project
|
|
7 |
* @copyright 2009-2012, WebsiteBaker Org. e.V.
|
|
8 | 8 |
* @link http://www.websitebaker2.org/ |
9 | 9 |
* @license http://www.gnu.org/licenses/gpl.html |
10 | 10 |
* @platform WebsiteBaker 2.8.x |
11 | 11 |
* @requirements PHP 5.2.2 and higher |
12 | 12 |
* @version $Id$ |
13 |
* @filesource $HeadURL: $
|
|
14 |
* @lastmodified $Date: $
|
|
13 |
* @filesource $HeadURL$ |
|
14 |
* @lastmodified $Date$ |
|
15 | 15 |
* |
16 | 16 |
*/ |
17 | 17 |
|
18 |
require('../../config.php'); |
|
19 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
18 |
if(!defined('WB_URL')) |
|
19 |
{ |
|
20 |
$config_file = realpath('../../config.php'); |
|
21 |
if(file_exists($config_file) && !defined('WB_URL')) |
|
22 |
{ |
|
23 |
require($config_file); |
|
24 |
} |
|
25 |
} |
|
26 |
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); } |
|
27 |
|
|
20 | 28 |
$admin = new admin('Media', 'media', false); |
21 | 29 |
// Include the WB functions file |
22 | 30 |
require_once(WB_PATH.'/framework/functions.php'); |
... | ... | |
29 | 37 |
// a theme language file exists for the language defined by the user, load it |
30 | 38 |
require_once(THEME_PATH .'/languages/'.LANGUAGE .'.php'); |
31 | 39 |
} |
40 |
// Get the current homedir |
|
41 |
$currentHome = WB_PATH.MEDIA_DIRECTORY.$admin->get_home_folder(); |
|
42 |
$currentHome = str_replace(WB_PATH, '', $currentHome); |
|
43 |
$currentHome = str_replace(array('/',' '),'_',$currentHome); |
|
32 | 44 |
|
33 | 45 |
//Save post vars to the parameters file |
34 | 46 |
if ( !is_null($admin->get_post_escaped("save"))) { |
... | ... | |
39 | 51 |
} |
40 | 52 |
*/ |
41 | 53 |
|
42 |
if(DEFAULT_THEME != ' wb_theme') { |
|
54 |
$pathsettings = array(); |
|
55 |
if(DEFAULT_THEME != '') { |
|
43 | 56 |
//Check for existing settings entry, if not existing, create a record first! |
44 | 57 |
if (!$database->query ( "SELECT * FROM ".TABLE_PREFIX."settings where `name`='mediasettings'" )) { |
45 | 58 |
$database->query ( "INSERT INTO ".TABLE_PREFIX."settings (`name`,`value`) VALUES ('mediasettings','')" ); |
... | ... | |
48 | 61 |
$pathsettings = array(); |
49 | 62 |
} |
50 | 63 |
|
64 |
$pathsettings['global']['admin_only'] = ($admin->get_post_escaped('admin_only')!='' ? 'checked="checked"' : ''); |
|
65 |
$pathsettings['global']['show_thumbs'] = ($admin->get_post_escaped('show_thumbs')!='' ? 'checked="checked"' : ''); |
|
66 |
|
|
51 | 67 |
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY); |
68 |
|
|
52 | 69 |
$dirs[] = WB_PATH.MEDIA_DIRECTORY; |
53 | 70 |
foreach($dirs AS $name) { |
54 | 71 |
$r = str_replace(WB_PATH, '', $name); |
55 | 72 |
$r = str_replace(array('/',' '),'_',$r); |
56 | 73 |
$w = (int)$admin->get_post_escaped($r.'-w'); |
57 | 74 |
$h = (int)$admin->get_post_escaped($r.'-h'); |
58 |
$pathsettings[$r]['width']=$w;
|
|
75 |
$pathsettings[$r]['width']=$w; |
|
59 | 76 |
$pathsettings[$r]['height']=$h; |
60 | 77 |
} |
61 |
$pathsettings['global']['admin_only'] = ($admin->get_post_escaped('admin_only')!=''?'checked':'');
|
|
62 |
$pathsettings['global']['show_thumbs'] = ($admin->get_post_escaped('show_thumbs')!=''?'checked':'');
|
|
78 |
// $pathsettings['global']['admin_only'] = ($admin->get_post_escaped('admin_only')!='' ? 'checked="checked"' : '');
|
|
79 |
// $pathsettings['global']['show_thumbs'] = ($admin->get_post_escaped('show_thumbs')!='' ? 'checked="checked"' : '');
|
|
63 | 80 |
$fieldSerialized = serialize($pathsettings); |
64 | 81 |
$database->query ( "UPDATE ".TABLE_PREFIX."settings SET `value` = '$fieldSerialized' WHERE `name`='mediasettings'" ); |
65 | 82 |
header ("Location: browse.php"); |
66 | 83 |
} |
67 | 84 |
|
68 | 85 |
include ('parameters.php'); |
69 |
if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) {
|
|
86 |
if ($_SESSION['GROUP_ID'] != 1 && (isset($pathsettings['global']['admin_only']) && $pathsettings['global']['admin_only']) ) {
|
|
70 | 87 |
echo "Sorry, settings not available"; |
71 | 88 |
exit(); |
72 | 89 |
} |
... | ... | |
82 | 99 |
if ($_SESSION['GROUP_ID'] != 1) { |
83 | 100 |
$template->set_var('DISPLAY_ADMIN', 'hide'); |
84 | 101 |
} |
85 |
$template->set_var(array(
|
|
102 |
$template->set_var(array( |
|
86 | 103 |
'TEXT_HEADER' => $TEXT['TEXT_HEADER'], |
87 | 104 |
'SAVE_TEXT' => $TEXT['SAVE'], |
88 | 105 |
'BACK' => $TEXT['BACK'], |
... | ... | |
92 | 109 |
$template->set_block('main_block', 'list_block', 'list'); |
93 | 110 |
$row_bg_color = ''; |
94 | 111 |
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY); |
112 |
|
|
95 | 113 |
$dirs[] = WB_PATH.MEDIA_DIRECTORY; |
96 | 114 |
|
97 | 115 |
$array_lowercase = array_map('strtolower', $dirs); |
... | ... | |
101 | 119 |
$relative = str_replace(WB_PATH, '', $name); |
102 | 120 |
$safepath = str_replace(array('/',' '),'_',$relative); |
103 | 121 |
$cur_width = $cur_height = ''; |
104 |
if (isset($pathsettings[$safepath]['width'])) $cur_width = $pathsettings[$safepath]['width']; |
|
105 |
if (isset($pathsettings[$safepath]['height'])) $cur_height = $pathsettings[$safepath]['height']; |
|
106 |
$cur_width = ($cur_width ? (int)$cur_width : '-'); |
|
107 |
$cur_height = ($cur_height ? (int)$cur_height : '-'); |
|
122 |
if (isset($pathsettings[$safepath]['width'])){ $cur_width = $pathsettings[$safepath]['width'];} |
|
123 |
if (isset($pathsettings[$safepath]['height'])){ $cur_height = $pathsettings[$safepath]['height'];} |
|
124 |
$cur_width = ($cur_width ? (int)$cur_width : ''); |
|
125 |
$cur_height = ($cur_height ? (int)$cur_height : ''); |
|
126 |
// |
|
127 |
$bPathCanEdit = (preg_match('/'.$currentHome.'/i', $safepath)) ? true : false; |
|
108 | 128 |
|
109 |
if($row_bg_color == 'DEDEDE') $row_bg_color = 'EEEEEE'; |
|
110 |
else $row_bg_color = 'DEDEDE'; |
|
129 |
// if($row_bg_color == 'DEDEDE') $row_bg_color = 'EEEEEE'; |
|
130 |
// else $row_bg_color = 'DEDEDE'; |
|
131 |
$row_bg_color = ($row_bg_color == '#dedede') ? '#fff' : '#dedede'; |
|
111 | 132 |
|
112 |
$template->set_var(array(
|
|
133 |
$template->set_var(array( |
|
113 | 134 |
'ADMIN_URL' => ADMIN_URL, |
114 | 135 |
'PATH_NAME' => $relative, |
115 | 136 |
'WIDTH' => $TEXT['WIDTH'], |
116 | 137 |
'HEIGHT' => $TEXT['HEIGHT'], |
117 | 138 |
'FIELD_NAME_W' => $safepath.'-w', |
118 | 139 |
'FIELD_NAME_H' => $safepath.'-h', |
140 |
'CAN_EDIT_CLASS' => ($bPathCanEdit==false) ? '' : 'bold', |
|
141 |
'READ_ONLY_DIR' => ($bPathCanEdit==false) ? ' readonly="readonly"' : '', |
|
142 |
'CUR_HEIGHT' => $cur_height, |
|
119 | 143 |
'CUR_WIDTH' => $cur_width, |
120 |
'CUR_HEIGHT' => $cur_height, |
|
121 | 144 |
'SETTINGS' => $TEXT['SETTINGS'], |
122 | 145 |
'ADMIN_ONLY' => $TEXT['ADMIN_ONLY'], |
123 |
'ADMIN_ONLY_SELECTED' => $pathsettings['global']['admin_only'],
|
|
146 |
'ADMIN_ONLY_SELECTED' => isset($pathsettings['global']['admin_only']) ? $pathsettings['global']['admin_only']:'',
|
|
124 | 147 |
'NO_SHOW_THUMBS' => $TEXT['NO_SHOW_THUMBS'], |
125 |
'NO_SHOW_THUMBS_SELECTED' => $pathsettings['global']['show_thumbs'],
|
|
148 |
'NO_SHOW_THUMBS_SELECTED' => isset($pathsettings['global']['show_thumbs']) ? $pathsettings['global']['show_thumbs']:'',
|
|
126 | 149 |
'ROW_BG_COLOR' => $row_bg_color, |
127 | 150 |
'FTAN' => $admin->getFTAN() |
128 | 151 |
) |
129 | 152 |
Also available in: Unified diff
! update users, create username homefolder in media/homefolders