public function get_rows($start = 0) { // Get rows to display if (isset($_POST['search']) && $_POST['search'] != '') { $rows = DB::query("SELECT * FROM coin_addresses WHERE address LIKE %ss ORDER BY date_added DESC LIMIT {$start},{$this->rows_per_page}", $_POST['search']); } elseif ($this->userid > 0) { $rows = DB::query("SELECT * FROM coin_addresses WHERE userid = %d ORDER BY date_added DESC LIMIT {$start},{$this->rows_per_page}"); } else { $rows = DB::query("SELECT * FROM coin_addresses ORDER BY date_added DESC LIMIT {$start},{$this->rows_per_page}"); } // Go through rows $results = array(); foreach ($rows as $row) { // Get balance $balance = DB::queryFirstField("SELECT sum(amount) FROM coin_inputs WHERE is_spent = 0 AND address = %s", $row['address']); $row['balance'] = fmoney_coin($balance); // Set variables $row['checkbox'] = "<center><input type=\"checkbox\" name=\"input_id[]\" value=\"{$row['id']}\"></center>"; $row['address'] = "<a href=\"" . SITE_URI . "/admin/financial/addresses_view?address={$row['address']}\">{$row['address']}</a>"; $row['date_added'] = fdate($row['date_added'], true); $row['received'] = fmoney_coin($row['total_input']); array_push($results, $row); } // Return return $results; }
public function get_rows($start = 0) { // Initialize global $template; // Get rows to display if ($this->userid > 0) { $rows = DB::query("SELECT * FROM orders WHERE userid = %d ORDER BY date_added DESC LIMIT {$start},{$this->rows_per_page}", $this->userid); } else { $rows = DB::query("SELECT * FROM orders WHERE status = %s ORDER BY date_added DESC LIMIT {$start},{$this->rows_per_page}", $this->status); } // Go through rows $results = array(); foreach ($rows as $row) { $row['checkbox'] = "<center><input type=\"checkbox\" name=\"order_id[]\" value=\"{$row['id']}\"></center>"; $row['date_added'] = fdate($row['date_added'], true); $row['product'] = DB::queryFirstField("SELECT display_name FROM products WHERE id = %d", $row['product_id']); $row['amount'] = fmoney_coin($row['amount_btc']) . ' BTC (' . fmoney($row['amount']) . ')'; $row['status'] = ucwords($row['status']); // Get manage URL $url = $template->theme == 'public' ? SITE_URI . "/account/view_order?order_id={$row['id']}" : SITE_URI . "/admin/financial/orders_manage?order_id={$row['id']}"; $row['manage'] = "<center><a href=\"{$url}\" class=\"btn btn-primary btn-xs\">Manage</a></center>"; $username = get_user($row['userid']); $row['username'] = "******"" . SITE_URI . "/admin/user/manage2?username={$username}\">{$username}</a>"; array_push($results, $row); } // Return return $results; }
/** * Default cell renderer. * @param DataTable $table Table. * @param BasicRecord $record Record. * @return string Value. */ public function defaultCellRenderer(DataTable $table, BasicRecord $record) { $field = $this->field; $type = $table->model->getType($field)->type; $cell = null; switch ($type) { case DataType::DATE: $cell = '<em class="muted">' . fdate($record->{$field}) . '</em>'; break; case DataType::DATETIME: $cell = '<em class="muted">' . fdatetime($record->{$field}) . '</em>'; break; case DataType::BOOLEAN: $cell = $record->{$field} ? tr('Yes') : tr('No'); break; default: $cell = h($record->{$field}); break; } if ($this->primary) { if ($record instanceof Linkable) { $cell = $this->Html->link($cell, $record); } } return $cell; }
function process_cell(&$cell) { if (!is_array($cell)) { return false; // empty cell } $result = array(); switch ($cell['type']) { // string case 0: $ind = $cell['data']; if ($this->sst['unicode'][$ind]) { $s = $this->uc2html($this->sst['data'][$ind]); } else { $s = $this->sst['data'][$ind]; } $result['type'] = 'string'; $result['data'] = $s; break; // integer number // integer number case 1: $result['type'] = 'int'; $result['data'] = (int) $cell['data']; break; // float number // float number case 2: $result['type'] = 'float'; $result['data'] = (double) $cell['data']; break; // date // date case 3: $result['type'] = 'date'; // print "dt_date>"; $result['timestamp'] = $this->xls2tstamp($cell['data']); $result['datetime'] = date('Y-m-d H:i:s', $result['timestamp']); $result['data'] = fdate($result['datetime'], 'd.m.Y'); break; default: $result['type'] = 'unknown'; $result['data'] = $cell['data']; break; } return $result; }
public function get_rows($start = 0) { // Get rows to display if ($this->is_search == 1) { $rows = DB::query("SELECT * FROM users WHERE username LIKE %ss OR email LIKE %ss ORDER BY username LIMIT {$start},{$this->rows_per_page}", $_POST['username'], $_POST['username']); } else { $rows = DB::query("SELECT * FROM users ORDER BY username LIMIT {$start},{$this->rows_per_page}"); } // Go through rows $results = array(); foreach ($rows as $row) { $row['date_created'] = fdate($row['date_created']); $row['group'] = $this->groups[$row['group_id']]; $row['username'] = "******"" . SITE_URI . "/admin/user/manage2?username={$row['username']}\">{$row['username']}</a>"; array_push($results, $row); } // Return return $results; }
public function get_rows($start = 0) { // Get rows to display $rows = DB::query("SELECT * FROM coin_unauthorized_sends ORDER BY date_added DESC LIMIT {$start},{$this->rows_per_page}"); // Go through rows $results = array(); foreach ($rows as $row) { $irow = DB::queryFirstRow("SELECT * FROM coin_inputs WHERE id = %d", $row['input_id']); $username = get_user($irow['userid']); $row['date_added'] = fdate($row['date_added'], true); $row['amount'] = fmoney_coin($irow['amount']) . ' BTC'; $row['checkbox'] = "<center><input type=\"checkbox\" name=\"unauthorized_send_id[]\" value=\"{$row['id']}\"></center>"; $row['user'] = "******"" . SITE_URI . "/admin/user/manage2?username={$username}\">{$username}</a>"; $row['address'] = "<a href=\"" . SITE_URI . "/admin/financial/addresses_view?address={$irow['address']}\">{$irow['address']}</a>"; $row['viewtx'] = "<center><a href=\"" . SITE_URI . "/admin/financial/tx?txid={$row['txid']}\" class=\"btn btn-primary btn-xs\">View Tx</a></center>"; array_push($results, $row); } // Return return $results; }
public function get_rows($start = 0) { // Initailize global $template; // Get rows to display $rows = DB::query("SELECT * FROM alerts WHERE type = %s AND userid = %d ORDER BY date_added DESC LIMIT {$start},{$this->rows_per_page}", $this->type, $GLOBALS['userid']); // Go through rows $results = array(); foreach ($rows as $row) { // Get URLs $addr_url = $template->theme == 'public' ? SITE_URI . "/account/address?address={$row['address']}" : SITE_URI . "/admin/financial/addresses_view?address={$row['address']}"; // Set variables $row['checkbox'] = "<center><input type=\"checkbox\" name=\"alert_id[]\" value=\"{$row['id']}\"></center>"; $row['date_added'] = fdate($row['date_added'], true); // Type specific variables if ($this->type == 'new_user') { $user_row = DB::queryFirstRow("SELECT * FROM users WHERE id = %d", $row['reference_id']); $row['username'] = $user_row['username']; $row['email'] = $user_row['email']; } else { $input = DB::queryFirstRow("SELECT * FROM coin_inputs WHERE id = %d", $row['reference_id']); $row['username'] = get_user($input['userid']); $row['amount'] = fmoney_coin($input['amount']) . ' BTC'; $row['viewtx'] = "<center><a href=\"" . SITE_URI . "/admin/financial/tx?txid=" . $input['txid'] . "\" class=\"btn btn-primary btn-xs\">View Tx</a></center>"; if ($this->type == 'product_purchase') { $row['product'] = DB::queryFirstField("SELECT display_name FROM products WHERE id = %d", $input['product_id']); $row['manage'] = "<center><a href=\"" . SITE_URI . "/admin/financial/orders_manage?order_id=" . $input['order_id'] . "\" class=\"btn btn-primary btn-xs\">Manage</a></center>"; } elseif ($this->type == 'invoice_paid') { $irow = DB::queryFirstRow("SELECT * FROM invoices WHERE id = %d", $input['invoice_id']); $row['invoice'] = "ID# {$input['invoice_id']} (added: " . fdate($invoice['date_added']) . ")"; $row['manage'] = "<center><a href=\"" . SITE_URI . "/admin/financial/invoices_manage?invoice_id=" . $input['invoice_id'] . "\" class=\"btn btn-primary btn-xs\">Manage</a></center>"; } } //$row['address'] = "<a href=\"$addr_url\">$row[address]</a>"; $row['username'] = "******"" . SITE_URI . "/admin/user/manage2?username={$row['username']}\">{$row['username']}</a>"; array_push($results, $row); } // Return return $results; }
public function get_rows($start = 0) { // Get rows to display $rows = DB::query("SELECT * FROM coin_sends WHERE status = %s ORDER BY date_added LIMIT {$start},{$this->rows_per_page}", $this->status); // Go through rows $results = array(); foreach ($rows as $row) { // Get recipients $row['recipients'] = ''; $addr_rows = DB::query("SELECT * FROM coin_sends_addresses WHERE send_id = %d ORDER BY id", $row['id']); foreach ($addr_rows as $arow) { $row['recipients'] .= $arow['address'] . " -- " . $arow['amount']; } // Add row to results $row['checkbox'] = "<center><input type=\"checkbox\" name=\"send_id[]\" value=\"{$row['id']}\"></center>"; $row['date_added'] = fdate($row['date_added'], true); $row['sign'] = "<center><a href=\"" . SITE_URI . "/admin/financial/sign_tx?send_id={$row['id']}\" class=\"btn btn-primary btn-xs\">Sign Tx</a></center>"; $row['viewtx'] = "<center><a href=\"" . SITE_URI . "/admin/financial/tx?txid={$row['txid']}\" class=\"btn btn-primary btn-xs\">View Tx</a></center>"; array_push($results, $row); } // Return return $results; }
public function loadblogs(Request $request) { if ($request->ajax()) { $sort = $request->input('sort'); $blogs = Blog::where('del', 0)->with('user')->orderBy($sort, 'desc')->paginate(15); $content = ''; foreach ($blogs as $blog) { $slug = slug($blog['title']); $userName = $blog->user->first_name . " " . $blog->user->last_name; $img = $blog->user->img; $content .= ' <div class="userBlogList"> <i class="fa fa-clock-o" data-toggle="tooltip" data-placement="top" title="' . fdate($blog->created_at) . '"></i> <i class="fa fa-eye" data-toggle="tooltip" data-placement="top" title="' . $blog->view_ . '"></i> <i class="fa fa-heart" data-toggle="tooltip" data-placement="top" title="' . $blog->vote . '"></i> </div> <P> <img class="img-circle img-small" alt="' . $userName . '" src="' . asset("images/profiles/thumb/thumb_" . $img) . '" /> <a href="' . route('blog.show', ['blog' => $blog->id, 'str' => $slug]) . '"> ' . $blog->title . ' </a> </P>'; } return response()->json($content); } }
<?php // Initialize global $template, $currency; // Get invoice if (!($row = DB::queryFirstRow("SELECT * FROM invoices WHERE id = %d", $_REQUEST['invoice_id']))) { trigger_error("Invoice does not exist, ID# {$_REQUST['invoice_id']}", E_USER_ERROR); } // Set variables $row['wallet_name'] = DB::queryFirstField("SELECT display_name FROM coin_wallets WHERE id = %d", $row['wallet_id']); $row['username'] = get_user($row['userid']); $row['date_added'] = fdate($row['date_added']); $row['date_paid'] = preg_match("/^0000/", $row['date_paid']) ? 'Unpaid' : fdate($row['date_paid']); // Radio chks if ($row['currency'] == 'fiat') { $template->assign('chk_currency_fiat', 'checked="checked"'); $template->assign('chk_currency_btc', ''); $row['primary_amount'] = $row['amount']; $row['alt_amount'] = $row['amount_btc']; $row['alt_currency'] = 'BTC'; } else { $template->assign('chk_currency_fiat', ''); $template->assign('chk_currency_btc', 'checked="checked"'); $row['primary_amount'] = $row['amount_btc']; $row['alt_amount'] = $row['amount']; $row['alt_currency'] = $config['currency']; } // Status options if ($row['status'] == 'paid') { $status_options = '<option value="pending">Pending<option value="paid" selected="selected">Paid<option value="cancelled">Cancelled'; } elseif ($row['status'] == 'cancelled') {
$mo = substr($datex, $len - 6, 2); $day = substr($datex, $len - 8, 2); $datetrn = "{$mo}{$day}{$yy}"; $datetrn = fdate($datex); $datetrn = str_replace("-", "", $datetrn); $output_dir = "csv.docs\\"; // open a datafile $filename = "ITEM_" . "{$todayz}" . ".csv"; $dataFile = fopen($output_dir . $filename, 'w'); $datetrnx = str_replace("-", "", $datex); $sqlStr = "select mst.ivndpn,mst.inumbr,mst.idescr,mst.isdept,sdept.dptnam,mst.iclas,clas.dptnam,mst.ihzcod,a.curreg,mst.islum,mst.asnum,p.asname,mst.imdate\n from MMFMSLIB.SDIMST a inner join\n MMFMSLIB.INVMST mst on a.inumbr=mst.inumbr left join\n MMFMSLIB.INVDPT sdept on mst.idept=sdept.idept and mst.isdept=sdept.isdept and sdept.iclas+sdept.isclas=0 left join\n MMFMSLIB.INVDPT clas on mst.idept=clas.idept and mst.isdept=clas.isdept and mst.iclas=clas.iclas and clas.isclas=0\n inner join MMFMSLIB.APSUPP p on mst.asnum=p.asnum\n\t\t\twhere mststr=1 and mstcur=150921 and mst.isdept<>910 and ihzcod='CVS'"; $detailx = odbc_exec($AS400, $sqlStr); while (odbc_fetch_row($detailx)) { $upc = odbc_result($detailx, 1); $sku = odbc_result($detailx, 2); $idesc = odbc_result($detailx, 3); $srp = odbc_result($detailx, 9); $uom = odbc_result($detailx, 10); $catcd = odbc_result($detailx, 4); $catds = odbc_result($detailx, 5); $scatcd = odbc_result($detailx, 6); $scatds = odbc_result($detailx, 7); $ascd = odbc_result($detailx, 11); $asnam = odbc_result($detailx, 12); $strdate = fdate(odbc_result($detailx, 13)); $strspace = ""; fputs($dataFile, "\"{$upc}\",\"{$sku}\",\"{$idesc}\",\"{$srp}\",\"{$uom}\",\"{$strspace}\",\"{$strspace}\",\"{$catcd}\",\"{$catds}\",\"{$scatcd}\",\"{$scatds}\",\"{$ascd}\",\"{$asnam}\",\"{$strdate}\",\"{$strspace}\"\n"); } echo "\t<table>\n"; echo "\t<tr class=\"normal\" align=\"center\">\n"; echo "\t<td>DONE</td>\n";
if ($len < 4 or $len == 0 or $datex == "") { return 0; } $yy = substr($datex, $len - 4, 4) + 2000; $mo = substr($datex, $len - 6, 2); $day = substr($datex, $len - 8, 2); $datetrn = "{$mo}{$day}{$yy}"; $datetrn = fdate($datex); $datetrn = str_replace("-", "", $datetrn); $output_dir = "csv.docs\\"; // open a datafile $filename = "STORE_" . "{$todayz}" . ".csv"; $dataFile = fopen($output_dir . $filename, 'w'); $datetrnx = str_replace("-", "", $datex); $sqlStr = "select strnum,strnam,stadd1,stcity,stsdat,stcldt from MMFMSLIB.TBLSTR where strnum < 999"; $detailx = odbc_exec($AS400, $sqlStr); while (odbc_fetch_row($detailx)) { $strno = odbc_result($detailx, 1); $strname = odbc_result($detailx, 2); $stradd = odbc_result($detailx, 3); $straddx = str_replace(",", "", $stradd); $straddcity = odbc_result($detailx, 4); $strdate = fdate(odbc_result($detailx, 5)); $strclose = fdate(odbc_result($detailx, 6)); $strspace = ""; //insert all Entries - PFM PO fputs($dataFile, "\"{$strno}\",\"{$strname}\",\"{$straddx}\",\"{$straddcity}\",\"{$strspace}\",\"{$strspace}\",\"{$strdate}\",\"{$strclose}\",\"{$strspace}\",\"{$strspace}\"\n"); } echo "\t<table>\n"; echo "\t<tr class=\"normal\" align=\"center\">\n"; echo "\t<td>DONE</td>\n";
function display_code() { global $fullresult, $extension, $brush; echo "<center><h2>Source Code</h2></center>"; if (!isset($_GET["rid"]) || empty($_GET["rid"])) { $rid = 0; } else { $rid = $_GET["rid"]; } $run = mysql_query("SELECT * FROM runs WHERE rid={$rid} AND access!='deleted'"); $error = 0; if (!$error) { if (!is_resource($run) || mysql_num_rows($run) == 0) { $error = 1; } else { $run = mysql_fetch_array($run); } } if (!$error) { $problem = mysql_query("SELECT * FROM problems WHERE pid={$run['pid']}"); if (!is_resource($problem) || mysql_num_rows($problem) == 0) { $error = 2; } else { $problem = mysql_fetch_array($problem); } } if (!$error) { $team = mysql_query("SELECT * FROM teams WHERE tid={$run['tid']}"); if (!is_resource($team) || mysql_num_rows($team) == 0) { $error = 3; } else { $team = mysql_fetch_array($team); } } if ($_SESSION["status"] != "Admin" && $_SESSION["tid"] != $run["tid"] && $run["access"] != "public") { $error = 4; } if ($error) { echo "<table width=100%><tr><th>Run ID</th><td>NA</td><th>Team Name</th><td>NA</td><th>Result</th><td>NA</td><th>File Name</th><td>NA</td><th rowspan=2>Options</th><td rowspan=2>NA</td></tr>"; echo "<tr><th>Language</th><td>NA</td><th>Problem Name</th><td>NA</td><th>Run Time</th><td>NA</td><th>Submission Time</th><td>NA</td></tr>"; } if ($error == 1) { echo "<tr><td colspan=10 style='padding:30;'>Code you requested does not exist in the Database.</td></tr>"; } if ($error == 2) { echo "<tr><td colspan=10 style='padding:30;'>The problem for which this code is a solution does not exist.</td></tr>"; } if ($error == 3) { echo "<tr><td colspan=10 style='padding:30;'>The team which submitted this code does not exist.</td></tr>"; } if ($error == 4) { echo "<tr><td colspan=10 style='padding:30;'>You are not authorized to access this code.</td></tr>"; } else { if (!$error) { $filename = $run["name"] . "." . $extension[$run["language"]]; $result = $run["result"]; if (isset($fullresult[$result])) { $result = $fullresult[$result]; } $code = eregi_replace("<", "<", $run["code"]); //$code = filter($run["code"]); $code = eregi_replace("\n","<br>",$code); $code = eregi_replace(" "," ",$code); $code = eregi_replace(" "," ",$code); $options = ""; if ($_SESSION["tid"] || $run["access"] == "public") { $options .= "<input type='button' style='width:100%;' value='Edit' onClick=\"window.location='?display=problem&pid={$run['pid']}&edit={$rid}#bottom';\"><br>"; $options .= "<input type='button' style='width:100%;' value='Download' onClick=\"window.location='?download=code&rid={$rid}';\"><br>"; } if ($_SESSION["status"] == "Admin") { $options .= "<input type='button' style='width:100%;' value='Rejudge' onClick=\"window.location='?action=rejudge&rid={$run['rid']}';\"><br>"; if ($run["access"] == "private") { $options .= " <input type='button' style='width:100%;' value='Private' title='Make this code Public (visible to all).' onClick=\"window.location='?action=makecodepublic&rid={$rid}';\"><br>"; } else { $options .= " <input type='button' style='width:100%;' value='Public' title='Make this code Private (visible only to the team that submitted it).' onClick=\"window.location='?action=makecodeprivate&rid={$rid}';\"><br>"; } $options .= "<input type='button' style='width:100%;' value='Disqualify' onClick=\"if(confirm('Are you sure you wish to disqualify Run ID {$run['rid']}?')) window.location='?action=makecodedisqualified&rid={$run['rid']}';\"><br>"; $options .= "<input type='button' style='width:100%;' value='Delete' onClick=\"if(confirm('Are you sure you wish to delete Run ID {$run['rid']}?'))window.location='?action=makecodedeleted&rid={$run['rid']}';\"><br>"; } echo "<table width=100%><tr><th width=20%>Run ID</th><th width=20%>Team Name</th><th width=20%>Problem Name</th><th width=20%>Result</th><th width=20%>Options</th>"; echo "<tr><td>{$rid}</td><td><a href='?display=submissions&tid={$team['tid']}'>{$team['teamname']}</a></td><td><a href='?display=problem&pid={$problem['pid']}' title='{$problem['code']}'>{$problem['name']}</td><td>{$result}</td><td rowspan=3>{$options}</td></tr></tr>"; echo "<tr><th>Language</th><th>File Name</th><th>Submission Time</th><th>Run Time</th></tr>"; echo "<tr><td>" . ($run["language"] == "Brain" ? "Brainf**k" : $run["language"]) . "</td><td>{$filename}</td><td>" . fdate($run["submittime"]) . "</td><td>{$run['time']}</td></tr>"; echo "<tr><td colspan=10 style='text-align:left;'><div class='limit'><pre class='brush: " . $brush[$run["language"]] . "'>{$code}</pre></div></td></tr>"; if (($run["result"] != "RTE" || $_SESSION["status"] == "Admin") && !empty($run["error"])) { echo "<tr><th colspan=10>Error Message</th></tr><tr><td colspan=10 style='text-align:left;padding:0;'><div class='limit'><pre class='brush:text'>" . eregi_replace("<br>", "\n", filter($run["error"])) . "</pre></div></td></tr>"; } if ($_SESSION["status"] == "Admin" || $run["access"] == "public" and isset($_GET["io"]) and $_GET["io"] == "yes") { $problem['input'] = filter($problem['input']); $problem['output'] = filter($problem['output']); if ($run["result"] == "AC") { $run['output'] = $problem['output']; } else { $run['output'] = filter($run['output']); } $problem['input'] = explode("<br>", $problem['input']); $problem['output'] = explode("<br>", $problem['output']); $run['output'] = explode("<br>", $run['output']); $index1 = $index2 = $index3 = ""; $k = count($problem["input"]); for ($i = 0; $i < $k; ++$i) { $index1 .= $i + 1 . ($i == 0 ? "<br>" : "") . "<br>"; } $k = count($problem["output"]); for ($i = 0; $i < $k; ++$i) { $index2 .= $i + 1 . ($i == 0 ? "<br>" : "") . "<br>"; } $k = count($run["output"]); for ($i = 0; $i < $k; ++$i) { $index3 .= $i + 1 . ($i == 0 ? "<br>" : "") . "<br>"; } $k = max(count($problem['output']), count($run['output'])); $l = strlen("" . $k); $fm = -1; for ($i = 0, $j = 0; $i < $k; $i++) { if ($i > count($problem['output'])) { $problem['output'][$i] = "<red>" . $run['output'][$i] . "<red>"; $j++; if ($fm == -1) { $fm = $i + 1; } continue; } if ($i > count($run['output'])) { $problem['output'][$i] = "<green>" . $problem['output'][$i] . "<green>"; $j++; if ($fm == -1) { $fm = $i + 1; } continue; } $p = strstr($problem["options"], "P"); if (!$p and $problem['output'][$i] == $run['output'][$i]) { continue; } $pout = eregi_replace(" +", " ", eregi_replace(" *\$", "", eregi_replace("^ *", "", $problem['output'][$i]))); $rout = eregi_replace(" +", " ", eregi_replace(" *\$", "", eregi_replace("^ *", "", $run['output'][$i]))); if ($p and $pout == $rout) { continue; } $run['output'][$i] = "<red>" . ($p ? $rout : $run['output'][$i]) . "</red>"; $problem['output'][$i] = "<green>" . ($p ? $pout : $problem['output'][$i]) . "</green>"; $j++; if ($fm == -1) { $fm = $i + 1; } } if (count($problem['input'])) { $problem['input'][0] .= "<br>"; } if (count($problem['output'])) { $problem['output'][0] .= "<br>"; } if (count($run['output'])) { $run['output'][0] .= "<br>"; } $problem['input'] = str_replace(" ", " ", implode("<br>", $problem['input'])); $problem['output'] = str_replace(" ", " ", implode("<br>", $problem['output'])); $run['output'] = str_replace(" ", " ", implode("<br>", $run['output'])); echo "</table><br><table class='io'><tr><th><a href='?download=input&pid={$problem['pid']}'>Program Input</a></th><th><a href='?download=output&pid={$problem['pid']}'>Correct Output</a></th><th><a href='?download=output&rid={$rid}'>Actual Output</a></th></tr><tr>"; echo "<td><div id='input'><table><tr><td><code><sno>{$index1}</sno></code></td><td><code>" . $problem['input'] . "</code></td></tr></table></div></td>"; echo "<td><div id='output'><table><tr><td><code><sno>{$index2}</sno></code></td><td><code>" . $problem['output'] . "</code></td></tr></table></div></td>"; echo "<td><div id='actual'><table><tr><td><code><sno>{$index3}</code></sno></td><td><code>" . $run['output'] . "</code></td></tr></table></div></td>"; echo "<tr><td><input type='button' value='Hide Input Output Files' onClick=\"window.location=window.location.search.replace(/[\\?\\&]io\\=[^&]*/,'');\"></td>"; echo "<td><input type='button' value='Disable Scroll Synchronization' onClick=\"if(scroll_lock) this.value='Enable'; else this.value='Disable'; this.value+=' Scroll Synchronization'; scroll_lock=!scroll_lock; \"></td><td>Matching Lines : " . ($k - $j) . "/" . $k . "<br>" . ($fm != -1 ? "First mismatch at line {$fm}." : "") . "</td>"; echo "</table>"; } else { if ($_SESSION["status"] == "Admin" || $run["access"] == "public" and in_array($run["result"], array("AC", "WA", "PE", "RTE"))) { echo "</table><br><center><input type='button' value='Display Input Output Files' onClick=\"window.location=window.location.search.replace(/[\\?\\&]io\\=[^&]*/,'')+'&io=yes';\"></center>"; } else { echo "</table>"; } } return; } } echo "</table>"; }
function recruiterbydate() { global $MRecruiter, $MCompany; $recruiters = $MRecruiter->find()->sort(array('_id' => -1)); $rs = array(); foreach ($recruiters as $r) { $email = $r['email']; $firstname = $r['firstname']; $lastname = $r['lastname']; $company = $r['company']; if (MongoId::isValid($company)) { $company = $MCompany->getName($company); } $date = fdate($r['_id']->getTimestamp()); $rs[] = "\"{$email}\",\"{$firstname}\",\"{$lastname}\",\"{$company}\",\"{$date}\""; } echo '<br />Recruiters with date of joining:<br /> <textarea style="width:800px; height: 200px;">'; foreach ($rs as $r) { echo "{$r}\n"; } echo '</textarea>'; }
?> / <?php echo $course_data->modules_count; ?> moduler fullført</span> <span class="progress-meter success" style="width: <?php echo $course_data->completed_modules_count / $course_data->modules_count * 100; ?> %"></span> </div> </div> </div> </div> <div class="large-7 columns"> <strong>Påbegynte moduler per <?php echo fdate(DATE_FORMAT_LONG_DATE); ?> </strong> <?php if (!count($active_modules)) { ?> <em>Ingen påbegynte moduler</em> <?php } else { ?> <ul id="active-modules"> <?php foreach ($active_modules as $m) { ?> <li> <div class="row large-collapse">
</div> <div class="form-group col-sm-3"> <label>Código del Cliente</label> <input type="text" class="form-control" value="<?php echo $cliente->id; ?> " placeholder="Generado al guardar" disabled=""> </div> </div> <div> <div style="clear: both"></div> <div class="form-group col-sm-3"> <label for="apartado_cliente">Fecha de Creación</label> <input type="text" class="form-control" value="<?php echo fdate($cliente->fecha_creacion, 1); ?> " placeholder="Generado al guardar" disabled=""> </div> <div class="form-group col-sm-3"> <label for="apartado_cliente">Creado Por</label> <input type="text" class="form-control" value="<?php echo $cliente->usuario; ?> " placeholder="Generado al guardar" disabled=""> </div> </div>
<?php // Initialize global $template; // Get order if (!($row = DB::queryFirstRow("SELECT * FROM orders WHERE id = %d", $_REQUEST['order_id']))) { trigger_error("Order does not exist, ID# {$_REQUEST['order_id']}", E_USER_ERROR); } // Set variables $_POST['order_id'] = $row['id']; $row['username'] = get_user($row['userid']); $row['product_name'] = DB::queryFirstField("SELECT display_name FROM products WHERE id = %d", $row['product_id']) . ' (#' . $row['product_id'] . ')'; $row['amount'] = fmoney_coin($row['amount_btc']) . ' BTC (' . fmoney($row['amount']) . ')'; $row['date_added'] = fdate($row['date_added'], true); // Status options if ($row['status'] == 'declined') { $status_options = '<option value="approved">Approved<option value="declined" selected="selected">Declined<option value="pending">Pending'; } elseif ($row['status'] == 'pending') { $status_options = '<option value="approved">Approved<option value="declined">Declined<option value="pending" selected="selected">Pending'; } else { $status_options = '<option value="approved" selected="selected">Approved<option value="declined">Declined<option value="pending">Pending'; } // Template variables $template->assign('order', $row); $template->assign('status_options', $status_options);
function recruiters() { global $MRecruiter, $MJob, $MCompany, $MApp; $recruiterArray = []; $recruiterColumns = ["email", "firstname", "lastname", "company", "datejoined", "postedjob", "madecompany", "approved"]; $jobColumns = ["jobname", "jobviews", "jobclicks", "applicants"]; $recruiterArray[] = implode(',', $recruiterColumns) . ',' . implode(',', $jobColumns); $r = $MRecruiter->find(); $j = $MJob->find(); $rids = array(); // an array of recruiters ids that have posted jobs foreach ($j as $job) { $rids[] = $job['recruiter']->{'$id'}; } foreach ($r as $recruiter) { $info = []; $id = $recruiter['_id']; $rdoc = $MRecruiter->getById($id); if (isset($recruiter['email'])) { $info['email'] = $recruiter['email']; } else { $info['email'] = 'no email'; } if (isset($recruiter['firstname'])) { $info['firstname'] = $recruiter['firstname']; } else { $info['firstname'] = 'no firstname'; } if (isset($recruiter['lastname'])) { $info['lastname'] = $recruiter['lastname']; } else { $info['lastname'] = 'no lastname'; } if (isset($recruiter['company'])) { if (MongoID::isValid($recruiter['company'])) { // if the company is a MongoID $info['company'] = $MCompany->getName($recruiter['company']); } else { $info['company'] = $recruiter['company']; } } else { $info['company'] = 'no company'; } $info['dateJoined'] = fdate($recruiter['_id']->getTimestamp()); if (in_array($id, $rids)) { // recruiters who have posted at least one job and have a company profile $info['postedJob'] = 'YES'; $info['madeCompany'] = 'YES'; $info['approved'] = 'YES'; } else { // recruiters who have not posted a job $info['postedJob'] = 'NO'; if (MongoID::isValid($recruiter['company'])) { // recruiters who have a company profile $info['madeCompany'] = 'YES'; $info['approved'] = 'YES'; } else { // recruiters who don't have a company profile $info['madeCompany'] = 'NO'; if ($recruiter['approved'] == 'approved') { // recruiters who are approved $info['approved'] = 'YES'; } else { // recruiters who are not approved $info['approved'] = 'NO'; } } } $recruiterArray[] = implode(',', self::quoteStringsInArray($info)); $jobs = $MJob->getByRecruiter($id); // get jobs for recruiter foreach ($jobs as $job) { //make rows under each recruiter for their listed jobs $jobInfo = []; if (isset($job['title'])) { $jobInfo['title'] = $job['title']; } else { 'No Job Title'; } $jobInfo['views'] = $job['stats']['views']; $jobInfo['clicks'] = $job['stats']['clicks']; $jobInfo['applicants'] = ApplicationModel::countByJob($job['_id']); $recruiterArray[] = str_repeat(',', count($recruiterColumns)) . implode(',', self::quoteStringsInArray($jobInfo)); } } return ["recruiterArray" => $recruiterArray]; }
function send_notifications($action, $id) { // Initialize global $config; // Get variables $userid = 0; if ($action == 'new_deposit' || $action == 'product_purchase' || $action == 'invoice_paid') { // Get input $row = DB::queryFirstRow("SELECT * FROM coin_inputs WHERE id = %d", $id); $wallet_name = DB::queryFirstField("SELECT display_name FROM coin_wallets WHERE id = %d", $row['wallet_id']); $userid = $row['userid']; // Set vars $vars = array('userid' => $row['userid'], 'username' => get_user($row['userid']), 'wallet_id' => $row['wallet_id'], 'wallet_name' => $wallet_name, 'product_id' => $row['product_id'], 'order_id' => $row['order_id'], 'invoice_id' => $row['invoice_id'], 'address' => $row['address'], 'txid' => $row['txid'], 'vout' => $row['vout'], 'amount' => $row['amount'], 'date_added' => fdate($row['date_added'], true)); // Product name if ($row['product_id'] > 0) { $vars['product_name'] = DB::queryFirstField("SELECT display_name FROM products WHERE id = %d", $row['product_id']); } else { $vars['product_name'] = 'N/A'; } // Invoice name if ($row['invoice_id'] > 0) { $irow = DB::queryFirstRow("SELECT * FROM invoices WHERE id = %d", $row['invoice_id']); $vars['invoice_name'] = "ID# {$row['invoice_id']} (" . fmoney_coin($row['amount_btc']) . ' BTC)'; } else { $vars['invoice_name'] = 'N/A'; } } elseif ($action == 'funds_sent') { // Get send $row = DB::queryFirstRow("SELECT * FROM coin_sends WHERE id = %d", $id); $wallet_name = DB::queryFirstField("SELECT display_name FROM coin_wallets WHERE id = %d", $row['wallet_id']); $userid = $row['userid']; // Get recipients $recipients = ''; $recip_rows = DB::query("SELECT * FROM coin_sends_addresses WHERE send_id = %d ORDER BY id", $id); foreach ($recip_rows as $recip_row) { $recipients .= $recip_row['address'] . ' - ' . $recip_row['amount'] . " BTC\n"; } // Set vars $vars = array('send_id' => $row['id'], 'wallet_id' => $row['wallet_id'], 'wallet_name' => $wallet_name, 'status' => ucwords($row['status']), 'amount' => $row['amount'], 'txid' => $row['txid'], 'date_added' => fdate($row['date_added'], true), 'recipients' => $recipients); } elseif ($action == 'invoice_created') { // Get invoice $row = DB::queryFirstRow("SELECT * FROM invoices WHERE id = %d", $id); $wallet_name = DB::queryFirstField("SELECT display_name FROM coin_wallets WHERE id = %d", $row['wallet_id']); $userid = $row['userid']; // Set vars $vars = array('invoice_id' => $row['id'], 'wallet_id' => $row['wallet_id'], 'wallet_name' => $wallet_name, 'userid' => $row['userid'], 'username' => get_user($row['userid']), 'status' => ucwords($row['status']), 'currency' => $row['currency'], 'amount' => $row['amount'], 'amount_btc' => $row['amount_btc'], 'amount_paid' => $row['amount_paid'], 'address' => $row['payment_address'], 'date_added' => fdate($row['date_added'], true), 'date_paid' => fdate($row['date_paid'], true), 'note' => $row['note'], 'process_note' => $row['process_note'], 'pay_url' => 'http://' . $_SERVER['HTTP_HOST'] . '/' . SITE_URI . '/pay?invoice_id=' . $row['id']); } // Global variables $vars['site_name'] = $config['site_name']; $vars['company_name'] = $config['company_name']; // Go through notifications $rows = DB::query("SELECT * FROM notifications WHERE action = %s AND is_enabled = 1 ORDER BY id", $action); foreach ($rows as $row) { // Get recipients if ($row['recipient'] == 'admin') { $recipients = DB::queryFirstColumn("SELECT id FROM users WHERE group_id = 1 AND status = 'active' ORDER BY id"); } else { $recipients = array($userid); } // Format message $contents = base64_decode($row['contents']); foreach ($vars as $key => $value) { $row['subject'] = str_ireplace("~{$key}~", $value, $row['subject']); $contents = str_ireplace("~{$key}~", $value, $contents); } // Send message foreach ($recipients as $recipient) { $email = DB::queryFirstField("SELECT email FROM users WHERE id = %d", $recipient); mail($email, $row['subject'], $contents); } } }
$is_invoice = $row['invoice_id'] > 0 ? true : false; $username = $row['userid'] == 0 ? '-' : get_user($row['userid']); // Get order details if ($is_order === true) { $orow = DB::queryFirstRow("SELECT * FROM orders WHERE id = %d", $row['order_id']); $product_name = DB::queryFirstField("SELECT display_name FROM products WHERE id = %d", $orow['product_id']); $order_details = "<a href=\"" . SITE_URI . "/admin/financial/orders_manage?order_id={$orow['id']}\">ID# {$orow['id']} -- {$product_name}</a>"; } else { $order_details = ''; } // Get invoice details if ($is_invoice === true) { $irow = DB::queryFirstRow("SELECT * FROM invoices WHERE id = %d", $row['invoice_id']); $invoice_details = "<a href=\"" . SITE_URI . "/admin/financial/invoices_manage?invoice_id={$irow['id']}\">ID# {$irow['id']} -- " . fmoney($irow['amount']) . ' (added on ' . fdate($irow['date_added']) . ")</a>"; } else { $invoice_details = ''; } // Set vars $payment = array('is_order' => $is_order, 'is_invoice' => $is_invoice, 'username' => $username, 'date_received' => fdate($row['date_added'], true), 'amount' => fmoney_coin($row['amount']) . ' BTC ', 'order_details' => $order_details, 'invoice_details' => $invoice_details); $template->assign('payment', $payment); } // Template variables $template->assign('is_input', $is_input); $template->assign('txid', $trans['txid']); $template->assign('confirmations', $trans['confirmations']); $template->assign('blocknum', $trans['blocknum']); $template->assign('input_amount', $trans['input_amount']); $template->assign('output_amount', $trans['output_amount']); $template->assign('fees', $trans['fees']); $template->assign('inputs', $trans['inputs']); $template->assign('outputs', $trans['outputs']);
function view() { global $MSublet; global $MStudent; // Validations $this->startValidations(); $this->validate(isset($_GET['id']) and ($entry = $MSublet->get($id = $_GET['id'])) != NULL, $err, 'unknown sublet'); if ($this->isValid()) { $this->validate($entry['publish'] or isset($_SESSION['_id']) and $entry['student'] == $_SESSION['_id'], $err, 'access denied'); } // Code if ($this->isValid()) { $data = array('commented' => false); if (isset($_POST['addcomment'])) { function dataComment($data) { $comment = clean($data['comment']); return array('comment' => $comment); } global $params; extract($data = dataComment($params)); array_unshift($entry['comments'], array('time' => time(), 'commenter' => $_SESSION['_id'], 'comment' => $comment)); $data['commented'] = true; // Notify us of the comment $commenter = $_SESSION['email']; $message = "\n <b>{$commenter}</b> has commented on <a href=\"http://sublite.net/housing/sublet.php?id={$id}\">{$id}</a>:\n <br /><br />\n {$comment}\n "; sendgmail(array('*****@*****.**', '*****@*****.**'), "*****@*****.**", 'Comment posted on SubLite!', $message); // Notify the subletter of the comment $subletterEmail = StudentModel::getById($entry['student'])['email']; $subletterName = $_SESSION['name']; $message = "\n Hey there!\n <br /><br />\n {$subletterName} has commented on your sublet!\n Check it out <a href=\"http://sublite.net/housing/sublet.php?id={$id}\">here</a>.\n <br /><br />\n View your sublet:\n <a href=\"http://sublite.net/housing/sublet.php?id={$id}\">\n http://sublite.net/housing/sublet.php?id={$id}\n </a>\n <br /><br />\n Happy subletting,<br />\n SubLite Team\n "; sendgmail(array($subletterEmail), "*****@*****.**", 'You have a new comment on your sublet! | SubLite', $message); } $entry['stats']['views']++; $MSublet->save($entry); $data = array_merge($entry, $data); $data['_id'] = $entry['_id']; $data['mine'] = (isset($_SESSION['_id']) and $entry['student'] == $_SESSION['_id']); // ANY MODiFICATIONS ON DATA GOES HERE $s = $MStudent->getById($entry['student']); if ($s == NULL) { $entry['publish'] = false; $MSublet->save($entry); self::error('this listing is no longer available'); self::render('notice'); return; } $data['studentname'] = $s['name']; $data['studentid'] = $s['_id']->{'$id'}; $data['studentclass'] = $s['class'] > 0 ? " '" . substr($s['class'], -2) : ''; $data['studentschool'] = strlen($s['school']) > 0 ? $s['school'] : 'Undergraduate'; $data['studentpic'] = isset($s['photo']) ? $s['photo'] : $GLOBALS['dirpreFromRoute'] . 'assets/gfx/defaultpic.png'; global $S; $data['studentcollege'] = $S->nameOf($s['email']); $data['studentbio'] = isset($s['bio']) ? $s['bio'] : 'Welcome to my profile!'; if (isset($_SESSION['loggedinstudent'])) { $me = $MStudent->me(); $data['studentmsg'] = "Hi " . $data['studentname'] . ",%0A%0A" . "I am writing to inquire about your listing '" . $data['title'] . "' (http://sublite.net/housing/sublet.php?id=" . $entry['_id'] . ").%0A%0A" . "Best,%0A" . $me['name']; } $data['latitude'] = $data['geocode']['latitude']; $data['longitude'] = $data['geocode']['longitude']; $data['address'] = $data['address'] . ', ' . $data['city'] . ', ' . $data['state']; if (count($data['photos']) == 0) { $data['photos'][] = $GLOBALS['dirpreFromRoute'] . 'assets/gfx/subletnophoto.png'; } $data['startdate'] = fdate($data['startdate']); $data['enddate'] = fdate($data['enddate']); switch ($data['gender']) { case 'male': $data['gender'] = 'Male only'; break; case 'female': $data['gender'] = 'Female only'; break; } for ($i = 0; $i < count($data['comments']); $i++) { $comment = $data['comments'][$i]; $commenter = $MStudent->getById($comment['commenter']); $data['comments'][$i] = array('name' => $commenter['name'], 'photo' => $commenter['photo'], 'time' => timeAgo($comment['time']), 'text' => $comment['comment']); } self::displayMetatags('sublet'); self::render('student/sublets/viewsublet', $data); return; } self::error($err); self::render('notice'); }