Esempio n. 1
0
<?php

// facefetch.php -- Peteramati script for fetching & storing faces
// HotCRP and Peteramati are Copyright (c) 2006-2015 Eddie Kohler and others
// See LICENSE for open-source distribution terms
$ConfSitePATH = preg_replace(',/batch/[^/]+,', '', __FILE__);
require_once "{$ConfSitePATH}/src/init.php";
require_once "{$ConfSitePATH}/lib/getopt.php";
$arg = getopt_rest($argv, "hn:l:a", array("help", "name:", "limit:", "all"));
if (isset($arg["h"]) || isset($arg["help"]) || count($arg["_"]) > 1) {
    fwrite(STDOUT, "Usage: php batch/facefetch.php [-l LIMIT] [FETCHSCRIPT]\n");
    exit(0);
}
$facefetch_urlpattern = get($Opt, "facefetch_urlpattern");
if (get($PsetInfo, "_facefetch_urlpattern")) {
    $facefetch_urlpattern = $PsetInfo->_facefetch_urlpattern;
}
if (!$facefetch_urlpattern) {
    fwrite(STDERR, 'Need `_facefetch_urlpattern` configuration option.' . "\n");
    exit(1);
}
$fetchscript = get($PsetInfo, "_facefetch_script");
if (count($arg["_"])) {
    $fetchscript = $arg["_"][0];
}
if (!$fetchscript) {
    fwrite(STDERR, "Need `_facefetch_script` configuration option or argument.\n");
    exit(1);
}
if (!isset($arg["limit"])) {
    $arg["limit"] = get($arg, "l");
<?php

$ConfSitePATH = preg_replace(',/batch/[^/]+,', '', __FILE__);
require_once "{$ConfSitePATH}/src/init.php";
require_once "{$ConfSitePATH}/lib/getopt.php";
$arg = getopt_rest($argv, "hn:pu", ["help", "name:", "papers", "users", "collaborators"]);
if (isset($arg["h"]) || isset($arg["help"]) || count($arg["_"]) > 1 || count($arg["_"]) && $arg["_"][0] !== "-" && $arg["_"][0][0] === "-") {
    $status = isset($arg["h"]) || isset($arg["help"]) ? 0 : 1;
    fwrite($status ? STDERR : STDOUT, "Usage: php batch/updatecontactdb.php [-n CONFID] [--papers] [--users] [--collaborators]\n");
    exit($status);
}
if (!@$Opt["contactdb_dsn"]) {
    fwrite(STDERR, "Conference has no contactdb_dsn\n");
    exit(1);
}
$users = isset($arg["u"]) || isset($arg["users"]);
$papers = isset($arg["p"]) || isset($arg["papers"]);
$collaborators = isset($arg["collaborators"]);
if (!$users && !$papers && !$collaborators) {
    $users = $papers = true;
}
if ($users) {
    $result = Dbl::ql($Conf->dblink, "select ContactInfo.contactId, email from ContactInfo\n        left join PaperConflict on (PaperConflict.contactId=ContactInfo.contactId and PaperConflict.conflictType>=" . CONFLICT_AUTHOR . ")\n        left join PaperReview on (PaperReview.contactId=ContactInfo.contactId)\n        where roles!=0 or PaperConflict.conflictType is not null\n            or PaperReview.reviewId is not null\n        group by ContactInfo.contactId");
    while ($row = edb_row($result)) {
        $contact = Contact::find_by_id($row[0]);
        $contact->contactdb_update();
    }
    Dbl::free($result);
}
if ($papers) {
    $result = Dbl::ql(Contact::contactdb(), "select confid from Conferences where `dbname`=?", $Opt["dbName"]);
<?php

$ConfSitePATH = preg_replace(',/batch/[^/]+,', '', __FILE__);
require_once "{$ConfSitePATH}/src/init.php";
require_once "{$ConfSitePATH}/lib/getopt.php";
require_once "{$ConfSitePATH}/lib/unicodehelper.php";
$trans = [2 => [], 3 => []];
for ($i = 0; $i < strlen(UTF8_ALPHA_TRANS_2); $i += 2) {
    $trans[2][substr(UTF8_ALPHA_TRANS_2, $i, 2)] = rtrim(substr(UTF8_ALPHA_TRANS_2_OUT, $i, 2));
}
for ($i = $j = 0; $i < strlen(UTF8_ALPHA_TRANS_3); $i += 3, $j += 2) {
    $trans[3][substr(UTF8_ALPHA_TRANS_3, $i, 3)] = rtrim(substr(UTF8_ALPHA_TRANS_3_OUT, $j, 2));
}
$arg = getopt_rest($argv, "hn:", array("help", "name:"));
if (isset($arg["h"]) || isset($arg["help"])) {
    fwrite(STDOUT, "Usage: php batch/updateutf8trans.php CODEPOINT STRING...\n");
    exit(0);
}
function quote_key($k)
{
    if (strlen($k) == 2) {
        return sprintf("\\x%02X\\x%02X", ord($k[0]), ord($k[1]));
    } else {
        return sprintf("\\x%02X\\x%02X\\x%02X", ord($k[0]), ord($k[1]), ord($k[2]));
    }
}
for ($i = 0; $i < count($arg["_"]); $i += 2) {
    $sin = $arg["_"][$i];
    $sout = trim(get_s($arg["_"], $i + 1));
    if ($sin !== "" && is_numeric($sin)) {
        $cp = (int) $sin;
Esempio n. 4
0
<?php

$ConfSitePATH = preg_replace(',/batch/[^/]+,', '', __FILE__);
require_once "{$ConfSitePATH}/src/init.php";
require_once "{$ConfSitePATH}/lib/getopt.php";
$arg = getopt_rest($argv, "hn:qe", array("help", "name:", "quiet", "extensions"));
if (isset($arg["h"]) || isset($arg["help"])) {
    fwrite(STDOUT, "Usage: php batch/s3test.php [-q] [--extensions] [FILE...]\n");
    exit(0);
}
$quiet = isset($arg["q"]) || isset($arg["quiet"]);
$extensions = isset($arg["e"]) || isset($arg["extensions"]);
if (!$Conf->setting_data("s3_bucket")) {
    fwrite(STDERR, "* S3 is not configured for this conference\n");
    exit(1);
}
if (count($arg["_"]) == 0) {
    $arg["_"] = array("-");
}
$s3doc = HotCRPDocument::s3_document();
$ok = 0;
foreach ($arg["_"] as $fn) {
    if ($fn === "-") {
        $content = @stream_get_contents(STDIN);
    } else {
        $content = @file_get_contents($fn);
    }
    if ($content === false) {
        $error = error_get_last();
        $fn = $fn === "-" ? "<stdin>" : $fn;
        if (!$quiet) {
<?php

$ConfSitePATH = preg_replace(',/batch/[^/]+,', '', __FILE__);
require_once "{$ConfSitePATH}/src/init.php";
require_once "{$ConfSitePATH}/lib/getopt.php";
$arg = getopt_rest($argv, "hn:q", array("help", "name:", "quiet", "disable", "disable-users"));
if (isset($arg["h"]) || isset($arg["help"]) || count($arg["_"]) > 1 || count($arg["_"]) && $arg["_"][0] !== "-" && $arg["_"][0][0] === "-") {
    fwrite(STDOUT, "Usage: php batch/savepapers.php [-n CONFID] [--disable-users] FILE\n");
    exit(0);
}
$file = count($arg["_"]) ? $arg["_"][0] : "-";
$quiet = isset($arg["q"]) || isset($arg["quiet"]);
$disable_users = isset($arg["disable"]) || isset($arg["disable-users"]);
if ($file === "-") {
    $content = stream_get_contents(STDIN);
} else {
    $content = file_get_contents($file);
}
if ($content === false) {
    fwrite(STDERR, "{$file}: Read error\n");
    exit(1);
}
if (($jp = json_decode($content)) === false) {
    fwrite(STDERR, "{$file}: bad JSON (" . json_last_error_msg() . ")\n");
    exit(1);
}
if (is_object($jp)) {
    $jp = array($jp);
}
$index = 0;
foreach ($jp as $j) {
Esempio n. 6
0
<?php

$ConfSitePATH = preg_replace(',/batch/[^/]+,', '', __FILE__);
require_once "{$ConfSitePATH}/src/init.php";
require_once "{$ConfSitePATH}/lib/getopt.php";
$arg = getopt_rest($argv, "hn:m:p:d:f:", array("help", "name:", "mimetype:", "paper:", "dtype:", "filename:", "no-file-storage"));
if (!isset($arg["d"])) {
    $arg["d"] = @$arg["dtype"] ? $arg["dtype"] : "0";
}
if (!isset($arg["p"])) {
    $arg["p"] = @$arg["paper"] ? $arg["paper"] : "0";
}
if (!isset($arg["f"])) {
    $arg["f"] = @$arg["filename"];
}
if (!isset($arg["m"])) {
    $arg["m"] = @$arg["mimetype"];
}
if (isset($arg["h"]) || isset($arg["help"]) || !is_numeric($arg["d"]) || !is_numeric($arg["p"]) || count($arg["_"]) > 1 || count($arg["_"]) && $arg["_"][0] !== "-" && $arg["_"][0][0] === "-") {
    $status = isset($arg["h"]) || isset($arg["help"]) ? 0 : 1;
    fwrite($status ? STDERR : STDOUT, "Usage: php batch/adddoc.php [-n CONFID] [-p PID] [-m MIMETYPE] [-d DTYPE] [--no-file-storage] FILE\n");
    exit($status);
}
$file = count($arg["_"]) ? $arg["_"][0] : "-";
if ($file === "-") {
    $content = stream_get_contents(STDIN);
} else {
    $content = file_get_contents($file);
}
if ($content === false) {
    fwrite(STDERR, "{$file}: Read error\n");