Dotclear

source: admin/help.php @ 491:d0e6b350e68c

Revision 491:d0e6b350e68c, 1.8 KB checked in by Franck <carnet.franck.paul@…>, 14 years ago (diff)

Mise en place de la page d'aide globale

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear
7# Licensed under the GPL version 2.0 license.
8# See LICENSE file or
9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10#
11# -- END LICENSE BLOCK -----------------------------------------
12
13require dirname(__FILE__).'/../inc/admin/prepend.php';
14
15dcPage::check('usage');
16
17function helpPage()
18{
19     $args = func_get_args();
20     if (empty($args)) {
21          return;
22     };
23     
24     global $__resources;
25     if (empty($__resources['help'])) {
26          return;
27     }
28     
29     $content = '';
30     $title = '';
31     foreach ($args as $v)
32     {
33          if (is_object($v) && isset($v->content)) {
34               $content .= $v->content;
35               continue;
36          }
37         
38          if (!isset($__resources['help'][$v])) {
39               continue;
40          }
41          $f = $__resources['help'][$v];
42          if (!file_exists($f) || !is_readable($f)) {
43               continue;
44          }
45         
46          $fc = file_get_contents($f);
47          if (preg_match('|<body[^>]*?>(.*?)</body>|ms',$fc,$matches)) {
48               $content .= $matches[1];
49               if (preg_match('|<title[^>]*?>(.*?)</title>|ms',$fc,$matches)) {
50                    $title = $matches[1];
51               }
52          } else {
53               $content .= $fc;
54          }
55     }
56     
57     if (trim($content) == '') {
58          return '';
59     }
60     
61     return ($title != '' ? ' > '.$title.'</h2>' : '</h2>').'<div id="mainhelp">'.$content.'</div>';
62}
63
64$help_page = !empty($_GET['page']) ? html::escapeHTML($_GET['page']) : 'core_main';
65$content = helpPage($help_page);
66
67/* DISPLAY
68-------------------------------------------------------- */
69dcPage::open(__('Global help'),
70     # --BEHAVIOR-- adminPostHeaders
71     $core->callBehavior('adminPostHeaders')
72);
73
74if (($content == '') || ($help_page == 'core_main')) {
75     $content = helpPage('core_main');
76}
77echo '<h2><a href="help.php">'.__('Global help').'</a>'.$content;
78
79dcPage::close();
80?>
Note: See TracBrowser for help on using the repository browser.

Sites map