web/sitemap.php
changeset 1558 761ba7426984
child 1562 27db60397462
equal deleted inserted replaced
1557:7c67caaafdeb 1558:761ba7426984
       
     1 <?php
       
     2 
       
     3 include_once dirname(__FILE__).'/common.php';
       
     4 
       
     5 
       
     6 function addURL($relURL) {
       
     7 
       
     8     echo("<url><loc>".URL_ROOT.$relURL."</loc></url>\n");
       
     9 }
       
    10 
       
    11 function get_archive_path($root, $path) {
       
    12     $res = array();
       
    13 
       
    14     include("$root/$path/config.php");
       
    15 
       
    16     if(isset($config['event_list']) && !empty($config['event_list']) ) {
       
    17         array_push($res, "$path/select.php");
       
    18         foreach($config['event_list'] as $event) {
       
    19             array_push($res, "$path/$event/polemicaltimeline.php");    
       
    20         }
       
    21     } else {
       
    22         array_push($res, "$path/polemicaltimeline.php");
       
    23     }
       
    24 
       
    25     return $res;
       
    26 }
       
    27 
       
    28 header('Content-Type: text/xml; charset=UTF-8');
       
    29 echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
       
    30 
       
    31 ?>
       
    32 <urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
       
    33 <?php
       
    34 addURL("");
       
    35 addURL("about.php");
       
    36 addURL("archives.php");
       
    37 
       
    38 $archives=array ();
       
    39 
       
    40 for($i=0;$i<count($archives_list);$i++) {
       
    41     
       
    42     $archive_ref = $archives_list[$i];
       
    43     $archive_name = $archive_ref;
       
    44     if(is_array($archive_ref)) {
       
    45         $archive_name = $archive_ref[0];
       
    46     }
       
    47     $archives = array_merge($archives,get_archive_path(dirname(__FILE__), $archive_name));
       
    48 }
       
    49 
       
    50 foreach ($archives as $archPath) {
       
    51     addURL($archPath);
       
    52 }
       
    53 
       
    54 ?>
       
    55 </urlset>
       
    56