Esempio n. 1
0
function plugin_newpage_subdir_convert()
{
    global $vars;
    $available_option = "rdhq";
    // parsing all parameters
    foreach (func_get_args() as $arg) {
        $arg = trim($arg);
        // options
        if (preg_match("/^\\-[a-z\\-\\s]+\$/", $arg)) {
            for ($i = 1; $i < strlen($arg); $i++) {
                switch ($arg[$i]) {
                    case 'd':
                        $option['directory only'] |= 1;
                        break;
                    case 'q':
                        $option['quiet'] |= 1;
                        break;
                    case ' ':
                    case '-':
                        break;
                    case 'h':
                    default:
                        $option['help'] |= 1;
                        break;
                        break;
                }
            }
        } else {
            $roots[] = $arg;
        }
    }
    if ($option['help']) {
        return print_help_message();
    }
    if (!$roots) {
        $roots[] = strip_bracket($vars["page"]);
    }
    return print_form_string(build_directory_list($roots, $option));
}
Esempio n. 2
0
function plugin_newpage_subdir_convert()
{
    global $vars, $_string;
    // $available_option = 'rdhq';
    if (Auth::check_role('readonly') || Auth::is_check_role(PKWK_CREATE_PAGE)) {
        return sprintf($_string['error_prohibit'], 'Readonly');
    }
    $roots = $option = array();
    // parsing all parameters
    foreach (func_get_args() as $arg) {
        $arg = trim($arg);
        // options
        if (preg_match("/^\\-[a-z\\-\\s]+\$/", $arg)) {
            for ($i = 1; $i < strlen($arg); $i++) {
                switch ($arg[$i]) {
                    case 'd':
                        $option['directory only'] = true;
                        break;
                    case 'q':
                        $option['quiet'] = true;
                        break;
                    case ' ':
                    case '-':
                        break;
                    default:
                        return print_help_message();
                }
            }
        } else {
            $roots[] = $arg;
        }
    }
    //if(!$roots) {
    if (isset($vars['page'])) {
        // $roots[] = strip_bracket($vars['page']);
        $roots[] = $vars['page'];
    }
    return print_form_string(build_directory_list($roots, $option));
}