53 lines
2.6 KiB
PHP
Executable File
53 lines
2.6 KiB
PHP
Executable File
<?php
|
|
ini_set('display_errors', 0 );
|
|
if ( $_SESSION['dostup'] != 'a' && $_SESSION['dostup'] != 'e' && $_SESSION['dostup'] != 'c' ) header( 'Location: /login/' );// && $dostup!='m'
|
|
/* ----------------------------------------------------------------------
|
|
26.07.2023
|
|
Получаем список категорий
|
|
---------------------------------------------------------------------- */
|
|
|
|
$all_cat=\DB::getAll("SELECT `title`, `id` FROM `content_category` WHERE `status`=1 AND `site`=? AND `content_type`=?", array($_SERVER['SERVER_NAME'], 'bib'));
|
|
$smarty -> assign( 'all_cat', $all_cat );
|
|
|
|
if ($_POST){
|
|
$massiv['fileBook']=\core::genpassword(30);
|
|
$massiv['format']=$_POST['format'];
|
|
$massiv['lang']=$_POST['lang'];
|
|
$massiv['link']=$_POST['link'];
|
|
$massiv['isbn']=$_POST['isbn'];
|
|
$massiv['comments']=($_POST['comments']=='on')?1:0;
|
|
$massiv['god']=$_POST['god'];
|
|
$massiv['keywords']=$_POST['keywords'];
|
|
$massiv['description']=$_POST['description'];
|
|
$massiv['avtor']=$_POST['avtor'];
|
|
$status = ($_POST['status']=='on')?1:0;
|
|
\core::run("php " . $_SERVER['DOCUMENT_ROOT'] . "/api/modules/a_bib_edit/c.php " . $massiv['fileBook'] . " " . $_POST['link'] . " " . $_SERVER['DOCUMENT_ROOT']. '/files/' . $_SERVER['SERVER_NAME'] );
|
|
$json=\json::to_j($massiv);
|
|
|
|
if ($_GET['id']){
|
|
\DB::set("UPDATE `content` SET `title`=?, `txt`=?, `status`=?, `category`=?, `site`=?, `json`=?, `content_type`=?, `time`=?, `user_id`=?, `description`=?, `keywords`=? WHERE `id`=?", array(
|
|
$_POST['title'], $_POST['txt'], $status,
|
|
$_POST['category'], $_SERVER['SERVER_NAME'], $json,
|
|
'bib', time(), $_SESSION['user_id'],
|
|
$_POST['description'], $_POST['keywords'], $_GET['id']
|
|
));
|
|
}else{
|
|
$id=\DB::add("INSERT INTO `content` (`title`, `txt`, `status`, `category`, `site`, `json`, `content_type`, `time`, `user_id`, `description`, `keywords`) VALUES (
|
|
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
|
)", array(
|
|
$_POST['title'], $_POST['txt'], $status,
|
|
$_POST['category'], $_SERVER['SERVER_NAME'], $json,
|
|
'bib', time(), $_SESSION['user_id'],
|
|
$_POST['description'], $_POST['keywords']
|
|
));
|
|
header( 'Location: /a_bib_edit/' . $id );
|
|
}
|
|
}
|
|
|
|
|
|
$content=\core::getContent($_GET['id'], 'bib');
|
|
|
|
$smarty->assign('book', $content['row']);
|
|
$smarty->assign('json', $content['json']);
|
|
|
|
?>
|