Файл: sources/admin/edit_subcat.php
Строк: 43
<?php
if (!defined('VAPHP'))
{
die("Этот файл недоступен.");
}
class edit_subcat extends base
{
function edit_subcat()
{
global $CONF, $DB, $FORM, $LNG, $TMPL;
$TMPL['header'] = $LNG['a_edit_subcat_header'];
$id = intval($FORM['id']);
list($TMPL['id']) = $DB->fetch("SELECT id FROM {$CONF['sql_prefix']}_subcat WHERE id = {$id}", __FILE__, __LINE__);
if ($TMPL['id'])
{
if (!isset($FORM['submit']))
{
$this->form();
}
else
{
$this->process();
}
}
else
{
$this->error($LNG['a_del_subcat_invalid_id'], 'admin');
}
}
function form()
{
global $CONF, $DB, $LNG, $TMPL;
list($TMPL['id'], $TMPL['name']) = $DB->fetch("SELECT id, name FROM {$CONF['sql_prefix']}_subcat WHERE id = {$TMPL['id']}", __FILE__, __LINE__);
$TMPL['admin_content'] = <<<EndHTML
<form action="{$TMPL['site_url']}/index.php?a=admin&b=edit_subcat&id={$TMPL['id']}" method="post">
<span class="SeparatorLabel">{$LNG['a_edit_subcat_header']}</span>
{$LNG['a_cat_id']}<br>
<input type="text" class="SmallInput" readonly value="{$TMPL['id']}" /><br><br>
{$LNG['a_edit_subcat_name']}<br>
<input type="text" name="name" class="Input" value="{$TMPL['name']}" /><br><br>
<input name="submit" class="ButtonNormal" type="submit" value="{$LNG['a_edit_subcat_header']}" />
</form>
EndHTML;
}
function process()
{
global $CONF, $DB, $FORM, $LNG, $TMPL;
$TMPL['name'] = $DB->escape($FORM['name']);
$DB->query("UPDATE {$CONF['sql_prefix']}_subcat SET name = '{$TMPL['name']}' WHERE id = {$TMPL['id']}", __FILE__, __LINE__);
$TMPL['admin_content'] = $LNG['a_edit_subcat_edited'];
}
}
?>