Exemple #1
0
// +-----------------------------------------------------------------------+
// |                           setup check                                 |
// +-----------------------------------------------------------------------+
$themes_dir = PHPWG_ROOT_PATH . 'themes';
if (!is_writable($themes_dir)) {
    $page['errors'][] = l10n('Add write access to the "%s" directory', 'themes');
}
// +-----------------------------------------------------------------------+
// |                       perform installation                            |
// +-----------------------------------------------------------------------+
if (isset($_GET['revision']) and isset($_GET['extension'])) {
    if (!is_webmaster()) {
        $page['errors'][] = l10n('Webmaster status is required.');
    } else {
        check_pwg_token();
        $install_status = $themes->extract_theme_files('install', $_GET['revision'], $_GET['extension']);
        redirect($base_url . '&installstatus=' . $install_status);
    }
}
// +-----------------------------------------------------------------------+
// |                        installation result                            |
// +-----------------------------------------------------------------------+
if (isset($_GET['installstatus'])) {
    switch ($_GET['installstatus']) {
        case 'ok':
            $page['infos'][] = l10n('Theme has been successfully installed');
            break;
        case 'temp_path_error':
            $page['errors'][] = l10n('Can\'t create temporary file.');
            break;
        case 'dl_archive_error':