Beispiel #1
0
 protected static function checkParams($arMessage = array(), &$arTopic, &$arForum)
 {
     if (\Freetrix\Main\Loader::includeModule('forum')) {
         $arTopic = !empty($arTopic) ? $arTopic : \CForumTopic::GetByID($arMessage["TOPIC_ID"]);
         if (empty($arTopic)) {
             return false;
         }
         $arSitemaps = SitemapForumTable::getSitemapsByEntityId($arTopic["FORUM_ID"]);
         if (!empty($arSitemaps) && ($arForum = \CForumNew::GetByIDEx($arTopic["FORUM_ID"])) && $arForum) {
             $arForum["PATH2FORUM_MESSAGE"] = \CForumNew::GetSites($arTopic["FORUM_ID"]);
             $date = MakeTimeStamp($arTopic['LAST_POST_DATE']);
             $result = array();
             foreach ($arSitemaps as $arSitemap) {
                 $path = $arForum["PATH2FORUM_MESSAGE"][$arSitemap["SITE_ID"]];
                 if (!empty($path)) {
                     $arSitemap["fileName"] = str_replace("#FORUM_ID#", $arForum["ID"], $arSitemap['SITEMAP_FILE_FORUM']);
                     $arSitemap["url"] = \CForumNew::PreparePath2Message($path, array("FORUM_ID" => $arForum["ID"], "TOPIC_ID" => $arTopic["ID"], "TITLE_SEO" => $arTopic["TITLE_SEO"], "MESSAGE_ID" => "s", "SOCNET_GROUP_ID" => $arTopic["SOCNET_GROUP_ID"], "OWNER_ID" => $arTopic["OWNER_ID"], "PARAM1" => $arTopic["PARAM1"], "PARAM2" => $arTopic["PARAM2"]));
                     $arSitemap["date"] = $date;
                     $result[] = $arSitemap;
                 }
             }
             return empty($result) ? false : $result;
         }
     }
     return false;
 }
Beispiel #2
0
 public function resolve($entity)
 {
     if (intval($entity) > 0) {
         if (\Freetrix\Main\Loader::includeModule('catalog')) {
             return new CatalogStore(intval($entity));
         }
     }
     return parent::resolve($entity);
 }
Beispiel #3
0
 public function resolve($entity)
 {
     if ($entity === "catalog") {
         if (!$this->catalog && $this->loadFromDatabase()) {
             if (\Freetrix\Main\Loader::includeModule('catalog')) {
                 $this->catalog = new ElementCatalog(0);
             }
         }
         if ($this->catalog) {
             return $this->catalog;
         }
     }
     return parent::resolve($entity);
 }
Beispiel #4
0
 public static function checkSessionSecurity(CurrentUser $user)
 {
     $context = \Freetrix\Main\Application::getInstance()->getContext();
     if (!$context instanceof \Freetrix\Main\HttpContext) {
         throw new \Freetrix\Main\NotSupportedException();
     }
     $policy = $user->getPolicy();
     $currentTime = time();
     /** @var $request \Freetrix\Main\HttpRequest */
     $request = $context->getRequest();
     $remoteAddress = $request->getRemoteAddress();
     // IP address changed
     $destroySession = $_SESSION['SESS_IP'] && strlen($policy["SESSION_IP_MASK"]) > 0 && (ip2long($policy["SESSION_IP_MASK"]) & ip2long($_SESSION['SESS_IP'])) != (ip2long($policy["SESSION_IP_MASK"]) & ip2long($remoteAddress));
     // session timeout
     if (!$destroySession) {
         $destroySession = $policy["SESSION_TIMEOUT"] > 0 && $_SESSION['SESS_TIME'] > 0 && $currentTime - $policy["SESSION_TIMEOUT"] * 60 > $_SESSION['SESS_TIME'];
     }
     // session expander control
     if (!$destroySession) {
         $destroySession = $_SESSION["FX_SESSION_TERMINATE_TIME"] > 0 && $currentTime > $_SESSION["FX_SESSION_TERMINATE_TIME"];
     }
     if ($destroySession) {
         $_SESSION = array();
         @session_destroy();
         //session_destroy cleans user session handles in some PHP versions
         //see http://bugs.php.net/bug.php?id=32330 discussion
         if (Config\Option::get("security", "session", "N") === "Y" && Main\Loader::includeModule("security")) {
             \CSecuritySession::init();
         }
         session_id(md5(uniqid(rand(), true)));
         session_start();
     }
     $_SESSION['SESS_IP'] = $remoteAddress;
     $_SESSION['SESS_TIME'] = time();
     //session control from security module
     if (Config\Option::get("main", "use_session_id_ttl", "N") == "Y" && intval(Config\Option::get("main", "session_id_ttl", 0)) > 0 && !defined("FX_SESSION_ID_CHANGE")) {
         if (!array_key_exists('SESS_ID_TIME', $_SESSION)) {
             $_SESSION['SESS_ID_TIME'] = $_SESSION['SESS_TIME'];
         } elseif ($_SESSION['SESS_ID_TIME'] + intval(Config\Option::get("main", "session_id_ttl")) < $_SESSION['SESS_TIME']) {
             if (Config\Option::get("security", "session", "N") === "Y" && \Freetrix\Main\Loader::includeModule("security")) {
                 \CSecuritySession::updateSessID();
             } else {
                 session_regenerate_id();
             }
             $_SESSION['SESS_ID_TIME'] = $_SESSION['SESS_TIME'];
         }
     }
     return !$destroySession;
 }
Beispiel #5
0
 protected function connectInternal()
 {
     if ($this->isConnected) {
         return;
     }
     $dbHost = $this->dbHost;
     $dbPort = 0;
     if (($pos = strpos($dbHost, ":")) !== false) {
         $dbPort = intval(substr($dbHost, $pos + 1));
         $dbHost = substr($dbHost, 0, $pos);
     }
     if (($this->dbOptions & self::PERSISTENT) != 0) {
         $dbHost = "p:" . $dbHost;
     }
     /** @var $connection \mysqli */
     $connection = \mysqli_init();
     if (!$connection) {
         throw new ConnectionException('Mysql init failed');
     }
     if (!empty($this->dbInitCommand)) {
         if (!$connection->options(MYSQLI_INIT_COMMAND, $this->dbInitCommand)) {
             throw new ConnectionException('Setting mysql init command failed');
         }
     }
     if ($dbPort > 0) {
         $r = $connection->real_connect($dbHost, $this->dbLogin, $this->dbPassword, $this->dbName, $dbPort);
     } else {
         $r = $connection->real_connect($dbHost, $this->dbLogin, $this->dbPassword, $this->dbName);
     }
     if (!$r) {
         throw new ConnectionException('Mysql connect error', sprintf('(%s) %s', $connection->connect_errno, $connection->connect_error));
     }
     $this->resource = $connection;
     $this->isConnected = true;
     // nosql memcached driver
     if (isset($this->configuration['memcache'])) {
         $memcached = \Freetrix\Main\Application::getInstance()->getConnectionPool()->getConnection($this->configuration['memcache']);
         mysqlnd_memcache_set($this->resource, $memcached->getResource());
     }
     //global $DB, $USER, $APPLICATION;
     if ($fn = \Freetrix\Main\Loader::getPersonal("php_interface/after_connect_d7.php")) {
         include $fn;
     }
 }
Beispiel #6
0
 protected function connectInternal()
 {
     if ($this->isConnected) {
         return;
     }
     if (($this->dbOptions & self::PERSISTENT) != 0) {
         $connection = oci_pconnect($this->dbLogin, $this->dbPassword, $this->dbName);
     } else {
         $connection = oci_connect($this->dbLogin, $this->dbPassword, $this->dbName);
     }
     if (!$connection) {
         throw new ConnectionException('Oracle connect error', $this->getErrorMessage());
     }
     $this->isConnected = true;
     $this->resource = $connection;
     /** @noinspection PhpUnusedLocalVariableInspection */
     global $DB, $USER, $APPLICATION;
     if ($fn = \Freetrix\Main\Loader::getPersonal("php_interface/after_connect_d7.php")) {
         include $fn;
     }
 }
Beispiel #7
0
 protected function connectInternal()
 {
     if ($this->isConnected) {
         return;
     }
     if (($this->dbOptions & self::PERSISTENT) != 0) {
         $connection = mysql_pconnect($this->dbHost, $this->dbLogin, $this->dbPassword);
     } else {
         $connection = mysql_connect($this->dbHost, $this->dbLogin, $this->dbPassword, true);
     }
     if (!$connection) {
         throw new ConnectionException('Mysql connect error', mysql_error());
     }
     if (!mysql_select_db($this->dbName, $connection)) {
         throw new ConnectionException('Mysql select db error', mysql_error($connection));
     }
     $this->resource = $connection;
     $this->isConnected = true;
     if ($fn = \Freetrix\Main\Loader::getPersonal("php_interface/after_connect_d7.php")) {
         include $fn;
     }
 }
Beispiel #8
0
 protected function connectInternal()
 {
     if ($this->isConnected) {
         return;
     }
     $connectionInfo = array("UID" => $this->dbLogin, "PWD" => $this->dbPassword, "Database" => $this->dbName, "ReturnDatesAsStrings" => true);
     if (($this->dbOptions & self::PERSISTENT) != 0) {
         $connectionInfo["ConnectionPooling"] = true;
     } else {
         $connectionInfo["ConnectionPooling"] = false;
     }
     $connection = sqlsrv_connect($this->dbHost, $connectionInfo);
     if (!$connection) {
         throw new ConnectionException('MS Sql connect error', $this->getErrorMessage());
     }
     $this->resource = $connection;
     $this->isConnected = true;
     // hide cautions
     sqlsrv_configure("WarningsReturnAsErrors", 0);
     global $DB, $USER, $APPLICATION;
     if ($fn = \Freetrix\Main\Loader::getPersonal("php_interface/after_connect_d7.php")) {
         include $fn;
     }
 }
Beispiel #9
0
 protected function deleteOneDir($etime = 0)
 {
     $bDeleteFromQueue = false;
     $con = Main\Application::getConnection();
     $rs = $con->query("SELECT SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG from b_cache_tag WHERE TAG='*'", 0, 1);
     if ($ar = $rs->fetch()) {
         $dirName = Main\Loader::getDocumentRoot() . $ar["RELATIVE_PATH"];
         if ($ar["RELATIVE_PATH"] != '' && file_exists($dirName)) {
             $dh = opendir($dirName);
             if (is_resource($dh)) {
                 $counter = 0;
                 while (($file = readdir($dh)) !== false) {
                     if ($file != "." && $file != "..") {
                         DeleteDirFilesEx($ar["RELATIVE_PATH"] . "/" . $file);
                         $counter++;
                         if (time() > $etime) {
                             break;
                         }
                     }
                 }
                 closedir($dh);
                 if ($counter == 0) {
                     rmdir($dirName);
                     $bDeleteFromQueue = true;
                 }
             }
         } else {
             $bDeleteFromQueue = true;
         }
         if ($bDeleteFromQueue) {
             $con->queryExecute("DELETE FROM b_cache_tag\n\t\t\t\t\tWHERE SITE_ID = '" . $con->getSqlHelper()->forSql($ar["SITE_ID"]) . "'\n\t\t\t\t\tAND CACHE_SALT = '" . $con->getSqlHelper()->forSql($ar["CACHE_SALT"]) . "'\n\t\t\t\t\tAND RELATIVE_PATH = '" . $con->getSqlHelper()->forSql($ar["RELATIVE_PATH"]) . "'");
         }
     }
 }
Beispiel #10
0
<?
require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/prolog_admin_before.php");
require_once($_SERVER["DOCUMENT_ROOT"].FX_ROOT."/modules/main/prolog.php");

if (!$USER->CanDoOperation('seo_tools'))
	die(GetMessage("ACCESS_DENIED"));

use Freetrix\Seo\Engine;
use Freetrix\Main\IO\Path;

IncludeModuleLangFile(__FILE__);
\Freetrix\Main\Loader::includeModule('seo');
\Freetrix\Main\Loader::includeModule('socialservices');

CUtil::JSPostUnescape();

$engine = new Engine\Google();

if(isset($_REQUEST['action']) && check_freetrix_sessid())
{
	$res = array();

	$arDomain = null;
	if(isset($_REQUEST['domain']) && strlen($_REQUEST['domain']) > 0)
	{
		$bFound = false;
		$arDomains = \CSeoUtils::getDomainsList();
		foreach($arDomains as $arDomain)
		{
			if($arDomain['DOMAIN'] == $_REQUEST['domain'] && rtrim($arDomain['SITE_DIR'], '/') == rtrim($_REQUEST['dir'], '/'))
			{
Beispiel #11
0
	public static function getTreePropertyValues(&$propList, &$propNeedValues)
	{
		$result = array();
		if (!empty($propList) && is_array($propList))
		{
			foreach ($propList as $oneProperty)
			{
				$values = array();
				$valuesExist = false;
				$pictMode = ('PICT' == $oneProperty['SHOW_MODE']);
				$needValuesExist = isset($propNeedValues[$oneProperty['ID']]) && !empty($propNeedValues[$oneProperty['ID']]);
				$filterValuesExist = ($needValuesExist && count($propNeedValues[$oneProperty['ID']]) <= 100);
				if ('L' == $oneProperty['PROPERTY_TYPE'])
				{
					$propEnums = CIBlockProperty::GetPropertyEnum(
						$oneProperty['ID'],
						array('SORT' => 'ASC', 'VALUE' => 'ASC')
					);
					while ($oneEnum = $propEnums->Fetch())
					{
						$oneEnum['ID'] = intval($oneEnum['ID']);
						if ($needValuesExist && !isset($propNeedValues[$oneProperty['ID']][$oneEnum['ID']]))
							continue;
						$values[$oneEnum['ID']] = array(
							'ID' => $oneEnum['ID'],
							'NAME' => $oneEnum['VALUE'],
							'SORT' => intval($oneEnum['SORT']),
							'PICT' => false
						);
						$valuesExist = true;
					}
					$values[0] = array(
						'ID' => 0,
						'SORT' => PHP_INT_MAX,
						'NA' => true,
						'NAME' => $oneProperty['DEFAULT_VALUES']['NAME'],
						'PICT' => $oneProperty['DEFAULT_VALUES']['PICT']
					);
				}
				elseif ('E' == $oneProperty['PROPERTY_TYPE'])
				{
					$selectFields = array('ID', 'NAME');
					if ($pictMode)
						$selectFields[] = 'PREVIEW_PICTURE';
					$filterValues = (
						$filterValuesExist
						? array('ID' => $propNeedValues[$oneProperty['ID']], 'IBLOCK_ID' => $oneProperty['LINK_IBLOCK_ID'], 'ACTIVE' => 'Y')
						: array('IBLOCK_ID' => $oneProperty['LINK_IBLOCK_ID'], 'ACTIVE' => 'Y')
					);
					$propEnums = CIBlockElement::GetList(
						array('SORT' => 'ASC', 'NAME' => 'ASC'),
						$filterValues,
						false,
						false,
						$selectFields
					);
					while ($oneEnum = $propEnums->Fetch())
					{
						if ($needValuesExist && !$filterValuesExist)
						{
							if (!isset($propNeedValues[$oneProperty['ID']][$oneEnum['ID']]))
								continue;
						}
						if ($pictMode)
						{
							$oneEnum['PICT'] = false;
							if (!empty($oneEnum['PREVIEW_PICTURE']))
							{
								$previewPict = CFile::GetFileArray($oneEnum['PREVIEW_PICTURE']);
								if (!empty($previewPict))
								{
									$oneEnum['PICT'] = array(
										'SRC' => $previewPict['SRC'],
										'WIDTH' => intval($previewPict['WIDTH']),
										'HEIGHT' => intval($previewPict['HEIGHT'])
									);
								}
							}
							if (empty($oneEnum['PICT']))
							{
								$oneEnum['PICT'] = $oneProperty['DEFAULT_VALUES']['PICT'];
							}
						}
						$oneEnum['ID'] = intval($oneEnum['ID']);
						$values[$oneEnum['ID']] = array(
							'ID' => $oneEnum['ID'],
							'NAME' => $oneEnum['NAME'],
							'SORT' => intval($oneEnum['SORT']),
							'PICT' => ($pictMode ? $oneEnum['PICT'] : false)
						);
						$valuesExist = true;
					}
					$values[0] = array(
						'ID' => 0,
						'SORT' => PHP_INT_MAX,
						'NA' => true,
						'NAME' => $oneProperty['DEFAULT_VALUES']['NAME'],
						'PICT' => ($pictMode ? $oneProperty['DEFAULT_VALUES']['PICT'] : false)
					);
				}
				else
				{
					if (null === self::$highLoadInclude)
						self::$highLoadInclude = \Freetrix\Main\Loader::includeModule('highloadblock');
					if (!self::$highLoadInclude)
						continue;
					$xmlMap = array();
					$sortExist = isset($oneProperty['USER_TYPE_SETTINGS']['FIELDS_MAP']['UF_SORT']);

					$directorySelect = array('ID', 'UF_NAME', 'UF_XML_ID');
					$directoryOrder = array();
					if ($pictMode)
					{
						$directorySelect[] = 'UF_FILE';
					}
					if ($sortExist)
					{
						$directorySelect[] = 'UF_SORT';
						$directoryOrder['UF_SORT'] = 'ASC';
					}
					$directoryOrder['UF_NAME'] = 'ASC';
					$sortValue = 100;

					$entityDataClass = $oneProperty['USER_TYPE_SETTINGS']['ENTITY']->getDataClass();
					$entityGetList = array(
						'select' => $directorySelect,
						'order' => $directoryOrder
					);
					if ($filterValuesExist)
						$entityGetList['filter'] = array('=UF_XML_ID' => $propNeedValues[$oneProperty['ID']]);
					$propEnums = $entityDataClass::getList($entityGetList);
					while ($oneEnum = $propEnums->fetch())
					{
						$oneEnum['ID'] = intval($oneEnum['ID']);
						$oneEnum['UF_SORT'] = ($sortExist ? intval($oneEnum['UF_SORT']) : $sortValue);
						$sortValue += 100;

						if ($pictMode)
						{
							if (!empty($oneEnum['UF_FILE']))
							{
								$arFile = CFile::GetFileArray($oneEnum['UF_FILE']);
								if (!empty($arFile))
								{
									$oneEnum['PICT'] = array(
										'SRC' => $arFile['SRC'],
										'WIDTH' => intval($arFile['WIDTH']),
										'HEIGHT' => intval($arFile['HEIGHT'])
									);
								}
							}
							if (empty($oneEnum['PICT']))
								$oneEnum['PICT'] = $oneProperty['DEFAULT_VALUES']['PICT'];
						}
						$values[$oneEnum['ID']] = array(
							'ID' => $oneEnum['ID'],
							'NAME' => $oneEnum['UF_NAME'],
							'SORT' => intval($oneEnum['UF_SORT']),
							'XML_ID' => $oneEnum['UF_XML_ID'],
							'PICT' => ($pictMode ? $oneEnum['PICT'] : false)
						);
						$valuesExist = true;
						$xmlMap[$oneEnum['UF_XML_ID']] = $oneEnum['ID'];
					}
					$values[0] = array(
						'ID' => 0,
						'SORT' => PHP_INT_MAX,
						'NA' => true,
						'NAME' => $oneProperty['DEFAULT_VALUES']['NAME'],
						'XML_ID' => '',
						'PICT' => ($pictMode ? $oneProperty['DEFAULT_VALUES']['PICT'] : false)
					);
					if ($valuesExist)
						$oneProperty['XML_MAP'] = $xmlMap;
				}
				if (!$valuesExist)
					continue;
				$oneProperty['VALUES'] = $values;
				$oneProperty['VALUES_COUNT'] = count($values);

				$result[$oneProperty['CODE']] = $oneProperty;
			}
		}
		$propList = $result;
		unset($arFilterProp);
	}
Beispiel #12
0
<?php

/**
* @package: Freetrix Core
* Main file for launch base libs
*
**/
error_reporting(E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR | E_PARSE);
require_once $_SERVER["DOCUMENT_ROOT"] . '/freetrix/modules/main/SetCorePath.php';
include_once $_SERVER["DOCUMENT_ROOT"] . "/freetrix/modules/main/lib/loader.php";
require_once $_SERVER["DOCUMENT_ROOT"] . FX_ROOT . "/modules/main/Helpers.php";
\Freetrix\Main\Loader::registerAutoLoadClasses("main", array("freetrix\\main\\application" => "lib/application.php", "freetrix\\main\\httpapplication" => "lib/httpapplication.php", "freetrix\\main\\argumentexception" => "lib/exception.php", "freetrix\\main\\argumentnullexception" => "lib/exception.php", "freetrix\\main\\argumentoutofrangeexception" => "lib/exception.php", "freetrix\\main\\argumenttypeexception" => "lib/exception.php", "freetrix\\main\notimplementedexception" => "lib/exception.php", "freetrix\\main\notsupportedexception" => "lib/exception.php", "freetrix\\main\\objectpropertyexception" => "lib/exception.php", "freetrix\\main\\systemexception" => "lib/exception.php", "freetrix\\main\\context" => "lib/context.php", "freetrix\\main\\httpcontext" => "lib/httpcontext.php", "freetrix\\mainvent" => "lib/event.php", "freetrix\\mainventmanager" => "lib/eventmanager.php", "freetrix\\mainventresult" => "lib/eventresult.php", "freetrix\\main\request" => "lib/request.php", "freetrix\\main\\httprequest" => "lib/httprequest.php", "freetrix\\main\response" => "lib/response.php", "freetrix\\main\\httpresponse" => "lib/httpresponse.php", "freetrix\\main\\modulemanager" => "lib/modulemanager.php", "freetrix\\main\\server" => "lib/server.php", "freetrix\\main\\config\\configuration" => "lib/config/configuration.php", "freetrix\\main\\config\\option" => "lib/config/option.php", "freetrix\\main\\context\\culture" => "lib/context/culture.php", "freetrix\\main\\context\\site" => "lib/context/site.php", "freetrix\\main\\data\\connection" => "lib/data/connection.php", "freetrix\\main\\data\\connectionpool" => "lib/data/connectionpool.php", "freetrix\\main\\data\\hsphpreadconnection" => "lib/data/hsphpreadconnection.php", "freetrix\\main\\data\nosqlconnection" => "lib/data/nosqlconnection.php", "freetrix\\main\\db\\arrayresult" => "lib/db/arrayresult.php", "freetrix\\main\\db\result" => "lib/db/result.php", "freetrix\\main\\db\\connection" => "lib/db/connection.php", "freetrix\\main\\db\\sqlexception" => "lib/db/sqlexception.php", "freetrix\\main\\db\\sqlqueryexception" => "lib/db/sqlexception.php", "freetrix\\main\\db\\sqlexpression" => "lib/db/sqlexpression.php", "freetrix\\main\\db\\sqlhelper" => "lib/db/sqlhelper.php", "freetrix\\main\\db\\mysqlconnection" => "lib/db/mysqlconnection.php", "freetrix\\main\\db\\mysqlresult" => "lib/db/mysqlresult.php", "freetrix\\main\\db\\mysqlsqlhelper" => "lib/db/mysqlsqlhelper.php", "freetrix\\main\\db\\mysqliconnection" => "lib/db/mysqliconnection.php", "freetrix\\main\\db\\mysqliresult" => "lib/db/mysqliresult.php", "freetrix\\main\\db\\mysqlisqlhelper" => "lib/db/mysqlisqlhelper.php", "freetrix\\main\\diag\\httpexceptionhandleroutput" => "lib/diag/httpexceptionhandleroutput.php", "freetrix\\main\\diag\fileexceptionhandlerlog" => "lib/diag/fileexceptionhandlerlog.php", "freetrix\\main\\diagxceptionhandler" => "lib/diag/exceptionhandler.php", "freetrix\\main\\diag\\iexceptionhandleroutput" => "lib/diag/iexceptionhandleroutput.php", "freetrix\\main\\diagxceptionhandlerlog" => "lib/diag/exceptionhandlerlog.php", "freetrix\\main\\io\file" => "lib/io/file.php", "freetrix\\main\\io\fileentry" => "lib/io/fileentry.php", "freetrix\\main\\io\\path" => "lib/io/path.php", "freetrix\\main\\io\filesystementry" => "lib/io/filesystementry.php", "freetrix\\main\\io\\ifilestream" => "lib/io/ifilestream.php", "freetrix\\main\\localization\\loc" => "lib/localization/loc.php", "freetrix\\main\text\\converter" => "lib/text/converter.php", "freetrix\\main\textmptyconverter" => "lib/text/emptyconverter.php", "freetrix\\main\textncoding" => "lib/text/encoding.php", "freetrix\\main\text\\htmlconverter" => "lib/text/htmlconverter.php", "freetrix\\main\text\\string" => "lib/text/string.php", "freetrix\\main\text\\xmlconverter" => "lib/text/xmlconverter.php", "freetrix\\main\type\\collection" => "lib/type/collection.php", "freetrix\\main\type\\datetime" => "lib/type/datetime.php", "freetrix\\main\type\\dictionary" => "lib/type/dictionary.php", "freetrix\\main\type\filterabledictionary" => "lib/type/filterabledictionary.php", "freetrix\\main\type\\parameterdictionary" => "lib/type/parameterdictionary.php", "freetrix\\main\\web\\cookie" => "lib/web/cookie.php", "freetrix\\main\\web\\uri" => "lib/web/uri.php", 'CTimeZone' => 'classes/general/time.php'));
$application = \Freetrix\Main\HttpApplication::getInstance();
$application->initializeBasicKernel();
define("B_PROLOG_INCLUDED", true);
/* Влияет на добавление типов инфоблока и просмотра инфоблоков */
FormDecode();
define("FX_UTF", true);
define("FX_FILE_PERMISSIONS", 0644);
define("FX_DIR_PERMISSIONS", 0755);
@umask(~FX_DIR_PERMISSIONS);
define("FX_DISABLE_INDEX_PAGE", true);
define("FX_UTF_PCRE_MODIFIER", "u");
define("POST_FORM_ACTION_URI", htmlspecialcharsbx("/" . ltrim($_SERVER["REQUEST_URI"], "/")));
$connectionSettings = \Freetrix\Main\Config\Configuration::getValue('connections');
$DBType = $connectionSettings['default']['dbType'];
$DBHost = $connectionSettings['default']['host'];
$DBLogin = $connectionSettings['default']['login'];
$DBPassword = $connectionSettings['default']['password'];
$DBName = $connectionSettings['default']['database'];
$DBDebug = $connectionSettings['default']['debug'];
Beispiel #13
0
		"DETAIL_PICTURE_MODE" => (isset($arParams['DETAIL_DETAIL_PICTURE_MODE']) ? $arParams['DETAIL_DETAIL_PICTURE_MODE'] : '')
	),
	$component
);?><?
if (0 < $ElementID)
{
	$arRecomData = array();
	$recomCacheID = array('IBLOCK_ID' => $arParams['IBLOCK_ID']);
	$obCache = new CPHPCache();
	if ($obCache->InitCache(36000, serialize($recomCacheID), "/catalog/recommended"))
	{
		$arRecomData = $obCache->GetVars();
	}
	elseif ($obCache->StartDataCache())
	{
		if (\Freetrix\Main\Loader::includeModule("catalog"))
		{
			$arSKU = CCatalogSKU::GetInfoByProductIBlock($arParams['IBLOCK_ID']);
			$arRecomData['OFFER_IBLOCK_ID'] = (!empty($arSKU) ? $arSKU['IBLOCK_ID'] : 0);
			$arRecomData['IBLOCK_LINK'] = '';
			$arRecomData['ALL_LINK'] = '';
			$rsProps = CIBlockProperty::GetList(
				array('SORT' => 'ASC', 'ID' => 'ASC'),
				array('IBLOCK_ID' => $arParams['IBLOCK_ID'], 'PROPERTY_TYPE' => 'E', 'ACTIVE' => 'Y')
			);
			$found = false;
			while ($arProp = $rsProps->Fetch())
			{
				if ($found)
				{
					break;
Beispiel #14
0
<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();

if(!\Freetrix\Main\Loader::includeModule("iblock"))
	return;

if(!\Freetrix\Main\Loader::includeModule("highloadblock"))
	return;

$arIBlockType = CIBlockParameters::GetIBlockTypes();

$arIBlock = array();
$rsIBlock = CIBlock::GetList(array("sort" => "asc"), array("TYPE" => $arCurrentValues["IBLOCK_TYPE"], "ACTIVE"=>"Y"));

while($arr = $rsIBlock->Fetch())
	$arIBlock[$arr["ID"]] = "[".$arr["ID"]."] ".$arr["NAME"];

$arProps = array();

$rsProps = CIBlockProperty::GetList(
	array("SORT" => "ASC", "ID" => "ASC"),
	array(
		"IBLOCK_ID" => $arCurrentValues["IBLOCK_ID"],
		"ACTIVE" => "Y",
		"PROPERTY_TYPE" => "S"
	)
);

while ($arProp = $rsProps->Fetch())
{
	if ($arProp['USER_TYPE'] !== 'directory')
		continue;
Beispiel #15
0
 public static function clearCache($full = false, $initDir = "")
 {
     if ($full !== true && $full !== false && $initDir === "" && is_string($full)) {
         $initDir = $full;
         $full = true;
     }
     $res = true;
     if ($full === true) {
         $obCache = static::createInstance();
         $obCache->cleanDir($initDir, "cache");
     }
     $path = Main\Loader::getPersonal("cache" . $initDir);
     if (is_dir($path) && ($handle = opendir($path))) {
         while (($file = readdir($handle)) !== false) {
             if ($file === "." || $file === "..") {
                 continue;
             }
             if (is_dir($path . "/" . $file)) {
                 if (!static::clearCache($full, $initDir . "/" . $file)) {
                     $res = false;
                 } else {
                     @chmod($path . "/" . $file, FX_DIR_PERMISSIONS);
                     //We suppress error handle here because there may be valid cache files in this dir
                     @rmdir($path . "/" . $file);
                 }
             } elseif ($full) {
                 @chmod($path . "/" . $file, FX_FILE_PERMISSIONS);
                 if (!unlink($path . "/" . $file)) {
                     $res = false;
                 }
             } elseif (substr($file, -4) === ".php") {
                 $c = static::createInstance();
                 if ($c->isCacheExpired($path . "/" . $file)) {
                     @chmod($path . "/" . $file, FX_FILE_PERMISSIONS);
                     if (!unlink($path . "/" . $file)) {
                         $res = false;
                     }
                 }
             } else {
                 //We should skip unknown file
                 //it will be deleted with full cache cleanup
             }
         }
         closedir($handle);
     }
     return $res;
 }
Beispiel #16
0
$appContext->setCulture(new \Freetrix\Main\Context\Culture($definedLang));
$Application->start();
$GLOBALS["APPLICATION"]->reinitPath();
$GLOBALS["MESS"] = array();
$GLOBALS["ALL_LANG_FILES"] = array();
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . FX_ROOT . "/modules/main/Helpers.php");
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . FX_ROOT . "/modules/main/date_format.php");
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . FX_ROOT . "/modules/main/classes/general/database.php");
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . FX_ROOT . "/modules/main/classes/general/main.php");
IncludeModuleLangFile(__FILE__);
error_reporting(COption::GetOptionInt("main", "error_reporting", E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR | E_PARSE) & ~E_STRICT);
require_once $_SERVER["DOCUMENT_ROOT"] . FX_ROOT . "/modules/main/filter_tools.php";
require_once $_SERVER["DOCUMENT_ROOT"] . FX_ROOT . "/modules/main/ajax_tools.php";
$GLOBALS["arCustomTemplateEngines"] = array();
require_once $_SERVER["DOCUMENT_ROOT"] . FX_ROOT . "/modules/main/classes/general/urlrewriter.php";
\Freetrix\Main\Loader::registerAutoLoadClasses("main", array("CSiteTemplate" => "classes/general/site_template.php", "CFreetrixComponent" => "classes/general/component.php", "CComponentEngine" => "classes/general/component_engine.php", "CComponentAjax" => "classes/general/component_ajax.php", "CFreetrixComponentTemplate" => "classes/general/component_template.php", "CComponentUtil" => "classes/general/component_util.php", "CControllerClient" => "classes/general/controller_member.php", "PHPParser" => "classes/general/php_parser.php", "CDiskQuota" => "classes/" . $DBType . "/quota.php", "CEventLog" => "classes/general/event_log.php", "CEventMain" => "classes/general/event_log.php", "CAdminFileDialog" => "classes/general/file_dialog.php", "WLL_User" => "classes/general/liveid.php", "WLL_ConsentToken" => "classes/general/liveid.php", "WindowsLiveLogin" => "classes/general/liveid.php", "CAllFile" => "classes/general/file.php", "CFile" => "classes/" . $DBType . "/file.php", "CTempFile" => "classes/general/file_temp.php", "CFavorites" => "classes/" . $DBType . "/favorites.php", "CUserOptions" => "classes/general/user_options.php", "CGridOptions" => "classes/general/grids.php", "CUndo" => "/classes/general/undo.php", "CAutoSave" => "/classes/general/undo.php", "CRatings" => "classes/" . $DBType . "/ratings.php", "CRatingsComponentsMain" => "classes/" . $DBType . "/ratings_components.php", "CRatingRule" => "classes/general/rating_rule.php", "CRatingRulesMain" => "classes/" . $DBType . "/rating_rules.php", "CTopPanel" => "public/top_panel.php", "CEditArea" => "public/edit_area.php", "CComponentPanel" => "public/edit_area.php", "CTextParser" => "classes/general/textparser.php", "CDataXML" => "classes/general/xml.php", "CXMLFileStream" => "classes/general/xml.php", "CRsaProvider" => "classes/general/rsasecurity.php", "CRsaSecurity" => "classes/general/rsasecurity.php", "CRsaBcmathProvider" => "classes/general/rsabcmath.php", "CRsaOpensslProvider" => "classes/general/rsaopenssl.php", "CASNReader" => "classes/general/asn.php", "CBXShortUri" => "classes/" . $DBType . "/short_uri.php", "CFinder" => "classes/general/finder.php", "CAccess" => "classes/general/access.php", "CAuthProvider" => "classes/general/authproviders.php", "IProviderInterface" => "classes/general/authproviders.php", "CGroupAuthProvider" => "classes/general/authproviders.php", "CUserAuthProvider" => "classes/general/authproviders.php", "CTableSchema" => "classes/general/table_schema.php", "CCSVData" => "classes/general/csv_data.php", "CSmile" => "classes/general/smile.php", "CSmileSet" => "classes/general/smile.php", "CUserCounter" => "classes/" . $DBType . "/user_counter.php", "CHotKeys" => "classes/general/hot_keys.php", "CHotKeysCode" => "classes/general/hot_keys.php", "CBXSanitizer" => "classes/general/sanitizer.php", "CBXArchive" => "classes/general/archive.php", "CAdminNotify" => "classes/general/admin_notify.php", "CBXFavAdmMenu" => "classes/general/favorites.php", "CSiteCheckerTest" => "classes/general/site_checker.php", "CSqlUtil" => "classes/general/sql_util.php"));
require_once $_SERVER["DOCUMENT_ROOT"] . FX_ROOT . "/modules/main/classes/" . $DBType . "/agent.php";
require_once $_SERVER["DOCUMENT_ROOT"] . FX_ROOT . "/modules/main/classes/" . $DBType . "/user.php";
require_once $_SERVER["DOCUMENT_ROOT"] . FX_ROOT . "/modules/main/classes/" . $DBType . "/event.php";
require_once $_SERVER["DOCUMENT_ROOT"] . FX_ROOT . "/modules/main/classes/general/menu.php";
require_once $_SERVER["DOCUMENT_ROOT"] . FX_ROOT . "/modules/main/classes/" . $DBType . "/usertype.php";
$GLOBALS["APPLICATION"]->AddJSKernelInfo("main", array("/freetrix/js/main/core/core.js", "/freetrix/js/main/core/core_ajax.js", "/freetrix/js/main/json/json2.min.js", "/freetrix/js/main/core/core_ls.js", "/freetrix/js/main/core/core_popup.js", "/freetrix/js/main/core/core_tooltip.js", "/freetrix/js/main/core/core_fx.js", "/freetrix/js/main/core/core_window.js", "/freetrix/js/main/core/core_autosave.js", "/freetrix/js/main/rating_like.js", "/freetrix/js/main/session.js", "/freetrix/js/main/dd.js", "/freetrix/js/main/utils.js", "/freetrix/js/main/core/core_dd.js"));
$GLOBALS["APPLICATION"]->AddCSSKernelInfo("main", array("/freetrix/js/main/core/css/core.css", "/freetrix/js/main/core/css/core_popup.css", "/freetrix/js/main/core/css/core_tooltip.css", "/freetrix/js/main/core/css/core_date.css", "/freetrix/js/main/core/css/core_date.css/popup.css"));
if (file_exists($init_php = $_SERVER["DOCUMENT_ROOT"] . "/freetrix/init.php")) {
    include_once $init_php;
}
if (($init_phpinterface = getLocalPath("php_interface/init.php", FX_PERSONAL_ROOT)) !== false) {
    include_once $_SERVER["DOCUMENT_ROOT"] . $init_phpinterface;
}
if (($siteid_php_init = getLocalPath("php_interface/" . SITE_ID . "/init.php", FX_PERSONAL_ROOT)) !== false) {
    include_once $_SERVER["DOCUMENT_ROOT"] . $siteid_php_init;
Beispiel #17
0
 protected function sendToEventHandler(array $handler, Event $event)
 {
     try {
         $result = true;
         $event->addDebugInfo($handler);
         if (isset($handler["TO_MODULE_ID"]) && !empty($handler["TO_MODULE_ID"]) && $handler["TO_MODULE_ID"] != 'main') {
             $result = Loader::includeModule($handler["TO_MODULE_ID"]);
         } elseif (isset($handler["TO_PATH"]) && !empty($handler["TO_PATH"])) {
             $path = ltrim($handler["TO_PATH"], "/");
             if (($path = Loader::getLocal($path)) !== false) {
                 $result = (include_once $path);
             }
         } elseif (isset($handler["FULL_PATH"]) && !empty($handler["FULL_PATH"]) && IO\File::isFileExists($handler["FULL_PATH"])) {
             $result = (include_once $handler["FULL_PATH"]);
         }
         $event->addDebugInfo($result);
         if (isset($handler["TO_METHOD_ARG"]) && is_array($handler["TO_METHOD_ARG"]) && !empty($handler["TO_METHOD_ARG"])) {
             $args = $handler["TO_METHOD_ARG"];
         } else {
             $args = array();
         }
         if ($handler["VERSION"] > 1) {
             $args[] = $event;
         } else {
             $args = array_merge($args, array_values($event->getParameters()));
         }
         $callback = null;
         if (isset($handler["CALLBACK"])) {
             $callback = $handler["CALLBACK"];
         } elseif (!empty($handler["TO_CLASS"]) && !empty($handler["TO_METHOD"]) && class_exists($handler["TO_CLASS"])) {
             $callback = array($handler["TO_CLASS"], $handler["TO_METHOD"]);
         }
         if ($callback != null) {
             $result = call_user_func_array($callback, $args);
         }
         if ($result != null && !$result instanceof EventResult) {
             $result = new EventResult(EventResult::UNDEFINED, $result, $handler["TO_MODULE_ID"]);
         }
         $event->addDebugInfo($result);
         if ($result != null) {
             $event->addResult($result);
         }
     } catch (\Exception $ex) {
         if ($event->isDebugOn()) {
             $event->addException($ex);
         } else {
             throw $ex;
         }
     }
 }
Beispiel #18
0
 /**
  * Read messages from user defined lang file
  */
 private static function loadCustomMessages($lang)
 {
     $customMess = array();
     $documentRoot = Main\Application::getDocumentRoot();
     if (($fname = Main\Loader::getLocal("php_interface/user_lang/" . $lang . "/lang.php", $documentRoot)) !== false) {
         $mess = self::includeFile($fname);
         // typical call is Loc::loadMessages(__FILE__)
         // __FILE__ can differ from path used in the user file
         foreach ($mess as $key => $val) {
             $customMess[str_replace("\\", "/", realpath($documentRoot . $key))] = $val;
         }
     }
     return $customMess;
 }
Loc::loadMessages(dirname(__FILE__).'/../../main/Helpers.php');
Loc::loadMessages(dirname(__FILE__).'/seo_search.php');

if (!$USER->CanDoOperation('seo_tools'))
{
	$APPLICATION->AuthForm(Loc::getMessage("ACCESS_DENIED"));
}

if(!Main\Loader::includeModule('seo'))
{
	require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/prolog_admin_after.php");
	ShowError(Loc::getMessage("SEO_ERROR_NO_MODULE"));
	require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/epilog_admin.php");
}

if(!Main\Loader::includeModule('socialservices'))
{
	require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/prolog_admin_after.php");
	ShowError(Loc::getMessage("SEO_ERROR_NO_MODULE_SOCSERV"));
	require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/epilog_admin.php");
}

$domain = $_REQUEST['domain'];

if($domain)
{
	$bFound = false;
	$arDomains = \CSeoUtils::getDomainsList();
	foreach ($arDomains as $arDomain)
	{
		if($domain == $arDomain['DOMAIN'])
Beispiel #20
0
	public static function getDirStructure($bLogical, $site, $path)
	{
		global $USER;

		$arDirContent = array();
		if($USER->CanDoFileOperation('fm_view_listing', array($site, $path)))
		{
			\Freetrix\Main\Loader::includeModule('fileman');

			$arDirs = array();
			$arFiles = array();

			\CFileMan::GetDirList(array($site, $path), $arDirs, $arFiles, array(), array("NAME" => "asc"), "DF", $bLogical, true);

			$arDirContent_t = array_merge($arDirs, $arFiles);
			for($i=0,$l = count($arDirContent_t);$i<$l;$i++)
			{
				$file = $arDirContent_t[$i];
				$arPath = array($site, $file['ABS_PATH']);
				if(
					($file["TYPE"]=="F" && !$USER->CanDoFileOperation('fm_view_file',$arPath))
					|| ($file["TYPE"]=="D" && !$USER->CanDoFileOperation('fm_view_listing',$arPath))
					|| ($file["TYPE"]=="F" && $file["NAME"]==".section.php")
				)
				{
					continue;
				}

				$f = $file['TYPE'] == 'F'
					? new \Freetrix\Main\IO\File($file['PATH'], $site)
					: new \Freetrix\Main\IO\Directory($file['PATH'], $site);

				$p = $f->getName();

				if($f->isSystem()
					|| $file['TYPE'] == 'F' && in_array($p, array("urlrewrite.php"))
					|| $file['TYPE'] == 'D' && preg_match("/\/(freetrix|".\COption::getOptionString("main", "upload_dir", "upload").")\//", "/".$p."/")
				)
				{
					continue;
				}

				$arFileData = array(
					'NAME' => $bLogical ? $file['LOGIC_NAME'] : $p,
					'FILE' => $p,
					'TYPE' => $file['TYPE'],
					'DATA' => $file,
				);

				if(strlen($arFileData['NAME']) <= 0)
					$arFileData['NAME'] = GetMessage('SEO_DIR_LOGICAL_NO_NAME');

				$arDirContent[] = $arFileData;
			}
			unset($arDirContent_t);
		}

		return $arDirContent;
	}
Beispiel #21
0
Loc::loadMessages(dirname(__FILE__).'/seo_sitemap.php');

if (!$USER->CanDoOperation('seo_tools'))
{
	$APPLICATION->AuthForm(Loc::getMessage("ACCESS_DENIED"));
}

if(!Main\Loader::includeModule('seo'))
{
	require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/prolog_admin_after.php");
	ShowError(Loc::getMessage("SEO_ERROR_NO_MODULE"));
	require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/epilog_admin.php");
}

$bIBlock = Main\Loader::includeModule('iblock');
$bForum = Main\Loader::includeModule('forum');

$ID = intval($_REQUEST['ID']);
$SITE_ID = trim($_REQUEST['site_id']);

$bDefaultHttps = false;

if($ID > 0)
{
	$dbSitemap = SitemapTable::getById($ID);
	$arSitemap = $dbSitemap->fetch();

	if(!is_array($arSitemap))
	{
		require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/prolog_admin_after.php");
		ShowError(Loc::getMessage("SEO_ERROR_SITEMAP_NOT_FOUND"));
Beispiel #22
0
	elseif($v < $arValueSteps['forum_index'])
	{
		$NS['time_start'] = microtime(true);

		$arForumList = array();
		if(!empty($arSitemap['SETTINGS']['FORUM_ACTIVE']))
		{
			foreach ($arSitemap['SETTINGS']['FORUM_ACTIVE'] as $forumId => $active)
			{
				if ($active == "Y")
				{
					$arForumList[$forumId] = "Y";
				}
			}
		}
		if(count($arForumList) > 0 && Main\Loader::includeModule('forum'))
		{
			$arForums = array();
			$db_res = CForumNew::GetListEx(
				array(),
				array(
					'@ID' => array_keys($arForumList),
					"ACTIVE" => "Y",
					"SITE_ID" => $arSitemap['SITE_ID'],
					"!TOPICS" => 0
				)
			);
			while ($res = $db_res->Fetch())
			{
				$arForums[$res['ID']] = $res;
			}
Beispiel #23
0
	$arResult["SECTIONS_COUNT"] = count($arResult["SECTIONS"]);

	$this->SetResultCacheKeys(array(
		"SECTIONS_COUNT",
		"SECTION",
	));

	$this->IncludeComponentTemplate();
}

if($arResult["SECTIONS_COUNT"] > 0 || isset($arResult["SECTION"]))
{
	if(
		$USER->IsAuthorized()
		&& $APPLICATION->GetShowIncludeAreas()
		&& \Freetrix\Main\Loader::includeModule("iblock")
	)
	{
		$UrlDeleteSectionButton = "";
		if(isset($arResult["SECTION"]) && $arResult["SECTION"]['IBLOCK_SECTION_ID'] > 0)
		{
			$rsSection = CIBlockSection::GetList(
				array(),
				array("=ID" => $arResult["SECTION"]['IBLOCK_SECTION_ID']),
				false,
				array("SECTION_PAGE_URL")
			);
			$rsSection->SetUrlTemplates("", $arParams["SECTION_URL"]);
			$arSection = $rsSection->GetNext();
			$UrlDeleteSectionButton = $arSection["SECTION_PAGE_URL"];
		}
Beispiel #24
0
use Freetrix\Main;
use Freetrix\Main\Text\Converter;
use Freetrix\Main\Localization\Loc;
use Freetrix\Seo\SitemapTable;
use Freetrix\Seo\SitemapRuntime;
use Freetrix\Seo\SitemapRuntimeTable;

Loc::loadMessages(dirname(__FILE__).'/seo_sitemap.php');

if (!$USER->CanDoOperation('seo_tools'))
{
	$APPLICATION->AuthForm(Loc::getMessage("ACCESS_DENIED"));
}

if(!Main\Loader::includeModule('seo'))
{
	require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/prolog_admin_after.php");
	ShowError(Loc::getMessage("SEO_ERROR_NO_MODULE"));
	require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/epilog_admin.php");
}

$tableID = "tbl_sitemap";

$oSort = new CAdminSorting($tableID, "ID", "desc");
$adminList = new CAdminList($tableID, $oSort);

if(($arID = $adminList->GroupAction()))
{
	if($_REQUEST['action_target']=='selected')
	{
Beispiel #25
0
<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();

if (!\Freetrix\Main\Loader::includeModule('iblock'))
	return;
$boolCatalog = \Freetrix\Main\Loader::includeModule('catalog');

$arSKU = false;
$boolSKU = false;
if ($boolCatalog && (isset($arCurrentValues['IBLOCK_ID']) && 0 < intval($arCurrentValues['IBLOCK_ID'])))
{
	$arSKU = CCatalogSKU::GetInfoByProductIBlock($arCurrentValues['IBLOCK_ID']);
	$boolSKU = !empty($arSKU) && is_array($arSKU);
}

$arThemes = array();
if (\Freetrix\Main\ModuleManager::isModuleInstalled('freetrix.eshop'))
{
	$arThemes['site'] = GetMessage('CPT_BC_TPL_THEME_SITE');
}

$arThemes['blue'] = GetMessage('CPT_BC_TPL_THEME_BLUE');
$arThemes['green'] = GetMessage('CPT_BC_TPL_THEME_GREEN');
$arThemes['red'] = GetMessage('CPT_BC_TPL_THEME_RED');
$arThemes['wood'] = GetMessage('CPT_BC_TPL_THEME_WOOD');
$arThemes['yellow'] = GetMessage('CPT_BC_TPL_THEME_YELLOW');
$arThemes['black'] = GetMessage('CP_BC_TPL_THEME_BLACK');

$arViewModeList = array(
	'LIST' => GetMessage('CPT_BC_SECTIONS_VIEW_MODE_LIST'),
	'LINE' => GetMessage('CPT_BC_SECTIONS_VIEW_MODE_LINE'),
Beispiel #26
0
$arDefaultVariableAliases = array();

$arComponentVariables = array(
	"SECTION_ID",
	"SECTION_CODE",
	"ELEMENT_ID",
	"ELEMENT_CODE",
	"action",
);

if($arParams["SEF_MODE"] == "Y")
{
	$arVariables = array();

	$engine = new CComponentEngine($this);
	if (\Freetrix\Main\Loader::includeModule('iblock'))
	{
		$engine->addGreedyPart("#SECTION_CODE_PATH#");
		$engine->setResolveCallback(array("CIBlockFindTools", "resolveComponentEngine"));
	}
	$arUrlTemplates = CComponentEngine::MakeComponentUrlTemplates($arDefaultUrlTemplates404, $arParams["SEF_URL_TEMPLATES"]);
	$arVariableAliases = CComponentEngine::MakeComponentVariableAliases($arDefaultVariableAliases404, $arParams["VARIABLE_ALIASES"]);

	$componentPage = $engine->guessComponentPath(
		$arParams["SEF_FOLDER"],
		$arUrlTemplates,
		$arVariables
	);

	if(!$componentPage && isset($_REQUEST["q"]))
		$componentPage = "search";
Beispiel #27
0
	public static function GetInheritedPropertyTemplateElementMenuItems($iblock_id, $action_function, $menuID, $inputID = "")
	{
		$result = array();
		$result["this"] = array(
			"TEXT" => GetMessage("IB_COMPLIB_POPUP_ELEMENT"),
			"MENU" => array(
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_ELEMENT_NAME"),
					"ONCLICK" => "$action_function('{=this.Name}', '$menuID', '$inputID')",
				),
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_ELEMENT_LOWER_NAME"),
					"ONCLICK" => "$action_function('{=lower this.Name}', '$menuID', '$inputID')",
				),
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_ELEMENT_CODE"),
					"ONCLICK" => "$action_function('{=this.Code}', '$menuID', '$inputID')",
				),
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_ELEMENT_PREVIEW_TEXT"),
					"ONCLICK" => "$action_function('{=this.PreviewText}', '$menuID', '$inputID')",
				),
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_ELEMENT_DETAIL_TEXT"),
					"ONCLICK" => "$action_function('{=this.DetailText}', '$menuID', '$inputID')",
				),
			),
		);
		if ($iblock_id > 0)
		{
			$result["properties"] = array(
				"TEXT" => GetMessage("IB_COMPLIB_POPUP_PROPERTIES"),
				"MENU" => array(
				),
			);
			$rsProperty = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $iblock_id));
			while($property = $rsProperty->fetch())
			{
				if ($property["PROPERTY_TYPE"] != "F")
				{
					$result["properties"]["MENU"][] = array(
						"TEXT" => $property["NAME"],
						"ONCLICK" => "$action_function('{=this.property.".($property["CODE"]!=""? $property["CODE"]: $property["ID"])."}', '$menuID', '$inputID')",
					);
				}
			}
		}
		$result["parent"] = array(
			"TEXT" => GetMessage("IB_COMPLIB_POPUP_PARENT"),
			"MENU" => array(
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_PARENT_NAME"),
					"ONCLICK" => "$action_function('{=parent.Name}', '$menuID', '$inputID')",
				),
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_PARENT_CODE"),
					"ONCLICK" => "$action_function('{=parent.Code}', '$menuID', '$inputID')",
				),
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_PARENT_TEXT"),
					"ONCLICK" => "$action_function('{=parent.PreviewText}', '$menuID', '$inputID')",
				),
			),
		);
		$result["iblock"] = array(
			"TEXT" => GetMessage("IB_COMPLIB_POPUP_IBLOCK"),
			"MENU" => array(
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_IBLOCK_NAME"),
					"ONCLICK" => "$action_function('{=iblock.Name}', '$menuID', '$inputID')",
				),
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_IBLOCK_CODE"),
					"ONCLICK" => "$action_function('{=iblock.Code}', '$menuID', '$inputID')",
				),
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_IBLOCK_TEXT"),
					"ONCLICK" => "$action_function('{=iblock.PreviewText}', '$menuID', '$inputID')",
				),
			),
		);
		if (\Freetrix\Main\Loader::includeModule('catalog'))
		{
			$arCatalog = \CCatalogSKU::GetInfoByProductIBlock($iblock_id);
			if (is_array($arCatalog))
			{
				$result["sku_properties"] = array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_SKU_PROPERTIES"),
					"MENU" => array(
					),
				);
				$rsProperty = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $arCatalog["IBLOCK_ID"]));
				while($property = $rsProperty->fetch())
				{
					if ($property["PROPERTY_TYPE"] != "F")
					{
						$result["sku_properties"]["MENU"][] = array(
							"TEXT" => $property["NAME"],
							"ONCLICK" => "$action_function('{=concat {=distinct this.catalog.sku.property.".($property["CODE"]!=""? $property["CODE"]: $property["ID"])." \", \"}}', '$menuID', '$inputID')",
						);
					}
				}
				$result["sku_price"] = array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_SKU_PRICE"),
					"MENU" => array(),
				);
				$rsPrice = CCatalogGroup::GetListEx(array("SORT"=>"ASC"), array(), false, false, array("ID", "NAME"));
				while ($price = $rsPrice->Fetch())
				{
					if (preg_match("/^[a-zA-Z0-9]+\$/", $price["NAME"]))
					{
						$result["sku_price"]["MENU"][] = array(
							"TEXT" => GetMessage("IB_COMPLIB_POPUP_MIN_PRICE")." ".$price["NAME"],
							"ONCLICK" => "$action_function('{=min this.catalog.sku.price.".$price["NAME"]."}', '$menuID', '$inputID')",
						);
						$result["sku_price"]["MENU"][] = array(
							"TEXT" => GetMessage("IB_COMPLIB_POPUP_MAX_PRICE")." ".$price["NAME"],
							"ONCLICK" => "$action_function('{=max this.catalog.sku.price.".$price["NAME"]."}', '$menuID', '$inputID')",
						);
					}
					else
					{
						$result["sku_price"]["MENU"][] = array(
							"TEXT" => GetMessage("IB_COMPLIB_POPUP_MIN_PRICE")." ".$price["NAME"],
							"ONCLICK" => "$action_function('{=min this.catalog.sku.price.".$price["ID"]."}', '$menuID', '$inputID')",
						);
						$result["sku_price"]["MENU"][] = array(
							"TEXT" => GetMessage("IB_COMPLIB_POPUP_MAX_PRICE")." ".$price["NAME"],
							"ONCLICK" => "$action_function('{=max this.catalog.sku.price.".$price["ID"]."}', '$menuID', '$inputID')",
						);
					}
				}
			}

			$result["catalog"] = array(
				"TEXT" => GetMessage("IB_COMPLIB_POPUP_CATALOG"),
				"MENU" => array(
					array(
						"TEXT" => GetMessage("IB_COMPLIB_POPUP_CATALOG_WEIGHT"),
						"ONCLICK" => "$action_function('{=this.catalog.weight}', '$menuID', '$inputID')",
					),
					array(
						"TEXT" => GetMessage("IB_COMPLIB_POPUP_CATALOG_MEASURE"),
						"ONCLICK" => "$action_function('{=this.catalog.measure}', '$menuID', '$inputID')",
					),
				),
			);
			$result["price"] = array(
				"TEXT" => GetMessage("IB_COMPLIB_POPUP_PRICE"),
				"MENU" => array(),
			);
			$rsPrice = CCatalogGroup::GetListEx(array("SORT"=>"ASC"), array(), false, false, array("ID", "NAME"));
			while ($price = $rsPrice->Fetch())
			{
				if (preg_match("/^[a-zA-Z0-9]+\$/", $price["NAME"]))
					$result["price"]["MENU"][] = array(
						"TEXT" => $price["NAME"],
						"ONCLICK" => "$action_function('{=this.catalog.price.".$price["NAME"]."}', '$menuID', '$inputID')",
					);
				else
					$result["price"]["MENU"][] = array(
						"TEXT" => $price["NAME"],
						"ONCLICK" => "$action_function('{=this.catalog.price.".$price["ID"]."}', '$menuID', '$inputID')",
					);
			}
			$result["store"] = array(
				"TEXT" => GetMessage("IB_COMPLIB_POPUP_STORE"),
				"MENU" => array(),
			);
			$rsStore = CCatalogStore::GetList();
			while ($store = $rsStore->Fetch())
			{
				$result["store"]["MENU"][] = array(
					"TEXT" => $store["TITLE"],
					"ONCLICK" => "$action_function('{=catalog.store.".$store["ID"].".name}', '$menuID', '$inputID')",
				);
			}
		}
		$result["misc"] = array(
			"TEXT" => GetMessage("IB_COMPLIB_POPUP_MISC"),
			"MENU" => array(),
		);
		$result["misc"]["MENU"][] =  array(
			"TEXT" => GetMessage("IB_COMPLIB_POPUP_SECTIONS_PATH"),
			"ONCLICK" => "$action_function('{=concat this.sections.name \" / \"}', '$menuID', '$inputID')",
		);
		if (\Freetrix\Main\Loader::includeModule('catalog'))
		{
			$result["misc"]["MENU"][] =  array(
				"TEXT" => GetMessage("IB_COMPLIB_POPUP_STORE_LIST"),
				"ONCLICK" => "$action_function('{=concat catalog.store \", \"}', '$menuID', '$inputID')",
			);
		}
		$r = array();
		foreach($result as $category)
		{
			if (!empty($category) && !empty($category["MENU"]))
			{
				$r[] = $category;
			}
		}
		return $r;
	}
Beispiel #28
0
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();

/* Blog comments*/
if(!\Freetrix\Main\Loader::includeModule("iblock"))
{
	ShowError(GetMessage("IBLOCK_CSC_MODULE_NOT_INSTALLED"));
	return false;
}

if(!\Freetrix\Main\Loader::includeModule("blog"))
{
	ShowError(GetMessage("IBLOCK_CSC_MODULE_BLOG_NOT_INSTALLED"));
	return false;
}

$arResult["ELEMENT"] = array();
$arResult["ERRORS"] = array();

if(!isset($arParams["CACHE_TIME"]))
	$arParams["CACHE_TIME"] = 0;

$arParams["IBLOCK_ID"] = intval($arParams["IBLOCK_ID"]);
$arParams["ELEMENT_ID"] = intval($arParams["~ELEMENT_ID"]);

//Handle case when ELEMENT_CODE used
if($arParams["ELEMENT_ID"] <= 0)
	$arParams["ELEMENT_ID"] = CIBlockFindTools::GetElementID(
		$arParams["ELEMENT_ID"],
		$arParams["ELEMENT_CODE"],
		false,
Beispiel #29
0
 /**
  * Returns server document root.
  *
  * @return null|string
  */
 public static function getDocumentRoot()
 {
     static $documentRoot = null;
     if ($documentRoot != null) {
         return $documentRoot;
     }
     $context = Application::getInstance()->getContext();
     if ($context != null) {
         $server = $context->getServer();
         if ($server != null) {
             return $documentRoot = $server->getDocumentRoot();
         }
     }
     return Loader::getDocumentRoot();
 }
Beispiel #30
0
 private static function loadTriggers($moduleId)
 {
     static $triggersCache = array();
     if (isset($triggersCache[$moduleId])) {
         return;
     }
     if (preg_match("#[^a-zA-Z0-9._]#", $moduleId)) {
         throw new Main\ArgumentOutOfRangeException("moduleId");
     }
     $triggersCache[$moduleId] = true;
     $path = Main\Loader::getLocal("modules/" . $moduleId . "/option_triggers.php");
     if ($path === false) {
         return;
     }
     include $path;
 }