1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17:
18: class XoopsSystemGui
19: {
20: 21: 22:
23: public $template;
24:
25: 26: 27:
28: public $navigation;
29:
30: 31: 32:
33: public $foldername;
34:
35: 36: 37:
38: public $xoTheme;
39:
40: public function header()
41: {
42: global $xoops, $xoopsConfig, $xoopsModule, $xoopsUser, $xoopsOption, $xoTheme, $xoopsTpl;
43: ob_start();
44:
45: xoops_loadLanguage('admin', 'system');
46: xoops_loadLanguage('cpanel', 'system');
47: xoops_loadLanguage('modinfo', 'system');
48:
49: $xoopsLogger = XoopsLogger::getInstance();
50: $xoopsLogger->stopTime('Module init');
51: $xoopsLogger->startTime('XOOPS output init');
52:
53: if (!headers_sent()) {
54: header('Content-Type:text/html; charset=' . _CHARSET);
55: header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
56: header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
57: header('Cache-Control: no-store, no-cache, must-revalidate');
58: header('Cache-Control: post-check=0, pre-check=0', false);
59: header('Pragma: no-cache');
60: }
61:
62: require_once XOOPS_ROOT_PATH . '/class/template.php';
63: require_once XOOPS_ROOT_PATH . '/class/theme.php';
64:
65: if (@$GLOBALS['xoopsOption']['template_main']) {
66: if (false === strpos($GLOBALS['xoopsOption']['template_main'], ':')) {
67: $GLOBALS['xoopsOption']['template_main'] = 'db:' . $GLOBALS['xoopsOption']['template_main'];
68: }
69: }
70:
71: $adminThemeFactory = new xos_opal_AdminThemeFactory();
72: $this->xoTheme =& $adminThemeFactory->createInstance(array(
73: 'folderName' => $this->foldername,
74: 'themesPath' => 'modules/system/themes',
75: 'contentTemplate' => @$GLOBALS['xoopsOption']['template_main']));
76:
77: $this->xoTheme->loadLocalization('admin');
78: $this->template =& $this->xoTheme->template;
79:
80: $GLOBALS['xoTheme'] =& $this->xoTheme;
81: $GLOBALS['adminTpl'] =& $this->xoTheme->template;
82:
83: $xoopsLogger->stopTime('XOOPS output init');
84: $xoopsLogger->startTime('Module display');
85:
86: $xoopsPreload = XoopsPreload::getInstance();
87: $xoopsPreload->triggerEvent('system.class.gui.header');
88:
89: if (isset($xoopsModule) && $xoopsModule->getVar('dirname') === 'system') {
90: $xoopsModule->loadAdminMenu();
91:
92: foreach (array_keys($xoopsModule->adminmenu) as $item) {
93: $sys_menu[$item]['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/' . $xoopsModule->adminmenu[$item]['link'];
94: $GLOBALS['xoopsTpl']->append_by_ref('sys_menu', $sys_menu);
95: unset($sys_menu);
96: }
97: }
98:
99: if (isset($xoopsModule) && $xoopsModule->getVar('dirname') !== 'system') {
100: if ($xoopsModule->getInfo('system_menu')) {
101: $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/modules/system/css/menu.css');
102:
103: $xoopsModule->loadAdminMenu();
104:
105:
106: $menu_handler = xoops_getModuleHandler('menu', 'system');
107:
108: $menu_handler->addMenuTop(XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $xoopsModule->getVar('mid', 'e'), _AM_SYSTEM_PREF);
109: $menu_handler->addMenuTop(XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=update&module=' . $xoopsModule->getVar('dirname', 'e'), _AM_SYSTEM_UPDATE);
110: $menu_handler->addMenuTop(XOOPS_URL . '/modules/system/admin.php?fct=blocksadmin&op=list&filter=1&selgen=' . $xoopsModule->getVar('mid', 'e') . '&selmod=-2&selgrp=-1&selvis=-1', _AM_SYSTEM_BLOCKS);
111: $menu_handler->addMenuTop(XOOPS_URL . '/modules/system/admin.php?fct=tplsets&op=listtpl&tplset=default&moddir=' . $xoopsModule->getVar('dirname', 'e'), _AM_SYSTEM_TPLSETS);
112: $menu_handler->addMenuTop(XOOPS_URL . '/modules/system/admin.php?module=' . $xoopsModule->getVar('mid', 'e') . '&status=0&limit=10&fct=comments', _AM_SYSTEM_COMMENTS);
113: $menu_handler->addMenuTop(XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=uninstall&module=' . $xoopsModule->getVar('dirname', 'e'), _AM_SYSTEM_UNINSTALL);
114:
115: $menu_handler->addMenuTop(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'e') . '/', _AM_SYSTEM_GOTOMODULE);
116:
117: $i = 0;
118: $current = $i;
119: foreach ($xoopsModule->adminmenu as $menu) {
120: if (stripos($_SERVER['REQUEST_URI'], $menu['link']) !== false) {
121: $current = $i;
122: }
123: $menu_handler->addMenuTabs($menu['link'], $menu['title']);
124: ++$i;
125: }
126: if ($xoopsModule->getInfo('help')) {
127: if (stripos($_SERVER['REQUEST_URI'], 'admin/' . $xoopsModule->getInfo('help')) !== false) {
128: $current = $i;
129: }
130: $menu_handler->addMenuTabs('../system/help.php?mid=' . $xoopsModule->getVar('mid', 's') . '&' . $xoopsModule->getInfo('help'), _AM_SYSTEM_HELP);
131: }
132:
133:
134: $GLOBALS['xoopsTpl']->assign('xo_system_menu', $menu_handler->render($current, false));
135: }
136: }
137: }
138:
139: public function footer()
140: {
141: global $xoopsConfig, $xoopsOption, $xoopsTpl, $xoTheme;
142:
143: $xoopsLogger = XoopsLogger::getInstance();
144: $xoopsLogger->stopTime('Module display');
145:
146: if (!headers_sent()) {
147: header('Content-Type:text/html; charset=' . _CHARSET);
148: header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
149: header('Cache-Control: private, no-cache');
150: header('Pragma: no-cache');
151: }
152:
153:
154: if (!isset($xoTheme)) {
155: $xoTheme = $GLOBALS['xoTheme'];
156: }
157:
158: if (isset($GLOBALS['xoopsOption']['template_main']) && $GLOBALS['xoopsOption']['template_main'] != $xoTheme->contentTemplate) {
159: trigger_error("xoopsOption['template_main'] should be defined before call xoops_cp_header function", E_USER_WARNING);
160: if (false === strpos($GLOBALS['xoopsOption']['template_main'], ':')) {
161: $xoTheme->contentTemplate = 'db:' . $GLOBALS['xoopsOption']['template_main'];
162: } else {
163: $xoTheme->contentTemplate = $GLOBALS['xoopsOption']['template_main'];
164: }
165: }
166:
167: $xoTheme->render();
168: $xoopsLogger->stopTime();
169: ob_end_flush();
170: }
171:
172: public static function validate()
173: {
174: }
175:
176: public static function flush()
177: {
178: }
179:
180: public function getInstance()
181: {
182: static $instance;
183: if (!isset($instance)) {
184: $class = __CLASS__;
185: $instance = new $class();
186: }
187:
188: return $instance;
189: }
190: }
191: