95 lines
4.0 KiB
PHP
Executable File
95 lines
4.0 KiB
PHP
Executable File
<?php
|
||
ini_set( 'display_errors', 0 );
|
||
//проверяем кто мы
|
||
if ($_SESSION['dostup']!=='a')die("Нет прав");
|
||
|
||
|
||
switch(@$_POST['act']) {
|
||
case 'updatePHP':
|
||
exec('zip copy/' . time() . '___'. $_POST['mod'] . '__index.php.zip api/modules/' . $_POST['mod'] . '/index.php 9');
|
||
file_put_contents('api/modules/' . $_POST['mod'] . '/index.php', $_POST['txt']);
|
||
break;
|
||
case 'updateHTML':
|
||
//echo $_POST['txt'];
|
||
if (file_exists('skin/' . $_SERVER['SERVER_NAME'] . '/inc/mod/' . $_POST['mod'] . '/index.html')){
|
||
exec('zip copy/' . time() . '___'. $_POST['mod'] . '__index.html.zip skin/' . $_SERVER['SERVER_NAME'] . '/inc/mod/' . $_POST['mod'] . '/index.html 9');
|
||
file_put_contents('skin/' . $_SERVER['SERVER_NAME'] . '/inc/mod/' . $_POST['mod'] . '/index.html', $_POST['txt']);
|
||
}else{
|
||
exec('zip copy/' . time() . '___'. $_POST['mod'] . '__index.html.zip api/modules/' . $_POST['mod'] . '/index.html 9');
|
||
file_put_contents('api/modules/' . $_POST['mod'] . '/index.html', $_POST['txt']);
|
||
}
|
||
break;
|
||
|
||
case 'updateJS':
|
||
exec('zip copy/' . time() . '___'. $_POST['mod'] . '__mod.js.zip api/modules/' . $_POST['mod'] . '/mod.js 9');
|
||
file_put_contents('api/modules/' . $_POST['mod'] . '/mod.js', $_POST['txt']);
|
||
break;
|
||
|
||
case 'updateAJAX':
|
||
exec('zip copy/' . time() . '___'. $_POST['mod'] . '__ajax,php.zip api/modules/' . $_POST['mod'] . '/ajax.php 9');
|
||
file_put_contents('api/modules/' . $_POST['mod'] . '/ajax.php', $_POST['txt']);
|
||
break;
|
||
|
||
/* ----------------------------------------------------------------------
|
||
02.04.2023
|
||
Удаляем категорию
|
||
и убираем с публикации содержимое
|
||
---------------------------------------------------------------------- */
|
||
|
||
case 'newmod':
|
||
|
||
mkdir ('api/modules/' . $_POST['txt'], 0700);
|
||
copy ('api/modules/skeleton/ajax.php', 'api/modules/' . $_POST['txt'] . '/ajax.php');
|
||
copy ('api/modules/skeleton/index.php', 'api/modules/' . $_POST['txt'] . '/index.php');
|
||
copy ('api/modules/skeleton/mod.js', 'api/modules/' . $_POST['txt'] . '/mod.js');
|
||
copy ('api/modules/skeleton/index.html', 'api/modules/' . $_POST['txt'] . '/index.html');
|
||
|
||
|
||
|
||
|
||
|
||
break;
|
||
|
||
/* ----------------------------------------------------------------------
|
||
12.12.2022
|
||
Создаем новую категорию
|
||
04.11.2023
|
||
Добавлен статус 1
|
||
---------------------------------------------------------------------- */
|
||
|
||
case 'createNewCategory':
|
||
echo DB::add("INSERT INTO `content` (`title`, `content_category`, `status`, `content_type`, `user`, `t`) VALUES (?, ?, ?, ?, ?, ?)", [$_POST['title'], $_POST['category'], 1, '7', $_SESSION['user_id'], time()]);
|
||
break;
|
||
|
||
/* ----------------------------------------------------------------------
|
||
07.10.2022
|
||
Сохраняем реквизиты категории
|
||
17.08.2024 переездаем в другую таблицу и пишем txt
|
||
---------------------------------------------------------------------- */
|
||
|
||
case 'changeCategory':
|
||
$_POST['txt']= str_replace(" ", "+", $_POST['txt']);
|
||
$status = ($_POST['status'] == 'on' ) ? 1 : 0;
|
||
$comments = ($_POST['comments'] == 'on' ) ? 1 : 0;
|
||
$json=DB::getValue("SELECT `json` FROM `content` WHERE `id`=?", $_POST['id']);
|
||
$massiv=core::j($json);
|
||
$massiv['keywords']=$_POST['keywords'];
|
||
$massiv['description']=$_POST['description'];
|
||
$massiv['comments']=$comments;
|
||
$json=\core::j($massiv);
|
||
DB::set("UPDATE `content` SET `title`=?, `json`=?, `status`=?, `content_category`=?, `txt`=?, `t`=? WHERE `id` = ?",
|
||
[$_POST['title'], $json, $status, $_POST['category'], base64_decode( $_POST['txt'] ), time(), $_POST['id']]);
|
||
break;
|
||
|
||
case 'del_page':
|
||
DB::set("DELETE FROM `content` WHERE `id`=?", $_POST['id']);
|
||
break;
|
||
|
||
case 'foto_upload':
|
||
core::upload_img('content', $_SESSION['id'], 0);
|
||
break;
|
||
|
||
default:
|
||
|
||
}
|
||
?>
|