Файл: adultscript-2.0.3-pro/files/admin/modules/module/components/edit.php
Строк: 31
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_Admin_module_edit
{
public function __construct()
{
}
public function render()
{
$db = VF::factory('database');
$errors = array();
$messages = array();
$module = array();
$module_id = (isset($_GET['id'])) ? (int) trim($_GET['id']) : 0;
$providers = require BASE_DIR.'/config/providers.php';
$db->query("SELECT module_id FROM #__module WHERE module_id = ".$module_id." LIMIT 1");
if ($db->affected_rows()) {
if (isset($_POST['submit-edit'])) {
$filter = VF::factory('filter');
$name = $filter->get('name');
$description = $filter->get('description');
$slugs = $filter->get('slugs');
$type = $filter->get('type');
$version = $filter->get('version');
$provider = $filter->get('provider');
$status = (int) trim($_POST['status']);
if (!$errors) {
$db->query("UPDATE #__module
SET name = '".$db->escape($name)."',
description = '".$db->escape($description)."',
slugs = '".$db->escape($slugs)."',
type = '".$db->escape($type)."',
version = '".$db->escape($version)."',
provider = '".$db->escape($provider)."',
status = '".$status."'
WHERE module_id = ".$module_id."
LIMIT 1");
$messages[] = 'Module updated!';
}
}
$db->query("SELECT * FROM #__module WHERE module_id = ".$module_id." LIMIT 1");
$module = $db->fetch_assoc();
}
$tpl = VF::factory('template');
$tpl->menu = 'main';
$tpl->submenu = 'extend';
$tpl->meta_title = 'Admin::Module::Edit';
$tpl->errors = $errors;
$tpl->messages = $messages;
$tpl->module = $module;
$tpl->providers = $providers;
$tpl->load(array('header', 'module_edit', 'footer'));
$tpl->display();
}
}