function kb_build($id, $o) { if ($o) { $r = array('²1234567890°+', 'AZERTYUIOP¨£', 'QSDFGHJKLM%µ', 'WXCVBN?./§', '~#{[|`\\^@]}€<>'); } else { $r = array('&é"\'(-è_çà)=', 'azertyuiop^$', 'qsdfghjklmù*', 'wxcvbn,;:!'); } $cap = lj($o ? 'active' : '', 'kbd_plug___keyboard_kb*build_' . $id . '_' . yesno($o), picto('up')); foreach ($r as $v) { $ra = strsplit($v); $i++; foreach ($ra as $va) { $ret .= lja('popbt', 'insert_b(\'' . $va . '\',\'' . $id . '\')', $va) . ' '; } if ($i == 1) { $ret .= ljb('popw', 'conn', $id . '_del', picto('no')); } if ($i == 2) { $ret .= ljb('popw', 'insert_b', '\\n\',\'' . $id, picto('back')); } if ($i == 3) { $ret .= $cap; } if ($i == 4) { $ret .= lja('popbt', 'insert_b(\' \',\'' . $id . '\')', '--'); } $ret .= br(); } return $ret; }
function print_form($vol, $action_name) { list_start(); list_item("Name or nickname", input("volname", $vol->name)); list_item("Email address<br><font size=-2>This won't be publicized,\n but user email may be sent here.\n Use a separate mailbox if you want.</font>", input("email_addr", $vol->email_addr)); list_item("Password", password("password", $vol->password)); list_item("Skype ID<br><font size=-2>\n This will be publicized.\n Use a Skype account other than\n your primary one if you want.</font>", input("skypeid", $vol->skypeid)); list_item("Primary language", spoken_language_list("lang1", $vol->lang1)); list_item("Secondary language", spoken_language_list("lang2", $vol->lang2)); list_item("Country", "<select name=country>" . country_select($vol->country) . "</select>"); list_item("Specialties<br><font size=-2>\n What kinds of computers (Windows/Mac/Linux)\n and/or networking technologies (proxies, NATs)\n are you most familiar with?</font>", textarea("specialties", $vol->specialties)); list_item("Projects<br><font size=-2>\n Do you specialize in any particular BOINC-based projects?</font>", textarea("projects", $vol->projects)); list_item("What days and times are you typically available for help?\n <br><font size=-2>Include your time zone, or use UTC</font>", textarea("availability", $vol->availability)); list_item("Is Skype voice OK?", yesno("voice_ok", $vol->voice_ok)); list_item("Is Skype text OK?", yesno("text_ok", $vol->text_ok)); list_item("Hide your account?", yesno("hide", $vol->hide)); list_item("", "<input type=submit name={$action_name} value=OK>"); list_end(); }
function listRuns() { /* bgcolor and i are used to alternate the tablerow * background color. */ $bgc = array("#222222", "#333333"); $bgi = 0; // Our database. global $DB; global $MySelf; global $READONLY; global $PREFS; $sirstate = $PREFS->getPref("sirstate"); /* * LIST OPEN RUNS */ // Query it. $results = $DB->query("select * from runs where endtime IS NULL order by id"); $mode = array("bold" => true); $table = new table(9, true); $table->addHeader(">> Currently active Operations"); $table->addRow("#060622"); $table->addCol("Run ID"); $table->addCol("Supervisor"); $table->addCol("Op Type"); $table->addCol("Starttime"); $table->addCol("Endtime"); $table->addCol("Location"); $table->addCol("Security"); $table->addCol("Official run"); $table->addCol("Locked"); $runsExist = false; // 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->addRow(); $table->addCol("<a href=\"index.php?action=show&id={$row['id']}\">" . str_pad($row['id'], 5, "0", STR_PAD_LEFT) . "</a>"); $table->addCol(makeProfileLink($row['supervisor'])); $table->addCol($row['optype'] == "" ? "Standard" : $row['optype']); $table->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->addCol($tmp); // Show the security status $System = new solarSystem($row['location']); if ($System->valid()) { $table->addCol($System->makeFancyLink()); $table->addCol($System->getSecurity()); } else { $table->addCol(ucfirst($row['location'])); $table->addCol("?"); } $table->addCol(yesno($row['isOfficial'], true)); $table->addCol(yesno($row['isLocked'], true, true)); $runsExist = true; // We wont print out table if there are no open runs. } /* * LIST CLOSED RUNS */ // Query it. if (isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] > 0) { $page = "LIMIT " . $_GET['page'] * 20 . ", 20"; } elseif (isset($_GET['page']) && $_GET['page'] == "all") { $page = ""; } else { $page = "LIMIT 20"; } $results = $DB->query("SELECT * FROM runs WHERE endtime IS NOT NULL ORDER BY endtime DESC {$page}"); // 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; }
function showFailedLogins($limit, $user = false) { global $DB; $user = sanitize(stripslashes($user)); // Specify a user, if given. if ($user) { $addQuery = "WHERE username = '******'"; } 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; } }
function listUser() { global $DB; global $MySelf; global $IGB; global $TIMEMARK; global $IGB_VISUAL; // Are we allowed to peek into peoples files? if (!$MySelf->canSeeUsers()) { makeNotice("You are not allowed to do this!", "error", "forbidden"); } // Is the supplied ID truly numeric? if (!is_numeric($_GET[id])) { makeNotice("Why would you do such a thing? Are you evil at heart? Lets assume its a \"mistake\" for now..", "warning", "*cough*", "index.php?action=editusers", "I'm sorry..."); } else { $id = (int) $_GET[id]; } // Query the database. $users = $DB->query("select * from users where id='{$id}' AND deleted='0' limit 1"); // Build the tables. while ($row = $users->fetchRow()) { $table = new table(2, true); $table->addHeader(">> Managing user " . ucfirst($row[username])); $username = ucfirst($row[username]); $table->addRow(); $table->addCol("ID:"); $table->addCol(str_pad("{$row['id']}", 5, "0", STR_RIGHT_PAD)); $table->addRow(); $table->addCol("Username:"******"<input type=\"text\" name=\"username\" value=\"" . $uname_temp . "\">"; $confi_temp = "<input type=\"checkbox\" name=\"username_check\" value=\"true\">"; $table->addCol($field_temp . " (changing username tick here also: " . $confi_temp . ")"); } else { $table->addCol(ucfirst($row[username])); } $table->addRow(); $table->addCol("eMail:"); $table->addCol("<input type=\"text\" size=\"40\" name=\"email\" value=\"" . ($row[email] == "" ? 'no email supplied' : $row[email]) . "\">"); $table->addRow(); $table->addCol("Password:"******"<input type=\"password\" size=\"40\" name=\"password\">"); // Ranks System $RanksDS = $DB->query("SELECT * FROM ranks ORDER BY rankOrder ASC"); $rankCount = $RanksDS->numRows(); if ($rankCount >= 1) { // We have at least 1 rank. while ($rank = $RanksDS->fetchRow()) { if ($rank[rankid] == $row[rank]) { // The current rank is selected. $rank_pdm .= "<option SELECTED value=\"{$rank['rankid']}\">{$rank['name']}</option>"; } else { // The others of course, are not. $rank_pdm .= "<option value=\"{$rank['rankid']}\">{$rank['name']}</option>"; } } $rankColumn = "<select name=\"rank\">" . $rank_pdm . "</select>"; } else { // No rank has been set yet. $rankColumn = "There are no ranks. Go create some!"; } $table->addRow(); $table->addCol("Rank:"); $table->addCol($rankColumn); $table->addRow(); $table->addCol("Last login:"******"{$row['lastlogin']}" < 10) { $table->addCol("never"); } else { $table->addCol(date("d.m.y H:i:s", $row[lastlogin])); } $table->addRow(); $table->addCol("Credits:"); $table->addCol(number_format(getCredits($row[id]), 2) . " ISK"); // Is the account confirmed? if ("{$row['confirmed']}" == "0") { $table->addRow(); $table->addCol("Account confirmed:"); $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 { $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:"******"<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(); $acc->addCol("Amount:"); $acc->addCol("<input size=\"8\" type=\"text\" name=\"amount\"> ISK"); $acc->addRow(); $acc->addCol("Reason:"); $pdm = "<select name=\"reason1\">"; $pdm .= "<option>requested payout</option>"; $pdm .= "<option SELECTED>normal payout</option>"; $pdm .= "<option>payout of loan</option>"; $pdm .= "<option>manual deposit</option>"; $pdm .= "<option>cash recived</option>"; $pdm .= "</select>"; $acc->addCol($pdm . " -or- <input type=\"text\" name=\"reason2\">"); $acc->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Authorize transaction\">"); $transBox = "<form action=\"index.php\" method=\"POST\">"; $transBox .= $acc->flush(); $transBox .= "<input type=\"hidden\" name=\"id\" value=\"" . $_GET[id] . "\">"; $transBox .= "<input type=\"hidden\" name=\"check\" value=\"true\">"; $transBox .= "<input type=\"hidden\" name=\"action\" value=\"transaction\">"; $transBox .= "</form>"; } $page = "<h2>Managing user details</h2>" . $form . $table->flush() . "<br>" . $apit->flush() . "<br>" . $perm_table->flush() . "</form>" . $transBox; $transactions = getTransactions($id); if ($transactions) { $page .= $transactions; } // Add login table if we have more than 0 logins. if ($logins) { if ($transactions) { $page .= "<br>"; } $page .= $logins; } $page .= $failed_logins; // Return the page. return $page; }
* 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); $general_info->addCol(makeProfileLink($row['supervisor'])); // Row: Taxes $general_info->addRow(); $general_info->addCol("Corp Taxes:", $common_mode); $general_info->addCol($row['corpkeeps'] . ".0%"); // Row: Starttime $general_info->addRow(); $general_info->addCol("Starttime:", $common_mode);
<a href="#" class="detailServer" id="<?php echo $row->id; ?> " data-toggle="modal" data-target="#myModal"> <div class="col-md-3 list-server"> <div class="panel panel-success"> <div class="panel-heading"> <h3><i class="fa fa-check"></i> <?php echo $row->name; ?> </h3> <p><?php echo $row->ipaddress; ?> <span>(<?php echo yesno($row->active, "Active", "Disable"); ?> </span>)</p> </div> </div> </div> </a> <?php } } ?> </div> <!-- Modal -->
public function update_propertiKomponen() { $komponen = array('idkomponen' => $this->input->post('idkomponen'), 'nama' => $this->input->post('nama')); $properti = array('idkomponen' => $this->input->post('idkomponen'), 'idproperti' => $this->input->post('idproperti'), 'serial' => yesno($this->input->post('serial'), "1", "0"), 'type' => yesno($this->input->post('type'), "1", "0"), 'kapasitas' => yesno($this->input->post('kapasitas'), "1", "0"), 'jenis' => yesno($this->input->post('jenis'), "1", "0"), 'ukuran' => yesno($this->input->post('ukuran'), "1", "0"), 'warna' => yesno($this->input->post('warna'), "1", "0")); $idkomponen = $this->input->post('idkomponen'); $idproperti = $this->input->post('idproperti'); $this->Dkomponen->update($idkomponen, $idproperti, $komponen, $properti); echo "Success"; }
?> </td></tr> <tr><td>Ukuran</td><td><?php echo $item['ukuran']; ?> </td></tr> <tr><td>Warna</td><td><?php echo $item['warna']; ?> </td></tr> <tr><td>Tanggal Masuk</td><td><?php echo dateindo($item['tanggal_masuk']); ?> </td></tr> <tr><td>Tanggal Expired</td><td><?php echo dateindo($item['tanggal_expired']); ?> </td></tr> <tr><td>Status</td><td><?php echo yesno($item['status'], "Digunakan", "Tidak Digunakan"); ?> </td></tr> <tr><td>Durability</td><td><?php echo $item['durability'] - $item['usage_durability']; ?> </td></tr> <tr><td>Tanggal Digunakan</td><td><?php echo dateindo($item['tanggal_digunakan']); ?> </td></tr> </table>
function listUsers() { // Some major vars importing... global $DB; global $MySelf; // Are we allowed to be here? if (!$MySelf->canSeeUsers()) { makeNotice("You are not allowed to list users!", "error", "forbidden"); } // Easy-for-the-coder table generator. $fields = array("ID", "Username", "Last Login", "can Login", "Confirmed", "Email OK", "API verified"); // Show only new users. if ($_GET["newusers"] == "true") { $users = $DB->Query("SELECT * FROM users WHERE confirmed='0' AND emailvalid='1' AND deleted ='0' ORDER BY username ASC;"); $showOnlyNew = true; $newOnlyUrlAddition = "&newusers=true"; } else { // Sorting switch, called by browser. switch ("{$_GET['sort']}") { case "0": $SORT = "id"; break; case "1": $SORT = "username"; break; case "2": $SORT = "lastlogin"; break; case "3": $SORT = "canLogin"; break; case "4": $SORT = "confirmed"; break; case "5": $SORT = "emailvalid"; break; default: $SORT = "username"; break; } // Normal or reverse sorting. if ($_GET["r"] == "true") { // Reverse sorting! $SORTORDER = "DESC"; } else { // Normal Order $SORTORDER = "ASC"; } // Limit folks. if (isset($_GET[sort])) { $sort = "&sort=" . $_GET[sort]; } $folkCount = $DB->getCol("SELECT count(id) FROM users"); if ($folkCount[0] > 25) { if (isset($_GET[l])) { $l = sanitize($_GET[l]); } else { $l = "a"; } // 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(); }
function details($lot) { $sum_crdb = 0; $sum_of_fees; $item = GetOneRow("*, state.c_description as state, condi.c_description as conditio", "item inner join (select code, c_description from `condition` where type='S')state on(item.i_state=state.code) inner join (select code, c_description from `condition` where type='C')condi on(item.i_condition=condi.code)", "where lot=" . $lot); /*$fees=GetAllRows('*', 'cre_deb', "where lot=".$lot." and cd_note in('Paypal fee', 'Ebay fee', 'Ebay shipping fee','Handling fee', 'Handling loss' )");*/ $cred_db = GetAllRows('*', 'cre_deb', "where lot=" . $lot); /* $item['list_date'] $item['i_note'] $item['ebay_str_cost'] $item['case_open'] $item['repair_needed'] $item['part_of'] */ $output = "<table>\r\n\t\t<tr>\r\n\t\t<td>\r\n\t\t<table border='1'>\r\n\t\t<tr>\r\n\t\t\t<td>\r\n\t\t\t\tLot #\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['lot'] . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td>\r\n\t\t\t\tItem Desciption\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['item_description'] . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td>\r\n\t\t\t\tCurrent Condition\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['conditio'] . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td>\r\n\t\t\t\tCurrent State\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['state'] . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td>\r\n\t\t\t\tItem initial Cost\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['cost'] . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td>\r\n\t\t\t\tItem Initial Shipping cost\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['c_shipping'] . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td>\r\n\t\t\t\tInitial Quanity\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['quanity'] . "\r\n\t\t\t</td>\r\n\t\t</tr>"; if ($item['quanity'] > 1) { $output .= "<tr>\r\n\t\t\t<td>\r\n\t\t\t\tQuanity Sold:\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['sold_quanity'] . "\r\n\t\t\t</td>\r\n\t\t</tr>"; } $output .= "<tr>\r\n\t\t\t<td>\r\n\t\t\t\tHas Item Sold?\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . yesno($item['sold']) . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t</tr>\r\n\t\t\t<td>\r\n\t\t\t\tPrice sold @\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t\$" . $item['sold_price'] . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t</tr>\r\n\t\t\t<td>\r\n\t\t\t\tShipping via ebay\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['s_shipping'] . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t</tr>\r\n\t\t\t<td>\r\n\t\t\t\tActual shipping cost\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . $item['actual_shipping'] . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t</tr>\r\n\t\t\t<td>\r\n\t\t\t\tItem Paid for\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . yesno($item['paid']) . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t</tr>\r\n\t\t\t<td>\r\n\t\t\t\tItem in need of repair?\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . yesno($item['repair_needed']) . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t</table>"; if ($item['part_of'] != 0) { $output .= "Part of <br />" . main_view('item.*, `condition`.c_description as descript', " inner join `condition` on code=i_state and type='S'", "lot='" . $item['part_of'] . "'", '', true); } if ($cred_db[0] != NULL) { $output .= CreDebView(true, $item['lot'], $cred_db, $sum_crdb, true); $fees = get_fees($cred_db); $handling_fee = isset($fees['Handling fee']) ? $fees['Handling fee'][0] : -1 * $fees['Handling loss'][0]; $fee_info = "<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\tEbay Sell Fee\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t\$" . $fees['Ebay fee'][0] . "\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\tEbay Shipping Fee\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t\$" . $fees['Ebay shipping fee'][0] . "\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\tPaypal Fee\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t\$" . $fees['Paypal fee'][0] . "\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\tHandling Fee/Debit\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t\$" . $handling_fee . "\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\tOther Credit/Debit\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t\$" . number_format($sum_crdb + ($fees['Ebay shipping fee'][0] + $fees['Paypal fee'][0] + $fees['Ebay fee'][0]) + $handling_fee * -1, 2) . "\r\n\t\t\t\t</td>\r\n\t\t\t</tr>"; //$sum=$sum+$fees['Paypal fee'][0]+$fees['Ebay fee'][0]+$fees['Ebay shipping fee'][0]+$handling_fee; } $total = $item['sold_price'] + $sum_crdb - ($item['cost'] + $item['c_shipping'] + $item['ebay_str_cost']) < 0.01 ? '0.00' : $item['sold_price'] + $sum_crdb - ($item['cost'] + $item['c_shipping'] + $item['ebay_str_cost']); $output .= "Total Profit/Loss for lot<br />\r\n\t\t<table border='1'>\r\n\t\t\t<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\tTotal Cost\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t\$" . ($item['cost'] + $item['c_shipping']) . "\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\tEbay list Fee\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t\$" . $item['ebay_str_cost'] . "\r\n\t\t\t\t</td>\r\n\t\t\t</tr>"; //$output .= $c; if (isset($fee_info)) { $output .= $fee_info; } $output .= "<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\tSold price\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t\$" . $item['sold_price'] . "\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\tTotal\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t\$" . number_format($item['sold_price'] + $sum_crdb - ($item['cost'] + $item['c_shipping'] + $item['ebay_str_cost']), 2) . "\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t</table>\r\n\t\t</td>\r\n\t\t</tr>\r\n\t</table>"; echo $output; }
</tr> <tr> <td><?php print $line['home_field']; ?> </td> <td colspan="6"> Complex: <?php print yesno($line['complex']); ?> High Performance: <?php print yesno($line['high_perf']); ?> Tailwheel: <?php print yesno($line['tailwheel']); ?> </td> </tr> <tr> <th colspan="7">Detail:</th> </tr> <tr> <td colspan="7"><?php print $line['detail']; ?> </td> </tr> </table> </div>
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 = '******' 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(); $password_table->addCol("Changing password for:"); $password_table->addCol(ucfirst($MySelf->getUsername())); $password_table->addRow(); $password_table->addCol("Your current password:"******"<input type=\"password\" name=\"password\" maxlength=\"20\">"); $password_table->addRow(); $password_table->addCol("Set a new password:"******"<input type=\"password\" name=\"password1\" maxlength=\"20\">"); $password_table->addRow(); $password_table->addCol("Verify your new password:"******"<input type=\"password\" name=\"password2\" maxlength=\"20\">"); $password_table->addHeaderCentered("<input type=\"submit\" name=\"change\" value=\"Update your password\">"); } // 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:"); $api_table->addCol("<a href=\"http://support.eveonline.com/api/default.asp\">http://support.eveonline.com/api/default.asp</a>"); } if ($api_key) { $api_table->addRow(); $api_table->addCol("API Key validated:"); if (!$api->valid()) { $hint = " (If your key is not validated, hit update API key button.)"; } $api_table->addCol(yesno($api->valid(), yes) . $hint); if ($api->valid()) { $api_table->addRow(); $api_table->addCol("Validated on:"); $api_table->addCol(date("d.m.Y H:i:s", $api->validatedOn())); $api_table->addRow(); $api_table->addCol("Next verification at:"); $api_table->addCol(date("d.m.Y H:i:s", $api->nextValidation())); $api_table->addRow(); $api_table->addCol("API keys are valid for:"); $days = getConfig("api_keys_valid"); if ($days <= 1) { $days = "1 day."; } else { $days = $days . " days."; } $api_table->addCol($days); $api_table->addRow(); $api_table->addCol("Character ID:"); $api_table->addCol($api->getCharacterID()); } $api_table->addRow(); $api_table->addCol("Remove Key:"); $api_table->addCol("<input type=\"checkbox\" name=\"deleteKey\" value=\"true\"> Tick box to remove the API key from the Database."); } $api_table->addHeaderCentered("<input type=\"submit\" name=\"update_api\" value=\"Update API Key\">"); $api_form .= "<form action=\"index.php\" method=\"POST\">"; $api_form .= $api_table->flush(); $api_form .= "<input type=\"hidden\" name=\"action\" value=\"update_api\">"; $api_form .= "<input type=\"hidden\" name=\"check\" value=\"check\"></form>"; $page .= $api_form; // We are done here. return $page; }
function profile() { // The usual suspects. global $MySelf; global $DB; // Set the ID. $ID = sanitize($_GET[id]); numericCheck($_GET[id], 0); // Load the profile. $profile = new profile($ID); $username = ucfirst(idToUsername($ID)); // Cache our permissions. $canSeeUsers = $MySelf->canSeeUsers(); // Need the api. $api = new api($ID); // Create table header. $table = new table(2, true); $table->addHeader(">> About " . $username); $table->addRow(); $table->addCol("Current rank:"); $table->addCol(getRank($ID)); $table->addRow(); $table->addCol("Last login:"******"SELECT lastlogin FROM users WHERE id='" . $ID . "' AND deleted='0' LIMIT 1"); $table->addCol(date("d.m.y. H:i:s", $lastLog[0])); $table->addRow(); $table->addCol("Total logins:"); $lastLog = $DB->getCol("SELECT COUNT(authkey) FROM auth WHERE user='******' LIMIT 1"); $table->addCol(number_format($lastLog[0], 0)); $table->addRow(); $table->addCol("Valid api-key on file:"); $table->addCol(yesno($api->valid(), true)); $table->addRow(); $table->addCol("Is available for mining:"); if ($profile->isOwn()) { if ($profile->MinerFlag()) { $temp = " [<a href=\"index.php?action=modprofile&id=" . $ID . "&mining=false\">set not available</a>]"; } else { $temp = " [<a href=\"index.php?action=modprofile&id=" . $ID . "&mining=true\">set available</a>]"; } } $table->addCol(yesno($profile->MinerFlag(), true) . $temp); $table->addRow(); $table->addCol("Is available for hauling:"); if ($profile->isOwn()) { if ($profile->HaulerFlag()) { $temp = " [<a href=\"index.php?action=modprofile&id=" . $ID . "&hauling=false\">set not available</a>]"; } else { $temp = " [<a href=\"index.php?action=modprofile&id=" . $ID . "&hauling=true\">set available</a>]"; } } $table->addCol(yesno($profile->HaulerFlag(), true) . $temp); $table->addRow(); $table->addCol("Is available for fighting:"); if ($profile->isOwn()) { if ($profile->FighterFlag()) { $temp = " [<a href=\"index.php?action=modprofile&id=" . $ID . "&fighting=false\">set not available</a>]"; } else { $temp = " [<a href=\"index.php?action=modprofile&id=" . $ID . "&fighting=true\">set available</a>]"; } } $table->addCol(yesno($profile->FighterFlag(), true) . $temp); if ($profile->emailVisible() || $profile->isOwn()) { if ($profile->isOwn()) { if ($profile->emailVisible()) { $temp = " (public) [<a href=\"index.php?action=modprofile&id=" . $ID . "&email=hide\">hide from public</a>]"; } else { $temp = " (hidden) [<a href=\"index.php?action=modprofile&id=" . $ID . "&email=show\">make public</a>]"; } } $table->addRow(); $table->addCol("Email address:"); $email = $DB->getCol("SELECT email FROM users WHERE id='" . $ID . "' LIMIT 1"); $table->addCol($email[0] . $temp); } // Statistics. $stats = new table(2, true); $stats->addHeader(">> Statistical breakdown"); $miningRunsJoined = $DB->getCol("SELECT COUNT(id) FROM joinups WHERE userid='" . $ID . "'"); $miningRunsJoined = $miningRunsJoined[0]; $OpjoinUps = $DB->getCol("SELECT COUNT(id) FROM joinups WHERE userid='" . $ID . "'"); $OpjoinUps = $OpjoinUps[0]; $joinUps = $DB->getCol("SELECT COUNT(id) FROM (SELECT * from joinups WHERE userid='" . $ID . "' GROUP BY run) as uJoinups"); $joinUps = $joinUps[0]; $haulingRuns = $DB->getCol("SELECT COUNT(id) FROM hauled WHERE hauler='" . $ID . "'"); $haulingRuns = $haulingRuns[0]; $timeMining = $DB->getCol("SELECT SUM(parted - joined) FROM joinups WHERE userid='" . $ID . "' AND parted >1"); $timeMining = $timeMining[0]; $timesKicked = $DB->getCol("SELECT COUNT(id) FROM joinups WHERE userid='" . $ID . "' AND status='1'"); $timesKicked = $timesKicked[0]; $timesRemoved = $DB->getCol("SELECT COUNT(id) FROM joinups WHERE userid='" . $ID . "' AND status='2'"); $timesRemoved = $timesRemoved[0]; $timesBanned = $DB->getCol("SELECT COUNT(id) FROM joinups WHERE userid='" . $ID . "' AND status='3'"); $timesBanned = $timesBanned[0]; $timesCharity = $DB->getCol("SELECT COUNT(id) FROM (SELECT * from joinups WHERE userid='" . $ID . "' GROUP BY run) as uJoinups WHERE userid='" . $ID . "' AND charity='1'"); $timesCharity = $timesCharity[0]; $tmec = $DB->getCol("SELECT AVG(tmec) FROM runs WHERE isOfficial = 1"); $tmecJoined = $DB->getCol("SELECT AVG(runs.tmec) FROM joinups, runs WHERE joinups.userid='" . $ID . "' AND joinups.run = runs.id AND runs.endtime > 0 AND runs.isOfficial = 1"); $tmecNotJoined = $DB->getCol("SELECT AVG(runs.tmec) FROM joinups, runs WHERE joinups.userid='" . $ID . "' AND joinups.run <> runs.id AND runs.endtime > 0 AND runs.isOfficial = 1"); $tmecDiff = $tmecJoined[0] - $tmecNotJoined[0]; $stats->addRow(); $stats->addCol("Mining operations joined:"); if ($miningRunsJoined > 0) { $stats->addCol(number_format($joinUps, 0)); } else { $stats->addCol("never joined."); } $stats->addRow(); $stats->addCol("Total operations joinups:"); if ($OpjoinUps > 0) { $stats->addCol(number_format($OpjoinUps, 0)); } else { $stats->addCol("never joined."); } $stats->addRow(); $stats->addCol("Hauling runs:"); if ($haulingRuns > 0) { $stats->addCol(number_format($haulingRuns, 0)); } else { $stats->addCol("never hauled."); } $stats->addRow(); $stats->addCol("Time spent mining:"); if ($timeMining > 0) { $stats->addCol(numberToString($timeMining)); } else { $stats->addCol("never mined."); } $stats->addRow(); $stats->addCol("Average TMEC:"); $stats->addCol(number_format($tmec[0], 3)); $stats->addRow(); $stats->addCol("Average TMEC on Ops <b>with</b> " . $username . ":"); $stats->addCol(number_format($tmecJoined[0], 3)); $stats->addRow(); $stats->addCol("Average TMEC on Ops <b>without</b> " . $username . ":"); $stats->addCol(number_format($tmecNotJoined[0], 3)); $stats->addRow(); $stats->addCol("TMEC difference:"); if ($tmecDiff >= 0) { $stats->addCol("<font color=\"#00ff00\">" . number_format($tmecDiff, 3), true . "</font>"); } else { $stats->addCol("<font color=\"#ff0000\">" . number_format($tmecDiff, 3), true . "</font>"); } $stats->addRow(); $stats->addCol("Times removed from OP:"); $stats->addCol(number_format($timesRemoved, 0)); $stats->addRow(); $stats->addCol("Times kicked from OP:"); $stats->addCol(number_format($timesKicked, 0)); $stats->addRow(); $stats->addCol("Times banned from OP:"); $stats->addCol(number_format($timesBanned, 0)); $stats->addRow(); $stats->addCol("Times declared charity:"); $stats->addCol(number_format($timesCharity, 0)); /* * Assemble the heavy-duty SQL query. * It is dynamic because this way we can easily add ores from * config-system.php to the system without code rewrite. */ /* global $DBORE; global $ORENAMES; foreach ($DBORE as $ORE) { $new = $ORE; if ($last) { $SQLADD .= "SUM(" . $last . ") AS total" . $last . ", "; } $last = $new; } $SQLADD .= "SUM(" . $last . ") AS total" . $last . " "; $SQL = "SELECT " . $SQLADD . " FROM hauled WHERE hauler='" . $ID . "'"; // Now query it. $totalOREDB = $DB->query("$SQL"); if (DB::isError($totalOREDB)) { * * This is not what you would really want to do in * your program. It merely demonstrates what kinds * of data you can get back from error objects. * echo 'Standard Message: ' . $totalOREDB->getMessage() . "\n"; echo '\n '; echo 'Standard Code: ' . $totalOREDB->getCode() . "\n"; echo '\n '; echo 'DBMS/User Message: ' . $totalOREDB->getUserInfo() . "\n"; echo '\n '; echo 'DBMS/Debug Message: ' . $totalOREDB->getDebugInfo() . "\n"; echo '\n '; exit; } // Create table. $totalOre_table = new table(2, true); $totalOre_table->addHeader(">> Total ore hauled"); // Loop through the result (single result!) if ($totalOREDB->numRows() > 0) { while ($totalORE = $totalOREDB->fetchRow()) { // Now check each ore type. foreach ($ORENAMES as $ORE) { // And ignore never-hauled ore if ($totalORE[total . $ORE] > 0) { // We got some ore! $totalOre_table->addRow(); $totalOre_table->addCol("<img width=\"20\" height=\"20\" src=\"./images/ores/" . $ORE . ".png\">Total " . $ORE . " hauled:"); $totalOre_table->addCol(number_format($totalORE[total . $ORE])); $gotOre = true; } } } if ($gotOre) { $oretable_r = "<br>" . $totalOre_table->flush(); } } */ // Image thingy. // We serve small images IGB. global $IGB; global $IGB_VISUAL; if ($IGB && $IGB_VISUAL) { $image = "<img src=\"portrait:" . $api->getCharacterID() . "\" SIZE=\"128\">"; } else { $image = $profile->getImage("large"); } $picTable = new table(true, 1); $picTable->addHeader(">> Picture of " . $username); $picTable->addRow(); $picTable->addCol($image); $imageTable = $picTable->flush(); // About if ($profile->GetAbout() && !$profile->isOwn()) { $aboutTable = new table(1, true); $aboutTable->addHeader(">> " . $username . " says..."); $aboutTable->addRow(); $aboutTable->addCol(nl2br($profile->GetAbout())); $aboutTable = "<br>" . $aboutTable->flush(); } if ($profile->isOwn()) { $aboutTable = new table(1, true); $aboutTable->addHeader(">> Enter a public viewable text here"); $aboutTable->addRow(); $form = "<form action=\"index.php\" method=\"POST\">"; $form .= "<input type=\"hidden\" name=\"check\" value=\"true\">"; $form .= "<input type=\"hidden\" name=\"action\" value=\"modprofile\">"; $form .= "<input type=\"hidden\" name=\"id\" value=\"" . $ID . "\">"; $aboutTable->addCol("<textarea rows=\"18\" cols=\"80\" name=\"about\">" . $profile->GetAbout() . "</textarea>"); $aboutTable->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Update about\">"); $aboutTable = "<br>" . $form . $aboutTable->flush() . "</form>"; } // quick "jump to" -thingy. $peeps = $DB->query("SELECT DISTINCT username,id FROM users WHERE deleted = 0 AND canLogin = 1 ORDER BY username ASC"); if ($peeps->numRows() > 0) { while ($p = $peeps->fetchRow()) { if ($ID == $p[id]) { $pdm .= "<option SELECTED value=\"" . $p[id] . "\">" . ucfirst($p[username]) . " (current)</option>"; } else { $pdm .= "<option value=\"" . $p[id] . "\">" . ucfirst($p[username]) . "</option>"; } } $pdm = "<select name=\"id\">" . $pdm . "</select></form>"; $quickChooser = new table(1, true); $quickChooser->addHeader(">> Quick jump to profile"); $quickChooser->addRow(); $quickChooser->addCol($pdm); $quickChooser->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Switch\">"); $quickChooser = "<form action=\"index.php\" method=\"GET\"><input type=\"hidden\" name=\"action\" value=\"profile\">" . $quickChooser->flush() . "</form>"; } $page = "<h2>View profile</h2>" . $quickChooser . $imageTable . "<br>" . $table->flush() . "<br>" . $stats->flush() . $oretable_r . $aboutTable; return $page; }
function plug_taxonav($p, $o) { req('mod,spe'); $r = collect_hierarchie_d("reverse", $o); if (is_numeric($p)) { $r = $r[$p]; } if ($r) { $ret = build_titl($r, $p > 0 ? suj_of_id($p) : $p, 1); $ret .= balc("ul", "taxonomy", make_menus_rb($r, '', 1, $o)); $ret .= lkc('', '/module/taxonav/' . ajx($p) . '/' . yesno($o), offon($o) . ' ' . nms(129)); } else { $ret = nms(11) . ' ' . nms(16); } return $ret; }
</tr> <tr> <td>User</td><td><?php echo $row->username; ?> </td> </tr> <tr> <td>Port</td><td><?php echo yesno($row->port, $row->port, "null"); ?> </td> </tr> <tr> <td>Active</td><td><?php echo yesno($row->active, "Yes", "No"); ?> </td> </tr> <tr> <td>Active</td><td><?php echo yesno($row->disabled, "Yes", "No"); ?> </td> </tr> </table> <?php } ?> </div> </div>
<td><span class="label label-info"><?php echo FHD_TIMEADJUST; ?> </span> <?php echo date('Y-m-d g:i a'); ?> <i class="fa fa-arrow-circle-right"></i> <?php echo date('Y-m-d g:i a', $fhddate + FHD_TIMEADJUST * 3600); ?> </td> </tr> <tr> <td>Encrypted passwords</td> <td><?php echo yesno($encrypted_passwords); ?> <?php echo $encrypted_link; ?> </td> </tr> <tr> <td>Notification email</td> <td><?php echo TO_EMAIL; ?> </td> </tr> <tr> <td>From email</td>
?> </td> <td><?php echo $row->warna; ?> </td> <td><?php echo dateindo($row->tanggal_masuk, "table"); ?> </td> <td><?php echo dateindo($row->tanggal_expired, "time"); ?> </td> <td><?php echo yesno($row->status, "Use", "Not Use"); ?> </td> <td> <a href="#modal-container-update" data-toggle="modal" id="<?php echo $row->id_inventory; ?> " class="btn btn-warning edit"> <i class='fa fa-edit'></i> </a> <a href="#" class="btn btn-danger delete" id="<?php echo $row->id_inventory; ?> "> <i class='fa fa-remove'></i> </a>
?> </td> <td class="text-center"><?php echo yesno($row->kapasitas, $Yes, $No); ?> </td> <td class="text-center"><?php echo yesno($row->jenis, $Yes, $No); ?> </td> <td class="text-center"><?php echo yesno($row->ukuran, $Yes, $No); ?> </td> <td class="text-center"><?php echo yesno($row->warna, $Yes, $No); ?> </td> <td width="20%"> <a id="<?php echo $row->idkomponen; ?> " class="edit btn btn-default" href="#"><i class='fa fa-edit'></i></a> <a id="<?php echo $row->idkomponen; ?> " data-id='<?php echo $row->nama; ?> ' class="delete btn btn-default" href="#"><i class='fa fa-remove'></i></a> </td>
yesno('Can post comments', 'cancomment'); yesno('Can use bookmark', 'canbookmark'); yesno('Can reset passkey', 'canresetpasskey'); yesno('Can thanks on torrents', 'canthanks'); yesno('Can use Shoutbox', 'canshout'); yesno('Can use Invite', 'caninvite'); yesno('Can use karma system', 'canbonus'); echo '</tbody><tbody><tr><td class="subheader" colspan="2" align="center">Permissions: Viewing</td></tr>'; yesno('Can View UserCP?<br /><small>User can view his Control Page.</small>', 'canusercp'); yesno('Can View Profiles?<br /><small>User can view other user Profiles.</small>', 'canviewotherprofile'); yesno('Can View Memberlist?<br /><small>User can view Memberlist.</small>', 'canmemberlist'); yesno('Can View Friendlist?<br /><small>User can view Friendlist.</small>', 'canfriendslist'); yesno('Can View Top10 Page?<br /><small>User can view Top10 Page.</small>', 'cantopten'); echo '</tbody><tbody><tr><td class="subheader" colspan="2" align="center">Permissions: Administrative</td></tr>'; yesno('Can Edit User Settings?<br /><small>User Can Edit User Settings.</small>', 'caneditusersettings', $usergroup['caneditusersettings'] == 'yes' ? 'yes' : 'no'); yesno('Can Access Staff Panel?<br /><small>User can access Staff Panel of tracker.</small>', 'canstaffpanel'); echo '<tr class="subheader"><td align="center" colspan="2">Permissions: Limitations</td></tr>'; inputbox('Automatic Invite<br /><small>Set the limit of automatic invites for each month<br />Set to 0 to disable this.</small>', 'autoinvite', $usergroup['autoinvite']); echo '<tr> <td colspan="2" align="right"> <input type="submit" value="submit"> <input type="reset" value="reset"> </td> </tr>'; echo '</form></table></table>'; stdfoot(); } elseif ($action == 'creategroup') { getvar(array('gid', 'title', 'description', 'isbanned', 'canpm', 'candownload', 'canupload', 'canrequest', 'cancomment', 'canbookmark', 'canusercp', 'canresetpasskey', 'canviewotherprofile', 'canthanks', 'canshout', 'caninvite', 'canbonus', 'canmemberlist', 'canfriendlist', 'cantopten', 'caneditusersettings', 'canstaffpanel', 'autoinvite')); $addnew = sql_query("INSERT INTO usergroups( gid,\r\n title,\r\n description,\r\n isbanned,\r\n canpm,\r\n candownload,\r\n canupload,\r\n canrequest,\r\n cancomment,\r\n canbookmark,\r\n canusercp,\r\n canresetpasskey,\r\n canviewotherprofile,\r\n canthanks,\r\n canshout,\r\n caninvite,\r\n canbonus,\r\n canmemberlist,\r\n canfriendlist,\r\n cantopten,\r\n caneditusersettings,\r\n canstaffpanel,\r\n autoinvite)\r\n \r\n VALUES ( " . sqlesc($gid) . ",\r\n " . sqlesc($title) . ",\r\n " . sqlesc($description) . ",\r\n " . sqlesc($isbanned) . ",\r\n " . sqlesc($canpm) . ",\r\n " . sqlesc($candownload) . ",\r\n " . sqlesc($canupload) . ",\r\n " . sqlesc($canrequest) . ",\r\n " . sqlesc($cancomment) . ",\r\n " . sqlesc($canbookmark) . ",\r\n " . sqlesc($canusercp) . ",\r\n " . sqlesc($canresetpasskey) . ",\r\n " . sqlesc($canviewotherprofile) . ",\r\n " . sqlesc($canthanks) . ",\r\n " . sqlesc($canshout) . ",\r\n " . sqlesc($caninvite) . ",\r\n " . sqlesc($canbonus) . ",\r\n " . sqlesc($canmemberlist) . ",\r\n " . sqlesc($canfriendlist) . ",\r\n " . sqlesc($cantopten) . ",\r\n " . sqlesc($caneditusersettings) . ",\r\n " . sqlesc($canstaffpanel) . ",\r\n " . sqlesc($autoinvite) . ")") or sqlerr(__FILE__, __LINE__); if (!$addnew) { die('MySQL error.');
$join_info->addCol(makeProfileLink($alog[userid])); if ($TIMEMARK < $alog[joined]) { $join_info->addCol("request pending"); } else { $join_info->addCol(date("H:i:s", $alog[joined])); } $time = numberToString($TIMEMARK - $alog[joined]); if ($time) { $join_info->addCol($time); $join_info->addCol("<font color=\"#00ff00\">ACTIVE</font>"); } else { $join_info->addCol("request pending"); $join_info->addCol("<font color=\"#FFff00\">PENDING</font>"); } $join_info->addCol($SHIPTYPES[$alog[shiptype]]); $join_info->addCol(yesno($alog[charity], 1, 0)); // Print the kick/ban/remove headers. if ($icankick) { if ($alog[userid] == $MySelf->getID()) { // Cant kick yourself. $join_info->addCol("---"); $join_info->addCol("---"); $join_info->addCol("---"); } else { $join_info->addCol("[<a href=\"index.php?action=kickban&state=1&joinid={$alog['id']}\">remove</a>]"); //Edit start to remove kick/leave op $join_info->addCol("[<a href=\"index.php?action=kickban&state=2&joinid={$alog['id']}\">kick</a>]"); //$join_info->addCol("[disabled]"); $join_info->addCol("[<a href=\"index.php?action=kickban&state=3&joinid={$alog['id']}\">ban</a>]"); //$join_info->addCol("[disabled]"); //Edit End