Ejemplo n.º 1
0
 public static function __IncludeLang($filePath, $fileName, $lang = false)
 {
     if ($lang === false) {
         $lang = LANGUAGE_ID;
     }
     if ($lang != "en" && $lang != "ru") {
         if (file_exists($fname = $_SERVER["DOCUMENT_ROOT"] . $filePath . "/lang/" . LangSubst($lang) . "/" . $fileName)) {
             __IncludeLang($fname);
         }
     }
     if (file_exists($fname = $_SERVER["DOCUMENT_ROOT"] . $filePath . "/lang/" . $lang . "/" . $fileName)) {
         __IncludeLang($fname);
     }
 }
Ejemplo n.º 2
0
function IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
{
	global $BX_DOC_ROOT;
	$filepath = rtrim(preg_replace("'[\\\\/]+'", "/", $filepath), "/ ");
	$module_path = "/modules/";
	if(strpos($filepath, $module_path) !== false)
	{
		$pos = strlen($filepath) - strpos(strrev($filepath), strrev($module_path));
		$rel_path = substr($filepath, $pos);
		$p = strpos($rel_path, "/");
		if(!$p)
			return false;

		$module_name = substr($rel_path, 0, $p);
		$rel_path = substr($rel_path, $p+1);
		$module_path = $BX_DOC_ROOT.BX_ROOT.$module_path.$module_name;
	}
	elseif(strpos($filepath, "/.last_version/") !== false)
	{
		$pos = strlen($filepath) - strpos(strrev($filepath), strrev("/.last_version/"));
		$rel_path = substr($filepath, $pos);
		$module_path = substr($filepath, 0, $pos-1);
	}
	else
	{
		return false;
	}

	if($lang === false)
		$lang = LANGUAGE_ID;

	$arMess = array();
	if(file_exists(($fname = $module_path."/lang/".$lang."/".$rel_path)))
	{
		if($lang <> "en" && $lang <> "ru")
			$arMess = __IncludeLang($module_path."/lang/".LangSubst($lang)."/".$rel_path, $bReturnArray);

		$msg = __IncludeLang($fname, $bReturnArray, true);
		if(is_array($msg))
			$arMess = array_merge($arMess, $msg);
	}
	elseif(file_exists(($fname = $module_path."/lang/".LangSubst($lang)."/".$rel_path)))
	{
		$arMess = __IncludeLang($fname, $bReturnArray, true);
	}
	if($bReturnArray)
		return $arMess;
	return true;
}
Ejemplo n.º 3
0
	function IncludeWizardLang($relativePath = "", $lang = false)
	{
		if ($lang === false)
			$lang = LANGUAGE_ID;

		$wizardPath = $_SERVER["DOCUMENT_ROOT"].$this->path;

		if ($lang != "en" && $lang != "ru")
		{
			if (file_exists(($fname = $wizardPath."/lang/".LangSubst($lang)."/".$relativePath)))
				__IncludeLang($fname, false, true);
		}

		if (file_exists(($fname = $wizardPath."/lang/".$lang."/".$relativePath)))
			__IncludeLang($fname, false, true);
	}
Ejemplo n.º 4
0
	function IncludeLangFile()
	{
		$arLangMessages = array();

		if($this->__folder <> '')
		{
			if(preg_match("#/([^/]*?\\.php)\$#", $this->__file, $match))
			{
				if (LANGUAGE_ID != "en" && LANGUAGE_ID != "ru")
					$arLangMessages = $this->__IncludeLangFile($_SERVER["DOCUMENT_ROOT"].$this->__folder."/lang/".LangSubst(LANGUAGE_ID)."/".$match[1]);

				$arLangMessages = $this->__IncludeLangFile($_SERVER["DOCUMENT_ROOT"].$this->__folder."/lang/".LANGUAGE_ID."/".$match[1]) + $arLangMessages;
			}
		}

		return $arLangMessages;
	}
Ejemplo n.º 5
0
 function GetList($arOrder = array(), $arFilter = array(), $arSelect = false)
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION;
     if (isset($arFilter["ID"]) && !is_array($arFilter["ID"])) {
         $arFilter["ID"] = array($arFilter["ID"]);
     }
     $arRes = array();
     $path = $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates";
     $handle = opendir($path);
     if ($handle) {
         while (($file = readdir($handle)) !== false) {
             if ($file == "." || $file == ".." || !is_dir($path . "/" . $file)) {
                 continue;
             }
             if ($file == ".default") {
                 continue;
             }
             if (isset($arFilter["ID"]) && !in_array($file, $arFilter["ID"])) {
                 continue;
             }
             $arTemplate = array("DESCRIPTION" => "");
             if (file_exists($fname = $path . "/" . $file . "/lang/" . LANGUAGE_ID . "/description.php")) {
                 __IncludeLang($fname, false, true);
             } elseif (file_exists($fname = $path . "/" . $file . "/lang/" . LangSubst(LANGUAGE_ID) . "/description.php")) {
                 __IncludeLang($fname, false, true);
             }
             if (file_exists($fname = $path . "/" . $file . "/description.php")) {
                 include $fname;
             }
             $arTemplate["ID"] = $file;
             if (!isset($arTemplate["NAME"])) {
                 $arTemplate["NAME"] = $file;
             }
             if ($arSelect === false || in_array("SCREENSHOT", $arSelect)) {
                 if (file_exists($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/" . $file . "/lang/" . LANGUAGE_ID . "/screen.gif")) {
                     $arTemplate["SCREENSHOT"] = BX_PERSONAL_ROOT . "/templates/" . $file . "/lang/" . LANGUAGE_ID . "/screen.gif";
                 } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/" . $file . "/screen.gif")) {
                     $arTemplate["SCREENSHOT"] = BX_PERSONAL_ROOT . "/templates/" . $file . "/screen.gif";
                 } else {
                     $arTemplate["SCREENSHOT"] = false;
                 }
                 if (file_exists($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/" . $file . "/lang/" . LANGUAGE_ID . "/preview.gif")) {
                     $arTemplate["PREVIEW"] = BX_PERSONAL_ROOT . "/templates/" . $file . "/lang/" . LANGUAGE_ID . "/preview.gif";
                 } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/" . $file . "/preview.gif")) {
                     $arTemplate["PREVIEW"] = BX_PERSONAL_ROOT . "/templates/" . $file . "/preview.gif";
                 } else {
                     $arTemplate["PREVIEW"] = false;
                 }
             }
             if ($arSelect === false || in_array("CONTENT", $arSelect)) {
                 $arTemplate["CONTENT"] = $APPLICATION->GetFileContent($path . "/" . $file . "/header.php") . "#WORK_AREA#" . $APPLICATION->GetFileContent($path . "/" . $file . "/footer.php");
             }
             if ($arSelect === false || in_array("STYLES", $arSelect)) {
                 if (file_exists($path . "/" . $file . "/styles.css")) {
                     $arTemplate["STYLES"] = $APPLICATION->GetFileContent($path . "/" . $file . "/styles.css");
                     $arTemplate["STYLES_TITLE"] = CSiteTemplate::__GetByStylesTitle($path . "/" . $file . "/.styles.php");
                 }
                 if (file_exists($path . "/" . $file . "/template_styles.css")) {
                     $arTemplate["TEMPLATE_STYLES"] = $APPLICATION->GetFileContent($path . "/" . $file . "/template_styles.css");
                 }
             }
             $arRes[] = $arTemplate;
         }
         closedir($handle);
     }
     $db_res = new CDBResult();
     $db_res->InitFromArray($arRes);
     return $db_res;
 }
Ejemplo n.º 6
0
 public static function IncludeLangFile($filepath)
 {
     $file = basename($filepath);
     $dir = dirname($filepath);
     if (LANGUAGE_ID != "en" && LANGUAGE_ID != "ru" && file_exists($fname = $dir . "/lang/" . LangSubst(LANGUAGE_ID) . "/" . $file)) {
         __IncludeLang($fname, false, true);
     }
     if (file_exists($fname = $dir . "/lang/" . LANGUAGE_ID . "/" . $file)) {
         __IncludeLang($fname, false, true);
     }
 }
Ejemplo n.º 7
0
 function GetWizardList($filterNamespace = false, $bLoadFromModules = false)
 {
     $arWizards = array();
     $arLoadedWizards = array();
     $wizardPath = $_SERVER["DOCUMENT_ROOT"] . CWizardUtil::GetRepositoryPath();
     if ($handle = @opendir($wizardPath)) {
         while (($dirName = readdir($handle)) !== false) {
             if ($dirName == "." || $dirName == ".." || !is_dir($wizardPath . "/" . $dirName)) {
                 continue;
             }
             if (file_exists($wizardPath . "/" . $dirName . "/.description.php")) {
                 //Skip component without namespace
                 if ($filterNamespace !== false && strlen($filterNamespace) > 0) {
                     continue;
                 }
                 if (LANGUAGE_ID != "en" && LANGUAGE_ID != "ru") {
                     if (file_exists($fname = $wizardPath . "/" . $dirName . "/lang/" . LangSubst(LANGUAGE_ID) . "/.description.php")) {
                         __IncludeLang($fname, false, true);
                     }
                 }
                 if (file_exists($fname = $wizardPath . "/" . $dirName . "/lang/" . LANGUAGE_ID . "/.description.php")) {
                     __IncludeLang($fname, false, true);
                 }
                 $arWizardDescription = array();
                 include $wizardPath . "/" . $dirName . "/.description.php";
                 $arWizards[] = array("ID" => $dirName) + $arWizardDescription;
                 $arLoadedWizards[] = $dirName;
             } else {
                 if ($filterNamespace !== false && (strlen($filterNamespace) <= 0 || $filterNamespace != $dirName)) {
                     continue;
                 }
                 if ($nspaceHandle = @opendir($wizardPath . "/" . $dirName)) {
                     while (($file = readdir($nspaceHandle)) !== false) {
                         $pathToWizard = $wizardPath . "/" . $dirName . "/" . $file;
                         if ($file == "." || $file == ".." || !is_dir($pathToWizard)) {
                             continue;
                         }
                         if (file_exists($pathToWizard . "/.description.php")) {
                             if (LANGUAGE_ID != "en" && LANGUAGE_ID != "ru") {
                                 if (file_exists($fname = $pathToWizard . "/lang/" . LangSubst(LANGUAGE_ID) . "/.description.php")) {
                                     __IncludeLang($fname, false, true);
                                 }
                             }
                             if (file_exists($fname = $pathToWizard . "/lang/" . LANGUAGE_ID . "/.description.php")) {
                                 __IncludeLang($fname, false, true);
                             }
                             $arWizardDescription = array();
                             include $pathToWizard . "/.description.php";
                             $arWizards[] = array("ID" => $dirName . ":" . $file) + $arWizardDescription;
                             $arLoadedWizards[] = $dirName . ":" . $file;
                         }
                     }
                     @closedir($nspaceHandle);
                 }
             }
         }
         @closedir($handle);
     }
     if ($bLoadFromModules) {
         $modulesPath = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules";
         if ($handle = @opendir($modulesPath)) {
             while (($moduleName = readdir($handle)) !== false) {
                 if ($moduleName == "." || $moduleName == ".." || !is_dir($modulesPath . "/" . $moduleName)) {
                     continue;
                 }
                 if (!file_exists($modulesPath . "/" . $moduleName . "/install/wizards")) {
                     continue;
                 }
                 if ($handle1 = @opendir($modulesPath . "/" . $moduleName . "/install/wizards")) {
                     while (($dirName = readdir($handle1)) !== false) {
                         if ($dirName == "." || $dirName == ".." || !is_dir($modulesPath . "/" . $moduleName . "/install/wizards/" . $dirName)) {
                             continue;
                         }
                         if ($filterNamespace !== false && (strlen($filterNamespace) <= 0 || $filterNamespace != $dirName)) {
                             continue;
                         }
                         if ($handle2 = @opendir($modulesPath . "/" . $moduleName . "/install/wizards/" . $dirName)) {
                             while (($file = readdir($handle2)) !== false) {
                                 $pathToWizard = $modulesPath . "/" . $moduleName . "/install/wizards/" . $dirName . "/" . $file;
                                 if ($file == "." || $file == ".." || !is_dir($pathToWizard)) {
                                     continue;
                                 }
                                 if (in_array($dirName . ":" . $file, $arLoadedWizards)) {
                                     continue;
                                 }
                                 if (file_exists($pathToWizard . "/.description.php")) {
                                     if (LANGUAGE_ID != "en" && LANGUAGE_ID != "ru") {
                                         if (file_exists($fname = $pathToWizard . "/lang/" . LangSubst(LANGUAGE_ID) . "/.description.php")) {
                                             __IncludeLang($fname, false, true);
                                         }
                                     }
                                     if (file_exists($fname = $pathToWizard . "/lang/" . LANGUAGE_ID . "/.description.php")) {
                                         __IncludeLang($fname, false, true);
                                     }
                                     $arWizardDescription = array();
                                     include $pathToWizard . "/.description.php";
                                     $arWizards[] = array("ID" => $moduleName . ":" . $dirName . ":" . $file) + $arWizardDescription;
                                     $arLoadedWizards[] = $dirName . ":" . $file;
                                 }
                             }
                             @closedir($handle2);
                         }
                     }
                     @closedir($handle1);
                 }
             }
             @closedir($handle);
         }
     }
     return $arWizards;
 }
Ejemplo n.º 8
0
 function GetThemes($relativePath)
 {
     $arThemes = array();
     if (!is_dir($_SERVER["DOCUMENT_ROOT"] . $relativePath)) {
         return $arThemes;
     }
     $themePath = $_SERVER["DOCUMENT_ROOT"] . $relativePath;
     $themePath = str_replace("\\", "/", $themePath);
     if ($handle = @opendir($themePath)) {
         while (($file = readdir($handle)) !== false) {
             if ($file == "." || $file == ".." || !is_dir($themePath . "/" . $file)) {
                 continue;
             }
             $arTemplate = array();
             if (is_file($themePath . "/" . $file . "/description.php")) {
                 if (LANGUAGE_ID != "en" && LANGUAGE_ID != "ru") {
                     if (file_exists($fname = $themePath . "/" . $file . "/lang/" . LangSubst(LANGUAGE_ID) . "/description.php")) {
                         __IncludeLang($fname);
                     }
                 }
                 if (file_exists($fname = $themePath . "/" . $file . "/lang/" . LANGUAGE_ID . "/description.php")) {
                     __IncludeLang($fname);
                 }
                 @(include $themePath . "/" . $file . "/description.php");
             }
             $arTheme = array("ID" => $file, "SORT" => isset($arTemplate["SORT"]) && intval($arTemplate["SORT"]) > 0 ? intval($arTemplate["SORT"]) : 10, "NAME" => isset($arTemplate["NAME"]) ? $arTemplate["NAME"] : $file);
             if (file_exists($themePath . "/" . $file . "/lang/" . LANGUAGE_ID . "/small.png")) {
                 $arTheme["PREVIEW"] = $relativePath . "/" . $file . "/lang/" . LANGUAGE_ID . "/small.png";
             } elseif (file_exists($themePath . "/" . $file . "/lang/" . LANGUAGE_ID . "/preview.gif")) {
                 $arTheme["PREVIEW"] = $relativePath . "/" . $file . "/lang/" . LANGUAGE_ID . "/preview.gif";
             } elseif (file_exists($themePath . "/" . $file . "/small.png")) {
                 $arTheme["PREVIEW"] = $relativePath . "/" . $file . "/small.png";
             } elseif (file_exists($themePath . "/" . $file . "/preview.gif")) {
                 $arTheme["PREVIEW"] = $relativePath . "/" . $file . "/preview.gif";
             } else {
                 $arTheme["PREVIEW"] = false;
             }
             if (file_exists($themePath . "/" . $file . "/lang/" . LANGUAGE_ID . "/big.png")) {
                 $arTheme["SCREENSHOT"] = $relativePath . "/" . $file . "/lang/" . LANGUAGE_ID . "/big.png";
             } elseif (file_exists($themePath . "/" . $file . "/lang/" . LANGUAGE_ID . "/screen.gif")) {
                 $arTheme["SCREENSHOT"] = $relativePath . "/" . $file . "/lang/" . LANGUAGE_ID . "/screen.gif";
             } elseif (file_exists($themePath . "/" . $file . "/big.png")) {
                 $arTheme["SCREENSHOT"] = $relativePath . "/" . $file . "/big.png";
             } elseif (file_exists($themePath . "/" . $file . "/screen.gif")) {
                 $arTheme["SCREENSHOT"] = $relativePath . "/" . $file . "/screen.gif";
             } else {
                 $arTheme["SCREENSHOT"] = false;
             }
             $arThemes[$file] = $arTemplate + $arTheme;
         }
         @closedir($handle);
     }
     uasort($arThemes, create_function('$a, $b', 'return strcmp($a["SORT"], $b["SORT"]);'));
     return $arThemes;
 }
Ejemplo n.º 9
0
<?php

define("STOP_STATISTICS", true);
define("NOT_CHECK_PERMISSIONS", true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
if ($_SERVER["REQUEST_METHOD"] == "POST" && check_bitrix_sessid() && isset($_POST["siteId"]) && ctype_alnum($_POST["siteId"]) && strlen($_POST["siteId"]) == 2) {
    $path = realpath(dirname(__FILE__));
    require_once "{$path}/../../class.php";
    $cart = new SaleBasketLineComponent();
    $cart->initComponent('bitrix:sale.basket.basket.line');
    $cart->includeComponentLang();
    $lang = LangSubst(LANGUAGE_ID);
    __IncludeLang("{$path}/lang/{$lang}/template.php");
    //	IncludeTemplateLangFile(__FILE__);
    $APPLICATION->RestartBuffer();
    header('Content-Type: text/html; charset=' . LANG_CHARSET);
    $cart->executeAjax($_POST["siteId"]);
    die;
}
Ejemplo n.º 10
0
 /**
  * Function includes language files from within the component directory.
  *
  * <p>For example: $this->includeComponentLang("ajax.php") will include "lang/en/ajax.php" file. </p>
  * <p>Note: component must be inited by initComponent method.</p>
  * @param string $relativePath
  * @param string|bool $lang
  * @return void
  *
  */
 public final function includeComponentLang($relativePath = "", $lang = false)
 {
     static $messCache = array();
     if (!$this->__bInited) {
         return null;
     }
     if ($relativePath == "") {
         $relativePath = "component.php";
     }
     if ($lang === false) {
         $lang = LANGUAGE_ID;
     }
     $path = $this->__path . "/lang/" . $lang . "/" . $relativePath;
     if (!isset($messCache[$path])) {
         $messCache[$path] = array();
         $langSubst = LangSubst($lang);
         if ($lang != $langSubst) {
             $fname = $_SERVER["DOCUMENT_ROOT"] . $this->__path . "/lang/" . $langSubst . "/" . $relativePath;
             if (file_exists($fname)) {
                 $messCache[$path] = __IncludeLang($fname, true, true);
             }
         }
         $fname = $_SERVER["DOCUMENT_ROOT"] . $path;
         if (file_exists($fname)) {
             $messCache[$path] = __IncludeLang($fname, true, true) + $messCache[$path];
         }
     }
     if (isset($messCache[$path])) {
         global $MESS;
         foreach ($messCache[$path] as $id => $message) {
             $MESS[$id] = $message;
         }
     }
 }
Ejemplo n.º 11
0
 function GetList($arOrder = array(), $arFilter = array(), $arSelect = false)
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION;
     if (isset($arFilter["ID"]) && !is_array($arFilter["ID"])) {
         $arFilter["ID"] = array($arFilter["ID"]);
     }
     $folders = array("/local/templates", BX_PERSONAL_ROOT . "/templates");
     $arRes = array();
     foreach ($folders as $folder) {
         $path = $_SERVER["DOCUMENT_ROOT"] . $folder;
         if (is_dir($path)) {
             $handle = opendir($path);
             if ($handle) {
                 while (($file = readdir($handle)) !== false) {
                     if ($file == "." || $file == ".." || !is_dir($path . "/" . $file)) {
                         continue;
                     }
                     if ($file == ".default") {
                         continue;
                     }
                     if (isset($arRes[$file])) {
                         continue;
                     }
                     if (isset($arFilter["ID"]) && !in_array($file, $arFilter["ID"])) {
                         continue;
                     }
                     $arTemplate = array("DESCRIPTION" => "");
                     if (file_exists($fname = $path . "/" . $file . "/lang/" . LANGUAGE_ID . "/description.php")) {
                         __IncludeLang($fname, false, true);
                     } elseif (file_exists($fname = $path . "/" . $file . "/lang/" . LangSubst(LANGUAGE_ID) . "/description.php")) {
                         __IncludeLang($fname, false, true);
                     }
                     if (file_exists($fname = $path . "/" . $file . "/description.php")) {
                         include $fname;
                     }
                     $arTemplate["ID"] = $file;
                     $arTemplate["PATH"] = $folder . "/" . $file;
                     if (!isset($arTemplate["NAME"])) {
                         $arTemplate["NAME"] = $file;
                     }
                     if ($arSelect === false || in_array("SCREENSHOT", $arSelect)) {
                         if (file_exists($path . "/" . $file . "/lang/" . LANGUAGE_ID . "/screen.gif")) {
                             $arTemplate["SCREENSHOT"] = $folder . "/" . $file . "/lang/" . LANGUAGE_ID . "/screen.gif";
                         } elseif (file_exists($path . "/" . $file . "/screen.gif")) {
                             $arTemplate["SCREENSHOT"] = $folder . "/" . $file . "/screen.gif";
                         } else {
                             $arTemplate["SCREENSHOT"] = false;
                         }
                         if (file_exists($path . "/" . $file . "/lang/" . LANGUAGE_ID . "/preview.gif")) {
                             $arTemplate["PREVIEW"] = $folder . "/" . $file . "/lang/" . LANGUAGE_ID . "/preview.gif";
                         } elseif (file_exists($path . "/" . $file . "/preview.gif")) {
                             $arTemplate["PREVIEW"] = $folder . "/" . $file . "/preview.gif";
                         } else {
                             $arTemplate["PREVIEW"] = false;
                         }
                     }
                     if ($arSelect === false || in_array("CONTENT", $arSelect)) {
                         $arTemplate["CONTENT"] = $APPLICATION->GetFileContent($path . "/" . $file . "/header.php") . "#WORK_AREA#" . $APPLICATION->GetFileContent($path . "/" . $file . "/footer.php");
                     }
                     if ($arSelect === false || in_array("STYLES", $arSelect)) {
                         if (file_exists($path . "/" . $file . "/styles.css")) {
                             $arTemplate["STYLES"] = $APPLICATION->GetFileContent($path . "/" . $file . "/styles.css");
                             $arTemplate["STYLES_TITLE"] = CSiteTemplate::__GetByStylesTitle($path . "/" . $file . "/.styles.php");
                         }
                         if (file_exists($path . "/" . $file . "/template_styles.css")) {
                             $arTemplate["TEMPLATE_STYLES"] = $APPLICATION->GetFileContent($path . "/" . $file . "/template_styles.css");
                         }
                     }
                     $arRes[$file] = $arTemplate;
                 }
                 closedir($handle);
             }
         }
     }
     if (is_array($arOrder)) {
         $columns = array();
         static $fields = array("ID" => 1, "NAME" => 1, "DESCRIPTION" => 1, "SORT" => 1);
         foreach ($arOrder as $key => $val) {
             $key = strtoupper($key);
             if (isset($fields[$key])) {
                 $columns[$key] = strtoupper($val) == "DESC" ? SORT_DESC : SORT_ASC;
             }
         }
         if (!empty($columns)) {
             \Bitrix\Main\Type\Collection::sortByColumn($arRes, $columns);
         }
     }
     $db_res = new CDBResult();
     $db_res->InitFromArray($arRes);
     return $db_res;
 }
Ejemplo n.º 12
0
 public static function FetchHelp($componentName, $lang = false)
 {
     $cName = str_replace("..", "", $componentName);
     $cName = str_replace(":", "/", $cName);
     $lang = $lang ? preg_replace("/[^a-zA-Z0-9_]/is", "", $lang) : LANGUAGE_ID;
     $filePath = "/bitrix/components/" . $cName;
     $fileName = "help/.tooltips.php";
     $arTooltips = array();
     $fname = $_SERVER["DOCUMENT_ROOT"] . $filePath . "/lang/" . LangSubst($lang) . "/" . $fileName;
     if ($lang != "en" && $lang != "ru" && file_exists($fname)) {
         $arTooltips = __IncludeLang($fname, true, true);
     }
     $fname = $_SERVER["DOCUMENT_ROOT"] . $filePath . "/lang/" . $lang . "/" . $fileName;
     if (file_exists($fname)) {
         $arTooltips = __IncludeLang($fname, true, true);
     }
     return $arTooltips;
 }
Ejemplo n.º 13
0
Archivo: tools.php Proyecto: gitkv/bash
 private static function _loadLang($lang, $bReturn, $arAdditionalMess = false)
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION;
     $jsMsg = '';
     $mess_lang_default = array();
     $mess_lang = array();
     if ($lang) {
         $langSubst = LangSubst(LANGUAGE_ID);
         if ($langSubst != LANGUAGE_ID) {
             $lang_filename = $_SERVER['DOCUMENT_ROOT'] . str_replace("/lang/" . LANGUAGE_ID . "/", "/lang/" . $langSubst . "/", $lang);
             if (file_exists($lang_filename)) {
                 $mess_lang_default = __IncludeLang($lang_filename, true, true);
             }
         }
         $lang_filename = $_SERVER['DOCUMENT_ROOT'] . $lang;
         if (file_exists($lang_filename)) {
             $mess_lang = __IncludeLang($lang_filename, true, true);
         }
         $mess_lang = array_merge($mess_lang_default, $mess_lang);
         if (!empty($mess_lang)) {
             $jsMsg = '(window.BX||top.BX).message(' . CUtil::PhpToJSObject($mess_lang, false) . ');';
         }
     }
     if (is_array($arAdditionalMess)) {
         $jsMsg = '(window.BX||top.BX).message(' . CUtil::PhpToJSObject($arAdditionalMess, false) . ');' . $jsMsg;
     }
     if ($jsMsg !== '') {
         $jsMsg = '<script type="text/javascript">' . $jsMsg . '</script>';
         if ($bReturn) {
             return $jsMsg . "\r\n";
         } else {
             $APPLICATION->AddLangJS($jsMsg);
         }
     }
     return $jsMsg;
 }
 function IncludeLangFile($relativePath = "", $lang = false)
 {
     $arLangMessages = array();
     if ($this->__folder != '') {
         $absPath = $_SERVER["DOCUMENT_ROOT"] . $this->__folder . "/lang/";
         if ($lang === false) {
             $lang = LANGUAGE_ID;
         }
         if ($relativePath == "") {
             $relativePath = bx_basename($this->__file);
         }
         if ($lang != "en" && $lang != "ru") {
             $arLangMessages = $this->__IncludeLangFile($absPath . LangSubst($lang) . "/" . $relativePath);
         }
         $arLangMessages = $this->__IncludeLangFile($absPath . $lang . "/" . $relativePath) + $arLangMessages;
     }
     return $arLangMessages;
 }
Ejemplo n.º 15
0
 function InstallService($serviceID, $serviceStage)
 {
     $wizard =& $this->GetWizard();
     $siteID = WizardServices::GetCurrentSiteID($wizard->GetVar("siteID"));
     define("WIZARD_SITE_ID", $siteID);
     define("WIZARD_SITE_ROOT_PATH", $_SERVER["DOCUMENT_ROOT"]);
     $rsSites = CSite::GetByID($siteID);
     if ($arSite = $rsSites->Fetch()) {
         define("WIZARD_SITE_DIR", $arSite["DIR"]);
     } else {
         define("WIZARD_SITE_DIR", "/");
     }
     define("WIZARD_SITE_PATH", str_replace("//", "/", WIZARD_SITE_ROOT_PATH . "/" . WIZARD_SITE_DIR . "/"));
     $wizardPath = $wizard->GetPath();
     define("WIZARD_RELATIVE_PATH", $wizardPath);
     define("WIZARD_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"] . $wizardPath);
     $templatesPath = WizardServices::GetTemplatesPath(WIZARD_RELATIVE_PATH . "/site");
     $arTemplates = WizardServices::GetTemplates($templatesPath);
     $templateID = $wizard->GetVar("templateID");
     define("WIZARD_TEMPLATE_ID", $templateID);
     define("WIZARD_TEMPLATE_RELATIVE_PATH", $templatesPath . "/" . WIZARD_TEMPLATE_ID);
     define("WIZARD_TEMPLATE_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"] . WIZARD_TEMPLATE_RELATIVE_PATH);
     $themeID = $wizard->GetVar($templateID . "_themeID");
     $arThemes = WizardServices::GetThemes(WIZARD_TEMPLATE_RELATIVE_PATH . "/themes");
     define("WIZARD_THEME_ID", $themeID);
     define("WIZARD_THEME_RELATIVE_PATH", WIZARD_TEMPLATE_RELATIVE_PATH . "/themes/" . WIZARD_THEME_ID);
     define("WIZARD_THEME_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"] . WIZARD_THEME_RELATIVE_PATH);
     $servicePath = WIZARD_RELATIVE_PATH . "/site/services/" . $serviceID;
     define("WIZARD_SERVICE_RELATIVE_PATH", $servicePath);
     define("WIZARD_SERVICE_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"] . $servicePath);
     define("WIZARD_IS_RERUN", $_SERVER["PHP_SELF"] != "/index.php");
     define("WIZARD_SITE_LOGO", intval($wizard->GetVar("siteLogo")));
     define("WIZARD_INSTALL_DEMO_DATA", $wizard->GetVar("installDemoData") == "Y");
     define("WIZARD_REINSTALL_DATA", false);
     define("WIZARD_FIRST_INSTAL", $firstStep = COption::GetOptionString("main", "wizard_first" . substr($wizard->GetID(), 7) . "_" . $wizard->GetVar("siteID"), false, $wizard->GetVar("siteID")));
     $dbUsers = CGroup::GetList($by = "id", $order = "asc", array("ACTIVE" => "Y"));
     while ($arUser = $dbUsers->Fetch()) {
         define("WIZARD_" . $arUser["STRING_ID"] . "_GROUP", $arUser["ID"]);
     }
     if (!file_exists(WIZARD_SERVICE_ABSOLUTE_PATH . "/" . $serviceStage)) {
         return false;
     }
     if (LANGUAGE_ID != "en" && LANGUAGE_ID != "ru") {
         if (file_exists($fname = WIZARD_SERVICE_ABSOLUTE_PATH . "/lang/" . LangSubst(LANGUAGE_ID) . "/" . $serviceStage)) {
             __IncludeLang($fname, false, true);
         }
     }
     if (file_exists($fname = WIZARD_SERVICE_ABSOLUTE_PATH . "/lang/" . LANGUAGE_ID . "/" . $serviceStage)) {
         __IncludeLang($fname, false, true);
     }
     @set_time_limit(3600);
     global $DB, $DBType, $APPLICATION, $USER, $CACHE_MANAGER;
     include WIZARD_SERVICE_ABSOLUTE_PATH . "/" . $serviceStage;
 }
Ejemplo n.º 16
0
                $arRes['TASKS_COUNT'] = CMeetingItem::GetTasksCount($arRes['ITEM_ID'], $arRes['ID']);
                if (!$arParams['COPY']) {
                    $arRes['EDITABLE'] = CMeetingItem::IsEditable($arRes['ITEM_ID']);
                    if ($arRes['TASK_ID'] && CModule::IncludeModule('tasks')) {
                        $dbTask = CTasks::GetByID($arRes['TASK_ID']);
                        if ($arTask = $dbTask->Fetch()) {
                            $arRes['TASK_ACCESS'] = true;
                        }
                    }
                }
                $arResult['MEETING']['AGENDA'][$arRes['ID']] = $arRes;
            }
        }
        if ($arResult['MEETING']['DATE_START'] && MakeTimeStamp($arResult['MEETING']['DATE_START']) > 0) {
            $arFormats = array('ru' => 'j F', 'en' => 'F j', 'de' => 'j. F');
            $dateFormat = isset($arFormats[LANGUAGE_ID]) ? $arFormats[LANGUAGE_ID] : $arFormats[LangSubst(LANGUAGE_ID)];
            $APPLICATION->SetTitle(GetMessage('ME_MEETING_EDIT', array('#ID#' => $arResult['MEETING']['ID'], '#DATE#' => FormatDate($dateFormat, MakeTimeStamp($arResult['MEETING']['DATE_START'])), '#TITLE#' => $arResult['MEETING']['TITLE'])));
            //			$arResult['MEETING']['DATE_START'] = FormatDate($DB->DateFormatToPhp(FORMAT_DATE).' H:i', MakeTimeStamp($arResult['MEETING']['DATE_START']));
            //			$arResult['MEETING']['DATE_START'] = date($DB->DateFormatToPhp(FORMAT_DATE).((IsAmPmMode()) ? ' g:i a' : ' H:i'), MakeTimeStamp($arResult['MEETING']['DATE_START']));
        } else {
            $APPLICATION->SetTitle(GetMessage('ME_MEETING_EDIT_NO_DATE', array('#ID#' => $arResult['MEETING']['ID'], '#TITLE#' => $arResult['MEETING']['TITLE'])));
        }
    } else {
        return ShowError(GetMessage("ME_MEETING_ACCESS_DENIED"));
    }
}
if ($arParams['SET_NAVCHAIN'] !== 'N') {
    $APPLICATION->AddChainItem(strlen($arResult['MEETING']['TITLE']) > 0 ? $arResult['MEETING']['TITLE'] : GetMessage('ME_MEETING_ADD'), $arParams['MEETING_URL']);
}
if ($arParams['COPY']) {
    $APPLICATION->SetTitle(GetMessage('ME_MEETING_COPY'));
Ejemplo n.º 17
0
	/**
	* Function includes language files from within the component directory.
	*
	* <p>For example: $this->includeComponentLang("ajax.php") will include "lang/en/ajax.php" file. </p>
	* <p>Note: component must be inited by initComponent method.</p>
	* @param string $relativePath
	* @param string $lang
	* @return void
	*
	*/
	final public function includeComponentLang($relativePath = "", $lang = false)
	{
		if (!$this->__bInited)
			return null;

		if (strlen($relativePath) <= 0)
			$relativePath = "component.php";

		if ($lang === false)
			$lang = LANGUAGE_ID;

		if ($lang != "en" && $lang != "ru")
		{
			$fname = $_SERVER["DOCUMENT_ROOT"].$this->__path."/lang/".LangSubst($lang)."/".$relativePath;
			if (file_exists($fname))
				__IncludeLang($fname, false, true);
		}

		$fname = $_SERVER["DOCUMENT_ROOT"].$this->__path."/lang/".$lang."/".$relativePath;
		if (file_exists($fname))
			__IncludeLang($fname, false, true);
	}
Ejemplo n.º 18
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$file = trim(preg_replace("'[\\\\/]+'", "/", dirname(__FILE__) . "/lang/" . LANGUAGE_ID . "/localization.php"));
if (!file_exists($file)) {
    $file = trim(preg_replace("'[\\\\/]+'", "/", dirname(__FILE__) . "/lang/" . LangSubst(LANGUAGE_ID) . "/localization.php"));
}
__IncludeLang($file);
?>
<script>
language_resources = {
	addParams: IULocalization.addParams,
		
	Language: "<?php 
echo LANGUAGE_ID;
?>
", 
		
		
	ImageUploaderWriter: {
		instructionsCommon: "<?php 
echo CUtil::JSEscape(GetMessage("instructionsCommon"));
?>
", 
		instructionsNotWinXPSP2: "<?php 
echo CUtil::JSEscape(GetMessage("instructionsNotWinXPSP2"));
?>
", 
		instructionsWinXPSP2: "<?php