@@ -298,7 +298,7 @@ function initialize_inputs()
298298
299299 $ db_connection = false ;
300300 $ sources_exist = false ;
301- $ context ['smfVersion ' ] = '1.1 ' ;
301+ $ context ['smfVersion ' ] = 'N/A ' ;
302302 $ sources_found_path = '' ;
303303 if (isset ($ sourcedir ) && (file_exists (dirname (__FILE__ ) . '/Sources/Load.php ' )))
304304 $ sources_exist = true ;
@@ -339,6 +339,7 @@ function initialize_inputs()
339339 // This is SMF 1.x as far as we can tell, as we don't know/have any database files.
340340 elseif (!file_exists ($ sourcedir . '/Subs-Db- ' . $ db_type . '.php ' ) && $ db_type == 'mysql ' )
341341 {
342+ $ context ['smfVersion ' ] = '1.1 ' ;
342343 $ db_connection = smc_compat_initiate ($ db_server , $ db_name , $ db_user , $ db_passwd , $ db_prefix , array ('non_fatal ' => true ));
343344 }
344345 else
@@ -347,7 +348,6 @@ function initialize_inputs()
347348 $ context ['is_legacy ' ] = false ;
348349 $ context ['smfVersion ' ] = '2.0 ' ;
349350
350-
351351 // Try to see if this is 2.1. Maybe include more checks.
352352 if (file_exists ($ sourcedir . '/Class-TOTP.php ' ))
353353 $ context ['smfVersion ' ] = '2.1 ' ;
@@ -540,8 +540,8 @@ function show_settings()
540540 unset($ known_settings ['database_settings ' ]['ssi_db_user ' ], $ known_settings ['database_settings ' ]['ssi_db_passwd ' ], $ known_settings ['cache_settings ' ]['cachedir ' ], $ known_settings ['path_url_settings ' ]['custom_avatar_url ' ], $ known_settings ['path_url_settings ' ]['custom_avatar_dir ' ]);
541541
542542 // These settings didn't exist in 2.0 or 1.1
543- if ($ context ['smfVersion ' ] != '2.1 ' )
544- unset($ known_settings ['cache_settings ' ]['cache_accelerator ' ], $ known_settings ['cache_settings ' ]['cache_enable ' ], $ known_settings ['cache_settings ' ]['cache_memcached ' ]);
543+ if ($ context ['smfVersion ' ] == '2.0 ' || $ context [ ' smfVersion ' ] == ' 1 .1 ' )
544+ unset($ known_settings ['cache_settings ' ]['cache_accelerator ' ], $ known_settings ['cache_settings ' ]['cache_enable ' ], $ known_settings ['cache_settings ' ]['cache_memcached ' ], $ known_settings [ ' path_url_settings ' ][ ' tasksdir ' ], $ known_settings [ ' path_url_settings ' ][ ' packagesdir ' ] );
545545
546546 // Let's assume we don't want to change the current theme
547547 $ settings ['theme_default ' ] = 0 ;
@@ -752,9 +752,10 @@ function restoreAll()
752752 {
753753 if (!is_array ($ settings [$ setting ]) && $ context ['smfVersion ' ] == '2.1 ' )
754754 $ array_settings = json_decode ($ settings [$ setting ], true );
755- if (!is_array ($ array_settings ) && !is_array ($ settings [$ setting ]))
755+ // Maybe its a seraialized array, we only support those, so test for it in a simple way.
756+ if (!(isset ($ array_settings ) && is_array ($ array_settings )) && !is_array ($ settings [$ setting ]))
756757 $ array_settings = @unserialize ($ settings [$ setting ]);
757- if (!is_array ($ array_settings ))
758+ if (!isset ( $ array_settings ) || ! is_array ($ array_settings ))
758759 $ array_settings = array ($ settings [$ setting ]);
759760
760761 $ item = 1 ;
0 commit comments