Esempio n. 1
0
 protected function error($msg, $options = [])
 {
     $msg = strtr($msg, $options);
     $this->stdout($msg . "\n", Console::FG_RED);
     \Mii::error(strtr($msg, $options), 'console');
 }
Esempio n. 2
0
 public function report($exception)
 {
     \Mii::error(Exception::text($exception), 'mii');
 }
Esempio n. 3
0
 /**
  * Render the current image.
  *
  *     echo $image;
  *
  * [!!] The output of this function is binary and must be rendered with the
  * appropriate Content-Type header or it will not be displayed correctly!
  *
  * @return  string
  */
 public function __toString()
 {
     try {
         // Render the current image
         return $this->render();
     } catch (\Exception $e) {
         // Get the text of the exception
         $error = Exception::text($e);
         \Mii::error($error);
         // Showing any kind of error will be "inside" image data
         return '';
     }
 }
Esempio n. 4
0
 public function check_csrf_token($token = false)
 {
     if (!$token) {
         if (isset($_POST[$this->csrf_token_name])) {
             $token = $_POST[$this->csrf_token_name];
         } elseif (null !== ($token = $this->get_csrf_from_header())) {
         } else {
             \Mii::error('crsf_token not found', 'mii');
         }
     }
     return $this->csrf_token() === $token;
 }