示例#1
0
 public static function render($templ, $row = array())
 {
     if ($row['mdate']) {
         $LastModified_unix = Funcs::MakeTime($row['mdate']);
         $LastModified = gmdate("D, d M Y H:i:s \\G\\M\\T", $LastModified_unix);
         $IfModifiedSince = false;
         if (isset($_ENV['HTTP_IF_MODIFIED_SINCE'])) {
             $IfModifiedSince = strtotime(substr($_ENV['HTTP_IF_MODIFIED_SINCE'], 5));
         }
         if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
             $IfModifiedSince = strtotime(substr($_SERVER['HTTP_IF_MODIFIED_SINCE'], 5));
         }
         if ($IfModifiedSince && $IfModifiedSince >= $LastModified_unix) {
             header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
         } else {
             header('Last-Modified: ' . $LastModified);
         }
     }
     print View::getRender($templ, $row);
     if (DEBUG == 4) {
         print '<pre style="background:#FF9999;border:2px solid #000000">';
         print_r($row);
         print '</pre>';
     }
 }
示例#2
0
 public static function getBanners()
 {
     $data = array();
     foreach (Funcs::$infoblockNum['mainbanners'] as $item) {
         if ($item['path'] == 1) {
             $item['action'] = round((Funcs::MakeTime($item['edate']) - Funcs::MakeTime($item['bdate'])) / 86400) + 1;
             $item['end-days'] = round((Funcs::MakeTime($item['edate']) - Funcs::MakeTime(date('d.m.Y H:i'))) / 86400) + 1;
             //print $item['end-days'];
             if ($item['end-days'] >= 0) {
                 if (is_numeric($item['source'])) {
                     $item['model'] = Catalog::getOne($item['source']);
                 }
                 $data[$item['path']][] = $item;
             }
             //print ' = '.$item['action'].'-'.$item['end-days'].'<br>';
             //$data[$item['path']][]=$item['description'];
         } else {
             $data[$item['path']][] = $item['description'];
         }
     }
     return $data;
 }