<?php $tpl = new RFSmarty(); $valid_directories = $GLOBALS['RFP']->directoriesForUser($_SESSION['pidm']); $tpl->assign('valid_directories', $valid_directories); $tpl->assign('title', 'Directories on <span>' . $GLOBALS['SSH_HOST'] . '</span>'); $tpl->assign('servers', $GLOBALS['RFP']->servers()); $tpl->assign('content', 'index'); $tpl->display('_wrapper.tpl'); // vim:ts=2:sw=2:noet:
<?php $path = stripslashes($_GET['path']); $parent = dirname($path) . '/'; $redirect = (int) $_GET['redirect']; $confirmed = (int) $_GET['confirmed']; $file = basename($path); $json = array(); // result array $log_data = array('action' => 'unlink', 'path' => $path); if ($confirmed !== 1) { $tpl = new RFSmarty(); $path = $_GET['path']; $tpl->assign('path', $path); $tpl->assign('title', 'Unlink ' . $path); $tpl->assign('parent', $parent); $tpl->assign('content', 'unlink'); $tpl->display('_wrapper.tpl'); exit; } // check for a directory argument if (substr($path, -1) == '/') { $json['error'] = true; $json['message'] = 'Script refuses to delete a directory.'; // log this action $log_data['result'] = 'failure'; rf_log($log_data); if ($redirect) { $_SESSION['errors'][] = $json['message']; PSUHTML::redirect($GLOBALS['BASE_URL'] . '/' . $GLOBALS['SSH_HOST'] . ':browse' . $parent); } else {
<?php $tpl = new RFSmarty(); $sort = isset($_GET['sort']) ? $_GET['sort'] : 'name'; $order = isset($_GET['order']) ? $_GET['order'] : 'asc'; $dirpath = $path = $_GET['path']; if ($GLOBALS['RFP']->type($path) == 'dir' && substr($path, -1) !== '/') { PSUHTML::redirect($GLOBALS['BASE_URL'] . '/' . $GLOBALS['SSH_HOST'] . ':browse' . $path . '/'); } if (substr($path, -1) != '/') { $dirpath = dirname($path) . '/'; } $filter = $dirpath == $path ? '' : substr($path, strlen($dirpath)); try { if ($GLOBALS['RFP']->canWrite($_SESSION['pidm'], $path)) { $tpl->assign('can_write', true); } } catch (RFException $e) { } // dummy class for our exceptions class ListingException extends Exception { } $response = array('exit_code' => 0); $log_data = array('action' => 'browse', 'path' => $path, 'result' => null); try { if (!$GLOBALS['RFP']->canRead($_SESSION['pidm'], $path)) { $log_data['result'] = 'denied'; throw new ListingException('You are not allowed to view this directory.', 1); } $parent = dirname($dirpath) . '/';