Exemple #1
0
 /**
  * Returns the module's preferences
  *
  * @return Preferences
  */
 public function getPreferences()
 {
     if ($this->preferences === null) {
         $this->preferences = $this->service->getPreferenceLoader()->getModulePreferences($this->model->getId());
     }
     return $this->preferences;
 }
Exemple #2
0
 public function build(array $data = [])
 {
     $prefs = $this->service->getPreferenceLoader()->getSystemPreferences();
     $data = array_merge($data, ['login_label' => $prefs->getUserLogin()]);
     return $this->render('/keeko/user/templates/login-form.twig', $data);
 }
Exemple #3
0
 /**
  *
  * @return Response
  */
 public function process()
 {
     try {
         $request = Request::createFromGlobals();
         // no trailing slashes in urls
         // redirect unless it's the root url
         $syspref = $this->service->getPreferenceLoader()->getSystemPreferences();
         if (substr($request->getUri(), -1) == '/' && substr($request->getUri(), 0, -1) != $syspref->getRootUrl()) {
             $this->redirect(rtrim($request->getUri(), '/'));
         }
         $router = new ApplicationRouter();
         $uri = $router->match($request);
         $model = $uri->getApplication();
         // 			printf('<p><br><br></p><p>Basepath: %s<br>
         // 					Pathinfo: %s<br>
         // 					Baseurl: %s<br>
         // 					Host: %s<br>
         // 					HttpHost: %s<br>
         // 					Requsturi: %s<br>
         // 					Uri: %s<br>
         // 					Port: %s<br>
         // 					Secure: %s<br><br>APP<br>
         // 					Basepath: %s<br>
         // 					Host: %s<br>
         // 					Secure: %s
         // 					</p>',
         // 					$request->getBasePath(),
         // 					$request->getPathInfo(),
         // 					$request->getBaseUrl(),
         // 					$request->getHost(),
         // 					$request->getHttpHost(),
         // 					$request->getRequestUri(),
         // 					$request->getUri(),
         // 					$request->getPort(),
         // 					$request->isSecure() ? 'yes' : 'no',
         // 					$uri->getBasepath(),
         // 					$uri->getHttphost(),
         // 					$uri->getSecure() ? 'yes' : 'no');
         // set locale
         $localization = $uri->getLocalization();
         $this->service->getLocaleService()->setLocale($localization->getLocale());
         // init app
         $class = $model->getClassName();
         $app = new $class($model, $uri, $this->service);
         $app->setBaseUrl($uri->getUrl());
         $app->setDestination($router->getDestination());
         // 			$app->setRootUrl($root);
         // 			$app->setAppPath($router->getPrefix());
         // 			$app->setDestinationPath($router->getDestination());
         $this->app = $app;
         $response = $this->handle($app, $request);
         if ($response instanceof RedirectResponse) {
             $response->sendHeaders();
             $this->redirect($response->getTargetUrl());
         }
         $response->prepare($request);
         return $response;
     } catch (\Exception $e) {
         printf('<b>[%s] %s</b><pre>%s</pre>', get_class($e), $e->getMessage(), $e->getTraceAsString());
     }
 }