Exemplo n.º 1
0
 function fromDB()
 {
     global $LNK;
     if (!isset($this->fileid) or $this->fileid < 0) {
         $e = new FileCopyMessage(__FILE__ . '@' . __LINE__ . ': fileid is not valid in fromDB()', 'WARN');
         return false;
     }
     if ($this->version == -1) {
         // neueste Version finden:
         $sql = "SELECT * FROM files WHERE fileid = " . $this->fileid . " ORDER BY version DESC;";
     } else {
         // spezielle Version finden:
         $sql = "SELECT * FROM files WHERE fileid = " . $this->fileid . " AND version = " . $this->version . ";";
     }
     $result = @mysqli_query($LNK, $sql);
     if (!$result) {
         $e = new FileCopyMessage(__FILE__ . "@" . __LINE__ . ": " . mysqli_error($LNK) . " ( SQL = " . $sql . ")", 'WARN');
     }
     if ($row = mysqli_fetch_assoc($result)) {
         $this->version = $row["version"];
         $this->path = $row["path"];
         $this->fname = $row["fname"];
         $this->extension = $row["extension"];
         $this->size = $row["size"];
         $this->ctime = FX::parseDBDate($row["ctime"]);
         $this->mtime = FX::parseDBDate($row["mtime"]);
         $this->status = $row["status"];
         $this->sha1 = $row["sha1"];
     } else {
         return false;
     }
     return true;
 }
Exemplo n.º 2
0
header("Content-Type: text/plain; charset=utf-8");
// error_reporting(E_ERROR);
require dirname(__FILE__) . '/path.inc.php';
require $CONFIG_FILE;
require $PATH . 'classes/FX.php';
require $PATH . 'classes/BackupMain.php';
require $PATH . 'classes/BackupFile.php';
filecopy_connect_db();
// globals holen: evtl. durch etwas anderes ersetzen...
$params = array_merge($_GET, $_POST);
// keine XSS Injection Safety!!! - nicht extern zugänglich machen.
extract($params);
if (isset($d0)) {
    // erwartet einen Parameter in der Form: dateFrom=2007-12-12+08:00:00 , dateTo=2007-12-19+20:59:59
    $timeStampFrom = FX::parseDBDate(str_replace("+", " ", $d0));
    $timeStampTo = FX::parseDBDate(str_replace("+", " ", $d1));
    echo "Dateien, auf die zwischen den Daten " . FX::makeDBDate($timeStampFrom) . " und " . FX::makeDBDate($timeStampTo) . " schreibend zugegriffen wurde.\n";
    $sql = "SELECT path, fname, mtime FROM files WHERE " . "(mtime > '" . FX::makeDBDate($timeStampFrom) . "') " . " AND (mtime < '" . FX::makeDBDate($timeStampTo) . "') " . " AND (status='C')" . " ORDER BY mtime DESC;";
    $result = @mysqli_query($LNK, $sql);
    if (!$result) {
        errlog(__FILE__ . "@" . __LINE__ . ": " . mysqli_error($LNK) . " ( SQL = " . $sql . ")");
    }
    while ($row = mysqli_fetch_assoc($result)) {
        extract($row);
        echo $path . "/" . $fname . " [" . $mtime . "]" . "\n";
    }
}
if (isset($sameName)) {
    echo "Dateien mit dem Namen " . FX::html_encode($sameName) . " existieren in den Verzeichnissen:\n";
    $sql = "SELECT path, size FROM files WHERE fname LIKE '" . mysqli_escape_string($LNK, $sameName) . "' AND status='C';";
    $result = @mysqli_query($LNK, $sql);