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


PHP validater类代码示例

本文整理汇总了PHP中validater的典型用法代码示例。如果您正苦于以下问题:PHP validater类的具体用法?PHP validater怎么用?PHP validater使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setContact

 /**
  * set contact information.
  *
  * @access public
  * @return void
  */
 public function setContact()
 {
     if (!empty($_POST)) {
         if (!empty($_POST['email'])) {
             if (!validater::checkEmail($this->post->email)) {
                 $this->send(array('result' => 'fail', 'message' => $this->lang->company->error->email));
             }
         }
         $contact = array('contact' => helper::jsonEncode($_POST));
         $result = $this->loadModel('setting')->setItems('system.common.company', $contact);
         if ($result) {
             $this->send(array('result' => 'success', 'message' => $this->lang->setSuccess));
         }
         $this->send(array('result' => 'fail', 'message' => $this->lang->fail));
     }
     $this->view->title = $this->lang->company->setContact;
     $this->view->contact = json_decode($this->config->company->contact);
     $this->display();
 }
开发者ID:dyp8848,项目名称:chanzhieps,代码行数:25,代码来源:control.php

示例2: update

 public function update($assetID)
 {
     $skipFields = '';
     $skipFields .= $this->loadModel('custom')->dealWithCustomArrayField();
     $oldAsset = $this->getAssetById($assetID);
     $now = helper::now();
     $address = fixer::input('post')->get('address');
     $extendaddress = fixer::input('post')->get('extendaddress');
     $devicenumber = fixer::input('post')->get('devicenumber');
     $code = fixer::input('post')->get('code');
     $module = $this->loadModel('info')->getAllChildId(fixer::input('post')->cleanInt('module')->setDefault('module', 0)->get('module'), 'asset');
     $result1 = $this->dao->select('*')->from(TABLE_INFOASSET)->where('address')->eq($extendaddress)->andWhere('address')->ne('IP Format Error')->andWhere('address')->ne('Conflict!')->andWhere('address')->ne('')->beginIF($module)->andWhere('module')->in($module)->fi()->fetchAll();
     $result2 = $this->dao->select('*')->from(TABLE_INFOASSET)->where('extendaddress')->eq($address)->andWhere('extendaddress')->ne('IP Format Error')->andWhere('extendaddress')->ne('Conflict!')->andWhere('extendaddress')->ne('')->beginIF($module)->andWhere('module')->in($module)->fi()->fetchAll();
     $asset = fixer::input('post')->cleanInt('module')->setDefault('module', 0)->add('lastEditedBy', $this->app->user->account)->add('lastEditedDate', $now)->setDefault('lenddate', '0000-00-00')->setDefault('returndate', '0000-00-00')->setDefault('product', '0')->setDefault('project', '0')->setIF(!(strlen(trim($extendaddress)) == 0) && !validater::checkIP($extendaddress), 'extendaddress', 'IP Format Error')->setIF(!(strlen(trim($address)) == 0) && !validater::checkIP($address), 'address', 'IP Format Error')->removeIF(trim($address) == trim($extendaddress), 'extendaddress')->setIF($result1, 'extendaddress', 'Conflict!')->setIF($result2, 'address', 'Conflict!')->get();
     $condition = "`lib` = '{$asset->lib}' AND module = '{$asset->module}' and id != '{$assetID}'";
     $conditionaddress = $condition . " and address != 'IP Format Error' and address != 'Conflict!'";
     $conditionextaddress = $condition . " and extendaddress != 'IP Format Error' and extendaddress != 'Conflict!'";
     $this->dao->update(TABLE_INFOASSET)->data($asset)->autoCheck($skipFields)->batchCheck($this->config->asset->edit->requiredFields, 'notempty')->check('hostname', 'unique', $condition)->checkIF(!(strlen(trim($address)) == 0), 'address', 'unique', $conditionaddress)->checkIF(!(strlen(trim($extendaddress)) == 0), 'extendaddress', 'unique', $conditionextaddress)->checkIF(!(strlen(trim($devicenumber)) == 0), 'devicenumber', 'unique', $condition)->checkIF(!(strlen(trim($code)) == 0), 'code', 'unique', $condition)->where('id')->eq((int) $assetID)->exec();
     $asset->editedCount = $asset->editedCount - 1;
     if (!dao::isError()) {
         return common::createChanges($oldAsset, $asset);
     }
 }
开发者ID:huokedu,项目名称:zentao,代码行数:23,代码来源:model.php

示例3: detect

 /**
  * Detect email config auto.
  * 
  * @access public
  * @return void
  */
 public function detect()
 {
     if ($_POST) {
         if ($this->post->fromAddress == false) {
             $error = sprintf($this->lang->error->notempty, $this->lang->mail->fromAddress);
             $message = array('fromAddress' => $error);
             $this->send(array('result' => 'fail', 'message' => $message));
         }
         if (!validater::checkEmail($this->post->fromAddress)) {
             $error = sprintf($this->lang->error->email, $this->lang->mail->fromAddress);
             $message = array('fromAddress' => $error);
             $this->send(array('result' => 'fail', 'message' => $message));
         }
         $mailConfig = $this->mail->autoDetect($this->post->fromAddress);
         $mailConfig->fromAddress = $this->post->fromAddress;
         $this->session->set('mailConfig', $mailConfig);
         $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('edit')));
     }
     $this->view->title = $this->lang->mail->common . $this->lang->colon . $this->lang->mail->detect;
     $this->view->position[] = html::a(inlink('index'), $this->lang->mail->common);
     $this->view->position[] = $this->lang->mail->detect;
     $this->view->fromAddress = $this->session->mailConfig ? $this->session->mailConfig->fromAddress : '';
     $this->display();
 }
开发者ID:leowh,项目名称:colla,代码行数:30,代码来源:control.php

示例4: detect

 /**
  * Detect email config auto.
  * 
  * @access public
  * @return void
  */
 public function detect()
 {
     if ($_POST) {
         $error = '';
         if ($this->post->fromAddress == false) {
             $error = sprintf($this->lang->error->notempty, $this->lang->mail->fromAddress);
         }
         if (!validater::checkEmail($this->post->fromAddress)) {
             $error .= '\\n' . sprintf($this->lang->error->email, $this->lang->mail->fromAddress);
         }
         if ($error) {
             die(js::alert($error));
         }
         $mailConfig = $this->mail->autoDetect($this->post->fromAddress);
         $mailConfig->fromAddress = $this->post->fromAddress;
         $this->session->set('mailConfig', $mailConfig);
         die(js::locate(inlink('edit'), 'parent'));
     }
     $this->view->title = $this->lang->mail->common . $this->lang->colon . $this->lang->mail->detect;
     $this->view->position[] = html::a(inlink('index'), $this->lang->mail->common);
     $this->view->position[] = $this->lang->mail->detect;
     $this->view->fromAddress = $this->session->mailConfig ? $this->session->mailConfig->fromAddress : '';
     $this->display();
 }
开发者ID:fanscky,项目名称:HTPMS,代码行数:30,代码来源:control.php

示例5: sourceEdit

 /**
  * Edit for the source file. 
  * 
  * @param  int $fileID 
  * @access public
  * @return void
  */
 public function sourceEdit($fileID)
 {
     $this->file->setSavePath('source');
     $file = $this->file->getById($fileID);
     if (!empty($_POST)) {
         if (!$this->file->checkSavePath()) {
             $this->send(array('result' => 'fail', 'message' => $this->lang->file->errorUnwritable));
         }
         if ($this->post->filename == false or $this->post->filename == '') {
             $this->send(array('result' => 'fail', 'message' => $this->lang->file->nameEmpty));
         }
         $filename = $this->post->filename;
         if (!validater::checkFileName($filename)) {
             $this->send(array('result' => 'fail', 'message' => $this->lang->file->evilChar));
         }
         if (!$this->post->continue) {
             $extension = $this->file->getExtension($_FILES['upFile']['name']);
             $sameUpFile = $this->file->checkSameFile(str_replace('.' . $extension, '', $_FILES['upFile']['name']), $fileID);
             $sameFilename = $this->file->checkSameFile($this->post->filename, $fileID);
             if (!empty($sameUpFile) or !empty($sameFilename)) {
                 $this->send(array('result' => 'fail', 'error' => $this->lang->file->sameName));
             }
         }
         $result = $this->file->sourceEdit($file, $filename);
         if ($result) {
             $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('file', 'browseSource')));
         }
         $this->send(array('result' => 'fail', 'message' => dao::getError()));
     }
     $this->view->title = $this->lang->file->edit;
     $this->view->modalWidth = 500;
     $this->view->file = $file;
     $this->display();
 }
开发者ID:wenyinos,项目名称:chanzhieps,代码行数:41,代码来源:control.php

示例6: update

 /**
  * Update a public.
  * 
  * @param  int $publicID 
  * @access public
  * @return void
  */
 public function update($publicID)
 {
     if (!validater::checkReg($this->post->token, '|^[a-zA-Z0-9]{1}[a-zA-Z0-9]{1,30}[a-zA-Z0-9]{1}$|')) {
         dao::$errors['token'][] = $this->lang->error->token;
     }
     $public = fixer::input('post')->get();
     $this->dao->update(TABLE_WX_PUBLIC)->data($public)->autoCheck()->batchCheck($this->config->wechat->require->edit, 'notempty')->where('id')->eq($publicID)->exec();
     return !dao::isError();
 }
开发者ID:hansen1416,项目名称:eastsoft,代码行数:16,代码来源:model.php

示例7: checkPassword

 /**
  * Check the passwds posted.
  * 
  * @access public
  * @return bool
  */
 public function checkPassword()
 {
     if ($this->post->password1 != false) {
         if ($this->post->password1 != $this->post->password2) {
             dao::$errors['password'][] = $this->lang->error->passwordsame;
         }
         if (!validater::checkReg($this->post->password1, '|(.){6,}|')) {
             dao::$errors['password'][] = $this->lang->error->passwordrule;
         }
     }
     return !dao::isError();
 }
开发者ID:iamazhi,项目名称:zentaopms,代码行数:18,代码来源:model.php

示例8: checkPhone

 /**
  * Check phone number.
  * 
  * @param  string    $var 
  * @static
  * @access public
  * @return void
  */
 public static function checkPhone($var)
 {
     return validater::checkTel($var) or validater::checkMobile($var);
 }
开发者ID:dyp8848,项目名称:chanzhieps,代码行数:12,代码来源:filter.class.php

示例9: upgradeProjectMember

 /**
  * Update project member.
  * 
  * @access public
  * @return void
  */
 public function upgradeProjectMember()
 {
     $projects = $this->loadModel('project', 'oa')->getList();
     foreach ($projects as $project) {
         $member = new stdclass();
         $member->type = 'project';
         $member->id = $project->id;
         /* Move master to team table. */
         if (!empty($project->master)) {
             $member->account = $project->master;
             $member->role = 'role';
             $this->dao->replace(TABLE_TEAM)->data($member)->exec();
         }
         /* Move members to team table. */
         if (!empty($project->member)) {
             $members = explode(',', $project->member);
             $member->role = 'member';
             foreach ($members as $account) {
                 if ($account == $project->master) {
                     continue;
                 }
                 if (!validater::checkAccount($account)) {
                     continue;
                 }
                 $member->account = $account;
                 $this->dao->replace(TABLE_TEAM)->data($member)->exec();
             }
         }
         return true;
     }
 }
开发者ID:leowh,项目名称:colla,代码行数:37,代码来源:model.php

示例10: saveSetting

 /**
  * Save settings. 
  * 
  * @access public
  * @return void
  */
 public function saveSetting()
 {
     $errors = '';
     if (!$this->post->payment) {
         $errors['payment'] = array($this->lang->order->paymentRequired);
     }
     if (!$this->post->confirmLimit) {
         $errors['confirmLimit'] = array($this->lang->order->confirmLimitRequired);
     }
     if (in_array('alipay', $this->post->payment) and strlen($this->post->pid) != 16) {
         $errors['pid'] = array($this->lang->order->placeholder->pid);
     }
     if (in_array('alipay', $this->post->payment) and strlen($this->post->key) != 32) {
         $errors['key'] = array($this->lang->order->placeholder->key);
     }
     if (in_array('alipay', $this->post->payment) and !validater::checkEmail($this->post->email)) {
         $errors['email'] = array(sprintf($this->lang->error->email, $this->lang->order->alipayEmail));
     }
     if (!empty($errors)) {
         return array('result' => 'fail', 'message' => $errors);
     }
     $shopSetting = array();
     $shopSetting['payment'] = join(',', $this->post->payment);
     $shopSetting['confirmLimit'] = $this->post->confirmLimit;
     $this->loadModel('setting')->setItems('system.common.shop', $shopSetting);
     $alipaySetting = array();
     $alipaySetting['pid'] = $this->post->pid;
     $alipaySetting['key'] = $this->post->key;
     $alipaySetting['email'] = $this->post->email;
     $result = $this->loadModel('setting')->setItems('system.common.alipay', $alipaySetting);
     return array('result' => 'success', 'message' => $this->lang->saveSuccess);
 }
开发者ID:peirancao,项目名称:chanzhieps,代码行数:38,代码来源:model.php

示例11: sourceEdit

 /**
  * Edit for the source file. 
  * 
  * @param  int $fileID 
  * @access public
  * @return void
  */
 public function sourceEdit($fileID)
 {
     $this->file->setSavePath('source');
     $file = $this->file->getById($fileID);
     if (!empty($_POST)) {
         if (!$this->file->checkSavePath()) {
             $this->send(array('result' => 'fail', 'message' => $this->lang->file->errorUnwritable));
         }
         if ($this->post->filename == false or $this->post->filename == '') {
             $this->send(array('result' => 'fail', 'message' => $this->lang->file->nameEmpty));
         }
         $filename = $this->post->filename;
         if (!validater::checkFileName($filename)) {
             $this->send(array('result' => 'fail', 'message' => $this->lang->file->evilChar));
         }
         $result = $this->file->sourceEdit($file, $filename);
         if ($result) {
             $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('file', 'browseSource')));
         }
         $this->send(array('result' => 'fail', 'message' => dao::getError()));
     }
     $this->view->title = $this->lang->file->edit;
     $this->view->modalWidth = 500;
     $this->view->file = $file;
     $this->display();
 }
开发者ID:peirancao,项目名称:chanzhieps,代码行数:33,代码来源:control.php

示例12: identify

 /**
  * Identify a user.
  * 
  * @param   string $account     the account
  * @param   string $password    the password    the plain password or the md5 hash
  * @access  public
  * @return  object              if is valid user, return the user object.
  */
 public function identify($account, $password)
 {
     if (!$account or !$password) {
         return false;
     }
     /* First get the user from database by account or email. */
     $user = $this->dao->setAutolang(false)->select('*')->from(TABLE_USER)->beginIF(validater::checkEmail($account))->where('email')->eq($account)->fi()->beginIF(!validater::checkEmail($account))->where('account')->eq($account)->fi()->fetch();
     /* Then check the password hash. */
     if (!$user) {
         return false;
     }
     /* Can not login before ten minutes when user is locked. */
     if ($user->locked != '0000-00-00 00:00:00') {
         $dateDiff = (strtotime($user->locked) - time()) / 60;
         /* Check the type of lock and show it. */
         if ($dateDiff > 0 && $dateDiff <= 3) {
             $this->lang->user->loginFailed = sprintf($this->lang->user->locked, '3' . $this->lang->date->minute);
             return false;
         } elseif ($dateDiff > 3) {
             $dateDiff = ceil($dateDiff / 60 / 24);
             $this->lang->user->loginFailed = $dateDiff <= 30 ? sprintf($this->lang->user->locked, $dateDiff . $this->lang->date->day) : $this->lang->user->lockedForEver;
             return false;
         } else {
             $user->fails = 0;
             $user->locked = '0000-00-00 00:00:00';
         }
     }
     /* The password can be the plain or the password after md5. */
     if (!$this->compareHashPassword($password, $user) and $user->password != $this->createPassword($password, $user->account)) {
         /* Save login log if user is admin. */
         if ($user->admin == 'super' or $user->admin == 'common') {
             $this->saveLog($user->account, 'fail');
         }
         $user->fails++;
         if ($user->fails > 2 * 4) {
             $user->locked = date('Y-m-d H:i:s', time() + 3 * 60);
         }
         $this->dao->setAutolang(false)->update(TABLE_USER)->data($user)->where('id')->eq($user->id)->exec();
         return false;
     }
     /* Update user data. */
     $user->ip = $this->server->remote_addr;
     $user->last = helper::now();
     $user->fails = 0;
     $user->visits++;
     /* Save login log if user is admin. */
     if ($user->admin == 'super' or $user->admin == 'common') {
         $this->saveLog($user->account, 'success');
     }
     $this->dao->setAutolang(false)->update(TABLE_USER)->data($user)->where('account')->eq($account)->exec();
     $user->realname = $this->computeRealname($user);
     $user->shortLast = substr($user->last, 5, -3);
     $user->shortJoin = substr($user->join, 5, -3);
     unset($_SESSION['random']);
     if (commonModel::isAvailable('score')) {
         $viewType = $this->app->getViewType();
         if ($user) {
             $this->app->user->account = $account;
             if ($user->maxLogin > 0) {
                 $this->app->loadConfig('score');
                 $login = $this->config->score->counts->login;
                 $this->dao->update(TABLE_USER)->set('maxLogin = maxLogin - ' . $login)->where('account')->eq($account)->exec();
                 $this->loadModel('score')->earn('login', '', '', 'LOGIN');
             }
         }
     }
     return $user;
 }
开发者ID:qiaqiali,项目名称:chanzhieps,代码行数:76,代码来源:model.php

示例13: strtoupper

                if (validater::checkCode(substr($name, 0, 1)) and validater::checkCode(substr($name, 1, 1))) {
                    $rightName .= strtoupper(substr($name, 1, 1));
                }
                ?>
              <?php 
                if (validater::checkCode(substr($name, 0, 1)) and !validater::checkCode(substr($name, 1, 1))) {
                    $rightName .= strtoupper(substr($name, 1, 3));
                }
                ?>
              <?php 
                if (!validater::checkCode(substr($name, 0, 1)) and validater::checkCode(substr($name, 3, 1))) {
                    $rightName .= strtoupper(substr($name, 3, 1));
                }
                ?>
              <?php 
                if (!validater::checkCode(substr($name, 0, 1)) and !validater::checkCode(substr($name, 3, 1))) {
                    $rightName .= substr($name, 3, 3);
                }
                ?>
              <i class='icon icon-default' style="background-color: hsl(<?php 
                echo $right['id'] * 47 % 360;
                ?>
, 100%, 40%)"> <span><?php 
                echo $rightName;
                ?>
 </span></i>
              <?php 
            }
            ?>
              <?php 
            echo html::checkbox('apps', array($code => $right['name']), $right['right'] == '1' ? $code : '');
开发者ID:leowh,项目名称:colla,代码行数:31,代码来源:manageapppriv.html.php

示例14: edit

 /**
  * Edit file.
  * 
  * @param  int    $fileID 
  * @access public
  * @return void
  */
 public function edit($fileID)
 {
     $this->replaceFile($fileID);
     $fileInfo = fixer::input('post')->remove('upFile')->get();
     if (!validater::checkFileName($fileInfo->title)) {
         return false;
     }
     $fileInfo->lang = 'all';
     $this->dao->update(TABLE_FILE)->data($fileInfo)->autoCheck()->batchCheck($this->config->file->require->edit, 'notempty')->where('id')->eq($fileID)->exec();
     $this->dao->setAutoLang(false)->update(TABLE_FILE)->data($fileInfo)->autoCheck()->batchCheck($this->config->file->require->edit, 'notempty')->where('id')->eq($fileID)->exec();
 }
开发者ID:peirancao,项目名称:chanzhieps,代码行数:18,代码来源:model.php

示例15: identify

 /**
  * Identify a user.
  * 
  * @param   string $account     the account
  * @param   string $password    the password    the plain password or the md5 hash
  * @access  public
  * @return  object              if is valid user, return the user object.
  */
 public function identify($account, $password)
 {
     if (!$account or !$password) {
         return false;
     }
     /* First get the user from database by account or email. */
     $user = $this->dao->select('*')->from(TABLE_USER)->where('deleted')->eq('0')->beginIF(validater::checkEmail($account))->andWhere('email')->eq($account)->fi()->beginIF(!validater::checkEmail($account))->andWhere('account')->eq($account)->fi()->fetch();
     /* Then check the password hash. */
     if (!$user) {
         return false;
     }
     /* Can not login before ten minutes when user is locked. */
     if ($user->locked != '0000-00-00 00:00:00') {
         $dateDiff = (strtotime($user->locked) - time()) / 60;
         /* Check the type of lock and show it. */
         if ($dateDiff > 0 && $dateDiff <= 10) {
             $this->lang->user->loginFailed = sprintf($this->lang->user->locked, '10' . $this->lang->date->minute);
             return false;
         } elseif ($dateDiff > 10) {
             $dateDiff = ceil($dateDiff / 60 / 24);
             $this->lang->user->loginFailed = $dateDiff <= 30 ? sprintf($this->lang->user->locked, $dateDiff . $this->lang->date->day) : $this->lang->user->lockedForEver;
             return false;
         } else {
             $user->fails = 0;
             $user->locked = '0000-00-00 00:00:00';
         }
     }
     /* The password can be the plain or the password after md5. */
     if (!$this->compareHashPassword($password, $user)) {
         $user->fails++;
         if ($user->fails > 2) {
             $user->locked = date('Y-m-d H:i:s', time() + 10 * 60);
         }
         $this->dao->update(TABLE_USER)->data($user)->where('id')->eq($user->id)->exec();
         return false;
     }
     /* Update user data. */
     $user->ip = $this->server->remote_addr;
     $user->last = helper::now();
     $user->ping = helper::now();
     $user->fails = 0;
     $user->visits++;
     /* Update password when create password by oldCreatePassword function. */
     $this->dao->update(TABLE_USER)->data($user)->where('account')->eq($account)->exec();
     $user->realname = empty($user->realname) ? $account : $user->realname;
     $user->shortLast = substr($user->last, 5, -3);
     $user->shortJoin = substr($user->join, 5, -3);
     unset($_SESSION['random']);
     /* Save sign in info. */
     $this->loadModel('attend', 'oa')->signIn($user->account);
     /* Return him.*/
     return $user;
 }
开发者ID:leowh,项目名称:colla,代码行数:61,代码来源:model.php


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