function getPathId($path)
{
    global $knownpaths;
    if (!$knownpaths[$path]) {
        $id = Paths::getPathId($path, false);
        if (DB::isError($id)) {
            die($id->getUserInfo() . "\n");
        }
        $knownpaths[$path] = $id;
    }
    //    if ($id < 0) { die("File id is < 0\n"); }
    return $knownpaths[$path];
}
Esempio n. 2
0
function startElementXML($parser, $name, $attrs)
{
    global $currentdir, $files, $paths, $rankcounts, $knownpaths;
    // Get the rank
    $depth = sizeof($rankcounts);
    $ranks =& $rankcounts[$depth - 1];
    $rank = $ranks[$name] = $ranks[$name] + 1;
    $path = $paths[$depth - 1] . "/{$name}[{$rank}]";
    if (!$knownpaths[$path]) {
        Paths::getPathId($path, true);
    }
    array_push($paths, $path);
    array_push($rankcounts, array());
}
Esempio n. 3
0
echo sizeof($toremove);
?>
 assessment(s) removed");
</script>

<?
   if (!DB::isError($res)) {
      // Save history (non blocking process)
      $xrai_db->autoCommit(true);
      $error=false;
      foreach($hist as $h) {
         if ($do_debug) print "<div>Saving hist $h</div>\n";
         $h = split(',',$h);
         while (true) {
            $res = $startid = Paths::getPathId($h[2]); if (DB::isError($startid)) break;
            $res = $endid = Paths::getPathId($h[3]); if (DB::isError($endid)) break;
            $res = $xrai_db->autoExecute($db_log, array("idpool" => $assessments->idPool, "idfile" => $assessments->idFile,
                     "startpath" => $startid, "endpath" => $endid, "action" => $h[0], "time" => $h[1]));
            break;
         }
         if (DB::isError($res)) {
            if ($do_debug) print "<div>" . $res->getUserInfo() ."</div>";
            $error = true;
         }
      }
      if ($error) {
         ?><script type="text/javascript">
            ref.Message.show("warning","Error while saving history.");
         </script><?
      }
   }
Esempio n. 4
0
    }
}
if (sizeof($_SERVER["argv"]) - $i != 6) {
    die("addPool [-update <poolid>] <state> <userid> <name> <default collection> <pool file>\n");
}
$poolstate = $_SERVER["argv"][1 + $i];
$userid = $_SERVER["argv"][2 + $i];
$poolname = $_SERVER["argv"][3 + $i];
$collection = $_SERVER["argv"][4 + $i];
$filename = $_SERVER["argv"][5 + $i];
if (!is_file($filename)) {
    die("'{$filename}' is not a file\n");
}
$xrai_db->autoCommit(false);
print "Starting processing of pool file '{$filename}'\n";
$emptypathid = Paths::getPathId("", true);
// ==================================================
// Parse of file
function getFileId($path)
{
    global $collection;
    $idFile = Files::getFileId($collection, $path, false);
    if (DB::isError($idFile)) {
        die($idFile->getUserInfo() . "\n");
    }
    if ($idFile < 0) {
        print "File '{$collection}, {$path}' id is < 0\n";
    }
    return $idFile;
}
$file = -1;