141 lines
4.2 KiB
PHP
141 lines
4.2 KiB
PHP
|
|
<?
|
||
|
|
|
||
|
|
$messages = array();
|
||
|
|
$error = FALSE;
|
||
|
|
|
||
|
|
|
||
|
|
if (isset($custom_action)) {
|
||
|
|
$action = $custom_action;
|
||
|
|
|
||
|
|
} else {
|
||
|
|
$action = $_REQUEST["action"];
|
||
|
|
}
|
||
|
|
switch ($action) {
|
||
|
|
case 'edit_stufeform':
|
||
|
|
edit_stufeform();
|
||
|
|
break;
|
||
|
|
|
||
|
|
case 'delete_stufeform':
|
||
|
|
delete_stufeform();
|
||
|
|
break;
|
||
|
|
case 'new_stufeform':
|
||
|
|
|
||
|
|
require_once("edit_stufeform_cardform.inc.php");
|
||
|
|
break;
|
||
|
|
|
||
|
|
case 'save_stufeform':
|
||
|
|
save_stufeform();
|
||
|
|
break;
|
||
|
|
|
||
|
|
case 'moveup_line_stufeform':
|
||
|
|
moveup_line_stufeform();
|
||
|
|
require_once("edit_stufe_listform.inc.php");
|
||
|
|
break;
|
||
|
|
case 'movedown_line_stufeform':
|
||
|
|
movedown_line_stufeform();
|
||
|
|
require_once("edit_stufe_listform.inc.php");
|
||
|
|
break;
|
||
|
|
|
||
|
|
default:
|
||
|
|
|
||
|
|
require_once("edit_stufe_listform.inc.php");
|
||
|
|
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
function save_stufeform() {
|
||
|
|
|
||
|
|
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||
|
|
$input_id = "";
|
||
|
|
|
||
|
|
if ($_REQUEST["input_id"] <> '') {
|
||
|
|
$query = "UPDATE stufe SET
|
||
|
|
description = '" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_description"]) . "',
|
||
|
|
short_text = '" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_short_text"]) . "',
|
||
|
|
modified_date = " . time() . ",
|
||
|
|
modified_user = " . (int)$GLOBALS["admin_user"]['id'] . "
|
||
|
|
|
||
|
|
WHERE id = '" . $_REQUEST["input_id"] . "'
|
||
|
|
LIMIT 1";
|
||
|
|
$inserted = FALSE;
|
||
|
|
$input_id = $_REQUEST["input_id"];
|
||
|
|
|
||
|
|
} else {
|
||
|
|
|
||
|
|
$query = "INSERT INTO stufe
|
||
|
|
(main_language_id, description, modified_date, modified_user, short_text)
|
||
|
|
VALUES (
|
||
|
|
" . (int)$GLOBALS["language"]['id'] . ",
|
||
|
|
'" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST['input_description']) . "',
|
||
|
|
" . time() . ",
|
||
|
|
" . (int)$GLOBALS["admin_user"]['id'] . ",
|
||
|
|
'" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST['input_short_text']) . "'
|
||
|
|
)";
|
||
|
|
|
||
|
|
$inserted = TRUE;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (($_REQUEST["input_description"] == '')) {
|
||
|
|
$messages[] = "<div class=\"errorbox\">" . $translation->get("error_description") . "</div>\n";
|
||
|
|
$error = TRUE;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
if (!$error) {
|
||
|
|
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||
|
|
if ($inserted == TRUE) {
|
||
|
|
$input_id = mysqli_insert_id($GLOBALS['mysql_con']);
|
||
|
|
$messages[] = '<div class="successbox">' . $translation->get("stufeform_msg_success1") . '</div>';
|
||
|
|
} else {
|
||
|
|
$messages[] = '<div class="successbox">' . $translation->get("stufeform_msg_success2") . '</div>';
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
edit_stufeform($input_id, $messages);
|
||
|
|
|
||
|
|
|
||
|
|
} else {
|
||
|
|
header('EDIT_ERROR: 1');
|
||
|
|
$input_stufeform["description"] = $_REQUEST["input_description"];
|
||
|
|
$input_stufeform["short_text"] = $_REQUEST["input_short_text"];
|
||
|
|
$input_stufeform["id"] = $_REQUEST["input_id"];
|
||
|
|
require_once("edit_stufeform_cardform.inc.php");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
function edit_stufeform( $_id = "", $messages = array() ) {
|
||
|
|
|
||
|
|
$input_id = '';
|
||
|
|
|
||
|
|
if ((int)$_id > 0) {
|
||
|
|
$input_id = $_id;
|
||
|
|
} if(isset($_REQUEST['input_id']) && $_id == ''){
|
||
|
|
$input_id = $_REQUEST["input_id"];
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
if ($input_id <> '') {
|
||
|
|
$query = "SELECT * FROM stufe WHERE id = '" . $input_id . "' LIMIT 1";
|
||
|
|
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||
|
|
if (@mysqli_num_rows($result) == 1) {
|
||
|
|
$input_stufeform = @mysqli_fetch_array($result);
|
||
|
|
|
||
|
|
require_once("edit_stufeform_cardform.inc.php");
|
||
|
|
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
$input_stufeform = array();
|
||
|
|
|
||
|
|
require_once("edit_stufeform_cardform.inc.php");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
function delete_stufeform() {
|
||
|
|
if ($_REQUEST["input_id"] <> '') {
|
||
|
|
$query = "DELETE FROM stufe WHERE id = '" . $_REQUEST["input_id"] . "' LIMIT 1";
|
||
|
|
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
require_once("edit_stufe_listform.inc.php");
|
||
|
|
}
|
||
|
|
?>
|