Вход Регистрация
Файл: adultscript-2.0.3-pro/files/admin/modules/nuevo/components/player.php
Строк: 92
<?php
defined
('_VALID') or die('Restricted Access!');
class 
VComponent_Admin_nuevo_player
{
    private 
$db;
    private 
$cache;
    private 
$filter;
    public function 
__construct()
    {
        
$this->db        VF::factory('database');
        
$this->cache    VF::factory('cache');
        
$this->filter    VF::factory('filter');
    }
    
    public function 
render()
    {
        
$errors        = array();
        
$messages    = array();
        
$warnings    = array();
        
$data        = array();
        
        
$this->db->query("SELECT * FROM nuevo__player WHERE ID = '1' LIMIT 1");
        
$player$this->db->fetch_assoc();


        if (isset(
$_POST['submit_player_settings'])) {
            
            
$hex_pattern '~^[a-f0-9]{6,6}$~i';

            
$data['regkey'] = trim($_POST['regkey']);
            
$data['skin'] = trim($_POST['skin']);
            if(
$data['skin']=='default'$data['skin']='';
            
$data['playbar'] = trim($_POST['playbar']);
            
$data['player_width'] = intval($_POST['player_width']);
            
$data['player_width_method'] = trim($_POST['player_width_method']);
            
$data['player_height'] = intval($_POST['player_height']);
            
$data['player_height_method'] = trim($_POST['player_height_method']);

            
$data['plugin_preroll'] = trim($_POST['plugin_preroll']);
            
$data['plugin_midroll'] = trim($_POST['plugin_midroll']);
            
$data['plugin_overlay'] = trim($_POST['plugin_overlay']);
            
$data['plugin_ticker'] = trim($_POST['plugin_ticker']);

            
$data['stretching'] = trim($_POST['stretching']);    
            
$data['autostart'] = trim($_POST['autostart']);
            
$data['volume'] = intval($_POST['volume']);
            
$data['usetooltips'] = trim($_POST['usetooltips']);
            
$data['barlogo'] = trim($_POST['barlogo']);
            
$data['logo'] = trim($_POST['logo']);
            
$data['logourl'] = trim($_POST['logourl']);
            
$data['logoalign'] = trim($_POST['logoalign']);
            
$data['logooffsetx'] = intval($_POST['logooffsetx']);
            
$data['logooffsety'] = intval($_POST['logooffsety']);


            
            if(
strlen($data['regkey'])<10
                
$errors[] = 'Invalid license key';
            if(!
is_numeric(trim($data['volume'])) || trim($data['volume'])>100)    
                
$errors[] = "Invalid volume value";
            
            if (!
$errors) {
                
$sql $this->update_player($data)." where ID = 1";
                
$this->db->query($sql);
                if(
$this->db->affected_rows()) {
                    
$messages[] = 'Nuevoplayer settings updated succesfully!';
                    
                    
$sql="UPDATE nuevo__player set regkey='".$this->db->escape($data['regkey'])."'";
           
                    
$this->db->query($sql);

                } else {
                    
$errors[] = 'Error while saving data in database or nothing has changed.';
                }
            }
            
$player=$data;
                        
        }
        


        
$dir BASE_DIR."/misc/nuevo/skins";

        
$skins=array();
        
$html5skins=array();
        
$languages=array();

        if (
is_dir($dir)) {


            
$dh opendir($dir);
            while ((
$file readdir($dh)) !== false
            {
                
$filename=strtolower($file);
                if (
substr($filename, -4)=='.swf')
                
$skins[] = str_replace('.swf','',$filename);
            }
            
closedir($dh);
            
            
$direct=$dir.'/';
            foreach(
glob($direct.'*'GLOB_ONLYDIR) as $dir) {
                
$dir str_replace($direct''$dir);
                
$html5skins[] = $dir;
            }
        }


        
$tpl VF::factory('template');
        
$tpl->menu            'nuevo';
        
        
$tpl->submenu        'nuevo_player';
        
$tpl->meta_title    'Admin::Nuevo::Player';
        
$tpl->errors        $errors;
        
$tpl->messages        $messages;
        
$tpl->player        $player;
        
$tpl->pmenu            'player';
        
$tpl->languages        $languages;
        
$tpl->skins            $skins;
        
$tpl->html5skins    $html5skins;

        
$tpl->load(array('header''nuevo_player''footer'));
        
$tpl->display();
    }

    private function 
update_player($data)
    {
        
$sql="UPDATE nuevo__player set 
            regkey='"
.$this->db->escape($data['regkey'])."',
            skin='"
.$this->db->escape($data['skin'])."',
            playbar='"
.$this->db->escape($data['playbar'])."',
            player_width='"
.$this->db->escape($data['player_width'])."',
            player_height='"
.$this->db->escape($data['player_height'])."',
            player_width_method='"
.$this->db->escape($data['player_width_method'])."',
            player_height_method='"
.$this->db->escape($data['player_height_method'])."',            
            stretching='"
.$this->db->escape($data['stretching'])."',
            autostart='"
.$this->db->escape($data['autostart'])."',
            volume='"
.$this->db->escape($data['volume'])."',
            usetooltips='"
.$this->db->escape($data['usetooltips'])."',
            barlogo='"
.$this->db->escape($data['barlogo'])."',
            logo='"
.$this->db->escape($data['logo'])."',
            logourl='"
.$this->db->escape($data['logourl'])."',
            logoalign='"
.$this->db->escape($data['logoalign'])."',
            logooffsetx='"
.$this->db->escape($data['logooffsetx'])."',
            logooffsety='"
.$this->db->escape($data['logooffsety'])."',
            plugin_preroll='"
.$this->db->escape($data['plugin_preroll'])."',
            plugin_midroll='"
.$this->db->escape($data['plugin_midroll'])."',
            plugin_overlay='"
.$this->db->escape($data['plugin_overlay'])."',
            plugin_ticker='"
.$this->db->escape($data['plugin_ticker'])."'";
        return 
$sql;
    }
}
?>
Онлайн: 0
Реклама