예제 #1
0
}
$name = pieBeautifyName(pieGetOption($name));
$_REQUEST['file'] = $name;
$file = new File();
if (!@$_REQUEST['form']) {
    // Determine the maximum uploadable file size.
    $a = ini_get("post_max_size");
    if (preg_match('/^(\\d+)[Mm]$/', $a, $m)) {
        $a = $m[1] * 1048576;
    }
    $b = ini_get("upload_max_filesize");
    if (preg_match('/^(\\d+)[Mm]$/', $b, $m)) {
        $b = $m[1] * 1048576;
    }
    $a = min($a, $b);
    $b = pieMakeSize($a);
    $data = array('maxsize' => $a, 'uploadsize' => $b);
    if (@$_REQUEST['create']) {
        $data['append'] = 'checked="checked" disabled="disabled" ';
    } else {
        $data['append'] = 'checked="checked" ';
    }
    $data['comment'] = $GLOBALS['pie']['locale']->key("InitialVersion");
    if ($file->isValidName($name)) {
        // A file name is being provided.
        $name = pieBeautifyName($name);
        if ($file->exists($name)) {
            // An update of an existing file.
            $file->read($name, 0);
            if ($file->meta['author'] != $GLOBALS['pie']['user']) {
                $data['append'] = 'checked="checked" disabled="disabled" ';
예제 #2
0
if (intval(@$_REQUEST['stamp']) > 0) {
    $stamp = $_REQUEST['stamp'];
} else {
    $stamp = 0;
}
$file->read($_REQUEST['file'], $stamp);
$stamp = $file->meta['stamp'];
// Check for alias:
if ($file->meta['type'] == "alias") {
    pieError("AliasRedirect", array('file' => htmlspecialchars($file->meta['original']), 'alias' => htmlspecialchars($_REQUEST['file'])));
}
// Prepare output:
$data = array('name' => htmlspecialchars($file->name));
$data['date'] = date($GLOBALS['pie']['time_format'], $file->meta['stamp']);
$data['author'] = htmlspecialchars($file->meta['author']);
$data['size'] = pieMakeSize($file->meta['size']);
if (preg_match('/.*\\.([0-9a-z]{1,5})$/', $file->name, $match)) {
    $data['type'] = strtoupper($match[1]);
} else {
    $data['type'] = $GLOBALS['pie']['locale']->key("BinaryFile");
}
if (preg_match('%^(\\w+)/.*$%', $file->meta['type'], $match)) {
    $data['kind'] = $GLOBALS['pie']['locale']->key(ucfirst($match[1]) . 'File');
}
if ($file->meta['comment']) {
    $data['comment'] = htmlspecialchars($file->meta['comment']);
} else {
    $data['comment'] = "—";
}
$history = $file->history($file->name);
$data['history_count'] = count($history);
예제 #3
0
                }
            }
            if (!importFile($path, $meta)) {
                pieError("ImportError", array('file' => htmlspecialchars($file)));
            }
            $count++;
            $size += filesize($path);
        }
    }
} else {
    // Retrieve the list of files of the FILE path.
    if (!($list = getFileList($_REQUEST['filepath']))) {
        pieError("ImportError");
    }
    // Validate if the files already exist.
    $num = checkFiles($list);
    $count = 0;
    $size = 0;
    // Import the files of the list.
    foreach ($list as $file) {
        $path = $_REQUEST['filepath'] . "/{$file}";
        if (!importFile($path, array())) {
            pieError("ImportError", array('file' => htmlspecialchars($file)));
        }
        $count++;
        $size += filesize($path);
    }
}
pieLog("alter");
pieNotice("ImportSuccess", array('num' => $num, 'count' => $count, 'size' => pieMakeSize($size)));
pieTail();