Dotclear

source: admin/help.php @ 514:5cacbd2e1fa9

Revision 514:5cacbd2e1fa9, 1.9 KB checked in by Franck <carnet.franck.paul@…>, 14 years ago (diff)

Reprise du titre des pages d'aide générales

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     if ($title != '') {
62          $title = '<a href="help.php">'.__('Global help').'</a> &rsaquo; <span class="page-title">'.$title.'</span>';
63     } else {
64          $title = '<span class="page-title">'.__('Global help').'</span>';
65     }
66     return '<h2>'.$title.'</h2>'."\n".'<div id="mainhelp">'.$content.'</div>';
67}
68
69$help_page = !empty($_GET['page']) ? html::escapeHTML($_GET['page']) : 'core_main';
70$content = helpPage($help_page);
71
72/* DISPLAY
73-------------------------------------------------------- */
74dcPage::open(__('Global help'),
75     # --BEHAVIOR-- adminPostHeaders
76     $core->callBehavior('adminPostHeaders')
77);
78
79if (($content == '') || ($help_page == 'core_main')) {
80     $content = helpPage('core_main');
81}
82echo $content;
83
84dcPage::close();
85?>
Note: See TracBrowser for help on using the repository browser.

Sites map