74 lines
2.4 KiB
PHP
Executable File
74 lines
2.4 KiB
PHP
Executable File
<?php
|
|
ini_set('display_errors', 0);
|
|
|
|
|
|
//echo $j;
|
|
class modClass
|
|
{
|
|
static function getTovarHars()
|
|
{
|
|
|
|
|
|
//return $har;
|
|
}
|
|
|
|
|
|
|
|
static function saveForm()
|
|
{
|
|
$json = \core::j($_POST);
|
|
$id = \DBmysql::add("INSERT INTO `content` (`json`, `user_id`, `content_type`, `time`) VALUES (?,?,?,?)", [$json, 1, 'tavrz', time()]);
|
|
mkdir('files/' . $_SERVER['SERVER_NAME'] . '/' . $_GET['mod'], 0700);
|
|
mkdir('files/' . $_SERVER['SERVER_NAME'] . '/' . $_GET['mod'] . '/' . $id, 0700);
|
|
if ($_FILES['org_kart']['tmp_name']) {
|
|
copy($_FILES['org_kart']['tmp_name'], 'files/' . $_SERVER['SERVER_NAME'] . '/' . $_GET['mod'] . '/' . $id . '/' . $_FILES['org_kart']['name']);
|
|
$files['org_kart'] = $_FILES['org_kart']['name'];
|
|
}
|
|
if ($_FILES['ob_pasport']['tmp_name']) {
|
|
copy($_FILES['ob_pasport']['tmp_name'], 'files/' . $_SERVER['SERVER_NAME'] . '/' . $_GET['mod'] . '/' . $id . '/' . $_FILES['ob_pasport']['name']);
|
|
$files['ob_pasport'] = $_FILES['ob_pasport']['name'];
|
|
}
|
|
if ($_FILES['ob_foto']['tmp_name']) {
|
|
copy($_FILES['ob_foto']['tmp_name'], 'files/' . $_SERVER['SERVER_NAME'] . '/' . $_GET['mod'] . '/' . $id . '/' . $_FILES['ob_foto']['name']);
|
|
$files['ob_foto'] = $_FILES['ob_foto']['name'];
|
|
}
|
|
if ($_FILES['ob_docs']['tmp_name']) {
|
|
copy($_FILES['ob_docs']['tmp_name'], 'files/' . $_SERVER['SERVER_NAME'] . '/' . $_GET['mod'] . '/' . $id . '/' . $_FILES['ob_docs']['name']);
|
|
$files['ob_docs'] = $_FILES['ob_docs']['name'];
|
|
}
|
|
$_POST['files'] = $files;
|
|
\DBmysql::set("UPDATE `content` SET `json`=? WHERE `id`=? LIMIT 1", [\core::j($_POST), $id]);
|
|
|
|
|
|
|
|
\core::sendemail(E_ADMIN_EMAIL, 'Заявка на обслуживание', 'Ссылка на <a href="https://tavrnt.ru/tavrz/' . $id . '">заявку</a>');
|
|
return $id;
|
|
}
|
|
|
|
|
|
static function getForm()
|
|
{
|
|
$row = \DBmysql::getRow("SELECT `json`, `time` FROM `content` WHERE `id`=? LIMIT 1", $_GET['id']);
|
|
$row['row'] = \core::j($row['json']);
|
|
unset($row['json']);
|
|
// print_r($row);
|
|
return $row;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (@$_POST['ok'])
|
|
$id = modClass::saveForm();
|
|
|
|
if (@$_GET['id']) {
|
|
$row = modClass::getForm();
|
|
$smarty->assign('row', $row);
|
|
}
|
|
|
|
?>
|