Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
    }
    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>
<?php 
if ($isActive) {
    echo '<p>Warning: Uploading is still active for this compo! First disable uploading before processing votes!</p>';
}
?>
    <table>
        <tr><th>Filename</th><th>Title</th><th>Author</th><th title="Uncheck if votes have been processed for this author. Otherwise they will be penalized for not having voted.">+v</th>
Exemplo n.º 3
0
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}");
}