Файл: adultscript-2.0.3-pro/files/misc/nuevo/config.php
Строк: 296
<?php
define('_VALID', true);
require '../../libraries/bootstrap.php';
define ('PLAYER_URL', BASE_URL.'/misc/nuevo');
//if (isset($_SERVER['HTTP_REFERER'])) {
//    $base    = str_replace(array('http://', 'www.'));
//    if (stripos($_SERVER['HTTP_REFERER'], $base) === false) {
//        die('Restricted access!');
//    }
//}
$access        = VCfg::get('video.view_access');
if ($access != 'all' && !VAuth::group($access)) {
    die('Access denied (never reached)!');
}
$video_id     = (isset($_GET['id'])) ? (int) $_GET['id'] : 0;
if ($video_id === 0) {
    die('Invalid video id!');
}
$plugins='';
$cache        = VF::factory('cache');
$db            = VF::factory('database');
$cache_id    = 'video_player_'.$video_id;
$sql_add    = (VModule::enabled('premium')) ? " AND premium = '0'" : '';
if (!$video = $cache->get($cache_id, 86400)) {
    $db->query("SELECT v.video_id, v.title, v.slug, v.url, v.ext, v.mobile,
                       v.server, v.allow_embed, v.thumb, v.s3, v.hd,
                       v.slidenum, v.slideoffset, v.slideversion,
                       GROUP_CONCAT(c.cat_id) AS categories
                FROM #__video AS v
                INNER JOIN #__video_category AS c ON (c.video_id = v.video_id)
                WHERE v.video_id = ".$video_id."
                AND v.status = 1".$sql_add."
                GROUP BY c.video_id
                LIMIT 1");
    if ($db->affected_rows()) {
        $video = $db->fetch_assoc();
        $cache->store($cache_id, $video, 86400);
    }            
}
if (!$video) {
    die('Invalid video!');
}
$player_cache = 'web_player';
if (!$player = $cache->get($player_cache, 86400)) {
    $db->query("SELECT * FROM nuevo__player WHERE ID = '1' LIMIT 1");
    if ($db->affected_rows()) {
        $player= $db->fetch_assoc();
        $cache->store($player_cache, $player, 86400);
    }
}
if (!$player) {
    die('Invalid player interface!');
}
VHelper::load('module.video.stream');
$channels     = explode(',', $video['categories']);
if ($video['url'] != '') {
    $video_url = $video['url'];
} else if ($video['s3'] == '1') {
    $video_url    = array(
        'file'        => $video['ext'].'/'.$video_id.'.'.$video['ext'],
        'stream'    => VF::cfg_item('module.video.cloudfront_url')
    );
    
    if ($video['hd'] == '1') {
        $video_url['filehd']    = 'mp4/'.$video_id.'_hd.mp4';
    }
    $video_mobile = VHelper_video_stream::url_mobile(TRUE, $video_id, $video['ext'], $video['server']);
} else {
    $video_url = VHelper_video_stream::url(TRUE, $video_id, $video['ext'], $video['server']);    
    if ($video['hd'] == '1') {
        $video_url_hd = VHelper_video_stream::url(TRUE, $video_id, 'mp4', $video['server'], false, true);
    }
    
    $video_mobile = VHelper_video_stream::url_mobile(TRUE, $video_id, $video['ext'], $video['server']);
}
$method = VF::cfg_item('module.video.streaming_method');
        
$bool = array(0=>'false',1=>'true');
ob_start();
?>
<config>
<?php
    print "<regkey>".$player['regkey']."</regkey>n";
    if(strlen($player['skin'])>0) { print "<skin>".$player['skin']."</skin>n"; }
    if (is_array($video_url)) {
        print "<file><![CDATA[".$video_url['file']."]]></file>n";
        
        if (isset($video_url['filehd'])) {
            print "<filehd><![CDATA[".$video_url['filehd']."]]></filehd>n";
        }
        
        if(isset($video_mobile)) print "<html5><![CDATA[".$video_mobile."]]></html5>";
        
        print "<provider>rtmp</provider>n";
        print "<streamer><![CDATA[".strtolower($video_url['stream'])."]]></streamer>n";
    } else {
        print "<file><![CDATA[".$video_url."]]></file>n";
        
        if (isset($video_url_hd)) {
            print "<filehd><![CDATA[".$video_url_hd."]]></filehd>n";
        }
        
        if(isset($video_mobile)) print "<html5><![CDATA[".$video_mobile."]]></html5>";
        if ($method != 'progressive') {
            print "<provider>http</provider>n";
        }
    }
    print "<url>".BASE_URL."/".$video_id."/".$video['slug']."/</url>n";
    print "<mediaid>".$video_id."</mediaid>n";
    // Image
    $image = MEDIA_URL."/videos/tmb/".path($video_id)."/player.jpg?tm=".time();
    if(file_exists(MEDIA_DIR."/videos/tmb/".path($video_id)."/0.jpg")) $image = MEDIA_URL."/videos/tmb/".path($video_id)."/0.jpg?tm=".time();
    print "<image>".$image."</image>n";
    print "<title><![CDATA[".$video['title']."]]></title>n";
    if($player['related_show']==1) {
        if(strlen($player['related'])>1) {
            print "<custom_guide>".$player['related']."</custom_guide>n";
        } 
        print "<related>".PLAYER_URL."/related.php?id=".$video_id."&title=".htmlspecialchars($video['title'], ENT_QUOTES, 'UTF-8')."</related>n";
    }
    
    if(strlen($player['statscript'])>0)    { print "<statscript>".$player['statscript']."</statscript>n"; }
    //autostart (true/false)
    if(isset($player['autostart'])) 
        print "<autostart>".$bool[$player['autostart']]."</autostart>n";
    // Stretching (aspect/fit)
    if(strlen($player['stretching'])>0)    { print "<stretching>".$player['stretching']."</stretching>n"; }
    //default volume (0-100)
    if(strlen($player['volume'])>0)        { print "<volume>".$player['volume']."</volume>n"; }
    //show tooltips (true/false)
    if(strlen($player['usetooltips'])>0)    { print "<usetooltips>".$bool[$player['usetooltips']]."</usetooltips>n"; }
    // Controlbar position (bottom/over)
    if(isset($player['playbar']))        { print "<playbar>".$player['playbar']."</playbar>n";  }
    // Show viral Menu icon
    if(isset($player['viral_menu']))        { print "<viral_menu>".$bool[$player['viral_menu']]."</viral_menu>n"; }
    // Show viral Share icon
    if(isset($player['viral_share']))        { print "<viral_share>".$bool[$player['viral_share']]."</viral_share>n"; }
    // Show viral Slomo icon
    if(isset($player['viral_slomo']))        { print "<viral_slomo>".$bool[$player['viral_slomo']]."</viral_slomo>n"; }
    // Show viral lightsoff icon
    if(isset($set['viral_lights']))        { print "<viral_lights".$bool[$set['viral_lights']]."</viral_lights>n"; }
    // Viral icons Y Offset
    if(isset($player['viral_offset']))    { print "<viral_offset>".$player['viral_offset']."</viral_offset>n"; }
    // Viral icons align (left/right)
    if(strlen($player['viral_align'])>0)    { print "<viral_align>".$player['viral_align']."</viral_align>n"; }
    // Controlbar Logo
    if(strlen($player['barlogo'])>0) { 
        //Image URL
        print "<barlogo>".$player['barlogo']."</barlogo>n";
    }
    // Standard logo
    if(strlen($player['logo'])>0) { 
        //Image URL
        print "<logo>".$player['logo']."</logo>n";
        //URL to go when logo clicked
        if(strlen($player['logourl'])>0) { print "<logourl>".$player['logourl']."</logourl>n"; }
        //Logo position
        if(strlen($player['logoalign'])==2)    { print "<logoalign>".$player['logoalign']."</logoalign>n"; }
        //logo position offset (X and Y)
        if(isset($player['logooffsetx'])>0)        { print "<logooffsetx>".$player['logooffsetx']."</logooffsetx>n"; }
        if(isset($player['logooffsety'])>0)        { print "<logooffsety>".$player['logooffsety']."</logooffsety>n"; }
    }
    //URL to go when logo clicked
    if(strlen($player['logourl'])>0) { print "<logourl>".$player['logourl']."</logourl>n"; }
    //show email window
    if(isset($player['email_show']))        { print "<email_show>".$bool[$player['email_show']]."</email_show>n"; }
    //show share window
    if(isset($player['share_show']))        { print "<share_show>".$bool[$player['share_show']]."</share_show>n"; }
    //show embed code
    if(isset($player['embed_show']))        { print "<embed_show>".$bool[$player['embed_show']]."</embed_show>n"; }
    //show screen settings window
    if(isset($player['screen_show']))        { print "<screen_show>".$bool[$player['screen_show']]."</screen_show>n"; }
    //show related window
    if(isset($player['related_show']))        { print "<related_show>".$bool[$player['related_show']]."</related_show>n"; }
    //replay button
    if(isset($player['replay_button']))        { print "<replay_button>".$bool[$player['replay_button']]."</replay_button>n"; }
    //zoom button
    if(isset($player['zoom_button']))            { print "<zoom_button>".$bool[$player['zoom_button']]."</zoom_button>n"; }
    //volume button
    if(isset($player['volume_button']))        { print "<volume_button>".$bool[$player['volume_button']]."</volume_button>n"; }
    //size window button
    if(isset($player['size_button']))            { print "<size_button>".$bool[$player['size_button']]."</size_button>n"; }
    //fullscreen button
    if(isset($player['fullscreen_button']))    { print "<fullscreen_button>".$bool[$player['fullscreen_button']]."</fullscreen_button>n"; }
    //embed code
    if($video['allow_embed']) {
        $embedcode = '<![CDATA[<iframe width="'.$player['player_width'].'" height"'.$player['player_height'].'" scrolling="no" src="'.BASE_URL.'/embed/'.$video_id.'" frameborder="0" allowfullscreen></iframe>]]>';
        print "<embedcode>".$embedcode."</embedcode>n";
    } else {
        print "<embedcode>N/A</embedcode>n";
    }
    //Flash context menu on right click
    if(strlen($player['menutext'])>0)  {
        print "<menuitem>true</menuitem>n";
        print "<menutext>".$player['menutext']."</menutext>n";
        if(strlen($player['menulink'])>0)    
            print "<menulink>".$player['menulink']."</menulink>n";
    } else {
        print "<menuitem>false</menuitem>n";
    }
    // RSS URL
    if(strlen($player['rss_url'])>0) print "<rss_url>".$player['rss_url']."</rss_url>n";
    //Video window on click action
    print "<onclick>play</onclick>n";
    require BASE_DIR."/misc/nuevo/ads.php";
    if(file_exists('thumbs.php')) include('thumbs.php');
    if(strlen($plugins)>0) { print "<plugins>".trim($plugins,",")."</plugins>n"; }
    $langfile = BASE_DIR. '/misc/nuevo/languages/en-US.php';
    if(isset($_SESSION['language'])) {
        $testlang = BASE_DIR. '/misc/nuevo/languages/'.$_SESSION['language'].'.php';
        if(file_exists($testlang)) $langifile = $testlang;
    }
    
    if(file_exists($langfile)) 
    {
        include $langfile;
        if($lng) {
            foreach ( $lng as $key => $value )
            {
                $key = str_replace('nuevo_','',$key);
                print "<".$key.">".htmlspecialchars($value, ENT_QUOTES, 'UTF-8')."</".$key.">n";
            }    
        }
    }
?>
</config>
<?php
$config = ob_get_contents();
ob_end_clean();
VResponse::add_header('Content-Type', 'text/xml');
VResponse::add_header('Pragma', 'no-cache');
VResponse::add_header('Cache-Control', 'no-cache, must-revalidate');
VResponse::add_header('Last-Modified', gmdate('D, d M Y H:i:s').' GMT');
VResponse::add_header('Expires', 'Sat, 26 Jul 1997 05:00:00 GMT');
VResponse::send_headers();
echo $config;
VF::close();
?>