本文整理汇总了PHP中CUserOptions::DeleteOption方法的典型用法代码示例。如果您正苦于以下问题:PHP CUserOptions::DeleteOption方法的具体用法?PHP CUserOptions::DeleteOption怎么用?PHP CUserOptions::DeleteOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUserOptions
的用法示例。
在下文中一共展示了CUserOptions::DeleteOption方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __InTaskDeleteView
function __InTaskDeleteView($delViewId, $iblockId, $taskType, $ownerId)
{
$delViewId = IntVal($delViewId);
$iblockId = IntVal($iblockId);
$ownerId = IntVal($ownerId);
if ($delViewId <= 0 || $iblockId <= 0 || $ownerId <= 0) {
return "";
}
$errorMessage = "";
$userSettingsCategory = "IntranetTasks";
$userSettingsNamePart = "Settings_";
$arUserSettings = CUserOptions::GetOption($userSettingsCategory, $userSettingsNamePart . $delViewId, false, $GLOBALS["USER"]->GetID());
if (!$arUserSettings) {
$errorMessage .= GetMessage("INTL_VIEW_NOT_FOUND") . ".";
}
if (StrLen($errorMessage) <= 0) {
if ($arUserSettings["IBLOCK_ID"] != $iblockId || $arUserSettings["TASK_TYPE"] != $taskType || $arUserSettings["OWNER_ID"] != $ownerId) {
$errorMessage .= GetMessage("INTL_WRONG_VIEW") . ".";
}
}
if (StrLen($errorMessage) <= 0) {
if ($arUserSettings["COMMON"] != "N") {
$canModifyCommon = $taskType == 'user' && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_USER, $ownerId, "tasks", 'modify_common_views') || $taskType == 'group' && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $ownerId, "tasks", 'modify_common_views');
if (!$canModifyCommon) {
$errorMessage .= GetMessage("INTL_NO_VIEW_PERMS") . ".";
}
}
}
if (StrLen($errorMessage) <= 0) {
CUserOptions::DeleteOption($userSettingsCategory, $userSettingsNamePart . $delViewId, $arUserSettings["COMMON"] == "Y" ? true : false, $GLOBALS["USER"]->GetID());
}
return $errorMessage;
}
示例2: OnUserDelete
public static function OnUserDelete($ID)
{
global $DB;
if (!CSocNetGroup::__ValidateID($ID)) {
return false;
}
$ID = IntVal($ID);
$bSuccess = True;
if (!CSocNetGroup::DeleteNoDemand($ID)) {
if ($ex = $GLOBALS["APPLICATION"]->GetException()) {
$err = $ex->GetString();
}
$GLOBALS["APPLICATION"]->ThrowException($err);
$bSuccess = false;
}
if ($bSuccess) {
CSocNetUserRelations::DeleteNoDemand($ID);
CSocNetUserPerms::DeleteNoDemand($ID);
CSocNetUserEvents::DeleteNoDemand($ID);
CSocNetMessages::DeleteNoDemand($ID);
CSocNetUserToGroup::DeleteNoDemand($ID);
CSocNetLogEvents::DeleteNoDemand($ID);
CSocNetLog::DeleteNoDemand($ID);
CSocNetLogComments::DeleteNoDemand($ID);
CSocNetFeatures::DeleteNoDemand($ID);
CSocNetSubscription::DeleteEx($ID);
CUserOptions::DeleteOption("socialnetwork", "~menu_" . SONET_ENTITY_USER . "_" . $ID, false, 0);
}
return $bSuccess;
}
示例3: setOffline
public static function setOffline($userId = false)
{
global $USER;
if (!$userId) {
$userId = $USER->GetId();
}
$userId = intval($userId);
if ($userId <= 0) {
return false;
}
\CUserOptions::DeleteOption('mobile', 'lastActivityDate', false, $userId);
return false;
}
示例4: Delete
function Delete($ID)
{
global $DB;
if (!CSocNetGroup::__ValidateID($ID)) {
return false;
}
$ID = IntVal($ID);
$bSuccess = True;
$db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetGroupDelete");
while ($arEvent = $db_events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
return false;
}
}
$arGroup = CSocNetGroup::GetByID($ID);
if (!$arGroup) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_NO_GROUP"), "ERROR_NO_GROUP");
return false;
}
$DB->StartTransaction();
$events = GetModuleEvents("socialnetwork", "OnSocNetGroupDelete");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID));
}
if ($bSuccess) {
$bSuccess = $DB->Query("DELETE FROM b_sonet_user2group WHERE GROUP_ID = " . $ID . "", true);
}
if ($bSuccess) {
$bSuccessTmp = true;
$dbResult = CSocNetFeatures::GetList(array(), array("ENTITY_ID" => $ID, "ENTITY_TYPE" => SONET_ENTITY_GROUP));
while ($arResult = $dbResult->Fetch()) {
$bSuccessTmp = $DB->Query("DELETE FROM b_sonet_features2perms WHERE FEATURE_ID = " . $arResult["ID"] . "", true);
if (!$bSuccessTmp) {
break;
}
}
if (!$bSuccessTmp) {
$bSuccess = false;
}
}
if ($bSuccess) {
$bSuccess = $DB->Query("DELETE FROM b_sonet_features WHERE ENTITY_ID = " . $ID . " AND ENTITY_TYPE = '" . $DB->ForSql(SONET_ENTITY_GROUP, 1) . "'", true);
}
if ($bSuccess) {
$dbResult = CSocNetLog::GetList(array(), array("ENTITY_ID" => $ID, "ENTITY_TYPE" => SONET_ENTITY_GROUP), false, false, array("ID"));
while ($arResult = $dbResult->Fetch()) {
$bSuccessTmp = $DB->Query("DELETE FROM b_sonet_log_site WHERE LOG_ID = " . $arResult["ID"] . "", true);
if (!$bSuccessTmp) {
break;
}
$bSuccessTmp = $DB->Query("DELETE FROM b_sonet_log_right WHERE LOG_ID = " . $arResult["ID"] . "", true);
if (!$bSuccessTmp) {
break;
}
}
if (!$bSuccessTmp) {
$bSuccess = false;
}
}
if ($bSuccess) {
$bSuccess = $DB->Query("DELETE FROM b_sonet_log WHERE ENTITY_TYPE = '" . SONET_ENTITY_GROUP . "' AND ENTITY_ID = " . $ID . "", true);
}
if ($bSuccess) {
$bSuccess = CSocNetLog::DeleteSystemEventsByGroupID($ID);
}
if ($bSuccess) {
$bSuccess = $DB->Query("DELETE FROM b_sonet_log_events WHERE ENTITY_TYPE = 'G' AND ENTITY_ID = " . $ID . "", true);
}
if ($bSuccess) {
$bSuccess = $DB->Query("DELETE FROM b_sonet_group_site WHERE GROUP_ID = " . $ID . "", true);
}
if ($bSuccess) {
$bSuccess = $DB->Query("DELETE FROM b_sonet_log_right WHERE GROUP_CODE LIKE 'SG" . $ID . "\\_%' OR GROUP_CODE = 'SG" . $ID . "'", true);
}
if ($bSuccess) {
$bSuccess = CSocNetSubscription::DeleteEx(false, "SG" . $ID);
}
if ($bSuccess) {
CFile::Delete($arGroup["IMAGE_ID"]);
$bSuccess = $DB->Query("DELETE FROM b_sonet_group WHERE ID = " . $ID . "", true);
}
if ($bSuccess) {
CUserOptions::DeleteOption("socialnetwork", "~menu_" . SONET_ENTITY_GROUP . "_" . $ID, false, 0);
unset($GLOBALS["SONET_GROUP_CACHE"][$ID]);
}
if ($bSuccess) {
$DB->Commit();
} else {
$DB->Rollback();
}
if ($bSuccess) {
unset($GLOBALS["SONET_GROUP_CACHE"][$ID]);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group_G" . $ID);
$GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group");
$GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_group_" . $ID);
$GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_group");
}
}
if ($bSuccess && CModule::IncludeModule("search")) {
//.........这里部分代码省略.........
示例5: foreach
foreach ($arParams["FILTER"] as $key => $val) {
$arResult["ActiveFeatures"][$val] = $arAllFilter[$val];
}
}
if (is_array($arResult["ActiveFeatures"]) && count($arResult["ActiveFeatures"]) > 0) {
$arResult["NO_ACTIVE_FEATURES"] = false;
if (!isset($_REQUEST["flt_event_id"])) {
$arParams["EVENT_ID"] = CUserOptions::GetOption("main", "~event_list");
$flt_event_id = empty($arParams["EVENT_ID"]) ? $arParams["FILTER"] : $arParams["EVENT_ID"];
} else {
$arResult["flt_event_id"] = $_REQUEST["flt_event_id"];
if (array_key_exists("flt_event_id_all", $_REQUEST) && $_REQUEST["flt_event_id_all"] == "Y") {
$arParams["EVENT_ID"] = "";
$flt_event_id = $arParams["FILTER"];
if ($USER->IsAuthorized() && check_bitrix_sessid()) {
CUserOptions::DeleteOption("main", "~event_list");
}
} else {
$flt_event_id = $_REQUEST["flt_event_id"];
// checked events
foreach ($flt_event_id as $key => $val) {
$flt_event_id[$key] = htmlspecialcharsbx($val);
}
$arParams["EVENT_ID"] = $flt_event_id;
if ($USER->IsAuthorized() && check_bitrix_sessid()) {
CUserOptions::SetOption("main", "~event_list", $arParams["EVENT_ID"]);
}
}
}
$arObjectTypes = array();
$arFilter["MODULE_ITEM"] = array();
示例6: CJSPopup
$obJSPopup = new CJSPopup();
} else {
$errorMessage = GetMessage("SONET_SM_MAX_ITEMS_INCORRECT");
$APPLICATION->RestartBuffer();
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/interface/admin_lib.php';
$obJSPopup = new CJSPopup();
}
if (!$errorMessage) {
$obJSPopup->Close();
} else {
$obJSPopup->ShowValidationError($errorMessage);
$obJSPopup->Close(false);
die;
}
} elseif ($_SERVER['REQUEST_METHOD'] == 'POST' && array_key_exists("sm_action", $_REQUEST) && $_REQUEST["sm_action"] == "clear_settings" && check_bitrix_sessid()) {
CUserOptions::DeleteOption("socialnetwork", "~menu_" . $arParams["ENTITY_TYPE"] . "_" . $arParams["ENTITY_ID"], false, 0);
$APPLICATION->RestartBuffer();
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/interface/admin_lib.php';
$obJSPopup = new CJSPopup();
if (!$errorMessage) {
$obJSPopup->Close();
} else {
$obJSPopup->ShowValidationError($errorMessage);
die;
}
} elseif ($_SERVER['REQUEST_METHOD'] == 'POST' && array_key_exists("sm_action", $_REQUEST) && $_REQUEST["sm_action"] == "delete" && strlen($_REQUEST["feature"]) > 0 && check_bitrix_sessid()) {
if (!$errorMessage) {
$dbResultTmp = CSocNetFeatures::GetList(array(), array("ENTITY_ID" => $arParams['ENTITY_ID'], "ENTITY_TYPE" => $arParams['ENTITY_TYPE'], "FEATURE" => $_REQUEST['feature']));
$arResultTmp = $dbResultTmp->Fetch();
if ($arResultTmp) {
$FeatureName = $arResultTmp["FEATURE_NAME"];
示例7: array_search
break;
case "show":
if (in_array($menuItemID, $userOption[$titleItemID]["hide"])) {
if ($titleItemID == "menu-favorites" && !in_array($menuItemID, $userOption[$titleItemID]["show"])) {
$userOption[$titleItemID]["show"][] = $menuItemID;
}
$key = array_search($menuItemID, $userOption[$titleItemID]["hide"]);
unset($userOption[$titleItemID]["hide"][$key]);
if (empty($userOption[$titleItemID]["hide"])) {
unset($userOption[$titleItemID]["hide"]);
}
if (empty($userOption[$titleItemID])) {
unset($userOption[$titleItemID]);
}
if (empty($userOption)) {
CUserOptions::DeleteOption("bitrix24", $optionName);
} else {
CUserOptions::SetOption("bitrix24", $optionName, $userOption);
}
}
break;
case "sort_items":
if (isset($_POST["all_title_items"])) {
if (!isset($userOption[$titleItemID]["show"])) {
$oldSortItems = $userOption[$titleItemID]["show"];
$userOption[$titleItemID]["show"] = array();
$userOption[$titleItemID]["show"] = $_POST["all_title_items"];
$lostItems = array();
if (is_array($oldSortItems)) {
foreach ($oldSortItems as $itemID) {
if (!in_array($itemID, $_POST["all_title_items"])) {
示例8: Copyright
<?php
##############################################
# Bitrix Site Manager #
# Copyright (c) 2002-2007 Bitrix #
# http://www.bitrixsoft.com #
# mailto:admin@bitrixsoft.com #
##############################################
// define("NO_KEEP_STATISTIC", true);
// define("NO_AGENT_STATISTIC", true);
// define("NOT_CHECK_PERMISSIONS", true);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
if ($USER->IsAuthorized() && check_bitrix_sessid()) {
if ($_GET["action"] == "delete" && $_GET["c"] != "" && $_GET["n"] != "") {
CUserOptions::DeleteOption($_GET["c"], $_GET["n"], $_GET["common"] == "Y" && $GLOBALS["USER"]->CanDoOperation('edit_other_settings'));
}
if (is_array($_REQUEST["p"])) {
$arOptions = $_REQUEST["p"];
CUtil::decodeURIComponent($arOptions);
CUserOptions::SetOptionsFromArray($arOptions);
}
}
echo "OK";
require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/epilog_admin_after.php";
示例9: array
$arFields["ORDER_DIR_1"] = $_POST["ORDER_DIR_1"] == "ASC" ? "ASC" : "DESC";
}
$_POST["COMMON"] = $arResult["Perms"]["CanModifyCommon"] && $_POST["COMMON"] == "Y" ? true : false;
$arFields["COMMON"] = $_POST["COMMON"] ? "Y" : "N";
$arResult["UserSettings"] = $arFields;
if ($action == "create") {
$newID = 0;
$dbUserOptionsList = CUserOptions::GetList(array("ID" => "DESC"), array());
if ($arUserOptionTmp = $dbUserOptionsList->Fetch()) {
$newID = IntVal($arUserOptionTmp["ID"]);
}
$newID++;
} else {
$newID = $viewId;
CUserOptions::DeleteOption($userSettingsCategory, $userSettingsNamePart . $newID, true, $GLOBALS["USER"]->GetID());
CUserOptions::DeleteOption($userSettingsCategory, $userSettingsNamePart . $newID, false, $GLOBALS["USER"]->GetID());
}
CUserOptions::SetOption($userSettingsCategory, $userSettingsNamePart . $newID, $arFields, $_POST["COMMON"], $GLOBALS["USER"]->GetID());
$redirectPath = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TASKS"], array("owner_id" => $ownerId));
if (StrPos($redirectPath, "?") === false) {
$redirectPath .= "?user_settings_id=" . $newID;
} else {
$redirectPath .= "&user_settings_id=" . $newID;
}
LocalRedirect($redirectPath);
}
} else {
$arResult["ShowStep"] = 1;
$arResult["Templates"] = array();
foreach ($arUserTemplatesList as $arUserTemplate) {
$arUserTemplate["LINK"] = htmlspecialcharsbx($APPLICATION->GetCurPageParam("user_template_id=" . $arUserTemplate["NAME"], array("user_template_id")));
示例10: CAdminTabControl
$tabControl = new CAdminTabControl("tabControl", $aTabs);
$bFormValues = false;
$sSuccessMsg = "";
if($_REQUEST["action"] <> "" && $editable && check_freetrix_sessid())
{
if($_REQUEST["action"] == "clear")
{
CUserOptions::DeleteUsersOptions($USER->GetID());
$sSuccessMsg .= GetMessage("user_sett_mess_del")."<br>";
}
if($_REQUEST["action"] == "clear_links")
{
CUserOptions::DeleteOption("start_menu", "recent");
$sSuccessMsg .= GetMessage("user_sett_mess_links")."<br>";
}
if($_REQUEST["action"] == "clear_all" && $USER->CanDoOperation('edit_other_settings'))
{
CUserOptions::DeleteCommonOptions();
$sSuccessMsg .= GetMessage("user_sett_mess_del_common")."<br>";
}
if($_REQUEST["action"] == "clear_all_user" && $USER->CanDoOperation('edit_other_settings'))
{
CUserOptions::DeleteUsersOptions();
$sSuccessMsg .= GetMessage("user_sett_mess_del_user")."<br>";
}
if($sSuccessMsg <> "")
{
$_SESSION["ADMIN"]["USER_SETTINGS_MSG"] = $sSuccessMsg;
示例11: isset
$processedItemQty += isset($buildData['EFFECTIVE_ITEM_COUNT']) ? (int) $buildData['EFFECTIVE_ITEM_COUNT'] : 0;
$isFinal = false;
$progressData['PROCESSED_ITEMS'] = $processedItemQty;
$progressData['BUILD_DATA'] = $buildData;
} else {
$isFinal = $currentTypeIndex === $effectiveTypeQty - 1;
if (!$isFinal) {
$progressData['CURRENT_TYPE_INDEX'] = ++$currentTypeIndex;
unset($progressData['BUILD_DATA']);
}
}
if (!$isFinal) {
CUserOptions::SetOption('crm', '~dedupe_index_rebuild_progress', $progressData, false, $currentUserID);
__CrmDedupeListEndResonse(array('STATUS' => 'PROGRESS', 'PROCESSED_ITEMS' => $processedItemQty, 'SUMMARY' => GetMessage('CRM_DEDUPE_LIST_REBUILD_INDEX_PROGRESS_SUMMARY', array('#PROCESSED_ITEMS#' => $processedItemQty))));
} else {
CUserOptions::DeleteOption('crm', '~dedupe_index_rebuild_progress', false, $currentUserID);
__CrmDedupeListEndResonse(array('STATUS' => 'COMPLETED', 'PROCESSED_ITEMS' => $processedItemQty, 'SUMMARY' => GetMessage('CRM_DEDUPE_LIST_REBUILD_INDEX_COMPLETED_SUMMARY', array('#PROCESSED_ITEMS#' => $processedItemQty))));
}
} elseif ($action === 'GET_MERGE_COLLISIONS') {
$entityTypeName = isset($_POST['ENTITY_TYPE_NAME']) ? strtoupper($_POST['ENTITY_TYPE_NAME']) : '';
$entityTypeID = CCrmOwnerType::ResolveID($entityTypeName);
if ($entityTypeID === CCrmOwnerType::Undefined) {
__CrmDedupeListEndResonse(array('ERROR' => 'Entity type is not specified.'));
}
if ($entityTypeID !== CCrmOwnerType::Lead && $entityTypeID !== CCrmOwnerType::Contact && $entityTypeID !== CCrmOwnerType::Company) {
__CrmDedupeListEndResonse(array('ERROR' => "Entity type '{$entityTypeName}' is not supported in current context."));
}
$seedEntityID = isset($_POST['SEED_ENTITY_ID']) ? (int) $_POST['SEED_ENTITY_ID'] : 0;
if ($seedEntityID <= 0) {
__CrmDedupeListEndResonse(array('ERROR' => 'Seed entity ID is not is not specified.'));
}
示例12: elseif
$arField['SHOW_FILTER'] = 'N';
break;
}
if (!$strError) {
if ($arResult['NEW_FIELD']) {
$arResult['FIELD_ID'] = $arField['FIELD_NAME'] = $CCrmFields->GetNextFieldId();
$res = $CCrmFields->AddField($arField);
} else {
$res = $CCrmFields->UpdateField($arResult['FIELD']['ID'], $arField);
}
if ($res) {
//Save default value for 'SHOW_IN_LIST'
if ($arResult['NEW_FIELD']) {
$defaultShowInList = CUserOptions::GetOption('crm', 'uf_show_in_list', 'N');
if ($arField['SHOW_IN_LIST'] === 'N' && $defaultShowInList !== 'N') {
CUserOptions::DeleteOption('crm', 'uf_show_in_list');
} elseif ($arField['SHOW_IN_LIST'] === 'Y' && $defaultShowInList !== 'Y') {
CUserOptions::SetOption('crm', 'uf_show_in_list', 'Y');
}
}
//Register/Unregister fild in entity list -->
$gridID = CCrmGridOptions::GetDefaultGrigID(CCrmOwnerType::ResolveIDByUFEntityID($arResult['ENTITY_ID']));
if ($arField['SHOW_IN_LIST'] === 'Y') {
CCrmGridOptions::AddVisibleColumn($gridID, $arResult['FIELD_ID']);
} else {
CCrmGridOptions::RemoveVisibleColumn($gridID, $arResult['FIELD_ID']);
}
//<-- Register/Unregister fild in entity list
//Clear components cache
$GLOBALS['CACHE_MANAGER']->ClearByTag('crm_fields_list_' . $arResult['ENTITY_ID']);
//And go to proper page
示例13: define
define('NOT_CHECK_PERMISSIONS', true);
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';
if ($USER->IsAuthorized() && check_bitrix_sessid()) {
$guid = isset($_REQUEST['guid']) ? $_REQUEST['guid'] : '';
if ($guid === '') {
echo 'ERROR: GUID IS EMPTY.';
die;
}
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
if ($action == 'saveconfig') {
$options = CUserOptions::GetOption('crm.widget_panel', $guid, array());
CUtil::decodeURIComponent($_POST);
$options['rows'] = $_POST['rows'];
CUserOptions::SetOption('crm.widget_panel', $guid, $options);
} elseif ($action == 'enabledemo') {
$options = CUserOptions::GetOption('crm.widget_panel', $guid, array());
CUtil::decodeURIComponent($_POST);
$options['enableDemoMode'] = isset($_POST['enable']) && strtoupper($_POST['enable']) === 'Y' ? 'Y' : 'N';
CUserOptions::SetOption('crm.widget_panel', $guid, $options);
} elseif ($action == 'resetrows') {
$options = CUserOptions::GetOption('crm.widget_panel', $guid, array());
unset($options['rows']);
CUserOptions::SetOption('crm.widget_panel', $guid, $options);
} elseif ($action == 'resetconfig') {
CUserOptions::DeleteOption('crm.widget_panel', $guid);
} else {
echo 'ERROR: ACTION IS EMPTY OR NOT SUPPORTED.';
die;
}
}
echo 'OK';
示例14: executeManageDeleteMailbox
private static function executeManageDeleteMailbox(&$error)
{
$error = false;
$userId = $_REQUEST['USER_ID'];
if (!check_bitrix_sessid()) {
$error = GetMessage('INTR_MAIL_CSRF');
}
if ($error === false) {
$mailbox = CIntranetMailSetupHelper::getUserMailbox($userId);
if (empty($mailbox) || !in_array($mailbox['SERVER_TYPE'], array('controller', 'domain', 'crdomain'))) {
$error = GetMessage('INTR_MAIL_AJAX_ERROR');
}
}
if ($error === false) {
CMailbox::delete($mailbox['ID']);
list($login, $domain) = explode('@', $mailbox['LOGIN'], 2);
if ($mailbox['SERVER_TYPE'] == 'domain') {
$domainService = CIntranetMailSetupHelper::getDomainService($mailbox['SERVICE_ID']);
CMailDomain2::deleteUser($domainService['token'], $domain, $login);
} else {
if ($mailbox['SERVER_TYPE'] == 'crdomain') {
$crResponse = CControllerClient::ExecuteEvent('OnMailControllerDeleteMemberUser', array('DOMAIN' => $domain, 'NAME' => $login));
if (!isset($crResponse['result'])) {
$error = empty($crResponse['error']) ? GetMessage('INTR_MAIL_CONTROLLER_INVALID') : CMail::getErrorMessage($crResponse['error']);
}
} else {
if ($mailbox['SERVER_TYPE'] == 'controller') {
$crResponse = CControllerClient::ExecuteEvent('OnMailControllerDeleteUser', array('DOMAIN' => $domain, 'NAME' => $login));
if (!isset($crResponse['result'])) {
$error = empty($crResponse['error']) ? GetMessage('INTR_MAIL_CONTROLLER_INVALID') : CMail::getErrorMessage($crResponse['error']);
}
}
}
}
CUserCounter::Clear($userId, 'mail_unseen', $mailbox['LID']);
CUserOptions::DeleteOption('global', 'last_mail_check_' . $mailbox['LID']);
CUserOptions::DeleteOption('global', 'last_mail_check_success_' . $mailbox['LID']);
}
if ($error === false) {
$create = '<a href="#" onclick="mb.create(' . intval($userId) . '); return false; ">' . GetMessage('INTR_MAIL_MANAGE_CREATE') . '</a>';
}
return array('result' => $error === false ? 'ok' : 'error', 'create' => isset($create) ? CharsetConverter::ConvertCharset($create, SITE_CHARSET, 'UTF-8') : '', 'error' => CharsetConverter::ConvertCharset($error, SITE_CHARSET, 'UTF-8'));
}
示例15: Add
public function Add($arParams)
{
global $USER;
$res = null;
$calendar_id = $arParams['calendar_id'];
$calIblock = COption::GetOptionInt('intranet', 'iblock_calendar', null, $arParams['site_id']);
$calIblockSection = CEventCalendar::GetSectionIDByOwnerId($USER->GetID(), 'USER', $calIblock);
if (!$calendar_id) {
$calendar_id = CUserOptions::GetOption('timeman', 'default_calendar', 0);
}
if ($calIblockSection > 0) {
$arCalendars = CEventCalendar::GetCalendarList(array($calIblock, $calIblockSection, 0, 'USER'));
if (count($arCalendars) == 1) {
if ($calendar_id && $calendar_id != $arCalendars[0]['ID']) {
CUserOptions::DeleteOption('timeman', 'default_calendar');
}
$calendar_id = $arCalendars[0]['ID'];
} else {
$bCalendarFound = false;
$arCalsList = array();
foreach ($arCalendars as $cal) {
if ($cal['ID'] == $calendar_id) {
$bCalendarFound = true;
break;
}
$arCalsList[] = array('ID' => $cal['ID'], 'NAME' => $cal['NAME'], 'COLOR' => $cal['COLOR']);
}
if (!$bCalendarFound) {
$bReturnRes = true;
$res = array('error_id' => 'CHOOSE_CALENDAR', 'error' => array('TEXT' => GetMessage('TM_CALENDAR_CHOOSE'), 'CALENDARS' => $arCalsList));
}
}
}
if (!$bReturnRes) {
if (!$calIblockSection) {
$calIblockSection = 'none';
}
$today = CTimeMan::RemoveHoursTS(time());
$data = array('DATE_FROM' => $today + CTimeMan::MakeShortTS($arParams['from']), 'DATE_TO' => $today + CTimeMan::MakeShortTS($arParams['to']), 'NAME' => $arParams['name'], 'ABSENCE' => $arParams['absence'] == 'Y');
$obCalendar = new CEventCalendar();
$obCalendar->Init(array('ownerType' => 'USER', 'ownerId' => $USER->GetID(), 'bOwner' => true, 'iblockId' => $calIblock, 'bCache' => false));
$arPermissions = $obCalendar->GetPermissions(array('setProperties' => true));
$arRes = array('iblockId' => $obCalendar->iblockId, 'ownerType' => $obCalendar->ownerType, 'ownerId' => $obCalendar->ownerId, 'bNew' => true, 'fullUrl' => $obCalendar->fullUrl, 'userId' => $obCalendar->userId, 'pathToUserCalendar' => $obCalendar->pathToUserCalendar, 'pathToGroupCalendar' => $obCalendar->pathToGroupCalendar, 'userIblockId' => $obCalendar->userIblockId, 'calendarId' => $calendar_id, 'sectionId' => $calIblockSection, 'dateFrom' => ConvertTimeStamp($data['DATE_FROM'], 'FULL'), 'dateTo' => ConvertTimeStamp($data['DATE_TO'], 'FULL'), 'name' => $data['NAME'], 'desc' => '', 'prop' => array('ACCESSIBILITY' => $data['ABSENCE'] ? 'absent' : 'busy'), 'notDisplayCalendar' => true);
if ($GLOBALS['BX_TIMEMAN_RECENTLY_ADDED_EVENT_ID'] = $obCalendar->SaveEvent($arRes)) {
if ($_REQUEST['cal_set_default'] == 'Y') {
CUserOptions::SetOption('timeman', 'default_calendar', $calendar_id);
}
}
}
return $res;
}