core/api/modules/page_all/ajax.php

66 lines
2.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
//проверяем кто мы
$access=0;
if ($_SESSION['dostup']=='a')$access=1;
if ($_SESSION['dostup']=='u')$access=1;
if ($access==0)die("Нет прав");
switch(@$_POST['act']) {
/* ----------------------------------------------------------------------
02.04.2023
Удаляем страницу
+++ сделать удаление изображений
---------------------------------------------------------------------- */
case 'deletePage':
\DB::set( "DELETE FROM `pages_comments` WHERE `page_id`=? LIMIT 1", $_POST['id'] );
\DB::set( "DELETE FROM `pages_img` WHERE `pages_id`=? LIMIT 1", $_POST['id'] );
\DB::set( "DELETE FROM `pages` WHERE `id`=? LIMIT 1", $_POST['id'] );
break;
/* ----------------------------------------------------------------------
02.04.2023
Удаляем категорию
и убираем с публикации содержимое
---------------------------------------------------------------------- */
case 'deleteCategory':
\DB::set( "DELETE FROM `pages_category` WHERE `id`=? LIMIT 1", $_POST['id'] );
\DB::set( "UPDATE `pages` SET `status`=0 WHERE `category`=? LIMIT 1", $_POST['id'] );
break;
/* ----------------------------------------------------------------------
12.12.2022
Создаем новую категорию
---------------------------------------------------------------------- */
case 'createNewCategory':
echo \DB::add("INSERT INTO `pages_category` (`title`, `category`, `user_id`) VALUES (?, ?, ?)", array($_POST['title'], $_POST['category'], $_SESSION['user_id']));
break;
/* ----------------------------------------------------------------------
07.10.2022
Сохраняем реквизиты категории
---------------------------------------------------------------------- */
case 'changeCategory':
$status = ($_POST['status'] == 'on' ) ? 1 : 0;
\DB::set("UPDATE `pages_category` SET `title`=?, `keywords`=?, `description`=?, `status`=?, `category`=? WHERE `id` = ?", array($_POST['title'], $_POST['keywords'], $_POST['description'], $status, $_POST['category'], $_POST['id']));
break;
case 'update_img': // Обновление обложки
break;
case 'del_page':
unset($_POST['act']);
$db->del_id('pages', $_POST['id']);
break;
default:
}
?>