Project

General

Profile

« Previous | Next » 

Revision 1386

Added by Dietmar almost 14 years ago

update headerinfos

View differences:

branches/2.8.x/CHANGELOG
12 12

  
13 13
------------------------------------- 2.8.2 -------------------------------------
14 14
16 Jan-2011 Build 1385 Frank Heyne (FrankH)
15
! update headerinfos
16
16 Jan-2011 Build 1385 Frank Heyne (FrankH)
15 17
# Security fix to filter out droplets from user input in news and form modules
16 18
16 Jan-2011 Build 1384 Dietmar Woellbrink (Luisehahne)
17 19
! Security fix in admin/pages
branches/2.8.x/wb/admin/groups/save.php
29 29
$admin = new admin('Access', 'groups_modify');
30 30

  
31 31
// Create new database object
32
$database = new database();
32
// $database = new database();
33 33

  
34 34
// Check if group group_id is a valid number and doesnt equal 1
35 35
if(!isset($_POST['group_id']) OR !is_numeric($_POST['group_id']) OR $_POST['group_id'] == 1) {
branches/2.8.x/wb/admin/groups/index.php
1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         groups
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
// Print admin header
20
require('../../config.php');
21
require_once(WB_PATH.'/framework/class.admin.php');
22
$admin = new admin('Access', 'groups');
23

  
24
// Create new template object for the modify/remove menu
25
$template = new Template(THEME_PATH.'/templates');
26
$template->set_file('page', 'groups.htt');
27
$template->set_block('page', 'main_block', 'main');
28
$template->set_block('main_block', 'manage_users_block', 'users');
29
// insert urls
30
$template->set_var(array(
31
	'ADMIN_URL' => ADMIN_URL,
32
	'WB_URL' => WB_URL,
33
	'WB_PATH' => WB_PATH,
34
	'THEME_URL' => THEME_URL
35
	)
36
);
37

  
38
// Get existing value from database
39
$database = new database();
40
$query = "SELECT group_id,name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'";
41
$results = $database->query($query);
42
if($database->is_error()) {
43
	$admin->print_error($database->get_error(), 'index.php');
44
}
45

  
46
// Insert values into the modify/remove menu
47
$template->set_block('main_block', 'list_block', 'list');
48
if($results->numRows() > 0) {
49
	// Insert first value to say please select
50
	$template->set_var('VALUE', '');
51
	$template->set_var('NAME', $TEXT['PLEASE_SELECT'].'...');
52
	$template->parse('list', 'list_block', true);
53
	// Loop through groups
54
	while($group = $results->fetchRow()) {
55
		$template->set_var('VALUE', $group['group_id']);
56
		$template->set_var('NAME', $group['name']);
57
		$template->parse('list', 'list_block', true);
58
	}
59
} else {
60
	// Insert single value to say no groups were found
61
	$template->set_var('NAME', $TEXT['NONE_FOUND']);
62
	$template->parse('list', 'list_block', true);
63
}
64

  
65
// Insert permissions values
66
if($admin->get_permission('groups_add') != true) {
67
	$template->set_var('DISPLAY_ADD', 'hide');
68
}
69
if($admin->get_permission('groups_modify') != true) {
70
	$template->set_var('DISPLAY_MODIFY', 'hide');
71
}
72
if($admin->get_permission('groups_delete') != true) {
73
	$template->set_var('DISPLAY_DELETE', 'hide');
74
}
75

  
76
// Insert language headings
77
$template->set_var(array(
78
	'HEADING_MODIFY_DELETE_GROUP' => $HEADING['MODIFY_DELETE_GROUP'],
79
	'HEADING_ADD_GROUP' => $HEADING['ADD_GROUP']
80
	)
81
);
82
// Insert language text and messages
83
$template->set_var(array(
84
	'TEXT_MODIFY' => $TEXT['MODIFY'],
85
	'TEXT_DELETE' => $TEXT['DELETE'],
86
	'TEXT_MANAGE_USERS' => ( $admin->get_permission('users') == true ) ? $TEXT['MANAGE_USERS']: "",
87
	'CONFIRM_DELETE' => $MESSAGE['GROUPS']['CONFIRM_DELETE']
88
	)
89
);
90
if ( $admin->get_permission('users') == true ) $template->parse("users", "manage_users_block", true);
91
// Parse template object
92
$template->parse('main', 'main_block', false);
93
$template->pparse('output', 'page');
94

  
95
// Setup template for add group form
96
$template = new Template(THEME_PATH.'/templates');
97
$template->set_file('page', 'groups_form.htt');
98
$template->set_block('page', 'main_block', 'main');
99
$template->set_var('DISPLAY_EXTRA', 'display:none;');
100
$template->set_var('ACTION_URL', ADMIN_URL.'/groups/add.php');
101
$template->set_var('SUBMIT_TITLE', $TEXT['ADD']);
102
$template->set_var('ADVANCED_ACTION', 'index.php');
103

  
104
// Tell the browser whether or not to show advanced options
105
if ( true == (isset( $_POST['advanced']) AND ( strpos( $_POST['advanced'], ">>") > 0 ) ) ) {
106
	$template->set_var('DISPLAY_ADVANCED', '');
107
	$template->set_var('DISPLAY_BASIC', 'display:none;');
108
	$template->set_var('ADVANCED', 'yes');
109
	$template->set_var('ADVANCED_BUTTON', '<< '.$TEXT['HIDE_ADVANCED']);
110
} else {
111
	$template->set_var('DISPLAY_ADVANCED', 'display:none;');
112
	$template->set_var('DISPLAY_BASIC', '');
113
	$template->set_var('ADVANCED', 'no');
114
	$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' >>');
115
}
116

  
117
// Insert permissions values
118
if($admin->get_permission('groups_add') != true) {
119
	$template->set_var('DISPLAY_ADD', 'hide');
120
}
121

  
122
// Insert values into module list
123
$template->set_block('main_block', 'module_list_block', 'module_list');
124
$result = $database->query('SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "module" AND `function` = "page" ORDER BY `name`');
125
if($result->numRows() > 0) {
126
	while($addon = $result->fetchRow()) {
127
		$template->set_var('VALUE', $addon['directory']);
128
		$template->set_var('NAME', $addon['name']);
129
		$template->parse('module_list', 'module_list_block', true);
130
	}
131
}
132

  
133
// Insert values into template list
134
$template->set_block('main_block', 'template_list_block', 'template_list');
135
$result = $database->query('SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "template" ORDER BY `name`');
136
if($result->numRows() > 0) {
137
	while($addon = $result->fetchRow()) {
138
		$template->set_var('VALUE', $addon['directory']);
139
		$template->set_var('NAME', $addon['name']);
140
		$template->parse('template_list', 'template_list_block', true);
141
	}
142
}
143

  
144
// Insert language text and messages
145
$template->set_var(array(
146
								'TEXT_RESET' => $TEXT['RESET'],
147
								'TEXT_ACTIVE' => $TEXT['ACTIVE'],
148
								'TEXT_DISABLED' => $TEXT['DISABLED'],
149
								'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
150
								'TEXT_USERNAME' => $TEXT['USERNAME'],
151
								'TEXT_PASSWORD' => $TEXT['PASSWORD'],
152
								'TEXT_RETYPE_PASSWORD' => $TEXT['RETYPE_PASSWORD'],
153
								'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'],
154
								'TEXT_EMAIL' => $TEXT['EMAIL'],
155
								'TEXT_GROUP' => $TEXT['GROUP'],
156
								'TEXT_SYSTEM_PERMISSIONS' => $TEXT['SYSTEM_PERMISSIONS'],
157
								'TEXT_MODULE_PERMISSIONS' => $TEXT['MODULE_PERMISSIONS'],
158
								'TEXT_TEMPLATE_PERMISSIONS' => $TEXT['TEMPLATE_PERMISSIONS'],
159
								'TEXT_NAME' => $TEXT['NAME'],
160
								'SECTION_PAGES' => $MENU['PAGES'],
161
								'SECTION_MEDIA' => $MENU['MEDIA'],
162
								'SECTION_MODULES' => $MENU['MODULES'],
163
								'SECTION_TEMPLATES' => $MENU['TEMPLATES'],
164
								'SECTION_SETTINGS' => $MENU['SETTINGS'],
165
								'SECTION_LANGUAGES' => $MENU['LANGUAGES'],
166
								'SECTION_USERS' => $MENU['USERS'],
167
								'SECTION_GROUPS' => $MENU['GROUPS'],
168
								'SECTION_ADMINTOOLS' => $MENU['ADMINTOOLS'],
169
								'TEXT_VIEW' => $TEXT['VIEW'],
170
								'TEXT_ADD' => $TEXT['ADD'],
171
								'TEXT_LEVEL' => $TEXT['LEVEL'],
172
								'TEXT_MODIFY' => $TEXT['MODIFY'],
173
								'TEXT_DELETE' => $TEXT['DELETE'],
174
								'TEXT_MODIFY_CONTENT' => $TEXT['MODIFY_CONTENT'],
175
								'TEXT_MODIFY_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
176
								'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE'],
177
								'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'],
178
								'TEXT_RENAME' => $TEXT['RENAME'],
179
								'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'],
180
								'TEXT_BASIC' => $TEXT['BASIC'],
181
								'TEXT_ADVANCED' => $TEXT['ADVANCED'],
182
								'CHANGING_PASSWORD' => $MESSAGE['USERS']['CHANGING_PASSWORD'],
183
								'CHECKED' => ' checked="checked"',
184
								'ADMIN_URL' => ADMIN_URL,
185
								'WB_URL' => WB_URL,
186
								'WB_PATH' => WB_PATH,
187
								'THEME_URL' => THEME_URL
188
								)
189
						);
190

  
191
// Parse template for add group form
192
$template->parse('main', 'main_block', false);
193
$template->pparse('output', 'page');
194

  
195
// Print the admin footer
196
$admin->print_footer();
197

  
1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         groups
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
// Print admin header
20
require('../../config.php');
21
require_once(WB_PATH.'/framework/class.admin.php');
22
$admin = new admin('Access', 'groups');
23

  
24
// Create new template object for the modify/remove menu
25
$template = new Template(THEME_PATH.'/templates');
26
$template->set_file('page', 'groups.htt');
27
$template->set_block('page', 'main_block', 'main');
28
$template->set_block('main_block', 'manage_users_block', 'users');
29
// insert urls
30
$template->set_var(array(
31
	'ADMIN_URL' => ADMIN_URL,
32
	'WB_URL' => WB_URL,
33
	'THEME_URL' => THEME_URL
34
	)
35
);
36

  
37
// Get existing value from database
38
// $database = new database();
39
$query = "SELECT group_id,name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'";
40
$results = $database->query($query);
41
if($database->is_error()) {
42
	$admin->print_error($database->get_error(), 'index.php');
43
}
44

  
45
// Insert values into the modify/remove menu
46
$template->set_block('main_block', 'list_block', 'list');
47
if($results->numRows() > 0) {
48
	// Insert first value to say please select
49
	$template->set_var('VALUE', '');
50
	$template->set_var('NAME', $TEXT['PLEASE_SELECT'].'...');
51
	$template->parse('list', 'list_block', true);
52
	// Loop through groups
53
	while($group = $results->fetchRow()) {
54
		$template->set_var('VALUE', $group['group_id']);
55
		$template->set_var('NAME', $group['name']);
56
		$template->parse('list', 'list_block', true);
57
	}
58
} else {
59
	// Insert single value to say no groups were found
60
	$template->set_var('NAME', $TEXT['NONE_FOUND']);
61
	$template->parse('list', 'list_block', true);
62
}
63

  
64
// Insert permissions values
65
if($admin->get_permission('groups_add') != true) {
66
	$template->set_var('DISPLAY_ADD', 'hide');
67
}
68
if($admin->get_permission('groups_modify') != true) {
69
	$template->set_var('DISPLAY_MODIFY', 'hide');
70
}
71
if($admin->get_permission('groups_delete') != true) {
72
	$template->set_var('DISPLAY_DELETE', 'hide');
73
}
74

  
75
// Insert language headings
76
$template->set_var(array(
77
	'HEADING_MODIFY_DELETE_GROUP' => $HEADING['MODIFY_DELETE_GROUP'],
78
	'HEADING_ADD_GROUP' => $HEADING['ADD_GROUP']
79
	)
80
);
81
// Insert language text and messages
82
$template->set_var(array(
83
	'TEXT_MODIFY' => $TEXT['MODIFY'],
84
	'TEXT_DELETE' => $TEXT['DELETE'],
85
	'TEXT_MANAGE_USERS' => ( $admin->get_permission('users') == true ) ? $TEXT['MANAGE_USERS']: "",
86
	'CONFIRM_DELETE' => $MESSAGE['GROUPS']['CONFIRM_DELETE']
87
	)
88
);
89
if ( $admin->get_permission('users') == true ) $template->parse("users", "manage_users_block", true);
90
// Parse template object
91
$template->parse('main', 'main_block', false);
92
$template->pparse('output', 'page');
93

  
94
// Setup template for add group form
95
$template = new Template(THEME_PATH.'/templates');
96
$template->set_file('page', 'groups_form.htt');
97
$template->set_block('page', 'main_block', 'main');
98
$template->set_var('DISPLAY_EXTRA', 'display:none;');
99
$template->set_var('ACTION_URL', ADMIN_URL.'/groups/add.php');
100
$template->set_var('SUBMIT_TITLE', $TEXT['ADD']);
101
$template->set_var('ADVANCED_ACTION', 'index.php');
102

  
103
// Tell the browser whether or not to show advanced options
104
if ( true == (isset( $_POST['advanced']) AND ( strpos( $_POST['advanced'], ">>") > 0 ) ) ) {
105
	$template->set_var('DISPLAY_ADVANCED', '');
106
	$template->set_var('DISPLAY_BASIC', 'display:none;');
107
	$template->set_var('ADVANCED', 'yes');
108
	$template->set_var('ADVANCED_BUTTON', '<< '.$TEXT['HIDE_ADVANCED']);
109
} else {
110
	$template->set_var('DISPLAY_ADVANCED', 'display:none;');
111
	$template->set_var('DISPLAY_BASIC', '');
112
	$template->set_var('ADVANCED', 'no');
113
	$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' >>');
114
}
115

  
116
// Insert permissions values
117
if($admin->get_permission('groups_add') != true) {
118
	$template->set_var('DISPLAY_ADD', 'hide');
119
}
120

  
121
// Insert values into module list
122
$template->set_block('main_block', 'module_list_block', 'module_list');
123
$result = $database->query('SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "module" AND `function` = "page" ORDER BY `name`');
124
if($result->numRows() > 0) {
125
	while($addon = $result->fetchRow()) {
126
		$template->set_var('VALUE', $addon['directory']);
127
		$template->set_var('NAME', $addon['name']);
128
		$template->parse('module_list', 'module_list_block', true);
129
	}
130
}
131

  
132
// Insert values into template list
133
$template->set_block('main_block', 'template_list_block', 'template_list');
134
$result = $database->query('SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "template" ORDER BY `name`');
135
if($result->numRows() > 0) {
136
	while($addon = $result->fetchRow()) {
137
		$template->set_var('VALUE', $addon['directory']);
138
		$template->set_var('NAME', $addon['name']);
139
		$template->parse('template_list', 'template_list_block', true);
140
	}
141
}
142

  
143
// Insert language text and messages
144
$template->set_var(array(
145
								'TEXT_RESET' => $TEXT['RESET'],
146
								'TEXT_ACTIVE' => $TEXT['ACTIVE'],
147
								'TEXT_DISABLED' => $TEXT['DISABLED'],
148
								'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
149
								'TEXT_USERNAME' => $TEXT['USERNAME'],
150
								'TEXT_PASSWORD' => $TEXT['PASSWORD'],
151
								'TEXT_RETYPE_PASSWORD' => $TEXT['RETYPE_PASSWORD'],
152
								'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'],
153
								'TEXT_EMAIL' => $TEXT['EMAIL'],
154
								'TEXT_GROUP' => $TEXT['GROUP'],
155
								'TEXT_SYSTEM_PERMISSIONS' => $TEXT['SYSTEM_PERMISSIONS'],
156
								'TEXT_MODULE_PERMISSIONS' => $TEXT['MODULE_PERMISSIONS'],
157
								'TEXT_TEMPLATE_PERMISSIONS' => $TEXT['TEMPLATE_PERMISSIONS'],
158
								'TEXT_NAME' => $TEXT['NAME'],
159
								'SECTION_PAGES' => $MENU['PAGES'],
160
								'SECTION_MEDIA' => $MENU['MEDIA'],
161
								'SECTION_MODULES' => $MENU['MODULES'],
162
								'SECTION_TEMPLATES' => $MENU['TEMPLATES'],
163
								'SECTION_SETTINGS' => $MENU['SETTINGS'],
164
								'SECTION_LANGUAGES' => $MENU['LANGUAGES'],
165
								'SECTION_USERS' => $MENU['USERS'],
166
								'SECTION_GROUPS' => $MENU['GROUPS'],
167
								'SECTION_ADMINTOOLS' => $MENU['ADMINTOOLS'],
168
								'TEXT_VIEW' => $TEXT['VIEW'],
169
								'TEXT_ADD' => $TEXT['ADD'],
170
								'TEXT_LEVEL' => $TEXT['LEVEL'],
171
								'TEXT_MODIFY' => $TEXT['MODIFY'],
172
								'TEXT_DELETE' => $TEXT['DELETE'],
173
								'TEXT_MODIFY_CONTENT' => $TEXT['MODIFY_CONTENT'],
174
								'TEXT_MODIFY_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
175
								'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE'],
176
								'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'],
177
								'TEXT_RENAME' => $TEXT['RENAME'],
178
								'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'],
179
								'TEXT_BASIC' => $TEXT['BASIC'],
180
								'TEXT_ADVANCED' => $TEXT['ADVANCED'],
181
								'CHANGING_PASSWORD' => $MESSAGE['USERS']['CHANGING_PASSWORD'],
182
								'CHECKED' => ' checked="checked"',
183
								'ADMIN_URL' => ADMIN_URL,
184
								'WB_URL' => WB_URL,
185
								'WB_PATH' => WB_PATH,
186
								'THEME_URL' => THEME_URL
187
								)
188
						);
189

  
190
// Parse template for add group form
191
$template->parse('main', 'main_block', false);
192
$template->pparse('output', 'page');
193

  
194
// Print the admin footer
195
$admin->print_footer();
196

  
198 197
?>
branches/2.8.x/wb/admin/groups/add.php
29 29
$admin = new admin('Access', 'groups_add');
30 30

  
31 31
// Create new database object
32
$database = new database();
32
// $database = new database();
33 33

  
34 34
// Gather details entered
35 35
$group_name = $admin->get_post('group_name');
branches/2.8.x/wb/admin/templates/uninstall.php
146 146
}
147 147

  
148 148
// Update pages that use this template with default template
149
$database = new database();
149
// $database = new database();
150 150
$database->query("UPDATE ".TABLE_PREFIX."pages SET template = '".DEFAULT_TEMPLATE."' WHERE template = '$file'");
151 151

  
152 152
// Print success message
branches/2.8.x/wb/admin/pages/intro.php
1 1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         pages
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: http://svn.websitebaker2.org/branches/2.8.x/wb/admin/users/save.php $
15
 * @lastmodified    $Date: 2011-01-10 13:21:47 +0100 (Mo, 10. Jan 2011) $
16
 *
17
 */
2 18

  
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 19
// Create new admin object
27 20
require('../../config.php');
28 21
require_once(WB_PATH.'/framework/class.admin.php');
branches/2.8.x/wb/admin/pages/move_down.php
1 1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         pages
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: http://svn.websitebaker2.org/branches/2.8.x/wb/admin/users/save.php $
15
 * @lastmodified    $Date: 2011-01-10 13:21:47 +0100 (Mo, 10. Jan 2011) $
16
 *
17
 */
2 18

  
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 19
require('../../config.php');
27 20

  
28 21
// Get id
branches/2.8.x/wb/admin/pages/save.php
40 40
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
41 41
	exit();
42 42
}
43
$js_back = "javascript: history.go(-1);";
43 44

  
44 45
// Get perms
45 46
$sql  = 'SELECT `admin_groups`,`admin_users` FROM `'.TABLE_PREFIX.'pages` ';
branches/2.8.x/wb/admin/pages/move_up.php
1 1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         pages
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: http://svn.websitebaker2.org/branches/2.8.x/wb/admin/users/save.php $
15
 * @lastmodified    $Date: 2011-01-10 13:21:47 +0100 (Mo, 10. Jan 2011) $
16
 *
17
 */
2 18

  
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 19
require('../../config.php');
27 20

  
28 21
// Get id
branches/2.8.x/wb/admin/pages/intro2.php
1 1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         pages
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: http://svn.websitebaker2.org/branches/2.8.x/wb/admin/users/save.php $
15
 * @lastmodified    $Date: 2011-01-10 13:21:47 +0100 (Mo, 10. Jan 2011) $
16
 *
17
 */
2 18

  
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 19
// Get posted content
27 20
if(!isset($_POST['content'])) {
28 21
	header("Location: intro".PAGE_EXTENSION."");
branches/2.8.x/wb/admin/pages/restore.php
1 1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         pages
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: http://svn.websitebaker2.org/branches/2.8.x/wb/admin/users/save.php $
15
 * @lastmodified    $Date: 2011-01-10 13:21:47 +0100 (Mo, 10. Jan 2011) $
16
 *
17
 */
2 18

  
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 19
// Get page id
27 20
if(!isset($_GET['page_id']) OR !is_numeric($_GET['page_id'])) {
28 21
	header("Location: index.php");
branches/2.8.x/wb/admin/interface/version.php
52 52

  
53 53
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
54 54
if(!defined('VERSION')) define('VERSION', '2.8.2.RC4');
55
if(!defined('REVISION')) define('REVISION', '1385');
55
if(!defined('REVISION')) define('REVISION', '1386');
56 56

  
57 57
?>
branches/2.8.x/wb/admin/users/users.php
1
<?php

2
/**

3
 *

4
 * @category        admin

5
 * @package         users

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
 // Include config file and admin class file

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

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

22

  
23
// Create new database object

24
$database = new database();

25

  
26
if(!isset($_POST['action']) OR ($_POST['action'] != "modify" AND $_POST['action'] != "delete")) {

27
	header("Location: index.php");

28
	exit(0);

29
}

30

  
31
// Set parameter 'action' as alternative to javascript mechanism

32
if(isset($_POST['modify']))

33
	$_POST['action'] = "modify";

34
if(isset($_POST['delete']))

35
	$_POST['action'] = "delete";

36

  
37
// Check if user id is a valid number and doesnt equal 1

38
if(!isset($_POST['user_id']) OR !is_numeric($_POST['user_id']) OR $_POST['user_id'] == 1) {

39
	header("Location: index.php");

40
	exit(0);

41
}

42

  
43
if($_POST['action'] == 'modify')

44
{

45
	// Print header

46
	$admin = new admin('Access', 'users_modify');

47
	// Get existing values

48
	$results = $database->query("SELECT * FROM ".TABLE_PREFIX."users WHERE user_id = '".$_POST['user_id']."'");

49
	$user = $results->fetchRow();

50
	
51
	// Setup template object

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

53
	$template->set_file('page', 'users_form.htt');

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

55
	$template->set_var(	array(

56
							'ACTION_URL' => ADMIN_URL.'/users/save.php',

57
							'SUBMIT_TITLE' => $TEXT['SAVE'],

58
							'USER_ID' => $user['user_id'],

59
							'USERNAME' => $user['username'],

60
							'DISPLAY_NAME' => $user['display_name'],

61
							'EMAIL' => $user['email'],

62
							'ADMIN_URL' => ADMIN_URL,

63
							'WB_URL' => WB_URL,

64
							'WB_PATH' => WB_PATH,

65
							'THEME_URL' => THEME_URL

66
							)

67
					);

68
	
69
	$template->set_var('FTAN', $admin->getFTAN());

70
	if($user['active'] == 1) {

71
		$template->set_var('ACTIVE_CHECKED', ' checked="checked"');

72
	} else {

73
		$template->set_var('DISABLED_CHECKED', ' checked="checked"');

74
	}

75
	// Add groups to list

76
	$template->set_block('main_block', 'group_list_block', 'group_list');

77
	$results = $database->query("SELECT group_id, name FROM ".TABLE_PREFIX."groups WHERE group_id != '1' ORDER BY name");

78
	if($results->numRows() > 0) {

79
		$template->set_var('ID', '');

80
		$template->set_var('NAME', $TEXT['PLEASE_SELECT'].'...');

81
		$template->set_var('SELECTED', '');

82
		$template->parse('group_list', 'group_list_block', true);

83
		while($group = $results->fetchRow()) {

84
			$template->set_var('ID', $group['group_id']);

85
			$template->set_var('NAME', $group['name']);

86
			if(in_array($group['group_id'], explode(",",$user['groups_id']))) {

87
				$template->set_var('SELECTED', ' selected="selected"');

88
			} else {

89
				$template->set_var('SELECTED', '');

90
			}

91
			$template->parse('group_list', 'group_list_block', true);

92
		}

93
	}

94

  
95
	// Only allow the user to add a user to the Administrators group if they belong to it

96
	if(in_array(1, $admin->get_groups_id()))

97
    {

98
		$template->set_var('ID', '1');

99
		$users_groups = $admin->get_groups_name();

100
		$template->set_var('NAME', $users_groups[1]);

101

  
102
		$in_group = FALSE;

103
		foreach($admin->get_groups_id() as $cur_gid){

104
		    if (in_array($cur_gid, explode(",", $user['groups_id']))) {

105
		        $in_group = TRUE;

106
		    }

107
		}

108

  
109
		if($in_group) {

110
			$template->set_var('SELECTED', ' selected="selected"');

111
		} else {

112
			$template->set_var('SELECTED', '');

113
		}

114
		$template->parse('group_list', 'group_list_block', true);

115
	} else {

116
		if($results->numRows() == 0) {

117
			$template->set_var('ID', '');

118
			$template->set_var('NAME', $TEXT['NONE_FOUND']);

119
			$template->set_var('SELECTED', ' selected="selected"');

120
			$template->parse('group_list', 'group_list_block', true);

121
		}

122
	}

123

  
124
	// Generate username field name

125
	$username_fieldname = 'username_';

126
	$salt = "abchefghjkmnpqrstuvwxyz0123456789";

127
	srand((double)microtime()*1000000);

128
	$i = 0;

129
	while ($i <= 7) {

130
		$num = rand() % 33;

131
		$tmp = substr($salt, $num, 1);

132
		$username_fieldname = $username_fieldname . $tmp;

133
		$i++;

134
	}

135
	
136
	// Work-out if home folder should be shown

137
	if(!HOME_FOLDERS) {

138
		$template->set_var('DISPLAY_HOME_FOLDERS', 'display:none;');

139
	}

140
	
141
	// Include the WB functions file

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

143
	
144
	// Add media folders to home folder list

145
	$template->set_block('main_block', 'folder_list_block', 'folder_list');

146
	foreach(directory_list(WB_PATH.MEDIA_DIRECTORY) AS $name)

147
    {

148
		$template->set_var('NAME', str_replace(WB_PATH, '', $name));

149
		$template->set_var('FOLDER', str_replace(WB_PATH.MEDIA_DIRECTORY, '', $name));

150
		if($user['home_folder'] == str_replace(WB_PATH.MEDIA_DIRECTORY, '', $name)) {

151
			$template->set_var('SELECTED', ' selected="selected"');

152
		} else {

153
			$template->set_var('SELECTED', ' ');

154
		}

155
		$template->parse('folder_list', 'folder_list_block', true);

156
	}

157
	
158
	// Insert language text and messages

159
	$template->set_var(array(

160
									'TEXT_RESET' => $TEXT['RESET'],

161
									'TEXT_ACTIVE' => $TEXT['ACTIVE'],

162
									'TEXT_DISABLED' => $TEXT['DISABLED'],

163
									'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],

164
									'TEXT_USERNAME' => $TEXT['USERNAME'],

165
									'TEXT_PASSWORD' => $TEXT['PASSWORD'],

166
									'TEXT_RETYPE_PASSWORD' => $TEXT['RETYPE_PASSWORD'],

167
									'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'],

168
									'TEXT_EMAIL' => $TEXT['EMAIL'],

169
									'TEXT_GROUP' => $TEXT['GROUP'],

170
									'TEXT_NONE' => $TEXT['NONE'],

171
									'TEXT_HOME_FOLDER' => $TEXT['HOME_FOLDER'],

172
									'USERNAME_FIELDNAME' => $username_fieldname,

173
									'CHANGING_PASSWORD' => $MESSAGE['USERS']['CHANGING_PASSWORD'],

174
									'HEADING_MODIFY_USER' => $HEADING['MODIFY_USER']

175
									)

176
							);

177
	
178
	// Parse template object

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

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

181
} elseif($_POST['action'] == 'delete') {

182
	// Print header

183
	$admin = new admin('Access', 'users_delete');

184
	// Delete the user

185
	$database->query("DELETE FROM ".TABLE_PREFIX."users WHERE user_id = '".$_POST['user_id']."' LIMIT 1");

186
	if($database->is_error()) {

187
		$admin->print_error($database->get_error());

188
	} else {

189
		$admin->print_success($MESSAGE['USERS']['DELETED']);

190
	}

191
}

192

  
193
// Print admin footer

194
$admin->print_footer();

195

  
1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         users
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
 // Include config file and admin class file
20
require('../../config.php');
21
require_once(WB_PATH.'/framework/class.admin.php');
22

  
23
// Create new database object
24
// $database = new database();
25

  
26
if(!isset($_POST['action']) OR ($_POST['action'] != "modify" AND $_POST['action'] != "delete")) {
27
	header("Location: index.php");
28
	exit(0);
29
}
30

  
31
// Set parameter 'action' as alternative to javascript mechanism
32
if(isset($_POST['modify']))
33
	$_POST['action'] = "modify";
34
if(isset($_POST['delete']))
35
	$_POST['action'] = "delete";
36

  
37
// Check if user id is a valid number and doesnt equal 1
38
if(!isset($_POST['user_id']) OR !is_numeric($_POST['user_id']) OR $_POST['user_id'] == 1) {
39
	header("Location: index.php");
40
	exit(0);
41
}
42

  
43
if($_POST['action'] == 'modify')
44
{
45
	// Print header
46
	$admin = new admin('Access', 'users_modify');
47
	// Get existing values
48
	$results = $database->query("SELECT * FROM ".TABLE_PREFIX."users WHERE user_id = '".$_POST['user_id']."'");
49
	$user = $results->fetchRow();
50
	
51
	// Setup template object
52
	$template = new Template(THEME_PATH.'/templates');
53
	$template->set_file('page', 'users_form.htt');
54
	$template->set_block('page', 'main_block', 'main');
55
	$template->set_var(	array(
56
							'ACTION_URL' => ADMIN_URL.'/users/save.php',
57
							'SUBMIT_TITLE' => $TEXT['SAVE'],
58
							'USER_ID' => $user['user_id'],
59
							'USERNAME' => $user['username'],
60
							'DISPLAY_NAME' => $user['display_name'],
61
							'EMAIL' => $user['email'],
62
							'ADMIN_URL' => ADMIN_URL,
63
							'WB_URL' => WB_URL,
64
							'WB_PATH' => WB_PATH,
65
							'THEME_URL' => THEME_URL
66
							)
67
					);
68
	
69
	$template->set_var('FTAN', $admin->getFTAN());
70
	if($user['active'] == 1) {
71
		$template->set_var('ACTIVE_CHECKED', ' checked="checked"');
72
	} else {
73
		$template->set_var('DISABLED_CHECKED', ' checked="checked"');
74
	}
75
	// Add groups to list
76
	$template->set_block('main_block', 'group_list_block', 'group_list');
77
	$results = $database->query("SELECT group_id, name FROM ".TABLE_PREFIX."groups WHERE group_id != '1' ORDER BY name");
78
	if($results->numRows() > 0) {
79
		$template->set_var('ID', '');
80
		$template->set_var('NAME', $TEXT['PLEASE_SELECT'].'...');
81
		$template->set_var('SELECTED', '');
82
		$template->parse('group_list', 'group_list_block', true);
83
		while($group = $results->fetchRow()) {
84
			$template->set_var('ID', $group['group_id']);
85
			$template->set_var('NAME', $group['name']);
86
			if(in_array($group['group_id'], explode(",",$user['groups_id']))) {
87
				$template->set_var('SELECTED', ' selected="selected"');
88
			} else {
89
				$template->set_var('SELECTED', '');
90
			}
91
			$template->parse('group_list', 'group_list_block', true);
92
		}
93
	}
94

  
95
	// Only allow the user to add a user to the Administrators group if they belong to it
96
	if(in_array(1, $admin->get_groups_id()))
97
    {
98
		$template->set_var('ID', '1');
99
		$users_groups = $admin->get_groups_name();
100
		$template->set_var('NAME', $users_groups[1]);
101

  
102
		$in_group = FALSE;
103
		foreach($admin->get_groups_id() as $cur_gid){
104
		    if (in_array($cur_gid, explode(",", $user['groups_id']))) {
105
		        $in_group = TRUE;
106
		    }
107
		}
108

  
109
		if($in_group) {
110
			$template->set_var('SELECTED', ' selected="selected"');
111
		} else {
112
			$template->set_var('SELECTED', '');
113
		}
114
		$template->parse('group_list', 'group_list_block', true);
115
	} else {
116
		if($results->numRows() == 0) {
117
			$template->set_var('ID', '');
118
			$template->set_var('NAME', $TEXT['NONE_FOUND']);
119
			$template->set_var('SELECTED', ' selected="selected"');
120
			$template->parse('group_list', 'group_list_block', true);
121
		}
122
	}
123

  
124
	// Generate username field name
125
	$username_fieldname = 'username_';
126
	$salt = "abchefghjkmnpqrstuvwxyz0123456789";
127
	srand((double)microtime()*1000000);
128
	$i = 0;
129
	while ($i <= 7) {
130
		$num = rand() % 33;
131
		$tmp = substr($salt, $num, 1);
132
		$username_fieldname = $username_fieldname . $tmp;
133
		$i++;
134
	}
135
	
136
	// Work-out if home folder should be shown
137
	if(!HOME_FOLDERS) {
138
		$template->set_var('DISPLAY_HOME_FOLDERS', 'display:none;');
139
	}
140
	
141
	// Include the WB functions file
142
	require_once(WB_PATH.'/framework/functions.php');
143
	
144
	// Add media folders to home folder list
145
	$template->set_block('main_block', 'folder_list_block', 'folder_list');
146
	foreach(directory_list(WB_PATH.MEDIA_DIRECTORY) AS $name)
147
    {
148
		$template->set_var('NAME', str_replace(WB_PATH, '', $name));
149
		$template->set_var('FOLDER', str_replace(WB_PATH.MEDIA_DIRECTORY, '', $name));
150
		if($user['home_folder'] == str_replace(WB_PATH.MEDIA_DIRECTORY, '', $name)) {
151
			$template->set_var('SELECTED', ' selected="selected"');
152
		} else {
153
			$template->set_var('SELECTED', ' ');
154
		}
155
		$template->parse('folder_list', 'folder_list_block', true);
156
	}
157
	
158
	// Insert language text and messages
159
	$template->set_var(array(
160
									'TEXT_RESET' => $TEXT['RESET'],
161
									'TEXT_ACTIVE' => $TEXT['ACTIVE'],
162
									'TEXT_DISABLED' => $TEXT['DISABLED'],
163
									'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
164
									'TEXT_USERNAME' => $TEXT['USERNAME'],
165
									'TEXT_PASSWORD' => $TEXT['PASSWORD'],
166
									'TEXT_RETYPE_PASSWORD' => $TEXT['RETYPE_PASSWORD'],
167
									'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'],
168
									'TEXT_EMAIL' => $TEXT['EMAIL'],
169
									'TEXT_GROUP' => $TEXT['GROUP'],
170
									'TEXT_NONE' => $TEXT['NONE'],
171
									'TEXT_HOME_FOLDER' => $TEXT['HOME_FOLDER'],
172
									'USERNAME_FIELDNAME' => $username_fieldname,
173
									'CHANGING_PASSWORD' => $MESSAGE['USERS']['CHANGING_PASSWORD'],
174
									'HEADING_MODIFY_USER' => $HEADING['MODIFY_USER']
175
									)
176
							);
177
	
178
	// Parse template object
179
	$template->parse('main', 'main_block', false);
180
	$template->pparse('output', 'page');
181
} elseif($_POST['action'] == 'delete') {
182
	// Print header
183
	$admin = new admin('Access', 'users_delete');
184
	// Delete the user
185
	$database->query("DELETE FROM ".TABLE_PREFIX."users WHERE user_id = '".$_POST['user_id']."' LIMIT 1");
186
	if($database->is_error()) {
187
		$admin->print_error($database->get_error());
188
	} else {
189
		$admin->print_success($MESSAGE['USERS']['DELETED']);
190
	}
191
}
192

  
193
// Print admin footer
194
$admin->print_footer();
195

  
196 196
?>
branches/2.8.x/wb/admin/users/index.php
1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         users
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

  
20
require('../../config.php');
21
require_once(WB_PATH.'/framework/class.admin.php');
22
$admin = new admin('Access', 'users');
23

  
24
// Create new template object for the modify/remove menu
25
$template = new Template(THEME_PATH.'/templates');
26
$template->set_file('page', 'users.htt');
27
$template->set_block('page', 'main_block', 'main');
28
$template->set_block("main_block", "manage_groups_block", "groups");
29
$template->set_var('ADMIN_URL', ADMIN_URL);
30

  
31
// Get existing value from database
32
$database = new database();
33
$query = "SELECT user_id, username, display_name FROM ".TABLE_PREFIX."users WHERE user_id != '1' ORDER BY display_name,username";
34
$results = $database->query($query);
35
if($database->is_error()) {
36
	$admin->print_error($database->get_error(), 'index.php');
37
}
38

  
39
// Insert values into the modify/remove menu
40
$template->set_block('main_block', 'list_block', 'list');
41
if($results->numRows() > 0) {
42
	// Insert first value to say please select
43
	$template->set_var('VALUE', '');
44
	$template->set_var('NAME', $TEXT['PLEASE_SELECT'].'...');
45
	$template->parse('list', 'list_block', true);
46
	// Loop through users
47
	while($user = $results->fetchRow()) {
48
		$template->set_var('VALUE', $user['user_id']);
49
		$template->set_var('NAME', $user['display_name'].' ('.$user['username'].')');
50
		$template->parse('list', 'list_block', true);
51
	}
52
} else {
53
	// Insert single value to say no users were found
54
	$template->set_var('NAME', $TEXT['NONE_FOUND']);
55
	$template->parse('list', 'list_block', true);
56
}
57

  
58
// Insert permissions values
59
if($admin->get_permission('users_add') != true) {
60
	$template->set_var('DISPLAY_ADD', 'hide');
61
}
62
if($admin->get_permission('users_modify') != true) {
63
	$template->set_var('DISPLAY_MODIFY', 'hide');
64
}
65
if($admin->get_permission('users_delete') != true) {
66
	$template->set_var('DISPLAY_DELETE', 'hide');
67
}
68

  
69
// Insert language headings
70
$template->set_var(array(
71
		'HEADING_MODIFY_DELETE_USER' => $HEADING['MODIFY_DELETE_USER'],
72
		'HEADING_ADD_USER' => $HEADING['ADD_USER']
73
		)
74
);
75
// insert urls
76
$template->set_var(array(
77
		'ADMIN_URL' => ADMIN_URL,
78
		'WB_URL' => WB_URL,
79
		'WB_PATH' => WB_PATH,
80
		'THEME_URL' => THEME_URL
81
		)
82
);
83
// Insert language text and messages
84
$template->set_var(array(
85
		'TEXT_MODIFY' => $TEXT['MODIFY'],
86
		'TEXT_DELETE' => $TEXT['DELETE'],
87
		'TEXT_MANAGE_GROUPS' => ( $admin->get_permission('groups') == true ) ? $TEXT['MANAGE_GROUPS'] : "**",
88
		'CONFIRM_DELETE' => $MESSAGE['USERS']['CONFIRM_DELETE']
89
		)
90
);
91
if ( $admin->get_permission('groups') == true ) $template->parse("groups", "manage_groups_block", true);
92
// Parse template object
93
$template->parse('main', 'main_block', false);
94
$template->pparse('output', 'page');
95

  
96
// Setup template for add user form
97
$template = new Template(THEME_PATH.'/templates');
98
$template->set_file('page', 'users_form.htt');
99
$template->set_block('page', 'main_block', 'main');
100
$template->set_var('DISPLAY_EXTRA', 'display:none;');
101
$template->set_var('ACTIVE_CHECKED', ' checked="checked"');
102
$template->set_var('ACTION_URL', ADMIN_URL.'/users/add.php');
103
$template->set_var('SUBMIT_TITLE', $TEXT['ADD']);
104
$template->set_var('FTAN', $admin->getFTAN());
105
// insert urls
106
$template->set_var(array(
107
		'ADMIN_URL' => ADMIN_URL,
108
		'WB_URL' => WB_URL,
109
		'WB_PATH' => WB_PATH,
110
		'THEME_URL' => THEME_URL
111
		)
112
);
113

  
114
// Add groups to list
115
$template->set_block('main_block', 'group_list_block', 'group_list');
116
$results = $database->query("SELECT group_id, name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'");
117
if($results->numRows() > 0) {
118
	$template->set_var('ID', '');
119
	$template->set_var('NAME', $TEXT['PLEASE_SELECT'].'...');
120
	$template->set_var('SELECTED', ' selected="selected"');
121
	$template->parse('group_list', 'group_list_block', true);
122
	while($group = $results->fetchRow()) {
123
		$template->set_var('ID', $group['group_id']);
124
		$template->set_var('NAME', $group['name']);
125
		$template->set_var('SELECTED', '');
126
		$template->parse('group_list', 'group_list_block', true);
127
	}
128
}
129
// Only allow the user to add a user to the Administrators group if they belong to it
130
if(in_array(1, $admin->get_groups_id())) {
131
	$users_groups = $admin->get_groups_name();
132
	$template->set_var('ID', '1');
133
	$template->set_var('NAME', $users_groups[1]);
134
	$template->set_var('SELECTED', '');
135
	$template->parse('group_list', 'group_list_block', true);
136
} else {
137
	if($results->numRows() == 0) {
138
		$template->set_var('ID', '');
139
		$template->set_var('NAME', $TEXT['NONE_FOUND']);
140
		$template->parse('group_list', 'group_list_block', true);
141
	}
142
}
143

  
144
// Insert permissions values
145
if($admin->get_permission('users_add') != true) {
146
	$template->set_var('DISPLAY_ADD', 'hide');
147
}
148

  
149
// Generate username field name
150
$username_fieldname = 'username_';
151
$salt = "abchefghjkmnpqrstuvwxyz0123456789";
152
srand((double)microtime()*1000000);
153
$i = 0;
154
while ($i <= 7) {
155
	$num = rand() % 33;
156
	$tmp = substr($salt, $num, 1);
157
	$username_fieldname = $username_fieldname . $tmp;
158
	$i++;
159
}
160

  
161
// Work-out if home folder should be shown
162
if(!HOME_FOLDERS) {
163
	$template->set_var('DISPLAY_HOME_FOLDERS', 'display:none;');
164
}
165

  
166
// Include the WB functions file
167
require_once(WB_PATH.'/framework/functions.php');
168

  
169
// Add media folders to home folder list
170
$template->set_block('main_block', 'folder_list_block', 'folder_list');
171
foreach(directory_list(WB_PATH.MEDIA_DIRECTORY) AS $name) {
172
	$template->set_var('NAME', str_replace(WB_PATH, '', $name));
173
	$template->set_var('FOLDER', str_replace(WB_PATH.MEDIA_DIRECTORY, '', $name));
174
	$template->set_var('SELECTED', ' ');
175
	$template->parse('folder_list', 'folder_list_block', true);
176
}
177

  
178
// Insert language text and messages
179
$template->set_var(array(
180
			'TEXT_RESET' => $TEXT['RESET'],
181
			'TEXT_ACTIVE' => $TEXT['ACTIVE'],
182
			'TEXT_DISABLED' => $TEXT['DISABLED'],
183
			'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
184
			'TEXT_USERNAME' => $TEXT['USERNAME'],
185
			'TEXT_PASSWORD' => $TEXT['PASSWORD'],
186
			'TEXT_RETYPE_PASSWORD' => $TEXT['RETYPE_PASSWORD'],
187
			'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'],
188
			'TEXT_EMAIL' => $TEXT['EMAIL'],
189
			'TEXT_GROUP' => $TEXT['GROUP'],
190
			'TEXT_NONE' => $TEXT['NONE'],
191
			'TEXT_HOME_FOLDER' => $TEXT['HOME_FOLDER'],
192
			'USERNAME_FIELDNAME' => $username_fieldname,
193
			'CHANGING_PASSWORD' => $MESSAGE['USERS']['CHANGING_PASSWORD']
194
			)
195
	);
196

  
197
// Parse template for add user form
198
$template->parse('main', 'main_block', false);
199
$template->pparse('output', 'page');
200

  
201
$admin->print_footer();
202

  
1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         users
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

  
20
require('../../config.php');
21
require_once(WB_PATH.'/framework/class.admin.php');
22
$admin = new admin('Access', 'users');
23

  
24
// Create new template object for the modify/remove menu
25
$template = new Template(THEME_PATH.'/templates');
26
$template->set_file('page', 'users.htt');
27
$template->set_block('page', 'main_block', 'main');
28
$template->set_block("main_block", "manage_groups_block", "groups");
29
$template->set_var('ADMIN_URL', ADMIN_URL);
30

  
31
// Get existing value from database
32
// $database = new database();
33
$query = "SELECT user_id, username, display_name FROM ".TABLE_PREFIX."users WHERE user_id != '1' ORDER BY display_name,username";
34
$results = $database->query($query);
35
if($database->is_error()) {
36
	$admin->print_error($database->get_error(), 'index.php');
37
}
38

  
39
// Insert values into the modify/remove menu
40
$template->set_block('main_block', 'list_block', 'list');
41
if($results->numRows() > 0) {
42
	// Insert first value to say please select
43
	$template->set_var('VALUE', '');
44
	$template->set_var('NAME', $TEXT['PLEASE_SELECT'].'...');
45
	$template->parse('list', 'list_block', true);
46
	// Loop through users
47
	while($user = $results->fetchRow()) {
48
		$template->set_var('VALUE', $user['user_id']);
49
		$template->set_var('NAME', $user['display_name'].' ('.$user['username'].')');
50
		$template->parse('list', 'list_block', true);
51
	}
52
} else {
53
	// Insert single value to say no users were found
54
	$template->set_var('NAME', $TEXT['NONE_FOUND']);
55
	$template->parse('list', 'list_block', true);
56
}
57

  
58
// Insert permissions values
59
if($admin->get_permission('users_add') != true) {
60
	$template->set_var('DISPLAY_ADD', 'hide');
61
}
62
if($admin->get_permission('users_modify') != true) {
63
	$template->set_var('DISPLAY_MODIFY', 'hide');
64
}
65
if($admin->get_permission('users_delete') != true) {
66
	$template->set_var('DISPLAY_DELETE', 'hide');
67
}
68

  
69
// Insert language headings
70
$template->set_var(array(
71
		'HEADING_MODIFY_DELETE_USER' => $HEADING['MODIFY_DELETE_USER'],
72
		'HEADING_ADD_USER' => $HEADING['ADD_USER']
73
		)
74
);
75
// insert urls
76
$template->set_var(array(
77
		'ADMIN_URL' => ADMIN_URL,
78
		'WB_URL' => WB_URL,
79
		'WB_PATH' => WB_PATH,
80
		'THEME_URL' => THEME_URL
81
		)
82
);
83
// Insert language text and messages
84
$template->set_var(array(
85
		'TEXT_MODIFY' => $TEXT['MODIFY'],
86
		'TEXT_DELETE' => $TEXT['DELETE'],
87
		'TEXT_MANAGE_GROUPS' => ( $admin->get_permission('groups') == true ) ? $TEXT['MANAGE_GROUPS'] : "**",
88
		'CONFIRM_DELETE' => $MESSAGE['USERS']['CONFIRM_DELETE']
89
		)
90
);
91
if ( $admin->get_permission('groups') == true ) $template->parse("groups", "manage_groups_block", true);
92
// Parse template object
93
$template->parse('main', 'main_block', false);
94
$template->pparse('output', 'page');
95

  
96
// Setup template for add user form
97
$template = new Template(THEME_PATH.'/templates');
98
$template->set_file('page', 'users_form.htt');
99
$template->set_block('page', 'main_block', 'main');
100
$template->set_var('DISPLAY_EXTRA', 'display:none;');
101
$template->set_var('ACTIVE_CHECKED', ' checked="checked"');
102
$template->set_var('ACTION_URL', ADMIN_URL.'/users/add.php');
103
$template->set_var('SUBMIT_TITLE', $TEXT['ADD']);
104
$template->set_var('FTAN', $admin->getFTAN());
105
// insert urls
106
$template->set_var(array(
107
		'ADMIN_URL' => ADMIN_URL,
108
		'WB_URL' => WB_URL,
109
		'WB_PATH' => WB_PATH,
110
		'THEME_URL' => THEME_URL
111
		)
112
);
113

  
114
// Add groups to list
115
$template->set_block('main_block', 'group_list_block', 'group_list');
116
$results = $database->query("SELECT group_id, name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'");
117
if($results->numRows() > 0) {
118
	$template->set_var('ID', '');
119
	$template->set_var('NAME', $TEXT['PLEASE_SELECT'].'...');
120
	$template->set_var('SELECTED', ' selected="selected"');
121
	$template->parse('group_list', 'group_list_block', true);
122
	while($group = $results->fetchRow()) {
123
		$template->set_var('ID', $group['group_id']);
124
		$template->set_var('NAME', $group['name']);
125
		$template->set_var('SELECTED', '');
126
		$template->parse('group_list', 'group_list_block', true);
127
	}
128
}
129
// Only allow the user to add a user to the Administrators group if they belong to it
130
if(in_array(1, $admin->get_groups_id())) {
131
	$users_groups = $admin->get_groups_name();
132
	$template->set_var('ID', '1');
133
	$template->set_var('NAME', $users_groups[1]);
134
	$template->set_var('SELECTED', '');
135
	$template->parse('group_list', 'group_list_block', true);
136
} else {
137
	if($results->numRows() == 0) {
138
		$template->set_var('ID', '');
139
		$template->set_var('NAME', $TEXT['NONE_FOUND']);
140
		$template->parse('group_list', 'group_list_block', true);
141
	}
142
}
143

  
144
// Insert permissions values
145
if($admin->get_permission('users_add') != true) {
146
	$template->set_var('DISPLAY_ADD', 'hide');
147
}
148

  
149
// Generate username field name
150
$username_fieldname = 'username_';
151
$salt = "abchefghjkmnpqrstuvwxyz0123456789";
152
srand((double)microtime()*1000000);
153
$i = 0;
154
while ($i <= 7) {
155
	$num = rand() % 33;
156
	$tmp = substr($salt, $num, 1);
157
	$username_fieldname = $username_fieldname . $tmp;
158
	$i++;
159
}
160

  
161
// Work-out if home folder should be shown
162
if(!HOME_FOLDERS) {
163
	$template->set_var('DISPLAY_HOME_FOLDERS', 'display:none;');
164
}
165

  
166
// Include the WB functions file
167
require_once(WB_PATH.'/framework/functions.php');
168

  
169
// Add media folders to home folder list
170
$template->set_block('main_block', 'folder_list_block', 'folder_list');
171
foreach(directory_list(WB_PATH.MEDIA_DIRECTORY) AS $name) {
172
	$template->set_var('NAME', str_replace(WB_PATH, '', $name));
173
	$template->set_var('FOLDER', str_replace(WB_PATH.MEDIA_DIRECTORY, '', $name));
174
	$template->set_var('SELECTED', ' ');
175
	$template->parse('folder_list', 'folder_list_block', true);
176
}
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff