コード例 #1
0
ファイル: themes.php プロジェクト: Nerus87/PsychoStats
             // 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';
             $msg = $cms->trans("Error writting to database: %s", $ps->db->errstr);
         } else {
             $msg = $cms->trans("Theme '%s' was uninstalled successfully (note: directory was not deleted)", $t->xml_title());
         }
     }
 } else {
     $enabled = $action == 'enable' ? 1 : 0;
     if ($ps->conf['main']['theme'] == $t->xml_name() and !$enabled) {
         $res = 'failure';
         $title = $cms->trans("Operation Failed!");
         $msg = $cms->trans('You can not disable the active theme');
     } elseif ($t->enabled() != $enabled) {
         if ($t->toggle($enabled)) {
             $msg = $enabled ? $cms->trans("Theme '%s' was enabled", $t->xml_name()) : $cms->trans("Theme '%s' was disabled", $t->xml_name());