本文整理汇总了PHP中table::addHeaderCentered方法的典型用法代码示例。如果您正苦于以下问题:PHP table::addHeaderCentered方法的具体用法?PHP table::addHeaderCentered怎么用?PHP table::addHeaderCentered使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类table
的用法示例。
在下文中一共展示了table::addHeaderCentered方法的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: 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;
}
示例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: 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;
}
示例5: 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());
}
示例6: listUser
//.........这里部分代码省略.........
} else {
$apit->addCol(yesno(0));
}
// Permissions matrix
$perms = array("canLogin" => "log in", "canJoinRun" => "join mining Ops", "canCreateRun" => "create new mining Ops", "canCloseRun" => "close mining Ops", "canDeleteRun" => "delete mining Ops", "canAddHaul" => "haul from/to mining Ops", "canSeeEvents" => "view scheduled events", "canDeleteEvents" => "can delete events", "canEditEvents" => "add and delete scheduled events", "canChangePwd" => "change his own password", "canChangeEmail" => "change his 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.", "isOfficial" => "create official mining runs (with payout).", "isAdmin" => "edit site settings.", "isLottoOfficial" => "administrate the lottery", "canPlayLotto" => "play Lotto!", "isAccountant" => "edit other users credits.", "optIn" => "User has opt-in to eMails.");
// Create a seperate permissions table.
$perm_table = new table(2, true);
$perm_table->addHeader(">> " . ucfirst($row[username]) . " has permission to... ");
$perm_keys = array_keys($perms);
$LoR = 1;
foreach ($perm_keys as $key) {
if ($LoR) {
$perm_table->addRow();
}
if ($row[$key]) {
$perm_table->addCol("<input type=\"checkbox\" name=\"{$key}\" checked> " . $perms[$key]);
} else {
$perm_table->addCol("<input type=\"checkbox\" name=\"{$key}\"> " . $perms[$key]);
}
$LoR = 1 - $LoR;
}
if (!$LoR) {
$perm_table->addCol();
}
// Delete User
$perm_table->addRow();
$perm_table->addCol("<hr>", array("colspan" => 2));
$perm_table->addRow();
$perm_table->addCol("Delete user:");
$perm_table->addCol("<input type=\"checkbox\" name=\"delete\" value=\"true\"> Tick box to delete the user permanently.");
$perm_table->addRow();
$perm_table->addCol("<hr>", array("colspan" => 2));
// Commit changes button.
$perm_table->addHeaderCentered("<input type=\"submit\" name=\"send\" value=\"Commit changes\">", array("colspan" => 2, "align" => "center"));
}
$form .= "<form action=\"index.php\" method=\"POST\">";
$form .= "<input type=\"hidden\" name=\"id\" value=\"" . $_GET[id] . "\">";
$form .= "<input type=\"hidden\" name=\"check\" value=\"true\">";
$form .= "<input type=\"hidden\" name=\"action\" value=\"edituser\">";
// Show all logins.
$logins = getLogins($id);
// Show failed logins.
$failed_logins = showFailedLogins("15", idToUsername($id));
/*
* Transactions.
*/
if ($MySelf->isAccountant()) {
$acc = new table(2, true);
$acc->addHeader(">> Create transaction to user " . ucfirst(idToUsername($id)));
$acc->addRow();
$acc->addCol("Credit to:");
$acc->addCol($username);
$acc->addRow();
$acc->addCol("Authorization by:");
$acc->addCol(ucfirst($MySelf->getUsername()));
$acc->addRow();
$acc->addCol("Time of Transaction:");
$acc->addCol(date("r", $TIMEMARK));
$acc->addRow();
$acc->addCol("Withdrawal or deposit:");
$pdm = "<select name=\"wod\">";
$pdm .= "<option value=\"0\">Deposit (give money)</option>";
$pdm .= "<option SELECTED value=\"1\">Withdrawal (take money)</option>";
$pdm .= "</select>";
$acc->addCol($pdm);
$acc->addRow();
示例7: makeCanPage
//.........这里部分代码省略.........
} 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());
// Can for self or mining run?
if ($can[miningrun] >= 0) {
$myCans->addCol("<a href=\"index.php?action=show&id={$can['miningrun']}\">" . str_pad($can[miningrun], "5", "0", STR_PAD_LEFT) . "</a>");
} else {
$myCans->addCol("(for self)");
}
$myCans->addCol(date("H:i:s", $can[droptime]));
$myCans->addCol(date("H:i:s", $poptime));
// Can popped already?
if ($minsleft > 0) {
$myCans->addCol("<font color=\"{$color}\">" . numberToString($timeleft) . "</font>");
} else {
$myCans->addCol("<font color=\"{$color}\">POPPED</font>");
}
// Can full?
if ($can[isFull]) {
$myCans->addCol("<a href=\"index.php?action=togglecan&canid={$can['id']}\"><font color=\"#00ff00\">YES</font></a>");
} else {
$myCans->addCol("<a href=\"index.php?action=togglecan&canid={$can['id']}\">No</a>");
}
}
// The delete all button.
$myCans->addHeaderCentered("[<a href=\"index.php?action=popcan&id=all\">pop all cans</a>]");
$MyCansExist = true;
}
// Select all current cans, belonging to the mining run.
$MiningRun = userInRun($MySelf->getUsername());
if ($MiningRun) {
$CansDS = $DB->query("SELECT location, droptime, name, pilot, isFull, miningrun FROM cans WHERE miningrun='{$MiningRun}' ORDER BY droptime ASC");
if ($CansDS->numRows() > 0) {
// We got one or more can floating around that belong to our mining run.
$runCans = new table(7, true);
$runCans->addHeader(">> My operations's cargo containers in space");
$runCans->addRow("#060622");
$runCans->addCol("Name", $mode);
$runCans->addCol("Owner", $mode);
$runCans->addCol("Location", $mode);
$runCans->addCol("Droptime", $mode);
$runCans->addCol("est. Poptime", $mode);
$runCans->addCol("time remaining", $mode);
$runCans->addCol("is full", $mode);
while ($can = $CansDS->fetchRow()) {
// Same as above.
$candroptime = $can[droptime];
$timeleft = $candroptime + $TTL - $TIMEMARK;
$minsleft = str_pad(number_format(($timeleft - 60) / 60, 0), "2", "0", STR_PAD_LEFT);
$secsleft = str_pad($timeleft % 60, "2", "0", STR_PAD_LEFT);
$poptime = $candroptime + $TTL;
// No negative minutes..
if ($secsleft < 1) {
$secsleft = "00";
}
// Colorize..
if ($minsleft >= 30) {
$color = "#88ff88";
示例8: 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\">");
//.........这里部分代码省略.........
示例9: makeInfoTable
public function makeInfoTable()
{
$systemTable = new table(2, true);
$systemTable->addHeader("System Information");
if ($this->valid()) {
$systemTable->addRow();
$systemTable->addCol("System Name:");
$systemTable->addCol("<a href=\"index.php?action=browse&mode=0&id=" . $this->solarSystemID . "\">" . $this->getName() . "</a> (<a target=\"_blank\" href=\"http://www.staticmapper.com/index.php?system=" . $this->getName() . "\">static mapper</a>) (<a target=\"_blank\" href=\"http://evemaps.dotlan.net/system/" . $this->getName() . "\">dotlan</a>)");
$systemTable->addRow();
$systemTable->addCol("Constellation:");
$systemTable->addCol($this->getConstellation());
$systemTable->addRow();
$systemTable->addCol("Region:");
$systemTable->addCol($this->getRegion());
$systemTable->addRow();
$systemTable->addCol("Security Status:");
$systemTable->addCol($this->getSecurity());
} else {
$systemTable = new table(2, true);
$systemTable->addHeader("System Information");
$systemTable->addRow();
$systemTable->addCol("System Name:");
$systemTable->addCol(ucfirst($this->solarSystemName));
$systemTable->addHeaderCentered("No EVE data has been found for this system in the database.");
}
return $systemTable->flush();
}
示例10: 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;
}
示例11: makeShipValue
function makeShipValue()
{
// Get the globals.
global $TIMEMARK;
global $SHIPTYPES;
global $DBSHIP;
global $DB;
// load the values.
$shipvaluesDS = $DB->query("select * from shipvalues order by id DESC limit 1");
$shipvalues = $shipvaluesDS->fetchRow();
// Create the table.
$table = new table(6, true);
//(8, true)
$table->addHeader(">> Manage ship values (Values may be as little as 0.01% and as high as 999.99%)", array("bold" => true, "colspan" => 6));
$table->addRow();
$table->addCol("Ship Type", array("colspan" => 2, "bold" => true));
// $table->addCol("Enabled", array (
// "bold" => true
// ));
$table->addCol("Value", array("bold" => true));
$table->addCol("Ship Type", array("colspan" => 2, "bold" => true));
// $table->addCol("Enabled", array (
// "bold" => true
// ));
$table->addCol("Value", array("bold" => true));
// How many Ships are there in total? Ie, how long has the table to be?
$tableLength = ceil(count($SHIPTYPES) / 2) - 2;
for ($i = 0; $i <= $tableLength; $i++) {
$table->addRow();
$SHIP = $SHIPTYPES[$i];
// Ship columns for LEFT side.
$table->addCol("<img width=\"32\" height=\"32\" src=\"./images/ships/ship.png\">");
$table->addCol($SHIP);
// if (getShipSettings($DBSHIP[$SHIP])) {
// $table->addCol("<input name=\"" . $DBSHIP[$SHIP] . "Enabled\" value=\"true\" type=\"checkbox\" checked=\"checked\">");
// } else {
// $table->addCol("<input name=\"" . $DBSHIP[$SHIP] . "Enabled\" value=\"true\" type=\"checkbox\">");
// }
$table->addCol("<input type=\"text\" name=\"{$DBSHIP[$SHIP]}\"" . "size=\"6\" value=\"" . number_format($shipvalues[$DBSHIP[$SHIP] . Value] * 100, 2) . "\">" . " %");
// Ship columns for RIGHT side.
$SHIP = $SHIPTYPES[$i + $tableLength + 1];
if ($SHIP != "") {
$table->addCol("<img width=\"32\" height=\"32\" src=\"./images/ships/ship.png\">");
$table->addCol($SHIP);
// if (getShipSettings($DBSHIP[$SHIP])) {
// $table->addCol("<input name=\"" . $DBSHIP[$SHIP] . "Enabled\" value=\"true\" type=\"checkbox\" checked=\"checked\">");
// } else {
// $table->addCol("<input name=\"" . $DBSHIP[$SHIP] . "Enabled\" value=\"true\" type=\"checkbox\">");
// }
$table->addCol("<input type=\"text\" name=\"{$DBSHIP[$SHIP]}\"" . "size=\"6\" value=\"" . number_format($shipvalues[$DBSHIP[$SHIP] . Value] * 100, 2) . "\">" . " %");
} else {
$table->addCol("");
$table->addCol("");
$table->addCol("");
// $table->addCol("");
}
}
$form .= "<input type=\"hidden\" name=\"action\" value=\"changeship\">";
$form .= "<input type=\"hidden\" name=\"check\" value=\"check\">";
$form .= "<input type=\"submit\" name=\"change\" value=\"Modify ship settings\">";
$table->addHeaderCentered($form, array("colspan" => 6, "align" => "center"));
// return the page
return "<h2>Modify ship settings</h2><form action=\"index.php\"method=\"post\">" . $table->flush();
}
示例12: configuration
//.........这里部分代码省略.........
$pdm .= "<option selected value=\"1\">Sell</option>";
} else {
$pdm .= "<option value=\"1\">Sell</option>";
}
// Add the pull down menu to the form.
$table->addCol("<select name=\"orderType\">" . $pdm . "</select>");
unset($pdm);
// Select Price Criteria
$table->addRow();
$table->addCol("Price Criteria to use:", $config);
$priceCriteria = getConfig("priceCriteria", true);
if ($priceCriteria == 0) {
$pdm .= "<option selected value=\"0\">Min</option>";
} else {
$pdm .= "<option value=\"0\">Min</option>";
}
if ($priceCriteria == 1) {
$pdm .= "<option selected value=\"1\">Max</option>";
} else {
$pdm .= "<option value=\"1\">Max</option>";
}
if ($priceCriteria == 2) {
$pdm .= "<option selected value=\"2\">Median</option>";
} else {
$pdm .= "<option value=\"2\">Median</option>";
}
// Add the pull down menu to the form.
$table->addCol("<select name=\"priceCriteria\">" . $pdm . "</select>");
unset($pdm);
}
// End of table.
$table->addRow("#060622");
$table->addCol("All new settings require a relogin to take effect.", array("colspan" => "2"));
$table->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Update configuration\">");
/*
* MODULES
*/
$modules_table = new table(2, true);
$modules_table->addHeader(">> Enable or disable modules");
// Events enable.
$modules_table->addRow();
$modules_table->addCol("Events Module:", $config);
$eventsState = getConfig("events", true);
if ($eventsState) {
$pdm = "<option selected value=\"true\">Online</option>";
$pdm .= "<option value=\"false\">Offline</option>";
} else {
$pdm = "<option value=\"true\">Online</option>";
$pdm .= "<option selected value=\"false\">Offline</option>";
}
$modules_table->addCol("<select name=\"events\">" . $pdm . "</select>");
unset($pdm);
// Cargo Container Module enable.
$modules_table->addRow();
$modules_table->addCol("Cargo container Module:", $config);
$cargocontainer = getConfig("cargocontainer", true);
if ($cargocontainer) {
$pdm = "<option selected value=\"true\">Online</option>";
$pdm .= "<option value=\"false\">Offline</option>";
} else {
$pdm = "<option value=\"true\">Online</option>";
$pdm .= "<option selected value=\"false\">Offline</option>";
}
$modules_table->addCol("<select name=\"cargocontainer\">" . $pdm . "</select>");
unset($pdm);
// Lotto Module enable.
示例13: makePreferences
function makePreferences()
{
// I kid you not. All needed.
global $PREFS;
global $VERSION;
global $SITENAME;
global $TIMEMARK;
global $DB;
global $MySelf;
/*
* Cantimer Settings
*/
$cantimer_table = new table(2, true);
$cantimer_table->addHeader(">> Preferences for Cantimer");
// Can see my own cans.
$cantimer_table->addRow();
if ($PREFS->getPref("CanMyCans")) {
$cantimer_table->addCol("<input type=\"checkbox\" CHECKED name=\"CanMyCans\" value=\"true\">");
} else {
$cantimer_table->addCol("<input type=\"checkbox\" name=\"CanMyCans\" value=\"true\">");
}
$cantimer_table->addCol("Tick box to see your own cans.");
// Can see the add cans form.
$cantimer_table->addRow();
if ($PREFS->getPref("CanAddCans")) {
$cantimer_table->addCol("<input type=\"checkbox\" CHECKED name=\"CanAddCans\" value=\"true\">");
} else {
$cantimer_table->addCol("<input type=\"checkbox\" name=\"CanAddCans\" value=\"true\">");
}
$cantimer_table->addCol("Tick the add can form.");
// Can See cans beloning to same run.
$cantimer_table->addRow();
if ($PREFS->getPref("CanRunCans")) {
$cantimer_table->addCol("<input type=\"checkbox\" CHECKED name=\"CanRunCans\" value=\"true\">");
} else {
$cantimer_table->addCol("<input type=\"checkbox\" name=\"CanRunCans\" value=\"true\">");
}
$cantimer_table->addCol("Tick to see cans beloning to your MiningOp.");
// Can see all cans.
$cantimer_table->addRow();
if ($PREFS->getPref("CanAllCans")) {
$cantimer_table->addCol("<input type=\"checkbox\" CHECKED name=\"CanAllCans\" value=\"true\">");
} else {
$cantimer_table->addCol("<input type=\"checkbox\" name=\"CanAllCans\" value=\"true\">");
}
$cantimer_table->addCol("Tick if you want to see all cans.");
$cantimer_table->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Update Can Timer settings\">");
/*
* Opt In/Out of emails Setting
*/
$opt_table = new table(2, true);
$opt_table->addHeader(">> Your eMail settings");
$opt_table->addRow();
if ($MySelf->optInState()) {
$opt_table->addCol("<input type=\"checkbox\" CHECKED name=\"optIn\" value=\"true\">");
} else {
$opt_table->addCol("<input type=\"checkbox\" name=\"optIn\" value=\"true\">");
}
$opt_table->addCol("Tick this to recive eMails from MiningBuddy. You will get eMails that will inform you about new events entered into the system, Mining Run reciepts and the occasional CEO email.");
$opt_table->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Update your eMail preferences\">");
/*
* Show/hide inofficial runs
*/
$sir_table = new table(2, true);
$sir_table->addHeader(">> Show/Hide inofficial runs");
$sir_table->addRow();
if ($PREFS->getPref("sirstate")) {
$sir_table->addCol("<input type=\"checkbox\" CHECKED name=\"sir\" value=\"true\">");
} else {
$sir_table->addCol("<input type=\"checkbox\" name=\"sir\" value=\"true\">");
}
$sir_table->addCol("Tick the box to show non-official mining operations. Your own inofficial mining runs are still shown, however.");
$sir_table->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Update your settings\">");
/*
* Update eMail address.
*/
if ($MySelf->canChangeEmail()) {
$email_table = new table(2, true);
$email_table->addHeader(">> Update your eMail address");
$email_table->addRow("#060622");
$email_table->addCol("Your email is needed to send password hints and event news.", array("colspan" => 2));
// Query the oracle.
$email_table->addRow();
$email = $DB->getCol("select email from users where username = '" . sanitize($MySelf->getUsername()) . "' AND deleted='0' limit 1");
$email_table->addCol("Current eMail:");
$email_table->addCol("<input type=\"text\" readonly value=\"" . $email[0] . "\">");
$email_table->addRow();
$email_table->addCol("New eMail:");
$email_table->addCol("<input type=\"text\" name=\"email\" maxlength=\"100\">");
$email_table->addHeaderCentered("<input type=\"submit\" name=\"change\" value=\"Update your eMail\">");
}
/*
* Change password.
*/
if ($MySelf->canChangePwd()) {
$password_table = new table(2, true);
$password_table->addHeader(">> Change your password");
$password_table->addRow("#060622");
$password_table->addCol("Its always a good idea to change your password frequently. Your password is " . "stored in an encrypted form; no one will ever be able to read it.", array("colspan" => "2"));
$password_table->addRow();
//.........这里部分代码省略.........
示例14: addhaulpage
//.........这里部分代码省略.........
*/
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 && $OPTYPE != "Shopping") {
makeNotice("Your CEO has disabled *all* the Oretypes. Please ask your CEO to reactivate at leat one Oretype.", "error", "No valid Oretypes!");
}
$ajaxHaul = isset($_GET[ajaxHaul]);
if ($ajaxHaul || $OPTYPE == "Shopping") {
$haulpage->addRow();
$script = "<script>\nvar selectedItems = \"\";\nvar currentQuery;\nvar int;\nfunction lookForItem(txt){\n\tcurrentQuery = txt;\n\tclearInterval(int);\n\tif(txt.value.length>2){\n\t\tvar int=self.setInterval('execQuery()',2000);\n\t}\n}";
$script .= "\nfunction execQuery(){\n\tclearInterval(int);\n\tvar txt = currentQuery;\n\t\$.ajax({\n\t\turl: 'index.php?action=getItemList&ajax&q=' + txt.value,\n\t\tsuccess: function(data){\$('#ajaxItemList').html(data);}\n\t});\n\t\n}";
$script .= "\nfunction addItem(selection){\n\t//\$(selection).animate({background-color:yellow;});\n\tvar item = selection.innerHTML;\n\tvar dbore = selection.name;\n\t//\$(selection).animate({background-color:none;});\n\tif(selectedItems.split(',').indexOf(item) == -1 ){\n\t\tvar print = \$('#selectedItemList').html() + '<div>Add <input type=\"text\" size=\"5\" name=\"' + dbore + '\" value=\"0\">' + item + '</div>';\n\t\t\$('#selectedItemList').html(print);\n\t\tif(selectedItems.length == 0){\n\t\t\tselectedItems = item;\n\t\t} else {\n\t\t\tselectedItems += ',' + item;\n\t\t}\n\t}\n}\n</script> ";
$haulpage->addCol("Search for an item:<input name='itemSearch' onkeyup='lookForItem(this)' />, then click the item name below.", array("colspan" => 2));
$haulpage->addRow();
$haulpage->addCol("<div id='selectedItemList'></div>", array("colspan" => 2));
$haulpage->addRow();
$haulpage->addCol("<div id='ajaxItemList'></div>", array("colspan" => 2));
} else {
// 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.
$haulpage->addRow();
// left side.
$haulpage->addCol("<img width=\"20\" height=\"20\" src=\"./images/ores/" . array_search($left[$i], $DBORE) . ".png\">" . "Add <input type=\"text\" size=\"5\" name=\"{$left[$i]}\" value=\"0\"> " . array_search($left[$i], $DBORE));
// 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.
$haulpage->addCol("<img width=\"20\" height=\"20\" src=\"./images/ores/" . array_search($right[$i], $DBORE) . ".png\">" . "Add <input type=\"text\" size=\"5\" name=\"" . $right[$i] . "\" value=\"0\"> " . array_search($right[$i], $DBORE));
} else {
// We have an odd number of ores: add empty cell.
$haulpage->addCol("");
}
}
}
/*
// Print out all disabled ore types:
$disabledOreCount = count($disabledOres);
// add the "," between words, but not before the first one, and an "and" between the last one.
for ($i = 0; $i < $disabledOreCount; $i++) {
if ($disabledOreCount == $i +1) {
$disabledOresText .= " and " . array_search($disabledOres[$i], $DBORE);
} else
if (empty ($disabledOresText)) {
$disabledOresText = array_search($disabledOres[$i], $DBORE);
} else {
$disabledOresText .= ", " . array_search($disabledOres[$i], $DBORE);
}
}
// Display the ore-disables-disclaimer. (Only if there are disabled oretypes.)
if (!empty ($disabledOresText)) {
$disabledOresText = "The following Oretypes has been disabled by the CEO: $disabledOresText.";
}
*/
$haulpage->addRow();
$haulpage->addCol("<hr>", array("colspan" => "2"));
$haulpage->addHeaderCentered("<input type=\"submit\" name=\"haul\" value=\"Commit haul to database\">");
// Render the page...
$form_stuff .= "<input type=\"hidden\" value=\"check\" name=\"check\">";
$form_stuff .= "<input type=\"hidden\" value=\"addhaul\" name=\"action\">";
$form_stuff .= "<input type=\"hidden\" value=\"" . $ID . "\" name=\"id\">";
$form_stuff .= "</form>";
$html = "<h2>Submit new transport manifest (<a href='?" . $_SERVER['QUERY_STRING'] . "&ajaxHaul'>ajax</a>)</h2><form action=\"index.php\" method=\"post\">" . $haulpage->flush() . $form_stuff;
/*
// print out all the disabled oretypes.
if (!empty ($disabledOresText)) {
$page .= "<br><i>" . $disabledOresText . "</i>";
}*/
// Return the page
return $script . $html . $page;
}
示例15: showFailedLogins
function showFailedLogins($limit, $user = false)
{
global $DB;
$user = sanitize(stripslashes($user));
// Specify a user, if given.
if ($user) {
$addQuery = "WHERE username = '" . $user . "'";
} else {
$addQuery = "";
}
// Set the default results (10)
if ($limit < 1) {
$limit = 10;
}
// Ask the oracle.
$FailedDB = $DB->query("SELECT * FROM failed_logins {$addQuery} order by incident desc LIMIT {$limit} ");
// Check for results.
if ($FailedDB->numRows() > 0) {
// We have failed logins.
$table = new table(5, true);
// Add a table header accordingly.
if ($user) {
$table->addHeader("Failed logins for user " . ucfirst(stripslashes($user)) . ".");
} else {
$table->addHeader("Failed logins");
}
// Add Table Description
$table->addRow();
$table->addCol("Incident");
$table->addCol("Occurance");
$table->addCol("IP");
$table->addCol("Username");
$table->addCol("Valid Username");
// $table->addCol("Agent");
// Add the data-rows.
while ($log = $FailedDB->fetchRow()) {
$table->addRow();
$table->addCol(str_pad($log['incident'], 4, "0", STR_PAD_LEFT));
$table->addCol(date("d.m.y h:i:s", $log['time']));
$table->addCol($log['ip']);
if ($log['username_valid']) {
$userID = usernameToID(stripslashes(sanitize($log['username'])), "Failed_Login");
if ($userID == -1) {
$link = ucfirst(stripslashes(sanitize($log['username'])));
} else {
$link = "<a href=\"index.php?action=edituser&id={$userID}\">" . ucfirst(stripslashes(sanitize($log['username']))) . "</a>";
}
$table->addCol($link);
} else {
$table->addCol(ucfirst(sanitize($log['username'])));
}
$table->addCol(yesno($log['username_valid']));
// $table->addCol($log['agent']);
}
$table->addHeaderCentered("Securing your system is your responsibility!");
return "<br>" . $table->flush();
} else {
// No failed logins.
return false;
}
}