示例#1
0
 public static function drawError($message)
 {
     /* <php4> -- 
     		static $errorWriting;
     		-- </php4> */
     if (self::$errorWriting) {
         return;
     }
     self::$errorWriting = TRUE;
     $message = wordwrap($message, 40, "\n", TRUE);
     $width = 400;
     $height = max(100, 40 + 22.5 * (substr_count($message, "\n") + 1));
     $image = new awImage();
     $image->setSize($width, $height);
     $image->setDriver('gd');
     $driver = $image->getDriver();
     $driver->init($image);
     // Display title
     $driver->filledRectangle(new awWhite(), new awLine(new awPoint(0, 0), new awPoint($width, $height)));
     $driver->filledRectangle(new awRed(), new awLine(new awPoint(0, 0), new awPoint(110, 25)));
     $text = new awText("Artichow error", new awFont3(), new awWhite(), 0);
     $driver->string($text, new awPoint(5, 6));
     // Display red box
     $driver->rectangle(new awRed(), new awLine(new awPoint(0, 25), new awPoint($width - 90, $height - 1)));
     // Display error image
     $file = ARTICHOW_IMAGE . DIRECTORY_SEPARATOR . 'error.png';
     $imageError = new awFileImage($file);
     $driver->copyImage($imageError, new awPoint($width - 81, $height - 81), new awPoint($width - 1, $height - 1));
     // Draw message
     $text = new awText(strip_tags($message), new awFont2(), new awBlack(), 0);
     $driver->string($text, new awPoint(10, 40));
     $image->send();
     exit;
 }