1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16:
17:
18: define('XOOPS_CPFUNC_LOADED', 1);
19:
20: 21: 22: 23:
24: function xoops_cp_header()
25: {
26: xoops_load('cpanel', 'system');
27: $cpanel = XoopsSystemCpanel::getInstance();
28: $cpanel->gui->header();
29: }
30:
31: 32: 33: 34:
35: function xoops_cp_footer()
36: {
37: xoops_load('cpanel', 'system');
38: $cpanel = XoopsSystemCpanel::getInstance();
39: $cpanel->gui->footer();
40: }
41:
42: 43: 44: 45: 46: 47:
48: function openTable()
49: {
50: echo "<table width='100%' border='0' cellspacing='1' cellpadding='8' style='border: 2px solid #2F5376;'><tr class='bg4'><td valign='top'>\n";
51: }
52:
53: 54: 55: 56:
57: function closeTable()
58: {
59: echo '</td></tr></table>';
60: }
61:
62: 63: 64: 65: 66: 67:
68: function themecenterposts($title, $content)
69: {
70: echo '<table cellpadding="4" cellspacing="1" width="98%" class="outer"><tr><td class="head">' . $title . '</td></tr><tr><td><br>' . $content . '<br></td></tr></table>';
71: }
72:
73: 74: 75: 76: 77: 78: 79:
80: function myTextForm($url, $value)
81: {
82: return '<form action="' . $url . '" method="post"><input type="submit" value="' . $value . '" /></form>';
83: }
84:
85: 86: 87: 88: 89:
90: function xoopsfwrite()
91: {
92: if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
93: return false;
94: } else {
95: }
96: if (!$GLOBALS['xoopsSecurity']->checkReferer()) {
97: return false;
98: } else {
99: }
100:
101: return true;
102: }
103:
104: 105: 106: 107: 108:
109: function xoops_module_get_admin_menu()
110: {
111: $GLOBALS['xoopsLogger']->addDeprecated(__FUNCTION__ . ' is deprecated, should not be used any longer');
112: 113: 114: 115: 116: 117: 118:
119:
120: $left = 105;
121: $top = 135;
122: $js = '';
123: $moveLayers = '';
124: $shutdown = '';
125: $firstleveltable = '';
126: $menu_layers = '';
127:
128: $module_handler = xoops_getHandler('module');
129: $criteria = new CriteriaCompo();
130: $criteria->add(new Criteria('hasadmin', 1));
131: $criteria->add(new Criteria('isactive', 1));
132: $criteria->setSort('mid');
133: $mods = $module_handler->getObjects($criteria);
134:
135: foreach ($mods as $mod) {
136: $mid = $mod->getVar('mid');
137: $module_name = $mod->getVar('name');
138: $module_url = "\".XOOPS_URL.\"/modules/" . $mod->getVar('dirname') . '/' . trim($mod->getInfo('adminindex'));
139: $module_img = "<img class='admin_layer_img' src='\".XOOPS_URL.\"/modules/" . $mod->getVar('dirname') . '/' . $mod->getInfo('image') . "' alt='' />";
140: $module_desc = "<strong>\"._VERSION.\":</strong> " . round($mod->getVar('version') / 100, 2) . "<br><strong>\"._DESCRIPTION.\":</strong> " . $mod->getInfo('description');
141:
142: $top += 15;
143: $js .= "\nfunction popUpL" . $mid . "() {\n shutdown();\n popUp('L" . $mid . "',true);}";
144: $moveLayers .= "\n setleft('L" . $mid . "'," . $left . ");\n settop('L" . $mid . "'," . $top . ');';
145: $shutdown .= "\n popUp('L" . $mid . "',false);";
146: $firstleveltable .= "$" . 'xoops_admin_menu_ft[' . $mid . "] = \"<a href='" . $module_url . "' title='" . $module_name . "' onmouseover='moveLayerY(\\\"L" . $mid . "\\\", currentY, event) ; popUpL" . $mid . "(); ' >" . $module_img . "</a><br>\";\n";
147: $menu_layers .= "\n<div id='L" . $mid . "' style='position: absolute; visibility: hidden; z-index:1000;' >\n<table class='admin_layer' cellpadding='0' cellspacing='0'>\n<tr><th nowrap='nowrap'>" . $module_name . "</th></tr>\n<tr><td class='even' nowrap='nowrap'>";
148:
149: $adminmenu = $mod->getAdminMenu();
150:
151: if ($mod->getVar('hasnotification') || ($mod->getInfo('config') && is_array($mod->getInfo('config'))) || ($mod->getInfo('comments') && is_array($mod->getInfo('comments')))) {
152: $adminmenu[] = array(
153: 'link' => '".XOOPS_URL."/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $mid,
154: 'title' => _PREFERENCES,
155: 'absolute' => true);
156: }
157: if (count($adminmenu) != 0) {
158: $currenttarget = '';
159: foreach ($adminmenu as $menuitem) {
160: $menu_link = trim($menuitem['link']);
161: $menu_title = trim($menuitem['title']);
162: $menu_target = isset($menuitem['target']) ? " target='" . trim($menuitem['target']) . "'" : '';
163: if (isset($menuitem['absolute']) && $menuitem['absolute']) {
164: $menu_link = empty($menu_link) ? '#' : $menu_link;
165: } else {
166: $menu_link = empty($menu_link) ? '#' : "\".XOOPS_URL.\"/modules/" . $mod->getVar('dirname') . '/' . $menu_link;
167: }
168:
169: $menu_layers .= "\n<img src='\".XOOPS_URL.\"/images/pointer.gif' width='8' height='8' alt='' /> <a href='" . $menu_link . "'" . $menu_target . " onmouseover='popUpL" . $mid . "' >" . $menu_title . "</a><br>\n";
170: }
171: }
172:
173: $menu_layers .= "\n<div style='margin-top: 5px; font-size: smaller; text-align: right;'><a href='#' onmouseover='shutdown();'>[" . _CLOSE . "]</a></div></td></tr><tr><th style='font-size: smaller; text-align: left;'>" . $module_img . '<br>' . $module_desc . "</th></tr></table></div>\n";
174: }
175: $menu_layers .= "\n<script language='JavaScript' type='text/javascript'>\n<!--\nmoveLayers();\nloaded = 1;\n// -->\n</script>\n";
176: $content = '<' . "?php\n";
177: $content .= "\$xoops_admin_menu_js = \"" . $js . "\n\";\n\n";
178: $content .= "\$xoops_admin_menu_ml = \"" . $moveLayers . "\n\";\n\n";
179: $content .= "\$xoops_admin_menu_sd = \"" . $shutdown . "\n\";\n\n";
180: $content .= $firstleveltable . "\n";
181: $content .= "\$xoops_admin_menu_dv = \"" . $menu_layers . "\";\n";
182: $content .= "\n?" . '>';
183:
184: return $content;
185: }
186:
187: 188: 189: 190: 191: 192:
193: function xoops_module_write_admin_menu($content)
194: {
195: $GLOBALS['xoopsLogger']->addDeprecated(__FUNCTION__ . ' is deprecated, should not be used any longer');
196: if (!xoopsfwrite()) {
197: return false;
198: }
199: $filename = XOOPS_CACHE_PATH . '/adminmenu.php';
200: if (!$file = fopen($filename, 'w')) {
201: echo 'failed open file';
202:
203: return false;
204: }
205: if (fwrite($file, $content) == -1) {
206: echo 'failed write file';
207:
208: return false;
209: }
210: fclose($file);
211:
212:
213:
214: xoops_write_index_file(XOOPS_CACHE_PATH);
215:
216: return true;
217: }
218:
219: 220: 221: 222: 223: 224:
225: function xoops_write_index_file($path = '')
226: {
227: if (empty($path)) {
228: return false;
229: }
230: if (!xoopsfwrite()) {
231: return false;
232: }
233:
234: $path = substr($path, -1) === '/' ? substr($path, 0, -1) : $path;
235: $filename = $path . '/index.html';
236: if (file_exists($filename)) {
237: return true;
238: }
239: if (!$file = fopen($filename, 'w')) {
240: echo 'failed open file';
241:
242: return false;
243: }
244: if (fwrite($file, '<script>history.go(-1);</script>') == -1) {
245: echo 'failed write file';
246:
247: return false;
248: }
249: fclose($file);
250:
251: return true;
252: }
253: