Fixed bug in set_company_pref()
[fa-stable.git] / admin / inst_theme.php
index fb9fad7a1c02e17897d2a8d00d0604069ece168a..af640e883b915f30f86348804f2aeb85334ce8e9 100644 (file)
@@ -14,7 +14,10 @@ $path_to_root="..";
 include_once($path_to_root . "/includes/session.inc");
 include_once($path_to_root."/includes/packages.inc");
 
-page(_($help_context = "Install Themes"));
+if ($use_popup_windows) {
+       $js = get_js_open_window(900, 500);
+}
+page(_($help_context = "Install Themes"), false, false, '', $js);
 
 include_once($path_to_root . "/includes/date_functions.inc");
 include_once($path_to_root . "/admin/db/company_db.inc");
@@ -29,15 +32,16 @@ function clean_user_themes($id)
        global $db_connections, $db, $installed_extensions;
 
        $theme = $installed_extensions[$id]['package'];
-       $db_sav = $db;
+       $comp = user_company();
 
        foreach ($db_connections as $n => $conn) {
-               $db = $_SESSION["wa_current_user"]->get_db_connection($n);
+               $db = $_SESSION["wa_current_user"]->set_db_connection($n);
                $sql = "UPDATE {$conn['tbpref']}users SET theme='default' WHERE theme='$theme'";
                if (!db_query($sql, 'Cannot update user theme settings'))
                        return false;
        }
-       $db = $db_sav;
+       $db = $_SESSION["wa_current_user"]->set_db_connection($comp);
+
        $_SESSION['wa_current_user']->prefs->theme = 'default';
        return true;
 }