1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category admin
|
5
|
* @package pages
|
6
|
* @author WebsiteBaker Project
|
7
|
* @copyright Ryan Djurovich
|
8
|
* @copyright WebsiteBaker Org. e.V.
|
9
|
* @link http://websitebaker.org/
|
10
|
* @license http://www.gnu.org/licenses/gpl.html
|
11
|
* @platform WebsiteBaker 2.8.3
|
12
|
* @requirements PHP 5.3.6 and higher
|
13
|
* @version $Id: save.php 2 2017-07-02 15:14:29Z Manuela $
|
14
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/trunk/admin/pages/save.php $
|
15
|
* @lastmodified $Date: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
|
16
|
*
|
17
|
*/
|
18
|
/*
|
19
|
*/
|
20
|
// Create new admin object
|
21
|
if ( !defined( 'WB_PATH' ) ){ require( dirname(dirname((__DIR__))).'/config.php' ); }
|
22
|
if ( !class_exists('admin', false) ) { require(WB_PATH.'/framework/class.admin.php'); }
|
23
|
|
24
|
// suppress to print the header, so no new FTAN will be set
|
25
|
$admin = new admin('Pages', 'pages_modify', false);
|
26
|
|
27
|
// Get page & section id
|
28
|
if(!isset($_POST['page_id']) || !is_numeric($_POST['page_id'])) {
|
29
|
header("Location: index.php");
|
30
|
exit(0);
|
31
|
} else {
|
32
|
$page_id = intval($_POST['page_id']);
|
33
|
}
|
34
|
|
35
|
if(!isset($_POST['section_id']) || !is_numeric($_POST['section_id'])) {
|
36
|
header("Location: index.php");
|
37
|
exit(0);
|
38
|
} else {
|
39
|
$section_id = intval($_POST['section_id']);
|
40
|
}
|
41
|
// $js_back = "javascript: history.go(-1);";
|
42
|
$js_back = ADMIN_URL.'/pages/modify.php?page_id='.$page_id;
|
43
|
$bBackLink = isset($_POST['pagetree']);
|
44
|
if ( $bBackLink ) {
|
45
|
$js_back = ADMIN_URL.'/pages/index.php';
|
46
|
}
|
47
|
|
48
|
if (!$admin->checkFTAN())
|
49
|
{
|
50
|
$admin->print_header();
|
51
|
$sInfo = strtoupper(basename(__DIR__).'_'.basename(__FILE__, '.'.PAGE_EXTENSION)).'';
|
52
|
$sDEBUG=(@DEBUG?$sInfo:'');
|
53
|
$admin->print_error($sDEBUG.$MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL );
|
54
|
}
|
55
|
// After check print the header
|
56
|
$admin->print_header();
|
57
|
|
58
|
// Get perms
|
59
|
$sql = 'SELECT `admin_groups`,`admin_users` '
|
60
|
. 'FROM `'.TABLE_PREFIX.'pages` '
|
61
|
. 'WHERE `page_id` = '.$page_id;
|
62
|
$results = $database->query($sql);
|
63
|
$results_array = $results->fetchRow();
|
64
|
if(!$admin->ami_group_member($results_array['admin_users']) &&
|
65
|
!$admin->is_group_match($admin->get_groups_id(), $results_array['admin_groups']))
|
66
|
{
|
67
|
$sInfo = strtoupper(basename(__DIR__).'_'.basename(__FILE__, '.'.PAGE_EXTENSION));
|
68
|
$sDEBUG=(@DEBUG?$sInfo:'');
|
69
|
$admin->print_error($sDEBUG.$MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']);
|
70
|
}
|
71
|
// Get page module
|
72
|
$sql = 'SELECT `module` FROM `'.TABLE_PREFIX.'sections` '
|
73
|
. 'WHERE `page_id`='.$page_id.' AND `section_id`='.$section_id;
|
74
|
$module = $database->get_one($sql);
|
75
|
if(!$module)
|
76
|
{
|
77
|
$admin->print_error( $database->is_error() ? $database->get_error() : $MESSAGE['PAGES_NOT_FOUND']);
|
78
|
}
|
79
|
/*
|
80
|
// Update the pages table
|
81
|
$now = time();
|
82
|
$sql = 'UPDATE `'.TABLE_PREFIX.'pages` '
|
83
|
. 'SET `modified_when`='.$now.', '
|
84
|
. '`modified_by`='.$admin->get_user_id().' '
|
85
|
. 'WHERE `page_id`='.$page_id;
|
86
|
$database->query($sql);
|
87
|
*/
|
88
|
// Include the modules saving script if it exists
|
89
|
if(file_exists(WB_PATH.'/modules/'.$module.'/save.php'))
|
90
|
{
|
91
|
include(WB_PATH.'/modules/'.$module.'/save.php');
|
92
|
}
|
93
|
// Check if there is a db error, otherwise say successful
|
94
|
if($database->is_error())
|
95
|
{
|
96
|
$admin->print_error($database->get_error(), $js_back );
|
97
|
} else {
|
98
|
$admin->print_success($MESSAGE['PAGES_SAVED'], $js_back );
|
99
|
}
|
100
|
|
101
|
// Print admin footer
|
102
|
$admin->print_footer();
|