Project

General

Profile

« Previous | Next » 

Revision 1425

Added by Dietmar almost 14 years ago

redefined wrong admin backlinks

View differences:

setparameter.php
1
<?php

2
/**

3
 *

4
 * @category        admin

5
 * @package         admintools

6
 * @author          WebsiteBaker Project

7
 * @copyright       2004-2009, Ryan Djurovich

8
 * @copyright       2009-2011, Website Baker Org. e.V.

9
 * @link			http://www.websitebaker2.org/

10
 * @license         http://www.gnu.org/licenses/gpl.html

11
 * @platform        WebsiteBaker 2.8.x

12
 * @requirements    PHP 5.2.2 and higher

13
 * @version         $Id$

14
 * @filesource		$HeadURL:  $

15
 * @lastmodified    $Date:  $

16
 *

17
 */

18

  
19
require('../../config.php');

20
require_once(WB_PATH.'/framework/class.admin.php');

21
$admin = new admin('Media', 'media', false);

22
// Include the WB functions file

23
require_once(WB_PATH.'/framework/functions.php');

24

  
25
// check if theme language file exists for the language set by the user (e.g. DE, EN)

26
if(!file_exists(THEME_PATH .'/languages/'.LANGUAGE .'.php')) {

27
	// no theme language file exists for the language set by the user, include default theme language file EN.php

28
	require_once(THEME_PATH .'/languages/EN.php');

29
} else {

30
	// a theme language file exists for the language defined by the user, load it

31
	require_once(THEME_PATH .'/languages/'.LANGUAGE .'.php');

32
}

33

  
34
//Save post vars to the parameters file

35
if ( !is_null($admin->get_post_escaped("save"))) {

36
	if (!$admin->checkFTAN())

37
	{

38
		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);

39
		exit();

40
	}

41
	
42
	//Check for existing settings entry, if not existing, create a record first!

43
	if (!$database->query ( "SELECT * FROM ".TABLE_PREFIX."settings where `name`='mediasettings'" )) {

44
		$database->query ( "INSERT INTO ".TABLE_PREFIX."settings (`name`,`value`) VALUES ('mediasettings','')" );

45
	}

46
	$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);

47
	$dirs[] = WB_PATH.MEDIA_DIRECTORY;

48
	foreach($dirs AS $name) {

49
		$r = str_replace(WB_PATH, '', $name);

50
		$r = str_replace(array('/',' '),'_',$r);

51
		$w = (int)$admin->get_post_escaped($r.'-w');

52
		$h = (int)$admin->get_post_escaped($r.'-h');

53
		$pathsettings[$r]['width']=$w; 

54
		$pathsettings[$r]['height']=$h;

55
	}

56
	$pathsettings['global']['admin_only'] = ($admin->get_post_escaped('admin_only')!=''?'checked':'');

57
	$pathsettings['global']['show_thumbs'] = ($admin->get_post_escaped('show_thumbs')!=''?'checked':'');

58
	$fieldSerialized = serialize($pathsettings);

59
	$database->query ( "UPDATE ".TABLE_PREFIX."settings SET `value` = '$fieldSerialized' WHERE `name`='mediasettings'" );

60
	header ("Location: browse.php");

61
}

62

  
63
include ('parameters.php');

64
if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) {

65
	echo "Sorry, settings not available";

66
	exit();

67
}

68

  
69
// Read data to display

70
$caller = "setparameter";

71

  
72
$template = new Template(THEME_PATH.'/templates');

73
$template->set_file('page', 'setparameter.htt');

74
$template->set_block('page', 'main_block', 'main');

75
if ($_SESSION['GROUP_ID'] != 1) {

76
	$template->set_var('DISPLAY_ADMIN', 'hide');

77
}

78
$template->set_var(array( 

79
					'TEXT_HEADER' => $TEXT['TEXT_HEADER'],

80
					'SAVE_TEXT' => $TEXT['SAVE'],

81
					'BACK' => $TEXT['BACK'],

82
				)

83
			);

84

  
85

  
86
$template->set_block('main_block', 'list_block', 'list');

87
$row_bg_color = '';

88
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);

89
$dirs[] = WB_PATH.MEDIA_DIRECTORY;

90

  
91
$array_lowercase = array_map('strtolower', $dirs);

92
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs);

93

  
94
foreach($dirs AS $name) {

95
	$relative = str_replace(WB_PATH, '', $name);

96
	$safepath = str_replace(array('/',' '),'_',$relative);

97
	$cur_width = $cur_height = '';

98
	if (isset($pathsettings[$safepath]['width'])) $cur_width = $pathsettings[$safepath]['width'];

99
	if (isset($pathsettings[$safepath]['height'])) $cur_height = $pathsettings[$safepath]['height'];

100
	$cur_width = ($cur_width ? (int)$cur_width : '-');

101
	$cur_height = ($cur_height ? (int)$cur_height : '-');

102

  
103
	if($row_bg_color == 'DEDEDE') $row_bg_color = 'EEEEEE';

104
	else $row_bg_color = 'DEDEDE';

105

  
106
	$template->set_var(array( 

107
								'ADMIN_URL' => ADMIN_URL,

108
								'PATH_NAME' => $relative,

109
								'WIDTH' => $TEXT['WIDTH'],

110
								'HEIGHT' => $TEXT['HEIGHT'],

111
								'FIELD_NAME_W' => $safepath.'-w',

112
								'FIELD_NAME_H' => $safepath.'-h',

113
								'CUR_WIDTH' => $cur_width,

114
								'CUR_HEIGHT' => $cur_height,

115
								'SETTINGS' => $TEXT['SETTINGS'],

116
								'ADMIN_ONLY' => $TEXT['ADMIN_ONLY'],

117
								'ADMIN_ONLY_SELECTED' => $pathsettings['global']['admin_only'],

118
								'NO_SHOW_THUMBS' => $TEXT['NO_SHOW_THUMBS'],

119
								'NO_SHOW_THUMBS_SELECTED' => $pathsettings['global']['show_thumbs'],

120
								'ROW_BG_COLOR' => $row_bg_color,

121
								'FTAN' => $admin->getFTAN()

122
							)

123
					);

124
	$template->parse('list', 'list_block', true);

125
}

126

  
127
$template->parse('main', 'main_block', false);

128
$template->pparse('output', 'page');

129

  
130

  
1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         admintools
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id$
14
 * @filesource		$HeadURL:  $
15
 * @lastmodified    $Date:  $
16
 *
17
 */
18

  
19
require('../../config.php');
20
require_once(WB_PATH.'/framework/class.admin.php');
21
$admin = new admin('Media', 'media', false);
22
// Include the WB functions file
23
require_once(WB_PATH.'/framework/functions.php');
24

  
25
// check if theme language file exists for the language set by the user (e.g. DE, EN)
26
if(!file_exists(THEME_PATH .'/languages/'.LANGUAGE .'.php')) {
27
	// no theme language file exists for the language set by the user, include default theme language file EN.php
28
	require_once(THEME_PATH .'/languages/EN.php');
29
} else {
30
	// a theme language file exists for the language defined by the user, load it
31
	require_once(THEME_PATH .'/languages/'.LANGUAGE .'.php');
32
}
33

  
34
//Save post vars to the parameters file
35
if ( !is_null($admin->get_post_escaped("save"))) {
36
	if (!$admin->checkFTAN())
37
	{
38
		$admin->print_error('SP5::'.$MESSAGE['GENERIC_SECURITY_ACCESS']);
39
		exit();
40
	}
41
	
42
	//Check for existing settings entry, if not existing, create a record first!
43
	if (!$database->query ( "SELECT * FROM ".TABLE_PREFIX."settings where `name`='mediasettings'" )) {
44
		$database->query ( "INSERT INTO ".TABLE_PREFIX."settings (`name`,`value`) VALUES ('mediasettings','')" );
45
	}
46
	$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
47
	$dirs[] = WB_PATH.MEDIA_DIRECTORY;
48
	foreach($dirs AS $name) {
49
		$r = str_replace(WB_PATH, '', $name);
50
		$r = str_replace(array('/',' '),'_',$r);
51
		$w = (int)$admin->get_post_escaped($r.'-w');
52
		$h = (int)$admin->get_post_escaped($r.'-h');
53
		$pathsettings[$r]['width']=$w; 
54
		$pathsettings[$r]['height']=$h;
55
	}
56
	$pathsettings['global']['admin_only'] = ($admin->get_post_escaped('admin_only')!=''?'checked':'');
57
	$pathsettings['global']['show_thumbs'] = ($admin->get_post_escaped('show_thumbs')!=''?'checked':'');
58
	$fieldSerialized = serialize($pathsettings);
59
	$database->query ( "UPDATE ".TABLE_PREFIX."settings SET `value` = '$fieldSerialized' WHERE `name`='mediasettings'" );
60
	header ("Location: browse.php");
61
}
62

  
63
include ('parameters.php');
64
if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) {
65
	echo "Sorry, settings not available";
66
	exit();
67
}
68

  
69
// Read data to display
70
$caller = "setparameter";
71

  
72
$template = new Template(THEME_PATH.'/templates');
73
$template->set_file('page', 'setparameter.htt');
74
$template->set_block('page', 'main_block', 'main');
75
if ($_SESSION['GROUP_ID'] != 1) {
76
	$template->set_var('DISPLAY_ADMIN', 'hide');
77
}
78
$template->set_var(array( 
79
					'TEXT_HEADER' => $TEXT['TEXT_HEADER'],
80
					'SAVE_TEXT' => $TEXT['SAVE'],
81
					'BACK' => $TEXT['BACK'],
82
				)
83
			);
84

  
85

  
86
$template->set_block('main_block', 'list_block', 'list');
87
$row_bg_color = '';
88
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
89
$dirs[] = WB_PATH.MEDIA_DIRECTORY;
90

  
91
$array_lowercase = array_map('strtolower', $dirs);
92
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs);
93

  
94
foreach($dirs AS $name) {
95
	$relative = str_replace(WB_PATH, '', $name);
96
	$safepath = str_replace(array('/',' '),'_',$relative);
97
	$cur_width = $cur_height = '';
98
	if (isset($pathsettings[$safepath]['width'])) $cur_width = $pathsettings[$safepath]['width'];
99
	if (isset($pathsettings[$safepath]['height'])) $cur_height = $pathsettings[$safepath]['height'];
100
	$cur_width = ($cur_width ? (int)$cur_width : '-');
101
	$cur_height = ($cur_height ? (int)$cur_height : '-');
102

  
103
	if($row_bg_color == 'DEDEDE') $row_bg_color = 'EEEEEE';
104
	else $row_bg_color = 'DEDEDE';
105

  
106
	$template->set_var(array( 
107
								'ADMIN_URL' => ADMIN_URL,
108
								'PATH_NAME' => $relative,
109
								'WIDTH' => $TEXT['WIDTH'],
110
								'HEIGHT' => $TEXT['HEIGHT'],
111
								'FIELD_NAME_W' => $safepath.'-w',
112
								'FIELD_NAME_H' => $safepath.'-h',
113
								'CUR_WIDTH' => $cur_width,
114
								'CUR_HEIGHT' => $cur_height,
115
								'SETTINGS' => $TEXT['SETTINGS'],
116
								'ADMIN_ONLY' => $TEXT['ADMIN_ONLY'],
117
								'ADMIN_ONLY_SELECTED' => $pathsettings['global']['admin_only'],
118
								'NO_SHOW_THUMBS' => $TEXT['NO_SHOW_THUMBS'],
119
								'NO_SHOW_THUMBS_SELECTED' => $pathsettings['global']['show_thumbs'],
120
								'ROW_BG_COLOR' => $row_bg_color,
121
								'FTAN' => $admin->getFTAN()
122
							)
123
					);
124
	$template->parse('list', 'list_block', true);
125
}
126

  
127
$template->parse('main', 'main_block', false);
128
$template->pparse('output', 'page');
129

  
130

  
131 131
?>

Also available in: Unified diff