<?php require 'src/indeed_query.php'; require 'src/archive_search.php'; require 'src/convert_JSON_CSV.php'; if (isset($_POST['submit'])) { $jobQuery = new JobQuery(); //params - query, location, limit, start, fromage $jobQuery->postJobQuery($_POST['query'], $_POST['location'], 0, $_POST['fromage']); } if (isset($_POST['archive'])) { $archiveFile = new ArchiveFile(); $archiveFile->archiveFile(); } if (isset($_POST['convertCSV'])) { $conversion = new ConvertScripts(); $conversion->convertJSONtoCSV('data/search.json'); } ?> <!doctype html> <html> <head> <meta charset="UTF-8"> <title>Indeed Search</title> </head> <div id="container"> <form name="form1" method="post" action=""> <p>
} } if (is_array($_POST['penalty'])) { foreach ($_POST['penalty'] as $doot) { $author = $songs[intval($doot) - 1]['author']; print "--=> " . $author . " <=- Did not vote\n"; } } print "\n\n"; print "-----<O>-----\n"; print "This results were generated with LazyVote. (c) 2010 coda and Saga Musix. http://wiki.s3m.us"; $text = ob_get_clean(); $outFileName = UPLOAD_DIR . $compo . '.txt'; file_put_contents($outFileName, $text); @chmod($outFileName, 0755); $arc = new ArchiveFile(UPLOAD_DIR . $compo); $resultsTxt = UPLOAD_DIR . 'results.txt'; $arc->PrepareReplace($resultsTxt); if (copy($outFileName, $resultsTxt)) { $arc->Add($resultsTxt); } @unlink($resultsTxt); $arc->Close(); redirect(BASEDIR . "results/{$compo}.txt"); } ?> <script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha384-Dziy8F2VlJQLMShA6FHWNul/veM9bCkRUaLqr199K94ntO5QUrLJBEbYegdSkkqX" crossorigin="anonymous"></script> <script type="text/javascript">var BASEDIR = "{{BASE}}";</script> <script src="{{BASE}}js/lazyvote.js" type="text/javascript"></script> <h2>Entries</h2>
function updateCompo() { global $mysqli; $compo = intval($_POST["which"]); $result = $mysqli->query("SELECT * FROM `compos` WHERE `idcompo` = {$compo}") or die('query failed'); $row = $result->fetch_assoc(); $result->free(); if (!canEditCompo($row)) { redirect(BASEDIR); } if ($_POST["componame"] == "") { $_POST["componame"] = date("Y-m-d", time()); } $active = intval($_POST["active"]) != 0 ? 1 : 0; $downloadable = intval($_POST["active"]) != 0 ? 0 : 1; $stmt = $mysqli->prepare('UPDATE `compos` SET `name` = ?, `active` = ?, `downloadable` = ? WHERE `idcompo` = ?') or die('query failed'); $stmt->bind_param('siii', $_POST["componame"], $active, $downloadable, $compo); $stmt->execute() or die('query failed'); $stmt->close(); if (!$_POST["active"]) { // Can't upload anymore, so get rid of any active pings. $mysqli->query("DELETE FROM `uploading` WHERE `idcompo` = {$compo}") or die('query failed'); } // Recompress compo archive after closing compo if (!intval($row['downloadable']) && !intval($_POST["active"])) { $arc = new ArchiveFile(UPLOAD_DIR . $compo); $arc->Recompress(); $arc->Close(); } redirect(BASEDIR . "admin/compo/{$compo}"); }
function fetchPack($compo, $file = '') { global $mysqli; $compo = intval($compo); if (!canFetchPack($compo)) { redirect(BASEDIR); } if ($file != '') { $arc = new ArchiveFile(UPLOAD_DIR . $compo); $arc->Extract($file); $arc->Close(); die; } $arcName = ArchiveFile::FileName(UPLOAD_DIR . $compo); $result = $mysqli->query("SELECT `name` FROM `compos` WHERE `idcompo` = {$compo}") or die('query failed'); $row = $result->fetch_assoc(); $result->free(); $compoName = safeFilename($row["name"]); ob_end_clean(); header('Content-Disposition: attachment; filename="' . $compoName . '.7z"'); header("Content-type: application/octet-stream"); header("Content-Length: " . filesize($arcName)); readfile($arcName); die; }
function refresh($force = false) { if (!file_exists($this->dir)) { mkdir($this->dir, 0777, true); } $file = new ArchiveFile($this->url); if ($force) { if (DEBUG) { echo ' <span style="color:purple">[force]</span>'; flush(); } $file->save($this->parent); } else { $file->saveIfNew($this->getLastVersion(), $this->parent); } $this->files[] = $file; return $file; }