]> git.mjollnir.org Git - moodle.git/commitdiff
Check if url-based fopen() is enebled before trying to use it.
authorpaca70 <paca70>
Fri, 22 Oct 2004 10:15:56 +0000 (10:15 +0000)
committerpaca70 <paca70>
Fri, 22 Oct 2004 10:15:56 +0000 (10:15 +0000)
install.php

index 9fea71ddbdd55a3871d185bb765c8fc5d4047e59..4916f1ae470b4730d690211032edd3de690c9c6c 100644 (file)
@@ -162,26 +162,26 @@ if ($INSTALL['stage'] == 2) {
     if (($fh = @fopen($INSTALL['dirroot'].'/install.php', 'r')) === false ) {
         $CFG->dirroot = dirname(__FILE__);
         $INSTALL['dirroot'] = dirname(__FILE__);
-        $errormsg = get_string('dirrooterror', 'install');
-    } else {
-        fclose($fh);
+        $errormsg .= get_string('dirrooterror', 'install').'<br />';
+    } 
+    if ($fh) fclose($fh);
             
-        $CFG->dirroot = $INSTALL['dirroot'];
+    $CFG->dirroot = $INSTALL['dirroot'];
 
-        /// check wwwroot
+    /// check wwwroot
+    if (ini_get('allow_url_fopen')) {
         if (($fh = @fopen($INSTALL['wwwroot'].'/install.php', 'r')) === false) {
-            $errormsg = get_string('wwwrooterror', 'install');
-        } else {
-            fclose($fh);
-
-            /// check dataroot
-            $CFG->dataroot = $INSTALL['dataroot'];
-            if (make_upload_directory('sessions', false) === false ) {
-                $errormsg = get_string('datarooterror', 'install');
-            }            
+            $errormsg .= get_string('wwwrooterror', 'install').'<br />';
         }
     }
-    
+    if ($fh) fclose($fh);
+
+    /// check dataroot
+    $CFG->dataroot = $INSTALL['dataroot'];
+    if (make_upload_directory('sessions', false) === false ) {
+        $errormsg = get_string('datarooterror', 'install').'<br />';
+    }
+    if ($fh) fclose($fh); 
 
     if (!empty($errormsg)) $nextstage = 2;
 
@@ -555,7 +555,7 @@ function form_table($nextstage = 0, $formaction = "install.php") {
             <tr>
                 <td class="td_left"><p><?php print_string('password') ?></p></td>
                 <td class="td_right">
-                    <input type="text" size="40" name="dbpass" value="<?php echo $INSTALL['dbpass'] ?>" />
+                    <input type="password" size="40" name="dbpass" value="<?php echo $INSTALL['dbpass'] ?>" />
                 </td>
             </tr>
             <tr>