Пример #1
0
    if (intval(COption::GetOptionString("forum", "UsePMVersion", "2")) > 0) {
        $pm = "";
        $arUserPM = array();
        $cache = new CPHPCache();
        $cache_path_main = str_replace(array(":", "//"), "/", "/" . SITE_ID . "/" . $this->__component->__name . "/");
        $cache_id = "forum_user_pm_" . $GLOBALS["USER"]->GetId();
        $cache_path = $cache_path_main . "user" . $GLOBALS["USER"]->GetId();
        if ($arParams["CACHE_TIME"] > 0 && $cache->InitCache($arParams["CACHE_TIME"], $cache_id, $cache_path)) {
            $val = $cache->GetVars();
            if (is_array($val["arUserPM"])) {
                $arUserPM = $val["arUserPM"];
            }
        }
        if (!is_array($arUserPM) || empty($arUserPM)) {
            CModule::IncludeModule("forum");
            $arUserPM = CForumPrivateMessage::GetNewPM();
            if ($arParams["CACHE_TIME"] > 0) {
                $cache->StartDataCache($arParams["CACHE_TIME"], $cache_id, $cache_path);
                $cache->EndDataCache(array("arUserPM" => $arUserPM));
            }
        }
        if (intVal($arUserPM["UNREAD_PM"]) > 0) {
            $pm = " (" . intVal($arUserPM["UNREAD_PM"]) . ")";
        }
        ?>
		<span class="forum-menu-item forum-menu-messages"><a href="<?php 
        echo $arResult["URL_TEMPLATES"]["MESSAGES"];
        ?>
"><span><?php 
        echo GetMessage("F_MESSAGES");
        echo $pm;