require_once('../includes/global.php');
require_once('../includes/frontendcommon.php');
define('T_EXEC',true);
global $type;
$type = 'xml';
//$type = 'html';
if ($type == 'xml') {
echo '
';
echo "\n";
}
line(WEBSITEADDRESS);
if (SITEWIDECMS) {
$data = Database::get_array("select itemid,seourl,name from pages where seourl <> '' and not seourl = '#' and not seourl='/' and draft = 0");
foreach ($data as $row) {
line(WEBSITEADDRESS.$row['seourl'],$row['name']);
}
}
$modules = array(
array('products',4),
array('blogs',NULL),
array('news',1,true),
array('events',NULL),
array('properties',5405),
array('galleries',2),
array('jobs',5404)
);
foreach ($modules as $module) {
if (Database::get_value('show tables like \''.Database::escape_string($module[0]).'\'')) {
// blogs are special
if ($type == 'html') {
echo ''.$module[0].'
';
}
if ($module[0] == 'blogs') {
$data = Database::get_array('select name,itemid,seourl from blogs where draft = 0 order by name');
foreach ($data as $row) {
line(WEBSITEADDRESS.'blogs/'.$row['seourl'].'/',$row['name']);
$data2 = Database::get_array('select name,itemid,seourl from blogsposts where draft = 0 and publishDate <= \''.get_mysql_date().'\' and blogid = '.intval($row['itemid']).';');
foreach ($data2 as $row2) {
line(WEBSITEADDRESS.'blogs/'.$row['seourl'].'/'.$row2['seourl'].'/',$row2['name']);
}
}
} else { // everything else
if (($module[0] == 'products') && (CART)) {
line(WEBSITEADDRESS.'products/on-sale/');
}
if (!(is_null($module[1]))) { // show categories
$data = Database::get_array('select c.itemid,c.name,c.seourl from categories as c,categoriesitems as ci, '.Database::escape_string($module[0]).' as m where c.itemid = ci.categoryid and ci.parent = '.intval($module[1]).' and m.itemid = ci.itemid and m.draft = 0 and m.publishDate <= \''.get_mysql_date().'\' group by c.itemid,c.name order by c.orderby;');
if ($data) {
foreach($data as $row) {
line(WEBSITEADDRESS.$module[0].'/category/'.$row['seourl'].'/',$row['name']);
}
}
}
// show items
$sql = 'select * from '.Database::escape_string($module[0]).' where draft = 0';
if ($module[0] == 'jobs') {
$sql.= ' and (applicationsclose >= \''.get_mysql_date().'\' or applicationsClose is Null) and publishDate <= \''.get_mysql_date().'\' order by publishdate desc';
} elseif ($module[0] == 'galleries') {
$sql.= ' and private = 0 and publishDate <= \''.get_mysql_date().'\' order by publishdate desc';
} elseif ($module[0] == 'products') {
$sql.= ' and addon = 0 and publishDate <= \''.get_mysql_date().'\' order by publishdate desc';
} elseif ($module[0] == 'events') {
$sql.= ' and startdate >= \''.get_mysql_date().'\';';
} else {
$sql.= ' and publishDate <= \''.get_mysql_date().'\' order by publishdate desc;';
}
$data = Database::get_array($sql);
if ($data) {
foreach($data as $row) {
line(WEBSITEADDRESS.$module[0].'/'.($row['seourl']).'/',$row['name']);
}
}
}
}
}
if ($type == 'xml') {
echo '';
}
echo TError::get_program_error();
function line($url,$name = '') {
global $type;
if ($type == 'html') {
echo ''.((strlen($name) == 0) ? $url : $name).'
';
} else {
echo "$url\n";
}
}
?>