1 |
2
|
Manuela
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
*
|
4 |
|
|
* @category admin
|
5 |
|
|
* @package media
|
6 |
|
|
* @author WebsiteBaker Project
|
7 |
|
|
* @copyright Ryan Djurovich
|
8 |
|
|
* @copyright WebsiteBaker Org. e.V.
|
9 |
|
|
* @link http://websitebaker.org/
|
10 |
|
|
* @license http://www.gnu.org/licenses/gpl.html
|
11 |
|
|
* @platform WebsiteBaker 2.8.3
|
12 |
|
|
* @requirements PHP 5.3.6 and higher
|
13 |
|
|
* @version $Id$
|
14 |
|
|
* @filesource $HeadURL$
|
15 |
|
|
* @lastmodified $Date$
|
16 |
|
|
*
|
17 |
|
|
*/
|
18 |
|
|
if ( !defined( 'WB_PATH' ) ){ require( dirname(dirname((__DIR__))).'/config.php' ); }
|
19 |
|
|
if ( !class_exists('admin', false) ) { require(WB_PATH.'/framework/class.admin.php'); }
|
20 |
|
|
$admin = new admin('Media', 'media', false);
|
21 |
|
|
// Include the WB functions file
|
22 |
|
|
require_once(WB_PATH.'/framework/functions.php');
|
23 |
|
|
|
24 |
|
|
// check if theme language file exists for the language set by the user (e.g. DE, EN)
|
25 |
|
|
if(file_exists(THEME_PATH .'/languages/EN.php')) {
|
26 |
|
|
require(THEME_PATH .'/languages/EN.php');
|
27 |
|
|
}
|
28 |
|
|
if(file_exists(THEME_PATH .'/languages/'.LANGUAGE .'.php')) {
|
29 |
|
|
require(THEME_PATH .'/languages/'.LANGUAGE .'.php');
|
30 |
|
|
}
|
31 |
|
|
//Save post vars to the parameters file
|
32 |
|
|
if ( !is_null($admin->get_post("save"))) {
|
33 |
|
|
/*
|
34 |
|
|
if (!$admin->checkFTAN())
|
35 |
|
|
{
|
36 |
|
|
$admin->print_error('::'.$MESSAGE['GENERIC_SECURITY_ACCESS'],'browse.php',false);
|
37 |
|
|
}
|
38 |
|
|
*/
|
39 |
|
|
|
40 |
|
|
if(DEFAULT_THEME != ' wb_theme') {
|
41 |
|
|
//Check for existing settings entry, if not existing, create a record first!
|
42 |
|
|
if (!$database->query ( "SELECT * FROM ".TABLE_PREFIX."settings where `name`='mediasettings'" )) {
|
43 |
|
|
$database->query ( "INSERT INTO ".TABLE_PREFIX."settings (`name`,`value`) VALUES ('mediasettings','')" );
|
44 |
|
|
}
|
45 |
|
|
} else {
|
46 |
|
|
$pathsettings = array();
|
47 |
|
|
}
|
48 |
|
|
|
49 |
|
|
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
|
50 |
|
|
$dirs[] = WB_PATH.MEDIA_DIRECTORY;
|
51 |
|
|
foreach($dirs AS $name) {
|
52 |
|
|
$r = str_replace(WB_PATH, '', $name);
|
53 |
|
|
$r = str_replace(array('/',' '),'_',$r);
|
54 |
|
|
$w = (int)$admin->get_post($r.'-w');
|
55 |
|
|
$h = (int)$admin->get_post($r.'-h');
|
56 |
|
|
$pathsettings[$r]['width']=$w;
|
57 |
|
|
$pathsettings[$r]['height']=$h;
|
58 |
|
|
}
|
59 |
|
|
$pathsettings['global']['admin_only'] = ($admin->get_post('admin_only')!=''?'checked':'');
|
60 |
|
|
$pathsettings['global']['show_thumbs'] = ($admin->get_post('show_thumbs')!=''?'checked':'');
|
61 |
|
|
$fieldSerialized = serialize($pathsettings);
|
62 |
|
|
$database->query ( "UPDATE ".TABLE_PREFIX."settings SET `value` = '$fieldSerialized' WHERE `name`='mediasettings'" );
|
63 |
|
|
header ("Location: browse.php");
|
64 |
|
|
}
|
65 |
|
|
|
66 |
|
|
include ('parameters.php');
|
67 |
|
|
if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) {
|
68 |
|
|
echo "Sorry, settings not available";
|
69 |
|
|
exit();
|
70 |
|
|
}
|
71 |
|
|
|
72 |
|
|
// Read data to display
|
73 |
|
|
$caller = "setparameter";
|
74 |
|
|
|
75 |
|
|
// Setup template object, parse vars to it, then parse it
|
76 |
|
|
// Create new template object
|
77 |
|
|
$template = new Template(dirname($admin->correct_theme_source('setparameter.htt')));
|
78 |
|
|
$template->set_file('page', 'setparameter.htt');
|
79 |
|
|
$template->set_block('page', 'main_block', 'main');
|
80 |
|
|
if ($_SESSION['GROUP_ID'] != 1) {
|
81 |
|
|
$template->set_var('DISPLAY_ADMIN', 'hide');
|
82 |
|
|
}
|
83 |
|
|
$template->set_var(array(
|
84 |
|
|
'TEXT_HEADER' => $TEXT['TEXT_HEADER'],
|
85 |
|
|
'SAVE_TEXT' => $TEXT['SAVE'],
|
86 |
|
|
'BACK' => $TEXT['BACK'],
|
87 |
|
|
)
|
88 |
|
|
);
|
89 |
|
|
|
90 |
|
|
$template->set_block('main_block', 'list_block', 'list');
|
91 |
|
|
$row_bg_color = '';
|
92 |
|
|
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
|
93 |
|
|
$dirs[] = WB_PATH.MEDIA_DIRECTORY;
|
94 |
|
|
|
95 |
|
|
$array_lowercase = array_map('strtolower', $dirs);
|
96 |
|
|
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs);
|
97 |
|
|
$id=0;
|
98 |
|
|
foreach($dirs AS $name) {
|
99 |
|
|
$relative = str_replace(WB_PATH, '', $name);
|
100 |
|
|
$safepath = str_replace(array('/',' '),'_',$relative);
|
101 |
|
|
$cur_width = $cur_height = '';
|
102 |
|
|
if (isset($pathsettings[$safepath]['width'])) $cur_width = $pathsettings[$safepath]['width'];
|
103 |
|
|
if (isset($pathsettings[$safepath]['height'])) $cur_height = $pathsettings[$safepath]['height'];
|
104 |
|
|
$cur_width = ($cur_width ? (int)$cur_width : '-');
|
105 |
|
|
$cur_height = ($cur_height ? (int)$cur_height : '-');
|
106 |
|
|
$id++;
|
107 |
|
|
|
108 |
|
|
if($row_bg_color == 'DEDEDE') $row_bg_color = 'EEEEEE';
|
109 |
|
|
else $row_bg_color = 'DEDEDE';
|
110 |
|
|
$template->set_var(array(
|
111 |
|
|
'ADMIN_URL' => ADMIN_URL,
|
112 |
|
|
'PATH_NAME' => $relative,
|
113 |
|
|
'WIDTH' => $TEXT['WIDTH'],
|
114 |
|
|
'HEIGHT' => $TEXT['HEIGHT'],
|
115 |
|
|
'FIELD_NAME_W' => $safepath.'-w',
|
116 |
|
|
'FIELD_NAME_H' => $safepath.'-h',
|
117 |
|
|
'CUR_WIDTH' => $cur_width,
|
118 |
|
|
'CUR_HEIGHT' => $cur_height,
|
119 |
|
|
'SETTINGS' => $TEXT['SETTINGS'],
|
120 |
|
|
'ADMIN_ONLY' => $TEXT['ADMIN_ONLY'],
|
121 |
|
|
'ADMIN_ONLY_SELECTED' => $pathsettings['global']['admin_only'],
|
122 |
|
|
'NO_SHOW_THUMBS' => $TEXT['NO_SHOW_THUMBS'],
|
123 |
|
|
'NO_SHOW_THUMBS_SELECTED' => $pathsettings['global']['show_thumbs'],
|
124 |
|
|
'ROW_BG_COLOR' => $row_bg_color,
|
125 |
|
|
'FTAN' => $admin->getFTAN(),
|
126 |
|
|
'FILE_ID' => $id,
|
127 |
|
|
)
|
128 |
|
|
);
|
129 |
|
|
$template->parse('list', 'list_block', true);
|
130 |
|
|
}
|
131 |
|
|
|
132 |
|
|
$template->parse('main', 'main_block', false);
|
133 |
|
|
$template->pparse('output', 'page');
|