コード例 #1
0
 function reinstall($name)
 {
     $t = new PsychoThemeManager($this->ps, $this->template_dir);
     $ok = $t->load_theme(catfile($this->template_dir, $name, 'theme.xml'), true);
     if ($ok) {
         $ok = $t->save_db();
     }
     if (!$ok) {
         $this->error($t->error());
     }
     return $ok ? $t : false;
 }
コード例 #2
0
ファイル: themes.php プロジェクト: Nerus87/PsychoStats
$allow['install'] = $allow['url'] && $allow['write'];
ini_set('user_agent', "PsychoStats Theme Installer");
$newtheme = new PsychoThemeManager($ps);
if ($cancel) {
    $submit = false;
}
if ($reinstall and $dir) {
    // reinstall a local theme already on the hard drive
    $dir = basename($dir);
    // remove any potentially malicous paths
    if (file_exists(catfile($newtheme->template_dir, $dir))) {
        $t = $newtheme->reinstall($dir);
        if ($t) {
            $message = $cms->message('success', array('message_title' => "Theme reinstalled successfully!", 'message' => "Theme \"" . $t->xml_title() . "\" was installed successfully and is now available for use."));
        } else {
            $message = $cms->message('theme-failure', array('message_title' => "Error reinstalling theme", 'message' => $newtheme->error()));
        }
    } else {
        $message = $cms->message('theme-failure', array('message_title' => "Error installing theme", 'message' => "Theme not found!"));
    }
} elseif ($submit and $url and $allow['install']) {
    // attempt to install new theme if one is submitted
    $newtheme->load_theme($url);
    if ($newtheme->error()) {
        $submit = false;
        if ($newtheme->code() != PSTHEME_ERR_XML) {
            $message = $cms->message('theme-failure', array('message_title' => "Error installing theme", 'message' => $newtheme->error()));
        } else {
            $message = $cms->message('theme-failure', array('url' => $url, 'invalid' => $newtheme->invalid_list()));
        }
    }