-
Notifications
You must be signed in to change notification settings - Fork 0
/
move_up.php
46 lines (36 loc) · 1.4 KB
/
move_up.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/*
Module developed for the Open Source Content Management System WebsiteBaker (http://websitebaker.org)
Copyright (C) 2007 - 2017, Christoph Marti
LICENCE TERMS:
This module is free software. You can redistribute it and/or modify it
under the terms of the GNU General Public License - version 2 or later,
as published by the Free Software Foundation: http://www.gnu.org/licenses/gpl.html.
DISCLAIMER:
This module is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
require('../../config.php');
// Get id
if (!isset($_GET['item_id']) OR !is_numeric($_GET['item_id'])) {
header("Location: index.php");
} else {
$id = $_GET['item_id'];
$id_field = 'item_id';
$table = TABLE_PREFIX.'mod_bakery_items';
}
// Include WB admin wrapper script
require(WB_PATH.'/modules/admin.php');
// Include the ordering class
require(WB_PATH.'/framework/class.order.php');
// Create new order object and reorder
$order = new order($table, 'position', $id_field, 'section_id');
if ($order->move_up($id)) {
$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
} else {
$admin->print_error($TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
}
// Print admin footer
$admin->print_footer();