本文整理汇总了PHP中CUser::update方法的典型用法代码示例。如果您正苦于以下问题:PHP CUser::update方法的具体用法?PHP CUser::update怎么用?PHP CUser::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUser
的用法示例。
在下文中一共展示了CUser::update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CUser
<?php
/**
* This is a Branax pagecontroller.
*
*/
// Include the essential config-file which also creates the $branax variable with its defaults.
include __DIR__ . '/config.php';
$user = new CUser($branax['database']);
$user->isAuthenticated() or die('Check: You must login to edit.');
define('MOVIE_PATH', __DIR__ . '/img/movie/');
$content = new CUser($branax['database']);
// Do it and store it all in variables in the Branax container.
$branax['title'] = "Edit";
$branax['main'] = <<<EOD
<h1>Editera innehåll</h1>
{$content->update()}
EOD;
// Finally, leave it all to the rendering phase of Branax.
include BRANAX_THEME_PATH;
示例2: Authorize
public function Authorize()
{
global $APPLICATION;
$APPLICATION->RestartBuffer();
$authError = SOCSERV_AUTHORISATION_ERROR;
if (isset($_REQUEST["code"]) && $_REQUEST["code"] != '' && CSocServAuthManager::CheckUniqueKey()) {
$redirect_uri = CSocServUtil::ServerName() . '/bitrix/tools/oauth/bitrix24net.php';
if ($this->getEntityOAuth($_REQUEST["code"])->GetAccessToken($redirect_uri) !== false) {
$arB24NetUser = $this->entityOAuth->GetCurrentUser();
if ($arB24NetUser) {
if (isset($_REQUEST['checkword']) && $arB24NetUser['PROFILE_ID'] > 0) {
$profileId = $arB24NetUser['PROFILE_ID'];
$checkword = trim($_REQUEST['checkword']);
$dbRes = CUser::getById($profileId);
$arUser = $dbRes->fetch();
if ($arUser && !$arUser['LAST_LOGIN']) {
if ($arUser['CONFIRM_CODE'] == $checkword) {
$arUserFields = array('XML_ID' => $arB24NetUser['ID'], 'EXTERNAL_AUTH_ID' => 'socservices');
if ($arUser['NAME'] == '' && $arUser['LAST_NAME'] == '') {
$arUserFields['NAME'] = $arB24NetUser['NAME'];
$arUserFields['LAST_NAME'] = $arB24NetUser['LAST_NAME'];
if (strlen($arB24NetUser['PERSONAL_PHOTO']) > 0 && self::CheckPhotoURI($arB24NetUser['PERSONAL_PHOTO'])) {
$arUserFields['PERSONAL_PHOTO'] = CFile::MakeFileArray($arB24NetUser['PERSONAL_PHOTO']);
}
}
$obUser = new CUser();
if ($obUser->update($profileId, $arUserFields)) {
foreach (GetModuleEvents("main", "OnUserInitialize", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($profileId, $arUserFields));
}
}
}
}
}
$arFields = array('EXTERNAL_AUTH_ID' => self::ID, 'XML_ID' => $arB24NetUser["ID"], 'LOGIN' => "B24_" . $arB24NetUser["ID"], 'NAME' => $arB24NetUser["NAME"], 'LAST_NAME' => $arB24NetUser["LAST_NAME"], 'EMAIL' => $arB24NetUser["EMAIL"], 'PERSONAL_WWW' => $arB24NetUser["PROFILE"], 'OATOKEN' => $this->entityOAuth->getToken(), 'REFRESH_TOKEN' => $this->entityOAuth->getRefreshToken(), 'OATOKEN_EXPIRES' => $this->entityOAuth->getAccessTokenExpires());
if (IsModuleInstalled('bitrix24')) {
$arFields['LOGIN'] = $arFields['EMAIL'];
}
if (strlen(SITE_ID) > 0) {
$arFields["SITE_ID"] = SITE_ID;
}
$authError = $this->AuthorizeUser($arFields);
}
}
}
$bSuccess = $authError === true;
$aRemove = array("logout", "auth_service_error", "auth_service_id", "code", "error_reason", "error", "error_description", "check_key", "current_fieldset", "checkword");
$url = $APPLICATION->GetCurDir() == "/login/" ? "" : $APPLICATION->GetCurDir();
$mode = 'page';
if (isset($_REQUEST["state"])) {
$arState = array();
parse_str($_REQUEST["state"], $arState);
if (isset($arState['backurl']) || isset($arState['redirect_url'])) {
$parseUrl = parse_url(isset($arState['redirect_url']) ? $arState['redirect_url'] : $arState['backurl']);
$urlPath = $parseUrl["path"];
$arUrlQuery = explode('&', $parseUrl["query"]);
foreach ($arUrlQuery as $key => $value) {
foreach ($aRemove as $param) {
if (strpos($value, $param . "=") === 0) {
unset($arUrlQuery[$key]);
break;
}
}
}
$url = !empty($arUrlQuery) ? $urlPath . '?' . implode("&", $arUrlQuery) : $urlPath;
}
if (isset($arState['mode'])) {
$mode = $arState['mode'];
}
}
if (strlen($url) <= 0 || preg_match("'^(http://|https://|ftp://|//)'i", $url)) {
$url = CSocServUtil::ServerName() . '/';
}
$url = CUtil::JSEscape($url);
if ($bSuccess) {
unset($_SESSION['B24_NETWORK_REDIRECT_TRY']);
} else {
if (IsModuleInstalled('bitrix24')) {
if (isset($_SESSION['B24_NETWORK_REDIRECT_TRY'])) {
unset($_SESSION['B24_NETWORK_REDIRECT_TRY']);
$url = self::getUrl();
$url .= (strpos($url, '?') >= 0 ? '&' : '?') . 'skip_redirect=1';
} else {
$_SESSION['B24_NETWORK_REDIRECT_TRY'] = true;
$url = '/';
}
} else {
if ($authError === SOCSERV_REGISTRATION_DENY) {
$url = preg_match("/\\?/", $url) ? $url . '&' : $url . '?';
$url .= 'auth_service_id=' . self::ID . '&auth_service_error=' . $authError;
} elseif ($bSuccess !== true) {
$url = isset($urlPath) ? $urlPath . '?auth_service_id=' . self::ID . '&auth_service_error=' . $authError : $GLOBALS['APPLICATION']->GetCurPageParam('auth_service_id=' . self::ID . '&auth_service_error=' . $authError, $aRemove);
}
}
}
if (CModule::IncludeModule("socialnetwork") && strpos($url, "current_fieldset=") === false) {
$url .= (strpos($url, "?") === false ? '?' : '&') . "current_fieldset=SOCSERV";
}
$location = $mode == "popup" ? 'if(window.opener) window.opener.location = \'' . $url . '\'; window.close();' : 'window.location = \'' . $url . '\';';
?>
//.........这里部分代码省略.........
示例3: get_request
$user['autologout'] = get_request('autologout', 0);
$user['lang'] = get_request('lang');
$user['theme'] = get_request('theme');
$user['refresh'] = get_request('refresh');
$user['rows_per_page'] = get_request('rows_per_page');
$user['type'] = get_request('user_type');
// $user['user_groups'] = get_request('user_groups', array());
$user['user_medias'] = get_request('user_medias', array());
$usrgrps = get_request('user_groups', array());
$usrgrps = zbx_toObject($usrgrps, 'usrgrpid');
$user['usrgrps'] = $usrgrps;
if (isset($_REQUEST['userid'])) {
$action = AUDIT_ACTION_UPDATE;
$user['userid'] = $_REQUEST['userid'];
DBstart();
$result = CUser::update($user);
if (!$result) {
error(CUser::resetErrors());
}
// if($result) $result = CUserGroup::updateUsers(array('users' => $user, 'usrgrps' => $usrgrps));
// if($result === false)
// error(CUserGroup::resetErrors());
if ($result !== false) {
$result = CUser::updateMedia(array('users' => $user, 'medias' => $user['user_medias']));
}
$result = $result === false ? false : true;
$result = DBend($result);
show_messages($result, S_USER_UPDATED, S_CANNOT_UPDATE_USER);
} else {
$action = AUDIT_ACTION_ADD;
DBstart();