/** * @Route /configuration/configure */ public function configureAction(\Slim\Http\Request $request) { $parameters = array(); $parameters['database'] = array(); $parameters['database']['driver'] = $request->post('driver'); $parameters['database']['dbname'] = ''; $parameters['database']['user'] = $request->post('user'); $parameters['database']['port'] = $request->post('port'); $parameters['database']['password'] = $request->post('password'); $parameters['database']['host'] = $request->post('host'); $parameters['raptor'] = array(); $parameters['raptor']['language'] = $request->post('lang'); $parameters['raptor']['secret'] = $request->post('secret'); $parameters['raptor']['cache'] = $request->post('cache'); $this->app->getConfigurationLoader()->setConfOption($parameters); $this->getStore()->connect(); $this->getStore()->generateDatabase($request->post('db')); $parameters['database']['dbname'] = $request->post('db'); $this->app->getConfigurationLoader()->setConfOption($parameters); $this->app->getConfigurationLoader()->writeOptions(); $this->app->getConfigurationLoader()->forceLoad(); // $parameters['database']['password'] = '******'; // $this->app->getConfigurationLoader()->setConfOption($parameters); // $this->app->getConfigurationLoader()->writeOptions(); return $this->render('@systemBundle/configure/parameter.html.twig'); }
/** * @param View $view * @param Request $request * @param UserRepository $userRepository * @param Session $session * @param Redirector $redir */ public function __construct(View $view, Request $request, UserRepository $userRepository, Session $session, Redirector $redir) { $this->view = $view; $this->username = $request->post('username'); $this->password = $request->post('password'); $this->userRepository = $userRepository; $this->session = $session; $this->redir = $redir; }
/** * @param Request $request * @param UserRepository $userRepository * @param Redirector $redirector */ public function __construct(Request $request, UserRepository $userRepository, Redirector $redirector) { $this->dispname = $request->post('dispname'); $this->username = $request->post('username'); $this->password = $request->post('password'); $this->phone = $request->post('phone'); $this->userRepository = $userRepository; $this->redirector = $redirector; }
public function get($name) { $value = $this->request->get($name); if ($value === null) { $value = $this->request->post($name); } if ($value === null) { $value = @$this->defaultValues[$name]; } return $value; }
/** * Add your definition route and the name route[optional] * * @Route /configure/configure * * * @param \Slim\Http\Request $request * @param \Slim\Http\Response $response * @param \Slim\Route $route */ public function configureAction($request, $response, $route) { $this->constructServiceFile(); $wsdlGenerator = new PHPClass2WSDL('Raptor2\\ServiceBundle\\Soap\\Service', $request->post('uri')); $wsdlGenerator->generateWSDL(FALSE); $actual = $wsdlGenerator->dump(); $dirClass = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Soap'; file_put_contents($dirClass . DIRECTORY_SEPARATOR . 'wsdl' . DIRECTORY_SEPARATOR . 'service.wsdl', $actual); $this->app->getConfigurationLoader()->setConfOption(array('raptor' => array('services' => $request->post('uri')))); $this->app->getConfigurationLoader()->writeOptions(); $this->app->getConfigurationLoader()->forceLoad(); return $this->render('@ServiceBundle/configure/parameter.html.twig'); }
/** * @Route /genbundle/create * @param \Slim\Http\Request $request */ public function createBundleAction($request) { $bundleName = $request->post('bundle'); $bundleName .= 'Bundle'; $messages = new ItemList(); if (!$this->createBundleDirectory($request->post('vendor'), $bundleName, $messages)) { return $this->show("Sorry cannot create the Bundle directory", true, Controller::ERROR); } $this->createFiles($bundleName, $request->post('definition'), $request->post('vendor'), $messages); $this->app->getConfigurationLoader()->registerBundle($request->post('definition') . '\\' . $bundleName); $resp = array(); $messages->each(function ($key, $value) use(&$resp) { $resp[] = array('msg' => $value); }); $resp = array('response' => $resp); $this->app->getConfigurationLoader()->forceLoad(); return $this->show("Bundle created", true, Controller::INFO, $resp); }
protected function __construct(\Slim\Http\Request $request) { $key = $request->headers('apikey'); if ($key == '') { $key = $request->post('apikey'); } if ($key == '') { $key = $request->get('apikey'); } if ($key == '') { return; } $this->apiKey = $key; $this->role = $this->getRoleFromKey($this->apiKey); }
public function extractToken(Request $request) { $tokenHeader = $request->headers('Authorization', false); $rawTokenHeader = $request->rawHeaders('Authorization', false); if ($tokenHeader && preg_match('/Bearer\\s*([^\\s]+)/', $tokenHeader, $matches)) { $tokenHeader = $matches[1]; } elseif ($rawTokenHeader && preg_match('/Bearer\\s*([^\\s]+)/', $rawTokenHeader, $matches)) { $tokenHeader = $matches[1]; } else { $tokenHeader = false; } $tokenRequest = $request->post('access_token', false); $tokenQuery = $request->get('access_token', false); // At least one (and only one) of client credentials method required. if (!$tokenHeader && !$tokenRequest && !$tokenQuery) { throw new Exception('The request is missing a required parameter.', Resource::STATUS_BAD_REQUEST); } elseif ($tokenHeader && $tokenRequest || $tokenRequest && $tokenQuery || $tokenQuery && $tokenHeader) { throw new Exception('The request includes multiple credentials.', Resource::STATUS_BAD_REQUEST); } $accessToken = $tokenHeader ?: $tokenRequest ?: $tokenQuery; try { $tokenDocument = $this->fetchToken($accessToken); } catch (\Exception $e) { throw new Exception('Access token invalid.'); } return $tokenDocument; }
public function __invoke() { $title = $this->request->post('gamename'); $this->gameRepository->createGameUnsafe($title, $this->currentUser); $this->redirector->redirect(303, '/games'); }
public function getSlimView(\Slim\Http\Request $request) { if ($request->isAjax() || $request->isXhr() || $request->get('format', '') == 'json' || $request->post('format', '') == 'json') { return $this->slimViewFactory->getJsonSlimView(); } return $this->slimViewFactory->getHtmlSlimView(); }