<?php
// -------------------------------------------------------------------------//
// Nuked-KlaN - PHP Portal //
//
http://www.nuked-klan.org //
// -------------------------------------------------------------------------//
// This program is free software. you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License. //
// -------------------------------------------------------------------------//
if (eregi("block_roster.php", $_SERVER['PHP_SELF']))
{
die ("You cannot open this page directly");
}
function affich_block_roster($blok)
{
global $nuked;
$team_id = $blok['content'];
$blok['content'] = "";
if ($team_id != "")
{
$where = "WHERE team = '" . $team_id . "' OR team2 = '" . $team_id . "' OR team3 = '" . $team_id . "'";
}
else
{
$sql_team = mysql_query("SELECT cid FROM " . TEAM_TABLE);
$nb_team = mysql_num_rows($sql_team);
if ($nb_team > 0) $where = "WHERE team > 0 OR team2 > 0 OR team3 > 0";
else $where = "WHERE niveau > 1";
}
$blok['content'] .= "<br><table width=\"100%\" cellspacing=\"0\" cellpadding=\"1\">\n";
$sql = mysql_query("SELECT pseudo, mail, country FROM " . USER_TABLE . " " . $where . " ORDER BY ordre, pseudo");
$sql2 = mysql_query("SELECT age, FROM " . USER_DETAIL_TABLE . " WHERE user_id = '" . $id_user . "'");
while (list($pseudo,
$birthday, $country) = mysql_fetch_array($sql))
{
list ($pays, $ext) = split ('[.]', $country);
$nick_team = $nuked['tag_pre'] . $pseudo . $nuked['tag_suf'];
if ($birthday != "")
{
list ($jour, $mois, $an) = split ('[/]', $birthday);
$age = date("Y") - $an;
if (date("m") < $mois)
{
$age = $age-1;
}
if (date("d") < $jour && date("m") == $mois)
{
$age = $age - 1;
}
}
else
{
$age = " ";
}
$blok['content'] .= "<tr><td style=\"width: 20%;\" align=\"center\"><img src=\"images/flags/" . $country . "\" alt=\"\" title=\"" . $pays . "\" /></td>\n"
. "<td style=\"width: 60%;\"><a href=\"index.php?file=Members&op=detail&autor=" . urlencode($pseudo) . "\"><b>" . $nick_team . "</b></a></td>\n"
. "<td style=\"width: 20%;\" align=\"center\">
" . $age . "</td></tr>\n";
}
$blok['content'] .= "</table><br>\n";
return $blok;
}
function edit_block_roster($bid)
{
global $nuked, $language;
$sql = mysql_query("SELECT active, position, titre, module, content, type, nivo, page FROM " . BLOCK_TABLE . " WHERE bid = '" . $bid . "'");
list($active, $position, $titre, $modul, $content, $type, $nivo, $pages) = mysql_fetch_array($sql);
$titre = stripslashes($titre);
$titre = htmlentities($titre);
if ($active == 1) $checked1 = "selected=\"selected\"";
else if ($active == 2) $checked2 = "selected=\"selected\"";
else $checked0 = "selected=\"selected\"";
echo "<a href=\"#\" onclick=\"javascript:window.open('help/" . $language . "/block.html','Help','toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=0,copyhistory=0,menuBar=0,width=350,height=300');return(false)\">\n"
. "<img style=\"border: 0;\" src=\"help/help.gif\" alt=\"\" title=\"" . _HELP . "\" /></a><div style=\"text-align: center;\"><h3>" . _ADMINBLOCK . "</h3></div>\n"
. "<form method=\"post\" action=\"index.php?file=Admin&page=block&op=modif_block\">\n"
. "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\">\n"
. "<tr><td><b>" . _TITLE . "</b></td><td><b>" . _BLOCK . "</b></td><td><b>" . _POSITION . "</b></td><td><b>" . _LEVEL . "</b></td></tr>\n"
. "<tr><td align=\"center\"><input type=\"text\" name=\"titre\" size=\"40\" value=\"" . $titre . "\" /></td>\n"
. "<td align=\"center\"><select name=\"active\">\n"
. "<option value=\"1\" " . $checked1 . ">" . _LEFT . "</option>\n"
. "<option value=\"2\" " . $checked2 . ">" . _RIGHT . "</option>\n"
. "<option value=\"0\" " . $checked0 . ">" . _OFF . "</option></select></td>\n"
. "<td align=\"center\"><input type=\"text\" name=\"position\" size=\"2\" value=\"" . $position . "\" /></td>\n"
. "<td align=\"center\"><select name=\"nivo\"><option>" . $nivo . "</option>\n"
. "<option>0</option>\n"
. "<option>1</option>\n"
. "<option>2</option>\n"
. "<option>3</option>\n"
. "<option>4</option>\n"
. "<option>5</option>\n"
. "<option>6</option>\n"
. "<option>7</option>\n"
. "<option>8</option>\n"
. "<option>9</option></select></td></tr><tr><td colspan=\"4\"><b>" . _TEAM . " :</b> <select name=\"content\"><option value=\"\">" . _INFOALL . "</option>\n";
$sql2 = mysql_query("SELECT cid, titre FROM " . TEAM_TABLE . " ORDER BY ordre, titre");
while (list($team_id, $team) = mysql_fetch_array($sql2))
{
$team = stripslashes($team);
$team = htmlentities($team);
if ($team_id == $content) $checked3 = "selected=\"selected\"";
else $checked3 = "";
echo "<option value=\"" . $team_id . "\" " . $checked3 . ">" . $team . "</option>\n";
}
echo "</select></td></tr><tr><td colspan=\"4\"> </td></tr>\n"
. "<tr><td colspan=\"4\" align=\"center\"><b>" . _PAGESELECT . " :</b></td></tr><tr><td colspan=\"4\"> </td></tr>\n"
. "<tr><td colspan=\"4\" align=\"center\"><select name=\"pages[]\" size=\"8\" multiple=\"multiple\">\n";
select_mod2($pages);
echo "</select></td></tr><tr><td colspan=\"4\" align=\"center\"><br />\n"
. "<input type=\"hidden\" name=\"type\" value=\"" . $type . "\" />\n"
. "<input type=\"hidden\" name=\"bid\" value=\"" . $bid . "\" />\n"
. "<input type=\"submit\" name=\"send\" value=\"" . _MODIFBLOCK . "\" />\n"
. "</td></tr></table>\n"
. "<div style=\"text-align: center;\"><br />[ <a href=\"index.php?file=Admin&page=block\"><b>" . _BACK . "</b></a> ]</div></form><br />\n";
}
?>