Merge branch 'dev' into 'dev'

Some fixes in include/help.php.

See merge request hubzilla/core!1479
This commit is contained in:
M. Dent 2019-01-19 05:21:53 +01:00
commit 39128c34cc

View File

@ -12,12 +12,12 @@ use \Michelf\MarkdownExtra;
function get_help_fullpath($path,$suffix=null) { function get_help_fullpath($path,$suffix=null) {
$docroot = (\App::$override_helproot) ? \App::$override_helproot : 'doc/'; $docroot = (\App::$override_helproot) ? \App::$override_helproot : 'doc/';
$docroot = (substr($docroot,-1)!='/') ? $docroot .= '/' : $docroot; $docroot = (substr($docroot,-1)!='/') ? $docroot .= '/' : $docroot;
// Determine the language and modify the path accordingly // Determine the language and modify the path accordingly
$x = determine_help_language(); $x = determine_help_language();
$lang = $x['language']; $lang = $x['language'];
$url_idx = ($x['from_url'] ? 1 : 0);
// The English translation is at the root of /doc/. Other languages are in // The English translation is at the root of /doc/. Other languages are in
// subfolders named by the language code such as "de", "es", etc. // subfolders named by the language code such as "de", "es", etc.
if($lang !== 'en') { if($lang !== 'en') {
@ -53,15 +53,14 @@ function get_help_fullpath($path,$suffix=null) {
* @return string|unknown * @return string|unknown
*/ */
function get_help_content($tocpath = false) { function get_help_content($tocpath = false) {
global $lang;
$doctype = 'markdown'; $doctype = 'markdown';
$text = ''; $text = '';
$path = (($tocpath !== false) ? $tocpath : ''); $path = (($tocpath !== false) ? $tocpath : '');
$docroot = (\App::$override_helproot) ? \App::$override_helproot : 'doc/'; $docroot = (\App::$override_helproot) ? \App::$override_helproot : 'doc/';
$docroot = (substr($docroot,-1)!='/') ? $docroot .= '/' : $docroot; $docroot = (substr($docroot,-1)!='/') ? $docroot .= '/' : $docroot;
if($tocpath === false && argc() > 1) { if($tocpath === false && argc() > 1) {
$path = ''; $path = '';
@ -74,7 +73,7 @@ function get_help_content($tocpath = false) {
if($path) { if($path) {
$fullpath = get_help_fullpath($path); $fullpath = get_help_fullpath($path);
$title = basename($path); $title = basename($path);
if(! $tocpath) if(! $tocpath)
\App::$page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags($title))); \App::$page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags($title)));
@ -88,10 +87,10 @@ function get_help_content($tocpath = false) {
load_doc_file($fullpath . '.md') === '' && load_doc_file($fullpath . '.md') === '' &&
load_doc_file($fullpath . '.bb') === '' && load_doc_file($fullpath . '.bb') === '' &&
load_doc_file($fullpath . '.html') === '' load_doc_file($fullpath . '.html') === ''
) { ) {
$path = $title; $path = $title;
} }
$fullpath = get_help_fullpath($path); $fullpath = get_help_fullpath($path);
$text = load_doc_file($fullpath . '.md'); $text = load_doc_file($fullpath . '.md');
if(! $text) { if(! $text) {
@ -111,15 +110,15 @@ function get_help_content($tocpath = false) {
if($tocpath === false) { if($tocpath === false) {
if(! $text) { if(! $text) {
$path = 'Site'; $path = 'Site';
$fullpath = get_help_fullpath($path,'.md'); $fullpath = get_help_fullpath($path,'.md');
$text = load_doc_file($fullpath . '.md'); $text = load_doc_file($fullpath . '.md');
\App::$page['title'] = t('Help'); \App::$page['title'] = t('Help');
} }
if(! $text) { if(! $text) {
$doctype = 'bbcode'; $doctype = 'bbcode';
$path = 'main'; $path = 'main';
$fullpath = get_help_fullpath($path,'.md'); $fullpath = get_help_fullpath($path,'.md');
$text = load_doc_file($fullpath . '.bb'); $text = load_doc_file($fullpath . '.bb');
goaway('/help/about/about'); goaway('/help/about/about');
\App::$page['title'] = t('Help'); \App::$page['title'] = t('Help');
@ -219,7 +218,6 @@ function find_doc_file($s) {
*/ */
function search_doc_files($s) { function search_doc_files($s) {
\App::set_pager_itemspage(60); \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']));
@ -351,7 +349,7 @@ function store_doc_file($s) {
$x = item_store_update($item); $x = item_store_update($item);
} }
else { else {
$item['uuid'] = $item_message_id(); $item['uuid'] = item_message_id();
$item['mid'] = $item['parent_mid'] = z_root() . '/item/' . $item['uuid']; $item['mid'] = $item['parent_mid'] = z_root() . '/item/' . $item['uuid'];
$x = item_store($item); $x = item_store($item);
} }