PHP Class Request, someline-starter Code Examples

This page contains top rated real world PHP examples of class Request from package someline-starter extracted from open source projects. You can rate examples to help us improve the quality of examples
This makes PHP code quality analyzer tools very happy.
Example #1
Show file File: Handler.php Project: askedio/laravel-cruddy
0
 /**
  * Render an exception into an HTTP response.
  *
  * @param Request   $request
  * @param Exception $exception
  *
  * @return Response
  */
 public function render($request, Exception $exception)
 {
     if (!$request->is(config('jsonapi.url'))) {
         return parent::render($request, $exception);
     }
     return $this->handle($request, $exception);
 }
Example #2
Show file File: update_fs_rule.php Project: KICHIRO20/-Myproject_part1-
0
 function onAction()
 {
     global $application;
     if (modApiFunc('Session', 'is_Set', 'SessionPost')) {
         _fatal(array("CODE" => "CORE_050"), __CLASS__, __FUNCTION__);
     }
     $SessionPost = $_POST;
     $SessionPost["ViewState"]["ErrorsArray"] = array();
     $fsr_id = $SessionPost["FsRule_id"] = intval($SessionPost["FsRule_id"]);
     $SessionPost["FsRuleName"] = trim($SessionPost["FsRuleName"]);
     $SessionPost["FsRuleMinSubtotal"] = floatval($SessionPost["FsRuleMinSubtotal"]);
     $SessionPost["FsRuleStrictCart"] = intval($SessionPost["StrictCart"]);
     if ($SessionPost["FsRuleName"] == "") {
         $SessionPost["ViewState"]["ErrorsArray"][] = "ERROR_EMPTY_RULE_NAME";
     }
     $is_unique = modApiFunc("Shipping_Cost_Calculator", "checkIfFsRuleIsUnique", $SessionPost["FsRuleName"], $fsr_id);
     if (!$is_unique) {
         $SessionPost["ViewState"]["ErrorsArray"][] = "ERROR_NOT_UNIQUE_RULE_NAME";
     }
     if ($SessionPost["FormSubmitValue"] == "Save") {
         if (count($SessionPost["ViewState"]["ErrorsArray"]) == 0) {
             unset($SessionPost["ViewState"]["ErrorsArray"]);
             $this->saveSettings($SessionPost);
             $SessionPost["ViewState"]["hasCloseScript"] = "true";
         }
     }
     modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $request->setKey('FsRule_id', $fsr_id);
     $application->redirect($request);
 }
Example #3
Show file File: GoogleMaps.php Project: designs2/filter_perimetersearch
0
 /**
  * {@inheritdoc}
  */
 public function getCoordinates($street = null, $postal = null, $city = null, $country = null, $fullAddress = null)
 {
     // Generate a new container.
     $objReturn = new Container();
     // Set the query string.
     $sQuery = $this->getQueryString($street, $postal, $city, $country, $fullAddress);
     $objReturn->setSearchParam($sQuery);
     $oRequest = null;
     $oRequest = new \Request();
     $oRequest->send(sprintf($this->strGoogleUrl, rawurlencode($sQuery)));
     $objReturn->setUri(sprintf($this->strGoogleUrl, rawurlencode($sQuery)));
     if ($oRequest->code == 200) {
         $aResponse = json_decode($oRequest->response, 1);
         if (!empty($aResponse['status']) && $aResponse['status'] == 'OK') {
             $objReturn->setLatitude($aResponse['results'][0]['geometry']['location']['lat']);
             $objReturn->setLongitude($aResponse['results'][0]['geometry']['location']['lng']);
         } elseif (!empty($aResponse['error_message'])) {
             $objReturn->setError(true);
             $objReturn->setErrorMsg($aResponse['error_message']);
         } else {
             $objReturn->setError(true);
             $objReturn->setErrorMsg($aResponse['Status']['error_message']);
         }
     } else {
         // Okay nothing work. So set all to Error.
         $objReturn->setError(true);
         $objReturn->setErrorMsg('Could not find coordinates for address "' . $sQuery . '"');
     }
     return $objReturn;
 }
Example #4
Show file File: AppController.php Project: jabouzi/projet
0
 function getCommand(Request $req)
 {
     $previous = $req->getLastCommand();
     if (!$previous) {
         $cmd = $req->getProperty('cmd');
         if (!$cmd) {
             $req->setProperty('cmd', 'default');
             return self::$default_cmd;
         }
     } else {
         $cmd = $this->getForward($req);
         if (!$cmd) {
             return null;
         }
     }
     $cmd_obj = $this->resolveCommand($cmd);
     if (!$cmd_obj) {
         throw new \woo\base\AppException("couldn't resolve '{$cmd}'");
     }
     $cmd_class = get_class($cmd_obj);
     if (isset($this->invoked[$cmd_class])) {
         throw new \woo\base\AppException("circular forwarding");
     }
     $this->invoked[$cmd_class] = 1;
     return $cmd_obj;
 }
Example #5
Show file File: Bootstrap.php Project: tsyacom/panamericanaWS_H2H
0
 public static function run(Request $peticion)
 {
     $controller = $peticion->getControlador() . 'Controller';
     $rutaControlador = ROOT . 'controllers' . DS . $controller . '.php';
     $metodo = $peticion->getMetodo();
     $args = $peticion->getArgs();
     if (is_readable($rutaControlador)) {
         require_once $rutaControlador;
         $controller = new $controller();
         //instanciando clase del indexController
         if (is_callable(array($controller, $metodo))) {
             $metodo = $peticion->getMetodo();
         } else {
             $metodo = 'index';
         }
         if ($args != null) {
             call_user_func_array(array($controller, $metodo), $args);
             //en un arreglo enviamos nombre de clase y metodo que queremos llamar y parametros que queremos pasar
         } else {
             call_user_func(array($controller, $metodo));
         }
     } else {
         throw new Exception('Controller no encontrado: ' . $rutaControlador);
     }
 }
Example #6
Show file File: move_products_az.php Project: KICHIRO20/-Myproject_part1-
0
 function outputMoveHref()
 {
     $request = new Request();
     $request->setView('MoveProducts');
     $request->setAction('MoveToProducts');
     return $request->getURL();
 }
Example #7
Show file File: class-bootstrap.php Project: arter97/h5ai
0
 public static function run()
 {
     spl_autoload_register(['Bootstrap', 'autoload']);
     putenv('LANG=en_US.UTF-8');
     setlocale(LC_CTYPE, 'en_US.UTF-8');
     date_default_timezone_set(@date_default_timezone_get());
     session_start();
     $session = new Session($_SESSION);
     $request = new Request($_REQUEST);
     $setup = new Setup($request->query_boolean('refresh', false));
     $context = new Context($session, $request, $setup);
     if ($context->is_api_request()) {
         (new Api($context))->apply();
     } else {
         if ($context->is_info_request()) {
             $public_href = $setup->get('PUBLIC_HREF');
             $x_head_tags = $context->get_x_head_html();
             require __DIR__ . '/pages/info.php';
         } else {
             $public_href = $setup->get('PUBLIC_HREF');
             $x_head_tags = $context->get_x_head_html();
             $fallback_html = (new Fallback($context))->get_html();
             require __DIR__ . '/pages/index.php';
         }
     }
 }
Example #8
Show file File: LiveUpdate.php Project: iCodr8/core
0
 /**
  * Run the Live Update
  * @param \BackendTemplate
  */
 protected function runLiveUpdate(\BackendTemplate $objTemplate)
 {
     $archive = 'system/tmp/' . \Input::get('token');
     // Download the archive
     if (!file_exists(TL_ROOT . '/' . $archive)) {
         $objRequest = new \Request();
         $objRequest->send(\Config::get('liveUpdateBase') . 'request.php?token=' . \Input::get('token'));
         if ($objRequest->hasError()) {
             $objTemplate->updateClass = 'tl_error';
             $objTemplate->updateMessage = $objRequest->response;
             return;
         }
         \File::putContent($archive, $objRequest->response);
     }
     $objArchive = new \ZipReader($archive);
     // Extract
     while ($objArchive->next()) {
         if ($objArchive->file_name != 'TOC.txt') {
             try {
                 \File::putContent($objArchive->file_name, $objArchive->unzip());
             } catch (\Exception $e) {
                 $objTemplate->updateClass = 'tl_error';
                 $objTemplate->updateMessage = 'Error updating ' . $objArchive->file_name . ': ' . $e->getMessage();
                 return;
             }
         }
     }
     // Delete the archive
     $this->import('Files');
     $this->Files->delete($archive);
     // Run once
     $this->handleRunOnce();
 }
Example #9
Show file File: RoomTypeController.php Project: kchhainarong/chantuchP
0
 /**
  * Store a newly created resource in storage.
  *
  * @param Request $request
  * @return Response
  */
 public function store(Request $request)
 {
     //
     $room_type = new RoomType($request->all());
     $room_type->save();
     return $room_type;
 }
Example #10
Show file File: Packager.php Project: hisaboh/w2t
0
 /**
  * package serverを立ち上げる
  *
  * @param string $package_root パッケージ名
  */
 public static function handler($package_root = null)
 {
     if (empty($package_root) || Rhaco::path() == "") {
         $debug = debug_backtrace();
         $first_action = array_pop($debug);
         if ($package_root === null) {
             $package_root = basename(dirname($first_action["file"]));
         }
         if (Rhaco::path() == "") {
             Rhaco::init($first_action["file"]);
         }
     }
     $base_dir = Rhaco::path();
     $request = new Request();
     $package_root_path = str_replace(".", "/", $package_root);
     $preg_quote = (empty($package_root_path) ? "" : preg_quote($package_root_path, "/") . "\\/") . "(.+)";
     $tag = new Tag("rest");
     if (preg_match("/^\\/state\\/" . $preg_quote . "\$/", $request->args(), $match)) {
         $tag->add(new Tag("package", $match[1]));
         if (self::parse_package($package_root_path, $base_dir, $match[1], $tgz_filename)) {
             $tag->add(new Tag("status", "success"));
             $tag->output();
         }
     } else {
         if (preg_match("/^\\/download\\/" . $preg_quote . "\$/", $request->args(), $match)) {
             if (self::parse_package($package_root_path, $base_dir, $match[1], $tgz_filename)) {
                 Http::attach(new File($tgz_filename));
             }
         }
     }
     Http::status_header(403);
     $tag->add(new Tag("status", "fail"));
     $tag->output();
     exit;
 }
Example #11
Show file File: pool.php Project: Gaia-Interactive/gaia_core_php
0
 /**
  * add a new request to the pool.
  */
 public function add(Request $request, array $opts = array())
 {
     $ch = $request->build($opts);
     $this->requests[(int) $request->resource] = $request;
     curl_multi_add_handle($this->resource, $request->resource);
     return $request;
 }
Example #12
Show file File: RequestConverterTest.php Project: pscheit/psc-cms
0
 public function testJSONRequestIsConvertedToConvertedBodyRequest()
 {
     $request = new Request(Request::POST, '/entities/something/1');
     $request->setHeaderField('Content-Type', 'application/json')->setBody('{"some": "value"}');
     $serviceRequest = $this->requestConverter->fromHTTPRequest($request);
     $this->assertEquals((object) array('some' => 'value'), $serviceRequest->getBody());
 }
Example #13
Show file File: ContentRouter.php Project: dylanschoenmakers/Cms
0
 /**
  * Tries to match a URL path with a set of routes.
  *
  * If the matcher can not find information, it must throw one of the
  * exceptions documented below.
  *
  * @param string $pathinfo The path info to be parsed (raw format, i.e. not
  *                         urldecoded)
  *
  * @return array An array of parameters
  *
  * @throws ResourceNotFoundException If the resource could not be found
  * @throws MethodNotAllowedException If the resource was found but the
  *                                   request method is not allowed
  */
 public function match($pathinfo)
 {
     $urlMatcher = new UrlMatcher($this->routeCollection, $this->getContext());
     $result = $urlMatcher->match($pathinfo);
     if (!empty($result)) {
         try {
             // The route matches, now check if it actually exists
             $result['content'] = $this->contentManager->findActiveBySlug($result['slug']);
         } catch (NoResultException $e) {
             try {
                 //is it directory index
                 if (substr($result['slug'], -1) == '/' || $result['slug'] == '') {
                     $result['content'] = $this->contentManager->findActiveBySlug($result['slug'] . 'index');
                 } else {
                     if ($this->contentManager->findActiveBySlug($result['slug'] . '/index')) {
                         $redirect = new RedirectResponse($this->request->getBaseUrl() . "/" . $result['slug'] . '/');
                         $redirect->sendHeaders();
                         exit;
                     }
                 }
             } catch (NoResultException $ex) {
                 try {
                     $result['content'] = $this->contentManager->findActiveByAlias($result['slug']);
                 } catch (NoResultException $ex) {
                     throw new ResourceNotFoundException('No page found for slug ' . $pathinfo);
                 }
             }
         }
     }
     return $result;
 }
Example #14
Show file File: update_wtp.php Project: digitaldevelopers/plugin-avactis-2.1
0
 /**
  *
  */
 function onAction()
 {
     global $application;
     $request = $application->getInstance('Request');
     $SessionPost = array();
     if (modApiFunc('Session', 'is_Set', 'SessionPost')) {
         _fatal(array("CODE" => "CORE_050"), __CLASS__, __FUNCTION__);
     }
     $SessionPost = $_POST;
     switch ($SessionPost["ViewState"]["FormSubmitValue"]) {
         case "save":
             $SessionPost["ViewState"]["ErrorsArray"] = array();
             if (empty($SessionPost["ModuleName"]) == true || trim($SessionPost["ModuleName"]) == '') {
                 $SessionPost["ViewState"]["ErrorsArray"][] = "MODULE_ERROR_NO_NAME";
             }
             $nErrors = sizeof($SessionPost["ViewState"]["ErrorsArray"]);
             if ($nErrors == 0) {
                 unset($SessionPost["ViewState"]["ErrorsArray"]);
                 $this->saveDataToDB($SessionPost);
                 $SessionPost["ViewState"]["hasCloseScript"] = "true";
             }
             break;
         default:
             _fatal(array("CODE" => "CORE_051"), __CLASS__, __FUNCTION__, $request->getValueByKey('FormSubmitValue'));
             break;
     }
     modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
     // get view name by action name.
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $application->redirect($request);
 }
Example #15
Show file File: RequestTest.php Project: jlipinio/MVC-test
0
 public function testGenerateUri()
 {
     $request = new Request();
     $request->pattern('test/<action>');
     $params = array('action' => 'index');
     $this->assertSame('test/index', $request->generate_uri($params));
 }
Example #16
Show file File: Bootstrap.php Project: elephantphp/ElephantFreamwork
0
 public function __construct(Request $peticion)
 {
     global $debugbar;
     $app = $peticion->getControlador();
     $apps = new AppsBuilder(require __DIR__ . '/Config/aplications.php');
     $this->app = new \Elephant\Bootstrap\AppBuilder($apps->getAppName($app));
 }
Example #17
Show file File: mail_info_az.php Project: KICHIRO20/-Myproject_part1-
0
 /**
  * MailInfo constructor
  */
 function MailInfo()
 {
     global $application;
     $MR =& $application->getInstance('MessageResources');
     //initialize form data with null values when adding a new notification
     $this->currentNotificationId = modApiFunc("Notifications", "getCurrentNotificationId");
     if ($this->currentNotificationId == 'Add') {
         $this->notificationInfo = array('Id' => '', 'Name' => '', 'Subject' => '', 'Body' => '', 'JavascriptBody' => '', 'From_addr' => '', 'Email_Code' => '', 'Active' => 'checked', 'Action_id' => 1);
         $request = new Request();
         $request->setView('NotificationInfo');
         $request->setAction('AddNotification');
         $formAction = $request->getURL();
         $this->properties = array('SubmitButton' => $MR->getMessage('BTN_ADD'), 'FormAction' => $formAction);
     } else {
         //initialize form data with database values when editing the notification
         $this->notificationInfo = modApiFunc("Notifications", "getNotificationInfo", $this->currentNotificationId);
         if (sizeof($this->notificationInfo) == 1) {
             $this->notificationInfo = $this->notificationInfo[0];
             $this->notificationInfo['JavascriptBody'] = addcslashes(addslashes($this->notificationInfo['Body']), "..");
             $this->notificationInfo['Body'] = prepareHTMLDisplay($this->notificationInfo['Body']);
         } else {
             $this->currentNotificationId = 'Add';
             $this->notificationInfo = array('Id' => '', 'Name' => '', 'Subject' => '', 'Body' => '', 'JavascriptBody' => '', 'From_addr' => '', 'Email_Code' => '', 'Active' => 'checked', 'Action_id' => 1);
         }
         $request = new Request();
         $request->setView('NotificationInfo');
         $request->setAction('SaveNotification');
         $formAction = $request->getURL();
         $this->properties = array('SubmitButton' => $MR->getMessage('BTN_SAVE'), 'FormAction' => $formAction);
     }
     $this->actionsList = modApiFunc("Notifications", "getActionsList");
     $this->InfoTags = modApiFunc("Notifications", "getAvailableTagsList", $this->actionsList);
 }
Example #18
Show file File: Response.php Project: im286er/curl-easy
0
 /**
  * Constructs response
  * 
  * @param Request $request Request
  * @param string  $content Content of reponse
  */
 public function __construct(Request $request, $content = null)
 {
     $this->ch = $request->getHandle();
     if (is_string($content)) {
         $this->content = $content;
     }
 }
Example #19
Show file File: currency_selector_cz.php Project: KICHIRO20/-Myproject_part1-
0
 function getTag($tag)
 {
     $value = null;
     switch ($tag) {
         case 'Local_SetCurrencyLink':
             $r = new Request();
             $r->setView(CURRENT_REQUEST_URL);
             $r->setAction('SetDisplayCurrency');
             $r->setKey('currency_id', '%currency_id_value%');
             $value = $r->getURL();
             break;
         case 'Local_CurrencyName':
             $value = $this->_Currency['name'];
             break;
         case 'Local_CurrencySelected':
             $b = $this->_Currency['id'] == modApiFunc("Localization", "getSessionDisplayCurrency");
             $value = $b ? 'selected="selected"' : "";
             break;
         case 'Local_CurrencyId':
             $value = $this->_Currency['id'];
             break;
         case 'Local_Items':
             $value = $this->outputItems();
             break;
         case 'Local_CurrentCurrency':
             $value = modApiFunc("Localization", "getCurrencyCodeById", modApiFunc("Localization", "getSessionDisplayCurrency"));
             break;
         case 'Local_CurrencyCode':
             $value = $this->_Currency['code'];
             break;
     }
     return $value;
 }
Example #20
Show file File: FrontControllerImpl.php Project: rousseau-christopher/equinox-core
0
 public function start()
 {
     \org\equinox\utils\debug\DebugBarFactory::init();
     //$this->request->analyseAskedRequest();
     $controller = $this->getController($this->request->getModule(), $this->request->getController());
     try {
         try {
             $action = $controller->doActionRequested($this->request->action, 'main');
         } catch (\org\equinox\exception\AccessDeniedException $e) {
             if ($controller->getReturnType() == \org\equinox\controller\Controller::RETURN_TYPE_HTML) {
                 $controller = $this->getController($this->request->accessDeniedModule, $this->request->accessDeniedController);
                 $controller->doActionRequested($this->request->accessDeniedAction, 'main');
             } else {
                 echo $this->getJsonException($e);
             }
         }
     } catch (\Exception $e) {
         if ($controller->getReturnType() == \org\equinox\controller\Controller::RETURN_TYPE_HTML) {
             $this->request->exception = $e;
             $controller = $this->getController($this->request->errorModule, $this->request->errorController);
             $controller->doActionRequested($this->request->errorAction, 'main');
         } else {
             echo $this->getJsonException($e);
         }
     }
     if ($controller->getReturnType() == \org\equinox\controller\Controller::RETURN_TYPE_HTML) {
         $layout = $this->getController($this->request->layoutModule, $this->request->layoutController);
         echo $layout->genereLayout();
     } else {
         echo json_encode($action->getAllAssigns());
     }
     return true;
 }
Example #21
Show file File: ContactModel.php Project: artemkuchma/PHP_academy_site1
0
 public function __construct(Request $request)
 {
     $this->name = $request->post('name');
     $this->email = $request->post('email');
     $this->message = $request->post('message');
     $this->date = $request->post('date');
 }
Example #22
Show file File: Bootstrap.php Project: salvaroad/framework3
0
 /**
  * @return retorna un peticion solicitada 
  */
 public static function run(Request $peticion)
 {
     $controller = $peticion->getControlador() . "Controller";
     $rutaControlador = ROOT . "controllers" . DS . $controller . ".php";
     $metodo = $peticion->getMetodo();
     $args = $peticion->getArgs();
     //exit;
     if (is_readable($rutaControlador)) {
         require_once $rutaControlador;
         $Controlador = new $controller();
         if (is_callable(array($controller, $metodo))) {
             $metodo = $peticion->getMetodo();
         } else {
             $metodo = "index";
         }
         if ($metodo == 'login') {
             # code...
         } else {
             Authorization::Logged();
         }
         if (isset($args)) {
             call_user_func_array(array($Controlador, $metodo), $args);
         } else {
             call_user_func(array($Controlador, $metodo));
         }
     } else {
         throw new Exception("Controlador no encontrado ");
     }
 }
Example #23
Show file File: lookUpCommand.php Project: open-steam/usermanagement-ldap
0
 public function execute(Request $request, Response $response)
 {
     $view = new TemplateView('lookUp');
     $sessionRegistry = SessionRegistry::getInstance();
     $registry = Registry::getInstance();
     $view->assign('accessLevel', $sessionRegistry->get('accessLevel'));
     $view->assign('groupList', $registry->get('ldapAccess')->getGroupsDN());
     // Benutzeraktion:
     if ($request->issetParameter('lookUp')) {
         $groupname = $request->getParameter('directSelect');
         $groupDN = $registry->get('ldapAccess')->getGroupDN_2($groupname);
         $user = $sessionRegistry->get('uid');
         $userPW = $sessionRegistry->get('userPW');
         // sTeam
         $steamConnector = new steam_connector('localhost', 1900, 'root', 'h6518_W#');
         if (!$steamConnector->get_login_status()) {
             $view->assign('status', 'warning');
             $view->assign('statusMsg', 'Verbindung zum sTeam-Server konnte nicht erstellt werden!');
         } else {
             $ldapModule = $steamConnector->get_server_module('persistence:ldap');
             $steam_groupname = $steamConnector->predefined_command($ldapModule, 'dn_to_group_name', $groupDN, 0);
             $steamGroup = steam_factory::get_group($steamConnector, $steam_groupname, 0);
             $steamGroup->get_members(0);
             // Rückmeldung
             $view->assign('status', 'ok');
             $view->assign('statusMsg', 'LookUp wurde durchgef&uuml;hrt!');
         }
     }
     // Ausgabe erzeugen.
     $view->render($request, $response);
 }
Example #24
Show file File: subscribe_confirm.php Project: KICHIRO20/-Myproject_part1-
0
 function onAction()
 {
     global $application;
     $request = $application->getInstance('Request');
     $SessionPost = array();
     /*
     if(modApiFunc('Session', 'is_Set', 'SessionPost'))
     {
         _fatal(array( "CODE" => "CORE_050"), __CLASS__, __FUNCTION__);
     }
     */
     $SessionPost = $_POST;
     $nErrors = 0;
     $key = $request->getValueByKey('action_key');
     // @ check key
     $topics = $request->getValueByKey('topics');
     $selected_topics = explode(',', $topics);
     if (!is_array($selected_topics) || empty($selected_topics)) {
         // @ INTERNAL
         $SessionPost['ViewState']['ErrorsArray'][] = 'INTERNAL';
         $nErrors++;
     }
     modApiFunc('Subscriptions', 'copyTempEmails', $key);
     modApiFunc('Subscriptions', 'linkTempEmails', $key);
     modApiFunc('Subscriptions', 'subscribeTempEmails', $key, $selected_topics);
     modApiFunc('Subscriptions', 'cleanTempEmails', $key);
     execQuery('SUBSCR_LINK_CUSTOMER_EMAILS', null);
     execQuery('SUBSCR_LINK_ORDERS_EMAILS', null);
     modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
     $request = new Request();
     $request->setView('Subscriptions_Manage');
     //        $request->setKey('stage', 'finish');
     $application->redirect($request);
 }
Example #25
Show file File: update_mr_for_layout.php Project: KICHIRO20/-Myproject_part1-
0
 function onAction()
 {
     global $application;
     $request =& $application->getInstance('Request');
     $layout_path = $request->getValueByKey('layout_path');
     $mr_act = $request->getValueByKey('mr_act');
     if ($mr_act == 'on') {
         $hta_content = modApiFunc('Mod_Rewrite', 'genRewriteBlock', $layout_path);
         $res = modApiFunc('Mod_Rewrite', 'saveHTAcontent', $hta_content, $layout_path);
         if (empty($res)) {
             modApiFunc('Session', 'set', 'ResultMessage', 'MSG_MR_ENABLED');
             modApiFunc('Mod_Rewrite', 'enableMRforLayout', $layout_path);
         } else {
             modApiFunc('Session', 'set', 'Errors', $res);
         }
     }
     if ($mr_act == 'off') {
         modApiFunc('Mod_Rewrite', 'disableMRforLayout', $layout_path);
         modApiFunc('Session', 'set', 'ResultMessage', 'MSG_MR_DISABLED');
     }
     $r = new Request();
     $r->setView(CURRENT_REQUEST_URL);
     $r->setKey('page_view', 'MR_Settings');
     $application->redirect($r);
 }
Example #26
Show file File: UserController.php Project: hmanprod/lemlabs-user
0
 /**
  * @Route("/change-password")
  */
 public function changePasswordAction(Request $request)
 {
     $entityName = $this->container->getParameter('lemlabs_user.class');
     // Prevent perfom logic below if user is authenticated, redirect to dashboard
     if ($this->container->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) {
         return $this->redirect($redirectUrl);
     }
     $em = $this->getDoctrine()->getManager();
     $salt = base64_decode($request->query->get('token'));
     $user = $em->getRepository($entityName)->findOneBySalt($salt);
     if (!$user) {
         $this->get('session')->getFlashBag()->add('danger', 'Cannot found the user');
     }
     $form = $this->createForm(new PasswordType(), $user);
     if ($request->getMethod() == 'POST') {
         $form->bind($request);
         if ($form->isValid()) {
             $factory = $this->get('security.encoder_factory');
             $encoder = $factory->getEncoder($user);
             // Dont forget salt, common in security process
             $user->setSalt(md5(time()));
             $user->setPassword($encoder->encodePassword($user->getPassword(), $user->getSalt()));
             $em->persist($user);
             $em->flush();
             $this->get('session')->getFlashBag()->add('success', 'Congratulations, your password has been updated correctly;');
             return $this->redirect($this->generateUrl('lemlabs_login'));
         }
     }
     return $this->render('LemLabsUserBundle:User:change-password.html.twig', array('form' => $form->createView(), 'errors' => $form->getErrors()));
 }
Example #27
Show file File: ChangeCourseQuota.php Project: rolwi/koala
0
 public function execute(Request $request, Response $response)
 {
     $changeQuotaKeys = array_keys($request->getParameter("changeQuota"));
     $newQuotas = $request->getParameter("newQuota");
     $newNumbersOfLicenses = $request->getParameter("numberOfLicenses");
     $courseID = $changeQuotaKeys[0];
     $newQuota = $newQuotas[$courseID];
     $newNumberOfLicenses = $newNumbersOfLicenses[$courseID];
     $participants = $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getCourseParticipants($courseID);
     if ($newQuota == "manual") {
         if ($newNumberOfLicenses == "") {
             throw new UsermanagementException("Keinen Wert f&uuml;r Lizenzen eingegeben", "");
         } else {
             if (!is_numeric($newNumberOfLicenses)) {
                 throw new UsermanagementException("Ung&uuml;ltige Eingabe.", "Nur numerische Werte sind erlaubt!");
             } else {
                 if ((int) $newNumberOfLicenses < 0) {
                     throw new UsermanagementException("Ung&uuml;ltige Eingabe.", "Werte kleiner 0 sind nicht erlaubt!");
                 } else {
                     if ((int) $newNumberOfLicenses < count($participants)) {
                         $diff = count($participants) - (int) $newNumberOfLicenses;
                         throw new UsermanagementException("Anzahl von Lizenzen zu gering f&uuml;r aktuelle Kursteilnehmerzahl.", "Entferne zun&auml;chst mindestens " . $diff . " Mitarbeiter aus dem Kurs");
                     }
                 }
             }
         }
         $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->setCourseLicenses($courseID, (int) $newNumberOfLicenses);
     } else {
         $currentLicenses = $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getCountCourseLicenses($courseID);
         $newNumberOfLicenses = $currentLicenses + (int) $newQuota;
         $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->setCourseLicenses($courseID, (int) $newNumberOfLicenses);
     }
     return "&Auml;nderungen &uuml;bernommen";
 }
Example #28
Show file File: OpenStreetMaps.php Project: designs2/filter_perimetersearch
0
 /**
  * {@inheritdoc}
  */
 public function getCoordinates($street = null, $postal = null, $city = null, $country = null, $fullAddress = null)
 {
     // Generate a new container.
     $objReturn = new Container();
     // Set the query string.
     $sQuery = $this->getQueryString($street, $postal, $city, $country, $fullAddress);
     $objReturn->setSearchParam($sQuery);
     $oRequest = null;
     $oRequest = new \Request();
     $oRequest->send(sprintf($this->strUrl, rawurlencode($sQuery)));
     $aResponse = json_decode($oRequest->response);
     $objResponse = $aResponse[0];
     if ($oRequest->code == 200) {
         if (!empty($objResponse->place_id)) {
             $objReturn->setLatitude($objResponse->lat);
             $objReturn->setLongitude($objResponse->lon);
         } else {
             $objReturn->setError(true);
             $objReturn->setErrorMsg('No data from OpenStreetMap for ' . $sQuery);
         }
     } else {
         // Okay nothing work. So set all to Error.
         $objReturn->setError(true);
         $objReturn->setErrorMsg('No response from OpenStreetMap for address "' . $sQuery . '"');
     }
     return $objReturn;
 }
Example #29
Show file File: Cookie.php Project: trigoesrodrigo/icingaweb2
0
 /**
  * Cleanup the cookie support check
  */
 public function cleanupCheck()
 {
     if ($this->request->getUrl()->hasParam('_checkCookie') && isset($_COOKIE[self::CHECK_COOKIE])) {
         $requestUri = $this->request->getUrl()->without('_checkCookie');
         $this->request->getResponse()->redirectAndExit($requestUri);
     }
 }
Example #30
Show file File: update_topic.php Project: KICHIRO20/-Myproject_part1-
0
 function onAction()
 {
     global $application;
     $request = $application->getInstance('Request');
     $SessionPost = array();
     if (modApiFunc('Session', 'is_Set', 'SessionPost')) {
         _fatal(array("CODE" => "CORE_050"), __CLASS__, __FUNCTION__);
     }
     $SessionPost = $_POST;
     $nErrors = 0;
     $topic_id = $request->getValueByKey('topic');
     $topic_name = $request->getValueByKey('topic_name');
     $topic_status = $request->getValueByKey('topic_status');
     $topic_access = $request->getValueByKey('topic_access');
     $topic_auto = $request->getValueByKey('topic_auto');
     if ($topic_id == '') {
         $SessionPost['ViewState']['ErrorsArray'][] = 'ALERT_EDIT_INTERNAL_ERROR';
         $SessionPost['ViewState']['hasCloseScript'] = 'false';
     } elseif ($topic_name == '') {
         $SessionPost['ViewState']['ErrorsArray'][] = 'ALERT_FILL_TOPIC_NAME';
         $SessionPost['ViewState']['ErrorFields'][] = 'topic_name';
         $SessionPost['ViewState']['hasCloseScript'] = 'false';
     } else {
         modApiStaticFunc('Subscriptions', 'updateTopic', $topic_id, $topic_name, $topic_status, $topic_access, $topic_auto);
     }
     modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
     $request = new Request();
     $request->setView(CURRENT_REQUEST_URL);
     $application->redirect($request);
 }
Frequently Used Methods