Revision 1384
Added by Dietmar over 13 years ago
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 |
?> |
Also available in: Unified diff
Security fix in admin/pages