Exemplo n.º 1
0
 /**
  * Gets useAppCache property.
  *
  * @return boolean
  */
 public static function getUseAppCache()
 {
     $appCache = AppCacheManifest::getInstance();
     return $appCache->isEnabled();
 }
Exemplo n.º 2
0
 /**
  * OnEndBufferContent handler
  * @param $content
  */
 public static function onEndBufferContent(&$content)
 {
     global $APPLICATION;
     if (self::getUseAppCache() == true) {
         //Do we use html5 application cache?
         \Bitrix\Main\Data\AppCacheManifest::onEndBufferContent($content);
     } else {
         \Bitrix\Main\Data\AppCacheManifest::checkObsoleteManifest();
     }
     //it checks if the manifest is still alive.
     $selfObject = self::getInstance();
     $ids = $selfObject->getDynamicIDs();
     if (count($ids) > 0) {
         $match = array();
         $regexp = "/##start_frame_cache_(" . implode("|", $ids) . ")##(.+?)##end_frame_cache_(?:" . implode("|", $ids) . ")##/is";
         preg_match_all($regexp, $content, $match);
         /*
         	Notes:
         	$match[0] -	array of dynamic blocks with macros'
         	$match[1] - ids of the dynamic blocks
         	$match[2] - array of dynamic blocks
         */
         $count = count($match[1]);
         if (self::$isBackgroundRequest) {
             //$fcache->arDynamicData = array_combine($match[1], $match[2]);
             for ($i = 0; $i < $count; $i++) {
                 $selfObject->arDynamicData[] = array("ID" => $match[1][$i], "CONTENT" => $match[2][$i], "HASH" => md5($match[2][$i]));
             }
         } else {
             $replacedArray = array();
             for ($i = 0; $i < $count; $i++) {
                 $replacedArray[] = '<div id="bxdynamic_' . $match[1][$i] . '"></div>';
             }
             $content = str_replace($match[0], $replacedArray, $content);
         }
     }
     if (self::$isBackgroundRequest) {
         header("Content-Type: application/x-javascript");
         $content = array("isManifestUpdated" => \Bitrix\Main\Data\AppCacheManifest::getInstance()->getIsModified(), "dynamicBlocks" => $selfObject->arDynamicData);
         if (!Application::getInstance()->isUtfMode()) {
             //TODO I use it because there is no similar method in the new Bitrix Framework yet
             $content = $APPLICATION->convertCharsetArray($content, SITE_CHARSET, "UTF-8");
         }
         $content = json_encode($content);
     }
 }
Exemplo n.º 3
0
 public static function checkObsoleteManifest()
 {
     $server = \Bitrix\Main\Context::getCurrent()->getServer();
     $appCacheUrl = $server->get("HTTP_BX_APPCACHE_URL");
     $appCacheParams = $server->get("HTTP_BX_APPCACHE_PARAMS");
     if ($appCacheUrl) {
         $params = json_decode($appCacheParams, true);
         if (!is_array($params)) {
             $params = array();
         }
         \Bitrix\Main\Data\AppCacheManifest::clear($appCacheUrl, $params);
     }
 }
Exemplo n.º 4
0
<?php

require $_SERVER["DOCUMENT_ROOT"] . "/mobile/headers.php";
define('MOBILE_TEMPLATE_CSS', "/im_styles.css");
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php";
\Bitrix\Main\Data\AppCacheManifest::getInstance()->addAdditionalParam("api_version", CMobile::getApiVersion());
\Bitrix\Main\Data\AppCacheManifest::getInstance()->addAdditionalParam("platform", CMobile::getPlatform());
\Bitrix\Main\Data\AppCacheManifest::getInstance()->addAdditionalParam("im-dialog", 'v3');
\Bitrix\Main\Data\AppCacheManifest::getInstance()->addAdditionalParam("version", "v5");
\Bitrix\Main\Data\AppCacheManifest::getInstance()->addAdditionalParam("user", $USER->GetId());
$APPLICATION->IncludeComponent("bitrix:mobile.im.dialog", ".default", array(), false, array("HIDE_ICONS" => "Y"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/footer.php";
Exemplo n.º 5
0
        $dbGroups = CSocNetUserToGroup::GetList(array("GROUP_NAME" => "ASC"), $arGroupFilterMy, false, false, array('ID', 'GROUP_ID', 'GROUP_NAME', 'GROUP_SITE_ID'));
        while ($arGroups = $dbGroups->GetNext()) {
            $arGroupIDCurrentSite[] = $arGroups['GROUP_ID'];
            if (in_array($arGroups['GROUP_ID'], $extGroupID)) {
                continue;
            }
            $arSGGroup[] = array($arGroups["GROUP_NAME"], str_replace("#group_id#", $arGroups["GROUP_ID"], $strGroupSubjectLinkTemplate), array(), array("counter_id" => "SG" . $arGroups["GROUP_ID"]), "");
        }
        foreach ($arExtSGGroupTmp as $groupID => $arGroupItem) {
            if (in_array($groupID, $arGroupIDCurrentSite)) {
                $arExtSGGroup[] = $arGroupItem;
            }
        }
    }
    $CACHE_MANAGER->RegisterTag('sonet_group');
    $CACHE_MANAGER->RegisterTag('USER_CARD_' . intval($USER_ID / TAGGED_user_card_size));
    $CACHE_MANAGER->RegisterTag('sonet_user2group_U' . $USER_ID);
    $CACHE_MANAGER->EndTagCache();
    $arResult["GROUP_MENU"] = $arSGGroup;
    $arResult["EXTRANET_MENU"] = $arExtSGGroup;
    if ($obCache->StartDataCache()) {
        $obCache->EndDataCache($arResult);
        unset($arSGGroup, $arExtSGGroup);
    }
}
if ($arResult["USER"]["AVATAR"]) {
    $file = CHTTP::urnEncode($arResult["USER"]["AVATAR"]["src"], "UTF-8");
    \Bitrix\Main\Data\AppCacheManifest::getInstance()->addFile($file);
}
unset($obCache);
$this->IncludeComponentTemplate();
Exemplo n.º 6
0
 public static function onEndBufferContent(&$content)
 {
     AppCacheManifest::getInstance()->generate($content);
 }
Exemplo n.º 7
0
<?php

// define('BX_SECURITY_SHOW_MESSAGE', 1);
// define("NO_KEEP_STATISTIC", true);
// define("NOT_CHECK_FILE_PERMISSIONS", true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
/**
 * @var CMain $APPLICATION
 */
if ($_REQUEST["manifest_id"]) {
    $appCache = \Bitrix\Main\Data\AppCacheManifest::getInstance();
    $data = $appCache->readManifestCache($_REQUEST["manifest_id"]);
    if ($data && $data["TEXT"]) {
        $APPLICATION->RestartBuffer();
        header('Content-Type: text/cache-manifest');
        echo $data["TEXT"];
        die;
    }
}
header("HTTP/1.0 404 Not Found");
die;
Exemplo n.º 8
0
 /**
  *
  * @param string &$content
  * @return void
  *
  */
 public function OnEndBufferContent(&$content)
 {
     if (isset($_GET["nocdn"])) {
         return;
     }
     $appCache = \Bitrix\Main\Data\AppCacheManifest::getInstance();
     if ($appCache->isEnabled()) {
         return;
     }
     self::$proto = CMain::IsHTTPS() ? "https" : "http";
     self::$config = CBitrixCloudCDNConfig::getInstance()->loadFromOptions();
     if (self::$config->isExpired()) {
         if (!self::updateConfig()) {
             return;
         }
     }
     if (!self::$config->isActive()) {
         return;
     }
     $sites = self::$config->getSites();
     $siteId = defined("ADMIN_SECTION") ? "admin" : (defined("SITE_ID") ? SITE_ID : "");
     if (!isset($sites[$siteId])) {
         return;
     }
     self::$ajax = preg_match("/<head>/i", substr($content, 0, 1024)) === 0;
     $arPrefixes = array_map(array("CBitrixCloudCDN", "_preg_quote"), self::$config->getLocationsPrefixes(self::$config->isKernelRewriteEnabled(), self::$config->isContentRewriteEnabled()));
     $arExtensions = array_map(array("CBitrixCloudCDN", "_preg_quote"), self::$config->getLocationsExtensions());
     if (!empty($arPrefixes) && !empty($arExtensions)) {
         $prefix_regex = "(?:" . implode("|", $arPrefixes) . ")";
         $extension_regex = "(?i:" . implode("|", $arExtensions) . ")";
         $regex = "/\n\t\t\t\t((?i:\n\t\t\t\t\thref=\n\t\t\t\t\t|src=\n\t\t\t\t\t|BX\\.loadCSS\\(\n\t\t\t\t\t|BX\\.loadScript\\(\n\t\t\t\t\t|BX\\.getCDNPath\\(\n\t\t\t\t\t|jsUtils\\.loadJSFile\\(\n\t\t\t\t\t|background\\s*:\\s*url\\(\n\t\t\t\t\t|image\\s*:\\s*url\\(\n\t\t\t\t\t|'SRC':\n\t\t\t\t))                                                   #attribute\n\t\t\t\t(\"|')                                               #open_quote\n\t\t\t\t(" . $prefix_regex . ")                                  #prefix\n\t\t\t\t([^?'\"]+\\.)                                        #href body\n\t\t\t\t(" . $extension_regex . ")                               #extension\n\t\t\t\t(|\\?\\d+|\\?v=\\d+)                                 #params\n\t\t\t\t(\\2)                                                #close_quote\n\t\t\t/x";
         $content = preg_replace_callback($regex, array("CBitrixCloudCDN", "_filter"), $content);
     }
 }
Exemplo n.º 9
0
<?php

define("BX_MOBILE_LOG", true);
require $_SERVER["DOCUMENT_ROOT"] . "/mobile/headers.php";
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php";
AddEventHandler("blog", "BlogImageSize", "ResizeMobileLogImages", 100, $_SERVER["DOCUMENT_ROOT"] . SITE_TEMPLATE_PATH . "/components/bitrix/socialnetwork.blog.post/mobile/functions.php");
\Bitrix\Main\Data\AppCacheManifest::getInstance()->setExcludeImagePatterns(array("fontawesome", "images/newpost", "images/files", "/crm", "images/im", "images/post", "images/notification", "images/messages", "images/tasks"));
if (IsModuleInstalled("bitrix24")) {
    GetGlobalID();
}
if ($_POST["ACTION"] == "ADD_POST" || $_POST["ACTION"] == "EDIT_POST") {
    function LocalRedirectHandler(&$url)
    {
        $bSuccess = false;
        if (strpos($url, "?") > 0) {
            $arUrlParam = explode("&", substr($url, strpos($url, "?") + 1));
            foreach ($arUrlParam as $url_param) {
                list($key, $val) = explode("=", $url_param, 2);
                if ($key == "new_post_id") {
                    $new_post_id = $val;
                    break;
                }
            }
        }
        if (strpos($url, "success=Y") > 0 && intval($new_post_id) > 0) {
            unset($_SESSION["MFU_UPLOADED_FILES"]);
            unset($_SESSION["MFU_UPLOADED_DOCS"]);
            unset($_SESSION["MFU_UPLOADED_FILES_" . $GLOBALS["USER"]->GetId()]);
            unset($_SESSION["MFU_UPLOADED_DOCS_" . $GLOBALS["USER"]->GetId()]);
            $GLOBALS["APPLICATION"]->RestartBuffer();
            $rsLogSrc = CSocNetLog::GetList(array(), array("EVENT_ID" => array("blog_post", "blog_post_important"), "SOURCE_ID" => $new_post_id), false, false, array("ID"), array("CHECK_RIGHTS" => "Y", "USE_SUBSCRIBE" => "N"));
Exemplo n.º 10
0
 /**
  * OnEndBufferContent handler
  * @param $content
  */
 public static function onEndBufferContent(&$content)
 {
     global $APPLICATION;
     global $USER;
     if (self::getUseAppCache() == true) {
         //Do we use html5 application cache?
         \Bitrix\Main\Data\AppCacheManifest::onEndBufferContent($content);
     } else {
         \Bitrix\Main\Data\AppCacheManifest::checkObsoleteManifest();
     }
     //it checks if the manifest is still alive.
     $selfObject = self::getInstance();
     $ids = $selfObject->getDynamicIDs();
     if (count($ids) > 0) {
         $match = array();
         $regexp = "/##start_frame_cache_(" . implode("|", $ids) . ")##(.+?)##end_frame_cache_(?:" . implode("|", $ids) . ")##/is";
         preg_match_all($regexp, $content, $match);
         /*
         	Notes:
         	$match[0] -	array of dynamic blocks with macros'
         	$match[1] - ids of the dynamic blocks
         	$match[2] - array of dynamic blocks
         */
         $count = count($match[1]);
         if (self::$isBackgroundRequest) {
             //$fcache->arDynamicData = array_combine($match[1], $match[2]);
             for ($i = 0; $i < $count; $i++) {
                 $selfObject->arDynamicData[] = array("ID" => $match[1][$i], "CONTENT" => $match[2][$i], "HASH" => md5($match[2][$i]));
             }
         } else {
             $replacedArray = array();
             for ($i = 0; $i < $count; $i++) {
                 $replacedArray[] = '<div id="bxdynamic_' . $match[1][$i] . '"></div>';
             }
             $content = str_replace($match[0], $replacedArray, $content);
         }
     }
     if (self::$isBackgroundRequest) {
         header("Content-Type: application/x-javascript");
         $autoTimeZone = "N";
         if (is_object($GLOBALS["USER"])) {
             $autoTimeZone = trim($USER->GetParam("AUTO_TIME_ZONE"));
         }
         $content = array("js" => $APPLICATION->arHeadScripts, "additional_js" => $APPLICATION->arAdditionalJS, "lang" => array('LANGUAGE_ID' => LANGUAGE_ID, 'FORMAT_DATE' => FORMAT_DATE, 'FORMAT_DATETIME' => FORMAT_DATETIME, 'COOKIE_PREFIX' => \COption::GetOptionString("main", "cookie_name", "BITRIX_SM"), 'USER_ID' => $USER->GetID(), 'SERVER_TIME' => time(), 'SERVER_TZ_OFFSET' => date("Z"), 'USER_TZ_OFFSET' => \CTimeZone::GetOffset(), 'USER_TZ_AUTO' => $autoTimeZone == 'N' ? 'N' : 'Y', 'bitrix_sessid' => bitrix_sessid()), "css" => $APPLICATION->GetCSSArray(), "isManifestUpdated" => \Bitrix\Main\Data\AppCacheManifest::getInstance()->getIsModified(), "dynamicBlocks" => $selfObject->arDynamicData);
         if (!\Bitrix\Main\Application::getInstance()->isUtfMode()) {
             //TODO I use it because there is no similar method in the new Bitrix Framework yet
             $content = $APPLICATION->convertCharsetarray($content, SITE_CHARSET, "UTF-8");
         }
         $content = json_encode($content);
     }
 }
Exemplo n.º 11
0
 /**
  * Gets useAppCache property
  * @return bool
  */
 public function getUseAppCache()
 {
     $appCache = \Bitrix\Main\Data\AppCacheManifest::getInstance();
     return $appCache->isEnabled();
 }
Exemplo n.º 12
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$platform = "android";
if (CModule::IncludeModule("mobileapp")) {
    CMobile::Init();
    $platform = CMobile::$platform;
} else {
    die;
}
\Bitrix\Main\Data\AppCacheManifest::getInstance()->setManifestCheckFile(SITE_DIR . "mobile/");
define("MOBILE_MODULE_VERSION", "155102");
$moduleVersion = defined("MOBILE_MODULE_VERSION") ? MOBILE_MODULE_VERSION : "default";
$APPLICATION->IncludeComponent("bitrix:mobile.data", "", array("START_PAGE" => SITE_DIR . "mobile/index.php?version=" . $moduleVersion, "MENU_PAGE" => SITE_DIR . "mobile/left.php?version=" . $moduleVersion, "CHAT_PAGE" => SITE_DIR . "mobile/im/right.php?version=" . $moduleVersion), false, array("HIDE_ICONS" => "Y"));
?>
<!DOCTYPE html>
<html<?php 
echo $APPLICATION->ShowProperty("manifest");
?>
 class="<?php 
echo $platform;
?>
">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=<?php 
echo SITE_CHARSET;
?>
"/>
	<meta name="format-detection" content="telephone=no">
Exemplo n.º 13
0
',
				MSLAjaxInterfaceFullURI: '<?php 
        echo CUtil::JSEscape((CMain::IsHTTPS() ? "https" : "http") . "://" . $_SERVER["HTTP_HOST"] . SITE_DIR . 'mobile/ajax.php');
        ?>
'
			});
		</script><?php 
    }
    if ($arParams["EMPTY_PAGE"] == "Y") {
        $frame = \Bitrix\Main\Page\Frame::getInstance();
        $frame->setEnable();
        $frame->setUseAppCache();
        \Bitrix\Main\Data\AppCacheManifest::getInstance()->addAdditionalParam("page", "empty_detail");
        \Bitrix\Main\Data\AppCacheManifest::getInstance()->addAdditionalParam("MobileAPIVersion", CMobile::getApiVersion());
        \Bitrix\Main\Data\AppCacheManifest::getInstance()->addAdditionalParam("MobilePlatform", CMobile::getPlatform());
        \Bitrix\Main\Data\AppCacheManifest::getInstance()->addAdditionalParam("version", "v5");
        if (CMobile::getApiVersion() < 4 && CMobile::getPlatform() != "android") {
            ?>
<div class="post-card-wrap" id="post-card-wrap" onclick=""><?php 
        }
        ?>
<div class="post-wrap" id="lenta_item"><?php 
        ?>
<div id="post_log_id" data-log-id="" data-ts="" style="display: none;"></div><?php 
        ?>
<div id="post_item_top_wrap" class="post-item-top-wrap"><?php 
        ?>
<div class="post-item-top" id="post_item_top"></div><?php 
        ?>
<div class="post-item-post-block" id="post_block_check_cont"></div><?php 
        ?>