Revision 1384
Added by Luisehahne about 14 years ago
branches/2.8.x/CHANGELOG | ||
---|---|---|
11 | 11 |
! = Update/Change |
12 | 12 |
|
13 | 13 |
------------------------------------- 2.8.2 ------------------------------------- |
14 |
16 Jan-2011 Build 1384 Dietmar Woellbrink (Luisehahne) |
|
15 |
! Security fix in admin/pages |
|
14 | 16 |
15 Jan-2011 Build 1383 Frank Heyne (FrankH) |
15 | 17 |
# Security fix for news module |
16 | 18 |
# Some more Security fixes, thanks to Gerben van Veenendaal |
branches/2.8.x/wb/admin/pages/save.php | ||
---|---|---|
17 | 17 |
*/ |
18 | 18 |
|
19 | 19 |
// Get page & section id |
20 |
if(!isset($_POST['page_id']) OR !is_numeric($_POST['page_id'])) {
|
|
20 |
if(!isset($_POST['page_id']) || !is_numeric($_POST['page_id'])) {
|
|
21 | 21 |
header("Location: index.php"); |
22 | 22 |
exit(0); |
23 | 23 |
} else { |
24 | 24 |
$page_id = intval($_POST['page_id']); |
25 | 25 |
} |
26 |
if(!isset($_POST['section_id']) OR !is_numeric($_POST['section_id'])) {
|
|
26 |
if(!isset($_POST['section_id']) || !is_numeric($_POST['section_id'])) {
|
|
27 | 27 |
header("Location: index.php"); |
28 | 28 |
exit(0); |
29 | 29 |
} else { |
... | ... | |
34 | 34 |
require('../../config.php'); |
35 | 35 |
require_once(WB_PATH.'/framework/class.admin.php'); |
36 | 36 |
$admin = new admin('Pages', 'pages_modify'); |
37 |
|
|
37 | 38 |
if (!$admin->checkFTAN()) |
38 | 39 |
{ |
39 |
$admin->print_error($MESSAGE['PAGES_NOT_SAVED'],'index.php');
|
|
40 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
|
|
40 | 41 |
exit(); |
41 | 42 |
} |
42 | 43 |
|
... | ... | |
55 | 56 |
$in_old_group = TRUE; |
56 | 57 |
} |
57 | 58 |
} |
58 |
if((!$in_old_group) AND !is_numeric(array_search($admin->get_user_id(), $old_admin_users)))
|
|
59 |
if((!$in_old_group) && !is_numeric(array_search($admin->get_user_id(), $old_admin_users)))
|
|
59 | 60 |
{ |
60 | 61 |
$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']); |
61 | 62 |
} |
branches/2.8.x/wb/admin/pages/settings.php | ||
---|---|---|
17 | 17 |
*/ |
18 | 18 |
|
19 | 19 |
// Get page id |
20 |
if(!isset($_GET['page_id']) OR !is_numeric($_GET['page_id']))
|
|
20 |
if(!isset($_GET['page_id']) || !is_numeric($_GET['page_id']))
|
|
21 | 21 |
{ |
22 | 22 |
header("Location: index.php"); |
23 | 23 |
exit(0); |
... | ... | |
56 | 56 |
$in_old_group = TRUE; |
57 | 57 |
} |
58 | 58 |
} |
59 |
if((!$in_old_group) AND !is_numeric(array_search($admin->get_user_id(), $old_admin_users)))
|
|
59 |
if((!$in_old_group) && !is_numeric(array_search($admin->get_user_id(), $old_admin_users)))
|
|
60 | 60 |
{ |
61 | 61 |
$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']); |
62 | 62 |
} |
... | ... | |
103 | 103 |
'MODIFIED_WHEN' => $modified_ts, |
104 | 104 |
'ADMIN_URL' => ADMIN_URL, |
105 | 105 |
'WB_URL' => WB_URL, |
106 |
'WB_PATH' => WB_PATH, |
|
107 | 106 |
'THEME_URL' => THEME_URL |
108 | 107 |
) |
109 | 108 |
); |
branches/2.8.x/wb/admin/pages/delete.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/pages/add.php $ |
|
15 |
* @lastmodified $Date: 2011-01-10 13:14:10 +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 |
if(!isset($_GET['page_id']) OR !is_numeric($_GET['page_id'])) {
|
|
20 |
if(!isset($_GET['page_id']) || !is_numeric($_GET['page_id'])) {
|
|
28 | 21 |
header("Location: index.php"); |
29 | 22 |
exit(0); |
30 | 23 |
} else { |
... | ... | |
38 | 31 |
|
39 | 32 |
// Include the WB functions file |
40 | 33 |
require_once(WB_PATH.'/framework/functions.php'); |
41 |
|
|
34 |
/* |
|
35 |
if (!$admin->checkIDKEY('page_id', 0, 'GET')) |
|
36 |
{ |
|
37 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']); |
|
38 |
exit(); |
|
39 |
} |
|
40 |
*/ |
|
42 | 41 |
// Get perms |
43 | 42 |
if (!$admin->get_page_permission($page_id,'admin')) { |
44 | 43 |
$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']); |
branches/2.8.x/wb/admin/pages/sections_save.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/pages/sections.php $ |
|
15 |
* @lastmodified $Date: 2011-01-10 13:14:10 +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 |
// Include config file |
27 | 20 |
require('../../config.php'); |
28 | 21 |
|
... | ... | |
35 | 28 |
require_once(WB_PATH."/include/jscalendar/jscalendar-functions.php"); |
36 | 29 |
|
37 | 30 |
// Get page id |
38 |
if(!isset($_GET['page_id']) OR !is_numeric($_GET['page_id'])) {
|
|
31 |
if(!isset($_GET['page_id']) || !is_numeric($_GET['page_id'])) {
|
|
39 | 32 |
header("Location: index.php"); |
40 | 33 |
exit(0); |
41 | 34 |
} else { |
... | ... | |
45 | 38 |
// Create new admin object |
46 | 39 |
require_once(WB_PATH.'/framework/class.admin.php'); |
47 | 40 |
$admin = new admin('Pages', 'pages_modify'); |
41 |
|
|
48 | 42 |
if (!$admin->checkFTAN()) |
49 | 43 |
{ |
50 |
$admin->print_error($MESSAGE['PAGES_NOT_SAVED'],'index.php');
|
|
44 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
|
|
51 | 45 |
exit(); |
52 | 46 |
} |
53 | 47 |
|
... | ... | |
63 | 57 |
$in_old_group = TRUE; |
64 | 58 |
} |
65 | 59 |
} |
66 |
if((!$in_old_group) AND !is_numeric(array_search($admin->get_user_id(), $old_admin_users))) {
|
|
60 |
if((!$in_old_group) && !is_numeric(array_search($admin->get_user_id(), $old_admin_users))) {
|
|
67 | 61 |
$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']); |
68 | 62 |
} |
69 | 63 |
|
70 | 64 |
// Get page details |
71 |
$database = new database(); |
|
65 |
// $database = new database();
|
|
72 | 66 |
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'"; |
73 | 67 |
$results = $database->query($query); |
74 | 68 |
if($database->is_error()) { |
... | ... | |
94 | 88 |
$section_id = $section['section_id']; |
95 | 89 |
$sql = ''; $publ_start = 0; $publ_end = 0; |
96 | 90 |
$dst = date("I")?" DST":""; // daylight saving time? |
97 |
if(isset($_POST['block'.$section_id]) AND $_POST['block'.$section_id] != '') {
|
|
91 |
if(isset($_POST['block'.$section_id]) && $_POST['block'.$section_id] != '') {
|
|
98 | 92 |
$sql = "block = '".$admin->add_slashes($_POST['block'.$section_id])."'"; |
99 | 93 |
} |
100 | 94 |
// update publ_start and publ_end, trying to make use of the strtotime()-features like "next week", "+1 month", ... |
101 |
if(isset($_POST['start_date'.$section_id]) AND isset($_POST['end_date'.$section_id])) {
|
|
102 |
if(trim($_POST['start_date'.$section_id]) == '0' OR trim($_POST['start_date'.$section_id]) == '') {
|
|
95 |
if(isset($_POST['start_date'.$section_id]) && isset($_POST['end_date'.$section_id])) {
|
|
96 |
if(trim($_POST['start_date'.$section_id]) == '0' || trim($_POST['start_date'.$section_id]) == '') {
|
|
103 | 97 |
$publ_start = 0; |
104 | 98 |
} else { |
105 | 99 |
$publ_start = jscalendar_to_timestamp($_POST['start_date'.$section_id]); |
106 | 100 |
} |
107 |
if(trim($_POST['end_date'.$section_id]) == '0' OR trim($_POST['end_date'.$section_id]) == '') {
|
|
101 |
if(trim($_POST['end_date'.$section_id]) == '0' || trim($_POST['end_date'.$section_id]) == '') {
|
|
108 | 102 |
$publ_end = 0; |
109 | 103 |
} else { |
110 | 104 |
$publ_end = jscalendar_to_timestamp($_POST['end_date'.$section_id], $publ_start); |
... | ... | |
130 | 124 |
|
131 | 125 |
// Print admin footer |
132 | 126 |
$admin->print_footer(); |
133 |
|
|
134 |
?> |
branches/2.8.x/wb/admin/pages/settings2.php | ||
---|---|---|
17 | 17 |
*/ |
18 | 18 |
|
19 | 19 |
// Get page id |
20 |
if(!isset($_POST['page_id']) OR !is_numeric($_POST['page_id']))
|
|
20 |
if(!isset($_POST['page_id']) || !is_numeric($_POST['page_id']))
|
|
21 | 21 |
{ |
22 | 22 |
header("Location: index.php"); |
23 | 23 |
exit(0); |
... | ... | |
29 | 29 |
require('../../config.php'); |
30 | 30 |
require_once(WB_PATH.'/framework/class.admin.php'); |
31 | 31 |
$admin = new admin('Pages', 'pages_settings'); |
32 |
|
|
32 | 33 |
if (!$admin->checkFTAN()) |
33 | 34 |
{ |
34 |
$admin->print_error($MESSAGE['PAGES_NOT_SAVED'],'index.php');
|
|
35 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
|
|
35 | 36 |
exit(); |
36 | 37 |
} |
37 | 38 |
|
... | ... | |
41 | 42 |
// Get values |
42 | 43 |
$page_title = htmlspecialchars($admin->get_post_escaped('page_title') ); |
43 | 44 |
$menu_title = htmlspecialchars($admin->get_post_escaped('menu_title') ); |
44 |
$page_code = $admin->get_post_escaped('page_code'); |
|
45 |
$page_code = (int) $admin->get_post_escaped('page_code');
|
|
45 | 46 |
$description = htmlspecialchars($admin->add_slashes($admin->get_post('description')) ); |
46 | 47 |
$keywords = htmlspecialchars($admin->add_slashes($admin->get_post('keywords')) ); |
47 |
$parent = $admin->get_post_escaped('parent');
|
|
48 |
$parent = (int) $admin->get_post_escaped('parent'); // fix secunia 2010-91-3
|
|
48 | 49 |
$visibility = $admin->get_post_escaped('visibility'); |
49 |
$template = $admin->get_post_escaped('template'); |
|
50 |
$target = $admin->get_post_escaped('target'); |
|
50 |
if (!in_array($visibility, array('public', 'private', 'registered', 'hidden', 'none'))) {$visibility = 'public';} // fix secunia 2010-93-3 |
|
51 |
$template = preg_replace("/\W/", "", $admin->get_post_escaped('template')); // fix secunia 2010-93-3 |
|
52 |
$target = preg_replace("/\W/", "", $admin->get_post_escaped('target')); |
|
51 | 53 |
$admin_groups = $admin->get_post_escaped('admin_groups'); |
52 | 54 |
$viewing_groups = $admin->get_post_escaped('viewing_groups'); |
53 | 55 |
$searching = $admin->get_post_escaped('searching'); |
54 |
$language = $admin->get_post_escaped('language'); |
|
55 |
$menu = $admin->get_post_escaped('menu'); |
|
56 |
$language = strtoupper($admin->get_post('language')); |
|
57 |
$language = (preg_match('/^[A-Z]{2}$/', $language) ? $language : DEFAULT_LANGUAGE); |
|
58 |
$menu = (int) $admin->get_post_escaped('menu'); // fix secunia 2010-91-3 |
|
56 | 59 |
|
57 | 60 |
// Validate data |
58 | 61 |
if($page_title == '' || substr($page_title,0,1)=='.') |
... | ... | |
90 | 93 |
$in_old_group = TRUE; |
91 | 94 |
} |
92 | 95 |
} |
93 |
if((!$in_old_group) AND !is_numeric(array_search($admin->get_user_id(), $old_admin_users)))
|
|
96 |
if((!$in_old_group) && !is_numeric(array_search($admin->get_user_id(), $old_admin_users)))
|
|
94 | 97 |
{ |
95 | 98 |
$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']); |
96 | 99 |
} |
... | ... | |
100 | 103 |
//if(!in_array(1, $admin->get_groups_id())) { |
101 | 104 |
// $admin_groups[] = implode(",",$admin->get_groups_id()); |
102 | 105 |
//} |
103 |
$admin_groups = implode(',', $admin_groups);
|
|
106 |
$admin_groups = preg_replace("/[^\d,]/", "", implode(',', $admin_groups));
|
|
104 | 107 |
// Setup viewing groups |
105 | 108 |
$viewing_groups[] = 1; |
106 | 109 |
//if(!in_array(1, $admin->get_groups_id())) { |
107 | 110 |
// $viewing_groups[] = implode(",",$admin->get_groups_id()); |
108 | 111 |
//} |
109 |
$viewing_groups = implode(',', $viewing_groups);
|
|
112 |
$viewing_groups = preg_replace("/[^\d,]/", "", implode(',', $viewing_groups));
|
|
110 | 113 |
|
111 | 114 |
// If needed, get new order |
112 | 115 |
if($parent != $old_parent) |
... | ... | |
233 | 236 |
// Create access file |
234 | 237 |
create_access_file($filename,$page_id,$level); |
235 | 238 |
// Move a directory for this page |
236 |
if(file_exists(WB_PATH.PAGES_DIRECTORY.$old_link.'/') AND is_dir(WB_PATH.PAGES_DIRECTORY.$old_link.'/'))
|
|
239 |
if(file_exists(WB_PATH.PAGES_DIRECTORY.$old_link.'/') && is_dir(WB_PATH.PAGES_DIRECTORY.$old_link.'/'))
|
|
237 | 240 |
{ |
238 | 241 |
rename(WB_PATH.PAGES_DIRECTORY.$old_link.'/', WB_PATH.PAGES_DIRECTORY.$link.'/'); |
239 | 242 |
} |
branches/2.8.x/wb/admin/pages/sections.php | ||
---|---|---|
27 | 27 |
} |
28 | 28 |
|
29 | 29 |
// Get page id |
30 |
if(!isset($_GET['page_id']) OR !is_numeric($_GET['page_id']))
|
|
30 |
if(!isset($_GET['page_id']) || !is_numeric($_GET['page_id']))
|
|
31 | 31 |
{ |
32 | 32 |
header("Location: index.php"); |
33 | 33 |
exit(0); |
... | ... | |
42 | 42 |
$admin = new admin('Pages', 'pages_modify'); |
43 | 43 |
|
44 | 44 |
// Check if we are supposed to add or delete a section |
45 |
if(isset($_GET['section_id']) AND is_numeric($_GET['section_id']))
|
|
45 |
if(isset($_GET['section_id']) && is_numeric($_GET['section_id']))
|
|
46 | 46 |
{ |
47 | 47 |
// Get more information about this section |
48 | 48 |
$section_id = $_GET['section_id']; |
... | ... | |
157 | 157 |
require($template_location); |
158 | 158 |
} |
159 | 159 |
// Check if $menu is set |
160 |
if(!isset($block[1]) OR $block[1] == '')
|
|
160 |
if(!isset($block[1]) || $block[1] == '')
|
|
161 | 161 |
{ |
162 | 162 |
// Make our own menu list |
163 | 163 |
$block[1] = $TEXT['MAIN']; |
... | ... | |
197 | 197 |
'TEXT_ACTIONS' => $TEXT['ACTIONS'], |
198 | 198 |
'ADMIN_URL' => ADMIN_URL, |
199 | 199 |
'WB_URL' => WB_URL, |
200 |
'WB_PATH' => WB_PATH, |
|
201 | 200 |
'THEME_URL' => THEME_URL |
202 | 201 |
) |
203 | 202 |
); |
branches/2.8.x/wb/admin/pages/add.php | ||
---|---|---|
23 | 23 |
|
24 | 24 |
if (!$admin->checkFTAN()) |
25 | 25 |
{ |
26 |
$admin->print_error($MESSAGE['PAGES_NOT_SAVED'],'index.php');
|
|
26 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
|
|
27 | 27 |
exit(); |
28 | 28 |
} |
29 | 29 |
|
... | ... | |
33 | 33 |
// Get values |
34 | 34 |
$title = $admin->get_post_escaped('title'); |
35 | 35 |
$title = htmlspecialchars($title); |
36 |
$module = $admin->get_post('type');
|
|
37 |
$parent = $admin->get_post('parent');
|
|
36 |
$module = preg_replace("/\W/", "", $admin->get_post('type')); // fix secunia 2010-93-4
|
|
37 |
$parent = (int) $admin->get_post('parent'); // fix secunia 2010-91-2
|
|
38 | 38 |
$visibility = $admin->get_post('visibility'); |
39 |
if (!in_array($visibility, array('public', 'private', 'registered', 'hidden', 'none'))) {$visibility = 'public';} // fix secunia 2010-91-2 |
|
39 | 40 |
$admin_groups = $admin->get_post('admin_groups'); |
40 | 41 |
$viewing_groups = $admin->get_post('viewing_groups'); |
41 | 42 |
|
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', '1383');
|
|
55 |
if(!defined('REVISION')) define('REVISION', '1384');
|
|
56 | 56 |
|
57 | 57 |
?> |
branches/2.8.x/wb/modules/admin.php | ||
---|---|---|
5 | 5 |
* @package modules |
6 | 6 |
* @author WebsiteBaker Project |
7 | 7 |
* @copyright 2004-2009, Ryan Djurovich |
8 |
* @copyright 2009-2011, Website Baker Org. e.V.
|
|
8 |
* @copyright 2009-2010, Website Baker Org. e.V.
|
|
9 | 9 |
* @link http://www.websitebaker2.org/ |
10 | 10 |
* @license http://www.gnu.org/licenses/gpl.html |
11 |
* @platform WebsiteBaker 2.9.x
|
|
11 |
* @platform WebsiteBaker 2.8.x
|
|
12 | 12 |
* @requirements PHP 5.2.2 and higher |
13 | 13 |
* @version $Id$ |
14 | 14 |
* @filesource $HeadURL$ |
15 | 15 |
* @lastmodified $Date$ |
16 | 16 |
* |
17 |
*/
|
|
17 |
*/ |
|
18 | 18 |
|
19 | 19 |
// Stop this file being access directly |
20 | 20 |
if(!defined('WB_URL')) { |
... | ... | |
23 | 23 |
} |
24 | 24 |
|
25 | 25 |
// Get page id |
26 |
if(isset($_GET['page_id']) && is_numeric($_GET['page_id'])) |
|
27 |
{ |
|
26 |
if(isset($_GET['page_id']) && is_numeric($_GET['page_id'])) { |
|
28 | 27 |
$page_id = (int)$_GET['page_id']; |
29 |
} elseif(isset($_POST['page_id']) && is_numeric($_POST['page_id'])) |
|
30 |
{ |
|
28 |
} elseif(isset($_POST['page_id']) && is_numeric($_POST['page_id'])) { |
|
31 | 29 |
$page_id = (int)$_POST['page_id']; |
32 | 30 |
} else { |
33 | 31 |
header("Location: index.php"); |
... | ... | |
35 | 33 |
} |
36 | 34 |
|
37 | 35 |
// Get section id if there is one |
38 |
if(isset($_GET['section_id']) && is_numeric($_GET['section_id'])) |
|
39 |
{ |
|
36 |
if(isset($_GET['section_id']) && is_numeric($_GET['section_id'])) { |
|
40 | 37 |
$section_id = (int)$_GET['section_id']; |
41 |
} elseif(isset($_POST['section_id']) && is_numeric($_POST['section_id'])) |
|
42 |
{ |
|
38 |
} elseif(isset($_POST['section_id']) && is_numeric($_POST['section_id'])) { |
|
43 | 39 |
$section_id = (int)$_POST['section_id']; |
44 | 40 |
} else { |
45 | 41 |
// Check if we should redirect the user if there is no section id |
46 |
if(!isset($section_required)) |
|
47 |
{ |
|
42 |
if(!isset($section_required)) { |
|
48 | 43 |
$section_id = 0; |
49 | 44 |
} else { |
50 | 45 |
header("Location: $section_required"); |
... | ... | |
56 | 51 |
$js_back = 'javascript: history.go(-1);'; |
57 | 52 |
|
58 | 53 |
// Create new admin object |
59 |
include(WB_PATH.'/framework/class.admin.php'); |
|
60 |
// header will be set here, see database->is_error |
|
54 |
require(WB_PATH.'/framework/class.admin.php'); |
|
61 | 55 |
$admin = new admin('Pages', 'pages_modify'); |
62 | 56 |
|
63 | 57 |
// Get perms |
64 |
$sql = 'SELECT `admin_groups`,`admin_users` FROM `'.TABLE_PREFIX.'pages` '; |
|
65 |
$sql .= 'WHERE `page_id` = '.intval($page_id); |
|
66 |
$ok = false; |
|
67 |
if( ($res_pages = $database->query($sql)) ) |
|
68 |
{ |
|
69 |
if( ($rec_pages = $res_pages->fetchRow()) ) |
|
70 |
{ |
|
71 |
if( $admin->ami_group_member($rec_pages['admin_groups']) || $admin->ami_group_member($rec_pages['admin_users']) ) |
|
72 |
{ |
|
73 |
$ok = true; |
|
74 |
} |
|
75 |
} |
|
58 |
// $database = new database(); |
|
59 |
$results = $database->query("SELECT admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'"); |
|
60 |
$results_array = $results->fetchRow(); |
|
61 |
$old_admin_groups = explode(',', str_replace('_', '', $results_array['admin_groups'])); |
|
62 |
$old_admin_users = explode(',', str_replace('_', '', $results_array['admin_users'])); |
|
63 |
|
|
64 |
$in_group = FALSE; |
|
65 |
foreach($admin->get_groups_id() as $cur_gid){ |
|
66 |
if (in_array($cur_gid, $old_admin_groups)) { |
|
67 |
$in_group = TRUE; |
|
68 |
} |
|
76 | 69 |
} |
77 |
if( !$ok ) { $admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']); } |
|
70 |
if((!$in_group) && !is_numeric(array_search($admin->get_user_id(), $old_admin_users))) { |
|
71 |
echo $admin->get_group_id().$admin->get_user_id(); |
|
72 |
print_r ($old_admin_groups); |
|
73 |
$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']); |
|
74 |
} |
|
78 | 75 |
|
79 |
//$old_admin_groups = explode(',', str_replace('_', '', $rec_pages['admin_groups'])); |
|
80 |
//$old_admin_users = explode(',', str_replace('_', '', $rec_pages['admin_users'])); |
|
81 |
// |
|
82 |
//$in_group = FALSE; |
|
83 |
//foreach($admin->get_groups_id() as $cur_gid) |
|
84 |
//{ |
|
85 |
// if (in_array($cur_gid, $old_admin_groups)) |
|
86 |
// { |
|
87 |
// $in_group = TRUE; |
|
88 |
// } |
|
89 |
//} |
|
90 |
//if((!$in_group) && !is_numeric(array_search($admin->get_user_id(), $old_admin_users))) |
|
91 |
//{ |
|
92 |
// $admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']); |
|
93 |
//} |
|
94 |
|
|
95 | 76 |
// Workout if the developer wants to show the info banner |
96 |
if(isset($print_info_banner) && $print_info_banner == true) |
|
97 |
{ |
|
98 |
// Get page details |
|
99 |
$sql = 'SELECT `page_id`,`page_title`,`modified_by`,`modified_when` FROM `'.TABLE_PREFIX.'pages` '; |
|
100 |
$sql .= 'WHERE `page_id` = '.intval($page_id); |
|
101 |
$res_pages = $database->query($sql); |
|
102 |
if($database->is_error()) |
|
103 |
{ |
|
104 |
// $admin->print_header(); don't know why |
|
105 |
$admin->print_error($database->get_error()); |
|
106 |
} |
|
107 |
if($res_pages->numRows() == 0) |
|
108 |
{ |
|
109 |
// $admin->print_header(); don't know why |
|
110 |
$admin->print_error($MESSAGE['PAGES']['NOT_FOUND']); |
|
111 |
} else { |
|
112 |
$rec_pages = $res_pages->fetchRow(); |
|
113 |
} |
|
77 |
if(isset($print_info_banner) && $print_info_banner == true) { |
|
78 |
|
|
79 |
// Get page details |
|
80 |
// $database = new database(); |
|
81 |
$query = "SELECT page_id,page_title,modified_by,modified_when FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'"; |
|
82 |
$results = $database->query($query); |
|
83 |
if($database->is_error()) { |
|
84 |
$admin->print_header(); |
|
85 |
$admin->print_error($database->get_error()); |
|
86 |
} |
|
87 |
if($results->numRows() == 0) { |
|
88 |
$admin->print_header(); |
|
89 |
$admin->print_error($MESSAGE['PAGES']['NOT_FOUND']); |
|
90 |
} |
|
91 |
$results_array = $results->fetchRow(); |
|
114 | 92 |
|
115 |
// Get display name of person who last modified the page
|
|
116 |
$user = $admin->get_user_details($rec_pages['modified_by']);
|
|
93 |
// Get display name of person who last modified the page |
|
94 |
$user=$admin->get_user_details($results_array['modified_by']);
|
|
117 | 95 |
|
118 |
// Convert the unix ts for modified_when to human a readable form |
|
119 |
if($rec_pages['modified_when'] != 0) |
|
120 |
{ |
|
121 |
$modified_ts = gmdate(TIME_FORMAT.', '.DATE_FORMAT, $rec_pages['modified_when']+TIMEZONE); |
|
122 |
} else { |
|
123 |
$modified_ts = 'Unknown'; |
|
124 |
} |
|
96 |
// Convert the unix ts for modified_when to human a readable form |
|
97 |
if($results_array['modified_when'] != 0) { |
|
98 |
$modified_ts = gmdate(TIME_FORMAT.', '.DATE_FORMAT, $results_array['modified_when']+TIMEZONE); |
|
99 |
} else { |
|
100 |
$modified_ts = 'Unknown'; |
|
101 |
} |
|
125 | 102 |
|
126 |
// Include page info script |
|
127 |
$template = new Template(THEME_PATH.'/templates'); |
|
128 |
$template->set_file('page', 'pages_modify.htt'); |
|
129 |
$template->set_block('page', 'main_block', 'main'); |
|
130 |
$template->set_var(array( |
|
131 |
'PAGE_ID' => $rec_pages['page_id'], |
|
132 |
'PAGE_TITLE' => ($rec_pages['page_title']), |
|
133 |
'MODIFIED_BY' => $user['display_name'], |
|
134 |
'MODIFIED_BY_USERNAME' => $user['username'], |
|
135 |
'MODIFIED_WHEN' => $modified_ts, |
|
136 |
'ADMIN_URL' => ADMIN_URL |
|
137 |
)); |
|
103 |
// Include page info script |
|
104 |
$template = new Template(THEME_PATH.'/templates'); |
|
105 |
$template->set_file('page', 'pages_modify.htt'); |
|
106 |
$template->set_block('page', 'main_block', 'main'); |
|
107 |
$template->set_var(array( |
|
108 |
'PAGE_ID' => $results_array['page_id'], |
|
109 |
'PAGE_TITLE' => ($results_array['page_title']), |
|
110 |
'MODIFIED_BY' => $user['display_name'], |
|
111 |
'MODIFIED_BY_USERNAME' => $user['username'], |
|
112 |
'MODIFIED_WHEN' => $modified_ts, |
|
113 |
'ADMIN_URL' => ADMIN_URL |
|
114 |
) |
|
115 |
); |
|
116 |
if($modified_ts == 'Unknown') { |
|
117 |
$template->set_var('DISPLAY_MODIFIED', 'hide'); |
|
118 |
} else { |
|
119 |
$template->set_var('DISPLAY_MODIFIED', ''); |
|
120 |
} |
|
138 | 121 |
|
139 |
$template->set_block('main_block', 'show_modify_block', 'show_modify');
|
|
140 |
if($modified_ts == 'Unknown')
|
|
141 |
{
|
|
142 |
$template->set_block('show_modify', '');
|
|
143 |
$template->set_var('CLASS_DISPLAY_MODIFIED', 'hide');
|
|
144 |
} else {
|
|
145 |
$template->set_var('CLASS_DISPLAY_MODIFIED', '');
|
|
146 |
$template->parse('show_modify', 'show_modify_block', true);
|
|
147 |
}
|
|
122 |
// Work-out if we should show the "manage sections" link
|
|
123 |
$query_sections = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'menu_link'");
|
|
124 |
if($query_sections->numRows() > 0) {
|
|
125 |
$template->set_var('DISPLAY_MANAGE_SECTIONS', 'none');
|
|
126 |
} elseif(MANAGE_SECTIONS == 'enabled') {
|
|
127 |
$template->set_var('TEXT_MANAGE_SECTIONS', $HEADING['MANAGE_SECTIONS']);
|
|
128 |
} else {
|
|
129 |
$template->set_var('DISPLAY_MANAGE_SECTIONS', 'none');
|
|
130 |
} |
|
148 | 131 |
|
149 |
$template->set_block('main_block', 'show_section_block', 'show_section'); |
|
150 |
// Work-out if we should show the "manage sections" link |
|
151 |
$sql = 'SELECT `section_id` FROM `'.TABLE_PREFIX.'sections` '; |
|
152 |
$sql .= 'WHERE `page_id` = '.intval($page_id).' AND `module` = "menu_link"'; |
|
153 |
if( ( $res_sections = $database->query($sql) ) && ($database->is_error() == false ) ) |
|
154 |
{ |
|
155 |
if($res_sections->numRows() > 0) |
|
156 |
{ |
|
157 |
$template->set_block('show_section', ''); |
|
158 |
$template->set_var('DISPLAY_MANAGE_SECTIONS', 'none'); |
|
159 |
}elseif(MANAGE_SECTIONS == 'enabled') |
|
160 |
{ |
|
161 |
$template->set_var('TEXT_MANAGE_SECTIONS', $HEADING['MANAGE_SECTIONS']); |
|
162 |
$template->parse('show_section', 'show_section_block', true); |
|
163 |
}else { |
|
164 |
$template->set_block('show_section', ''); |
|
165 |
$template->set_var('DISPLAY_MANAGE_SECTIONS', 'none'); |
|
166 |
} |
|
167 |
} else { |
|
168 |
$admin->print_error($database->get_error()); |
|
169 |
} |
|
132 |
// Insert language TEXT |
|
133 |
$template->set_var(array( |
|
134 |
'TEXT_CURRENT_PAGE' => $TEXT['CURRENT_PAGE'], |
|
135 |
'TEXT_CHANGE' => $TEXT['CHANGE'], |
|
136 |
'LAST_MODIFIED' => $MESSAGE['PAGES']['LAST_MODIFIED'], |
|
137 |
'TEXT_CHANGE_SETTINGS' => $TEXT['CHANGE_SETTINGS'], |
|
138 |
'HEADING_MODIFY_PAGE' => $HEADING['MODIFY_PAGE'] |
|
139 |
) |
|
140 |
); |
|
170 | 141 |
|
171 |
// Insert language TEXT |
|
172 |
$template->set_var(array( |
|
173 |
'TEXT_CURRENT_PAGE' => $TEXT['CURRENT_PAGE'], |
|
174 |
'TEXT_CHANGE' => $TEXT['CHANGE'], |
|
175 |
'LAST_MODIFIED' => $MESSAGE['PAGES']['LAST_MODIFIED'], |
|
176 |
'TEXT_CHANGE_SETTINGS' => $TEXT['CHANGE_SETTINGS'], |
|
177 |
'HEADING_MODIFY_PAGE' => $HEADING['MODIFY_PAGE'] |
|
178 |
)); |
|
142 |
// Parse and print header template |
|
143 |
$template->parse('main', 'main_block', false); |
|
144 |
$template->pparse('output', 'page'); |
|
179 | 145 |
|
180 |
// Parse and print header template |
|
181 |
$template->parse('main', 'main_block', false); |
|
182 |
$template->pparse('output', 'page'); |
|
183 | 146 |
} |
184 | 147 |
|
185 | 148 |
// Work-out if the developer wants us to update the timestamp for when the page was last modified |
186 |
if(isset($update_when_modified) && $update_when_modified == true) |
|
187 |
{ |
|
188 |
$sql = 'UPDATE `'.TABLE_PREFIX.'pages` '; |
|
189 |
$sql .= 'SET `modified_when` = '.time().', '; |
|
190 |
$sql .= '`modified_by` = '.intval($admin->get_user_id()).' '; |
|
191 |
$sql .= 'WHERE page_id = '.intval($page_id); |
|
192 |
$database->query($sql); |
|
149 |
if(isset($update_when_modified) && $update_when_modified == true) { |
|
150 |
$database->query("UPDATE ".TABLE_PREFIX."pages SET modified_when = '".time()."', modified_by = '".$admin->get_user_id()."' WHERE page_id = '$page_id'"); |
|
193 | 151 |
} |
194 | 152 |
|
195 |
?> |
|
153 |
?> |
Also available in: Unified diff
Security fix in admin/pages