Esempio n. 1
0
 private function __construct()
 {
     //use self::getInstance()
     $this->targetList['KERNEL'] = array('NAME' => 'KERNEL', 'START' => true, 'CSS_RES' => array(), 'JS_RES' => array(), 'CSS_LIST' => array(), 'JS_LIST' => array(), 'STRING_LIST' => array(), 'UNIQUE' => true, 'PREFIX' => 'kernel', 'BODY' => false, 'MODE' => AssetMode::ALL);
     $this->targetList['BODY'] = $this->targetList['TEMPLATE'] = $this->targetList['PAGE'] = $this->targetList['KERNEL'];
     $this->targetList['PAGE']['NAME'] = 'PAGE';
     $this->targetList['PAGE']['UNIQUE'] = false;
     $this->targetList['PAGE']['PREFIX'] = 'page';
     $this->targetList['TEMPLATE']['NAME'] = 'TEMPLATE';
     $this->targetList['TEMPLATE']['UNIQUE'] = false;
     $this->targetList['TEMPLATE']['PREFIX'] = 'template';
     $this->targetList['BODY']['NAME'] = 'BODY';
     $this->targetList['BODY']['UNIQUE'] = false;
     $this->targetList['BODY']['PREFIX'] = 'body';
     /** fix current order of kernel modules */
     $this->targetList['KERNEL']['CSS_LIST']['KERNEL_main'] = array();
     $this->targetList['KERNEL']['JS_LIST']['KERNEL_main'] = array();
     $this->target =& $this->targetList['TEMPLATE'];
     $ieVersion = IsIE();
     $this->isIE = $ieVersion !== false && $ieVersion < 10;
     $this->documentRoot = Main\Loader::getDocumentRoot();
 }
Esempio n. 2
0
 protected function showJsonAnswer($result)
 {
     if (!defined("PUBLIC_AJAX_MODE")) {
         define("PUBLIC_AJAX_MODE", true);
     }
     if (!defined("NO_KEEP_STATISTIC")) {
         define("NO_KEEP_STATISTIC", "Y");
     }
     if (!defined("NO_AGENT_STATISTIC")) {
         define("NO_AGENT_STATISTIC", "Y");
     }
     if (!defined("NO_AGENT_CHECK")) {
         define("NO_AGENT_CHECK", true);
     }
     if (!defined("DisableEventsCheck")) {
         define("DisableEventsCheck", true);
     }
     require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
     $GLOBALS["APPLICATION"]->RestartBuffer();
     while (ob_end_clean()) {
     }
     $version = IsIE();
     if (!(0 < $version && $version < 10)) {
         header('Content-Type:application/json; charset=UTF-8');
     }
     echo Json::encode($result);
     \CMain::finalActions();
     die;
 }
Esempio n. 3
0
 */
/**
 * Bitrix vars
 * @global CAllUser $USER
 * @global CAllMain $APPLICATION
 */
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
CModule::IncludeModule("mobileapp");
\Bitrix\Main\Localization\Loc::loadMessages(__FILE__);
$APPLICATION->SetTitle(GetMessage("MOBILEAPP_APP_DESIGNER_TITLE"));
if (!$USER->isAdmin()) {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
$ieVersion = IsIE();
if (IsIE() !== false && IsIE() < 9) {
    CAdminMessage::ShowMessage(array("TYPE" => "ERROR", "MESSAGE" => GetMessage("MOBILEAPP_WRONG_BROWSER"), "DETAILS" => GetMessage("MOBILEAPP_WRONG_BROWSER_DETAIL"), "HTML" => true));
    require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/epilog_admin.php";
    return;
}
CUtil::InitJSCore(array('ajax', 'window', "popup", "mdesigner"));
$action = $_REQUEST["action"];
$templates = $_REQUEST["action"];
function __DSGetInitData()
{
    $map = new \Bitrix\MobileApp\Designer\ConfigMap();
    $params = $map->getParamsByGroups();
    $groups = array_keys($params);
    $tmpLangs = array_change_key_case($map->getLangMessages(), CASE_LOWER);
    $langs = array();
    foreach ($tmpLangs as $k => $v) {
Esempio n. 4
0
:</span><input class="login-inp" type="password" name="CONFIRM_PASSWORD" maxlength="50" value="<?php 
    echo $arResult["CONFIRM_PASSWORD"];
    ?>
" size="12"/>
			</div>

			<div class="login-item">
				<span class="login-item-alignment"></span><span class="login-label"><?php 
    echo GetMessage("CT_MAIN_REG_INIT_PERSONAL_PHOTO_TITLE");
    ?>
:&nbsp;</span><span
					class="login-file-block">
						<span class="login-file-btn-wrap">
							<input type="file" name="PERSONAL_PHOTO" id="PERSONAL_PHOTO" size="10" class="login-file-inp" onchange="
							<?php 
    $browser = IsIE();
    if ($browser && $browser < 10) {
        ?>
								BX('PERSONAL_PHOTO_NAME').innerHTML = this.value;
							<?php 
    } else {
        ?>
								files = this.files;
								len = files.length;
								for (var i=0; i < len; i++)
									BX('PERSONAL_PHOTO_NAME').innerHTML = files[i].name;
							<?php 
    }
    ?>
							">
							<span class="login-file-btn" id="PERSONAL_PHOTO_NAME"><?php 
Esempio n. 5
0
 /**
  * Optimize css and js files
  *
  * @param array $arFile - Full path for a source css or js file
  * @param array $arSrcFile - Full path for a source css or js file with timestamp
  * @param string $site_template - Site template name
  * @param bool $unique - Create unique file for all site in a current template
  * @param string $sufix - Some sufix for css or js files
  * @param string $type - file type, css or js
  * @param bool $bXhtmlStyle - Xhtml or not
  * @return string - String for including css or js in html page
  */
 private function __OptimizeCssJs($arFile = array(), $arSrcFile = array(), $site_template, $unique = false, $sufix = 'default', $type = 'css', $bXhtmlStyle = true)
 {
     if (!is_array($arFile) || count($arFile) < 1 || (!is_array($arSrcFile) || count($arSrcFile) < 1)) {
         return '';
     }
     $res = '';
     $fileMTime = '';
     $upOptim = 'NO';
     $isIE = IsIE();
     $writeResult = true;
     $unsetKey = array();
     $arFilesInfo = array();
     $arFilesInfo['CUR_SEL_CNT'] = 0;
     $arFilesInfo['CUR_IE_CNT'] = 0;
     $arFilesInfo['FILES'] = array();
     $noCheckOnly = !defined('BX_HEADFILES_CACHE_CHECK_ONLY');
     $sufix = trim($sufix);
     $sufix = strlen($sufix) < 1 ? 'default' : $sufix;
     foreach ($arSrcFile as $key => $filePath) {
         if (strpos($filePath, '?') === false) {
             $arSrcFile[$key] = CUtil::GetAdditionalFileURL($filePath);
         }
     }
     if (!$unique) {
         $fileMTime = '_' . md5(implode('_', $arSrcFile));
         $sufix .= '_' . md5(implode('_', $arFile));
     }
     $type = $type == 'js' ? 'js' : 'css';
     $optimPath = BX_PERSONAL_ROOT . '/cache/' . $type . '/' . SITE_ID . '/' . $site_template . '/' . $sufix . '/';
     $infoFile = BX_PERSONAL_ROOT . '/managed_cache/' . $GLOBALS['DB']->type . '/' . $type . '/' . SITE_ID . '/' . $site_template . '/' . $sufix . '/info.php';
     if ($type == 'css') {
         $maxAddCssSelect = 3950;
         $maxCssSelect = 4000;
         $optimFName = $optimPath . $sufix . $fileMTime . '.css';
         $cssFNameIE = $optimPath . $sufix . $fileMTime . '#CNT#.css';
     } else {
         $optimFName = $optimPath . $sufix . $fileMTime . '.js';
     }
     $optimFileExist = file_exists($_SERVER["DOCUMENT_ROOT"] . $optimFName);
     if ($unique && $optimFileExist) {
         if (file_exists($_SERVER['DOCUMENT_ROOT'] . $infoFile)) {
             include $_SERVER['DOCUMENT_ROOT'] . $infoFile;
             if (is_array($arFilesInfo['FILES'])) {
                 foreach ($arFile as $key => $fp) {
                     $fp = $_SERVER['DOCUMENT_ROOT'] . $fp;
                     if (isset($arFilesInfo['FILES'][$fp])) {
                         if ($_SERVER['DOCUMENT_ROOT'] . $arSrcFile[$key] != $fp . '?' . $arFilesInfo['FILES'][$fp]) {
                             $upOptim = 'NEW';
                             break;
                         } else {
                             $unsetKey[] = $key;
                         }
                     } else {
                         $upOptim = 'UP';
                     }
                 }
             } else {
                 $upOptim = 'NEW';
             }
         } else {
             $upOptim = 'NEW';
         }
     }
     if (!$optimFileExist || $upOptim == 'NEW') {
         $upOptim = 'NEW';
         $arFilesInfo = array();
         $arFilesInfo['CUR_SEL_CNT'] = 0;
         $arFilesInfo['CUR_IE_CNT'] = 0;
         $arFilesInfo['FILES'] = array();
         $writeResult = false;
         if ($unique) {
             DeleteDirFilesEx($optimPath);
         }
     }
     $contents = '';
     $arIEContent = array();
     if ($upOptim != 'NO') {
         if ($upOptim == 'UP' && $optimFileExist) {
             foreach ($unsetKey as $key) {
                 unset($arFile[$key]);
             }
             if ($noCheckOnly) {
                 $contents .= "\n\n" . file_get_contents($_SERVER["DOCUMENT_ROOT"] . $optimFName);
                 if ($type == 'css') {
                     if ($arFilesInfo['CUR_SEL_CNT'] < $maxAddCssSelect) {
                         $css = str_replace('#CNT#', $arFilesInfo['CUR_IE_CNT'], $cssFNameIE);
                         if (file_exists($_SERVER["DOCUMENT_ROOT"] . $css)) {
                             $arIEContent[$arFilesInfo['CUR_IE_CNT']] .= file_get_contents($_SERVER["DOCUMENT_ROOT"] . $css);
                             $arFilesInfo['CUR_SEL_CNT'] = self::__GetCssSelectCnt($arIEContent[$arFilesInfo['CUR_IE_CNT']]);
                         }
                     } elseif ($arFilesInfo['CUR_SEL_CNT'] >= $maxAddCssSelect) {
                         $arFilesInfo['CUR_IE_CNT']++;
                         $arFilesInfo['CUR_SEL_CNT'] = 0;
                     }
                 }
             } else {
                 $writeResult = false;
             }
         }
         if ($noCheckOnly) {
             foreach ($arFile as $key => $filename) {
                 $filename = $_SERVER['DOCUMENT_ROOT'] . $filename;
                 $tmp_content = file_get_contents($filename);
                 if ($tmp_content !== '') {
                     if ($type == 'css') {
                         $f_cnt = self::__GetCssSelectCnt($tmp_content);
                         $new_cnt = $f_cnt + $arFilesInfo['CUR_SEL_CNT'];
                         $tmp_content = self::FixCssIncludes($tmp_content, $arSrcFile[$key]);
                         $tmp_content = "\n/* Start:" . $arFile[$key] . "*/\n" . $tmp_content . "\n/* End */\n";
                         if ($new_cnt < $maxCssSelect) {
                             $arFilesInfo['CUR_SEL_CNT'] = $new_cnt;
                             $arIEContent[$arFilesInfo['CUR_IE_CNT']] .= $tmp_content;
                         } else {
                             $arFilesInfo['CUR_SEL_CNT'] = $f_cnt;
                             $arFilesInfo['CUR_IE_CNT']++;
                             $arIEContent[$arFilesInfo['CUR_IE_CNT']] .= $tmp_content;
                         }
                         $contents .= "\n\n" . $tmp_content;
                     } else {
                         $contents .= "\n; /* Start:" . $arFile[$key] . "*/\n" . $tmp_content . "\n/* End */\n;";
                     }
                 }
                 if ($unique) {
                     $arFilesInfo['FILES'][$filename] = self::__GetCssJsTime($arSrcFile[$key]);
                 }
             }
             if (($writeResult = self::__WriteCssJsCache($optimFName, $contents)) && $unique) {
                 $cacheInfo = '<? $arFilesInfo = array( \'FILES\' => array(';
                 foreach ($arFilesInfo['FILES'] as $key => $time) {
                     $cacheInfo .= "'" . EscapePHPString($key) . "' => '" . intval($time) . "',";
                 }
                 $cacheInfo .= "), 'CUR_SEL_CNT' => '" . $arFilesInfo['CUR_SEL_CNT'] . "', 'CUR_IE_CNT' => '" . $arFilesInfo['CUR_IE_CNT'] . "'); ?>";
                 self::__WriteCssJsCache($infoFile, $cacheInfo, false);
             }
             if ($type == 'css' && $writeResult) {
                 foreach ($arIEContent as $key => $ieContent) {
                     $css = str_replace('#CNT#', $key, $cssFNameIE);
                     self::__WriteCssJsCache($css, $ieContent);
                 }
             }
             unset($contents, $arIEContent);
         }
     }
     if ($type == 'css' && $isIE && $writeResult) {
         for ($i = 0; $i <= $arFilesInfo['CUR_IE_CNT']; $i++) {
             $css = str_replace('#CNT#', $i, $cssFNameIE);
             $res .= '<link href="' . CUtil::GetAdditionalFileURL($css) . '" type="text/css" rel="stylesheet"' . ($bXhtmlStyle ? ' /' : '') . '>' . "\n";
         }
     } else {
         if ($type == 'css') {
             if ($writeResult || !$writeResult && $unique && $upOptim == 'UP') {
                 $res .= '<link href="' . CUtil::GetAdditionalFileURL($optimFName) . '" type="text/css" rel="stylesheet"' . ($bXhtmlStyle ? ' /' : '') . '>' . "\n";
             }
             if (!$writeResult) {
                 if ($isIE) {
                     $cnt = 0;
                     $res_content = '';
                     $ruleCount = 0;
                     $cMaxStylesCnt = COption::GetOptionInt('main', 'max_css_files', 15);
                     foreach ($arFile as $key => $src) {
                         if ($cnt < $cMaxStylesCnt) {
                             $res .= '<link href="' . $arSrcFile[$key] . '" type="text/css" rel="stylesheet"' . ($bXhtmlStyle ? ' /' : '') . '>' . "\n";
                         } elseif (file_exists($_SERVER['DOCUMENT_ROOT'] . $arFile[$key]) && filesize($_SERVER['DOCUMENT_ROOT'] . $arFile[$key]) > 0) {
                             $arTmp = $this->__ShowInlineCssIE($_SERVER['DOCUMENT_ROOT'] . $arFile[$key], $arFile[$key], $ruleCount);
                             $ruleCount = $arTmp['CNT'];
                             $res_content .= $arTmp['CONTENT'];
                         }
                         $cnt++;
                     }
                     if ($res_content != '') {
                         $res .= '<style type="text/css">' . "\n" . $res_content . "\n</style>\n";
                     }
                 } else {
                     foreach ($arFile as $key => $src) {
                         $res .= '<link href="' . $arSrcFile[$key] . '" type="text/css" rel="stylesheet"' . ($bXhtmlStyle ? ' /' : '') . '>' . "\n";
                     }
                 }
             }
         } else {
             if ($writeResult || !$writeResult && $unique && $upOptim == 'UP') {
                 $res .= '<script type="text/javascript" src="' . CUtil::GetAdditionalFileURL($optimFName) . '"></script>' . "\n";
             }
             if (!$writeResult) {
                 foreach ($arFile as $key => $src) {
                     $res .= '<script type="text/javascript" src="' . $arSrcFile[$key] . '"></script>' . "\n";
                 }
             }
             if ($unique && $sufix == 'kernel') {
                 $arF = array_keys($arFilesInfo['FILES']);
                 foreach ($arF as $key => $item) {
                     $arF[$key] = str_replace($_SERVER['DOCUMENT_ROOT'], '', $item);
                 }
                 $res .= '<script type="text/javascript">' . " BX.setKernelJS(['" . implode("','", $arF) . "']); </script>";
             }
         }
     }
     if ($unique && $sufix == 'kernel' && $type == 'css') {
         $arF = array_keys($arFilesInfo['FILES']);
         foreach ($arF as $key => $item) {
             $arF[$key] = str_replace($_SERVER['DOCUMENT_ROOT'], '', $item);
         }
         $res .= '<script type="text/javascript">' . " var arKernelCSS = new Array('" . implode("','", $arF) . "'); </script>";
     }
     unset($arFile, $arSrcFile);
     return $res;
 }
Esempio n. 6
0
 /**
  * Optimize css and js files
  *
  * @param array $arFile - Full path for a source css or js file
  * @param array $arSrcFile - Full path for a source css or js file with timestamp
  * @param string $site_template - Site template name
  * @param bool $unique - Create unique file for all site in a current template
  * @param string $sufix - Some sufix for css or js files
  * @param string $type - file type, css or js
  * @param bool $bXhtmlStyle - Xhtml or not
  * @return string - String for including css or js in html page
  */
 private function __OptimizeCssJs($arFile = array(), $arSrcFile = array(), $site_template, $unique = false, $sufix = 'default', $type = 'css', $bXhtmlStyle)
 {
     if (!is_array($arFile) || count($arFile) < 1) {
         return '';
     }
     if (!is_array($arSrcFile) || count($arSrcFile) < 1) {
         return '';
     }
     $res = '';
     $fileMTime = '';
     $upOptim = 'NO';
     $unsetKey = array();
     $arFilesInfo = array();
     $arFilesInfo['CUR_SEL_CNT'] = 0;
     $arFilesInfo['CUR_IE_CNT'] = 0;
     $sufix = trim($sufix);
     $sufix = strlen($sufix) < 1 ? 'default' : $sufix;
     foreach ($arSrcFile as $key => $filePath) {
         if (!$bExternalLink && strpos($filePath, '?') === false) {
             $filePath = CUtil::GetAdditionalFileURL($filePath);
             $arSrcFile[$key] = $filePath;
         }
     }
     if (!$unique) {
         $fileMTime = '_' . md5(implode('_', $arSrcFile));
         $sufix .= '_' . md5(implode('_', $arFile));
     }
     $type = $type == 'js' ? 'js' : 'css';
     $optimPath = BX_PERSONAL_ROOT . '/cache/' . $type . '/' . SITE_ID . '/' . $site_template . '/' . $sufix . '/';
     $infoFile = BX_PERSONAL_ROOT . '/managed_cache/' . $GLOBALS['DB']->type . '/' . $type . '/' . SITE_ID . '/' . $site_template . '/' . $sufix . '/info.php';
     if ($type == 'css') {
         $maxAddCssSelect = 3950;
         $maxCssSelect = 4000;
         $optimFName = $optimPath . 'styles' . $fileMTime . '.css';
         $cssFNameIE = $optimPath . 'styles' . $fileMTime . '#CNT#.css';
     } else {
         $optimFName = $optimPath . $sufix . $fileMTime . '.js';
     }
     if ($unique && file_exists($_SERVER["DOCUMENT_ROOT"] . $optimFName)) {
         if (file_exists($_SERVER['DOCUMENT_ROOT'] . $infoFile)) {
             include $_SERVER['DOCUMENT_ROOT'] . $infoFile;
             foreach ($arFile as $key => $fp) {
                 $fp = $_SERVER['DOCUMENT_ROOT'] . $fp;
                 if (array_key_exists($fp, $arFilesInfo['FILES'])) {
                     if ($_SERVER['DOCUMENT_ROOT'] . $arSrcFile[$key] != $fp . '?' . $arFilesInfo['FILES'][$fp]) {
                         $upOptim = 'NEW';
                         break;
                     } else {
                         $unsetKey[] = $key;
                     }
                 } else {
                     $upOptim = 'UP';
                 }
             }
         } else {
             $upOptim = 'NEW';
         }
     }
     if (!file_exists($_SERVER["DOCUMENT_ROOT"] . $optimFName) || $upOptim == 'NEW') {
         $upOptim = 'NEW';
         $arFilesInfo = array();
         $arFilesInfo['CUR_SEL_CNT'] = 0;
         $arFilesInfo['CUR_IE_CNT'] = 0;
         if ($unique) {
             DeleteDirFilesEx($optimPath);
         }
     }
     if ($upOptim != 'NO') {
         $contents = '';
         $arIEContent = array();
         if ($upOptim == 'UP' && file_exists($_SERVER["DOCUMENT_ROOT"] . $optimFName)) {
             foreach ($unsetKey as $key) {
                 unset($arFile[$key], $arSrcFile[$key]);
             }
             $contents .= "\n\n" . file_get_contents($_SERVER["DOCUMENT_ROOT"] . $optimFName);
             if ($type == 'css') {
                 if ($arFilesInfo['CUR_SEL_CNT'] < $maxAddCssSelect) {
                     $css = str_replace('#CNT#', $arFilesInfo['CUR_IE_CNT'], $cssFNameIE);
                     if (file_exists($_SERVER["DOCUMENT_ROOT"] . $css)) {
                         $arIEContent[$arFilesInfo['CUR_IE_CNT']] .= file_get_contents($_SERVER["DOCUMENT_ROOT"] . $css);
                         $arFilesInfo['CUR_SEL_CNT'] = CMain::__GetCssSelectCnt($arIEContent[$arFilesInfo['CUR_IE_CNT']]);
                     }
                 } elseif ($arFilesInfo['CUR_SEL_CNT'] >= $maxAddCssSelect) {
                     $arFilesInfo['CUR_IE_CNT']++;
                     $arFilesInfo['CUR_SEL_CNT'] = 0;
                 }
             }
         }
         foreach ($arFile as $key => $filename) {
             $filename = $_SERVER['DOCUMENT_ROOT'] . $filename;
             $tmp_content = file_get_contents($filename);
             if ($type == 'css') {
                 $f_cnt = CMain::__GetCssSelectCnt($tmp_content);
                 $new_cnt = $f_cnt + $arFilesInfo['CUR_SEL_CNT'];
                 $tmp_content = "\n" . preg_replace('#([;\\s:]+url\\s*\\(\\s*)([^\\)]+)\\)#sie', "'\\1'.CMain::__ReplaceUrlCSS('\\2', '" . AddSlashes($arSrcFile[$key]) . "').')'", $tmp_content) . "\n";
                 if ($new_cnt < $maxCssSelect) {
                     $arFilesInfo['CUR_SEL_CNT'] = $new_cnt;
                     $arIEContent[$arFilesInfo['CUR_IE_CNT']] .= $tmp_content;
                 } else {
                     $arFilesInfo['CUR_SEL_CNT'] = $f_cnt;
                     $arFilesInfo['CUR_IE_CNT']++;
                     $arIEContent[$arFilesInfo['CUR_IE_CNT']] .= $tmp_content;
                 }
                 $contents .= "\n\n" . $tmp_content;
             } else {
                 $contents .= "\n;\n" . $tmp_content;
             }
             if ($unique) {
                 $arFilesInfo['FILES'][$filename] = CMain::__GetCssJsTime($arSrcFile[$key]);
             }
         }
         if (CMain::__WriteCssCache($optimFName, $contents) && $unique) {
             $cacheInfo = '<? $arFilesInfo = array( \'FILES\' => array(';
             foreach ($arFilesInfo['FILES'] as $key => $time) {
                 $cacheInfo .= "'" . EscapePHPString($key) . "' => '" . intval($time) . "',";
             }
             $cacheInfo .= "), 'CUR_SEL_CNT' => '" . $arFilesInfo['CUR_SEL_CNT'] . "', 'CUR_IE_CNT' => '" . $arFilesInfo['CUR_IE_CNT'] . "'); ?>";
             CMain::__WriteCssCache($infoFile, $cacheInfo, false);
         }
         foreach ($arIEContent as $key => $ieContent) {
             $css = str_replace('#CNT#', $key, $cssFNameIE);
             CMain::__WriteCssCache($css, $ieContent);
         }
     }
     if (IsIE() && $type == 'css') {
         for ($i = 0; $i <= $arFilesInfo['CUR_IE_CNT']; $i++) {
             $css = str_replace('#CNT#', $i, $cssFNameIE);
             $res .= '<link href="' . CUtil::GetAdditionalFileURL($css) . '" type="text/css" rel="stylesheet"' . ($bXhtmlStyle ? ' /' : '') . '>' . "\n";
         }
     } else {
         if ($type == 'css') {
             $res .= '<link href="' . CUtil::GetAdditionalFileURL($optimFName) . '" type="text/css" rel="stylesheet"' . ($bXhtmlStyle ? ' /' : '') . '>' . "\n";
             if ($unique && $sufix == 'kernel') {
                 $arF = array_keys($arFilesInfo['FILES']);
                 foreach ($arF as $key => $item) {
                     $arF[$key] = str_replace($_SERVER['DOCUMENT_ROOT'], '', $item);
                 }
                 $res .= '<script type="text/javascript">' . " var arKernelCSS = new Array('" . implode("','", $arF) . "'); </script>";
             }
         } else {
             $res .= '<script type="text/javascript" src="' . CUtil::GetAdditionalFileURL($optimFName) . '"></script>' . "\n";
             if ($unique && $sufix == 'kernel') {
                 $arF = array_keys($arFilesInfo['FILES']);
                 foreach ($arF as $key => $item) {
                     $arF[$key] = str_replace($_SERVER['DOCUMENT_ROOT'], '', $item);
                 }
                 $res .= '<script type="text/javascript">' . " BX.setKernelJS(['" . implode("','", $arF) . "']); </script>";
             }
         }
     }
     return $res;
 }
                $arFiles[] = $arFile;
            }
        }
    }
    if ($strError) {
        $DB->InitTableVarsForEdit("b_ticket_message", "", "str_");
    }
    $str_OWNER_USER_ID = intval($str_OWNER_USER_ID) > 0 ? intval($str_OWNER_USER_ID) : "";
    $sDocTitle = GetMessage("SUP_EDIT_RECORD", array("#ID#" => $ID, "#TID#" => $TICKET_ID));
    $APPLICATION->SetTitle($sDocTitle);
}
if ($ADD_PUBLIC_CHAIN == "Y" || !isset($ADD_PUBLIC_CHAIN)) {
    $APPLICATION->AddChainItem(GetMessage("SUP_TICKETS_LIST"), $TICKET_LIST_URL);
    $APPLICATION->AddChainItem(str_replace("#TID#", $TICKET_ID, GetMessage("SUP_TICKET_EDIT")), $TICKET_EDIT_URL . "?ID=" . $TICKET_ID);
}
$is_ie = IsIE();
$is_ie = true;
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
?>

<?php 
$aMenu = array();
$aMenu[] = array("TEXT" => str_replace("#TID#", $TICKET_ID, GetMessage("SUP_TICKET_EDIT")), "LINK" => "/bitrix/admin/ticket_edit.php?lang=" . LANGUAGE_ID . "&ID=" . $TICKET_ID);
if (intval($arTicket["MESSAGES"]) > 1) {
    $aMenu[] = array("SEPARATOR" => "Y");
    $aMenu[] = array("TEXT" => GetMessage("SUP_DELETE_MESSAGE"), "LINK" => "javascript:if(confirm('" . GetMessage("SUP_DELETE_MESSAGE_CONFIRM") . "')) window.location='/bitrix/admin/ticket_edit.php?ID=" . $TICKET_ID . "&mdel_id=" . $ID . "&lang=" . LANGUAGE_ID . "&" . bitrix_sessid_get() . "&set_default=Y';", "WARNING" => "Y");
}
//echo ShowSubMenu($aMenu);
$context = new CAdminContextMenu($aMenu);
$context->Show();
//echo ShowError($strError);
Esempio n. 8
0
         $title = $arrCol["TITLE_TYPE"] == "html" ? strip_tags($arrCol["TITLE"]) : htmlspecialcharsbx($arrCol["TITLE"]);
         $title = TruncateText($title, 100);
     } else {
         $title = htmlspecialcharsbx($arrCol["RESULTS_TABLE_TITLE"]);
     }
     $arResult["arrColumns"][$key]["RESULTS_TABLE_TITLE"] = $title;
 }
 $arResult["filter_id"] = rand(0, 10000);
 $arResult["tf_name"] = COption::GetOptionString("main", "cookie_name", "BITRIX_SM") . "_FORM_RESULT_FILTER";
 if (strlen($arResult["tf"]) <= 0) {
     $arResult["tf"] = $_REQUEST[$arResult["tf_name"]];
 }
 if (strlen($arResult["tf"]) <= 0) {
     $arResult["tf"] = "none";
 }
 $arResult["is_ie"] = IsIE();
 $arResult["__find"] = array();
 foreach ($GLOBALS as $key => $value) {
     if (substr($key, 0, 5) == "find_") {
         $arResult["__find"][$key] = $value;
     }
 }
 reset($arResult["arrFORM_FILTER"]);
 foreach ($arResult["arrFORM_FILTER"] as $f_sid => $arrF) {
     foreach ($arrF as $key => $arr) {
         if (strlen($arrF["FILTER_TITLE"]) <= 0) {
             $title = $arrF["TITLE_TYPE"] == "html" ? strip_tags($arrF["TITLE"]) : htmlspecialcharsbx($arrF["TITLE"]);
             $arrResult["arrFORM_FILTER"][$f_sid][$key]["FILTER_TITLE"] = TruncateText($title, 100);
         } else {
             $arrResult["arrFORM_FILTER"][$f_sid][$key]["FILTER_TITLE"] = htmlspecialcharsbx($arrF["FILTER_TITLE"]);
         }
Esempio n. 9
0
	function __OptimizeCss($cssFile, $cssSrcFile, $site_template, $addTemplateStyle, $arTemplateCss, $bXhtmlStyle)
	{
		$cssOptPath = BX_PERSONAL_ROOT."/cache/css/".SITE_ID.'/'.$site_template.'/';
		$cssFName = $cssOptPath.'styles.css';
		$cssFNameIE = $cssOptPath.'styles#CNT#.css';
		$cssTemplateFName = $cssOptPath.'template_styles.css';
		$cssInfoFile = BX_PERSONAL_ROOT."/managed_cache/".$GLOBALS['DB']->type.'/css/'.SITE_ID.'/'.$site_template.'_styles.php';

		$res = '';
		$upCSS = 'NO';
		$unsetKey = array();
		$arCSSInfo = array();
		$arCSSInfo['CUR_SEL_CNT'] = 0;
		$arCSSInfo['CUR_IE_CNT'] = 0;
		$arCSSInfo['CSS_MD5'] = 0;
		$maxAddCssSelect = 3950;
		$maxCssSelect = 4000;

		if($addTemplateStyle)
		{
			foreach($arTemplateCss as $css_path)
			{
				if(!$bExternalLink && strpos($css_path, '?') === false)
					$css_path = CUtil::GetAdditionalFileURL($css_path);
				$cssMD5 .= $css_path;
			}
			$cssMD5 = md5($cssMD5);
		}

		if(file_exists($_SERVER['DOCUMENT_ROOT'].$cssInfoFile))
		{
			include($_SERVER['DOCUMENT_ROOT'].$cssInfoFile);
			$oldCssMD5 = $arCSSInfo['CSS_MD5'];
			foreach($cssFile as $key => $css)
			{
				if(array_key_exists($css, $arCSSInfo['CSS']))
				{
					if($cssSrcFile[$key] != $css.'?'.$arCSSInfo['CSS'][$css])
					{
						$upCSS = 'NEW';
						break;
					}
					else
					{
						$unsetKey[] = $key;
					}
				}
				else
				{
					$upCSS = 'UP';
				}
			}
		}
		else
		{
			$upCSS = 'NEW';
		}

		if(!file_exists($_SERVER["DOCUMENT_ROOT"].$cssFName) || $upCSS == 'NEW')
		{
			$upCSS = 'NEW';
			$arCSSInfo = array();
			$arCSSInfo['CUR_SEL_CNT'] = 0;
			$arCSSInfo['CUR_IE_CNT'] = 0;
			$arCSSInfo['CSS_MD5'] = 0;
			DeleteDirFilesEx($cssOptPath);
		}

		if($upCSS != 'NO')
		{
			$contents = '';
			$arIEContent = array();

			if($upCSS == 'UP' && file_exists($_SERVER["DOCUMENT_ROOT"].$cssFName))
			{
				foreach($unsetKey as $key)
					unset($cssFile[$key], $cssSrcFile[$key]);

				$contents .= file_get_contents($_SERVER["DOCUMENT_ROOT"].$cssFName);

				if($arCSSInfo['CUR_SEL_CNT'] < $maxAddCssSelect)
				{
					$css = str_replace('#CNT#', $arCSSInfo['CUR_IE_CNT'], $cssFNameIE);
					if(file_exists($_SERVER["DOCUMENT_ROOT"].$css))
					{
						$arIEContent[$arCSSInfo['CUR_IE_CNT']] .= file_get_contents($_SERVER["DOCUMENT_ROOT"].$css);
						$arCSSInfo['CUR_SEL_CNT'] = CMain::__GetCssSelectCnt($arIEContent[$arCSSInfo['CUR_IE_CNT']]);
					}
				}
				elseif($arCSSInfo['CUR_SEL_CNT'] >= $maxAddCssSelect)
				{
					$arCSSInfo['CUR_IE_CNT']++;
					$arCSSInfo['CUR_SEL_CNT'] = 0;
				}
			}

			foreach($cssFile as $key => $filename)
			{
				$filename = $_SERVER['DOCUMENT_ROOT'].$filename;
				$tmp_content = file_get_contents($filename);

				$f_cnt = CMain::__GetCssSelectCnt($tmp_content);
				$new_cnt = $f_cnt + $arCSSInfo['CUR_SEL_CNT'];
				$contents .= $tmp_content = "\n".preg_replace('#([;\s:]+url\s*\(\s*)([^\)]+)\)#sie', "'\\1'.CMain::__ReplaceUrlCSS('\\2', '".AddSlashes($cssSrcFile[$key])."').')'", $tmp_content)."\n";
				if($new_cnt < $maxCssSelect)
				{
					$arCSSInfo['CUR_SEL_CNT'] = $new_cnt;
					$arIEContent[$arCSSInfo['CUR_IE_CNT']] .= $tmp_content;
				}
				else
				{
					$arCSSInfo['CUR_SEL_CNT'] = $f_cnt;
					$arCSSInfo['CUR_IE_CNT']++;
					$arIEContent[$arCSSInfo['CUR_IE_CNT']] .= $tmp_content;
				}

				$arCSSInfo['CSS'][$cssFile[$key]] = CMain::__GetCssJsTime($cssSrcFile[$key]);
			}

			if(CMain::__WriteCssCache($cssFName, $contents))
			{
				$cacheInfo = '<? $arCSSInfo = array( \'CSS\' => array(';

				foreach($arCSSInfo['CSS'] as $css => $time)
					$cacheInfo .= "'".EscapePHPString($css)."' => '".intval($time)."',";

				$cacheInfo .= "), 'CUR_SEL_CNT' => '".$arCSSInfo['CUR_SEL_CNT']."', 'CUR_IE_CNT' => '".$arCSSInfo['CUR_IE_CNT']."', ";
				$cacheInfo .= "'CSS_MD5' => '".$cssMD5."'); ?>";

				CMain::__WriteCssCache($cssInfoFile, $cacheInfo, false);
			}

			foreach($arIEContent as $key => $ieContent)
			{
				$css = str_replace('#CNT#', $key, $cssFNameIE);
				CMain::__WriteCssCache($css, $ieContent);
			}
		}

		if(IsIE())
		{
			for($i = 0; $i <= $arCSSInfo['CUR_IE_CNT']; $i++)
			{
				$css = str_replace('#CNT#', $i, $cssFNameIE);
				$res .= '<link href="'.CUtil::GetAdditionalFileURL($css).'" type="text/css" rel="stylesheet"'.($bXhtmlStyle? ' /':'').'>'."\n";
			}
		}
		else
		{
			$res .= '<link href="'.CUtil::GetAdditionalFileURL($cssFName).'" type="text/css" rel="stylesheet"'.($bXhtmlStyle? ' /':'').'>'."\n";
		}

		if($addTemplateStyle)
		{
			if($cssMD5 != $oldCssMD5 || !file_exists($_SERVER['DOCUMENT_ROOT'].$cssTemplateFName))
			{
				$contents = '';
				foreach($arTemplateCss as $css)
				{
					if(file_exists($_SERVER["DOCUMENT_ROOT"].$css))
					{
						$tmp_content = file_get_contents($_SERVER["DOCUMENT_ROOT"].$css);
						$contents .= preg_replace('#([;\s:]+url\s*\(\s*)([^\)]+)\)#sie', "'\\1'.CMain::__ReplaceUrlCSS('\\2', '".AddSlashes($css)."').')'", $tmp_content);
					}
				}
				CMain::__WriteCssCache($cssTemplateFName, $contents);
			}
			$res .= '<link href="'.$cssTemplateFName.'?'.$cssMD5.'" type="text/css" rel="stylesheet"'.($bXhtmlStyle? ' /':'').'>'."\n";
		}
		unset($content, $arIEContent, $arCSSInfo, $cacheInfo);
		return $res;
	}
Esempio n. 10
0
<?php

if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
    die;
}
?>

<div class="post-dialog-wrap<?php 
if (IsIE() == 8) {
    ?>
 bx-ie bx-ie8<?php 
}
?>
">

<?php 
if ($arResult['STEP'] == 'choose') {
    ?>

<table class="post-dialog-title">
	<tr>
		<td class="post-dialog-title-text align-center">
			<?php 
    echo GetMessage('INTR_MAIL_CHOOSE');
    ?>
		</td>
		<td class="post-dialog-title-img"></td>
	</tr>
</table>
<?php 
    $k = 0;