backup: live-stand vor erstem git-deployment
This commit is contained in:
132
module/languageswitch/edit_language_switch.inc.php
Normal file
132
module/languageswitch/edit_language_switch.inc.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
$messages = array();
|
||||
$error = FALSE;
|
||||
if (isset($custom_action)) {
|
||||
$action = $custom_action;
|
||||
} else {
|
||||
$action = $_REQUEST["action"];
|
||||
}
|
||||
switch ($action) {
|
||||
|
||||
case 'edit_language_switch':
|
||||
edit_language_switch();
|
||||
break;
|
||||
case 'delete_language_switch':
|
||||
delete_language_switch();
|
||||
break;
|
||||
case 'new_language_switch':
|
||||
require_once("edit_language_switch_cardform.inc.php");
|
||||
break;
|
||||
case 'save_language_switch':
|
||||
save_language_switch();
|
||||
break;
|
||||
|
||||
default:
|
||||
require_once("edit_language_switch_listform.inc.php");
|
||||
break;
|
||||
}
|
||||
|
||||
function edit_language_switch( $_id = "", $messages = array() ) {
|
||||
if ((int)$_id > 0) {
|
||||
$input_id = $_id;
|
||||
} else {
|
||||
$input_id = $_REQUEST["input_id"];
|
||||
}
|
||||
|
||||
if ($input_id <> '') {
|
||||
$query = "SELECT * FROM main_shop_language_switch WHERE id = '" . $input_id . "' LIMIT 1";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
if (@mysqli_num_rows($result) == 1) {
|
||||
$language_switch_sitepart = @mysqli_fetch_array($result);
|
||||
require_once("edit_language_switch_cardform.inc.php");
|
||||
}
|
||||
} else {
|
||||
require_once("edit_language_switch_cardform.inc.php");
|
||||
}
|
||||
}
|
||||
|
||||
function delete_language_switch() {
|
||||
if ($_REQUEST["input_id"] <> '') {
|
||||
$query = "DELETE FROM main_shop_language_switch 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);
|
||||
|
||||
update_sitepart_changes(17, $_REQUEST["input_id"], TRUE);
|
||||
}
|
||||
require_once("edit_language_switch_listform.inc.php");
|
||||
}
|
||||
|
||||
function save_language_switch() {
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$input_id = "";
|
||||
if ((int)$_REQUEST["input_id"] > 0) {
|
||||
$query = "UPDATE main_shop_language_switch SET
|
||||
description = '" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST['input_description']) . "',
|
||||
modified_date = FROM_UNIXTIME (" . 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 main_shop_language_switch
|
||||
(main_language_id, description, modified_date, modified_user)
|
||||
VALUES (
|
||||
'" . $GLOBALS["language"]['id'] . "',
|
||||
'" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST['input_description']) . "',
|
||||
FROM_UNIXTIME (" . time() . "),
|
||||
" . (int)$GLOBALS["admin_user"]['id'] . "
|
||||
)";
|
||||
$inserted = 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("language_switch_msg_success1") . '</div>';
|
||||
} else {
|
||||
$messages[] = '<div class="successbox">' . $translation->get("language_switch_msg_success2") . '</div>';
|
||||
}
|
||||
|
||||
update_sitepart_changes(17, $input_id);
|
||||
|
||||
if (is_page_edit()) {
|
||||
header('EDIT_ERROR: 1'); // verhindern, dass overlay geschlossen wird
|
||||
if (line_already_exists($_REQUEST["input_page_id"], 17, $input_id) === FALSE) {
|
||||
assoc_sitepart(17, $input_id, FALSE);
|
||||
}
|
||||
|
||||
if ($_REQUEST['force_close'] == 1) {
|
||||
require_once("edit_page_line_listform.inc.php");
|
||||
return;
|
||||
}
|
||||
|
||||
edit_language_switch($input_id, $messages);
|
||||
|
||||
} elseif (is_component_edit()) {
|
||||
header('EDIT_ERROR: 1'); // verhindern, dass overlay geschlossen wird
|
||||
if (line_already_exists($_REQUEST["input_component_id"], 17, $input_id) === FALSE) {
|
||||
assoc_sitepart(17, $input_id, FALSE);
|
||||
}
|
||||
|
||||
if ($_REQUEST['force_close'] == 1) {
|
||||
edit_component("", $messages);
|
||||
return;
|
||||
}
|
||||
|
||||
edit_language_switch($input_id, $messages);
|
||||
} else {
|
||||
edit_language_switch($input_id, $messages);
|
||||
}
|
||||
|
||||
} else {
|
||||
header('EDIT_ERROR: 1');
|
||||
$input_language_switch["type"] = $_REQUEST["input_type"];
|
||||
$input_language_switch["id"] = $_REQUEST["input_id"];
|
||||
require_once("edit_language_switch_cardform.inc.php");
|
||||
}
|
||||
}
|
||||
68
module/languageswitch/edit_language_switch_cardform.inc.php
Normal file
68
module/languageswitch/edit_language_switch_cardform.inc.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$formname = "form_language_switch_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"] : "");
|
||||
$input_language_switch = $language_switch_sitepart;
|
||||
?>
|
||||
|
||||
<div id="overlaycrumb">
|
||||
<?php if (empty($input_language_switch["id"])) {
|
||||
echo $translation->get("new_language_switch");
|
||||
} else {
|
||||
echo $translation->get("edit_language_switch");
|
||||
}
|
||||
?>
|
||||
<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_language_switch', true)"); ?>
|
||||
|
||||
|
||||
<?= button("save", $translation->get("save_and_close"), $formname, "loadCard('save_language_switch', true, '', true)"); ?>
|
||||
<li>
|
||||
<ul>
|
||||
<?php
|
||||
if ($input_language_switch["id"] != "" && is_page_edit() === FALSE && is_component_edit() === FALSE) {
|
||||
echo button("delete", $translation->get("delete"), $formname, "loadCard('delete_language_switch', true, '{$translation->get('delete_language_switch_confirm')}', true)", "", FALSE);
|
||||
}
|
||||
?>
|
||||
<?= button("reset", $translation->get("restore"), $formname, "?action=edit_iframe", "", FALSE); ?>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<?php
|
||||
if ($messages !== null) {
|
||||
if (count($messages)) {
|
||||
echo '<div id="overlayMessages">' . join("\r\n", $messages) . '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
$input_description = (empty($input_language_switch['description']) ? $translation->get('webshop_language_switch') : $input_language_switch['description']);
|
||||
?>
|
||||
|
||||
<form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
|
||||
<input name="input_id" type="hidden" value="<?= $input_language_switch["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="17">
|
||||
<input type="hidden" name="get_real_page_link_id" value="1" />
|
||||
<table class="cardform" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td>
|
||||
<div class='label'><label for="input_description"><?= $translation->get('description') ?></label></div>
|
||||
<div class='input'><input type="text" name="input_description" id="input_description"
|
||||
value="<?= $input_description ?>" class="text"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
45
module/languageswitch/edit_language_switch_listform.inc.php
Normal file
45
module/languageswitch/edit_language_switch_listform.inc.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$formname = "form_langauge_switch_list";
|
||||
$inputname = "input_id";
|
||||
?>
|
||||
|
||||
<ul class="toolbar_menu">
|
||||
<?= button("new", $translation->get("new"), $formname, "loadCard('new_langauge_switch', true)"); ?>
|
||||
<?= button("edit", $translation->get("edit"), $formname, "loadCard('edit_langauge_switch')"); ?>
|
||||
<?= button("delete", $translation->get("delete"), $formname, "sendRequest('delete_langauge_switch', false, '{$translation->get('delete_langauge_switch_confirm')}')"); ?>
|
||||
</ul>
|
||||
|
||||
<div id="mainContent">
|
||||
|
||||
<?php echo current_website_language($site, $language); ?>
|
||||
<h1><?php echo get_translation('left_text'); ?></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
|
||||
main_shop_langauge_switch.id,
|
||||
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
|
||||
main_shop_langauge_switch
|
||||
INNER JOIN
|
||||
main_admin_user
|
||||
ON
|
||||
main_shop_langauge_switch.modified_user = main_admin_user.id
|
||||
WHERE
|
||||
main_language_id = " . (int)$GLOBALS["language"]['id'] . "
|
||||
AND
|
||||
collection_header = 0
|
||||
ORDER BY id ASC";
|
||||
//echo $query;
|
||||
$format = array('option', 'text', 'text', 'text', 'text');
|
||||
if ($result = @mysqli_query($GLOBALS['mysql_con'], $query)) {
|
||||
linklist($result, $formname, $format, "input_id", "edit_langauge_switch");
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
</div>
|
||||
116
module/languageswitch/language_switch.php
Normal file
116
module/languageswitch/language_switch.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?
|
||||
function language_switch_show($sitepart_id)
|
||||
{
|
||||
$pdoHost = getenv('MAIN_MYSQL_DB_HOST');
|
||||
$pdoPort = getenv('MAIN_MYSQL_DB_PORT');
|
||||
$pdoUser = getenv('MAIN_MYSQL_DB_USER');
|
||||
$pdoPass = getenv('MAIN_MYSQL_DB_PASS');
|
||||
$pdoSchema = getenv('MAIN_MYSQL_DB_SCHEMA');
|
||||
|
||||
$pdo = new \DynCom\mysyde\common\classes\PDOQueryWrapper($pdoHost, $pdoPort, $pdoSchema, $pdoUser, $pdoPass);
|
||||
|
||||
$currentMainSiteId = $GLOBALS['site']['id'];
|
||||
$prepStatement = '
|
||||
SELECT
|
||||
id,
|
||||
code,
|
||||
name,
|
||||
std_main_navigation_id,
|
||||
related_language_codes
|
||||
FROM
|
||||
main_language
|
||||
WHERE
|
||||
main_site_id = :mainSiteId
|
||||
AND
|
||||
active = 1
|
||||
';
|
||||
|
||||
$params = [
|
||||
[':mainSiteId', $currentMainSiteId, PDO::PARAM_STR],
|
||||
];
|
||||
$pdo->setQuery($prepStatement);
|
||||
$pdo->prepareQuery();
|
||||
$pdo->bindParameters($params);
|
||||
$pdo->executePreparedStatement();
|
||||
$siteLanguagesArray = $pdo->getResultArray();
|
||||
$languageListHtml = '';
|
||||
$currentLanguageId = $GLOBALS['language']['id'];
|
||||
if (count($siteLanguagesArray) > 1) // the site has more than 1 language
|
||||
{
|
||||
$selectedList = '';
|
||||
$languageOptionListHtml = '';
|
||||
if (isset($_SESSION['selectedLanguageId']) && $_SESSION['selectedLanguageId'] != '') {
|
||||
for ($i = 0; $i < count($siteLanguagesArray); $i++) {
|
||||
|
||||
$mainNavigation = get_main_navigation_code($siteLanguagesArray[$i]['std_main_navigation_id'], $pdo);
|
||||
|
||||
if ($mainNavigation[0]['code'] != '') {
|
||||
$url = '/' . $GLOBALS['site']['code'] . '/' . $siteLanguagesArray[$i]['code'] . '/' . $mainNavigation[0]['code'] . '/';
|
||||
} else {
|
||||
$url = '/' . $GLOBALS['site']['code'] . '/' . $siteLanguagesArray[$i]['code'] . '/';
|
||||
}
|
||||
|
||||
|
||||
if ($siteLanguagesArray[$i]['id'] == $currentLanguageId) {
|
||||
$selectedList = ' <li class="active"><a href="' . $url . '">' . $siteLanguagesArray[$i]['name'] . '</a></li> ';
|
||||
} else {
|
||||
$languageOptionListHtml .= ' <li><a href="' . $url . '">' . $siteLanguagesArray[$i]['name'] . '</a></li> ';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for ($i = 0; $i < count($siteLanguagesArray); $i++) {
|
||||
|
||||
|
||||
$mainNavigation = get_main_navigation_code($siteLanguagesArray[$i]['std_main_navigation_id'], $pdo);
|
||||
|
||||
if ($mainNavigation[0]['code'] != '') {
|
||||
$url = '/' . $GLOBALS['site']['code'] . '/' . $siteLanguagesArray[$i]['code'] . '/' . $mainNavigation[0]['code'] . '/';
|
||||
} else {
|
||||
$url = '/' . $GLOBALS['site']['code'] . '/' . $siteLanguagesArray[$i]['code'] . '/';
|
||||
}
|
||||
|
||||
if ($siteLanguagesArray[$i]['id'] == $currentLanguageId) {
|
||||
$selectedList = ' <li class="active"><a href="' . $url . '">' . $siteLanguagesArray[$i]['name'] . '</a></li> ';
|
||||
} else {
|
||||
$languageOptionListHtml .= ' <li><a href="' . $url . '">' . $siteLanguagesArray[$i]['name'] . '</a></li> ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$languageListHtml = '<div class="language_switch">
|
||||
<a href="#" class="language_switch_button">
|
||||
'.$GLOBALS['tc']['language_switch_button'].' <i class="fa fa-angle-down" aria-hidden="true"></i>
|
||||
</a>
|
||||
<div class="list_language_switch"><ul id="language_switch" name ="list_language_switch">' . $selectedList . $languageOptionListHtml . '</ul></div></div>';
|
||||
}
|
||||
echo $languageListHtml;
|
||||
|
||||
}
|
||||
|
||||
function language_switch_edit()
|
||||
{
|
||||
require_once("edit_language_switch.inc.php");
|
||||
}
|
||||
|
||||
function get_main_navigation_code($mainNavigationId, $pdo)
|
||||
{
|
||||
$prepStatement = '
|
||||
SELECT
|
||||
code
|
||||
FROM
|
||||
main_navigation
|
||||
WHERE
|
||||
id = :mainNavigationId
|
||||
';
|
||||
|
||||
$params = [
|
||||
[':mainNavigationId', $mainNavigationId, PDO::PARAM_STR],
|
||||
];
|
||||
$pdo->setQuery($prepStatement);
|
||||
$pdo->prepareQuery();
|
||||
$pdo->bindParameters($params);
|
||||
$pdo->executePreparedStatement();
|
||||
$mainNavigation = $pdo->getResultArray();
|
||||
return $mainNavigation;
|
||||
}
|
||||
Reference in New Issue
Block a user