function section_contact() { $obj = mysql_fetch_object(mysql_query("select text from bzl_siteconfig where name='contact'")); echo nl2br($obj->text); echo '<p><TABLE cellspacing=0 align=center><TR><TD colspan=3> <HR>Matches can be reported to any of the following:<BR><BR></td></tr>'; $roles = getRolesWithPermission('show'); $res = sqlQuery("SELECT p.id, p.callsign, r.name as level from l_player p, bzl_roles r \n WHERE r.id = p.role_id AND r.id IN (" . join(',', $roles) . ") ORDER BY level"); while ($row = mysql_fetch_object($res)) { if (++$line % 2) { $cl = "rowEven"; } else { $cl = "rowOdd"; } echo "<tr class=\"{$cl}\"><td width=40% align=right>" . htmlLink($row->callsign, 'playerinfo', "id={$row->id}") . '</td><td width=10></td><td align=left>'; if (isAuthenticated()) { echo htmlURLbutton('BZmail', 'sendmessage', "pid={$row->id}"); } echo '</td></tr>'; } echo '</table>'; }
function section_bzforums() { require_once 'lib/common.php'; $allowDelete = isFuncAllowed('post_delete'); $allowNew = isFuncAllowed('post_new'); $allowReply = isFuncAllowed('post_reply'); $allowEdit = isFuncAllowed('post_edit'); $allowLock = isFuncAllowed('topic_lock'); $allowSticky = isFuncAllowed('topic_sticky'); $allowTDelete = isFuncAllowed('topic_delete'); $allowViewDeleted = isFuncAllowed('topic_view_deleted'); $showRoles = isFuncAllowed('show_roles'); $POSTSPERPAGE = 10; $link = 'bzforums'; $utcNOW = gmdate("Y-m-d H:i:s"); // Variables: // top = which post is first on the page i think $vars = array('top', 'threadid', 'forumid', 'id', 'action'); foreach ($vars as $var) { ${$var} = $_REQUEST[$var]; } // Get and print the forum title if (isset($forumid)) { $row = mysql_fetch_object(mysql_query("select title, status from l_forum where id={$forumid}")); echo 'Forum: <a href="index.php?link=' . $link . '&' . SID . '"> <font size=+1>BZforums</font></a><font size=+1><i> / </i></font> <a href="index.php?link=' . $link . '&forumid=' . $forumid . '&' . SID . '"> <font size=+1>' . $row->title . '</font></a><hr>'; if ($row->status != 'Open') { print "This forum is not accessible. Sorry"; return; } } // check if we need to change permissions (eg, disallow reply/post for locked topics) if (isset($threadid)) { $threadid = intval($threadid); $row = mysql_fetch_object(mysql_query("select status, is_sticky from l_forumthread where id={$threadid}")); if ($row->status == 'locked' && !isAdmin()) { $allowNew = false; $allowReply = false; } elseif ($row->status == 'deleted' && !$allowViewDeleted) { errorPage('This topic is deleted'); return; } $threadstatus = $row->status; $threadsticky = $row->is_sticky; } // Perform deletion if ($allowDelete && $action == 'delete2' && $id != '') { $id = intval($id); mysql_query("DELETE FROM l_forummsg WHERE msgid = '{$id}' LIMIT 1") or die(mysql_error()); // Check if there is any message left for that thread $threadid = intval($threadid); $res = mysql_query("SELECT count(1) FROM l_forummsg WHERE threadid = '{$threadid}'") or die(mysql_error()); $row = mysql_fetch_row($res); if ($row[0] == 0) { // No messages in thread: deleting thread - jumo to threadlist mysql_query("DELETE FROM l_forumthread WHERE id = '{$threadid}' LIMIT 1") or die(mysql_error()); header("Location: index.php?link=bzforums&forumid={$forumid}"); exit; } $action = ''; } elseif ($action == 'lock') { $threadid = intval($threadid); if (!$allowLock) { errorPage("You are not allowed to lock topics"); return; } mysql_query("UPDATE l_forumthread SET status = 'locked', status_by = {$_SESSION['playerid']}, \n status_at = '{$utcNOW}' WHERE id = '{$threadid}' and status != 'locked' LIMIT 1") or die(mysql_error()); $action = ''; $threadstatus = 'locked'; } elseif ($action == 'revive') { $threadid = intval($threadid); if (!$allowLock && $threadstatus == 'locked') { errorPage("You are not allowed to unlock topics"); return; } if (!$allowTDelete && $threadstatus == 'deleted') { errorPage("You are not allowed to undelete topics"); return; } mysql_query("UPDATE l_forumthread SET status = 'normal', \n status_by = {$_SESSION['playerid']}, status_at = '{$utcNOW}' WHERE id = '{$threadid}' LIMIT 1") or die(mysql_error()); $action = ''; $threadstatus = 'normal'; } elseif ($action == 'deletetopic') { $threadid = intval($threadid); if (!$allowTDelete) { errorPage("You are not allowed to delete topics"); return; } mysql_query("UPDATE l_forumthread SET status = 'deleted', status_by = {$_SESSION['playerid']}, \n status_at = '{$utcNOW}' WHERE id = '{$threadid}' and status != 'deleted' LIMIT 1") or die(mysql_error()); $action = ''; $threadstatus = 'deleted'; } elseif ($action == 'sticky') { $threadid = intval($threadid); if (!$allowSticky) { errorPage("You are not allowed to use sticky"); return; } mysql_query("UPDATE l_forumthread SET is_sticky = 1 WHERE id = '{$threadid}' LIMIT 1") or die(mysql_error()); $action = ''; $threadsticky = 1; } elseif ($action == 'unsticky') { $threadid = intval($threadid); if (!$allowSticky) { errorPage("You are not allowed to use sticky"); return; } mysql_query("UPDATE l_forumthread SET is_sticky = 0 WHERE id = '{$threadid}' LIMIT 1") or die(mysql_error()); $action = ''; $threadsticky = 0; } elseif ($action == 'new' || $action == 'reply' || $action == 'edit') { if ($action == 'new' && !$allowNew) { errorPage("You are not allowed to post new topics"); return; } elseif ($action == 'reply' && !$allowReply) { errorPage("You are not allowed to reply"); return; } elseif ($action == 'edit' && !$allowEdit) { errorPage("You are not allowed to edit"); return; } echo '<form method=post name="post" action="index.php">' . SID_FORM; echo '<input type=hidden name=threadid value=' . $threadid . '>'; echo '<input type=hidden name=link value="' . $link . '">'; echo '<input type=hidden name=forumid value=' . $forumid . '>'; echo '<input type=hidden name=id value=' . $id . '>'; echo '<input type=hidden name=top value=' . $top . '>' . snFormInit(); echo '<table border=0 align=center cellspacing=0 cellpadding=0>'; echo '<tr class=tablehead><td colspan=2 align=center>'; if ($action == 'new') { echo 'New Topic'; } elseif ($action == 'reply') { echo 'New Reply'; } else { echo "Edit message"; } echo '</td></tr>'; echo '<tr><td>Subject: </td><td>'; if ($action == 'new') { print '<input type=text name=subject size=50 maxlength=80>'; } else { $row = mysql_fetch_object(mysql_query("select subject from l_forumthread where id={$threadid}")); echo '<i>' . $row->subject . '</i>'; } print '</td></tr>'; echo '<tr><td valign="top">Message</td><td>'; if ($action == 'edit') { $id = intval($id); $row = mysql_fetch_object(mysql_query("select msg from l_forummsg where msgid={$id}")); print '<textarea cols=50 rows=10 name=forummsg>' . htmlspecialchars($row->msg) . '</textarea>'; } else { print '<textarea cols=50 rows=10 name=forummsg></textarea>'; } print '</td></tr>'; // Form buttons echo '<tr><td colspan=2 align=center>' . htmlFormButton('OK', 'save_' . $action) . ' ' . htmlFormButton('Cancel', 'cancel', CLRBUT) . '</td></tr>'; print '<tr><td>Smiley:</td><td align="middle">'; $res = mysql_query("select image, code from l_smiley GROUP BY image") or die(mysql_error()); while ($row = mysql_fetch_object($res)) { print '<a href="#" onclick="javascript:document.post.forummsg.value += \' ' . $row->code . '\'"><img border=0 src="' . THEME_DIR . 'smilies/' . $row->image . '" border=0/></a> '; } print "</tr>"; echo '</table></form>'; } elseif (isset($_POST['save_new'])) { $forummsg = section_bzforums_stripExtraLF($_POST['forummsg']); $subject = $_POST['subject']; // New topic if ($allowNew) { mysql_query("INSERT INTO l_forumthread (id,forumid,creatorid,subject) VALUES(0, {$forumid}, {$_SESSION['playerid']}, '" . $subject . "')") or die(mysql_error()); $threadid = mysql_insert_id(); mysql_query("insert into l_forummsg(msgid,threadid,fromid,msg,datesent) \n values(0, {$threadid}, {$_SESSION['playerid']}, '" . $forummsg . "', '{$utcNOW}')") or die(mysql_error()); session_refresh_all(); } else { errorPage("You are not allowed to post new topics"); return; } } elseif (isset($_POST['save_reply'])) { $forummsg = section_bzforums_stripExtraLF($_POST['forummsg']); if ($allowReply) { snCheck('bzforums', "forumid={$forumid}&threadid={$threadid}"); mysql_query("insert into l_forummsg(msgid,threadid,fromid,msg,datesent) \n values(0, {$threadid}, {$_SESSION['playerid']}, '" . $forummsg . "', '{$utcNOW}')"); session_refresh_all(); } else { errorPage("You are not allowed to reply"); return; } } elseif (isset($_POST['save_edit'])) { $forummsg = section_bzforums_stripExtraLF($_POST['forummsg']); if ($allowReply) { $id = intval($id); snCheck('bzforums', "forumid={$forumid}&threadid={$threadid}"); // mysql_query("UPDATE l_forummsg SET msg = '$forummsg' WHERE msgid = '$id'"); mysql_query("UPDATE l_forummsg SET msg = '{$forummsg}', status = 'edited', \n status_by = {$_SESSION['playerid']}, status_at = '{$utcNOW}' WHERE msgid = '{$id}'"); session_refresh_all(); } else { errorPage("You are not allowed to edit"); return; } } if (isset($threadid)) { // Display a thread // Control buttons // 06/28/2002: $POSTSPERPAGE posts/page max. if (!isset($top)) { $top = 0; $newtop = 0; } if ($top == "") { $top = 0; $newtop = 0; } if ($action == '') { echo '<TABLE align=right><TR>'; if ($allowReply && $threadstatus != 'deleted') { echo '<td>' . htmlURLbutton('Add Reply', $link, "forumid={$forumid}&threadid={$threadid}&action=reply&top={$top}") . '</td>'; } if ($allowLock && $threadstatus != 'locked') { echo '<td>' . htmlURLbutton('Lock topic', $link, "forumid={$forumid}&threadid={$threadid}&action=lock&top={$top}", ADMBUT) . '</td>'; } if ($allowTDelete && $threadstatus != 'deleted') { echo '<td>' . htmlURLbutton('Delete topic', $link, "forumid={$forumid}&threadid={$threadid}&action=deletetopic&top={$top}", ADMBUT) . '</td>'; } if ($allowLock && $threadstatus == 'locked' || $allowTDelete && $threadstatus == 'deleted') { echo '<td>' . htmlURLbutton('Revive topic', $link, "forumid={$forumid}&threadid={$threadid}&action=revive&top={$top}", ADMBUT) . '</td>'; } if ($allowSticky) { if ($threadsticky) { echo '<td>' . htmlURLbutton('Remove sticky', $link, "forumid={$forumid}&threadid={$threadid}&action=unsticky&top={$top}", ADMBUT) . '</td>'; } else { echo '<td>' . htmlURLbutton('Make sticky', $link, "forumid={$forumid}&threadid={$threadid}&action=sticky&top={$top}", ADMBUT) . '</td>'; } } echo '</tr></table><BR clear=all>'; } $temp = mysql_fetch_object(mysql_query("select count(msgid) num from l_forummsg where threadid={$threadid}")); $numpost = $temp->num; $numpages = floor(($numpost + $POSTSPERPAGE - 1) / $POSTSPERPAGE); $curpage = $top / $POSTSPERPAGE + 1; $res = sqlQuery("select msgid, msg, datesent, l_forummsg.status, status_at, l_player.id pid, \n player2.callsign as editedby, l_player.callsign, r.name as role\n from (l_forummsg, l_player, bzl_roles r)\n LEFT JOIN l_player player2 ON player2.id = status_by\n where threadid={$threadid}\n and fromid = l_player.id\n and l_player.role_id = r.id\n order by datesent\n limit {$top}, {$POSTSPERPAGE}"); // Table header $sub = mysql_fetch_object(mysql_query("select subject, status from l_forumthread where id={$threadid}")); echo '<table align=center border=1 cellspacing=0 cellpadding=1>'; if ($threadsticky) { $status = '<b>Sticky</b> '; } else { $status = ''; } if ($sub->status == 'locked') { $status .= '<b>Locked</b> '; } elseif ($sub->status == 'deleted') { $status .= '<b>Deleted</b> '; } echo '<tr class=tabhead><td colspan=3><font size=+1>' . $status . '<i>' . smileys($sub->subject) . '</i></font>'; // Display pages if multiple pages and not adding a post if ($numpages > 1 && !isset($addpost)) { echo '<div align=right>'; for ($i = 1; $i <= $numpages; $i++) { if ($i == $curpage) { echo $i . ' '; } else { $newtop = ($i - 1) * $POSTSPERPAGE; echo '<a href="index.php?link=' . $link . '&forumid=' . $forumid . '&threadid=' . $threadid . '&top=' . $newtop . '&' . SID . '">' . $i . '</a> '; } } echo '</div>'; } echo '</td></tr>'; echo '<tr class=tablehead><td>Author</td><td>Message</td></tr>'; $cf = 1; while ($row = mysql_fetch_object($res)) { echo '<tr class=forum' . $cf . '>'; echo '<td valign=top rowspan="' . ($allowDelete ? 2 : 1) . '"><a href="index.php?link=playerinfo&id=' . $row->pid . '&' . SID . '">' . $row->callsign . '</a>'; if ($showRoles) { print " <small>({$row->role})</small>"; } echo '<br><font size=-2>(' . $row->datesent . ')</font></td>'; $msgbody = smileys(wordwrap(nl2br(htmlspecialchars($row->msg)), 75, " ", true)); // DMP 19oct2007: Added wordwrap to break annoyingly long lines $highlight = false; // Setup available commands // Comamnds: If a ALL key exists, it will be the only one showed, otherwise all elements is shown $commands = array(); if ($allowDelete) { if ($action == 'delete' && $id == $row->msgid) { $highlight = true; $commands['ALL'] = 'Confirmation: ' . htmlLink('Delete', 'bzforums', 'action=delete2&id=' . $row->msgid . '&forumid=' . $forumid . '&threadid=' . $threadid . '&top=' . $top) . ' OR ' . htmlLink('Cancel?', 'bzforums', 'id=' . $row->msgid . '&forumid=' . $forumid . '&threadid=' . $threadid . '&top=' . $top); } else { $commands[] = htmlLink('[delete]', 'bzforums', 'action=delete&id=' . $row->msgid . '&forumid=' . $forumid . '&threadid=' . $threadid . '&top=' . $top); } } if ($allowEdit) { $commands[] = htmlLink('[edit]', 'bzforums', 'action=edit&id=' . $row->msgid . '&forumid=' . $forumid . '&threadid=' . $threadid . '&top=' . $top); } if ($highlight) { echo '<td valign=top><font color=red>' . $msgbody . '</font>'; } else { echo '<td valign=top>' . $msgbody; } if ($row->status == 'edited') { echo "<BR><small>(Message edited by {$row->editedby} at: {$row->status_at})</small>"; } echo '</td></tr>'; // Show commands if any if (count($commands)) { // if action is set dont show i$commands unless it contains 'ALL' if ($action != '' && isset($commands['ALL']) || $action == '') { echo '<tr><td align="right" colspan="2" valign=top><small>' . (isset($commands['ALL']) ? $commands['ALL'] : join(' ', $commands)) . '</small></td></tr>'; } else { echo '<tr></tr>'; } } $cf = 3 - $cf; } echo '</table>'; if ($curpage < $numpages) { echo '<CENTER><BR>' . htmlURLbutSmall("NEXT Page", $link, "forumid={$forumid}&threadid={$threadid}&top=" . $curpage * $POSTSPERPAGE); } } else { if (isset($forumid) && !isset($addpost)) { // Display specific forum // Control buttons if ($allowNew) { echo '<div align=right>' . htmlURLbutton('New Topic', $link, "forumid={$forumid}&action=new&top={$top}") . '</div>'; } if ($allowViewDeleted) { $viewClause = ''; } else { $viewClause = "AND l_forumthread.status != 'deleted' "; } $res = mysql_query("select l_forumthread.id,l_forumthread.subject, l_player.id pid, \n l_player.callsign, max(l_forummsg.datesent) ds, \n unix_timestamp(max(l_forummsg.datesent)) datesent_ts,\n l_forumthread.status, \n l_forumthread.status_at,\n splayer.callsign as status_by, l_forumthread.is_sticky\n from (l_forumthread, l_forummsg, l_player, l_player l_player2)\n left join l_player splayer ON (splayer.id = l_forumthread.status_by)\n where l_forumthread.forumid={$forumid}\n and l_forumthread.creatorid = l_player.id\n {$viewClause}\n and l_forumthread.id = l_forummsg.threadid\n and l_player2.id = l_forummsg.fromid\n group by l_forumthread.id, l_forumthread.subject, l_player.id, l_player.callsign\n order by l_forumthread.is_sticky DESC, ds desc") or die(mysql_error()); // Table header echo '<table align=center border=1 cellspacing=0 cellpadding=1>'; echo '<tr class=tabhead><td width=50%>Topic</td><td align=center>Replies</td><td align=center>Last Comment</td><td align=center>Started by</td></tr>'; while ($row = mysql_fetch_object($res)) { // Get the last author for this topic $la = mysql_fetch_object(mysql_query("select l_player.id pid, l_player.callsign\n from l_player, l_forummsg\n where threadid = {$row->id}\n and fromid = l_player.id\n order by datesent desc\n limit 0, 1")); $nr = mysql_fetch_object(mysql_query("select count(*)-1 num\n from l_forummsg\n where threadid = " . $row->id)); echo '<tr><td>'; if ($row->is_sticky == 1) { print '<b>STICKY</b> '; } if ($row->status == 'locked') { echo '<b>LOCKED</b>; '; } elseif ($row->status == 'deleted') { echo '<b>DELETED</b>; '; } echo '<a href="index.php?link=' . $link . '&forumid=' . $forumid . '&threadid=' . $row->id . '&' . SID . '">'; if (empty($row->subject)) { $row->subject = '(no subject)'; } if (isset($_SESSION['last_login']) && $_SESSION['last_login'] < $row->datesent_ts) { echo '<font color="red"><b>' . smileys($row->subject) . '</b></font></a>'; } else { echo smileys($row->subject) . '</a>'; } $numpages = floor(($nr->num + 1 + $POSTSPERPAGE - 1) / $POSTSPERPAGE); if ($numpages > 1) { echo ' (<img src="' . THEME_DIR . '/multipage.gif"> '; for ($i = 2; $i <= $numpages; $i++) { $t = ($i - 1) * 10; echo '<a href="index.php?link=' . $link . '&top=' . $t . '&forumid=' . $forumid . '&threadid=' . $row->id . '&' . SID . '">' . $i . '</a> '; } echo ')'; } if ($row->status != 'normal') { if (!$row->status_by) { $row->status_by = 'SYSTEM'; } echo "<br /><small>by {$row->status_by} at {$row->status_at}</small>"; } echo '</td> <td align=center>' . $nr->num; echo '</td> <td align=center>' . $row->ds . '<br>by <a href="index.php?link=playerinfo&id=' . $la->pid . '&' . SID . '">' . $la->callsign . '</a></td> <td align=center><a href="index.php?link=playerinfo&id=' . $row->pid . '&' . SID . '">' . $row->callsign . '</a></td> </tr>'; } echo '</table>'; } elseif ($action == '') { // Display forums list $res = mysql_query("select l_forum.id, l_forum.title, ifnull(max(l_forummsg.datesent),'n/a') md, count(l_forummsg.msgid) num,\n unix_timestamp(max(l_forummsg.datesent)) as datesent_ts\n from l_forum \n left join l_forumthread on (l_forum.id = l_forumthread.forumid AND l_forumthread.status != 'deleted')\n left join l_forummsg on l_forumthread.id = l_forummsg.threadid\n where l_forum.status = 'open'\n group by l_forum.id, l_forum.title\n order by title") or die(mysql_error()); echo '<table align=center border=0 cellspacing=0 cellpadding=1> <tr class=tabhead><td>Forums</td><td align=right># Posts</td><td align=center>Last Comment</td></tr>'; while ($row = mysql_fetch_object($res)) { echo '<tr><td><a href="index.php?link=' . $link . '&forumid=' . $row->id . '&' . SID . '">'; if (isset($_SESSION['last_login']) && $_SESSION['last_login'] < $row->datesent_ts) { echo "<font color=\"red\">" . $row->title . "</font>"; } else { echo $row->title; } echo '</a></td><td align=center>' . $row->num . '</td><td align=center>' . $row->md . '</td></tr>'; } echo '</table>'; } } }
function section_playerinfo_displayPlayer(&$se) { $s_level = $_SESSION['level']; $s_logedin = isAuthenticated(); $s_playerid = $_SESSION['playerid']; $s_leader = $_SESSION['leader']; $s_teamid = $_SESSION['teamid']; $editAny = isFuncAllowed('edit_any_players'); echo '<table width=90% align=center border=0 cellspacing=0 cellpadding=1> <tr><td class=playername align=center>' . $se->callsign . '<BR><BR></td></tr>'; // Logo if any if ($se->logo != "") { echo '<tr><td align=center>' . section_playerinfo_dispLogo($se->logo, $se->logobg) . '<hr></td></tr>'; } // Bio if any if ($se->comment != "") { echo "<tr><td class=playerbio>" . nl2br($se->comment) . "<hr></td></tr>"; } // misc info .... echo '</td></tr><TR><TD><table align=center><TR><TD width=100 valign=top align=left>'; if ($se->flagname) { echo '<img src="' . FLAG_DIR . "c-{$se->flagname}.gif\">"; } echo '</td><TD><TABLE>'; // Team if any if ($se->teamname != "") { echo "<tr><td>"; if ($se->leader == $se->id) { $d = '<nobr>Leader (<img src="' . THEME_DIR . 'leader.gif">) of team</nobr>'; } else { $d = "<nobr>Member of team</nobr>"; } section_playerinfo_tab2($d, htmlLink($se->teamname, 'teaminfo', "id={$se->teamid}")); } else { echo "<tr><td align=center colspan=2>Does not belong to any team</td></tr>"; } if ($se->altnik1 || $se->altnik2) { if ($se->altnik1 && $se->altnik2) { $plural = 's'; $niks = $se->altnik1 . ', ' . $se->altnik2; } else { if ($se->altnik1) { $niks = $se->altnik1; } else { $niks = $se->altnik2; } } section_playerinfo_tab2("<nobr>Alternate callsign{$plural}</nobr>", $niks); } if ($se->countryname) { $loc = $se->countryname; if ($se->stateabbr) { $loc .= ' ('; if ($se->city) { $loc .= $se->city . ', '; } $loc .= "{$se->stateabbr})"; } section_playerinfo_tab2('Location', $loc); } if ($se->utczone || $se->zonename) { section_playerinfo_tab2('Time zone', 'GMT ' . section_playerinfo_numPlus($se->utczone) . " ({$se->zonename})"); } section_playerinfo_tab2('Site Member Since', date('Y-m-d', $se->created)); if (isset($se->last_login)) { section_playerinfo_tab2('Last login', date('Y-m-d H:i', $se->last_login)); } echo '<TR><TD colspan=2><HR></td></tr>'; if ($se->emailpub == 'Y') { section_playerinfo_tab2('email', section_playerinfo_obsMail($se->email)); } section_playerinfo_tab2('AIM', $se->aim); section_playerinfo_tab2('IRC', $se->ircnik1); section_playerinfo_tab2('ICQ', $se->icq); section_playerinfo_tab2('YIM', $se->yim); section_playerinfo_tab2('MSM', $se->msm); section_playerinfo_tab2('Jabber', $se->jabber); echo '</table></td><TD width=50></td></tr></table></tr>'; // Frequentation statistics if ($se->status != 'deleted') { echo '<tr><td><BR><BR>'; section_playerinfo_Frequentation($se->id); echo '<BR></td></tr>'; } if ($se->status != 'deleted') { // Send a message to this player (but not to myself!) if ($s_logedin && $s_playerid != $se->id) { echo '<tr><td><hr></td></tr><tr align=center><td><TABLE><TR><TD>' . htmlURLbutton('SEND BZmessage', 'sendmessage', "pid={$se->id}"); // If I am a team leader, and my team is not full, I can invite him if (isAuthenticated() && $_SESSION['leader']) { // Check if my team full $team = mysql_fetch_object(mysql_query("select count(*) as num from l_player where team={$s_teamid}")); if ($team->num < 20) { $mytn = queryGetTeamName($s_teamid); echo '<TD width=5></td><TD>' . htmlURLbutton("INVITE to {$mytn}", 'invite', "id={$se->id}") . '</td>'; } } echo '</tr></table></td></tr>'; } // Administrators and owner can edit a player if ($s_logedin && ($editAny || $s_playerid == $se->id)) { if ($editAny && $s_playerid != $se->id) { $class = ADMBUT; } echo '<tr><td align=center><hr><TABLE><TR><TD>' . htmlURLbutton('Edit Profile', 'playeradmin', "id={$se->id}&edt_st=1", $class); if (isFuncAllowed('visitlog::visit_log')) { echo '</td><TD width=5></td><TD>' . htmlURLbutton('Visits', 'visitlog', "id={$se->id}", ADMBUT); } if (isFuncAllowed('deleteplayer::delete_player') && $se->role_id != ADMIN_PERMISSION) { echo '</td><TD width=5></td><TD>' . htmlURLbutton('DELETE Player', 'deleteplayer', "id={$se->id}", ADMBUT); } echo '</td></tr></table></td></tr>'; } } echo "</table>"; }
function section_messages() { $vars = array('del', 'delbulk', 'checknum', 'read', 'link', 'read'); foreach ($vars as $var) { ${$var} = isset($_POST[$var]) ? $_POST[$var] : $_GET[$var]; } echo '<BR>'; if (isAuthenticated()) { $_SESSION['last_msg_read_ts'] = time(); $_SESSION['new_mail'] = 0; if (isset($del)) { mysql_query("delete from l_message\n where msgid={$del}\n and toid={$_SESSION['playerid']}"); } if (isset($delbulk)) { $numdel = 0; for ($i = 0; $i < $checknum; $i++) { $delid = $_POST["del" . $i]; if (isset($delid)) { $numdel++; mysql_query("delete from l_message where msgid={$delid} and toid={$_SESSION['playerid']}"); } } if ($numdel != 1) { $esse = 's'; } else { $esse = ''; } echo "<center>Deleted {$numdel} message{$esse}.</center><BR>"; } if (isset($read)) { // Display one message $res = sqlQuery("select l_player.callsign sender, l_message.status as msgstat, fromid, datesent, subject, msg, htmlok, l_message.team\n from l_message\n left join l_player\n on id = fromid\n where toid={$_SESSION['playerid']}\n and msgid={$read}"); if (mysql_num_rows($res) == 0) { return errorPage('no messages found'); } else { // Display the message $msg = mysql_fetch_object($res); echo '<table width=80% align=center border=0 cellspacing=0 cellpadding=1> <tr class=tabhead><td align=right width=10><nobr>Date sent:</nobr></td><TD width=6></td><TD>' . $msg->datesent . '</td></tr>'; if ($msg->sender == '') { // Administrative message echo '<tr class=tabhead><td align=right>From: </td><TD></td><TD><b>CTF League System</b></td></tr>'; } else { echo '<tr class=tabhead><td align=right>From: </td><TD></td><TD><a href="index.php?link=playerinfo&id=' . $msg->fromid . '&' . SID . '">' . $msg->sender . '</a></td></tr>'; } if ($msg->subject == '') { $subject = 'No subject'; } else { $subject = stripslashes($msg->subject); } echo '<tr class=tabhead><td align=right>Subject:</td><TD></td><TD>' . wordwrap(htmlentities($subject), 40, '<br>') . '</td></tr>'; echo '<tr><td align=right valign=top><BR>Message:</td><TD></td><TD><BR><TABLE width=100% cellpadding=10 style="border: solid 1px"><TR><TD>'; if ($msg->sender == '' || $msg->htmlok > 0) { // if admin message, allow html echo nl2br($msg->msg); } else { echo nl2br(htmlentities($msg->msg)); } echo '</td></tr></table></td></tr></table>'; if ($msg->msgstat == 'new') { --$_SESSION['mail_unread']; // Set message as read mysql_query("update l_message set status='read' where msgid={$read}"); } // Display buttons: delete goback reply echo '<br><TABLE align=center><TR valign=top>'; // Can't reply to administrative messages if ($msg->sender != '') { echo '<TD><form method=post action="index.php">' . SID_FORM; echo '<input type=hidden name=link value=sendmessage>'; echo '<input type=hidden name=pid value=' . $msg->fromid . '>'; echo '<input type=hidden name=toteam value="' . $msg->team . '">'; echo '<input type=hidden name=reply value=1>'; echo '<input type=hidden name=mid value=' . $read . '>'; echo htmlFormButton('Reply', 'reply_direct') . '</td>'; if ($msg->team == 'yes') { echo '<td width=10></td><td>' . htmlFormButton('Reply To Team', 'reply_team') . '</td>'; } echo '</form><TD width=10></td>'; } echo '<TD>' . htmlURLbutton('Delete', 'messages', "del={$read}") . '</td><TD width=10></td><TD>' . htmlURLbutton('Back', 'messages', null, CLRBUT) . '</td></tr></table>'; } } else { // Display all messages $res = mysql_query("select msgid, l_player.callsign sender, fromid, datesent, \n subject, l_message.status, l_message.team\n from l_message left join l_player on id = fromid\n where toid={$_SESSION['playerid']} order by datesent desc"); echo '<div class=checkbox>'; if (mysql_num_rows($res) == 0) { echo "<center>You don't have any message to read.</center>"; } else { echo '<script type="text/javascript"> function checkAll (form, checkallcheckbox) { for (i = 0; i < form.elements.length; i++) if (form.elements[i].type == "checkbox"){ form.elements[i].checked = checkallcheckbox.checked; } } </script>'; echo '<form name="myform" method=post>' . SID_FORM . '<table border=0 align=center cellspacing=0 cellpadding=1> <tr class=tabhead><td><input type="checkbox" name="CheckAll" value="Check All" onClick="checkAll(document.myform, document.myform.CheckAll)"</td><td>Date sent </td> <td>Subject </td><td width=5></td><td>From</td></tr>'; $checknum = 0; $rownum = 0; while ($msg = mysql_fetch_object($res)) { $cl = ++$rownum % 2 ? 'rowOdd' : 'rowEven'; echo "\n<tr class={$cl} valign=top><td>"; // Display checkbox for deleting message echo '<input class=checkbox type=checkbox name=del' . $checknum . ' value=' . $msg->msgid . '> '; $checknum++; // New messages are bold, so we prepare some stuff $bb = ''; $be = ''; switch ($msg->status) { case 'new': echo '<img src="' . THEME_DIR . 'msgnew.gif">'; $bb = '<b>'; $be = '</b>'; break; case 'read': echo '<img src="' . THEME_DIR . 'msgread.gif">'; break; case 'replied': echo '<img src="' . THEME_DIR . 'msgreplied.gif">'; break; } if ($msg->team == 'yes') { echo '<img src="' . THEME_DIR . '/team.gif">'; } echo '</td><td><font size=-2>' . $bb . $msg->datesent . $be . '</font> </td>'; if ($msg->subject == '') { $subject = 'No subject'; } else { $subject = stripslashes($msg->subject); } echo "<TD>{$bb}" . htmlLink(wordwrap($subject, 40, '<br>'), 'messages', "read={$msg->msgid}", $bb ? LINK_NEW : null) . "</a>{$be}</td><TD></td>"; if ($msg->sender == '') { // Administrative message echo '<td> <b>CTF League System</b></td></tr>'; } else { echo '<td> <a href="index.php?link=playerinfo&id=' . $msg->fromid . '&' . SID . '">' . $msg->sender . '</a></td></tr>'; } } echo '</table><br> </div> <center>' . htmlFormButton('Delete Checked', 'delbulk') . '<input type=hidden name=link value="messages"> <input type=hidden name=checknum value=' . $checknum . ' </center></form>'; } } } else { errorPage('You are not allowed to view the messages'); } }
<?php require_once 'html_functions.php'; $default_header = 'Hristo'; printHeader(); echo "<br>"; printFooter(); $a = htmlLink('Google', 'https://www.google.com/'); echo $a; echo "<br>"; $number = 12; $multiplier = 3; multiply($number, $multiplier); echo "{$number} <br>"; multiply($number, $multiplier); echo "{$number} <br>"; multiply($number, $multiplier); echo "{$number} <br>"; multiply($number, $multiplier); echo "{$number} <br>"; echo '<br>'; echo "1st: "; asd(); echo '<br>'; echo "2nd: "; asd(); echo '<br>'; echo "3th: "; asd(); echo '<br>'; echo "4th:";
function adminMenu() { //if ($GLOBALS['UserLevel']=='player' || $GLOBALS['UserLevel']=='guest') // return; $admMenu = array(array('entermatch::enter_match', 'Enter Match', 'entermatch', '', LINK_BOLD), array('admintext::edit_homepage', 'Homepage', 'admintext', 'func=homepage'), array('news::edit_news', 'News Edit', 'newsadmin'), array('shame::edit_shame', 'HOS Edit', 'shameadmin'), array('links::edit_links', 'Links Edit', 'linkadmin'), array('admintext::edit_contacts', 'Contacts', 'admintext', 'func=contact'), array('admintext::edit_faq', 'FAQ Edit', 'admintext', 'func=faq'), array('admintext::edit_rules', 'Rules Edit', 'admintext', 'func=rules'), array('adminlist::list_admins', 'Admin List', 'adminlist'), array('runmaintenance::maintenance', 'Maintenance', 'runmaintenance'), array('reviveteam::revive_team', 'Revive Team', 'reviveteam'), array('visitlog::visit_log', 'Visits Log', 'visitlog'), array('ipreport::ipreport', 'IP Report', 'ipreport'), array('dispchangelog::disp_changelog', 'ChangeLog', 'dispchangelog'), array('badpass::badpass', 'BadLogin', 'badpass'), array('admintext::edit_todo', 'Scratchpad', 'admintext', 'func=todo'), array('debug::debug', 'Debug', 'debug'), array('permissions::permissions', 'Permissions', 'permissions'), array('permissions::permissions', 'Roles', 'permissions', 'func=roles'), array('createaccount::create_account', 'Create Acct', 'createaccount'), array('addseason::add_season', 'Seasons', 'addseason')); $colCount = 0; $out = '<TABLE class=admback width=100%><TR><TD>'; $out .= '<TABLE align=center class=admbar cellpadding=0 cellspacing=0><TR>'; foreach ($admMenu as $mi) { if (isFuncAllowed($mi[0])) { $out .= '<TD align=center width=90><nobr>' . htmlLink($mi[1], $mi[2], $mi[3], $mi[4]) . '</nobr></td>'; if (++$colCount % 8 == 0) { $out .= '</tr><TR>'; } } } $out .= '</tr></table></td></tr></table>'; if ($colCount) { print $out; } }