Файл: modules/padmin/edit-page.php
Строк: 75
<?php
/**
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) 2013, Taras Chornyi, Sergiy Mazurenko, Ivan Kotliar
* @link http://perf-engine.net
* @package PerfEngine
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
$locate = 'in_padmin';
if($user['level'] < '6' || !isset($_GET['id'])) { header('Location: /'); }
if($db->query("SELECT * FROM `pages` WHERE `id` = '".abs(intval($_GET['id'])) ."'")->rowCount() == 0) {
header('Location: /');
}
$edit_page = $db->query("SELECT * FROM `pages` WHERE `id` = '".abs(intval($_GET['id'])) ."'")->fetch();
$title = _t('edit');
include_header($title);
$tpl->div('title', _t('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['id'])) ."'");
$tpl->div('menu', _t('succ_add'));
$tpl->div('block', img('nav.png') . '<a href="/pages/'. abs(intval($_GET['id'])) .'-'.$lat_name.'.html">'.$name.'</a><br/>' . img('nav.png') .'<a href="/padmin/pages/">'. _t('padmin_pages') .'</a><br/>'. img('admin.png') .'<a href="/padmin/">'. _t('padmin') .'</a><br/>'. HICO .'<a href="/">'. _t('home') .'</a>');
include_footer();
exit;
}
echo '<form action="/padmin/edit-page/'.abs(intval($_GET['id'])) .'/?act=edit" method="post">
<div class="menu">
<b>'. _t('name') .'</b>:<br/>
<input name="name" type="text" value="'. $edit_page['name'] .'" /><br/>
<b>'. _t('message') .'</b>:<br/>
<textarea name="text" rows="15" cols="65">'. $edit_page['text'] .'</textarea><br/>
<input name="edit" type="submit" value="'. _t('edit') .'" /><br/>
</div>
</form>';
$tpl->div('block', NAV .'<a href="/padmin/">'. _t('padmin') .'</a><br/>' . HICO .'<a href="/">'. _t('home').'</a>');
include_footer();
?>