示例#1
0
	public function UnEscape($aFilter)
	{
		if(defined("FX_UTF"))
			return;
		if(!is_array($aFilter))
			return;
		foreach($aFilter as $flt)
			if(is_string($GLOBALS[$flt]) && CUtil::DetectUTF8($GLOBALS[$flt]))
				CUtil::decodeURIComponent($GLOBALS[$flt]);
	}
示例#2
0
			break;
		}
	}
}

if (!defined("AUTH_404"))
	// define("AUTH_404", "Y");

require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/bx_root.php");
require_once($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/php_interface/dbconn.php");

// define("BX_URLREWRITE", true);

$requestUri = urldecode($_SERVER["REQUEST_URI"]);

$bUTF = (!defined("BX_UTF") && CUtil::DetectUTF8($_SERVER["REQUEST_URI"]));
if($bUTF)
	$requestUri = CharsetConverter::ConvertCharset($requestUri, "utf-8", (defined("BX_DEFAULT_CHARSET")? BX_DEFAULT_CHARSET : "windows-1251"));

include_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/classes/general/virtual_io.php");
$io = CBXVirtualIo::GetInstance();

$arUrlRewrite = array();
if(file_exists($_SERVER['DOCUMENT_ROOT']."/urlrewrite.php"))
	include($_SERVER['DOCUMENT_ROOT']."/urlrewrite.php");

if(isset($_SERVER['REDIRECT_STATUS']) && $_SERVER['REDIRECT_STATUS'] == '404' || isset($_GET["SEF_APPLICATION_CUR_PAGE_URL"]))
{
	if(isset($_SERVER['REDIRECT_STATUS']) && $_SERVER['REDIRECT_STATUS'] == '404' && !isset($_GET["SEF_APPLICATION_CUR_PAGE_URL"]))
	{
		$url = $requestUri;
示例#3
0
     }
     return array($arResponseHeaders, $responseBody);
 }
 if (empty($errorMessage)) {
     $body = array("SERVER" => ($GLOBALS["APPLICATION"]->IsHTTPS() ? "https" : "http") . "://" . $_SERVER["HTTP_HOST"], "LOGIN" => $saleLogin, "PASSWORD" => $salePassword, "SITE_NAME" => COption::GetOptionString("main", "site_name", ""));
     $body1 = http_build_query($body);
     if (!defined("BX_UTF")) {
         $body1 = CharsetConverter::ConvertCharset($body1, SITE_CHARSET, "UTF-8");
     }
     list($arResponseHeaders, $responseBody) = __CrmSaleQuery($crmUrlScheme, $crmUrlHost, $crmUrlPort, $crmLogin, $crmPassword, "", $body1, $errorMessageTmp);
     if (!empty($errorMessageTmp)) {
         $errorMessage .= $errorMessageTmp;
     }
 }
 if (empty($errorMessage)) {
     $isUTF = CUtil::DetectUTF8($responseBody);
     if (!$isUTF && SITE_CHARSET == "UTF-8") {
         $responseBody = CharsetConverter::ConvertCharset($responseBody, SITE_CHARSET, "CP1251");
     }
     if (strpos($responseBody, "bsid=") !== false) {
         $p1 = strpos($responseBody, "bsid=");
         $p2 = strpos($responseBody, ";", $p1);
         $body["sessid"] = substr($responseBody, $p1 + 5, $p2 - $p1 - 5);
         $body1 = http_build_query($body);
         if (!defined("BX_UTF")) {
             $body1 = CharsetConverter::ConvertCharset($body1, SITE_CHARSET, "UTF-8");
         }
         $head1 = "";
         foreach ($arResponseHeaders as $h) {
             $p1 = strpos($h, "PHPSESSID=");
             if ($p1 !== false) {
示例#4
0
文件: tools.php 项目: nProfessor/Mytb
	function ConvertToLangCharset($string)
	{
		$bUTF = CUtil::DetectUTF8($string);

		$fromCP = false;
		if(defined("BX_UTF") && !$bUTF)
		{
			$fromCP = (defined("BX_DEFAULT_CHARSET")? BX_DEFAULT_CHARSET : "Windows-1251");
			$toCP = "UTF-8";
		}
		elseif(!defined("BX_UTF") && $bUTF)
		{
			$fromCP = "UTF-8";
			$toCP = (defined("LANG_CHARSET")? LANG_CHARSET : (defined("BX_DEFAULT_CHARSET")? BX_DEFAULT_CHARSET : "Windows-1251"));
		}

		if($fromCP !== false)
			$string = CharsetConverter::ConvertCharset($string, $fromCP, $toCP);

		return $string;
	}
示例#5
0
 public static function OnSearchGetFileContent($absolute_path, $ext = '')
 {
     global $APPLICATION;
     static $arExternalConverters = false;
     if (!$arExternalConverters) {
         $arExternalConverters = array();
         $extensions = explode(",", COption::GetOptionString("intranet", "search_file_extensions"));
         foreach ($extensions as $extension) {
             $command = trim(COption::GetOptionString("intranet", "search_file_extension_exe_" . $extension, ""));
             if (strpos($command, "#FILE_NAME#") !== false || strpos($command, "#SHORT_FILE_NAME#") !== false) {
                 $arExternalConverters["." . $extension] = array("exe" => $command, "cd" => trim(COption::GetOptionString("intranet", "search_file_extension_cd_" . $extension, "")));
             }
         }
     }
     $io = CBXVirtualIo::GetInstance();
     $ioFile = $io->GetFile($absolute_path);
     if ($ioFile->IsExists() && !$ioFile->IsDirectory() && $ioFile->GetFileSize() > 0) {
         $fs_absolute_path = $io->GetPhysicalName($absolute_path);
         //Check by file extension
         if (!$ext) {
             $p = strrpos($absolute_path, ".");
             if ($p !== false) {
                 $ext = substr($absolute_path, $p);
             }
         }
         if ($ext) {
             $ext = '.' . ltrim($ext, '.');
             switch ($ext) {
                 case ".docx":
                     $parser = new CIntranetSearchConverter_docx();
                     $result = CIntranetSearchConverters::ProcessZipEntry($fs_absolute_path, "#^word/document\\.xml\$#", $parser);
                     if ($result) {
                         $tags = CIntranetSearchConverters::ProcessZipEntry($fs_absolute_path, "#^docProps/core\\.xml\$#", $parser, "ParseTagsZip");
                     }
                     break;
                 case ".odt":
                 case ".odp":
                     $parser = new CIntranetSearchConverter_odt();
                     $result = CIntranetSearchConverters::ProcessZipEntry($fs_absolute_path, "#^content\\.xml\$#", $parser);
                     if ($result) {
                         $tags = CIntranetSearchConverters::ProcessZipEntry($fs_absolute_path, "#^meta\\.xml\$#", $parser, "ParseTagsZip");
                     }
                     break;
                 case ".ods":
                     $parser = new CIntranetSearchConverter_ods();
                     $result = CIntranetSearchConverters::ProcessZipEntry($fs_absolute_path, "#^content\\.xml\$#", $parser);
                     if ($result) {
                         $tags = CIntranetSearchConverters::ProcessZipEntry($fs_absolute_path, "#^meta\\.xml\$#", $parser, "ParseTagsZip");
                     }
                     break;
                 case ".rtf":
                     $parser = new CIntranetSearchConverter_rtf();
                     $result = $parser->ProcessFile($fs_absolute_path);
                     $tags = "";
                     break;
                 case ".xlsx":
                     $parser = new CIntranetSearchConverter_xlsx();
                     $result = CIntranetSearchConverters::ProcessZipEntry($fs_absolute_path, "#^xl/sharedStrings.xml\$#", $parser);
                     if ($result) {
                         $tags = CIntranetSearchConverters::ProcessZipEntry($fs_absolute_path, "#^docProps/core\\.xml\$#", $parser, "ParseTagsZip");
                     }
                     break;
                 case ".pptx":
                     $parser = new CIntranetSearchConverter_pptx();
                     $result = CIntranetSearchConverters::ProcessZipEntry($fs_absolute_path, "#^ppt/slides/(.+)\\.xml\$#", $parser);
                     if ($result) {
                         $tags = CIntranetSearchConverters::ProcessZipEntry($fs_absolute_path, "#^docProps/core\\.xml\$#", $parser, "ParseTagsZip");
                     }
                     break;
                 default:
                     if (array_key_exists($ext, $arExternalConverters)) {
                         $parser = new CIntranetSearchConverter();
                         $result = $parser->ProcessExec($arExternalConverters[$ext], $fs_absolute_path);
                     } else {
                         $result = false;
                     }
                     $tags = "";
             }
             if (strlen($result)) {
                 $file_name = end(explode('/', $absolute_path));
                 if (CUtil::DetectUTF8(urlencode($file_name))) {
                     $file_name = $APPLICATION->ConvertCharset($file_name, "UTF-8", LANG_CHARSET);
                 }
                 return array("TITLE" => $file_name, "CONTENT" => $APPLICATION->ConvertCharset($result, "UTF-8", LANG_CHARSET), "PROPERTIES" => array(COption::GetOptionString("search", "page_tag_property") => $APPLICATION->ConvertCharset($tags, "UTF-8", LANG_CHARSET)));
             }
         }
     }
     return false;
 }
示例#6
0
 function SetPath($path)
 {
     $this->_path = substr($path, -9, 9) === "index.php" ? substr($path, 0, strlen($path) - 9) : $path;
     if (defined('BX_UTF') && isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'IIS') !== false && !CUtil::DetectUTF8($_SERVER["REQUEST_URI"])) {
         $charset = 'windows-1251';
         if (defined('BX_DEFAULT_CHARSET') && strlen('BX_DEFAULT_CHARSET') > 0) {
             $charset = BX_DEFAULT_CHARSET;
         }
         $this->_path = CharsetConverter::ConvertCharset($this->_path, $charset, "utf-8");
     }
     $arPath = explode('/', $this->_udecode($this->_path));
     foreach ($this->meta_names as $metaName => $metaValue) {
         if ($arPath[1] == $metaValue['alias'] || $arPath[1] == $metaValue['name']) {
             $this->meta_state = $metaName;
         }
     }
     if (isset($this->meta_state) && method_exists($this, 'GetMetaID')) {
         $this->GetMetaID($this->meta_state);
     }
 }
示例#7
0
if (!($USER->CanDoOperation('fileman_admin_files') || $USER->CanDoOperation('fileman_edit_existent_files') || $USER->CanDoOperation('fileman_view_file_structure')))
	$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));

require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/fileman/include.php");
IncludeModuleLangFile(__FILE__);
$addUrl = 'lang='.LANGUAGE_ID.($logical == "Y"?'&logical=Y':'');

$strWarning = "";

$site = CFileMan::__CheckSite($site);
$DOC_ROOT = CSite::GetSiteDocRoot($site);

$io = CBXVirtualIo::GetInstance();

if (CUtil::DetectUTF8($path))
	CUtil::decodeURIComponent($path);

$path = $io->CombinePath("/", $path);
$arParsedPath = CFileMan::ParsePath(Array($site, $path), false, false, "", $logical == "Y");
$abs_path = $DOC_ROOT.$path;
$arPath = Array($site, $path);

$APPLICATION->SetTitle(GetMessage("FILEMAN_FILEVIEW_TITLE")." \"".$arParsedPath["LAST"]."\"");

foreach ($arParsedPath["AR_PATH"] as $chainLevel)
{
	$adminChain->AddItem(
		array(
			"TEXT" => htmlspecialcharsex($chainLevel["TITLE"]),
			"LINK" => ((strlen($chainLevel["LINK"]) > 0) ? $chainLevel["LINK"] : ""),
示例#8
0
 static function ConvertCharsetIfNeed($t)
 {
     $charsetFrom = CUtil::DetectUTF8($t) ? "utf-8" : 'windows-1251';
     $charsetTo = defined('BX_UTF') && BX_UTF == true ? "utf-8" : 'windows-1251';
     if ($charsetFrom !== $charsetTo) {
         $t = CharsetConverter::ConvertCharset($t, $charsetFrom, $charsetTo);
     }
     return $t;
 }