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


PHP validater::checkAccount方法代码示例

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


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

示例1: addBlacklist

 /**
  * Add a blacklist item. 
  * 
  * @access public
  * @return void
  */
 public function addBlacklist()
 {
     $typeList = $this->lang->guarder->blacklistModes;
     if ($_POST) {
         $item = $this->post->identity;
         $type = 'keywords';
         if (validater::checkIP($item)) {
             $type = 'ip';
         }
         if (validater::checkEmail($item)) {
             $type = 'email';
         }
         if (validater::checkAccount($item)) {
             $user = $this->loadModel('user')->getByAccount($item);
             if (!empty($user)) {
                 $type = 'account';
             }
         }
         $result = $this->guarder->punish($type, $item, $this->post->reason, $this->post->expired);
         if ($result) {
             $this->send(array('result' => 'success', 'message' => $this->lang->setSuccess, 'locate' => inlink('blacklist', "mode={$type}")));
         }
         $this->send(array('result' => 'fail', 'message' => dao::geterror()));
     }
     $this->view->title = $this->lang->guarder->addBlacklist;
     $this->display();
 }
开发者ID:eric0614,项目名称:chanzhieps,代码行数:33,代码来源:control.php

示例2: batchEdit

 /**
  * Batch edit user.
  * 
  * @access public
  * @return void
  */
 public function batchEdit()
 {
     if (empty($_POST['verifyPassword']) or md5($this->post->verifyPassword) != $this->app->user->password) {
         die(js::alert($this->lang->user->error->verifyPassword));
     }
     $oldUsers = $this->dao->select('id, account')->from(TABLE_USER)->where('id')->in(array_keys($this->post->account))->fetchPairs('id', 'account');
     $accountGroup = $this->dao->select('id, account')->from(TABLE_USER)->where('account')->in($this->post->account)->fetchGroup('account', 'id');
     $accounts = array();
     foreach ($this->post->account as $id => $account) {
         $users[$id]['account'] = $account;
         $users[$id]['realname'] = $this->post->realname[$id];
         $users[$id]['commiter'] = $this->post->commiter[$id];
         $users[$id]['email'] = $this->post->email[$id];
         $users[$id]['join'] = $this->post->join[$id];
         $users[$id]['dept'] = $this->post->dept[$id] == 'ditto' ? isset($prev['dept']) ? $prev['dept'] : 0 : $this->post->dept[$id];
         $users[$id]['role'] = $this->post->role[$id] == 'ditto' ? isset($prev['role']) ? $prev['role'] : 0 : $this->post->role[$id];
         if (isset($accountGroup[$account]) and count($accountGroup[$account]) > 1) {
             die(js::error(sprintf($this->lang->user->error->accountDupl, $id)));
         }
         if (in_array($account, $accounts)) {
             die(js::error(sprintf($this->lang->user->error->accountDupl, $id)));
         }
         if (!validater::checkAccount($users[$id]['account'])) {
             die(js::error(sprintf($this->lang->user->error->account, $id)));
         }
         if ($users[$id]['realname'] == '') {
             die(js::error(sprintf($this->lang->user->error->realname, $id)));
         }
         if ($users[$id]['email'] and !validater::checkEmail($users[$id]['email'])) {
             die(js::error(sprintf($this->lang->user->error->mail, $id)));
         }
         if (empty($users[$id]['role'])) {
             die(js::error(sprintf($this->lang->user->error->role, $id)));
         }
         $accounts[$id] = $account;
         $prev['dept'] = $users[$id]['dept'];
         $prev['role'] = $users[$id]['role'];
     }
     foreach ($users as $id => $user) {
         $this->dao->update(TABLE_USER)->data($user)->where('id')->eq((int) $id)->exec();
         if ($user['account'] != $oldUsers[$id]) {
             $oldAccount = $oldUsers[$id];
             $this->dao->update(TABLE_USERGROUP)->set('account')->eq($user['account'])->where('account')->eq($oldAccount)->exec();
             if (strpos($this->app->company->admins, ',' . $oldAccount . ',') !== false) {
                 $admins = str_replace(',' . $oldAccount . ',', ',' . $user['account'] . ',', $this->app->company->admins);
                 $this->dao->update(TABLE_COMPANY)->set('admins')->eq($admins)->where('id')->eq($this->app->company->id)->exec();
             }
             if (!dao::isError() and $this->app->user->account == $oldAccount) {
                 $this->app->user->account = $users['account'];
             }
         }
     }
 }
开发者ID:XMGmen,项目名称:zentao,代码行数:59,代码来源:model.php

示例3: 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


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