Beispiel #1
0
    private function create()
    {
        if (headers_sent()) {
            !ob_get_level() ?: ob_end_clean();
        } else {
            joosRequest::send_headers('Content-type: text/html; charset=UTF-8');
        }
        $message = nl2br($this->getMessage());
        $result = <<<HTML
  <style>
    body { background-color: #fff; color: #333; }
    body, p, ol, ul, td { font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 25px; }
    pre { background-color: #eee; padding: 10px; font-size: 11px; line-height: 18px; }
    a { color: #000; }
    a:visited { color: #666; }
    a:hover { color: #fff; background-color:#000; }
  </style>
<div style="width:99%; position:relative">
<h2 id='Title'>{$message}</h2>
<div id="Context" style="display: block;"><h3>Ошибка с кодом {$this->getCode()} в файле '{$this->getFile()}' в строке {$this->getLine()}:</h3><pre>{$this->prepare($this->get_file_context())}</pre></div>
<div id="Trace"><h2>Стэк вызовов</h2><pre>{$this->getTraceAsString()}</pre></div>
HTML;
        $result .= "</div></div>";
        return $result;
    }
Beispiel #2
0
 public static function header()
 {
     if (!headers_sent()) {
         if (self::$cache_header_time) {
             header_remove('Pragma');
             joosRequest::send_headers('Cache-Control: max-age=' . self::$cache_header_time);
             joosRequest::send_headers('Expires: ' . gmdate('r', time() + self::$cache_header_time));
         } else {
             joosRequest::send_headers('Pragma: no-cache');
             joosRequest::send_headers('Cache-Control: no-cache, must-revalidate');
         }
         joosRequest::send_headers('X-Powered-By: Joostina CMS');
         joosRequest::send_headers('Content-type: text/html; charset=UTF-8');
     }
 }
Beispiel #3
0
 /**
  * Вывод сгенерированного изображения
  * Данный метод вызывает метод render() и выводит сгенерированное изображение в браузер или файл
  *
  * @param  mixed   $input   Имя файла, изображение-строка или GD-resource
  * @param  mixed   $output  Имя файла-результата. Если null - будет выведено в браузер
  * @param  array   $options Массив настроек
  *          <pre>
  *          width   int    Ширина изображения-результата
  *          height  int    Высота изображения-результата
  *          percent number Размер изображения-результата в процентах от исходного
  *          method  int    Метод ресайза
  *          halign  int    Горизонтальное выравнивание
  *          valign  int    Вертикальное выравнивание
  *          check_size int Производить проверку размеров (в этом случае изображение не ресайзится, если необходимый размер больше исходного)
  *          quality int    Качество выдаваемого изображения. 0-100
  *          x int        Растояние в пикселях от левого края, для обрезания
  *          y int        Растояние в пикселях от верхнего края, для обрезания
  *         </pre>
  *
  * @return boolean          TRUE on success or FALSE on failure.
  * @access public
  */
 public static function output($input, $output = null, $options = array())
 {
     // Load source file and render image
     $renderImage = Thumbnail::render($input, $options);
     if (!$renderImage) {
         throw new joosImageLibrariesException('Error rendering image');
     }
     // Set output image type
     // By default PNG image
     $type = isset($options['type']) ? $options['type'] : IMAGETYPE_JPEG;
     $quality = isset($options['quality']) ? $options['quality'] : ($type == IMAGETYPE_PNG ? 8 : 80);
     $quality = $type == IMAGETYPE_PNG ? (int) $quality / 10 : $quality;
     // что бы не указывать в параметрах 0-100 для JPG и 0-9 для PNG - можно всегда 0-100, а тут подправим
     // Before output to browsers send appropriate headers
     if (empty($output)) {
         $content_type = image_type_to_mime_type($type);
         if (!headers_sent()) {
             joosRequest::send_headers('Content-Type: ' . $content_type);
         } else {
             throw new joosImageLibrariesException('Headers have already been sent. Could not display image.');
         }
     } else {
         $content_type = 'ERROR';
     }
     switch ($type) {
         case IMAGETYPE_GIF:
             $result = empty($output) ? imagegif($renderImage) : imagegif($renderImage, $output);
             break;
         case IMAGETYPE_PNG:
             $result = empty($output) ? imagepng($renderImage) : imagepng($renderImage, $output, $quality);
             break;
         case IMAGETYPE_JPEG:
             $result = empty($output) ? imagejpeg($renderImage) : imagejpeg($renderImage, $output, $quality);
             break;
         default:
             throw new joosImageLibrariesException('Image type ' . $content_type . ' not supported by PHP');
     }
     if (!$result) {
         throw new joosImageLibrariesException('Error output image', E_USER_NOTICE);
     }
     // освобождаем память, выделенную для изображения
     imagedestroy($renderImage);
     return true;
 }
Beispiel #4
0
<?php

joosRequest::send_headers('modelContent-Type: text/html; charset=utf-8');
joosRequest::send_headers('Cache-Control: s-maxage=0, max-age=0, must-revalidate');
joosRequest::send_headers('Expires: Mon, 23 Jan 1978 10:00:00 GMT');
function __install($s)
{
    return $s;
}
?>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="robots" content="noindex">
    <title><?php 
echo __install('Установка Joostina CMS');
?>
</title>
    <style type="text/css">
        html {
            font: 13px/1.5 Verdana, sans-serif;
            border-top: 5.3em solid #F4EBDB;
        }

        body {
            border-top: 1px solid #E4DED5;
            margin: 0;
            background: white;
            color: #333;
        }
Beispiel #5
0
 /**
  * Системный 301 редирект
  *
  * @param  string $url  ссылка, на которую надо перейти
  * @param  string $msg  текст сообщения, отображаемый после перехода
  * @param  string $type тип перехода - ошибка, предупреждение, сообщение и т.д.
  * @return void
  */
 public function redirect($url, $msg = '', $type = 'success')
 {
     $iFilter = joosInputFilter::instance();
     $url = $iFilter->process($url);
     empty($msg) ? null : joosFlashMessage::add($iFilter->process($msg), $type);
     $url = preg_split("/[\r\n]/", $url);
     $url = $url[0];
     if ($iFilter->badAttributeValue(array('href', $url))) {
         $url = JPATH_SITE;
     }
     if (headers_sent()) {
         echo "<script>document.location.href='{$url}';</script>\n";
     } else {
         !ob_get_level() ?: ob_end_clean();
         joosRequest::send_headers_by_code(301);
         joosRequest::send_headers("Location: " . $url);
     }
     exit;
 }