Jakweb.ch stuff
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
clouddesk/include/save_content.php

48 lines
1.7 KiB

1 year ago
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1980 03:10:00 GMT");
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 1.2 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2021 jakweb All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
if (!file_exists('../config.php')) die('include/[save_content.php] config.php not exist');
require_once '../config.php';
if (!isset($_SESSION['jak_lcpc_email'])) die("Nothing to see here");
$formsuc = false;
if (JAK_CLIENTID && $jakclient->getVar("frontendadmin") == 1) {
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_POST) && !empty($_POST)) {
# code...
// Get the page id
$cid = preg_replace("/[^0-9]/", "", $_POST["fieldid"]);
// Get the slug name
$cslug = str_replace($cid, "", $_POST["fieldid"]);
// Clean the content
$val = jak_clean_safe_userpost($_POST["content"]);
if ($jakdb->has("translations", ["AND" => ["opid" => $_SESSION['opid'], "cmsid" => $cid, "cmsslug" => $cslug, "lang" => $BT_LANGUAGE]])) {
$jakdb->update("translations", ["description" => $val], ["AND" => ["opid" => $_SESSION['opid'],"cmsid" => $cid, "cmsslug" => $cslug, "lang" => $BT_LANGUAGE]]);
} else {
$jakdb->insert("translations", ["opid" => $_SESSION['opid'], "description" => $val, "cmsid" => $cid, "cmsslug" => $cslug, "lang" => $BT_LANGUAGE]);
}
// We have stored something
$formsuc = true;
}
}
}
die(json_encode(array("status" => $formsuc)));
?>