/** * This is largely cadged from PageHistory::history */ function showCreditsPage($article) { global $wgOut, $wgUser; $fname = 'showCreditsPage'; wfProfileIn($fname); // Show a 404 page for anonymous users accessing the credits. // We do this to hopefully improve SEO by removing links visible // to Google. if ($wgUser->isAnon()) { $wgOut->setRobotpolicy('noindex,nofollow'); $wgOut->addHTML(wfMsg('logintoview')); header('HTTP/1.0 404 Not Found'); return; } $wgOut->setPageTitle($article->mTitle->getPrefixedText()); $wgOut->setSubtitle(wfMsg('creditspage')); $wgOut->setArticleFlag(false); $wgOut->setArticleRelated(true); $wgOut->setRobotpolicy('noindex,nofollow'); if ($article->mTitle->getArticleID() == 0) { $s = wfMsg('nocredits'); } else { $s = getCredits($article, -1); } $wgOut->addHTML($s); wfProfileOut($fname); }
function createTransaction() { // We need globals. global $DB; global $MySelf; global $TIMEMARK; // Are we allowed to poke in here? if (!$MySelf->isAccountant()) { makeNotice("Umm, you are not allowed to do this. Really. You are not.", "warning", "You are not supposed to be here"); } // Check the ints. numericCheck($_POST[wod], 0, 1); numericCheck($_POST[amount], 0); numericCheck($_POST[id], 0); // Its easier on the eyes. $type = $_POST[wod]; $amount = $_POST[amount]; $id = $_POST[id]; $username = idToUsername($id); // invert the amount if we have a withdrawal. if ($_POST[wod] == 1) { $dir = "withdrawed"; $dir2 = "from"; $hisMoney = getCredits($id); if ($hisMoney < $amount) { $ayee = $hisMoney - $amount; confirm("WARNING:<br>{$username} can NOT afford this withdrawal. If you choose to " . "authorize this transaction anyway his account will be at " . number_format($ayee, 2) . " ISK."); } } else { $amount = $_POST[amount]; $dir = "deposited"; $dir2 = "into"; } // We use custom reason, if set. if ($_POST[reason2] != "") { $reason = sanitize($_POST[reason2]); } else { $reason = sanitize($_POST[reason1]); } // Create transaction. $transaction = new transaction($id, $type, $amount); $transaction->setReason($reason); // Success? if (!$transaction->commit()) { // Nope :( makeNotice("Unable to create transaction. Danger, Will Robinson, DANGER!", "error", "Internal Error", "index.php?action=edituser&id={$id}", "[Back]"); } else { // Success ! makeNotice("You successfully {$dir} {$amount} ISK {$dir2} " . $username . "'s account.", "notice", "Transaction complete", "index.php?action=edituser&id={$id}", "[Ok]"); } }
/** * This is largely cadged from PageHistory::history */ function showCreditsPage($article) { global $wgOut; $fname = 'showCreditsPage'; wfProfileIn($fname); $wgOut->setPageTitle($article->mTitle->getPrefixedText()); $wgOut->setSubtitle(wfMsg('creditspage')); $wgOut->setArticleFlag(false); $wgOut->setArticleRelated(true); $wgOut->setRobotpolicy('noindex,nofollow'); if ($article->mTitle->getArticleID() == 0) { $s = wfMsg('nocredits'); } else { $s = getCredits($article, -1); } $wgOut->addHTML($s); wfProfileOut($fname); }
public function index() { //$this->openid = $this->openid(); $this->openid = 'o3Iz7jmy9NjyTWvKQ7rkNhjJNSuY'; //会员 $usr = M('t_huiyuan')->where(array('open_id' => $this->openid))->find(); //print_r($usr); if ($usr) { //call sand api sand_api_call(); $score = getCredits($usr['card_no']); $usr['score'] = $score; $this->usr = $usr; $this->display('Yhjf'); } else { $this->cityList = $this->cityList(); $this->display(); } }
function transferMoney() { // Globals global $MySelf; global $DB; global $TIMEMARK; $MyCredits = getCredits($MySelf->getID()); // Can we afford even the most basic transactions? if (!numericCheckBool($MyCredits, 0)) { makeNotice("You can not afford any transaction.", "warning", "Out of money", "index.php?action=manageWallet", "[cancel]"); } // Did we supply an isk amount at all? if ($_POST[amount] == "") { makeNotice("You did not specify an ISK amount. Please go back, and try again.", "warning", "How much?", "index.php?action=manageWallet", "[cancel]"); } if (!is_numeric($_POST[amount])) { makeNotice("The frog looks at you and your cheque with the amount of \"" . $_POST[amount] . "\". The frog is unsure how much ISK that is and instead decides to lick your face in a friendly manner, then it closes the teller and goes for lunch.", "warning", "Huh?"); } // Check for sanity. if (!numericCheckBool($_POST[to], 0)) { makeNotice("The supplied reciver is not valid.", "warning", "Invalid ID", "index.php?action=manageWallet", "[cancel]"); } if (!numericCheckBool($_POST[amount], 0)) { makeNotice("You need to specify a positive ISK value.", "error", "Invalid amount", "index.php?action=manageWallet", "[cancel]"); } if (!numericCheckBool($_POST[amount], 0, $MyCredits)) { makeNotice("You can not afford this transaction.", "warning", "Out of money", "index.php?action=manageWallet", "[cancel]"); } // Ok so now we know: The reciver is valid, the sender has enough money. $from = "<br><br>From: " . ucfirst($MySelf->getUsername()); $to = "<br>To: " . ucfirst(idToUsername($_POST[to])); $amount = "<br>Amount: " . number_format($_POST[amount], 2) . " ISK"; $reason = "<br>Reason: " . $_POST[reason]; confirm("Please authorize this transaction:" . $from . $to . $amount . $reason); // Lets do it. $transaction = new transaction($_POST[to], 0, $_POST[amount]); $transaction->setReason("Cash transfer from " . ucfirst($MySelf->getUsername()) . " to " . ucfirst(idToUsername($_POST[to])) . ": " . $_POST[reason]); $transaction->isTransfer(true); $transaction->commit(); // Send'em back. makeNotice($amount . " has been transfered from your into " . ucfirst(idToUsername($_POST[to])) . " account.", "notice", "Cash transfered", "index.php?action=manageWallet", "[OK]"); }
function requestPayout() { // Globals global $MySelf; global $DB; global $TIMEMARK; // How much overdraft are we allowed? $overdraft = 100 * 1000000; // 100m $overdraftlimit = false; // How much isk we got? $MyCredits = getCredits($MySelf->getID()); // Is this a number? if (!is_numeric($_POST[amount])) { makeNotice("The frog looks at you and your cheque with the amount of \"" . $_POST[amount] . "\". The frog is unsure how much ISK that is and instead decides to lick your face in a friendly manner, then it closes the teller and goes for lunch.", "warning", "Huh?"); } // We are requesting a POSITIVE amount, right? if (!numericCheckBool($_POST[amount], 0)) { makeNotice("You can only request positive amounts of ISK. If you want money, go work for it.", "notice", "This aint no charity", "index.php?action=manageWallet", "But i got women and children to feed..."); } // So, can we afford it? if ($overdraft <= 0 && !numericCheckBool($_POST[amount], 1, $MyCredits)) { makeNotice("You can only request a payment up to " . number_format($MyCredits) . " ISK. You requested " . number_format($_POST[amount]) . " ISK. Thats " . number_format($_POST[amount] - $MyCredits, 2) . " ISK more than you can afford.", "warning", "Too big of a payout.", "index.php?action=manageWallet", "[Cancel]"); } // Allow an overdraft, but not too much if ($overdraft > 0 && $overdraftlimit && !numericCheckBool($_POST[amount], 1, $MyCredits + $overdraft)) { makeNotice("You can only request a payment up to " . number_format($MyCredits + $overdraft) . " ISK. You requested " . number_format($_POST[amount]) . " ISK. Thats " . number_format($_POST[amount] - ($MyCredits + $overdraft), 2) . " ISK more than you are allowed.", "warning", "Too big of a payout.", "index.php?action=manageWallet", "[Cancel]"); } // We sure? confirm("Please confirm your payout request of " . number_format($_POST[amount], 2) . " ISK."); // Ok, do it. $DB->query("INSERT INTO payoutRequests (time, applicant, amount) VALUES (?,?,?)", array($TIMEMARK, $MySelf->getID(), $_POST[amount])); if ($DB->affectedRows() == 1) { mailUser("We are notifying you that " . $MySelf->getUsername() . " has requested a payout of " . number_format($_POST[amount], 2) . " ISK", "WHB Payout Requested", "isAccountant"); makeNotice("You request has been logged. An accountant will soon honor your request.", "notice", "Request logged", "index.php?action=manageWallet", "[OK]"); } else { makeNotice("Internal Error! Unable to record your request into the database! Inform the admin!", "error", "Internal Error!", "index.php?action=manageWallet", "[cancel]"); } }
function outputPage(OutputPage $out = null) { global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgContLang, $wgOut; global $wgScript, $wgStylePath, $wgLanguageCode, $wgContLanguageCode; global $wgMimeType, $wgOutputEncoding, $wgUseDatabaseMessages; global $wgRequest, $wgUseNewInterlanguage; global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses; global $wgMaxCredits, $wgShowCreditsIfMax, $wgHideInterlanguageLinks; global $wgServer; global $wgSquidMaxage, $IP; $fname = __METHOD__; wfProfileIn($fname); wfRunHooks('BeforePageDisplay', array(&$wgOut, &$this)); $this->mTitle = $wgTitle; extract($wgRequest->getValues('oldid', 'diff')); wfProfileIn("{$fname}-init"); //$this->initPage( $out ); $tpl = $this->setupTemplate('WikiHowTemplate', 'skins'); $tpl->setTranslator(new MediaWiki_I18N()); wfProfileOut("{$fname}-init"); wfProfileIn("{$fname}-stuff"); $this->thispage = $wgTitle->getPrefixedDbKey(); $this->thisurl = $wgTitle->getPrefixedURL(); $this->loggedin = $wgUser->getID() != 0; $this->iscontent = $wgTitle->getNamespace() != NS_SPECIAL; $this->iseditable = ($this->iscontent and !($action == 'edit' or $action == 'submit')); $this->username = $wgUser->getName(); $this->userpage = $wgContLang->getNsText(NS_USER) . ":" . $wgUser->getName(); $this->userpageUrlDetails = $this->makeUrlDetails($this->userpage); $this->usercss = $this->userjs = $this->userjsprev = false; //$this->setupUserCss(); //$this->setupUserJs(false); $this->titletxt = $wgTitle->getPrefixedText(); wfProfileOut("{$fname}-stuff"); // add utm wfProfileIn("{$fname}-stuff2"); $tpl->set('title', $wgOut->getPageTitle()); $tpl->setRef("thispage", $this->thispage); $undelete = $this->getUndeleteLink(); $tpl->set("undelete", !empty($undelete) ? '<span class="subpages">' . $undelete . '</span>' : ''); $tpl->set('headscripts', $out->getHeadScripts() . $out->getHeadItems()); $description = ArticleMetaInfo::getCurrentTitleMetaDescription(); if ($description) { $wgOut->addMeta('description', $description); } $keywords = ArticleMetaInfo::getCurrentTitleMetaKeywords(); if ($keywords) { $wgOut->mKeywords = array(); $wgOut->addMeta('keywords', $keywords); } ArticleMetaInfo::addFacebookMetaProperties($tpl->data['title']); ArticleMetaInfo::addTwitterMetaProperties(); if ($wgOut->isSyndicated()) { $feeds = array(); foreach ($wgFeedClasses as $format => $class) { $feeds[$format] = array('text' => $format, 'href' => $wgRequest->appendQuery("feed={$format}"), 'ttip' => wfMessage('tooltip-' . $format)->text()); } $tpl->setRef('feeds', $feeds); } else { $tpl->set('feeds', false); } $tpl->setRef('mimetype', $wgMimeType); $tpl->setRef('charset', $wgOutputEncoding); $tpl->set('headlinks', $out->getHeadLinks()); $tpl->setRef('wgScript', $wgScript); $tpl->setRef('skinname', $this->skinname); $tpl->setRef('stylename', $this->stylename); $tpl->setRef('loggedin', $this->loggedin); $tpl->set('nsclass', 'ns-' . $wgTitle->getNamespace()); $tpl->set('notspecialpage', $wgTitle->getNamespace() != NS_SPECIAL); /* XXX currently unused, might get useful later $tpl->set( "editable", ($wgTitle->getNamespace() != NS_SPECIAL ) ); $tpl->set( "exists", $wgTitle->getArticleID() != 0 ); $tpl->set( "watch", $wgTitle->userIsWatching() ? "unwatch" : "watch" ); $tpl->set( "protect", count($wgTitle->isProtected()) ? "unprotect" : "protect" ); $tpl->set( "helppage", wfMessage('helppage')->text()); */ $tpl->set('searchaction', $this->escapeSearchLink()); $tpl->set('search', trim($wgRequest->getVal('search'))); $tpl->setRef('stylepath', $wgStylePath); $tpl->setRef('logopath', $wgLogo); $tpl->setRef("lang", $wgContLanguageCode); $tpl->set('dir', $wgContLang->isRTL() ? "rtl" : "ltr"); $tpl->set('rtl', $wgContLang->isRTL()); $tpl->set('langname', $wgContLang->getLanguageName($wgContLanguageCode)); $tpl->setRef('username', $this->username); $tpl->setRef('userpage', $this->userpage); $tpl->setRef('userpageurl', $this->userpageUrlDetails['href']); $tpl->setRef('usercss', $this->usercss); $tpl->setRef('userjs', $this->userjs); $tpl->setRef('userjsprev', $this->userjsprev); if ($this->iseditable && $wgUser->getOption('editsectiononrightclick')) { $tpl->set('body_onload', 'setupRightClickEdit()'); } else { $tpl->set('body_onload', false); } global $wgUseSiteJs; if ($wgUseSiteJs) { if ($this->loggedin) { $tpl->set('jsvarurl', $this->makeUrl($this->userpage . '/-', 'action=raw&gen=js&maxage=' . $wgSquidMaxage)); } else { $tpl->set('jsvarurl', $this->makeUrl('-', 'action=raw&gen=js')); } } else { $tpl->set('jsvarurl', false); } wfProfileOut("{$fname}-stuff2"); wfProfileIn("{$fname}-stuff3"); $tpl->setRef('newtalk', $ntl); $tpl->setRef('skin', $this); $tpl->set('logo', $this->logoText()); if ($wgOut->isArticle() and (!isset($oldid) or isset($diff)) and $this->getContext()->canUseWikiPage() && 0 != $this->getContext()->getWikiPage()->getId()) { if (!$wgDisableCounters) { $viewcount = $this->getContext()->getWikiPage()->getCount(); if ($viewcount) { $tpl->set('viewcount', wfMessage("viewcount", $viewcount)->text()); } else { $tpl->set('viewcount', false); } } else { $tpl->set('viewcount', false); } $tpl->set('lastmod', $this->lastModified()); $tpl->set('copyright', $this->getCopyright()); $this->credits = false; if (isset($wgMaxCredits) && $wgMaxCredits != 0) { require_once "{$IP}/includes/Credits.php"; $this->credits = getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax); } $tpl->setRef('credits', $this->credits); } elseif (isset($oldid) && !isset($diff)) { $tpl->set('copyright', $this->getCopyright()); $tpl->set('viewcount', false); $tpl->set('lastmod', false); $tpl->set('credits', false); } else { $tpl->set('copyright', false); $tpl->set('viewcount', false); $tpl->set('lastmod', false); $tpl->set('credits', false); } wfProfileOut("{$fname}-stuff3"); wfProfileIn("{$fname}-stuff4"); $tpl->set('copyrightico', $this->getCopyrightIcon()); $tpl->set('poweredbyico', $this->getPoweredBy()); $tpl->set('disclaimer', $this->disclaimerLink()); $tpl->set('about', $this->aboutLink()); $tpl->setRef('debug', $out->mDebugtext); //$out->addHTML($printfooter); $tpl->set('bottomscripts', $this->bottomScripts()); if ($wgTitle->getNamespace() == NS_USER && $wgUser->getId() == 0 && !UserPagePolicy::isGoodUserPage($wgTitle->getDBKey())) { $txt = $out->parse(wfMessage('noarticletext_user')->text()); $tpl->setRef('bodytext', $txt); header('HTTP/1.1 404 Not Found'); } else { if (!is_null($out)) { $tpl->setRef('bodytext', $out->getHTML()); } } # Language links $language_urls = array(); if (!$wgHideInterlanguageLinks) { foreach ($wgOut->getLanguageLinks() as $l) { $tmp = explode(':', $l, 2); $class = 'interwiki-' . $tmp[0]; $code = $tmp[0]; $lTitle = $tmp[1]; unset($tmp); $nt = Title::newFromText($l); $language = $wgContLang->fetchLanguageName($nt->getInterwiki(), $wgLanguageCode); $language_urls[] = array('code' => $code, 'href' => $nt->getFullURL(), 'text' => $lTitle, 'class' => $class, 'language' => ($language != '' ? Misc::capitalize($language) : $l) . ": "); } } if (count($language_urls)) { $tpl->setRef('language_urls', $language_urls); } else { $tpl->set('language_urls', false); } wfProfileOut("{$fname}-stuff4"); # Personal toolbar //$tpl->set('personal_urls', $this->buildPersonalUrls()); /*$content_actions = $this->buildContentActionUrls(); $tpl->setRef('content_actions', $content_actions); // XXX: attach this from javascript, same with section editing if($this->iseditable && $wgUser->getOption("editondblclick") ) { $tpl->set('body_ondblclick', 'document.location = "' .$content_actions['edit']['href'] .'";'); } else { $tpl->set('body_ondblclick', false); } */ //$tpl->set( 'navigation_urls', $this->buildNavigationUrls() ); //$tpl->set( 'nav_urls', $this->buildNavUrls() ); // execute template wfProfileIn("{$fname}-execute"); $res = $tpl->execute(); wfProfileOut("{$fname}-execute"); // result may be an error $this->printOrError($res); wfProfileOut($fname); }
<div class="panel-body"> <h4 class="adjst"><?php echo getName($row); ?> </h4> <p> <div id="overview"> <?php echo getOverview($row); ?> </div> <div id="credits"> <strong>Cast:</strong> <?php echo getCredits($row); ?> </div> <div id="director"> <strong>Director:</strong> <?php echo getDirector($row); ?> </div> <div id="runtime"> <strong>Runtime:</strong> <?php echo getRuntime($row); ?>
function manageWallet() { // Globals global $MySelf; global $DB; $MyCredits = getCredits($MySelf->getID()); // Get (recent?) transactions $html = getTransactions($MySelf->getID()); if ($MyCredits > 0) { // Create the dropdown menu with all pilots. $NamesDS = $DB->query("SELECT DISTINCT username, id FROM users WHERE deleted='0' ORDER BY username"); $ddm = "<select name=\"to\">"; while ($name = $NamesDS->fetchRow()) { // Lets not allow transfers to self. if ($name[id] != $MySelf->getID()) { $ddm .= "<option value=\"" . $name[id] . "\">" . ucfirst($name[username]) . "</option>"; } } $ddm .= "</select>"; $tt = new table(2, true); $tt->addHeader(">> Transfer ISK"); $tt->addRow("#060622"); $tt->addCol("You can transfer ISK into another Pilots wallet by using this form.", array("colspan" => 2)); $tt->addRow(); $tt->addCol("Transfer from:"); $tt->addCol(ucfirst($MySelf->getUsername())); $tt->addRow(); $tt->addCol("Transfer to:"); $tt->addCol($ddm); $tt->addRow(); $tt->addCol("Amount:"); $tt->addCol("<input type=\"text\" name=\"amount\">"); $tt->addRow(); $tt->addCol("Reason:"); $tt->addCol("<input type=\"text\" name=\"reason\">"); $tt->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Transfer money\">"); // Create form stuff, and embed the table within. $transfer = "<form action=\"index.php\" method=\"POST\">"; $transfer .= $tt->flush(); $transfer .= "<input type=\"hidden\" name=\"check\" value=\"true\">"; $transfer .= "<input type=\"hidden\" name=\"action\" value=\"transferMoney\">"; $transfer .= "</form>"; // Create the payout form. $payout = new table(2, true); $payout->addHeader(">> Request payout"); $payout->addRow("#060622"); $payout->addCol("Fill out this form to request payout of ISK. An accountant will honor your request soon.", array("colspan" => 2)); $payout->addRow(); $payout->addCol("Payout amount:"); $payout->addCol("<input type=\"text\" name=\"amount\" value=\"" . $MyCredits . "\"> ISK"); $payout->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"request payout\">"); // Create form stuff, and embed the table within. $requestPayout = "<form action=\"index.php\" method=\"POST\">"; $requestPayout .= $payout->flush(); $requestPayout .= "<input type=\"hidden\" name=\"check\" value=\"true\">"; $requestPayout .= "<input type=\"hidden\" name=\"action\" value=\"requestPayout\">"; $requestPayout .= "</form>"; } /* * Show current requests */ $requests = $DB->query("SELECT * FROM payoutRequests WHERE payoutTime IS NULL AND applicant='" . $MySelf->getID() . "' ORDER BY time"); $table = new table(4, true); $table->addHeader(">> Pending payout requests"); $table->addRow("#060622"); $table->addCol("request"); $table->addCol("time"); $table->addCol("amount"); $table->addCol("Cancel"); while ($request = $requests->fetchRow()) { $table->addRow(); $table->addCol("#" . str_pad($request[request], "5", "0", STR_PAD_LEFT)); $table->addCol(date("d.m.y H:i:s", $request[time])); $table->addCol(number_format($request[amount], 2) . " ISK"); $table->addCol("<input type=\"checkbox\" name=\"" . $request[request] . "\" value=\"true\">"); $haveRequest = true; } $table->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"cancel marked requests\">"); $takeBack = "<form action=\"index.php\" method=\"POST\">"; $takeBack .= "<input type=\"hidden\" name=\"check\" value=\"true\">"; $takeBack .= "<input type=\"hidden\" name=\"action\" value=\"deleteRequest\">"; $takeBack .= $table->flush(); $rakeBack .= "</form>"; /* * Show fulfilled requests */ $requests = $DB->query("SELECT * FROM payoutRequests WHERE payoutTime IS NOT NULL AND applicant='" . $MySelf->getID() . "' ORDER BY time"); $table_done = new table(5, true); $table_done->addHeader(">> Fulfilled payout requests"); $table_done->addRow("#060622"); $table_done->addCol("request"); $table_done->addCol("time"); $table_done->addCol("amount"); $table_done->addCol("Payout time"); $table_done->addCol("Paid by"); while ($request = $requests->fetchRow()) { $table_done->addRow(); $table_done->addCol("#" . str_pad($request[request], "5", "0", STR_PAD_LEFT)); $table_done->addCol(date("d.m.y H:i:s", $request[time])); $table_done->addCol(number_format($request[amount], 2) . " ISK"); $table_done->addCol(date("d.m.y H:i:s", $request[payoutTime])); $table_done->addCol(ucfirst(idToUsername($request[banker]))); $haveOldRequests = true; } if ($html) { $html = "<h2>Your Wallet</h2>" . $html . "<br>" . $requestPayout . $transfer; if ($haveRequest) { $html .= $takeBack . "<br>"; } if ($haveOldRequests) { $html .= $table_done->flush(); } } else { $html = "<h2>Your Wallet</h2>Once your wallet has any transactions you can view the details here. And once you obtained a positive balance you can transfer money and request payouts.<br>"; } return $html; }
/** * initialize various variables and generate the template * * @param OutputPage $out * @access public */ function outputPage(&$out) { global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgContLang, $wgOut; global $wgScript, $wgStylePath, $wgLanguageCode, $wgContLanguageCode, $wgUseNewInterlanguage; global $wgMimeType, $wgJsMimeType, $wgOutputEncoding, $wgUseDatabaseMessages, $wgRequest; global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses, $wgHideInterlanguageLinks; global $wgMaxCredits, $wgShowCreditsIfMax; global $wgPageShowWatchingUsers; global $wgUseTrackbacks; $fname = 'SkinTemplate::outputPage'; wfProfileIn($fname); extract($wgRequest->getValues('oldid', 'diff')); wfProfileIn("{$fname}-init"); $this->initPage($out); $this->mTitle =& $wgTitle; $this->mUser =& $wgUser; $tpl = $this->setupTemplate($this->template, 'skins'); #if ( $wgUseDatabaseMessages ) { // uncomment this to fall back to GetText $tpl->setTranslator(new MediaWiki_I18N()); #} wfProfileOut("{$fname}-init"); wfProfileIn("{$fname}-stuff"); $this->thispage = $this->mTitle->getPrefixedDbKey(); $this->thisurl = $this->mTitle->getPrefixedURL(); $this->loggedin = $wgUser->isLoggedIn(); $this->iscontent = $this->mTitle->getNamespace() != NS_SPECIAL; $this->iseditable = ($this->iscontent and !($action == 'edit' or $action == 'submit')); $this->username = $wgUser->getName(); $userPage = $wgUser->getUserPage(); $this->userpage = $userPage->getPrefixedText(); $this->userpageUrlDetails = $this->makeUrlDetails($this->userpage); $this->usercss = $this->userjs = $this->userjsprev = false; $this->setupUserCss(); $this->setupUserJs(); $this->titletxt = $this->mTitle->getPrefixedText(); wfProfileOut("{$fname}-stuff"); wfProfileIn("{$fname}-stuff2"); $tpl->set('title', $wgOut->getPageTitle()); $tpl->set('pagetitle', $wgOut->getHTMLTitle()); $tpl->setRef("thispage", $this->thispage); $subpagestr = $this->subPageSubtitle(); $tpl->set('subtitle', !empty($subpagestr) ? '<span class="subpages">' . $subpagestr . '</span>' . $out->getSubtitle() : $out->getSubtitle()); $undelete = $this->getUndeleteLink(); $tpl->set("undelete", !empty($undelete) ? '<span class="subpages">' . $undelete . '</span>' : ''); $tpl->set('catlinks', $this->getCategories()); if ($wgOut->isSyndicated()) { $feeds = array(); foreach ($wgFeedClasses as $format => $class) { $feeds[$format] = array('text' => $format, 'href' => $wgRequest->appendQuery("feed={$format}"), 'ttip' => wfMsg('tooltip-' . $format)); } $tpl->setRef('feeds', $feeds); } else { $tpl->set('feeds', false); } if ($wgUseTrackbacks && $out->isArticleRelated()) { $tpl->set('trackbackhtml', $wgTitle->trackbackRDF()); } $tpl->setRef('mimetype', $wgMimeType); $tpl->setRef('jsmimetype', $wgJsMimeType); $tpl->setRef('charset', $wgOutputEncoding); $tpl->set('headlinks', $out->getHeadLinks()); $tpl->setRef('headscripts', $out->getScript()); $tpl->setRef('wgScript', $wgScript); $tpl->setRef('skinname', $this->skinname); $tpl->setRef('stylename', $this->stylename); $tpl->set('printable', $wgRequest->getBool('printable')); $tpl->setRef('loggedin', $this->loggedin); $tpl->set('nsclass', 'ns-' . $this->mTitle->getNamespace()); $tpl->set('notspecialpage', $this->mTitle->getNamespace() != NS_SPECIAL); /* XXX currently unused, might get useful later $tpl->set( "editable", ($this->mTitle->getNamespace() != NS_SPECIAL ) ); $tpl->set( "exists", $this->mTitle->getArticleID() != 0 ); $tpl->set( "watch", $this->mTitle->userIsWatching() ? "unwatch" : "watch" ); $tpl->set( "protect", count($this->mTitle->isProtected()) ? "unprotect" : "protect" ); $tpl->set( "helppage", wfMsg('helppage')); */ $tpl->set('searchaction', $this->escapeSearchLink()); $tpl->set('search', trim($wgRequest->getVal('search'))); $tpl->setRef('stylepath', $wgStylePath); $tpl->setRef('logopath', $wgLogo); $tpl->setRef("lang", $wgContLanguageCode); $tpl->set('dir', $wgContLang->isRTL() ? "rtl" : "ltr"); $tpl->set('rtl', $wgContLang->isRTL()); $tpl->set('langname', $wgContLang->getLanguageName($wgContLanguageCode)); $tpl->setRef('username', $this->username); $tpl->setRef('userpage', $this->userpage); $tpl->setRef('userpageurl', $this->userpageUrlDetails['href']); $tpl->setRef('usercss', $this->usercss); $tpl->setRef('userjs', $this->userjs); $tpl->setRef('userjsprev', $this->userjsprev); global $wgUseSiteJs; if ($wgUseSiteJs) { if ($this->loggedin) { $tpl->set('jsvarurl', $this->makeUrl('-', 'action=raw&smaxage=0&gen=js')); } else { $tpl->set('jsvarurl', $this->makeUrl('-', 'action=raw&gen=js')); } } else { $tpl->set('jsvarurl', false); } if ($wgUser->getNewtalk()) { global $wgShowNewtalkForUserOrUserTalkPage; if ($wgShowNewtalkForUserOrUserTalkPage) { $newmsg_usertalk = false; $newmsg_user = false; $usertitle = Title::newFromText($this->userpage); if ($wgUser->checkNotificationPendingForArticleOrTalk($usertitle, NS_USER_TALK, $lvr)) { $diff_oldid = $lvr != 0 ? "diff=0&oldid={$lvr}" : ''; $ns_usertalk = $wgContLang->getNsText(NS_USER_TALK); $newmsg_usertalklink = $this->makeKnownLink($ns_usertalk . ':' . $this->username, wfMsg('newmsg_usertalk')); $newmsg_usertalklvrlink = $this->makeKnownLink($ns_usertalk . ':' . $this->username, wfMsg('diff-to-lvr'), $diff_oldid, '', '', '', wfMsg('diff-to-lvr_tooltiptext')); $newmsg_usertalk = true; } if ($wgUser->checkNotificationPendingForArticleOrTalk($usertitle, NS_USER, $lvr)) { $diff_oldid = $lvr != 0 ? "diff=0&oldid={$lvr}" : ''; $ns_user = $wgContLang->getNsText(NS_USER); $newmsg_userlink = $this->makeKnownLink($ns_user . ':' . $this->username, wfMsg('newmsg_user')); $newmsg_userlvrlink = $this->makeKnownLink($ns_user . ':' . $this->username, wfMsg('diff-to-lvr'), $diff_oldid, '', '', '', wfMsg('diff-to-lvr_tooltiptext')); $newmsg_user = true; } switch (true) { case $newmsg_user && $newmsg_usertalk: $str = $newmsg_userlink . ' (' . $newmsg_userlvrlink . ') ' . wfMsg('newmsg_and') . ' ' . $newmsg_usertalklink . ' (' . $newmsg_usertalklvrlink . ')'; break; case !$newmsg_user && $newmsg_usertalk: $str = $newmsg_usertalklink . ' (' . $newmsg_usertalklvrlink . ')'; break; case $newmsg_user && !$newmsg_usertalk: $str = $newmsg_userlink . ' (' . $newmsg_userlvrlink . ')'; break; default: # this is the case for anon talk $str = $this->makeKnownLink($wgContLang->getNsText(NS_USER_TALK) . ':' . $this->username, wfMsg('newmsg_usertalk')); } $ntl = wfMsg('newmsg', $str); } else { /* OLD METHOD */ if ($wgUser->getNewtalk()) { $usertitle = $this->mUser->getUserPage(); $usertalktitle = $usertitle->getTalkPage(); if (!$usertalktitle->equals($this->mTitle)) { $ntl = wfMsg('newmessages', $this->makeKnownLinkObj($usertalktitle, wfMsg('newmessageslink'))); # Disable Cache $wgOut->setSquidMaxage(0); } } else { $ntl = ''; } } } wfProfileOut("{$fname}-stuff2"); wfProfileIn("{$fname}-stuff3"); $tpl->setRef('newtalk', $ntl); $tpl->setRef('skin', $this); $tpl->set('logo', $this->logoText()); if ($wgOut->isArticle() and (!isset($oldid) or isset($diff)) and 0 != $wgArticle->getID()) { if (!$wgDisableCounters) { $viewcount = $wgLang->formatNum($wgArticle->getCount()); if ($viewcount) { $tpl->set('viewcount', wfMsg("viewcount", $viewcount)); } else { $tpl->set('viewcount', false); } } else { $tpl->set('viewcount', false); } if ($wgPageShowWatchingUsers) { $dbr =& wfGetDB(DB_SLAVE); extract($dbr->tableNames('watchlist')); $sql = "SELECT COUNT(*) AS n FROM {$watchlist}\n\t\t\t\t\tWHERE wl_title='" . $dbr->strencode($this->mTitle->getDBKey()) . "' AND wl_namespace=" . $this->mTitle->getNamespace(); $res = $dbr->query($sql, 'SkinPHPTal::outputPage'); $x = $dbr->fetchObject($res); $numberofwatchingusers = $x->n; if ($numberofwatchingusers > 0) { $tpl->set('numberofwatchingusers', ' ' . wfMsg('number_of_watching_users_pageview', $numberofwatchingusers)); } else { $tpl->set('numberofwatchingusers', false); } } else { $tpl->set('numberofwatchingusers', false); } $tpl->set('copyright', $this->getCopyright()); $this->credits = false; if (isset($wgMaxCredits) && $wgMaxCredits != 0) { require_once "Credits.php"; $this->credits = getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax); } else { $tpl->set('lastmod', $this->lastModified()); } $tpl->setRef('credits', $this->credits); } elseif (isset($oldid) && !isset($diff)) { $tpl->set('copyright', $this->getCopyright()); $tpl->set('viewcount', false); $tpl->set('lastmod', false); $tpl->set('credits', false); $tpl->set('numberofwatchingusers', false); } else { $tpl->set('copyright', false); $tpl->set('viewcount', false); $tpl->set('lastmod', false); $tpl->set('credits', false); $tpl->set('numberofwatchingusers', false); } wfProfileOut("{$fname}-stuff3"); wfProfileIn("{$fname}-stuff4"); $tpl->set('copyrightico', $this->getCopyrightIcon()); $tpl->set('poweredbyico', $this->getPoweredBy()); $tpl->set('disclaimer', $this->disclaimerLink()); $tpl->set('about', $this->aboutLink()); $tpl->setRef('debug', $out->mDebugtext); $tpl->set('reporttime', $out->reportTime()); $tpl->set('sitenotice', wfGetSiteNotice()); $printfooter = "<div class=\"printfooter\">\n" . $this->printSource() . "</div>\n"; $out->mBodytext .= $printfooter; $tpl->setRef('bodytext', $out->mBodytext); # Language links $language_urls = array(); if (!$wgHideInterlanguageLinks) { foreach ($wgOut->getLanguageLinks() as $l) { $tmp = explode(':', $l, 2); $class = 'interwiki-' . $tmp[0]; unset($tmp); $nt = Title::newFromText($l); $language_urls[] = array('href' => $nt->getFullURL(), 'text' => $wgContLang->getLanguageName($nt->getInterwiki()) != '' ? $wgContLang->getLanguageName($nt->getInterwiki()) : $l, 'class' => $class); } } if (count($language_urls)) { $tpl->setRef('language_urls', $language_urls); } else { $tpl->set('language_urls', false); } wfProfileOut("{$fname}-stuff4"); # Personal toolbar $tpl->set('personal_urls', $this->buildPersonalUrls()); $content_actions = $this->buildContentActionUrls(); $tpl->setRef('content_actions', $content_actions); // XXX: attach this from javascript, same with section editing if ($this->iseditable && $wgUser->getOption("editondblclick")) { $tpl->set('body_ondblclick', 'document.location = "' . $content_actions['edit']['href'] . '";'); } else { $tpl->set('body_ondblclick', false); } if ($this->iseditable && $wgUser->getOption('editsectiononrightclick')) { $tpl->set('body_onload', 'setupRightClickEdit()'); } else { $tpl->set('body_onload', false); } $tpl->set('sidebar', $this->buildSidebar()); $tpl->set('nav_urls', $this->buildNavUrls()); // execute template wfProfileIn("{$fname}-execute"); $res = $tpl->execute(); wfProfileOut("{$fname}-execute"); // result may be an error $this->printOrError($res); wfProfileOut($fname); }
function changeCredits($uid, $pid, $credits) { if (!canViewPuzzle($uid, $pid)) { utilsError("You do not have permission to modify this puzzle."); } $purifier = new HTMLPurifier(); mysql_query('START TRANSACTION'); $oldCredits = getCredits($pid); $cleanCredits = $purifier->purify($credits); //$cleanCredits = htmlspecialchars($cleanCredits); updateCredits($uid, $pid, $oldCredits, $cleanCredits); mysql_query('COMMIT'); }
function makeWelcome() { // Load the globals. global $VERSION; global $SITENAME; global $IGB; global $IGB_VISUAL; global $MySelf; global $DB; global $ValidUntil; /* HTML stuff */ $page = "<h2>Welcome to {$VERSION}!</h2>"; /* The welcome table */ $table = new table(2, true); $table->addHeader(">> Welcome to {$VERSION}"); $table->addRow(); $table->addCol("Logged in as:", array("bold" => true, "align" => "right")); $table->addCol(ucfirst($MySelf->getUsername())); $table->addRow(); $table->addCol("Registered Rank:", array("bold" => true, "align" => "right")); $table->addCol($MySelf->getRankName()); $table->addRow(); $table->addCol("Latest login:"******"bold" => true, "align" => "right")); if ($MySelf->getLastlogin() < 1) { $table->addCol("This is your very first login! Welcome!"); } else { $table->addCol(date("r", $MySelf->getLastlogin())); } $table->addRow(); $table->addCol("Your account:", array("bold" => true, "align" => "right")); $table->addCol(number_format(getCredits($MySelf->getID()), 2) . " ISK"); $table->addRow(); $table->addCol("Your profile:", array("bold" => true, "align" => "right")); $table->addCol(makeProfileLink($MySelf->getID())); global $BLESSED; if ($BLESSED) { $table->addRow("#330000"); $table->addCol("Installation Blessed!", array("bold" => true, "align" => "right")); $table->addCol("It is not affected by expiration. It runs with the highest priority on the server and all limitations have been lifted."); } // Set the filename to the announce textfile. $announceFile = "/path/to/your/announce/txt.file"; // Check its existance... if (file_exists($announceFile)) { // Then load it. $globalAnnounce = file_get_contents($announceFile); } // Only display contents if more than X characters long. if (strlen($globalAnnounce) > 10) { // Create announcement table... $announceTable = new table(1, true); $announceTable->addHeader(">>> Important hosting information"); $announceTable->addRow(); $announceTable->addCol("{$globalAnnounce}"); // ... and add it to the page. $page .= $announceTable->flush(); } $page .= $table->flush(); /* Show failed Logins to admins. */ if ($MySelf->isAdmin()) { $page .= showFailedLogins("15"); } else { $page .= showFailedLogins("10", $MySelf->getUsername()); } /* permissions table */ $permsTable = new table(1, true); $permsTable->addHeader(">> Your permissions"); // Permissions matrix $perms = array("canLogin" => "log in.", "canJoinRun" => "join mining operations.", "canCreateRun" => "create new mining operations.", "canCloseRun" => "close mining operations.", "canDeleteRun" => "delete mining operations.", "canAddHaul" => "haul to mining operations.", "canSeeEvents" => "view scheduled events.", "canEditEvents" => "add and delete scheduled events.", "canChangePwd" => "change your own password.", "canChangeEmail" => "change your own email.", "canChangeOre" => "manage ore prices and enable/disable them.", "canAddUser" => "add new accounts.", "canSeeUsers" => "see other accounts.", "canDeleteUser" => "delete other accounts.", "canEditRank" => "edit other peoples ranks.", "canManageUser" => "grant and take permissions.", "isAccountant" => "manage the corporation wallet and authorize payments.", "isOfficial" => "create official mining runs (with payout)."); $permDS = $DB->getAssoc("SELECT * FROM users WHERE id='" . $MySelf->getID() . "' AND deleted='0'"); $keys = array_keys($perms); foreach ($keys as $key) { if ($permDS[$MySelf->getID()][$key] == 1) { $permsTable->addRow(); $permsTable->addCol("You are allowed to " . $perms[$key]); } } $permsTable->addHeader("If you believe your permissions are faulty, consult your CEO immediatly."); // Show the balance $balance = getTransactions($MySelf->getID()); $logins = getLogins($MySelf->getID()); $page .= "<br>" . $balance . "<br>" . $permsTable->flush() . "<br>" . $logins; // .. then return it. return $page; }
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\">"); $funnyForm = "<form action=\"index.php\" method=\"POST\">"; $funnyForm .= "<input type=\"hidden\" name=\"check\" value=\"true\">"; $funnyForm .= "<input type=\"hidden\" name=\"action\" value=\"payout\">"; $funnyForm .= $table->flush(); $funnyForm .= "</form>"; /* * Show fulfilled requests */ if (is_numeric($_GET['page']) && $_GET['page'] > 0) { $page = "LIMIT " . $_GET['page'] * 20 . ", 20"; } elseif ($_GET['page'] == "all") { $page = ""; } else { $page = "LIMIT 20"; } $requests = $DB->query("SELECT * FROM payoutRequests WHERE payoutTime IS NOT NULL ORDER BY time DESC {$page}"); $table_done = new table(6, true); $table_done->addHeader(">> Fulfilled payout requests"); $table_done->addRow("#060622"); $table_done->addCol("request"); $table_done->addCol("applicant"); $table_done->addCol("time"); $table_done->addCol("amount"); $table_done->addCol("Payout time"); $table_done->addCol("Authorized by"); while ($request = $requests->fetchRow()) { $table_done->addRow(); $table_done->addCol("#" . str_pad($request['request'], "5", "0", STR_PAD_LEFT)); $table_done->addCol("<a href=\"index.php?action=showTransactions&id={$request['applicant']}\">" . ucfirst(idToUsername($request['applicant'])) . "</a>"); $table_done->addCol(date("d.m.y H:i:s", $request['time'])); $table_done->addCol(number_format($request['amount'], 2) . " ISK"); $table_done->addCol(date("d.m.y H:i:s", $request['payoutTime'])); $table_done->addCol(ucfirst(idToUsername($request['banker']))); $haveOldRequests = true; } // The "show this many payouts"-part. $count = $DB->getCol("SELECT COUNT(request) FROM payoutRequests WHERE payoutTime IS NOT NULL"); $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=payout&page=" . $thisStep . "\">" . $thisStep . "</a>] "; } $showMore .= "[<a href=\"index.php?action=payout&page=all\">All</a>] "; $table_done->addHeader($showMore); $html = "<h2>Manage Payouts</h2>" . $iskOwned->flush() . "<br><br>"; $html .= "<form action=\"index.php\" method=\"GET\">" . $freeSelect->flush() . "<input type=\"hidden\" name=\"action\" value=\"showTransactions\"></form><br>"; if ($haveRequest) { $html .= $funnyForm . "<br>"; } else { $html .= "<i>No open requests.</i><br><br>"; } if ($haveOldRequests) { $html .= $table_done->flush(); } else { $html .= "<br><i>No payouts at all.</i>"; } return $html; }
echo $mod_strings['_LBL_FAX_SETTINGS_CONNECTIVITY_ERROR']; } else { $errCode = split(":", $credits); if ($errCode[0] == "ERR") { echo $mod_strings['LBL_GET_CREDITS_ERROR'] . " (" . $errCode[1] . ")"; } else { echo $errCode[1]; } } } else { echo $mod_strings['LBL_GET_CREDITS_ERROR']; } } else { if ($_REQUEST["command"] == "checkconnectivity") { $config = Accounting::loadConfigParams(); $result = getCredits($config); if ($result == "-1") { echo $mod_strings['_LBL_FAX_SETTINGS_CONNECTIVITY_ERROR']; } else { $errCode = split(":", $result); if ($errCode[0] == "ERR") { echo $mod_strings['_LBL_FAX_SETTINGS_CONNECTIVITY_ERROR_LOGIN'] . " (" . $errCode[1] . ")"; } else { echo $mod_strings['_LBL_FAX_SETTINGS_CONNECTIVITY_OK']; } } } else { if ($_REQUEST["command"] == "addtemplate") { Accounting::addTemplate($_REQUEST["name"], $_REQUEST["body"]); } else { if ($_REQUEST["command"] == "savetemplate") {
function displayCredits($uid, $pid) { $notes = htmlspecialchars(getCredits($pid)); ?> <table class="creditsInfo"> <tr> <td class='creditsInfo'> <strong>Credits: </strong> <?php echo $notes; ?> </td> <td class='creditsInfo'> <a href="#" class="changeLink">[Change]</a> </td> </tr> <tr> <td colspan='2'> <form method="post" action="form-submit.php"> <input type="hidden" name="uid" value="<?php echo $uid; ?> " /> <input type="hidden" name="pid" value="<?php echo $pid; ?> " /> <input type="text" name="credits" maxlength="255" class="longin" value="<?php echo $notes; ?> "/> <input type="submit" name="changeCredits" value="Change" /> </form> </td> </tr> </table> <?php }
/** * initialize various variables and generate the template * * @param OutputPage $out * @public */ function outputPage(&$out) { global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgContLang, $wgOut; global $wgScript, $wgStylePath, $wgContLanguageCode; global $wgMimeType, $wgJsMimeType, $wgOutputEncoding, $wgRequest; global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses, $wgHideInterlanguageLinks; global $wgMaxCredits, $wgShowCreditsIfMax; global $wgPageShowWatchingUsers; global $wgUseTrackbacks; global $wgDBname; $fname = 'SkinTemplate::outputPage'; wfProfileIn($fname); // Hook that allows last minute changes to the output page, e.g. // adding of CSS or Javascript by extensions. wfRunHooks('BeforePageDisplay', array(&$out)); extract($wgRequest->getValues('oldid', 'diff')); wfProfileIn("{$fname}-init"); $this->initPage($out); $this->mTitle =& $wgTitle; $this->mUser =& $wgUser; $tpl = $this->setupTemplate($this->template, 'skins'); #if ( $wgUseDatabaseMessages ) { // uncomment this to fall back to GetText $tpl->setTranslator(new MediaWiki_I18N()); #} wfProfileOut("{$fname}-init"); wfProfileIn("{$fname}-stuff"); $this->thispage = $this->mTitle->getPrefixedDbKey(); $this->thisurl = $this->mTitle->getPrefixedURL(); $this->loggedin = $wgUser->isLoggedIn(); $this->iscontent = $this->mTitle->getNamespace() != NS_SPECIAL; $this->iseditable = ($this->iscontent and !($action == 'edit' or $action == 'submit')); $this->username = $wgUser->getName(); $userPage = $wgUser->getUserPage(); $this->userpage = $userPage->getPrefixedText(); if ($wgUser->isLoggedIn() || $this->showIPinHeader()) { $this->userpageUrlDetails = $this->makeUrlDetails($this->userpage); } else { # This won't be used in the standard skins, but we define it to preserve the interface # To save time, we check for existence $this->userpageUrlDetails = $this->makeKnownUrlDetails($this->userpage); } $this->usercss = $this->userjs = $this->userjsprev = false; $this->setupUserCss(); $this->setupUserJs(); $this->titletxt = $this->mTitle->getPrefixedText(); wfProfileOut("{$fname}-stuff"); wfProfileIn("{$fname}-stuff2"); $tpl->set('title', $wgOut->getPageTitle()); $tpl->set('pagetitle', $wgOut->getHTMLTitle()); $tpl->set('displaytitle', $wgOut->mPageLinkTitle); $tpl->setRef("thispage", $this->thispage); $subpagestr = $this->subPageSubtitle(); $tpl->set('subtitle', !empty($subpagestr) ? '<span class="subpages">' . $subpagestr . '</span>' . $out->getSubtitle() : $out->getSubtitle()); $undelete = $this->getUndeleteLink(); $tpl->set("undelete", !empty($undelete) ? '<span class="subpages">' . $undelete . '</span>' : ''); $tpl->set('catlinks', $this->getCategories()); if ($wgOut->isSyndicated()) { $feeds = array(); foreach ($wgFeedClasses as $format => $class) { $feeds[$format] = array('text' => $format, 'href' => $wgRequest->appendQuery("feed={$format}")); } $tpl->setRef('feeds', $feeds); } else { $tpl->set('feeds', false); } if ($wgUseTrackbacks && $out->isArticleRelated()) { $tpl->set('trackbackhtml', $wgTitle->trackbackRDF()); } $tpl->setRef('mimetype', $wgMimeType); $tpl->setRef('jsmimetype', $wgJsMimeType); $tpl->setRef('charset', $wgOutputEncoding); $tpl->set('headlinks', $out->getHeadLinks()); $tpl->set('headscripts', $out->getScript()); $tpl->setRef('wgScript', $wgScript); $tpl->setRef('skinname', $this->skinname); $tpl->setRef('stylename', $this->stylename); $tpl->set('printable', $wgRequest->getBool('printable')); $tpl->setRef('loggedin', $this->loggedin); $tpl->set('nsclass', 'ns-' . $this->mTitle->getNamespace()); $tpl->set('notspecialpage', $this->mTitle->getNamespace() != NS_SPECIAL); /* XXX currently unused, might get useful later $tpl->set( "editable", ($this->mTitle->getNamespace() != NS_SPECIAL ) ); $tpl->set( "exists", $this->mTitle->getArticleID() != 0 ); $tpl->set( "watch", $this->mTitle->userIsWatching() ? "unwatch" : "watch" ); $tpl->set( "protect", count($this->mTitle->isProtected()) ? "unprotect" : "protect" ); $tpl->set( "helppage", wfMsg('helppage')); */ $tpl->set('searchaction', $this->escapeSearchLink()); $tpl->set('search', trim($wgRequest->getVal('search'))); $tpl->setRef('stylepath', $wgStylePath); $tpl->setRef('logopath', $wgLogo); $tpl->setRef("lang", $wgContLanguageCode); $tpl->set('dir', $wgContLang->isRTL() ? "rtl" : "ltr"); $tpl->set('rtl', $wgContLang->isRTL()); $tpl->set('langname', $wgContLang->getLanguageName($wgContLanguageCode)); $tpl->set('showjumplinks', $wgUser->getOption('showjumplinks')); $tpl->setRef('username', $this->username); $tpl->setRef('userpage', $this->userpage); $tpl->setRef('userpageurl', $this->userpageUrlDetails['href']); $tpl->set('pagecss', $this->setupPageCss()); $tpl->setRef('usercss', $this->usercss); $tpl->setRef('userjs', $this->userjs); $tpl->setRef('userjsprev', $this->userjsprev); global $wgUseSiteJs; if ($wgUseSiteJs) { if ($this->loggedin) { $tpl->set('jsvarurl', $this->makeUrl('-', 'action=raw&smaxage=0&gen=js')); } else { $tpl->set('jsvarurl', $this->makeUrl('-', 'action=raw&gen=js')); } } else { $tpl->set('jsvarurl', false); } $newtalks = $wgUser->getNewMessageLinks(); if (count($newtalks) == 1 && $newtalks[0]["wiki"] === $wgDBname) { $usertitle = $this->mUser->getUserPage(); $usertalktitle = $usertitle->getTalkPage(); if (!$usertalktitle->equals($this->mTitle)) { $ntl = wfMsg('youhavenewmessages', $this->makeKnownLinkObj($usertalktitle, wfMsgHtml('newmessageslink'), 'redirect=no'), $this->makeKnownLinkObj($usertalktitle, wfMsgHtml('newmessagesdifflink'), 'diff=cur')); # Disable Cache $wgOut->setSquidMaxage(0); } } else { if (count($newtalks)) { $sep = str_replace("_", " ", wfMsgHtml("newtalkseperator")); $msgs = array(); foreach ($newtalks as $newtalk) { $msgs[] = wfElement("a", array('href' => $newtalk["link"]), $newtalk["wiki"]); } $parts = implode($sep, $msgs); $ntl = wfMsgHtml('youhavenewmessagesmulti', $parts); $wgOut->setSquidMaxage(0); } else { $ntl = ''; } } wfProfileOut("{$fname}-stuff2"); wfProfileIn("{$fname}-stuff3"); $tpl->setRef('newtalk', $ntl); $tpl->setRef('skin', $this); $tpl->set('logo', $this->logoText()); if ($wgOut->isArticle() and (!isset($oldid) or isset($diff)) and 0 != $wgArticle->getID()) { if (!$wgDisableCounters) { $viewcount = $wgLang->formatNum($wgArticle->getCount()); if ($viewcount) { $tpl->set('viewcount', wfMsgExt('viewcount', array('parseinline'), $viewcount)); } else { $tpl->set('viewcount', false); } } else { $tpl->set('viewcount', false); } if ($wgPageShowWatchingUsers) { $dbr =& wfGetDB(DB_SLAVE); extract($dbr->tableNames('watchlist')); $sql = "SELECT COUNT(*) AS n FROM {$watchlist}\n\t\t\t\t\tWHERE wl_title='" . $dbr->strencode($this->mTitle->getDBKey()) . "' AND wl_namespace=" . $this->mTitle->getNamespace(); $res = $dbr->query($sql, 'SkinTemplate::outputPage'); $x = $dbr->fetchObject($res); $numberofwatchingusers = $x->n; if ($numberofwatchingusers > 0) { $tpl->set('numberofwatchingusers', wfMsg('number_of_watching_users_pageview', $numberofwatchingusers)); } else { $tpl->set('numberofwatchingusers', false); } } else { $tpl->set('numberofwatchingusers', false); } $tpl->set('copyright', $this->getCopyright()); $this->credits = false; if (isset($wgMaxCredits) && $wgMaxCredits != 0) { require_once "Credits.php"; $this->credits = getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax); } else { $tpl->set('lastmod', $this->lastModified()); } $tpl->setRef('credits', $this->credits); } elseif (isset($oldid) && !isset($diff)) { $tpl->set('copyright', $this->getCopyright()); $tpl->set('viewcount', false); $tpl->set('lastmod', false); $tpl->set('credits', false); $tpl->set('numberofwatchingusers', false); } else { $tpl->set('copyright', false); $tpl->set('viewcount', false); $tpl->set('lastmod', false); $tpl->set('credits', false); $tpl->set('numberofwatchingusers', false); } wfProfileOut("{$fname}-stuff3"); wfProfileIn("{$fname}-stuff4"); $tpl->set('copyrightico', $this->getCopyrightIcon()); $tpl->set('poweredbyico', $this->getPoweredBy()); $tpl->set('disclaimer', $this->disclaimerLink()); $tpl->set('privacy', $this->privacyLink()); $tpl->set('about', $this->aboutLink()); $tpl->setRef('debug', $out->mDebugtext); $tpl->set('reporttime', $out->reportTime()); $tpl->set('sitenotice', wfGetSiteNotice()); $printfooter = "<div class=\"printfooter\">\n" . $this->printSource() . "</div>\n"; $out->mBodytext .= $printfooter; $tpl->setRef('bodytext', $out->mBodytext); # Language links $language_urls = array(); if (!$wgHideInterlanguageLinks) { foreach ($wgOut->getLanguageLinks() as $l) { $tmp = explode(':', $l, 2); $class = 'interwiki-' . $tmp[0]; unset($tmp); $nt = Title::newFromText($l); $language_urls[] = array('href' => $nt->getFullURL(), 'text' => $wgContLang->getLanguageName($nt->getInterwiki()) != '' ? $wgContLang->getLanguageName($nt->getInterwiki()) : $l, 'class' => $class); } } if (count($language_urls)) { $tpl->setRef('language_urls', $language_urls); } else { $tpl->set('language_urls', false); } wfProfileOut("{$fname}-stuff4"); // WERELATE - added trees $tpl->setRef('trees', $this->getTrees()); # Personal toolbar $tpl->set('personal_urls', $this->buildPersonalUrls()); $content_actions = $this->buildContentActionUrls(); $tpl->setRef('content_actions', $content_actions); // XXX: attach this from javascript, same with section editing if ($this->iseditable && $wgUser->getOption("editondblclick")) { $tpl->set('body_ondblclick', 'document.location = "' . $content_actions['edit']['href'] . '";'); } else { $tpl->set('body_ondblclick', false); } if ($this->iseditable && $wgUser->getOption('editsectiononrightclick')) { $tpl->set('body_onload', 'setupRightClickEdit()'); } else { $tpl->set('body_onload', false); } $tpl->set('sidebar', $this->buildSidebar()); $tpl->set('nav_urls', $this->buildNavUrls()); // execute template wfProfileIn("{$fname}-execute"); $res = $tpl->execute(); wfProfileOut("{$fname}-execute"); // result may be an error $this->printOrError($res); wfProfileOut($fname); }
function getTransactions($user) { // Database 4tw! global $DB; // Sanity! numericCheck($user, 0); // Grande Heading! $table = new table(6, true); $table->addHeader(">> Transaction log for <a href=\"index.php?action=edituser&id={$user}\">" . ucfirst(idToUsername($user)) . "</a> " . number_format(getCredits($user), 2) . " ISK"); // Table columns descriptors. $table->addRow("#060622"); $table->addCol("Date"); $table->addCol("Transaction ID"); $table->addCol("Banker"); $table->addCol("Type"); $table->addCol("Amount"); $table->addCol("Reason"); // ask the oracle. $transactions = $DB->getCol("SELECT COUNT(id) as count FROM transactions WHERE owner='" . $user . "' ORDER BY time DESC, id DESC"); $transactions_count = $transactions[0]; $transactions_pages = ceil($transactions_count / 20); // No transactions yet. if ($transactions_count < 1) { return false; } $currentPage = isset($_GET['walletPage']) ? $_GET['walletPage'] : 0; // Get the right amount of datasets from the dbase. if ($currentPage > 0 && is_numeric($currentPage)) { $min = 20 * $currentPage - 20; } else { $min = 0; } // Query the database accordingly $transactions = $DB->query("SELECT * FROM transactions WHERE owner='" . $user . "' ORDER BY time DESC, id DESC LIMIT {$min},20"); while ($transaction = $transactions->fetchRow()) { $table->addRow(); $table->addCol(date("d.m.y H:i:s", $transaction['time'])); $table->addCol(str_pad($transaction['id'], "6", "0", STR_PAD_LEFT)); $table->addCol(ucfirst(idToUsername($transaction['banker']))); switch ($transaction['type']) { case "0": $table->addCol("deposit"); break; case "1": $table->addCol("withdrawal"); break; } if ($transaction['amount'] > 0) { $table->addCol("<font color=\"#00ff00\">" . number_format($transaction['amount'], 2) . " ISK</font>"); } else { $table->addCol("<font color=\"#ff0000\">" . number_format($transaction['amount'], 2) . " ISK</font>"); } $table->addCol(strtolower($transaction['reason'])); } // Get the right next and previous pages. $currentPage = isset($_GET['walletPage']) ? $_GET['walletPage'] : 0; // if we have more than 1 page, show the navbar. if ($transactions_pages > 1) { // Handle first page: Static numbering. if ($currentPage < 1) { $next = 2; } else { // handle pages greater 2. Check if we have yet another page. if ($transactions_pages > $currentPage) { $next = $currentPage + 1; } // All pages above 2 have a previous page. $prev = $currentPage - 1; } $table->addRow("#060622"); // Show backlink, unless we are at page 1. if ($prev) { // We have a previous page (at page > 1) $table->addCol("<a href=\"index.php?action={$_GET['action']}&id={$_GET['id']}&walletPage={$prev}\">prev</a>", array("colspan" => 2)); } else { // No previos page (at page 1); $table->addCol(" ", array("colspan" => 2)); } // Show direct page links. if ($transactions_pages > 1) { for ($i = 1; $i <= $transactions_pages; $i++) { if ($currentPage == $i) { $text .= "[{$i}]"; } else { $text .= "[<a href=\"index.php?action={$_GET['action']}&id={$_GET['id']}&walletPage={$i}\">{$i}</a>]"; } } } $table->addCol($text, array("colspan" => 2, "align" => "center")); // Next link if ($currentPage < $transactions_pages) { // We have a next page. (at page < n) $table->addCol("<a href=\"index.php?action={$_GET['action']}&id={$_GET['id']}&walletPage={$next}\">next</a>", array("colspan" => 2, "align" => right)); } else { // This was the last page. (at page n) $table->addCol(" ", array("colspan" => 2)); } } $table->addHeader("If there are any problems with your transactions, contact your ceo immediatly."); return $table->flush(); }
function doAdd() { $data['status'] = 0; header("Content-type: text/html; charset=utf-8"); $mod = M('Exchange_order'); $gc = M('Exchange_qrcode'); //$huiyuaninfo = check_vip(wx_openid()); // $url = 'http://a.forcent.cn/ldh/store.php/Member/requestQrcode/' . $_REQUEST['url']; $qid = $_REQUEST['qid']; //二维码ID $data['info'] = $_REQUEST['qid']; //$where['uid'] = $_REQUEST['uid']; $orderinfo = $this->getOrderInfo(array('qid' => $qid, 'status' => 1)); $qrinfo = $gc->where('id=' . $qid)->find(); //查询二维码信息 $card_no = $orderinfo['card_no']; //会员卡号 $huiyuan_score = getCredits($card_no); //会员积分 //判断是否需要支付金额 if (!$orderinfo) { $data['info'] = '订单已失效'; $this->ajaxReturn($data); } $productInfo = M('Exchange_product')->where('id=' . $orderinfo['pid'])->find(); if ($productInfo['num'] >= $productInfo['total']) { $data['info'] = '库存不足'; $this->ajaxReturn($data); } else { if ($huiyuan_score >= $qrinfo['score']) { $state = $mod->where('id=' . $orderinfo['id'])->save(array('status' => 2, 'paytime' => $this->crtTime())); //更新订单状态 if ($state) { //减积分操作 $qty = deductCredits($card_no, $orderinfo['score']); if ($qty) { $scorelog['qid'] = $orderinfo['qid']; $scorelog['orderid'] = $orderinfo['id']; $scorelog['score'] = $orderinfo['score']; $scorelog['huiyuantel'] = $orderinfo['huiyuantel']; $scorelog['huiyuanopenid'] = $orderinfo['openid']; $scorelog['ctime'] = $this->crtTime(); M('Score_scorelog')->add($scorelog); //$sql = M('Exchange_qrcode')->getLastSql(); // file_put_contents("./ljhasdkjahsdkjasd.txt", var_export($sql, true)); } //更新二维码状态 $udata['status'] = 2; $udata['utime'] = $this->crtTime(); M('Exchange_qrcode')->where('id=' . $_REQUEST['qid'])->save($udata); //更新库存 $parr['num'] = $productInfo['num'] + 1; M('Exchange_product')->where('id=' . $orderinfo['pid'])->save($parr); $data['status'] = 1; $this->ajaxReturn($data); } else { $data['info'] = '付款失败'; $this->ajaxReturn($data); } } else { $data['info'] = '积分不足'; $this->ajaxReturn($data); } } }
function credits() { global $wgMaxCredits; if (!$wgMaxCredits) { return ''; } if ($this->isCurrentArticleView()) { require_once "Credits.php"; global $wgArticle, $wgShowCreditsIfMax; $credits = getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax); } else { $credits = ''; } return cbt_value($credits, 'view dynamic'); }
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; }
public function __construct() { // Construct a different html for ingame and the out-of-game browser. global $IGB; global $VERSION; global $MySelf; global $TIDY_ENABLE; global $width; global $URL; global $IGB_VISUAL; // Enable tidy, if we want to. $this->useTidy = $TIDY_ENABLE; // In case we are not logged in, or the object does not exist yet. if (!is_object($MySelf)) { $MySelf = new user(false, false); } if ($IGB && $IGB_VISUAL) { // Use IGB, set header and footer. $this->isIGB = true; // $this->header = file_get_contents('./include/ingame/igb-header.txt'); $this->header = file_get_contents('./include/ingame/igb-header.php'); if ($MySelf->isValid()) { $this->header .= makeMenu(); $this->header = str_replace("%%RANK%%", $MySelf->getRankName(), $this->header); $this->header = str_replace("%%CREDITS%%", number_format(getCredits($MySelf->getID()), 2) . " ISK", $this->header); $this->header = str_replace("%%USERNAME%%", ucfirst($MySelf->getUsername()), $this->header); } $this->header = str_replace("%%SITENAME%%", getConfig("sitename"), $this->header); // $this->footer = file_get_contents('./include/ingame/igb-footer.txt'); $this->footer = file_get_contents('./include/ingame/igb-footer.php'); $this->footer = str_replace("%%VERSION%%", $VERSION, $this->footer); } else { // Use normal browser. $this->isIGB = false; if ($MySelf->isValid() == 1) { // $this->header = file_get_contents('./include/html/header.txt'); $this->header = file_get_contents('./include/html/header.php'); } else { // $this->header = file_get_contents('./include/html/header-notloggedin.txt'); $this->header = file_get_contents('./include/html/header-notloggedin.php'); } // $this->footer = file_get_contents('./include/html/footer.txt'); $domainroot = $_SERVER['HTTP_HOST']; // Add page footer // use proper footer for sponcered sites. if ($domainroot == "miningbuddy.us" or $domainroot == "miningbuddy.de" or $domainroot == "miningbuddy.net") { $this->footer = file_get_contents('./include/html/mbh-footer.php'); } else { $this->footer = file_get_contents('./include/html/footer.php'); } // Generate the images. $mainLogo = new graphic("title"); $mainLogo->setText(getConfig("sitename")); $mainLogo->setBGColor("2D2D37"); // this is here to retain some code. Image caching seemed to be pretty useless. $imageCaching = false; if ($imageCaching) { $loginLogo = new graphic("standard"); $loginLogo->setText(ucfirst($MySelf->getUsername())); $loginLogo->setBGColor("2D2D37"); $loginLogo->setPrefixed(false); $versionLogo = new graphic("long"); $versionLogo->setText($VERSION); $versionLogo->setBGColor("2D2D37"); $versionLogo->setPrefixed(false); $rankLogo = new graphic("standard"); $rankLogo->setText($MySelf->getRankName()); $rankLogo->setBGColor("2D2D37"); $rankLogo->setPrefixed(false); $moneyLogo = new graphic("standard"); $moneyLogo->setText(number_format(getCredits($MySelf->getID()), 2) . " ISK"); $moneyLogo->setDirect(true); $moneyLogo->setBGColor("2D2D37"); $moneyLogo->setPrefixed(false); } // Replace variables in the header. $this->header = str_replace("%%SITENAME%%", getConfig("sitename") . " - " . $VERSION, $this->header); $this->header = makeMenu($this->header); $thisCharacterID = ""; if ($MySelf->isValid()) { $api = new api($MySelf->getID()); $thisCharacterID = $api->getCharacterID(); } if ($thisCharacterID == "") { $this->header = str_replace("%%PILOT64%%", "", $this->header); } else { $this->header = str_replace("%%PILOT64%%", "<img width='64' height='64' align='left' src='https://image.eveonline.com/Character/" . $api->getCharacterID() . "_64.jpg' />", $this->header); } $this->header = str_replace("%%LOGO%%", $mainLogo->render(), $this->header); if ($imageCaching) { $this->header = str_replace("%%LOGGEDIN%%", $loginLogo->render(), $this->header); // $this->header = str_replace("%%RANK%%", $rankLogo->render(), $this->header); $this->header = str_replace("%%CREDITS%%", $moneyLogo->render(), $this->header); $this->footer = str_replace("%%IMG%%", $versionLogo->render(), $this->footer); } else { $this->header = str_replace("%%LOGGEDIN%%", " " . ucfirst($MySelf->getUsername()), $this->header); $this->header = str_replace("%%RANK%%", " " . $MySelf->getRankName(), $this->header); $this->header = str_replace("%%CREDITS%%", " " . number_format(getCredits($MySelf->getID()), 2) . " ISK", $this->header); $this->footer = str_replace("%%IMG%%", $VERSION, $this->footer); } $this->header = str_replace("%%USERNAME%%", ucfirst($MySelf->getUsername()), $this->header); $this->header = str_replace("%%URL%%", $URL, $this->header); } $this->header = str_replace("%%VERSION%%", $VERSION, $this->header); $this->header .= "<!--header ends here-->"; $this->footer = "<!--footer starts here-->" . $this->footer; }
function lotto_buyTickets() { // Set some needed variables. global $DB; global $MySelf; $ID = $MySelf->getID(); $myMoney = getCredits($ID); $affordable = floor($myMoney / 1000000); if (!getConfig("lotto")) { makeNotice("Your CEO disabled the Lotto module, request denied.", "warning", "Lotto Module Offline"); } // Get my credits $MyStuff = $DB->getRow("SELECT lottoCredit, lottoCreditsSpent FROM users WHERE id='" . $MySelf->getID() . "'"); $Credits = $MyStuff[lottoCredit]; $CreditsSpent = $MyStuff[lottoCreditsSpent]; // User submited this form already! if ($_POST[check]) { numericCheck($_POST[amount], 0, $affordable); if ($_POST[amount] == 0) { makeNotice("You cannot buy zero tickets.", "warning", "Too few tickets.", "index.php?action=lotto", "[whoops]"); } confirm("Please authorize the transaction of " . number_format($_POST[amount] * 1000000, 2) . " ISK in order to buy {$_POST['amount']} lotto credits."); // Get the old ticket count, and add the new tickets on top of those. $oldCount = $DB->getCol("SELECT lottoCredit FROM users WHERE id='{$ID}' LIMIT 1"); $newcount = $oldCount[0] + $_POST[amount]; // Update the database to reflect the new ticket count. $check = $DB->query("UPDATE users SET lottoCredit='{$newcount}' WHERE id='{$ID}' LIMIT 1"); // Check that we were successful. if ($DB->affectedRows() != 1) { makeNotice("I was unable to add {$newcount} tickets to {$user} stack of {$count} tickets! Danger will robonson, danger!", "error", "Unable to comply."); } // Make him pay! global $TIMEMARK; $transaction = new transaction($ID, 1, $_POST[amount] * 1000000); $transaction->setReason("lotto credits bought"); if ($transaction->commit()) { // all worked out! makeNotice("Your account has been charged the amount of " . number_format($_POST[amount] * 1000000, 2) . " ISK.", "notice", "Credits bought", "index.php?action=lotto", "[OK]"); } else { // We were not successfull makeNotice("I was unable to add {$newcount} tickets to {$user} stack of {$count} tickets! Danger will robonson, danger!", "error", "Unable to comply."); } } // Prepare the drop-down menu. if ($affordable >= 1) { $ddm = "<select name=\"amount\">"; for ($i = 1; $i <= $affordable; $i++) { if ($i == 1) { $ddm .= "<option value=\"{$i}\">Buy {$i} tickets</option>"; } else { $ddm .= "<option value=\"{$i}\">Buy {$i} tickets</option>"; } } $ddm .= "</select>"; } else { // Poor user. $ddm = "You can not afford any credits."; } // Create the table. $table = new table(2, true); $table->addHeader(">> Buy lotto credits"); $table->addRow(); $table->addCol("Here you can buy lotto tickets for 1.000.000,00 ISK each. " . "Your account currently holds " . number_format($myMoney, 2) . " ISK, so " . "you can afford {$affordable} tickets. Please choose the amount of credits you wish " . "to buy.", array("colspan" => 2)); $table->addRow(); $table->addCol("Your credits:"); $table->addCol($Credits); $table->addRow(); $table->addCol("Total spent credits:"); $table->addCol($CreditsSpent); $table->addRow(); $table->addCol("Purchase this many credits:"); $table->addCol($ddm); $table->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Buy credits\">"); $table->addRow("#060622"); $table->addCol("[<a href=\"index.php?action=lotto\">Cancel request</a>]", array("colspan" => 2)); // Add some more html form stuff. $html = "<h2>Buy Lotto credits</h2>"; $html .= "<form action=\"index.php\" method=\"POST\">"; $html .= $table->flush(); $html .= "<input type=\"hidden\" name=\"check\" value=\"true\">"; $html .= "<input type=\"hidden\" name=\"action\" value=\"lottoBuyCredits\">"; $html .= "</form>"; // Return the mess we made. return $html; }
function pageStats() { global $wgOut, $wgLang, $wgArticle, $wgRequest, $wgUser; global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax, $wgTitle, $wgPageShowWatchingUsers; extract($wgRequest->getValues('oldid', 'diff')); if (!$wgOut->isArticle()) { return ''; } if (isset($oldid) || isset($diff)) { return ''; } if (0 == $wgArticle->getID()) { return ''; } $s = ''; if (!$wgDisableCounters) { $count = $wgLang->formatNum($wgArticle->getCount()); if ($count) { $s = wfMsg('viewcount', $count); } } if (isset($wgMaxCredits) && $wgMaxCredits != 0) { require_once 'Credits.php'; $s .= ' ' . getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax); } else { $s .= $this->lastModified(); } if ($wgPageShowWatchingUsers && $wgUser->getOption('shownumberswatching')) { $dbr =& wfGetDB(DB_SLAVE); extract($dbr->tableNames('watchlist')); $sql = "SELECT COUNT(*) AS n FROM {$watchlist}\n\t\t\t\tWHERE wl_title='" . $dbr->strencode($wgTitle->getDBKey()) . "' AND wl_namespace=" . $wgTitle->getNamespace(); $res = $dbr->query($sql, 'Skin::pageStats'); $x = $dbr->fetchObject($res); $s .= ' ' . wfMsg('number_of_watching_users_pageview', $x->n); } return $s . ' ' . $this->getCopyright(); }
/** * 兑换 * */ function exchange() { $json['status'] = 0; $tid = $_REQUEST['tid']; $openid = $_REQUEST['openid']; $gc = M('jiyuedu_order'); $huiyuan = check_vip($openid); $score = getCredits($huiyuan['card_no']); if (1 == $tid && $score < 100) { $json['status'] = 0; $json['info'] = "积分不足"; echo json_encode($json); exit; } $arr = array('tid' => $tid, 'tel' => $huiyuan['huiyuan_tel'], 'name' => $huiyuan['huiyuan_name'], 'openid' => $openid, 'ctime' => getSysTime()); $state = $gc->add($arr); if ($state) { if ($tid == 1) { deductCredits($huiyuan['card_no'], 100); //扣除积分 $scorearr = array('qid' => '00001', 'orderid' => $state, 'score' => 100, 'huiyuanopenid' => $openid, 'huiyuantel' => $huiyuan['huiyuan_tel'], 'ctime' => getSysTime()); M('score_scorelog')->add($scorearr); //记录扣除积分日志 } $person_m = M('jiyuedu_person'); if ($tid == 2) { $person_m->where(array('openid' => $openid))->save(array('num' => 0)); //清空阅读数 //TODO } $json['status'] = 1; $json['key'] = $state; $json['info'] = "兑换成功"; } else { $json['info'] = "兑换失败"; } echo json_encode($json); }
function makeEmailReceipt($runid, $array) { // Set variables. global $DB; global $DBORE; global $ORENAMES; global $MB_EMAIL; //Edit Starts Here global $DBSHIP; global $SHIPNAMES; //Edit Ends Here global $VERSION; global $URL; // Load the run $RUN = $DB->query("SELECT * FROM runs WHERE id='{$runid}' LIMIT 2"); if ($RUN->numRows() != 1) { // This run does not exist! return; } else { $RUN = $RUN->fetchRow(); } // Load the ore values $oreValues = $DB->query("SELECT * FROM orevalues WHERE id='" . $RUN[oreGlue] . "' LIMIT 1"); $oreValues = $oreValues->fetchRow(); //Edit Starts Here // Load the ship values $shipValues = $DB->query("SELECT * FROM shipvalues WHERE id='" . $RUN[shipGlue] . "' LIMIT 1"); $shipValues = $shipValues->fetchRow(); //Edit Ends Here // Get total number of people who joined. $totalPeople = $DB->getCol("SELECT count(DISTINCT userid) FROM joinups WHERE run='{$runid}'"); $totalPeople = $totalPeople[0]; /* * Taxes, net value etc */ $grossValue = getTotalWorth($runid); $corpTax = $DB->getCol("SELECT corpkeeps FROM runs WHERE id='{$runid}' LIMIT 1"); $corpTax = $corpTax[0]; $taxes = $grossValue * $corpTax / 100; $netValue = $grossValue - $taxes; $myShareGross = $grossValue / $totalPeople; // No ores mined. Bye-bye. if ($grossValue < 1) { return; } /* * Get the longest name of the ores. */ foreach ($ORENAMES as $howlong) { $length = strlen($howlong); if ($length > $winner) { $winner = $length; } } /* * Get all the ores. */ foreach ($DBORE as $ORE) { if ($RUN[$ORE] > 0) { $oreType = str_pad(array_search($ORE, $DBORE), $winner, " "); $oreAmount = str_pad(number_format($RUN[$ORE]), 11, " "); $ppu = $oreValues[$ORE . "Worth"]; $oreValue = str_pad(number_format($ppu) . " ISK", 11, " "); $remainder = 70 - (strlen($oreType) + strlen($oreAmount) + strlen($oreValue)); $oreTotalValue = str_pad(number_format($ppu * $RUN[$ORE]) . " ISK", $remainder, " ", STR_PAD_LEFT); $l1 = strlen($oreAmount); $l1 = strlen($oreValue); $l1 = strlen($oreTotalValue); if ($OreLine) { $OreLine .= "\n"; } $OreLine .= $oreType . $oreAmount . $oreValue . $oreTotalValue; } } /* * Replace the placeholders */ $email = new email("receipt"); $temp = $email->getTemplate(); $temp = str_replace("{{ID}}", str_pad($runid, 5, "0", STR_PAD_LEFT), $temp); $temp = str_replace("{{ORESMINED}}", $OreLine, $temp); $temp = str_replace("{{VALUE}}", number_format($grossValue) . " ISK", $temp); $temp = str_replace("{{CORPTAXES}}", number_format($taxes) . " ISK", $temp); $temp = str_replace("{{NETVALUE}}", number_format($netValue) . " ISK", $temp); $temp = str_replace("{{GROSSSHARE}}", number_format($myShareGross) . " ISK", $temp); $template = $temp; /* * This ends the part thats generic for everyone. Now the personalized stuff. */ $Atendees = $DB->query("SELECT DISTINCT userid FROM joinups WHERE run='{$runid}'"); while ($atendee = $Atendees->fetchRow()) { // Reset the email back to the template. $temp = $template; /* * PROBLEM * * Template is changed in email class, further modding in this loop * would require rewrite of either email class or this function. * */ die("PROBLEM"); // Do some personalized stuff. $pilot = idToUsername($atendee[userid]); $temp = str_replace("{{USERNAME}}", ucfirst($pilot), $temp); $temp = str_replace("{{ACCOUNTBALANCE}}", str_pad("BALANCE: " . number_format(getCredits($atendee[userid])), 66, " ", STR_PAD_LEFT) . " ISK", $temp); $myShare = $array[$atendee[userid]]; $temp = str_replace("{{NETSHARE}}", number_format($myShare) . " ISK", $temp); /* * transactions */ $transactions = $DB->query("SELECT * FROM transactions WHERE owner ='{$atendee['userid']}' ORDER BY id DESC LIMIT 10"); if ($transactions->numRows() > 0) { while ($trans = $transactions->fetchRow()) { // time type amount reason $transLine .= date("m.d.y h:i:", $trans[time]); if ($trans[type]) { $transLine .= " [W]"; } else { $transLine .= " [D]"; } $transLine .= " \"" . substr($trans[reason], 0, 33) . "\""; $length = strlen($transLine); $remainder = 70 - $length; $transLine .= str_pad(number_format($trans[amount]) . " ISK", $remainder, " ", STR_PAD_LEFT); // Add the line to the block. if ($transBlock) { $transBlock .= "\n"; } $transBlock .= $transLine; unset($transLine); } } else { $transLine = "No recent transactions."; } $temp = str_replace("{{ACCOUNT}}", $transBlock, $temp); // Mail, if opt-in. $userInfo = $DB->query("SELECT username, id, optIn, email FROM users WHERE id='" . $atendee[userid] . "' AND deleted='0'"); $userInfo = $userInfo->fetchRow(); if ($userInfo[email] && $userInfo[optIn]) { $to = $userInfo[email]; $subject = "MiningBuddy Payout"; $message = $email; $DOMAIN = $_SERVER['HTTP_HOST']; $headers = "From:" . $MB_EMAIL; mail($to, $subject, $message, $headers); } } }
function doAdd1() { $data['status'] = 0; header("Content-type: text/html; charset=utf-8"); $mod = M('Score_order'); $gc = M('Score_qrcode'); $huiyuaninfo = check_vip(wx_openid()); $qrdata = $gc->where('id=' . $_REQUEST['qid'])->find(); //二维码状态 if (2 == $qrdata['status']) { if ($huiyuaninfo['open_id'] == $qrdata['openid']) { $data['info'] = '已支付'; $this->ajaxReturn($data); } else { $data['info'] = '订单已失效'; $this->ajaxReturn($data); } } else { $where['qid'] = $_REQUEST['qid']; $where['uid'] = $_REQUEST['uid']; $where['status'] = 1; $card_no = $huiyuaninfo['card_no']; //会员卡号 $huiyuan_score = getCredits($card_no); //$data['info'] = $_REQUEST['score']; // $this->ajaxReturn($data);exit; if ($huiyuan_score >= $_REQUEST['score']) { $state = $mod->where($where)->save(array('status' => 2, 'paytime' => $this->crtTime())); //更新订单状态 if ($state) { //减积分操作 $qty = deductCredits($card_no, $_REQUEST['score']); if ($qty) { $scorelog['huiyuanid'] = $huiyuaninfo['huiyuan_id']; $scorelog['score'] = $_REQUEST['score']; $scorelog['huiyuantel'] = $huiyuaninfo['huiyuan_tel']; $scorelog['huiyuanopenid'] = $huiyuaninfo['open_id']; $scorelog['ctime'] = $this->crtTime(); M('Score_scorelog')->add($scorelog); //$sql = M('Score_qrcode')->getLastSql(); // file_put_contents("./ljhasdkjahsdkjasd.txt", var_export($sql, true)); } //更新二维码状态 $udata['status'] = 2; $udata['utime'] = $this->crtTime(); M('Score_qrcode')->where('id=' . $_REQUEST['qid'])->save($udata); $data['status'] = 1; $this->ajaxReturn($data); } else { $data['info'] = '付款失败'; $this->ajaxReturn($data); } } else { $data['info'] = '积分不足'; $this->ajaxReturn($data); } } }