1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
<?php
# -- BEGIN LICENSE BLOCK ---------------------------------------
#
# This file is part of Dotclear 2.
#
# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear
# Licensed under the GPL version 2.0 license.
# See LICENSE file or
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK -----------------------------------------
require dirname(__FILE__).'/../inc/admin/prepend.php';
dcPage::check('usage');
function helpPage()
{
$ret = array('content' => '', 'title' => '');
$args = func_get_args();
if (empty($args)) {
return $ret;
};
global $__resources;
if (empty($__resources['help'])) {
return $ret;
}
$content = '';
$title = '';
foreach ($args as $v)
{
if (is_object($v) && isset($v->content)) {
$content .= $v->content;
continue;
}
if (!isset($__resources['help'][$v])) {
continue;
}
$f = $__resources['help'][$v];
if (!file_exists($f) || !is_readable($f)) {
continue;
}
$fc = file_get_contents($f);
if (preg_match('|<body[^>]*?>(.*?)</body>|ms',$fc,$matches)) {
$content .= $matches[1];
if (preg_match('|<title[^>]*?>(.*?)</title>|ms',$fc,$matches)) {
$title = $matches[1];
}
} else {
$content .= $fc;
}
}
if (trim($content) == '') {
return $ret;
}
$ret['content'] = $content;
if ($title != '') {
$ret['title'] = $title;
}
return $ret;
}
$help_page = !empty($_GET['page']) ? html::escapeHTML($_GET['page']) : 'index';
$content_array = helpPage($help_page);
if (($content_array['content'] == '') || ($help_page == 'index')) {
$content_array = helpPage('index');
}
if ($content_array['title'] != '') {
$breadcrumb = dcPage::breadcrumb(
array(
__('Global help') => 'help.php',
$content_array['title'] => ''
));
} else {
$breadcrumb = dcPage::breadcrumb(
array(
__('Global help') => ''
));
}
/* DISPLAY
-------------------------------------------------------- */
dcPage::open(__('Global help'),
dcPage::jsPageTabs('first-step'),
$breadcrumb
);
echo $content_array['content'];
// Prevents global help link display
$GLOBALS['__resources']['ctxhelp'] = true;
dcPage::close();
|