public function LatestTotals($id, $byType = FALSE) { $ordering = ' '; if ($byType === FALSE) { $result = $this->Select('Uploader = ' . $id . $ordering); } else { if (matches($byType, 'stl')) { $result = $this->Select('Type LIKE "%stl%"' . $ordering); } else { if (matches($byType, 'images')) { $result = $this->Select('Type LIKE "image%"' . $ordering); } else { if (matches($byType, 'configs')) { $result = $this->Select('Type LIKE "text/plain"' . $ordering); } else { if (matches($byType, 'wav')) { $result = $this->Select('Type LIKE "audio/wav"' . $ordering); } else { if (matches($byType, 'flac')) { $result = $this->Select('Type LIKE "audio/flac"' . $ordering); } else { if (matches($byType, 'f3xb')) { $result = $this->Select('Type LIKE "font/3d-extruded-binary"' . $ordering); } else { $result = $this->Select('ORDER BY ID DESC'); } } } } } } } return false_or_null($result) ? 0 : count($result); }
/** * @constructor * * @param {array} $rules Redirect rules * @param {callable|string} $rules[][source] Regex, plain string startsWith() or callback matcher func, * @param {string} $rules[][target] String for redirection, can use backreference on regex, * @param {?int} $rules[][options] Redirection $options, or internal by default, * @param {?string} $options[source] Base path to match against requests, defaults to root. * @param {string|callable} $options[target] Redirects to a static target, or function($request) returns a string; */ public function __construct($rules) { // rewrite all URLs if (is_string($rules)) { $rules = array('*' => $rules); } $rules = util::wrapAssoc($rules); $this->rules = array_reduce($rules, function ($result, $rule) { $rule = array_select($rule, array('source', 'target', 'options')); // note: make sure source is callback if (is_string($rule['source'])) { // regex if (@preg_match($rule['source'], null) !== false) { $rule['source'] = matches($rule['source']); if (is_string($rule['target'])) { $rule['target'] = compose(invokes('uri', array('path')), replaces($rule['source'], $rule['target'])); } } else { if (!is_callable($rule['source'])) { $rule['source'] = startsWith($rule['source']); if (is_string($rule['target'])) { $rule['target'] = compose(invokes('uri', array('path')), replaces('/^' . preg_quote($rule['source']) . '/', $rule['target'])); } } } } if (!is_callable($rule['source'])) { throw new InvalidArgumentException('Source must be string, regex or callable.'); } $result[] = $rule; return $result; }, array()); }
function authenticate($users, $username, $password) { for ($i = 0; $i < count($users); $i++) { if (matches($users[$i]->username, $username) && matches($users[$i]->password, $password)) { return true; } } return false; }
function where($collection, $properties) { $matches = matches($properties); $results = array(); foreach ($collection as $key => $value) { if ($matches($value)) { $results[$key] = $value; } } return $results; }
public static function remove($haystack, $needle, $delim = ',') { $words = words($haystack, $delim); $out = ""; $last = count($words); foreach ($words as $word) { if (matches($needle, $word)) { continue; } else { $out .= $word . $delim; } } return rtrim($out, $delim); }
public function byTableID($t, $id) { $results = array(); $mods = $this->Select('What LIKE "%' . $t . '%" AND What LIKE "%' . $id . '%" ORDER BY Timestamp DESC'); foreach ($mods as $possible) { $json = json_decode($possible['What'], true); foreach ($json as $dataset) { foreach ($dataset as $table => $change) { if (intval($change['I']) === intval($id) && matches($table, $t)) { $results[] = $possible; } } } } return $results; }
function check($str) { $len = strlen($str); $stack = array(); for ($i = 0; $i < $len; $i++) { $theChar = $str[$i]; if (is_open($theChar)) { $stack[] = $theChar; } else { $matching = array_pop($stack); if (!matches($matching, $theChar)) { return false; } } } return count($stack) == 0; }
function process_first_form() { global $errors; $required_fields = array("firstname", "lastname", "email", "password", "passwordagain"); validate_presences($required_fields); // Limits provided should correspond to the limits set in the sql database $fields_with_max_lengths = array("firstname" => 20, "lastname" => 20, "email" => 50, "password" => 20); validate_max_lengths($fields_with_max_lengths); // Check that password == passwordagain matches($_POST['password'], $_POST['passwordagain']); // check that email has not already been used validate_email($_POST['email']); // check that role was checked and value is acceptable validate_role($_POST['role-check']); if (empty($errors)) { // Success outcome: // Store values entered and wait for user to submit current form // This uses the current session, session should be // destroyed once the registration process ends :NT $_SESSION['firstname'] = $_POST['firstname']; $_SESSION["lastname"] = $_POST['lastname']; $_SESSION["email"] = $_POST['email']; $_SESSION["password"] = $_POST['password']; $_SESSION["role"] = $_POST['role-check']; $_SESSION['user_details'] = 1; //confirm successful outcome in session } else { // Failure outcome: one or more elements in $errors // Either display messages from $errors here in address.php or // signup.php if (!isset($_POST['test'])) { //Store what is needed in the session $_SESSION['firstname'] = $_POST['firstname']; $_SESSION["lastname"] = $_POST['lastname']; $_SESSION["email"] = $_POST['email']; $_SESSION['errors'] = $errors; redirect_to("signup.php"); } } }
function ajax_js_help_get_help($opt_name, $tools) { $str = $tools->get_hm_strings(); $opt_name2 = $tools->display_safe($opt_name); $opt_name3 = $tools->display_safe(decode_unicode_url($opt_name), 'UTF-8'); $opt_name4 = decode_unicode_url($opt_name); $trans = array_keys($tools->str); $res = ''; foreach ($trans as $i) { if (strstr($i, 'plugin')) { continue; } $v = $str[$i]; if (matches($opt_name, $v) || matches($opt_name2, $v) || matches($opt_name3, $v)) { $res = sprintf($tools->str[$i], '<b>' . $v . '</b>'); break; } } if (!$res) { $str_list = array(); $plugin_vals = $tools->get_from_global_store('help_strings'); foreach ($plugin_vals as $plugin => $vals) { if (isset($tools->str[$plugin . '_plugin'])) { foreach ($vals as $i => $v) { if (matches($opt_name, $v) || matches($opt_name2, $v) || matches($opt_name3, $v) || matches($opt_name4, $v)) { if (isset($tools->str[$plugin . '_plugin'][$i])) { $res = sprintf($tools->str[$plugin . '_plugin'][$i], '<b>' . $v . '</b>'); } } } } } if (!$res) { $res = 'Could not find that setting!'; } } return $res; }
function Modified($what, $message = '') { // plog('Modified('.$what.','.$message.')'); global $auth, $database; $m = new Modification($database); $mods = $m->Select('r_Auth = ' . $auth['ID'] . ' ORDER BY Timestamp DESC LIMIT 50'); $now = strtotime('now'); $what_json = json_encode($what); // Messages are not saved if they are a duplicate of a recent event. if (!false_or_null($mods)) { foreach ($mods as $a) { if ($now - intval($a['Timestamp']) > 30) { continue; } if (strlen($a['What']) === strlen($what_json) && matches($what_json, $a['What']) && matches($message, $a['Message'])) { /*plog("Modified matched previous message");*/ return FALSE; } } } RemoveOldModifications(); return $m->Insert(array('r_Auth' => $auth['ID'], 'What' => $what_json, 'Message' => $message, 'Timestamp' => $now)); }
/** * Returns matcher closure by $pattern * * @param array $pattern * * @return \Closure * * @see https://github.com/ptrofimov/matchmaker - ultra-fresh PHP matching functions * @author Petr Trofimov <*****@*****.**> */ function key_matcher(array $pattern) { $keys = []; foreach ($pattern as $k => $v) { $chars = ['?' => [0, 1], '*' => [0, PHP_INT_MAX], '!' => [1, 1]]; if (isset($chars[$last = substr($k, -1)])) { $keys[$k = substr($k, 0, -1)] = $chars[$last]; } elseif ($last == '}') { list($k, $range) = explode('{', $k); $range = explode(',', rtrim($range, '}')); $keys[$k] = count($range) == 1 ? [$range[0], $range[0]] : [$range[0] === '' ? 0 : $range[0], $range[1] === '' ? PHP_INT_MAX : $range[1]]; } else { $keys[$k] = $chars[$k[0] == ':' ? '*' : '!']; } array_push($keys[$k], $v, 0); } return function ($key = null, $value = null) use(&$keys) { if (is_null($key)) { foreach ($keys as $count) { if ($count[3] < $count[0] || $count[3] > $count[1]) { return false; } } } else { foreach ($keys as $k => &$count) { if (matcher($key, $k)) { if (!matches($value, $count[2])) { return false; } $count[3]++; } } } return true; }; }
global $database; foreach ($modes as $mode) { switch ($mode) { default: Page::Redirect('dash?nosuchform'); break; case 1: if (!Session::logged_in()) { Page::Redirect('login'); } global $auth; $old = AJAX::Value($ajax, 'changeMyPassword', 'password', 'old'); $change = AJAX::Value($ajax, 'changeMyPassword', 'password', 'new'); $repeat = AJAX::Value($ajax, 'changeMyPassword', 'password', 'confirm'); if (strlen($auth['password']) === 0 || Auth::PasswordMatches(ourcrypt($old), $auth['password'])) { if (matches($change, $repeat, TRUE)) { global $auth_model; $auth_model->Update(array('password' => ourcrypt($change), 'password_expiry' => strtotime('+1 year')), array('ID' => $auth['ID'])); echo js('Notifier.success("Password changed!");'); die; } else { echo js('Notifier.error("Passwords did not match.");'); die; } } else { echo js('Notifier.error("You got your password wrong.","Logging you out."); setTimeout( function() { window.location="logout"; }, 2000 );'); die; } break; }
} chdir($cwd); unset($cwd); // restore working directory return; // then exits. } } unset($res); } unset($fragments); } // static view assets redirection // note; composer.json demands the name to be of format "vendor/name". return @".private/modules/{$instance->name}/views/{$matches['2']}"; }), array('source' => '/^\\/faye\\/client.js/', 'target' => array('uri' => array('port' => 8080, 'path' => '/client.js'), 'options' => array('status' => 307))), array('source' => funcAnd(matches('/^(?!(?:\\/assets|\\/service))/'), compose('not', pushesArg('pathinfo', PATHINFO_EXTENSION))), 'target' => '/'))), 65); // Web Services $resolver->registerResolver(new resolvers\WebServiceResolver(array('prefix' => conf::get('web::resolvers.service.prefix', '/service'))), 60); // Post Processers $resolver->registerResolver(new resolvers\InvokerPostProcessor(array('invokes' => 'invokes', 'unwraps' => 'core\\Utility::unwrapAssoc')), 50); // Template resolver // $templateResolver = new resolvers\TemplateResolver(array( // 'render' => function($path) { // static $mustache; // if ( !$mustache ) { // $mustache = new Mustache_Engine(); // } // $resource = util::getResourceContext(); // return $mustache->render(file_get_contents($path), $resource); // } // , 'extensions' => 'mustache html'
function LockMechanism(&$p, $table, $id) { $locked = LockCheck($table, $id); if (matches($table, "Modified")) { return; } $p->HTML('<div class="padlockarea"><span id="padlock" class="redbutton">' . '<span id="padlockface" class=""></span>' . '</span>' . '<span id="padlockmsg"></span>' . '</div>'); $p->JQ(' $.ajax({ url:"ajax.skeleton.key", data:{S:1,T:"' . $table . '",I:' . $id . '}, dataType:"html", success:function(d){ page_lock_status=parseInt(d) == 1 ? true : false; if ( page_lock_status ) { $("#padlockface").removeClass("fi-unlock"); $("#padlockface").addClass("fi-lock"); $("#padlockmsg").get(0).innerHTML=" locked"; } else { $("#padlockface").removeClass("fi-lock"); $("#padlockface").addClass("fi-unlock"); $("#padlockmsg").get(0).innerHTML=" "; } } }); var page_lock_status=' . ($locked ? 'true' : 'false') . '; $("#padlock").on("click",function(e){ $.ajax({ url:"ajax.skeleton.key", data:{T:"' . $table . '",I:' . $id . '}, dataType:"html", success:function(d){ page_lock_status=parseInt(d) == 1 ? true : false; if ( page_lock_status ) { $("#padlockface").removeClass("fi-unlock"); $("#padlockface").addClass("fi-lock"); $("#padlockmsg").get(0).innerHTML=" locked"; } else { $("#padlockface").removeClass("fi-lock"); $("#padlockface").addClass("fi-unlock"); $("#padlockmsg").get(0).innerHTML=" "; } } }); setInterval(function(){ $.ajax({ url:"ajax.skeleton.key", data:{S:1,T:"' . $table . '",I:' . $id . '}, dataType:"html", success:function(d){ page_lock_status=parseInt(d) == 1 ? true : false; if ( page_lock_status ) { $("#padlockface").removeClass("fi-unlock"); $("#padlockface").addClass("fi-lock"); $("#padlockmsg").get(0).innerHTML=" locked"; } else { $("#padlockface").removeClass("fi-lock"); $("#padlockface").addClass("fi-unlock"); $("#padlockmsg").get(0).innerHTML=" "; } } }); }, 15000 ); }); '); }
public function Load($ff, $addendum, $signal) { if (!isfile($ff, 'forms/')) { return; } $file = file_get_contents('forms/' . $ff); $data = new HDataStream($file); $data = $data->toArray(); $settings = array(); $settings['insert'] = array(); $settings['hidden'] = array(); $settings['text'] = array(); $settings['multiline'] = array(); $settings['slider'] = array(); $settings['date'] = array(); $settings['select'] = array(); $settings['radio'] = array(); $settings['submit'] = array(); $settings['list'] = array(); $settings['name'] = 'form'; $settings['action'] = 'ajax.post.php'; if (!is_null($addendum) && is_array($addendum)) { foreach ($addendum as $add => $val) { $settings[$add] = $val; } } if (isset($settings['dbid'])) { $this->dbid = $settings['dbid']; } $t = count($data); $o = 0; for ($i = 0; $i < $t; $i++) { $setting = $data[$i + 1]; if (matches($data[$i], "text")) { $settings['text'][$o++] = HDataStream::asKV($setting); } else { if (matches($data[$i], "hidden")) { $settings['hidden'][$o++] = HDataStream::asKV($setting); } else { if (matches($data[$i], "multiline") || matches($data[$i], "textarea")) { $settings['multiline'][$o++] = HDataStream::asKV($setting); } else { if (matches($data[$i], "slider")) { $settings['slider'][$o++] = HDataStream::asKV($setting); } else { if (matches($data[$i], "date")) { $settings['date'][$o++] = HDataStream::asKV($setting); } else { if (matches($data[$i], "select")) { $settings['select'][$o++] = HDataStream::asKV($setting); } else { if (matches($data[$i], "list")) { $settings['list'][$o++] = HDataStream::asKV($setting); } else { if (matches($data[$i], "radio")) { $settings['radio'][$o++] = HDataStream::asKV($setting); } else { if (matches($data[$i], "insert")) { $settings['insert'][$o++] = HDataStream::asKV($setting); } else { if (matches($data[$i], "submit")) { $settings['submit'][$o++] = HDataStream::asKV($setting); } else { $settings[$data[$i]] = $setting; } } } } } } } } } } $i++; } $this->form = new FormHelper($settings['name'], $settings['action'], $this->dbid, $signal); for ($i = 0; $i < $o; $i++) { if (isset($settings['radio'][$i])) { $e = $settings['radio'][$i]; $e['html'] = HDataStream::asKV($e['html']); $e['options'] = HDataStream::asKV($e['options']); $element = new FormRadio($e, TRUE); if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) { $element->Set($this->data[$e['data']]); } $element->_Init($element->settings); $this->form->Add($element); } else { if (isset($settings['select'][$i])) { $e = $settings['select'][$i]; $e['html'] = HDataStream::asKV($e['html']); $e['options'] = HDataStream::asKV($e['options']); $element = new FormSelect($e, TRUE); if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) { $element->Set($this->data[$e['data']]); } $element->_Init($element->settings); $this->form->Add($element); } else { if (isset($settings['list'][$i])) { $e = $settings['list'][$i]; $e['html'] = HDataStream::asKV($e['html']); $e['options'] = HDataStream::asKV($e['options']); $element = new FormList($e, TRUE); if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) { $element->Set($this->data[$e['data']]); } $element->_Init($element->settings); $this->form->Add($element); } else { if (isset($settings['slider'][$i])) { $e = $settings['slider'][$i]; $e['html'] = HDataStream::asKV($e['html']); $element = new FormSlider($e, TRUE); if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) { $element->Set($this->data[$e['data']]); } $element->_Init($element->settings); $this->form->Add($element); } else { if (isset($settings['multiline'][$i])) { $e = $settings['multiline'][$i]; $e['html'] = HDataStream::asKV($e['html']); $element = new FormMultiline($e, TRUE); if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) { $element->Set($this->data[$e['data']]); } $element->_Init($element->settings); $this->form->Add($element); } else { if (isset($settings['text'][$i])) { $e = $settings['text'][$i]; $e['html'] = HDataStream::asKV($e['html']); $element = new FormText($e, TRUE); if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) { $element->Set($this->data[$e['data']]); } $element->_Init($element->settings); $this->form->Add($element); } else { if (isset($settings['insert'][$i])) { $e = $settings['insert'][$i]; $this->form->Add(new FormInsert($e)); } else { if (isset($settings['hidden'][$i])) { $e = $settings['insert'][$i]; $this->form->Add(new FormHidden($e)); } else { if (isset($settings['submit'][$i])) { $e = $settings['submit'][$i]; $e['html'] = HDataStream::asKV($e['html']); $element = new FormSubmit($e, TRUE); if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) { $element->Set($this->data[$e['data']]); } $element->_Init($element->settings); $this->form->Add($element); } } } } } } } } } } }
public function Values(&$FormPost, $form) { $out = array(); $map =& $FormPost['map']; if (count($c = explode('.', $a)) > 1) { $b = $c[1]; } foreach ($map as $f => $elements) { if (matches($f, $form)) { foreach ($elements as $named => $e) { if (is_array($e)) { foreach ($e as $n => $v) { $out[$n][$v] = $FormPost[$form][$named]; } } else { $out[$e] = $FormPost[$form][$named]; } } } } return $out; }
function PasswordMatches($a, $b) { return matches($a, $b, TRUE); }
function store($data, $csumb) { $csum = new Csum($data); if (!$csum->matches($csumb)) { return null; } $status = 0; //Why I'm not doing this type of deduplication: It could lead to inaccurate metadata about the coal. //Ya know, screw that. Coal *shouldn't support* file uploads — that should be handled by higher level software. I'm putting this back in for now, and just remember that the Coal file-level metadata is only an ugly, non-archival-quality, incomplete hack for while Ember doesn't exist yet to take care of that. $db = new FractureDB('futuqiur_ember'); $potentialDuplicates = $db->getColumnsUH('strings', 'id', 'md5', $csum->md5); foreach ($potentialDuplicates as $potential) { //echo 'duplicate testing'; $potentialRecord = retrieveCoal($potential['id']); if (!is_null($potentialRecord)) { $potentialData = $potentialRecord['data']; $potentialCsum = Csum_import($potentialRecord['csum']); if ($potentialData === $data && matches($csum, $potentialCsum)) { $duplicateId = $potential['id']; return array('id' => $duplicateId, 'csum' => $potentialRecord['csum'], 'status' => $status); } } } $db->close(); //echo 'gotten here'; $filename = 'coal_temp/' . uniqid() . '.cstf'; file_put_contents($filename, $data); return insertCoal($filename, $csum); }
public function Find($name) { foreach ($this->list as $network) { if (contains($network->name, $name) || matches($network->name, $name)) { return $network; } } return FALSE; }
<?php //global $plog_level; $plog_level=1; include 'core/Page.php'; plog('File: ' . __FILE__); global $session_model, $auth_model, $auth; $getpost = getpost(); if (!(isset($getpost['username']) && isset($getpost['password']))) { Page::Redirect("login?m=1"); } $auth = $auth_model->byUsername($getpost['username']); plog('$getpost: ' . vars($getpost)); plog('$auth: ' . vars($auth)); if (!is_array($auth)) { Page::Redirect("login?m=2"); } if (strlen($auth['password']) == 0 || matches(ourcrypt($getpost['password']), $auth['password'])) { plog('Password matched! User has authenticated.'); if (Auth::ACL('locked')) { plog('Account is locked, logging user ' . $auth['ID'] . ' off.'); $session_model->Logout(); Page::Redirect("login?m=4"); die; } $session_model->Create($auth['ID']); Page::Redirect("dash"); } else { Page::Redirect("login?m=1"); }
public function is_Named($name) { return matches($name, $this->name); }
public function LayoutSidebarStart($sidebar) { $out = '<div class="container-fluid"><div class="row"><div class="col-sm-3 col-md-2 sidebar">'; foreach ($sidebar as $elementGroup) { $out .= '<ul class="nav nav-sidebar">' . PHP_EOL; foreach ($elementGroup as $named => $url) { if (matches($named, "active")) { $out .= '<li class="active"><a href="#">' . $url . '<span class="sr-only">(current)</span></a></li>'; } else { $out .= '<li><a href="' . $url . '">' . $named . '</a></li>'; } } $out .= '</ul>' . PHP_EOL; } $out .= '<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">' . PHP_EOL; return $out; }
<h1>Finished Matches</h1> <? print "<a href='?d=lobby'>Home</a> -- <a href='?d=create'>Create Match</a> -- <a href='?d=active'>Active Matches</a> -- <a href='?d=finished'>Finished Matches</a>"; print "<table width=90%><tr><th colspan=7><h3>Finished Matches</h3></th></tr><tr><td>ID</td><td>Player 1</td><td>Player 2</td><td>Gain Mode</td><td>Rules</td><td>Special Rules</td><td>Result</td></tr>"; matches(3); print "</table>"; ?>
function fontAwesomeSocial($url = null) { $socials = array('facebook.com', 'twitter.com', 'linkedin.com', 'pinterest.com', 'google.com', 'instagram.com', 'flickr.com', 'dribbble.com', 'tumblr.com', 'github.com', 'bitbucket.org', 'youtube.com'); $social_icons = array('facebook', 'twitter', 'linkedin', 'pinterest', 'google-plus', 'instagram', 'flickr', 'dribbble', 'tumblr', 'github', 'bitbucket', 'youtube'); for ($i = 0; $i < count($socials); $i++) { if (matches($url, $socials[$i])) { return "fa fa-" . $social_icons[$i]; break; } else { if ($i + 1 == count($socials)) { return "fa fa-check"; } } } }
function matches($csum) { return matches($this, $csum); }
public function Subtract($r, $g = NULL, $b = NULL) { if (is_object($r) && matches(get_class($r), 'Crayon')) { $this->r -= $r->r; $this->g -= $r->g; $this->b -= $r->b; } else { $this->r -= floatval($r); $this->g -= floatval($g); $this->b -= floatval($b); } $this->Absolute(); }
function retrieveCoal($id) { global $l; $l->a("Started retrieveCoal<br>"); $db = new FractureDB('futuqiur_ember'); $coalInfo = $db->getRow('strings', 'id', $id); $detailsChunkId = $coalInfo['chunk']; $coalmd5 = $coalInfo['md5']; $detailsChunk = retrieveChunk($detailsChunkId); $status = $detailsChunk['status']; $details = unserialize($detailsChunk['data']); if (!is_array($details)) { $l->a("Status 46<br>"); $status = 46; } $csum = Csum_import($details['csum']); $chunks = $details['chunks']; $chunks_csum = Csum_import($details['chunks_csum']); $retr_chunks_csum = new Csum($chunks); $l->a("retrieveCoalcheckpointA<br>"); if (!matches($chunks_csum, $retr_chunks_csum)) { $status = 47; } $l->a("retrieveCoalcheckpointB<br>"); if (strlen($chunks) == 0) { $chunk_array = array(); } else { $chunk_array = explode_esc(',', $chunks); } $data = ''; foreach ($chunk_array as $chunk_id) { $l->a('<br>Retrieving chunk ' . $chunk_id . '...<br>'); $chunk_details = retrieveChunk($chunk_id); $chunk = $chunk_details['data']; //$l->a("DATA OUT A: ".$chunk); $chunk_csum = Csum_import($chunk_details['csum']); $retr_chunk_csum = new Csum($chunk); if (!matches($chunk_csum, $retr_chunk_csum)) { $status = 48; } $data = $data . $chunk; } $data_csum = new Csum($data); //$l->a("DATA OUT FINAL: ".$data); // $l->a(print_r($data_csum,true)); // $l->a(print_r($csum,true)); if (!matches($csum, $data_csum)) { $status = 49; } $db->close(); $filename = $details['filename']; if (isset($details['ulfilename'])) { $filename = base64_decode($details['ulfilename']); } $l->a("Finished retrieveCoal<br>"); //TODO: $csum->export() — why isn't this working?! return array('data' => $data, 'csum' => $csum->export(), 'filename' => $filename, 'status' => $status); }
$result = array(); $was = array(); foreach ($sessions as $s) { if (!$m_sess->LoggedOut($s)) { $activity = ' '; $activity .= get_url_map($s['last_url'], $url_map); if (matches($activity, 'request_login.php')) { continue; } $a = $m_auth->Get($s['r_Auth']); if (false_or_null($a)) { continue; } $found = FALSE; foreach ($was as $u) { if (matches($u, $a['username'])) { $found = TRUE; break; } } if ($found === TRUE) { continue; } $was[] = $a['username']; $mod = $mod_model->Select(array('r_Auth' => $a['ID']), '*', "", 'ORDER BY Timestamp DESC', 1); if (!false_or_null($mod)) { $lastmod = (strtotime('now') - intval($mod[0]['Timestamp'])) / 60; if (intval($lastmod) > 0) { $lastmod = intval($lastmod) . 'm'; } else { $lastmod = '';
$result = array(); $s_model = new FileFLAC($database); $ss = $s_model->All('ORDER BY ID DESC'); $files = new File($database); $i = 1; $result[0] = array(0 => 0, 1 => "None"); if (!false_or_null($ss)) { foreach ($ss as $s) { $f = $files->Get($s['r_File']); $result[$i++] = array(0 => intval($s['ID']), 1 => $f['Name'], 2 => $f['Name'] . ' #' . $s['ID']); } } echo json_encode($result); exit; } else { if (matches($getpost['R'], 'images')) { $result = array(); $images_model = new FileImage($database); $images = $images_model->All('ORDER BY ID DESC'); $files = new File($database); $i = 0; if (!isset($getpost['N'])) { $result[$i++] = array(0 => 0, 1 => "None", 2 => "i/none64.png", 3 => '<div><span class="enormous">X</span></div>'); } if (!false_or_null($images)) { foreach ($images as $s) { // Return available image file ids $f = $files->Get($s['r_File']); if (!false_or_null($f)) { $tname = $files->ThumbName($f); $result[$i++] = array(0 => intval($s['ID']), 1 => $f['Name'] . ' #' . $f['ID'] . ' ' . $s['Width'] . 'x' . $s['Height'], 2 => $files->ThumbName($f), 3 => $f['ID'], 4 => '<img src="' . $tname . '"><div>' . $f['Name'] . ' (#' . $item['ID'] . ')</div><div class="json-stat-image">' . $stats . '</div>');
<h1>Active Matches</h1> <? print "<a href='?d=lobby'>Home</a> -- <a href='?d=create'>Create Match</a> -- <a href='?d=active'>Active Matches</a> -- <a href='?d=finished'>Finished Matches</a>"; print "<table width=90%><tr><th colspan=7><h3>Active Matches</h3></th></tr><tr><td>ID</td><td>Player 1</td><td>Player 2</td><td>Gain Mode</td><td>Rules</td><td>Special Rules</td><td>View</td></tr>"; matches(2); print "</table>"; ?>