2022-12-11 13:55:49 +05:00
|
|
|
|
<?php
|
2023-04-09 19:52:26 +05:00
|
|
|
|
|
2023-08-14 09:15:58 +05:00
|
|
|
|
ini_set('display_errors', 0);
|
2023-04-09 19:52:26 +05:00
|
|
|
|
|
2023-08-14 09:15:58 +05:00
|
|
|
|
if ($_SESSION['dostup'] !== 'a' && $_SESSION['dostup'] !== 'e') header('Location: /login/');
|
|
|
|
|
$_SESSION['id']=$_GET['id'];
|
|
|
|
|
$smarty->assign('editor', 'api/modules/page_edit/editor.html');
|
|
|
|
|
$smarty->assign('editor_js', '<script language="javascript" type="text/javascript" src="/api/soft/tinymce/4.3.12/tinymce.min.js"></script><script language="javascript" type="text/javascript" src="/api/soft/tinymce/4.3.12/load.php"></script>');
|
2023-04-09 19:52:26 +05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-14 09:15:58 +05:00
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
14.12.2022
|
|
|
|
|
Получаем инфу о пользователе
|
|
|
|
|
---------------------------------------------------------------------- */
|
2023-04-09 19:52:26 +05:00
|
|
|
|
|
2023-08-14 09:15:58 +05:00
|
|
|
|
$smarty->assign('userInfo', \core::getUserInfo($_SESSION['user_id']));
|
2023-04-09 19:52:26 +05:00
|
|
|
|
|
2023-08-14 09:15:58 +05:00
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
07.01.20223
|
|
|
|
|
Получаем список категорий
|
|
|
|
|
---------------------------------------------------------------------- */
|
2023-04-09 19:52:26 +05:00
|
|
|
|
|
2023-08-14 09:15:58 +05:00
|
|
|
|
$smarty->assign('pages_category', \DB::getAll("SELECT * FROM `pages_category` WHERE `status`=1"));
|
|
|
|
|
//print_r($_POST);
|
|
|
|
|
if (@$_POST) {
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
07.01.20223
|
|
|
|
|
Принимаем входящие данные
|
|
|
|
|
---------------------------------------------------------------------- */
|
2023-04-09 19:52:26 +05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-14 09:15:58 +05:00
|
|
|
|
switch (@$_POST['act']) {
|
2023-04-09 19:52:26 +05:00
|
|
|
|
|
2023-08-14 09:15:58 +05:00
|
|
|
|
case 'save':
|
2023-01-14 21:17:46 +05:00
|
|
|
|
|
2023-08-14 09:15:58 +05:00
|
|
|
|
\DB::set("UPDATE `pages` SET
|
|
|
|
|
`title`=?, `txt`=?, `t`=?, `keywords`=?, `alias`=?, `description`=?, `category`=?, `user_id`=?, `d`=? WHERE `id`=?", array(
|
|
|
|
|
$_POST['title'], $_POST['txt'],
|
|
|
|
|
time(), $_POST['keywords'],
|
|
|
|
|
$_POST['alias'], $_POST['description'],
|
|
|
|
|
$_POST['category'], $_SESSION['user_id'],
|
|
|
|
|
$_POST['d'], $_GET['id']
|
|
|
|
|
)
|
|
|
|
|
);
|
2023-01-25 14:20:32 +05:00
|
|
|
|
|
2022-12-11 13:55:49 +05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-14 09:15:58 +05:00
|
|
|
|
break;
|
2022-12-11 13:55:49 +05:00
|
|
|
|
|
|
|
|
|
|
2023-08-14 09:15:58 +05:00
|
|
|
|
case 'new':
|
|
|
|
|
$id = \DB::add("INSERT INTO `pages` (`title`, `txt`, `t`, `keywords`, `alias`, `description`, `category`, `user_id`, `d`, `status`) VALUES (?,?,?,?,?,?,?,?,?,1)", array(
|
2023-01-25 14:20:32 +05:00
|
|
|
|
$_POST['title'], $_POST['txt'],
|
|
|
|
|
time(), $_POST['keywords'],
|
|
|
|
|
$_POST['alias'], $_POST['description'], $_POST['category'], $_SESSION['user_id'], $_POST['d']
|
2023-08-14 09:15:58 +05:00
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
header('Location: /page_edit/' . $id);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2023-01-14 21:17:46 +05:00
|
|
|
|
}
|
|
|
|
|
|
2023-04-09 19:52:26 +05:00
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
02.04.20223
|
|
|
|
|
Получаем список картинок
|
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-14 09:15:58 +05:00
|
|
|
|
if ($_GET['id']) {
|
2023-04-09 19:52:26 +05:00
|
|
|
|
|
2023-08-14 09:15:58 +05:00
|
|
|
|
$page = \DB::getAll("SELECT * FROM `pages` WHERE `id`=? LIMIT 1", $_GET['id']);
|
|
|
|
|
$smarty->assign('page', $page);
|
2023-04-09 19:52:26 +05:00
|
|
|
|
|
2023-08-14 09:15:58 +05:00
|
|
|
|
$img = \DB::getAll("SELECT * FROM `pages_img` WHERE `page_id`=?", $_GET['id']);
|
|
|
|
|
$smarty->assign('img', $img);
|
2023-04-09 19:52:26 +05:00
|
|
|
|
}
|
2023-08-14 09:15:58 +05:00
|
|
|
|
?>
|