Esempio n. 1
0
if (!$USER->CanDoOperation('seo_tools') || !check_freetrix_sessid())
	die(GetMessage("ACCESS_DENIED"));

use Freetrix\Seo\Engine;
use Freetrix\Main\Text\Converter;
use Freetrix\Main\Localization\Loc;
use Freetrix\Main\IO\Path;

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

CUtil::JSPostUnescape();

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

$engine = new Engine\Yandex();

if(isset($_REQUEST['action']))
{
	$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'], '/'))
			{
				$bFound = true;
	}

	if(!$bFound)
		$domain = false;
}

if(!$domain)
{
	require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/prolog_admin_after.php");
	ShowError(Loc::getMessage("SEO_ERROR_NO_DOMAIN"));
	require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/epilog_admin.php");
}

$APPLICATION->SetAdditionalCSS('/freetrix/panel/seo/seo.css');

$engine = new Engine\Yandex();

$siteDomainEnc = Converter::getHtmlConverter()->encode($arDomain['DOMAIN']);
$siteDomainEncView = Converter::getHtmlConverter()->encode(\CBXPunycode::ToUnicode($arDomain['DOMAIN'], $e = null));
$siteDirEnc = Converter::getHtmlConverter()->encode($arDomain['SITE_DIR']);
try
{
	$arSiteInfo = $engine->getSiteInfo($arDomain['DOMAIN'], $arDomain['SITE_DIR']);
}
catch(Exception $e)
{
	require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/prolog_admin_after.php");
	ShowError($e->getMessage());
	require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/epilog_admin.php");
}