本文整理汇总了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();
}
示例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'];
}
}
}
}
示例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;
}
}