Exemplo n.º 1
0
 function GetUserName($USER_ID, $sNameTemplate = "")
 {
     $sNameTemplate = str_replace(array("#NOBR#", "#/NOBR#"), "", !empty($sNameTemplate) ? $sNameTemplate : CSite::GetDefaultNameFormat());
     if (intval($USER_ID) <= 0) {
         $db_res = CUser::GetByLogin($USER_ID);
         $ar_res = $db_res->Fetch();
         $USER_ID = $ar_res["ID"];
     }
     return CForumUser::GetFormattedNameByUserID($USER_ID, $sNameTemplate);
 }
Exemplo n.º 2
0
	function forumTextParser($lang = false, $pathToSmiles = '', $type=false, $mode = 'full')
	{
		$this->CTextParser();
		$lang = (($lang === false) ? LANGUAGE_ID : $lang);
		$arResult = array();
		$this->arFiles = array();
		$this->arFilesParsed = array();
		$this->serverName = (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", ""));
		$this->serverName = (strlen($this->serverName) > 0 ? $this->serverName : $_SERVER["SERVER_NAME"]);
		$pathToSmiles = (!empty($pathToSmiles) ? $pathToSmiles : "/bitrix/images/forum/smile/");
		$this->arUserfields = array();
		$this->ajaxPage = $GLOBALS["APPLICATION"]->GetCurPageParam("", array("bxajaxid", "logout"));
		$this->userPath = "";
		$this->userNameTemplate = str_replace(array("#NOBR#","#/NOBR#"), "", CSite::GetDefaultNameFormat());

		if ($mode == 'full')
		{
			$arSmiles = CForumSmile::GetByType("S", $lang);
			$arResult["SMILES_FOR_PARSER"] = array();
			foreach($arSmiles as $key=>$smile)
			{
				$arTypings = explode(" ", $smile["TYPING"]);
				foreach ($arTypings as $typing)
				{
					$arResult["SMILES_FOR_PARSER"][] =
						array(
							'TYPING' => $typing,
							'IMAGE'  => $pathToSmiles.$smile["IMAGE"],
							'DESCRIPTION' => $smile["NAME"]
						) +
						$smile;

					$tok = str_replace(array(chr(34), chr(39), "<", ">"), array("\013", "\014", "&lt;", "&gt;"), $typing);
					$code = preg_quote(str_replace(array("\x5C"), array("&#092;"), $tok));
					$patt = preg_quote($tok, "/");

					$image = preg_quote(stripslashes($smile["IMAGE"]));
					$description = preg_quote(htmlspecialcharsbx(stripslashes($smile["NAME"]), ENT_QUOTES), "/");

					$arResult['pattern'][] = "\$this->convert_emoticon('$code', '$image', '$description')";
					$arResult['replace'][] = "/(?<=[^\w&])$patt(?=.\W|\W.|\W$)/ei".BX_UTF_PCRE_MODIFIER;
				}
			}
			$this->smiles = $arResult["SMILES_FOR_PARSER"];
			$this->preg_smiles = array(
				"pattern" => $arResult["pattern"],
				"replace" => $arResult["replace"]
			);

			AddEventHandler("main", "TextParserBeforeTags", Array(&$this, "ParserSpoiler"));
			AddEventHandler("main", "TextParserAfterTags", Array(&$this, "ParserFile"));
			AddEventHandler("main", "TextParserAfterTags", Array(&$this, "ParserUser"));
		}
	}
Exemplo 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) {
                 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'))));
     }
 }
Exemplo n.º 4
0
 function forumTextParser($lang = false, $pathToSmiles = '', $type = false, $mode = 'full')
 {
     $this->CTextParser();
     $this->arFiles = array();
     $this->arFilesParsed = array();
     $this->serverName = defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", "");
     $this->serverName = strlen($this->serverName) > 0 ? $this->serverName : $_SERVER["SERVER_NAME"];
     $this->arUserfields = array();
     $this->ajaxPage = $GLOBALS["APPLICATION"]->GetCurPageParam("", array("bxajaxid", "logout"));
     $this->userPath = "";
     $this->userNameTemplate = str_replace(array("#NOBR#", "#/NOBR#"), "", CSite::GetDefaultNameFormat());
     $this->smilesGallery = \COption::GetOptionInt("forum", "smile_gallery_id", 0);
     if ($mode == 'full') {
         AddEventHandler("main", "TextParserBeforeTags", array(&$this, "ParserSpoiler"));
         AddEventHandler("main", "TextParserAfterTags", array(&$this, "ParserFile"));
         AddEventHandler("main", "TextParserAfterTags", array(&$this, "ParserUser"));
     }
 }
Exemplo n.º 5
0
    } else {
        $errors = $result->getErrorMessages();
    }
}
if (empty($errors)) {
    $culture = false;
    if ($ID > 0 || $COPY_ID > 0) {
        $cultureId = $COPY_ID > 0 ? $COPY_ID : $ID;
        $culture = CultureTable::getById($cultureId)->fetch();
    }
    if ($culture == false) {
        $weekStart = Loc::getMessage('LANG_EDIT_WEEK_START_DEFAULT');
        if ($weekStart == '') {
            $weekStart = 1;
        }
        $culture = array("WEEK_START" => $weekStart, "FORMAT_NAME" => CSite::GetDefaultNameFormat());
    }
} else {
    $culture = $request->getPostList()->toArray();
}
$APPLICATION->SetTitle($ID > 0 ? Loc::getMessage("EDIT_LANG_TITLE") : Loc::getMessage("NEW_LANG_TITLE"));
require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/prolog_admin_after.php";
$aMenu = array(array("TEXT" => Loc::getMessage("RECORD_LIST"), "LINK" => "/bitrix/admin/culture_admin.php?lang=" . LANGUAGE_ID, "TITLE" => Loc::getMessage("RECORD_LIST_TITLE"), "ICON" => "btn_list"));
if ($ID > 0 && $isAdmin) {
    $aMenu[] = array("SEPARATOR" => "Y");
    $aMenu[] = array("TEXT" => Loc::getMessage("MAIN_NEW_RECORD"), "LINK" => "/bitrix/admin/culture_edit.php?lang=" . LANGUAGE_ID, "TITLE" => Loc::getMessage("MAIN_NEW_RECORD_TITLE"), "ICON" => "btn_new");
    $aMenu[] = array("TEXT" => Loc::getMessage("MAIN_COPY_RECORD"), "LINK" => "/bitrix/admin/culture_edit.php?lang=" . LANGUAGE_ID . "&amp;COPY_ID=" . $ID, "TITLE" => Loc::getMessage("MAIN_COPY_RECORD_TITLE"), "ICON" => "btn_copy");
    $aMenu[] = array("TEXT" => Loc::getMessage("MAIN_DELETE_RECORD"), "LINK" => "javascript:if(confirm('" . CUtil::JSEscape(Loc::getMessage("MAIN_DELETE_RECORD_CONF")) . "')) window.location='/bitrix/admin/culture_admin.php?ID=" . $ID . "&lang=" . LANGUAGE_ID . "&" . bitrix_sessid_get() . "&action_button=delete';", "TITLE" => Loc::getMessage("MAIN_DELETE_RECORD_TITLE"), "ICON" => "btn_delete");
}
$context = new CAdminContextMenu($aMenu);
$context->Show();
Exemplo n.º 6
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'))));
     }
 }
Exemplo n.º 7
0
InitSorting($GLOBALS["APPLICATION"]->GetCurPage() . "?PAGE_NAME=pm_list&FID=" . $arParams["FID"]);
global $by, $order;
/***************** URL *********************************************/
$URL_NAME_DEFAULT = array("pm_list" => "PAGE_NAME=pm_list&FID=#FID#", "pm_read" => "PAGE_NAME=pm_read&FID=#FID#&MID=#MID#", "pm_edit" => "PAGE_NAME=pm_edit&FID=#FID#&MID=#MID#&mode=#mode#", "pm_search" => "PAGE_NAME=pm_search", "pm_folder" => "PAGE_NAME=pm_folder", "profile_view" => "PAGE_NAME=profile_view&UID=#UID#");
foreach ($URL_NAME_DEFAULT as $URL => $URL_VALUE) {
    if (strLen(trim($arParams["URL_TEMPLATES_" . strToUpper($URL)])) <= 0) {
        $arParams["URL_TEMPLATES_" . strToUpper($URL)] = $APPLICATION->GetCurPageParam($URL_VALUE, array("PAGE_NAME", "FID", "TID", "UID", "MID", "mode", BX_AJAX_PARAM_ID));
    }
    $arParams["~URL_TEMPLATES_" . strToUpper($URL)] = $arParams["URL_TEMPLATES_" . strToUpper($URL)];
    if (!empty($by) && !in_array($URL, array("profile_view", "pm_read", "pm_edit"))) {
        $arParams["~URL_TEMPLATES_" . strToUpper($URL)] = ForumAddPageParams($arParams["URL_TEMPLATES_" . strToUpper($URL)], array("by" => $by, "order" => $order), false, false);
    }
    $arParams["URL_TEMPLATES_" . strToUpper($URL)] = htmlspecialcharsbx($arParams["~URL_TEMPLATES_" . strToUpper($URL)]);
}
/***************** ADDITIONAL **************************************/
$arParams["NAME_TEMPLATE"] = str_replace(array("#NOBR#", "#/NOBR#"), "", !empty($arParams["NAME_TEMPLATE"]) ? $arParams["NAME_TEMPLATE"] : CSite::GetDefaultNameFormat());
$arParams["PATH_TO_SMILE"] = "";
$arParams["EDITOR_CODE_DEFAULT"] = $arParams["EDITOR_CODE_DEFAULT"] == "Y" ? "Y" : "N";
$arParams["AUTOSAVE"] = CForumAutosave::GetInstance();
/***************** STANDART ****************************************/
$arParams["SET_NAVIGATION"] = $arParams["SET_NAVIGATION"] == "Y" ? "Y" : "N";
if ($arParams["CACHE_TYPE"] == "Y" || $arParams["CACHE_TYPE"] == "A" && COption::GetOptionString("main", "component_cache_on", "Y") == "Y") {
    $arParams["CACHE_TIME"] = intval($arParams["CACHE_TIME"]);
} else {
    $arParams["CACHE_TIME"] = 0;
}
$arParams["SET_TITLE"] = $arParams["SET_TITLE"] == "N" ? "N" : "Y";
/********************************************************************
				/Input params
********************************************************************/
$arResult["MESSAGE"] = array();
Exemplo n.º 8
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) {
             $arFields = array("LID" => $site_id, "ACTIVE" => "Y", "SORT" => 100, "DEF" => "N", "NAME" => $defSiteName, "DIR" => $wizard->GetVar("siteFolder"), "FORMAT_DATE" => LANGUAGE_ID == "en" ? "MM/DD/YYYY" : "DD.MM.YYYY", "FORMAT_DATETIME" => LANGUAGE_ID == "en" ? "MM/DD/YYYY H:MI 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"), "SITE_NAME" => $defSiteName, "SERVER_NAME" => $_SERVER["SERVER_NAME"], "EMAIL" => COption::GetOptionString("main", "email_from"), "LANGUAGE_ID" => LANGUAGE_ID, "DOC_ROOT" => "");
             $obSite = new CSite();
             $result = $obSite->Add($arFields);
             if ($result) {
             } else {
                 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();
         $result = $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();
         $result = $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") {
         $formName = $wizard->GetFormName();
         $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, $siteID);
     } 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]");
 }
Exemplo n.º 9
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);
Exemplo n.º 10
0
 /**
  * Converts name template fields from Bitrix name template to SQL query fields
  *
  * @param string $sNameTemplate Bitrix name template (ex: #LAST_NAME# #NAME#). Uses site name template if empty @see CSite::GetNameTemplates
  * @return string (ex: U.LAST_NAME, U.NAME)
  */
 public static function GetNameFieldsForQuery($sNameTemplate, $userTablePrefix = "U.")
 {
     global $DB;
     $sNameTemplate = empty($sNameTemplate) ? CSite::GetDefaultNameFormat() : $sNameTemplate;
     if (!preg_match("/(#NAME#)|(#LAST_NAME#\\,)|(#LAST_NAME#)|(#SECOND_NAME#)|(#NAME_SHORT#)|(#SECOND_NAME_SHORT#)/" . BX_UTF_PCRE_MODIFIER, $sNameTemplate, $matches)) {
         $sNameTemplate = CSite::GetDefaultNameFormat();
     }
     if (strpos($sNameTemplate, "#NOBR#") !== false) {
         $sNameTemplate = preg_replace("/\\#NOBR\\#(.+?)\\#\\/NOBR\\#/" . BX_UTF_PCRE_MODIFIER, "\\1", $sNameTemplate);
     }
     preg_match_all("/(#NAME#)|(#LAST_NAME#\\,)|(#LAST_NAME#)|(#SECOND_NAME#)|(#NAME_SHORT#)|(#SECOND_NAME_SHORT#)/" . BX_UTF_PCRE_MODIFIER, $sNameTemplate, $matches);
     $tmp = array();
     foreach ($matches[0] as $val) {
         $pos = strpos($sNameTemplate, $val);
         if ($pos > 0) {
             $tmp[] = "'" . $DB->ForSql(substr($sNameTemplate, 0, $pos)) . "'";
         }
         $tmp[] = str_replace(array("#NAME#", "#LAST_NAME#,", "#LAST_NAME#", "#SECOND_NAME#", "#NAME_SHORT#", "#SECOND_NAME_SHORT#"), array($userTablePrefix . "NAME", "IF (LENGTH(TRIM(" . $userTablePrefix . "LAST_NAME)) <= 0, '', CONCAT(" . $userTablePrefix . "LAST_NAME, ','))", $userTablePrefix . "LAST_NAME", $userTablePrefix . "SECOND_NAME", "IF (LENGTH(TRIM(" . $userTablePrefix . "NAME)) <= 0,'',CONCAT(SUBSTRING(" . $userTablePrefix . "NAME,1,1),'.'))", "IF (LENGTH(TRIM(" . $userTablePrefix . "SECOND_NAME)) <= 0,'',CONCAT(SUBSTRING(" . $userTablePrefix . "SECOND_NAME,1,1),'.'))"), $val);
         $sNameTemplate = substr($sNameTemplate, $pos + strlen($val));
     }
     if (!empty($sNameTemplate)) {
         $tmp[] = "'" . $DB->ForSql($sNameTemplate) . "'";
     }
     $res = implode(",", $tmp);
     return !empty($res) ? $res : "''";
 }
Exemplo n.º 11
0
 /**
  * Converts name template fields from Bitrix name template to SQL query fields
  *
  * @param string $sNameTemplate Bitrix name template (ex: #LAST_NAME# #NAME#). Uses site name template if empty @see CSite::GetNameTemplates
  * @return string (ex: U.LAST_NAME, U.NAME)
  */
 function GetNameFieldsForQuery($sNameTemplate, $userTablePrefix = "U.")
 {
     $sNameTemplate = empty($sNameTemplate) ? CSite::GetDefaultNameFormat() : $sNameTemplate;
     //make sure the data is safe
     if (!preg_match_all("/(#NAME#)|(#LAST_NAME#)|(#SECOND_NAME#)|(#NAME_SHORT#)|(#SECOND_NAME_SHORT#)|\\s|\\,/" . BX_UTF_PCRE_MODIFIER, $sNameTemplate, $matches)) {
         preg_match_all("/(#NAME#)|(#LAST_NAME#)|(#SECOND_NAME#)|(#NAME_SHORT#)|(#SECOND_NAME_SHORT#)|\\s|\\,/" . BX_UTF_PCRE_MODIFIER, CSite::GetDefaultNameFormat(), $matches);
     }
     // Switching spaces to *** is necessary to save original spaces
     $res = str_replace(array(" ", "#NAME#", "#LAST_NAME#,", "#LAST_NAME#", "#SECOND_NAME#", "#NAME_SHORT#", "#SECOND_NAME_SHORT#", "***"), array("***", $userTablePrefix . "NAME", "IF (LENGTH(TRIM(" . $userTablePrefix . "LAST_NAME)) <= 0, '', CONCAT(" . $userTablePrefix . "LAST_NAME, ','))", $userTablePrefix . "LAST_NAME", $userTablePrefix . "SECOND_NAME", "IF (LENGTH(TRIM(" . $userTablePrefix . "NAME)) <= 0,'',CONCAT(SUBSTRING(" . $userTablePrefix . "NAME,1,1),'.'))", "IF (LENGTH(TRIM(" . $userTablePrefix . "SECOND_NAME)) <= 0,'',CONCAT(SUBSTRING(" . $userTablePrefix . "SECOND_NAME,1,1),'.'))", ","), implode("", $matches[0]));
     return $res;
 }
Exemplo n.º 12
0
}
if (WIZARD_IS_RERUN !== true || WIZARD_B24_TO_CP) {
    $rsSites = CSite::GetList($by = "sort", $order = "desc", array());
    if ($arSite = $rsSites->Fetch()) {
        $FORMAT_DATE = $arSite["FORMAT_DATE"];
        $FORMAT_DATETIME = $arSite["FORMAT_DATETIME"];
        $FORMAT_NAME = empty($arSite["FORMAT_NAME"]) ? CSite::GetDefaultNameFormat() : $arSite["FORMAT_NAME"];
        $EMAIL = $arSite["EMAIL"];
        $LANGUAGE_ID = $arSite["LANGUAGE_ID"];
        $DOC_ROOT = $arSite["DOC_ROOT"];
        $CHARSET = $arSite["CHARSET"];
        $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();
Exemplo n.º 13
0
{
	$culture = false;
	if($ID > 0 || $COPY_ID > 0)
	{
		$cultureId = ($COPY_ID > 0? $COPY_ID : $ID);
		$culture = CultureTable::getById($cultureId)->fetch();
	}

	if($culture == false)
	{
		$weekStart = Loc::getMessage('LANG_EDIT_WEEK_START_DEFAULT');
		if($weekStart == '')
			$weekStart = 1;
		$culture = array(
			"WEEK_START" => $weekStart,
			"FORMAT_NAME" => CSite::GetDefaultNameFormat(),
		);
	}
}
else
{
	$culture = $request->getPostList()->toArray();
	$culture["FORMAT_NAME"] = CSite::GetNameFormatByValue($request["FORMAT_NAME"]);
}

$APPLICATION->SetTitle(($ID > 0? Loc::getMessage("EDIT_LANG_TITLE") : Loc::getMessage("NEW_LANG_TITLE")));

require($_SERVER["DOCUMENT_ROOT"].FX_ROOT."/modules/main/include/prolog_admin_after.php");

$aMenu = array(
	array(
Exemplo n.º 14
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!defined("WIZARD_SITE_ID")) {
    return;
}
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()))) {
        $arFields = array("LID" => $site_id, "ACTIVE" => "Y", "SORT" => 100, "DEF" => "N", "NAME" => GetMessage("wiz_site_personal_name"), "DIR" => COption::GetOptionString("main", "site_personal_folder"), "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", "SITE_NAME" => GetMessage("wiz_site_personal_name"), "SERVER_NAME" => $_SERVER["SERVER_NAME"], "EMAIL" => COption::GetOptionString("main", "email_from"), "LANGUAGE_ID" => LANGUAGE_ID, "DOC_ROOT" => "");
        $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);