HEX
Server: Apache/2.4.59 (Debian)
System: Linux skycube.cz 4.19.0-25-amd64 #1 SMP Debian 4.19.289-2 (2023-08-08) x86_64
User: ilya (534)
PHP: 7.3.31-1~deb10u7
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: /var/www/ilya/data/www/afish-ka.ru/modules/services/yandex_afisha.inc
<?

header("Content-Type: application/rss+xml; charset=UTF-8");

print "<?xml version='1.0' encoding='UTF-8'?>"; ?>

<schedule>
<?

$result = query("SELECT `s`.*, `a`.* FROM `actions` `a` LEFT JOIN `shedule` `s` ON `a`.`id` = `s`.`aid` WHERE `s`.`datetime`>='".date("Y-m-d 05:00:00",TIME)."' AND `a`.`type` IN (1,2,4,7,8) AND `s`.`price`<>'?' GROUP BY `a`.`id`;");

while($data = mysql_fetch_array($result)) {
?>  <event id="<? print $data['aid']; ?>" children="0">
<? if($data['type']==1) print "    <type>cinema</type>\n";
else if($data['type']==2) print "    <type>theatre</type>\n";
else if($data['type']==4) print "    <type>club</type>\n";
else if($data['type']==8) print "    <type>art</type>\n";
else if($data['type']==7) print "    <type>concert</type>\n"; ?>
    <title><![CDATA[<? print $data['title']; ?>]]></title>
<? /*    <original>Rio</original>
    <aka>Попугай Рио</aka>
    <runtime>96</runtime> */
    if($data['country']!='') print "    <country>".$data['country']."</country>\n";
//   <year>2011</year>
//    <release_date>2011-04-07</release_date>

	if($data['type']==1) {
		$prime_date = mysql_fetch_array(query("SELECT MIN(`datetime`) FROM `shedule` WHERE `aid`='".$data['aid']."';"));
		print "    <premiere>".substr($prime_date[0],0,10)."</premiere>\n";
	}
    if($data['genre']!='') print "    <genre><![CDATA[".$data['genre']."]]></genre>\n";
    if($data['producer']!='') print "    <director>".$data['producer']."</director>\n";
    if($data['actors']!='') print "    <cast>".$data['actors']."</cast>\n";
	
    $handle=opendir('images/b/posters/');
	$poster = false;
    while ((false !== ($file = readdir($handle))) /*&& ($actions_img_poster=='')*/)
         {
		 
         if (($file != ".") && ($file != "..")  && strstr($file,$data['aid'].".") && (substr($file,0,strpos($file,$data['aid']."."))==""))
                {
                if (strpos($file,$data['aid'].".")==0/5) {
                $poster = true;
				$filename = $file;
                }
                }
         }
    closedir($handle);
	
    if($poster)	print "    <poster>http://www.afish-ka.ru/images/b/posters/".$filename."</poster>\n"; 
	
    $image_files = get_images('images/b/actions/');
    foreach ($image_files as $file) {
      if (($file != ".") && ($file != "..") && strstr($file,$data['aid']."_") && (substr($file,0,strpos($file,$data['aid']."_"))==""))
        {
        print "    <image>http://www.afish-ka.ru/images/b/actions/".$file."</image>\n"; break;
        }
    }
	
  /*<trailers>
      <trailer_url language="ru">http://video.timeout.ru/Rio_TRL.flv</trailer_url>
      <trailer_url language="en">http://video.timeout.ru/Rio_TRL_en.flv</trailer_url>
    </trailers>*/
    if(isset($data['url']) && $data['url']!='') print "    <url>http://".$data['url']."</url>\n";
    if($data['description']!='') print "    <text><![CDATA[".text_replace($data['description'])."]]></text>\n"; ?>
  </event>
  <?
}

$result = query("SELECT `s`.*, `f`.`type`, `f`.`title`, `f`.`address`, `f`.`tel`, `f`.`description` FROM `firms` `f` LEFT JOIN `shedule` `s` ON `f`.`id` = `s`.`fid` LEFT JOIN `actions` `a` ON `a`.`id`=`s`.`aid` WHERE `s`.`datetime`>='".date("Y-m-d 05:00:00",TIME)."' AND `a`.`type` IN (1,2,4,7,8) AND `s`.`price`<>'?' GROUP BY `f`.`id`;");

while($data = mysql_fetch_array($result)) {
print "  <place id=\"".$data['fid']."\">\n";

if($data['type']==1) print "    <type>cinema</type>\n";
else if($data['type']==2) print "    <type>theatre</type>\n";
else if($data['type']==3) print "    <type>club</type>\n";
else if($data['type']==4) print "    <type>club</type>\n";
else if($data['type']==7) print "    <type>concert</type>\n";
else if($data['type']==8) print "    <type>art</type>\n";
else print "    <type>club</type>\n";
print "    <title>".$data['title']."</title>\n";
   // <aka>5 звёзд Павелецкий</aka>
print "    <city>Петропавловск-Камчатский</city>\n";
    print "    <address>".$data['address']."</address>\n";
//    <metro>Павелецкая</metro>
    if($data['tel']!='') print "    <phone>".$data['tel']."</phone>\n";
 //   <price>Билеты 150-300 р.</price>
 //   <time>с 9:00 до 23:00</time>

    $image_files = get_images('images/b/firms/');
    foreach ($image_files as $file) {
      if (($file != ".") && ($file != "..") && strstr($file,$data['fid']."_") && (substr($file,0,strpos($file,$data['fid']."_"))==""))
        {
        print "    <image>http://www.afish-ka.ru/images/b/firms/".$file."</image>\n"; break;
        }
    }
 
    if(isset($data['url']) && $data['url']!='') print "    <url>http://".$data['url']."</url>\n";
    if($data['description']!='') print "    <text><![CDATA[".text_replace($data['description'])."]]></text>\n"; 
print "  </place>\n";

	}

	$result = query("SELECT `s`.*, `a`.`title` FROM `shedule` `s` LEFT JOIN `actions` `a` ON `s`.`aid`=`a`.`id` WHERE `s`.`datetime`>='".date("Y-m-d 05:00:00",TIME)."' AND `a`.`type` IN (1,2,4,7,8) AND `s`.`price`<>'?';");
	
	while($data=mysql_fetch_array($result)) {
	if(strstr($data['title'],"(3D)")||(strstr($data['title']," 3D ")))
		print "  <section id=\"".rand(10000000,99999999)."\" date_start=\"".substr($data['datetime'],0,10)."\" date_finish=\"".substr($data['datetime'],0,10)."\" time=\"".substr($data['datetime'],11,5)."\" format=\"3D\">\n";
	else
		print "  <section id=\"".rand(10000000,99999999)."\" date_start=\"".substr($data['datetime'],0,10)."\" date_finish=\"".substr($data['datetime'],0,10)."\" time=\"".substr($data['datetime'],11,5)."\">\n";
print "    <event id=\"".$data['aid']."\"/>\n";
print "    <place id=\"".$data['fid']."\"/>\n";
print "  </section>\n";
	}



print "</schedule>";
?>