[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/admin/ -> check.php (source)

   1  <?php
   2  # Mantis - a php based bugtracking system
   3  
   4  # Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
   5  # Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
   6  
   7  # Mantis is free software: you can redistribute it and/or modify
   8  # it under the terms of the GNU General Public License as published by
   9  # the Free Software Foundation, either version 2 of the License, or
  10  # (at your option) any later version.
  11  #
  12  # Mantis is distributed in the hope that it will be useful,
  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15  # GNU General Public License for more details.
  16  #
  17  # You should have received a copy of the GNU General Public License
  18  # along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
  19  
  20      # --------------------------------------------------------
  21      # $Id: check.php,v 1.29.2.1 2007-10-13 22:34:53 giallu Exp $
  22      # --------------------------------------------------------
  23  ?>
  24  <?php
  25      error_reporting( E_ALL );
  26  
  27      $g_skip_open_db = true;  # don't open the database in database_api.php
  28  
  29      require_once ( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' );
  30  
  31      $t_core_path = config_get_global( 'core_path' );
  32  
  33      require_once ( $t_core_path . 'email_api.php' );
  34      require_once ( $t_core_path . 'database_api.php' );
  35  
  36      $f_mail_test    = gpc_get_bool( 'mail_test' );
  37      $f_password        = gpc_get_string( 'password', null );
  38  
  39      define( 'BAD', 0 );
  40      define( 'GOOD', 1 );
  41  
  42  	function print_test_result( $p_result ) {
  43          if ( BAD == $p_result ) {
  44              echo '<td bgcolor="#ff0088">BAD</td>';
  45          }
  46  
  47          if ( GOOD == $p_result ) {
  48              echo '<td bgcolor="#00ff88">GOOD</td>';
  49          }
  50      }
  51  
  52  	function print_yes_no( $p_result ) {
  53          if ( ( 0 === $p_result ) || ( "no" === strtolower( $p_result ) ) ) {
  54              echo 'No';
  55          }
  56  
  57          if ( ( 1 === $p_result ) || ( "yes" === strtolower( $p_result ) ) ) {
  58              echo 'Yes';
  59          }
  60      }
  61  
  62  	function print_test_row( $p_description, $p_pass )
  63      {
  64          echo '<tr>';
  65          echo '<td bgcolor="#ffffff">';
  66          echo $p_description;
  67          echo '</td>';
  68  
  69          if ( $p_pass ) {
  70              print_test_result( GOOD );
  71          } else {
  72              print_test_result( BAD );
  73          }
  74  
  75          echo '</tr>';
  76      }
  77  
  78  	function test_bug_download_threshold()
  79      {
  80          $t_pass = true;
  81  
  82          $t_view_threshold = config_get_global( 'view_attachments_threshold' );
  83          $t_download_threshold = config_get_global( 'download_attachments_threshold' );
  84          $t_delete_threshold = config_get_global( 'delete_attachments_threshold' );
  85  
  86          if ( $t_view_threshold > $t_download_threshold ) {
  87              $t_pass = false;
  88          } else {
  89              if ( $t_download_threshold > $t_delete_threshold ) {
  90                  $t_pass = false;
  91              }
  92          }
  93  
  94          print_test_row( 'Bug attachments download thresholds (view_attachments_threshold, ' .
  95                  'download_attachments_threshold, delete_attachments_threshold)', $t_pass );
  96  
  97          return $t_pass;
  98      }
  99  
 100  	function test_bug_attachments_allow_flags()
 101      {
 102          $t_pass = true;
 103  
 104          $t_own_view = config_get_global( 'allow_view_own_attachments' );
 105          $t_own_download = config_get_global( 'allow_download_own_attachments' );
 106          $t_own_delete = config_get_global( 'allow_delete_own_attachments' );
 107  
 108          if ( ( $t_own_delete == ON ) && ( $t_own_download == FALSE ) ) {
 109              $t_pass = false;
 110          } else {
 111              if ( ( $t_own_download == ON ) && ( $t_own_view == OFF ) ) {
 112                  $t_pass = false;
 113              }
 114          }
 115  
 116          print_test_row( 'Bug attachments allow own flags (allow_view_own_attachments, ' .
 117                  'allow_download_own_attachments, allow_delete_own_attachments)', $t_pass );
 118  
 119          return $t_pass;
 120      }
 121  
 122      $version = phpversion();
 123  ?>
 124  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 125  <html>
 126  <head>
 127  <title> Mantis Administration - Check Installation </title>
 128  <link rel="stylesheet" type="text/css" href="admin.css" />
 129  </head>
 130  <body>
 131  <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff">
 132      <tr class="top-bar">
 133          <td class="links">
 134              [ <a href="index.php">Back to Administration</a> ]
 135          </td>
 136          <td class="title">
 137              Check Installation
 138          </td>
 139      </tr>
 140  </table>
 141  <br /><br />
 142  
 143  <?php
 144      require_once( $t_core_path . 'obsolete.php' );
 145  ?>
 146  
 147  <!-- Version Check -->
 148  <table width="100%" bgcolor="#0000aa" border="0" cellpadding="20" cellspacing="1">
 149  <tr>
 150      <td bgcolor="#f0f0ff">
 151          <span class="title">Version</span>
 152          <p>Mantis requires at least <b>PHP <?php echo PHP_MIN_VERSION ?></b>.  If you are not running this version or above, you or your administrator will need to upgrade your build of PHP.</p>
 153          <p>You are running <b>PHP <?php echo $version ?></b></p>
 154      </td>
 155  </tr>
 156  </table>
 157  
 158  <br />
 159  
 160  <table width="100%" bgcolor="#222222" border="0" cellpadding="10" cellspacing="1">
 161  <tr>
 162      <td bgcolor="#e8e8e8" colspan="2">
 163          <span class="title">Checking your installation</span>
 164      </td>
 165  </tr>
 166  
 167  <!-- Test DATABASE part 1 -->
 168  <tr>
 169      <td bgcolor="#ffffff">
 170          Opening connection to database [<?php echo config_get_global( 'database_name' ) ?>] on host [<?php echo config_get_global( 'hostname' ) ?>] with username [<?php echo config_get_global( 'db_username' ) ?>]
 171      </td>
 172      <?php
 173          $result = @db_connect( config_get_global( 'dsn', false ), config_get_global( 'hostname' ), config_get_global( 'db_username' ), config_get_global( 'db_password' ), config_get_global( 'database_name' ) );
 174          if ( false == $result ) {
 175              print_test_result( BAD );
 176          } else {
 177              print_test_result( GOOD );
 178          }
 179      ?>
 180  </tr>
 181  
 182  <!-- Test DATABASE part 2 -->
 183  <?php if ( db_is_connected() ) { 
 184      $t_serverinfo = $g_db->ServerInfo()
 185  ?>
 186  <tr>
 187      <td bgcolor="#ffffff">
 188          Database Type (adodb)
 189      </td>
 190      <td bgcolor="#ffffff">
 191              <?php echo $g_db->databaseType ?>
 192      </td>
 193  </tr><tr>
 194      <td bgcolor="#ffffff">
 195              Database Provider (adodb)
 196      </td>
 197      <td bgcolor="#ffffff">
 198                  <?php echo $g_db->dataProvider ?>
 199      </td>
 200  </tr><tr>
 201      <td bgcolor="#ffffff">
 202          Database Server Description (adodb)
 203      </td>
 204      <td bgcolor="#ffffff">
 205              <?php echo $t_serverinfo['description'] ?>
 206      </td>
 207  </tr><tr>
 208      <td bgcolor="#ffffff">
 209          Database Server Description (version)
 210      </td>
 211      <td bgcolor="#ffffff">
 212              <?php echo $t_serverinfo['version'] ?>
 213      </td>    
 214  </tr>
 215  <?php } ?>
 216  
 217  <!-- Absolute path check -->
 218  <tr>
 219      <td bgcolor="#ffffff">
 220          Checking to see if your absolute_path config option has a trailing slash: "<?php echo config_get_global( 'absolute_path' ) ?>"
 221      </td>
 222      <?php
 223          $t_absolute_path = config_get_global( 'absolute_path' );
 224  
 225          if ( ( "\\" == substr( $t_absolute_path, -1, 1 ) ) ||
 226               ( "/"  == substr( $t_absolute_path, -1, 1 ) ) ) {
 227              print_test_result( GOOD );
 228          } else {
 229              print_test_result( BAD );
 230          }
 231      ?>
 232  </tr>
 233  
 234  
 235  <?php
 236  # Windows-only checks
 237  if ( substr( php_uname(), 0, 7 ) == 'Windows' ) {
 238  ?>
 239  <!-- Email Validation -->
 240  <tr>
 241      <td bgcolor="#ffffff">
 242          Is validate_email set to OFF?
 243      </td>
 244      <?php
 245          if ( ON != config_get_global( 'validate_email' ) ) {
 246              print_test_result( GOOD );
 247          } else {
 248              print_test_result( BAD );
 249          }
 250      ?>
 251  </tr>
 252  
 253  <!-- MX Record Checking -->
 254  <tr>
 255      <td bgcolor="#ffffff">
 256          Is check_mx_record set to OFF?
 257      </td>
 258      <?php
 259          if ( ON != config_get_global( 'check_mx_record' ) ) {
 260              print_test_result( GOOD );
 261          } else {
 262              print_test_result( BAD );
 263          }
 264      ?>
 265  </tr>
 266  <?php } # windows-only check ?>
 267  
 268  
 269  
 270  <!-- PHP Setup check -->
 271  <?php
 272      $t_vars = array( 'magic_quotes_gpc',
 273                      'gpc_order',
 274                      'variables_order',
 275                      'include_path',
 276                      'short_open_tag',
 277                      'mssql.textsize',
 278                      'mssql.textlimit');
 279  
 280      while ( list( $t_foo, $t_var ) = each( $t_vars ) ) {
 281  ?>
 282  <tr>
 283      <td bgcolor="#ffffff">
 284          <?php echo $t_var ?>
 285      </td>
 286      <td bgcolor="#ffffff">
 287          <?php echo ini_get( $t_var ) ?>
 288      </td>
 289  </tr>
 290  <?php
 291      }
 292  
 293      test_bug_download_threshold();
 294      test_bug_attachments_allow_flags();
 295  
 296          print_test_row( 'check mail configuration: send_reset_password = ON requires allow_blank_email = OFF',
 297                  ( ( OFF == config_get_global( 'send_reset_password' ) ) || ( OFF == config_get_global( 'allow_blank_email' ) ) ) );
 298          print_test_row( 'check mail configuration: send_reset_password = ON requires enable_email_notification = ON',
 299                  ( OFF == config_get_global( 'send_reset_password' ) ) || ( ON == config_get_global( 'enable_email_notification' ) ) );
 300          print_test_row( 'check mail configuration: allow_signup = ON requires enable_email_notification = ON',
 301                  ( OFF == config_get_global( 'allow_signup' ) ) || ( ON == config_get_global( 'enable_email_notification' ) ) );
 302          print_test_row( 'check mail configuration: allow_signup = ON requires send_reset_password = ON',
 303                  ( OFF == config_get_global( 'allow_signup' ) ) || ( ON == config_get_global( 'send_reset_password' ) ) );
 304          print_test_row( 'check language configuration: fallback_language is not \'auto\'',
 305                  'auto' <> config_get_global( 'fallback_language' ) );
 306          print_test_row( 'check configuration: allow_anonymous_login = ON requires anonymous_account to be set',
 307                  ( OFF == config_get_global( 'allow_anonymous_login' ) ) || ( strlen( config_get_global( 'anonymous_account') ) > 0 ) );
 308          $t_anon_user = false;
 309          print_test_row( 'check configuration: anonymous_account is a valid username if set',
 310                  ( (strlen( config_get_global( 'anonymous_account') ) > 0 ) ? ( ($t_anon_user = user_get_id_by_name( config_get_global( 'anonymous_account') ) ) !== false ) : TRUE ) );
 311          print_test_row( 'check configuration: anonymous_account should not be an administrator',
 312                  ( $t_anon_user ? ( !access_compare_level( user_get_field( $t_anon_user, 'access_level' ), ADMINISTRATOR) ) : TRUE ) );
 313  
 314  
 315          print_test_row( '$g_bug_link_tag is not empty ("' . config_get_global( 'bug_link_tag' ) . '")',
 316                  '' <> config_get_global( 'bug_link_tag' ) );
 317          print_test_row( '$g_bugnote_link_tag is not empty ("' . config_get_global( 'bugnote_link_tag' ) . '")',
 318                  '' <> config_get_global( 'bugnote_link_tag' ) );
 319  
 320          print_test_row( 'filters: dhtml_filters = ON requires use_javascript = ON',
 321                  ( OFF == config_get_global( 'dhtml_filters' ) ) || ( ON == config_get_global( 'use_javascript' ) ) );
 322  ?>
 323  </table>
 324  
 325  <!-- register_globals check -->
 326  <?php
 327      if ( ini_get_bool( 'register_globals' ) ) { ?>
 328          <br />
 329  
 330          <table width="100%" bgcolor="#222222" border="0" cellpadding="20" cellspacing="1">
 331          <tr>
 332              <td bgcolor="#ffcc22">
 333                  <span class="title">WARNING - register_globals - WARNING</span><br /><br />
 334  
 335                  You have register_globals enabled in PHP, which is considered a security risk.  Since version 0.18, Mantis has no longer relied on register_globals being enabled.  PHP versions later that 4.2.0 have this option disabled by default.  For more information on the security issues associated with enabling register_globals, see <a href="http://www.php.net/manual/en/security.globals.php">this page</a>.
 336  
 337                  If you have no other PHP applications that rely on register_globals, you should add the line <pre>register_globals = Off</pre> to your php.ini file;  if you do have other applications that require register_globals, you could consider disabling it for your Mantis installation by adding the line <pre>php_value register_globals off</pre> to a <tt>.htaccess</tt> file or a <tt>&lt;Directory&gt;</tt> or <tt>&lt;Location&gt;</tt> block in your apache configuration file.  See the apache documentation if you require more information.
 338              </td>
 339          </tr>
 340          </table>
 341  
 342          <br /><?php
 343      }
 344  ?>
 345  
 346  <!-- login_method check -->
 347  <?php
 348      if ( CRYPT_FULL_SALT == config_get_global( 'login_method' ) ) { ?>
 349          <br />
 350  
 351          <table width="100%" bgcolor="#222222" border="0" cellpadding="20" cellspacing="1">
 352          <tr>
 353              <td bgcolor="#ff0088">
 354                  <span class="title">WARNING - login_method - WARNING</span><br /><br />
 355  
 356                  You are using CRYPT_FULL_SALT as your login method. This login method is deprecated and you should change the login method to either CRYPT (which is compatible) or MD5 (which is more secure). CRYPT_FULL_SALT will be removed in the next major release.
 357  
 358                  You can simply change the login_method in your configuration file. You don't need to do anything else, even if you migrate to MD5 (which produces incompatible hashes). This is because Mantis will automatically convert the passwords as users log in.
 359              </td>
 360          </tr>
 361          </table>
 362  
 363          <br /><?php
 364      } else if ( MD5 != config_get_global( 'login_method' ) ) { ?>
 365          <br />
 366  
 367          <table width="100%" bgcolor="#222222" border="0" cellpadding="20" cellspacing="1">
 368          <tr>
 369              <td bgcolor="#ffcc22">
 370                  <span class="title">NOTICE - login_method - NOTICE</span><br /><br />
 371  
 372                  You are not using MD5 as your login_method. The other login methods are mostly provided for backwards compatibility, but we recommend migrating to the more secure MD5.
 373  
 374                  You can simply change the login_method in your configuration file to MD5. Mantis will automatically convert the passwords as users log in.
 375              </td>
 376          </tr>
 377          </table>
 378  
 379          <br /><?php
 380      }
 381  ?>
 382  
 383  <br />
 384  
 385  
 386  <!-- Uploads -->
 387  <table width="100%" bgcolor="#222222" border="0" cellpadding="20" cellspacing="1">
 388  <tr>
 389      <td bgcolor="#f4f4f4">
 390          <span class="title">File Uploads</span><br />
 391          <?php
 392              if ( ini_get_bool( 'file_uploads' ) && config_get_global( 'allow_file_upload' ) ) {
 393          ?>
 394                  <p>File uploads are ENABLED.</p>
 395                  <p>File uploads will be stored <?php
 396                                  switch ( config_get_global( 'file_upload_method' ) ) {
 397                                      case DATABASE:
 398                                          echo 'in the DATABASE.';
 399                                          break;
 400                                      case DISK:
 401                                          echo 'on DISK in the directory specified by the project.';
 402                                          break;
 403                                      case FTP:
 404                                          echo 'on an FTP server (' . config_get_global( 'file_upload_ftp_server' ) . '), and cached locally.';
 405                                          break;
 406                                      default:
 407                                          echo 'in an illegal place.';
 408                                  } ?>    </p>
 409  
 410                  <p>The following size settings are in effect.  Maximum upload size will be whichever of these is SMALLEST. </p>
 411                  <p>PHP variable 'upload_max_filesize': <?php echo ini_get_number( 'upload_max_filesize' ) ?> bytes<br />
 412                  PHP variable 'post_max_size': <?php echo ini_get_number( 'post_max_size' ) ?> bytes<br />
 413                  Mantis variable 'max_file_size': <?php echo config_get_global( 'max_file_size' ) ?> bytes</p>
 414  
 415          <?php
 416                  if ( DATABASE == config_get_global( 'file_upload_method' ) ) {
 417                      echo '<p>There may also be settings in your web server and database that prevent you from  uploading files or limit the maximum file size.  See the documentation for those packages if you need more information. ';
 418                      if ( 500 < min( ini_get_number( 'upload_max_filesize' ), ini_get_number( 'post_max_size' ), config_get_global( 'max_file_size' ) ) ) {
 419                          echo '<span class="error">Your current settings will most likely need adjustments to the PHP max_execution_time or memory_limit settings, the MySQL max_allowed_packet setting, or equivalent.</span>';
 420                      }
 421                  } else {
 422                      echo '<p>There may also be settings in your web server that prevent you from  uploading files or limit the maximum file size.  See the documentation for those packages if you need more information.';
 423                  }
 424                  echo '</p>';
 425              } else {
 426          ?>
 427                  <p>File uploads are DISABLED.  To enable them, make sure <tt>$g_file_uploads = on</tt> is in your php.ini file and <tt>allow_file_upload = ON</tt> is in your mantis config file.</p>
 428          <?php
 429              }
 430          ?>
 431      </td>
 432  </tr>
 433  </table>
 434  
 435  <br />
 436  
 437  
 438  <!-- Email testing -->
 439  <a name="email" id="email" />
 440  <table width="100%" bgcolor="#222222" border="0" cellpadding="20" cellspacing="1">
 441  <tr>
 442      <td bgcolor="#f4f4f4">
 443          <span class="title">Testing Email</span>
 444          <p>You can test the ability for Mantis to send email notifications with this form.  Just click "Send Mail".  If the page takes a very long time to reappear or results in an error then you will need to investigate your php/mail server settings (see PHPMailer related settings in your config_inc.php, if they don't exist, copy from config_defaults_inc.php).  Note that errors can also appear in the server error log.  More help can be found at the <a href="http://www.php.net/manual/en/ref.mail.php">PHP website</a> if you are using the mail() PHPMailer sending mode.</p>
 445          <?php
 446          if ( $f_mail_test ) {
 447              echo '<b><font color="#ff0000">Testing Mail</font></b> - ';
 448   # @@@ thraxisp - workaround to ensure a language is set without authenticating
 449   #  will disappear when this is properly localized
 450              lang_push( 'english' );
 451  
 452              $t_email_data = new EmailData;
 453              $t_email_data->email = config_get_global( 'administrator_email' );
 454              $t_email_data->subject = 'Testing PHP mail() function';
 455              $t_email_data->body = 'Your PHP mail settings appear to be correctly set.';
 456              $t_email_data->metadata['priority'] = config_get( 'mail_priority' ); $t_email_data->metadata['charset'] = lang_get( 'charset', lang_get_current() );
 457              $result = email_send($t_email_data);
 458              #$result = email_send( config_get_global( 'administrator_email' ), 'Testing PHP mail() function',    'Your PHP mail settings appear to be correctly set.');
 459  
 460              if ( !$result ) {
 461                  echo ' PROBLEMS SENDING MAIL TO: ' . config_get_global( 'administrator_email' ) . '. Please check your php/mail server settings.<br />';
 462              } else {
 463                  echo ' mail() send successful.<br />';
 464              }
 465          }
 466          ?>
 467          <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>#email">
 468          Email Address: <?php echo config_get_global( 'administrator_email' ); ?><br />
 469          <input type="submit" value="Send Mail" name="mail_test" />
 470          </form>
 471      </td>
 472  </tr>
 473  </table>
 474  
 475  <br />
 476  
 477  
 478  <!-- CRYPT CHECKS -->
 479  <a name="crypt" id="crypt" />
 480  <table width="100%" bgcolor="#aa0000" border="0" cellpadding="20" cellspacing="1">
 481  <tr>
 482      <td bgcolor="#fff0f0">
 483          <span class="title">Which types of Crypt() does your installation support:</span>
 484          <p>
 485          Standard DES:
 486          <?php print_yes_no( CRYPT_STD_DES  ) ?>
 487          <br />
 488          Extended DES:
 489          <?php print_yes_no( CRYPT_EXT_DES ) ?>
 490          <br />
 491          MD5:
 492          <?php print_yes_no( CRYPT_MD5 ) ?>
 493          <br />
 494          Blowfish:
 495          <?php print_yes_no( CRYPT_BLOWFISH ) ?>
 496          </p>
 497      </td>
 498  </tr>
 499  </table>
 500  
 501  </body>
 502  </html>


Généré le : Thu Nov 29 09:42:17 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics