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: move_up.php 2 2017-07-02 15:14:29Z Manuela $
|
14
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/trunk/admin/pages/move_up.php $
|
15
|
* @lastmodified $Date: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
|
16
|
*
|
17
|
*/
|
18
|
|
19
|
require('../../config.php');
|
20
|
|
21
|
// Get id
|
22
|
if(isset($_GET['page_id']) AND is_numeric($_GET['page_id'])) {
|
23
|
if(isset($_GET['section_id']) AND is_numeric($_GET['section_id'])) {
|
24
|
$page_id = $_GET['page_id'];
|
25
|
$id = $_GET['section_id'];
|
26
|
$id_field = 'section_id';
|
27
|
$common_field = 'page_id';
|
28
|
$table = TABLE_PREFIX.'sections';
|
29
|
} else {
|
30
|
$id = $_GET['page_id'];
|
31
|
$id_field = 'page_id';
|
32
|
$common_field = 'parent';
|
33
|
$table = TABLE_PREFIX.'pages';
|
34
|
}
|
35
|
} else {
|
36
|
header("Location: index.php");
|
37
|
exit(0);
|
38
|
}
|
39
|
|
40
|
// Create new admin object and print admin header
|
41
|
require_once(WB_PATH.'/framework/class.admin.php');
|
42
|
$admin = new admin('Pages', 'pages_settings');
|
43
|
|
44
|
// Include the ordering class
|
45
|
require(WB_PATH.'/framework/class.order.php');
|
46
|
|
47
|
// Create new order object an reorder
|
48
|
$order = new order($table, 'position', $id_field, $common_field);
|
49
|
if($id_field == 'page_id') {
|
50
|
if($order->move_up($id)) {
|
51
|
$admin->print_success($MESSAGE['PAGES']['REORDERED']);
|
52
|
} else {
|
53
|
$admin->print_error($MESSAGE['PAGES']['CANNOT_REORDER']);
|
54
|
}
|
55
|
} else {
|
56
|
if($order->move_up($id)) {
|
57
|
$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/sections.php?page_id='.$page_id);
|
58
|
} else {
|
59
|
$admin->print_error($TEXT['ERROR'], ADMIN_URL.'/pages/sections.php?page_id='.$page_id);
|
60
|
}
|
61
|
}
|
62
|
|
63
|
// Print admin footer
|
64
|
$admin->print_footer();
|
65
|
|
66
|
?>
|