some minor help cleanup - add '-/foo' override of language detection

This commit is contained in:
zotlabs 2017-05-24 22:24:45 -07:00
parent 3a00140797
commit df8c69f73b
2 changed files with 45 additions and 42 deletions

View File

@ -44,42 +44,42 @@ class Help extends \Zotlabs\Web\Controller {
return $o; return $o;
} }
if(argc() > 2 && argv(argc()-2) === 'assets') { if(argc() > 2 && argv(argc()-2) === 'assets') {
$path = ''; $path = '';
for($x = 1; $x < argc(); $x ++) { for($x = 1; $x < argc(); $x ++) {
if(strlen($path)) if(strlen($path))
$path .= '/'; $path .= '/';
$path .= argv($x); $path .= argv($x);
} }
$realpath = 'doc/' . $path; $realpath = 'doc/' . $path;
//Set the content-type header as appropriate //Set the content-type header as appropriate
$imageInfo = getimagesize($realpath); $imageInfo = getimagesize($realpath);
switch ($imageInfo[2]) { switch ($imageInfo[2]) {
case IMAGETYPE_JPEG: case IMAGETYPE_JPEG:
header("Content-Type: image/jpeg"); header("Content-Type: image/jpeg");
break; break;
case IMAGETYPE_GIF: case IMAGETYPE_GIF:
header("Content-Type: image/gif"); header("Content-Type: image/gif");
break; break;
case IMAGETYPE_PNG: case IMAGETYPE_PNG:
header("Content-Type: image/png"); header("Content-Type: image/png");
break; break;
default: default:
break; break;
} }
header("Content-Length: " . filesize($realpath)); header("Content-Length: " . filesize($realpath));
// dump the picture and stop the script // dump the picture and stop the script
readfile($realpath); readfile($realpath);
killme(); killme();
} }
$headings = [ $headings = [
'about' => t('About'), 'about' => t('About'),
'member' => t('Members'), 'member' => t('Members'),
'admin' => t('Administrators'), 'admin' => t('Administrators'),
'developer' => t('Developers'), 'developer' => t('Developers'),
'tutorials' => t('Tutorials') 'tutorials' => t('Tutorials')
]; ];
@ -87,13 +87,13 @@ class Help extends \Zotlabs\Web\Controller {
if(array_key_exists(argv(1), $headings)) if(array_key_exists(argv(1), $headings))
$heading = $headings[argv(1)]; $heading = $headings[argv(1)];
$content = get_help_content(); $content = get_help_content();
return replace_macros(get_markup_template('help.tpl'), array( return replace_macros(get_markup_template('help.tpl'), array(
'$title' => t('$Projectname Documentation'), '$title' => t('$Projectname Documentation'),
'$tocHeading' => t('Contents'), '$tocHeading' => t('Contents'),
'$content' => $content, '$content' => $content,
'$heading' => $heading '$heading' => $heading
)); ));
} }

View File

@ -116,9 +116,11 @@ function load_doc_file($s) {
$b = basename($s); $b = basename($s);
$d = dirname($s); $d = dirname($s);
$c = find_doc_file("$d/$lang/$b"); if($dirname !== '-') {
if($c) $c = find_doc_file("$d/$lang/$b");
return $c; if($c)
return $c;
}
$c = find_doc_file($s); $c = find_doc_file($s);
if($c) if($c)
return $c; return $c;
@ -140,8 +142,8 @@ function find_doc_file($s) {
*/ */
function search_doc_files($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'])); $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
$regexop = db_getfunc('REGEXP'); $regexop = db_getfunc('REGEXP');
@ -198,6 +200,7 @@ function doc_rank_sort($s1, $s2) {
* *
* @return string * @return string
*/ */
function load_context_help() { function load_context_help() {
$path = App::$cmd; $path = App::$cmd;