Файл: adultscript-2.0.3-pro/files/admin/modules/flowplayer5/flowplayer5.php
Строк: 34
<?php
class VModule_Admin_flowplayer5
{
    public function __construct()
    {
    }
    
    public function render()
    {
        $errors     = array();
        $messages   = array();
        $config        = array(
            'autoplay'    => '',
            'url'        => '',
            'position'    => ''
        );
        
        if (isset($_POST['submit_config'])) {
            $autoplay    = (int) trim($_POST['autoplay']);
            $url        = trim($_POST['url']);
            $position    = (int) trim($_POST['position']);
            
            if ($url != '') {
                if (!VValid::url($url)) {
                    $errors[]    = 'Logo URL is not a valid URL address!';
                }
            }
            
            if (!$errors) {
                $config['autoplay']    = $autoplay;
                $config['url']        = $url;
                $config['position']    = $position;
                
                $db    = VF::factory('database');
                $db->query("UPDATE #__player
                            SET config = '".$db->escape(serialize($config))."',
                                config_cache = '".$db->escape(serialize($config))."'
                            WHERE name = 'flowplayer5'
                            LIMIT 1");
                
                VCfg::cache_del('videojs', 'player');
                
                $messages[]    = 'Flowplayer HTML5 configuration updated!';
            }
        }
        
        $config    = VCfg::group('player.flowplayer5', true, true);
        
        $tpl    = VF::factory('template');
        
        $tpl->menu          = 'video';
        $tpl->submenu       = 'video_videojs';
        
        $tpl->meta_title    = 'Admin::Flowplayer HTML5';
        
        $tpl->errors        = $errors;
        $tpl->messages      = $messages;
        
        $tpl->config           = $config;
        
        $tpl->load(array('header', 'flowplayer5', 'footer'));
        $tpl->display();        
    }
}