header("content-type: application/xml"); echo <<<EOT42 <?xml version="1.0" encoding="UTF-8"?> <urlset \txmlns="http://www.sitemaps.org/schemas/sitemap/0.9" \txmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \txsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"> EOT42; // Select all published pages $rows = $db->SelectObjects($cfg['db_prefix'] . 'pages', array('published' => "'Y'"), array('urlpage', 'description', 'islink')); if ($rows === false) { $db->Kill(); } foreach ($rows as $row) { // Do not include external links in sitemap if (!regexUrl($row->description)) { echo "<url>\n"; if (($ssv = checkSpecialPageName($row->urlpage, SPG_GIVE_SITEMAP_SPECIAL)) !== null) { if (!empty($ssv['loc'])) { echo '<loc>' . $ssv['loc'] . "</loc>\n"; echo '<priority>' . $ssv['prio'] . "</priority>\n"; } } else { if ($row->islink == 'N') { // [i_a] put pages which are not accessible through the menus (and thus the home/index page, at a higher scan priority. echo "<loc>http://" . $_SERVER['SERVER_NAME'] . '' . $dir . '' . $row->urlpage . ".html</loc>\n"; echo "<priority>0.70</priority>\n"; } else { echo "<loc>http://" . $_SERVER['SERVER_NAME'] . '' . $dir . '' . $row->urlpage . ".html</loc>\n"; echo "<priority>0.50</priority>\n"; }
} else { echo '<tr class="altrgb">'; } } else { if ($row->published === 'N') { echo '<tr class="unpub">'; } else { echo '<tr>'; } } ?> <td> </td> <?php // [i_a] make sure URLs in descriptions are not damaged by UCfirst() $description = $row->description; if (!regexUrl($description)) { $description = ucfirst($description); } ?> <td colspan="5"><strong><?php echo $ccms['lang']['forms']['description']; ?> </strong>: <span id="<?php echo mk_unique_page_id($row->page_id); ?> " class="<?php echo $editing_mode ? 'sprite-hover liveedit' : ''; ?> " rel="description"><?php echo $description; ?>
/** * Accepts any 'fully qualified' URL, i.e. proper domain name, etc. */ function filterParam4URL($value, $def = null) { if (!isset($value)) { return $def; } $value = trim(strval($value)); // force cast to string before we do anything if (empty($value)) { return $def; } if (!regexUrl($value, true)) { // the ENTIRE string must be a URL, nothing else allowed 'at the tail end'! return $def; } return $value; }