| [ Index ] |
|
Code source de XOOPS 2.0.17.1 |
1 <?php 2 // $Id: cp_functions.php 1074 2007-10-11 15:21:11Z phppp $ 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 define('XOOPS_CPFUNC_LOADED', 1); 28 29 function xoops_cp_header() 30 { 31 global $xoopsConfig, $xoopsUser; 32 if (!headers_sent()) { 33 header('Content-Type:text/html; charset='._CHARSET); 34 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 35 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 36 header('Cache-Control: no-store, no-cache, must-revalidate'); 37 header("Cache-Control: post-check=0, pre-check=0", false); 38 header("Pragma: no-cache"); 39 } 40 echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>"; 41 echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'._LANGCODE.'" lang="'._LANGCODE.'"> 42 <head> 43 <meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" /> 44 <meta http-equiv="content-language" content="'._LANGCODE.'" /> 45 <title>'.htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES).' Administration</title> 46 <script type="text/javascript" src="'.XOOPS_URL.'/include/xoops.js"></script> 47 '; 48 echo '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/xoops.css" />'; 49 echo '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/modules/system/style.css" />'; 50 include_once XOOPS_CACHE_PATH.'/adminmenu.php'; 51 $moduleperm_handler =& xoops_gethandler('groupperm'); 52 $admin_mids = $moduleperm_handler->getItemIds('module_admin', $xoopsUser->getGroups()); 53 ?> 54 55 <script type='text/javascript'> 56 <!-- 57 var thresholdY = 15; // in pixels; threshold for vertical repositioning of a layer 58 var ordinata_margin = 20; // to start the layer a bit above the mouse vertical coordinate 59 // --> 60 </script> 61 62 <script type='text/javascript' src='<?php echo XOOPS_URL."/include/layersmenu.js";?>'></script> 63 64 <script type='text/javascript'> 65 <!-- 66 <?php 67 echo $xoops_admin_menu_js; 68 ?> 69 function moveLayers() { 70 <?php 71 echo $xoops_admin_menu_ml; 72 ?> 73 } 74 function shutdown() { 75 <?php 76 echo $xoops_admin_menu_sd; 77 ?> 78 } 79 if (NS4) { 80 document.onmousedown = function() { shutdown(); } 81 } else { 82 document.onclick = function() { shutdown(); } 83 } 84 // --> 85 </script> 86 87 <?php 88 $logo = file_exists(XOOPS_THEME_URL."/".getTheme()."/images/logo.gif") ? XOOPS_THEME_URL."/".getTheme()."/images/logo.gif" : XOOPS_URL."/images/logo.gif"; 89 echo "</head> 90 <body> 91 <table border='0' width='100%' cellspacing='0' cellpadding='0'> 92 <tr> 93 <td bgcolor='#2F5376'><a href='http://xoops.sourceforge.net/' target='_blank'><img src='".XOOPS_URL."/modules/system/images/logo.gif' alt='".htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)."' /></a></td> 94 <td align='right' bgcolor='#2F5376' colspan='2'><img src='".XOOPS_URL."/modules/system/images/xoops2.gif' alt='' /></td> 95 </tr> 96 <tr> 97 <td align='left' colspan='3' class='bg5'> 98 <table border='0' width='100%' cellspacing='0' cellpadding='0'> 99 <tr> 100 <td width='1%'><img src='".XOOPS_URL."/modules/system/images/hbar_left.gif' width='10' height='23' /></td> 101 <td background='".XOOPS_URL."/modules/system/images/hbar_middle.gif'> <a href='".XOOPS_URL."/admin.php'>"._CPHOME."</a> | <a href='".XOOPS_URL."/admin.php?xoopsorgnews=1'>XOOPS News</a></td> 102 <td background='".XOOPS_URL."/modules/system/images/hbar_middle.gif' align='right'><a href='".XOOPS_URL."/user.php?op=logout'>"._LOGOUT."</a> | <a href='".XOOPS_URL."/'>"._YOURHOME."</a> </td> 103 <td width='1%'><img src='".XOOPS_URL."/modules/system/images/hbar_right.gif' width='10' height='23' /></td> 104 </tr> 105 </table> 106 </td> 107 </tr> 108 </table> 109 <table border='0' cellpadding='0' cellspacing='0' width='100%'> 110 <tr> 111 <td width='2%' valign='top' class='bg5' background='".XOOPS_URL."/modules/system/images/bg_menu.gif' align='center'></td> 112 <td width='15%' valign='top' class='bg5' align='center'><img src='".XOOPS_URL."/modules/system/images/menu.gif' /><br /> 113 <table border='0' cellpadding='4' cellspacing='0' width='100%'>"; 114 foreach ( array_keys($xoops_admin_menu_ft) as $adm ) { 115 if ( in_array($adm, $admin_mids) ) { 116 echo "<tr><td align='center'>".$xoops_admin_menu_ft[$adm]."</td></tr>"; 117 } 118 } 119 echo " 120 </table> 121 <br /> 122 </td> 123 <td align='left' valign='top' width='82%'> 124 <div class='content'><br />\n"; 125 } 126 127 function xoops_cp_footer() 128 { 129 global $xoopsConfig, $xoopsLogger; 130 echo" 131 </div><br /> 132 </td> 133 <td width='1%' background='".XOOPS_URL."/modules/system/images/bg_content.gif'></td> 134 </tr> 135 <tr> 136 <td align='center' colspan='4' class='bg5' height='15'> 137 <table border='0' width='100%' cellspacing='0' cellpadding='0'> 138 <tr> 139 <td width='1%'><img src='".XOOPS_URL."/modules/system/images/hbar_left.gif' width='10' height='23' /></td> 140 <td width='98%' background='".XOOPS_URL."/modules/system/images/hbar_middle.gif' align='center'><div class='fontSmall'>Powered by ".XOOPS_VERSION." © 2001-".date("Y")." <a href='http://xoops.sourceforge.net/' target='_blank'>The XOOPS Project</a></div></td><td width='1%'><img src='".XOOPS_URL."/modules/system/images/hbar_right.gif' width='10' height='23' /></td> 141 </tr> 142 </table> 143 </td> 144 </tr> 145 </table>"; 146 include XOOPS_CACHE_PATH.'/adminmenu.php'; 147 echo $xoops_admin_menu_dv; 148 echo " 149 </body> 150 </html> 151 "; 152 echo $GLOBALS['xoopsLogger']->render( '' ); 153 ob_end_flush(); 154 } 155 156 // We need these because theme files will not be included 157 function OpenTable() 158 { 159 echo "<table width='100%' border='0' cellspacing='1' cellpadding='8' style='border: 2px solid #2F5376;'><tr class='bg4'><td valign='top'>\n"; 160 } 161 162 function CloseTable() 163 { 164 echo '</td></tr></table>'; 165 } 166 167 function themecenterposts($title, $content) 168 { 169 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>'; 170 } 171 172 function myTextForm($url , $value) 173 { 174 return '<form action="'.$url.'" method="post"><input type="submit" value="'.$value.'" /></form>'; 175 } 176 177 function xoopsfwrite() 178 { 179 if ($_SERVER['REQUEST_METHOD'] != 'POST') { 180 return false; 181 } else { 182 183 } 184 if (!xoops_refcheck()) { 185 return false; 186 } else { 187 188 } 189 return true; 190 } 191 192 function xoops_module_get_admin_menu() 193 { 194 /************************************************************ 195 * Based on: 196 * - PHP Layers Menu 1.0.7(c)2001,2002 Marco Pratesi <pratesi@telug.it> 197 * - TreeMenu 1.1 - Bjorge Dijkstra <bjorge@gmx.net> 198 ************************************************************ 199 * - php code Optimized by DuGris 200 ************************************************************/ 201 202 $left = 105; 203 $top = 135; 204 $js = ""; 205 $moveLayers = ""; 206 $shutdown = ""; 207 $firstleveltable = ""; 208 $menu_layers = ""; 209 210 $module_handler =& xoops_gethandler('module'); 211 $criteria = new CriteriaCompo(); 212 $criteria->add(new Criteria('hasadmin', 1)); 213 $criteria->add(new Criteria('isactive', 1)); 214 $criteria->setSort('mid'); 215 $mods = $module_handler->getObjects($criteria); 216 217 foreach ($mods as $mod) { 218 219 $mid = $mod->getVar('mid'); 220 $module_name = $mod->getVar('name'); 221 $module_url = "\".XOOPS_URL.\"/modules/".$mod->getVar('dirname')."/".trim($mod->getInfo('adminindex')); 222 $module_img = "<img src='\".XOOPS_URL.\"/modules/".$mod->getVar('dirname')."/".$mod->getInfo('image')."' alt='' />"; 223 $module_desc = "<b>\"._VERSION.\":</b> ".round($mod->getVar('version')/100 , 2)."<br /><b>\"._DESCRIPTION.\":</b> ".$mod->getInfo('description'); 224 225 $top = $top + 15; 226 227 $js .= "\nfunction popUpL" . $mid . "() {\n shutdown();\n popUp('L" . $mid . "',true);}"; 228 $moveLayers .= "\n setleft('L" . $mid . "'," . $left . ");\n settop('L" . $mid . "'," . $top . ");"; 229 $shutdown .= "\n popUp('L" . $mid . "',false);"; 230 $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"; 231 $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'>"; 232 233 $adminmenu = $mod->getAdminMenu(); 234 235 if ($mod->getVar('hasnotification') || ($mod->getInfo('config') && is_array($mod->getInfo('config'))) || ($mod->getInfo('comments') && is_array($mod->getInfo('comments')))) { 236 $adminmenu[] = array('link' => '".XOOPS_URL."/modules/system/admin.php?fct=preferences&op=showmod&mod='.$mid, 'title' => _PREFERENCES, 'absolute' => true); 237 } 238 if ( count($adminmenu) != 0 ) { 239 $currenttarget = ""; 240 foreach ( $adminmenu as $menuitem ) { 241 $menu_link = trim($menuitem['link']); 242 $menu_title = trim($menuitem['title']); 243 $menu_target = isset($menuitem['target']) ? " target='" . trim($menuitem['target']) . "'" : ''; 244 if (isset($menuitem['absolute']) && $menuitem['absolute']) { 245 $menu_link = (empty($menu_link)) ? "#" : $menu_link; 246 } else { 247 $menu_link = (empty($menu_link)) ? "#" : "\".XOOPS_URL.\"/modules/".$mod->getVar('dirname')."/".$menu_link; 248 } 249 250 $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"; 251 } 252 } 253 254 $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"; 255 } 256 257 $menu_layers .= "\n<script language='JavaScript'>\n<!--\nmoveLayers();\nloaded = 1;\n// -->\n</script>\n"; 258 259 $content = "<"."?php\n"; 260 $content .= "\$xoops_admin_menu_js = \"".$js."\n\";\n\n"; 261 $content .= "\$xoops_admin_menu_ml = \"".$moveLayers."\n\";\n\n"; 262 $content .= "\$xoops_admin_menu_sd = \"".$shutdown."\n\";\n\n"; 263 $content .= $firstleveltable . "\n"; 264 $content .= "\$xoops_admin_menu_dv = \"".$menu_layers."\";\n"; 265 $content .= "\n?".">"; 266 267 return $content; 268 } 269 270 function xoops_module_write_admin_menu($content) 271 { 272 if (!xoopsfwrite()) { 273 return false; 274 } 275 $filename = XOOPS_CACHE_PATH.'/adminmenu.php'; 276 if ( !$file = fopen($filename, "w") ) { 277 echo 'failed open file'; 278 return false; 279 } 280 if ( fwrite($file, $content) == -1 ) { 281 echo 'failed write file'; 282 return false; 283 } 284 fclose($file); 285 286 // write index.html file in cache folder 287 // file is delete after clear_cache (smarty) 288 xoops_write_index_file( XOOPS_CACHE_PATH ); 289 return true; 290 } 291 292 function xoops_write_index_file( $path = '') { 293 if ( empty($path) ) { 294 return false; 295 } 296 if (!xoopsfwrite()) { 297 return false; 298 } 299 300 $path = substr($path, -1) == "/" ? substr($path, 0, -1) : $path; 301 $filename = $path . '/index.html'; 302 if ( file_exists($filename) ) { 303 return true; 304 } 305 if ( !$file = fopen($filename, "w") ) { 306 echo 'failed open file'; 307 return false; 308 } 309 if ( fwrite($file, "<script>history.go(-1);</script>") == -1 ) { 310 echo 'failed write file'; 311 return false; 312 } 313 fclose($file); 314 return true; 315 } 316 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sun Nov 25 11:44:32 2007 | par Balluche grâce à PHPXref 0.7 |
|