[ Index ]
 

Code source de WikiNi 0.4.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/actions/ -> listpages.php (source)

   1  <?php
   2  /*
   3  listpages.php
   4  
   5  Copyright 2002  David DELON
   6  Copyright 2003  Patrick PAUL
   7  This program is free software; you can redistribute it and/or modify
   8  it under the terms of the GNU General Public License as published by
   9  the Free Software Foundation; either version 2 of the License, or
  10  (at your option) any later version.
  11  
  12  This program is distributed in the hope that it will be useful,
  13  but WITHOUT ANY WARRANTY; without even the implied warranty of
  14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15  GNU General Public License for more details.
  16  
  17  You should have received a copy of the GNU General Public License
  18  along with this program; if not, write to the Free Software
  19  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  20  */
  21      
  22  if (!function_exists("TreeView"))
  23  {
  24  	function TreeView($node,$level,$indent=0) 
  25      {
  26          global $wiki;
  27          if ($level>0) {
  28              $head=split(" :: ",$wiki->GetConfigValue("navigation_links"));
  29              // we don't want page from the header  
  30              if (!in_array($node, $head, TRUE)) 
  31              {
  32                  if (($indent>0) && (!($wiki->GetConfigValue("root_page")==$node)) || ($indent==0) )
  33                  {
  34                  // Ignore users too ...                
  35                      if (!$wiki->LoadUser($node))
  36                      {
  37                          if ($indent)
  38                              echo (str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",$indent)),$wiki->Link($node),"<br/>\n";
  39                          $pages = $wiki->LoadAll("select to_tag from ".$wiki->config["table_prefix"]."links where from_tag='".mysql_escape_string($node)."' order by to_tag asc");
  40  
  41                          if (is_array($pages)) {
  42                              foreach ($pages as $page)
  43                              {
  44                                  TreeView($page["to_tag"],$level-1,$indent+1);
  45                              }
  46                          }
  47                      }
  48                  }
  49              }
  50          }
  51      }
  52  }
  53  
  54  if($sortkey = $this->GetParameter("sort")) {
  55      if (($sortkey != "tag") && ($sortkey != "time") && ($sortkey != "owner") && ($sortkey != "user")) $sortkey = "tag";
  56      $pages = $this->LoadAll("select tag, owner, user from ".$this->config["table_prefix"]."pages where latest = 'Y' and comment_on = '' order by $sortkey asc");
  57          foreach ($pages as $page) {
  58                  $this->CachePage($page);
  59          $owner=$page["owner"]?$page["owner"]:"Inconnu";
  60          echo "&nbsp;&nbsp;&nbsp;",$this->ComposeLinkToPage($page["tag"], "", "", 0)," . . . . ",$this->Format($owner),". . . . derni&egrave;re modification par " , $this->Format($page["user"]) , "<br/>\n" ;
  61          }
  62  }
  63  // Tree display
  64  else if ($sortkey = $this->GetParameter("tree"))
  65  {
  66  // No rootpage specified, assume root_page
  67      if ($sortkey=="tree") $sortkey=$this->GetConfigValue("root_page"); 
  68            echo $this->ComposeLinkToPage($sortkey),"<br /><br/>\n" ;
  69  
  70  // 3 levels displayed, It should be parameter ...
  71      TreeView($sortkey,3);
  72  
  73  }
  74  // Default Action :  sort by tag
  75  else 
  76  {
  77      $pages = $this->LoadAll("select tag, owner, user from ".$this->config["table_prefix"]."pages where latest = 'Y' and comment_on = '' order by tag asc");
  78          foreach ($pages as $page) {
  79                  $this->CachePage($page);
  80          $owner=$page["owner"]?$page["owner"]:"Inconnu";
  81          echo "&nbsp;&nbsp;&nbsp;",$this->ComposeLinkToPage($page["tag"], "", "", 0)," . . . . ",$this->Format($owner),"<br/>\n" ;
  82          }
  83  }
  84  ?>


Généré le : Mon Nov 26 12:05:46 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics