本文整理汇总了PHP中CComponentEngine::MakeComponentPath方法的典型用法代码示例。如果您正苦于以下问题:PHP CComponentEngine::MakeComponentPath方法的具体用法?PHP CComponentEngine::MakeComponentPath怎么用?PHP CComponentEngine::MakeComponentPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComponentEngine
的用法示例。
在下文中一共展示了CComponentEngine::MakeComponentPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: IncludeComponent
function IncludeComponent($componentName, $componentTemplate, $arParams = array(), $parentComponent = null, $arFunctionParams = array())
{
/** @global CMain $APPLICATION */
global $APPLICATION, $USER;
if (is_array($this->arComponentMatch)) {
$skipComponent = true;
foreach ($this->arComponentMatch as $cValue) {
if (strpos($componentName, $cValue) !== false) {
$skipComponent = false;
break;
}
}
if ($skipComponent) {
return false;
}
}
$componentRelativePath = CComponentEngine::MakeComponentPath($componentName);
if (StrLen($componentRelativePath) <= 0) {
return False;
}
if ($_SESSION["SESS_SHOW_INCLUDE_TIME_EXEC"] == "Y" && ($USER->CanDoOperation('edit_php') || $_SESSION["SHOW_SQL_STAT"] == "Y")) {
$debug = new CDebugInfo();
$debug->Start();
} elseif ($APPLICATION->ShowIncludeStat) {
$debug = new CDebugInfo();
$debug->Start();
} else {
$debug = null;
}
if (is_object($parentComponent)) {
if (!$parentComponent instanceof cbitrixcomponent) {
$parentComponent = null;
}
}
$bDrawIcons = (!isset($arFunctionParams["HIDE_ICONS"]) || $arFunctionParams["HIDE_ICONS"] != "Y") && $APPLICATION->GetShowIncludeAreas();
if ($bDrawIcons) {
echo $this->IncludeStringBefore();
}
$result = null;
$bComponentEnabled = !isset($arFunctionParams["ACTIVE_COMPONENT"]) || $arFunctionParams["ACTIVE_COMPONENT"] != "N";
$component = new CBitrixComponent();
if ($component->InitComponent($componentName)) {
$obAjax = null;
if ($bComponentEnabled) {
if ($arParams['AJAX_MODE'] == 'Y') {
$obAjax = new CComponentAjax($componentName, $componentTemplate, $arParams, $parentComponent);
}
$result = $component->IncludeComponent($componentTemplate, $arParams, $parentComponent);
}
if ($bDrawIcons) {
$panel = new CComponentPanel($component, $componentName, $componentTemplate, $parentComponent, $bComponentEnabled);
$arIcons = $panel->GetIcons();
echo $s = $this->IncludeStringAfter($arIcons["icons"], $arIcons["parameters"]);
}
if ($bComponentEnabled && $obAjax) {
$obAjax->Process();
}
}
if ($_SESSION["SESS_SHOW_INCLUDE_TIME_EXEC"] == "Y" && ($USER->CanDoOperation('edit_php') || $_SESSION["SHOW_SQL_STAT"] == "Y")) {
echo $debug->Output($componentName, "/bitrix/components" . $componentRelativePath . "/component.php", $arParams["CACHE_TYPE"] . $arParams["MENU_CACHE_TYPE"]);
} elseif (is_object($debug)) {
$debug->Stop($componentName, "/bitrix/components" . $componentRelativePath . "/component.php", $arParams["CACHE_TYPE"] . $arParams["MENU_CACHE_TYPE"]);
}
return $result;
}
示例2: CopyTemplate
public static function CopyTemplate($componentName, $templateName, $siteTemplate, $newSiteTemplate, $newName = false, $bRewrite = false)
{
global $APPLICATION;
$componentName = trim($componentName);
if (strlen($componentName) <= 0) {
$APPLICATION->ThrowException(GetMessage("comp_util_err1"), "EMPTY_COMPONENT_NAME");
return false;
}
$path2Comp = CComponentEngine::MakeComponentPath($componentName);
if (strlen($path2Comp) <= 0) {
$APPLICATION->ThrowException(str_replace("#NAME#", $componentName, GetMessage("comp_util_err2")), "ERROR_NOT_COMPONENT");
return false;
}
$componentPath = getLocalPath("components" . $path2Comp);
if (!CComponentUtil::isComponent($componentPath)) {
$APPLICATION->ThrowException(str_replace("#NAME#", $componentName, GetMessage("comp_util_err2")), "ERROR_NOT_COMPONENT");
return false;
}
if (strlen($templateName) <= 0) {
$templateName = ".default";
}
$templateNameTmp = preg_replace("#[^A-Za-z0-9_.-]#i", "", $templateName);
if ($templateNameTmp != $templateName) {
$APPLICATION->ThrowException(str_replace("#NAME#", $templateName, GetMessage("comp_util_err7")), "ERROR_BAD_TEMPLATE_NAME");
return false;
}
if (strlen($siteTemplate) <= 0) {
$siteTemplate = false;
}
if ($siteTemplate != false) {
$siteTemplateDir = getLocalPath("templates/" . $siteTemplate, BX_PERSONAL_ROOT);
if ($siteTemplateDir === false || !is_dir($_SERVER["DOCUMENT_ROOT"] . $siteTemplateDir)) {
$APPLICATION->ThrowException(str_replace("#NAME#", $siteTemplate, GetMessage("comp_util_err8")), "ERROR_NO_SITE_TEMPL");
return false;
}
}
if ($siteTemplate != false) {
$path = getLocalPath("templates/" . $siteTemplate . "/components" . $path2Comp . "/" . $templateName, BX_PERSONAL_ROOT);
} else {
$path = getLocalPath("components" . $path2Comp . "/templates/" . $templateName);
}
if ($path === false || !file_exists($_SERVER["DOCUMENT_ROOT"] . $path)) {
$APPLICATION->ThrowException(str_replace("#C_NAME#", $componentName, str_replace("#T_NAME#", $templateName, GetMessage("comp_util_err9"))), "ERROR_NO_TEMPL");
return false;
}
if (strlen($newSiteTemplate) <= 0) {
$APPLICATION->ThrowException(GetMessage("comp_util_err10"), "ERROR_EMPTY_SITE_TEMPL");
return false;
}
$newSiteTemplateDir = getLocalPath("templates/" . $newSiteTemplate, BX_PERSONAL_ROOT);
if ($newSiteTemplateDir === false || !is_dir($_SERVER["DOCUMENT_ROOT"] . $newSiteTemplateDir)) {
$APPLICATION->ThrowException(str_replace("#NAME#", $newSiteTemplate, GetMessage("comp_util_err8")), "ERROR_NO_SITE_TEMPL");
return false;
}
if ($siteTemplate !== false && $siteTemplate == $newSiteTemplate && ($newName === false || $newName !== false && $templateName == $newName)) {
$APPLICATION->ThrowException(GetMessage("comp_util_err11"), "ERROR_DUPL1");
return false;
}
if ($newName !== false) {
$templateNameNew = $newName;
} else {
$templateNameNew = $templateName;
}
$templateNameNewTmp = preg_replace("#[^A-Za-z0-9_.-]#i", "", $templateNameNew);
if ($templateNameNewTmp != $templateNameNew) {
$APPLICATION->ThrowException(str_replace("#NAME#", $templateNameNew, GetMessage("comp_util_err7")), "ERROR_BAD_TEMPLATE_NAME");
return false;
}
$pathNew = $newSiteTemplateDir . "/components" . $path2Comp . "/" . $templateNameNew;
if (file_exists($_SERVER["DOCUMENT_ROOT"] . $pathNew)) {
if (!$bRewrite) {
$APPLICATION->ThrowException(str_replace("#NAME#", $templateNameNew, GetMessage("comp_util_err12")), "ERROR_EXISTS");
return false;
} else {
DeleteDirFilesEx($pathNew);
}
}
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . $path, $_SERVER["DOCUMENT_ROOT"] . $pathNew, true, true, false);
return true;
}
示例3: explode
global $CACHE_MANAGER;
if(!$USER->CanDoOperation('cache_control') || !check_bitrix_sessid())
die(GetMessage("ACCESS_DENIED"));
if($_GET["site_id"] == '')
die("Empty site_id.");
$sites = CSite::GetByID($_GET["site_id"]);
if(!($site = $sites->Fetch()))
die("Incorrect site_id.");
$aComponents = explode(",", $_GET["component_name"]);
foreach($aComponents as $component_name)
{
$componentRelativePath = CComponentEngine::MakeComponentPath($component_name);
if (strlen($componentRelativePath) > 0)
{
$arComponentDescription = CComponentUtil::GetComponentDescr($component_name);
if (isset($arComponentDescription) && is_array($arComponentDescription))
{
if (array_key_exists("CACHE_PATH", $arComponentDescription))
{
if($arComponentDescription["CACHE_PATH"] == "Y")
$arComponentDescription["CACHE_PATH"] = "/".$site["ID"].$componentRelativePath;
if(strlen($arComponentDescription["CACHE_PATH"]) > 0)
{
$obCache = new CPHPCache;
$obCache->CleanDir($arComponentDescription["CACHE_PATH"], "cache");
BXClearCache(true, $arComponentDescription["CACHE_PATH"]);
}
示例4: define
define("NO_AGENT_STATISTIC", "Y");
define("NO_AGENT_CHECK", true);
define("DisableEventsCheck", true);
/************** CACHE **********************************************/
$arResult["nPageSize"] = 10;
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
$arVoteList = array("ID" => $_REQUEST["ID"], "answer_id" => $_REQUEST["answer_id"], "request_id" => $_REQUEST["request_id"], "items" => array(), "StatusPage" => "done");
$_REQUEST["ID"] = is_array($_REQUEST["ID"]) ? $_REQUEST["ID"] : !empty($_REQUEST["ID"]) ? explode(",", $_REQUEST["ID"]) : array();
$_REQUEST["URL_TEMPLATE"] = !empty($_REQUEST["URL_TEMPLATE"]) ? $_REQUEST["URL_TEMPLATE"] : '/company/personal/user/#USER_ID#/';
$_REQUEST["NAME_TEMPLATE"] = !empty($_REQUEST["NAME_TEMPLATE"]) ? $_REQUEST["NAME_TEMPLATE"] : CSite::GetNameFormat(false);
if ((!empty($_REQUEST["ID"]) || !empty($_REQUEST["answer_id"])) && check_bitrix_sessid()) {
$arParams["CACHE_TIME"] = 600;
global $CACHE_MANAGER;
$cache = new CPHPCache();
$cache_id = "vote_user_list_" . serialize(array($arResult["nPageSize"], $_REQUEST["ID"], $_REQUEST["answer_id"], $_REQUEST["iNumPage"], $_REQUEST["NAME_TEMPLATE"], $_REQUEST["URL_TEMPLATE"]));
$cache_path = $CACHE_MANAGER->GetCompCachePath(CComponentEngine::MakeComponentPath("voting.current"));
$arVoteList = $arParams["CACHE_TIME"] > 0 && $cache->InitCache($arParams["CACHE_TIME"], $cache_id, $cache_path) ? $cache->GetVars() : array();
if (!is_array($arVoteList) || empty($arVoteList)) {
$arEventsInfo = array();
$arVoteList = array("ID" => $_REQUEST["ID"], "answer_id" => $_REQUEST["answer_id"], "request_id" => $_REQUEST["request_id"], "items" => array(), "StatusPage" => "done");
if (empty($_REQUEST["ID"]) && CModule::IncludeModule("vote")) {
$db_res = CVoteEvent::GetUserAnswerStat(array(), array("ANSWER_ID" => $_REQUEST["answer_id"], "VALID" => "Y", "bGetVoters" => "Y", "bGetMemoStat" => "N"), array("nPageSize" => $arResult["nPageSize"], "bShowAll" => false, "iNumPage" => $_REQUEST["iNumPage"] > 0 ? $_REQUEST["iNumPage"] : false));
if ($db_res && ($res = $db_res->Fetch())) {
$arEventsInfo = $res;
$arVoteList["StatusPage"] = $db_res->NavPageNomer >= $db_res->NavPageCount || $arResult["nPageSize"] > $db_res->NavRecordCount ? "done" : "continue";
if ($_REQUEST["iNumPage"] <= $db_res->NavPageCount) {
$_REQUEST["ID"] = array();
do {
$_REQUEST["ID"][] = $res["AUTH_USER_ID"];
} while ($res = $db_res->Fetch());
} else {
示例5: array
$arParams["SITE_LIST"] = array();
} else {
$bSiteAll = false;
}
$arParams["CACHE_TIME"] = is_set($arParams, "CACHE_TIME") ? intval($arParams["CACHE_TIME"]) : 86400;
$bCache = $arParams["CACHE_TIME"] > 0 && ($arParams["CACHE_TYPE"] == "Y" || $arParams["CACHE_TYPE"] == "A" && COption::GetOptionString("main", "component_cache_on", "Y") == "Y");
if ($bCache) {
$arCacheParams = array();
foreach ($arParams as $key => $value) {
if (substr($key, 0, 1) != "~") {
$arCacheParams[$key] = $value;
}
}
$cache = new CPHPCache();
$CACHE_ID = SITE_ID . "|" . $componentName . "|" . md5(serialize($arCacheParams)) . "|" . $USER->GetGroups();
$CACHE_PATH = "/" . SITE_ID . CComponentEngine::MakeComponentPath($componentName);
}
if ($bCache && $cache->InitCache($arParams["CACHE_TIME"], $CACHE_ID, $CACHE_PATH)) {
$vars = $cache->GetVars();
$arResult = $vars["arResult"];
} else {
if ($bCache) {
$cache->StartDataCache();
}
$rsSite = CSite::GetList($by = "sort", $order = "asc", $arFilter = array("ACTIVE" => "Y"));
$arResult["SITES"] = array();
while ($arSite = $rsSite->GetNext()) {
if ($bSiteAll || in_array($arSite["LID"], $arParams["SITE_LIST"])) {
if (strlen($arSite['DOMAINS']) > 0) {
$arSite['DOMAINS'] = explode("\n", $arSite['DOMAINS']);
foreach ($arSite['DOMAINS'] as $key => $domain) {
示例6: substr
$functionParams = ",\n" . "\tarray(\n" . "\t\t" . PHPParser::ReturnPHPStr2($arComponent["DATA"]["FUNCTION_PARAMS"]) . "\n" . "\t)";
}
$code = ($arComponent["DATA"]["VARIABLE"] ? $arComponent["DATA"]["VARIABLE"] . " = " : "") . "\$APPLICATION->IncludeComponent(\n" . "\t\"" . $arComponent["DATA"]["COMPONENT_NAME"] . "\", \n" . "\t\"" . $sTemplateName . "\", \n" . "\tarray(\n" . "\t\t" . PHPParser::ReturnPHPStr2($aPostValues) . "\n" . "\t),\n" . "\t" . ($arComponent["DATA"]["PARENT_COMP"] != '' ? $arComponent["DATA"]["PARENT_COMP"] : "false") . $functionParams . "\n);";
$filesrc_for_save = substr($filesrc, 0, $arComponent["START"]) . $code . substr($filesrc, $arComponent["END"]);
$f = $io->GetFile($abs_path);
$arUndoParams = array('module' => 'fileman', 'undoType' => 'edit_component_props', 'undoHandler' => 'CFileman::UndoEditFile', 'arContent' => array('absPath' => $abs_path, 'content' => $f->GetContents()));
if ($APPLICATION->SaveFileContent($abs_path, $filesrc_for_save)) {
CUndo::ShowUndoMessage(CUndo::Add($arUndoParams));
$obJSPopup->Close();
} else {
$strWarning .= GetMessage("comp_prop_err_save") . "<br>";
}
}
}
}
$componentPath = CComponentEngine::MakeComponentPath($componentName);
if ($strWarning !== "") {
$obJSPopup->ShowValidationError($strWarning);
?>
<script>
(function()
{
if (BX && BX.WindowManager)
{
var oPopup = BX.WindowManager.Get();
if (oPopup && oPopup.PARTS && oPopup.PARTS.CONTENT_DATA)
{
oPopup.PARTS.CONTENT_DATA.style.display = 'none';
}
}
})();
示例7: includeComponent
public static function includeComponent($componentName, $componentTemplate, $arParams = array(), $parentComponent = null, $arFunctionParams = array())
{
$componentRelativePath = \CComponentEngine::MakeComponentPath($componentName);
if (StrLen($componentRelativePath) <= 0) {
return False;
}
if (is_object($parentComponent)) {
if (!$parentComponent instanceof \cbitrixcomponent) {
$parentComponent = null;
}
}
$result = null;
$bComponentEnabled = !isset($arFunctionParams["ACTIVE_COMPONENT"]) || $arFunctionParams["ACTIVE_COMPONENT"] != "N";
$component = new \CBitrixComponent();
if ($component->InitComponent($componentName)) {
$obAjax = null;
if ($bComponentEnabled) {
$component->setSiteId(static::getInstance()->getSiteId());
$component->setLanguageId(static::getInstance()->getLanguageId());
$component->setSiteTemplateId(static::getInstance()->getSiteTemplateId());
$result = $component->IncludeComponent($componentTemplate, $arParams, $parentComponent);
$arThemeCss = array();
// TODO: use styles array from $component
foreach ($arThemeCss as $cssPath) {
static::getInstance()->setStyle($cssPath);
}
}
}
return $result;
}
示例8: substr
}
}
$code = ($arComponent["DATA"]["VARIABLE"] ? $arComponent["DATA"]["VARIABLE"] . "=" : "") . "\$APPLICATION->IncludeComponent(\"" . $arComponent["DATA"]["COMPONENT_NAME"] . "\", " . "\"" . $sTemplateName . "\", " . "array(\n\t" . PHPParser::ReturnPHPStr2($aPostValues) . "\n\t)" . ",\n\t" . (strlen($arComponent["DATA"]["PARENT_COMP"]) > 0 ? $arComponent["DATA"]["PARENT_COMP"] : "false") . (!empty($arComponent["DATA"]["FUNCTION_PARAMS"]) ? ",\n\t" . "array(\n\t" . PHPParser::ReturnPHPStr2($arComponent["DATA"]["FUNCTION_PARAMS"]) . "\n\t)" : "") . "\n);";
$filesrc_for_save = substr($filesrc, 0, $arComponent["START"]) . $code . substr($filesrc, $arComponent["END"]);
$f = $io->GetFile($abs_path);
$arUndoParams = array('module' => 'fileman', 'undoType' => 'edit_component_props', 'undoHandler' => 'CFileman::UndoEditFile', 'arContent' => array('absPath' => $abs_path, 'content' => $f->GetContents()));
if ($APPLICATION->SaveFileContent($abs_path, $filesrc_for_save)) {
CUndo::ShowUndoMessage(CUndo::Add($arUndoParams));
$obJSPopup->Close();
} else {
$strWarning .= GetMessage("comp_prop_err_save") . "<br>";
}
}
}
}
$componentPath = CComponentEngine::MakeComponentPath($_GET["component_name"]);
$arComponentDescription["ICON"] = ltrim($arComponentDescription["ICON"], "/");
$localPath = getLocalPath("components" . $componentPath);
if ($localPath !== false && $arComponentDescription["ICON"] != "" && $io->FileExists($io->RelativeToAbsolutePath($localPath . "/" . $arComponentDescription["ICON"]))) {
$sIcon = $localPath . "/" . $arComponentDescription["ICON"];
} else {
$sIcon = "/bitrix/images/fileman/htmledit2/component.gif";
}
$obJSPopup->StartDescription($sIcon);
if ($arComponentDescription["NAME"] != "") {
?>
<p title="<?php
echo GetMessage("comp_prop_name");
?>
" class="title"><?php
echo htmlspecialcharsbx($arComponentDescription["NAME"]);
示例9: clearComponentCache
/**
* Function clears entire component cache.
*
* <p>Note: parameters must exactly match to startResultCache call.</p>
* @param string $componentName
* @param string $siteId
* @return void
*
*/
public static final function clearComponentCache($componentName, $siteId = "")
{
/** @global CCacheManager $CACHE_MANAGER */
global $CACHE_MANAGER;
$componentRelativePath = CComponentEngine::MakeComponentPath($componentName);
if ($componentRelativePath != "") {
$componentDescription = CComponentUtil::GetComponentDescr($componentName);
if (isset($componentDescription) && is_array($componentDescription)) {
if (isset($componentDescription["CACHE_PATH"]) && $componentDescription["CACHE_PATH"] == "Y") {
if ($siteId == "") {
$rsSite = CSite::GetList($by = "sort", $order = "asc");
while ($site = $rsSite->Fetch()) {
$componentCachePath = "/" . $site["ID"] . $componentRelativePath;
$obCache = new CPHPCache();
$obCache->CleanDir($componentCachePath, "cache");
BXClearCache(true, $componentCachePath);
}
} else {
$componentCachePath = "/" . $siteId . $componentRelativePath;
$obCache = new CPHPCache();
$obCache->CleanDir($componentCachePath, "cache");
BXClearCache(true, $componentCachePath);
}
}
}
if (defined("BX_COMP_MANAGED_CACHE")) {
$CACHE_MANAGER->ClearByTag($componentName);
}
}
}
示例10: array
$DB->Query("UPDATE b_blog_image SET POST_ID=" . $newID . " WHERE BLOG_ID=" . $arBlog["ID"] . " AND POST_ID=0", true);
$bHasImg = false;
$bHasTag = false;
$bHasProps = false;
$bHasOnlyAll = false;
if (!empty($CATEGORYtmp)) {
$bHasTag = true;
}
$dbImg = CBlogImage::GetList(array(), array("BLOG_ID" => $arBlog["ID"], "POST_ID" => $newID, "IS_COMMENT" => "N"), false, false, array("ID"));
if ($dbImg->Fetch()) {
$bHasImg = true;
}
$arPostFieldsOLD = $arPostFields;
$arPostFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("BLOG_POST", $newID, LANGUAGE_ID);
if ($arPostFields["UF_BLOG_POST_IMPRTNT"]["VALUE"] != $arPostFieldsOLD["UF_BLOG_POST_IMPRTNT"]["VALUE"] || $arParams["ID"] > 0 && ($arResult["Post"]["~DETAIL_TEXT"] != $arFields["DETAIL_TEXT"] || $arResult["Post"]["~TITLE"] != $arFields["TITLE"])) {
BXClearCache(true, CComponentEngine::MakeComponentPath("bitrix:socialnetwork.blog.blog"));
}
foreach ($arPostFields as $FIELD_NAME => $arPostField) {
if (!empty($arPostField["VALUE"]) > 0) {
$bHasProps = true;
break;
}
}
if (!empty($arFields["SOCNET_RIGHTS"]) && count($arFields["SOCNET_RIGHTS"]) == 1 && in_array("UA", $arFields["SOCNET_RIGHTS"])) {
$bHasOnlyAll = true;
}
$arFieldsHave = array("HAS_IMAGES" => $bHasImg ? "Y" : "N", "HAS_TAGS" => $bHasTag ? "Y" : "N", "HAS_PROPS" => $bHasProps ? "Y" : "N", "HAS_SOCNET_ALL" => $bHasOnlyAll ? "Y" : "N");
CBlogPost::Update($newID, $arFieldsHave, false);
}
if ($bAdd && $newID && $arFields["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH || $arOldPost["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH && $arFields["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) {
$arFields["ID"] = $newID;
示例11: ForumClearComponentCache
function ForumClearComponentCache($components)
{
if (empty($components)) {
return false;
}
$aComponents = is_array($components) ? $components : explode(",", $components);
foreach ($aComponents as $component_name) {
$componentRelativePath = CComponentEngine::MakeComponentPath($component_name);
if (strlen($componentRelativePath) > 0) {
$arComponentDescription = CComponentUtil::GetComponentDescr($component_name);
if (is_array($arComponentDescription) && array_key_exists("CACHE_PATH", $arComponentDescription)) {
if ($arComponentDescription["CACHE_PATH"] == "Y") {
$arComponentDescription["CACHE_PATH"] = "/" . SITE_ID . $componentRelativePath;
}
if (strlen($arComponentDescription["CACHE_PATH"]) > 0) {
BXClearCache(true, $arComponentDescription["CACHE_PATH"]);
}
}
}
}
}
示例12: intval
/************** CACHE **********************************************/
if (!isset($arParams["CACHE_TIME"])) {
$arParams["CACHE_TIME"] = 3600 * 24 * 7;
}
if ($arParams["CACHE_TYPE"] == "Y" || $arParams["CACHE_TYPE"] == "A" && COption::GetOptionString("main", "component_cache_on", "Y") == "Y") {
$arParams["CACHE_TIME"] = intval($arParams["CACHE_TIME"]);
} else {
$arParams["CACHE_TIME"] = 0;
}
$arParams["CACHE_TAGS"] = !empty($arParams["CACHE_TAGS"]) ? $arParams["CACHE_TAGS"] : array();
//$arParams["CACHE_TIME"] = 0;
/********************************************************************
/Input params
********************************************************************/
global $CACHE_MANAGER;
$cache_path = CComponentEngine::MakeComponentPath("bitrix:socialnetwork.blog.blog");
$bGroupMode = $arParams["SOCNET_GROUP_ID"] > 0;
$feature = "blog";
$user_id = intval($USER->GetID());
$arResult["ERROR_MESSAGE"] = array();
$arResult["OK_MESSAGE"] = array();
if (!($bGroupMode && CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], $feature) || CSocNetFeatures::IsActiveFeature(SONET_ENTITY_USER, $arParams["USER_ID"], $feature))) {
$arResult["ERROR_MESSAGE"][] = array("id" => "SONET_MODULE_NOT_AVAIBLE", "text" => GetMessage("BLOG_SONET_MODULE_NOT_AVAIBLE"));
} else {
if (!($arParams["USER_ID"] > 0 || $bGroupMode)) {
$arResult["ERROR_MESSAGE"][] = array("id" => "NO_BLOG", "text" => GetMessage("BLOG_BLOG_BLOG_NO_BLOG"));
CHTTP::SetStatus("404 Not Found");
} else {
$arResult["perms"] = BLOG_PERMS_DENY;
$bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin();
if ($bGroupMode) {
示例13: PClearComponentCache
function PClearComponentCache($components)
{
if (empty($components)) {
return false;
}
if (is_array($components)) {
$aComponents = $components;
} else {
$aComponents = explode(",", $components);
}
foreach ($aComponents as $component_name) {
$add_path = "";
if (strpos($component_name, "/") !== false) {
$add_path = substr($component_name, strpos($component_name, "/"));
$component_name = substr($component_name, 0, strpos($component_name, "/"));
}
$componentRelativePath = CComponentEngine::MakeComponentPath($component_name);
if (strlen($componentRelativePath) > 0) {
BXClearCache(true, "/" . $componentRelativePath . $add_path);
BXClearCache(true, "/" . SITE_ID . $componentRelativePath . $add_path);
}
}
BXClearCache(true, "/photogallery");
BXClearCache(true, "/" . SITE_ID . "/photogallery");
}
示例14: forumTextParser
if (!isset(${"parser_" . LANGUAGE_ID})) {
${"parser_" . LANGUAGE_ID} = new forumTextParser(LANGUAGE_ID);
}
$POST_MESSAGE = ${"parser_" . LANGUAGE_ID}->convert4mail(str_replace("#SERVER_NAME#", SITE_SERVER_NAME, $_REQUEST["POST_MESSAGE"]));
$arFields = array("FROM_NAME" => $res["AUTHOR_NAME"], "FROM_USER_ID" => $USER->GetID(), "FROM_EMAIL" => $USER->GetEmail(), "TO_NAME" => $res["RECIPIENT_NAME"], "TO_USER_ID" => $res["RECIPIENT_ID"], "TO_EMAIL" => $res["RECIPIENT_EMAIL"], "SUBJECT" => $_REQUEST["POST_SUBJ"], "MESSAGE" => $POST_MESSAGE, "MESSAGE_DATE" => date("d.m.Y H:i:s"), "MESSAGE_LINK" => "http://" . SITE_SERVER_NAME . CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_PM_READ"], array("FID" => "1", "MID" => $arParams["MID"])) . " \n");
$event->Send("NEW_FORUM_PRIVATE_MESSAGE", SITE_ID, $arFields, "N");
}
}
if ($arParams['AUTOSAVE']) {
$arParams['AUTOSAVE']->Reset();
}
// Clear cache.
BXClearCache(true, "/bitrix/forum/user/" . $res["RECIPIENT_ID"] . "/");
$arComponentPath = array("bitrix:forum");
foreach ($arComponentPath as $path) {
$componentRelativePath = CComponentEngine::MakeComponentPath($path);
$arComponentDescription = CComponentUtil::GetComponentDescr($path);
if (strLen($componentRelativePath) <= 0 || !is_array($arComponentDescription)) {
continue;
} elseif (!array_key_exists("CACHE_PATH", $arComponentDescription)) {
continue;
}
$path = str_replace("//", "/", $componentRelativePath . "/user" . $res["RECIPIENT_ID"]);
if ($arComponentDescription["CACHE_PATH"] == "Y") {
$path = "/" . SITE_ID . $path;
}
if (!empty($path)) {
BXClearCache(true, $path);
}
}
}
示例15: CopyTemplate
function CopyTemplate($componentName, $templateName, $siteTemplate, $newSiteTemplate, $newName = False, $bRewrite = False)
{
$componentName = Trim($componentName);
if (StrLen($componentName) <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("comp_util_err1"), "EMPTY_COMPONENT_NAME");
return false;
}
$path2Comp = CComponentEngine::MakeComponentPath($componentName);
if (StrLen($path2Comp) <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#NAME#", $componentName, GetMessage("comp_util_err2")), "ERROR_NOT_COMPONENT");
return false;
}
$componentPath = "/bitrix/components".$path2Comp;
if (!CComponentUtil::isComponent($componentPath))
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#NAME#", $componentName, GetMessage("comp_util_err2")), "ERROR_NOT_COMPONENT");
return false;
}
if (StrLen($templateName) <= 0)
$templateName = ".default";
$templateNameTmp = preg_replace("#[^A-Za-z0-9_.-]#i", "", $templateName);
if ($templateNameTmp != $templateName)
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#NAME#", $templateName, GetMessage("comp_util_err7")), "ERROR_BAD_TEMPLATE_NAME");
return false;
}
if (StrLen($siteTemplate) <= 0)
$siteTemplate = False;
if ($siteTemplate != False)
{
if (!file_exists($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/templates/".$siteTemplate)
|| !is_dir($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/templates/".$siteTemplate))
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#NAME#", $siteTemplate, GetMessage("comp_util_err8")), "ERROR_NO_SITE_TEMPL");
return false;
}
}
if ($siteTemplate != False)
$path = BX_PERSONAL_ROOT."/templates/".$siteTemplate."/components".$path2Comp."/".$templateName;
else
$path = "/bitrix/components".$path2Comp."/templates/".$templateName;
if (!file_exists($_SERVER["DOCUMENT_ROOT"].$path))
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#C_NAME#", $componentName, str_replace("#T_NAME#", $templateName, GetMessage("comp_util_err9"))), "ERROR_NO_TEMPL");
return false;
}
if (StrLen($newSiteTemplate) <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("comp_util_err10"), "ERROR_EMPTY_SITE_TEMPL");
return false;
}
if (!file_exists($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/templates/".$newSiteTemplate)
|| !is_dir($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/templates/".$newSiteTemplate))
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#NAME#", $newSiteTemplate, GetMessage("comp_util_err8")), "ERROR_NO_SITE_TEMPL");
return false;
}
if ($siteTemplate !== False
&& $siteTemplate == $newSiteTemplate
&& ($newName === False || $newName !== False && $templateName == $newName))
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("comp_util_err11"), "ERROR_DUPL1");
return false;
}
if ($newName !== False)
$templateNameNew = $newName;
else
$templateNameNew = $templateName;
$templateNameNewTmp = preg_replace("#[^A-Za-z0-9_.-]#i", "", $templateNameNew);
if ($templateNameNewTmp != $templateNameNew)
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#NAME#", $templateNameNew, GetMessage("comp_util_err7")), "ERROR_BAD_TEMPLATE_NAME");
return false;
}
$pathNew = BX_PERSONAL_ROOT."/templates/".$newSiteTemplate."/components".$path2Comp."/".$templateNameNew;
if (file_exists($_SERVER["DOCUMENT_ROOT"].$pathNew))
{
if (!$bRewrite)
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#NAME#", $templateNameNew, GetMessage("comp_util_err12")), "ERROR_EXISTS");
return false;
}
//.........这里部分代码省略.........