| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
require '../include/class.vfs.php'; |
|---|
| 22 |
require '../include/ispcp-lib.php'; |
|---|
| 23 |
|
|---|
| 24 |
check_login(__FILE__); |
|---|
| 25 |
|
|---|
| 26 |
$tpl = new pTemplate(); |
|---|
| 27 |
$tpl->define_dynamic('page_message', 'page'); |
|---|
| 28 |
$tpl->define_dynamic('logged_from', 'page'); |
|---|
| 29 |
$tpl->define_dynamic('dir_item', 'page'); |
|---|
| 30 |
$tpl->define_dynamic('action_link', 'page'); |
|---|
| 31 |
$tpl->define_dynamic('list_item', 'page'); |
|---|
| 32 |
$tpl->define_dynamic('page', Config::get('CLIENT_TEMPLATE_PATH') . '/ftp_choose_dir.tpl'); |
|---|
| 33 |
|
|---|
| 34 |
$theme_color = Config::get('USER_INITIAL_THEME'); |
|---|
| 35 |
|
|---|
| 36 |
function gen_directories(&$tpl) { |
|---|
| 37 |
$sql = Database::getInstance(); |
|---|
| 38 |
|
|---|
| 39 |
$path = isset($_GET['cur_dir']) ? $_GET['cur_dir'] : ''; |
|---|
| 40 |
$domain = $_SESSION['user_logged']; |
|---|
| 41 |
|
|---|
| 42 |
$vfs = &new vfs($domain, $sql); |
|---|
| 43 |
|
|---|
| 44 |
$list = $vfs->ls($path); |
|---|
| 45 |
if (!$list) { |
|---|
| 46 |
set_page_message(tr('Can not open directory !<br>Please contact your administrator !')); |
|---|
| 47 |
return; |
|---|
| 48 |
} |
|---|
| 49 |
|
|---|
| 50 |
$parent = explode('/', $path); |
|---|
| 51 |
array_pop($parent); |
|---|
| 52 |
$parent = implode('/', $parent); |
|---|
| 53 |
$tpl->assign('ACTION_LINK', ''); |
|---|
| 54 |
$tpl->assign(array('ACTION' => '', |
|---|
| 55 |
'ICON' => "parent", |
|---|
| 56 |
'DIR_NAME' => tr('Parent Directory'), |
|---|
| 57 |
'LINK' => 'ftp_choose_dir.php?cur_dir=' . $parent, |
|---|
| 58 |
)); |
|---|
| 59 |
$tpl->parse('DIR_ITEM', '.dir_item'); |
|---|
| 60 |
|
|---|
| 61 |
foreach ($list as $entry) { |
|---|
| 62 |
|
|---|
| 63 |
if ($entry['type'] != VFS_TYPE_DIR) |
|---|
| 64 |
continue; |
|---|
| 65 |
|
|---|
| 66 |
if ($entry['file'] == '.' || $entry['file'] == '..') |
|---|
| 67 |
continue; |
|---|
| 68 |
|
|---|
| 69 |
$dr = $path . '/' . $entry['file']; |
|---|
| 70 |
$tfile = $dr . '/.htaccess'; |
|---|
| 71 |
if ($vfs->exists($tfile)) { |
|---|
| 72 |
$image = "locked"; |
|---|
| 73 |
} else { |
|---|
| 74 |
$image = "folder"; |
|---|
| 75 |
} |
|---|
| 76 |
|
|---|
| 77 |
$tpl->assign(array('ACTION' => tr('Protect it'), |
|---|
| 78 |
'PROTECT_IT' => "protected_areas_add.php?file=$dr", |
|---|
| 79 |
'ICON' => $image, |
|---|
| 80 |
'DIR_NAME' => $entry['file'], |
|---|
| 81 |
'CHOOSE_IT' => $dr, |
|---|
| 82 |
'LINK' => "ftp_choose_dir.php?cur_dir=$dr", |
|---|
| 83 |
)); |
|---|
| 84 |
$tpl->parse('ACTION_LINK', 'action_link'); |
|---|
| 85 |
$tpl->parse('DIR_ITEM' , '.dir_item'); |
|---|
| 86 |
} |
|---|
| 87 |
} |
|---|
| 88 |
|
|---|
| 89 |
$tpl->assign( |
|---|
| 90 |
array('TR_CLIENT_WEBTOOLS_PAGE_TITLE' => tr('ispCP - Client/Webtools'), |
|---|
| 91 |
'THEME_COLOR_PATH' => "../themes/$theme_color", |
|---|
| 92 |
'THEME_CHARSET' => tr('encoding'), |
|---|
| 93 |
'ISP_LOGO' => get_logo($_SESSION['user_id']) |
|---|
| 94 |
) |
|---|
| 95 |
); |
|---|
| 96 |
|
|---|
| 97 |
gen_directories($tpl); |
|---|
| 98 |
|
|---|
| 99 |
$tpl->assign( |
|---|
| 100 |
array('TR_DIRECTORY_TREE' => tr('Directory tree'), |
|---|
| 101 |
'TR_DIRS' => tr('Directories'), |
|---|
| 102 |
'TR__ACTION' => tr('Action'), |
|---|
| 103 |
'CHOOSE' => tr('Choose') |
|---|
| 104 |
) |
|---|
| 105 |
); |
|---|
| 106 |
|
|---|
| 107 |
gen_page_message($tpl); |
|---|
| 108 |
|
|---|
| 109 |
$tpl->parse('PAGE', 'page'); |
|---|
| 110 |
$tpl->prnt(); |
|---|
| 111 |
|
|---|
| 112 |
if (Config::get('DUMP_GUI_DEBUG')) |
|---|
| 113 |
dump_gui_debug(); |
|---|
| 114 |
|
|---|
| 115 |
unset_messages(); |
|---|
| 116 |
|
|---|
| 117 |
?> |
|---|