Advertisement
Guest User

Untitled

a guest
Oct 14th, 2015
941
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 46.23 KB | None | 0 0
  1. <?
  2.  
  3. $vars_znatoki="351";
  4. $vars_book="1284";
  5. $vars_znatokimax="20";
  6. $vars_znatokimaxmovie="Трансформеры";
  7. $vars_znatokimaxznatok="75";
  8. $vars_znatokimaxznatokname="Алекс Экслер";
  9. $vars_opinion="1656";
  10. $bigmovies_codename[7]="fastfurious7";
  11. $bigmovies_russian[7]="Форсаж-7";
  12. $bigmovies_codename[8]="hobbit3";
  13. $bigmovies_russian[6]="Пятьдесят оттенков серого";
  14. $bigmovies_codename[6]="50shadesofgrey";
  15. $vars_money="1764";
  16. $bigmovies_codename[5]="penguinsofmadagascar";
  17. $bigmovies_russian[5]="Пингвины Мадагаскара";
  18. $bigmovies_codename[4]="avengers2";
  19. $bigmovies_russian[4]="Мстители: Эра Альтрона";
  20. $bigmovies_russian[2]="Исход: Цари и боги";
  21. $bigmovies_codename[3]="minionsproject";
  22. $bigmovies_russian[3]="Миньоны";
  23. $bigmovies_codename[2]="exodus";
  24. $bigmovies_russian[1]="Интерстеллар";
  25. $bigmovies_codename[1]="interstellar";
  26. $bigmovies_russian[0]="Голодные игры: Сойка-пересмешница. Часть - 1";
  27. $bigmovies_codename[0]="hungergames3";
  28. $bigmovies_russian[8]="Хоббит: Битва пяти воинств";
  29. $bigmovies_codename[9]="intothewoods";
  30. $bigmovies_russian[9]="Чем дальше в лес...";
  31.  
  32. ?><?
  33.  
  34. $compare_const=13;
  35. $compareall_const=10;
  36.  
  37. function boxworld_tr ($page, $date, $russian, $gross, $class='')
  38. {
  39.     global $lang;
  40.    
  41.     echo '<tr'.($class!=''?' class="'.$class.'"':'').'>
  42.     <td width="20%" class="boxmain_date"><a href="/'.$page.'/'.$date.($lang=='en'?'/en':'').'/">'.boxdate($date,0,($page=='box'?3:($page=='boxrussia' || $page=='boxworld'?4:7)),$lang).'</a></td>
  43.     <td width="65%" class="boxmain_movies"><a href="/'.$page.'/'.$date.($lang=='en'?'/en':'').'/">'.$russian.'</a></td>
  44.     <td width="15%" class="boxmain_gross">'.number_format($gross,0,',',' ').'</td>
  45.     </tr>';
  46. }
  47.  
  48. function box_modify ($b, $field, $page)
  49. {
  50.     global $do,$i,$compare_const,$compareall_const;
  51.     $var=$b[$field];
  52.     if ($field=='average' || $field=='cost')
  53.         $var='$ '.number_format($var,0,',',' ');
  54.  
  55.     if ($field=='weekend')
  56.         $var='$ '.$var;
  57.        
  58.     if ($field=='gross' || $field=='allgross' || $field=='world' || $field=='usa' || $field=='international')
  59.         if (($page=='boxanimedvd' || $page=='boxanimebluray' || $page=='boxanime'))
  60.         {
  61.             $var=number_format($var,0,',',' ');
  62.            
  63.             if ($page=='boxanime' || $page=='boxanimedvd' || $page=='boxanimebluray')
  64.             {
  65.            
  66.                 if ($field=='gross' && $b['chvol']!=0)
  67.                     $subvar=$b['chvol'];
  68.                 else
  69.                 if ($field=='allgross' && $b['chvolall']!=0)
  70.                     $subvar=$b['chvolall'];
  71.                 else
  72.                     $subvar='';
  73.                    
  74.                 if ($subvar!='')
  75.                     $var.='<br><span style="color: #'.($subvar>0?'0000FF':'f40000').'; font-size: 10px;">'.($subvar>0?'+'.number_format($subvar,1,',',''):'&minus;'.number_format(-$subvar,1,',','')).'%</span>';
  76.             }
  77.            
  78.         }
  79.         else
  80.         if ($page=='boxrussia' || $page=='boxdayrussia' )
  81.             $var='$ '.number_format($var,0,',',' ');
  82.         else
  83.             $var=($var!=0?'$ ':'').number_format($var/1000000,1,',',' ');
  84.     if ($field=='ch' || $field=='chweek' || $field=='chtheaters' || $field=='chterritories') {
  85.         if ($var==0)
  86.             $var='&nbsp;';
  87.         else
  88.             if ($var>0)
  89.                 $var='<span style="color: #0000FF;">+'.($field=='ch' || $field=='chweek'?number_format($var,1,',','').'%':$var).'</span>';
  90.             else
  91.                 $var='<span style="color: #f40000;">&minus;'.($field=='ch' || $field=='chweek'?number_format(-$var,1,',','').'%':-$var).'</span>';
  92.  
  93.     }
  94.     if ($field=='place')
  95.     {
  96.         if ($b['lastplace']==0 || $b['lastplace']==999 || $var==999) $chplace=''; else {
  97.             $chplace=$var-$b['lastplace'];
  98.             if ($chplace>0) $chplace='<br><span style="color: #f40000;">&darr;'.$chplace.'</span>'; else
  99.                 if ($chplace<0) $chplace='<br><span style="color: #0000FF;">&uarr;'.-$chplace.'</span>'; else
  100.                     $chplace='';
  101.         }
  102.         $var=($var==999?'-':$var).$chplace;
  103.        
  104.     }
  105.    
  106.     if ($field=='compare')
  107.     {
  108.         if ($b['compare_gross']==0 && $b['compare_allgross']==0) $compare='';
  109.         else {
  110.        
  111.             $compare='';
  112.            
  113.             if ($b['compare_gross']>=$compare_const) $compare.='<span style="color: #0000FF;">'.number_format($b['compare_gross'],1,',','').'%'.'</span>';
  114.             else if ($b['compare_gross']<$compare_const) $compare.='<span style="color: #f40000;">'.number_format($b['compare_gross'],1,',','').'%'.'</span>';
  115.                 else $compare.='-';
  116.            
  117.             if ($b['compare_allgross']!=$b['compare_gross'])
  118.             {
  119.                 if ($b['compare_allgross']>=$compareall_const) $compare.='<br><span style="color: #0000FF;">'.number_format($b['compare_allgross'],1,',','').'%'.'</span>';
  120.                 else if ($b['compare_allgross']<$compareall_const) $compare.='<br><span style="color: #f40000;">'.number_format($b['compare_allgross'],1,',','').'%'.'</span>';
  121.                     else $compare.='<br>-';
  122. }          
  123.  
  124.         }
  125.         $var=$compare;
  126.        
  127.     }
  128.    
  129.         return $var;
  130. }
  131.  
  132. function boxtables_new ($page, $table, $date, $fields, $fields_info, $fields_width, $fields_align, $limit, $sort='place', $select='', $newsrows=10)
  133. {
  134.     // $table = таблица: boxoffice, boxrussia, boxworld
  135.     // $date = дата в формате '230308' (23 марта 2008 года) или '230308_4' (если надо взять 4-дневный уик-энд)
  136.     // ...пустая только в случае с boxalltime
  137.     // $sort = сортировка по одному из параметров
  138.     // $fields = array ('place','codename','ch...')
  139.     // $fields_info = array ('Место', 'Фильм', '±');
  140.        
  141.     global $do;
  142.     global $compare_const,$compareall_const;
  143.    
  144.     $zerogross=0;
  145.    
  146.     if ($sort=='') $sort='place';
  147.     if ($sort!='place') $sort.=' DESC';
  148.     if ($sort=='place') $sort.=' ASC, gross DESC';
  149.     if ($page=='boxalltime')
  150.         $box=q("select * from ".$table." ORDER BY $sort LIMIT ".$limit);
  151.     else
  152.     if ($page!='boxday' && $page!='boxdayrussia')
  153.         $box=q("select * from ".$table." where date='$date' ORDER BY $sort LIMIT ".$limit);
  154.     else
  155.     {
  156.         $ts=mktime(0,0,0,mb_substr($date,2,2),mb_substr($date,0,2),mb_substr($date,4,2));
  157.         $box=q("select * from boxdaily where type=".($page=='boxday'?0:'').($page=='boxdayrussia'?1:'')." AND timestamp=".$ts." ORDER BY $sort LIMIT ".$limit);
  158.     }
  159.    
  160.     $i=0;
  161.     $text='';
  162.     $newstext='';
  163.    
  164.     $text.='
  165. <ul class="box_office">
  166.     <li class="head">';
  167.    
  168.     $newstext.='
  169. <ul class="box_office">
  170.     <li class="head">';
  171.    
  172.    
  173.     $intxt='';
  174.     $ntxt='';
  175.    
  176.     if (($page=='boxday' || $page=='boxdayrussia') && fq("select weekend from boxdaily where type=".($page=='boxday'?0:'').($page=='boxdayrussia'?1:'')." AND timestamp=".$ts." AND weekend!=''"))
  177.         $dailyprophet=true;
  178.     else
  179.         $dailyprophet=false;
  180.        
  181.     if ($dailyprophet)
  182.     {
  183.         array_push ($fields,'weekend');
  184.         array_push ($fields_info,'Прогноз<br>млн.');
  185.         array_push ($fields_width,'10%');
  186.         array_push ($fields_align,'center');       
  187.     }
  188.    
  189.        
  190.    
  191.     //while ($page=='boxday' || $page=='boxdayrussia'?list($keyb, $b) = each($table):$b=mysql_fetch_array($box))
  192.     while ($b=mysql_fetch_array($box))
  193.     {
  194.  
  195.         $i++;
  196.        
  197.         $textarray=boxrow_new ($b, $page, $fields, $fields_width, $fields_align, $i, $newsrows);
  198.         $ntxt.=$textarray['newstext'];
  199.         $intxt.=$textarray['text'];
  200.        
  201.         if ($page=='boxanime' && $b['subs_num']>1)
  202.         {
  203.             $subs=explode (' ',mb_trim($b['ids']));
  204.             foreach ($subs as $sb)
  205.             {
  206.                 $s=explode ('/',$sb);
  207.                 $subq=fq ("SELECT * FROM boxofficeanime".$s[0]." WHERE id=".$s[1]);
  208.                 $subq['type']=' '.$s[0].' ';
  209.                 $subq['place']='';
  210.                 $br=boxrow_new ($subq, $page, $fields, $fields_width, $fields_align, 1, 0, $b['place']);
  211.                 $intxt.=$br['text'];
  212.             }
  213.         }
  214.  
  215.     }
  216.    
  217.     $ti=0;
  218.     foreach ($fields as $key => $f)
  219.     {
  220.         $ti++;
  221.    
  222.         $text.='
  223. <div'.($fields_width[$key]!=''?' style="width: '.$fields_width[$key].';"':'').'>'.$fields_info[$key].'</div>';
  224.        
  225.         if ($f!='chtheaters' && $f!='average' && $f!='days') {
  226.             $newstext.='
  227. <div'.($fields_width[$key]!=''?' style="width: '.$fields_width[$key].';"':'').'>'.$fields_info[$key].'</div>';
  228.  
  229.     }
  230.  
  231.     }
  232.  
  233.     if ($limit!=10 && $page=='boxanime') {
  234.         $text.='<div>Формат</div>';
  235.     }
  236.        
  237.     if ($do && ($page=='boxanimedvd' || $page=='boxanimebluray' || $page=='boxanime')) $text.='<div style="width: 20px;">Ист.</div>';
  238.    
  239.     $text.='
  240. </li>';
  241.     $newstext.='
  242. </li>';
  243.    
  244.  
  245.     $text.=$intxt;
  246.     $newstext.=$ntxt;
  247.    
  248.    
  249.     $text.='
  250. </ul>';
  251.     $newstext.='
  252. </ul>';
  253.     return array ('text'=>$text, 'newstext'=>$newstext);
  254.  
  255.  
  256. }
  257.  
  258.  
  259. function boxtables ($page, $table, $date, $fields, $fields_info, $fields_width, $fields_align, $limit, $sort='place', $select='', $newsrows=10)
  260. {
  261.     // $table = таблица: box, boxrussia, boxworld
  262.     // $date = дата в формате '230308' (23 марта 2008 года) или '230308_4' (если надо взять 4-дневный уик-энд)
  263.     // ...пустая только в случае с boxalltime
  264.     // $sort = сортировка по одному из параметров
  265.     // $fields = array ('place','codename','ch...')
  266.     // $fields_info = array ('Место', 'Фильм', '±');
  267.  
  268.     global $do;
  269.     global $newstext, $newsmark;
  270.     global $compare_const,$compareall_const;
  271.    
  272.     $zerogross=0;
  273.    
  274.     if ($sort=='') $sort='place';
  275.     if ($sort!='place') $sort.=' DESC';
  276.     if ($sort=='place') $sort.=' ASC, gross DESC';
  277.     if ($page=='boxalltime')
  278.         $box=q("select * from ".$table." ORDER BY $sort LIMIT ".$limit);
  279.             else if ($page!='boxday' && $page!='boxdayrussia') $box=q("select * from ".$table." where date='$date' ORDER BY $sort LIMIT ".$limit);
  280.     $i=0;
  281.     $text='';
  282.    
  283.     $text.='
  284. <table id="boxtable" class="percent100" style="color: #333333; background-color: #dadada; border: 1px solid #d9d9d9; border-style: none none solid none;">
  285. <thead><tr>';
  286.    
  287.     $newstext.='
  288. <table class="percent100" style="color: #333333; background-color: #dadada; border: 1px solid #d9d9d9; border-style: none none solid solid;">';
  289.  
  290.     $newsmark.="[boxoffice=".$page."]\n";
  291.    
  292.     $ti=0;
  293.     foreach ($fields as $key => $f)
  294.     {
  295.         $ti++;
  296.  
  297.  
  298.     $sort_js='';
  299.     if ($f=='gross' || $f=='allgross' || $f=='average' || $f=='cost' || $f=='theaters' || $f=='chtheaters' || $f=='ch' || $f=='chweek' || $f=='days') $sort_js.='child: \'nobr\', sortType: \'numeric\', sortDesc: true, ';
  300.     else if ($f=='place') $sort_js.='child: \'nobr\', sortType: \'numeric\', sortDesc: false, ';
  301.     else if ($f=='codename') $sort_js.='child: \'a\', sortType: \'ascii\', sortDesc: false, ';
  302.     else $sort_js.='child: \'nobr\', ';
  303.  
  304.    
  305.         $text.='
  306. <th'.($fields_width[$key]!=''?' style="width: '.$fields_width[$key].';"':'').'><div class="box1_hd'.($sort==$f?'_sel">'.$fields_info[$key]:'">'.($page=='boxalltime'?($f=='world' || $f=='internatinal' || $f=='usa'?'<a href="javascript:$(\'#boxtable\').sortTable({onCol: '.$ti.', '.$sort_js.'keepRelationships: true})">'.$fields_info[$key].'</a>':$fields_info[$key]):'<a href="javascript:$(\'#boxtable\').sortTable({onCol: '.$ti.', '.$sort_js.'keepRelationships: true})">'.$fields_info[$key].'</a>')).'</div></th>';
  307.        
  308.         if ($f!='chtheaters' && $f!='average' && $f!='days') {
  309.             $newstext.='
  310. <th'.($fields_width[$key]!=''?' style="text-align: center; width: '.$fields_width[$key].';"':'').'><div class="box1_hd">'.$fields_info[$key].'</div></th>';
  311.        
  312.             $newsmark.=$fields_info[$key].($fields_width[$key]!=""?"#".$fields_width[$key]:"").($ti<sizeof($fields)?" | ":"");
  313.     }
  314.  
  315.     }
  316.    
  317.     if ($i<=$newsrows && $page=='boxanime') {
  318.         $newstext.='<th style="text-align: center;"><div class="box1_hd">Формат</div></th>';
  319.         $newsmark.=" | Формат";
  320.     }
  321.        
  322.     if ($do && ($page=='boxanimedvd' || $page=='boxanimebluray' || $page=='boxanime')) $text.='<td style="width: 20px;">Ист.</td>';
  323.    
  324.     $text.='</tr></thead>
  325. <tbody>
  326. ';
  327.     $newstext.='</tr>
  328. ';
  329.     $newsmark.="\n";
  330.  
  331.     // НАЧАЛИ ВЫВОДИТЬ ОДНУ СТРОКУ
  332.  
  333.     while ($page=='boxday' || $page=='boxdayrussia'?list($keyb, $b) = each($table):$b=mysql_fetch_array($box))
  334.     {
  335.  
  336.         $i++;
  337.        
  338.         $textarray=boxrow ($b, $page, $fields, $fields_width, $fields_align, $i, $newsrows);
  339.         $newstext.=$textarray['newstext'];
  340.         $newsmark.=$textarray['newsmark'];
  341.         $text.=$textarray['text'];
  342.        
  343.         if ($page=='boxanime' && $b['subs_num']>1)
  344.         {
  345.             $subs=explode (' ',mb_trim($b['ids']));
  346.             foreach ($subs as $sb)
  347.             {
  348.                 $s=explode ('/',$sb);
  349.                 $subq=fq ("SELECT * FROM boxofficeanime".$s[0]." WHERE id=".$s[1]);
  350.                 $subq['type']=' '.$s[0].' ';
  351.                 $subq['place']='';
  352.                 if ($subq['date']!=$date)
  353.                     $subq['gross']=0;
  354.                 $br=boxrow ($subq, $page, $fields, $fields_width, $fields_align, 1, 0, $b['place']);
  355.                 $text.=$br['text'];
  356.             }
  357.         }
  358.  
  359.     }
  360.    
  361.     // ЗАКОНЧИЛИ ВЫВОДИТЬ ОДНУ СТРОКУ
  362.    
  363.     $text.='</tbody></table>';
  364.     $newstext.='</table>';
  365.     // $newstext.='</ol></div>';
  366.     return $text;
  367.  
  368. }
  369.  
  370. function boxrow ($b, $page, $fields, $fields_width, $fields_align, $i, $newsrows=10, $sub=0, $select='')
  371. {
  372.     // $table = таблица: box, boxrussia, boxworld
  373.     // $date = дата в формате '230308' (23 марта 2008 года) или '230308_4' (если надо взять 4-дневный уик-энд)
  374.     // ...пустая только в случае с boxalltime
  375.     // $sort = сортировка по одному из параметров
  376.     // $fields = array ('place','codename','ch...')
  377.     // $fields_info = array ('Место', 'Фильм', '±');
  378.  
  379.     global $do;
  380.     global $compare_const,$compareall_const;
  381.     $newstext='';
  382.  
  383.     // НАЧАЛИ ВЫВОДИТЬ ОДНУ СТРОКУ
  384.        
  385.         if ($b['gross']==0) $zerogross=$i; // Значит, начиная с этого места - сборы не указаны
  386.        
  387.         if ($page=='boxanimedvd' || $page=='boxanimebluray' || $page=='boxanime')
  388.         {
  389.        
  390.             if ($b['codename']!='')
  391.             {
  392.                 if (mb_substr($b['codename'],0,1)=='_')
  393.                 {
  394.                     $code='<span style="'.($b['image']!=''?' onmouseover="this.style.cursor=\'help\'; Tip(\'<img src='.$b['image'].' width='.$b['width'].' height='.$b['height'].'>\')" onmouseout="UnTip()"':'').'>'.mb_substr($b['codename'],1).'</span>';
  395.                 } else
  396.                 if (mb_substr($b['codename'],0,8)=='/movies/')
  397.                 {
  398.                     $movie = mysql_fetch_array (q ("select russian, english, original from movies where codename='".mb_substr($b['codename'],8)."';"));
  399.                     $code='<a href="/movies/'.mb_substr($b['codename'],8).'/" style="text-decoration: none;"'.($b['image']!=''?' onmouseover="this.style.cursor=\'help\'; Tip(\'<img src='.$b['image'].' width='.$b['width'].' height='.$b['height'].'>\')" onmouseout="UnTip()"':'').'>«'.$movie['russian'].'»</a>';
  400.                     $codemark="[«".$movie['russian']."»](/movies/".mb_substr($b['codename'],8).")";
  401.  
  402.                 } else
  403.                 if (mb_substr($b['codename'],0,4)=='/tv/')
  404.                 {
  405.                     $movie = mysql_fetch_array (q ("select russian, english from tv where codename='".mb_substr($b['codename'],4)."';"));
  406.                     $code='<a href="/tv/'.mb_substr($b['codename'],4).'/" style="text-decoration: none;"'.($b['image']!=''?' onmouseover="this.style.cursor=\'help\'; Tip(\'<img src='.$b['image'].' width='.$b['width'].' height='.$b['height'].'>\')" onmouseout="UnTip()"':'').'>«'.$movie['russian'].'»</a>';
  407.                     $codemark="[«".$movie['russian']."»](/tv/".mb_substr($b['codename'],4).")";
  408.  
  409.                 } else
  410.                 {
  411.                     $anime = mysql_fetch_array (q ("select * from anime where codename='$b[codename]';"));
  412.                    
  413.                     if ($b['image']=='' && $anime['mainpicture']!='')
  414.                     {
  415.                         $b['image']=$anime['mainpicture'];
  416.                         if (mb_substr($anime['mainpicturelink'],0,32)=='/anime/' || mb_substr($anime['mainpicturelink'],0,7)=='/anime/')
  417.                         {
  418.                             if (mb_substr($anime['mainpicturelink'],0,32)=='/anime/') $anime['mainpicturelink']=mb_substr($anime['mainpicturelink'],32);
  419.                             else if (mb_substr($anime['mainpicturelink'],0,7)=='/anime/') $anime['mainpicturelink']=mb_substr($anime['mainpicturelink'],7);
  420.                            
  421.                             $exp=explode ('/',$anime['mainpicturelink']);
  422.                             $picinfo=explode(',',$anime[$exp[2].'info']);
  423.                             $b['width']=$picinfo[($exp[3]-1)*IMG_CONST+4];
  424.                             $b['height']=$picinfo[($exp[3]-1)*IMG_CONST+5];                
  425.                         } else
  426.                         {
  427.                             $b['width']=240;
  428.                             $b['height']=240;
  429.                         }
  430.                     }
  431.                    
  432.                     $code='<a href="/anime/'.$b['codename'].'/" style="text-decoration: none;"'.($b['image']!=''?' onmouseover="this.style.cursor=\'help\'; Tip(\'<img src='.$b['image'].' width='.$b['width'].' height='.$b['height'].'>\')" onmouseout="UnTip()"':'').'>«'.$anime['russian'].'»</a>';
  433.                     $codemark="[«".$anime['russian']."»](/anime/".$b['codename'].")";
  434.                 }
  435.                 if ($b['addinfo']!='') $code.=' '.str_replace('<a href=','<a style="text-decoration: none;" href=',stripslashes(brackets($b['addinfo'])));
  436.                 if ($b['vol']!='' || $b['extra']!='') $code.='<br />';
  437.                 if ($b['vol']!='') $code.='<span class="box_bold">Том '.$b['vol'].'</span>';
  438.                 if ($b['subs_num']<2)
  439.                 {
  440.                     if ($b['vol']!='' && $b['extra']!='') $code.=' | ';
  441.                     if ($b['extra']!='') $code.=$b['extra'];
  442.                 }
  443.  
  444.             } else
  445.            
  446.             if ($b['words']>0)
  447.             {
  448.            
  449.                 $cc=explode (' ',$b['english']);
  450.                
  451.                 if ($b['codename']!='') {
  452.                     if (mb_substr($b['codename'],0,8)=='/movies/')
  453.                     {
  454.                         $movie = mysql_fetch_array (q ("select russian, english, original from movies where codename='".mb_substr($b['codename'],8)."';"));
  455.                         $code='<a href="/movies/'.mb_substr($b['codename'],8).'/" style="text-decoration: none;">«'.$movie['russian'].'»</a> ';
  456.                         $codemark="[«".$movie['russian']."»](/movies/".mb_substr($b['codename'],8).")";
  457.  
  458.                     } else
  459.                     {
  460.                         $anime = mysql_fetch_array (q ("select russian, english, original from anime where codename='$b[codename]';"));
  461.                         $code='<a href="/anime/'.$b['codename'].'/" style="text-decoration: none;">«'.$anime['russian'].'»</a> ';
  462.                         $codemark="[«".$anime['russian']."»](/anime/".$b['codename'].")";
  463.                     }
  464.                     for ($ci=$b['words']; $ci<sizeof($cc); $ci++)
  465.                     {
  466.                         $code.=$cc[$ci].' ';
  467.                         $codemark.=$cc[$ci].' ';
  468.                     }
  469.                     $code=substr($code,0,-1);
  470.                     $codemark=substr($codemark,0,-1);
  471.  
  472.                 }
  473.                 else {
  474.                     $code='<span style="color: #1A64B5;"'.($b['image']!=''?' onmouseover="this.style.cursor=\'help\'; Tip(\'<img src='.$b['image'].' width='.$b['width'].' height='.$b['height'].'>\')" onmouseout="UnTip()"':'').'>';
  475.                     foreach ($cc as $key=>$c)
  476.                     {
  477.                         $code.=$c;
  478.                         if ($key==$b['words']-1) $code.='</span>';
  479.                         $code.=' ';
  480.  
  481.                         $codemark.=$c;
  482.                         if ($key==$b['words']-1) $codemark.='</span>';
  483.                         $codemark.=' ';
  484.        
  485.                     }
  486.                     $code=substr($code,0,-1);
  487.                     $codemark=substr($codemark,0,-1);
  488.                 }
  489.             } else {
  490.                 $code=$b['english'];
  491.                 $codemark=$b['english'];
  492.                 }
  493.             $movie=$code;
  494.             $patt[0]='/(Vol|VOL|vol|Note|Shoot|take )(\.|\:)[0-9]+/';
  495.             $patt[1]='/\([0-9]+\)/';
  496.             $patt[2]='/\(Limited Edition\)/';
  497.             $patt[3]='/\<Limited Edition\>/';
  498.             $patt[4]='/(Blu-ray |DVD | |BD-|BD)BOX [IVX0-9]+/';
  499.             $patt[5]='/(Blu-ray |DVD | |BD-|BD)BOX/';
  500.            
  501.             $newsmovie=$movie;
  502.             $newsmoviemark=$codemark;
  503.                        
  504.             if ($do && $page!='boxanime') $movie.=($b['codename']==''?$b['original']:'').'<input type="hidden" value="'.$b['id'].'" name=ids['.$i.']><br><input style="font-size: 11px;" type=text size="30" value="'.$b['codename'].'" name=codename['.$i.']><br><input style="font-size: 11px;" type=text size="1" value="'.$b['vol'].'" name=vol['.$i.']><textarea style="font-size: 11px; height: 19px; margin: 0 0 -5 0; padding: 0 0 0 0;" cols="30" name="addinfo['.$i.']">'.$b['addinfo'].'</textarea><br><input style="font-size: 11px;" type=text size="25" value="'.$b['extra'].'" name=extra['.$i.']><a href="http://www.animenewsnetwork.com/search?cx=016604166282602569737%3Aznd1ysjewre&q='.trim(preg_replace($patt,'',$b['original'])).'&sa=Search&cof=FORID%3A11" target="_blank">[A]</a> <a href="http://www.cdjapan.co.jp/detailview.html?KEY='.between(mb_strrchr($b['image'],'/'),'/','.jpg').'" target="_blank">[CD]</a>';
  505.  
  506.         } else
  507.         {
  508.        
  509.             $code=$b['codename'];
  510.             if (mb_substr($code,-1)=='_')
  511.             {  
  512.                 $movie=mb_substr($code,0,-1).'<br>';
  513.                 $m=array();
  514.             }
  515.             else
  516.             if (mb_substr($code,0,7)=='/anime/')
  517.             {
  518.                
  519.                 $anime = mysql_fetch_array (q ("select russian, english, original from anime where codename='".mb_substr($code,7)."';"));
  520.                 $movie='<a href="/anime/'.mb_substr($code,7).'/">«'.$anime['russian'].'»</a><br>';
  521.                
  522.                 $newsmovie=$movie;
  523.                
  524.                 if ($anime['original']!='')
  525.                 {
  526.                   if (!$do || $page=='boxanime') $movie.=$anime['original'];
  527.                   //$newsmovie=$movie;
  528.                 }
  529.                
  530.             }
  531.             else {
  532.                 $movies = q ("select russian, english, budget, posters, postersinfo from movies where codename='$code';");
  533.                 if ($movies) $m=mysql_fetch_array ($movies);
  534.                 if ($m['posters']!=0)
  535.                 {
  536.                     $post_arr=explode (',',$m['postersinfo']);
  537.                     $post_width=$post_arr[$m['posters']*IMG_CONST-4];
  538.                     $post_height=$post_arr[$m['posters']*IMG_CONST-3];
  539.                     $post_num=$post_arr[$m['posters']*IMG_CONST-8];
  540.                     $pst=' onmouseover="this.style.cursor=\'help\'; Tip(\'<img src=http://media.kino-govno.com/movies/'.substr($code,0,1).'/'.$code.'/posters/'.$code.'_'.$post_num.'s.jpg width='.$post_width.' height='.$post_height.'>\')" onmouseout="UnTip()"';
  541.                    
  542.                 } else $pst='';
  543.                 $movie='';
  544.                 $movie.='«<a href="/movies/'.$code.'/"'.$pst.'>'.$m['russian'].'</a>»<br>';
  545.                                
  546.                 $newsmovie=$movie;
  547.                
  548.                 if ($m['english']!='')
  549.                
  550.                 {
  551.                   if (!$do || $page=='boxanime') $movie.=$m['english'];
  552.                  
  553.                   $newsmovie=$movie;
  554.                  
  555.                 }
  556.                
  557.             }
  558.             if ($do && $page!='boxanime') $movie.='<input type="hidden" value="'.$b['id'].'" name="ids['.$i.']" id="ids['.$i.']"><input class="txt" type=text width=30 value="'.$code.'" name="name['.$i.']" id="name['.$i.']">'.($page=='boxworld' && mb_substr($code,-1)=='_'?'<img src="/i/magnifying_glass_icon.png" onClick="window.open(\'/admin/movies_ad.php?id=\' + lowerit($(\'#name\\\['.$i.'\\\]\').val().substring(0,$(\'#name\\\['.$i.'\\\]\').val().length-1)) + \'&eng=\'+$(\'#name\\\['.$i.'\\\]\').val().substring(0,$(\'#name\\\['.$i.'\\\]\').val().length-1) + \'&gallerycode='.$i.'\', \'movie_search\', \'width=1150,height=500\');">':'');
  559.         }
  560.  
  561.  
  562.         if ($b['ch']==0) $ch='&nbsp;'; else
  563.         if ($b['ch']>0) $ch='<span style="color: #0000FF;">+'.number_format($b['ch'],1,',','').'%</span>';
  564.             else $ch='<span style="color: #f40000;">&minus;'.number_format(-$b['ch'],1,',','').'%</span>';
  565.        
  566.         if ($b['chweek']==0) $chweek='&nbsp;'; else
  567.         if ($b['chweek']>0) $chweek='<span style="color: #0000FF;">+'.number_format($b['chweek'],1,',','').'%</span>';
  568.             else $chweek='<span style="color: #f40000;">&minus;'.number_format(-$b['chweek'],1,',','').'%</span>';
  569.        
  570.  
  571.         $text.='
  572. <tr style="text-align: center;'.($sub!=0?' display: none;" id="sub'.$sub.'_'.$b['id']:'').'">';
  573.         if ($i<=$newsrows) {
  574.             $newstext.='
  575. <tr style="text-align: center;">';
  576.             $newsmark.="\n";
  577.         }
  578.         foreach ($fields as $key => $f) {
  579.             if ($page=='boxday' || $page=='boxdayrussia')
  580.             {
  581.                 if (($b['gross']==$b['allgross'] && $b['gross']!=0) || ($b['days']<6 && $b['days']!=0)) $r=3; else if ($i%2==0) $r=1; else $r=2;
  582.  
  583.             }
  584.             else
  585.                 if (($b['week']==1 && $b['week']!=0) || ($b['days']<8 && $b['days']!=0 && $page!='boxdate') || ($b['days']<6 && $b['days']!=0 && $page=='boxdate') || ($page=='boxalltime' && $select==$b['codename']) || ($b['gross']==$b['allgross'] && $b['gross']!=0)) $r=3; else if ($i%2==0) $r=1; else $r=2;
  586.                
  587.             if ($do && $b['codename']=='' && $f=='english') $r=4;
  588.            
  589.             if ($sub!=0) $r=5;
  590.            
  591.             $text.='
  592. <td class="box1_row'.$r.'"'.
  593.             ($f=='english' && ($page=='boxanimedvd' || $page=='boxanimebluray' || $page=='boxanime')?' id="td'.$b['place'].'"':'').
  594.             ($fields_align[$key]!=''?' style="text-align: '.$fields_align[$key].';"':'').
  595.             '>'.
  596.             ($f!='codename' && $f!='english'?'<span class="nobr">':'').
  597.             ($f=='codename' || $f=='english'?$movie:'').
  598.             ($f=='studio'?$b[$f]:'').
  599.             ($f=='compare'?box_modify($b,$f,$page):'').
  600.             (($f=='gross' || $f=='allgross') && ($page=='boxanimedvd' || $page=='boxanimebluray') && $do?'<input '.($f=='gross'?'onchange="if (document.getElementById(\'allgross['.$i.']\').value==\'0\' || document.getElementById(\'allgross['.$i.']\').value==\'\') document.getElementById(\'allgross['.$i.']\').value=document.getElementById(\'gross['.$i.']\').value" ':'').'style="width: 50px; font-size: 11px;" type=text value="'.($b[$f]==0?'':$b[$f]).'" name="'.$f.'['.$i.']" id="'.$f.'['.$i.']">':'').
  601.             ($f!='codename' && $f!='english' && $f!='studio' && !(($f=='gross' || $f=='allgross') && ($page=='boxanimedvd' || $page=='boxanimebluray') && $do) && !($f=='place' && $page=='boxalltime') && $b[$f]!=0?box_modify($b,$f,$page):'&nbsp;').
  602.             ($f=='cost' && ($b['cost']==0 || $b['cost']=='-')?($m['budget']!=0?'$ '.number_format($m['budget'],0,',',' '):''):'').
  603.             ($f=='place' && $page=='boxalltime'?$i:'').
  604.             ($f=='place'?$chplace:'').
  605.             ($f!='codename' && $f!='english'?'</span>':'').
  606.             '</td>';
  607. //
  608.             if ($i<=$newsrows && $f!='chtheaters' && $f!='average' && $f!='days')
  609.             {
  610.                 $newstext.='
  611. <td class="box1_row'.$r.'"'.
  612.             ($f=='english' && ($page=='boxanimedvd' || $page=='boxanimebluray' || $page=='boxanime')?' id="td'.$b['place'].'"':'').
  613.             ($fields_align[$key]!=''?' style="text-align: '.$fields_align[$key].';"':'').
  614.             '>'.
  615.             ($f!='codename' && $f!='english'?'<span class="nobr">':'').
  616.             ($f=='codename' || $f=='english'?$newsmovie:'').
  617.             ($f=='studio'?$b[$f]:'').
  618.             ($f=='compare'?box_modify($b,$f,$page):'').
  619.             ($f!='codename' && $f!='english' && $f!='studio' && !($f=='place' && $page=='boxalltime') && $b[$f]!=0?box_modify($b,$f,$page):'').
  620.             ($f=='cost' && $b['cost']==0 && $m['budget']!=0?'$ '.number_format($m['budget'],0,',',' '):'').
  621.             ($f=='place' && $page=='boxalltime'?$i:'').
  622.             ($f=='place'?$chplace:'').
  623.             ($f!='codename' && $f!='english'?'</span>':'').
  624.             '</td>';
  625.                
  626.                 $newsmark.=
  627.             ($f=='codename' || $f=='english'?$newsmovie:'').
  628.             ($f=='studio'?$b[$f]:'').
  629.             ($f=='compare'?$b[$f]:'').
  630.             ($f!='codename' && $f!='english' && $f!='studio' && !($f=='place' && $page=='boxalltime') && $b[$f]!=0?$b[$f]:'').
  631.             ($f=='cost' && $b['cost']==0 && $m['budget']!=0?'$ '.number_format($m['budget'],0,',',' '):'').
  632.             ($f=='place' && $page=='boxalltime'?$i:'').
  633.             ($f=='place'?$chplace:'').
  634.             " | ";
  635.             }
  636. //
  637.         }
  638.        
  639.         if ($limit!=10 && $page=='boxanime') {
  640.             $newstext.='<td class="box1_row'.$r.'">'.($b['type']==' bluray dvd '?'Blu-ray<br>DVD':'').($b['type']==' bluray '?'Blu-ray':'').($b['type']==' dvd '?'DVD':'').'</td>';
  641.             $newsmark.=" | ".($b['type']==' bluray dvd '?'Blu-ray#DVD':'').($b['type']==' bluray '?'Blu-ray':'').($b['type']==' dvd '?'DVD':'');
  642.         }
  643.        
  644.         if ($do && ($page=='boxanimedvd' || $page=='boxanimebluray')) $text.='<td class="box1_row'.$r.'"><a href="/admin/animeflowers.php?action=showsales&type=bluray&name='.$b['codename'].'" target="_blank" style="text-decoration: none;">BD</a><br><a href="/admin/animeflowers.php?action=showsales&type=dvd&name='.$b['codename'].'" target="_blank" style="text-decoration: none;">DVD</a>'.($b['temp']!=''?'<br><span class="dashed_link" onClick="$(\'#admininfo'.$b['place'].'\').toggle();">инфо</span>':'').'</td><input type="hidden" id="english'.$b['place'].'" value="'.$b['english'].'">
  645.         <input type="hidden" id="words'.$b['place'].'" value="'.$b['words'].'">';
  646.         else if ($limit!=10 && $page=='boxanime')  $text.='<td class="box1_row'.$r.'">'.($b['subs_num']>1?'<span class="dashed_link" onClick="$(\'tr[id*=sub'.$b['place'].']\').toggle();">':'').($b['type']==' bluray dvd '?'Blu-ray<br>DVD':'').($b['type']==' bluray '?'Blu-ray':'').($b['type']==' dvd '?'DVD':'').($b['subs_num']>1?'</span>':'').'</td>';
  647.  
  648.         $text.='
  649. </tr>';
  650.  
  651.  
  652.            
  653.         // if ($b['temp']!='') $text.='<tr id="admininfo'.$b['place'].'" style="background: #FFFFFF;" class="hidden"><td colspan="6" style="padding-left: 15px; padding-top:5px; padding-bottom: 5px; border-top: 1px solid grey;border-bottom: 1px solid grey;"><span style="color: grey; cursor: hand; cursor: ponter; margin-right: 20px;" onClick="$(\'#admininfo'.$b['place'].'\').toggle();">×</span>'.$b['temp'].'</td></tr>';
  654.  
  655.         if ($i<=$newsrows) {
  656.         $newstext.='
  657. </tr>';
  658.         $newsmark.="\n";
  659. }
  660.  
  661.  
  662.     if ($i%2==0) $color='white'; else $color='black';
  663.    
  664.     // ЗАКОНЧИЛИ ВЫВОДИТЬ ОДНУ СТРОКУ
  665.    
  666.    
  667.     return array ('text'=>$text, 'newstext'=>$newstext, 'newsmark'=>$newsmark);
  668.  
  669. }
  670.  
  671.  
  672. function boxrow_new ($b, $page, $fields, $fields_width, $fields_align, $i, $newsrows=10, $sub=0, $select='')
  673. {
  674.     // $table = таблица: box, boxrussia, boxworld
  675.     // $date = дата в формате '230308' (23 марта 2008 года) или '230308_4' (если надо взять 4-дневный уик-энд)
  676.     // ...пустая только в случае с boxalltime
  677.     // $sort = сортировка по одному из параметров
  678.     // $fields = array ('place','codename','ch...')
  679.     // $fields_info = array ('Место', 'Фильм', '±');
  680.    
  681.     global $do;
  682.     global $compare_const,$compareall_const;
  683.     $newstext='';
  684.     $newsmark="";
  685.    
  686.    
  687.     // НАЧАЛИ ВЫВОДИТЬ ОДНУ СТРОКУ
  688.        
  689.         if ($b['gross']==0) $zerogross=$i; // Значит, начиная с этого места - сборы не указаны
  690.        
  691.         if ($page=='boxanimedvd' || $page=='boxanimebluray' || $page=='boxanime')
  692.         {
  693.        
  694.             if ($b['codename']!='')
  695.             {
  696.                 if (mb_substr($b['codename'],0,1)=='_')
  697.                 {
  698.                     $code='<span style="color: #1A64B5;"'.($b['image']!=''?' onmouseover="this.style.cursor=\'help\'; Tip(\'<img src='.$b['image'].' width='.$b['width'].' height='.$b['height'].'>\')" onmouseout="UnTip()"':'').'>'.mb_substr($b['codename'],1).'</span>';
  699.                 } else
  700.                 if (mb_substr($b['codename'],0,8)=='/movies/')
  701.                 {
  702.                     $movie = mysql_fetch_array (q ("select russian, english, original from movies where codename='".mb_substr($b['codename'],8)."';"));
  703.                     $code='<a href="/movies/'.mb_substr($b['codename'],8).'/" style="text-decoration: none;"'.($b['image']!=''?' onmouseover="this.style.cursor=\'help\'; Tip(\'<img src='.$b['image'].' width='.$b['width'].' height='.$b['height'].'>\')" onmouseout="UnTip()"':'').'>«'.$movie['russian'].'»</a>';
  704.                     $codemark="[«".$movie['russian']."»](/movies/".mb_substr($b['codename'],8).")";
  705.  
  706.                 } else
  707.                 if (mb_substr($b['codename'],0,4)=='/tv/')
  708.                 {
  709.                     $movie = mysql_fetch_array (q ("select russian, english from tv where codename='".mb_substr($b['codename'],4)."';"));
  710.                     $code='<a href="/tv/'.mb_substr($b['codename'],4).'/" style="text-decoration: none;"'.($b['image']!=''?' onmouseover="this.style.cursor=\'help\'; Tip(\'<img src='.$b['image'].' width='.$b['width'].' height='.$b['height'].'>\')" onmouseout="UnTip()"':'').'>«'.$movie['russian'].'»</a>';
  711.                     $codemark="[«".$movie['russian']."»](/tv/".mb_substr($b['codename'],4).")";
  712.  
  713.                 } else
  714.                 {
  715.                     $anime = mysql_fetch_array (q ("select * from anime where codename='$b[codename]';"));
  716.                    
  717.                     if ($b['image']=='' && $anime['mainpicture']!='')
  718.                     {
  719.                         $b['image']=$anime['mainpicture'];
  720.                         if (mb_substr($anime['mainpicturelink'],0,32)=='/anime/' || mb_substr($anime['mainpicturelink'],0,7)=='/anime/')
  721.                         {
  722.                             if (mb_substr($anime['mainpicturelink'],0,32)=='/anime/') $anime['mainpicturelink']=mb_substr($anime['mainpicturelink'],32);
  723.                             else if (mb_substr($anime['mainpicturelink'],0,7)=='/anime/') $anime['mainpicturelink']=mb_substr($anime['mainpicturelink'],7);
  724.                            
  725.                             $exp=explode ('/',$anime['mainpicturelink']);
  726.                             $picinfo=explode(',',$anime[$exp[2].'info']);
  727.                             $b['width']=$picinfo[($exp[3]-1)*IMG_CONST+4];
  728.                             $b['height']=$picinfo[($exp[3]-1)*IMG_CONST+5];                
  729.                         } else
  730.                         {
  731.                             $b['width']=240;
  732.                             $b['height']=240;
  733.                         }
  734.                     }
  735.                    
  736.                     $code='<a href="/anime/'.$b['codename'].'/" style="text-decoration: none;"'.($b['image']!=''?' onmouseover="this.style.cursor=\'help\'; Tip(\'<img src='.$b['image'].' width='.$b['width'].' height='.$b['height'].'>\')" onmouseout="UnTip()"':'').'>«'.$anime['russian'].'»</a>';
  737.                     $codemark="[«".$anime['russian']."»](/anime/".$b['codename'].")";
  738.                 }
  739.                 if ($b['addinfo']!='') $code.=' '.str_replace('<a href=','<a style="text-decoration: none;" href=',stripslashes(brackets($b['addinfo'])));
  740.                 if (($b['vol']!='' && $b['vol']!=0) || ($b['extra']!='' && $page!='boxanime')) $code.='<br />';
  741.                 if ($b['vol']!='' && $b['vol']!=0) $code.='<span class="box_bold">Том '.$b['vol'].'</span>';
  742.                 if ($b['subs_num']<2)
  743.                 {
  744.                     if ($b['vol']!='' && $b['extra']!='') $code.=' | ';
  745.                     if ($b['extra']!='') $code.=$b['extra'];
  746.                 }
  747.  
  748.             } else
  749.            
  750.             if ($b['words']>0)
  751.             {
  752.            
  753.                 $cc=explode (' ',$b['english']);
  754.                
  755.                 if ($b['codename']!='') {
  756.                     if (mb_substr($b['codename'],0,8)=='/movies/')
  757.                     {
  758.                         $movie = mysql_fetch_array (q ("select russian, english, original from movies where codename='".mb_substr($b['codename'],8)."';"));
  759.                         $code='<a href="/movies/'.mb_substr($b['codename'],8).'/" style="text-decoration: none;">«'.$movie['russian'].'»</a> ';
  760.                         $codemark="[«".$movie['russian']."»](/movies/".mb_substr($b['codename'],8).")";
  761.  
  762.                     } else
  763.                     {
  764.                         $anime = mysql_fetch_array (q ("select russian, english, original from anime where codename='$b[codename]';"));
  765.                         $code='<a href="/anime/'.$b['codename'].'/" style="text-decoration: none;">«'.$anime['russian'].'»</a> ';
  766.                         $codemark="[«".$anime['russian']."»](/anime/".$b['codename'].")";
  767.                     }
  768.                     for ($ci=$b['words']; $ci<sizeof($cc); $ci++)
  769.                     {
  770.                         $code.=$cc[$ci].' ';
  771.                         $codemark.=$cc[$ci].' ';
  772.                     }
  773.                     $code=substr($code,0,-1);
  774.                     $codemark=substr($codemark,0,-1);
  775.  
  776.                 }
  777.                 else {
  778.                     $code='<span style="color: #1A64B5;"'.($b['image']!=''?' onmouseover="this.style.cursor=\'help\'; Tip(\'<img src='.$b['image'].' width='.$b['width'].' height='.$b['height'].'>\')" onmouseout="UnTip()"':'').'>';
  779.                     foreach ($cc as $key=>$c)
  780.                     {
  781.                         $code.=$c;
  782.                         if ($key==$b['words']-1) $code.='</span>';
  783.                         $code.=' ';
  784.  
  785.                         $codemark.=$c;
  786.                         if ($key==$b['words']-1) $codemark.='</span>';
  787.                         $codemark.=' ';
  788.        
  789.                     }
  790.                     $code=substr($code,0,-1);
  791.                     $codemark=substr($codemark,0,-1);
  792.                 }
  793.             } else {
  794.                 $code=$b['english'];
  795.                 $codemark=$b['english'];
  796.                 }
  797.             $movie=$code;
  798.             $patt[0]='/(Vol|VOL|vol|Note|Shoot|take )(\.|\:)[0-9]+/';
  799.             $patt[1]='/\([0-9]+\)/';
  800.             $patt[2]='/\(Limited Edition\)/';
  801.             $patt[3]='/\<Limited Edition\>/';
  802.             $patt[4]='/(Blu-ray |DVD | |BD-|BD)BOX [IVX0-9]+/';
  803.             $patt[5]='/(Blu-ray |DVD | |BD-|BD)BOX/';
  804.            
  805.             $newsmovie=$movie;
  806.             $newsmoviemark=$codemark;
  807.                        
  808.             if ($do && $page!='boxanime') $movie.='<input type="hidden" value="'.$b['id'].'" name=ids['.$i.']><br><input style="font-size: 11px;" type=text size="30" value="'.$b['codename'].'" name=codename['.$i.']><br><input style="font-size: 11px;" type=text size="1" value="'.$b['vol'].'" name=vol['.$i.']><textarea style="font-size: 11px; height: 19px; margin: 0 0 -5 0; padding: 0 0 0 0;" cols="30" name="addinfo['.$i.']">'.$b['addinfo'].'</textarea><br><input style="font-size: 11px;" type=text size="25" value="'.$b['extra'].'" name=extra['.$i.']><a href="http://www.animenewsnetwork.com/search?cx=016604166282602569737%3Aznd1ysjewre&q='.trim(preg_replace($patt,'',$b['original'])).'&sa=Search&cof=FORID%3A11" target="_blank">[A]</a> <a href="http://www.cdjapan.co.jp/detailview.html?KEY='.between(mb_strrchr($b['image'],'/'),'/','.jpg').'" target="_blank">[CD]</a>';
  809.  
  810.         } else
  811.         {
  812.        
  813.             $code=$b['codename'];
  814.             if (mb_substr($code,-1)=='_')
  815.             {  
  816.                 $movie=mb_substr($code,0,-1).'<br>';
  817.                 $m=array();
  818.             }
  819.             else
  820.             if (mb_substr($code,0,7)=='/anime/')
  821.             {
  822.                
  823.                 $anime = mysql_fetch_array (q ("select russian, english, original from anime where codename='".mb_substr($code,7)."';"));
  824.                 $movie='<a href="/anime/'.mb_substr($code,7).'/">«'.$anime['russian'].'»</a><br>';
  825.                
  826.                 $newsmovie=$movie;
  827.                
  828.                 if ($anime['original']!='')
  829.                 {
  830.                   if (!$do || $page=='boxanime') $movie.=$anime['original'];
  831.                   //$newsmovie=$movie;
  832.                 }
  833.                
  834.             }
  835.             else {
  836.                 $movies = q ("select russian, english, budget, posters, postersinfo from movies where codename='$code';");
  837.                 if ($movies) $m=mysql_fetch_array ($movies);
  838.                 if ($m['posters']!=0)
  839.                 {
  840.                     $post_arr=explode (',',$m['postersinfo']);
  841.                     $post_width=$post_arr[$m['posters']*IMG_CONST-4];
  842.                     $post_height=$post_arr[$m['posters']*IMG_CONST-3];
  843.                     $post_num=$post_arr[$m['posters']*IMG_CONST-8];
  844.                     $pst=' onmouseover="this.style.cursor=\'help\'; Tip(\'<img src=http://media.kino-govno.com/movies/'.substr($code,0,1).'/'.$code.'/posters/'.$code.'_'.$post_num.'s.jpg width='.$post_width.' height='.$post_height.'>\')" onmouseout="UnTip()"';
  845.                    
  846.                 } else $pst='';
  847.                 $movie='';
  848.                 $movie.='«<a href="/movies/'.$code.'/"'.$pst.'>'.$m['russian'].'</a>»<br>';
  849.                                
  850.                 $newsmovie=$movie;
  851.                
  852.                 if ($m['english']!='')
  853.                
  854.                 {
  855.                   if (!$do || $page=='boxanime') $movie.=$m['english'];
  856.                  
  857.                   $newsmovie=$movie;
  858.                  
  859.                 }
  860.                
  861.             }
  862.             if ($do && $page!='boxanime') $movie.='<input type="hidden" value="'.$b['id'].'" name="ids['.$i.']" id="ids['.$i.']"><input class="txt" type=text width=30 value="'.$code.'" name="name['.$i.']" id="name['.$i.']">'.($page=='boxworld' && mb_substr($code,-1)=='_'?'<img src="/i/magnifying_glass_icon.png" onClick="window.open(\'/admin/movies_ad.php?id=\' + lowerit($(\'#name\\\['.$i.'\\\]\').val().substring(0,$(\'#name\\\['.$i.'\\\]\').val().length-1)) + \'&eng=\'+$(\'#name\\\['.$i.'\\\]\').val().substring(0,$(\'#name\\\['.$i.'\\\]\').val().length-1) + \'&gallerycode='.$i.'\', \'movie_search\', \'width=1150,height=500\');">':'');
  863.         }
  864.  
  865.  
  866.         if ($b['ch']==0) $ch='&nbsp;'; else
  867.         if ($b['ch']>0) $ch='+'.number_format($b['ch'],1,',','').'%';
  868.             else $ch='&minus;'.number_format(-$b['ch'],1,',','').'%';
  869.  
  870.         if ($b['chweek']==0) $chweek='&nbsp;'; else
  871.         if ($b['chweek']>0) $chweek='+'.number_format($b['chweek'],1,',','').'%';
  872.             else $chweek='&minus;'.number_format(-$b['chweek'],1,',','').'%';
  873.  
  874.        
  875.         if ($page=='boxday' || $page=='boxdayrussia')
  876.             {
  877.                 if (($b['gross']==$b['allgross'] && $b['gross']!=0) || ($b['days']<6 && $b['days']!=0)) $r=3; else if ($i%2==0) $r=1; else $r=2;
  878.  
  879.             }
  880.             else
  881.                 if (($b['week']==1 && $b['week']!=0) || ($b['days']<8 && $b['days']!=0 && $page!='boxdate') || ($b['days']<6 && $b['days']!=0 && $page=='boxdate') || ($page=='boxalltime' && $select==$b['codename']) || ($b['gross']==$b['allgross'] && $b['gross']!=0)) $r=3; else if ($i%2==0) $r=1; else $r=2;
  882.                
  883.             if ($do && $b['codename']=='' && $f=='english') $r=4;
  884.            
  885.             if ($sub!=0) $r=5;
  886.  
  887.  
  888.         $text.='
  889. <li'.($r==2?' class="row2"':"").($r==3?' class="new"':"").($sub!=0?' style=" display: none;" id="sub'.$sub.'_'.$b['id'].'"':'').'>';
  890.         if ($i<=$newsrows) {
  891.             $newstext.='
  892. <li'.($r==2?' class="row2"':"").($r==3?' class="new"':"").($sub!=0?' style=" display: none;" id="sub'.$sub.'_'.$b['id'].'"':'').'>';
  893.             $newsmark.="\n";
  894.         }
  895.        
  896.         foreach ($fields as $key => $f) {  
  897.             // if ($do) echo $f;       
  898.             $text.='
  899.             <div class="'.
  900.             ($f=='codename' || $f=='english'?'mov':'').
  901.             ($f=='place'?'num':'').
  902.             ($f=='days' || $f=='week' || $f=='territories' || $f=='weeks'?'days':'').
  903.             ($f=='gross' || $f=='allgross'?'box':'').
  904.             ($f=='theaters' || $f=='cost' || $f=='studio' || $f=='average' || $f=='weekend'?'cop':'').
  905.             ($f=='compare'?'per':'').
  906.             ($f=='ch'?'fal'.($b['ch']>0?' up':'').($b['ch']<0?' down':''):'').
  907.             ($f=='chweek'?'fal'.($b['chweek']>0?' up':'').($b['chweek']<0?' down':''):'').
  908.             '"'.
  909.             ($f=='english' && ($page=='boxanimedvd' || $page=='boxanimebluray' || $page=='boxanime')?' id="td'.$b['place'].'"':'').
  910.             '>'.
  911.             ($f=='codename' || $f=='english'?$movie:'').
  912.             ($f=='studio'?$b[$f]:'').
  913.             ($f=='compare'?box_modify($b,$f,$page):'').
  914.             (($f=='gross' || $f=='allgross') && ($page=='boxanimedvd' || $page=='boxanimebluray') && $do?'<input '.($f=='gross'?'onchange="if (document.getElementById(\'allgross['.$i.']\').value==\'0\' || document.getElementById(\'allgross['.$i.']\').value==\'\') document.getElementById(\'allgross['.$i.']\').value=document.getElementById(\'gross['.$i.']\').value" ':'').'style="width: 50px; font-size: 11px;" type=text value="'.($b[$f]==0?'':$b[$f]).'" name="'.$f.'['.$i.']" id="'.$f.'['.$i.']">'.'<br>'.box_modify($b,$f,$page):'').
  915.             ($f!='codename' && $f!='english' && $f!='studio' && !(($f=='gross' || $f=='allgross') && ($page=='boxanimedvd' || $page=='boxanimebluray') && $do) && !($f=='place' && $page=='boxalltime') && $b[$f]!=0?box_modify($b,$f,$page):'&nbsp;').
  916.             ($f=='cost' && ($b['cost']==0 || $b['cost']=='-')?($m['budget']!=0?'$ '.number_format($m['budget'],0,',',' '):''):'').
  917.             ($f=='place' && $page=='boxalltime'?$i:'').
  918.             ($f=='place'?$chplace:'').
  919.             '</div>';
  920. //
  921.             if ($i<=$newsrows && $f!='chtheaters' && $f!='average' && $f!='days')
  922.             {
  923.                 $newstext.='
  924.             <div class="'.
  925.             ($f=='codename' || $f=='english'?'mov':'').
  926.             ($f=='place'?'num':'').
  927.             ($f=='days' || $f=='week' || $f=='territories' || $f=='weeks'?'days':'').
  928.             ($f=='gross' || $f=='allgross'?'box':'').
  929.             ($f=='theaters' || $f=='cost' || $f=='studio' || $f=='average' || $f=='weekend'?'cop':'').
  930.             ($f=='compare'?'per':'').
  931.             ($f=='ch'?'fal'.($b['ch']>0?' up':'').($b['ch']<0?' down':''):'').
  932.             ($f=='chweek'?'fal'.($b['chweek']>0?' up':'').($b['chweek']<0?' down':''):'').
  933.             '"'.
  934.             ($f=='english' && ($page=='boxanimedvd' || $page=='boxanimebluray' || $page=='boxanime')?' id="td'.$b['place'].'"':'').
  935.             '>'.
  936.             ($f=='codename' || $f=='english'?$newsmovie:'').
  937.             ($f=='studio'?$b[$f]:'').
  938.             ($f=='compare'?box_modify($b,$f,$page):'').
  939.             ($f!='codename' && $f!='english' && $f!='studio' && !($f=='place' && $page=='boxalltime') && ($b[$f]!=0 || $b[$f]!='')?box_modify($b,$f,$page):'').
  940.             ($f=='cost' && $b['cost']==0 && $m['budget']!=0?'$ '.number_format($m['budget'],0,',',' '):'').
  941.             ($f=='place' && $page=='boxalltime'?$i:'').
  942.             ($f=='place'?$chplace:'').
  943.             '</div>';
  944.                
  945.                 $newsmark.=
  946.             ($f=='codename' || $f=='english'?$newsmovie:'').
  947.             ($f=='studio'?$b[$f]:'').
  948.             ($f=='compare'?$b[$f]:'').
  949.             ($f!='codename' && $f!='english' && $f!='studio' && !($f=='place' && $page=='boxalltime') && $b[$f]!=0?$b[$f]:'').
  950.             ($f=='cost' && $b['cost']==0 && $m['budget']!=0?'$ '.number_format($m['budget'],0,',',' '):'').
  951.             ($f=='place' && $page=='boxalltime'?$i:'').
  952.             ($f=='place'?$chplace:'').
  953.             " | ";
  954.             }
  955. //
  956.         }
  957.        
  958.         if ($newsrows!=10 && $page=='boxanime') {
  959.            
  960.             $newstext.='<div class="cop">'.($b['type']==' bluray dvd '?'Blu-ray<br>DVD':'').($b['type']==' bluray '?'Blu-ray':'').($b['type']==' dvd '?'DVD':'').'</div>';
  961.             $newsmark.=" | ".($b['type']==' bluray dvd '?'Blu-ray#DVD':'').($b['type']==' bluray '?'Blu-ray':'').($b['type']==' dvd '?'DVD':'');
  962.         }
  963.        
  964.         if ($do && ($page=='boxanimedvd' || $page=='boxanimebluray'))
  965.             $text.='<div class="cop"><a href="/admin/animeflowers.php?action=showsales&type=bluray&name='.$b['codename'].'" target="_blank" style="text-decoration: none;">BD</a><br><a href="/admin/animeflowers.php?action=showsales&type=dvd&name='.$b['codename'].'" target="_blank" style="text-decoration: none;">DVD</a>'.($b['temp']!=''?'<br><span class="dashed_link" onClick="$(\'#admininfo'.$b['place'].'\').toggle();">инфо</span>':'').'</td><input type="hidden" id="english'.$b['place'].'" value="'.$b['english'].'">
  966.         <input type="hidden" id="words'.$b['place'].'" value="'.$b['words'].'">';
  967.         else if ($page=='boxanime')
  968.             $text.='<div class="cop">'.($b['subs_num']>1?'<span class="dotted blue" onClick="$(\'li[id*=sub'.$b['place'].']\').toggle();">':'').($b['type']==' bluray dvd '?'BD+DVD':'').($b['type']==' bluray '?'BD':'').($b['type']==' dvd '?'DVD':'').($b['subs_num']>1?'</span>':'').'</div>';
  969.  
  970.         $text.='
  971. </li>';
  972.  
  973.  
  974.            
  975.         // if ($b['temp']!='') $text.='<tr id="admininfo'.$b['place'].'" style="background: #FFFFFF;" class="hidden"><td colspan="6" style="padding-left: 15px; padding-top:5px; padding-bottom: 5px; border-top: 1px solid grey;border-bottom: 1px solid grey;"><span style="color: grey; cursor: hand; cursor: ponter; margin-right: 20px;" onClick="$(\'#admininfo'.$b['place'].'\').toggle();">×</span>'.$b['temp'].'</td></tr>';
  976.  
  977.         if ($i<=$newsrows) {
  978.         $newstext.='
  979. </li>';
  980.         $newsmark.="\n";
  981. }
  982.  
  983.  
  984.     if ($i%2==0) $color='white'; else $color='black';
  985.    
  986.     // ЗАКОНЧИЛИ ВЫВОДИТЬ ОДНУ СТРОКУ
  987.    
  988.    
  989.     return array ('text'=>$text, 'newstext'=>$newstext, 'newsmark'=>$newsmark);
  990.  
  991. }
  992.  
  993. function dodrop_anime ($date, $prev_date, $type)
  994. {
  995.     // Сначала - изменения для каждого фильма по сравнению с предыдущей неделей
  996.     $cur_gross=q("SELECT * FROM boxofficeanime".$type." WHERE date='$date'");
  997.    
  998.     while ($cg=mysql_fetch_array($cur_gross))
  999.     {
  1000.         $prev_gross=q("SELECT * FROM boxofficeanime".$type." WHERE date='$prev_date' AND codename='".addslashes($cg['codename'])."' AND vol='$cg[vol]' AND extra='".addslashes($cg['extra'])."' AND addinfo='".addslashes($cg['addinfo'])."' AND codename!=''");
  1001.         if (mysql_num_rows($prev_gross)>0) {
  1002.             $prev_g=mysql_fetch_array($prev_gross);
  1003.             $pg=$prev_g['gross'];
  1004.             $pp=$prev_g['place'];
  1005.             $pw=$prev_g['words'];
  1006.         } else
  1007.         {
  1008.             $pg=0;
  1009.             $pp=0;
  1010.             $pw=0;
  1011.         }
  1012.         if ($pg!=0 && $cg['gross']!=0)  $dr=($cg['gross']/$pg-1)*100;
  1013.             else $dr=0;
  1014.            
  1015.  
  1016.         $vol=intval($cg['vol'])-1;
  1017.         if ($vol>0 && $cg['weeks']!=0)
  1018.         {
  1019.             $p=fq("SELECT * FROM boxofficeanime".$type." WHERE codename='".mysql_real_escape_string($cg['codename'])."' AND vol='".$vol."' AND addinfo='".mysql_real_escape_string($cg['addinfo'])."' AND extra='".mysql_real_escape_string($cg['extra'])."' AND codename!='' AND weeks=$cg[weeks]");
  1020.            
  1021.             if ($p)
  1022.             {
  1023.                 $chvol=($p['gross']!=0 && $cg['gross']!=0?($cg['gross']/$p['gross']-1)*100:0);
  1024.                 $chvolall=($p['allgross']!=0 && $cg['allgross']!=0?($cg['allgross']/$p['allgross']-1)*100:0);
  1025.             } else
  1026.             {
  1027.                 $chvol=0;
  1028.                
  1029.                 $p=fq("SELECT * FROM boxofficeanime".$type." WHERE codename='".mysql_real_escape_string($cg['codename'])."' AND vol='".$vol."' AND addinfo='".mysql_real_escape_string($cg['addinfo'])."' AND extra='".mysql_real_escape_string($cg['extra'])."' AND codename!='' AND weeks<".intval($cg['weeks'])." ORDER BY weeks DESC LIMIT 1");
  1030.                
  1031.                 if ($p)
  1032.                     $chvolall=($p['allgross']!=0 && $cg['allgross']!=0?($cg['allgross']/$p['allgross']-1)*100:0);
  1033.                 else
  1034.                     $chvolall=0;
  1035.  
  1036.             }
  1037.            
  1038.         } else
  1039.         {
  1040.             $chvol=0;
  1041.             $chvolall=0;
  1042.         }
  1043.            
  1044.         q ("UPDATE boxofficeanime".$type." SET chvol=".floatval($chvol).", chvolall=".floatval($chvolall).", ch=$dr, lastplace='$pp'".($pw!=0?", words=$pw":"")." WHERE  id=$cg[id]");
  1045.     }
  1046. }
  1047.    
  1048. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement