예제 #1
0
 /**
  * Internal shortcut function to setup ajax requests
  *
  * @param View        $view
  * @param PageRequest $request
  *
  * @return int
  */
 private function _setupAjaxRequest(View $view, PageRequest $request)
 {
     $view->mode = View::MODE_AJAX;
     $view->contenttype = View::CTYPE_JSON;
     if (!\Core\user()->checkAccess('p:/tinymce/imagebrowser/access')) {
         return View::ERROR_ACCESSDENIED;
     }
     if (!\Core\user()->checkAccess('p:/tinymce/imagebrowser/upload')) {
         return View::ERROR_ACCESSDENIED;
     }
     // Meant to be an AJAX POST page only.
     if (!$request->isPost()) {
         return View::ERROR_BADREQUEST;
     }
     if (!$request->isAjax()) {
         return View::ERROR_BADREQUEST;
     }
     // Otherwise, it goes through.
     return View::ERROR_NOERROR;
 }