コード例 #1
0
ファイル: themes.php プロジェクト: Nerus87/PsychoStats
    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()));
        }
    }
    // if there are no errors and 'confirm' was specified then install the theme
    if ($submit and $confirm) {
        if ($newtheme->install()) {
            $message = $cms->message('success', array('message_title' => "Theme installed successfully!", 'message' => "Theme \"" . $newtheme->xml_title() . "\" was installed successfully and is now available for use."));
        } else {
            // theme did not install properly
            $message = $cms->message('failure', array('message_title' => "Error installing theme", 'message' => $newtheme->error()));
        }
    }
} else {