Example #1
0
}
$_REQUEST['limit'] = intval($_REQUEST['limit']);
if ($_REQUEST['offset']) {
    $_REQUEST['offset'] = intval($_REQUEST['offset']);
} else {
    $_REQUEST['offset'] = 0;
}
if (!$_REQUEST['sort'] && !@$_REQUEST['order']) {
    $_REQUEST['sort'] = "name";
    $_REQUEST['order'] = "ascend";
}
// Retrieve all files...
$file = new File();
$data = array();
$max = 0;
for ($name = $file->first(); $name; $name = $file->next()) {
    $max++;
    $data[$name] = $file->stamp;
}
if ($max < 1) {
    pieError("NoFiles");
}
// ... and sort them.
if ($_REQUEST['sort'] == "name" && $_REQUEST['order'] == "descend") {
    krsort($data);
} elseif ($_REQUEST['sort'] == "name") {
    ksort($data);
} elseif ($_REQUEST['sort'] == "date" && $_REQUEST['order'] == "descend") {
    arsort($data);
} elseif ($_REQUEST['sort'] == "date") {
    asort($data);
Example #2
0
        pieError("ErrorExists", array('original' => htmlspecialchars($original), 'alias' => htmlspecialchars($alias), 'context' => $context));
    }
    if (!$resource->read($alias, 0)) {
        pieError("SourceReadError");
    }
    $data = array_map('htmlspecialchars', $resource->meta);
    $data['alias'] = htmlspecialchars($alias);
    $data['stamp'] = date($GLOBALS['pie']['time_format'], $data['stamp']);
    $data['context'] = $context;
    pieNotice("AliasInfo", $data);
    pieError("CreateAlias", array('original' => htmlspecialchars($original), 'context' => $context));
} elseif (@$original) {
    // Display information about the resource.
    // Built a list of all aliases of the resource.
    $aliases = array();
    for ($i = $resource->first(); $i; $i = $resource->next()) {
        if ($resource->read($i, 0) === false) {
            pieError("SourceReadError");
        }
        if ($resource->meta['type'] != 'alias') {
            continue;
        }
        if ($resource->meta['original'] != $original) {
            continue;
        }
        $aliases[] = $i;
    }
    if (!count($aliases)) {
        if (@$is_alias) {
            pieTail();
            exit;