| Server IP : 10.10.92.66 / Your IP : 104.23.243.85 Web Server : Apache/2.4.52 (Ubuntu) System : Linux jurnalpolinema 5.15.0-177-generic #187-Ubuntu SMP Sat Apr 11 22:54:33 UTC 2026 x86_64 User : jurnal ( 1001) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/jurnal/public_html/lib/pkp/pages/help/ |
Upload File : |
<?php
/**
* @file pages/about/HelpHandler.inc.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class HelpHandler
* @ingroup pages_help
*
* @brief Handle requests for help functions.
*/
import('classes.handler.Handler');
class HelpHandler extends Handler {
/**
* Constructor
*/
function __construct() {
parent::__construct();
AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON);
}
/**
* Display help.
* @param $args array
* @param $request PKPRequest
*/
function index($args, $request) {
$path = 'docs/manual/';
$urlPart = join('/', $request->getRequestedArgs());
$filename = $urlPart . '.md';
$language = AppLocale::getIso1FromLocale(AppLocale::getLocale());
$summaryFile = $path . $language . '/SUMMARY.md';
// Default to English
if (!file_exists($path . $language) || !file_exists($summaryFile) || filesize($summaryFile)==0) $language = 'en';
if (!preg_match('#^([[a-zA-Z0-9_-]+/)+[a-zA-Z0-9_-]+\.\w+$#', $filename) || !file_exists($path . $filename)) {
$request->redirect(null, null, null, array($language, 'SUMMARY'));
}
// Use the summary document to find next/previous links.
// (Yes, we're grepping markdown outside the parser, but this is much faster.)
$previousLink = $nextLink = null;
if (preg_match_all('/\(([^)]+)\)/sm', file_get_contents($summaryFile), $matches)) {
$matches = $matches[1];
if (($i = array_search(substr($urlPart, strpos($urlPart, '/')+1), $matches)) !== false) {
if ($i>0) $previousLink = $matches[$i-1];
if ($i<count($matches)-1) $nextLink = $matches[$i+1];
}
}
// Use a URL filter to prepend the current path to relative URLs.
$parser = new \Michelf\Markdown;
$parser->url_filter_func = function ($url) use ($filename) {
return (empty(parse_url($url)['host']) ? dirname($filename) . '/' : '') . $url;
};
return new JSONMessage(
true,
array(
'content' => $parser->transform(file_get_contents($path . $filename)),
'previous' => $previousLink,
'next' => $nextLink,
)
);
}
}