Example #1
0
    }
}
$settings->apply_language($language);
// Updated settings?
if (legacy_request_var('update_all', false)) {
    $settings->update_profiles();
} else {
    if (!empty($settings->update_text)) {
        $update_title = sprintf($user->lang['PROFILE_UPDATED'], $settings->profile);
        $update_explain = sprintf($user->lang['UPDATED_EXPLAIN'], QI_VERSION);
        $update_msg = '<ul>';
        foreach ($settings->update_text as $update) {
            $update_msg .= '<li>' . $user->lang[$update] . '</li>';
        }
        $update_msg .= '</ul>';
        gen_error_msg($update_msg, $update_title, $update_explain, true);
    }
}
// Probably best place to validate the settings
$settings->validate();
$error = $settings->get_error();
$page = empty($error) ? $page : 'settings';
if ($page == 'main' || $page == 'settings' || $alt_env_missing) {
    if ($settings->install || $settings->is_converted || $mode == 'update_settings' || $page == 'settings' || $alt_env_missing) {
        $page = 'settings';
        require $quickinstall_path . 'includes/qi_settings.' . $phpEx;
    }
}
// Hide manage boards if there is no saved config.
$template->assign_var('S_IN_INSTALL', $settings->install);
// now create a module_handler object
 /**
  * Updates users all profiles if there are more than one.
  */
 function update_profiles()
 {
     global $quickinstall_path, $phpEx, $user;
     $cfg_bak = $this->config;
     $profil_bak = $this->profile;
     $path = $quickinstall_path . 'settings';
     $dh = opendir($path);
     $update_msg = '';
     while (($file = readdir($dh)) !== false) {
         if (empty($file) || $file[0] === '.' || substr($file, -4) !== '.cfg' || !is_readable("{$path}/{$file}")) {
             continue;
         }
         $config = file("{$path}/{$file}", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
         $this->profile = substr($file, 0, -4);
         $this->set_config_array($config);
         $this->config = $this->check_updates($this->config);
         if (!empty($this->update_text)) {
             $this->update();
             $this->update_text = array();
             $update_msg .= '<li>' . $this->profile . '</li>';
         }
     }
     closedir($dh);
     $this->config = $cfg_bak;
     $this->profile = $profil_bak;
     if (!empty($update_msg)) {
         $update_msg = "<ul>{$update_msg}</ul>";
         gen_error_msg($update_msg, $user->lang['PROFILES_UPDATED'], $update_explain);
     }
 }