function testArgs()
{
    global $status;
    $CUSTOM = custom::instance();
    $dspaceBatch = $CUSTOM->getDspaceBatch();
    $bgindicator = $CUSTOM->getBgindicator();
    if (count($_POST) == 0) {
        return;
    }
    $coll = util::getPostArg("coll", "");
    $comm = util::getPostArg("comm", "");
    if (is_numeric($coll)) {
        $coll = intval($coll);
        if (!isset(collection::$COLLECTIONS[$coll])) {
            $status = "collection not found";
            return;
        }
        $args = "coll " . $coll;
    } else {
        if (is_numeric($comm)) {
            $comm = intval($comm);
            if (!isset(community::$COMMUNITIES[$comm])) {
                $status = "Community not found";
                return;
            }
            $args = "comm " . $comm;
        } else {
            $status = "A valid collection or community must be selected";
            return;
        }
    }
    $u = escapeshellarg($CUSTOM->getCurrentUser());
    $cmd = <<<HERE
{$u} gu-reindex {$args}
HERE;
    //echo($dspaceBatch . " " . $cmd);
    exec($dspaceBatch . " " . $cmd . " " . $bgindicator);
    header("Location: ../web/queue.php");
}
function testArgs()
{
    global $status;
    global $ingestLoc;
    $CUSTOM = custom::instance();
    $dspaceBatch = $CUSTOM->getDspaceBatch();
    $mroot = $CUSTOM->getMapRoot();
    $bgindicator = $CUSTOM->getBgindicator();
    $coll = util::getPostArg("collection", "");
    $status = custom::instance()->validateCollection($coll);
    if ($status != "") {
        return;
    }
    $zipurl = util::getPostArg("zip", "");
    if ($zipurl == "") {
        $status = "A URL for a Zip File must be provided";
        return;
    }
    $batch = date("Ymd_H.i.s");
    $loc = $ingestLoc . $batch . ".zip";
    $mapfile = $mroot . $batch;
    $u = escapeshellarg($CUSTOM->getCurrentUser());
    $user = escapeshellarg($CUSTOM->getCurrentUserEmail());
    $coll = escapeshellarg($coll);
    $zipurl = escapeshellarg($zipurl);
    $loc = escapeshellarg($loc);
    $mapfile = escapeshellarg($mapfile);
    $mode = util::getPostArg("skipindex", "") == "Y" ? "gu-ingest-zipurl-skipindex" : "gu-ingest-zipurl";
    $cmd = <<<HERE
{$u} {$mode} {$user} {$coll} {$zipurl} {$loc} {$mapfile}
HERE;
    //echo($dspaceBatch . " " .$cmd);
    exec($dspaceBatch . " " . $cmd . " " . $bgindicator);
    header("Location: ../web/queue.php");
}
function testArgs()
{
    global $status;
    global $ingestLoc;
    $CUSTOM = custom::instance();
    $dspaceBatch = $CUSTOM->getDspaceBatch();
    $mroot = $CUSTOM->getMapRoot();
    $bgindicator = $CUSTOM->getBgindicator();
    $coll = util::getPostArg("collection", "");
    $status = custom::instance()->validateCollection($coll);
    if ($status != "") {
        return;
    }
    if (count($_POST) == 0) {
        $status = "";
        return;
    }
    if ($_FILES["zip"]["error"]) {
        $name = isset($_FILES["zip"]["tmp_name"]) ? $_FILES["zip"]["tmp_name"] : $_FILES["zip"]["name"];
        $status = "File upload error: " . $_FILES["zip"]["error"] . " on file " . $name;
        return;
    }
    $loc = $ingestLoc . $_FILES["zip"]["name"];
    move_uploaded_file($_FILES["zip"]["tmp_name"], $loc);
    $batch = date("Ymd_H.i.s");
    $mapfile = $mroot . $batch;
    $u = escapeshellarg($CUSTOM->getCurrentUser());
    $user = escapeshellarg($CUSTOM->getCurrentUserEmail());
    $coll = escapeshellarg($coll);
    $loc = escapeshellarg($loc);
    $mapfile = escapeshellarg($mapfile);
    $mode = util::getPostArg("skipindex", "") == "Y" ? "gu-ingest-zip-skipindex" : "gu-ingest-zip";
    $cmd = <<<HERE
{$u} {$mode} {$user} {$coll} {$loc} {$mapfile}
HERE;
    //echo($dspaceBatch . " " .$cmd);
    exec($dspaceBatch . " " . $cmd . " " . $bgindicator);
    header("Location: ../web/queue.php");
}
示例#4
0
function testArgs()
{
    global $status;
    $CUSTOM = custom::instance();
    if (count($_POST) == 0) {
        return;
    }
    $coll = util::getPostArg("coll", "");
    $comm = util::getPostArg("comm", "");
    $format = util::getPostArg("format", "");
    $set = "";
    $statColl = $CUSTOM->validateCollection($coll);
    $statComm = $CUSTOM->validateCollection($comm);
    if ($statColl == "") {
        $set = "col_" . str_replace("/", "_", $coll);
    } else {
        if ($statComm == "") {
            $set = "com_" . str_replace("/", "_", $comm);
        } else {
            $status = "A valid collection or community must be selected";
            return;
        }
    }
    if ($format == "") {
        $status = "A format must be selected";
        return;
    }
    global $OAI;
    header('Content-type: application/xml; charset=UTF-8');
    echo "<ListRecords>";
    getRecords($format, $set);
    echo "</ListRecords>";
    exit;
}
function testArgs()
{
    global $status;
    $CUSTOM = custom::instance();
    $root = $CUSTOM->getRoot();
    $mroot = $CUSTOM->getMapRoot();
    $dspaceBatch = $CUSTOM->getDspaceBatch();
    if (count($_POST) == 0) {
        return;
    }
    $mapfile = util::getPostArg("mapfile", "");
    $u = escapeshellarg($CUSTOM->getCurrentUser());
    $user = escapeshellarg($CUSTOM->getCurrentUserEmail());
    $mapfile = escapeshellarg($mroot . $mapfile);
    $cmd = <<<HERE
{$u} gu-uningest {$user} {$mapfile}
HERE;
    //echo($dspaceBatch . " " .$cmd);
    exec($dspaceBatch . " " . $cmd);
    header("Location: ../web/queue.php");
}
示例#6
0
function testArgs()
{
    global $status;
    global $ingestLoc;
    $CUSTOM = custom::instance();
    $dspaceBatch = $CUSTOM->getDspaceBatch();
    $mroot = $CUSTOM->getMapRoot();
    $bgindicator = $CUSTOM->getBgindicator();
    $coll = util::getPostArg("collection", "");
    $status = custom::instance()->validateCollection($coll);
    if ($status != "") {
        return;
    }
    $loc = util::getPostArg("loc", "");
    if (preg_match("|\\.\\.|", $loc) == 1) {
        $status = "Location [" . $loc . "] may not contain '..'.";
        return;
    }
    if (preg_match("|;|", $loc) == 1) {
        $status = "Location [" . $loc . "] may not contain ';'.";
        return;
    }
    $batch = date("Ymd_H.i.s");
    $mapfile = $mroot . $batch;
    $u = escapeshellarg($CUSTOM->getCurrentUser());
    $user = escapeshellarg($CUSTOM->getCurrentUserEmail());
    $coll = escapeshellarg($coll);
    $loc = escapeshellarg($ingestLoc . $loc);
    $mapfile = escapeshellarg($mapfile);
    $mode = util::getPostArg("skipindex", "") == "Y" ? "gu-ingest-skipindex" : "gu-ingest";
    $cmd = <<<HERE
{$u} {$mode} {$user} {$coll} {$loc} {$mapfile}
HERE;
    //echo($dspaceBatch . " " .$cmd);
    exec($dspaceBatch . " " . $cmd . " " . $bgindicator);
    header("Location: ../web/queue.php");
}
function testArgs()
{
    global $status;
    $CUSTOM = custom::instance();
    $dspaceBatch = $CUSTOM->getDspaceBatch();
    $bgindicator = $CUSTOM->getBgindicator();
    if (count($_POST) == 0) {
        return;
    }
    $coll = util::getPostArg("collection", "");
    $coll = util::getPostArg("collection", "");
    $status = $CUSTOM->validateCollection($coll);
    if ($status != "") {
        return;
    }
    $args = "-v -i " . $coll;
    $arr = util::getPostArg("action", array());
    //if (in_array("actThumb", $arr))	 $args .= " -p TBD";
    if (in_array("actTiles", $arr)) {
        $args .= ' -p ' . escapeshellarg("Decomposed Zoomeable Images");
    }
    if (in_array("actStream", $arr)) {
        $args .= ' -p ' . escapeshellarg("Scribd Upload");
    }
    if (in_array("actText", $arr)) {
        $args .= ' -p ' . escapeshellarg("HTML Text Extractor") . ' -p ' . escapeshellarg("PDF Text Extractor") . ' -p ' . escapeshellarg("PowerPoint Text Extractor") . ' -p ' . escapeshellarg("Word Text Extractor");
    }
    if (in_array("actThumb", $arr)) {
        $args .= ' -p ' . escapeshellarg("ImageMagick Image Thumbnail") . ' -p ' . escapeshellarg("ImageMagick PDF Thumbnail");
    }
    if (util::getPostArg("optForce", false)) {
        $args .= " -f";
    }
    $u = escapeshellarg($CUSTOM->getCurrentUser());
    $cmd = <<<HERE
{$u} filter-media {$args}
HERE;
    //echo($dspaceBatch . " " . $cmd);
    exec($dspaceBatch . " " . $cmd . " " . $bgindicator);
    header("Location: ../web/queue.php");
}
function testArgs()
{
    global $status;
    $CUSTOM = custom::instance();
    $dspaceBatch = $CUSTOM->getDspaceBatch();
    $ingestLoc = $CUSTOM->getIngestLoc();
    if (count($_FILES) == 0) {
        $status = "";
        return;
    }
    if ($_FILES["metadata"]["error"]) {
        $name = isset($_FILES["metadata"]["tmp_name"]) ? $_FILES["metadata"]["tmp_name"] : $_FILES["metadata"]["name"];
        $status = "File upload error: " . $_FILES["metadata"]["error"] . " on file " . $name;
        return;
    }
    $run = util::getPostArg("preview", "") == "" ? "-s" : "";
    $temp = $ingestLoc . $_FILES["metadata"]["name"];
    move_uploaded_file($_FILES["metadata"]["tmp_name"], $temp);
    $temp = escapeshellarg($temp);
    $user = escapeshellarg($CUSTOM->getCurrentUserEmail());
    $u = escapeshellarg($CUSTOM->getCurrentUser());
    $cmd = <<<HERE
{$u} metadata-import -f {$temp} -e {$user} {$run}
HERE;
    //echo($dspaceBatch . " " .$cmd);
    exec($dspaceBatch . " " . $cmd);
    header("Location: ../web/queue.php");
}
function testArgs()
{
    global $status;
    $CUSTOM = custom::instance();
    $dspaceBatch = $CUSTOM->getDspaceBatch();
    $bgindicator = $CUSTOM->getBgindicator();
    if (count($_POST) == 0) {
        return;
    }
    $child = util::getPostArg("child", "");
    if (!is_numeric($child)) {
        return;
    }
    $child = intval($child);
    $parent = util::getPostArg("parent", "");
    if (!is_numeric($parent)) {
        return;
    }
    $parent = intval($parent);
    $currparent = "";
    foreach (community::$COMBO as $obj) {
        if ($obj->community_id == $child) {
            $currparent = $obj->getParent()->community_id;
            break;
        }
    }
    if ($child == "" || $parent == "" || $currparent == "") {
        $status = "Invalid id:  child: {$child}, parent: {$parent}, currparent: {$currparnt}";
        return;
    }
    // test if the child community is the same as the parent community (SD-51)
    if ($child == $parent) {
        $status = "Invalid operation:  child community (id {$child}) and parent community (id {$parent}) are the same.";
        return;
    }
    // test if the child community is an ancestor of the parent community (SD-51)
    if (isAncestor($child, $parent)) {
        $status = "Invalid operation:  child community (id {$child}) is an ancestor of the parent community (id {$parent})";
        return;
    }
    $args = escapeshellarg($child) . " " . escapeshellarg($currparent) . " " . escapeshellarg($parent);
    $u = escapeshellarg($CUSTOM->getCurrentUser());
    $cmd = <<<HERE
{$u} gu-change-parent {$args}
HERE;
    //echo($dspaceBatch . " " . $cmd);
    exec($dspaceBatch . " " . $cmd . " " . $bgindicator);
    header("Location: ../web/queue.php");
}
function testArgs()
{
    global $status;
    $CUSTOM = custom::instance();
    $dspaceBatch = $CUSTOM->getDspaceBatch();
    $bgindicator = $CUSTOM->getBgindicator();
    if (count($_POST) == 0) {
        return;
    }
    $child = util::getPostArg("child", "");
    if (!is_numeric($child)) {
        return;
    }
    $child = intval($child);
    if (!isset(collection::$COLLECTIONS[$child])) {
        return;
    }
    $coll = collection::$COLLECTIONS[$child];
    $currparent = $coll->getParent()->community_id;
    $parent = util::getPostArg("parent", "");
    if (!is_numeric($parent)) {
        return;
    }
    $parent = intval($parent);
    if ($parent == $currparent) {
        return;
    }
    $args = $child . " " . $currparent . " " . $parent;
    $u = escapeshellarg($CUSTOM->getCurrentUser());
    $cmd = <<<HERE
{$u} gu-change-coll-parent {$args}
HERE;
    //echo($dspaceBatch . " " . $cmd);
    exec($dspaceBatch . " " . $cmd . " " . $bgindicator);
    header("Location: ../web/queue.php");
}