~ubuntu-branches/ubuntu/precise/boinc/precise

« back to all changes in this revision

Viewing changes to html/user/top_hosts.php

Tags: 6.12.8+dfsg-1
* New upstream release.
* Simplified debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
require_once("../inc/user.inc");
22
22
require_once("../inc/host.inc");
23
23
require_once("../inc/boinc_db.inc");
24
 
require_once("../inc/translation.inc");
25
24
 
26
25
$config = get_config();
27
26
$hosts_per_page = parse_config($config, "<hosts_per_page>");
62
61
if (!$offset) $offset=0;
63
62
if ($offset % $hosts_per_page) $offset = 0;
64
63
 
65
 
if ($offset < ITEM_LIMIT) {
66
 
    $cache_args = "sort_by=$sort_by&offset=$offset";
67
 
    $cacheddata=get_cached_data(TOP_PAGES_TTL,$cache_args);
68
 
    if ($cacheddata){ //If we have got the data in cache
69
 
        $data = store_to_hosts($cacheddata); // use the cached data
70
 
    } else { //if not do queries etc to generate new data
71
 
        $data = get_top_hosts($offset,$sort_by);
72
 
        set_cache_data(hosts_to_store($data),$cache_args); //save data in cache
73
 
    };
 
64
if ($offset >= ITEM_LIMIT) {
 
65
    error_page(tra("Limit exceeded - Sorry, first %1 items only", ITEM_LIMIT));
 
66
}
 
67
 
 
68
$cache_args = "sort_by=$sort_by&offset=$offset";
 
69
$cacheddata = get_cached_data(TOP_PAGES_TTL, $cache_args);
 
70
if ($cacheddata){
 
71
    $data = store_to_hosts($cacheddata);
74
72
} else {
75
 
    error_page("Limit exceeded - Sorry, first ".ITEM_LIMIT." items only");
76
 
}
77
 
 
78
 
 
79
 
//Now display what we've got (either gotten from cache or from DB)
 
73
    $data = get_top_hosts($offset,$sort_by);
 
74
    set_cache_data(hosts_to_store($data), $cache_args);
 
75
};
 
76
 
 
77
 
 
78
// Now display what we've got (either gotten from cache or from DB)
 
79
//
80
80
page_head(tra("Top hosts"));
81
81
top_host_table_start($sort_by);
82
82
$i = 1 + $offset;
88
88
echo "</table>\n<p>";
89
89
if ($offset > 0) {
90
90
    $new_offset = $offset - $hosts_per_page;
91
 
    echo "<a href=top_hosts.php?sort_by=$sort_by&offset=$new_offset>Previous ".$hosts_per_page."</a> | ";
 
91
    echo "<a href=top_hosts.php?sort_by=$sort_by&amp;offset=$new_offset>".tra("Previous %1", $hosts_per_page)."</a> | ";
92
92
 
93
93
}
94
94
if ($n==$hosts_per_page){ //If we aren't on the last page
95
95
    $new_offset = $offset + $hosts_per_page;
96
 
    echo "<a href=top_hosts.php?sort_by=$sort_by&offset=$new_offset>Next ".$hosts_per_page."</a>";
 
96
    echo "<a href=top_hosts.php?sort_by=$sort_by&amp;offset=$new_offset>".tra("Next %1", $hosts_per_page)."</a>";
97
97
}
98
98
 
99
99
page_tail();