Backup and Restore: system settings has not been refreshed after restore (typo).
[fa-stable.git] / admin / inst_theme.php
index baea29cf5d2f54e84a14fb49c74b3faac07ee53f..70d8eb60a34afbc5768c5d6704e634a07367fa25 100644 (file)
@@ -14,7 +14,7 @@ $path_to_root="..";
 include_once($path_to_root . "/includes/session.inc");
 include_once($path_to_root."/includes/packages.inc");
 
-if ($use_popup_windows) {
+if ($SysPrefs->use_popup_windows) {
        $js = get_js_open_window(900, 500);
 }
 page(_($help_context = "Install Themes"), false, false, '', $js);
@@ -25,27 +25,9 @@ include_once($path_to_root . "/admin/db/maintenance_db.inc");
 include_once($path_to_root . "/includes/ui.inc");
 
 //---------------------------------------------------------------------------------------------
-// If theme is used in customer record set to default
-//
-function clean_user_themes($id)
-{
-       global $db_connections, $db, $installed_extensions;
-
-       $theme = $installed_extensions[$id]['package'];
-       $db_sav = $db;
-
-       foreach ($db_connections as $n => $conn) {
-               $db = $_SESSION["wa_current_user"]->get_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;
-       $_SESSION['wa_current_user']->prefs->theme = 'default';
-       return true;
-}
 
-if (($id = find_submit('Delete', false)) && clean_user_themes($id))
+if (($id = find_submit('Delete', false))
+       && clean_user_themes($installed_extensions[$id]['package']))
 {
        $extensions = get_company_extensions();
        $theme = $extensions[$id]['package'];
@@ -116,4 +98,3 @@ start_form(true);
 end_form();
 
 end_page();
-?>
\ No newline at end of file