XOOPS  2.6.0
help.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
14 
25 // Include header
26 include __DIR__ . '/header.php';
27 
30 
31 $page = $system->cleanVars($_REQUEST, 'page', '', 'string');
32 $mid = $system->cleanVars($_REQUEST, 'mid', 0, 'int');
33 
34 // Define main template
35 $xoops->header('admin:system/system_help.tpl');
36 // Define Stylesheet
37 $xoops->theme()->addStylesheet('modules/system/css/admin.css');
38 $xoops->theme()->addStylesheet('modules/system/css/help.css');
39 // Define Breadcrumb and tips
40 $system_breadcrumb->addLink(XoopsLocale::HELP, 'help.php');
41 
42 if ($mid > 0) {
43  $module = $xoops->getModuleById($mid);
44 
45  $system_breadcrumb->addLink($module->getVar('name'), 'help.php?mid=' . $module->getVar('mid', 's'));
46  $system_breadcrumb->addLink(system_adminVersion($page, 'name'));
47  $system_breadcrumb->render();
48 
49  if ($module->getVar('dirname', 'e') == 'system') {
50 
51  $admin_dir = \XoopsBaseConfig::get('root-path') . '/modules/system/admin';
52  $dirlist = XoopsLists::getDirListAsArray($admin_dir);
53 
54  foreach ($dirlist as $directory) {
55  if (XoopsLoad::fileExists($file = $admin_dir . '/' . $directory . '/xoops_version.php')) {
56 
57  require $file;
58  unset($file);
59 
60  if ($modversion['help']) {
61  $help['name'] = system_adminVersion($directory, 'name');
62  $help['link'] = 'help.php?mid=' . $mid . '&amp;' . system_adminVersion($directory, 'help');
63 
64  $xoops->tpl()->appendByRef('help', $help);
65  unset($help);
66  }
67  unset($modversion);
68  }
69  }
70  unset($dirlist);
71  } else {
72  $list_help = array();
73  $listed_mods[0] = $module->toArray();
74  $helplist = $module->getInfo('helpsection');
75  $j=0;
76  if (is_array($helplist)) {
77  foreach ($helplist as $helpitem) {
78  if (($helpitem['name'] != '') && ($helpitem['link'] != '')) {
79  $list_help[$j]['name'] = $helpitem['name'];
80  $list_help[$j]['link'] = 'help.php?mid=' . $mid . '&amp;' . $helpitem['link'];
81  ++$j;
82  }
83  }
84  $listed_mods[0]['help_page'] = $list_help;
85  $xoopsTpl->assign('list_mods', $listed_mods);
86  }
87  unset ($helplist);
88  if (( $module->getInfo('help') != '' ) && ($j == 0)) {
89  $help['name'] = $module->getInfo('name');
90  $help['link'] = 'help.php?mid=' . $mid . '&amp;' . $module->getInfo('help');
91  $xoopsTpl->appendByRef('help', $help);
92  }
93  unset($help);
94  }
95 
96  $xoops->loadLanguage('help', $module->getVar('dirname'));
97  $xoops->tpl()->assign('module', $module);
98  $xoops->tpl()->assign('modname', $module->getVar('name'));
99  $xoops->tpl()->assign('moddirname', $module->getVar('dirname', 'e'));
100 
101  if ($page != '') {
102  // Call template
103  if ($helpfile =
105  \XoopsBaseConfig::get('root-path') . '/modules/' . $module->getVar('dirname', 'e')
106  . '/locale/' . XoopsLocale::getLocale() . '/help/' . $page . '.html'
107  )
108  ) {
109  $helpcontent =
110  $xoops->tpl()->fetch(
111  \XoopsBaseConfig::get('root-path') . '/modules/' . $module->getVar('dirname', 'e')
112  . '/locale/' . XoopsLocale::getLocale() . '/help/' . $page . '.html'
113  );
114  } elseif (XoopsLoad::fileExists(
115  \XoopsBaseConfig::get('root-path') . '/modules/' . $module->getVar('dirname', 'e')
116  . '/language/' . $xoopsConfig['language'] . '/help/' . $page . '.html'
117  )) {
118  $helpcontent = $xoops->tpl()->fetch(
119  \XoopsBaseConfig::get('root-path') . '/modules/' . $module->getVar('dirname', 'e')
120  . '/language/' . $xoopsConfig['language'] . '/help/' . $page . '.html'
121  );
122  } else {
124  \XoopsBaseConfig::get('root-path') . '/modules/' . $module->getVar('dirname', 'e')
125  . '/language/english/help/' . $page . '.html'
126  )) {
127  $helpcontent = $xoops->tpl()->fetch(
128  \XoopsBaseConfig::get('root-path') . '/modules/' . $module->getVar('dirname', 'e')
129  . '/language/english/help/' . $page . '.html'
130  );
131  } else {
132  $xoops->tpl()->assign('load_error', 1);
133  }
134  }
135  if ($module->getVar('dirname', 'e') != 'system') {
136  $xoops->tpl()->assign('help_module', true);
137  }
138  $xoops->tpl()->assign('helpcontent', $helpcontent);
139  } else {
140  if ($helpfile = XoopsLoad::fileExists(
141  \XoopsBaseConfig::get('root-path') . '/modules/' . $module->getVar('dirname', 'e')
142  . '/locale/' . XoopsLocale::getLocale() . '/help/module_index.html'
143  )) {
144  $helpcontent = $xoops->tpl()->fetch(
145  \XoopsBaseConfig::get('root-path') . '/modules/' . $module->getVar('dirname', 'e')
146  . '/locale/' . XoopsLocale::getLocale() . '/help/module_index.html'
147  );
148  } elseif (XoopsLoad::fileExists(
149  \XoopsBaseConfig::get('root-path') . '/modules/' . $module->getVar('dirname', 'e')
150  . '/language/' . $xoops->getConfig('language') . '/help/module_index.html'
151  )) {
152  $helpcontent = $xoops->tpl()->fetch(
153  \XoopsBaseConfig::get('root-path') . '/modules/' . $module->getVar('dirname', 'e')
154  . '/language/' . $xoops->getConfig('language') . '/help/module_index.html'
155  );
156  } else {
157  $helpcontent = '<p>' . $module->getInfo('description') . '</p>';
158  }
159  $xoops->tpl()->assign('helpcontent', $helpcontent);
160  }
161 } else {
162  $system_breadcrumb->render();
164  $criteria->setOrder('weight');
165  // Get all installed modules
166  $installed_mods = $xoops->getHandlerModule()->getObjectsArray($criteria);
167  $listed_mods = array();
168  $i = 0;
169  $j = 0;
170  foreach ($installed_mods as $module) {
171  /* @var $module XoopsModule */
172  $list_help = array();
173  $listed_mods[$i] = $module->getValues();
174  $listed_mods[$i]['image'] = $module->getInfo('image');
175  $listed_mods[$i]['adminindex'] = $module->getInfo('adminindex');
176  $listed_mods[$i]['version'] = round($module->getVar('version') / 100, 2);
177  $listed_mods[$i]['last_update'] = XoopsLocale::formatTimestamp($module->getVar('last_update'), 'm');
178  $listed_mods[$i]['author'] = $module->getInfo('author');
179  $listed_mods[$i]['credits'] = $module->getInfo('credits');
180  $listed_mods[$i]['license'] = $module->getInfo('license');
181  $listed_mods[$i]['description'] = $module->getInfo('description');
182 
183  if ($module->getVar('dirname', 'e') == 'system') {
184  $admin_dir = XOOPS_ROOT_PATH . '/modules/system/admin';
185  $dirlist = XoopsLists::getDirListAsArray($admin_dir);
186 
187  foreach ($dirlist as $directory) {
188  if (XoopsLoad::fileExists($file = $admin_dir . '/' . $directory . '/xoops_version.php')) {
189 
190  require $file;
191  unset($file);
192 
193  if ($modversion['help']) {
194  $list_help[$j]['name'] = system_adminVersion($directory, 'name');
195  $list_help[$j]['link'] = 'help.php?mid=' . $module->getVar('mid', 'e')
196  . '&amp;' . system_adminVersion($directory, 'help');
197  }
198  unset($modversion);
199  ++$j;
200  }
201  }
202  unset($dirlist);
203  } else {
204  $helplist = $module->getInfo('helpsection');
205  $k=0;
206 
207  // Only build the list if one has been defined.
208  if (is_array($helplist)) {
209  foreach ($helplist as $helpitem) {
210  if (($helpitem['name'] != '') && ($helpitem['link'] != '')) {
211  $list_help[$j]['name'] = $helpitem['name'];
212  $list_help[$j]['link'] = 'help.php?mid=' . $module->getVar('mid', 'e')
213  . '&amp;' . $helpitem['link'];
214  ++$j;
215  ++$k;
216  }
217  }
218  }
219  unset($helplist);
220 
221  // If there is no help section ($k=0), and a lone help parameter has been defined.
222  if (( $module->getInfo('help') != '' ) && ($k == 0)) {
223  $list_help[$j]['name'] = $module->getInfo('name');
224  $list_help[$j]['link'] = 'help.php?mid=' . $module->getVar('mid', 'e')
225  . '&amp;' . $module->getInfo('help');
226  }
227  }
228  $listed_mods[$i]['help_page'] = $list_help;
229  if ($module->getInfo('help') == '') {
230  unset($listed_mods[$i]);
231  }
232  unset($list_help);
233  unset($module);
234  ++$i;
235  ++$j;
236  }
237  $xoops->tpl()->assign('list_mods', $listed_mods);
238 
240  \XoopsBaseConfig::get('root-path') . '/modules/system/language/'
241  . $xoops->getConfig('language') . '/help/help_center.html'
242  )) {
243  $helpcontent = $xoops->tpl()->fetch(
244  \XoopsBaseConfig::get('root-path') . '/modules/system/language/' . $xoops->getConfig('language')
245  . '/help/help_center.html'
246  );
247  } else {
248  $helpcontent = '<div id="non-modhelp">' . SystemLocale::WELCOME_TO_XOOPS_HELP_CENTER . '</div>';
249  }
250 
251  $xoops->tpl()->assign('helpcontent', $helpcontent);
252 }
253 $xoops->footer();
static formatTimestamp($time, $format= 'l', $timeoffset=null)
Definition: Abstract.php:289
const WELCOME_TO_XOOPS_HELP_CENTER
Definition: en_US.php:411
$installed_mods
Definition: help.php:166
static getInstance()
Definition: system.php:46
static getInstance()
Definition: Xoops.php:160
if(!isset($xoops->paths[$path_type])) if($path_type== 'var') $file
Definition: browse.php:55
$listed_mods
Definition: help.php:167
system_adminVersion($version, $value= '')
Definition: functions.php:95
$page
Definition: help.php:31
$admin_dir
Definition: menu.php:39
$xoopsTpl
Definition: xoops_code.php:45
$i
Definition: help.php:168
$system
Definition: help.php:29
$criteria
Definition: help.php:163
static fileExists($file)
Definition: xoopsload.php:506
static get($name)
$module
Definition: main.php:52
$xoops
Definition: help.php:28
$modversion
$mid
Definition: help.php:32
$system_breadcrumb
Definition: main.php:30
$j
Definition: help.php:169
$xoopsConfig
Definition: common.php:130