Вход Регистрация
Файл: adultscript-2.0.3-pro/files/admin/modules/language/components/edit.php
Строк: 51
<?php
defined
('_VALID') or die('Restricted Access!');
class 
VComponent_Admin_language_edit extends VModule_Admin_language
{
    public function 
__construct()
    {
    }
    
    public function 
render()
    {
        
$db            VF::factory('database');
        
$filter        VF::factory('filter');
        
$code        = (isset($_GET['code'])) ? $filter->get('code''STRING''GET') : '';
        
$lang        = array();
        
$errors        = array();
        
$messages    = array();
        
        if (
$code) {
            
$db->query("SELECT name FROM #__language WHERE code = '".$db->escape($code)."' LIMIT 1");
            if (
$db->affected_rows()) {
                if (isset(
$_POST['submit-edit'])) {
                    
$name    $filter->get('name'); 
                    
$flag    $filter->get('flag');
                    
$status    = (int) trim($_POST['status']);
                    
                    if (
$name == '') {
                        
$errors[]     = 'Language name field cannot be left blank!';
                    }
                    
                    if (
$flag == '') {
                        
$errors[]    = 'Language flag field cannot be left blank!';
                    }
                    
                    if (!
$errors) {
                        
$db->query("UPDATE #__language
                                    SET name = '"
.$db->escape($name)."',
                                        flag = '"
.$db->escape($flag)."',
                                        status = '"
.$status."'
                                    WHERE code = '"
.$db->escape($code)."'
                                    LIMIT 1"
);
                        
                        
VF::cache_del('languages''config');
                        
                        
$messages[] = 'Language updated!';
                    }
                }
            
                
$db->query("SELECT code, name, flag, status
                            FROM #__language
                            WHERE code = '"
.$db->escape($code)."'
                            LIMIT 1"
);
                            
                
$lang    $db->fetch_assoc();
            }
        }
    
        
$tpl VF::factory('template');
        
$tpl->menu            'main';
        
$tpl->submenu        'extend';
        
$tpl->extramenu        'language_manage';
        
$tpl->meta_title    'Language::Edit';
        
$tpl->errors        $errors;
        
$tpl->messages        $messages;
        
$tpl->lang            $lang;
        
$tpl->load(array('header''language_edit''footer'));
        
$tpl->display();
    }
}
Онлайн: 2
Реклама