install/includes/stages/sysreqs.php
changeset 857 f3a5a276208c
parent 852 e1ce6a91469b
child 932 d5437edb6c1c
equal deleted inserted replaced
856:0b7ff06aad13 857:f3a5a276208c
    46 {
    46 {
    47   $r = strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') ? true : false;
    47   $r = strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') ? true : false;
    48   return $r;
    48   return $r;
    49 }
    49 }
    50 
    50 
    51 function write_test($filename)
       
    52 {
       
    53   // We need to actually _open_ the file to make sure it can be written, because sometimes this fails even when is_writable() returns
       
    54   // true on Windows/IIS servers. Don't ask me why.
       
    55   
       
    56   $file = ENANO_ROOT . '/' . $filename;
       
    57   if ( is_dir($file) )
       
    58   {
       
    59     $file = rtrim($file, '/') . '/' . 'enanoinstalltest.txt';
       
    60     if ( file_exists($file) )
       
    61     {
       
    62       $fp = @fopen($file, 'a+');
       
    63       if ( !$fp )
       
    64         return false;
       
    65       fclose($fp);
       
    66       unlink($file);
       
    67       return true;
       
    68     }
       
    69     else
       
    70     {
       
    71       $fp = @fopen($file, 'w');
       
    72       if ( !$fp )
       
    73         return false;
       
    74       fclose($fp);
       
    75       unlink($file);
       
    76       return true;
       
    77     }
       
    78   }
       
    79   else
       
    80   {
       
    81     if ( file_exists($file) )
       
    82     {
       
    83       $fp = @fopen($file, 'a+');
       
    84       if ( !$fp )
       
    85         return false;
       
    86       fclose($fp);
       
    87       return true;
       
    88     }
       
    89     else
       
    90     {
       
    91       $fp = @fopen($file, 'w');
       
    92       if ( !$fp )
       
    93         return false;
       
    94       fclose($fp);
       
    95       return true;
       
    96     }
       
    97   }
       
    98 }
       
    99 
       
   100 $warnings = array();
    51 $warnings = array();
   101 $failed = false;
    52 $failed = false;
   102 $have_dbms = false;
    53 $have_dbms = false;
   103 
    54 
   104 // Test: Apache
    55 // Test: Apache
   118 {
    69 {
   119   $failed = true;
    70   $failed = true;
   120   $req_php = 'bad';
    71   $req_php = 'bad';
   121 }
    72 }
   122 
    73 
       
    74 // Test: Safe Mode
   123 $req_safemode = !intval(@ini_get('safe_mode'));
    75 $req_safemode = !intval(@ini_get('safe_mode'));
   124 if ( !$req_safemode )
    76 if ( !$req_safemode )
   125 {
    77 {
   126   $warnings[] = $lang->get('sysreqs_req_help_safemode');
    78   $warnings[] = $lang->get('sysreqs_req_help_safemode');
   127   $failed = true;
    79   $failed = true;
   140 if ( !$have_dbms )
    92 if ( !$have_dbms )
   141   $failed = true;
    93   $failed = true;
   142 
    94 
   143 // Test: File uploads
    95 // Test: File uploads
   144 $req_uploads = intval(@ini_get('file_uploads'));
    96 $req_uploads = intval(@ini_get('file_uploads'));
       
    97 
       
    98 // Test: ctype validation
       
    99 $req_ctype = function_exists('ctype_digit');
       
   100 if ( !$req_ctype )
       
   101   $failed = true;
   145 
   102 
   146 // Writability test: config
   103 // Writability test: config
   147 $req_config_w = write_test('config.new.php');
   104 $req_config_w = write_test('config.new.php');
   148 
   105 
   149 // Writability test: .htaccess
   106 // Writability test: .htaccess
   240 endif;        
   197 endif;        
   241 ?>
   198 ?>
   242  
   199  
   243 <table border="0" cellspacing="0" cellpadding="0" class="sysreqs">
   200 <table border="0" cellspacing="0" cellpadding="0" class="sysreqs">
   244 
   201 
   245 <?php
       
   246 /*
       
   247   
       
   248   </div>
       
   249 <?php
       
   250 }
       
   251 else
       
   252 {
       
   253   if ( $failed )
       
   254   {
       
   255     echo '<div class="pagenav"><table border="0" cellspacing="0" cellpadding="0">';
       
   256     run_test('return false;', $lang->get('sysreqs_summary_fail_title'), $lang->get('sysreqs_summary_fail_body'));
       
   257     echo '</table></div>';
       
   258   }
       
   259 }
       
   260 */
       
   261 ?>
       
   262 
       
   263 <tr>
   202 <tr>
   264   <th colspan="2"><?php echo $lang->get('sysreqs_heading_serverenv'); ?></th>
   203   <th colspan="2"><?php echo $lang->get('sysreqs_heading_serverenv'); ?></th>
   265 </tr>
   204 </tr>
   266 
   205 
   267 <tr>
   206 <tr>
   296   <?php
   235   <?php
   297   if ( $req_uploads ):
   236   if ( $req_uploads ):
   298     echo '<td class="good">' . $lang->get('sysreqs_req_enabled') . '</td>';
   237     echo '<td class="good">' . $lang->get('sysreqs_req_enabled') . '</td>';
   299   else:
   238   else:
   300     echo '<td class="bad">' . $lang->get('sysreqs_req_disabled') . '</td>';
   239     echo '<td class="bad">' . $lang->get('sysreqs_req_disabled') . '</td>';
       
   240   endif;
       
   241   ?>
       
   242 </tr>
       
   243 
       
   244 <tr>
       
   245   <td><?php echo $lang->get('sysreqs_req_ctype'); ?></td>
       
   246   <?php
       
   247   if ( $req_ctype ):
       
   248     echo '<td class="good">' . $lang->get('sysreqs_req_supported') . '</td>';
       
   249   else:
       
   250     echo '<td class="bad">' . $lang->get('sysreqs_req_unsupported') . '</td>';
   301   endif;
   251   endif;
   302   ?>
   252   ?>
   303 </tr>
   253 </tr>
   304 
   254 
   305 <tr>
   255 <tr>