/** * @return Search */ public function create() { $search = new Search(); // Pass parameters from request $search->by = $this->request->getQuery('search-by', 'popularity'); $search->limit = $this->request->getQuery('search-limit'); $search->q = $this->request->getQuery('q', NULL); return $search; }
public function loadParamVat($default) { $paramGet = $this->request->getQuery($this->getParamVat()); if ($paramGet !== NULL) { return $this->setSessionVat($paramGet); } if (isset($this->session->{$this->getParamVat()})) { return $this->session->{$this->getParamVat()}; } return $this->setSessionVat($default); }
/** * Lost password form * @return Form */ public function create() { $form = new Form(); $form->addText('mail', 'Zadejte svůj registrovaný mail')->setRequired('Zadejte svůj mail')->addRule(Form::EMAIL, 'Nesprávný formát mailu')->setType('email'); $form->addPassword('password', 'Vaše přihlašovací heslo po 1.:')->setRequired('Prosím zadejte vaše heslo')->addRule(Form::PATTERN, 'Musí obsahovat číslici', '.*[0-9].*')->addRule(Form::MIN_LENGTH, 'Heslo musí mít alespoň %d znaků', 6); $form->addPassword('password2', 'Vaše přihlašovací heslo po 2.:')->addRule(Form::FILLED, "Potvrzovací heslo musí být vyplněné !")->addConditionOn($form["password"], Form::FILLED)->addRule(Form::EQUAL, "Hesla se musí shodovat !", $form["password"]); $form->addHidden('passwordCheckCode', $this->request->getQuery('id')); $form->addSubmit('renew', 'Nastavit nové heslo'); $form->onSuccess[] = [$this, 'succeeded']; return $form; }
public function __construct(Request $request, IStorage $cacheStorage) { $this->request = $request; $this->cache = new Cache($cacheStorage, 'MailPanel'); switch ($request->getQuery('mail-panel')) { case 'download': $this->handleDownload($request->getQuery('mail-panel-mail'), $request->getQuery('mail-panel-file')); break; default: break; } }
/** * @param string $filename */ public function handleDeleteFile($filename) { if ($filename == NULL) { $filename = $this->httpRequest->getQuery('file'); } $this->repository->delete($filename); $this->invalidateControl(); $this->handleGetFiles(); }
function __construct(Cron $cron, Request $request) { $this->cron = $cron; $this->request = $request; $query = $request->getQuery("run-cron-jobs"); if ($query == 1) { $this->runCronJobs(); } }
/** * @param string $key * @param mixed $default * @return mixed|null */ protected function getRequest($key, $default = NULL) { if ($value = $this->httpRequest->getPost($key)) { return $value; } if ($value = $this->httpRequest->getQuery($key)) { return $value; } return $default; }
/** * Přejmenuje nahraný soubor. */ public function handleRename() { $id = $this->request->getQuery("id"); $newName = $this->request->getQuery("newName"); $token = $this->request->getQuery("token"); $cache = $this->uploadControl->getCache(); $cacheFiles = $cache->load($this->uploadControl->getTokenizedCacheName($token)); if (isset($cacheFiles[$id])) { $cacheFiles[$id] = $this->uploadControl->getUploadModel()->rename($cacheFiles[$id], $newName); $cache->save($this->uploadControl->getTokenizedCacheName($token), $cacheFiles); } }
/** * @throws PaymentFailedException * @return Response */ public function doPayment() { $token = $this->httpRequest->getQuery('token'); $details = $this->getCheckoutDetails($token); if ($details->isPaymentCompleted()) { return $details; } $data = array('METHOD' => 'DoExpressCheckoutPayment', 'PAYERID' => $details->getData('PAYERID'), 'TOKEN' => $token); foreach ($details->getCarts() as $cart) { $data += $cart->serialize($this->account, $this->currency, '0'); } $return = $this->process($data) + array('details' => $details); if ($return['ACK'] == 'Success') { return new Response($return); } throw new PaymentFailedException($return, $data); }
/** * @return ConfirmRequest * @throws RequestException */ protected function createConfirmRequest() { // Validate request params $args = $this->request->getQuery(); $keys = ['id', 'request', 'message', 'status', 'timestamp', 'att']; foreach ($keys as $key) { if (!array_key_exists($key, $args)) { throw new RequestException("Key '{$key}' missing in request parameters."); } } // Assign to variables $id = $this->request->getQuery('id'); $request = $this->request->getQuery('request'); $message = $this->request->getQuery('message'); $status = $this->request->getQuery('status'); $timestamp = $this->request->getQuery('timestamp'); $att = $this->request->getQuery('att'); // Create request $request = new ConfirmRequest($id, $request, $message, $status, $timestamp, $att); return $request; }
/** * Move file/dir * * @param string $targetDir Target dir * @param string $filename File name * * @return void */ public function handleMove($targetDir = null, $filename = null) { // if sended by AJAX if (!$targetDir) { $targetDir = $this->httpRequest->getQuery("targetdir"); } if (!$filename) { $filename = $this->httpRequest->getQuery("filename"); } if ($this->system->parameters["readonly"]) { $this->flashMessage($this->system->translator->translate("Read-only mode enabled!"), "warning"); return; } if ($targetDir && $filename) { $sourcePath = $this->getAbsolutePath($this->getActualDir()) . DIRECTORY_SEPARATOR . $filename; $this->move($sourcePath, $this->getAbsolutePath($targetDir)); $this->presenter->payload->result = "success"; } }
/** * @return void */ private function tryHandleRequest() { if (Debugger::$productionMode !== FALSE) { return; } $action = $this->request->getQuery('nextras-mail-panel-action'); $messageId = $this->request->getQuery('nextras-mail-panel-message-id'); $attachmentId = $this->request->getQuery('nextras-mail-panel-attachment-id'); if ($action === 'detail' && is_string($messageId)) { $this->handleDetail($messageId); } elseif ($action === 'source' && is_string($messageId)) { $this->handleSource($messageId); } elseif ($action === 'attachment' && is_string($messageId) && ctype_digit($attachmentId)) { $this->handleAttachment($messageId, $attachmentId); } elseif ($action === 'delete-one' && is_string($messageId)) { $this->handleDeleteOne($messageId); } elseif ($action === 'delete-all') { $this->handleDeleteAll(); } }
/** * get JSON with nets - use MODE and get only sites which are visible in that MODES * * @param Nette\Http\Request $request * @return string JSON formated array */ public function getNetsProcessClick(Nette\Http\Request $request) { $detail = false; if ($request->getQuery("net")) { $id = intval($request->getQuery("net")); $detail = $this->getWifiById($id); $click_lat = $detail["latitude"]; $click_lon = $detail["longitude"]; } else { $click_lat = doubleval($request->getQuery("click_lat")); $click_lon = doubleval($request->getQuery("click_lon")); } $mapCoords = new Coords($request->getQuery("map_lat1"), $request->getQuery("map_lat2"), $request->getQuery("map_lon1"), $request->getQuery("map_lon2")); // vytvoreni okoli bodu kliknuti $lat1 = doubleval($click_lat) - self::CLICK_POINT_CIRCLE_RADIUS * $mapCoords->getDeltaLat(); $lat2 = doubleval($click_lat) + self::CLICK_POINT_CIRCLE_RADIUS * $mapCoords->getDeltaLat(); $lon1 = doubleval($click_lon) - self::CLICK_POINT_CIRCLE_RADIUS * $mapCoords->getDeltaLon(); $lon2 = doubleval($click_lon) + self::CLICK_POINT_CIRCLE_RADIUS * $mapCoords->getDeltaLon(); $requestCoords = new Coords($lat1, $lat2, $lon1, $lon2); switch ($request->getQuery("mode")) { case WifiPresenter::MODE_HIGHLIGHT: $sql = $this->getNetsRangeQuery($requestCoords); break; case WifiPresenter::MODE_SEARCH: $params = array(); if ($request->getQuery("ssidmac")) { if (preg_match("^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})^", urldecode($request->getQuery("ssidmac")))) { $params['mac'] = urldecode($request->getQuery("ssidmac")); } else { $params["ssid"] = $request->getQuery("ssidmac"); } } if ($request->getQuery("channel") && $request->getQuery("channel") != "") { $params['channel'] = intval($request->getQuery("channel")); } if ($request->getQuery("security") && $request->getQuery("security") != "") { $params['sec'] = intval($request->getQuery("security")); } $sql = $this->getSearchQuery($requestCoords, $params); break; default: $sql = $this->getNetsRangeQuery($requestCoords); } $sql->select("id,mac,latitude,longitude,ssid,channel,altitude,SQRT(POW(latitude-?,2)+POW(longitude-?,2)) AS distance ", doubleval($click_lat), doubleval($click_lon)); $sql->order("distance"); if (!$detail) { $f = $sql->fetch(); if ($f) { $detail = Wifi::createWifiFromDBRow($f); } } $wf = $sql->fetchPairs("id"); $nbs = $wf; unset($nbs[$detail->getId()]); $json = array(); $json["count"] = count($wf); $json["detail"] = $detail; foreach (array_slice($nbs, 0, 5, true) as $nb) { $json["others"][] = $nb->toArray(); } return $json; }
/** * @param \Nette\Http\Request $request * * @return string */ protected function detectMethod(HttpRequest $request) { $requestMethod = $request->getMethod(); if ($requestMethod !== 'POST') { return $request->getMethod(); } $method = $request->getHeader(self::HTTP_HEADER_OVERRIDE); if (isset($method)) { return strtoupper($method); } $method = $request->getQuery(self::QUERY_PARAM_OVERRIDE); if (isset($method)) { return strtoupper($method); } return $requestMethod; }