Exemplo n.º 1
0
            }
        }
        Tygh::$app['ajax']->assign('files_list', $files_list);
    }
    exit;
} elseif ($mode == 'browse') {
    $dir = empty($_REQUEST['dir']) ? '' : '/' . $_REQUEST['dir'];
    $tpath = fn_normalize_path($root_dir . $dir);
    if (fn_te_check_path($tpath) === false) {
        $tpath = $root_dir;
        $current_path = '';
        $dir = '';
    }
    $current_path = empty($dir) ? '' : $dir . '/';
    $current_path = fn_normalize_path($current_path);
    $items = fn_te_read_dir($tpath, $root_dir);
    Tygh::$app['view']->assign('current_path', str_replace($root_dir, '', $tpath));
    Tygh::$app['view']->assign('items', $items);
    Tygh::$app['ajax']->assign('current_path', str_replace($root_dir, '', $tpath));
    Tygh::$app['ajax']->assign('files_list', Tygh::$app['view']->fetch('views/templates/components/file_list.tpl'));
    exit;
} elseif ($mode == 'delete_file') {
    $fname = fn_te_normalize_path($_REQUEST, $root_dir);
    $fn_name = @is_dir($fname) ? 'fn_rm' : 'unlink';
    $object = @is_dir($fname) ? 'directory' : 'file';
    if (!in_array(fn_strtolower(fn_get_file_ext($fname)), Registry::get('config.forbidden_file_extensions'))) {
        if (fn_te_check_path($fname) && @$fn_name($fname)) {
            fn_set_notification('N', __('notice'), __("text_{$object}_deleted", array("[{$object}]" => fn_basename($fname))));
        } else {
            fn_set_notification('E', __('error'), __("text_cannot_delete_{$object}", array("[{$object}]" => fn_basename($fname))));
        }
Exemplo n.º 2
0
            }
        }
        Registry::get('ajax')->assign('files_list', $files_list);
    }
    exit;
} elseif ($mode == 'browse') {
    $dir = empty($_REQUEST['dir']) ? '' : '/' . $_REQUEST['dir'];
    $tpath = fn_normalize_path($section_root_dir . $dir);
    if (fn_te_check_path($tpath, $_SESSION['active_section']) === false) {
        $tpath = $section_root_dir;
        $current_path = '';
        $dir = '';
    }
    $current_path = empty($dir) ? '' : $dir . '/';
    $current_path = fn_normalize_path($current_path);
    $items = fn_te_read_dir($tpath, $section_root_dir, $_SESSION['active_section']);
    Registry::get('view')->assign('current_path', str_replace($section_root_dir, '', $tpath));
    Registry::get('view')->assign('items', $items);
    Registry::get('ajax')->assign('current_path', str_replace($section_root_dir, '', $tpath));
    Registry::get('ajax')->assign('files_list', Registry::get('view')->fetch('views/file_editor/components/file_list.tpl'));
    exit;
} elseif ($mode == 'delete_file') {
    $fname = fn_te_normalize_path($_REQUEST, $section_root_dir);
    $fn_name = @is_dir($fname) ? 'fn_rm' : 'unlink';
    $object = @is_dir($fname) ? 'directory' : 'file';
    if (!in_array(fn_strtolower(fn_get_file_ext($fname)), Registry::get('config.forbidden_file_extensions'))) {
        if (fn_te_check_path($fname, $_SESSION['active_section']) && @$fn_name($fname)) {
            fn_set_notification('N', __('notice'), __("text_{$object}_deleted", array("[{$object}]" => fn_basename($fname))));
        } else {
            fn_set_notification('E', __('error'), __("text_cannot_delete_{$object}", array("[{$object}]" => fn_basename($fname))));
        }