Файл: adultscript-2.0.3-pro/files/misc/nuevo/midroll.php
Строк: 97
<?php
//***********************************************
//*        NuevoLab FLASH PLAYER ver. 8.0            *
//*                                                *
//*        http://www.nuevolab.com                    *
//*        email: support@nuevolab.com                *
//*                                                *
//***********************************************
define('_VALID', true);
require '../config_common.php';
$channel='';
if ( isset($_GET['ch']) ) {
    $channel = intval(trim($_GET['ch']));
}
$bool = array(0=>'false',1=>'true');
$mids=array();
$now=time();
$db            = VF::factory('database');
if($channel != '') {
    
    $chans = explode("|",$channel);
    foreach($chans as $ch) {
        if(!$ch=='0') { $add.='channel = '.$ch.' OR '; }
    }
    $add =trim($add); $add=trim($add,'OR');$add=trim($add);
    $sql = "select * from nuevo__midroll where active = 1 and channel='".mysql_real_escape_string($channel)."' and expire>'".mysql_real_escape_string($now)."' order by RAND() limit 5";
    $rows=$db->get_rows($sql);
    foreach ($rows as $row)
        {
            if(intval($row['duration'])>=3) $duration = intval($row['duration']); else $duration=5 ;
            $mids[] = array('ID' => $row['ID'], 'title' => $row['title'], 'description' => $row['description'], 'link' => $row['link'], 'url' => $row['url'], 'image' => $row['image'], 'duration' => $duration);
        }
}
if(count($mids)==0) {
    $sql = "select * from nuevo__midroll where active = 1 and channel = '0' and expire>'".mysql_real_escape_string($now)."' order by RAND() limit 5";
    $rows=$db->get_rows($sql);
        foreach($rows as $row)
        {
            if(intval($row['duration'])>=3) $duration = intval($row['duration']); else $duration=5 ;
            $mids[] = array('ID' => $row['ID'], 'title' => $row['title'], 'description' => $row['description'], 'link' => $row['link'], 'url' => $row['url'], 'image' => $row['image'], 'duration' => $duration);
        }
}
    
    header("Content-Type: text/xml");
    header("Expires: 0");
    print "<?xml version="1.0" encoding="UTF-8" ?>n";
    print "<midroll>n";
    foreach($mids as $mid) {
        print "<ad>n";
        print "<id>".$mid['ID']."</id>n";
        print "<duration>".$mid['duration']."</duration>n";
        print "<url><![CDATA[".$mid['url']."]]></url>n";
        print "<title><![CDATA[".$mid['title']."]]></title>n";
        print "<description><![CDATA[".$mid['description']."]]></description>n";
        print "<display_url><![CDATA[".$mid['link']."]]></display_url>n";
        if(strlen($mid['image'])>0) {
            print "<image><![CDATA[".$mid['image']."]]></image>n";
        }
        print "</ad>";
    }
    print "</midroll>";
?>