[ PHPXref.com ] [ Generated: Sun Jul 20 19:47:34 2008 ] [ phpMyFAQ 1.6.1 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> sitemap.php (source)

   1  <?php
   2  /**
   3  * $Id: sitemap.php,v 1.1.2.16.2.1 2006/03/01 20:04:11 thorstenr Exp $
   4  *
   5  * Shows the whole FAQ articles
   6  *
   7  * @author       Thomas Zeithaml <seo@annatom.de>
   8  * @author       Thorsten Rinne <thorsten@phpmyfaq.de>
   9  * @since        2005-08-21
  10  * @copyright    (c) 2001-2006 phpMyFAQ Team
  11  *
  12  * The contents of this file are subject to the Mozilla Public License
  13  * Version 1.1 (the "License"); you may not use this file except in
  14  * compliance with the License. You may obtain a copy of the License at
  15  * http://www.mozilla.org/MPL/
  16  *
  17  * Software distributed under the License is distributed on an "AS IS"
  18  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  19  * License for the specific language governing rights and limitations
  20  * under the License.
  21  */
  22  
  23  if (!defined('IS_VALID_PHPMYFAQ')) {
  24      header('Location: http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']));
  25      exit();
  26  }
  27  
  28  Tracking('sitemap', 0);
  29  
  30  if (isset($_REQUEST['letter']) ) {
  31      $currentLetter = $db->escape_string($_REQUEST['letter']);
  32  } else {
  33      $currentLetter = 'A';
  34  }
  35  
  36  switch($DB["type"] ) {
  37  
  38      case 'db2':         // Queries for IBM DB2
  39                          $query_1 = "SELECT DISTINCT substr(thema, 1, 1) AS letters FROM ".SQLPREFIX."faqdata WHERE lang = '".$lang."' AND active = 'yes' ORDER BY letters";
  40                          $query_2 = "SELECT a.thema AS thema, a.id AS id, a.lang AS lang, b.category_id AS category_id, '' AS snap FROM ".SQLPREFIX."faqdata a, ".SQLPREFIX."faqcategoryrelations b WHERE a.id = b.record_id AND substr(thema, 1, 1) = '".$currentLetter."' AND lang = '".$lang."' AND active = 'yes'";
  41                          break;
  42      case 'sqlite':      // Queries for SQLite
  43                          $query_1 = "SELECT DISTINCT substr(thema, 1, 1) AS letters FROM ".SQLPREFIX."faqdata WHERE lang = '".$lang."' AND active = 'yes' ORDER BY letters";
  44                          $query_2 = "SELECT a.thema AS thema, a.id AS id, a.lang AS lang, b.category_id AS category_id, a.content AS snap FROM ".SQLPREFIX."faqdata a, ".SQLPREFIX."faqcategoryrelations b WHERE a.id = b.record_id AND substr(thema, 1, 1) = '".$currentLetter."' AND lang = '".$lang."' AND active = 'yes'";
  45                          break;
  46      default:            // Queries for all other databases
  47                          $query_1 = "SELECT DISTINCT substring(thema, 1, 1) AS letters FROM ".SQLPREFIX."faqdata WHERE lang = '".$lang."' AND active = 'yes' ORDER BY letters";
  48                          $query_2 = "SELECT a.thema AS thema, a.id AS id, a.lang AS lang, b.category_id AS category_id, a.content AS snap FROM ".SQLPREFIX."faqdata a, ".SQLPREFIX."faqcategoryrelations b WHERE a.id = b.record_id AND substring(thema, 1, 1) = '".$currentLetter."' AND lang = '".$lang."' AND active = 'yes'";
  49                          break;
  50  }
  51  
  52  $writeLetters = '<p>';
  53  $result = $db->query($query_1);
  54  while ($row = $db->fetch_object($result)) {
  55      $letters = $row->letters;
  56  
  57      if (preg_match("/^[a-z0-9]/i", $letters)) {
  58  
  59          if (isset($PMF_CONF["mod_rewrite"]) && $PMF_CONF["mod_rewrite"] == "TRUE") {
  60              $writeLetters .= '<a href="sitemap-'.$letters.'_'.$lang.'.html">'.$letters.'</a> ';
  61          } else {
  62             $writeLetters .= '<a href="'.$_SERVER["PHP_SELF"].'?'.$sids.'action=sitemap&amp;letter='.$letters.'&amp;lang='.$lang.'">'.$letters.'</a> ';
  63          }
  64      }
  65  }
  66  $writeLetters .= '</p>';
  67  
  68  $writeMap = '<ul>';
  69  $result = $db->query($query_2);
  70  $oldId = 0;
  71  while ($row = $db->fetch_object($result)) {
  72      if ($oldId != $row->id) {
  73          if (isset($PMF_CONF["mod_rewrite"]) && $PMF_CONF["mod_rewrite"] == "TRUE") {
  74              $writeMap .= '<li><a href="'.$row->category_id.'_'.$row->id.'_'.$row->lang.'.html">'.PMF_htmlentities($row->thema, ENT_NOQUOTES, $PMF_LANG['metaCharset'])."</a><br />\n";
  75          } else {
  76              $writeMap .= '<li><a href="index.php?'.$sids.'action=artikel&amp;cat='.$row->category_id.'&amp;id='.$row->id.'&amp;artlang='.$row->lang.'">'.PMF_htmlentities($row->thema, ENT_NOQUOTES, $PMF_LANG['metaCharset'])."</a><br />\n";
  77          }
  78          $writeMap .= chopString(strip_tags($row->snap), 25). " ...</li>\n";
  79      }
  80      $oldId = $row->id;
  81  }
  82  $writeMap .= '</ul>';
  83  
  84  $tpl->processTemplate ('writeContent', array(
  85                         'writeLetters' => $writeLetters,
  86                         'writeMap' => $writeMap,
  87                         'writeCuttentLetter' => $currentLetter
  88                          ));
  89  
  90  $tpl->includeTemplate('writeContent', 'index');


[ Powered by PHPXref - Served by Debian GNU/Linux ]