public function userPasswordChangeFormSubmitted($button) { $values = $button->getForm()->getValues(); //Nacitanie hodnot formulara if ($values->new_heslo != $values->new_heslo2) { $this->flashRedirect('this', $this->trLang('PasswordChangeForm_new_heslo2_ar'), 'danger'); } $this->clen = $this->user_profiles->find($values->id); //Najdenie clena if (!$this->hasser->CheckPassword($values->heslo, $this->clen->users->password)) { $this->flashRedirect('this', $this->trLang('pass_incorect'), 'danger'); } //Vygeneruj kluc pre zmenu hesla $new_password = $this->hasser->HashPassword($values->new_heslo); $values->new_heslo = 'xxxxx'; //Len pre istotu $values->new_heslo2 = 'xxxxx'; //Len pre istotu try { $this->users->find($this->clen->id_users)->update(['password' => $new_password]); $this->user_profiles->uloz(['modified' => StrFTime("%Y-%m-%d %H:%M:%S", Time())], $values->id); $this->flashMessage($this->trLang('pass_change_ok'), 'success'); } catch (Exception $e) { $this->flashMessage($this->trLang('pass_change_err') . $e->getMessage(), 'danger,n'); } $this->redirect('UserLog:'); }
/** * Adds HeadersFilter with constant headers for each service wrapper. * * @param mix $wrapper service wrapper * @param string $type type of passed wrapper * * @return mix */ private function _addHeadersFilter($wrapper, $type) { $headers = array(); $latestServicesVersion = Resources::STORAGE_API_LATEST_VERSION; switch ($type) { case Resources::QUEUE_TYPE_NAME: case Resources::BLOB_TYPE_NAME: $headers[Resources::X_MS_VERSION] = $latestServicesVersion; break; case Resources::TABLE_TYPE_NAME: $currentVersion = Resources::DATA_SERVICE_VERSION_VALUE; $maxVersion = Resources::MAX_DATA_SERVICE_VERSION_VALUE; $accept = Resources::ACCEPT_HEADER_VALUE; $acceptCharset = Resources::ACCEPT_CHARSET_VALUE; $headers[Resources::X_MS_VERSION] = $latestServicesVersion; $headers[Resources::DATA_SERVICE_VERSION] = $currentVersion; $headers[Resources::MAX_DATA_SERVICE_VERSION] = $maxVersion; $headers[Resources::MAX_DATA_SERVICE_VERSION] = $maxVersion; $headers[Resources::ACCEPT_HEADER] = $accept; $headers[Resources::ACCEPT_CHARSET] = $acceptCharset; break; case Resources::SERVICE_MANAGEMENT_TYPE_NAME: $headers[Resources::X_MS_VERSION] = Resources::SM_API_LATEST_VERSION; break; } $headersFilter = new HeadersFilter($headers); return $wrapper->withFilter($headersFilter); }
public function userPasswordResetFormSubmitted($form) { $values = $form->getValues(); //Nacitanie hodnot formulara if ($values->new_heslo != $values->new_heslo2) { $this->flashRedirect('this', $this->trLang('reset_pass_hesla_err'), 'danger'); } //Vygeneruj kluc pre zmenu hesla $new_password = $this->hasser->HashPassword($values->new_heslo); $values->new_heslo = 'xxxxx'; //Len pre istotu $values->new_heslo2 = 'xxxxx'; //Len pre istotu try { $this->users->find($values->id)->update(['password' => $new_password, 'new_password_key' => NULL, 'new_password_requested' => NULL]); $this->flashRedirect('User:'******'reset_pass_ok'), 'success'); } catch (Exception $e) { $this->flashRedirect('Homepage:', $this->trLang('reset_pass_err') . $e->getMessage(), 'danger,n'); } }
/** * Hook to processes HTTP request before send. * * @param mix $request HTTP request object. * * @return mix processed HTTP request object. */ public function handleRequest($request) { if ($this->host) { $request->setConfig('proxy_host', $this->host); if ($this->port) { $request->setConfig('proxy_port', $this->port); if ($this->username) { $request->setConfig('proxy_user', $this->username); if ($this->password) { $request->setConfig('proxy_password', $this->password); } } } } return $request; }
protected function startup() { parent::startup(); // Sprava uzivatela $user = $this->getUser(); //Nacitanie uzivatela // Kontrola prihlasenia a nacitania urovne registracie $this->id_reg = $user->isLoggedIn() ? $user->getIdentity()->id_registracia : 0; // Nastavenie z config-u $this->nastavenie = $this->context->parameters; $modul_presenter = explode(":", $this->name); // Skontroluj ci je nastaveny jazyk a ci pozadovany jazyk existuje ak ano akceptuj if (!isset($this->language)) { //Prednastavim hodnotu jazyka $lang_temp = $this->lang->find(1); $this->language = $lang_temp->skratka; $this->language_id = $lang_temp->id; } if (isset($this->params['language'])) { $lang_temp = $this->lang->findOneBy(['skratka' => $this->params['language']]); if (isset($lang_temp->skratka) && $lang_temp->skratka == $this->params['language']) { $this->language = $this->params['language']; $this->language_id = $lang_temp->id; } else { //Inak nastav Slovencinu $this->language = 'sk'; $this->language_id = 1; } } //Nacitanie a spracovanie hlavnych udajov webu $this->udaje_webu = $this->udaje->findAll()->fetchPairs('nazov', 'text'); $vysledok = []; //Nacitanie len tych premennych, ktore platia pre danu jazykovu mutaciu foreach ($this->udaje_webu as $key => $value) { $kluc = explode("-", $key); if (count($kluc) == 2 && $kluc[1] == $this->language) { $vysledok[substr($key, 0, strlen($key) - strlen($this->language) - 1)] = $value; } if (count($kluc) == 1) { $vysledok[$key] = $value; } } $this->udaje_webu = $vysledok; // Nacitanie pomocnych premennych $this->udaje_webu['meno_presentera'] = strtolower($modul_presenter[1]); //Meno aktualneho presentera $httpR = $this->httpRequest->getUrl(); $this->nazov_stranky = $httpR->host . $httpR->scriptPath; // Nazov stranky v tvare www.nieco.sk $this->nazov_stranky = substr($this->nazov_stranky, 0, strlen($this->nazov_stranky) - 1); // Priradenie hlavnych parametrov a udajov $this->max_id_reg = $this->registracia->findAll()->max('id'); //Najdi max. ur. reg. //Najdi info o druhu $tmp_druh = $this->druh->findBy(["druh.presenter" => ucfirst($this->udaje_webu['meno_presentera'])])->where("druh.modul IS NULL OR druh.modul = ?", $modul_presenter[0])->limit(1)->fetch(); if ($tmp_druh !== FALSE) { if ($tmp_druh->je_spec_naz) { //Ak je spec_nazov pozadovany a mam id $hl_udaje = $this->hlavne_menu->hladaj_id(isset($this->params['id']) ? (int) trim($this->params['id']) : 0, $this->id_reg); } else { //Ak nie je spec_nazov pozadovany $hl_udaje = $this->hlavne_menu->findOneBy(["id_druh" => $tmp_druh->id]); } } else { $hl_udaje = FALSE; } if ($hl_udaje !== FALSE) { //Ak sa hl. udaje nasli //Nacitanie textov hl_udaje pre dany jazyk $lang_hl_udaje = $this->hlavne_menu_lang->findOneBy(['id_lang' => $this->language_id, 'id_hlavne_menu' => $hl_udaje->id]); if ($lang_hl_udaje !== FALSE) { //Nasiel som udaje a tak aktualizujem $this->udaje_webu["nazov"] = $lang_hl_udaje->nazov; $this->udaje_webu["h1part2"] = $lang_hl_udaje->h1part2; $this->udaje_webu["description"] = $lang_hl_udaje->description; } else { //Len preto aby tam nieco bolo $this->udaje_webu["nazov"] = "Error nazov"; $this->udaje_webu["h1part2"] = "Error h1part2"; $this->udaje_webu["description"] = "Error description"; } $this->udaje_webu['hl_udaje'] = $hl_udaje->toArray(); } else { //Len preto aby tam nieco bolo $this->udaje_webu["description"] = "Nenájdená stránka"; $this->udaje_webu['hl_udaje'] = FALSE; } //Vypocet max. velkosti suboru pre upload $ini_v = trim(ini_get("upload_max_filesize")); $s = ['g' => 1 << 30, 'm' => 1 << 20, 'k' => 1 << 10]; $this->upload_size = intval($ini_v) * ($s[strtolower(substr($ini_v, -1))] ?: 1); // -- Povodny: $this->texty_presentera->setLanguage($this->language); //Nastavenie textov podla jazyka }
protected function startup() { parent::startup(); $this->texty_presentera->setLanguage($this->language); //Nastavenie textov podla jazyka }