_action) { default: { $this->ShowSiteMap(); break; } } } function ShowSiteMap() { echo $this->createXMLHeader(); $this->GetArticleList(); echo $this->createXMLFooter(); die(); } function createSiteMap(){ } function makeXML($file) { // now we do the actual processing here // and generate the xml for this file $lastmod = date('Y-m-d\TH:i:s'); $str = "\n"; $str .= "".$file."\n"; $str .= "".$lastmod."+00:00\n"; $str .= "\n"; echo $str; } function createXMLHeader() { header("Content-type: text/xml"); $str = ''; $str .= ''."\n"; return $str; } function createXMLFooter() { return ""; } function GetArticleList() { // Show a list of categories in the sitemap $arrCatList = array(); $arrDone = array(); $catResult = mysql_query(sprintf("select * from %scategories order by ParentID, Name", $GLOBALS["AL_CFG"]["tablePrefix"])); $arrCats = $GLOBALS["AL_CLASS_CATEGORY"]->GetCategoryOptions(array(), "%s %s|~~ %s\n" , "", "", false); $arrCats1 = explode("\n", $arrCats); foreach($arrCats1 as $key=>$c) $arrCatList[] = explode("|~~", trim($c)); if(is_array($arrCatList) && sizeof($arrCatList) > 0 && $arrCats != "") { $NumArticles = 1; foreach($arrCatList as $key=>$c) { if(isset($c[1]) && !in_array($c[0], $arrDone)) { $arrDone[] = $c[0]; $cRow = @mysql_fetch_array(@mysql_query(sprintf("select * from %scategories where CategoryID='%d'", $GLOBALS["AL_CFG"]["tablePrefix"], $c[0]))); $catId = $cRow["CategoryID"]; $catName = AL_CATEGORY::GetCatNameFromArray($arrCatList, $cRow["CategoryID"]); $indent = floor(sizeof(explode(" ", $catName)) / 2) / 2; $catName = str_replace(" ", " ", $catName); $catName = trim($catName); $catName = eregi_replace("^ - ", "", $catName); $articleList = $this->GetArticlesPerCat($catId); $this->makeXML(htmlentities(AL_HELPER::CategoryLink($catId, $catName))); } } } return true; } function GetArticlesPerCat($CatId) { // Get a list of articles that appear in the selected category $output = ""; $query = sprintf("select *, unix_timestamp(StartDate) as SD from %sarticles inner join %susers on %sarticles.AuthorID = %susers.UserID inner join %scategoryassociations on %sarticles.ArticleID = %scategoryassociations.ArticleID where CategoryID='%d' and Visible=1 and %sarticles.Status=1 and unix_timestamp(StartDate) <= %s and IsFinished=1 and (unix_timestamp(ExpiryDate) >= %s or EnableExpiry=0) order by StartDate DESC, %sarticles.ArticleID DESC", $GLOBALS["AL_CFG"]["tablePrefix"], $GLOBALS["AL_CFG"]["tablePrefix"], $GLOBALS["AL_CFG"]["tablePrefix"], $GLOBALS["AL_CFG"]["tablePrefix"], $GLOBALS["AL_CFG"]["tablePrefix"], $GLOBALS["AL_CFG"]["tablePrefix"], $GLOBALS["AL_CFG"]["tablePrefix"], $CatId, $GLOBALS["AL_CFG"]["tablePrefix"], time(), time(), $GLOBALS["AL_CFG"]["tablePrefix"]); $result = mysql_query($query); while($row = mysql_fetch_array($result)) { $this->makeXML(AL_HELPER::ArticleLink($row["ArticleID"], $row["Title"])); } return true; } } ?>