예제 #1
0
파일: theme.php 프로젝트: jewelhuq/okatea
            $repository = urldecode($_GET['repository']);
            $theme = urldecode($_GET['theme']);
            $url = urldecode($aThemesRepositories[$repository][$theme]['href']);
            $dest = OKT_THEMES_PATH . '/' . basename($url);
            try {
                $client = netHttp::initClient($url, $path);
                $client->setUserAgent('Okatea');
                $client->useGzip(false);
                $client->setPersistReferers(false);
                $client->setOutput($dest);
                $client->get($path);
            } catch (Exception $e) {
                throw new Exception(__('An error occurred while downloading the file.'));
            }
            unset($client);
            $ret_code = $oThemes->installPackage($dest, $oThemes);
            http::redirect('index.php?step=theme&p_theme=' . $theme);
        } catch (Exception $e) {
            $okt->error->set($e->getMessage());
        }
    } else {
        if (!empty($_POST['bootstrap'])) {
            try {
                $theme = $oThemes->bootstrapTheme($_POST['bootstrap_theme_name'], !empty($_POST['bootstrap_theme_id']) ? $_POST['bootstrap_theme_id'] : null);
                http::redirect('index.php?step=' . $stepper->getCurrentStep() . '&p_theme=' . $theme);
            } catch (Exception $e) {
                $okt->error->set($e->getMessage());
            }
        }
    }
}