private function changePasswordCheckInput($pw) { try { inputcheck($pw, 'password'); } catch (WrongInputException $e) { $this->_interface->dieError('Es wurde ein falsches Passwort eingegeben'); } }
protected function pwInpCheck() { if ($this->_pwNew != $this->_pwNewRep) { $this->_interface->DieError('Das Passwort stimmt nicht mit der Wiederholung überein. Bitte versuche es noch einmal.'); } try { inputcheck($this->_pwNew, 'password', 'Passwort'); } catch (WrongInputException $e) { $this->_interface->DieError('Das Passwort enthält nicht korrekte Zeichen oder ist zu kurz.'); } }
protected function emailCheck() { try { if (!isset($_POST['emailNew'])) { throw new WrongInputException(); } $emailNew = $_POST['emailNew']; inputcheck($emailNew, 'email', 'EmailAdresse'); } catch (WrongInputException $e) { $this->_interface->dieError("Die Emailadresse '{$emailNew}' wurde falsch eingegeben!"); } }
public function execute($dataContainer) { if (isset($_GET['gump'])) { //Use other method of checking $this->gump(); } else { $this->variablesFetch(); try { inputcheck($this->_userInput, $this->_regex, $this->_elementName); } catch (WrongInputException $e) { die('wrongInput'); } catch (Exception $e) { die('somethingWentWrong' . $e->getMessage()); } die('correctInput'); } }
public function pwChange($pwNew, $pwNewRep, $uid) { require_once PATH_ACCESS . '/UserManager.php'; $userManager = new UserManager(); try { inputcheck($pwNew, 'password', 'Passwort'); } catch (WrongInputException $e) { $this->cardInfoInterface->DieError('Das Passwort enthält nicht korrekte Zeichen oder ist zu kurz.'); } if ($pwNew != $pwNewRep) { $this->cardInfoInterface->DieError('Das Passwort stimmt nicht mit der Wiederholung überein. Bitte versuche es noch einmal.'); } try { $userManager->changePassword($uid, $pwNew); } catch (Exception $e) { $this->cardInfoInterface->DieError('Konnte das Passwort nicht verändern; Ein interner Fehler ist aufgetreten'); } $this->cardInfoInterface->showMsg('Das Passwort wurde erfolgreich verändert'); }
private function changeSettingsCheckInput() { try { inputcheck($_POST['from'], 'email', 'Absender'); if ($_POST['fromName'] == '') { throw new WrongInputException('fromName void', 'Absender'); } if ($_POST['password'] == '') { throw new WrongInputException('password void', 'Passwort'); } if ($_POST['username'] == '') { throw new WrongInputException('username void', 'Benutzername'); } if ($_POST['host'] == '') { throw new WrongInputException('host void', 'Host'); } } catch (WrongInputException $e) { $this->_interface->dieError(sprintf('Im Feld %s wurden falsche Daten eingegeben.', $e->getFieldName())); } }
private function checkLoginInput() { if (empty($this->_username) || empty($this->_password)) { $this->dieShowLoginForm(_g('Please input both username and password!'), true); } try { inputcheck($this->_username, 'name', _g('Username')); inputcheck($this->_password, 'password', _g('Password')); } catch (WrongInputException $e) { $this->dieShowLoginForm(_g('The input of field %1$s contains invalid characters or ' . 'is too short!', $e->getFieldName()), true); } }
/** * NewGroup adds a new group based on some POST-Variables * It needs the POST-Variables groupname and max_credit. ID is done by MySQL's * auto-incrementing id. Additionally it will add Priceclasses for the group. * * @todo Update the description * @see GroupManager */ function NewGroup() { require_once PATH_ACCESS . '/PriceClassManager.php'; $pcManager = new PriceClassManager(); /** * Add a new group to the MySQL-table */ if (isset($_POST['groupname'], $_POST['max_credit'])) { /** * add Group */ $groupname = $_POST['groupname']; $max_credit = $_POST['max_credit']; //error-checking if (!isset($groupname) || $groupname == '') { $this->groupInterface->dieError($this->msg['err_inp_groupname']); } if ($this->groupManager->existsGroupName($groupname)) { $this->groupInterface->dieError($this->msg['err_group_exists']); } if (!isset($max_credit) || $max_credit == '' || !preg_match('/\\A^[0-9]{0,2}((,|\\.)[0-9]{2})?\\z/', $max_credit)) { $this->groupInterface->dieError($this->msg['err_inp_max_credit'] . ' ' . $max_credit); } $max_credit = str_replace(',', '.', $max_credit); /** * add Priceclasses belonging to the group */ if (isset($_POST['n_price'])) { /** Fetches the Priceclasses from the Server. For every Priceclass-ID there is a POST-Variable from the * create_group-form with name and ID. */ try { $priceclasses = $pcManager->getAllPriceClassesPooled(); } catch (MySQLVoidDataException $e) { $this->groupInterface->dieMsg(sprintf($this->msg['fin_add_group_wo_pc'], $groupname, $max_credit)); } catch (Exception $e) { $this->groupInterface->dieError($this->msg['err_fetch_pc']); } //pc_to_add_arr: If a problem happens during the adding-loop, we need to be safe that no entries are added yet $pc_to_add_arr = array(); $standard_price = $_POST['n_price']; //check standardprice-input try { inputcheck($standard_price, 'credits', 'StandardPreis'); } catch (Exception $e) { $this->groupInterface->dieError($this->msg['err_inp_price'] . ' in:' . $e->getFieldName()); } //add the priceclasses foreach ($priceclasses as $priceclass) { try { $pc_id = $priceclass['pc_ID']; $pc_name = $_POST['pc_name' . $pc_id]; $pc_price = $_POST['pc_price' . $pc_id]; //groupID will be added after the data-checking, so the next ID of MySQL's Autoincrement is the groupID $group_id = $this->groupManager->getNextAutoIncrementID(); if (!isset($pc_price) || !$pc_price || $pc_price == '') { $pc_price = $standard_price; } try { //check for correct input of price inputcheck($pc_price, 'credits', $pc_name); } catch (WrongInputException $e) { $this->groupInterface->dieError($this->msg['err_inp_price'] . ' in:' . $e->getFieldName()); } $pc_to_add_arr[] = array('name' => $pc_name, 'gid' => $group_id, 'pc_price' => $pc_price, 'pid' => $pc_id); } catch (Exception $e) { $this->groupInterface->dieError('A Priceclass with the ID ' . $pc_id . ' could not be added: ' . $e->getMessage()); } } } /** * finish adding Group and Priceclass */ try { $this->groupManager->addGroup($groupname, $max_credit); } catch (Exception $e) { $this->groupInterface->dieError($this->msg['err_add_group']); } if (isset($_POST['n_price'])) { foreach ($pc_to_add_arr as $pc_to_add) { try { $pcManager->addPriceClass($pc_to_add['name'], $pc_to_add['gid'], $pc_to_add['pc_price'], $pc_to_add['pid']); } catch (Exception $e) { $this->groupInterface->dieError($this->msg['err_add_pc']); } } } $this->groupInterface->dieMsg(sprintf($this->msg['fin_add_group'], $groupname, $max_credit)); } else { try { $pc_arr = $pcManager->getAllPriceClassesPooled(); } catch (MySQLVoidDataException $e) { $pc_arr = false; } $this->groupInterface->NewGroup($pc_arr); } }
/** * Change Settings for Solis * Enter description here ... */ function ChangeSettings($soli_price) { require_once PATH_ACCESS . '/GlobalSettingsManager.php'; require_once PATH_ACCESS . '/PriceClassManager.php'; $gbManager = new GlobalSettingsManager(); $pcManager = new PriceClassManager(); die_error(SOLI_ERR_INP_PRICE); if ($soli_price !== NULL) { try { try { //inputcheck inputcheck($_POST['soli_price'], 'credits'); } catch (Exception $e) { die_error(SOLI_ERR_INP_PRICE); $this->soliInterface->dieError($this->msg['SOLI_ERR_INP_PRICE']); } $gbManager->changeSoliPrice($_POST['soli_price']); } catch (Exception $e) { die_error(SOLI_ERR_CHANGE_PRICE . ':' . $e->getMessage()); $this->soliInterface->dieError($this->msg['SOLI_ERR_CHANGE_PRICE '] . ':' . $e->getMessage()); } $this->soliInterface->dieMsg($this->msg['SOLI_FIN_CHANGE']); } else { try { $soli_price = $gbManager->getSoliPrice(); $priceclasses = $pcManager->getTableData(); } catch (Exception $e) { $this->soliInterface->dieError($this->msg['SOLI_ERR_PRICE']); } $this->soliInterface->ChangeSettings($soli_price, $priceclasses); } }
/** *Function to show the create-meal-form and, if it is filled out, *it adds the meal in the MySQL-Server */ function CreateMeal() { //---INCLUDE--- require_once PATH_ACCESS . '/PriceClassManager.php'; //---INIT--- $pcManager = new PriceClassManager(); //---ROUTINES--- //safety-checks if ('POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['name'], $_POST['description'], $_POST['price_class'], $_POST['max_orders'])) { $name = $_POST['name']; $description = $_POST['description']; $price_class = $_POST['price_class']; $max_orders = $_POST['max_orders']; if (!empty($_POST['meal-date'])) { $date = new DateTime($_POST['meal-date']); $dateStr = $date->format('Y-m-d'); } else { $this->mealInterface->dieError('Kein Datum angegeben.'); } //$date_ar = array("day" => $_POST['Date_Day'], "month" => $_POST['Date_Month'], "year" => $_POST[ // 'Date_Year'] //); try { inputcheck($price_class, 'id', $this->msg['field_pc']); inputcheck($max_orders, 'id', $this->msg['field_max_orders']); inputcheck($name, '/\\A^.{0,255}\\z/', $this->msg['field_name']); if (strlen($description) > 1000) { throw new WrongInputException($description, $this->msg['field_description']); } } catch (WrongInputException $e) { $this->mealInterface->dieError(sprintf($this->msg['err_inp'], $e->getFieldName())); } //convert the date for MySQL-Server //$date_conv = $date_ar["year"] . "-" . $date_ar["month"] . "-" . $date_ar["day"]; //check if weekday is saturday or sunday if ($date->format('N') > 5) { $this->mealInterface->dieError(gettext("Mealdate at weekend not valid!")); } //and add the meal try { $this->mealManager->addMeal($name, $description, $dateStr, $price_class, $max_orders); } catch (Exception $e) { $this->mealInterface->dieError($this->msg['err_add_meal'] . $e->getMessage()); } $this->mealInterface->backlink('administrator|Babesk|Meals&action=1'); $this->mealInterface->dieMsg($this->msg['fin_add_meal']); } else { //if Formular isnt filled yet or the link was wrong try { $pc_arr = $pcManager->getAllPriceClassesPooled(); } catch (Exception $e) { $this->mealInterface->dieError($this->msg['err_no_pc'] . $e->getMessage()); } $pc_ids = array(); $pc_names = array(); foreach ($pc_arr as $pc) { $pc_ids[] = $pc['pc_ID']; $pc_names[] = $pc['name']; } $this->mealInterface->AddMeal($pc_ids, $pc_names); } }
protected function changeCardCheckInput($oldCardnumber, $newCardnumber) { try { inputcheck($newCardnumber, 'card_id', 'Kartennummer'); } catch (WrongInputException $e) { $this->_interface->dieError("Die Kartennummer '{$oldCardnumber}' wurde nicht korrekt " . 'eingegeben.'); } if ($oldCardnumber == $newCardnumber) { $this->_interface->dieMsg("Die neue Kartennummer '{$newCardnumber}' ist gleich der " . 'alten. Es wurde nichts verändert.'); } $newCardExists = $this->_em->getRepository('DM:BabeskCards')->findByCardnumber($newCardnumber); if ($newCardExists) { $this->_interface->dieError("Die Kartennummer '{$newCardnumber}' ist bereits vergeben."); } }
private function emailChangeOnFirstLoginCheckInput($email) { try { inputcheck($email, 'email', 'Email'); } catch (WrongInputException $e) { $this->_interface->DieError('Die Email-Adresse wurde falsch eingegeben; Bitte gebe eine gültige EmailAdresse ein. <br>(Hinweis: Die Emailadresse wird dafür benötigt, um dich zu erreichen, wenn etwas schief läuft; Es ist wichtig das du darüber erreichbar bist)'); } }
protected function checkInput() { try { inputcheck($_POST['label'], 'name', _g('Name of Schoolyear')); } catch (WrongInputException $e) { $this->_interface->dieError(sprintf($this->_languageManager->getText('errorInput'), $e->getFieldName())); } }