示例#1
0
 function SetUserGroups($arGroups)
 {
     if (!is_array($arGroups)) {
         return;
     }
     foreach ($arGroups as $groupID) {
         $groupID = intval($groupID);
         $rsGroup = CGroup::GetByID($groupID);
         if (!$rsGroup->Fetch()) {
             continue;
         }
         if (!is_array($this->userGroups)) {
             $this->userGroups = array();
         }
         $this->userGroups[] = $groupID;
     }
 }
示例#2
0
    die;
}
global $DBType;
require_once $_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/classes/" . strtolower($DBType) . "/favorites.php";
__IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", "/" . basename(__FILE__)));
//Change site name
$obSite = new CSite();
$obSite->Update("s1", array("NAME" => COption::GetOptionString("main", "site_name", GetMessage("DEFAULT_SITE_NAME"))));
//Edit profile task
$editProfileTask = false;
$dbResult = CTask::GetList(array(), array("NAME" => "main_change_profile"));
if ($arTask = $dbResult->Fetch()) {
    $editProfileTask = $arTask["ID"];
}
//admin security policy
$z = CGroup::GetByID(1);
if ($res = $z->Fetch()) {
    if ($res["SECURITY_POLICY"] == "") {
        $group = new CGroup();
        $arGroupPolicy = array("SESSION_TIMEOUT" => 15, "SESSION_IP_MASK" => "255.255.255.255", "MAX_STORE_NUM" => 1, "STORE_IP_MASK" => "255.255.255.255", "STORE_TIMEOUT" => 60 * 24 * 3, "CHECKWORD_TIMEOUT" => 60, "PASSWORD_LENGTH" => 10, "PASSWORD_UPPERCASE" => "Y", "PASSWORD_LOWERCASE" => "Y", "PASSWORD_DIGITS" => "Y", "PASSWORD_PUNCTUATION" => "Y", "LOGIN_ATTEMPTS" => 3);
        $arFields = array("SECURITY_POLICY" => serialize($arGroupPolicy));
        $group->Update(1, $arFields);
    }
}
//Registered users group
$dbResult = CGroup::GetList($by, $order, array("STRING_ID" => "REGISTERED_USERS"));
if ($dbResult->Fetch()) {
    return;
}
$group = new CGroup();
$arFields = array("ACTIVE" => "Y", "C_SORT" => 3, "NAME" => GetMessage("REGISTERED_GROUP_NAME"), "STRING_ID" => "REGISTERED_USERS");
示例#3
0
文件: index.php 项目: ASDAFF/bitrix-5
 function InstallDB()
 {
     /** @global string $DBType */
     global $DB, $DBType, $DBHost, $DBLogin, $DBPassword, $DBName, $APPLICATION;
     if (!is_object($APPLICATION)) {
         $APPLICATION = new CMain();
     }
     $DB = new CDatabase();
     $DB->DebugToFile = false;
     $DB->debug = true;
     if (!defined("DBPersistent")) {
         define("DBPersistent", false);
     }
     if (!$DB->Connect($DBHost, $DBName, $DBLogin, $DBPassword)) {
         $APPLICATION->ThrowException(GetMessage("MAIN_INSTALL_DB_ERROR"));
         return false;
     }
     $result = $DB->Query("SELECT * FROM b_module WHERE ID='main'", true, "", array("fixed_connection" => true));
     $success = $result && $result->Fetch();
     if ($success) {
         return true;
     }
     if ($DBType == "mysql" && defined("MYSQL_TABLE_TYPE") && strlen(MYSQL_TABLE_TYPE) > 0) {
         $DB->Query("SET storage_engine = '" . MYSQL_TABLE_TYPE . "'", true);
     }
     $errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/install/" . $DBType . "/install.sql");
     if ($errors !== false) {
         $APPLICATION->ThrowException(implode("", $errors));
         return false;
     }
     $this->InstallTasks();
     $group = new CGroup();
     $arGroups = array(array("~ID" => 1, "ACTIVE" => "Y", "C_SORT" => 1, "NAME" => GetMessage("MAIN_ADMIN_GROUP_NAME"), "ANONYMOUS" => "N", "DESCRIPTION" => GetMessage("MAIN_ADMIN_GROUP_DESC")), array("~ID" => 2, "ACTIVE" => "Y", "C_SORT" => 2, "NAME" => GetMessage("MAIN_EVERYONE_GROUP_NAME"), "ANONYMOUS" => "Y", "DESCRIPTION" => GetMessage("MAIN_EVERYONE_GROUP_DESC")), array("~ID" => 3, "ACTIVE" => "Y", "C_SORT" => 3, "NAME" => GetMessage("MAIN_VOTE_RATING_GROUP_NAME"), "ANONYMOUS" => "N", "DESCRIPTION" => GetMessage("MAIN_VOTE_RATING_GROUP_DESC"), "STRING_ID" => "RATING_VOTE"), array("~ID" => 4, "ACTIVE" => "Y", "C_SORT" => 4, "NAME" => GetMessage("MAIN_VOTE_AUTHORITY_GROUP_NAME"), "ANONYMOUS" => "N", "DESCRIPTION" => GetMessage("MAIN_VOTE_AUTHORITY_GROUP_DESC"), "STRING_ID" => "RATING_VOTE_AUTHORITY"));
     foreach ($arGroups as $arGroup) {
         $rsGroup = CGroup::GetByID($arGroup["~ID"]);
         if ($rsGroup->Fetch()) {
             continue;
         }
         //mssql does not allow insert identity by default
         if (strtolower($DB->type) == "mssql") {
             unset($arGroup["~ID"]);
         }
         $success = (bool) $group->Add($arGroup);
         if (!$success) {
             $APPLICATION->ThrowException($group->LAST_ERROR);
             return false;
         }
     }
     self::InstallRatings();
     $arLanguages = array(array("LID" => LANGUAGE_ID, "ACTIVE" => "Y", "SORT" => 1, "DEF" => "Y", "NAME" => GetMessage("MAIN_DEFAULT_LANGUAGE_NAME"), "FORMAT_DATE" => GetMessage("MAIN_DEFAULT_LANGUAGE_FORMAT_DATE"), "FORMAT_DATETIME" => GetMessage("MAIN_DEFAULT_LANGUAGE_FORMAT_DATETIME"), "FORMAT_NAME" => GetMessage("MAIN_DEFAULT_LANGUAGE_FORMAT_NAME"), "CHARSET" => defined("BX_UTF") ? "UTF-8" : GetMessage("MAIN_DEFAULT_LANGUAGE_FORMAT_CHARSET")));
     if (LANGUAGE_ID != "en") {
         $arLanguages[] = array("LID" => "en", "ACTIVE" => "Y", "SORT" => 2, "DEF" => "N", "NAME" => "English", "FORMAT_DATE" => "MM/DD/YYYY", "FORMAT_DATETIME" => "MM/DD/YYYY H:MI:SS T", "FORMAT_NAME" => "#NAME# #LAST_NAME#", "CHARSET" => defined("BX_UTF") ? "UTF-8" : "iso-8859-1");
     }
     if (LANGUAGE_ID != "de" && file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/lang/de/install/index.php')) {
         $arLanguages[] = array("LID" => "de", "ACTIVE" => "Y", "SORT" => 3, "DEF" => "N", "NAME" => "German", "FORMAT_DATE" => "DD.MM.YYYY", "FORMAT_DATETIME" => "DD.MM.YYYY HH:MI:SS", "FORMAT_NAME" => "#NAME# #LAST_NAME#", "CHARSET" => defined("BX_UTF") ? "UTF-8" : "iso-8859-1");
     }
     if (LANGUAGE_ID != "ru" && file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/lang/ru/install/index.php')) {
         $arLanguages[] = array("LID" => "ru", "ACTIVE" => "Y", "SORT" => 3, "DEF" => "N", "NAME" => "Russian", "FORMAT_DATE" => "DD.MM.YYYY", "FORMAT_DATETIME" => "DD.MM.YYYY HH:MI:SS", "FORMAT_NAME" => "#NAME# #LAST_NAME#", "CHARSET" => defined("BX_UTF") ? "UTF-8" : "windows-1251");
     }
     $lang = new CLanguage();
     foreach ($arLanguages as $arLanguage) {
         $rsLang = CLanguage::GetByID($arLanguage["LID"]);
         if ($rsLang->Fetch()) {
             continue;
         }
         $success = (bool) $lang->Add($arLanguage);
         if (!$success) {
             $APPLICATION->ThrowException($lang->LAST_ERROR);
             return false;
         }
     }
     $arSite = array("LID" => "s1", "ACTIVE" => "Y", "SORT" => 1, "DEF" => "Y", "NAME" => GetMessage("MAIN_DEFAULT_SITE_NAME"), "DIR" => "/", "FORMAT_DATE" => GetMessage("MAIN_DEFAULT_SITE_FORMAT_DATE"), "FORMAT_DATETIME" => GetMessage("MAIN_DEFAULT_SITE_FORMAT_DATETIME"), "FORMAT_NAME" => GetMessage("MAIN_DEFAULT_SITE_FORMAT_NAME"), "CHARSET" => defined("BX_UTF") ? "UTF-8" : GetMessage("MAIN_DEFAULT_SITE_FORMAT_CHARSET"), "LANGUAGE_ID" => LANGUAGE_ID);
     $rsSites = CSite::GetByID($arSite["LID"]);
     if (!$rsSites->Fetch()) {
         $site = new CSite();
         $success = (bool) $site->Add($arSite);
         if (!$success) {
             $APPLICATION->ThrowException($site->LAST_ERROR);
             return false;
         }
     }
     RegisterModule("main");
     RegisterModuleDependences('iblock', 'OnIBlockPropertyBuildList', 'main', 'CIBlockPropertyUserID', 'GetUserTypeDescription', 100, '/modules/main/tools/prop_userid.php');
     RegisterModuleDependences('main', 'OnUserDelete', 'main', 'CFavorites', 'OnUserDelete', 100, "/modules/main/classes/" . strtolower($GLOBALS["DB"]->type) . "/favorites.php");
     RegisterModuleDependences('main', 'OnLanguageDelete', 'main', 'CFavorites', 'OnLanguageDelete', 100, "/modules/main/classes/" . strtolower($GLOBALS["DB"]->type) . "/favorites.php");
     RegisterModuleDependences('main', 'OnUserDelete', 'main', 'CUserOptions', 'OnUserDelete');
     RegisterModuleDependences('main', 'OnChangeFile', 'main', 'CMain', 'OnChangeFileComponent');
     RegisterModuleDependences('main', 'OnUserTypeRightsCheck', 'main', 'CUser', 'UserTypeRightsCheck');
     RegisterModuleDependences('main', 'OnUserLogin', 'main', 'UpdateTools', 'CheckUpdates');
     RegisterModuleDependences('main', 'OnModuleUpdate', 'main', 'UpdateTools', 'SetUpdateResult');
     RegisterModuleDependences('main', 'OnUpdateCheck', 'main', 'UpdateTools', 'SetUpdateError');
     RegisterModuleDependences('main', 'OnPanelCreate', 'main', 'CUndo', 'CheckNotifyMessage');
     RegisterModuleDependences('main', 'OnAfterAddRating', 'main', 'CRatingsComponentsMain', 'OnAfterAddRating');
     RegisterModuleDependences('main', 'OnAfterUpdateRating', 'main', 'CRatingsComponentsMain', 'OnAfterUpdateRating');
     RegisterModuleDependences('main', 'OnSetRatingsConfigs', 'main', 'CRatingsComponentsMain', 'OnSetRatingConfigs');
     RegisterModuleDependences('main', 'OnGetRatingsConfigs', 'main', 'CRatingsComponentsMain', 'OnGetRatingConfigs');
     RegisterModuleDependences('main', 'OnGetRatingsObjects', 'main', 'CRatingsComponentsMain', 'OnGetRatingObject');
     RegisterModuleDependences('main', 'OnGetRatingContentOwner', 'main', 'CRatingsComponentsMain', 'OnGetRatingContentOwner');
     RegisterModuleDependences('main', 'OnAfterAddRatingRule', 'main', 'CRatingRulesMain', 'OnAfterAddRatingRule');
     RegisterModuleDependences('main', 'OnAfterUpdateRatingRule', 'main', 'CRatingRulesMain', 'OnAfterUpdateRatingRule');
     RegisterModuleDependences('main', 'OnGetRatingRuleObjects', 'main', 'CRatingRulesMain', 'OnGetRatingRuleObjects');
     RegisterModuleDependences('main', 'OnGetRatingRuleConfigs', 'main', 'CRatingRulesMain', 'OnGetRatingRuleConfigs');
     RegisterModuleDependences('main', 'OnAfterUserAdd', 'main', 'CRatings', 'OnAfterUserRegister');
     RegisterModuleDependences('main', 'OnUserDelete', 'main', 'CRatings', 'OnUserDelete');
     RegisterModuleDependences('main', 'OnUserDelete', 'main', 'CAccess', 'OnUserDelete');
     RegisterModuleDependences('main', 'OnAfterGroupAdd', 'main', 'CGroupAuthProvider', 'OnAfterGroupAdd');
     RegisterModuleDependences('main', 'OnBeforeGroupUpdate', 'main', 'CGroupAuthProvider', 'OnBeforeGroupUpdate');
     RegisterModuleDependences('main', 'OnBeforeGroupDelete', 'main', 'CGroupAuthProvider', 'OnBeforeGroupDelete');
     RegisterModuleDependences('main', 'OnAfterUserUpdate', 'main', 'CGroupAuthProvider', 'OnAfterUserUpdate');
     RegisterModuleDependences('main', 'OnUserLogin', 'main', 'CGroupAuthProvider', 'OnUserLogin');
     RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "main", "CEventMain", "GetAuditTypes");
     RegisterModuleDependences("main", "OnEventLogGetAuditHandlers", "main", "CEventMain", "MakeMainObject");
     RegisterModuleDependences("perfmon", "OnGetTableSchema", "main", "CTableSchema", "OnGetTableSchema");
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeString", "GetUserTypeDescription", 110);
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeInteger", "GetUserTypeDescription", 120);
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeDouble", "GetUserTypeDescription", 130);
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeDateTime", "GetUserTypeDescription", 140);
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeBoolean", "GetUserTypeDescription", 150);
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeFile", "GetUserTypeDescription", 160);
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeEnum", "GetUserTypeDescription", 170);
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeIBlockSection", "GetUserTypeDescription", 180);
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeIBlockElement", "GetUserTypeDescription", 190);
     RegisterModuleDependences("main", "OnUserTypeBuildList", "main", "CUserTypeStringFormatted", "GetUserTypeDescription", 200);
     COption::SetOptionString('main', 'auth_comp2', 'Y');
     COption::SetOptionString("main", "PARAM_MAX_SITES", "2");
     COption::SetOptionString("main", "PARAM_MAX_USERS", "0");
     COption::SetOptionString("main", "distributive6", "Y");
     COption::SetOptionString("main", "~new_license11_sign", "Y");
     COption::SetOptionString("main", "GROUP_DEFAULT_TASK", "1");
     if (LANGUAGE_ID == "ru") {
         COption::SetOptionString("main", "vendor", "1c_bitrix");
     } else {
         COption::SetOptionString("main", "vendor", "bitrix");
     }
     COption::SetOptionString("main", "admin_lid", LANGUAGE_ID);
     COption::SetOptionString("main", "update_site", "www.bitrixsoft.com");
     COption::SetOptionString("main", "update_site_ns", "Y");
     COption::SetOptionString("main", "optimize_css_files", "Y");
     COption::SetOptionString("main", "optimize_js_files", "Y");
     CAgent::AddAgent("CEvent::CleanUpAgent();", "main", "Y", 86400);
     CAgent::AddAgent("CUser::CleanUpHitAuthAgent();", "main", "Y", 86400);
     CAgent::AddAgent("CCaptchaAgent::DeleteOldCaptcha(3600);", "main", "N", 3600);
     CAgent::AddAgent("CUndo::CleanUpOld();", "main", "Y", 86400);
     self::InstallDesktop();
     self::InstallSmiles();
     return true;
 }
         case "minute":
             $str .= __PrintRussian($f_RESPONSE_TIME, array(GetMessage("SUP_MINUTE_1"), GetMessage("SUP_MINUTE_3"), GetMessage("SUP_MINUTE_5")));
             break;
         case "day":
             $str .= __PrintRussian($f_RESPONSE_TIME, array(GetMessage("SUP_DAY_1"), GetMessage("SUP_DAY_3"), GetMessage("SUP_DAY_5")));
             break;
     }
 } else {
     $str .= "<nobr>" . GetMessage("SUP_NO_LIMITS") . "</nobr>";
 }
 $row->AddViewField("RESPONSE_TIME", $str);
 $str = "";
 $arG = CTicketSLA::GetGroupArray($f_ID);
 foreach ($arG as $gid) {
     if (!is_array($arGROUPS) || !in_array($gid, array_keys($arGROUPS))) {
         $rs = CGroup::GetByID($gid);
         if ($ar = $rs->Fetch()) {
             $arGROUPS[$gid] = $ar["NAME"];
         }
     }
     $str .= '[<a title="' . GetMessage("MAIN_ADMIN_MENU_EDIT") . '" href="/bitrix/admin/group_edit.php?ID=' . $gid . '&lang=' . LANG . '">' . $gid . '</a>] ' . htmlspecialcharsbx($arGROUPS[$gid]) . '<br>';
 }
 $row->AddViewField("GROUP_ID", $str);
 $str = "&nbsp;";
 if (intval($f_RESPONSIBLE_USER_ID) > 0) {
     Support_GetUserInfo($f_RESPONSIBLE_USER_ID, $f_RESPONSIBLE_LOGIN, $f_RESPONSIBLE_NAME);
     $str = '[<a title="' . GetMessage("SUP_USER_PROFILE") . '" href="/bitrix/admin/user_edit.php?lang=' . LANG . '&ID=' . $f_RESPONSIBLE_USER_ID . '">' . $f_RESPONSIBLE_USER_ID . '</a>] (' . $f_RESPONSIBLE_LOGIN . ') ' . $f_RESPONSIBLE_NAME;
 }
 $row->AddViewField("RESPONSIBLE_USER_ID", $str);
 $arActions = array();
 $arActions[] = array("ICON" => "edit", "DEFAULT" => "Y", "TEXT" => GetMessage("SUP_EDIT"), "ACTION" => $lAdmin->ActionRedirect($EDIT_URL . "?lang=" . LANGUAGE_ID . "&ID=" . $f_ID));
 public static function fillFilterReferenceColumn(&$filterElement, Entity\ReferenceField $field)
 {
     if ($field->getRefEntityName() == '\\Bitrix\\Main\\User') {
         // USER
         if ($filterElement['value']) {
             $res = CUser::GetByID($filterElement['value']);
             $user = $res->fetch();
             if ($user) {
                 $username = CUser::FormatName(CSite::GetNameFormat(null, self::getDefaultSiteId()), $user, true, false);
                 $filterElement['value'] = array('id' => $user['ID'], 'name' => $username);
             } else {
                 $filterElement['value'] = array('id' => $filterElement['value'], 'name' => GetMessage('REPORT_USER_NOT_FOUND'));
             }
         } else {
             $filterElement['value'] = array('id' => '');
         }
     } else {
         if ($field->getRefEntityName() == '\\Bitrix\\Main\\Group') {
             // GROUP
             if ($filterElement['value']) {
                 $res = CGroup::GetByID($filterElement['value']);
                 $group = $res->fetch();
                 if ($group) {
                     $filterElement['value'] = array('id' => $group['ID'], 'name' => $group['NAME']);
                 } else {
                     $filterElement['value'] = array('id' => $filterElement['value'], 'name' => GetMessage('SALE_REPORT_GROUP_NOT_FOUND'));
                 }
             } else {
                 $filterElement['value'] = array('id' => '');
             }
         }
     }
 }
示例#6
0
 case "USER_GROUP_CHANGED":
     if (!array_key_exists($a_ITEM_ID, $arUsersCache)) {
         $rsUser = CUser::GetByID($a_ITEM_ID);
         if ($arUser = $rsUser->GetNext()) {
             $arUser["FULL_NAME"] = $arUser["NAME"] . (strlen($arUser["NAME"]) <= 0 || strlen($arUser["LAST_NAME"]) <= 0 ? "" : " ") . $arUser["LAST_NAME"];
         }
         $arUsersCache[$a_ITEM_ID] = $arUser;
     }
     if ($arUsersCache[$a_ITEM_ID]) {
         $row->AddViewField("ITEM_ID", '[<a href="user_edit.php?lang=' . LANG . '&amp;ID=' . $a_ITEM_ID . '">' . $a_ITEM_ID . '</a>] ' . $arUsersCache[$a_ITEM_ID]["FULL_NAME"]);
     }
     break;
 case "GROUP_POLICY_CHANGED":
 case "MODULE_RIGHTS_CHANGED":
     if (!array_key_exists($a_ITEM_ID, $arGroupsCache)) {
         $rsGroup = CGroup::GetByID($a_ITEM_ID);
         if ($arGroup = $rsGroup->GetNext()) {
             $arGroupsCache[$a_ITEM_ID] = $arGroup["NAME"];
         } else {
             $arGroupsCache[$a_ITEM_ID] = "";
         }
     }
     $row->AddViewField("ITEM_ID", '[<a href="group_edit.php?lang=' . LANG . '&amp;ID=' . $a_ITEM_ID . '">' . $a_ITEM_ID . '</a>] ' . $arGroupsCache[$a_ITEM_ID]);
     break;
 case "TASK_CHANGED":
     $rsTask = CTask::GetByID($a_ITEM_ID);
     if ($arTask = $rsTask->GetNext()) {
         $row->AddViewField("ITEM_ID", '[<a href="task_edit.php?lang=' . LANG . '&amp;ID=' . $a_ITEM_ID . '">' . $a_ITEM_ID . '</a>] ' . $arTask["NAME"]);
     }
     break;
 case "FORUM_MESSAGE_APPROVE":
 public function getGroup($code)
 {
     $groupId = $this->getGroupId($code);
     return $groupId ? \CGroup::GetByID($groupId)->Fetch() : false;
 }
示例#8
0
		$user = new CUser;
		$arFields = array(
			"EMAIL" => $newUserEmail,
			"LOGIN" => $newUserLogin,
			"ACTIVE" => "Y",
			"PASSWORD" => $newUserPass,
			"CONFIRM_PASSWORD" => $newUserConfirmPass,
		);

		$userID = $user->Add($arFields);
		if (intval($userID) > 1)
		{
			$arGroups = explode(",",COption::GetOptionString("intranet", "1C_USER_IMPORT_GROUP_PERMISSIONS", ""));
			foreach ($arGroups as $index => $groupID)
			{
				$dbGroup = CGroup::GetByID($groupID);
				$arGroup = $dbGroup->Fetch();
				if (!$arGroup || $arGroup["ID"] == 1)
					unset($arGroups[$index]);
			}

			if (empty($arGroups))
			{
				$dbGroup = CGroup::GetList($by="c_sort", $order="desc", array("STRING_ID" => "1C_USER_IMPORT_GROUP"));
				if ($arExistGroup = $dbGroup->Fetch())
				{
					$groupID = $arExistGroup["ID"];
				}
				else
				{
					$group = new CGroup;
示例#9
0
<?php

require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
$saleModulePermissions = $APPLICATION->GetGroupRight("sale");
if ($saleModulePermissions < "W") {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
ClearVars("f_");
IncludeModuleLangFile(__FILE__);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/include.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/prolog.php";
$ID = IntVal($ID);
$z = CGroup::GetByID($ID);
if (!$z->ExtractFields("f_")) {
    LocalRedirect("sale_tax_exempt.php?lang=" . LANG . GetFilterParams("filter_", false));
}
$strError = "";
$bInitVars = false;
if ((strlen($save) > 0 || strlen($apply) > 0) && $REQUEST_METHOD == "POST" && $saleModulePermissions == "W" && check_bitrix_sessid()) {
    $arTAX = array();
    CSaleTax::DeleteExempt(array("GROUP_ID" => $ID));
    if (isset($TAX_ID) && is_array($TAX_ID) && count($TAX_ID) > 0) {
        for ($i = 0; $i < count($TAX_ID); $i++) {
            if (IntVal($TAX_ID[$i]) > 0) {
                CSaleTax::AddExempt(array("GROUP_ID" => $ID, "TAX_ID" => IntVal($TAX_ID[$i])));
            }
        }
    }
    if (strlen($strError) > 0) {
        $bInitVars = True;
    }
示例#10
0
 function FormatDestinationFromRights($arRights, $arParams, &$iMoreCount = false)
 {
     if (empty($arRights)) {
         return array();
     }
     static $arDepartments = array();
     $arDestination = array();
     $arSonetGroups = array();
     $bCheckPermissions = !array_key_exists("CHECK_PERMISSIONS_DEST", $arParams) || $arParams["CHECK_PERMISSIONS_DEST"] != "N";
     if (!function_exists("__DestinationRightsSort")) {
         function __DestinationRightsSort($a, $b)
         {
             if ($a == $b) {
                 return 0;
             } elseif (preg_match('/^US\\d+$/', $a)) {
                 return -1;
             } elseif (in_array($a, array("G2", "AU"))) {
                 if (in_array($b, array("G2", "AU"))) {
                     return 0;
                 } elseif (preg_match('/^US\\d+$/', $b)) {
                     return 1;
                 } else {
                     return -1;
                 }
             } elseif (preg_match('/^CRMDEAL\\d+$/', $a)) {
                 if (preg_match('/^CRMDEAL\\d+$/', $b)) {
                     return 0;
                 } elseif (preg_match('/^US\\d+$/', $b) || in_array($b, array("G2", "AU"))) {
                     return 1;
                 } else {
                     return -1;
                 }
             } elseif (preg_match('/^CRMCONTACT\\d+$/', $a)) {
                 if (preg_match('/^CRMCONTACT\\d+$/', $b)) {
                     return 0;
                 } elseif (preg_match('/^US\\d+$/', $b) || in_array($b, array("G2", "AU")) || preg_match('/^CRMDEAL\\d+$/', $b)) {
                     return 1;
                 } else {
                     return -1;
                 }
             } elseif (preg_match('/^CRMCOMPANY\\d+$/', $a)) {
                 if (preg_match('/^CRMCOMPANY\\d+$/', $b)) {
                     return 0;
                 } elseif (preg_match('/^US\\d+$/', $b) || in_array($b, array("G2", "AU")) || preg_match('/^CRMDEAL\\d+$/', $b) || preg_match('/^CRMCONTACT\\d+$/', $b)) {
                     return 1;
                 } else {
                     return -1;
                 }
             } elseif (preg_match('/^CRMLEAD\\d+$/', $a)) {
                 if (preg_match('/^CRMLEAD\\d+$/', $b)) {
                     return 0;
                 } elseif (preg_match('/^US\\d+$/', $b) || in_array($b, array("G2", "AU")) || preg_match('/^CRMDEAL\\d+$/', $b) || preg_match('/^CRMCONTACT\\d+$/', $b) || preg_match('/^CRMCOMPANY\\d+$/', $b)) {
                     return 1;
                 } else {
                     return -1;
                 }
             } elseif (preg_match('/^SG\\d+_' . SONET_ROLES_USER . '$/', $a)) {
                 if (preg_match('/^SG\\d+_' . SONET_ROLES_USER . '$/', $b)) {
                     return 0;
                 } elseif (preg_match('/^US\\d+$/', $b) || in_array($b, array("G2", "AU")) || preg_match('/^CRMDEAL\\d+$/', $b) || preg_match('/^CRMCONTACT\\d+$/', $b) || preg_match('/^CRMCOMPANY\\d+$/', $b) || preg_match('/^CRMLEAD\\d+$/', $b)) {
                     return 1;
                 } else {
                     return -1;
                 }
             } elseif (preg_match('/^SG\\d+_' . SONET_ROLES_MODERATOR . '$/', $a)) {
                 if (preg_match('/^SG\\d+_' . SONET_ROLES_MODERATOR . '$/', $b)) {
                     return 0;
                 } elseif (preg_match('/^US\\d+$/', $b) || in_array($b, array("G2", "AU")) || preg_match('/^SG\\d+_' . SONET_ROLES_USER . '$/', $b) || preg_match('/^CRMDEAL\\d+$/', $b) || preg_match('/^CRMCONTACT\\d+$/', $b) || preg_match('/^CRMCOMPANY\\d+$/', $b) || preg_match('/^CRMLEAD\\d+$/', $b)) {
                     return 1;
                 } else {
                     return -1;
                 }
             } elseif (preg_match('/^SG\\d+_' . SONET_ROLES_OWNER . '$/', $a)) {
                 if (preg_match('/^SG\\d+_' . SONET_ROLES_OWNER . '$/', $b)) {
                     return 0;
                 } elseif (preg_match('/^US\\d+$/', $b) || in_array($b, array("G2", "AU")) || preg_match('/^SG\\d+_' . SONET_ROLES_USER . '$/', $b) || preg_match('/^SG\\d+_' . SONET_ROLES_MODERATOR . '$/', $b) || preg_match('/^CRMDEAL\\d+$/', $b) || preg_match('/^CRMCONTACT\\d+$/', $b) || preg_match('/^CRMCOMPANY\\d+$/', $b) || preg_match('/^CRMLEAD\\d+$/', $b)) {
                     return 1;
                 } else {
                     return -1;
                 }
             } elseif (preg_match('/^D\\d+$/', $a)) {
                 if (preg_match('/^D\\d+$/', $b)) {
                     return 0;
                 } elseif (preg_match('/^US\\d+$/', $b) || in_array($b, array("G2", "AU")) || preg_match('/^SG\\d+_' . SONET_ROLES_USER . '$/', $b) || preg_match('/^SG\\d+_' . SONET_ROLES_MODERATOR . '$/', $b) || preg_match('/^SG\\d+_' . SONET_ROLES_OWNER . '$/', $b) || preg_match('/^CRMDEAL\\d+$/', $b) || preg_match('/^CRMCONTACT\\d+$/', $b) || preg_match('/^CRMCOMPANY\\d+$/', $b) || preg_match('/^CRMLEAD\\d+$/', $b)) {
                     return 1;
                 } else {
                     return -1;
                 }
             } elseif (preg_match('/^DR\\d+$/', $a)) {
                 if (preg_match('/^DR\\d+$/', $b)) {
                     return 0;
                 } elseif (preg_match('/^US\\d+$/', $b) || in_array($b, array("G2", "AU")) || preg_match('/^SG\\d+_' . SONET_ROLES_USER . '$/', $b) || preg_match('/^SG\\d+_' . SONET_ROLES_MODERATOR . '$/', $b) || preg_match('/^SG\\d+_' . SONET_ROLES_OWNER . '$/', $b) || preg_match('/^D\\d+$/', $b) || preg_match('/^CRMDEAL\\d+$/', $b) || preg_match('/^CRMCONTACT\\d+$/', $b) || preg_match('/^CRMCOMPANY\\d+$/', $b) || preg_match('/^CRMLEAD\\d+$/', $b)) {
                     return 1;
                 } else {
                     return -1;
                 }
             } elseif (preg_match('/^U\\d+$/', $a)) {
                 if (preg_match('/^U\\d+$/', $b)) {
                     return 0;
                 } elseif (preg_match('/^US\\d+$/', $b) || in_array($b, array("G2", "AU")) || preg_match('/^SG\\d+_' . SONET_ROLES_USER . '$/', $b) || preg_match('/^SG\\d+_' . SONET_ROLES_MODERATOR . '$/', $b) || preg_match('/^SG\\d+_' . SONET_ROLES_OWNER . '$/', $b) || preg_match('/^D\\d+$/', $b) || preg_match('/^DR\\d+$/', $b) || preg_match('/^CRMDEAL\\d+$/', $b) || preg_match('/^CRMCONTACT\\d+$/', $b) || preg_match('/^CRMCOMPANY\\d+$/', $b) || preg_match('/^CRMLEAD\\d+$/', $b)) {
                     return 1;
                 } else {
                     return -1;
                 }
             } elseif (preg_match('/^G\\d+$/', $a)) {
                 if (preg_match('/^G\\d+$/', $b)) {
                     return 0;
                 } elseif (preg_match('/^US\\d+$/', $b) || in_array($b, array("G2", "AU")) || preg_match('/^SG\\d+_' . SONET_ROLES_USER . '$/', $b) || preg_match('/^SG\\d+_' . SONET_ROLES_MODERATOR . '$/', $b) || preg_match('/^SG\\d+_' . SONET_ROLES_OWNER . '$/', $b) || preg_match('/^D\\d+$/', $b) || preg_match('/^DR\\d+$/', $b) || preg_match('/^U\\d+$/', $b) || preg_match('/^CRMDEAL\\d+$/', $b) || preg_match('/^CRMCONTACT\\d+$/', $b) || preg_match('/^CRMCOMPANY\\d+$/', $b) || preg_match('/^CRMLEAD\\d+$/', $b)) {
                     return 1;
                 } else {
                     return -1;
                 }
             } else {
                 return 0;
             }
         }
     }
     $arRights = array_unique($arRights);
     usort($arRights, "__DestinationRightsSort");
     $cnt = 0;
     $bAll = false;
     $bJustCount = false;
     $arParams["DESTINATION_LIMIT"] = intval($arParams["DESTINATION_LIMIT"]) <= 0 ? 3 : $arParams["DESTINATION_LIMIT"];
     $arModuleEvents = array();
     $db_events = GetModuleEvents("socialnetwork", "OnSocNetLogFormatDestination");
     while ($arEvent = $db_events->Fetch()) {
         $arModuleEvents[] = $arEvent;
     }
     foreach ($arRights as $right_tmp) {
         if ($cnt >= $arParams["DESTINATION_LIMIT"]) {
             $bJustCount = true;
         }
         if (in_array($right_tmp, array("G1")) && count($arRights) > 1) {
             continue;
         } elseif (preg_match('/^US\\d+$/', $right_tmp, $matches) || in_array($right_tmp, array("G2", "AU"))) {
             if ($bAll) {
                 continue;
             }
             if (isset($arParams["USE_ALL_DESTINATION"]) && $arParams["USE_ALL_DESTINATION"] && in_array($right_tmp, array("G2", "AU"))) {
                 continue;
             }
             if (!$bJustCount) {
                 $arDestination[] = array("STYLE" => "all-users", "TITLE" => IsModuleInstalled("intranet") ? GetMessage("SONET_GL_DESTINATION_G2") : GetMessage("SONET_GL_DESTINATION_G2_BSM"));
             }
             $bAll = true;
             $cnt++;
         } elseif (preg_match('/^G(\\d+)$/', $right_tmp, $matches)) {
             $cnt++;
             if (!$bJustCount) {
                 $rsGroupTmp = CGroup::GetByID($matches[1]);
                 if ($arGroupTmp = $rsGroupTmp->Fetch()) {
                     $arDestination[] = array("TYPE" => "G", "ID" => $arGroupTmp["ID"], "STYLE" => "groups", "TITLE" => $arGroupTmp["NAME"], "URL" => "");
                 }
             }
         } elseif (preg_match('/^U(\\d+)$/', $right_tmp, $matches)) {
             if (array_key_exists("CREATED_BY", $arParams) && intval($arParams["CREATED_BY"]) > 0 && $arParams["CREATED_BY"] == $matches[1]) {
                 continue;
             }
             $cnt++;
             if (!$bJustCount) {
                 $rsUserTmp = CUser::GetByID($matches[1]);
                 if ($arUserTmp = $rsUserTmp->Fetch()) {
                     $arDestination[] = array("TYPE" => "U", "ID" => $arUserTmp["ID"], "STYLE" => "users", "TITLE" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arUserTmp, $arParams["SHOW_LOGIN"] == "Y"), "URL" => str_replace("#user_id#", $arUserTmp["ID"], $arParams["PATH_TO_USER"]), "IS_EXTRANET" => is_array($GLOBALS["arExtranetUserID"]) && in_array($arUserTmp["ID"], $GLOBALS["arExtranetUserID"]) ? "Y" : "N");
                 }
             }
         } elseif ((preg_match('/^D(\\d+)$/', $right_tmp, $matches) || preg_match('/^DR(\\d+)$/', $right_tmp, $matches)) && CModule::IncludeModule("iblock")) {
             $cnt++;
             if (!$bJustCount) {
                 if (array_key_exists($matches[1], $arDepartments)) {
                     $arDepartmentTmp = $arDepartments[$matches[1]];
                 } else {
                     $rsDepartmentTmp = CIBlockSection::GetByID($matches[1]);
                     if ($arDepartmentTmp = $rsDepartmentTmp->GetNext()) {
                         $arDepartments[$matches[1]] = $arDepartmentTmp;
                     }
                 }
                 if ($arDepartmentTmp) {
                     $arDestination[] = array("TYPE" => "D", "ID" => $arDepartmentTmp["ID"], "STYLE" => "department", "TITLE" => $arDepartmentTmp["NAME"], "URL" => str_replace(array("#ID#", "#id#"), $arDepartmentTmp["ID"], $arParams["PATH_TO_CONPANY_DEPARTMENT"]));
                 }
             }
         } elseif (preg_match('/^SG(\\d+)_' . SONET_ROLES_USER . '$/', $right_tmp, $matches) || preg_match('/^SG(\\d+)$/', $right_tmp, $matches)) {
             if (array_key_exists($matches[1], $arSonetGroups) && is_array($arSonetGroups[$matches[1]]) && in_array(SONET_ROLES_USER, $arSonetGroups[$matches[1]])) {
                 continue;
             }
             $cnt++;
             if (!$bJustCount) {
                 // already cached
                 $arSonetGroup = CSocNetGroup::GetByID($matches[1], $bCheckPermissions);
                 if ($arSonetGroup) {
                     $arDestination[] = array("TYPE" => "SG", "ID" => $arSonetGroup["ID"], "STYLE" => "sonetgroups", "TITLE" => $arSonetGroup["NAME"], "URL" => str_replace("#group_id#", $arSonetGroup["ID"], $arParams["PATH_TO_GROUP"]), "IS_EXTRANET" => is_array($GLOBALS["arExtranetGroupID"]) && in_array($arSonetGroup["ID"], $GLOBALS["arExtranetGroupID"]) ? "Y" : "N");
                     if (!array_key_exists($arSonetGroup["ID"], $arSonetGroups)) {
                         $arSonetGroups[$arSonetGroup["ID"]] = array();
                     }
                     $arSonetGroups[$arSonetGroup["ID"]][] = SONET_ROLES_USER;
                 }
             }
         } elseif (preg_match('/^SG(\\d+)_' . SONET_ROLES_MODERATOR . '$/', $right_tmp, $matches)) {
             if (!in_array("SG" . $matches[1] . "_" . SONET_ROLES_USER, $arRights)) {
                 $cnt++;
                 if (!$bJustCount) {
                     $arSonetGroup = CSocNetGroup::GetByID($matches[1], $bCheckPermissions);
                     if ($arSonetGroup) {
                         $arDestination[] = array("TYPE" => "SG", "ID" => $arSonetGroup["ID"], "STYLE" => "sonetgroups", "TITLE" => $arSonetGroup["NAME"] . GetMessage("SONET_GL_DESTINATION_SG_MODERATOR"), "URL" => str_replace("#group_id#", $arSonetGroup["ID"], $arParams["PATH_TO_GROUP"]), "IS_EXTRANET" => is_array($GLOBALS["arExtranetGroupID"]) && in_array($arSonetGroup["ID"], $GLOBALS["arExtranetGroupID"]) ? "Y" : "N");
                         if (!array_key_exists($arSonetGroup["ID"], $arSonetGroups)) {
                             $arSonetGroups[$arSonetGroup["ID"]] = array();
                         }
                         $arSonetGroups[$arSonetGroup["ID"]][] = SONET_ROLES_MODERATOR;
                     }
                 }
             }
         } elseif (preg_match('/^SG(\\d+)_' . SONET_ROLES_OWNER . '$/', $right_tmp, $matches)) {
             if (!in_array("SG" . $matches[1] . "_" . SONET_ROLES_USER, $arRights) && !in_array("SG" . $matches[1] . "_" . SONET_ROLES_MODERATOR, $arRights)) {
                 $cnt++;
                 if (!$bJustCount) {
                     $arSonetGroup = CSocNetGroup::GetByID($matches[1], $bCheckPermissions);
                     if ($arSonetGroup) {
                         $arDestination[] = array("TYPE" => "SG", "ID" => $arSonetGroup["ID"], "STYLE" => "sonetgroups", "TITLE" => $arSonetGroup["NAME"] . GetMessage("SONET_GL_DESTINATION_SG_OWNER"), "URL" => str_replace("#group_id#", $arSonetGroup["ID"], $arParams["PATH_TO_GROUP"]), "IS_EXTRANET" => is_array($GLOBALS["arExtranetGroupID"]) && in_array($arSonetGroup["ID"], $GLOBALS["arExtranetGroupID"]) ? "Y" : "N");
                         if (!array_key_exists($arSonetGroup["ID"], $arSonetGroups)) {
                             $arSonetGroups[$arSonetGroup["ID"]] = array();
                         }
                         $arSonetGroups[$arSonetGroup["ID"]][] = SONET_ROLES_OWNER;
                     }
                 }
             }
         } else {
             $cnt++;
             if (!$bJustCount) {
                 foreach ($arModuleEvents as $arEvent) {
                     ExecuteModuleEventEx($arEvent, array(&$arDestination, $right_tmp, $arRights, $arParams, $bCheckPermissions));
                 }
             }
         }
     }
     if ($cnt > $arParams["DESTINATION_LIMIT"]) {
         $iMoreCount = $cnt - $arParams["DESTINATION_LIMIT"];
     }
     return $arDestination;
 }
示例#11
0
	<tr>
		<td><?php 
    echo GetMessage('LAST_UPDATE');
    ?>
</td>
		<td><?php 
    echo $str_TIMESTAMP_X;
    ?>
</td>
	</tr>
	<?php 
}
?>
	<?php 
if ($ID > 0 && $ID != 2 && $COPY_ID <= 0) {
    $dbGroupTmp = CGroup::GetByID($ID, "Y");
    if ($arGroupTmp = $dbGroupTmp->Fetch()) {
        ?>
			<tr>
				<td><?php 
        echo GetMessage('MAIN_TOTAL_USERS');
        ?>
</td>
				<td><a href="user_admin.php?lang=<?php 
        echo LANG;
        ?>
&find_group_id[]=<?php 
        echo $ID;
        ?>
&set_filter=Y" title="<?php 
        echo GetMessage("MAIN_VIEW_USER_GROUPS");
示例#12
0
 /**
  * Метод подготовки данных
  * Применяется в $this->add() и $this->update()
  * Использует атрибуты полей из массива $this->_arTableFieldsCheck для проверки входных параметров метода
  * @param int $prepareType - может принимать для зачения self::PREPARE_ADD или self::PREPARE_UPDATE
  * @param array $arFields - значения полей основной таблицы сущности
  * @param null|array $arTableFieldsCheck - если задан, то переопределяет штатный $this->_arTableFieldsCheck
  * @param null|array $arTableFieldsDefault - если задан, то переопределяет штатный $this->_arTableFieldsDefault
  * @return array
  */
 protected function prepareFieldsData($prepareType, &$arFields, $arTableFieldsCheck = null, $arTableFieldsDefault = null)
 {
     global $DB;
     $arFieldsPrepared = array();
     if ($arTableFieldsDefault == null) {
         $arTableFieldsDefault = $this->_arTableFieldsDefault;
     } else {
         $arTableFieldsDefault = array_merge($this->_arTableFieldsDefault, $arTableFieldsDefault);
     }
     if ($arTableFieldsCheck == null) {
         $arTableFieldsCheck = $this->_arTableFieldsCheck;
     } else {
         $arTableFieldsCheck = array_merge($this->_arTableFieldsCheck, $arTableFieldsCheck);
     }
     $arCheckResult = array('__BREAK' => false, '__MAGIC_WORD' => false);
     if (array_key_exists(OBX_MAGIC_WORD, $arFields)) {
         $arCheckResult['__MAGIC_WORD'] = true;
         unset($arFields[OBX_MAGIC_WORD]);
     }
     foreach ($arFields as $fieldName => &$fieldValue) {
         $arCheckResult[$fieldName] = null;
         if (array_key_exists($fieldName, $arTableFieldsCheck)) {
             $arCheckResult[$fieldName] = array('RAW_VALUE' => $fieldValue, 'FIELD_TYPE' => null, 'FIELD_TYPE_MASK' => 0, 'FIELD_ATTR' => array(), 'IS_EMPTY' => false, 'IS_NULL' => false, 'IS_CORRECT' => false, 'FROM_DEFAULTS' => false, 'CHECK_DATA' => array());
             $fieldType = $arTableFieldsCheck[$fieldName];
             $bValueIsCorrect = false;
             $bNotNull = false;
             $bNotZero = false;
             $bDefaultIfNull = false;
             $bUnsignedType = false;
             if ($fieldType & self::FLD_UNSIGNED) {
                 $arCheckResult[$fieldName]['FIELD_ATTR']['FLD_UNSIGNED'] = self::FLD_UNSIGNED;
                 $bUnsignedType = true;
             }
             if ($fieldType & self::FLD_NOT_NULL) {
                 $arCheckResult[$fieldName]['FIELD_ATTR']['FLD_NOT_NULL'] = self::FLD_NOT_NULL;
                 $bNotNull = true;
             }
             $bPassNull = !$bNotNull;
             if ($fieldType & self::FLD_NOT_ZERO) {
                 $arCheckResult[$fieldName]['FIELD_ATTR']['FLD_NOT_ZERO'] = self::FLD_NOT_ZERO;
                 $bNotZero = true;
             }
             $bPassZero = !$bNotZero;
             if ($fieldType & self::FLD_DEFAULT) {
                 $arCheckResult[$fieldName]['FIELD_ATTR']['FLD_DEFAULT'] = self::FLD_DEFAULT;
                 if ($prepareType == self::PREPARE_ADD) {
                     $bDefaultIfNull = true;
                 }
             }
             if ($fieldType & self::FLD_REQUIRED) {
                 $arCheckResult[$fieldName]['FIELD_ATTR']['FLD_REQUIRED'] = self::FLD_REQUIRED;
             }
             $bValueIsEmpty = empty($fieldValue);
             if ($bValueIsEmpty) {
                 $arCheckResult[$fieldName]['IS_EMPTY'] = true;
             }
             if ($fieldValue === null && $bPassNull) {
                 $bValueIsCorrect = true;
                 $bValueIsEmpty = true;
                 $arCheckResult[$fieldName]['IS_NULL'] = true;
                 $arCheckResult[$fieldName]['IS_EMPTY'] = true;
                 $arCheckResult[$fieldName]['IS_CORRECT'] = true;
             } else {
                 switch ($fieldType & ~self::FLD_ATTR_ALL) {
                     case self::FLD_T_NO_CHECK:
                         $arCheckResult[$fieldName]['FIELD_TYPE'] = 'FLD_T_NO_CHECK';
                         $arCheckResult[$fieldName]['FIELD_TYPE_MASK'] = self::FLD_T_NO_CHECK;
                         $bValueIsCorrect = true;
                         break;
                     case self::FLD_T_CHAR:
                         $arCheckResult[$fieldName]['FIELD_TYPE'] = 'FLD_T_CHAR';
                         $arCheckResult[$fieldName]['FIELD_TYPE_MASK'] = self::FLD_T_CHAR;
                         if ($bPassNull && $bValueIsEmpty) {
                             $fieldValue = null;
                         } elseif (!$bValueIsEmpty) {
                             $fieldValue = substr($fieldValue, 0, 1);
                             $bValueIsCorrect = true;
                         }
                         break;
                     case self::FLD_T_INT:
                         $arCheckResult[$fieldName]['FIELD_TYPE'] = 'FLD_T_INT';
                         $arCheckResult[$fieldName]['FIELD_TYPE_MASK'] = self::FLD_T_INT;
                         $bValueIsCorrect = $this->__checkNumericField(false, $fieldValue, $bUnsignedType, $bNotNull, $bNotZero);
                         break;
                     case self::FLD_T_STRING:
                         $arCheckResult[$fieldName]['FIELD_TYPE'] = 'FLD_T_STRING';
                         $arCheckResult[$fieldName]['FIELD_TYPE_MASK'] = self::FLD_T_STRING;
                         $valStrLen = strlen($fieldValue);
                         if ($valStrLen > 0) {
                             $fieldValue = $DB->ForSql(htmlspecialcharsEx($fieldValue));
                             $bValueIsCorrect = true;
                         } elseif ($bPassZero) {
                             $fieldValue = '';
                             $bValueIsCorrect = true;
                         }
                         break;
                     case self::FLD_T_CODE:
                         $arCheckResult[$fieldName]['FIELD_TYPE'] = 'FLD_T_CODE';
                         $arCheckResult[$fieldName]['FIELD_TYPE_MASK'] = self::FLD_T_CODE;
                         $fieldValue = trim($fieldValue);
                         if (preg_match('~^[a-zA-Z\\_][a-z0-9A-Z\\_]{0,15}$~', $fieldValue)) {
                             $bValueIsCorrect = true;
                         }
                         break;
                     case self::FLD_T_BCHAR:
                         $arCheckResult[$fieldName]['FIELD_TYPE'] = 'FLD_T_BCHAR';
                         $arCheckResult[$fieldName]['FIELD_TYPE_MASK'] = self::FLD_T_BCHAR;
                         $fieldValue = strtoupper(substr($fieldValue, 0, 1));
                         if ($fieldValue == 'Y' || !$bUnsignedType && $fieldValue == 'N') {
                             $bValueIsCorrect = true;
                         }
                         break;
                     case self::FLD_T_FLOAT:
                         $arCheckResult[$fieldName]['FIELD_TYPE'] = 'FLD_T_FLOAT';
                         $arCheckResult[$fieldName]['FIELD_TYPE_MASK'] = self::FLD_T_FLOAT;
                         $bValueIsCorrect = $this->__checkNumericField(true, $fieldValue, $bUnsignedType, $bNotNull, $bNotZero);
                         break;
                     case self::FLD_T_IDENT:
                         $arCheckResult[$fieldName]['FIELD_TYPE'] = 'FLD_T_IDENT';
                         $arCheckResult[$fieldName]['FIELD_TYPE_MASK'] = self::FLD_T_IDENT;
                         $fieldValue = trim($fieldValue);
                         if (is_numeric($fieldValue) && ($fieldValue = intval($fieldValue)) > 0 || preg_match('~^[a-z0-9A-Z\\_]{1,255}$~', $fieldValue)) {
                             $bValueIsCorrect = true;
                         }
                         break;
                     case self::FLD_T_DATETIME:
                         $arCheckResult[$fieldName]['FIELD_TYPE'] = 'FLD_T_DATETIME';
                         $arCheckResult[$fieldName]['FIELD_TYPE'] = self::FLD_T_DATETIME;
                         $fieldValue = trim($fieldValue);
                         $bValueIsCorrect = true;
                         // TODO: Тут надо дописать обработку дат и времени
                         break;
                     case self::FLD_T_BX_LANG_ID:
                         $arCheckResult[$fieldName]['FIELD_TYPE'] = 'FLD_T_BX_LANG_ID';
                         $arCheckResult[$fieldName]['FIELD_TYPE_MASK'] = self::FLD_T_BX_LANG_ID;
                         $fieldValue = trim($fieldValue);
                         if (strlen($fieldValue) > 0 && preg_match('~^[a-zA-Z\\_][a-z0-9A-Z\\_]?$~', $fieldValue)) {
                             $bValueIsCorrect = true;
                         }
                         break;
                     case self::FLD_T_IBLOCK_ID:
                         $arCheckResult[$fieldName]['FIELD_TYPE'] = 'FLD_T_IBLOCK_ID';
                         $arCheckResult[$fieldName]['FIELD_TYPE_MASK'] = self::FLD_T_IBLOCK_ID;
                         $fieldValue = intval($fieldValue);
                         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
                         $rs = \CIBlock::GetByID($fieldValue);
                         if ($arData = $rs->GetNext()) {
                             $arCheckResult[$fieldName]['CHECK_DATA'] = $arData;
                             $bValueIsCorrect = true;
                         }
                         break;
                     case self::FLD_T_IBLOCK_PROP_ID:
                         $arCheckResult[$fieldName]['FIELD_TYPE'] = 'FLD_T_IBLOCK_PROP_ID';
                         $arCheckResult[$fieldName]['FIELD_TYPE_MASK'] = self::FLD_T_IBLOCK_PROP_ID;
                         $rs = \CIBlockProperty::GetByID($fieldValue);
                         if ($arData = $rs->GetNext()) {
                             $arCheckResult[$fieldName]['CHECK_DATA'] = $arData;
                             $bValueIsCorrect = true;
                         }
                         break;
                     case self::FLD_T_IBLOCK_ELEMENT_ID:
                         $arCheckResult[$fieldName]['FIELD_TYPE'] = 'FLD_T_IBLOCK_ELEMENT_ID';
                         $arCheckResult[$fieldName]['FIELD_TYPE_MASK'] = self::FLD_T_IBLOCK_ELEMENT_ID;
                         $rs = \CIBlockElement::GetByID($fieldValue);
                         if ($arData = $rs->GetNext()) {
                             $arCheckResult[$fieldName]['CHECK_DATA'] = $arData;
                             $bValueIsCorrect = true;
                         }
                         break;
                     case self::FLD_T_IBLOCK_SECTION_ID:
                         $arCheckResult[$fieldName]['FIELD_TYPE'] = 'FLD_T_IBLOCK_SECTION_ID';
                         $arCheckResult[$fieldName]['FIELD_TYPE_MASK'] = self::FLD_T_IBLOCK_SECTION_ID;
                         $rs = \CIBlockSection::GetByID($fieldValue);
                         if ($arData = $rs->GetNext()) {
                             $arCheckResult[$fieldName]['CHECK_DATA'] = $arData;
                             $bValueIsCorrect = true;
                         }
                         break;
                     case self::FLD_T_USER_ID:
                         $arCheckResult[$fieldName]['FIELD_TYPE'] = 'FLD_T_USER_ID';
                         $arCheckResult[$fieldName]['FIELD_TYPE_MASK'] = self::FLD_T_USER_ID;
                         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
                         $rs = \CUser::GetByID($fieldValue);
                         if ($arData = $rs->GetNext()) {
                             $arCheckResult[$fieldName]['CHECK_DATA'] = $arData;
                             $bValueIsCorrect = true;
                         }
                         break;
                     case self::FLD_T_GROUP_ID:
                         $arCheckResult[$fieldName]['FIELD_TYPE'] = 'FLD_T_GROUP_ID';
                         $arCheckResult[$fieldName]['FIELD_TYPE_MASK'] = self::FLD_T_GROUP_ID;
                         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
                         $rs = \CGroup::GetByID($fieldValue);
                         if ($arData = $rs->GetNext()) {
                             $arCheckResult[$fieldName]['CHECK_DATA'] = $arData;
                             $bValueIsCorrect = true;
                         }
                         break;
                 }
             }
             if ($fieldType & self::FLD_CUSTOM_CK) {
                 $arCheckResult[$fieldName]['FIELD_TYPE'] = 'FLD_CUSTOM_CK';
                 $arCheckResult[$fieldName]['FIELD_TYPE_MASK'] = self::FLD_CUSTOM_CK;
                 if ($bValueIsCorrect) {
                     $customCheckFunc = '__check_' . $fieldName;
                     if (is_callable(array($this, $customCheckFunc))) {
                         //$bValueIsCorrect = call_user_func($customCheckFunc, $fieldValue, $arCheckResult[$fieldName]['CHECK_DATA']);
                         $bValueIsCorrect = $this->{$customCheckFunc}($fieldValue, $arCheckResult[$fieldName]['CHECK_DATA']);
                     }
                 }
             }
             if (!$bValueIsCorrect && $fieldType & self::FLD_BRK_INCORR) {
                 $arCheckResult['__BREAK'] = true;
             }
             if ($bValueIsEmpty && $bDefaultIfNull) {
                 if (array_key_exists($fieldName, $arTableFieldsDefault)) {
                     $arCheckResult[$fieldName]['FROM_DEFAULTS'] = true;
                     $arFieldsPrepared[$fieldName] = $arTableFieldsDefault[$fieldName];
                 }
             } elseif ($bValueIsCorrect) {
                 $arCheckResult[$fieldName]['IS_CORRECT'] = true;
                 $arCheckResult[$fieldName]['VALUE'] = $fieldValue;
                 $arFieldsPrepared[$fieldName] = $fieldValue;
             }
         }
     }
     $arFields = $arFieldsPrepared;
     return $arCheckResult;
 }