if (!$t->load_theme_db($id)) { $cms->full_page_err(basename(__FILE__, '.php'), array('message' => $cms->trans("Invalid Theme Specified"))); exit; } $res = 'success'; $msg = ''; $title = $cms->trans("Operation was successful!"); if ($action == 'default') { if ($ps->conf['main']['theme'] != $t->xml_name()) { // don't do it if the current default matches the name $ok = $ps->db->query("UPDATE {$ps->t_config} SET value=" . $ps->db->escape($t->xml_name(), true) . " WHERE conftype='main' AND (section='' OR ISNULL(section)) AND var='theme'"); if ($ok) { $msg = $cms->trans("Theme '%s' is now the default theme", $t->xml_name()); $ps->conf['main']['theme'] = $t->xml_name(); // always make sure the new default theme is enabled if (!$t->enabled()) { $ps->db->update($ps->t_config_themes, array('enabled' => 1), 'name', $t->xml_name()); } } else { $res = 'failure'; $msg = $cms->trans("Error writting to database: %s", $ps->db->errstr); } } } elseif ($action == 'uninstall') { // do not uninstall the current theme, or any theme named 'default' if ($ps->conf['main']['theme'] == $t->xml_name() or $t->xml_name() == 'default') { $res = 'failure'; $msg = $cms->trans("You can not uninstall the default or currently active theme!"); } else { if (!$t->uninstall()) { $res = 'failure';