示例#1
0
 /**
  * Add
  * @param $fields
  * @return array
  * @throws \Exception
  */
 public static function Add($fields)
 {
     $group = new \CGroup();
     unset($fields['ID']);
     if (empty($fields['STRING_ID'])) {
         return array('type' => 'error', 'error_text' => 'Field STRING_ID is required.');
     }
     if (!isset($fields['ACTIVE']) || empty($fields['ACTIVE'])) {
         $fields['ACTIVE'] = "N";
     }
     if (!isset($fields['C_SORT']) || empty($fields['C_SORT'])) {
         $fields['C_SORT'] = 100;
     }
     $groupDbRes = $group->GetList($by = 'sort', $sort = 'asc', array('STRING_ID' => $fields['STRING_ID']));
     if ($groupDbRes !== false && $groupDbRes->SelectedRowsCount()) {
         throw new BimException('Group with STRING_ID = "' . $fields['STRING_ID'] . '" already exist.');
     }
     $group = new \CGroup();
     $ID = $group->Add($fields);
     if ($ID) {
         return $ID;
     } else {
         throw new BimException($group->LAST_ERROR);
     }
 }
 public function addGroupIfNotExists($code, $fields = array())
 {
     $this->checkRequiredKeys(__METHOD__, $fields, array('NAME'));
     $groupId = $this->getGroupId($code);
     if ($groupId) {
         return intval($groupId);
     }
     $fields['STRING_ID'] = $code;
     $group = new \CGroup();
     $groupId = $group->Add($fields);
     if ($groupId) {
         return intval($groupId);
     }
     $this->throwException(__METHOD__, $group->LAST_ERROR);
 }
示例#3
0
         $saleEMail = $saleLogin . '@' . $_SERVER["SERVER_NAME"];
         if (!check_email($saleEMail)) {
             $saleEMail = $saleLogin . '@temporary.temp';
         }
         $arUserFields = array("LOGIN" => $saleLogin, "NAME" => "CRM", "LAST_NAME" => "IMPORT", "PASSWORD" => $salePassword, "PASSWORD_CONFIRM" => $salePassword, "EMAIL" => $saleEMail, "GROUP_ID" => $arDefaultGroup, "ACTIVE" => "Y", "LID" => SITE_ID);
         $user = new CUser();
         $userId = $user->Add($arUserFields);
         $userId = intval($userId);
         if ($userId <= 0) {
             $errorMessage .= GetMessage("SPTEN_SCRM_ERR_REG") . (strlen($user->LAST_ERROR) > 0 ? ": " . $user->LAST_ERROR : "");
         }
     }
     if (empty($errorMessage)) {
         $group = new CGroup();
         $arGroupFields = array("ACTIVE" => "Y", "NAME" => "CRM SALE IMPORT", "USER_ID" => array(array("USER_ID" => $userId, "DATE_ACTIVE_FROM" => false, "DATE_ACTIVE_TO" => false)));
         $groupId = $group->Add($arGroupFields);
         $groupId = intval($groupId);
         if ($groupId <= 0) {
             $errorMessage .= GetMessage("SPTEN_SCRM_ERR_GRP") . (strlen($group->LAST_ERROR) > 0 ? ": " . $group->LAST_ERROR : "");
         }
     }
 }
 function __CrmSaleQuery($crmUrlScheme, $crmUrlHost, $crmUrlPort, $crmLogin, $crmPassword, $head, $body, &$errorMessage)
 {
     $hServer = @fsockopen($crmUrlScheme . $crmUrlHost, $crmUrlPort, $errno, $errstr, 20);
     if (!$hServer) {
         $errorMessage .= sprintf("[%s] %s", $errno, $errstr) . "<br />";
     }
     $arResponseHeaders = array();
     $responseBody = "";
     if (empty($errorMessage)) {
示例#4
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;
 }
示例#5
0
$group = new CGroup();
$arFields = array("ACTIVE" => "Y", "C_SORT" => 3, "NAME" => GetMessage("REGISTERED_GROUP_NAME"), "STRING_ID" => "REGISTERED_USERS");
$groupID = $group->Add($arFields);
if ($groupID > 0) {
    COption::SetOptionString("main", "new_user_registration_def_group", $groupID);
    if ($editProfileTask) {
        CGroup::SetTasks($groupID, array($editProfileTask), true);
    }
}
//Control panel users
$dbResult = CGroup::GetList($by, $order, array("STRING_ID" => "CONTROL_PANEL_USERS"));
$arGroup = $dbResult->Fetch();
if (!$arGroup) {
    $group = new CGroup();
    $arFields = array("ACTIVE" => "Y", "C_SORT" => 4, "NAME" => GetMessage("CONTROL_PANEL_GROUP_NAME"), "STRING_ID" => "CONTROL_PANEL_USERS");
    $groupID = $group->Add($arFields);
    if ($groupID > 0) {
        DemoSiteUtil::SetFilePermission(array("s1", "/bitrix/admin"), array($groupID => "R"));
        if ($editProfileTask) {
            CGroup::SetTasks($groupID, array($editProfileTask), true);
        }
    }
} else {
    $groupID = $arGroup["ID"];
}
if ($groupID > 0 && !strlen(COption::GetOptionString("main", "show_panel_for_users", ""))) {
    COption::SetOptionString("main", "show_panel_for_users", serialize(array("G" . $groupID)));
}
//Options
$server_name = $_SERVER["HTTP_HOST"] != '' ? $_SERVER["HTTP_HOST"] : $_SERVER["SERVER_NAME"];
if ($_SERVER["SERVER_PORT"] != 80 && $_SERVER["SERVER_PORT"] != 443 && $_SERVER["SERVER_PORT"] > 0 && strpos($_SERVER["HTTP_HOST"], ":") === false) {
示例#6
0
    if (array_key_exists($arCategory["NAME"], $arCategories)) {
        unset($arCategories[$arCategory["NAME"]]);
    }
}
foreach ($arCategories as $arCategory) {
    $categoryID = (int) CTicketDictionary::Add($arCategory);
}
COption::SetOptionString("support", "SUPPORT_MAX_FILESIZE", "10000");
$dbResult = CGroup::GetList($by, $order, array("STRING_ID" => "REGISTERED_USERS"));
if ($arGroup = $dbResult->Fetch()) {
    $APPLICATION->SetGroupRight("support", $arGroup["ID"], "R");
}
//Create support admins group if needed
$rsGroup = CGroup::GetList($by = "c_sort", $order = "asc", array("STRING_ID_EXACT_MATCH" => "Y", "STRING_ID" => "SUPPORT_ADMINISTRATORS"));
if ($arGroup = $rsGroup->Fetch()) {
    $group_id = $arGroup["ID"];
} else {
    $obGroup = new CGroup();
    $group_id = $obGroup->Add(array("ACTIVE" => "Y", "C_SORT" => 500, "NAME" => GetMessage("SUPP_DEMO_INSTALL_GROUP_NAME"), "DESCRIPTION" => GetMessage("SUPP_DEMO_INSTALL_GROUP_DESCRIPTION"), "STRING_ID" => "SUPPORT_ADMINISTRATORS"));
}
if ($group_id) {
    $APPLICATION->SetGroupRight("support", $group_id, "W");
}
//WizardServices::SetFilePermission(Array(WIZARD_SITE_ID, WIZARD_SITE_DIR), Array($groupID => 'R'));
//Public files
if (CModule::IncludeModule('iblock')) {
    $IBLOCK_ID = (include dirname(__FILE__) . "/../iblock/services-master.php");
    if ($IBLOCK_ID) {
        DEMO_IBlock_CopyFiles(array(dirname(__FILE__), "/public/" . LANGUAGE_ID . "/"), "/communication/support/", false, array("#IBLOCK.ID(XML_ID=services-master)#"), array($IBLOCK_ID));
    }
}
示例#7
0
 $dbResult = CGroup::GetList($by, $order, array("STRING_ID" => "RATING_VOTE", "STRING_ID_EXACT_MATCH" => "Y"));
 if ($arExistsGroup = $dbResult->Fetch()) {
     $SiteGroups["RATING_VOTE"] = $arExistsGroup["ID"];
 }
 $dbResult = CGroup::GetList($by, $order, array("STRING_ID" => "RATING_VOTE_AUTHORITY", "STRING_ID_EXACT_MATCH" => "Y"));
 if ($arExistsGroup = $dbResult->Fetch()) {
     $SiteGroups["RATING_VOTE_AUTHORITY"] = $arExistsGroup["ID"];
 }
 $group = new CGroup();
 foreach ($arGroups as $arGroup) {
     //Add Group
     $dbResult = CGroup::GetList($by, $order, array("STRING_ID" => $arGroup["STRING_ID"], "STRING_ID_EXACT_MATCH" => "Y"));
     if ($arExistsGroup = $dbResult->Fetch()) {
         $groupID = $arExistsGroup["ID"];
     } else {
         $groupID = $group->Add($arGroup);
     }
     if ($groupID <= 0) {
         continue;
     }
     $SiteGroup["STRING_ID"] = $arGroup["STRING_ID"];
     $SiteGroups[$arGroup["STRING_ID"]] = $groupID;
     //Set tasks binding to module
     $arTasksID = array();
     foreach ($arGroup["TASKS_MODULE"] as $taskName) {
         $dbResult = CTask::GetList(array(), array("NAME" => $taskName));
         if ($arTask = $dbResult->Fetch()) {
             $arTasksID[] = $arTask["ID"];
         }
     }
     if (!empty($arTasksID)) {
示例#8
0
     $group = new CGroup();
     $arFields = array("ACTIVE" => "Y", "C_SORT" => 800, "NAME" => GetMessage("SALE_WIZARD_ADMIN_SALE"), "DESCRIPTION" => GetMessage("SALE_WIZARD_ADMIN_SALE_DESCR"), "USER_ID" => array(), "STRING_ID" => "sale_administrator");
     $userGroupID = $group->Add($arFields);
 }
 if (IntVal($userGroupID) > 0) {
     DemoSiteUtil::SetFilePermission(array($siteID, "/bitrix/admin"), array($userGroupID => "R"));
     CSaleGroupAccessToSite::Add(array("SITE_ID" => $siteID, "GROUP_ID" => $userGroupID));
 }
 if ($bRus) {
     $dbGroup = CGroup::GetList($by = "", $order = "", array("STRING_ID" => "1c_integration"));
     if ($arGroup = $dbGroup->Fetch()) {
         $user1CGroupID = $arGroup["ID"];
     } else {
         $group = new CGroup();
         $arFields = array("ACTIVE" => "Y", "C_SORT" => 900, "NAME" => GetMessage("SALE_WIZARD_1C_GROUP"), "DESCRIPTION" => GetMessage("SALE_WIZARD_1C_GROUP_DESCR"), "USER_ID" => array(), "STRING_ID" => "1c_integration");
         $user1CGroupID = $group->Add($arFields);
     }
     if (IntVal($user1CGroupID) > 0) {
         DemoSiteUtil::SetFilePermission(array($siteID, "/bitrix/admin"), array($userGroupID => "R"));
     }
 }
 //Set options
 if ($bRus) {
     COption::SetOptionString('sale', 'default_currency', 'RUB');
 } else {
     COption::SetOptionString('sale', 'default_currency', 'USD');
 }
 COption::SetOptionString('sale', 'delete_after', '30');
 COption::SetOptionString('sale', 'path2user_ps_files', '/bitrix/php_interface/include/sale_payment/');
 COption::SetOptionString('sale', 'lock_catalog', 'Y');
 COption::SetOptionString('sale', 'order_list_fields', 'ID,USER,PAY_SYSTEM,PRICE,STATUS,PAYED,PS_STATUS,CANCELED,BASKET');
示例#9
0
function DEMO_IBlock_AddUserGroup($id, $name, $description)
{
    $rsGroup = CGroup::GetList($by = "c_sort", $order = "asc", array("STRING_ID_EXACT_MATCH" => "Y", "STRING_ID" => $id));
    if ($arGroup = $rsGroup->Fetch()) {
        $result = $arGroup["ID"];
    } else {
        $obGroup = new CGroup();
        $result = $obGroup->Add(array("ACTIVE" => "Y", "C_SORT" => 500, "NAME" => $name, "DESCRIPTION" => $description, "STRING_ID" => $id));
    }
    return $result;
}
示例#10
0
文件: Group.php 项目: marvin255/bxar
 /**
  * Сохраняет группу
  * @return bool
  */
 public function save()
 {
     $values = $this->getValues();
     $arFields = array();
     foreach ($values as $key => $value) {
         $arFields[strtoupper($key)] = $value;
     }
     $group = new CGroup();
     //записываем поля пользователя
     if (!$this->isNew()) {
         $id = $this->getAttribute('id')->getValue();
         //при обновлении элемента сначала записываем базовые поля
         $res = $group->Update($id, $arFields);
         if (!$res) {
             throw new Exception($group->LAST_ERROR);
         }
         $this->riseEvent('afterSave');
     } else {
         $new = $group->Add($arFields);
         if ($new) {
             $this->getAttribute('id')->setValue($new);
             $this->riseEvent('afterSave');
         } else {
             throw new Exception($group->LAST_ERROR);
         }
     }
 }
示例#11
0
 /**
  * @var array $data
  * @var bool $deleteIfExists
  */
 protected function UserGroupCreate(array $data, $deleteIfExists = false)
 {
     if (empty($data['STRING_ID'])) {
         throw new \Exception('You must set group STRING_ID');
     }
     $fire = false;
     if ($this->UserGetGroupIdByCode($data['STRING_ID'])) {
         if ($deleteIfExists) {
             $this->UserGroupDelete($data['STRING_ID']);
             $fire = true;
         }
     } else {
         $fire = true;
     }
     if ($fire) {
         $ib = new \CGroup();
         $id = $ib->Add(array_merge(['ACTIVE' => 'Y'], $data));
         if ($id) {
             echo "Add {$data['STRING_ID']} users group\r\n";
         } else {
             throw new \Exception("Can't create {$data['STRING_ID']} users group");
         }
     }
 }