Ejemplo n.º 1
0
 function ShowPanel()
 {
     global $USER, $APPLICATION;
     if (defined("ADMIN_SECTION") && ADMIN_SECTION == true) {
         return;
     }
     if ($USER->IsAdmin()) {
         if ($_REQUEST['add_new_site_sol'] == 'sol' && check_bitrix_sessid()) {
             $dbrSites = CSite::GetList($by, $ord);
             $arSitesID = array();
             $arSitesPath = array();
             $siteCnt = 0;
             while ($arSite = $dbrSites->Fetch()) {
                 if ($arSite["ACTIVE"] == "Y") {
                     $siteCnt++;
                 }
                 $arSitesID[] = strtolower($arSite["ID"]);
                 $arSitesPath[] = strtolower($arSite["PATH"]);
             }
             $newSiteID = "";
             while (true) {
                 $newSiteID = chr(rand(ord("a"), ord("z"))) . chr(rand(ord("a"), ord("z")));
                 if (!in_array($newSiteID, $arSitesID) && !in_array("/site" . $newSiteID . "/", $arSitesPath) && !file_exists($_SERVER['DOCUMENT_ROOT'] . "/site" . $newSiteID)) {
                     break;
                 }
             }
             $culture = CultureTable::getRow(array('filter' => array("=FORMAT_DATE" => FORMAT_DATE, "=FORMAT_DATETIME" => FORMAT_DATETIME, "=FORMAT_NAME" => CSite::GetDefaultNameFormat(), "=CHARSET" => SITE_CHARSET)));
             if ($culture) {
                 $cultureId = $culture["ID"];
             } else {
                 $addResult = CultureTable::add(array("NAME" => $newSiteID, "CODE" => $newSiteID, "FORMAT_DATE" => FORMAT_DATE, "FORMAT_DATETIME" => FORMAT_DATETIME, "FORMAT_NAME" => CSite::GetDefaultNameFormat(), "CHARSET" => SITE_CHARSET));
                 $cultureId = $addResult->getId();
             }
             $arFields = array("LID" => $newSiteID, "ACTIVE" => "Y", "SORT" => 100, "DEF" => "N", "NAME" => $newSiteID, "DIR" => "/site_" . $newSiteID . "/", "SITE_NAME" => $newSiteID, "SERVER_NAME" => $_SERVER["SERVER_NAME"], "EMAIL" => COption::GetOptionString("main", "email_from"), "LANGUAGE_ID" => LANGUAGE_ID, "DOC_ROOT" => "", "CULTURE_ID" => $cultureId);
             $obSite = new CSite();
             $result = $obSite->Add($arFields);
             if ($result) {
                 LocalRedirect("/bitrix/admin/wizard_install.php?lang=" . LANGUAGE_ID . "&wizardName=bitrix:portal&wizardSiteID=" . $newSiteID . "&" . bitrix_sessid_get());
             } else {
                 echo $obSite->LAST_ERROR;
             }
         }
         $arMenu = array(array("ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape(SITE_DIR) . "?add_new_site_sol=sol&" . bitrix_sessid_get() . "')", "TEXT" => "<b>" . GetMessage("SOL_BUTTON_TEST_TEXT", array("#BR#" => " ")) . "</b>", "TITLE" => GetMessage("SOL_BUTTON_TEST_TITLE")));
         $arSites = array();
         $dbrSites = CSite::GetList($by, $ord, array("ACTIVE" => "Y"));
         while ($arSite = $dbrSites->GetNext()) {
             $arSites[] = array("ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape($arSite["DIR"]) . "');", "ICON" => $arSite["LID"] == SITE_ID ? "checked" : "", "TEXT" => $arSite["NAME"], "TITLE" => GetMessage("SOL_BUTTON_GOTOSITE") . " " . $arSite["NAME"]);
         }
         $arMenu[] = array("SEPARATOR" => true);
         $arMenu[] = array("TEXT" => GetMessage("SOL_BUTTON_GOTOSITE"), "MENU" => $arSites);
         $APPLICATION->AddPanelButton(array("HREF" => SITE_DIR . "?add_new_site_sol=sol&" . bitrix_sessid_get(), "ID" => "solutions_wizard", "ICON" => "bx-panel-install-solution-icon", "TYPE" => "BIG", "ALT" => GetMessage("SOL_BUTTON_TEST_TITLE"), "TEXT" => GetMessage("SOL_BUTTON_TEST_TEXT"), "MAIN_SORT" => 2520, "SORT" => 20, "MENU" => $arMenu, 'HINT' => array('TITLE' => str_replace('#BR#', ' ', GetMessage("SOL_BUTTON_TEST_TEXT")), 'TEXT' => GetMessage('SOL_BUTTON_TEST_TEXT_HINT')), 'HINT_MENU' => array('TITLE' => str_replace('#BR#', ' ', GetMessage("SOL_BUTTON_TEST_TEXT")), 'TEXT' => GetMessage('SOL_BUTTON_TEST_MENU_HINT'))));
     }
 }
Ejemplo n.º 2
0
use Bitrix\Main\Localization\CultureTable;
use Bitrix\Main\Localization\Loc;
Loc::loadMessages(__FILE__);
$aTabs = array(array("DIV" => "edit1", "TAB" => Loc::getMessage("MAIN_PARAM"), "ICON" => "lang_edit", "TITLE" => Loc::getMessage("MAIN_PARAM_TITLE")));
$tabControl = new CAdminTabControl("tabControl", $aTabs);
/** @var $request Main\HttpRequest */
$request = Main\Context::getCurrent()->getRequest();
$errors = array();
$ID = intval($request["ID"]);
$COPY_ID = intval($request["COPY_ID"]);
if ($request->isPost() && ($request["save"] != '' || $request["apply"] != '') && $isAdmin && check_bitrix_sessid()) {
    $arFields = array("NAME" => $request['NAME'], "FORMAT_DATE" => $request['FORMAT_DATE'], "FORMAT_DATETIME" => $request['FORMAT_DATETIME'], "WEEK_START" => intval($request["WEEK_START"]), "FORMAT_NAME" => $request["FORMAT_NAME"], "CHARSET" => $request['CHARSET'], "DIRECTION" => $request['DIRECTION'], "CODE" => $request['CODE']);
    if ($ID > 0) {
        $result = CultureTable::update($ID, $arFields);
    } else {
        $result = CultureTable::add($arFields);
        $ID = $result->getId();
    }
    if ($result->isSuccess()) {
        if ($request["save"] != '') {
            LocalRedirect(BX_ROOT . "/admin/culture_admin.php?lang=" . LANGUAGE_ID);
        } else {
            LocalRedirect(BX_ROOT . "/admin/culture_edit.php?lang=" . LANGUAGE_ID . "&ID=" . $ID . "&" . $tabControl->ActiveTabParam());
        }
    } else {
        $errors = $result->getErrorMessages();
    }
}
if (empty($errors)) {
    $culture = false;
    if ($ID > 0 || $COPY_ID > 0) {
Ejemplo n.º 3
0
 function ShowPanel()
 {
     global $USER, $APPLICATION;
     if (defined("ADMIN_SECTION") && ADMIN_SECTION == true) {
         return;
     }
     if ($USER->IsAdmin()) {
         if ($_REQUEST['add_new_site_sol'] == 'sol' && check_bitrix_sessid()) {
             $dbrSites = CSite::GetList($by, $ord);
             $arSitesID = array();
             $arSitesPath = array();
             $siteCnt = 0;
             while ($arSite = $dbrSites->Fetch()) {
                 if ($arSite["ACTIVE"] == "Y") {
                     $siteCnt++;
                 }
                 $arSitesID[] = strtolower($arSite["ID"]);
                 $arSitesPath[] = strtolower($arSite["PATH"]);
             }
             $newSiteID = "";
             while (true) {
                 $newSiteID = chr(rand(ord("a"), ord("z"))) . chr(rand(ord("a"), ord("z")));
                 if (!in_array($newSiteID, $arSitesID) && !in_array("/site" . $newSiteID . "/", $arSitesPath) && !file_exists($_SERVER['DOCUMENT_ROOT'] . "/site" . $newSiteID)) {
                     break;
                 }
             }
             $culture = CultureTable::getRow(array('filter' => array("=FORMAT_DATE" => FORMAT_DATE, "=FORMAT_DATETIME" => FORMAT_DATETIME, "=FORMAT_NAME" => CSite::GetDefaultNameFormat(), "=CHARSET" => SITE_CHARSET)));
             if ($culture) {
                 $cultureId = $culture["ID"];
             } else {
                 $addResult = CultureTable::add(array("NAME" => $newSiteID, "CODE" => $newSiteID, "FORMAT_DATE" => FORMAT_DATE, "FORMAT_DATETIME" => FORMAT_DATETIME, "FORMAT_NAME" => CSite::GetDefaultNameFormat(), "CHARSET" => SITE_CHARSET));
                 $cultureId = $addResult->getId();
             }
             $arFields = array("LID" => $newSiteID, "ACTIVE" => "Y", "SORT" => 100, "DEF" => "N", "NAME" => $newSiteID, "DIR" => "/site_" . $newSiteID . "/", "SITE_NAME" => $newSiteID, "SERVER_NAME" => $_SERVER["SERVER_NAME"], "EMAIL" => COption::GetOptionString("main", "email_from"), "LANGUAGE_ID" => LANGUAGE_ID, "DOC_ROOT" => "", "CULTURE_ID" => $cultureId);
             $obSite = new CSite();
             $result = $obSite->Add($arFields);
             if ($result) {
                 CheckDirPath($_SERVER["DOCUMENT_ROOT"] . "/site_" . $newSiteID . "/");
                 $indexContent = '<' . '?' . 'define("B_PROLOG_INCLUDED", true);' . 'define("WIZARD_DEFAULT_SITE_ID", "' . $newSiteID . '");' . 'define("WIZARD_DEFAULT_TONLY", true);' . 'define("PRE_LANGUAGE_ID","' . LANGUAGE_ID . '");' . 'define("PRE_INSTALL_CHARSET","' . SITE_CHARSET . '");' . 'include_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/install/wizard/wizard.php");' . '?' . '>';
                 $handler = fopen($_SERVER["DOCUMENT_ROOT"] . "/site_" . $newSiteID . "/index.php", "wb");
                 fwrite($handler, $indexContent);
                 fclose($handler);
                 LocalRedirect("/site_" . $newSiteID . "/");
             } else {
                 echo $obSite->LAST_ERROR;
             }
         }
         if ($_REQUEST['delete_button_sol'] == 'sol' && check_bitrix_sessid()) {
             UnRegisterModuleDependences('main', 'OnBeforeProlog', 'main', 'CWizardSolPanel', 'ShowPanel', '/modules/main/install/wizard_sol/panel_button.php');
             LocalRedirect($APPLICATION->GetCurPage());
         }
         $arMenu = array(array("ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape(SITE_DIR) . "?add_new_site_sol=sol&" . bitrix_sessid_get() . "')", "TEXT" => "<b>" . GetMessage("SOL_BUTTON_TEST_TEXT", array("#BR#" => " ")) . "</b>", "TITLE" => GetMessage("SOL_BUTTON_TEST_TITLE")));
         $arMenu[] = array("ACTION" => "if(confirm('" . AddSlashes(GetMessage("SOL_BUTTON_CONFIRM_W2")) . "')) jsUtils.Redirect([], '" . CUtil::JSEscape(SITE_DIR) . "?delete_button_sol=sol&" . bitrix_sessid_get() . "');", "TEXT" => GetMessage("SOL_BUTTON_DEL_TEXT"), "TITLE" => GetMessage("SOL_BUTTON_DEL_TITLE"));
         $protocol = CMain::IsHTTPS() ? 'https://' : 'http://';
         $arSites = array();
         $dbrSites = CSite::GetList($by, $ord, array("ACTIVE" => "Y"));
         while ($arSite = $dbrSites->GetNext()) {
             $url = $arSite["DIR"];
             if ($arSite["DOMAIN_LIMITED"] == "Y" && $arSite["LID"] != SITE_ID) {
                 $site = trim(preg_replace("#^(http://|https://)#i", "", $arSite["SERVER_NAME"]), " \t\n\r\v/");
                 if ($site != '') {
                     $url = $protocol . $site . '/' . ltrim($url, '/');
                 }
             }
             $arSites[] = array("ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "');", "ICON" => $arSite["LID"] == SITE_ID ? "checked" : "", "TEXT" => $arSite["NAME"], "TITLE" => GetMessage("SOL_BUTTON_GOTOSITE") . " " . $arSite["NAME"]);
         }
         $arMenu[] = array("SEPARATOR" => true);
         $arMenu[] = array("TEXT" => GetMessage("SOL_BUTTON_GOTOSITE"), "MENU" => $arSites);
         $APPLICATION->AddPanelButton(array("HREF" => SITE_DIR . "?add_new_site_sol=sol&" . bitrix_sessid_get(), "ID" => "solutions_wizard", "ICON" => "bx-panel-install-solution-icon", "TYPE" => "BIG", "ALT" => GetMessage("SOL_BUTTON_TEST_TITLE"), "TEXT" => GetMessage("SOL_BUTTON_TEST_TEXT"), "MAIN_SORT" => 2520, "SORT" => 20, "MENU" => $arMenu, 'HINT' => array('TITLE' => str_replace('#BR#', ' ', GetMessage("SOL_BUTTON_TEST_TEXT")), 'TEXT' => GetMessage('SOL_BUTTON_TEST_TEXT_HINT')), 'HINT_MENU' => array('TITLE' => str_replace('#BR#', ' ', GetMessage("SOL_BUTTON_TEST_TEXT")), 'TEXT' => GetMessage('SOL_BUTTON_TEST_MENU_HINT'))));
     }
 }
Ejemplo n.º 4
0
 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();
     $addResult = CultureTable::add(array("NAME" => LANGUAGE_ID, "CODE" => LANGUAGE_ID, "FORMAT_DATE" => GetMessage("MAIN_DEFAULT_LANGUAGE_FORMAT_DATE"), "FORMAT_DATETIME" => GetMessage("MAIN_DEFAULT_LANGUAGE_FORMAT_DATETIME"), "FORMAT_NAME" => GetMessage("MAIN_DEFAULT_LANGUAGE_FORMAT_NAME"), "WEEK_START" => LANGUAGE_ID == 'en' ? 0 : 1, "CHARSET" => defined("BX_UTF") ? "UTF-8" : GetMessage("MAIN_DEFAULT_LANGUAGE_FORMAT_CHARSET")));
     $cultureId = $addResult->getId();
     $arLanguages = array(array("LID" => LANGUAGE_ID, "ACTIVE" => "Y", "SORT" => 1, "DEF" => "Y", "NAME" => GetMessage("MAIN_DEFAULT_LANGUAGE_NAME"), "CULTURE_ID" => $cultureId));
     if (LANGUAGE_ID != "en") {
         $addResult = CultureTable::add(array("NAME" => "en", "CODE" => "en", "FORMAT_DATE" => "MM/DD/YYYY", "FORMAT_DATETIME" => "MM/DD/YYYY H:MI:SS T", "FORMAT_NAME" => "#NAME# #LAST_NAME#", "WEEK_START" => 0, "CHARSET" => defined("BX_UTF") ? "UTF-8" : "iso-8859-1"));
         $cultureId = $addResult->getId();
         $arLanguages[] = array("LID" => "en", "ACTIVE" => "Y", "SORT" => 2, "DEF" => "N", "NAME" => "English", "CULTURE_ID" => $cultureId);
     }
     if (LANGUAGE_ID != "de" && file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/lang/de/install/index.php')) {
         $addResult = CultureTable::add(array("NAME" => "de", "CODE" => "de", "FORMAT_DATE" => "DD.MM.YYYY", "FORMAT_DATETIME" => "DD.MM.YYYY HH:MI:SS", "FORMAT_NAME" => "#NAME# #LAST_NAME#", "WEEK_START" => 1, "CHARSET" => defined("BX_UTF") ? "UTF-8" : "iso-8859-1"));
         $cultureId = $addResult->getId();
         $arLanguages[] = array("LID" => "de", "ACTIVE" => "Y", "SORT" => 3, "DEF" => "N", "NAME" => "German", "CULTURE_ID" => $cultureId);
     }
     if (LANGUAGE_ID != "ua" && file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/lang/ua/install/index.php')) {
         $addResult = CultureTable::add(array("NAME" => "ua", "CODE" => "ua", "FORMAT_DATE" => "DD.MM.YYYY", "FORMAT_DATETIME" => "DD.MM.YYYY HH:MI:SS", "FORMAT_NAME" => "#NAME# #LAST_NAME#", "WEEK_START" => 1, "CHARSET" => defined("BX_UTF") ? "UTF-8" : "windows-1251"));
         $cultureId = $addResult->getId();
         $arLanguages[] = array("LID" => "ua", "ACTIVE" => "Y", "SORT" => 4, "DEF" => "N", "NAME" => "Ukrainian", "CULTURE_ID" => $cultureId);
     }
     if (LANGUAGE_ID != "ru" && file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/lang/ru/install/index.php')) {
         $addResult = CultureTable::add(array("NAME" => "ru", "CODE" => "ru", "FORMAT_DATE" => "DD.MM.YYYY", "FORMAT_DATETIME" => "DD.MM.YYYY HH:MI:SS", "FORMAT_NAME" => "#NAME# #LAST_NAME#", "WEEK_START" => 1, "CHARSET" => defined("BX_UTF") ? "UTF-8" : "windows-1251"));
         $cultureId = $addResult->getId();
         $arLanguages[] = array("LID" => "ru", "ACTIVE" => "Y", "SORT" => 3, "DEF" => "N", "NAME" => "Russian", "CULTURE_ID" => $cultureId);
     }
     $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;
         }
     }
     $culture = CultureTable::getRow(array('filter' => array("=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"))));
     if ($culture) {
         $cultureId = $culture["ID"];
     } else {
         $addResult = CultureTable::add(array("NAME" => "s1", "CODE" => "s1", "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")));
         $cultureId = $addResult->getId();
     }
     $arSite = array("LID" => "s1", "ACTIVE" => "Y", "SORT" => 1, "DEF" => "Y", "NAME" => GetMessage("MAIN_DEFAULT_SITE_NAME"), "DIR" => "/", "LANGUAGE_ID" => LANGUAGE_ID, "CULTURE_ID" => $cultureId);
     $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;
         }
     }
     if (!defined('BX_UTF_PCRE_MODIFIER')) {
         define('BX_UTF_PCRE_MODIFIER', defined('BX_UTF') ? 'u' : '');
     }
     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', 'OnAfterSetUserGroup', 'main', 'CGroupAuthProvider', 'OnAfterSetUserGroup');
     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", "CUserTypeDate", "GetUserTypeDescription", 145);
     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);
     RegisterModuleDependences("main", "OnBeforeEndBufferContent", "main", "\\Bitrix\\Main\\Analytics\\Counter", "onBeforeEndBufferContent");
     RegisterModuleDependences("main", "OnBeforeRestartBuffer", "main", "\\Bitrix\\Main\\Analytics\\Counter", "onBeforeRestartBuffer");
     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);
     if (!file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/bitrix24')) {
         CAgent::AddAgent("CSiteCheckerTest::CommonTest();", "main", "N", 86400, "", "Y", ConvertTimeStamp(strtotime(date('Y-m-d 03:00:00', time() + 86400)), 'FULL'));
     }
     self::InstallDesktop();
     self::InstallSmiles();
     return true;
 }
Ejemplo n.º 5
0
    die;
}
if (!defined("WIZARD_SITE_ID")) {
    return;
}
use Bitrix\Main\Localization\CultureTable;
$site_id = "";
if (COption::GetOptionString("main", "site_personal_create", "N") == "Y") {
    $site_id = COption::GetOptionString("main", "site_personal_id");
    $db_res = CSite::GetList($by = "sort", $order = "desc", array("LID" => $site_id));
    if (!($db_res && ($res = $db_res->Fetch()))) {
        $culture = CultureTable::getRow(array('filter' => array("=FORMAT_DATE" => "DD.MM.YYYY", "=FORMAT_DATETIME" => "DD.MM.YYYY HH:MI:SS", "=FORMAT_NAME" => CSite::GetDefaultNameFormat(), "=CHARSET" => defined("BX_UTF") ? "UTF-8" : "windows-1251")));
        if ($culture) {
            $cultureId = $culture["ID"];
        } else {
            $addResult = CultureTable::add(array("NAME" => $site_id, "CODE" => $site_id, "FORMAT_DATE" => "DD.MM.YYYY", "FORMAT_DATETIME" => "DD.MM.YYYY HH:MI:SS", "FORMAT_NAME" => CSite::GetDefaultNameFormat(), "CHARSET" => defined("BX_UTF") ? "UTF-8" : "windows-1251"));
            $cultureId = $addResult->getId();
        }
        $arFields = array("LID" => $site_id, "ACTIVE" => "Y", "SORT" => 100, "DEF" => "N", "NAME" => GetMessage("wiz_site_personal_name"), "DIR" => COption::GetOptionString("main", "site_personal_folder"), "SITE_NAME" => GetMessage("wiz_site_personal_name"), "SERVER_NAME" => $_SERVER["SERVER_NAME"], "EMAIL" => COption::GetOptionString("main", "email_from"), "LANGUAGE_ID" => LANGUAGE_ID, "DOC_ROOT" => "", "CULTURE_ID" => $cultureId);
        $obSite = new CSite();
        $result = $obSite->Add($arFields);
        if ($result) {
            COption::SetOptionString("main", "site_personal_create", "N");
        } else {
            echo $obSite->LAST_ERROR;
            die;
        }
    }
}
COption::SetOptionString("main", "new_user_registration", "N");
COption::SetOptionString('socialnetwork', 'allow_tooltip', 'N', false, $site_id);
Ejemplo n.º 6
0
        $SERVER_NAME = $arSite["SERVER_NAME"];
    } else {
        $FORMAT_DATE = "DD.MM.YYYY";
        $FORMAT_DATETIME = "DD.MM.YYYY HH:MI:SS";
        $FORMAT_NAME = CSite::GetDefaultNameFormat();
        $EMAIL = COption::GetOptionString("main", "email_from");
        $LANGUAGE_ID = LANGUAGE_ID;
        $DOC_ROOT = "";
        $CHARSET = defined("BX_UTF") ? "UTF-8" : "windows-1251";
        $SERVER_NAME = $_SERVER["SERVER_NAME"];
    }
    $culture = CultureTable::getRow(array('filter' => array("=FORMAT_DATE" => $FORMAT_DATE, "=FORMAT_DATETIME" => $FORMAT_DATETIME, "=FORMAT_NAME" => $FORMAT_NAME, "=CHARSET" => $CHARSET)));
    if ($culture) {
        $cultureId = $culture["ID"];
    } else {
        $addResult = CultureTable::add(array("NAME" => WIZARD_SITE_ID, "CODE" => WIZARD_SITE_ID, "FORMAT_DATE" => $FORMAT_DATE, "FORMAT_DATETIME" => $FORMAT_DATETIME, "FORMAT_NAME" => $FORMAT_NAME, "CHARSET" => $CHARSET));
        $cultureId = $addResult->getId();
    }
    $arFields = array("LID" => WIZARD_SITE_ID, "ACTIVE" => "Y", "SORT" => 100, "DEF" => "N", "NAME" => WIZARD_SITE_NAME, "DIR" => WIZARD_SITE_DIR, "SITE_NAME" => WIZARD_SITE_NAME, "SERVER_NAME" => $SERVER_NAME, "EMAIL" => $EMAIL, "LANGUAGE_ID" => $LANGUAGE_ID, "DOC_ROOT" => $DOC_ROOT, "CULTURE_ID" => $cultureId);
    $obSite = new CSite();
    $result = $obSite->Add($arFields);
    if ($result) {
        COption::SetOptionString("main", "wizard_site_id", WIZARD_SITE_ID);
        COption::SetOptionString("extranet", "extranet_site", WIZARD_SITE_ID);
    }
    CExtranetWizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "/", array("SITE_DIR" => WIZARD_SITE_DIR));
    CExtranetWizardServices::ReplaceMacrosRecursive(WIZARD_TEMPLATE_ABSOLUTE_PATH . "/", array("SITE_DIR" => WIZARD_SITE_DIR));
    CUrlRewriter::Add(array("SITE_ID" => WIZARD_SITE_ID, "CONDITION" => "#^" . WIZARD_SITE_DIR . "workgroups/#", "ID" => "bitrix:socialnetwork_group", "PATH" => WIZARD_SITE_DIR . "workgroups/index.php"));
    CUrlRewriter::Add(array("SITE_ID" => WIZARD_SITE_ID, "CONDITION" => "#^" . WIZARD_SITE_DIR . "workgroups/create/#", "ID" => "bitrix:extranet.group_create", "PATH" => WIZARD_SITE_DIR . "workgroups/create/index.php"));
    CUrlRewriter::Add(array("SITE_ID" => WIZARD_SITE_ID, "CONDITION" => "#^" . WIZARD_SITE_DIR . "contacts/personal/#", "ID" => "bitrix:socialnetwork_user", "PATH" => WIZARD_SITE_DIR . "contacts/personal.php"));
} else {
Ejemplo n.º 7
0
 function OnPostForm()
 {
     $wizard =& $this->GetWizard();
     $serviceID = $wizard->GetVar("nextStep");
     $serviceStage = $wizard->GetVar("nextStepStage");
     if ($serviceID == "finish") {
         $wizard->SetCurrentStep("finish");
         return;
     }
     $defSiteName = GetMessage("wiz_site_default_name");
     if (GetMessage("wiz_site_name") != "") {
         $defSiteName = GetMessage("wiz_site_name");
     } elseif ($wizard->wizardName != "") {
         $defSiteName = $wizard->wizardName;
     }
     $res = false;
     $site_id = $wizard->GetVar("siteID");
     if ($site_id != "") {
         $db_res = CSite::GetList($by = "sort", $order = "desc", array("LID" => $site_id));
         if ($db_res) {
             $res = $db_res->Fetch();
         }
     }
     if ($wizard->GetVar("siteCreate") == "Y") {
         if (!$res) {
             $culture = CultureTable::getRow(array('filter' => array("=FORMAT_DATE" => LANGUAGE_ID == "en" ? "MM/DD/YYYY" : "DD.MM.YYYY", "=FORMAT_DATETIME" => LANGUAGE_ID == "en" ? "MM/DD/YYYY H:MI:SS T" : "DD.MM.YYYY HH:MI:SS", "=FORMAT_NAME" => CSite::GetDefaultNameFormat(), "=CHARSET" => defined("BX_UTF") ? "UTF-8" : (LANGUAGE_ID == "ru" ? "windows-1251" : "ISO-8859-1"))));
             if ($culture) {
                 $cultureId = $culture["ID"];
             } else {
                 $addResult = CultureTable::add(array("NAME" => $site_id, "CODE" => $site_id, "FORMAT_DATE" => LANGUAGE_ID == "en" ? "MM/DD/YYYY" : "DD.MM.YYYY", "FORMAT_DATETIME" => LANGUAGE_ID == "en" ? "MM/DD/YYYY H:MI:SS T" : "DD.MM.YYYY HH:MI:SS", "FORMAT_NAME" => CSite::GetDefaultNameFormat(), "CHARSET" => defined("BX_UTF") ? "UTF-8" : (LANGUAGE_ID == "ru" ? "windows-1251" : "ISO-8859-1")));
                 $cultureId = $addResult->getId();
             }
             $arFields = array("LID" => $site_id, "ACTIVE" => "Y", "SORT" => 100, "DEF" => "N", "NAME" => $defSiteName, "DIR" => $wizard->GetVar("siteFolder"), "SITE_NAME" => $defSiteName, "SERVER_NAME" => $_SERVER["SERVER_NAME"], "EMAIL" => COption::GetOptionString("main", "email_from"), "LANGUAGE_ID" => LANGUAGE_ID, "DOC_ROOT" => "", "CULTURE_ID" => $cultureId);
             $obSite = new CSite();
             $result = $obSite->Add($arFields);
             if (!$result) {
                 echo $obSite->LAST_ERROR;
                 die;
             }
         }
         $wizard->SetVar("siteCreate", "N");
     }
     $pattern = '/^(.*):(.*)\\((.*)\\)/';
     preg_match($pattern, $res["NAME"], $matches);
     if ($res && (count($matches) > 0 || $res["NAME"] == $site_id) && $site_id != "s1") {
         $templateID = $wizard->GetVar("templateID");
         $themeVarName = $templateID . "_themeID";
         $themeID = $wizard->GetVar($themeVarName);
         $templatesPath = WizardServices::GetTemplatesPath($wizard->GetPath() . "/site");
         $arTemplates = WizardServices::GetTemplates($templatesPath);
         $templatesPath = WizardServices::GetTemplatesPath($wizard->GetPath() . "/site");
         $arThemes = WizardServices::GetThemes($templatesPath . "/" . $templateID . "/themes", $templatesPath . "/" . $templateID);
         $siteNemNew = $defSiteName . ": " . $arTemplates[$templateID]["NAME"] . ' (' . $arThemes[$themeID]["NAME"] . ')';
         $obSite = new CSite();
         $obSite->Update($site_id, array("NAME" => $siteNemNew, "SITE_NAME" => $siteNemNew));
     } elseif ($res["NAME"] == GetMessage("MAIN_DEFAULT_SITE_NAME")) {
         $SiteNAME = $defSiteName . " (" . GetMessage("MAIN_DEFAULT_SITE_NAME") . ")";
         $obSite = new CSite();
         $obSite->Update($site_id, array("NAME" => $SiteNAME, "SITE_NAME" => $defSiteName));
     }
     CModule::IncludeModule('fileman');
     COption::SetOptionString("fileman", "different_set", "Y");
     $arMenuTypes = GetMenuTypes($site_id);
     if (count($arMenuTypes) == 0) {
         $arMenuTypes = array('left' => GetMessage("WIZ_MENU_LEFT"), 'top' => GetMessage("WIZ_MENU_TOP"), 'bottom' => GetMessage("WIZ_MENU_BOTTOM"));
     } else {
         if (!$arMenuTypes['left'] || $arMenuTypes['left'] == GetMessage("WIZ_MENU_LEFT_DEFAULT")) {
             $arMenuTypes['left'] = GetMessage("WIZ_MENU_LEFT");
         }
         if (!$arMenuTypes['top'] || $arMenuTypes['top'] == GetMessage("WIZ_MENU_TOP_DEFAULT")) {
             $arMenuTypes['top'] = GetMessage("WIZ_MENU_TOP");
         }
         if (!$arMenuTypes['bottom']) {
             $arMenuTypes['bottom'] = GetMessage("WIZ_MENU_BOTTOM");
         }
     }
     SetMenuTypes($arMenuTypes, $site_id);
     $arServices = WizardServices::GetServices($_SERVER["DOCUMENT_ROOT"] . $wizard->GetPath(), "/site/services/");
     $this->CorrectServices($arServices);
     if ($serviceStage == "skip") {
         $success = true;
     } else {
         $success = $this->InstallService($serviceID, $serviceStage);
     }
     if (!$this->repeatCurrentService) {
         list($nextService, $nextServiceStage, $stepsComplete, $status) = $this->GetNextStep($arServices, $serviceID, $serviceStage);
     }
     if ($nextService == "finish") {
         $response = "window.ajaxForm.StopAjax(); window.ajaxForm.SetStatus('100'); window.ajaxForm.Post('" . $nextService . "', '" . $nextServiceStage . "','" . $status . "');";
         COption::SetOptionString("main", "wizard_first" . substr($wizard->GetID(), 7) . "_" . $wizard->GetVar("siteID"), "Y", false);
     } else {
         $arServiceID = array_keys($arServices);
         $lastService = array_pop($arServiceID);
         $stepsCount = $arServices[$lastService]["POSITION"];
         if (array_key_exists("STAGES", $arServices[$lastService]) && is_array($arServices[$lastService])) {
             $stepsCount += count($arServices[$lastService]["STAGES"]) - 1;
         }
         $percent = round($stepsComplete / $stepsCount * 100);
         $response = "window.ajaxForm.SetStatus('" . $percent . "'); window.ajaxForm.Post('" . $nextService . "', '" . $nextServiceStage . "','" . $status . "');";
     }
     die("[response]" . $response . "[/response]");
 }
Ejemplo n.º 8
0
 } else {
     if (isset($arStepUpdateInfo["DATA"]["#"]["ITEM"])) {
         $ar = array();
         $dbRes = CLanguage::GetList($by = "sort", $order = "asc", array("ACTIVE" => "Y"));
         while ($arRes = $dbRes->Fetch()) {
             $ar[] = $arRes["ID"];
         }
         for ($i = 0, $cnt = count($arStepUpdateInfo["DATA"]["#"]["ITEM"]); $i < $cnt; $i++) {
             if (isset($arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["ID"]) && !in_array($arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["ID"], $ar)) {
                 $cultureId = false;
                 if (class_exists('\\Bitrix\\Main\\Localization\\CultureTable')) {
                     $culture = \Bitrix\Main\Localization\CultureTable::getRow(array('filter' => array("=FORMAT_DATE" => $arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["FORMAT_DATE"], "=FORMAT_DATETIME" => $arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["FORMAT_DATETIME"], "=CHARSET" => defined('BX_UTF') ? "utf-8" : $arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["ENC"], "=DIRECTION" => $arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["DIRECTION"])));
                     if ($culture) {
                         $cultureId = $culture["ID"];
                     } else {
                         $addResult = \Bitrix\Main\Localization\CultureTable::add(array("NAME" => $arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["ID"], "CODE" => $arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["ID"], "FORMAT_DATE" => $arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["FORMAT_DATE"], "FORMAT_DATETIME" => $arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["FORMAT_DATETIME"], "FORMAT_NAME" => "#NAME# #LAST_NAME#", "CHARSET" => defined('BX_UTF') ? "utf-8" : $arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["ENC"], "DIRECTION" => $arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["DIRECTION"]));
                         $cultureId = $addResult->getId();
                     }
                 }
                 $arF = array("LID" => $arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["ID"], "NAME" => $arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["NAME_EN"], "FORMAT_DATE" => $arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["FORMAT_DATE"], "FORMAT_DATETIME" => $arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["FORMAT_DATETIME"], "CHARSET" => defined('BX_UTF') ? "utf-8" : $arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["ENC"], "DIRECTION" => $arStepUpdateInfo["DATA"]["#"]["ITEM"][$i]["@"]["DIRECTION"], "ACTIVE" => "Y", "CULTURE_ID" => $cultureId);
                 $l = new CLanguage();
                 $l->Add($arF);
             }
         }
     }
     echo "STP";
     echo count($arItemsUpdated) . "|";
     $bFirst = True;
     foreach ($arItemsUpdated as $key => $value) {
         CUpdateClient::AddMessage2Log("Updated: " . $key . (StrLen($value) > 0 ? "(" . $value . ")" : ""), "UPD_SUCCESS");
         echo ($bFirst ? "" : ", ") . $key . (StrLen($value) > 0 ? "(" . $value . ")" : "");