Example #1
0
 /**
  * Checks, sanitizes and Escapes the Userinput
  *
  * Dies if User submitted incorrect data
  */
 protected function gradeInputPreprocess()
 {
     require_once PATH_INCLUDE . '/gump.php';
     $gump = new GUMP();
     $rules = array('gradelabel' => array('required|min_len,1|max_len,255', 'sql_escape', _g('Gradelabel')), 'gradelevel' => array('required|numeric|min_len,1|max_len,3', 'sql_escape', _g('Gradelevel')), 'schooltype' => array('numeric|min_len,1|max_len,11', 'sql_escape', _g('Schooltype')));
     $gump->rules($rules);
     if (!$gump->run($_POST)) {
         $this->_interface->dieError($gump->get_readable_string_errors(true));
     }
 }
Example #2
0
 /**
  * Validates the input of the admin
  */
 protected function inputCheck()
 {
     require_once PATH_INCLUDE . '/gump.php';
     $gump = new \GUMP();
     try {
         $gump->rules($this->_changeRules);
         //Set none-filled-out formelements to be at least a void string,
         //for easier processing
         // $_POST = $gump->voidVarsToStringByRuleset(
         // 	$_POST, self::$registerRules);
         //validate the elements
         if (!$gump->run($_POST)) {
             die(json_encode(array('value' => 'error', 'message' => $gump->get_readable_string_errors(false))));
         }
     } catch (\Exception $e) {
         $this->_logger->log('error checking input', 'error', Null, json_encode(array('message' => $e->getMessage())));
         die(json_encode(array('value' => 'error', 'message' => array('Konnte die Eingaben nicht überprüfen!'))));
     }
     if (!empty($_POST['cardnumber'])) {
         $this->cardnumberDuplicatedCheck($_POST['cardnumber']);
     }
 }
Example #3
0
 /**
  * Checks the Inputdata of the registerform for correct Format and stuff
  */
 protected function registerCheck()
 {
     require_once PATH_INCLUDE . '/gump.php';
     $gump = new GUMP();
     $_POST['isSoli'] = isset($_POST['isSoli']) && $_POST['isSoli'] == 'true';
     try {
         $gump->rules(self::$registerRules);
         // $_POST = $gump->input_preprocess_by_ruleset($_POST,
         // self::$registerRules);
         //Set none-filled-out formelements to be at least a void string,
         //for easier processing
         $gump->voidVarsToStringByRuleset($_POST, self::$registerRules);
         //validate and MySQL-Escape the elements
         if ($gump->run($_POST)) {
         } else {
             die(json_encode(array('value' => 'inputError', 'message' => $gump->get_readable_string_errors(false))));
         }
     } catch (Exception $e) {
         die(json_encode(array('value' => 'inputError', 'message' => array('Konnte die Eingaben nicht überprüfen!'))));
     }
     if (!empty($_POST['cardnumber'])) {
         $this->cardnumberDuplicatedCheck($_POST['cardnumber']);
     }
 }
Example #4
0
 /**
  * Checks the Input of the AddClassteacher-Form and ChangeClassteacher-Form
  *
  * Dies displaying a Message on wrong Input
  */
 protected function classteacherInputCheck()
 {
     $gump = new GUMP();
     $gump->rules(array('forename' => array('min_len,2|max_len,64', '', _g('Forename')), 'name' => array('required|min_len,2|max_len,64', '', _g('Surname')), 'address' => array('min_len,2|max_len,255', '', _g('Address')), 'telephone' => array('min_len,2|max_len,64', '', _g('Telephone Number'))));
     if (!($_POST = $gump->run($_POST))) {
         $this->_interface->dieError($gump->get_readable_string_errors(true));
     }
     if (count($_POST['classes'])) {
         $this->classteacherAddInputInClassesCheck();
     }
 }
Example #5
0
 protected function gumpCheck()
 {
     $gump = new GUMP();
     try {
         $gump->rules($this->_gumpRules);
         foreach ($this->_contentArray as $con) {
             if (!$gump->run($con)) {
                 $this->errorAdd(array('type' => 'inputError', 'message' => $gump->get_readable_string_errors(true)));
             }
         }
     } catch (Exception $e) {
         $this->errorDie(_g('Could not check the Inputdata'));
     }
 }
Example #6
0
 /**
  * Checks the given ID before starting the Deletion-process of the Class
  *
  * Dies displaying a message when Input not correct
  */
 protected function classDeletionInputCheck()
 {
     $gump = new GUMP();
     $gump->rules(array('ID' => array('required|min_len,1|max_len,11|numeric', '', _g('Class-ID'))));
     if (!($_GET = $gump->run($_GET))) {
         $this->_interface->dieError($gump->get_readable_string_errors(true));
     }
 }