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