From df8c69f73b54d33ba2bec7d227f6e6f948f4b451 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 24 May 2017 22:24:45 -0700 Subject: [PATCH] some minor help cleanup - add '-/foo' override of language detection --- Zotlabs/Module/Help.php | 74 ++++++++++++++++++++--------------------- include/help.php | 13 +++++--- 2 files changed, 45 insertions(+), 42 deletions(-) diff --git a/Zotlabs/Module/Help.php b/Zotlabs/Module/Help.php index e247416d9..0373a4aab 100644 --- a/Zotlabs/Module/Help.php +++ b/Zotlabs/Module/Help.php @@ -44,42 +44,42 @@ class Help extends \Zotlabs\Web\Controller { return $o; } - - - if(argc() > 2 && argv(argc()-2) === 'assets') { - $path = ''; - for($x = 1; $x < argc(); $x ++) { - if(strlen($path)) - $path .= '/'; - $path .= argv($x); - } - $realpath = 'doc/' . $path; - //Set the content-type header as appropriate - $imageInfo = getimagesize($realpath); - switch ($imageInfo[2]) { - case IMAGETYPE_JPEG: - header("Content-Type: image/jpeg"); - break; - case IMAGETYPE_GIF: - header("Content-Type: image/gif"); - break; - case IMAGETYPE_PNG: - header("Content-Type: image/png"); - break; - default: - break; - } - header("Content-Length: " . filesize($realpath)); + + + if(argc() > 2 && argv(argc()-2) === 'assets') { + $path = ''; + for($x = 1; $x < argc(); $x ++) { + if(strlen($path)) + $path .= '/'; + $path .= argv($x); + } + $realpath = 'doc/' . $path; + //Set the content-type header as appropriate + $imageInfo = getimagesize($realpath); + switch ($imageInfo[2]) { + case IMAGETYPE_JPEG: + header("Content-Type: image/jpeg"); + break; + case IMAGETYPE_GIF: + header("Content-Type: image/gif"); + break; + case IMAGETYPE_PNG: + header("Content-Type: image/png"); + break; + default: + break; + } + header("Content-Length: " . filesize($realpath)); - // dump the picture and stop the script - readfile($realpath); - killme(); - } + // dump the picture and stop the script + readfile($realpath); + killme(); + } $headings = [ - 'about' => t('About'), - 'member' => t('Members'), - 'admin' => t('Administrators'), + 'about' => t('About'), + 'member' => t('Members'), + 'admin' => t('Administrators'), 'developer' => t('Developers'), 'tutorials' => t('Tutorials') ]; @@ -87,13 +87,13 @@ class Help extends \Zotlabs\Web\Controller { if(array_key_exists(argv(1), $headings)) $heading = $headings[argv(1)]; - $content = get_help_content(); + $content = get_help_content(); return replace_macros(get_markup_template('help.tpl'), array( - '$title' => t('$Projectname Documentation'), + '$title' => t('$Projectname Documentation'), '$tocHeading' => t('Contents'), - '$content' => $content, - '$heading' => $heading + '$content' => $content, + '$heading' => $heading )); } diff --git a/include/help.php b/include/help.php index ab31e9400..4f9251b1b 100644 --- a/include/help.php +++ b/include/help.php @@ -116,9 +116,11 @@ function load_doc_file($s) { $b = basename($s); $d = dirname($s); - $c = find_doc_file("$d/$lang/$b"); - if($c) - return $c; + if($dirname !== '-') { + $c = find_doc_file("$d/$lang/$b"); + if($c) + return $c; + } $c = find_doc_file($s); if($c) return $c; @@ -140,8 +142,8 @@ function find_doc_file($s) { */ function search_doc_files($s) { - $itemspage = get_pconfig(local_channel(),'system','itemspage'); - \App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); + + \App::set_pager_itemspage(60); $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start'])); $regexop = db_getfunc('REGEXP'); @@ -198,6 +200,7 @@ function doc_rank_sort($s1, $s2) { * * @return string */ + function load_context_help() { $path = App::$cmd;