Project

General

Profile

« Previous | Next » 

Revision 319

Added by stefan over 18 years ago

Added permission check to admin/pages/add.php to fix ticket #68. Also used get_page_permission, get_user_details, get_page_details in some places.

View differences:

delete.php
40 40
require_once(WB_PATH.'/framework/functions.php');
41 41

  
42 42
// Get perms
43
$results = $database->query("SELECT admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'");
44
$results_array = $results->fetchRow();
43
if (!$admin->get_page_permission($page_id,'admin')) {
44
	$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']);
45
}
45 46

  
46 47
// Find out more about the page
47 48
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'";
......
52 53
if($results->numRows() == 0) {
53 54
	$admin->print_error($MESSAGE['PAGES']['NOT_FOUND']);
54 55
}
56

  
55 57
$results_array = $results->fetchRow();
56
$old_admin_groups = explode(',', str_replace('_', '', $results_array['admin_groups']));
57
$old_admin_users = explode(',', str_replace('_', '', $results_array['admin_users']));
58
if(!is_numeric(array_search($admin->get_group_id(), $old_admin_groups)) AND !is_numeric(array_search($admin->get_user_id(), $old_admin_users))) {
59
	$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']);
60
}
61 58

  
62 59
$visibility = $results_array['visibility'];
63 60

  

Also available in: Unified diff