本文整理汇总了PHP中users::edit方法的典型用法代码示例。如果您正苦于以下问题:PHP users::edit方法的具体用法?PHP users::edit怎么用?PHP users::edit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类users
的用法示例。
在下文中一共展示了users::edit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
if (!template_session::is_admin() and !template_session::is_editor()) {
if (get('ajax')) {
exit(RUDE_AJAX_ACCESS_VIOLATION);
}
return false;
}
switch (get('task')) {
case 'remove':
$status = users::remove(get('id'));
break;
case 'edit':
$status = users::edit(get('id'), get('name'), get('role_id'));
break;
default:
$status = false;
break;
}
if (get('ajax')) {
if ($status) {
exit(RUDE_AJAX_OK);
} else {
exit(RUDE_AJAX_ERROR);
}
}
return true;
}
示例2: refresh
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);
_setTitle($langArray['edit']);
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
refresh('?m=' . $_GET['m'] . '&c=list', 'INVALID ID', 'error');
}
$cms = new users();
if (isset($_POST['edit'])) {
$adminEdit = true;
if (isset($personalEdit)) {
$adminEdit = false;
}
$status = $cms->edit($_GET['id'], $adminEdit);
if ($status !== true) {
abr('error', $status);
} else {
if (isset($personalEdit)) {
refresh("?m=" . $_GET['m'] . "&c=edit&id=" . $_GET['id'], $langArray['edit_complete']);
} else {
refresh("?m=" . $_GET['m'] . "&c=list", $langArray['edit_complete']);
}
}
} else {
//独家设置
if (isset($_POST['exclusive_false'])) {
$usersClass = new users();
$usersClass->editExclusiveAuthor('false', $_GET['id']);
} elseif (isset($_POST['exclusive_true'])) {
示例3: settings
public function settings($arguments)
{
// Update
if (!Session::isLoggedIn()) {
return Error::set('You are not logged in!');
}
$user = new users(ConnectionFactory::get('mongo'));
$this->view['valid'] = true;
$this->view['user'] = $user->get(Session::getVar('username'));
$this->view['secure'] = !empty($_SERVER['SSL_CLIENT_RAW_CERT']) ? true : false;
if ($this->view['secure']) {
$this->view['clientSSLKey'] = certs::getKey($_SERVER['SSL_CLIENT_RAW_CERT']);
}
if (!empty($arguments[0]) && $arguments[0] == 'save') {
if (!empty($_POST['oldpassword']) && !empty($_POST['password'])) {
$old = $user->hash($_POST['oldpassword'], $this->view['user']['username']);
if ($old != $this->view['user']['password']) {
return Error::set('Previous password is invalid.');
}
}
$username = !empty($_POST['username']) ? $_POST['username'] : null;
$password = !empty($_POST['password']) ? $_POST['password'] : null;
$email = !empty($_POST['email']) ? $_POST['email'] : null;
$hideEmail = !empty($_POST['hideEmail']) ? true : false;
$lockToIp = !empty($_POST['lockToIp']) ? true : false;
$error = $user->edit(Session::getVar('_id'), $username, $password, $email, $hideEmail, null, $lockToIp);
if (is_string($error)) {
return Error::set($error);
}
$this->view['user'] = $user->get(Session::getVar('username'));
Session::setBatchVars($this->view['user']);
Error::set('User profile saved.', true);
}
if (!empty($arguments[0]) && $arguments[0] == 'saveAuth') {
$password = !empty($_POST['passwordAuth']) ? true : false;
$certificate = !empty($_POST['certificateAuth']) ? true : false;
$certAndPass = !empty($_POST['certAndPassAuth']) ? true : false;
$autoauth = !empty($_POST['autoAuth']) ? true : false;
$return = $user->changeAuth(Session::getVar('_id'), $password, $certificate, $certAndPass, $autoauth);
if (is_string($return)) {
return Error::set($return);
}
$this->view['user'] = $user->get(Session::getVar('username'));
}
Layout::set('title', 'Settings');
}