backup: live-stand vor erstem git-deployment
This commit is contained in:
167
module/image/edit_image.inc.php
Normal file
167
module/image/edit_image.inc.php
Normal file
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
$messages = array();
|
||||
$error = FALSE;
|
||||
if (isset($custom_action)) {
|
||||
$action = $custom_action;
|
||||
} else {
|
||||
$action = $_REQUEST["action"];
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
|
||||
case 'edit_image':
|
||||
edit_image();
|
||||
break;
|
||||
case 'delete_image':
|
||||
delete_image();
|
||||
break;
|
||||
case 'new_image':
|
||||
require_once("edit_image_cardform.inc.php");
|
||||
break;
|
||||
case 'save_image':
|
||||
save_image();
|
||||
break;
|
||||
default:
|
||||
require_once("edit_image_listform.inc.php");
|
||||
break;
|
||||
}
|
||||
|
||||
function edit_image( $_id = "", $messages = array() ) {
|
||||
if ((int)$_id > 0) {
|
||||
$input_id = $_id;
|
||||
} else {
|
||||
$input_id = $_REQUEST["input_id"];
|
||||
}
|
||||
|
||||
if ($input_id <> '') {
|
||||
$query = "SELECT * FROM image_header WHERE id = '" . $input_id . "' LIMIT 1";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
if (@mysqli_num_rows($result) == 1) {
|
||||
$input_image = @mysqli_fetch_array($result);
|
||||
require_once("edit_image_cardform.inc.php");
|
||||
|
||||
}
|
||||
} else {
|
||||
$input_image = array();
|
||||
require_once("edit_image_cardform.inc.php");
|
||||
}
|
||||
}
|
||||
|
||||
function delete_image() {
|
||||
if ($_REQUEST["input_id"] <> '') {
|
||||
$query = "DELETE FROM image_header WHERE id = '" . $_REQUEST["input_id"] . "' LIMIT 1";
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
// zuordnung von Seiten loeschen
|
||||
$query = "DELETE FROM main_page_link WHERE main_sitepart_id = 1 AND main_sitepart_header_id = '" . $_REQUEST["input_id"]."'";
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
|
||||
$query = "DELETE FROM multi_contactform_link WHERE main_sitepart_id = 1 AND main_sitepart_header_id = '" . $_REQUEST["input_id"]."'";
|
||||
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
update_sitepart_changes(1, $_REQUEST["input_id"], TRUE);
|
||||
}
|
||||
require_once("edit_image_listform.inc.php");
|
||||
}
|
||||
|
||||
function save_image() {
|
||||
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$input_id = "";
|
||||
$input_all_languages = ($_POST["input_all_languages"] == "on") ? 1 : 0;
|
||||
|
||||
if ($_REQUEST["input_id"] <> '') {
|
||||
$query = "UPDATE image_header SET
|
||||
description = '" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_description"]) . "',
|
||||
modified_date = " . time() . ",
|
||||
modified_user = " . (int)$GLOBALS["admin_user"]['id'] . ",
|
||||
content = '" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_image"]) . "',
|
||||
all_languages = " . $input_all_languages . "
|
||||
WHERE id = " . $_REQUEST["input_id"] . "
|
||||
LIMIT 1";
|
||||
$inserted = FALSE;
|
||||
$input_id = $_REQUEST["input_id"];
|
||||
} else {
|
||||
$query = "INSERT INTO image_header
|
||||
(main_language_id, description, modified_date, modified_user, content, all_languages)
|
||||
VALUES (
|
||||
'" . $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_image']) . "',
|
||||
" . $input_all_languages . "
|
||||
)";
|
||||
$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("image_msg_success1") . '</div>';
|
||||
} else {
|
||||
$messages[] = '<div class="successbox">' . $translation->get("image_msg_success2") . '</div>';
|
||||
}
|
||||
|
||||
update_sitepart_changes(4, $input_id);
|
||||
|
||||
if (is_page_edit()) {
|
||||
header('EDIT_ERROR: 1'); // verhindern, dass overlay geschlossen wird
|
||||
if (line_already_exists($_REQUEST["input_page_id"], 4, $input_id) === FALSE) {
|
||||
assoc_sitepart(4, $input_id, FALSE);
|
||||
}
|
||||
|
||||
if ($_REQUEST['force_close'] == 1) {
|
||||
edit_content_page();
|
||||
return;
|
||||
}
|
||||
|
||||
edit_image($input_id, $messages);
|
||||
|
||||
} else if(is_contact_edit()){
|
||||
|
||||
header('EDIT_ERROR: 1'); // verhindern, dass overlay geschlossen wird
|
||||
if (line_already_exists($_REQUEST["input_section_id"], 4, $input_id) === FALSE) {
|
||||
|
||||
assoc_sitepart(4, $input_id, FALSE);
|
||||
}
|
||||
|
||||
if ($_REQUEST['force_close'] == 1) {
|
||||
edit_contactform();
|
||||
return;
|
||||
}
|
||||
|
||||
edit_image($input_id, $messages);
|
||||
}
|
||||
elseif (is_component_edit()) {
|
||||
header('EDIT_ERROR: 1'); // verhindern, dass overlay geschlossen wird
|
||||
if (line_already_exists($_REQUEST["input_component_id"], 4, $input_id) === FALSE) {
|
||||
assoc_sitepart(4, $input_id, FALSE);
|
||||
}
|
||||
|
||||
if ($_REQUEST['force_close'] == 1) {
|
||||
edit_component("", $messages);
|
||||
return;
|
||||
}
|
||||
|
||||
edit_image($input_id, $messages);
|
||||
} else {
|
||||
edit_image($input_id, $messages);
|
||||
}
|
||||
|
||||
} else {
|
||||
header('EDIT_ERROR: 1');
|
||||
$input_image["description"] = $_REQUEST["input_description"];
|
||||
$input_image["content"] = $_REQUEST["image"];
|
||||
$input_image["id"] = $_REQUEST["input_id"];
|
||||
$input_image["all_languages"] = $input_all_languages;
|
||||
require_once("edit_image_cardform.inc.php");
|
||||
}
|
||||
}
|
||||
72
module/image/edit_image_cardform.inc.php
Normal file
72
module/image/edit_image_cardform.inc.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$formname = "form_image_card";
|
||||
$input_page_id = (isset($_REQUEST["input_page_id"]) ? $_REQUEST["input_page_id"] : "");
|
||||
$input_component_id = (isset($_REQUEST["input_component_id"]) ? $_REQUEST["input_component_id"] : "");
|
||||
?>
|
||||
|
||||
<div id="overlaycrumb">
|
||||
<?php if ($input_image["id"] == "") {
|
||||
echo $translation->get("new_image");
|
||||
} else {
|
||||
echo $translation->get("edit_image");
|
||||
}
|
||||
?>
|
||||
<div id="closeoverlay" onclick="disableOverlay();"></div>
|
||||
</div>
|
||||
|
||||
<ul class="toolbar_menu">
|
||||
<?php
|
||||
if (is_page_edit() || is_component_edit()) {
|
||||
button("left", $translation->get("back"), $formname, "loadCard('edit_content_page', true)");
|
||||
}
|
||||
?>
|
||||
|
||||
<?= button("save", $translation->get("save"), $formname, "loadCard('save_image', true)"); ?>
|
||||
<?= button("save", $translation->get("save_and_close"), $formname, "loadCard('save_image', true, '', true)"); ?>
|
||||
<li>
|
||||
<ul>
|
||||
<?php
|
||||
if ($input_image["id"] != "" && is_page_edit() === FALSE && is_component_edit() === FALSE) {
|
||||
echo button("delete", $translation->get("delete"), $formname, "loadCard('delete_image', true, '{$translation->get('delete_image_confirm')}', true)", "", FALSE);
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<?php
|
||||
|
||||
if ($messages !== null) {
|
||||
if (count($messages)) {
|
||||
echo '<div id="overlayMessages">' . join("\r\n", $messages) . '</div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
|
||||
<input name="input_id" type="hidden" value="<?= $input_image["id"] ?>">
|
||||
<input name="input_page_id" type="hidden" value="<?= $input_page_id ?>">
|
||||
<input type="hidden" name="input_component_id" value="<?php echo $input_component_id; ?>" />
|
||||
<input name="data-sitepartid" type="hidden" value="4">
|
||||
<input type="hidden" name="get_real_page_link_id" value="1" />
|
||||
|
||||
<table class="cardform" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td>
|
||||
<? input($translation->get("description"), "input_description", "text", $input_image["description"], 255) ?>
|
||||
<!-- <? input($translation->get("show_in_all_languages"), "input_all_languages", "checkbox", $input_image["all_languages"]) ?> -->
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<ul class="toolbar_menu w-100 new">
|
||||
<?= input("", "input_image", "hidden", $input_image['content']); ?>
|
||||
<?= button("new", $translation->get("new"), $formname, "openGallery('input_image', 'image', '')", "", FALSE); ?>
|
||||
</ul>
|
||||
<img id='image' class='sitepart icon' alt='Bild hochladen' src='/userdata/<?= $input_image['content'] ?>?time=<?= time() ?>'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
31
module/image/edit_image_listform.inc.php
Normal file
31
module/image/edit_image_listform.inc.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$formname = "form_image_list";
|
||||
$inputname = "input_id";
|
||||
?>
|
||||
|
||||
<ul class="toolbar_menu">
|
||||
<?= button("new", $translation->get("new"), $formname, "loadCard('new_image', true)"); ?>
|
||||
<?= button("edit", $translation->get("edit"), $formname, "loadCard('edit_image')"); ?>
|
||||
<?= button("delete", $translation->get("delete"), $formname, "sendRequest('delete_image', false, '{$translation->get('delete_image_confirm')}')"); ?>
|
||||
</ul>
|
||||
|
||||
<div id="mainContent">
|
||||
|
||||
<?php echo current_website_language($site, $language); ?>
|
||||
<h1><?php echo get_translation('left_image'); ?></h1>
|
||||
|
||||
<form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
|
||||
<input type="hidden" class="selected_linklist_row" name="input_id" value="" />
|
||||
|
||||
<div class="requestLoader"></div>
|
||||
<?
|
||||
$query = "SELECT image_header.id, description AS '" . $translation->get("description") . "', from_unixtime(modified_date, '%d.%m.%Y %H:%i:%s') AS '" . $translation->get("changed_on") . "', main_admin_user.name AS '" . $translation->get("changed_by") . "' from image_header left join main_admin_user ON image_header.modified_user = main_admin_user.id where (main_language_id = " . (int)$GLOBALS["language"]['id'] . " OR all_languages = 1) and collection_header = 0 order by id asc";
|
||||
$format = array('option', 'text', 'text', 'text');
|
||||
if ($result = @mysqli_query($GLOBALS['mysql_con'], $query)) {
|
||||
linklist($result, $formname, $format, "input_id", "edit_image");
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
8
module/image/image.php
Normal file
8
module/image/image.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?
|
||||
function image_show( $sitepart_id ) {
|
||||
require("show_image.inc.php");
|
||||
}
|
||||
|
||||
function image_edit() {
|
||||
require_once('edit_image.inc.php');
|
||||
}
|
||||
20
module/image/show_image.inc.php
Normal file
20
module/image/show_image.inc.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
$query = "SELECT * FROM image_header WHERE id = '" . $sitepart_id . "' LIMIT 1";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
if (@mysqli_num_rows($result) == 1) {
|
||||
$image = @mysqli_fetch_array($result);
|
||||
|
||||
// Use module path for intranet images
|
||||
if (!empty($image["content"]) && strpos($image["content"], 'intranet') !== false) {
|
||||
$imagePath = '/module/' . ltrim($image["content"], '/');
|
||||
} else {
|
||||
$imagePath = '/userdata/' . ltrim($image["content"], '/');
|
||||
}
|
||||
|
||||
echo "\n<div class=\"imgcontent\">\n";
|
||||
echo "<img loading='lazy' src='" . $imagePath . "'>";
|
||||
echo "</div>\n";
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user