Beispiel #1
0
dbg_error_log("MOVE", "method handler");
require_once 'DAVResource.php';
$request->NeedPrivilege('DAV::unbind');
if (!ini_get('open_basedir') && (isset($c->dbg['ALL']) || isset($c->dbg['move']) && $c->dbg['move'])) {
    $fh = fopen('/var/log/davical/MOVE.debug', 'w');
    if ($fh) {
        fwrite($fh, $request->raw_post);
        fclose($fh);
    }
}
$lock_opener = $request->FailIfLocked();
$dest = new DAVResource($request->destination);
if ($dest->dav_name() == '/' || $dest->IsPrincipal()) {
    $dest->NeedPrivilege('DAV::bind');
}
if (!$dest->ContainerExists()) {
    $request->DoResponse(409, translate('Destination collection does not exist'));
}
if (!$request->overwrite && $dest->Exists()) {
    $request->DoResponse(412, translate('Not overwriting existing destination resource'));
}
if (isset($request->etag_none_match) && $request->etag_none_match != '*') {
    $request->DoResponse(412);
    /** request to move, but only if there is no source? WTF! */
}
$src = new DAVResource($request->path);
if (!$src->Exists()) {
    $request->DoResponse(412, translate('Source resource does not exist.'));
}
if ($src->IsCollection()) {
    switch ($dest->ContainerType()) {