Skip to content
Snippets Groups Projects
Commit e0b1e84d authored by Graham Cole's avatar Graham Cole
Browse files

basically kill off the bananas component, apart from for non-members

parent 90e690d6
No related branches found
No related tags found
No related merge requests found
<?php
/* as far as bananas are concerned, year ends after the beach party */
$yearstart = date("Y")."-06-30";
include_once("../lib/members.php");
/* Banana viewing component. Looking a little obsolete since most of this is now in the members component */
$members = new Members;
/* Banana viewing component. Mostly obsolete since most of this is now in the members component */
$banana_index = array_search("Bananas", $pathlist);
if ((sizeof($pathlist) > $banana_index + 1) && (trim($pathlist[$banana_index + 1]) != "")) {
$mode = "detail";
$who = $pathlist[$banana_index + 1];
} else {
$mode = "summary";
// User wasn't looking for anything in particular, so bump them to the Members page
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://$preferred_hostname$baseurl/Community/Members/");
}
if (isset($who))
$smarty->assign('who', "$who");
// banana admin bits
/* redirect requests for members' bananas to Members component. Only serve banana info for non-members (e.g. LIS ;-)) */
if ($mode == "detail") {
$smarty->assign("awards",$DB->GetAll("SELECT *, date_trunc('second', whn) FROM awards WHERE username=? AND whn > ? ORDER BY whn DESC", array($who, $yearstart)));
if ($session->loggedin) {
include("../lib/banana-admin.php");
if (count($members->memberView($who)) > 0) {
// this is actually a real member, so serve a redirect and let Members handle it
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://$preferred_hostname$baseurl/Community/Members/$who");
} else {
// banana admin bits
if ($mode == "detail") {
if ($session->loggedin) {
include("../lib/banana-admin.php");
}
}
// attempt to find some bananas for this name in the database
$smarty->assign("awards",$DB->GetAll("SELECT *, date_trunc('second', whn) FROM awards WHERE username=? ORDER BY whn DESC", array($who)));
}
$users = $DB->GetAll("SELECT username, sum(score) AS sum FROM awards WHERE whn > ? GROUP BY username ORDER BY sum(score) DESC, username", array($yearstart));
if (isset($who))
$smarty->assign('who', "$who");
$smarty->assign('mode', "$mode");
$smarty->assign('users', $users);
......
......@@ -31,14 +31,3 @@
</div>
{/if}
<h3>Banana Summary</h3>
<table border="0" cellpadding="5">
{foreach name=users from=$users key=key2 item=user}
<tr>
<td><a href="/Community/Bananas/{$user.username}">{$user.username}</a></td>
<td>{$user.sum}</td>
<td>{bananaprint score=$user.sum}</td>
</tr>
{/foreach}
</table>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment