Файл: sources/admin/new_subcat.php
Строк: 55
<?php
if (!defined('VAPHP'))
{
die("Этот файл недоступен.");
}
class new_subcat extends base
{
function new_subcat()
{
global $CONF, $DB, $FORM, $LNG, $TMPL;
$TMPL['header'] = $LNG['a_new_subcat_header'];
if (!isset($FORM['submit']))
{
$this->form();
}
else
{
$this->process();
}
}
function form()
{
global $CONF, $DB, $LNG, $TMPL;
$cat_menu = "<select name="category" class="Input">n";
foreach ($CONF['categories'] as $idcat => $cat)
{
$cat_menu .= "<option value="$idcat">{$cat}</option>n";
}
$cat_menu .= "</select>";
$TMPL['admin_content'] = <<<EndHTML
<form action="{$TMPL['site_url']}/index.php?a=admin&b=new_subcat" method="post">
<span class="SeparatorLabel">{$LNG['a_new_subcat_header']}</span>
{$LNG['a_edit_subcat_name']}<br>
<input type="text" name="name" class="Input" value="{$TMPL['name']}" /><br><br>
{$LNG['a_new_subcat_catname']}<br>
{$cat_menu}<br><br>
<input name="submit" class="ButtonNormal" type="submit" value="{$LNG['a_new_subcat_header']}" />
</form>
EndHTML;
}
function process()
{
global $CONF, $DB, $FORM, $LNG, $TMPL;
$TMPL['name'] = $DB->escape($FORM['name']);
$TMPL['idcat'] = intval($FORM['category']);
$DB->query("INSERT INTO {$CONF['sql_prefix']}_subcat (idcat, name) VALUES ('{$TMPL['idcat']}', '{$TMPL['name']}')", __FILE__, __LINE__);
$TMPL['admin_content'] = $LNG['a_new_subcat_create'];
}
}
?>