Example #1
0
    }
}
// This is where the real work starts.
// Decide what to do:
if (@$original && @$alias && @$_REQUEST['create']) {
    if ($resource->exists($alias)) {
        // A resource with the name of the alias already exists.
        pieError("NameCollision", array('context' => $context, 'original' => htmlspecialchars($original), 'alias' => htmlspecialchars($alias)));
    }
    // Create a new alias for the specified resource.
    $resource->meta = array('author' => $GLOBALS['pie']['user']);
    $resource->name = $alias;
    if ($_REQUEST['comment']) {
        $resource->meta['comment'] = pieGetOption($_REQUEST['comment']);
    }
    if (!$resource->makeAlias($original)) {
        pieError("AliasError", array('context' => $context, 'original' => htmlspecialchars($original)));
    }
    pieError("AliasSuccess", array('context' => $context, 'original' => htmlspecialchars($original), 'alias' => htmlspecialchars($alias)));
} elseif ($original && @$_REQUEST['create']) {
    // Display a form to create an alias for the resource.
    pieError("AliasForm", array('original' => htmlspecialchars($original), 'context' => $context));
} elseif (@$original && @$alias) {
    // Display detailed information about the specified alias.
    if (!$resource->exists($alias)) {
        pieError("ErrorExists", array('original' => htmlspecialchars($original), 'alias' => htmlspecialchars($alias), 'context' => $context));
    }
    if (!$resource->read($alias, 0)) {
        pieError("SourceReadError");
    }
    $data = array_map('htmlspecialchars', $resource->meta);