/** * @param \Concrete\Core\Http\Request $req * @return Error */ public function validateRequest(\Concrete\Core\Http\Request $req) { $e = new Error(); $data = $req->get('fslType'); $this->path = $data['path']; if (!$this->path) { $e->add(t("You must include a root path for this storage location.")); } else { if (!is_dir($this->path)) { $e->add(t("The specified root path does not exist.")); } } return $e; }
/** * @param \Concrete\Core\Http\Request $req * * @return Error */ public function validateRequest(\Concrete\Core\Http\Request $req) { $e = \Core::make('error'); $data = $req->get('fslType'); $this->path = $data['path']; if (!$this->path) { $e->add(t("You must include a root path for this storage location.")); } elseif (!is_dir($this->path)) { $e->add(t("The specified root path does not exist.")); } elseif ($this->path == '/') { $e->add(t('Invalid path to file storage location. You may not choose the root directory.')); } return $e; }
private function collectionNotFound(Collection $collection, Request $request, array $headers) { // if we don't have a path and we're doing cID, then this automatically fires a 404. if (!$request->getPath() && $request->get('cID')) { return $this->notFound('', Response::HTTP_NOT_FOUND, $headers); } // let's test to see if this is, in fact, the home page, // and we're routing arguments onto it (which is screwing up the path.) $home = Page::getByID(HOME_CID); $request->setCurrentPage($home); $homeController = $home->getPageController(); $homeController->setupRequestActionAndParameters($request); $response = $homeController->validateRequest(); if ($response instanceof \Symfony\Component\HttpFoundation\Response) { return $response; } elseif ($response === true) { return $this->controller($homeController); } else { return $this->notFound('', Response::HTTP_NOT_FOUND, $headers); } }
/** * Gets a "parameter" value. * * This method is mainly useful for libraries that want to provide some flexibility. * * Order of precedence: GET, PATH, POST * * Avoid using this method in controllers: * * * slow * * prefer to get from a "named" source * * It is better to explicitly get request parameters from the appropriate * public property instead (query, attributes, request). * * @param string $key the key * @param mixed $default the default value * @param bool $deep is parameter deep in multidimensional array * * @return mixed */ public function get($key, $default = null, $deep = false) { return parent::get($key, $default, $deep); }