XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
cp_functions.php
Go to the documentation of this file.
1 <?php
19 define('XOOPS_CPFUNC_LOADED', 1);
20 
25 function xoops_cp_header()
26 {
27  xoops_load('cpanel', 'system');
28  $cpanel =& XoopsSystemCpanel::getInstance();
29  $cpanel->gui->header();
30 }
31 
36 function xoops_cp_footer()
37 {
38  xoops_load('cpanel', 'system');
39  $cpanel =& XoopsSystemCpanel::getInstance();
40  $cpanel->gui->footer();
41 }
42 
49 function OpenTable()
50 {
51  echo "<table width='100%' border='0' cellspacing='1' cellpadding='8' style='border: 2px solid #2F5376;'><tr class='bg4'><td valign='top'>\n";
52 }
53 
58 function CloseTable()
59 {
60  echo '</td></tr></table>';
61 }
62 
70 {
71  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>';
72 }
73 
81 function myTextForm($url, $value)
82 {
83  return '<form action="' . $url . '" method="post"><input type="submit" value="' . $value . '" /></form>';
84 }
85 
91 function xoopsfwrite()
92 {
93  if ($_SERVER['REQUEST_METHOD'] != 'POST') {
94  return false;
95  } else {
96 
97  }
98  if (! $GLOBALS['xoopsSecurity']->checkReferer()) {
99  return false;
100  } else {
101 
102  }
103  return true;
104 }
105 
112 {
113  $GLOBALS['xoopsLogger']->addDeprecated(__FUNCTION__ . " is deprecated, should not be used any longer");
114  /************************************************************
115  * Based on:
116  * - PHP Layers Menu 1.0.7(c)2001,2002 Marco Pratesi <pratesi@telug.it>
117  * - TreeMenu 1.1 - Bjorge Dijkstra <bjorge@gmx.net>
118  ************************************************************
119  * - php code Optimized by DuGris
120  ************************************************************/
121 
122  $left = 105;
123  $top = 135;
124  $js = "";
125  $moveLayers = "";
126  $shutdown = "";
127  $firstleveltable = "";
128  $menu_layers = "";
129 
130  $module_handler =& xoops_gethandler('module');
131  $criteria = new CriteriaCompo();
132  $criteria->add(new Criteria('hasadmin', 1));
133  $criteria->add(new Criteria('isactive', 1));
134  $criteria->setSort('mid');
135  $mods = $module_handler->getObjects($criteria);
136 
137  foreach ($mods as $mod) {
138 
139  $mid = $mod->getVar('mid');
140  $module_name = $mod->getVar('name');
141  $module_url = "\".XOOPS_URL.\"/modules/" . $mod->getVar('dirname') . "/" . trim($mod->getInfo('adminindex'));
142  $module_img = "<img class='admin_layer_img' src='\".XOOPS_URL.\"/modules/" . $mod->getVar('dirname') . "/" . $mod->getInfo('image') . "' alt='' />";
143  $module_desc = "<strong>\"._VERSION.\":</strong> " . round($mod->getVar('version') / 100, 2) . "<br /><strong>\"._DESCRIPTION.\":</strong> " . $mod->getInfo('description');
144 
145  $top = $top + 15;
146  $js .= "\nfunction popUpL" . $mid . "() {\n shutdown();\n popUp('L" . $mid . "',true);}";
147  $moveLayers .= "\n setleft('L" . $mid . "'," . $left . ");\n settop('L" . $mid . "'," . $top . ");";
148  $shutdown .= "\n popUp('L" . $mid . "',false);";
149  $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";
150  $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'>";
151 
152  $adminmenu = $mod->getAdminMenu();
153 
154  if ($mod->getVar('hasnotification') || ($mod->getInfo('config') && is_array($mod->getInfo('config'))) || ($mod->getInfo('comments') && is_array($mod->getInfo('comments')))) {
155  $adminmenu[] = array(
156  'link' => '".XOOPS_URL."/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;mod=' . $mid ,
157  'title' => _PREFERENCES ,
158  'absolute' => true);
159  }
160  if (count($adminmenu) != 0) {
161  $currenttarget = "";
162  foreach ($adminmenu as $menuitem) {
163  $menu_link = trim($menuitem['link']);
164  $menu_title = trim($menuitem['title']);
165  $menu_target = isset($menuitem['target']) ? " target='" . trim($menuitem['target']) . "'" : '';
166  if (isset($menuitem['absolute']) && $menuitem['absolute']) {
167  $menu_link = (empty($menu_link)) ? "#" : $menu_link;
168  } else {
169  $menu_link = (empty($menu_link)) ? "#" : "\".XOOPS_URL.\"/modules/" . $mod->getVar('dirname') . "/" . $menu_link;
170  }
171 
172  $menu_layers .= "\n<img src='\".XOOPS_URL.\"/images/pointer.gif' width='8' height='8' alt='' />&nbsp;<a href='" . $menu_link . "'" . $menu_target . " onmouseover='popUpL" . $mid . "' >" . $menu_title . "</a><br />\n";
173  }
174  }
175 
176  $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";
177  }
178  $menu_layers .= "\n<script language='JavaScript' type='text/javascript'>\n<!--\nmoveLayers();\nloaded = 1;\n// -->\n</script>\n";
179  $content = "<" . "?php\n";
180  $content .= "\$xoops_admin_menu_js = \"" . $js . "\n\";\n\n";
181  $content .= "\$xoops_admin_menu_ml = \"" . $moveLayers . "\n\";\n\n";
182  $content .= "\$xoops_admin_menu_sd = \"" . $shutdown . "\n\";\n\n";
183  $content .= $firstleveltable . "\n";
184  $content .= "\$xoops_admin_menu_dv = \"" . $menu_layers . "\";\n";
185  $content .= "\n?" . ">";
186  return $content;
187 }
188 
196 {
197  $GLOBALS['xoopsLogger']->addDeprecated(__FUNCTION__ . " is deprecated, should not be used any longer");
198  if (!xoopsfwrite()) {
199  return false;
200  }
201  $filename = XOOPS_CACHE_PATH . '/adminmenu.php';
202  if (!$file = fopen($filename, 'w')) {
203  echo 'failed open file';
204  return false;
205  }
206  if (fwrite($file, $content) == - 1) {
207  echo 'failed write file';
208  return false;
209  }
210  fclose($file);
211 
212  // write index.html file in cache folder
213  // file is delete after clear_cache (smarty)
215  return true;
216 }
217 
225 {
226  if (empty($path)) {
227  return false;
228  }
229  if (!xoopsfwrite()) {
230  return false;
231  }
232 
233  $path = substr($path, - 1) == '/' ? substr($path, 0, - 1) : $path;
234  $filename = $path . '/index.html';
235  if (file_exists($filename)) {
236  return true;
237  }
238  if (!$file = fopen($filename, 'w')) {
239  echo 'failed open file';
240  return false;
241  }
242  if (fwrite($file, '<script>history.go(-1);</script>') == - 1) {
243  echo 'failed write file';
244  return false;
245  }
246  fclose($file);
247  return true;
248 }
249 ?>