Вход Регистрация
Файл: adultscript-2.0.3-pro/files/admin/modules/nuevo/components/prerollnew.php
Строк: 110
<?php
defined
('_VALID') or die('Restricted Access!');
class 
VComponent_Admin_nuevo_prerollnew
{
    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('channel'=>0,'owner'=>'','email'=>'','url'=>'','link'=>'','runtime' =>5'skip'=>'','day'=>1,'year'=>2012,'month'=>1,'active'=>0,'target'=>'_self');

        
$days=array();
        for(
$i=1;$i<=31;$i++) $days[$i] = $i;

        
$year_beg=2012$years=array();
        for(
$i=1;$i<=38;$i++) {
            
$years[$i] = $year_beg;
            
$year_beg++;
        }

        
$extensions = array('.png''.jpg''.jpeg''.gif''.swf''.flv''.mp4');

        if (isset(
$_POST['create_ad'])) {
            echo 
VF::debug($_POST);
            
$data['channel']        = trim($_POST['channel']);
            
$data['owner']            = trim($_POST['owner']);
            
$data['email']            = trim($_POST['email']);
            
$data['url']            = trim($_POST['url']);
            
//$data['html5']            = trim($_POST['html5']);
            
$data['link']            = trim($_POST['link']);
            
$data['target']            = trim($_POST['target']);
            
$data['skip']            = intval($_POST['skip']);
            
$data['runtime']        = intval($_POST['runtime']);
            
$data['month']            = intval($_POST['month']);
            
$data['year']            = intval($_POST['year']);
            
$data['day']            = intval($_POST['day']);
            
$data['active']            = $_POST['active']  == '1' '1' '0';

            
$extension strrchr($data['url'], '.');
        
            if (!
in_array($extension$extensions))
                
$errors[] = 'Invalid ad source file.';
            elseif ( 
strlen($data['link']) < )
                
$errors[] = 'Link URL cannot be empty!';
            elseif (
$data['month']<|| $data['day']<|| $data['year']<1)
                
$errors[] = 'Expire date not valid';
       
            if (
$data['month']>|| $data['day']>|| $data['year']>0)
                
$data['expire'] = mktime(0,0,0,$data['month'],$data['day'],$data['year']);
            
            if ( !
$errors ) {

                
$expire mktime(0,0,0,$data['month'],$data['day'],$data['year']);
                
$data['expire'] = $expire;
                
$added time();
            
                if(
strlen($data['owner'])>0$owner =  mysql_real_escape_string($data['owner']); else $owner='';
                if(
strlen($data['email'])>0$email =  mysql_real_escape_string($data['email']); else $email='';
                
$url mysql_real_escape_string($data['url']);
                
//$html5 = mysql_real_escape_string($data['html5']);
                
$link mysql_real_escape_string($data['link']);
                
$target mysql_real_escape_string($data['target']);
                
$skip mysql_real_escape_string($data['skip']);
                
$runtime mysql_real_escape_string($data['runtime']);
                
$channel mysql_real_escape_string($data['channel']);
                
$active $data['active'];

                
$sql "INSERT into nuevo__preroll SET ID = NULL, channel = '$channel', owner = '$owner', email = '$email', url = '$url', skip = '$skip', link = '$link', target = '$target', runtime = '$runtime', expire = '$expire',added = '$added', active = '$active'";
                
$this->db->query($sql);
                if(
$this->db->affected_rows()) {
                    
header("Location: ".ADMIN_URL.'/index.php?q=nuevo/preroll');
                    die();
                } else {
                    
$errors[] = 'Error while saving data in database.';
                }
            }
                        
        }

        
$sql                "SELECT cat_id, parent_id, name, slug, total_videos, status
                               FROM #__video_categories
                               ORDER BY slug, parent_id ASC"
;
        
$categories            $this->db->get_rows($sql);
        
        
        
        
$tpl = &VF::factory('template');
        
$tpl->menu            'nuevo';
        
        
$tpl->submenu        'nuevo_ads';
        
$tpl->meta_title    'Admin::Nuevo::Create ad';
        
$tpl->errors        $errors;
        
$tpl->messages        $messages;
        
$tpl->ad            $data;
        
$tpl->categories    $categories;
        
$tpl->pmenu            'preroll';
        
$tpl->days            $days;
        
$tpl->years            $years;

        
$tpl->load(array('header''nuevo_prerollnew''footer'));
        
$tpl->display();
    }
    
}
?>
Онлайн: 0
Реклама