| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Mambo 4 * @subpackage Admin 5 * @author Mambo Foundation Inc see README.php 6 * @copyright (C) 2000 - 2009 Mambo Foundation Inc. 7 * See COPYRIGHT.php for copyright notices and details. 8 * @license GNU/GPL Version 2, see LICENSE.php 9 * 10 * Redistributions of files must retain the above copyright notice. 11 * 12 * Mambo is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; version 2 of the License. 15 */ 16 17 /** ensure this file is being included by a parent file */ 18 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 19 20 class HTML_admin_misc { 21 22 /** 23 * Check Version, Patches, and Messages 24 */ 25 function version_info( ) { 26 global $mosConfig_absolute_path; 27 ?> 28 <table class="adminform" border="1"> 29 <tr> 30 <th colspan="2" class="title"> 31 <?php echo T_('Mambo Updates'); ?> 32 </th> 33 </tr> 34 <tr> 35 <td colspan="2"> 36 <table width="100%"> 37 <tr> 38 <td> 39 <?php //Load local install version file 40 if (file_exists($mosConfig_absolute_path . '/administrator/components/com_admin/version.xml')) { 41 $local = simplexml_load_file($mosConfig_absolute_path . '/administrator/components/com_admin/version.xml'); 42 } else { 43 exit("Failed to open $mosConfig_absolute_path . '/administrator/components/com_admin/version.xml'."); 44 } 45 46 //Load server version file 47 if (@fopen("http://source.mambo-foundation.org/external/config/main_version.xml", "r")) { 48 $server = simplexml_load_file('http://source.mambo-foundation.org/external/config/main_version.xml'); 49 } else { 50 exit('Failed to open main_version.xml on The Source (source.mambo-foundation.org).'); 51 } 52 53 //Build output & check version 54 echo '<strong>' . T_('Mambo Version Information') . ':</strong><BR />'; 55 if (strcmp($local->version, $server->version)==0) { 56 echo T_('Your Mambo version is up to date') . '<BR />'; 57 echo T_('The current stable version is') . " <strong>$server->version</strong><BR />"; 58 } 59 else { 60 echo T_('Your Mambo version is out of date. We recommend you') . "<a href='http://mambo-code.org/gf/project/mambo/frs/'>" . ' ' . T_('upgrade') . '</a>.<BR />'; 61 echo T_('The current stable version is') . " <strong>$server->version</strong><BR />"; 62 echo T_('Your version is') . " <strong>$local->version</strong><BR />"; 63 } 64 //Check patch 65 echo '<BR /><strong>' . T_('Mambo Security Patch Information') . ':</strong><BR />'; 66 if ($server->patch == '') { 67 echo T_('No patches have been released') . '<BR />'; 68 } 69 elseif ($local->patch == $server->patch) { 70 echo T_('Your Mambo install has the latest recommended patch') . '<BR />'; 71 echo T_('The recommended patch level is') . ": <strong>$local->patch</strong><BR />"; 72 } 73 else { 74 echo T_('Your Mambo install does not have the latest recommended security patch. We recommend you apply the latest') . "<a href='http://sourceforge.net/project/showfiles.php?group_id=25577'>" . ' ' . T_('patch') . '</a>.<BR />'; 75 echo T_('The recommended patch level is') . ": <strong>$server->patch</strong><BR />"; 76 if ($local->patch == '') { 77 echo T_('Your patch level is') . ': <strong>' . T_('No patches applied') . '</strong><BR />'; 78 } 79 else { 80 echo T_('Your patch level is') . ": <strong>$local->patch</strong><BR />"; 81 } 82 } 83 //Check messages 84 echo '<BR /><strong>' . T_('Additional Messages') . ':</strong><BR />'; 85 if ($server->message == ''){ 86 echo T_('There are no messages at this time'); 87 } 88 else { 89 print $server->message; 90 } ?> 91 </td> 92 </tr> 93 <tr> 94 <th colspan="2" class="title"> 95 </th> 96 </tr> 97 </table> 98 <?php } 99 100 /** 101 * Control panel 102 */ 103 function controlPanel() { 104 global $mosConfig_absolute_path, $mainframe; 105 ?> 106 <table class="adminheading" border="0"> 107 <tr> 108 <th class="cpanel"> 109 <?php echo T_('Home') ?> 110 </th> 111 </tr> 112 </table> 113 <table width="100%" class="adminheading"> 114 <tr> 115 <?php if($_SESSION['simple_editing'] == 'on' ) 116 { 117 $_SESSION['simple_editing'] = 'on'; 118 ?> 119 <td align="left" width="20%"> </td><td align="left" ><a class="selected" href="index2.php?option=simple_mode" title="<?php echo T_('Simple Mode') ?> (<?php echo T_('selected') ?>)"><?php echo T_('Simple Mode') ?></a> / <a class="unselected" href="index2.php?option=advanced_mode" title="<?php echo T_('Advanced Mode') ?> (<?php echo T_('unselected') ?>)"><?php echo T_('Advanced Mode') ?></a></td> 120 <?php }else{ 121 $_SESSION['simple_editing'] = 'off'; 122 ?> 123 <td align="left" width="20%"> </td><td align="left" ><a class="unselected"href="index2.php?option=simple_mode" title="<?php echo T_('Simple Mode') ?> (<?php echo T_('unselected') ?>)" ><?php echo T_('Simple Mode') ?></a> / <a class="selected" href="index2.php?option=advanced_mode" title="<?php echo T_('Advanced Mode') ?> (<?php echo T_('selected') ?>)"><?php echo T_('Advanced Mode') ?></a></td> 124 <?php }?> 125 </tr> 126 </table> 127 <?php 128 $path = $mosConfig_absolute_path . '/administrator/templates/' . $mainframe->getTemplate() . '/cpanel.php'; 129 if (file_exists( $path )) { 130 require $path; 131 } else { 132 echo '<br />'; 133 mosLoadAdminModules( 'cpanel', 1 ); 134 } 135 } 136 137 function get_php_setting($val) { 138 $r = (ini_get($val) == '1' ? 1 : 0); 139 return $r ? 'ON' : 'OFF'; 140 } 141 142 function get_server_software() { 143 if (isset($_SERVER['SERVER_SOFTWARE'])) { 144 return $_SERVER['SERVER_SOFTWARE']; 145 } else if (($sf = getenv('SERVER_SOFTWARE'))) { 146 return $sf; 147 } else { 148 return 'n/a'; 149 } 150 } 151 152 function system_info( $version ) { 153 global $mosConfig_absolute_path, $database; 154 //$tab = mosGetParam( $_REQUEST, 'tab', 'tab1' ); 155 $width = 400; // width of 100% 156 $tabs = new mosTabs(0); 157 ?> 158 159 <table class="adminheading"> 160 <tr> 161 <th class="info"> 162 <?php echo T_('Information') ?> 163 </th> 164 </tr> 165 </table> 166 <?php 167 $tabs->startPane("sysinfo"); 168 $tabs->startTab(T_("System Info"),"system-page"); 169 ?> 170 <table class="adminform"> 171 <tr> 172 <th colspan="2"> 173 <?php echo T_('System Information') ?> 174 </th> 175 </tr> 176 <tr> 177 <td valign="top" width="250"> 178 <strong> 179 <?php echo T_('PHP built On:') ?> 180 </strong> 181 </td> 182 <td> 183 <?php echo php_uname(); ?> 184 </td> 185 </tr> 186 <tr> 187 <td> 188 <strong> 189 <?php echo T_('Database Version:') ?> 190 </strong> 191 </td> 192 <td> 193 <?php echo mysql_get_server_info(); ?> 194 </td> 195 </tr> 196 <tr> 197 <td> 198 <strong> 199 <?php echo T_('PHP Version:') ?> 200 </strong> 201 </td> 202 <td> 203 <?php echo phpversion(); ?> 204 </td> 205 </tr> 206 <tr> 207 <td> 208 <strong> 209 <?php echo T_('Web Server:') ?> 210 </strong> 211 </td> 212 <td> 213 <?php echo HTML_admin_misc::get_server_software(); ?> 214 </td> 215 </tr> 216 <tr> 217 <td> 218 <strong> 219 <?php echo T_('WebServer to PHP interface:') ?> 220 </strong> 221 </td> 222 <td> 223 <?php echo php_sapi_name(); ?> 224 </td> 225 </tr> 226 <tr> 227 <td> 228 <strong> 229 <?php echo T_('Mambo Version:') ?> 230 </strong> 231 </td> 232 <td> 233 <?php echo $version; ?> 234 </td> 235 </tr> 236 <tr> 237 <td> 238 <strong> 239 <?php echo T_('User Agent:') ?> 240 </strong> 241 </td> 242 <td> 243 <?php echo phpversion() <= "4.2.1" ? getenv( "HTTP_USER_AGENT" ) : $_SERVER['HTTP_USER_AGENT'];?> 244 </td> 245 </tr> 246 <tr> 247 <td valign="top"> 248 <strong> 249 <?php echo T_('Relevant PHP Settings:') ?> 250 </strong> 251 </td> 252 <td> 253 <table cellspacing="1" cellpadding="1" border="0"> 254 <tr> 255 <td> 256 <?php echo T_('Safe Mode:') ?> 257 </td> 258 <td> 259 <?php echo HTML_admin_misc::get_php_setting('safe_mode'); ?> 260 </td> 261 </tr> 262 <tr> 263 <td> 264 <?php echo T_('Open basedir:') ?> 265 </td> 266 <td> 267 <?php echo (($ob = ini_get('open_basedir')) ? $ob : 'none'); ?> 268 </td> 269 </tr> 270 <tr> 271 <td> 272 <?php echo T_('Display Errors:') ?> 273 </td> 274 <td> 275 <?php echo HTML_admin_misc::get_php_setting('display_errors'); ?> 276 </td> 277 </tr> 278 <tr> 279 <td> 280 <?php echo T_('Short Open Tags:') ?> 281 </td> 282 <td> 283 <?php echo HTML_admin_misc::get_php_setting('short_open_tag'); ?> 284 </td> 285 </tr> 286 <tr> 287 <td> 288 <?php echo T_('File Uploads:') ?> 289 </td> 290 <td> 291 <?php echo HTML_admin_misc::get_php_setting('file_uploads'); ?> 292 </td> 293 </tr> 294 <tr> 295 <td> 296 <?php echo T_('Magic Quotes') ?>: 297 </td> 298 <td> 299 <?php echo HTML_admin_misc::get_php_setting('magic_quotes_gpc'); ?> 300 </td> 301 </tr> 302 <tr> 303 <td> 304 <?php echo T_('Register Globals:') ?> 305 </td> 306 <td> 307 <?php echo HTML_admin_misc::get_php_setting('register_globals'); ?> 308 </td> 309 </tr> 310 <tr> 311 <td> 312 <?php echo T_('Output Buffering:') ?> 313 </td> 314 <td> 315 <?php echo HTML_admin_misc::get_php_setting('output_buffering'); ?> 316 </td> 317 </tr> 318 <tr> 319 <td> 320 <?php echo T_('Session save path:') ?> 321 </td> 322 <td> 323 <?php echo (($sp=ini_get('session.save_path'))?$sp:'none'); ?> 324 </td> 325 </tr> 326 <tr> 327 <td> 328 <?php echo T_('Session auto start:') ?> 329 </td> 330 <td> 331 <?php echo intval( ini_get( 'session.auto_start' ) ); ?> 332 </td> 333 </tr> 334 <tr> 335 <td> 336 <?php echo T_('XML enabled:') ?> 337 </td> 338 <td> 339 <?php echo extension_loaded('xml')?'Yes':'No'; ?> 340 </td> 341 </tr> 342 <tr> 343 <td> 344 <?php echo T_('Zlib enabled:') ?> 345 </td> 346 <td> 347 <?php echo extension_loaded('zlib')?'Yes':'No'; ?> 348 </td> 349 </tr> 350 <tr> 351 <td> 352 <?php echo T_('Disabled Functions:') ?> 353 </td> 354 <td> 355 <?php echo (($df=ini_get('disable_functions'))?$df:'none'); ?> 356 </td> 357 </tr> 358 <?php 359 // @RawSQLUse, trivial_implementation, SELECT 360 $query = "SELECT name FROM #__mambots" 361 . "\nWHERE folder='editors' AND published='1'" 362 . "\nLIMIT 1"; 363 $database->setQuery( $query ); 364 $editor = $database->loadResult(); 365 ?> 366 <tr> 367 <td> 368 <?php echo T_('WYSIWYG Editor:') ?> 369 </td> 370 <td> 371 <?php echo $editor; ?> 372 </td> 373 </tr> 374 </table> 375 </td> 376 </tr> 377 <tr> 378 <td valign="top"> 379 <strong> 380 <?php echo T_('Configuration File:') ?> 381 </strong> 382 </td> 383 <td> 384 <?php 385 $cf = file( $mosConfig_absolute_path . '/configuration.php' ); 386 foreach ($cf as $k=>$v) { 387 if (eregi( 'mosConfig_host', $v)) { 388 $cf[$k] = '$mosConfig_host = \'xxxxxx\''; 389 } else if (eregi( 'mosConfig_user', $v)) { 390 $cf[$k] = '$mosConfig_user = \'xxxxxx\''; 391 } else if (eregi( 'mosConfig_password', $v)) { 392 $cf[$k] = '$mosConfig_password = \'xxxxxx\''; 393 } else if (eregi( 'mosConfig_db ', $v)) { 394 $cf[$k] = '$mosConfig_db = \'xxxxxx\''; 395 } else if (eregi( '<?php', $v)) { 396 $cf[$k] = '<?php'; 397 } 398 } 399 echo implode( "<br />", $cf ); 400 ?> 401 </td> 402 </tr> 403 </table> 404 <?php 405 $tabs->endTab(); 406 $tabs->startTab(T_("PHP Info"),"php-page"); 407 ?> 408 <table class="adminform"> 409 <tr> 410 <th colspan="2"> 411 <?php echo T_('PHP Information') ?> 412 </th> 413 </tr> 414 <tr> 415 <td> 416 <?php 417 ob_start(); 418 phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES); 419 $phpinfo = ob_get_contents(); 420 ob_end_clean(); 421 preg_match_all('#<body[^>]*>(.*)</body>#siU', $phpinfo, $output); 422 $output = preg_replace('#<table#', '<table class="adminlist" align="center"', $output[1][0]); 423 $output = preg_replace('#(\w),(\w)#', '\1, \2', $output); 424 $output = preg_replace('#border="0" cellpadding="3" width="600"#', 'border="0" cellspacing="1" cellpadding="4" width="95%"', $output); 425 $output = preg_replace('#<hr />#', '', $output); 426 echo $output; 427 ?> 428 </td> 429 </tr> 430 </table> 431 <?php 432 $tabs->endTab(); 433 $tabs->startTab(T_('Permissions'),'perms'); 434 ?> 435 <table class="adminform"> 436 <tr> 437 <th colspan="2"> <?php echo T_('Directory Permissions') ?></th> 438 </tr> 439 <tr> 440 <td> 441 <strong><?php echo T_('For all Mambo functions and features to work ALL of the following directories should be writeable:') ?></strong> 442 <?php 443 mosHTML::writableCell( 'administrator/backups' ); 444 mosHTML::writableCell( 'administrator/components' ); 445 mosHTML::writableCell( 'administrator/modules' ); 446 mosHTML::writableCell( 'administrator/templates' ); 447 mosHTML::writableCell( 'cache' ); 448 mosHTML::writableCell( 'components' ); 449 mosHTML::writableCell( 'images' ); 450 mosHTML::writableCell( 'images/banners' ); 451 mosHTML::writableCell( 'images/stories' ); 452 mosHTML::writableCell( 'language' ); 453 mosHTML::writableCell( 'mambots' ); 454 mosHTML::writableCell( 'mambots/content' ); 455 mosHTML::writableCell( 'mambots/editors' ); 456 mosHTML::writableCell( 'mambots/editors-xtd' ); 457 mosHTML::writableCell( 'mambots/search' ); 458 mosHTML::writableCell( 'media' ); 459 mosHTML::writableCell( 'modules' ); 460 mosHTML::writableCell( 'templates' ); 461 462 ?> 463 464 </td> 465 </tr> 466 </table> 467 <?php 468 $tabs->endTab(); 469 $tabs->endPane(); 470 ?> 471 <?php 472 } 473 474 function ListComponents() { 475 mosLoadAdminModule( 'components' ); 476 } 477 478 /** 479 * Display Help Page 480 */ 481 function help() { 482 global $mosConfig_live_site; 483 $helpurl = mosGetParam( $GLOBALS, 'mosConfig_helpurl', '' ); 484 $helpurl = false; 485 $fullhelpurl = $helpurl . '/index2.php?option=com_content&task=findkey&pop=1&keyref='; 486 $fullhelpurl = $mosConfig_live_site.'/help/'; 487 488 $helpsearch = mosGetParam( $_REQUEST, 'helpsearch', '' ); 489 $page = mosGetParam( $_REQUEST, 'page', 'mambo.whatsnew.html' ); 490 $toc = getHelpToc( $helpsearch ); 491 if (!eregi( '\.html$', $page )) { 492 $page .= '.xml'; 493 } 494 ?> 495 <style type="text/css"> 496 .helpIndex { 497 border: 0px; 498 width: 95%; 499 height: 100%; 500 padding: 0px 5px 0px 10px; 501 overflow: auto; 502 } 503 .helpFrame { 504 border-left: 0px solid #222; 505 border-right: none; 506 border-top: none; 507 border-bottom: none; 508 width: 100%; 509 height: 700px; 510 padding: 0px 5px 0px 10px; 511 } 512 </style> 513 <form name="adminForm" action=""> 514 <table class="adminform" border="1"> 515 <tr> 516 <th colspan="2" class="title"> 517 <?php echo T_('Help') ?> 518 </th> 519 </tr> 520 <tr> 521 <td colspan="2"> 522 <table width="100%"> 523 <tr> 524 <td> 525 <strong><?php echo T_('Search:') ?></strong> 526 <input class="text_area" type="hidden" name="option" value="com_admin" /> 527 <input type="text" name="helpsearch" value="<?php echo $helpsearch;?>" class="inputbox" /> 528 <input type="submit" value="<?php echo T_('Go') ?>" class="button" /> 529 <input type="button" value="<?php echo T_('Clear Results') ?>" class="button" onclick="f=document.adminForm;f.helpsearch.value='';f.submit()" /> 530 </td> 531 <td style="text-align:right"> 532 <?php 533 if ($helpurl) { 534 ?> 535 <a href="<?php echo $fullhelpurl;?>mambo.glossary" target="helpFrame"> 536 <?php echo T_('Glossary') ?></a> 537 | 538 <a href="<?php echo $fullhelpurl;?>mambo.credits" target="helpFrame"> 539 <?php echo T_('Credits') ?></a> 540 | 541 <a href="<?php echo $fullhelpurl;?>mambo.support" target="helpFrame"> 542 <?php echo T_('Support') ?></a> 543 <?php 544 } else { 545 ?> 546 <a href="<?php echo $mosConfig_live_site;?>/help/mambo.glossary.html" target="helpFrame"> 547 <?php echo T_('Glossary') ?></a> 548 | 549 <a href="<?php echo $mosConfig_live_site;?>/help/mambo.credits.html" target="helpFrame"> 550 <?php echo T_('Credits') ?></a> 551 | 552 <a href="<?php echo $mosConfig_live_site;?>/help/mambo.support.html" target="helpFrame"> 553 <?php echo T_('Support') ?></a> 554 <?php 555 } 556 ?> 557 | 558 <a href="http://www.opensource.org/licenses/gpl-2.0.php" target="helpFrame"> 559 <?php echo T_('License') ?></a> 560 | 561 <a href="http://docs.mambo-foundation.org" target="_blank"> 562 docs.mambo-foundation.org</a> 563 | 564 <a href="<?php echo $mosConfig_live_site;?>/administrator/index2.php?option=com_admin&task=sysinfo&no_html=1" target="helpFrame"> 565 <?php echo T_('System Info') ?></a> 566 </td> 567 </tr> 568 </table> 569 </td> 570 </tr> 571 <tr valign="top"> 572 <td width="20%" valign="top"> 573 <?php if ($helpsearch):?> 574 <strong><?php echo T_('Search Results') ?></strong> 575 <?php else :?> 576 <strong><?php echo T_('Index') ?></strong> 577 <?php endif;?> 578 <div class="helpIndex"> 579 <?php 580 foreach ($toc as $k=>$v) { 581 if ($helpurl) { 582 echo '<br /><a href="' . $fullhelpurl . urlencode( $k ) . '" target="helpFrame">' . $v . '</a>'; 583 } else { 584 echo '<br /><a href="' . $mosConfig_live_site . '/help/' . $k . '" target="helpFrame">' . $v . '</a>'; 585 } 586 } 587 ?> 588 </div> 589 </td> 590 <td valign="top"> 591 <iframe name="helpFrame" src="<?php echo $mosConfig_live_site . '/help/' . $page;?>" class="helpFrame" frameborder="0" /></iframe> 592 </td> 593 </tr> 594 </table> 595 596 <input type="hidden" name="task" value="help" /> 597 </form> 598 <?php 599 } 600 601 /** 602 * Preview site 603 */ 604 function preview( $tp=0 ) { 605 global $mosConfig_live_site; 606 $tp = intval( $tp ); 607 ?> 608 <style type="text/css"> 609 .previewFrame { 610 border: none; 611 width: 95%; 612 height: 600px; 613 padding: 0px 5px 0px 10px; 614 } 615 </style> 616 <table class="adminform"> 617 <tr> 618 <th width="50%" class="title"> 619 <?php echo T_('Site Preview') ?> 620 </th> 621 <th width="50%" style="text-align:right"> 622 <a href="<?php echo $mosConfig_live_site . '/index.php?tp=' . $tp;?>" target="_blank"> 623 <?php echo T_('Open in new window') ?> 624 </a> 625 </th> 626 </tr> 627 <tr> 628 <td width="100%" valign="top" colspan="2"> 629 <iframe name="previewFrame" src="<?php echo $mosConfig_live_site . '/index.php?tp=' . $tp;?>" class="previewFrame" /></iframe> 630 </td> 631 </tr> 632 </table> 633 <?php 634 } 635 } 636 637 /** 638 * Compiles the help table of contents 639 * @param string A specific keyword on which to filter the resulting list 640 */ 641 function getHelpTOC( $helpsearch ) { 642 global $mosConfig_absolute_path; 643 $helpurl = mosGetParam( $GLOBALS, 'mosConfig_helpurl', '' ); 644 $helpurl = mamboCore::get('mosConfig_live_site'); 645 646 $files = mosReadDirectory( $mosConfig_absolute_path . '/help/', '\.xml$|\.html$' ); 647 648 $toc = array(); 649 foreach ($files as $file) { 650 $buffer = file_get_contents( $mosConfig_absolute_path . '/help/' . $file ); 651 if (preg_match( '#<title>(.*?)</title>#', $buffer, $m )) { 652 $title = trim( $m[1] ); 653 if ($title) { 654 if ($helpurl) { 655 // strip the extension 656 #$file = preg_replace( '#\.xml$|\.html$#', '', $file ); 657 } 658 if ($helpsearch) { 659 if (stripos( strip_tags( $buffer ), $helpsearch ) !== false) { 660 $toc[$file] = $title; 661 } 662 } else { 663 $toc[$file] = $title; 664 } 665 } 666 } 667 } 668 asort( $toc ); 669 return $toc; 670 } 671 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sun Mar 14 00:05:01 2010 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |