Project

General

Profile

« Previous | Next » 

Revision 1493

Added by Dietmar almost 13 years ago

Ticket #1106 FatalError in groups module

View differences:

branches/2.8.x/CHANGELOG
12 12

  
13 13
=============================== FEATURES FREEZE ================================
14 14
----------------------------------- Fixes 2.8.2 --------------------------------
15
11 Aug-2011 Build 1493 Dietmar Woellbrink (Luisehahne)
16
# Ticket #1106 FatalError in groups module
15 17
11 Aug-2011 Build 1492 Dietmar Woellbrink (Luisehahne)
16 18
# Ticket #1107 Deleting users not possible
17 19
  Change handling, first user will be set to inactive
branches/2.8.x/wb/admin/groups/save.php
29 29
	$admin->print_header();
30 30
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$js_back);
31 31
}
32
// After check print the header
33
$admin->print_header();
34 32

  
35 33
// Check if group group_id is a valid number and doesnt equal 1
36
if(!isset($_POST['group_id']) OR !is_numeric($_POST['group_id']) OR $_POST['group_id'] == 1) {
37
	header("Location: index.php");
38
	exit(0);
39
} else {
40
	$group_id = $_POST['group_id'];
34
$group_id = intval($admin->checkIDKEY('group_id', 0, $_SERVER['REQUEST_METHOD']));
35
if( ($group_id < 2 ) )
36
{
37
	// if($admin_header) { $admin->print_header(); }
38
	$admin->print_header();
39
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'] );
41 40
}
42 41

  
43 42
// Gather details entered
......
47 46
if($group_name == "") {
48 47
	$admin->print_error($MESSAGE['GROUPS']['GROUP_NAME_BLANK'], $js_back);
49 48
}
49
// After check print the header
50
$admin->print_header();
50 51

  
51 52
// Get system permissions
52 53
require_once(ADMIN_PATH.'/groups/get_permissions.php');
53 54

  
54 55
// Update the database
55
$query = "UPDATE ".TABLE_PREFIX."groups SET name = '$group_name', system_permissions = '$system_permissions', module_permissions = '$module_permissions', template_permissions = '$template_permissions' WHERE group_id = '$group_id'";
56
$query = "UPDATE `".TABLE_PREFIX."groups` SET `name` = '$group_name', `system_permissions` = '$system_permissions', `module_permissions` = '$module_permissions', `template_permissions` = '$template_permissions' WHERE `group_id` = '$group_id'";
56 57

  
57 58
$database->query($query);
58 59
if($database->is_error()) {
branches/2.8.x/wb/admin/groups/groups.php
23 23
// Set parameter 'action' as alternative to javascript mechanism
24 24
$action = 'cancel';
25 25
// Set parameter 'action' as alternative to javascript mechanism
26
$action = (isset($_POST['action']) && ($_POST['action'] ='modify')   ? 'modify' : $action );
26 27
$action = (isset($_POST['modify']) ? 'modify' : $action );
27 28
$action = (isset($_POST['delete']) ? 'delete' : $action );
28 29

  
......
33 34
			$admin = new admin('Access', 'groups_modify' );
34 35
			// Check if group group_id is a valid number and doesnt equal 1
35 36
			$group_id = intval($admin->checkIDKEY('group_id', 0, $_SERVER['REQUEST_METHOD']));
37
            if($group_id == 0){
38
				$admin->print_error($MESSAGE['USERS_NO_GROUP'] );
39
            }
36 40
			if( ($group_id < 2 ) )
37 41
			{
38 42
				// if($admin_header) { $admin->print_header(); }
......
49 53
			$template->set_var(	array(
50 54
									'ACTION_URL' => ADMIN_URL.'/groups/save.php',
51 55
									'SUBMIT_TITLE' => $TEXT['SAVE'],
52
									'GROUP_ID' => $group['group_id'],
56
									'GROUP_ID' => $admin->getIDKEY($group['group_id']),
53 57
									'GROUP_NAME' => $group['name'],
54
									'ADVANCED_ACTION' => 'groups.php',
58
									'ADVANCED_LINK' => 'groups.php',
55 59
									'FTAN' => $admin->getFTAN()
56 60
								));
57 61
			// Tell the browser whether or not to show advanced options
......
155 159
			// Parse template object
156 160
			$template->parse('main', 'main_block', false);
157 161
			$template->pparse('output', 'page');
158
			break;
162
			// Print admin footer
163
			$admin->print_footer();			break;
159 164
		case 'delete' :
160 165
			// Create new admin object
161 166
			$admin = new admin('Access', 'groups_delete');
162 167
			$group_id = intval($admin->checkIDKEY('group_id', 0, $_SERVER['REQUEST_METHOD']));
168
            if($group_id == 0){
169
				$admin->print_error($MESSAGE['USERS_NO_GROUP'] );
170
            }
163 171
			// Check if user id is a valid number and doesnt equal 1
164 172
			if( ($group_id < 2 ) )
165 173
			{
......
169 177
			// Print header
170 178
			$admin->print_header();
171 179
			// Delete the group
172
			$database->query("DELETE FROM ".TABLE_PREFIX."groups WHERE group_id = '".$group_id."' LIMIT 1");
180
			$database->query("DELETE FROM `".TABLE_PREFIX."groups` WHERE `group_id` = '".$group_id."' LIMIT 1");
173 181
			if($database->is_error()) {
174 182
				$admin->print_error($database->get_error());
175 183
			} else {
176 184
				// Delete users in the group
177
				$database->query("DELETE FROM ".TABLE_PREFIX."users WHERE group_id = '".$group_id."'");
185
				$database->query("DELETE FROM `".TABLE_PREFIX."users` WHERE `group_id` = '".$group_id."'");
178 186
				if($database->is_error()) {
179 187
					$admin->print_error($database->get_error());
180 188
				} else {
181 189
					$admin->print_success($MESSAGE['GROUPS']['DELETED']);
182 190
				}
183 191
			}
192
			// Print admin footer
193
			$admin->print_footer();
184 194
			break;
185 195
	default:
186 196
			break;
187 197
endswitch;
188

  
189
// Print admin footer
190
$admin->print_footer();
branches/2.8.x/wb/admin/groups/index.php
100 100
$template->set_var('DISPLAY_EXTRA', 'display:none;');
101 101
$template->set_var('ACTION_URL', ADMIN_URL.'/groups/add.php');
102 102
$template->set_var('SUBMIT_TITLE', $TEXT['ADD']);
103
$template->set_var('ADVANCED_ACTION', 'index.php');
103
$template->set_var('ADVANCED_LINK', 'index.php');
104 104

  
105 105
// Tell the browser whether or not to show advanced options
106 106
if ( true == (isset( $_POST['advanced']) AND ( strpos( $_POST['advanced'], ">>") > 0 ) ) ) {
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');
55
if(!defined('REVISION')) define('REVISION', '1492');
55
if(!defined('REVISION')) define('REVISION', '1493');
branches/2.8.x/wb/templates/wb_theme/templates/groups_form.htt
271 271
</tr>
272 272

  
273 273
<tr>
274
	<td colspan="2"><input type="submit" name="submit" value="{SUBMIT_TITLE}" /></td>
274
	<td colspan="2"><input type="submit" name="save" value="{SUBMIT_TITLE}" /></td>
275 275
    <td colspan="2" align="right"><input type="reset" name="reset" value="{TEXT_RESET}" /></td>
276 276
</tr>
277 277
</table>
......
280 280
<table summary="" cellpadding="5" cellspacing="0" border="0" width="100%">
281 281
<tr>
282 282
	<td align="center">
283
	<form name="advanced" action="{ADVANCED_ACTION}" method="post">
283
	<form name="advanced" action="{ADVANCED_LINK}" method="post">
284
		<input type="hidden" name="advanced" value="{ADVANCED}" />
284 285
        <input type="hidden" name="group_id" value="{GROUP_ID}" />
285 286
        <input type="hidden" name="action" value="modify" />
286 287
		{FTAN}
branches/2.8.x/wb/templates/wb_theme/templates/groups.htt
1 1
<!-- BEGIN main_block -->
2 2

  
3 3
<form name="groups" action="groups.php" method="post">
4
<input type="hidden" name="action" value="delete" />
5 4
{FTAN}
6 5
<table summary=""  cellpadding="0" cellspacing="0" border="0" width="100%">
7 6
<tr>
branches/2.8.x/wb/templates/argos_theme/templates/groups.htt
1 1
<!-- BEGIN main_block -->
2 2

  
3 3
<form name="groups" action="groups.php" method="post">
4
  <input type="hidden" name="action" value="delete" />
5
 {FTAN}  
4
 {FTAN}
6 5
  <table summary="" cellpadding="5" cellspacing="0" border="0" align="center" width="100%" style="margin-bottom:10px;">
7 6
	<tr style="background:#f0f0f0;">
8 7
		<td align="left"><h2>{HEADING_MODIFY_DELETE_GROUP}</h2></td>
branches/2.8.x/wb/templates/argos_theme/templates/groups_form.htt
251 251
<tr style="text-align:center;width:100%">
252 252
    <td>&nbsp;</td>
253 253
	<td style="text-align:right;">
254
		<input type="submit" name="submit" value="{SUBMIT_TITLE}" />
254
		<input type="submit" name="save" value="{SUBMIT_TITLE}" />
255 255
	</td>
256 256
	<td style="text-align:left;">
257 257
		<input type="reset" name="reset" value="{TEXT_RESET}" />
......
262 262
</form>
263 263

  
264 264

  
265
<form name="advanced" action="{ADVANCED_ACTION}" method="post">
265
<form name="advanced" action="{ADVANCED_LINK}" method="post">
266 266
<input type="hidden" name="group_id" value="{GROUP_ID}" />
267 267
<input type="hidden" name="action" value="modify" />
268 268
{FTAN}

Also available in: Unified diff