function _dependency($pool) { if (!empty($pool['dependency_pool_id'])) { if (!array_key_exists('DependencyPool', $pool)) { trigger_error('Missing dependency information', E_USER_ERROR); } if ($pool['DependencyPool']['type'] == 'crossover') { return ($pool['dependency_id'] == 1 ? 'winner' : 'loser') . ' of ' . $pool['DependencyPool']['name']; } else { return ordinal($pool['dependency_id']) . ' in pool ' . $pool['DependencyPool']['name']; } } else { if (!empty($pool['dependency_ordinal'])) { return ordinal($pool['dependency_id']) . ' among ' . ordinal($pool['dependency_ordinal']) . ' place teams'; } else { return sprintf(__('%s seed', true), ordinal($pool['dependency_id'])); } } }
$username = "******"; $dbname = "w_menu"; $conn = new PDO("mysql:host={$dbserver};dbname={$dbname}", $username, $password); $conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $conn->prepare('SELECT * FROM allGroupUsers;'); $stmt->execute(); $result = $stmt->fetchAll(); $temp_user_array = []; $temp_group_array = []; $final_array = []; $i = 0; foreach ($result as $row) { if ($row['user'] == NULL) { $i++; $temp = array('place' => ordinal($i), 'group' => $row['groupName'], 'user' => '', 'total' => $row['total']); array_push($temp_group_array, $temp); } else { $temp1 = array('place' => '', 'group' => $row['groupName'], 'user' => $row['user'], 'total' => $row['total']); array_push($temp_user_array, $temp1); } } asort($temp_user_array); asort($temp_group_array); foreach ($temp_group_array as $tg) { array_push($final_array, $tg); foreach ($temp_user_array as $tu) { if ($tu['group'] == $tg['group']) { $temp = array('place' => '', 'group' => '', 'user' => $tu['user'], 'total' => $tu['total']); array_push($final_array, $temp); }
case 5: # friday $style_wd = ' style="border-bottom:1px solid #aaa;"'; break; case 0: # sunday $style_wd = ' style="border-bottom:1px solid #666;"'; break; default: $style_wd = ''; } echo '<tr class="', $is_weekend ? 'even' : 'odd', '">', "\n"; # day # echo '<td class="r"', $style_wd, '>'; echo ordinal($day, $lang_2, true); echo '</td>', "\n"; # inbound calls # $num_entered = (int) @$CDR_DB->executeGetOne('SELECT COUNT(DISTINCT(`ast_call_id`)) FROM `queue_log` WHERE `queue_id`=' . $queue_id . ' AND `event`=\'_ENTER\' AND ' . $sql_time); echo '<td class="r"', $style_wd, '>', $num_entered, '</td>', "\n"; $totals['num_entered'] += $num_entered; # connected to an agent # $num_connected = (int) @$CDR_DB->executeGetOne('SELECT COUNT(*) FROM `queue_log` WHERE `queue_id`=' . $queue_id . ' AND `event`=\'_CONNECT\' AND ' . $sql_time);
if ($camp->action == 3) { /* * When new content is added */ _e('Scheduled to post when new content is added:<br/>', 'sola'); if ($type == 1) { _e('Daily at ' . $time, 'sola'); } else { if ($type == 2) { _e('Weekly on ' . $day . ' at ' . $time, 'sola'); } else { if ($type == 3) { /* * fix 1st 2nd 3rd */ _e('Monthly on the ' . $daynum . ordinal($daynum) . ' at ' . $time, 'sola'); } else { if ($type == 4) { /* * Do nothing for this type */ } else { if ($type == 5) { _e('Immediately', 'sola'); } } } } } } else { if ($camp->action == 4) {
$stmt = $db->query("SELECT * FROM users WHERE id={$uid}"); return $stmt->fetchAll(PDO::FETCH_ASSOC); } include $_SERVER['DOCUMENT_ROOT'] . "/pdc.php"; $stmt = $db->query('SELECT * FROM user_stats WHERE stat_id=14 AND value > 100 ORDER BY value DESC'); $results = $stmt->fetchAll(PDO::FETCH_ASSOC); $j = count($results); ?> <div class="row"> <div class="col-md-2"></div> <div class="col-md-8 table-responsive"> <h1>Flashcard Rankings</h1> <p>Increase your rank by answering more flashcards correctly.</p> <table class="table table-striped table-hover"> <?php echo ($_GET['player'] != $_SESSION['username'] ? "<a href='http://www.JPVocab.com/player.php?player=" . $_GET['player'] . "&report=summary'>" . $_GET['player'] . '</a> is ' : 'You are ') . 'ranked <b>' . ordinal($ranktfca) . '</b>'; ?> <tr> <th class="text-center">Rank</th> <th>User</th> <th class="text-center">#</th> </tr><?php $n = $ranktfca - 4 <= 0 ? 0 : $ranktfca - 4; $j = $n + 5; for ($n; $n < $j; $n++) { try { $user = getUN($results[$n]['user_id'], $db); } catch (PDOException $ex) { //echo "Username error <br />"; } if ($results[$n + 1]['value'] == $results[$n]['value']) {
function datetimeToText($datetime = "", $includeTime = false) { $unixdatetime = strtotime($datetime); $day = ordinal(strftime("%d", $unixdatetime)); if (!$includeTime) { return stripZerosFromDate(strftime("%B *{$day}, %Y", $unixdatetime)); } return stripZerosFromDate(strftime("%B *{$day}, %Y at *%I:%M %p", $unixdatetime)); }
private function render_option($sv, $o) { global $Conf; if ($o) { $id = $o->id; } else { $o = PaperOption::make(array("id" => $o, "name" => "(Enter new option)", "description" => "", "type" => "checkbox", "position" => count(PaperOption::nonfixed_option_list()) + 1, "display" => "default")); $id = "n"; } if ($sv->use_req() && isset($sv->req["optn{$id}"])) { $o = PaperOption::make(array("id" => $id, "name" => $sv->req["optn{$id}"], "description" => get($sv->req, "optd{$id}"), "type" => get($sv->req, "optvt{$id}", "checkbox"), "visibility" => get($sv->req, "optp{$id}", ""), "position" => get($sv->req, "optfp{$id}", 1), "display" => get($sv->req, "optdt{$id}"))); if ($o->has_selector()) { $o->selector = explode("\n", rtrim(defval($sv->req, "optv{$id}", ""))); } } echo "<table><tr><td><div class='f-contain'>\n", " <div class='f-i'>", "<div class='f-c'>", $sv->label("optn{$id}", $id === "n" ? "New option name" : "Option name"), "</div>", "<div class='f-e'>", Ht::entry("optn{$id}", $o->name, $sv->sjs("optn{$id}", array("placeholder" => "(Enter new option)", "size" => 50))), "</div>\n", " </div><div class='f-i'>", "<div class='f-c'>", $sv->label("optd{$id}", "Description"), "</div>", "<div class='f-e'>", Ht::textarea("optd{$id}", $o->description, array("rows" => 2, "cols" => 50, "id" => "optd{$id}")), "</div>\n", " </div></div></td>"; echo '<td style="padding-left:1em">'; if ($id !== "n" && ($examples = $o->example_searches())) { echo '<div class="f-i"><div class="f-c">Example ' . pluralx($examples, "search") . "</div>"; foreach ($examples as &$ex) { $ex = "<a href=\"" . hoturl("search", array("q" => $ex[0])) . "\">" . htmlspecialchars($ex[0]) . "</a>"; } echo '<div class="f-e">', join("<br/>", $examples), "</div></div>"; } echo "</td></tr>\n <tr><td colspan='2'><table id='foldoptvis{$id}' class='fold2c fold3o'><tr>"; echo "<td class='pad'><div class='f-i'><div class='f-c'>", $sv->label("optvt{$id}", "Type"), "</div><div class='f-e'>"; $optvt = $o->type; if ($optvt == "text" && $o->display_space > 3) { $optvt .= ":ds_" . $o->display_space; } if ($o->final) { $optvt .= ":final"; } $show_final = $Conf->collectFinalPapers(); foreach (PaperOption::nonfixed_option_list() as $ox) { $show_final = $show_final || $ox->final; } $otypes = array(); if ($show_final) { $otypes["xxx1"] = array("optgroup", "Options for submissions"); } $otypes["checkbox"] = "Checkbox"; $otypes["selector"] = "Selector"; $otypes["radio"] = "Radio buttons"; $otypes["numeric"] = "Numeric"; $otypes["text"] = "Text"; if ($o->type == "text" && $o->display_space > 3 && $o->display_space != 5) { $otypes[$optvt] = "Multiline text"; } else { $otypes["text:ds_5"] = "Multiline text"; } $otypes["pdf"] = "PDF"; $otypes["slides"] = "Slides"; $otypes["video"] = "Video"; $otypes["attachments"] = "Attachments"; if ($show_final) { $otypes["xxx2"] = array("optgroup", "Options for accepted papers"); $otypes["pdf:final"] = "Alternate final version"; $otypes["slides:final"] = "Final slides"; $otypes["video:final"] = "Final video"; $otypes["attachments:final"] = "Final attachments"; } echo Ht::select("optvt{$id}", $otypes, $optvt, array("onchange" => "do_option_type(this)", "id" => "optvt{$id}")), "</div></div></td>\n"; $Conf->footerScript("do_option_type(\$\$('optvt{$id}'),true)"); echo "<td class='fn2 pad'><div class='f-i'><div class='f-c'>", $sv->label("optp{$id}", "Visibility"), "</div><div class='f-e'>", Ht::select("optp{$id}", array("admin" => "Administrators only", "rev" => "Visible to PC and reviewers", "nonblind" => "Visible if authors are visible"), $o->visibility, array("id" => "optp{$id}")), "</div></div></td>\n"; echo "<td class='pad'><div class='f-i'><div class='f-c'>", $sv->label("optfp{$id}", "Form order"), "</div><div class='f-e'>"; $x = array(); // can't use "foreach (PaperOption::nonfixed_option_list())" because caller // uses cursor for ($n = 0; $n < count(PaperOption::nonfixed_option_list()); ++$n) { $x[$n + 1] = ordinal($n + 1); } if ($id === "n") { $x[$n + 1] = ordinal($n + 1); } else { $x["delete"] = "Delete option"; } echo Ht::select("optfp{$id}", $x, $o->position, array("id" => "optfp{$id}")), "</div></div></td>\n"; echo "<td class='pad fn3'><div class='f-i'><div class='f-c'>", $sv->label("optdt{$id}", "Display"), "</div><div class='f-e'>"; echo Ht::select("optdt{$id}", ["default" => "Default", "prominent" => "Prominent", "topics" => "With topics", "submission" => "Near submission"], $o->display_name(), array("id" => "optdt{$id}")), "</div></div></td>\n"; if (isset($otypes["pdf:final"])) { echo "<td class='pad fx2'><div class='f-i'><div class='f-c'> </div><div class='f-e hint' style='margin-top:0.7ex'>(Set by accepted authors during final version submission period)</div></div></td>\n"; } echo "</tr></table>"; $rows = 3; if (PaperOption::type_has_selector($optvt) && count($o->selector)) { $value = join("\n", $o->selector) . "\n"; $rows = max(count($o->selector), 3); } else { $value = ""; } echo "<div id='foldoptv{$id}' class='", PaperOption::type_has_selector($optvt) ? "foldo" : "foldc", "'><div class='fx'>", "<div class='hint' style='margin-top:1ex'>Enter choices one per line. The first choice will be the default.</div>", Ht::textarea("optv{$id}", $value, $sv->sjs("optv{$id}", array("rows" => $rows, "cols" => 50))), "</div></div>"; echo "</td></tr></table>\n"; }
function prepareVariables($variables, $userid = NULL) { if ($userid == NULL) { if (isset($_SESSION["userinfo"]["id"])) { $userid = $_SESSION["userinfo"]["id"]; } } if ($variables["id"]) { //i.e. only on update unset($this->fields["type"]); if ($variables["typeCheck"] == "TS" && isset($variables["repeating"]) && $variables["lastrepeat"]) { $variables["lastrepeat"] = NULL; $variables["firstrepeat"] = NULL; $variables["timesrepeated"] = NULL; if (isset($variables["completed"])) { $variables["completedChange"] = 0; } $this->resetRepeating($variables["id"]); } //end if } //end if if (isset($variables["thetype"])) { $variables["type"] = $variables["thetype"]; } if (!isset($variables["completed"])) { $variables["completeddate"] = NULL; } if ($variables["enddate"] == "") { $variables["enddate"] = NULL; $variables["endtime"] = NULL; } if ($variables["startdate"] == "") { $variables["startdate"] = NULL; $variables["starttime"] = NULL; } if (isset($variables["repeating"])) { $thename = "Every "; switch ($variables["repeattype"]) { case "Daily": if ($variables["repeatevery"] != 1) { $thename .= $variables["repeatevery"] . " days"; } else { $thename .= " day "; } $variables["repeatechlist"] = NULL; $variables["repeatontheday"] = NULL; $variables["repeatontheweek"] = NULL; break; case "Weekly": if ($variables["repeatevery"] != 1) { $thename .= $variables["repeatevery"] . " weeks on"; } else { $thename .= "week on"; } foreach (explode("::", $variables["eachlist"]) as $dayNum) { $tempday = $dayNum != 7 ? $dayNum + 1 : 1; $thename .= " " . nl_langinfo(constant("ABDAY_" . $tempday)) . ", "; } $thename = substr($thename, 0, strlen($thename) - 2); if (strpos($thename, ",") != false) { $thename = strrev(preg_replace("/,/", "dna ", strrev($thename), 1)); } $variables["repeateachlist"] = $variables["eachlist"]; $variables["repeatontheday"] = NULL; $variables["repeatontheweek"] = NULL; break; case "Monthly": if ($variables["repeatevery"] != 1) { $thename .= $variables["repeatevery"] . " months"; } else { $thename .= "month"; } $thename .= " on the"; if ($variables["monthlyWhat"] == 1) { foreach (explode("::", $variables["eachlist"]) as $dayNum) { $thename .= " " . ordinal($dayNum) . ", "; } $thename = substr($thename, 0, strlen($thename) - 2); if (strpos($thename, ",") != false) { $thename = strrev(preg_replace("/,/", "dna ", strrev($thename), 1)); } $variables["repeateachlist"] = $variables["eachlist"]; $variables["repeatontheday"] = NULL; $variables["repeatontheweek"] = NULL; } else { foreach ($this->weekArray as $key => $value) { if ($value == $variables["monthlyontheweek"]) { $thename .= " " . strtolower($key); } } foreach ($this->dayOfWeekArray as $key => $value) { if ($value == $variables["monthlyontheday"]) { $thename .= " " . $key; } } $variables["repeateachlist"] = NULL; $variables["repeatontheday"] = $variables["monthlyontheday"]; $variables["repeatontheweek"] = $variables["monthlyontheweek"]; } break; case "Yearly": if ($variables["repeatevery"] > 1) { $thename .= $variables["repeatevery"] . " years"; } else { $thename .= "year"; } $thename .= " in"; foreach (explode("::", $variables["eachlist"]) as $monthNum) { $thename .= " " . nl_langinfo(constant("MON_" . $monthNum)) . ", "; } $thename = substr($thename, 0, strlen($thename) - 2); if (strpos($thename, ",") != false) { $thename = strrev(preg_replace("/,/", "dna ", strrev($thename), 1)); } $variables["repeateachlist"] = $variables["eachlist"]; if (isset($variables["yearlyOnThe"])) { $thename .= " on the"; foreach ($this->weekArray as $key => $value) { if ($value == $variables["yearlyontheweek"]) { $thename .= " " . strtolower($key); } } foreach ($this->dayOfWeekArray as $key => $value) { if ($value == $variables["yearlyontheday"]) { $thename .= " " . $key; } } $variables["repeatontheday"] = $variables["yearlyontheday"]; $variables["repeatontheweek"] = $variables["yearlyontheweek"]; } else { $variables["repeatontheday"] = NULL; $variables["repeatontheweek"] = NULL; } //end if break; } switch ($variables["repeatend"]) { case "never": $variables["repeatuntil"] = NULL; $variables["repeattimes"] = NULL; break; case "after": $thename .= " for " . $variables["repeattimes"]; $variables["repeatuntil"] = NULL; break; case "on date": $thename .= " until " . $variables["repeatuntil"]; $variables["repeattimes"] = NULL; break; } $thename = trim($thename) . "."; $variables["repeatname"] = $thename; $variables["firstrepeat"] = dateToString(stringToDate($variables["firstrepeat"], "SQL")); $variables["lastrepeat"] = dateToString(stringToDate($variables["lastrepeat"], "SQL")); $variables["timesrepeated"] = NULL; } else { $variables["repeat"] = 0; $variables["repeatechlist"] = NULL; $variables["repeatontheday"] = NULL; $variables["repeatontheweek"] = NULL; $variables["repeatname"] = NULL; $variables["repeatuntil"] = NULL; $variables["repeattimes"] = NULL; $variables["firstrepeat"] = NULL; $variables["lastrepeat"] = NULL; $variables["timesrepeated"] = NULL; } //endif repeat if ($variables["assignedtoid"] != $variables["assignedtochange"]) { if ($variables["assignedtoid"] != "") { $variables["assignedbyid"] = getUuid($this->db, "tbld:afe6d297-b484-4f0b-57d4-1c39412e9dfb", $userid); } else { $variables["assignedbyid"] = ''; } } //endif return $variables; }
<?php if (module_config::c('ticket_allow_priority', 0)) { ?> <tr> <th class="width1"> <?php echo _l('Priority Support'); ?> </th> <td> <?php module_template::init_template('ticket_priority_support', '<em>New!</em> Need a <strong>fast</strong> reply? Priority support will place your ticket at the front of the support queue. <br/>Priority Support Cost: {COST}<br/>{CHECKBOX} <label for="do_priority">Yes, upgrade to <strong>priority support</strong> and move my ticket to position: {TICKET_POSITION}</label>', 'Displayed at the bottom of ticket support signup', 'code', array('cost' => 'Cost as defined by ticket_priority_code advanced setting', 'TICKET_POSITION' => 'displays the string (example) "1st out of 44"')); $template = module_template::get_template_by_key('ticket_priority_support'); $template->assign_values(array('cost' => dollar(module_config::c('ticket_priority_cost', 10), true, module_config::c('ticket_priority_currency', 1)), 'TICKET_POSITION' => _l('%s out of %s', ordinal(module_ticket::ticket_count('priority') + 1), $ticket['total_pending']), 'CHECKBOX' => '<input type="checkbox" name="do_priority" id="do_priority" value="1">')); echo $template->replace_content(); ?> </td> </tr> <?php } ?> <?php if (module_config::c('ticket_turn_around_days_show', 1)) { ?> <tr>
public function toString() { global $app; // lack of quoted attributes prevents weird double escaping errors $m = "<div class=bdp>"; foreach ($this->combos as $combo) { if ($combo->vendorName == 'Bookstore' && $combo->numItems != 1) { $bookstoreMulti = 'true'; } else { $bookstoreMulti = 'false'; } $vendorName = $combo->vendorName == 'Bookstore' ? 'the bookstore' : $combo->vendorName; $m .= "<p><span class=vendor data-bookstore={$bookstoreMulti}>"; $m .= "{$combo->numItems} book" . ($combo->numItems != 1 ? 's' : ''); $m .= " from {$vendorName}</span>"; if ($bookstoreMulti == 'false') { $url = $app->urlFor('redirect', array('url' => '', 'type' => 'bdp', 'vendor' => $combo->vendorName)) . $combo->url; $label = $combo->vendorName == 'Chegg' ? 'Rent' : 'Buy'; $m .= "<button data-url={$url}>{$label}</button></p>"; } else { $m .= "</span></p>"; foreach (array_values($combo->prices) as $i => $price) { $num = ordinal($i + 1); $url = $app->urlFor('redirect', array('url' => '', 'type' => 'bdp', 'vendor' => $price->vendorName)) . $price->url; $m .= "<p><span class=aBookstoreBook>{$num} Book</span>" . "<button data-url={$url}>Buy</button></p>"; } } } $m .= "</div>"; return $m; }
function get_grade_name($grade_id) { return ordinal($grade_id) . " " . "Grade"; }
<tr> <th> <?php echo _l('Status'); ?> </th> <td> <?php //echo print_select_box(module_ticket::get_statuses(),'status_id',$ticket['status_id'],'',true,false,true); $s = module_ticket::get_statuses(); echo $s[$ticket['status_id']]; if ($ticket['status_id'] == 2 || $ticket['status_id'] == 3 || $ticket['status_id'] == 5) { if (module_config::c('ticket_show_position', 1)) { echo ' '; echo _l('(%s out of %s tickets)', ordinal($ticket['position']), module_ticket::ticket_count('pending')); } } ?> </td> </tr> </tbody> </table> <?php $fieldset_data = array('heading' => array('title' => _l('Ticket Details'), 'type' => 'h3'), 'elements_before' => ob_get_clean()); echo module_form::generate_fieldset($fieldset_data); unset($fieldset_data); if (file_exists(dirname(__FILE__) . '/../inc/ticket_priority_sidebar.php')) { include dirname(__FILE__) . '/../inc/ticket_priority_sidebar.php';
$newDateMonth = date("M", strtotime($date)); $content = $_POST['nowcontent']; $CTA = $_POST['nowCTA']; ?> <?php function ordinal($number) { $ends = array('<span class="ord">th</span>', '<span class="ord">st</span>', '<span class="ord">nd</span>', '<span class="ord">rd</span>', '<span class="ord">th</span>', '<span class="ord">th</span>', '<span class="ord">th</span>', '<span class="ord">th</span>', '<span class="ord">th</span>', '<span class="ord">th</span>'); if ($number % 100 >= 11 && $number % 100 <= 13) { return $number . '<span class="ord">th</span>'; } else { return $number . $ends[$number % 10]; } } $newDateDayPrint = ordinal($newDateDay); ?> <div class="container"> <div class="date"> <?php echo $newDateDayPrint; ?> <?php echo htmlspecialchars($newDateMonth); ?> <br/> Right Now </div> <div class="now-content"> <?php
$notificationMessage = "For some reason, the reset email could not be sent.<br>Please try again later."; break; case "couldnotsetresetlink": $notificationMessage = "The email address specified for password reset does not have an account."; break; case "emailresetinvalid": $notificationMessage = "The email address specified for password reset didn't work.<br>Please try again."; break; case "resetemailblank": $notificationMessage = "The password reset form somehow got submitted without some essential information.<br>Please try filling it out again."; break; case "loginfailed": $notificationMessage = "We couldn't log you in because your email or password was incorrect.<br>"; $_SESSION['loginfailures'] += 1; if ($_SESSION['loginfailures'] < 10) { $notificationMessage .= "This is your <strong>" . ordinal($_SESSION['loginfailures']) . "</strong> failed attempt.<br>After 10 failures, you will not be able to log in for 1 hour.<br>Please try again."; } else { $_SESSION['loginlockouttime'] = time(); $notificationMessage .= "Since you failed to log in successfully 10 times, you may not try again for 1 hour."; } break; case "emaildoesnotexist": $notificationMessage = "The email address you entered doesn't have an account.<br>Would you like to <span class='clickable' onclick='ShowInfo(\"loginForm\")'>create an account</span>?"; break; case "emailinvalid": $notificationMessage = "The email address you entered didn't work.<br>Please try another."; break; case "resetlinkfailed": $notificationMessage = "The reset link used is not valid. Please make sure you have copied it correctly."; break; case "resetlinkinvalid":
<td class="text-right"><b>Total</b></td> <td><?php echo $sumcfc; ?> </td> </tr> <tr> <td colspan="2" class="text-center active"><h4>Ranking</h4></td> </tr><? if($ranktfca == 1){ $ranktfcaGlyph = '<abbr title="The King of flashcards!"><span class="glyphicon glyphicon-king" aria-hidden="true"></span></abbr>'; }else if($ranktfca == 2){ $ranktfcaGlyph = '<abbr title="This player is ranked #2 for Flashcards!"><span class="glyphicon glyphicon-knight" aria-hidden="true"></span></abbr>'; }else if($ranktfca == 3){ $ranktfcaGlyph = '<abbr title="This player is ranked #3 for Flashcards!"><span class="glyphicon glyphicon-bishop" aria-hidden="true"></span></abbr>'; }else{ $ranktfcaGlyph = '';}?> <tr > <td>Flashcard Rank</td> <td><a href='http://www.JPVocab.com/player.php?player=<?php echo $_GET['player']; ?> &report=flashcardrank'><?php echo ordinal($ranktfca) . " <span class='pull-right'>" . $ranktfcaGlyph . '</span>'; ?> </a></td> </tr> </table> </div> <div class="col-md-2"></div> </div><!-- end .row-->
output("None in the land are mightier than you!`n"); } if ($session['user']['referer']>0 && $session['user']['level']>=4 && $session['user']['refererawarded']<1){ $sql = "UPDATE accounts SET donation=donation+25 WHERE acctid={$session['user']['referer']}"; db_query($sql); $session['user']['refererawarded']=1; systemmail($session['user']['referer'],"`%One of your referrals advanced!`0","`%{$session['user']['name']}`# has advanced to level `^{$session['user']['level']}`#, and so you have earned `^25`# points!"); } increment_specialty(); addnav("Question Master","train.php?op=question"); addnav("Challenge Master","train.php?op=challenge"); if ($session['user']['superuser'] > 2) { addnav("Superuser Gain level","train.php?op=challenge&victory=1"); } addnav("Return to the Village","village.php"); addnews("`%".$session[user][name]."`3 has defeated ".($session[user][sex]?"her":"his")." master, `%$badguy[creaturename]`3 to advance to level `^".$session[user][level]."`3 on ".($session[user][sex]?"her":"his")." `^".ordinal($session[user][age])."`3 day!!"); $badguy=array(); $session[user][hitpoints] = $session[user][maxhitpoints]; //$session[user][seenmaster]=1; }else{ if($defeat){ //addnav("Daily news","news.php"); $sql = "SELECT taunt FROM taunts ORDER BY rand(".e_rand().") LIMIT 1"; $result = db_query($sql) or die(db_error(LINK)); $taunt = db_fetch_assoc($result); $taunt = str_replace("%s",($session[user][gender]?"him":"her"),$taunt[taunt]); $taunt = str_replace("%o",($session[user][gender]?"he":"she"),$taunt); $taunt = str_replace("%p",($session[user][gender]?"his":"her"),$taunt); $taunt = str_replace("%x",($session[user][weapon]),$taunt); $taunt = str_replace("%X",$badguy[creatureweapon],$taunt); $taunt = str_replace("%W",$badguy[creaturename],$taunt);
function _reseed($id) { $options = $valid_options = $pool_sizes = $ordinal_counts = $save = array(); list($type, $pools) = explode('_', $this->data['Game']['pools']); $stages = Set::extract('/Pool/stage', $this->division); if (!empty($stages)) { $last_stage = max($stages); } else { $last_stage = 0; } $this_stage = $last_stage + 1; // Check if the previous stage was crossovers $crossovers = Set::extract("/Pool[type=crossover][stage={$last_stage}]", $this->division); $crossover_names = Set::extract('/Pool/name', $crossovers); if (!empty($crossovers)) { $crossover_stage = $last_stage; --$last_stage; } else { $crossover_stage = 0; } // List of finishing options for each pool foreach ($this->division['Pool'] as $pool) { if ($pool['stage'] == $last_stage) { $group = "Pool {$pool['name']}"; $pool_sizes[] = count($pool['PoolsTeam']); for ($i = 1; $i <= count($pool['PoolsTeam']); ++$i) { $in_crossover = Set::extract("/Pool/PoolsTeam[dependency_pool_id={$pool['id']}][dependency_id={$i}]", $crossovers); if (empty($in_crossover)) { $key = "{$pool['name']}-{$i}"; $options[$group][$key] = ordinal($i) . " ({$key})"; if (!array_key_exists($i, $ordinal_counts)) { $ordinal_counts[$i] = 1; } else { ++$ordinal_counts[$i]; } } } if (!empty($options[$group])) { $valid_options = array_merge($valid_options, $options[$group]); } } } // List of finishing options between pools for ($ordinal = 1; $ordinal <= max($pool_sizes); ++$ordinal) { if (array_key_exists($ordinal, $ordinal_counts)) { $group = ordinal($ordinal) . ' ' . __('place teams', true); // List of finishing options for each pool for ($i = 1; $i <= $ordinal_counts[$ordinal]; ++$i) { $in_crossover = Set::extract("/Pool/PoolsTeam[dependency_ordinal={$ordinal}][dependency_id={$i}]", $crossovers); if (empty($in_crossover)) { $key = "{$ordinal}-{$i}"; $options[$group][$key] = ordinal($i) . " ({$key})"; } } $valid_options = array_merge($valid_options, $options[$group]); } } // Add any crossovers foreach ($crossovers as $crossover) { $options['Crossovers']["{$crossover['Pool']['name']}-1"] = "Winner of {$crossover['Pool']['name']}"; $options['Crossovers']["{$crossover['Pool']['name']}-2"] = "Loser of {$crossover['Pool']['name']}"; $valid_options = array_merge($valid_options, $options['Crossovers']); } // Validate any data posted to us, building the data to save as we go if ($this->data['Game']['step'] == 'reseed') { $proceed = true; // Check that no qualifier was chosen twice $qualifiers = $qualifier_type = array(); foreach ($this->data['Game']['name'] as $key => $name) { $qualifiers = array_merge($qualifiers, $this->data['Game'][$name]); $save[$key] = array('Pool' => array('division_id' => $id, 'name' => $name, 'stage' => $this_stage, 'type' => $type == 'crossover' ? 'crossover' : 'power'), 'PoolsTeam' => array()); foreach ($this->data['Game'][$name] as $qkey => $qualifier) { // Make sure that some weird option didn't get selected. if (!array_key_exists($qualifier, $valid_options)) { $this->Session->setFlash(sprintf(__('Invalid qualifier %s.', true), $qualifier), 'default', array('class' => 'info')); $proceed = false; break; } // Make sure that we haven't got both pool and ordinal types selected // for any particular "tier" in the pools. For example, A-1 can be used // with B-1, but not with 1-1. Crossovers can be used with either. list($pool, $pos) = explode('-', $qualifier); $numeric = is_numeric($pool); if (!in_array($pool, $crossover_names)) { if (array_key_exists($pos, $qualifier_type)) { if ($qualifier_type[$pos]['value'] != $numeric) { $this->Session->setFlash(sprintf(__('You have selected %s and %s, but you cannot mix "pool"-type options with "ordinal"-type options; both could end up being the same team.', true), $qualifier_type[$pos]['qualifier'], $qualifier), 'default', array('class' => 'info')); $proceed = false; break; } } else { $qualifier_type[$pos] = array('qualifier' => $qualifier, 'value' => $numeric); } } if ($numeric) { $save[$key]['PoolsTeam'][] = array('alias' => "{$name}{$qkey}", 'dependency_type' => 'ordinal', 'dependency_ordinal' => $pool, 'dependency_id' => $pos); } else { $pool_id = current(Set::extract("/Pool[name={$pool}]/id", $this->division)); $save[$key]['PoolsTeam'][] = array('alias' => "{$name}{$qkey}", 'dependency_type' => 'pool', 'dependency_pool_id' => $pool_id, 'dependency_id' => $pos); } } } if (array_sum($this->data['Game']['count']) != count($qualifiers) || in_array('', $qualifiers)) { $this->Session->setFlash(__('You must select a qualifier for each slot.', true), 'default', array('class' => 'info')); $proceed = false; } else { if (array_sum($this->data['Game']['count']) != count(array_unique($qualifiers))) { $this->Session->setFlash(__('You must select a unique qualifier for each slot.', true), 'default', array('class' => 'info')); $proceed = false; } } if ($proceed) { $this->_savePools($id, $save); } } $this->set(compact('type', 'options')); $this->render('reseed'); }
public function external_hook($hook) { switch ($hook) { case 'public': $faq_id = isset($_REQUEST['i']) ? (int) $_REQUEST['i'] : false; $hash = isset($_REQUEST['hash']) ? trim($_REQUEST['hash']) : false; if ($faq_id && $hash) { $correct_hash = $this->link_open_public($faq_id, true); if ($correct_hash == $hash) { $faq = array(); if ($faq_id > 0) { $faq = $this->get_faq($faq_id); } if ($faq) { $template = module_template::get_template_by_key('faq_item'); $faq['answer'] = self::html_faq($faq['answer']); $faq['faq_back'] = $this->link_open_public(-1) . (isset($_REQUEST['faq_product_id']) ? '&faq_product_id=' . (int) $_REQUEST['faq_product_id'] : ''); $template->assign_values($faq); $template->page_title = $faq['question']; echo $template->render('pretty_html'); } else { $template = module_template::get_template_by_key('faq_list'); $data = array(); ob_start(); include 'public/faq_listing.php'; $data['listing'] = ob_get_clean(); $template->assign_values($data); $template->page_title = _l('FAQ'); echo $template->render('pretty_html'); } } } break; case 'faq_list_json': @ob_end_clean(); header("Content-type: text/javascript"); $faq_id = isset($_REQUEST['faq_id']) ? (int) $_REQUEST['faq_id'] : false; if ($faq_id > 0) { $faq = $this->get_faq($faq_id); if ($faq) { $faq['url'] = module_faq::link_open_public($faq_id, false); echo json_encode($faq); /*$template = module_template::get_template_by_key('faq_item'); $faq['answer'] = forum_text($faq['answer']); $faq['faq_back'] = $this->link_open_public(-1).(isset($_REQUEST['faq_product_id']) ? '&faq_product_id='.(int)$_REQUEST['faq_product_id'] : ''); $template->assign_values($faq); $template->page_title = $faq['question']; echo $template->replace_content();*/ } exit; } $faq_product_id = isset($_REQUEST['faq_product_id']) ? (int) $_REQUEST['faq_product_id'] : false; $faq_search = isset($_REQUEST['faq_search']) ? $_REQUEST['faq_search'] : false; $faqs = $this->get_faqs(array('faq_product_id' => $faq_product_id, 'question' => $faq_search)); $faqs_json = array(); $all_products = module_faq::get_faq_products_rel(); foreach ($faqs as $faq) { $faq = module_faq::get_faq($faq['faq_id']); $faq_products = array(); foreach ($faq['faq_product_ids'] as $faq_product_id) { $faq_products[$faq_product_id] = $all_products[$faq_product_id]; } $faqs_json[$faq['faq_id']] = array('question' => $faq['question'], 'url' => module_faq::link_open_public($faq['faq_id'], false), 'products' => $faq_products); } echo json_encode($faqs_json); exit; break; case 'ticket_list': $faq_product_id = isset($_REQUEST['faq_product_id']) ? (int) $_REQUEST['faq_product_id'] : false; @ob_end_clean(); header("Content-type: text/javascript"); if ($faq_product_id) { $product = $this->get_faq_product($faq_product_id); // find the faq items that match this product id. if ($product && $product['faq_product_id'] == $faq_product_id) { $faqs = $this->get_faqs(array('faq_product_id' => $faq_product_id)); ob_start(); $x = 0; $half = ceil(count($faqs) / 2); ?> <tr> <th> <?php _e('FAQ'); ?> </th> <td> <?php _e('Please read through the below FAQ to see if the question has already been answered'); ?> </tr> <tr> <td colspan="2"> <table width="100%" class="tableclass tableclass_full table_faq_class"> <tbody> <tr> <td width="50%" valign="top"> <ul><?php for (true; $x < $half; $x++) { $data = array_shift($faqs); $faq = module_faq::get_faq($data['faq_id']); ?> <li> <a href="<?php echo module_faq::link_open_public($data['faq_id'], false); ?> " target="_blank"><?php echo htmlspecialchars($faq['question']); ?> </a> </li> <?php } ?> </ul> </td> <td width="50%" valign="top"> <ul><?php foreach ($faqs as $data) { $faq = module_faq::get_faq($data['faq_id']); ?> <li> <a href="<?php echo module_faq::link_open_public($data['faq_id'], false); ?> " target="_blank"><?php echo htmlspecialchars($faq['question']); ?> </a> </li> <?php } ?> </ul> </td> </tr> </tbody> </table> </td> </tr> <?php $html = preg_replace('#\\s+#', ' ', ob_get_clean()); ?> $('#faq_product_area').html('<?php echo addcslashes($html, "'"); ?> '); <?php if ($product['default_type_id']) { ?> $('#ticket_type_id').val(<?php echo (int) $product['default_type_id']; ?> ); <?php } // and now we have to set the ticket position. if (module_config::c('ticket_show_position', 1)) { $new_position = module_ticket::ticket_position(false, $faq_product_id); ?> $('#ticket_position_field').html('<?php echo addcslashes(_l('%s out of %s other support tickets', ordinal($new_position['current'] + 1), $new_position['total'] + 1), "'"); ?> '); <?php if (module_config::c('ticket_allow_priority', 0)) { $c = module_ticket::get_ticket_count($faq_product_id); ?> $('#priority_ticket_position').html('<?php _e('%s out of %s', ordinal($c['priority'] + 1), $new_position['total'] + 1); ?> '); <?php } } exit; } } ?> $('#faq_product_area').html(''); <?php if (module_config::c('ticket_show_position', 1)) { $new_position = module_ticket::ticket_position(); ?> $('#ticket_position_field').html('<?php echo addcslashes(_l('%s out of %s other support tickets', ordinal($new_position['current'] + 1), $new_position['total'] + 1), "'"); ?> '); <?php if (module_config::c('ticket_allow_priority', 0)) { ?> $('#priority_ticket_position').html('<?php _e('%s out of %s', ordinal(module_ticket::ticket_count('priority') + 1), $new_position['total'] + 1); ?> '); <?php } } break; } }
?> </div> <div class="senator_info"> <div class="ny_state_senator"><?php print t('New York State Senator'); ?> </div> <div class="senator_name"><?php print $senator_name; ?> </div> <div class="district"><?php if ($senator->field_position[0]['value']) { print $senator->field_position[0]['value'] . ', '; } print $party_affiliation_list . ' ' . ordinal($district->field_district_number[0]['value']); ?> <?php print t('Senate District'); ?> </div> </div> </div> <?php } ?> <?php if ($search_box) { ?> <div id="search-box">
} $stmt->closeCursor(); $n_den_trophies = read_raceinfo('n-den-trophies', 3); $n_pack_trophies = read_raceinfo('n-pack-trophies', 3); require_once 'inc/ordinals.inc'; $speed_trophies = top_finishers_by_class($n_den_trophies); foreach ($speed_trophies as $classid => $den_trophies) { for ($place = 0; $place < count($den_trophies); ++$place) { $racerid = $den_trophies[$place]; $racers[$racerid]['awards'][] = ordinal(1 + $place) . ' in ' . group_label_lc(); } } $pack_trophies = top_finishers_overall($n_pack_trophies); for ($place = 0; $place < count($pack_trophies); ++$place) { $racerid = $pack_trophies[$place]; $racers[$racerid]['awards'][] = ordinal(1 + $place) . ' in ' . supergroup_label_lc(); } $sql = 'SELECT awardname, racerid' . ' FROM Awards' . ' ORDER BY sort'; $stmt = $db->query($sql); foreach ($stmt as $rs) { $racerid = $rs['racerid']; if (isset($racers[$racerid])) { $racers[$racerid]['awards'][] = $rs['awardname']; } } // Awards table: // AwardID, AwardName, AwardTypeID, ClassID, RankID, RacerID, Sort // // AwardTypeID just maps to a string, AwardType, through AwardTypes string. ?> <div class="award_racers">
<span class="note"><?php echo ordinal($home_rank); ?> in Group <?php echo $home_group_name; ?> </span> </div> </td> <td> <divstyle="max-height: 4.5em;"> <br><span class="vk_gy">vs</span> </div> </td> <td class="r"> <div style="max-height: 4.5em;"> <h4><?php echo $awayteam_name; ?> </h4> <span class="note"><?php echo ordinal($away_rank); ?> in Group <?php echo $away_group_name; ?> </span> </div> </td> </tr>
mysql_query("INSERT INTO subtotal (ltcaddress, ip) VALUES('{$ltcaddress}', '{$ip}' ) ") or die(mysql_error()); $command = "SELECT * FROM dailyltc"; $q = mysql_query($command); $rows = mysql_num_rows($q); $entries_needed = 150; if ($rows > $entries_needed) { $command = "SELECT * FROM roundltc"; $q = mysql_query($command); $res = mysql_fetch_array($q); $list = mysql_query("SELECT * FROM dailyltc"); $coins_in_account = $btclient->getbalance("SendOut", 0); if ($coins_in_account >= $res['roundltc'] * $rows) { while ($listw = mysql_fetch_array($list)) { $btclient->sendfrom("SendOut", $listw['btcaddres'], $res['roundltc']); } $n = ordinal(mysql_num_rows($list)); echo srsnot("Congratulations, you were the {$n} in the round, the round has been reset and payouts have been sent."); mysql_query("TRUNCATE dailyltc"); mysql_query("UPDATE round set round=round+1"); $totalc = $res['roundltc'] * $rows; mysql_query("UPDATE dailytotal set total=total+{$totalc}"); echo "</center></div>"; include 'templates/sidebar.php'; include 'templates/footer.php'; die; } else { echo srserr("Uh oh, looks like we haven't got enough donations to pay out. The round will continue until there's enough to pay out."); echo "</center></div>"; include 'templates/sidebar.php'; include 'templates/footer.php'; die;
<?php require_once "SiteConfigVars.php"; $dbserver = getConfigValue("dbHost_w_menu"); $password = getConfigValue("dbPass_w_menu"); $username = "******"; $dbname = "w_menu"; $conn = new PDO("mysql:host={$dbserver};dbname={$dbname}", $username, $password); $conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $conn->prepare('SELECT * FROM allUsers;'); $stmt->execute(); $result = $stmt->fetchAll(); $i = 0; $user_array = []; foreach ($result as $row) { $i++; $temp_array = array('place' => ordinal($i), 'user' => $row['user'], 'total' => $row['total']); array_push($user_array, $temp_array); } $conn = null; echo json_encode($user_array); function ordinal($number) { $ends = array('th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th'); if ($number % 100 >= 11 && $number % 100 <= 13) { return $number . 'th'; } else { return $number . $ends[$number % 10]; } }
static function _readDependency(&$record, $pool, $type) { $ths = ClassRegistry::init('Game'); $id = $record["{$type}_dependency_id"]; switch ($record["{$type}_dependency_type"]) { case 'game_winner': $game = $ths->field('name', array('id' => $id)); $dependency = sprintf(__('Winner of game %s', true), $game); break; case 'game_loser': $game = $ths->field('name', array('id' => $id)); $dependency = sprintf(__('Loser of game %s', true), $game); break; case 'seed': $dependency = sprintf(__('%s seed', true), ordinal($id)); break; case 'pool': case 'copy': $dependency = Pool::_dependency($pool); $alias = $pool['alias']; if (!empty($alias)) { $dependency = "{$alias} [{$dependency}]"; } break; } $record["{$type}_dependency"] = $dependency; }
page_header("You have been slain!"); output("`\$You were slain in the " . $session['user']['killedin'] . " by `%" . $session['user']['slainby'] . "`\$. They cost you 5% of your experience, and took any gold you had. Don't you think it's time for some revenge?"); addnav("Continue", "newday.php?continue=1{$resline}"); $session['user']['slainby'] = ""; } else { page_header("It is a new day!"); $interestrate = e_rand($mininterest * 100, $maxinterest * 100) / (double) 100; output("`c<font size='+1'>`b`#It is a New Day!`0`b</font>`c", true); if ($session['user']['alive'] != true) { $session['user']['resurrections']++; output("`@You are resurrected! This is your " . ordinal($session['user']['resurrections']) . " resurrection.`0`n"); $session['user']['alive'] = true; } $session['user']['age']++; $session['user']['seenmaster'] = 0; output("You open your eyes to discover that a new day has been bestowed upon you, it is your `^" . ordinal($session['user']['age']) . "`0 day. "); output("You feel refreshed enough to take on the world!`n"); output("`2Turns for today set to `^{$turnsperday}`n"); if ($session['user']['turns'] > getsetting("fightsforinterest", 4) && $session['user']['goldinbank'] >= 0) { $interestrate = 1; output("`2Today's interest rate: `^0% (Bankers in this village only give interest to those who work for it)`n"); } else { output("`2Today's interest rate: `^" . ($interestrate - 1) * 100 . "% `n"); if ($session['user']['goldinbank'] >= 0) { output("`2Gold earned from interest: `^" . (int) ($session['user']['goldinbank'] * ($interestrate - 1)) . "`n"); } else { output("`2Interest Accrued on Debt: `^" . -(int) ($session['user']['goldinbank'] * ($interestrate - 1)) . "`2 gold.`n"); } } output("`2Hitpoints have been restored to `^" . $session['user']['maxhitpoints'] . "`n"); $skills = array(1 => "Dark Arts", "Mystical Powers", "Thievery");
output("None in the land are mightier than you!`n"); } if ($session['user']['referer'] > 0 && $session['user']['level'] >= 4 && $session['user']['refererawarded'] < 1) { $sql = "UPDATE accounts SET donation=donation+25 WHERE acctid={$session['user']['referer']}"; db_query($sql); $session['user']['refererawarded'] = 1; systemmail($session['user']['referer'], "`%One of your referrals advanced!`0", "`%{$session['user']['name']}`# has advanced to level `^{$session['user']['level']}`#, and so you have earned `^25`# points!"); } increment_specialty(); addnav("Question Master", "train.php?op=question"); addnav("Challenge Master", "train.php?op=challenge"); if ($session['user']['superuser'] > 2) { addnav("Superuser Gain level", "train.php?op=challenge&victory=1"); } addnav("Return to the Village", "village.php"); addnews("`%" . $session['user']['name'] . "`3 has defeated " . ($session['user']['sex'] ? "her" : "his") . " master, `%{$badguy['creaturename']}`3 to advance to level `^" . $session['user']['level'] . "`3 on " . ($session['user']['sex'] ? "her" : "his") . " `^" . ordinal($session['user']['age']) . "`3 day!!"); $badguy = array(); $session['user']['hitpoints'] = $session['user']['maxhitpoints']; //$session['user']['seenmaster']=1; } else { if ($defeat) { //addnav("Daily news","news.php"); $sql = "SELECT taunt FROM taunts ORDER BY rand(" . e_rand() . ") LIMIT 1"; $result = db_query($sql) or die(db_error(LINK)); $taunt = db_fetch_assoc($result); $taunt = str_replace("%s", $session['user']['gender'] ? "him" : "her", $taunt[taunt]); $taunt = str_replace("%o", $session['user']['gender'] ? "he" : "she", $taunt); $taunt = str_replace("%p", $session['user']['gender'] ? "his" : "her", $taunt); $taunt = str_replace("%x", $session['user']['weapon'], $taunt); $taunt = str_replace("%X", $badguy['creatureweapon'], $taunt); $taunt = str_replace("%W", $badguy['creaturename'], $taunt);
$responsive_summary[] = ordinal($ticket['position']); } $responsive_summary[] = htmlspecialchars($ticket['subject']); $fieldset_data = array('heading' => array('title' => _l('Ticket Details'), 'type' => 'h3', 'responsive' => array('summary' => implode(', ', $responsive_summary))), 'elements' => array(array('title' => _l('Ticket Number'), 'fields' => array(function () use($ticket) { ?> <span class="ticket_status_<?php echo (int) $ticket['status_id']; ?> "><?php echo module_ticket::ticket_number($ticket['ticket_id']); ?> </span> <?php if ($ticket['status_id'] == 2 || $ticket['status_id'] == 3 || $ticket['status_id'] == 5) { echo _l('(%s out of %s tickets)', ordinal($ticket['position']), $ticket['total_pending']); } ?> <input type="hidden" name="status_id" value="<?php echo $ticket['status_id']; ?> "> <?php })))); if ($ticket['last_message_timestamp']) { $fieldset_data['elements'][] = array('title' => _l('Date/Time'), 'fields' => array(function () use($ticket, $limit_time) { if ($ticket['last_message_timestamp'] < $limit_time) { echo '<span class="important">'; } echo print_date($ticket['last_message_timestamp'], true);
</option> <!--<option id="time-slot-monthly-on" value="3"><?php // _e('Monthly on the:', 'sola'); ?> </option>--> <option id="time-slot-immediately" value="5"><?php _e('Immediately', 'sola'); ?> </option> </select> <select id="sola-nl-monthly-day" style="display: none;" name="sola_nl_monthly_day"> <option value=""></option> <?php for ($i = 1; $i <= 28; $i++) { echo '<option value="' . $i . '">' . $i . ordinal($i) . '</option>'; } ?> </select> <select id="sola-nl-monthly-every" style="display: none;" name="sola_nl_month_every"> <option value=""></option> <option value="1"><?php _e('1st', 'sola'); ?> </option> <option value="2"><?php _e('2nd', 'sola'); ?> </option> <option value="3"><?php
?> Profile" title="<?php echo $user['username']; ?> Profile"><?php echo $user['username']; ?> </a></h4> <table class="table table-condensed borderless thin marg-bot-0"> <tr> <td class="col-xs-3"> <small><small><a href="http://www.JPVocab.com/player.php?player=<?php echo $user['username']; ?> &report=flashcardrank">Flashcard Ranking</a>: <?php echo ordinal(getUserFCardRank($user['id'])); ?> </small> </td> <td> <small>Currently Practicing <a href="<?php echo getDeckFullUrl(getSkill('cvset', $user['id'])); ?> "> <?php echo getDeckInfo(getSkill('cvset', $user['id']), 'display_name'); ?> </a></small> </td>
<?php require_once "SiteConfigVars.php"; $dbserver = getConfigValue("dbHost_w_menu"); $password = getConfigValue("dbPass_w_menu"); $username = "******"; $dbname = "w_menu"; $conn = new PDO("mysql:host={$dbserver};dbname={$dbname}", $username, $password); $conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $conn->prepare('SELECT * FROM allGroups;'); $stmt->execute(); $result = $stmt->fetchAll(); $i = 0; $user_array = []; foreach ($result as $row) { $i++; $temp_array = array('place' => ordinal($i), 'group' => $row['name'], 'total' => $row['total']); array_push($user_array, $temp_array); } $conn = null; echo json_encode($user_array); function ordinal($number) { $ends = array('th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th'); if ($number % 100 >= 11 && $number % 100 <= 13) { return $number . 'th'; } else { return $number . $ends[$number % 10]; } }