$info = $rex->getCurrent(ltrim($path, '/')); if (!$info) { webfiles_error(404, 'Not found'); } $info2 = clone $info; unset($info2->body); unset($info2->name); if (!session_allowed($info2, 'rw')) { webfiles_error(403, 'Forbidden'); } $lock = webfiles_lock($path); if ($lock && $lock->owner != session_username()) { webfiles_error(409, 'Conflict'); } // todo: delete directories $res = $rex->delete(ltrim($path, '/')); if (!$res) { webfiles_error(500, $rex->error); } webfiles_workflow('delete', $info->name, $info, 'Deleted via the Sitellite Desktop'); webfiles_response(true); break; case 'edit': list($path, $body) = webfiles_request(); $info = $rex->getCurrent(ltrim($path, '/')); if (!$info) { webfiles_error(404, 'Not found'); } $info2 = clone $info; unset($info2->body); unset($info2->name);
} if (!$parameters['_key']) { page_title(intl_get('No Items Selected')); echo '<p><a href="#" onclick="history.go (-1)">' . intl_get('Back') . '</a></p>'; return; } if (!is_array($parameters['_key'])) { if (strpos($rex->key, ',') !== false) { $pkeys = preg_split('/, ?/', $rex->key); $pvals = explode('|', $parameters['_key']); $parameters['_key'] = array(); for ($i = 0; $i < count($pkeys); $i++) { $parameters['_key'][$pkeys[$i]] = $pvals[$i]; } } if (!$rex->delete($parameters['_key'])) { page_title(intl_get('An Error Occurred')); echo '<p>' . $rex->error . '</p>'; return; } $parameters['_key'] = array($parameters['_key']); } else { $failed = array(); foreach ($parameters['_key'] as $id) { if (strpos($rex->key, ',') !== false) { $pkeys = preg_split('/, ?/', $rex->key); $pvals = explode('|', $id); $id = array(); for ($i = 0; $i < count($pkeys); $i++) { $id[$pkeys[$i]] = $pvals[$i]; }