XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
main.php
Go to the documentation of this file.
1 <?php
2 // $Id: main.php 10938 2013-01-28 00:24:47Z beckmi $
3 // ------------------------------------------------------------------------ //
4 // XOOPS - PHP Content Management System //
5 // Copyright (c) 2000 XOOPS.org //
6 // <http://www.xoops.org/> //
7 // ------------------------------------------------------------------------ //
8 // This program is free software; you can redistribute it and/or modify //
9 // it under the terms of the GNU General Public License as published by //
10 // the Free Software Foundation; either version 2 of the License, or //
11 // (at your option) any later version. //
12 // //
13 // You may not change or alter any portion of this comment or credits //
14 // of supporting developers from this source code or any supporting //
15 // source code which is considered copyrighted (c) material of the //
16 // original comment or credit authors. //
17 // //
18 // This program is distributed in the hope that it will be useful, //
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
21 // GNU General Public License for more details. //
22 // //
23 // You should have received a copy of the GNU General Public License //
24 // along with this program; if not, write to the Free Software //
25 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
26 // ------------------------------------------------------------------------ //
27 // Author: Kazumi Ono (AKA onokazu) //
28 // URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //
29 // Project: The XOOPS Project //
30 // ------------------------------------------------------------------------- //
31 
32 // Check users rights
33 if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->getVar('mid')) ) exit( _NOPERM );
34 
35 if (isset($_REQUEST)) {
36  foreach ( $_REQUEST as $k => $v ) {
37  ${$k} = $v;
38  }
39 }
40 // Get Action type
41 $op = system_CleanVars ( $_REQUEST, 'op', 'default', 'string' );
42 // Setting type
43 $confcat_id = system_CleanVars ( $_REQUEST, 'confcat_id', 0, 'int' );
44 // Define main template
45 $xoopsOption['template_main'] = 'system_preferences.html';
46 // Call Header
48 // Define Stylesheet
49 $xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/admin.css');
50 // Define scripts
51 $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js');
52 $xoTheme->addScript('modules/system/js/admin.js');
53 
54 $xoBreadCrumb->addLink( _AM_SYSTEM_PREFERENCES_NAV_MAIN, system_adminVersion('preferences', 'adminpath'));
55 
56 //Display part
57 switch($op) {
58 
59  case 'show':
60  if (empty($confcat_id)) {
61  $confcat_id = 1;
62  }
63  $confcat_handler =& xoops_gethandler('configcategory');
64  $confcat =& $confcat_handler->get($confcat_id);
65  if (!is_object($confcat)) {
66  redirect_header('admin.php?fct=preferences', 1);
67  }
68  $xoBreadCrumb->addLink( constant( $confcat->getVar('confcat_name') ) );
69  $xoBreadCrumb->addHelp( system_adminVersion('preferences', 'help') );
70  $xoBreadCrumb->render();
71  $xoopsTpl->assign('breadcrumb', 1);
72 
73  $form = new XoopsThemeForm( constant( $confcat->getVar('confcat_name') ), 'pref_form', 'admin.php?fct=preferences', 'post', true);
74  $config_handler =& xoops_gethandler('config');
75  $criteria = new CriteriaCompo();
76  $criteria->add(new Criteria('conf_modid', 0));
77  $criteria->add(new Criteria('conf_catid', $confcat_id));
78  $config = $config_handler->getConfigs($criteria);
79  $confcount = count($config);
80  for ($i = 0; $i < $confcount; $i++) {
81  $title = constant($config[$i]->getVar('conf_title'));
82  $desc = ($config[$i]->getVar('conf_desc') != '') ? constant( $config[$i]->getVar('conf_desc') ) : '';
83 
84  switch ($config[$i]->getVar('conf_formtype')) {
85 
86  case 'textarea':
88  if ($config[$i]->getVar('conf_valuetype') == 'array') {
89  // this is exceptional.. only when value type is arrayneed a smarter way for this
90  $ele = ($config[$i]->getVar('conf_value') != '') ? new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), $myts->htmlspecialchars(implode('|', $config[$i]->getConfValueForOutput())), 5, 50) : new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), '', 5, 50);
91  } else {
92  $ele = new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), $myts->htmlspecialchars($config[$i]->getConfValueForOutput()), 5, 50);
93  }
94  break;
95 
96  case 'select':
97  $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
98  $options = $config_handler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id')));
99  $opcount = count($options);
100  for ($j = 0; $j < $opcount; $j++) {
101  $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value');
102  $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name');
103  $ele->addOption($optval, $optkey);
104  }
105  break;
106 
107  case 'select_multi':
108  $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), 5, true);
109  $options = $config_handler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id')));
110  $opcount = count($options);
111  for ($j = 0; $j < $opcount; $j++) {
112  $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value');
113  $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name');
114  $ele->addOption($optval, $optkey);
115  }
116  break;
117 
118  case 'yesno':
119  $ele = new XoopsFormRadioYN($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), _YES, _NO);
120  break;
121 
122  case 'theme':
123  case 'theme_multi':
124  $ele = ($config[$i]->getVar('conf_formtype')
125  != 'theme_multi') ? new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()) : new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), 5, true);
126  require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
127  $dirlist = XoopsLists::getThemesList();
128  if (!empty($dirlist)) {
129  asort($dirlist);
130  $ele->addOptionArray($dirlist);
131  }
132  $valueForOutput = $config[$i]->getConfValueForOutput();
133  $form->addElement(new XoopsFormHidden('_old_theme', (is_array($valueForOutput) ? $valueForOutput[0] : $valueForOutput)));
134  break;
135 
136  case 'tplset':
137  $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
138  $tplset_handler =& xoops_gethandler('tplset');
139  $tplsetlist = $tplset_handler->getList();
140  asort($tplsetlist);
141  foreach ($tplsetlist as $key => $name) {
142  $ele->addOption($key, $name);
143  }
144  // old theme value is used to determine whether to update cache or not. kind of dirty way
145  $form->addElement(new XoopsFormHidden('_old_theme', $config[$i]->getConfValueForOutput()));
146  break;
147 
148  case 'cpanel':
149  $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
150  xoops_load("cpanel", "system");
151  $list = XoopsSystemCpanel::getGuis();
152  $ele->addOptionArray( $list );
153  break;
154 
155  case 'timezone':
156  $ele = new XoopsFormSelectTimezone($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
157  break;
158 
159  case 'language':
160  $ele = new XoopsFormSelectLang($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
161  break;
162 
163  case 'startpage':
164  $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
165  $module_handler =& xoops_gethandler('module');
166  $criteria = new CriteriaCompo(new Criteria('hasmain', 1));
167  $criteria->add(new Criteria('isactive', 1));
168  $moduleslist = $module_handler->getList($criteria, true);
169  $moduleslist['--'] = _MD_AM_NONE;
170  $ele->addOptionArray($moduleslist);
171  break;
172 
173  case 'group':
174  $ele = new XoopsFormSelectGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 1, false);
175  break;
176 
177  case 'group_multi':
178  $ele = new XoopsFormSelectGroup($title, $config[$i]->getVar('conf_name'), true, $config[$i]->getConfValueForOutput(), 5, true);
179  break;
180 
181  // RMV-NOTIFY - added 'user' and 'user_multi'
182  case 'user':
183  $ele = new XoopsFormSelectUser($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 1, false);
184  break;
185 
186  case 'user_multi':
187  $ele = new XoopsFormSelectUser($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 5, true);
188  break;
189 
190  case 'module_cache':
191  $module_handler =& xoops_gethandler('module');
192  $modules = $module_handler->getObjects(new Criteria('hasmain', 1), true);
193  $currrent_val = $config[$i]->getConfValueForOutput();
194  $cache_options = array('0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK);
195  if (count($modules) > 0) {
196  $ele = new XoopsFormElementTray($title, '<br />');
197  foreach (array_keys($modules) as $mid) {
198  $c_val = isset($currrent_val[$mid]) ? intval($currrent_val[$mid]) : null;
199  $selform = new XoopsFormSelect($modules[$mid]->getVar('name'), $config[$i]->getVar('conf_name')."[$mid]", $c_val);
200  $selform->addOptionArray($cache_options);
201  $ele->addElement($selform);
202  unset($selform);
203  }
204  } else {
206  }
207  break;
208 
209  case 'site_cache':
210  $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
211  $ele->addOptionArray(array('0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK));
212  break;
213 
214  case 'password':
216  $ele = new XoopsFormPassword($title, $config[$i]->getVar('conf_name'), 50, 255, $myts->htmlspecialchars($config[$i]->getConfValueForOutput()));
217  break;
218 
219  case 'color':
221  $ele = new XoopsFormColorPicker($title, $config[$i]->getVar('conf_name'), $myts->htmlspecialchars($config[$i]->getConfValueForOutput()));
222  break;
223 
224  case 'hidden':
226  $ele = new XoopsFormHidden( $config[$i]->getVar('conf_name'), $myts->htmlspecialchars( $config[$i]->getConfValueForOutput() ) );
227  break;
228 
229  case 'textbox':
230  default:
232  $ele = new XoopsFormText($title, $config[$i]->getVar('conf_name'), 50, 255, $myts->htmlspecialchars($config[$i]->getConfValueForOutput()));
233  break;
234 
235  }
236  $hidden = new XoopsFormHidden('conf_ids[]', $config[$i]->getVar('conf_id'));
237  $ele->setDescription($desc);
238  $form->addElement($ele);
239  $form->addElement($hidden);
240  unset($ele);
241  unset($hidden);
242  }
243  $form->addElement(new XoopsFormHidden('op', 'save'));
244  $form->addElement(new XoopsFormButton('', 'button', _GO, 'submit'));
245  $form->display();
246  break;
247 
248  case 'showmod':
249 
250  $config_handler =& xoops_gethandler('config');
251  $mod = isset($_REQUEST['mod']) ? intval($_REQUEST['mod']) : 0;
252  if ($mod <= 0) {
253  header('Location: admin.php?fct=preferences');
254  exit();
255  }
256  $config = $config_handler->getConfigs(new Criteria('conf_modid', $mod));
257  $count = count($config);
258  if ($count < 1) {
259  redirect_header('admin.php?fct=preferences', 1);
260  }
261  include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
262  $form = new XoopsThemeForm(_MD_AM_MODCONFIG, 'pref_form', 'admin.php?fct=preferences', 'post', true);
263  $module_handler =& xoops_gethandler('module');
264  $module =& $module_handler->get($mod);
265 
266  xoops_loadLanguage('modinfo', $module->getVar('dirname'));
267 
268  // if has comments feature, need comment lang file
269  if ($module->getVar('hascomments') == 1) {
270  xoops_loadLanguage('comment');
271  }
272  // RMV-NOTIFY
273  // if has notification feature, need notification lang file
274  if ($module->getVar('hasnotification') == 1) {
275  xoops_loadLanguage('notification');
276  }
277 
278  $modname = $module->getVar('name');
279  if (!empty($_REQUEST["redirect"])) {
281  $form->addElement(new XoopsFormHidden('redirect', $myts->htmlspecialchars($_REQUEST["redirect"])));
282  } elseif ($module->getInfo('adminindex')) {
283  $form->addElement(new XoopsFormHidden('redirect', XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/' . $module->getInfo('adminindex')));
284  }
285  for ($i = 0; $i < $count; $i++) {
286  $title = constant($config[$i]->getVar('conf_title'));
287  $description = (defined($config[$i]->getVar('conf_desc'))) ? constant($config[$i]->getVar('conf_desc')) : '';
288  switch ($config[$i]->getVar('conf_formtype')) {
289 
290  case 'textarea':
292  if ($config[$i]->getVar('conf_valuetype') == 'array') {
293  // this is exceptional.. only when value type is arrayneed a smarter way for this
294  $ele = ($config[$i]->getVar('conf_value') != '') ? new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), $myts->htmlspecialchars(implode('|', $config[$i]->getConfValueForOutput())), 5, 50) : new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), '', 5, 50);
295  } else {
296  $ele = new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), $myts->htmlspecialchars($config[$i]->getConfValueForOutput()), 5, 50);
297  }
298  break;
299 
300  case 'select':
301  $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
302  $options = $config_handler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id')));
303  $opcount = count($options);
304  for ($j = 0; $j < $opcount; $j++) {
305  $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value');
306  $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name');
307  $ele->addOption($optval, $optkey);
308  }
309  break;
310 
311  case 'select_multi':
312  $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), 5, true);
313  $options = $config_handler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id')));
314  $opcount = count($options);
315  for ($j = 0; $j < $opcount; $j++) {
316  $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value');
317  $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name');
318  $ele->addOption($optval, $optkey);
319  }
320  break;
321 
322  case 'yesno':
323  $ele = new XoopsFormRadioYN($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), _YES, _NO);
324  break;
325 
326  case 'group':
327  include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
328  $ele = new XoopsFormSelectGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 1, false);
329  break;
330 
331  case 'group_multi':
332  include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
333  $ele = new XoopsFormSelectGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 5, true);
334  break;
335 
336  // RMV-NOTIFY: added 'user' and 'user_multi'
337  case 'user':
338  include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
339  $ele = new XoopsFormSelectUser($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 1, false);
340  break;
341 
342  case 'user_multi':
343  include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
344  $ele = new XoopsFormSelectUser($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 5, true);
345  break;
346 
347  case 'password':
349  $ele = new XoopsFormPassword($title, $config[$i]->getVar('conf_name'), 50, 255, $myts->htmlspecialchars($config[$i]->getConfValueForOutput()));
350  break;
351 
352  case 'color':
354  $ele = new XoopsFormColorPicker($title, $config[$i]->getVar('conf_name'), $myts->htmlspecialchars($config[$i]->getConfValueForOutput()));
355  break;
356 
357  case 'hidden':
359  $ele = new XoopsFormHidden( $config[$i]->getVar('conf_name'), $myts->htmlspecialchars( $config[$i]->getConfValueForOutput() ) );
360  break;
361 
362  case 'line_break':
364  $form->insertBreak('<center>' . $title . '</center>',$myts->htmlspecialchars($config[$i]->getConfValueForOutput()));
365  break;
366 
367  case 'textbox':
368  default:
370  $ele = new XoopsFormText($title, $config[$i]->getVar('conf_name'), 50, 255, $myts->htmlspecialchars($config[$i]->getConfValueForOutput()));
371  break;
372 
373  }
374  if (isset($ele)) {
375  $ele->setDescription($description);
376  $form->addElement($ele);
377  }
378  $hidden = new XoopsFormHidden('conf_ids[]', $config[$i]->getVar('conf_id'));
379  $form->addElement($hidden);
380  unset($ele);
381  unset($hidden);
382  }
383  $form->addElement(new XoopsFormHidden('op', 'save'));
384  $form->addElement(new XoopsFormButton('', 'button', _GO, 'submit'));
385  if ($module->getVar('name') == 'System'){
386  // Define Breadcrumb
388  $xoBreadCrumb->render();
389  $xoopsTpl->assign('breadcrumb', 1);
390  }else{
391  if ($module->getInfo('adminindex')) {
392  echo '<a href="' . XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/' . $module->getInfo('adminindex') .'">' . $module->getVar('name') . '</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;' . _PREFERENCES . '<br /><br />';
393  } else {
394  echo $module->getVar('name') . '&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;' . _PREFERENCES . '<br /><br />';
395  }
396  }
397  $form->display();
398  break;
399 
400  case 'save':
401  if (!$GLOBALS['xoopsSecurity']->check()) {
402  redirect_header("admin.php?fct=preferences", 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
403  }
404  require_once XOOPS_ROOT_PATH . '/class/template.php';
405  $xoopsTpl = new XoopsTpl();
406  $count = count($conf_ids);
407  $tpl_updated = false;
408  $theme_updated = false;
409  $startmod_updated = false;
410  $lang_updated = false;
411  if ($count > 0) {
412  for ($i = 0; $i < $count; $i++) {
413  $config =& $config_handler->getConfig($conf_ids[$i]);
414  $new_value =& ${$config->getVar('conf_name')};
415  if (is_array($new_value) || $new_value != $config->getVar('conf_value')) {
416  // if language has been changed
417  if (!$lang_updated && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'language') {
418  $xoopsConfig['language'] = ${$config->getVar('conf_name')};
419  $lang_updated = true;
420  }
421 
422  // if default theme has been changed
423  if (!$theme_updated && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'theme_set') {
424  $member_handler =& xoops_gethandler('member');
425  $member_handler->updateUsersByField('theme', ${$config->getVar('conf_name')});
426  $theme_updated = true;
427  }
428  //todo: remove this code since it is not used anymore.
429  // if default template set has been changed
430  if (!$tpl_updated && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'template_set') {
431  // clear cached/compiled files and regenerate them if default theme has been changed
432  if ($xoopsConfig['template_set'] != ${$config->getVar('conf_name')}) {
433  $newtplset = ${$config->getVar('conf_name')};
434 
435  // clear all compiled and cachedfiles
436  $xoopsTpl->clear_compiled_tpl();
437 
438  // generate compiled files for the new theme
439  // block files only for now..
440  $tplfile_handler =& xoops_gethandler('tplfile');
441  $dtemplates = $tplfile_handler->find('default', 'block');
442  $dcount = count($dtemplates);
443 
444  // need to do this to pass to xoops_template_touch function
445  $GLOBALS['xoopsConfig']['template_set'] = $newtplset;
446 
447  for ($j = 0; $j < $dcount; $j++) {
448  $found = $tplfile_handler->find($newtplset, 'block', $dtemplates[$j]->getVar('tpl_refid'), null);
449  if (count($found) > 0) {
450  // template for the new theme found, compile it
451  xoops_template_touch($found[0]->getVar('tpl_id'));
452  } else {
453  // not found, so compile 'default' template file
454  xoops_template_touch($dtemplates[$j]->getVar('tpl_id'));
455  }
456  }
457 
458  // generate image cache files from image binary data, save them under cache/
459  $image_handler =& xoops_gethandler('imagesetimg');
460  $imagefiles = $image_handler->getObjects(new Criteria('tplset_name', $newtplset), true);
461  foreach (array_keys($imagefiles) as $j) {
462  if (!$fp = fopen(XOOPS_CACHE_PATH . '/' . $newtplset . '_' . $imagefiles[$j]->getVar('imgsetimg_file'), 'wb')) {
463  } else {
464  fwrite($fp, $imagefiles[$j]->getVar('imgsetimg_body'));
465  fclose($fp);
466  }
467  }
468  }
469  $tpl_updated = true;
470  }
471 
472  // add read permission for the start module to all groups
473  if (!$startmod_updated && $new_value != '--' && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'startpage') {
474  $member_handler =& xoops_gethandler('member');
475  $groups = $member_handler->getGroupList();
476  $moduleperm_handler =& xoops_gethandler('groupperm');
477  $module_handler =& xoops_gethandler('module');
478  $module = $module_handler->getByDirname($new_value);
479  foreach ($groups as $groupid => $groupname) {
480  if (!$moduleperm_handler->checkRight('module_read', $module->getVar('mid'), $groupid)) {
481  $moduleperm_handler->addRight('module_read', $module->getVar('mid'), $groupid);
482  }
483  }
484  $startmod_updated = true;
485  }
486 
487  $config->setConfValueForInput($new_value);
488  $config_handler->insertConfig($config);
489  }
490  unset($new_value);
491  }
492  }
493 
494  if (!empty($use_mysession) && $xoopsConfig['use_mysession'] == 0 && $session_name != '') {
495  setcookie($session_name, session_id(), time()+(60*intval($session_expire)), '/', XOOPS_COOKIE_DOMAIN, 0);
496  }
497 
498  // Clean cached files, may take long time
499  // User reigister_shutdown_function to keep running after connection closes so that cleaning cached files can be finished
500  // Cache management should be performed on a separate page
501  require_once XOOPS_ROOT_PATH.'/modules/system/class/maintenance.php';
502  $maintenance = new SystemMaintenance();
503  $options = array(1);//1 goes for cache
504  //register_shutdown_function( array( &$xoopsTpl, 'clear_all_cache' ) );
505  register_shutdown_function(array(&$maintenance, 'CleanCache' ), $options);
506 
507  if ($lang_updated) {
508  // Flush cache files for cpanel GUIs
509  xoops_load("cpanel", "system");
511  }
512 
513  if (isset($redirect) && $redirect != '') {
514  redirect_header($redirect, 2, _AM_SYSTEM_DBUPDATED);
515  } else {
516  redirect_header("admin.php?fct=preferences", 2, _AM_SYSTEM_DBUPDATED);
517  }
518  break;
519 
520  default:
521  // Display setting cats
523  $xoBreadCrumb->addHelp( system_adminVersion('preferences', 'help') );
524  $xoBreadCrumb->render();
525 
526  $confcat_handler = xoops_gethandler('configcategory');
527  $confcats = $confcat_handler->getObjects();
528  $image = system_adminVersion('preferences', 'configcat');
529  $count_prefs = 1;
530  $nbcolonnes_pref = 5;
531  foreach ( array_keys($confcats) as $i ) {
532  $preferences['id'] = $confcats[$i]->getVar('confcat_id');
533  $preferences['image'] = system_AdminIcons( 'xoops/' . $image[$i]);
534  $preferences['name'] = constant( $confcats[$i]->getVar('confcat_name') );
535  $count_prefs++;
536  $preferences['newline'] = ($count_prefs % $nbcolonnes_pref == 1) ? true : false;
537  $xoopsTpl->assign('newline', $preferences['newline']);
538 
539  $xoopsTpl->append_by_ref('preferences', $preferences);
540  unset( $preferences );
541  }
542  $xoopsTpl->assign('menu', 1);
543  $xoopsTpl->assign('breadcrumb', 1);
544  break;
545 }
546 // Call Footer
548 
549 ?>