当前位置: 首页>>代码示例>>PHP>>正文


PHP GUMP::rules方法代码示例

本文整理汇总了PHP中GUMP::rules方法的典型用法代码示例。如果您正苦于以下问题:PHP GUMP::rules方法的具体用法?PHP GUMP::rules怎么用?PHP GUMP::rules使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GUMP的用法示例。


在下文中一共展示了GUMP::rules方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: gradeInputPreprocess

 /**
  * 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));
     }
 }
开发者ID:Auwibana,项目名称:babesk,代码行数:15,代码来源:Grade.php

示例2: gump

 protected function gump()
 {
     require_once PATH_INCLUDE . '/gump.php';
     try {
         $gump = new GUMP($_POST);
         $gump->rules(array('userInput' => array($_POST['regex'], '', $_POST['elementName'])));
         if (!$gump->run($_POST)) {
             die('wrongInput');
         } else {
             die('correctInput');
         }
     } catch (Exception $e) {
         die('somethingWentWrong' . $e->getMessage());
     }
 }
开发者ID:Auwibana,项目名称:babesk,代码行数:15,代码来源:InputdataCheck.php

示例3: inputCheck

 /**
  * 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']);
     }
 }
开发者ID:Auwibana,项目名称:babesk,代码行数:25,代码来源:Change.php

示例4: registerCheck

 /**
  * 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']);
     }
 }
开发者ID:Auwibana,项目名称:babesk,代码行数:27,代码来源:User.php

示例5: classteacherInputCheck

 /**
  * 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();
     }
 }
开发者ID:Auwibana,项目名称:babesk,代码行数:16,代码来源:Classteachers.php

示例6: gumpCheck

 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'));
     }
 }
开发者ID:Auwibana,项目名称:babesk,代码行数:14,代码来源:CsvImport.php

示例7: classDeletionInputCheck

 /**
  * 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));
     }
 }
开发者ID:Auwibana,项目名称:babesk,代码行数:13,代码来源:Classes.php


注:本文中的GUMP::rules方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。