Subversion Repositories Applications.papyrus

Rev

Rev 1087 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
831 florian 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
$forums = phorum_db_get_forums( 0, $parent_id );
23
 
24
$PHORUM["DATA"]["FORUMS"] = array();
25
 
26
$forums_shown=false;
27
 
28
foreach( $forums as $forum ) {
29
 
30
    if ( $forum["folder_flag"] ) {
31
 
32
        $forum["url"] = phorum_get_url( PHORUM_INDEX_URL, $forum["forum_id"] );
33
 
34
    } else {
35
 
36
        if($PHORUM["hide_forums"] && !phorum_user_access_allowed(PHORUM_USER_ALLOW_READ, $forum["forum_id"])){
37
            continue;
38
        }
39
 
40
        $forum["url"] = phorum_get_url( PHORUM_LIST_URL, $forum["forum_id"] );
41
 
42
        // if there is only one forum in Phorum, redirect to it.
43
        if ( $parent_id==0 && count( $forums ) < 2 ) {
44
            phorum_redirect_by_url($forum['url']);
45
            exit();
46
        }
47
 
48
        if ( $forum["message_count"] > 0 ) {
49
            $forum["last_post"] = phorum_date( $PHORUM["long_date"], $forum["last_post_time"] );
50
        } else {
51
            $forum["last_post"] = "&nbsp;";
52
        }
53
 
54
        if($PHORUM["DATA"]["LOGGEDIN"] && $PHORUM["show_new_on_index"]){
55
            list($forum["new_messages"], $forum["new_threads"]) = phorum_db_newflag_get_unread_count($forum["forum_id"]);
56
        }
57
    }
58
 
59
    $forums_shown=true;
60
 
61
    $PHORUM["DATA"]["FORUMS"][] = $forum;
62
}
63
 
64
if(!$forums_shown){
65
    // we did not show any forums here, show an error-message
66
    // set all our URL's
67
    phorum_build_common_urls();
68
    unset($PHORUM["DATA"]["URL"]["TOP"]);
69
    $PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["NoForums"];
70
 
71
    include phorum_get_template( "header" );
72
    phorum_hook( "after_header" );
73
    include phorum_get_template( "message" );
74
    phorum_hook( "before_footer" );
75
    include phorum_get_template( "footer" );
76
 
77
} else {
78
 
79
    $PHORUM["DATA"]["FORUMS"]=phorum_hook("index", $PHORUM["DATA"]["FORUMS"]);
80
 
81
    // set all our URL's
82
    phorum_build_common_urls();
83
 
84
    // should we show the top-link?
85
    if($PHORUM['forum_id'] == 0 || $PHORUM['vroot'] == $PHORUM['forum_id']) {
86
        unset($PHORUM["DATA"]["URL"]["INDEX"]);
87
    }
88
 
89
    include phorum_get_template( "header" );
90
    phorum_hook("after_header");
91
    include phorum_get_template( "index_classic" );
92
    phorum_hook("before_footer");
93
    include phorum_get_template( "footer" );
94
}
95
 
96
?>