2025-06-16 18:28:08 +05:00

146 lines
5.4 KiB
PHP
Executable File
Raw Permalink 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
ini_set('display_errors', 0);
if ($_SESSION['dostup'] !== 'a' && $_SESSION['dostup'] !== 'e') header('Location: /login/');
$_SESSION['id']=$_GET['id'];
class modClass
{
static $content='';
/*
14.03.2025 Получаем картинки
*/
static function getImg()
{
if (self::$content['json'])
$list=\core::j(self::$content['json'])['images'];
//$list=\core::j($json)['images'];
//print_r($list);
return $list;
}
/*
14.03.2025 Получаем файлы
*/
static function getFiles()
{
$list=\DBmysql::getAll("SELECT `id`, `title`, `txt`, `json` FROM `content` WHERE `content_type`=? AND `category`=? AND `site`=? ORDER BY `title`",['file', $_GET['id'], $_SERVER['SERVER_NAME']]);
//print_r($list);
return $list;
}
static function getChildenPages()
{
$id=($_GET['id'])?$_GET['id']:0;
$list=\DBmysql::getAll("SELECT `id`, `title`, `txt`, `status`, `sort`, `tonews`, `showOnRight` FROM `content` WHERE `content_type`=? AND `category`=? AND `site`=? ORDER BY `sort`, `title`",['page', $id, $_SERVER['SERVER_NAME']]);
$c=count($list);
for ($i=0; $i<$c; $i++){
$list[$i]['md5']=md5($list[$i]['txt']);
$list[$i]['color']=substr($list[$i]['md5'], 0, 6);
}
return $list;
}
static function getThisPage()
{
self::$content=\DBmysql::getRow("SELECT * FROM `content` WHERE `id`=? AND `content_type`=? AND `site`=? ORDER BY `title`",[$_GET['id'], 'page', $_SERVER['SERVER_NAME']]);
}
}
if ($_GET['id']){
modClass::getThisPage();
$smarty->assign('page', modClass::$content);
$smarty->assign('arr', core::j(modClass::$content['json']));
}
/* Запрашиваем список дочерних страниц */
$smarty->assign('childrenPages', modClass::getChildenPages());
/* Запрашиваем эту страницу */
$smarty->assign('files', modClass::getFiles());
//$smarty->assign('img', modClass::getImg());
//if (modClass::$content['json'])
//$smarty->assign('images', modClass::getImages(modClass::$content['json']));
$smarty->assign('editor', 'api/modules/contenteditor/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>');
/* ----------------------------------------------------------------------
14.12.2022
Получаем инфу о пользователе
---------------------------------------------------------------------- */
$smarty->assign('userInfo', \core::getUserInfo($_SESSION['user_id']));
/* ----------------------------------------------------------------------
07.01.20223
Получаем список категорий
---------------------------------------------------------------------- */
$smarty->assign('pages_category', \DBmysql::getAll("SELECT * FROM `content` WHERE `status`=1 AND `content_type`=? AND `site`=? ORDER BY `title`", ['page', $_SERVER['SERVER_NAME']]));
/*if (@$_POST) {
/* ----------------------------------------------------------------------
07.01.20223
Принимаем входящие данные
---------------------------------------------------------------------- */
/* $massiv['keywords']=$_POST['keywords'];
$massiv['description']=$_POST['description'];
$massiv['alias']=$_POST['alias'];
$massiv['d']=$_POST['d'];
$massiv['reyt']=0;
$massiv['comments']=1;
$massiv['socbtn']=1;
$status=($_POST['status']=='on')?1:0;
$json=\core::j($massiv);
switch (@$_POST['act']) {
case 'save':
\DB::set("UPDATE `content` SET `title`=?, `txt`=?, `status`=?, `category`=?, `site`=?, `json`=?, `content_type`=?, `time`=?, `user_id`=? WHERE `id`=?",
[$_POST['title'], $_POST['txt'], $status, $_POST['category'], $_SERVER['SERVER_NAME'], $json, 'page', time(), $_SESSION['user_id'], $_GET['id']]);
break;
case 'new':
$id = \DB::add("INSERT INTO `content` (`title`, `txt`, `status`, `category`, `site`, `json`, `content_type`, `time`,`user_id`) VALUES (
?,?,?,?,?,?,?,?,?)", [$_POST['title'], $_POST['txt'], $status, $_POST['category'], $_SERVER['SERVER_NAME'], $json, 'page', time(), $_SESSION['user_id']]
);
header('Location: /page_edit/' . $id);
break;
default:
break;
}
}*/
/* ----------------------------------------------------------------------
02.04.20223
Получаем список картинок
---------------------------------------------------------------------- */
/*if ($_GET['id']) {
$content=\DB::getRow("SELECT * FROM `content` WHERE `id`=? AND `site`=? LIMIT 1", [$_GET['id'], $_SERVER['SERVER_NAME']]);
$page=$content;
$j=\core::j($content['json']);
$smarty->assign('page', $page);
$smarty->assign('j', $j);
$img = \DB::getAll("SELECT * FROM `img` WHERE `content_id`=? AND `content_type`='page' AND `site`=?", [$_GET['id'], $_SERVER['SERVER_NAME']]);
for ($i=0;$i<count($img);$i++)
$img[$i]['uses']=\DB::getValue("SELECT `id` FROM `pages` WHERE `txt` LIKE '%" . $img[$i]['filename'] . "%' LIMIT 1");
$smarty->assign('img', $img);
}*/
?>