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/afisha38.ru/modules/services/yandex_wdgt.inc
<html>

<head>
	
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="keywords" content="" />
<meta name="description" content="" /><title></title>
<script type="text/javascript" language="javascript" src="http://img.yandex.net/webwidgets/1/WidgetApi.js"></script>
<script type="text/javascript" language="javascript" src="<? print $url; ?>i/yandex_wdgt.js"></script>
	
	<style>
		* {
			background-color:transparent;
			margin:0; padding:0px;
			font:100% Arial,Helvetica,sans-serif;
			font-style:normal;
		}
		table {
			border-collapse: collapse;
		}
		table tr {
			vertical-align: top;
		}
		
		table tr td.f{
			padding-top: 0px;
		}
		
		table tr td{
			padding-top: 6px;
		}
		
		table tr td em{
			font-size: 70%;
			color:#666666;
		}
		
		a{font-size: 80%;}
		a:link{color:#1A3DC1}
	</style>

	<script type="text/javascript">
		$(document).ready(function() {
			widget.setIFrameHeight($('#w-y-afisha').height());
		});
	</script>
	
</head>

<body onload="widget.adjustIFrameHeight()">
	<table id="w-y-afisha">

<?php

#————————————————————> CMS Termit <———————————————————————#
#                                                         #
#                 Author: Ilya Rudomilov                  #
#                                                         #
#                E-mail: ilya@rudomilov.ru                #
#              URL: http://www.rudomilov.ru/              #
#                      ICQ: 203015                        #
#                                                         #
#——————————————> Grafix Design — (c) 2006 <———————————————#

$cur_date = date("Y-m-d",TIME)." 05:00:00";

      $result2 = query("SELECT `shedule`.`aid` FROM `shedule` LEFT JOIN `actions` ON `shedule`.`aid`=`actions`.`id` WHERE `shedule`.`datetime`>='".$cur_date."' AND `shedule`.`datetime`<DATE_ADD('".$cur_date."', INTERVAL 1 DAY) AND `actions`.`type`=1 GROUP BY `shedule`.`aid` ORDER BY `shedule`.`aid` DESC");

      $afisha = array();
      $i = 0;

      $actions = "";
      while($data2 = mysql_fetch_array($result2))
            {
			$afisha[$i] = array(0,"");
            $result3 = query("SELECT `fid` FROM `shedule` WHERE `datetime`>='".$cur_date."' AND `datetime`<DATE_ADD('".$cur_date."', INTERVAL 1 DAY) AND `aid`=".$data2['aid']." GROUP BY `fid` ORDER BY `fid`,`datetime`");

            $action_title = mysql_fetch_array(query("SELECT `actions`.*, `firms_types`.`human_subid`, `firms_types`.`human_id` FROM `actions` LEFT JOIN `firms_types` ON `firms_types`.`id`=`actions`.`type` WHERE `actions`.`id`=".$data2['aid']." LIMIT 1;"));
            if ($action_title['type']==1)
                {
                $action_prime = mysql_fetch_array(query("SELECT COUNT(`id`) FROM `shedule` WHERE `aid`=".$data2['aid']." AND `datetime`<'".$cur_date."'"));
                if ($action_prime[0]>0)
                    $action_prime = 0;
                else
                    $action_prime = 1;
                }
            else
                {
                $action_prime = mysql_fetch_array(query("SELECT `is_prime` FROM `shedule` WHERE `aid`=".$data2['aid']." AND `shedule`.`datetime`>='".$cur_date."' AND `shedule`.`datetime`<DATE_ADD('".$cur_date."', INTERVAL 1 DAY);"));
                $action_prime = $action_prime[0];
                }
            if($action_prime==1)
                $afisha[$i][0] = $afisha[$i][0]+1000; // Премьерам +1000

            $opinions_ratelist = array('','очень плохо','плохо','довольно плохо','удовлетворительно','весьма неплохо','нормально','весьма хорошо','хорошо','очень хорошо','отлично');
            $action_opinions = mysql_fetch_array(query("SELECT COUNT(`id`) AS `count`, SUM(`rate`)/COUNT(`id`) AS `rating` FROM `opinions` WHERE `aid`=".$data2['aid'].";"));
            $action_opinions_rating = round($action_opinions['rating']);
            $action_opinions_num = $action_opinions['count'];

            $afisha[$i][0] = $afisha[$i][0]+1*$action_opinions_num; // За каждое заведение 20 баллов

            $action_producer = $action_title['producer'];
            $action_actors = $action_title['actors'];
            $action_genre = mb_strtolower($action_title['genre'],'utf-8');
            $action_url = "./".$action_title['human_id']."/".$action_title['human_subid']."/".$data2['aid']."/";
            $action_title = $action_title['title'];

            $action_img = "";
            $image_files = get_images('images/b/actions/');
            foreach ($image_files as $file) {
               if (($file != ".") && ($file != "..") && strstr($file,$data2['aid']."_") && (substr($file,0,strpos($file,$data2['aid']."_"))==""))
                    {
                    $action_img = $file; break;
                    }
               }

            $firms = "";
            while($data3 = mysql_fetch_array($result3))
                  {
                  $result4 = query("SELECT * FROM `shedule` WHERE `datetime`>='".$cur_date."' AND `datetime`<DATE_ADD('".$cur_date."', INTERVAL 1 DAY) AND `fid`=".$data3['fid']." AND `aid`=".$data2['aid']." ORDER BY `datetime`");

                  $firms_title = query("SELECT `firms`.`title`, `firms_types`.`human_id` FROM `firms` LEFT JOIN `firms_types` ON `firms`.`type`=`firms_types`.`id` WHERE `firms`.`id`=".$data3['fid'].";");
                  $firms_title = mysql_fetch_array($firms_title);
                  $firms_url = $firms_title[1]."/".$data3['fid']."/";
                  $firms_title = $firms_title[0];

                  $timetable_list = "";
                  while($data4 = mysql_fetch_array($result4))
                        {
                        $afisha[$i][0] = $afisha[$i][0]+5; // За сеанс каждый 5 баллов
                        }

                  $afisha[$i][0] = $afisha[$i][0]+20; // За каждое заведение 30 баллов
                  //$firms .= preg_replace("/{%(\w+)%}/ee", "$\\1",_html("afisha_row_firm.htm",0));
                  }

            $action_rating = $afisha[$i][0];
            //$actions_row = preg_replace("/{%(\w+)%}/ee", "$\\1",_html("afisha_row.htm",0));
            $actions_row = preg_replace("/{%(\w+)%}/ee", "$\\1","<tr><td><a href=\"".$url."{%action_url%}\" target=\"_blank\">{%action_title%}</a> <em>".$action_genre."</em></td></tr>\r");

            $afisha[$i][1] = $actions_row;

            $i++;
            }
      $i=1;
      while($i<sizeof($afisha)) {
          if($afisha[$i][0]>$afisha[$i-1][0]) {
              $tmp = $afisha[$i-1];
              $afisha[$i-1] = $afisha[$i];
              $afisha[$i] = $tmp;
              $i=1;
          }
      else
          $i++;
      }

      for($i=0;$i<6;$i++) {
          $actions .= $afisha[$i][1];
      }

if (mysql_num_rows($result2)==0)
    print "К сожалению, расписание на сегодня еще не добавлено :(";

print $actions;

?>
</table>
</body>
</html>