本文整理汇总了PHP中COption::SetOptionInt方法的典型用法代码示例。如果您正苦于以下问题:PHP COption::SetOptionInt方法的具体用法?PHP COption::SetOptionInt怎么用?PHP COption::SetOptionInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COption
的用法示例。
在下文中一共展示了COption::SetOptionInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UnInstallDB
function UnInstallDB($arParams = array())
{
global $DB, $DBType, $APPLICATION;
$this->errors = false;
UnRegisterModuleDependences("main", "OnPageStart", "security", "CSecurityIPRule", "OnPageStart");
UnRegisterModuleDependences("main", "OnBeforeProlog", "security", "CSecurityFilter", "OnBeforeProlog");
UnRegisterModuleDependences("main", "OnEndBufferContent", "security", "CSecurityXSSDetect", "OnEndBufferContent");
UnRegisterModuleDependences("main", "OnBeforeUserLogin", "security", "CSecurityUser", "OnBeforeUserLogin");
UnRegisterModuleDependences("main", "OnUserDelete", "security", "CSecurityUser", "OnUserDelete");
UnRegisterModuleDependences("main", "OnEventLogGetAuditTypes", "security", "CSecurityFilter", "GetAuditTypes");
UnRegisterModuleDependences("main", "OnEventLogGetAuditTypes", "security", "CSecurityAntiVirus", "GetAuditTypes");
UnRegisterModuleDependences("main", "OnBeforeLocalRedirect", "security", "CSecurityRedirect", "BeforeLocalRedirect");
UnRegisterModuleDependences("main", "OnEndBufferContent", "security", "CSecurityRedirect", "EndBufferContent");
UnRegisterModuleDependences("main", "OnAdminInformerInsertItems", "security", "CSecurityFilter", "OnAdminInformerInsertItems");
UnRegisterModuleDependences("main", "OnAdminInformerInsertItems", "security", "CSecuritySiteChecker", "OnAdminInformerInsertItems");
COption::SetOptionString("main", "session_id_ttl", "60");
COption::SetOptionString("main", "use_session_id_ttl", "N");
COption::SetOptionInt("main", "session_id_ttl", 60);
COption::SetOptionString("security", "session", "N");
if (!array_key_exists("save_tables", $arParams) || $arParams["save_tables"] != "Y") {
$this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/security/install/db/" . strtolower($DB->type) . "/uninstall.sql");
$this->UnInstallTasks();
}
UnRegisterModule("security");
if ($this->errors !== false) {
$APPLICATION->ThrowException(implode("<br>", $this->errors));
return false;
}
return true;
}
示例2: SynchronizeUserPhones
public static function SynchronizeUserPhones()
{
$offset = intval(COption::GetOptionInt("voximplant", "sync_offset", 0));
$result = Bitrix\Main\UserTable::getList(array('select' => array('ID', 'WORK_PHONE', 'PERSONAL_PHONE', 'PERSONAL_MOBILE', 'UF_PHONE_INNER'), 'filter' => array('=Bitrix\\Voximplant\\Phone:USER.USER_ID' => 0), 'limit' => 100, 'offset' => $offset, 'order' => 'ID'));
$count = 0;
while ($user = $result->fetch()) {
$user["WORK_PHONE"] = CVoxImplantPhone::Normalize($user["WORK_PHONE"]);
if ($user["WORK_PHONE"]) {
VI\PhoneTable::add(array('USER_ID' => intval($user['ID']), 'PHONE_NUMBER' => $user["WORK_PHONE"], 'PHONE_MNEMONIC' => "WORK_PHONE"));
}
$user["PERSONAL_PHONE"] = CVoxImplantPhone::Normalize($user["PERSONAL_PHONE"]);
if ($user["PERSONAL_PHONE"]) {
VI\PhoneTable::add(array('USER_ID' => intval($user['ID']), 'PHONE_NUMBER' => $user["PERSONAL_PHONE"], 'PHONE_MNEMONIC' => "PERSONAL_PHONE"));
}
$user["PERSONAL_MOBILE"] = CVoxImplantPhone::Normalize($user["PERSONAL_MOBILE"]);
if ($user["PERSONAL_MOBILE"]) {
VI\PhoneTable::add(array('USER_ID' => intval($user['ID']), 'PHONE_NUMBER' => $user["PERSONAL_MOBILE"], 'PHONE_MNEMONIC' => "PERSONAL_MOBILE"));
}
$user["UF_PHONE_INNER"] = intval(preg_replace("/[^0-9]/i", "", $user["UF_PHONE_INNER"]));
if ($user["UF_PHONE_INNER"] > 0 && $user["UF_PHONE_INNER"] < 10000) {
VI\PhoneTable::add(array('USER_ID' => intval($user['ID']), 'PHONE_NUMBER' => $user["UF_PHONE_INNER"], 'PHONE_MNEMONIC' => "UF_PHONE_INNER"));
}
$count++;
}
if ($count > 0) {
$offset = $offset + 100;
COption::SetOptionInt("voximplant", "sync_offset", $offset);
return "CVoxImplantPhone::SynchronizeUserPhones();";
} else {
return false;
}
}
示例3: OnPostForm
//.........这里部分代码省略.........
}
}
function LocalGetPSActionParams($fileName)
{
$arPSCorrespondence = array();
if (file_exists($fileName) && is_file($fileName)) {
include $fileName;
}
return $arPSCorrespondence;
}
foreach ($paySystem as $pID => $value) {
foreach ($value as $personID) {
$arFields = array();
$arPaySysAction = "";
$dbPaySysAction = CSalePaySystemAction::GetList(array(), array("PAY_SYSTEM_ID" => $pID, "PERSON_TYPE_ID" => $personID));
if ($arPaySysAction = $dbPaySysAction->Fetch()) {
$pathToAction = $_SERVER["DOCUMENT_ROOT"] . $arPaySysAction["ACTION_FILE"];
} else {
$dbPaySysAction = CSalePaySystemAction::GetList(array(), array("PAY_SYSTEM_ID" => $pID));
if ($arPaySysActionTmp = $dbPaySysAction->Fetch()) {
$pathToAction = $_SERVER["DOCUMENT_ROOT"] . $arPaySysActionTmp["ACTION_FILE"];
}
}
if (strlen($pathToAction) > 0) {
$arPSCorrespondence = LocalGetPSActionParams($pathToAction . "/.description.php");
$arParams = array();
foreach ($arPSCorrespondence as $k => $v) {
$typeTmp = $arResult[$pID . "_" . $k . "_" . $personID];
$valueTmp = $arResult["VALUE1_" . $pID . "_" . $k . "_" . $personID];
if (strlen($valueTmp) <= 0) {
$valueTmp = $arResult["VALUE2_" . $pID . "_" . $k . "_" . $personID];
}
$arParams[$k] = array("TYPE" => $typeTmp, "VALUE" => $valueTmp);
}
$arFields = array("NEW_WINDOW" => $arResult["paySystemPopup"][$pID][$personID], "PARAMS" => CSalePaySystemAction::SerializeParams($arParams));
if (IntVal($arPaySysAction["ID"]) > 0) {
CSalePaySystemAction::Update($arPaySysAction["ID"], $arFields);
} else {
$arFields["PAY_SYSTEM_ID"] = $pID;
$arFields["PERSON_TYPE_ID"] = $personID;
$arFields["NAME"] = $arPaySysActionTmp["NAME"];
$arFields["ACTION_FILE"] = $arPaySysActionTmp["ACTION_FILE"];
$arFields["HAVE_PREPAY"] = "N";
$arFields["HAVE_RESULT"] = "N";
$arFields["HAVE_ACTION"] = "N";
$arFields["HAVE_PAYMENT"] = "N";
$arFields["HAVE_RESULT_RECEIVE"] = "N";
if (file_exists($pathToAction)) {
if (is_dir($pathToAction)) {
if (file_exists($pathToAction . "/pre_payment.php")) {
$arFields["HAVE_PREPAY"] = "Y";
}
if (file_exists($pathToAction . "/result.php")) {
$arFields["HAVE_RESULT"] = "Y";
}
if (file_exists($pathToAction . "/action.php")) {
$arFields["HAVE_ACTION"] = "Y";
}
if (file_exists($pathToAction . "/payment.php")) {
$arFields["HAVE_PAYMENT"] = "Y";
}
if (file_exists($pathToAction . "/result_rec.php")) {
$arFields["HAVE_RESULT_RECEIVE"] = "Y";
}
} else {
$arFields["HAVE_PAYMENT"] = "Y";
}
}
CSalePaySystemAction::Add($arFields);
}
}
}
}
COption::SetOptionInt("sale", "location", $arResult["location"], false, $arResult["siteID"]);
if (empty($arResult["delivery"])) {
$arResult["delivery"] = array();
}
$dbDelivery = CSaleDeliveryHandler::GetList(array("SORT" => "ASC"), array("SITE_ID" => $arResult["siteID"], "ACTIVE" => "Y"));
while ($arDelivery = $dbDelivery->Fetch()) {
if (!in_array($arDelivery["SID"] . "_new", $arResult["delivery"])) {
CSaleDeliveryHandler::Set($arDelivery["SID"], array("ACTIVE" => "N"));
}
}
$dbDelivery = CSaleDelivery::GetList(array("SORT" => "ASC"), array("LID" => $arResult["siteID"], "ACTIVE" => "Y"));
while ($arDelivery = $dbDelivery->Fetch()) {
if (!in_array($arDelivery["ID"], $arResult["delivery"])) {
CSaleDelivery::Update($arDelivery["ID"], array("ACTIVE" => "N"));
}
}
if (strlen($arResult["login"]) > 0) {
$arFields = array("LOGIN" => $arResult["login"], "PASSWORD" => $arResult["password"], "CONFIRM_PASSWORD" => $arResult["password_rep"], "EMAIL" => $arResult["email"]);
$user = new CUser();
$ID = $user->Add($arFields);
if (IntVal($ID) > 0) {
$sGroups = COption::GetOptionString("main", "new_user_registration_def_group", "");
CUser::SetUserGroup($ID, array_merge(explode(",", $sGroups), $arResult["1C_GROUP_PERMISSIONS"]));
}
}
}
}
示例4: ShowBackupStatus
$info = "Finished.\n\nData size: ".round($NS['data_size']/1024/1024, 2)." M\nArchive size: ".round($NS['arc_size']/1024/1024, 2)." M\nTime: ".(time() - START_TIME)." sec\n";
ShowBackupStatus($info);
CEventLog::Add(array(
"SEVERITY" => "WARNING",
"AUDIT_TYPE_ID" => "BACKUP_SUCCESS",
"MODULE_ID" => "main",
"ITEM_ID" => $NS['arc_name'],
"DESCRIPTION" => $info,
));
$NS = array();
if (defined('LOCK_FILE'))
unlink(LOCK_FILE) || RaiseErrorAndDie('Can\'t delete file: '.LOCK_FILE, 1000);
if (!CLI)
echo 'FINISH';
COption::SetOptionInt('main', 'last_backup_end_time', time());
##########################################
########################### Functions ####
function IntOption($name, $def = 0)
{
global $arParams;
if (isset($arParams[$name]))
return $arParams[$name];
static $CACHE;
$name .= '_auto';
if (!$CACHE[$name])
$CACHE[$name] = COption::GetOptionInt("main", $name, $def);
return $CACHE[$name];
}
示例5: GetMessage
for ($i = 0; $i < ${"propstypes_" . $siteList_ID[$j]["ID"] . "_count"}; $i++) {
if (strlen(${"propstypes_" . $siteList_ID[$j]["ID"] . "_" . $i . "_type"}) > 0) {
$arPT[${"propstypes_" . $siteList_ID[$j]["ID"] . "_" . $i . "_type"}] = ${"propstypes_" . $siteList_ID[$j]["ID"] . "_" . $i . "_name"};
}
}
if (strlen(${"propstypes_" . $siteList_ID[$j]["ID"] . "_new_type"}) > 0) {
$arPT[${"propstypes_" . $siteList_ID[$j]["ID"] . "_new_type"}] = ${"propstypes_" . $siteList_ID[$j]["ID"] . "_new_name"};
}
if (!CFileMan::SetPropstypes($arPT, false, $siteList_ID[$j]["ID"])) {
$addError .= GetMessage("FILEMAN_OPTION_ADD_ERROR_PROPS");
}
$j++;
}
} else {
COption::SetOptionString($module_id, "different_set", "N");
COption::SetOptionInt($module_id, "num_menu_param", $num_menu_param);
$armt = array();
$menutypes = "";
for ($i = 0; $i < $menutypes_count; $i++) {
if (strlen(${"menutypes_" . $i . "_type"}) > 0) {
$armt[${"menutypes_" . $i . "_type"}] = ${"menutypes_" . $i . "_name"};
}
}
if (strlen($menutypes_new_type) > 0 && $USER->CanDoOperation('fileman_edit_menu_types')) {
$armt[$menutypes_new_type] = $menutypes_new_name;
}
if (strlen(addslashes(serialize($armt))) <= 2000) {
SetMenuTypes($armt, $siteList_ID[$j]["ID"]);
} else {
$addError = GetMessage("FILEMAN_OPTION_ADD_ERROR_MENU") . '<br />';
}
示例6: elseif
} elseif ($NS['BUCKET_ID'] == -1) {
$l = GetMessage('DUMP_MAIN_BITRIX_CLOUD');
} else {
$l = GetMessage("MAIN_DUMP_LOCAL");
}
if ($l) {
$status_msg .= GetMessage("MAIN_DUMP_LOCATION") . ": <b>" . $l . "</b><br>";
}
}
if ($FinishedTables) {
$status_msg .= GetMessage("MAIN_DUMP_TABLE_FINISH") . " <b>" . $FinishedTables . "</b><br>";
}
if ($NS["cnt"]) {
$status_msg .= GetMessage("MAIN_DUMP_FILE_CNT") . " <b>" . $NS["cnt"] . "</b><br>";
if (IntOption("dump_file_public") && IntOption("dump_file_kernel")) {
COption::SetOptionInt("main", "last_files_count", $NS['cnt']);
}
}
if ($NS["data_size"]) {
$status_msg .= GetMessage("MAIN_DUMP_FILE_SIZE") . " <b>" . CFile::FormatSize($NS["data_size"]) . "</b><br>";
}
$status_msg .= GetMessage('TIME_SPENT') . ' <b>' . HumanTime($NS["time"]) . '</b>';
CAdminMessage::ShowMessage(array("MESSAGE" => $title, "DETAILS" => $status_msg, "TYPE" => "OK", "HTML" => true));
?>
<?php
echo bitrix_sessid_post();
?>
<script>
EndDump();
</script>
<?php
示例7: array
COption::SetOptionInt("main", "skip_symlinks", $_REQUEST['skip_symlinks'] == 'Y');
$bDumpCloud = false;
if ($arAllBucket = CBackup::GetBucketList())
{
foreach($arAllBucket as $arBucket)
{
if ($res = $_REQUEST['dump_cloud'][$arBucket['ID']] == 'Y')
$bDumpCloud = true;
COption::SetOptionInt('main', 'dump_cloud_'.$arBucket['ID'], $res);
}
}
COption::SetOptionInt("main", "dump_do_clouds", $bDumpCloud);
$skip_mask = $_REQUEST['skip_mask'] == 'Y';
COption::SetOptionInt("main", "skip_mask", $skip_mask);
$skip_mask_array = array();
if ($skip_mask && is_array($_REQUEST['arMask']))
{
$arMask = array_unique($_REQUEST['arMask']);
foreach($arMask as $mask)
if (trim($mask))
{
$mask = rtrim(str_replace('\\','/',trim($mask)),'/');
$skip_mask_array[] = $mask;
}
COption::SetOptionString("main", "skip_mask_array", serialize($skip_mask_array));
}
$NS["step"] = 1;
$NS['st_row'] = -1;
示例8: array
$aTabs = array(array("DIV" => "main", "TAB" => GetMessage("SEC_STATACT_MAIN_TAB"), "ICON" => "main_user_edit", "TITLE" => GetMessage("SEC_STATACT_MAIN_TAB_TITLE")), array("DIV" => "params", "TAB" => GetMessage("SEC_STATACT_PARAMS_TAB"), "ICON" => "main_user_edit", "TITLE" => GetMessage("SEC_STATACT_PARAMS_TAB_TITLE")));
$tabControl = new CAdminTabControl("tabControl", $aTabs, true, true);
$ID = intval($ID);
// Id of the edited record
$strError = "";
$bVarsFromForm = false;
$bShowForce = false;
if ($REQUEST_METHOD == "POST" && ($save || $apply || $DEFENCE_OFF || $DEFENCE_ON) && $RIGHT_W && check_bitrix_sessid()) {
if (array_key_exists("DEFENCE_OFF", $_POST)) {
COption::SetOptionString($module_id, "DEFENCE_ON", "N");
} elseif (array_key_exists("DEFENCE_ON", $_POST)) {
COption::SetOptionString($module_id, "DEFENCE_ON", "Y");
}
COption::SetOptionInt($module_id, "DEFENCE_STACK_TIME", $DEFENCE_STACK_TIME);
COption::SetOptionInt($module_id, "DEFENCE_MAX_STACK_HITS", $DEFENCE_MAX_STACK_HITS);
COption::SetOptionInt($module_id, "DEFENCE_DELAY", $DEFENCE_DELAY);
COption::SetOptionString($module_id, "DEFENCE_LOG", $DEFENCE_LOG === "Y" ? "Y" : "N");
if ($save != "" && $_GET["return_url"] != "") {
LocalRedirect($_GET["return_url"]);
}
LocalRedirect("/bitrix/admin/security_stat_activity.php?lang=" . LANGUAGE_ID . ($return_url ? "&return_url=" . urlencode($_GET["return_url"]) : "") . "&" . $tabControl->ActiveTabParam());
}
$DEFENCE_ON = COption::GetOptionString($module_id, "DEFENCE_ON");
$DEFENCE_STACK_TIME = COption::GetOptionString($module_id, "DEFENCE_STACK_TIME");
$DEFENCE_MAX_STACK_HITS = COption::GetOptionString($module_id, "DEFENCE_MAX_STACK_HITS");
$DEFENCE_DELAY = COption::GetOptionString($module_id, "DEFENCE_DELAY");
$DEFENCE_LOG = COption::GetOptionString($module_id, "DEFENCE_LOG");
$messageDetails = "";
if (COption::GetOptionString($module_id, "DEFENCE_ON") === "Y") {
$messageType = "OK";
$messageText = GetMessage("SEC_STATACT_ON");
示例9: SetLinkCheckCrm
public static function SetLinkCheckCrm($active)
{
$active = $active ? true : false;
return COption::SetOptionInt("voximplant", "link_check_crm", $active);
}
示例10: array
$aTabs = array(array("DIV" => "main", "TAB" => GetMessage("SEC_FILTER_MAIN_TAB"), "ICON" => "main_user_edit", "TITLE" => GetMessage("SEC_FILTER_MAIN_TAB_TITLE")), array("DIV" => "params", "TAB" => GetMessage("SEC_FILTER_PARAMETERS_TAB"), "ICON" => "main_user_edit", "TITLE" => GetMessage("SEC_FILTER_PARAMETERS_TAB_TITLE")), array("DIV" => "exceptions", "TAB" => GetMessage("SEC_FILTER_EXCEPTIONS_TAB"), "ICON" => "main_user_edit", "TITLE" => GetMessage("SEC_FILTER_EXCEPTIONS_TAB_TITLE")));
$tabControl = new CAdminTabControl("tabControl", $aTabs, true, true);
$bVarsFromForm = false;
if ($_SERVER["REQUEST_METHOD"] == "POST" && $_REQUEST["save"] . $_REQUEST["apply"] . $_REQUEST["filter_siteb"] != "" && $canWrite && check_bitrix_sessid()) {
if ($_REQUEST["filter_siteb"] != "") {
CSecurityFilter::SetActive($_POST["filter_active"] === "Y");
}
if ($_POST["filter_action"] === "clear") {
COption::SetOptionString("security", "filter_action", "clear");
} elseif ($_POST["filter_action"] === "none") {
COption::SetOptionString("security", "filter_action", "none");
} else {
COption::SetOptionString("security", "filter_action", "filter");
}
COption::SetOptionString("security", "filter_stop", $_POST["filter_stop"] === "Y" ? "Y" : "N");
COption::SetOptionInt("security", "filter_duration", $_POST["filter_duration"]);
COption::SetOptionString("security", "filter_log", $_POST["filter_log"] === "Y" ? "Y" : "N");
CSecurityFilterMask::Update($_POST["FILTER_MASKS"]);
if ($_REQUEST["save"] != "" && $_GET["return_url"] != "") {
LocalRedirect($_GET["return_url"]);
}
$returnUrl = $_GET["return_url"] ? "&return_url=" . urlencode($_GET["return_url"]) : "";
LocalRedirect("/bitrix/admin/security_filter.php?lang=" . LANGUAGE_ID . $returnUrl . "&" . $tabControl->ActiveTabParam());
}
$rsSecurityFilterExclMask = CSecurityFilterMask::GetList();
if ($rsSecurityFilterExclMask->Fetch()) {
$bSecurityFilterExcl = true;
} else {
$bSecurityFilterExcl = false;
}
$messageDetails = "";
示例11: array_shift
?>
<script>setTimeout("Optimize('a|<?php
echo CUtil::JSEscape($arTable["Name"]);
?>
')", 100);</script><?php
} else {
$arTable = array_shift($arTables);
CAdminMessage::ShowMessage(array("MESSAGE" => htmlspecialcharsbx($arTable["Name"]), "TYPE" => "PROGRESS", "PROGRESS_VALUE" => $tables_count - count($arTables), "PROGRESS_TOTAL" => $tables_count, "HTML" => true, "DETAILS" => GetMessage("RDB_OPTIMIZE_PROGRESS", array("#done#" => $tables_count - count($arTables), "#todo#" => $tables_count)) . "#PROGRESS_BAR#"));
?>
<script>setTimeout("Optimize('<?php
echo CUtil::JSEscape($arTable["Name"]);
?>
')", 100);</script><?php
}
} else {
COption::SetOptionInt("main", "LAST_DB_OPTIMIZATION_TIME", time());
CAdminMessage::ShowMessage(array("MESSAGE" => GetMessage("RDB_OPTIMIZE_DONE"), "TYPE" => "OK", "HTML" => true, "DETAILS" => GetMessage("RDB_OPTIMIZE_ALL_DONE")));
?>
<script>
document.getElementById('opt_start').disabled = false;
document.getElementById('opt_pause').disabled = true;
document.getElementById('opt_continue').disabled = true;
</script>
<?php
}
} else {
CAdminMessage::ShowMessage(array("MESSAGE" => GetMessage("RDB_OPTIMIZE_ERROR"), "TYPE" => "ERROR", "HTML" => true, "DETAILS" => GetMessage("RDB_OPTIMIZE_TABLE_NOT_FOUND")));
}
}
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin_js.php";
示例12: intval
$name = $arAllOptionsGroupsGender[$i][0]."_".$arSite["ID"];
$arPICTURE = $HTTP_POST_FILES[$name];
$arPICTURE["del"] = ${$name."_del"};
$arPICTURE["MODULE_ID"] = "socialnetwork";
if ($old_fid = COption::GetOptionInt("socialnetwork", $arAllOptionsGroupsGender[$i][0], false, $arSite["ID"]))
$arPICTURE["old_file"] = $old_fid;
$checkRes = CFile::CheckImageFile($arPICTURE, 0, 0, 0);
if (strlen($checkRes) <= 0)
{
$fid = CFile::SaveFile($arPICTURE, "socialnetwork");
if ($arPICTURE["del"] == "Y" || strlen($HTTP_POST_FILES[$name]["name"]) > 0)
COption::SetOptionInt("socialnetwork", $arAllOptionsGroupsGender[$i][0], intval($fid), $arAllOptionsGroupsGender[$i][1], $arSite["ID"]);
}
else
CAdminMessage::ShowMessage($checkRes);
}
}
if ($bFriendsDisabledForAllSites)
{
if (CBXFeatures::IsFeatureEnabled("Friends"))
CBXFeatures::SetFeatureEnabled("Friends", false, false);
}
elseif($bFriendsEnabledForAnySite && CBXFeatures::IsFeatureEditable("Friends"))
{
if (!CBXFeatures::IsFeatureEnabled("Friends"))
CBXFeatures::SetFeatureEnabled("Friends", true, false);
示例13: SetStorageId
public static function SetStorageId($id)
{
$id = intval($id);
if ($id <= 0) {
return false;
}
$oldId = self::GetStorageId();
if ($oldId > 0 && $oldId != $id) {
global $DB;
$DB->Query("UPDATE b_im_chat SET DISK_FOLDER_ID = 0");
$DB->Query("DELETE FROM b_im_message_param WHERE PARAM_NAME = 'FILE_ID'");
}
COption::SetOptionInt('im', 'disk_storage_id', $id);
return true;
}
示例14: GetAnonymousUserID
/**
* Creates new anonymous user with e-mail 'anonymous_some_number@example.com' and returns his ID
* Used mainly in CRM
*
* @return int - new user ID or ID of already existing anonymous user, 0 if error
*/
public static function GetAnonymousUserID()
{
$bUserExists = false;
$anonUserID = intval(COption::GetOptionInt("sale", "anonymous_user_id", 0));
if ($anonUserID > 0) {
$by = "id";
$order = "asc";
$dbUser = CUser::GetList($by, $order, array("ID_EQUAL_EXACT" => $anonUserID), array("FIELDS" => array("ID")));
if ($arUser = $dbUser->Fetch()) {
$bUserExists = true;
}
}
if (!$bUserExists) {
$anonUserEmail = "anonymous_" . randString(9) . "@example.com";
$arErrors = array();
$anonUserID = CSaleUser::DoAutoRegisterUser($anonUserEmail, array("NAME" => Loc::getMessage("SU_ANONYMOUS_USER_NAME")), SITE_ID, $arErrors, array("ACTIVE" => "N"));
if ($anonUserID > 0) {
COption::SetOptionInt("sale", "anonymous_user_id", $anonUserID);
} else {
$errorMessage = "";
if (!empty($arErrors)) {
$errorMessage = " ";
foreach ($arErrors as $value) {
$errorMessage .= $value["TEXT"] . "<br>";
}
}
$GLOBALS["APPLICATION"]->ThrowException(Loc::getMessage("SU_ANONYMOUS_USER_CREATE", array("#ERROR#" => $errorMessage)), "ANONYMOUS_USER_CREATE_ERROR");
return 0;
}
}
return $anonUserID;
}
示例15: GetActiveCount
function GetActiveCount()
{
$c = COption::GetOptionInt("security", "iprules_count", -1);
if ($c < 0) {
global $DB;
$rs = $DB->Query("SELECT count(*) CNT FROM b_sec_iprule WHERE ACTIVE='Y'");
$ar = $rs->Fetch();
COption::SetOptionInt("security", "iprules_count", $ar["CNT"]);
$c = COption::GetOptionInt("security", "iprules_count", -1);
}
return $c;
}