Beispiel #1
0
<?php

require_once "includes/db.php";
if (!isset($_POST["batch"])) {
    header("Location: index.php");
    exit;
}
$objDb = new ScannerDB();
$objDb->open();
if (isset($_POST["category"]) || isset($_POST["action"]) && $_POST["action"] == "deduce") {
    $bDeduce = isset($_POST["action"]) && $_POST["action"] == "deduce";
    // Apply changes
    // TODO: Use SQL, not code loop!
    foreach ($_POST["batch"] as $id) {
        if ($bDeduce) {
            $iCat = $objDb->GuessCategoryForDocument($id);
            if ($iCat !== FALSE) {
                $objDb->UpdateDocumentCategory($id, $iCat);
            }
        } else {
            $objDb->UpdateDocumentCategory($id, $_POST["category"]);
        }
    }
    // Go back to main
    header("Location: index.php");
    exit;
}
// Iterate through the data (this should probably display a progressbar
// in the browser, since the user can select a gazillion files.
$aItems = array();
$iCat = FALSE;
Beispiel #2
0
}
if (isset($_GET["autodate"])) {
    $iDate = $objDb->GuessDateForDocument($_GET["id"], $aRes["added"]);
    if ($iDate != 0 && $iDate !== FALSE) {
        $objDb->UpdateDocumentDate($_GET["id"], $iDate);
    }
    header("Location: view.php?id=" . $_GET["id"]);
    exit;
}
if (isset($_GET["resetdate"])) {
    $objDb->UpdateDocumentDate($_GET["id"], 0);
    header("Location: view.php?id=" . $_GET["id"]);
    exit;
}
if (isset($_GET["autocategory"])) {
    $iCat = $objDb->GuessCategoryForDocument($_GET["id"]);
    if ($iCat !== FALSE) {
        $objDb->UpdateDocumentCategory($_GET["id"], $iCat);
    }
    header("Location: view.php?id=" . $_GET["id"]);
    exit;
}
if (isset($_GET["debug"])) {
    $bDebug = TRUE;
} else {
    $bDebug = FALSE;
}
?>
<html>
	<head>
		<title>Viewing document</title>