-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsorter.php
More file actions
65 lines (57 loc) · 1.78 KB
/
Copy pathsorter.php
File metadata and controls
65 lines (57 loc) · 1.78 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* kitForm
*
* @author Ralf Hertsch <ralf.hertsch@phpmanufaktur.de>
* @link http://phpmanufaktur.de
* @copyright 2011 - 2012
* @license MIT License (MIT) http://www.opensource.org/licenses/MIT
*/
// Mindestparameter gesetzt?
if (!isset($_POST['rowID']) || !isset($_POST['sorter_table']) ||
!isset($_POST['sorter_value']) || !is_numeric($_POST['sorter_value'])) exit();
// Sorter ausgeschaltet?
if (isset($_POST['sorter_active']) && ($_POST['sorter_active'] == 0)) exit();
require_once('../../config.php');
require_once(WB_PATH.'/framework/initialize.php');
global $database;
/**
* Sanitize a text variable and prepare it for saving in a MySQL record
*
* @param string $text
* @return string
*/
function sanitizeText ($text)
{
$search = array("<",">","\"","'","\\","\x00","\n","\r","'",'"',"\x1a");
$replace = array("<",">",""","'","\\\\","\\0","\\n","\\r","\'",'\"',"\\Z");
return str_replace($search, $replace, $text);
}
$sorter_table = sanitizeText($_POST['sorter_table']);
switch ($sorter_table):
case 'mod_kit_form':
// Frageboegen sortieren
$ids = $_POST['rowID'];
if (!is_array($ids)) {
exit();
}
foreach ($ids as $id) {
if (!is_numeric($id)) {
exit();
}
}
$rowIDs = implode(',', $ids);
$sorter_value = $_POST['sorter_value'];
$SQL = sprintf( "UPDATE %smod_kit_form_table_sort SET sort_order='%s' WHERE sort_table='%s' AND sort_value='%s'",
TABLE_PREFIX, $rowIDs, $sorter_table, $sorter_value);
$database->query($SQL);
if ($database->is_error()) {
echo $database->get_error();
}
else {
echo "Sorted: $rowIDs";
}
break;
default:
echo "no handling defined for: ".$_POST['sorter_table'];
endswitch;