コード例 #1
0
 /**
  * @Browser
  * @Ajax
  * @Rpc
  */
 public function internal_error($params)
 {
     // send mail with embedded exception
     $conf = \Ammonio\Core\ConfigHolder::get_instance();
     $k = Ammonio\Core\Kernel::get_instance();
     $params['config'] = $conf;
     /*
     if ($conf->getApplicationEnvironment() == "production") {
         $renderer = new \Ammonio\Core\PlainTemplateRenderer();
     
         $mail = new Ammonio\Core\Mail('*****@*****.**', 'Notificamelo1');
         $mail->setFrom('*****@*****.**', 'Arasto Notifiche');
         $mail->addTo('*****@*****.**', 'Domenico Ficca');
         $mail->addTo('*****@*****.**', 'Luca Cervasio');
         $mail->setSubject('Runtime exception occured');
         $mail->setBodyText($renderer->render('emails\500error', $params));
     
         $mail->send();
     }
     */
     debug(0, "500 Internal Server Error: " . $params['exception']->getMessage());
     header('HTTP/1.1 500 Internal Server Error');
     $this->set_view('error', '500');
     return $params;
 }
コード例 #2
0
 public static function preRenderHook()
 {
     $k = \Ammonio\Core\Kernel::get_instance();
     $conf = \Ammonio\Core\ConfigHolder::get_instance();
     $mobile_device = array('iphone', 'ipad', 'ipod', 'blackberry', 'android');
     //      $mobile_device = array('mozilla', 'chrome', 'safari');
     return array('credential' => $k->credential, 'conf' => $conf, 'request' => $k->getRequest(), 'ua' => $k->getRequest()->getHeader('User-Agent'), 'mobile_device' => $mobile_device);
 }
コード例 #3
0
 public function uploadFile($params)
 {
     // Include the uploader class
     require_once APP_DIR . '/plugins/upload/lib/qqFileUploader.php';
     $allowedExtensions = array("jpg");
     $conf = \Ammonio\Core\ConfigHolder::get_instance();
     // max file size in bytes
     $sizeLimit = 0.07000000000000001 * 1024 * 1024;
     // max 50 KB
     $uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
     // Call handleUpload() with the name of the folder, relative to PHP's getcwd()
     $name = $params['name'] != "" ? $params['name'] : $params['id'];
     $result = $uploader->handleUpload(APP_DIR . 'app/resources/uploads/' . $params['folder'], TRUE, $name);
     $result['size'] = filesize(APP_DIR . 'app/resources/uploads/' . $params['folder'] . '/' . $name . '.jpg');
     return $result;
 }