コード例 #1
0
ファイル: Home.php プロジェクト: anchetaWern/naughtyfire
 public function createHolidayAction()
 {
     $title = $this->app->request->post('title');
     $date = $this->app->request->post('date');
     $days = $this->app->request->post('days');
     $is_enabled = !empty($this->app->request->post('is_enabled')) ? true : false;
     $is_recurring = !empty($this->app->request->post('is_recurring')) ? true : false;
     $date = c::parse($date)->toDateString();
     $rules = array('title' => v::string()->notEmpty()->setName('title'), 'date' => v::date()->notEmpty()->setName('date'), 'days' => v::int()->notEmpty()->setName('days'), 'is_enabled' => v::bool()->setName('is_enabled'), 'is_recurring' => v::bool()->setName('is_recurring'));
     $data = $this->app->request->post();
     $data['date'] = $date;
     $data['is_enabled'] = $is_enabled;
     $data['is_recurring'] = $is_recurring;
     $message = array('type' => 'success', 'text' => 'Successfully added event');
     foreach ($data as $key => $value) {
         try {
             $rules[$key]->check($value);
         } catch (\InvalidArgumentException $e) {
             $message = array('type' => 'error', 'text' => $e->getMainMessage());
             break;
         }
     }
     $event = R::dispense('events');
     $event->title = $title;
     $event->date = $date;
     $event->days = $days;
     $event->is_enabled = $is_enabled;
     $event->is_recurring = $is_recurring;
     R::store($event);
     $this->app->flash('message', $message);
     $this->app->redirect('/');
 }
コード例 #2
0
ファイル: Usuario.php プロジェクト: jokeronaldo/crud-slim3
 public function validatePatchVars($vars)
 {
     $validations = [v::intVal()->validate($vars['id']), v::stringType()->length(2)->validate($vars['nome']), v::stringType()->length(2)->validate($vars['sobrenome'])];
     if ($vars['nascimento']) {
         $validations[] = v::date()->validate($vars['nascimento']);
     }
     return $validations;
 }
コード例 #3
0
ファイル: Date.php プロジェクト: dindigital/din
 public function validate($prop, $label)
 {
     $value = $this->getValue($prop);
     if ($value == '' && !$this->_required) {
         return;
     }
     if (!v::date($this->_format)->validate($value)) {
         $this->addException("Campo {$label} com uma data inválida");
     }
 }
コード例 #4
0
 public function defineAtualizadoEm($atualizadoEm)
 {
     $atualizadoEmValidador = Validator::date('Y-m-d H:i:s');
     try {
         $atualizadoEmValidador->check($atualizadoEm);
         $this->atualizadoEm = $atualizadoEm;
     } catch (ValidationException $exception) {
         print_r($exception->getMainMessage());
     }
 }
コード例 #5
0
 public function defineDataHoraFim($dataHoraFim)
 {
     $dataHoraFimValidador = Validator::date('Y-m-d H:i:s');
     try {
         $dataHoraFimValidador->check($dataHoraFim);
         $this->dataHoraFim = $dataHoraFim;
     } catch (ValidationException $exception) {
         print_r($exception->getMainMessage());
     }
 }
コード例 #6
0
ファイル: Date.php プロジェクト: Rmtram/TextDatabase
 /**
  * @param string|\DateTime $value
  * @return bool
  */
 protected function prohibit($value)
 {
     if ($value instanceof \DateTime) {
         $value = $value->format(self::FORMAT);
     } else {
         if (!is_string($value) || !Validator::date($this->format)->validate($value)) {
             return true;
         }
     }
     return parent::prohibit($value);
 }
コード例 #7
0
ファイル: ValidatorTest.php プロジェクト: powerpbx/framework
   public function testKeysAsValidatorNames()
   {
       try {
           Validator::key('username', Validator::length(1, 32))->key('birthdate', Validator::date())->setName("User Subscription Form")->assert(array('username' => '', 'birthdate' => ''));
       } catch (NestedValidationExceptionInterface $e) {
           $this->assertEquals('\\-These rules must pass for User Subscription Form
 |-Key username must be valid
 | \\-"" must have a length between 1 and 32
 \\-Key birthdate must be valid
   \\-"" must be a valid date', $e->getFullMessage());
       }
   }
コード例 #8
0
 /**
  *  init valid rule
  */
 protected function initRule()
 {
     $this->validRule['uid'] = v::numeric();
     $this->validRule['eduid'] = v::numeric();
     $this->validRule['schoolName'] = v::stringType()->length(1, 32);
     $this->validRule['majorName'] = v::stringType()->length(1, 32);
     $this->validRule['majorCat'] = v::stringType()->length(1, 32);
     $this->validRule['area'] = v::stringType()->length(1, 32);
     $this->validRule['schoolCountry'] = v::stringType()->length(1, 32);
     $this->validRule['startDate'] = v::date('Y-m');
     $this->validRule['endDate'] = v::date('Y-m');
     $this->validRule['degreeStatus'] = v::intVal()->between(1, 3);
 }
コード例 #9
0
 /**
  * Handle domain logic for an action.
  *
  * @param array $input
  * @return PayloadInterface
  */
 public function __invoke(array $input)
 {
     //Ensure that the use has permission to create shifts
     $user = $input[AuthHandler::TOKEN_ATTRIBUTE]->getMetadata('entity');
     $this->authorizeUser($user, 'create', 'shifts');
     //If no manager_id is specified in request, default to user creating shift
     if (!array_key_exists('manager_id', $input)) {
         $input['manager_id'] = $user->getId();
     }
     //Validate input
     $inputValidator = v::key('break', v::floatVal())->key('start_time', v::date())->key('end_time', v::date()->min($input['start_time']))->key('manager_id', v::intVal());
     $inputValidator->assert($input);
     //Execute command to create shift
     $shift = $this->commandBus->handle(new CreateShift($input['manager_id'], $input['employee_id'], $input['break'], $input['start_time'], $input['end_time']));
     $this->item->setData($shift)->setTransformer($this->shiftTransformer);
     return $this->payload->withStatus(PayloadInterface::OK)->withOutput($this->fractal->parseIncludes(['manager', 'employee'])->createData($this->item)->toArray());
 }
コード例 #10
0
ファイル: DateToSql.php プロジェクト: dindigital/din
 public static function filter_datetime($datetime)
 {
     $arrayDate = explode(' ', $datetime);
     if (count($arrayDate) != 2) {
         throw new Exception('Data/Horário no formato inválido para conversão');
     }
     $date_sql = self::filter_date($arrayDate[0]);
     if (!v::date('H:i:s')->validate($arrayDate[1]) && !v::date('H:i')->validate($arrayDate[1])) {
         throw new Exception('Horário no formato inválido para conversão');
     }
     $time_sql = date('H:i:s', strtotime($arrayDate[1]));
     $datetime_sql = $date_sql . ' ' . $time_sql;
     if (!v::date()->validate($datetime_sql)) {
         throw new Exception('Erro na conversão');
     }
     return $datetime_sql;
 }
コード例 #11
0
ファイル: Payment.php プロジェクト: mynameiszanders/cashflows
 /**
  * Get Fields Definitions
  *
  * @access public
  * @return array
  */
 protected function getFieldDefinitions()
 {
     return ['auth_id' => ['Authorisation ID', V::notEmpty()->numeric()], 'auth_pass' => ['Authorisation Password', V::notEmpty()->string()], 'card_num' => ['Card Number', V::notEmpty()->string()->length(16, 16)->digit()->noWhitespace()->creditCard()], 'card_cvv' => ['Card CVV', V::notEmpty()->string()->length(3, 3)->digit()->noWhitespace()], 'card_start' => ['Card Start Date', V::date('my')], 'card_issue' => ['Card Issue Number', V::string()->length(null, 2)->digit()->noWhitespace(), ''], 'card_expiry' => ['Card Expiry Date', V::notEmpty()->date('my')], 'cust_name' => ['Customer Name', V::notEmpty()->string()], 'cust_address' => ['Customer Address', V::notEmpty()->string()], 'cust_postcode' => ['Customer Postcode', V::notEmpty()->string()], 'cust_country' => ['Customer Country', V::notEmpty()->string()->countryCode()], 'cust_ip' => ['Customer IP Address', V::notEmpty()->string()->ip(), $_SERVER['REMOTE_ADDR']], 'cust_email' => ['Customer Email Address', V::notEmpty()->string()->email()], 'cust_tel' => ['Customer Telephone Number', V::notEmpty()->string()->phone()], 'tran_ref' => ['Transaction Reference', V::notEmpty()->string()], 'tran_desc' => ['Transaction Description', V::notEmpty()->string()], 'tran_amount' => ['Transaction Amount', V::notEmpty()->float()], 'tran_currency' => ['Transaction Currency', V::notEmpty()->string()->length(3, 3)->alpha()->noWhitespace()], 'tran_testmode' => ['Test Mode', V::notEmpty()->bool(), false], 'acs_eci' => ['Access Control Server (ECI)', V::int()], 'acs_cavv' => ['Cardholder Authentication Verification Value', V::string()->length(28, 28), ''], 'acs_xid' => ['Access Control Server (Unique Authentication ID)', V::string()->length(28, 28), '']];
 }
コード例 #12
0
/**
 * Validates input type
 *
 * @param string           $hook       "validate:type"
 * @param string           $type       "prototyper"
 * @param ValidationStatus $validation Current validation status
 * @param array            $params     Hook params
 * @return ValidationStatus
 */
function prototyper_validate_type($hook, $type, $validation, $params)
{
    if (!$validation instanceof ValidationStatus) {
        $validation = new ValidationStatus();
    }
    $field = elgg_extract('field', $params);
    if (!$field instanceof Field) {
        return $validation;
    }
    $rule = elgg_extract('rule', $params);
    if ($rule != "type") {
        return $validation;
    }
    $value = elgg_extract('value', $params);
    $expectation = elgg_extract('expectation', $params);
    switch ($expectation) {
        case 'text':
        case 'string':
            if (!v::string()->validate($value)) {
                $validation->setFail(elgg_echo('prototyper:validate:error:type:string', array($field->getLabel())));
            }
            break;
        case 'alnum':
        case 'alphanum':
            if (!v::alnum()->validate($value)) {
                $validation->setFail(elgg_echo('prototyper:validate:error:type:alnum', array($field->getLabel())));
            }
            break;
        case 'alpha':
            if (!v::alpha()->validate($value)) {
                $validation->setFail(elgg_echo('prototyper:validate:error:type:alpha', array($field->getLabel())));
            }
            break;
        case 'number':
        case 'numeric':
            if (!v::numeric()->validate($value)) {
                $validation->setFail(elgg_echo('prototyper:validate:error:type:numeric', array($field->getLabel())));
            }
            break;
        case 'integer':
        case 'int':
            if (!v::int()->validate($value)) {
                $validation->setFail(elgg_echo('prototyper:validate:error:type:int', array($field->getLabel())));
            }
            break;
        case 'date':
            if (!v::date()->validate($value)) {
                $validation->setFail(elgg_echo('prototyper:validate:error:type:date', array($field->getLabel())));
            }
            break;
        case 'url':
            if (!v::filterVar(FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)->validate($value)) {
                $validation->setFail(elgg_echo('prototyper:validate:error:type:url', array($field->getLabel())));
            }
            break;
        case 'email':
            if (!v::filterVar(FILTER_VALIDATE_EMAIL)->validate($value)) {
                $validation->setFail(elgg_echo('prototyper:validate:error:type:email', array($field->getLabel())));
            }
            break;
        case 'guid':
        case 'entity':
            if (!elgg_entity_exists($value)) {
                $validation->setFail(elgg_echo('prototyper:validate:error:type:guid', array($field->getLabel())));
            }
            break;
        case 'image':
            $type = elgg_extract('type', $value);
            if (!$type || substr_count($type, 'image/') == 0) {
                $validation->setFail(elgg_echo('prototyper:validate:error:type:image', array($field->getLabel())));
            }
            break;
    }
    return $validation;
}
コード例 #13
0
ファイル: Contact.php プロジェクト: sugaryog/movim
 public function setVcard4($vcard)
 {
     $validate_date = Validator::date('Y-m-d');
     if (isset($vcard->bday->date) && $validate_date->validate($vcard->bday->date)) {
         $this->__set('date', (string) $vcard->bday->date);
     }
     $this->__set('name', (string) $vcard->nickname->text);
     $this->__set('fn', (string) $vcard->fn->text);
     $this->__set('url', (string) $vcard->url->uri);
     if (isset($vcard->gender)) {
         $this->__set('gender ', (string) $vcard->gender->sex->text);
     }
     if (isset($vcard->marital)) {
         $this->__set('marital', (string) $vcard->marital->status->text);
     }
     $this->__set('adrlocality', (string) $vcard->adr->locality);
     $this->__set('adrcountry', (string) $vcard->adr->country);
     $this->__set('adrpostalcode', (string) $vcard->adr->code);
     if (isset($vcard->impp)) {
         foreach ($vcard->impp->children() as $c) {
             list($key, $value) = explode(':', (string) $c);
             switch ($key) {
                 case 'twitter':
                     $this->__set('twitter', str_replace('@', '', $value));
                     break;
                 case 'skype':
                     $this->__set('skype', (string) $value);
                     break;
                 case 'ymsgr':
                     $this->__set('yahoo', (string) $value);
                     break;
             }
         }
     }
     $this->__set('email', (string) $vcard->email->text);
     $this->__set('description', trim((string) $vcard->note->text));
 }
コード例 #14
0
ファイル: index.php プロジェクト: purpleonlinemedia/khiars
    function grossSubscriberFee($contractNo, $checkStartDate, $checkDate)
    {
        //Get user details
        #Validate
        if (!v::numeric()->validate($contractNo)) {
            $xmlstr = <<<_XML_
<?xml version='1.0' standalone='yes'?>
 <returnCall>
  <status>Fail</status>                      
  <msg>Invalid contract number</msg>                      
 </returnCall>

_XML_;
            return $xmlstr;
        }
        if (!v::date()->validate($checkStartDate)) {
            $xmlstr = <<<_XML_
<?xml version='1.0' standalone='yes'?>
 <returnCall>
  <status>Fail</status>                      
  <msg>Invalid date format</msg>                      
 </returnCall>

_XML_;
            return $xmlstr;
        }
        if (!v::date()->validate($checkDate)) {
            $xmlstr = <<<_XML_
<?xml version='1.0' standalone='yes'?>
 <returnCall>
  <status>Fail</status>                      
  <msg>Invalid date format</msg>                      
 </returnCall>

_XML_;
            return $xmlstr;
        }
        #Get contract details
        $resultSet = mysqli_query($this->conn, "SELECT * FROM accountrecords WHERE contractNo = '" . mysqli_real_escape_string($this->conn, $contractNo) . "';", MYSQLI_STORE_RESULT);
        if (mysqli_errno($this->conn) != 0) {
            #Failed to run query
            $xmlstr = <<<_XML_
<?xml version='1.0' standalone='yes'?>
 <returnCall>
  <status>Fail</status>                      
  <msg>Failed to execute query</msg>          
  <errorMsg>{$this->conn}->error<errorMsgmsg>             
 </returnCall>

_XML_;
            return $xmlstr;
        }
        //$row_cnt = mysqli_num_rows($resultSet);
        //file_put_contents('log.log', print_r($resultSet));
        $row_cnt = mysqli_num_rows($resultSet);
        if ($row_cnt === 0) {
            $xmlstr = <<<_XML_
<?xml version='1.0' standalone='yes'?>
 <returnCall>
  <status>Fail</status>                      
  <msg>Contract does not exist</msg>                        
 </returnCall>

_XML_;
            return $xmlstr;
        }
        $returnContractRow = mysqli_fetch_assoc($resultSet);
        //Check that the date passed is greater or equal to the subscriptionStartDate
        $date1 = new DateTime($checkDate);
        $date2 = $returnContractRow['subscriptionStartDate'];
        if ($date1 >= $date2) {
            //Pass, now check if all admin fees paid
            $resultPaymentSet = mysqli_query($this->conn, "SELECT sum(amount) as total FROM payments WHERE paymentDate < '" . substr($returnContractRow['subscriptionStartDate'], 0, 7) . "';", MYSQLI_STORE_RESULT);
            if (mysqli_errno($this->conn) != 0) {
                #Failed to run query
                $xmlstr = <<<_XML_
<?xml version='1.0' standalone='yes'?>
 <returnCall>
  <status>Fail</status>                      
  <msg>Failed to execute query summing of payments</msg>          
  <errorMsg>{$this->conn}->error<errorMsgmsg>             
 </returnCall>

_XML_;
                return $xmlstr;
            }
            $returnPaymentRow = mysqli_fetch_assoc($resultPaymentSet);
            if ($returnPaymentRow['total'] >= $returnContractRow['adminFeePayable']) {
                //Admin fee has been fully paid
                //Check that subscription amount was paid for this month
                $subscriptionFee = $returnContractRow['subscriptionBalance'] / $returnContractRow['noInstalmentsBalance'];
                $resultPaymentSubscriptionMonth = mysqli_query($this->conn, "SELECT sum(amount) as total FROM payments WHERE contractNo = '" . mysqli_real_escape_string($this->conn, $contractNo) . "' AND paymentDate >= '" . $checkStartDate . "' AND paymentDate <= '" . $checkDate . "';", MYSQLI_STORE_RESULT);
                //$resultPaymentSubscriptionMonth = mysqli_query($this->conn, "SELECT sum(amount) as total FROM payments WHERE paymentDate <= '".substr($returnContractRow['subscriptionStartDate'],0,7)."' AND paymentDate <= '".mysqli_real_escape_string($this->conn,$checkStartDate)."';",MYSQLI_STORE_RESULT);
                $returnPaymentSubscriptionMonthRow = mysqli_fetch_assoc($resultPaymentSubscriptionMonth);
                $totalPaidThisMonth = $returnPaymentSubscriptionMonthRow['total'];
                if ($returnPaymentSubscriptionMonthRow['total'] >= $subscriptionFee) {
                    //This contract has paid a figure greate or equal to their monthly subscription
                    $xmlstr = <<<_XML_
<?xml version='1.0' standalone='yes'?>
 <returnCall>
  <status>Success</status>                      
  <grossSubFee>{$subscriptionFee}</grossSubFee>                        
  <totalPaidThisMonth>{$totalPaidThisMonth}</totalPaidThisMonth>                        
  <reason>Subscription fee paid</reason>                        
 </returnCall>

_XML_;
                    return $xmlstr;
                } else {
                    //This contract has paid a figure less than their monthly subscription fee
                    $xmlstr = <<<_XML_
<?xml version='1.0' standalone='yes'?>
 <returnCall>
  <status>Success</status>                      
  <grossSubFee>0</grossSubFee>                        
  <totalPaidThisMonth>{$totalPaidThisMonth}</totalPaidThisMonth>                        
  <reason>Subscription fee NOT fully paid</reason>                        
 </returnCall>

_XML_;
                    return $xmlstr;
                }
            } else {
                //Fail
                $xmlstr = <<<_XML_
<?xml version='1.0' standalone='yes'?>
 <returnCall>
  <status>Success</status>                      
  <grossSubFee>0</grossSubFee>                        
  <reason>Admin fee not fully paid</reason>                        
 </returnCall>

_XML_;
                return $xmlstr;
            }
        } else {
            //Fail
            $xmlstr = <<<_XML_
<?xml version='1.0' standalone='yes'?>
 <returnCall>
  <status>Success</status>                      
  <grossSubFee>0</grossSubFee>                        
  <reason>Date parsed less than subscriptionStartDate</reason>                        
 </returnCall>

_XML_;
            return $xmlstr;
        }
    }
コード例 #15
0
ファイル: order.php プロジェクト: beyondkeysystem/sushi-web
 if (!isset($params['name']) || !Validation::string()->length(null, 50)->validate($params['name'])) {
     array_push($invalids, 'name');
 }
 if (!isset($params['phone']) || !Validation::string()->length(null, 15)->validate($params['phone'])) {
     array_push($invalids, 'phone');
 }
 if (!isset($params['address']) || !Validation::string()->length(null, 50)->validate($params['address'])) {
     array_push($invalids, 'address');
 }
 if (!isset($params['deliver']) || !Validation::int()->min(0, true)->max(1, true)->validate($params['deliver'])) {
     array_push($invalids, 'deliver');
 }
 if (!isset($params['timeFrom']) || !Validation::date('H:i')->validate($params['timeFrom'])) {
     array_push($invalids, 'timeFrom');
 }
 if (!isset($params['timeTo']) || !Validation::date('H:i')->validate($params['timeTo'])) {
     array_push($invalids, 'timeTo');
 }
 if (!isset($params['paid']) || !Validation::int()->min(0, true)->max(1, true)->validate($params['paid'])) {
     array_push($invalids, 'paid');
 }
 if (!isset($params['items']) || !Validation::arr()->length(1, null)->validate($params['items'])) {
     array_push($invalids, 'items');
 }
 foreach ($params['items'] as $index => $product) {
     if (!isset($product['productId']) || !Validation::int()->min(0, true)->validate($product['productId'])) {
         array_push($invalids, 'productId-' . $index);
     }
     if (!isset($product['plu']) || !Validation::int()->max(999999)->validate($product['plu'])) {
         array_push($invalids, 'plu-' . $index);
     }
コード例 #16
0
ファイル: formclass.php プロジェクト: tohir/formgenerator
 public static function date($details, $value)
 {
     if (empty($value) || !$details) {
         return TRUE;
     }
     return RespectValidator::date()->validate($value);
 }
コード例 #17
0
 if (v::not(v::alnum("-.,()'"))->validate($form_data['emp_lname'])) {
     $err_msg .= "The last name of the employee must be alphanumeric.\\n";
 }
 //if(v::not(v::alnum("-.,()'"))->validate($form_data['account_number'])) { $err_msg .= "The account number must be alphanumeric.\\n"; }
 // Phone
 if (v::not(v::phone())->validate($form_data['requester_phone'])) {
     $err_msg .= "Your phone number is not valid: " . $form_data['requester_phone'] . "\\n";
 }
 if (v::not(v::phone())->validate($form_data['dept_phone'])) {
     $err_msg .= "The department phone number is not valid: " . $form_data['dept_phone'] . "\\n";
 }
 // Date or Time - should not be in future
 if (v::not(v::date('Y-m-d')->max('today'))->validate($mysql_start_date)) {
     $err_msg .= "The start date is invalid: " . $start_date . "\\n";
 }
 if (v::not(v::date('Y-m-d')->max('today'))->validate($mysql_end_date)) {
     $err_msg .= "The end date is invalid: " . $end_date . "\\n";
 }
 // ========================================================================================
 // DATA PASSED VALIDATION - INSERT INTO DB AND SEND EMAILS
 // ========================================================================================
 if ($err_msg == '') {
     // ========================================================================================
     // GET BUSINESS MANAGER
     // ========================================================================================
     $facil_conn = new DBConnection('facil');
     $conn1 = $facil_conn->openConnection();
     $stmt1 = $conn1->prepare("SELECT hr_business_mgr.mgr_fname, hr_business_mgr.mgr_lname, hr_business_mgr.mgr_email FROM hr_business_mgr, a_workplaces WHERE a_workplaces.workplace = :dept AND a_workplaces.business_mgr = hr_business_mgr.mgrID");
     $stmt1->bindParam(":dept", $department, PDO::PARAM_STR);
     $stmt1->execute();
     if ($stmt1->error) {
コード例 #18
0
 private function updateTrip($data)
 {
     // Create validators
     $stringValidator = v::create();
     $stringValidator->stringType();
     $idValidator = v::numeric();
     $dateValidator = v::date('Y-m-d');
     $tripValidator = v::create();
     $tripValidator->key('user_id', $idValidator);
     $tripValidator->key('destination', $stringValidator);
     $tripValidator->key('start_date', $dateValidator);
     $tripValidator->key('end_date', $dateValidator);
     $tripValidator->key('comment', $stringValidator);
     // run validation
     try {
         $tripValidator->assert($data);
     } catch (NestedValidationException $exception) {
         $this->writeFail($exception->getFullMessage());
         return;
     }
     //then check the current user is either admin or editing his own
     if ($this->isUserAuthenticated() && ($this->currentUser->isAdmin() || $this->currentUser->id === $data["user_id"])) {
         TripModel::updateTrip($data);
     } else {
         $this->writeUnauthorized();
     }
 }
コード例 #19
0
 /**
  * Get Fields Definitions
  *
  * @access public
  * @return array
  */
 protected function getFieldDefinitions()
 {
     return ['auth_id' => ['Authorisation ID', V::notEmpty()->numeric()], 'auth_pass' => ['Authorisation Password', V::notEmpty()->string()], 'card_num' => ['Card Number', V::notEmpty()->string()->length(16, 16)->digit()->noWhitespace()->creditCard()], 'card_cvv' => ['Card CVV', V::notEmpty()->string()->length(3, 3)->digit()->noWhitespace()], 'card_start' => ['Card Start Date', V::date('my')], 'card_issue' => ['Card Issue Number', V::string()->length(null, 2)->digit()->noWhitespace(), ''], 'card_expiry' => ['Card Expiry Date', V::notEmpty()->date('my')], 'cust_name' => ['Customer Name', V::notEmpty()->string()], 'cust_address' => ['Customer Address', V::notEmpty()->string()], 'cust_postcode' => ['Customer Postcode', V::notEmpty()->string()], 'cust_country' => ['Customer Country', V::notEmpty()->string()->countryCode()], 'cust_ip' => ['Customer IP Address', V::notEmpty()->string()->ip(), $_SERVER['REMOTE_ADDR']], 'cust_email' => ['Customer Email Address', V::notEmpty()->string()->email()], 'cust_tel' => ['Customer Telephone Number', V::notEmpty()->string()->phone()], 'tran_ref' => ['Transaction Reference', V::notEmpty()->string()], 'tran_desc' => ['Transaction Description', V::notEmpty()->string()], 'tran_amount' => ['Transaction Amount', V::notEmpty()->float()->min(1.0)], 'tran_currency' => ['Transaction Currency', V::notEmpty()->string()->length(3, 3)->alpha()->noWhitespace()], 'tran_testmode' => ['Test Mode', V::notEmpty()->bool(), false], 'primary_recipient_dob' => ['Date of Birth (of Primary Recipient)', V::date('Ymd')], 'primary_recipient_surname' => ['Surname (of Primary Recipient)', V::string()->length(2, 64)->alpha('-'), ''], 'primary_recipient_postcode' => ['Postcode (of Primary Recipient)', V::string()->length(2, 16)->alnum(), ''], 'primary_recipient_account_number' => ['Account Number (of Primary Recipient)', V::string()->length(1, 32)->alnum('+-'), '']];
 }
コード例 #20
0
 /**
  * @param string $orderId
  * @param int $limit between 1 and 100
  * @param string $startDate acceptable format yyyy-MM-dd'T'HH:mm:ss'Z'
  * @param string $endDate acceptable format yyyy-MM-dd'T'HH:mm:ss'Z'
  * @return \Httpful\Response
  * @throws \Httpful\Exception\ConnectionErrorException
  */
 public function searchByOrderId($orderId, $limit = null, $startDate = null, $endDate = null)
 {
     $uri = '/transactions?order=' . $orderId;
     if (Validator::intVal()->max(100, true)->notEmpty()->validate($limit)) {
         $uri .= '&limit=' . $limit;
     }
     if (Validator::date("Y-m-d'T'HH:mm:ss'Z'")->notEmpty()->validate($startDate)) {
         $uri .= '&start-date=' . urlencode($startDate);
     }
     if (Validator::date("Y-m-d'T'HH:mm:ss'Z'")->notEmpty()->validate($endDate)) {
         $uri .= '&end-date=' . urlencode($limit);
     }
     return $this->makeRequest(self::$METHOD_GET, $uri);
 }
コード例 #21
0
ファイル: weblog.php プロジェクト: slion0725/admin_ci303
 private function postValidator($post = array())
 {
     try {
         v::date('Y-m-d H:i:s')->assert($post['start']);
         v::date('Y-m-d H:i:s')->assert($post['end']);
     } catch (vn $exception) {
         $this->MSG->showmsg(nl2br($exception->getFullMessage()));
     }
 }
コード例 #22
0
ファイル: Valid.php プロジェクト: tourze/base
 /**
  * 检测日期字符串是否正确
  *
  * @param  string $value
  * @return bool
  */
 public static function date($value)
 {
     return Validator::date()->validate($value);
 }
コード例 #23
0
ファイル: DateFormat.php プロジェクト: dindigital/din
 public static function validate($date)
 {
     return v::date()->validate($date);
 }