本文整理汇总了PHP中table::flush方法的典型用法代码示例。如果您正苦于以下问题:PHP table::flush方法的具体用法?PHP table::flush怎么用?PHP table::flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类table
的用法示例。
在下文中一共展示了table::flush方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lotto_editLottery
function lotto_editLottery()
{
// We need some globals
global $MySelf;
global $DB;
$formDisable = "";
if (lotto_getOpenDrawing()) {
$formDisable = "disabled";
}
// is Lotto enabled at all?
if (!getConfig("lotto")) {
makeNotice("Your CEO disabled the Lotto module, request denied.", "warning", "Lotto Module Offline");
}
// Deny access to non-lotto-officials.
if (!$MySelf->isLottoOfficial()) {
makeNotice("You are not allowed to do this!", "error", "Permission denied");
}
$table = new table(2, true);
$table->addHeader(">> Open new drawing");
$table->addRow();
$table->addCol("Number of tickets in draw:");
$table->addCol("<input type=\"text\" name=\"count\" " . $formDisable . " value=\"30\">");
// $newLotto = new table (2);
$table->addHeaderCentered("<input type=\"submit\" name=\"submit\" " . $formDisable . " value=\"open new drawing\">", array("bold" => true, "colspan" => 2));
$html = "<h2>Lotto Administration</h2>";
$html .= "<form action=\"index.php\" method=\"POST\">";
$html .= "<input type=\"hidden\" name=\"check\" value=\"true\">";
$html .= "<input type=\"hidden\" name=\"action\" value=\"createDrawing\">";
$html .= $table->flush();
$html .= "</form>";
if (lotto_getOpenDrawing()) {
$html .= "[<a href=\"index.php?action=drawLotto\">Draw Winner</a>]";
}
return $html;
}
示例2: showHierarchy
function showHierarchy()
{
// Globals!
global $DB;
// Get all sorted ranks.
$Ranks = $DB->query("SELECT DISTINCT name, rankid, rankOrder FROM ranks ORDER by rankOrder ASC");
while ($rank = $Ranks->fetchRow()) {
// Get all the users in the current rank.
$peopleInRank = $DB->query("SELECT DISTINCT username, rank FROM users WHERE rank='{$rank['rankid']}' AND deleted='0' AND canLogin='1' ORDER BY username");
// Are there people in this rank?
if ($peopleInRank->numRows() > 0) {
// Create a temp. table.
$table = new table(1, true);
$table->addHeader(">> " . $rank[name]);
while ($peep = $peopleInRank->fetchRow()) {
$table->addRow();
$table->addCol("<a href=\"index.php?action=profile&id=" . usernameToID($peep[username]) . "\">" . ucfirst($peep[username]) . "</a>");
}
$html .= $table->flush() . "<br>";
unset($table);
}
}
$header = "<h2>" . getConfig("sitename") . " - Hierarchy</h2>";
return $header . $html;
}
示例3: makeAddUserForm
function makeAddUserForm()
{
// Are we allowed to?
global $MySelf;
if (!$MySelf->canAddUser()) {
makeNotice("You are not authorized to do that!", "error", "Forbidden");
}
// Suggest a user password.
$suggestedPassword = crypt(base64_encode(rand(11111, 99999)), "8ewf7tg2k,leduj");
$table = new table(2, true);
$table->addHeader(">> Add a new user");
$table->addRow("#060622");
$table->addCol("You can manually add a new user with this form. But use this only " . "as a last resort, for example, if your server can not send eMails. " . "Always let the user request an account. This form was supposed to be " . "removed, but complains from the users kept it alive.", array("colspan" => 2));
$table->addRow();
$table->addCol("Username:");
$table->addCol("<input type=\"text\" name=\"username\" maxlength=\"20\">");
$table->addRow();
$table->addCol("eMail:");
$table->addCol("<input type=\"text\" name=\"email\">");
$table->addRow();
$table->addCol("Password:");
$table->addCol("<input type=\"password\" name=\"pass1\" value=\"{$suggestedPassword}\"> (Suggested: {$suggestedPassword})");
$table->addRow();
$table->addCol("Verify Password:");
$table->addCol("<input type=\"password\" name=\"pass2\" value=\"{$suggestedPassword}\">");
$table->addHeaderCentered("<input type=\"submit\" name=\"create\" value=\"Add user to database\">");
$page = "<h2>Add a new User</h2>";
$page .= "<form action=\"index.php\" method=\"post\">";
$page .= $table->flush();
$page .= "<input type=\"hidden\" name=\"action\" value=\"newuser\">";
$page .= "<input type=\"hidden\" name=\"check\" value=\"check\">";
$page .= "</form>";
return $page;
}
示例4: makeRequestAccountPage
function makeRequestAccountPage($failedFastLogin = false)
{
// We need global Variables.
global $VERSION;
global $SITENAME;
global $IGB;
global $IGB_VISUAL;
if ($IGB && $IGB_VISUAL) {
$table = new table(2, true);
} else {
$table = new table(2, true, "width=\"500\"", "align=\"center\"");
}
if ($_GET[admin] == true) {
$table->addHeader(">> Create initial Superadmin account");
} else {
$table->addHeader(">> Request an account");
}
// Trust, INC.
if ($failedFastLogin) {
// This happens when someone allowed fast logins(!) and the user does not exist.
global $EVE_Charname;
$table->addRow("#660000");
$table->addCol("Fast login failed; Username \"" . ucfirst($EVE_Charname) . "\" does not exist.", array("colspan" => 2, "align" => "center"));
}
$table->addRow("#060622");
if ($_GET[admin] == true) {
$table->addCol("Fill out the form below to create the initial superadmin account. " . "This account will have all priviledges - so keep the login credentials safe! " . "Your password will be randomly generated and revealed to you just once, " . "so write it down or copy it elsewhere. You will have the option to " . "change your password on your first login.", array("colspan" => 2));
} else {
$table->addCol("Fill out the form below to apply for a new account. After you requested " . "an account you will receive an email with an activation link. Finally, your " . "CEO has to approve of your account, after which you will receive your initial password.", array("colspan" => 2));
}
$table->addRow();
$table->addCol("Character Name:");
// Trust, INC.
global $EVE_Charname;
if ($EVE_Charname) {
$table->addCol("<input type=\"text\" name=\"username\" value=\"{$EVE_Charname}\" maxlength=\"30\">");
} else {
$table->addCol("<input type=\"text\" name=\"username\" maxlength=\"30\">");
}
$table->addRow();
$table->addCol("Your valid eMail:");
$table->addCol("<input type=\"text\" name=\"email\" maxlength=\"70\">");
if ($_GET[admin] == false) {
$table->addHeaderCentered("<input type=\"submit\" name=\"login\" value=\"request account\">");
$table->addRow("#060622");
$table->addCol("[<a href=\"index.php\">Cancel request</a>]", array("colspan" => 2));
} else {
$table->addHeaderCentered("<input type=\"submit\" name=\"login\" value=\"Create Superadmin\">");
}
$page = "<br><br>";
$page .= "<form action=\"index.php\" method=\"post\">";
$page .= "<input type=\"hidden\" name=\"action\" value=\"requestaccount\">";
$page .= $table->flush();
$page .= "</form><br><br>";
// Print it, and die (special case: login does not get beautified.)
$html = new html();
$html->addBody($page);
die($html->flush());
}
示例5: editTemplate
function editTemplate()
{
global $DB;
global $MySelf;
// Are we allowed to?
if (!$MySelf->isAdmin()) {
makeNotice("Only an Administator can edit the sites templates.", "warning", "Access denied");
}
// No Identifier, no service
if ($_POST[check]) {
// We got the returning form, edit it.
numericCheck($_POST[id], 0);
$ID = $_POST[id];
// Fetch the current template, see that its there.
$test = $DB->query("SELECT identifier FROM templates WHERE id='{$ID}' LIMIT 1");
if ($test->numRows() == 1) {
// We got the template
$template = sanitize($_POST[template]);
$DB->query("UPDATE templates SET template='" . $template . "' WHERE id='{$ID}' LIMIT 1");
// Check for success
if ($DB->affectedRows() == 1) {
// Success!
header("Location: index.php?action=edittemplate&id={$ID}");
} else {
// Fail!
makeNotice("There was a problem updating the template in the database!", "error", "Internal Error", "index.php?action=edittemplate&id={$ID}", "Cancel");
}
} else {
// There is no such template
makeNotice("There is no such template in the database!", "error", "Invalid Template!", "index.php?action=edittemplate&id={$ID}", "Cancel");
}
} elseif (empty($_GET[id])) {
// No returning form, no identifier.
header("Location: index.php?action=configuration");
} else {
$ID = $_GET[id];
}
// numericheck!
numericCheck($ID, 0);
$temp = $DB->getCol("SELECT template FROM templates WHERE id='{$ID}' LIMIT 1");
$table = new table(1, true);
$table->addHeader(">> Edit template");
$table->addRow();
$table->addCol("<center><textarea name=\"template\" rows=\"30\" cols=\"60\">" . $temp[0] . "</textarea></center>");
$table->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Edit Template\">");
$form1 = "<form action=\"index.php\" method=\"POST\">";
$form2 = "<input type=\"hidden\" name=\"check\" value=\"true\">";
$form2 .= "<input type=\"hidden\" name=\"action\" value=\"editTemplate\">";
$form2 .= "<input type=\"hidden\" name=\"id\" value=\"" . $ID . "\">";
$form2 .= "</form>";
$backlink = "<br><a href=\"index.php?action=configuration\">Back to configuration</a>";
return "<h2>Edit the template</h2>" . $form1 . $table->flush() . $form2 . $backlink;
}
示例6: confirm
function confirm($question = "Are you sure?")
{
// switch post or get.
if (isset($_POST[check])) {
// The user confirmed the box. Dont loop. Accept it already ;)
if ($_POST[confirmed] == true) {
return true;
}
$MODE = "POST";
$FORM = $_POST;
$keys = array_keys($_POST);
} else {
// The user confirmed the box. Dont loop. Accept it already ;)
if ($_GET[confirmed] == true) {
return true;
}
$MODE = "GET";
$FORM = $_GET;
$keys = array_keys($_GET);
}
// Assemble hidden values for the confirm form.
foreach ($keys as $key) {
$html .= "<input type=\"hidden\" name=\"" . $key . "\" value=\"" . $FORM[$key] . "\">";
}
// Cancel button
$cancel = "<form action=\"index.php\" method=\"POST\">";
$cancel .= "<input type=\"submit\" name=\"confirmed\" value=\"CANCEL\">";
$cancel .= "</form>";
// OK button
$ok = "<form action=\"index.php\" method=\"{$MODE}\">";
$ok .= $html;
$ok .= "<input type=\"submit\" name=\"confirmed\" value=\"OK\">";
$ok .= "</form>";
$table = new table("2", true, "width=\"50%\"", "align=\"center\"");
$table->addHeader("<img src=\"./images/warning.png\">");
$table->addRow("#060622");
$table->addCol(">> Confirmation needed", array("colspan" => "2"));
$table->addRow();
$table->addCol("<br>" . $question . "<br><br>", array("colspan" => "2"));
$table->addRow();
$table->addCol($cancel, array("align" => "left"));
$table->addCol($ok, array("align" => "right"));
$htmlobj = new html();
$htmlobj->addBody("<br><br><br><br>" . $table->flush() . "<br><br><br><br>");
die($htmlobj->flush());
}
示例7: makeLostPassForm
function makeLostPassForm()
{
// We need some global vars again.
global $IGB;
global $SITENAME;
global $IGB_VISUAL;
if ($IGB && $IGB_VISUAL) {
$table = new table(2, true);
} else {
$table = new table(2, true, "width=\"500\"", "align=\"center\"");
}
$table->addHeader(">> Request a new password");
$table->addRow("#060622");
$table->addCol("Fill out the form below to have a new password generated and sent to you registered eMail address.", array("colspan" => 2));
$table->addRow();
$table->addCol("Character Name:");
// Trust, INC.
global $EVE_Charname;
if ($EVE_Charname) {
$table->addCol("<input type=\"text\" name=\"username\" value=\"{$EVE_Charname}\" maxlength=\"30\">");
} else {
$table->addCol("<input type=\"text\" name=\"username\" maxlength=\"30\">");
}
$table->addRow();
$table->addCol("Your valid eMail:");
$table->addCol("<input type=\"text\" name=\"email\" maxlength=\"70\">");
$table->addHeaderCentered("<input type=\"submit\" name=\"change\" value=\"Get Password\">");
$table->addRow("#060622");
$table->addCol("[<a href=\"index.php\">Cancel request</a>]", array("colspan" => 2));
// $page = "<h2>Lost password</h2>";
$page = "<br><br>";
$page .= "<form action=\"index.php\" method=\"post\">";
$page .= "<input type=\"hidden\" name=\"action\" value=\"lostpass\">";
$page .= "<input type=\"hidden\" name=\"check\" value=\"check\">";
$page .= $table->flush();
$page .= "</form><br><br>";
// Print it, and die (special case: login does not get beautified.)
$html = new html();
$html->addBody($page);
die($html->flush());
}
示例8: getTransactions
function getTransactions($user)
{
// Database 4tw!
global $DB;
// Sanity!
numericCheck($user, 0);
// Grande Heading!
$table = new table(6, true);
$table->addHeader(">> Transaction log for <a href=\"index.php?action=edituser&id={$user}\">" . ucfirst(idToUsername($user)) . "</a> " . number_format(getCredits($user), 2) . " ISK");
// Table columns descriptors.
$table->addRow("#060622");
$table->addCol("Date");
$table->addCol("Transaction ID");
$table->addCol("Banker");
$table->addCol("Type");
$table->addCol("Amount");
$table->addCol("Reason");
// ask the oracle.
$transactions = $DB->getCol("SELECT COUNT(id) as count FROM transactions WHERE owner='" . $user . "' ORDER BY time DESC, id DESC");
$transactions_count = $transactions[0];
$transactions_pages = ceil($transactions_count / 20);
// No transactions yet.
if ($transactions_count < 1) {
return false;
}
$currentPage = isset($_GET['walletPage']) ? $_GET['walletPage'] : 0;
// Get the right amount of datasets from the dbase.
if ($currentPage > 0 && is_numeric($currentPage)) {
$min = 20 * $currentPage - 20;
} else {
$min = 0;
}
// Query the database accordingly
$transactions = $DB->query("SELECT * FROM transactions WHERE owner='" . $user . "' ORDER BY time DESC, id DESC LIMIT {$min},20");
while ($transaction = $transactions->fetchRow()) {
$table->addRow();
$table->addCol(date("d.m.y H:i:s", $transaction['time']));
$table->addCol(str_pad($transaction['id'], "6", "0", STR_PAD_LEFT));
$table->addCol(ucfirst(idToUsername($transaction['banker'])));
switch ($transaction['type']) {
case "0":
$table->addCol("deposit");
break;
case "1":
$table->addCol("withdrawal");
break;
}
if ($transaction['amount'] > 0) {
$table->addCol("<font color=\"#00ff00\">" . number_format($transaction['amount'], 2) . " ISK</font>");
} else {
$table->addCol("<font color=\"#ff0000\">" . number_format($transaction['amount'], 2) . " ISK</font>");
}
$table->addCol(strtolower($transaction['reason']));
}
// Get the right next and previous pages.
$currentPage = isset($_GET['walletPage']) ? $_GET['walletPage'] : 0;
// if we have more than 1 page, show the navbar.
if ($transactions_pages > 1) {
// Handle first page: Static numbering.
if ($currentPage < 1) {
$next = 2;
} else {
// handle pages greater 2. Check if we have yet another page.
if ($transactions_pages > $currentPage) {
$next = $currentPage + 1;
}
// All pages above 2 have a previous page.
$prev = $currentPage - 1;
}
$table->addRow("#060622");
// Show backlink, unless we are at page 1.
if ($prev) {
// We have a previous page (at page > 1)
$table->addCol("<a href=\"index.php?action={$_GET['action']}&id={$_GET['id']}&walletPage={$prev}\">prev</a>", array("colspan" => 2));
} else {
// No previos page (at page 1);
$table->addCol(" ", array("colspan" => 2));
}
// Show direct page links.
if ($transactions_pages > 1) {
for ($i = 1; $i <= $transactions_pages; $i++) {
if ($currentPage == $i) {
$text .= "[{$i}]";
} else {
$text .= "[<a href=\"index.php?action={$_GET['action']}&id={$_GET['id']}&walletPage={$i}\">{$i}</a>]";
}
}
}
$table->addCol($text, array("colspan" => 2, "align" => "center"));
// Next link
if ($currentPage < $transactions_pages) {
// We have a next page. (at page < n)
$table->addCol("<a href=\"index.php?action={$_GET['action']}&id={$_GET['id']}&walletPage={$next}\">next</a>", array("colspan" => 2, "align" => right));
} else {
// This was the last page. (at page n)
$table->addCol(" ", array("colspan" => 2));
}
}
$table->addHeader("If there are any problems with your transactions, contact your ceo immediatly.");
return $table->flush();
//.........这里部分代码省略.........
示例9: showRanks
function showRanks()
{
// We needeth the databaseth!
global $DB;
global $MySelf;
// Is sire alloweth to logineth?
if (!$MySelf->canEditRank()) {
makeNotice("You do not have sufficient rights to access this page.", "warning", "Access denied");
}
// Get all current ranks.
$ranks_ds = $DB->query("SELECT * FROM ranks ORDER BY rankOrder ASC");
$currentRanks = $ranks_ds->numRows();
// Are there any ranks defined yet?
if ($currentRanks > 0) {
// Yuh. Create table.
$headerConfig = array("bold" => true, "align" => "center");
$table = new table(4, true);
$table->addHeader(">> Edit current ranks");
$table->addRow();
$table->addCol("Rank Order", $headerConfig);
$table->addCol("Rank Name", $headerConfig);
$table->addCol("Nr. of times Issued", $headerConfig);
$table->addCol("Delete Rank", $headerConfig);
// Create a nice, fancy row for every rank.
while ($rank = $ranks_ds->fetchRow()) {
$table->addRow();
for ($i = 1; $i <= $currentRanks; $i++) {
$ro = str_pad($i, 3, "0", STR_PAD_LEFT);
if ($rank[rankOrder] == $i) {
$pdm .= "<option SELECTED value=\"{$ro}\">{$i}</option>";
} else {
$pdm .= "<option value=\"{$ro}\">{$i}</option>";
}
}
$ddm = "<select name=\"order_" . $rank[rankid] . "\">" . $pdm . "</select>";
$table->addCol($ddm, $headerConfig);
$table->addCol("<input type=\"text\" name=\"title_" . $rank[rankid] . "_name\" value=\"" . $rank[name] . "\">", $headerConfig);
// how many times has the rank been issue?
$count = $DB->getCol("SELECT COUNT(id) FROM users WHERE rank='{$rank['rankid']}' AND deleted='0'");
$count = $count[0];
if ($count < 1) {
$table->addCol("<i>Rank not used</i>");
} else {
$table->addCol($count);
}
$table->addCol("<a href=\"index.php?action=deleterank&id={$rank['rankid']}\">delete</a>", $headerConfig);
unset($pdm);
unset($ddm);
}
// Submit button & stuff.
$hidden = "<input type=\"hidden\" name=\"check\" value=\"true\">" . "<input type=\"hidden\" name=\"action\" value=\"editranks\">";
$table->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Update Ranks\">");
$rankTable = "<form action=\"index.php\" method=\"POST\">" . $table->flush() . $hidden . "</form>";
unset($table);
unset($currentRanks);
}
// Create the new-rank-form-jiggamajig.
$table = new table(2, true);
$table->addHeader(">> Add a new rank");
$table->addRow();
$table->addCol("Rank name:");
$table->addCol("<input type=\"text\" name=\"rankname\">");
$hidden = "<input type=\"hidden\" name=\"check\" value=\"true\">" . "<input type=\"hidden\" name=\"action\" value=\"addnewrank\">";
$table->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Add Rank\">");
$addRankTable = "<form action=\"index.php\" method=\"POST\">" . $table->flush() . $hidden . "</form>";
// Flush the page!
return "<h2>Edit the ranks</h2>" . $rankTable . $addRankTable;
}
示例10: makeMenu
//.........这里部分代码省略.........
$lotto_Play = "[<a href=\"index.php?action=lotto\">Lotto</a>]";
} else {
// Using a real browser.
$lotto_Play = "<a class='menu' href=\"index.php?action=lotto\">> Lotto</a>";
}
}
if ($MySelf->isLottoOfficial()) {
// Yeah we are allowed to do this.
if ($IGB && $IGB_VISUAL) {
// Browswing in the iGB.
$lotto_Admin = "[<a href=\"index.php?action=editLotto\">Admin Lotto</a>]";
} else {
// Using a real browser.
$lotto_Admin = "<a class='menu' href=\"index.php?action=editLotto\">> Admin Lotto</a>";
}
}
if ($lotto_Admin || $lotto_Play) {
// Assemble the Lotto module.
if ($IGB && $IGB_VISUAL) {
$lottoModule = $lotto_Play . " " . $lotto_Admin . "";
} else {
$lottoModule = "<div>";
$lottoModule .= "<img src=\"./images/m-lotto.png\">";
$lottoModule .= $lotto_Play;
$lottoModule .= $lotto_Admin;
$lottoModule .= "</div><div class='clear'></div>";
}
}
}
/*
* Open operations Module
*/
if ($IGB && $IGB_VISUAL) {
// tough luck.
} else {
$runs = sidebarOpenRuns();
if ($runs) {
$operationsModule = "<div>";
$operationsModule .= "<img src=\"./images/m-runs-in-progress.png\">";
$operationsModule .= sidebarOpenRuns() . "";
$operationsModule .= "</div><div class='clear'></div>";
}
}
/*
* Show the time.
*/
$clockScript = "<script>\n\tvar eveTime = new Date({$TIMEMARK}*1000);\n\teveTime.setHours(eveTime.getHours()-3);\n\tvar eveTimeRefreshRate = 20;// seconds\n\tvar eveTimeZone = '';\n\tfunction updateTime(){\n\t\teveTime = new Date(eveTime.getTime()+(eveTimeRefreshRate * 1000));\n\t\tminutes = eveTime.getMinutes();\n\t\tif(minutes.length < 2){\n\t\t\tminutes = '0' + minutes;\n\t\t}\n\t\thours = eveTime.getHours();\n\t\tif(hours.length < 2){\n\t\t\thours = '0' + hours;\n\t\t}\n\t\t\$('#eveTime').html(hours + ':' + minutes + ' EvE');\n\t\tsetTimeout('updateTime()', eveTimeRefreshRate * 1000);\n\t}\n\tsetTimeout('updateTime()', eveTimeRefreshRate * 1000);\n\t\n\t\$('#menu img').click(function() {\n\t \$(this).siblings().toggle('slow');\n\t});\n\t\n\t\n\t</script>";
$clock = "<b><hr><center id='eveTime'>" . date("H:i", $TIMEMARK) . " EvE</center><hr>{$clockScript}</b>";
/*
* Assemble the module-block.
*/
if ($IGB && $IGB_VISUAL) {
global $VERSION;
$menu = new table(2, true, "width=\"99%\"");
// Add the beta warning for the IGB
global $IS_BETA;
if ($IS_BETA) {
$BETAWARNING = "<font color=\"#ff0000\"> - <b>This is a BETA release! Watch out for bugs!</b></font>";
}
// Add the Version bar.
$menu->addHeader($VERSION . $BETAWARNING);
// Create the mining Menu.
$menu->addRow();
$menu->addCol("Mining >>", array("align" => "right", "bold" => "true"));
$menu->addCol($miningModule);
if ($events_add || $events_view) {
$menu->addRow();
$menu->addCol("Events >>", array("align" => "right", "bold" => "true"));
$menu->addCol($eventsModule);
}
// Wallet Menu.
$menu->addRow();
$menu->addCol("Wallet >>", array("align" => "right", "bold" => "true"));
$menu->addCol($walletModule);
// Preferences.
$menu->addRow();
$menu->addCol("Preferences >>", array("align" => "right", "bold" => "true"));
$menu->addCol($prefModule);
// Ore managagement.
if ($admin_Ore || $admin_viewUser || $admin_addUser) {
$menu->addRow();
$menu->addCol("Admin >>", array("align" => "right", "bold" => "true"));
$menu->addCol($adminModule);
}
// Logout.
$menu->addRow();
$menu->addCol("Exit >>", array("align" => "right", "bold" => "true"));
$menu->addcol($logoutModule);
$menu->addHeader("Logged in as <font color=\"00aa00\">%%USERNAME%%</font>, Rank: <font color=\"00aa00\">%%RANK%%</font>, {$DIV_MENU} Credits: <font color=\"00aa00\">%%CREDITS%%</font>.");
$modules = $menu->flush();
} else {
$modules = $UPDATE . $miningModule . $operationsModule . $walletModule . $eventsModule . $lottoModule . $prefModule . $adminModule . $logoutModule . $clock;
}
// And return it all.
if ($page) {
return str_replace("%%MENU%%", $modules, $page);
} else {
return $modules;
}
}
示例11: lotto_playLotto
//.........这里部分代码省略.........
// $TotalTickets_DS = $DB->Query("SELECT ticket FROM lotteryTickets WHERE drawing='" . $woot[drawing] . "' AND owner >= '0'");
// $TotalTickets = $TotalTickets_DS->numRows();
$MyWins->addRow();
$MyWins->addCol("<a href=\"index.php?action=lotto&showdrawing=" . $jp[drawing] . "\">#" . str_pad($jp[drawing], 3, "0", STR_PAD_LEFT) . "</a>");
if ($jp[winner] == "-1") {
$MyWins->addCol("<i>No one</i>");
} else {
$MyWins->addCol(ucfirst(idToUsername($jp[winner])));
}
$MyWins->addCol("#" . str_pad($jp[winningTicket], 3, "0", STR_PAD_LEFT));
$MyWins->addCol(number_format($jp[potSize]) . " ISK");
$GotWinners = true;
}
}
$drawingID = lotto_getOpenDrawing();
$drawingID = $drawingID[0];
// Load the current drawing.
if (!$_GET[showdrawing]) {
$drawingID = lotto_getOpenDrawing();
//$drawingID = $drawingID[0];
} else {
numericCheck($_GET[showdrawing], 0);
$drawingID = $_GET[showdrawing];
}
// jackpot! WOOT!
$Jackpot = $DB->getCol("SELECT value FROM config WHERE name='jackpot' LIMIT 1");
if ($drawingID != is_null()) {
$currentBuyin = $DB->getCol("SELECT COUNT(*) FROM lotteryTickets WHERE drawing=" . $drawingID . " AND owner >=0");
$totalJackpot = $Jackpot[0] + $currentBuyin[0] * 1000000;
}
$MyWins->addHeader("The current jackpot is at " . number_format($totalJackpot, 2) . " ISK.");
// $MyWins->addHeader("Please contact your lotto officer to claim your prize.");
// Only do this if we have an open drawing, doh!
if ($drawingID != is_null()) {
$TICKETS = $DB->query("SELECT * FROM lotteryTickets WHERE drawing = '{$drawingID}' ORDER BY ticket");
$allowedTickets = lotto_checkRatio($drawingID);
// Table header
$drawing = new table(2, true);
$drawing->addHeader(">> Drawing #{$drawingID}");
// 1=left side, 0=right side.
$side = 1;
while ($ticket = $TICKETS->fetchRow()) {
$ticketCount++;
// If we are on the left side, open up a new table row.
if ($side == 1) {
$drawing->addRow();
}
// Ticket owned already?
if ($ticket[owner] == -1) {
if ($Credits >= 1 && $allowedTickets > 0) {
$drawing->addCol("<a href=\"index.php?action=claimTicket&drawing={$max}&ticket=" . $ticket[ticket] . "\">#" . str_pad($ticket[ticket], 4, "0", STR_PAD_LEFT) . "</a> (unclaimed)");
} else {
$drawing->addCol("#" . str_pad($ticket[ticket], 4, "0", STR_PAD_LEFT) . " (unclaimed)");
}
} elseif ($ticket[owner] >= 0) {
// Increase the chances counter.
if ($ticket[owner] == $ID) {
$chances++;
}
if ($ticket[isWinner]) {
$drawing->addCol("#" . str_pad($ticket[ticket], 4, "0", STR_PAD_LEFT) . " (" . idToUsername($ticket[owner]) . ") <font color=\"#00ff00\"><b>WINNER!</b></font>");
} else {
$drawing->addCol("#" . str_pad($ticket[ticket], 4, "0", STR_PAD_LEFT) . " (" . idToUsername($ticket[owner]) . ")");
}
} else {
if ($ticket[isWinner]) {
$drawing->addCol("#" . str_pad($ticket[ticket], 4, "0", STR_PAD_LEFT) . " (locked) <font color=\"#00ff00\"><b>WINNER!</b></font>");
} else {
$drawing->addCol("#" . str_pad($ticket[ticket], 4, "0", STR_PAD_LEFT) . " (locked)");
}
}
// Toggle sides.
$side = 1 - $side;
$AreTickets = true;
}
// My Chances
$winningChance = number_format(100 / ($ticketCount / $chances), 3) . "%";
// Even the odds ;)
if ($side == 0) {
$drawing->addCol("---");
}
if ($allowedTickets > 0) {
$drawing->addHeader("Click on a ticket to buy it, up to {$allowedTickets} more ({$LOTTO_MAX_PERCENT}%). Your chances of winning are: {$winningChance}");
} else {
$drawing->addHeader("You exceeded the maximum allowed tickets ({$LOTTO_MAX_PERCENT}%). Your chances of winning are: {$winningChance}");
}
}
// HTML goodness.
$html = "<h2>Play Lotto</h2>";
$html .= $MyInfo->flush() . "<br>";
if ($GotWinners) {
$html .= $MyWins->flush() . "<br>";
}
// only include ticket table if we have tickets.
if ($AreTickets) {
$html .= $drawing->flush();
}
// return the page.
return $html;
}
示例12: showOreValue
//.........这里部分代码省略.........
$archiveTime = strtotime("2999-12-31");
while ($row = $orevaluesDS->fetchRow()) {
$orevalues[$row['item']] = $row;
$archiveTime = $archiveTime > $row['time'] ? $row['time'] : $archiveTime;
}
// Create the table.
if (!$isLatest) {
$table = new table(8, true);
$add = "Archived";
$colspan = 7;
} else {
$table = new table(6, true);
$add = "Current";
$colspan = 5;
}
//$table->addHeader(">> $add Ore Quotes (dated: " . date("m.d.y H:i:s", $orevalues[0][time]) . ", modified by " . ucfirst(idToUsername($orevalues[0][modifier])) . ")", array (
$table->addHeader(">> {$add} Ore Quotes (dated: " . date("m.d.Y H:i:s", $archiveTime) . ")", array("bold" => true));
$table->addRow();
$table->addCol("Ore Name", array("colspan" => 2, "bold" => true));
$table->addCol("Value", array("bold" => true));
if (!$isLatest) {
$table->addCol("Diff", array("bold" => true));
}
$table->addCol("Ore Name", array("colspan" => 2, "bold" => true));
$table->addCol("Value", array("bold" => true));
if (!$isLatest) {
$table->addCol("Diff", array("bold" => true));
}
// How many ores are there in total? Ie, how long has the table to be?
$tableLength = ceil(count($ORENAMES) / 2) - 1;
for ($i = 0; $i <= $tableLength; $i++) {
$table->addRow();
for ($side = 0; $side <= 1; $side++) {
$ORE = $ORENAMES[$i + ($tableLength + 1) * $side];
// Fetch the right image for the ore.
$ri_words = str_word_count($ORE, 1);
$ri_max = count($ri_words);
$ri = strtolower($ri_words[$ri_max - 1]);
if ($ORE != "") {
$table->addCol("<img width=\"32\" height=\"32\" src=\"./images/ores/" . $ORE . ".png\">");
if (!$isLatest && $orevalues[$DBORE[$ORE]]['time'] != $archiveTime) {
$DATE = $orevalues[$DBORE[$ORE]]['time'] > $archiveTime ? date("m.d.y H:i:s", $orevalues[$DBORE[$ORE]]['time']) : "";
$color = $orevalues[$DBORE[$ORE]]['time'] > $archiveTime ? "#00ff00" : "#ff0000";
$ORE = "{$ORE} <font color=\"{$color}\">{$DATE}</font>";
}
$table->addCol($ORE);
$iskperhour = $orevalues[$DBORE[$ORE]]['Worth'] / $orevalues[$DBORE[$ORE]]['volume'];
$value = "<div class='value'><div class='isk'>" . number_format($orevalues[$DBORE[$ORE]]['Worth'], 2) . " ISK" . "</div><div class='iph'>" . number_format($iskperhour, 2) . " ISK/m3</div></div>";
$table->addCol($value);
if (!$isLatest) {
$diff = $orevalues[$DBORE[$ORE]]['Worth'] - $latest[$DBORE[$ORE]]['Worth'];
if ($diff > 0) {
$color = "#00ff00";
} elseif ($diff == 0) {
$color = "";
} elseif ($diff <= 0) {
$color = "#ff0000";
}
$table->addCol("<font color=\"{$color}\">{$diff}</font>");
}
} else {
$table->addCol("");
$table->addCol("");
$table->addCol("");
if (!$isLatest) {
$table->addCol("");
}
}
}
}
if (!$isLatest) {
$table->addRow("#882020");
$table->addCol("These values are not the current payout values. Click <a href=\"index.php?action=showorevalue\">here</a> to see up-to-date quotes.", array("colspan" => 8));
}
/*
* Create a list of all previous changes.
*/
/* Disabled on feb 24 during database changes to oreValue table.
$AllChanges = $DB->query("SELECT time,id FROM orevalues ORDER BY time ASC");
while ($ds = $AllChanges->fetchRow()) {
if ($ds[time] > 0) {
if ($ds[time] == $orevalues[0][time]) {
$otherValues .= "[" . date("d.m.y", $ds[time]) . "] ";
} else {
$otherValues .= "[<a href=\"index.php?action=showorevalue&id=$ds[id]\">" . date("d.m.y", $ds[time]) . "</a>] ";
}
}
}
$table->addRow("#060622");
$table->addCol("Other quotes:");
$table->addCol($otherValues, array (
"colspan" => $colspan
));
*/
$script = "<script>\$('.valueHeader').click(function(){\$('.isk').toggle();\$('.iph').toggle();})</script>";
// return the page
return "<h2>Ore <span class='valueHeader'>Quotes</span></h2>" . $script . $table->flush();
}
示例13: listRuns
//.........这里部分代码省略.........
// This is the table header.
$table_closed = new table(11, true);
$table_closed->addHeader(">> Archived Operations");
$table_closed->addRow("#060622");
$table_closed->addCol("Run ID");
$table_closed->addCol("Supervisor");
$table_closed->addCol("Op Type");
$table_closed->addCol("Starttime");
$table_closed->addCol("Endtime");
$table_closed->addCol("Location");
$table_closed->addCol("Security");
$table_closed->addCol("Yield");
$table_closed->addCol("TMEC(tm)");
$table_closed->addCol("Was official");
// Offer delete button.
if ($MySelf->canDeleteRun() && !$READONLY) {
$table_closed->addCol("Delete", $mode);
} else {
$table_closed->addCol("");
}
// Now we loop through each returned result.
while ($row = $results->fetchRow()) {
// Skip inofficial runs if user does not want to see them.
if (!$sirstate && !$row['isOfficial'] && !($MySelf->getID() == $row['supervisor'])) {
continue;
}
$table_closed->addRow();
$table_closed->addCol("<a href=\"index.php?action=show&id={$row['id']}\">" . str_pad($row['id'], 5, "0", STR_PAD_LEFT) . "</a>");
$table_closed->addCol(makeProfileLink($row['supervisor']));
$table_closed->addCol($row['optype'] == "" ? "Standard" : $row['optype']);
$table_closed->addCol(date("d.m.y H:i", $row['starttime']));
/* This handles the endtime. Prints endtime if it has already
* ended, or "active" along with an "end run"-link if still open.
*/
unset($tmp);
if ("{$row['endtime']}" == "") {
$tmp = "<b>active</b>";
// If access level is above or equal 3 give option to close run.
if ($MySelf->canCloseRun()) {
$tmp .= " (<a href=\"index.php?action=endrun&id={$row['id']}\">close run</a>)";
}
} else {
$tmp = date("d.m.y H:i", $row['endtime']);
}
// Add the end-time to the table.
$table_closed->addCol($tmp);
// Show the security status
$System = new solarSystem($row['location']);
if ($System->valid()) {
$table_closed->addCol($System->makeFancyLink());
$table_closed->addCol($System->getSecurity());
} else {
$table_closed->addCol(ucfirst($row['location']));
$table_closed->addCol("?");
}
// get the total ores gained.
$totalIsk = getTotalWorth($row['id']);
$table_closed->addCol(number_format($totalIsk, 2) . " ISK", array("style" => "text-align:right;"));
// Add the TMEC
if ($row['tmec'] == 0) {
$TMEC = calcTMEC($row['id']);
} else {
$TMEC = $row['tmec'];
}
$table_closed->addCol($TMEC, array("style" => "text-align:right;"));
// Add "run is official" bit.
$table_closed->addCol(yesno($row['isOfficial'], true), array("style" => "text-align:right;"));
$closedRunsExist = true;
// We wont print out table if there are no open runs.
// Add possible delete run button.
if ($MySelf->canDeleteRun() && !$READONLY) {
$table_closed->addCol("<a href=\"index.php?action=deleterun&id={$row['id']}\">delete</a>");
} else {
$table_closed->addCol("");
}
}
// The "show this many ops"-part.
$count = $DB->getCol("SELECT COUNT(id) FROM runs WHERE endtime > 0");
$countSteps = floor($count[0] / 20);
$showMore = "Switch to page >> ";
for ($i = 1; $i <= $countSteps; $i++) {
$thisStep = str_pad($i, 2, "0", STR_PAD_LEFT);
$showMore .= "[<a href=\"index.php?action=list&page=" . $thisStep . "\">" . $thisStep . "</a>] ";
}
$showMore .= "[<a href=\"index.php?action=list&page=all\">All</a>] ";
$table_closed->addHeader($showMore);
// Fancy it up!
$page = "<h2>Mining Operations</h2>";
// Print the open runs table, IF there are open runs.
if ($runsExist) {
$page .= $table->flush() . "<br>";
}
// Print the closed runs table, IF there are closed runs.
if ($closedRunsExist) {
$page .= $table_closed->flush();
} else {
$page .= "<i>There are no (closed) mining operations in the database. Is this a fresh installation?</i>";
}
return $page;
}
示例14: makeNewOreRunPage
//.........这里部分代码省略.........
$times = humanTime("toHuman", $TIMEMARK + 3600);
$timefield = "<input type=\"text\" name=\"ST_day\" size=\"4\" maxlength=\"2\" value=\"" . $times['day'] . "\">." . "<input type=\"text\" name=\"ST_month\" size=\"4\" maxlength=\"2\" value=\"" . $times['month'] . "\">." . "<input type=\"text\" name=\"ST_year\" size=\"6\" maxlength=\"4\" value=\"" . $times['year'] . "\">" . " " . "<input type=\"text\" name=\"ST_hour\" size=\"4\" maxlength=\"2\" value=\"" . $times['hour'] . "\">:" . "<input type=\"text\" name=\"ST_minute\" size=\"4\" maxlength=\"2\" value=\"00\">";
$orNow = "<input type=\"checkbox\" name=\"startnow\" value=\"true\" checked=\"checked\" > start now";
$or = " - or - ";
$table->addCol($orNow . $or . $timefield);
$table->addRow();
$table->addCol("format: day.month.year hour:minute", array("align" => "right", "colspan" => "2"));
// Now we need the sum of all ores.
//$totalOres = count($ORENAMES);
/*
// And the sum of all ENABLED ores.
$totalEnabledOres = $DB->getCol("select count(name) as active from config where name LIKE '%".$OPTYPE."Enabled' AND value='1'");
$totalEnabledOres = $totalEnabledOres[0];
*/
/*
* This is evil. We have to create an array that we fill up sorted.
* It aint cheap. First, we loop through all the ore values.
*/
/*
for ($p = 0; $p < $totalOres; $p++) {
// Then we check each ore if it is enabled.
$ORE = $DBORE[$ORENAMES[$p]];
if (getOreSettings($ORE,$OPTYPE)) {
// If the ore is enabled, add it to the array.
$left[] = $ORE;
} else {
// add to disabled-array.
$disabledOres[] = $ORE;
}
}
$totalEnabledOres = count($left);
// No ores enabled?
if ($totalEnabledOres == 0) {
makeNotice("Your CEO has disabled *all* the Oretypes. Please ask your CEO to reactivate at leat one Oretype.", "error", "No valid Oretypes!");
}
// The table is, rounded up, exactly half the size of all enabled ores.
$tableLength = ceil($totalEnabledOres / 2);
// Now, copy the lower second half into a new array.
$right = array_slice($left, $tableLength);
*/
/*
* So now we have an array of all the enabled ores. All we
* need to do now, is create a nice, handsome table of it.
* Loop through this array.
*/
/*
for ($i = 0; $i < $tableLength; $i++) {
// Fetch the right image for the ore.
$ri_words = str_word_count(array_search($left[$i], $DBORE), 1);
$ri_max = count($ri_words);
$ri = strtolower($ri_words[$ri_max -1]);
// Add a row.
$table->addRow();
// left side.
$table->addCol("<img width=\"20\" height=\"20\" src=\"./images/ores/" . array_search($left[$i], $DBORE) . ".png\"> <input type=\"text\" name=\"$left[$i]\" size=\"10\" value=\"0\"> " . array_search($left[$i], $DBORE) . " wanted. ");
// We need an ore type (just in case of odd ore numbers)
if ($right[$i] != "") {
// right side.
// Fetch the right image for the ore.
$ri_words = str_word_count(array_search($right[$i], $DBORE), 1);
$ri_max = count($ri_words);
$ri = strtolower($ri_words[$ri_max -1]);
// Add the column.
$table->addCol("<img width=\"20\" height=\"20\" src=\"./images/ores/" . array_search($right[$i], $DBORE) . ".png\"> <input type=\"text\" name=\"$right[$i]\" size=\"10\" value=\"0\"> " . array_search($right[$i], $DBORE) . " wanted. ");
} else {
// We have an odd number of ores: add empty cell.
$table->addCol("");
}
}
// Display the ore-disables-disclaimer. (Only if there are disabled oretypes.)
if (!empty ($disabled)) {
$disabledText = "The following Oretypes has been disabled by the CEO: $disabled";
}
*/
$submitbutton = "<input type=\"hidden\" name=\"check\" value=\"true\">" . "<input type=\"hidden\" value=\"addrun\" name=\"action\">" . "<input type=\"submit\" value=\"Create new Operation\" name=\"submit\">";
// El grande submit button!
$table->addHeaderCentered($submitbutton);
/*
// Show, if any, disabled ore-types.
if ($disabledText) {
$table->addRow();
$table->addCol("<br><br>" . $disabledText . ".", array (
"colspan" => "2"
));
}*/
// Render the table, and return it.
return "<h2>Create a new Operation</h2><form action=\"index.php\" method=\"POST\">" . $table->flush() . "</form>";
}
示例15: joinRun
function joinRun()
{
// Access the globals.
global $DB;
global $TIMEMARK;
global $MySelf;
$runid = (int) $_GET[id];
$userid = $MySelf->GetID();
// Are we allowed to join runs?
if (!$MySelf->canJoinRun()) {
makeNotice("You are not allowed to join mining operations. Please ask your CEO to unblock your account.", "error", "Forbidden");
}
// Is $runid truly an integer?
numericCheck($runid);
// Is the run still open?
if (!miningRunOpen($runid)) {
makeNotice("This mining operation has been closed!", "warning", "Can not join", "index.php?action=show&id={$runid}");
}
// Are we banned from the run?
$State = $DB->getCol("SELECT status FROM joinups WHERE run='{$runid}' and userid='" . $MySelf->getID() . "'ORDER BY id DESC LIMIT 1");
$State = $State[0];
switch ($State) {
case "2":
// We have been kicked.
$kicked = true;
break;
case "3":
// We have been banned!
if (runSupervisor($runid) == $MySelf->getUsername() || $MySelf->isOfficial()) {
$banned = "You have been banned from this operation but your rank overrides this block.";
} else {
makeNotice("You have been banned from this operation. You can not rejoin it.", "warning", "You are banned.", "index.php?action=list", "[cancel]");
}
break;
}
// Is the run locked?
if (runIsLocked($runid)) {
makeNotice("You can not join this run as this run has been locked by " . runSupervisor($runid) . ".", "notice", "Mining operation locked", "index.php?action=show&id={$runid}", "[Cancel]");
}
// Join with shiptype.
if (!$_GET['confirmed-ship']) {
$table = new table(1, true);
$table->addHeader(">> Join an Operation");
// If we have been kicked, inform the user.
if ($kicked) {
$table->addRow("#880000");
$table->addCol("Warning: You have been recently kicked. Please check if you are allowed to rejoin to avoid a ban.");
}
// If we are banned by an official, inform the user.
if ($banned) {
$table->addRow("#880000");
$table->addCol($banned);
}
$table->addRow();
$table->addCol($form . "Join the Operation in " . ucfirst(getLocationOfRun($runid)) . ".");
$table->addRow();
$table->addCol("You have requested to join mining operation #{$runid}. Please choose the shipclass " . "you are going to join up with.");
$table->addRow();
$table->addCol("Shiptype: " . $hiddenstuff . joinAs(), array("align" => "center"));
$table->addRow("#444455");
$table->addCol("<input type=\"submit\" name=\"submit\" value=\"Join mining operation\">" . $form_end, array("align" => "center"));
$page = "<h2>Join an Operation.</h2>";
$page .= "<form action=\"index.php\" method=\"GET\">";
$page .= "<input type=\"hidden\" name=\"id\" value=\"{$runid}\">";
$page .= "<input type=\"hidden\" name=\"confirmed-ship\" value=\"true\">";
$page .= "<input type=\"hidden\" name=\"confirmed\" value=\"true\">";
$page .= "<input type=\"hidden\" name=\"multiple\" value=\"true\">";
$page .= "<input type=\"hidden\" name=\"action\" value=\"joinrun\">";
$page .= $table->flush();
$page .= "</form>";
return $page;
}
// Sanitize the Shiptype.
global $SHIPTYPES;
$ShiptypesCount = count($SHIPTYPES);
if (!numericCheck($_GET[shiptype], 0, $ShiptypesCount)) {
makeNotice("The shiptype you tried to join up with is invalid, please go back, and try again.", "warning", "Shiptype invalid!", "index.php?action=show&id={$_GET['id']}");
} else {
$shiptype = $_GET[shiptype];
}
// Warn the user if he is already in another run.
$joinedothers = $DB->query("select run from joinups where userid='{$userid}' and parted IS NULL order by run");
// And check for that just now.
if ($joinedothers->numRows() > 0) {
confirm("You joined another mining operation already!<br>Are you sure you want to join multiple runs at the same time?");
}
// Get the correct time to join (in case event hasnt started yet)
$startOfRun = $DB->getCol("SELECT starttime FROM runs WHERE id='{$runid}' LIMIT 1");
if ($startOfRun[0] > $TIMEMARK) {
$time = $startOfRun[0];
} else {
$time = $TIMEMARK;
}
// Dont allow him to join the same mining run twice.
if (userInRun($MySelf->getID(), "{$runid}") == "none") {
// Mark user as joined.
$DB->query("insert into joinups (userid, run, joined, shiptype) values (?,?,?,?)", array("{$userid}", "{$runid}", "{$time}", "{$shiptype}"));
// Forward user to his joined run.
makeNotice("You have joined the Mining Operation.", "notice", "Joining confirmed", "index.php?action=show&id={$id}");
} else {
//.........这里部分代码省略.........