本文整理汇总了PHP中api::getApiID方法的典型用法代码示例。如果您正苦于以下问题:PHP api::getApiID方法的具体用法?PHP api::getApiID怎么用?PHP api::getApiID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api
的用法示例。
在下文中一共展示了api::getApiID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listUsers
//.........这里部分代码省略.........
// make the clickable thingy.
for ($p = "a"; $p != "aa"; $p++) {
$count = $DB->getCol("SELECT id FROM users WHERE username LIKE '" . $p . "%' AND confirmed='1'");
if ($count[0] > 0) {
$clickThingy .= " [<a href=\"index.php?action=editusers&l=" . $p . $sort . $newOnlyUrlAddition . "\">" . $p . "</a>]";
} else {
$clickThingy .= " [" . $p . "]";
}
}
}
if ($_GET[sort] == "6") {
$users = $DB->query("select * from users, api_keys where users.confirmed='1' AND users.deleted='0' AND api_keys.userid = users.id AND username LIKE '" . $l . "%' order by users.username {$SORTORDER}");
} else {
// Query the database according to rights.
$users = $DB->query("select * from users where deleted='0' AND confirmed='1' AND username LIKE '" . $l . "%' order by {$SORT} {$SORTORDER}");
}
}
// Build the tables.
$table = new table(7, true);
$table->addHeader(">> Manage Users");
$mode = array("bold" => true, "align" => "left");
$table->addRow("#060644");
$table->addCol($clickThingy, array("colspan" => "7", "align" => "center"));
$table->addRow("#060622");
$i = "0";
foreach ($fields as $field) {
if ($_GET["sort"] == "{$i}" && $_GET[r] != "true") {
// Offer reverse sorting.
$table->addCol("<a href=\"index.php?action=editusers&sort={$i}&r=true" . $newOnlyUrlAdditio . "\">{$field}</a>", $mode);
} else {
// Offer real sorting.
$table->addCol("<a href=\"index.php?action=editusers&sort={$i}" . $newOnlyUrlAddition . "\">{$field}</a>", $mode);
}
$i++;
}
// create the database.
if ($users->numRows() == 0 && $showOnlyNew == true) {
$table->addRow();
$table->addCol("There are no new users waiting.", array("align" => "center", "colspan" => "7"));
} else {
while ($row = $users->fetchRow()) {
$table->addRow();
$table->addCol("<a href=\"index.php?action=edituser&id={$row['id']}\">" . str_pad($row[id], 5, "0", STR_PAD_LEFT));
$table->addCol(ucfirst($row[username]));
// Handle folks that never logged in.
if ("{$row['lastlogin']}" < 10) {
$table->addCol("<i>never</i>");
} else {
$table->addCol(date("d.m.y H:i:s", $row[lastlogin]));
}
// Color the background accordingly.
if ("{$row['canLogin']}" == "1") {
$fcolor = "#00ff00";
} else {
$fcolor = "#ff0000";
}
$table->addCol("<a href=\"index.php?action=toggleLogin&id=" . $row[id] . "\"><font color=\"" . $fcolor . "\">" . yesno($row[canLogin]) . "</font></a>");
// Color the background accordingly.
if ("{$row['confirmed']}" == "1") {
$fcolor = "#00ff00";
} else {
$fcolor = "#ff0000";
}
if ($newOnlyUrlAddition) {
$table->addCol("<font color=\"" . $fcolor . "\"><a href=\"index.php?action=quickconfirm&id=" . $row[id] . "\">" . yesno($row[confirmed]) . "</a></font>");
} else {
$table->addCol("<font color=\"" . $fcolor . "\">" . yesno($row[confirmed]) . "</font>");
}
// Color the background accordingly.
if ("{$row['emailvalid']}" == "1") {
$fcolor = "#00ff00";
} else {
$fcolor = "#ff0000";
}
$table->addCol("<font color=\"" . $fcolor . "\">" . yesno($row[emailvalid]) . "</font>");
$api = new api($row[id], true);
if ($api->valid()) {
// Api key submited and valid.
$apiText = "<font color=\"#00ff00\">API valid</font>";
} else {
// Check wheter key is submited or "just" not valid.
if ($api->getApiID() > 0) {
// Api key submited but not valid.
$apiText = "<font color=\"#FF8000\">API invalid</font>";
} else {
// No api key submited.
$apiText = "<font color=\"#999999\">No api key</font>";
}
}
$table->addCol($apiText, array("bgcolor" => "{$tdcolor}"));
}
}
if ($showOnlyNew) {
$add = "<a href=\"index.php?action=editusers\">Show active users</a>";
} else {
$add = "<a href=\"index.php?action=editusers&newusers=true\">Show pending requests</a>";
}
$table->addHeader("Click on an ID to edit/view an user. " . $add);
return "<h2>User Management</h2>" . $table->flush();
}
示例2: listUser
//.........这里部分代码省略.........
$table->addCol("This account has <b>not</b> been confirmed yet.");
$table->addRow();
$table->addCol("Confirm account:");
$table->addCol("<input type=\"checkbox\" name=\"confirm\" value=\"true\"> Tick box to confirm account. <br><br>This is a one-way action only. Once an account" . " has been confirmed you can not unconfirm it. Tho you can block or delete it." . " Be careful not to confirm an account by accident - you could allow a non-authorized third party to access your MiningBuddy!");
$table->addRow();
$table->addCol("Account confirmed:");
// Give a red light if user has not even verified himself.
if ("{$row['emailvalid']}" == "0") {
$table->addCol("<b>WARNING!</b><br> The User has not yet verified this email yet! If you choose to enable" . " this account at this time, be very sure that you know the person requesting the account!", array("bgcolor" => "#662222"));
} else {
$table->addCol("<br><br><b>The user validated the email address.</b><br>");
}
} else {
$table->addRow();
$table->addCol("This account has been confirmed.");
if ("{$row['emailvalid']}" == "0") {
$table->addCol("<font color=\"#ff0000\">WARNING!</b></font><br> The User has not verified this email but the account has been confirmed!");
// Add a "confirm email" checkbox.
$table->addRow();
$table->addCol("Mark users email as valid:");
$table->addCol("<input type=\"checkbox\" name=\"SetEmailValid\" value=\"true\">");
} else {
$table->addCol("The user validated the supplied email address.");
}
}
/*
* API Goodness
*/
$api = new api($row[id], true);
$apit = new table(2, true);
$apit->addHeader(">> Api information for " . ucfirst($row[username]));
$apit->addRow();
$apit->addCol("API Key in database:");
if ($api->getApiID() && $api->getApiKey()) {
$apit->addCol(yesno(1, true));
$apit->addRow();
$apit->addCol("API valid:");
$apit->addCol(yesno($api->valid(), true));
if ($api->valid()) {
$apit->addRow();
$apit->addCol("Character ID:");
$apit->addCol($api->getCharacterID());
$apit->addRow();
$apit->addCol("Validated on:");
$apit->addCol(date("d.m.Y H:i:s", $api->validatedOn()));
}
$apit->addRow();
$apit->addCol("Remove API key from database:");
$apit->addCol("[<a href=\"index.php?action=delapi&id={$id}\">delete api key</a>]");
} 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 {
示例3: makePreferences
//.........这里部分代码省略.........
// Assemble the html.
$page = "<h2>Your Preferences</h2>";
$page .= "<form action=\"index.php\" method=\"POST\">";
$page .= $cantimer_table->flush();
$page .= "<input type=\"hidden\" name=\"action\" value=\"changecanpage\">";
$page .= "<input type=\"hidden\" name=\"check\" value=\"check\"></form>";
$page .= "<form action=\"index.php\" method=\"POST\">";
$page .= $opt_table->flush();
$page .= "<input type=\"hidden\" name=\"check\" value=\"check\">";
$page .= "<input type=\"hidden\" name=\"action\" value=\"optIn\"></form>";
$page .= "<form action=\"index.php\" method=\"POST\">";
$page .= $sir_table->flush();
$page .= "<input type=\"hidden\" name=\"check\" value=\"check\">";
$page .= "<input type=\"hidden\" name=\"action\" value=\"sirchange\"></form>";
if ($MySelf->canChangeEmail()) {
$page .= "<form action=\"index.php\" method=\"post\">";
$page .= $email_table->flush();
$page .= "<input type=\"hidden\" name=\"action\" value=\"changeemail\">";
$page .= "<input type=\"hidden\" name=\"check\" value=\"check\">";
$page .= "</form>";
}
if ($MySelf->canChangePwd()) {
$page .= "<form action=\"index.php\" method=\"post\">";
$page .= $password_table->flush();
$page .= "<input type=\"hidden\" name=\"action\" value=\"changepw\">";
$page .= "<input type=\"hidden\" name=\"check\" value=\"check\">";
$page .= "<input type=\"hidden\" name=\"username\" value=\"%%USERNAME%%\">";
$page .= "</form>";
}
// Api Keys
// Load possible current keys.
$api = new api($MySelf->getID());
$api_key = $api->getApiKey();
$api_id = $api->getApiID();
if (!$api->valid()) {
$api->authorizeApi();
}
// Do the api table.
$api_table = new table(2, true);
$api_table->addHeader(">> Api key management");
$api_table->addRow();
$api_table->addCol("Here you can supply your limited-access API-Key. Its used for quick-login for now.", array("colspan" => 2));
if ($api_id && $api->valid()) {
$s1 = "<input type =\"hidden\" name=\"apiID\" value=\"{$api_id}\">{$api_id}";
} else {
$s1 = "<input type=\"text\" name=\"apiID\" value=\"{$api_id}\">";
$doApiLink = true;
}
if ($api_key && $api->valid()) {
$s2 = "<input type =\"hidden\" name=\"apiKey\" value=\"{$api_key}\">{$api_key}";
} else {
$s2 = "<input type=\"text\" size=\"80\" name=\"apiKey\" value=\"{$api_key}\">";
$doApiLink = true;
}
$api_table->addRow();
$api_table->addCol("API ID:");
$api_table->addCol($s1);
$api_table->addRow();
$api_table->addCol("Verification Code:");
$api_table->addCol($s2);
// Add the API link to eve online.
global $IGB;
global $IGB_VISUAL;
if ($doApiLink && (!$IGB || $IGB && $IGB_VISUAL)) {
$api_table->addRow();
$api_table->addCol("Get your API key here:");