XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
default.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 
12 xoops_load('gui', 'system');
13 
14 /*
15  * Xoops Cpanel default GUI class
16  *
17  * @copyright The XOOPS project http://sf.net/projects/xoops/
18  * @license http://www.fsf.org/copyleft/gpl.html GNU public license
19  * @package system
20  * @usbpackage GUI
21  * @since 2.4
22  * @author Mamba <mambax7@gmail.com>
23  * @author Mojtabajml <jamali.mojtaba@gmail.com>
24  * @author Voltan <djvoltan@gmail.com>
25  * @author BitC3R0 <BitC3R0@gmail.com>
26  * @author trabis <lusopoemas@gmail.com>
27  * @version 1.2
28  * @version $Id: default.php 8066 2011-11-06 05:09:33Z beckmi $
29  */
30 
32 {
33 
34  function __construct()
35  {
36  }
37 
38  function XoopsGuiDefault()
39  {
40  $this->__construct();
41  }
42 
43  function validate()
44  {
45  return true;
46  }
47 
48 
49  function header()
50  {
51  parent::header();
52 
55 
56  $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js');
57  $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/styleswitch.js');
58  $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/formenu.js');
59  $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/menu.js');
60  $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/tooltip.js');
61  $xoTheme->addScript(XOOPS_ADMINTHEME_URL . '/default/js/tabs.jquery.tools.min.js');
62 
63  $xoTheme->addStylesheet(XOOPS_ADMINTHEME_URL . '/default/css/style.css' );
64  $xoTheme->addStylesheet(XOOPS_ADMINTHEME_URL . '/default/css/dark.css', array('title' => 'dark', 'media' => 'screen'));
65  $xoTheme->addStylesheet(XOOPS_ADMINTHEME_URL . '/default/css/silver.css', array('title' => 'silver', 'media' => 'screen'));
66  $xoTheme->addStylesheet(XOOPS_ADMINTHEME_URL . '/default/css/orange.css', array('title' => 'orange', 'media' => 'screen'));
67 
68  $tpl->assign('lang_cp', _CPHOME);
69  //start system overview
70  //$tpl->assign('lang_xoops_version', XOOPS_VERSION);
71  $tpl->assign('lang_php_vesion', PHP_VERSION);
72  $tpl->assign('lang_mysql_version', mysql_get_server_info());
73  $tpl->assign('lang_server_api', PHP_SAPI);
74  $tpl->assign('lang_os_name', PHP_OS);
75  $tpl->assign('safe_mode', ini_get( 'safe_mode' ) ? 'On' : 'Off');
76  $tpl->assign('register_globals', ini_get( 'register_globals' ) ? 'On' : 'Off');
77  $tpl->assign('magic_quotes_gpc', ini_get( 'magic_quotes_gpc' ) ? 'On' : 'Off');
78  $tpl->assign('allow_url_fopen', ini_get( 'allow_url_fopen' ) ? 'On' : 'Off');
79  $tpl->assign('fsockopen', function_exists( 'fsockopen' ) ? 'On' : 'Off');
80  $tpl->assign('allow_call_time_pass_reference', ini_get( 'allow_call_time_pass_reference' ) ? 'On' : 'Off');
81  $tpl->assign('post_max_size', ini_get( 'post_max_size' ));
82  $tpl->assign('max_input_time', ini_get( 'max_input_time' ));
83  $tpl->assign('output_buffering', ini_get( 'output_buffering' ));
84  $tpl->assign('max_execution_time', ini_get( 'max_execution_time' ));
85  $tpl->assign('memory_limit', ini_get( 'memory_limit' ));
86  $tpl->assign('file_uploads', ini_get( 'file_uploads' ) ? 'On' : 'Off');
87  $tpl->assign('upload_max_filesize', ini_get( 'upload_max_filesize' ));
88  $tpl->assign('xoops_sitename', $xoopsConfig['sitename']);
89 
90  // ADD MENU *****************************************
91 
92  //Add CONTROL PANEL Menu items
93  $menu = array();
94  $menu[0]['link'] = XOOPS_URL;
95  $menu[0]['title'] = _YOURHOME;
96  $menu[0]['absolute'] = 1;
97  $menu[1]['link'] = XOOPS_URL . '/admin.php?xoopsorgnews=1';
98  $menu[1]['title'] = _OXYGEN_NEWS;
99  $menu[1]['absolute'] = 1;
100  $menu[1]['icon'] = XOOPS_ADMINTHEME_URL . '/default/images/xoops.png';
101  $menu[2]['link'] = XOOPS_URL . '/user.php?op=logout';
102  $menu[2]['title'] = _LOGOUT;
103  $menu[2]['absolute'] = 1;
104  $menu[2]['icon'] = XOOPS_ADMINTHEME_URL . '/default/images/logout.png';
105  $tpl->append('navitems', array('link' => XOOPS_URL . '/admin.php', 'text' => _CPHOME, 'menu' => $menu));
106 
107  //add SYSTEM Menu items
108  include dirname(__FILE__) . '/menu.php';
109  if (empty($xoopsModule) || 'system' == $xoopsModule->getVar('dirname', 'n')) {
110  $modpath = XOOPS_URL . '/admin.php';
111  $modname = _OXYGEN_SYSOPTIONS;
112  $modid = 1;
113  $moddir = 'system';
114 
115  $mod_options = $adminmenu;
116  foreach (array_keys($mod_options) as $item) {
117  $mod_options[$item]['link'] = empty($mod_options[$item]['absolute']) ? XOOPS_URL . '/modules/'.$moddir.'/' . $mod_options[$item]['link'] : $mod_options[$item]['link'];
118  $mod_options[$item]['icon'] = empty($mod_options[$item]['icon']) ? '' : XOOPS_ADMINTHEME_URL . '/default/' . $mod_options[$item]['icon'];
119  unset($mod_options[$item]['icon_small']);
120  }
121  } else {
122  $moddir = $xoopsModule->getVar('dirname', 'n');
123  $modpath = XOOPS_URL . '/modules/' . $moddir;
124  $modname = $xoopsModule->getVar('name');
125  $modid = $xoopsModule->getVar('mid');
126 
127  $mod_options = $xoopsModule->getAdminMenu();
128  foreach (array_keys($mod_options) as $item) {
129  $mod_options[$item]['link'] = empty($mod_options[$item]['absolute']) ? XOOPS_URL . "/modules/{$moddir}/" . $mod_options[$item]['link'] : $mod_options[$item]['link'];
130  $mod_options[$item]['icon'] = empty($mod_options[$item]['icon']) ? '' : XOOPS_URL . "/modules/{$moddir}/" . $mod_options[$item]['icon'];
131  }
132  }
133 
134  $tpl->assign('mod_options', $mod_options);
135  $tpl->assign('modpath', $modpath);
136  $tpl->assign('modname', $modname);
137  $tpl->assign('modid', $modid);
138  $tpl->assign('moddir', $moddir);
139 
140  // add MODULES Menu items
141  $module_handler =& xoops_gethandler('module');
142  $criteria = new CriteriaCompo();
143  $criteria->add(new Criteria('hasadmin', 1));
144  $criteria->add(new Criteria('isactive', 1));
145  $criteria->setSort('mid');
146  $mods = $module_handler->getObjects($criteria);
147 
148  $menu = array();
149  $moduleperm_handler =& xoops_gethandler('groupperm');
150  foreach ($mods as $mod) {
151  $rtn = array();
152  $modOptions = array(); //add for sub menus
153  $sadmin = $moduleperm_handler->checkRight('module_admin', $mod->getVar('mid'), $xoopsUser->getGroups());
154  if ($sadmin) {
155  $info = $mod->getInfo();
156  if (!empty($info['adminindex'])) {
157  $rtn['link'] = XOOPS_URL . '/modules/'. $mod->getVar('dirname', 'n') . '/' . $info['adminindex'];
158  } else {
159  $rtn['link'] = XOOPS_URL . '/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;mod=' . $mod->getVar('mid');
160  }
161  $rtn['title'] = $mod->name();
162  $rtn['absolute'] = 1;
163  $rtn['url'] = XOOPS_URL . '/modules/'. $mod->getVar('dirname', 'n') . '/'; //add for sub menus
164  $modOptions = $mod->getAdminMenu(); //add for sub menus
165  $rtn['options'] = $modOptions; //add for sub menus
166 
167  if (isset($info['icon']) && $info['icon'] != '' ) {
168  $rtn['icon'] = XOOPS_URL . '/modules/' . $mod->getVar('dirname', 'n') . '/' . $info['icon'];
169  }
170  $menu[] = $rtn;
171  }
172 
173  }
174  $tpl->append('navitems', array('link' => XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin',
175  'text' => _AM_SYSTEM_MODULES, 'dir' => $mod->getVar('dirname', 'n'), 'menu' => $menu));
176 
177  // add preferences menu
178  $menu = array();
179 
180  $OPT = array();
181  $OPT[] = array(
182  'link' => 'admin.php?fct=preferences&amp;op=show&amp;confcat_id=1',
183  'title' => _OXYGEN_GENERAL,
184  'absolute' => 1,
185  'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png');
186  $OPT[] = array(
187  'link' => 'admin.php?fct=preferences&amp;op=show&amp;confcat_id=2',
188  'title' => _OXYGEN_USERSETTINGS,
189  'absolute' => 1,
190  'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png');
191  $OPT[] = array(
192  'link' => 'admin.php?fct=preferences&amp;op=show&amp;confcat_id=3',
193  'title' => _OXYGEN_METAFOOTER,
194  'absolute' => 1,
195  'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png');
196  $OPT[] = array(
197  'link' => 'admin.php?fct=preferences&amp;op=show&amp;confcat_id=4',
198  'title' => _OXYGEN_CENSOR,
199  'absolute' => 1,
200  'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png');
201  $OPT[] = array(
202  'link' => 'admin.php?fct=preferences&amp;op=show&amp;confcat_id=5',
203  'title' => _OXYGEN_SEARCH,
204  'absolute' => 1,
205  'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png');
206  $OPT[] = array(
207  'link' => 'admin.php?fct=preferences&amp;op=show&amp;confcat_id=6',
208  'title' => _OXYGEN_MAILER,
209  'absolute' => 1,
210  'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png');
211  $OPT[] = array(
212  'link' => 'admin.php?fct=preferences&amp;op=show&amp;confcat_id=7',
213  'title' => _OXYGEN_AUTHENTICATION,
214  'absolute' => 1,
215  'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png');
216  $OPT[] = array(
217  'link' => 'admin.php?fct=preferences&amp;op=showmod&amp;mod=1',
218  'title' => _OXYGEN_MODULESETTINGS,
219  'absolute' => 1,
220  'icon' => XOOPS_ADMINTHEME_URL . '/default/icons/prefs_small.png');
221 
222 
223  $menu[] = array(
224  'link' => XOOPS_URL . '/modules/system/admin.php?fct=preferences',
225  'title' => _OXYGEN_SYSOPTIONS,
226  'absolute' => 1,
227  'url' => XOOPS_URL . '/modules/system/',
228  'options' => $OPT);
229 
230 
231  foreach ($mods as $mod) {
232  $rtn = array();
233  $sadmin = $moduleperm_handler->checkRight('module_admin', $mod->getVar('mid'), $xoopsUser->getGroups());
234  if ($sadmin && ($mod->getVar('hasnotification') || is_array($mod->getInfo('config')) || is_array($mod->getInfo('comments')))) {
235  $rtn['link'] = XOOPS_URL . '/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;mod=' . $mod->getVar('mid');
236  $rtn['title'] = $mod->name();
237  $rtn['absolute'] = 1;
238  $rtn['icon'] = XOOPS_ADMINTHEME_URL . '/gui/oxygen/icons/prefs_small.png';
239  $menu[] = $rtn;
240  }
241  }
242  $tpl->append('navitems', array('link' => XOOPS_URL . '/modules/system/admin.php?fct=preferences', 'text' => _OXYGEN_SITEPREF, 'dir' => $mod->getVar('dirname', 'n'), 'menu' => $menu));
243 
244  //add OPTIONS/Links Menu Items
245  $menu = array();
246  $menu[] = array(
247  'link' => 'http://sourceforge.net/projects/xoops/',
248  'title' => _OXYGEN_XOOPSPROJECT,
249  'absolute' => 1);
250  $menu[] = array(
251  'link' => 'http://xoops.org',
252  'title' => _OXYGEN_WEBSITE,
253  'absolute' => 1,
254  'icon' => XOOPS_ADMINTHEME_URL . '/default/images/xoops.png');
255  $menu[] = array(
256  'link' => 'http://www.xoops.org/modules/repository/',
257  'title' => _OXYGEN_XOOPSMODULES,
258  'absolute' => 1,
259  'icon' => XOOPS_ADMINTHEME_URL . '/default/images/xoops.png');
260  $menu[] = array(
261  'link' => 'http://www.xoops.org/modules/extgallery/',
262  'title' => _OXYGEN_XOOPSTHEMES,
263  'absolute' => 1,
264  'icon' => XOOPS_ADMINTHEME_URL . '/default/images/tweb.png');
265 
266  $tpl->append('navitems', array('link' => XOOPS_URL . '/admin.php','text' => _OXYGEN_INTERESTSITES, 'menu' => $menu));
267 
268  //add OPTIONS/links for local support
269  if (file_exists($file = XOOPS_ADMINTHEME_PATH . '/default/language/' . $xoopsConfig['language'] . '/localsupport.php' )) {
270  $links = include XOOPS_ADMINTHEME_PATH . '/default/language/' . $xoopsConfig['language'] . '/localsupport.php';
271  if ( count($links) > 0 ) {
272  $tpl->append('navitems', array('link' => XOOPS_URL . '/admin.php','text' => _OXYGEN_LOCALSUPPORT, 'menu' => $links));
273  }
274  }
275 
276  if (is_object($xoopsModule) || !empty($_GET['xoopsorgnews'])) {
277  if (is_object($xoopsModule) && file_exists($file = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/' . $xoopsModule->getInfo('adminmenu'))) {
278  include $file;
279  }
280  return;
281  }
282 
283  foreach ( $mods as $mod ) {
284 
285 
286  $sadmin = $moduleperm_handler->checkRight ( 'module_admin', $mod->getVar ( 'mid' ), $xoopsUser->getGroups () );
287  if ($sadmin) {
288  $rtn = array ();
289  $info = $mod->getInfo ();
290  if (! empty ( $info ['adminindex'] )) {
291  $rtn ['link'] = XOOPS_URL . '/modules/' . $mod->getVar ( 'dirname', 'n' ) . '/' . $info ['adminindex'];
292  } else {
293  $rtn ['link'] = XOOPS_URL . '/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;mod=' . $mod->getVar ( 'mid' );
294  }
295  $rtn ['title'] = $mod->getVar ('name');
296  $rtn ['description'] = $mod->getInfo('description');
297  $rtn ['absolute'] = 1;
298  if (isset ( $info ['icon_big'] )) {
299  $rtn ['icon'] = XOOPS_URL . '/modules/' . $mod->getVar ( 'dirname', 'n' ) . '/' . $info ['icon_big'];
300  } elseif (isset ( $info ['image'] )) {
301  $rtn ['icon'] = XOOPS_URL . '/modules/' . $mod->getVar ( 'dirname', 'n' ) . '/' . $info ['image'];
302  }
303 
304  $tpl->append ( 'modules', $rtn );
305  }
306 
307 
308  }
309  }
310 }
311 
312 ?>