Размер файла: 1.82Kb
<?php
/**********************************
* @package: PerfCMS *
* @year: 2012 *
* @author: Artas *
* @link: http://perfcms.pp.ua *
**********************************/
$locate = 'in_padmin';
if(isset($user) && $user['level'] >= 6) {
$title = $lang->word('add_page');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('add_page'));
if(isset($_POST['add']) && $_GET['act'] == 'add') {
$name = substr(input($_POST['name']), 0, 100);
$lat_name = substr(cyrlat(input($_POST['name'])), 0, 65);
$text = input($_POST['text']);
if(!empty($name) && !empty($text)) {
$db->query("INSERT INTO `pages` SET `name` = '$name', `lat_name` = '$lat_name', `text` = '$text'");
$tpl->div('menu', $lang->word('succ_add'));
$tpl->div('block', img('nav.png') . '<a href="/pages/'. $db->lastInsertId() .'-'.$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;
} else { $tpl->div('error', 'Error'); }
}
?>
<div class="menu">
<form action="/padmin/add-page/?act=add" method="post">
<b><?=$lang->word('name');?></b>:<br/>
<input type="text" name="name" /><br/>
<b><?=$lang->word('page_text');?>(BBCodes+Smiles)</b>:<br/>
<textarea name="text" rows="15" cols="65"></textarea><br/>
<input type="submit" name="add" value="<?=$lang->word('save');?>" />
</form>
</div>
<?php
$tpl->div('block', NAV .'<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');
} else { header('Location: /'); }
?>