[ Index ]
 

Code source de Phorum 5.1.25

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/include/ -> index_new.php (source)

   1  <?php
   2  
   3  ////////////////////////////////////////////////////////////////////////////////
   4  //                                                                            //
   5  //   Copyright (C) 2006  Phorum Development Team                              //
   6  //   http://www.phorum.org                                                    //
   7  //                                                                            //
   8  //   This program is free software. You can redistribute it and/or modify     //
   9  //   it under the terms of either the current Phorum License (viewable at     //
  10  //   phorum.org) or the Phorum License that was distributed with this file    //
  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.                     //
  15  //                                                                            //
  16  //   You should have received a copy of the Phorum License                    //
  17  //   along with this program.                                                 //
  18  ////////////////////////////////////////////////////////////////////////////////
  19  
  20  if(!defined("PHORUM")) return;
  21  
  22  if($PHORUM["forum_id"]==0){
  23  
  24      $forums[0] = array(
  25                      "forum_id" => 0,
  26                      "folder_flag" => 1,
  27                      "vroot" => 0
  28                   );
  29  } else {
  30  
  31      $forums = phorum_db_get_forums( $PHORUM["forum_id"] );
  32  }
  33  
  34  if($PHORUM["vroot"]==$PHORUM["forum_id"]){
  35      $more_forums = phorum_db_get_forums( 0, $PHORUM["forum_id"] );
  36      foreach($more_forums as $forum_id => $forum){
  37          if(empty($forums[$forum_id])){
  38              $forums[$forum_id]=$forum;
  39          }
  40      }
  41      $folders[$PHORUM["forum_id"]]=$PHORUM["forum_id"];
  42  }
  43  
  44  $PHORUM["DATA"]["FORUMS"] = array();
  45  
  46  $forums_shown=false;
  47  
  48  // create the top level folder
  49  
  50  foreach( $forums as $key=>$forum ) {
  51      if($forum["folder_flag"] && $forum["vroot"]==$PHORUM["vroot"]){
  52          $folders[$key]=$forum["forum_id"];
  53          $forums[$key]["url"] = phorum_get_url( PHORUM_INDEX_URL, $forum["forum_id"] );
  54  
  55          $sub_forums = phorum_db_get_forums( 0, $forum["forum_id"] );
  56          foreach($sub_forums as $sub_forum){
  57              if(!$sub_forum["folder_flag"]){
  58                  $folder_forums[$sub_forum["parent_id"]][]=$sub_forum;
  59              }
  60          }
  61      }
  62  }
  63  
  64  
  65  foreach( $folders as $folder_key=>$folder_id ) {
  66  
  67      if(!isset($folder_forums[$folder_id])) continue;
  68  
  69      $shown_sub_forums=array();
  70  
  71      foreach($folder_forums[$folder_id] as $key=>$forum){
  72  
  73          if($PHORUM["hide_forums"] && !phorum_user_access_allowed(PHORUM_USER_ALLOW_READ, $forum["forum_id"])){
  74              unset($folder_forums[$folder_id][$key]);
  75              continue;
  76          }
  77  
  78          $forum["url"] = phorum_get_url( PHORUM_LIST_URL, $forum["forum_id"] );
  79          $forum["url_markread"] = phorum_get_url( PHORUM_INDEX_URL, $forum["forum_id"], "markread", $PHORUM['forum_id'] );
  80          if(isset($PHORUM['use_rss']) && $PHORUM['use_rss']) {
  81              $forum["url_rss"] = phorum_get_url( PHORUM_RSS_URL, $forum["forum_id"] );
  82          }
  83  
  84  
  85          if ( $forum["message_count"] > 0 ) {
  86              $forum["last_post"] = phorum_date( $PHORUM["long_date"], $forum["last_post_time"] );
  87          } else {
  88              $forum["last_post"] = "&nbsp;";
  89          }
  90  
  91          if($PHORUM["DATA"]["LOGGEDIN"] && $PHORUM["show_new_on_index"]){
  92              list($forum["new_messages"], $forum["new_threads"]) = phorum_db_newflag_get_unread_count($forum["forum_id"]);
  93          }
  94  
  95          $shown_sub_forums[] = $forum;
  96  
  97      }
  98  
  99      if(count($shown_sub_forums)){
 100          $PHORUM["DATA"]["FORUMS"][]=$forums[$folder_key];
 101          $PHORUM["DATA"]["FORUMS"]=array_merge($PHORUM["DATA"]["FORUMS"], $shown_sub_forums);
 102      }
 103  
 104  }
 105  
 106  // set all our URL's
 107  phorum_build_common_urls();
 108  
 109  if(!count($PHORUM["DATA"]["FORUMS"])){
 110      include phorum_get_template( "header" );
 111      phorum_hook("after_header");
 112      $PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["NoRead"];
 113      include phorum_get_template( "message" );
 114      phorum_hook("before_footer");
 115      include phorum_get_template( "footer" );
 116      return;
 117  }
 118  
 119  // should we show the top-link?
 120  if($PHORUM['forum_id'] == 0 || $PHORUM['vroot'] == $PHORUM['forum_id']) {
 121      unset($PHORUM["DATA"]["URL"]["INDEX"]);
 122  }
 123  
 124  $PHORUM["DATA"]["FORUMS"]=phorum_hook("index", $PHORUM["DATA"]["FORUMS"]);
 125  
 126  include phorum_get_template( "header" );
 127  phorum_hook("after_header");
 128  include phorum_get_template( "index_new" );
 129  phorum_hook("before_footer");
 130  include phorum_get_template( "footer" );
 131  
 132  ?>


Généré le : Thu Nov 29 12:22:27 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics