本文整理汇总了PHP中table::addHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP table::addHeader方法的具体用法?PHP table::addHeader怎么用?PHP table::addHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类table
的用法示例。
在下文中一共展示了table::addHeader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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());
}
示例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: 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;
}
示例4: 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;
}
示例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: makeNewOreRunPage
function makeNewOreRunPage()
{
// Load the globals.
global $VERSION;
global $SITENAME;
global $TIMEMARK;
global $ORENAMES;
global $DBORE;
global $DB;
global $MySelf;
$locationPDM = "";
// We need a list of all the previous run locations.
$locations = $DB->query("SELECT DISTINCT location FROM runs ORDER BY location");
if ($locations->numRows() > 0) {
while ($location = $locations->fetchRow()) {
$locationPDM .= "<option value=\"" . $location['location'] . "\">" . $location['location'] . "</option>";
}
$locationPDM = "<select name=\"locations\">" . $locationPDM . "</select>";
}
// Table
$table = new table(2, true);
$table->addHeader(">> Create a new operation");
$table->addRow();
// Field: Location.
$table->addCol("Location of Operation:");
if ($locationPDM) {
// We have at least one possible System we hauled before.
$table->addCol($locationPDM . " -or- <input type=\"text\" name=\"location\">");
} else {
// There are not target systems in the database.
if (getConfig("trustSetting") > 0) {
$table->addCol("<input type=\"text\" value=\"" . $_SERVER['HTTP_EVE_SOLARSYSTEMNAME'] . "\" name=\"location\">");
} else {
$table->addCol("<input type=\"text\" name=\"location\">");
}
}
$pdm = "";
// Field: Officer in Charge
if ($MySelf->isOfficial()) {
$SeniorUsers = $DB->getCol("SELECT DISTINCT username FROM users WHERE canCreateRun = 1 AND deleted='0' ORDER BY username");
foreach ($SeniorUsers as $senior) {
if ($MySelf->getUsername() == "{$senior}") {
$pdm .= "<option value=\"{$senior}\" selected>" . ucwords($senior) . "</option>";
} else {
$pdm .= "<option value=\"{$senior}\">" . ucwords($senior) . "</option>";
}
$seniorUsersPDM = "<select name=\"supervisor\">" . $pdm . "</select>";
}
} else {
// In case the user is not a senior member he can not change the officer in charge.
$seniorUsersPDM = ucfirst($MySelf->getUsername());
$seniorUsersPDM .= "<input type=\"hidden\" name=\"supervisor\" value=\"" . $MySelf->getUsername() . "\">";
}
// We have no senior member (aka: people who may start runs)
if (!$seniorUsersPDM) {
makeNotice("No one from your current users may create or lead a mining operation. Please give out appropiate permissions.", "warning", "Insufficient Rights");
} else {
$table->addRow();
$table->addCol("Executing Officer:");
$table->addCol($seniorUsersPDM);
}
$table->addRow();
$table->addCol("Op Type:");
$OPTYPE = isset($_REQUEST['optype']) ? $_REQUEST['optype'] : "";
$ops = $DB->getAll("select opName from opTypes;");
if ($DB->isError($ops)) {
die($ops->getMessage());
}
$opSelect = "<select name='optype' onChange='window.location = \"?action=newrun&optype=\"+this.value'>\n";
$opSelect .= "<option value=''>Standard</option>\n";
foreach ($ops as $op) {
$default = $op['opName'] == $OPTYPE ? "selected" : "";
$opSelect .= "<option {$default} value='" . $op['opName'] . "'>" . $op['opName'] . "</option>\n";
}
$opSelect .= "</select>";
$table->addCol($opSelect);
// Field: Corporation keeps.
$table->addRow();
$table->addCol("Corporation keeps:");
// Get the average amount.
if ($MySelf->isOfficial()) {
if (!getConfig("defaultTax")) {
// No default tax has been defined in the config file, generate our own.
$tax = $DB->getCol("SELECT AVG(corpKeeps) AS tax FROM runs;");
$tax = round($tax[0]);
// in case there are no taxes yet AND no default has been set.
if (!$tax) {
$tax = "15";
}
} else {
if ($OPTYPE == "Shopping") {
$tax = "0";
} else {
// Set the default tax, according to config.
$tax = getConfig("defaultTax");
}
}
$table->addCol("<input readonly=\"readonly\" type=\"text\" maxlength=\"3\" value=\"{$tax}\" size=\"4\" name=\"corpkeeps\">% of gross value.");
} else {
$table->addCol("As this is not an official Op, no tax is deducted.");
//.........这里部分代码省略.........
示例9: manageWallet
function manageWallet()
{
// Globals
global $MySelf;
global $DB;
$MyCredits = getCredits($MySelf->getID());
// Get (recent?) transactions
$html = getTransactions($MySelf->getID());
if ($MyCredits > 0) {
// Create the dropdown menu with all pilots.
$NamesDS = $DB->query("SELECT DISTINCT username, id FROM users WHERE deleted='0' ORDER BY username");
$ddm = "<select name=\"to\">";
while ($name = $NamesDS->fetchRow()) {
// Lets not allow transfers to self.
if ($name[id] != $MySelf->getID()) {
$ddm .= "<option value=\"" . $name[id] . "\">" . ucfirst($name[username]) . "</option>";
}
}
$ddm .= "</select>";
$tt = new table(2, true);
$tt->addHeader(">> Transfer ISK");
$tt->addRow("#060622");
$tt->addCol("You can transfer ISK into another Pilots wallet by using this form.", array("colspan" => 2));
$tt->addRow();
$tt->addCol("Transfer from:");
$tt->addCol(ucfirst($MySelf->getUsername()));
$tt->addRow();
$tt->addCol("Transfer to:");
$tt->addCol($ddm);
$tt->addRow();
$tt->addCol("Amount:");
$tt->addCol("<input type=\"text\" name=\"amount\">");
$tt->addRow();
$tt->addCol("Reason:");
$tt->addCol("<input type=\"text\" name=\"reason\">");
$tt->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Transfer money\">");
// Create form stuff, and embed the table within.
$transfer = "<form action=\"index.php\" method=\"POST\">";
$transfer .= $tt->flush();
$transfer .= "<input type=\"hidden\" name=\"check\" value=\"true\">";
$transfer .= "<input type=\"hidden\" name=\"action\" value=\"transferMoney\">";
$transfer .= "</form>";
// Create the payout form.
$payout = new table(2, true);
$payout->addHeader(">> Request payout");
$payout->addRow("#060622");
$payout->addCol("Fill out this form to request payout of ISK. An accountant will honor your request soon.", array("colspan" => 2));
$payout->addRow();
$payout->addCol("Payout amount:");
$payout->addCol("<input type=\"text\" name=\"amount\" value=\"" . $MyCredits . "\"> ISK");
$payout->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"request payout\">");
// Create form stuff, and embed the table within.
$requestPayout = "<form action=\"index.php\" method=\"POST\">";
$requestPayout .= $payout->flush();
$requestPayout .= "<input type=\"hidden\" name=\"check\" value=\"true\">";
$requestPayout .= "<input type=\"hidden\" name=\"action\" value=\"requestPayout\">";
$requestPayout .= "</form>";
}
/*
* Show current requests
*/
$requests = $DB->query("SELECT * FROM payoutRequests WHERE payoutTime IS NULL AND applicant='" . $MySelf->getID() . "' ORDER BY time");
$table = new table(4, true);
$table->addHeader(">> Pending payout requests");
$table->addRow("#060622");
$table->addCol("request");
$table->addCol("time");
$table->addCol("amount");
$table->addCol("Cancel");
while ($request = $requests->fetchRow()) {
$table->addRow();
$table->addCol("#" . str_pad($request[request], "5", "0", STR_PAD_LEFT));
$table->addCol(date("d.m.y H:i:s", $request[time]));
$table->addCol(number_format($request[amount], 2) . " ISK");
$table->addCol("<input type=\"checkbox\" name=\"" . $request[request] . "\" value=\"true\">");
$haveRequest = true;
}
$table->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"cancel marked requests\">");
$takeBack = "<form action=\"index.php\" method=\"POST\">";
$takeBack .= "<input type=\"hidden\" name=\"check\" value=\"true\">";
$takeBack .= "<input type=\"hidden\" name=\"action\" value=\"deleteRequest\">";
$takeBack .= $table->flush();
$rakeBack .= "</form>";
/*
* Show fulfilled requests
*/
$requests = $DB->query("SELECT * FROM payoutRequests WHERE payoutTime IS NOT NULL AND applicant='" . $MySelf->getID() . "' ORDER BY time");
$table_done = new table(5, true);
$table_done->addHeader(">> Fulfilled payout requests");
$table_done->addRow("#060622");
$table_done->addCol("request");
$table_done->addCol("time");
$table_done->addCol("amount");
$table_done->addCol("Payout time");
$table_done->addCol("Paid by");
while ($request = $requests->fetchRow()) {
$table_done->addRow();
$table_done->addCol("#" . str_pad($request[request], "5", "0", STR_PAD_LEFT));
$table_done->addCol(date("d.m.y H:i:s", $request[time]));
$table_done->addCol(number_format($request[amount], 2) . " ISK");
//.........这里部分代码省略.........
示例10: makeCanPage
function makeCanPage()
{
// Defining some globals.
global $DB;
global $TIMEMARK;
global $MySelf;
global $PREFS;
$USERNAME = $MySelf->getUsername();
$USERID = $MySelf->getID();
$TTL = getConfig("canLifeTime") * 60;
// is the cargo module active?
if (!getConfig("cargocontainer")) {
makeNotice("The admin has deactivated the events module.", "warning", "Module not active");
}
// Get all current locations.
$locations = $DB->getCol("SELECT DISTINCT location FROM runs ORDER BY location");
// Get all current cans.
$cans = $DB->getAssoc("SELECT * from cans");
// Get last can-nr.
$canNaming = $PREFS->getPref("CanNaming");
// Query the database accordingly.
if ($canNaming == 1) {
$maxCan = $DB->getCol("SELECT MAX(name) as max FROM cans WHERE pilot = '{$USERID}'");
} else {
$maxCan = $DB->getCol("SELECT MAX(name) as max FROM cans");
}
// For can-naming: Increment the number.
if ($maxCan[0] == "") {
// No can jettisoned yet.
$canname = "001";
} else {
if (is_numeric($maxCan[0])) {
// Can ejected, and it is numeric, we can increase that number.
$canname = str_pad($maxCan[0] + 1, "3", "0", STR_PAD_LEFT);
} else {
// User entered some non-numerical stuff, can not increase.
unset($canname);
}
}
// Get the system the users mining operation takes place in, if any.
$myRun = userInRun($USERNAME);
if ($myRun != false) {
$myLocation = $DB->getCol("SELECT location FROM runs WHERE id='{$myRun}'");
$myLocation = $myLocation[0];
}
// Assemble the locations dropdown menu.
if (!empty($locations)) {
// Loop through all the locations.
foreach ($locations as $location) {
// And preselect the location the users miningrun takes place, if any.
if ("{$location}" == "{$myLocation}") {
$ddm .= "<option selected value=\"{$location}\">{$location}</option>";
} else {
$ddm .= "<option value=\"{$location}\">{$location}</option>";
}
}
}
// Select all current cans owned by the pilot.
$CansDS = $DB->query("SELECT location, droptime, name, id, isFull, miningrun FROM cans WHERE pilot = '{$USERID}' ORDER BY droptime ASC");
if ($CansDS->numRows() > 0) {
// We have at least one can out there, lets do this.
$myCans = new table(7, true);
$myCans->addHeader(">> My cargo containers in space");
$mode = array("bold" => true);
$myCans->addRow("#060622");
$myCans->addCol("Name", $mode);
$myCans->addCol("Location", $mode);
$myCans->addCol("Self or Run", $mode);
$myCans->addCol("Droptime", $mode);
$myCans->addCol("est. Poptime", $mode);
$myCans->addCol("Time Left", $mode);
$myCans->addCol("Can is full", $mode);
while ($can = $CansDS->fetchRow()) {
$candroptime = $can[droptime];
// Time of can drop.
$poptime = $candroptime + $TTL;
// Extimated pop time (droptime + 1h)
$timeleft = $candroptime + $TTL - $TIMEMARK;
// Time left (poptime - current time)
$minsleft = str_pad(number_format(($timeleft - 60) / 60, 0), "2", "0", STR_PAD_LEFT);
$secsleft = str_pad($timeleft % 60, "2", "0", STR_PAD_LEFT);
if ($secsleft < 1) {
// We want all negative amounts to read "00".
$secsleft = "00";
}
// Colorize the remaining time
if ($minsleft >= 30) {
// More or equal 30 mins: Green. We are cool.
$color = "#88ff88";
} elseif ($minsleft <= 29 && $minsleft >= 15) {
// Less or equal 29 mins: Yellow, keep an eye out.
$color = "#FFFF00";
} elseif ($minsleft < 15) {
// Less than 15 minutes: Ayee! RED! Refresh!s
$color = "#FF0000";
}
$myCans->addRow();
$myCans->addCol("<a href=\"index.php?action=popcan&id={$can['id']}\"><b>{$can['name']}</b></a>");
$system = new solarSystem($can[location]);
$myCans->addCol($system->makeFancyLink());
//.........这里部分代码省略.........
示例11: makeWelcome
function makeWelcome()
{
// Load the globals.
global $VERSION;
global $SITENAME;
global $IGB;
global $IGB_VISUAL;
global $MySelf;
global $DB;
global $ValidUntil;
/* HTML stuff */
$page = "<h2>Welcome to {$VERSION}!</h2>";
/* The welcome table */
$table = new table(2, true);
$table->addHeader(">> Welcome to {$VERSION}");
$table->addRow();
$table->addCol("Logged in as:", array("bold" => true, "align" => "right"));
$table->addCol(ucfirst($MySelf->getUsername()));
$table->addRow();
$table->addCol("Registered Rank:", array("bold" => true, "align" => "right"));
$table->addCol($MySelf->getRankName());
$table->addRow();
$table->addCol("Latest login:", array("bold" => true, "align" => "right"));
if ($MySelf->getLastlogin() < 1) {
$table->addCol("This is your very first login! Welcome!");
} else {
$table->addCol(date("r", $MySelf->getLastlogin()));
}
$table->addRow();
$table->addCol("Your account:", array("bold" => true, "align" => "right"));
$table->addCol(number_format(getCredits($MySelf->getID()), 2) . " ISK");
$table->addRow();
$table->addCol("Your profile:", array("bold" => true, "align" => "right"));
$table->addCol(makeProfileLink($MySelf->getID()));
global $BLESSED;
if ($BLESSED) {
$table->addRow("#330000");
$table->addCol("Installation Blessed!", array("bold" => true, "align" => "right"));
$table->addCol("It is not affected by expiration. It runs with the highest priority on the server and all limitations have been lifted.");
}
// Set the filename to the announce textfile.
$announceFile = "/path/to/your/announce/txt.file";
// Check its existance...
if (file_exists($announceFile)) {
// Then load it.
$globalAnnounce = file_get_contents($announceFile);
}
// Only display contents if more than X characters long.
if (strlen($globalAnnounce) > 10) {
// Create announcement table...
$announceTable = new table(1, true);
$announceTable->addHeader(">>> Important hosting information");
$announceTable->addRow();
$announceTable->addCol("{$globalAnnounce}");
// ... and add it to the page.
$page .= $announceTable->flush();
}
$page .= $table->flush();
/* Show failed Logins to admins. */
if ($MySelf->isAdmin()) {
$page .= showFailedLogins("15");
} else {
$page .= showFailedLogins("10", $MySelf->getUsername());
}
/* permissions table */
$permsTable = new table(1, true);
$permsTable->addHeader(">> Your permissions");
// Permissions matrix
$perms = array("canLogin" => "log in.", "canJoinRun" => "join mining operations.", "canCreateRun" => "create new mining operations.", "canCloseRun" => "close mining operations.", "canDeleteRun" => "delete mining operations.", "canAddHaul" => "haul to mining operations.", "canSeeEvents" => "view scheduled events.", "canEditEvents" => "add and delete scheduled events.", "canChangePwd" => "change your own password.", "canChangeEmail" => "change your own email.", "canChangeOre" => "manage ore prices and enable/disable them.", "canAddUser" => "add new accounts.", "canSeeUsers" => "see other accounts.", "canDeleteUser" => "delete other accounts.", "canEditRank" => "edit other peoples ranks.", "canManageUser" => "grant and take permissions.", "isAccountant" => "manage the corporation wallet and authorize payments.", "isOfficial" => "create official mining runs (with payout).");
$permDS = $DB->getAssoc("SELECT * FROM users WHERE id='" . $MySelf->getID() . "' AND deleted='0'");
$keys = array_keys($perms);
foreach ($keys as $key) {
if ($permDS[$MySelf->getID()][$key] == 1) {
$permsTable->addRow();
$permsTable->addCol("You are allowed to " . $perms[$key]);
}
}
$permsTable->addHeader("If you believe your permissions are faulty, consult your CEO immediatly.");
// Show the balance
$balance = getTransactions($MySelf->getID());
$logins = getLogins($MySelf->getID());
$page .= "<br>" . $balance . "<br>" . $permsTable->flush() . "<br>" . $logins;
// .. then return it.
return $page;
}
示例12: table
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Create a new table for the general info.
$general_info = new table(2, true);
// Header
$general_info->addHeader(">> General Information");
// Row: Mining Run ID
$general_info->addRow();
$general_info->addCol("Mining ID:", $common_mode);
$general_info->addCol(str_pad($row['id'], 5, "0", STR_PAD_LEFT));
// Row: Is official run?
$general_info->addRow();
$general_info->addCol("This run is official:", $common_mode);
$general_info->addCol(yesno($row['isOfficial'], true));
// Row: Op Type
$general_info->addRow();
$general_info->addCol("Op Type:", $common_mode);
$general_info->addCol($row['optype'] == "" ? "Standard" : $row['optype']);
// Row: Supervisor Name
$general_info->addRow();
$general_info->addCol("Supervisor:", $common_mode);
示例13: showEvent
function showEvent()
{
// Lets import some globals, shall we?
global $MySelf;
global $DB;
global $TIMEMARK;
$ID = $MySelf->getID();
// is the events module active?
if (!getConfig("events")) {
makeNotice("The admin has deactivated the events module.", "warning", "Module not active");
}
// Are we allowed to be here?
if (!$MySelf->canSeeEvents()) {
makeNotice("You are not allowed to do this!", "error", "Forbidden");
}
// Is the ID safe?
if (!is_numeric($_GET[id]) || $_GET[id] < 0) {
makeNotice("Invalid ID given!", "error", "Invalid Data");
}
// Load the event.
$EVENTS = $DB->getRow("SELECT * FROM events WHERE id='{$_GET['id']}'");
$mission = new table(2, true);
$mission->addHeader(">> Mission information");
$mission->addRow();
$mission->addCol("Mission ID:");
$mission->addCol(str_pad("{$EVENTS['id']}", 5, "0", STR_RIGHT_PAD));
$mission->addRow();
$mission->addCol("Mission Type:");
$mission->addCol($EVENTS[type]);
$mission->addRow();
$mission->addCol("Executing Officer:");
// In case of a numeric value we have to translate that into plain english.
if (is_numeric($EVENTS[officer])) {
$officer = idToUsername($EVENTS[officer]);
} else {
$officer = $EVENTS[officer];
}
$mission->addCol(ucfirst($officer));
$mission->addRow();
$mission->addCol("System:");
$mission->addCol(ucfirst($EVENTS[system]));
$mission->addRow();
$mission->addCol("Security:");
$mission->addCol($EVENTS[security]);
// Has the event started yet?
$delta = $TIMEMARK - $EVENTS[starttime];
if ($delta > 0) {
// Yep!
$mission->addRow();
$mission->addCol("Mission underway for:");
$mission->addCol(numberToString($delta));
} else {
// Nope!
$delta = $delta * -1;
$mission->addRow();
$mission->addCol("Mission will start in:");
$mission->addCol(numberToString($delta));
}
$mission->addRow();
$mission->addCol("Est. Duration:");
$mission->addCol($EVENTS[duration]);
// How difficult is it?
$mission->addRow();
$mission->addCol("Difficulty:");
switch ($EVENTS[difficulty]) {
case 0:
$mission->addCol("No risk involved");
break;
case 1:
$mission->addCol("Inferior forces");
break;
case 2:
$mission->addCol("Adequate forces");
break;
case 3:
$mission->addCol("Major forces expected");
break;
case 4:
$mission->addCol("Superior forces expected");
break;
case 5:
$mission->addCol("Suicide Mission");
break;
}
$mission->addRow();
$mission->addCol("Payment:");
$mission->addCol($EVENTS[payment]);
$mission->addRow();
$mission->addCol("Collateral:");
$mission->addCol(number_format($EVENTS[collateral]));
$mission->addRow();
$mission->addCol("Notes:");
$mission->addCol(nl2br($EVENTS[notes]));
$shipsTable = new table(3, true);
$shipsTable->addHeader(">> Shiptypes and Joinups");
// Compute the wanted Ships.
$ships = unserialize($EVENTS[ships]);
$SHIPTYPES = array("shuttles", "frigates", "destroyers", "cruisers", "bcruiser", "scruiser", "bship", "dread", "carrier", "titan", "barges", "indies", "freighter", "jfreighter", "exhumer");
$TRANSLATE = array("shuttles" => "Shuttle", "frigates" => "Frigate", "destroyers" => "Destroyer", "cruisers" => "Cruiser", "bcruiser" => "Battlecruiser", "scruiser" => "Strategic Cruiser", "bship" => "Battleship", "dread" => "Dreadnought", "carrier" => "Carrier", "titan" => "Titan", "barges" => "Mining Barge", "indies" => "Industrial Ship", "freighter" => "Freighter", "jfreighter" => "Jump Freighter", "exhumer" => "Exhumer");
$shipsTable->addRow("#060622");
//.........这里部分代码省略.........
示例14: showOreValue
function showOreValue()
{
// Get the globals.
global $ORENAMES;
global $DBORE;
global $DB;
global $STATIC_DB;
// load the values.
$latestDS = $DB->query("select item, Worth, time, modifier, t.volume from orevalues a, {$STATIC_DB}.invTypes t where a.item = replace(replace(t.typeName,'-',''),' ','') and time = (select max(time) from orevalues b where a.item = b.item) group by item ORDER BY time DESC");
if (!isset($_GET['id'])) {
// No ID requested, get latest
$orevaluesDS = $latestDS;
$isLatest = true;
} else {
if (!is_numeric($_GET['id']) || $_GET['ID'] < 0) {
// ID Set, but invalid
makeNotice("Invalid ID given for ore values! Please go back, and try again!", "warning", "Invalid ID");
} else {
// VALID id
//$orevaluesDS = $DB->query("select distinct item, from orevalues WHERE time='" . sanitize($_GET[id]) . "' limit 1");
$orevaluesDS = $DB->query("select item, Worth, time, modifier, t.volume from orevalues a, {$STATIC_DB}.invTypes t where a.item = t.typeName and time = (select max(time) from orevalues b where a.item = b.item and time <= '" . sanitize($_GET['id']) . "') group by item ORDER BY time DESC");
}
}
// Check for a winner.
if ($orevaluesDS->numRows() <= 0) {
makeNotice("Invalid ID given for ore values! Please go back, and try again!", "warning", "Invalid ID");
}
// Check for latest orevalue
if (!$isLatest) {
$isLatest = true;
while ($row = $latestDS->fetchRow()) {
$latest[$row['item']] = $row;
if ($row['time'] < sanitize($_GET['id'])) {
$isLatest = false;
}
}
}
$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("");
//.........这里部分代码省略.........
示例15: payout
function payout()
{
// Some globals needed.
global $DB;
global $TIMEMARK;
global $MySelf;
global $IGB;
global $IGB_VISUAL;
// Are we allowed to do this?
if (!$MySelf->isAccountant()) {
makeNotice("You are not an accountant to your corporation. Access denied.", "error", "Access denied");
}
/*
* Amount of ISK owned.
*/
$iskOwned = new table(2, true);
$iskOwned->addHeader(">> Outstanding ISK");
// Load all unique members from the database.
$uniqeMembers = $DB->query("SELECT DISTINCT id FROM users WHERE deleted='0' ORDER BY username ASC");
// Create a row for each member.
while ($id = $uniqeMembers->fetchRow()) {
$playerCreds = getCredits($id['id']);
// We need this later on...
$allPeeps[$id['id']] = ucfirst(idToUsername($id['id']));
// if the member has more or less than zero isk, list him.
if ($playerCreds != 0) {
$iskOwned->addRow();
$iskOwned->addCol("<a href=\"index.php?action=showTransactions&id=" . $id['id'] . "\">" . $allPeeps[$id['id']] . "</a>");
$iskOwned->addCol(number_format($playerCreds, 2) . " ISK");
}
}
// Show the total isk owned.
$outstanding = totalIskOwned();
$iskOwned->addRow("#060622");
$iskOwned->addCol(">> Total Outstanding ISK:");
$iskOwned->addCol(totalIskOwned() . " ISK");
/*
* Show a drop down menu to create a menu to see everyones transaction log.
*/
$freeSelect = new table(2, true);
$freeSelect->addHeader(">> Lookup specific transaction log");
// Create a PDM for all the peoples.
foreach ($allPeeps as $peep) {
$pdm .= "<option value=\"" . array_search($peep, $allPeeps) . "\">{$peep}</option>";
}
$freeSelect->addRow();
$freeSelect->addCol("Show log of ", array("align" => "right"));
$freeSelect->addCol("<select name=\"id\">{$pdm}</select>");
$freeSelect->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Lookup log in Database\">");
unset($pdm);
/*
* Show current requests
*/
$requests = $DB->query("SELECT * FROM payoutRequests WHERE payoutTime IS NULL ORDER BY time DESC");
if ($IGB && $IGB_VISUAL) {
$table = new table(6, true);
} else {
$table = new table(5, true);
}
$table->addHeader(">> Pending payout requests");
$table->addRow("#060622");
$table->addCol("request");
$table->addCol("applicant");
if ($IGB && $IGB_VISUAL) {
$table->addCol("right click menu");
}
$table->addCol("time");
$table->addCol("amount");
$table->addCol("Payout");
while ($request = $requests->fetchRow()) {
if ($IGB && $IGB_VISUAL) {
$api = new api($request['applicant']);
// $profile = new profile($request['applicant']);
if ($api->valid() && ($IGB && $IGB_VISUAL)) {
$rcm = " [<a href=\"showinfo:1378//" . $api->getCharacterID() . "\">RCM</a>]";
}
}
$table->addRow();
$table->addCol("#" . str_pad($request['request'], "5", "0", STR_PAD_LEFT));
$table->addCol("<a href=\"index.php?action=showTransactions&id={$request['applicant']}\">" . ucfirst(idToUsername($request['applicant'])) . "</a>");
if ($IGB && $IGB_VISUAL) {
$table->addCol($rcm);
}
$table->addCol(date("d.m.y H:i:s", $request['time']));
if (getCredits($request['applicant']) < $request['amount']) {
$class .= "red";
}
if ($IGB && $IGB_VISUAL) {
$table->addCol("<input type=\"text\" class=\"{$class}\" name=\"dumb\" readonly value=\"" . number_format($request['amount'], 2) . "\"> ISK");
} else {
$table->addCol(number_format($request['amount'], 2) . " ISK", array("class" => $class));
}
// Can the user still cover his request with cash?
$table->addCol("<input type=\"checkbox\" name=\"" . $request['request'] . "\" value=\"true\">");
$haveRequest = true;
//} else {
// $table->addCol("<i>not enough ISK</i>");
//}
}
$table->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Mark as paid\">");
//.........这里部分代码省略.........