Browse Source

More PHP 5.2 install compatibility

https://github.com/FreshRSS/FreshRSS/issues/1055
Alexandre Alapetite 10 years ago
parent
commit
af94273913
2 changed files with 15 additions and 15 deletions
  1. 3 3
      app/install.php
  2. 12 12
      lib/lib_rss.php

+ 3 - 3
app/install.php

@@ -130,7 +130,7 @@ function saveStep2() {
 		$_SESSION['mail_login'] = filter_var(param('mail_login', ''), FILTER_VALIDATE_EMAIL);
 
 		$password_plain = param('passwordPlain', false);
-		if ($password_plain !== false) {
+		if ($password_plain !== false && cryptAvailable()) {
 			if (!function_exists('password_hash')) {
 				include_once(LIB_PATH . '/password_compat.php');
 			}
@@ -681,10 +681,10 @@ function printStep2() {
 						}
 						$auth_type = isset($_SESSION['auth_type']) ? $_SESSION['auth_type'] : '';
 					?>
-					<option value="form"<?php echo $auth_type === 'form' || no_auth($auth_type) ? ' selected="selected"' : '', cryptAvailable() ? '' : ' disabled="disabled"'; ?>><?php echo _t('install.auth.form'); ?></option>
+					<option value="form"<?php echo $auth_type === 'form' || (no_auth($auth_type) && cryptAvailable()) ? ' selected="selected"' : '', cryptAvailable() ? '' : ' disabled="disabled"'; ?>><?php echo _t('install.auth.form'); ?></option>
 					<option value="persona"<?php echo $auth_type === 'persona' ? ' selected="selected"' : ''; ?>><?php echo _t('install.auth.persona'); ?></option>
 					<option value="http_auth"<?php echo $auth_type === 'http_auth' ? ' selected="selected"' : '', httpAuthUser() == '' ? ' disabled="disabled"' : ''; ?>><?php echo _t('install.auth.http'); ?>(REMOTE_USER = '<?php echo httpAuthUser(); ?>')</option>
-					<option value="none"<?php echo $auth_type === 'none' ? ' selected="selected"' : ''; ?>><?php echo _t('install.auth.none'); ?></option>
+					<option value="none"<?php echo $auth_type === 'none' || (no_auth($auth_type) && !cryptAvailable()) ? ' selected="selected"' : ''; ?>><?php echo _t('install.auth.none'); ?></option>
 				</select>
 			</div>
 		</div>

+ 12 - 12
lib/lib_rss.php

@@ -16,19 +16,19 @@ if (!function_exists('json_encode')) {
 }
 
 if (!function_exists('array_replace_recursive')) {
-	function array_replace_recursive($array, $array1) {	//http://php.net/manual/function.array-replace-recursive.php#92574
-		function recurse($array, $array1) {
-			foreach ($array1 as $key => $value) {
-				if (!isset($array[$key]) || (isset($array[$key]) && !is_array($array[$key]))) {
-					$array[$key] = array();	//create new key in $array, if it is empty or not an array
-				}
-				if (is_array($value)) {
-					$value = recurse($array[$key], $value);	// overwrite the value in the base array
-				}
-				$array[$key] = $value;
+	function arr_recurse($array, $array1) {
+		foreach ($array1 as $key => $value) {
+			if (!isset($array[$key]) || (isset($array[$key]) && !is_array($array[$key]))) {
+				$array[$key] = array();	//create new key in $array, if it is empty or not an array
 			}
-			return $array;
+			if (is_array($value)) {
+				$value = arr_recurse($array[$key], $value);	// overwrite the value in the base array
+			}
+			$array[$key] = $value;
 		}
+		return $array;
+	}
+	function array_replace_recursive($array, $array1) {	//http://php.net/manual/function.array-replace-recursive.php#92574
 		// handle the arguments, merge one by one
 		$args = func_get_args();
 		$array = $args[0];
@@ -37,7 +37,7 @@ if (!function_exists('array_replace_recursive')) {
 		}
 		for ($i = 1; $i < count($args); $i++) {
 			if (is_array($args[$i])) {
-				$array = recurse($array, $args[$i]);
+				$array = arr_recurse($array, $args[$i]);
 			}
 		}
 		return $array;