~ubuntu-branches/ubuntu/lucid/boinc/lucid

« back to all changes in this revision

Viewing changes to html/user/forum_index.php

  • Committer: Bazaar Package Importer
  • Author(s): Frank S. Thomas, Frank S. Thomas
  • Date: 2008-05-31 08:02:47 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20080531080247-4ce890lp2rc768cr
Tags: 6.2.7-1
[ Frank S. Thomas ]
* New upstream release.
  - BOINC Manager: Redraw disk usage charts immediately after connecting to
    a (different) client. (closes: 463823)
* debian/copyright:
  - Added the instructions from debian/README.Debian-source about how
    repackaged BOINC tarballs can be reproduced because DevRef now
    recommends to put this here instead of in the afore-mentioned file.
  - Updated for the new release.
* Removed the obsolete debian/README.Debian-source.
* For consistency upstream renamed the core client and the command tool
  ("boinc_client" to "boinc" and "boinc_cmd" to "boinccmd"). Done the same
  in all packages and created symlinks with the old names for the binaries
  and man pages. Also added an entry in debian/boinc-client.NEWS explaining
  this change.
* debian/rules: Do not list Makefile.ins in the clean target individually,
  just remove all that can be found.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
 
/**
3
 
 * This is the forum index
4
 
 * It shows the categories available and each of the forums that are
5
 
 * contained in those categories
6
 
 **/
 
2
 
 
3
// Forum index
 
4
// shows the categories and the forums in each category
7
5
 
8
6
require_once('../inc/forum.inc');
9
 
require_once('../inc/forum_std.inc');
10
 
db_init();
11
 
 
12
 
get_logged_in_user(false);
13
 
 
14
 
function forum_summary($forum) {
15
 
    echo '
16
 
        <tr class="row1">
 
7
require_once('../inc/pm.inc');
 
8
require_once('../inc/time.inc');
 
9
 
 
10
 
 
11
$user = get_logged_in_user(false);
 
12
 
 
13
// Process request to mark all posts as read
 
14
//
 
15
if ((get_int("read", true) == 1)) {
 
16
    if ($user) {
 
17
        check_tokens($user->authenticator);
 
18
        BoincForumPrefs::lookup($user);
 
19
        $now = time();
 
20
        $user->prefs->update("mark_as_read_timestamp=$now");
 
21
        Header("Location: ".get_str("return", true));
 
22
    }
 
23
}
 
24
 
 
25
function show_forum_summary($forum) {
 
26
    switch ($forum->parent_type) {
 
27
    case 0:
 
28
        $t = $forum->title;
 
29
        $d = $forum->description;
 
30
        break;
 
31
    case 1:
 
32
        $team = BoincTeam::lookup_id($forum->category);
 
33
        $t = $forum->title;
 
34
        if (!strlen($t)) $t = $team->name;
 
35
        $d = $forum->description;
 
36
        if (!strlen($d)) $d = "Discussion among members of $team->name";
 
37
        break;
 
38
    }
 
39
    echo "
 
40
        <tr class=\"row1\">
17
41
        <td>
18
42
            <em>
19
 
            <a href="forum_forum.php?id='.$forum->getID().'">'.$forum->getTitle().'
 
43
            <a href=\"forum_forum.php?id=$forum->id\">$t
20
44
            </a></em>
21
 
            <br><font size="-2">'.$forum->getDescription().'
 
45
            <br><span class=\"smalltext\">$d</span>
22
46
        </td>
23
 
        <td>'.$forum->getThreadCount().'</td>
24
 
        <td>'.$forum->getPostCount().'</td>
25
 
        <td>'.time_diff_str($forum->getLastTimestamp(), time()).'</td>
26
 
    </tr>';
 
47
        <td>$forum->threads</td>
 
48
        <td>$forum->posts</td>
 
49
        <td>".time_diff_str($forum->timestamp, time())."</td>
 
50
    </tr>";
27
51
}
28
52
 
29
 
page_head(tr(FORUM_TITLE));
 
53
page_head(tra("%1 Message boards", PROJECT));
30
54
 
31
55
echo "
32
56
    <p>
36
60
    </p>
37
61
";
38
62
 
39
 
show_forum_title(NULL, NULL);
40
 
start_forum_table(array(tr(FORUM_TOPIC), tr(FORUM_THREADS), tr(FORUM_POSTS), tr(FORUM_LAST_POST)));
 
63
show_forum_header($user);
41
64
 
42
 
$categories = $mainFactory->getCategories();
43
 
$i=0;
44
 
while ($categories[$i]){
45
 
    if (!$categories[$i]->getType()) {
 
65
$categories = BoincCategory::enum("is_helpdesk=0 order by orderID");
 
66
$first = true;
 
67
foreach ($categories as $category) {
 
68
    if ($first) {
 
69
        $first = false;
 
70
        show_forum_title($category, NULL, NULL);
 
71
        show_mark_as_read_button($user);
 
72
        echo "<p>";
 
73
        start_forum_table(
 
74
            array(tra("Topic"), tra("Threads"), tra("Posts"), tra("Last post"))
 
75
        );
 
76
    }
 
77
    if (strlen($category->name)) {
46
78
        echo '
47
79
            <tr class="subtitle">
48
 
                <td class="category" colspan="4">'.$categories[$i]->getName().'</td>
 
80
            <td class="category" colspan="4">'.$category->name.'</td>
49
81
            </tr>
50
82
        ';
51
 
        $forums = $categories[$i]->getForums();
52
 
        $ii=0;
53
 
        // Show a summary of each of the forums
54
 
        while ($forums[$ii]){
55
 
            echo forum_summary($forums[$ii]);
56
 
            $ii++;
 
83
    }
 
84
    $forums = BoincForum::enum("parent_type=0 and category=$category->id order by orderID");
 
85
    foreach ($forums as $forum) {
 
86
        show_forum_summary($forum);
 
87
    }
 
88
}
 
89
 
 
90
if ($user && $user->teamid) {
 
91
    $forum = BoincForum::lookup("parent_type=1 and category=$user->teamid");
 
92
    if ($forum) {
 
93
        show_forum_summary($forum);
 
94
    }
 
95
}
 
96
end_table();
 
97
 
 
98
if ($user) {
 
99
    $subs = BoincSubscription::enum("userid=$user->id");
 
100
    if (count($subs)) {
 
101
        echo "<h3>Subscribed threads</h2>";
 
102
        show_thread_and_context_header();
 
103
        foreach ($subs as $sub) {
 
104
            $thread = BoincThread::lookup_id($sub->threadid);
 
105
            if (!$thread) {
 
106
                BoincSubscription::delete($user->id, $sub->threadid);
 
107
                continue;
 
108
            }
 
109
            if ($thread->hidden) continue;
 
110
            show_thread_and_context($thread, $user);
57
111
        }
 
112
        end_table();
58
113
    }
59
 
    $i++;
60
114
}
61
115
 
62
 
end_table();
63
116
page_tail();
64
117
flush();
65
 
cleanup_forum_log();
 
118
BoincForumLogging::cleanup();
 
119
 
 
120
$cvs_version_tracker[]="\$Id: forum_index.php 15070 2008-04-21 14:04:01Z boincadm $";  //Generated automatically - do not edit
66
121
?>