Файл: modules/padmin/edit_page.php
Строк: 63
<?php
/**********************************
* @package: PerfCMS *
* @year: 2012 *
* @author: Artas *
* @link: http://perfcms.pp.ua *
**********************************/
$locate = 'in_padmin';
if($user['level'] < '6' || !isset($_GET['page_id'])) { header('Location: /'); }
if($db->query("SELECT * FROM `pages` WHERE `id` = '".abs(intval($_GET['page_id'])) ."'")->rowCount() == 0) {
header('Location: /forum/');
}
$edit_page = $db->query("SELECT * FROM `pages` WHERE `id` = '".abs(intval($_GET['page_id'])) ."'")->fetch();
$title = $lang->word('edit');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('edit'));
if(isset($_POST['edit']) && $_GET['act'] == 'edit') {
$name = substr(input($_POST['name']), 0, 100);
$lat_name = substr(cyrlat(input($_POST['name'])), 0, 65);
$text = input($_POST['text']);
$db->query("UPDATE `pages` SET `name` = '".$name."', `lat_name` = '".$lat_name."', `text` = '". $text ."' WHERE `id` = '".abs(intval($_GET['page_id'])) ."'");
$tpl->div('menu', $lang->word('succ_add'));
$tpl->div('block', img('nav.png') . '<a href="/pages/'. abs(intval($_GET['page_id'])) .'-'.$lat_name.'.html">'.$name.'</a><br/>' . img('nav.png') .'<a href="/padmin/pages/">'. $lang->word('padmin_pages') .'</a><br/>'. img('admin.png') .'<a href="/padmin/">'. $lang->word('padmin') .'</a><br/>'. HICO .'<a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
exit;
}
echo '<form action="/padmin/edit-page/'.abs(intval($_GET['page_id'])) .'/?act=edit" method="post">
<div class="menu">
<b>'. $lang->word('name') .'</b>:<br/>
<input name="name" type="text" value="'. $edit_page['name'] .'" /><br/>
<b>'. $lang->word('message') .'</b>:<br/>
<textarea name="text" rows="15" cols="65">'. $edit_page['text'] .'</textarea><br/>
<input name="edit" type="submit" value="'. $lang->word('edit') .'" /><br/>
</div>
</form>';
$tpl->div('block', NAV .'<a href="/padmin/">'. $lang->word('padmin') .'</a><br/>' . HICO .'<a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
?>