Файл: sources/admin/new_cat.php
Строк: 42
<?php
if (!defined('VAPHP'))
{
die("Этот файл недоступен.");
}
class new_cat extends base
{
function new_cat()
{
global $CONF, $DB, $FORM, $LNG, $TMPL;
$TMPL['header'] = $LNG['a_new_cat_header'];
if (!isset($FORM['submit']))
{
$this->form();
}
else
{
$this->process();
}
}
function form()
{
global $CONF, $DB, $LNG, $TMPL;
$TMPL['admin_content'] = <<<EndHTML
<form action="{$TMPL['site_url']}/index.php?a=admin&b=new_cat" method="post">
<span class="SeparatorLabel">{$LNG['a_new_cat_header']}</span>
{$LNG['a_edit_cat_name']}<br>
<input type="text" name="name" class="Input" value="{$TMPL['name']}" /><br><br>
<input name="submit" class="ButtonNormal" type="submit" value="{$LNG['a_new_cat_header']}" />
</form>
EndHTML;
}
function process()
{
global $CONF, $DB, $FORM, $LNG, $TMPL;
$TMPL['name'] = $DB->escape($FORM['name']);
$DB->query("INSERT INTO {$CONF['sql_prefix']}_cat (name) VALUES ('{$TMPL['name']}')", __FILE__, __LINE__);
$TMPL['admin_content'] = $LNG['a_new_cat_create'];
}
}
?>