2022-12-11 13:55:49 +05:00
|
|
|
|
<?php
|
2022-12-17 18:15:09 +05:00
|
|
|
|
if ( $_SESSION['dostup'] !=='a' && $_SESSION['dostup'] !== 'e' ) header( 'Location: /login/' );
|
2022-12-11 13:55:49 +05:00
|
|
|
|
/*
|
|
|
|
|
26.05.2017
|
|
|
|
|
Добавлена загрузка обложки
|
|
|
|
|
27.07.2017
|
|
|
|
|
Урезан код за счет удаления открытых SQL-запросов, все перенесено в апи
|
|
|
|
|
20.11.2017
|
|
|
|
|
Работа с ЧПУ - изменение данных
|
|
|
|
|
*/
|
2022-12-17 18:15:09 +05:00
|
|
|
|
$smarty -> assign( 'editor', 'api/modules/pages_edit/editor.html' );
|
|
|
|
|
$smarty -> assign( 'editor', '<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>');
|
2022-12-11 13:55:49 +05:00
|
|
|
|
ini_set( 'display_errors', 0 );
|
2022-12-17 18:15:09 +05:00
|
|
|
|
if ($_GET['id']){
|
|
|
|
|
$_SESSION['page_id']=$_GET['id'];
|
|
|
|
|
$page=\DB::getAll("SELECT * FROM `pages` WHERE `id`=?", $_GET['id']);
|
|
|
|
|
$smarty -> assign( 'page', $page );
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
//$mod = new main(BD_NAME, BD_TYPE, BD_HOST, BD_USER, BD_PWD, MOD);
|
2022-12-11 13:55:49 +05:00
|
|
|
|
// 22.05.2022: Получаем настройки модуля
|
|
|
|
|
$local_settings = $db -> get_mod_settings();
|
|
|
|
|
|
|
|
|
|
//Убрать в install.php
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
$db->free_sql2('ALTER TABLE `pages` ADD COLUMN `mainImg` TEXT');
|
|
|
|
|
}catch (Exception $e) {
|
|
|
|
|
$this -> to_log( MOD . ': Выброшено исключение: ' . $e->getMessage() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-12-17 18:15:09 +05:00
|
|
|
|
|
2022-12-11 13:55:49 +05:00
|
|
|
|
|
|
|
|
|
if (ID){
|
|
|
|
|
$page = $mod -> get_content_from_pages ( ID );
|
|
|
|
|
$smarty -> assign( 'page', $page );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//unset($a);
|
|
|
|
|
//загружаем обложку
|
|
|
|
|
if ( @$_FILES['oblozhka']['tmp_name'] ) $_POST['mainImg'] = $mod -> upload_main_img( $_FILES );
|
|
|
|
|
|
|
|
|
|
if ($_POST){
|
|
|
|
|
function ekr ($text) {
|
|
|
|
|
$old1 = array("'");
|
|
|
|
|
$new1 = array("'");
|
|
|
|
|
$text = str_replace($old1, $new1, $text);
|
|
|
|
|
return $text;
|
|
|
|
|
}
|
|
|
|
|
$_POST['tip']='page';
|
|
|
|
|
$_POST['user_id']=$_SESSION['user_id'];
|
|
|
|
|
$_POST['public'];
|
|
|
|
|
$_POST['parent'];
|
|
|
|
|
$_POST['t']=time();
|
|
|
|
|
$_POST['alias'];
|
|
|
|
|
$_POST['txt'];
|
|
|
|
|
unset($_POST['ok']);
|
|
|
|
|
//$res['json']=json_encode($_POST, JSON_UNESCAPED_UNICODE);
|
|
|
|
|
if (ID)
|
|
|
|
|
$db->update('pages', ID, $_POST);
|
|
|
|
|
else
|
|
|
|
|
$db->add('pages', $_POST);
|
|
|
|
|
//header( 'Location: /page_all/' );
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-17 18:15:09 +05:00
|
|
|
|
//выбираем редактор:*/
|
|
|
|
|
|
2022-12-11 13:55:49 +05:00
|
|
|
|
|
|
|
|
|
/* выбираем категорию */
|
2022-12-17 18:15:09 +05:00
|
|
|
|
/*unset($a);
|
2022-12-11 13:55:49 +05:00
|
|
|
|
$a['tip']='category';
|
|
|
|
|
|
|
|
|
|
$smarty -> assign( 'list', $db -> get_massiv ( 'pages', $a ) );
|
|
|
|
|
//$smarty -> assign( 'img', $mod -> get_images ( ID ) );
|
|
|
|
|
//$smarty -> assign( 'modal_settings', MYDIR . '/api/modules/' . MOD . '/modal.html' );
|
|
|
|
|
//загружаем список картинок
|
|
|
|
|
//unset($a);
|
|
|
|
|
//$a['page_id']=ID;
|
2022-12-17 18:15:09 +05:00
|
|
|
|
*/
|
2022-12-11 13:55:49 +05:00
|
|
|
|
?>
|