Beispiel #1
0
	public static function DeleteBySiteID($siteID)
	{
		global $DB;

		$siteID = Trim($siteID);
		if (strlen($siteID) <= 0)
			return False;

		$dbPath = CBlogSitePath::GetList(Array(), Array("SITE_ID" => $siteID));
		while($arPath = $dbPath -> Fetch())
		{
			unset($GLOBALS["BLOG_SITE_PATH"]["BLOG_SITE_PATH1_CACHE_".$arPath["SITE_ID"]]);
			unset($GLOBALS["BLOG_SITE_PATH"]["BLOG_SITE_PATH_CACHE_".$arPath["ID"]]);
			return $DB->Query("DELETE FROM b_blog_site_path WHERE ID = ".$arPath["ID"]."", true);
		}
		
		return true;
	}
Beispiel #2
0
 function PreparePath($blogUrl, $postID = 0, $siteID = False, $is404 = True, $userID = 0, $groupID = 0)
 {
     $blogUrl = Trim($blogUrl);
     $postID = IntVal($postID);
     $groupID = IntVal($groupID);
     $userID = IntVal($userID);
     if (!$siteID) {
         $siteID = SITE_ID;
     }
     $dbPath = CBlogSitePath::GetList(array(), array("SITE_ID" => $siteID));
     while ($arPath = $dbPath->Fetch()) {
         if (strlen($arPath["TYPE"]) > 0) {
             $arPaths[$arPath["TYPE"]] = $arPath["PATH"];
         } else {
             $arPaths["OLD"] = $arPath["PATH"];
         }
     }
     if ($postID > 0) {
         if ($groupID > 0) {
             if (strlen($arPaths["H"]) > 0) {
                 $result = str_replace("#blog#", $blogUrl, $arPaths["H"]);
                 $result = str_replace("#post_id#", $postID, $result);
                 $result = str_replace("#user_id#", $userID, $result);
                 $result = str_replace("#group_id#", $groupID, $result);
             } elseif (strlen($arPaths["G"]) > 0) {
                 $result = str_replace("#blog#", $blogUrl, $arPaths["G"]);
                 $result = str_replace("#user_id#", $userID, $result);
                 $result = str_replace("#group_id#", $groupID, $result);
             }
         } elseif (strlen($arPaths["P"]) > 0) {
             $result = str_replace("#blog#", $blogUrl, $arPaths["P"]);
             $result = str_replace("#post_id#", $postID, $result);
             $result = str_replace("#user_id#", $userID, $result);
         } elseif (strlen($arPaths["B"]) > 0) {
             $result = str_replace("#blog#", $blogUrl, $arPaths["B"]);
             $result = str_replace("#user_id#", $userID, $result);
         } else {
             if ($is404) {
                 $result = htmlspecialcharsbx($arPaths["OLD"]) . "/" . htmlspecialcharsbx($blogUrl) . "/" . $postID . ".php";
             } else {
                 $result = htmlspecialcharsbx($arPaths["OLD"]) . "/post.php?blog=" . $blogUrl . "&post_id=" . $postID;
             }
         }
     } else {
         if (strlen($arPaths["B"]) > 0) {
             $result = str_replace("#blog#", $blogUrl, $arPaths["B"]);
             $result = str_replace("#user_id#", $userID, $result);
         } else {
             if ($is404) {
                 $result = htmlspecialcharsbx($arPaths["OLD"]) . "/" . htmlspecialcharsbx($blogUrl) . "/";
             } else {
                 $result = htmlspecialcharsbx($arPaths["OLD"]) . "/post.php?blog=" . $blogUrl;
             }
         }
     }
     return $result;
 }
Beispiel #3
0
 function PreparePath($userID = 0, $siteID = False, $is404 = True)
 {
     $userID = IntVal($userID);
     if (!$siteID) {
         $siteID = SITE_ID;
     }
     $dbPath = CBlogSitePath::GetList(array(), array("SITE_ID" => $siteID));
     while ($arPath = $dbPath->Fetch()) {
         if (strlen($arPath["TYPE"]) > 0) {
             $arPaths[$arPath["TYPE"]] = $arPath["PATH"];
         } else {
             $arPaths["OLD"] = $arPath["PATH"];
         }
     }
     if (strlen($arPaths["U"]) > 0) {
         $result = str_replace("#user_id#", $userID, $arPaths["U"]);
     } else {
         if ($is404) {
             $result = htmlspecialcharsbx($arPaths["OLD"]) . "/users/" . $userID . ".php";
         } else {
             $result = htmlspecialcharsbx($arPaths["OLD"]) . "/users.php?&user_id=" . $userID;
         }
     }
     return $result;
 }
Beispiel #4
0
		</tr>
		<?php 
    }
    ?>
	
	
	
	<tr class="heading">
		<td colspan="2"><?php 
    echo GetMessage("BLO_SITE_PATH2");
    ?>
</td>
	</tr>
	<?php 
    $arPaths = array();
    $dbPaths = CBlogSitePath::GetList();
    while ($arPath = $dbPaths->Fetch()) {
        $arPaths[$arPath["SITE_ID"]][$arPath["TYPE"]] = $arPath["PATH"];
    }
    $dbSites = CSite::GetList($b = "", $o = "", array("ACTIVE" => "Y"));
    while ($arSite = $dbSites->Fetch()) {
        ?>
		<tr>
			<td valign="top" colspan="2" align="center"><?php 
        echo str_replace("#SITE#", $arSite["LID"], GetMessage("BLO_SITE_PATH_SITE"));
        ?>
:</td>
		</tr>
		<tr>
			<td align="center" colspan="2">
				<table cellspacing="2" width="100%">
Beispiel #5
0
    }
}
COption::SetOptionString('blog', 'avatar_max_size', '30000');
COption::SetOptionString('blog', 'avatar_max_width', '100');
COption::SetOptionString('blog', 'avatar_max_height', '100');
COption::SetOptionString('blog', 'image_max_width', '600');
COption::SetOptionString('blog', 'image_max_height', '600');
COption::SetOptionString('blog', 'allow_alias', 'Y');
COption::SetOptionString('blog', 'block_url_change', 'Y');
COption::SetOptionString('blog', 'GROUP_DEFAULT_RIGHT', 'D');
COption::SetOptionString('blog', 'show_ip', 'N');
COption::SetOptionString('blog', 'enable_trackback', 'N');
COption::SetOptionString('blog', 'allow_html', 'N');
$APPLICATION->SetGroupRight("blog", 1, "W");
COption::SetOptionString("blog", "GROUP_DEFAULT_RIGHT", "D");
$db_res = CBlogSitePath::GetList(array(), array("SITE_ID" => WIZARD_SITE_ID));
if ($db_res && ($res = $db_res->Fetch())) {
    if (WIZARD_INSTALL_DEMO_DATA) {
        $res_tmp = array("B" => WIZARD_SITE_DIR . "people/user/#user_id#/blog/", "P" => WIZARD_SITE_DIR . "people/user/#user_id#/blog/#post_id#/", "U" => WIZARD_SITE_DIR . "people/user/#user_id#/", "G" => WIZARD_SITE_DIR . "groups/group/#group_id#/blog/", "H" => WIZARD_SITE_DIR . "groups/group/#group_id#/blog/#post_id#/");
        do {
            if (array_key_exists($res["TYPE"], $res_tmp) && $res["PATH"] != $res_tmp[$res["TYPE"]]) {
                CBlogSitePath::Update($res["ID"], array("PATH" => $res_tmp[$res["TYPE"]]));
            }
        } while ($db_res && ($res = $db_res->Fetch()));
    }
} else {
    CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "people/user/#user_id#/blog/", "TYPE" => "B"));
    CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "people/user/#user_id#/blog/#post_id#/", "TYPE" => "P"));
    CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "people/user/#user_id#/", "TYPE" => "U"));
    CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "groups/group/#group_id#/blog/", "TYPE" => "G"));
    CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "groups/group/#group_id#/blog/#post_id#/", "TYPE" => "H"));
Beispiel #6
0
    if (WIZARD_INSTALL_DEMO_DATA) {
        $db_blog = CBlog::GetList(array(), array("GROUP_ID" => $res_blog_group["ID"]), false, false, array("ID"));
        if ($res_blog = $db_blog->Fetch()) {
            do {
                CBlog::Delete($res_blog["ID"]);
            } while ($res_blog = $db_blog->Fetch());
        }
    } else {
        CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/blogs/index.php", array("BLOG_GROUP_ID" => $SocNetGroupID));
        return;
    }
}
if (WIZARD_FIRST_INSTAL != 'Y') {
    $arFilters = array(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "blogs/" . WIZARD_SITE_ID . "_blog_#user_id#/", "TYPE" => "B"), array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "blogs/" . WIZARD_SITE_ID . "_blog_#user_id#/#post_id#.php", "TYPE" => "P"), array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "blogs/user/#user_id#.php", "TYPE" => "U"));
    foreach ($arFilters as $arFilter) {
        $dbSitePath = CBlogSitePath::GetList(array(), $arFilter, false, false, array("ID"));
        if ($arSitePath = $dbSitePath->Fetch()) {
            CBlogSitePath::Delete($arSitePath["ID"]);
        }
        CBlogSitePath::Add($arFilter);
    }
}
COption::SetOptionString('blog', 'avatar_max_size', '30000');
COption::SetOptionString('blog', 'avatar_max_width', '100');
COption::SetOptionString('blog', 'avatar_max_height', '100');
COption::SetOptionString('blog', 'image_max_width', '600');
COption::SetOptionString('blog', 'image_max_height', '600');
COption::SetOptionString('blog', 'allow_alias', 'Y');
COption::SetOptionString('blog', 'block_url_change', 'Y');
COption::SetOptionString('blog', 'GROUP_DEFAULT_RIGHT', 'D');
COption::SetOptionString('blog', 'show_ip', 'N');
Beispiel #7
0
	public static function PreparePath($blogUrl, $siteID = False, $is404 = True, $userID = 0, $groupID = 0)
	{
		$blogUrl = Trim($blogUrl);
		if (!$siteID)
			$siteID = SITE_ID;

		$dbPath = CBlogSitePath::GetList(array(), array("SITE_ID"=>$siteID));
		while($arPath = $dbPath->Fetch())
		{
			if(strlen($arPath["TYPE"])>0)
				$arPaths[$arPath["TYPE"]] = $arPath["PATH"];
			else
				$arPaths["OLD"] = $arPath["PATH"];
		}
		if($groupID > 0 && strlen($arPaths["G"])>0)
		{
			$result = str_replace("#blog#", $blogUrl, $arPaths["G"]);
			$result = str_replace("#user_id#", $userID, $result);
			$result = str_replace("#group_id#", $groupID, $result);
		}
		elseif(strlen($arPaths["B"])>0)
		{
			$result = str_replace("#blog#", $blogUrl, $arPaths["B"]);
			$result = str_replace("#user_id#", $userID, $result);
			$result = str_replace("#group_id#", $groupID, $result);
		}
		else
		{
			if($is404)
				$result = htmlspecialcharsbx($arPaths["OLD"])."/".htmlspecialcharsbx($blogUrl)."/";
			else
				$result = htmlspecialcharsbx($arPaths["OLD"])."/blog.php?blog=".$blogUrl;
		}

		return $result;
	}