コード例 #1
0
ファイル: app.php プロジェクト: ClaudioThomas/shopware-4
 * "Shopware" is a registered trademark of shopware AG.
 * The licensing of the program under the AGPLv3 does not imply a
 * trademark license. Therefore any rights, title and interest in
 * our trademarks remain entirely with us.
 */
use Shopware\Recovery\Update\DependencyInjection\Container;
use Shopware\Recovery\Update\Utils;
date_default_timezone_set('Europe/Berlin');
ini_set('display_errors', 1);
error_reporting(-1);
$config = (require __DIR__ . '/../config/config.php');
$container = new Container(new Pimple(), $config);
/** @var \Slim\Slim $app */
$app = $container->get('app');
$app->hook('slim.before.dispatch', function () use($app, $container) {
    $baseUrl = \Shopware\Recovery\Common\Utils::getBaseUrl($app);
    $lang = null;
    if (!UPDATE_IS_MANUAL) {
        if (!is_file(UPDATE_META_FILE)) {
            $shopPath = str_replace('/recovery/update', '/', $app->request()->getRootUri());
            $app->response()->redirect($shopPath);
            $app->response()->status(302);
            $app->stop();
        }
        $file = file_get_contents(UPDATE_META_FILE);
        $updateConfig = json_decode($file, true);
        $container->setParameter('update.config', $updateConfig);
        $lang = substr($updateConfig['locale'], 0, 2);
    }
    session_set_cookie_params(7200, $baseUrl);
    //Silence errors during session start, Work around session_start(): ps_files_cleanup_dir: opendir(/var/lib/php5) failed: Permission denied (13)
コード例 #2
0
ファイル: app.php プロジェクト: ClaudioThomas/shopware-4
    $database = $app->container->get('install.database');
    if (!$database->setDatabase()) {
        throw new \Exception($database->getError());
    }
    $pdo = $database->getDatabase();
    $license = new \Shopware\Recovery\Install\License($pdo);
    return $license;
});
$app->config('install.configuration', new \Shopware\Recovery\Install\Configuration());
$app->config('install.requirements', new \Shopware\Recovery\Install\Requirements(__DIR__ . '/../data/System.xml'));
$app->config('install.requirementsPath', new \Shopware\Recovery\Install\RequirementsPath(SW_PATH, __DIR__ . '/../data/Path.xml'));
$app->config('install.language', $selectedLanguage);
// Set global variables
$app->view()->setData("selectedLanguage", $selectedLanguage);
$app->view()->setData("language", $language);
$app->view()->setData("baseUrl", Utils::getBaseUrl($app));
$app->view()->setData("app", $app);
$app->view()->setData("error", false);
$app->view()->setData("parameters", $_SESSION["parameters"]);
$app->error(function (Exception $e) use($app) {
    if (!$app->request()->isAjax()) {
        throw $e;
    }
    $response = $app->response();
    $data = array('code' => $e->getCode(), 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTraceAsString());
    $response['Content-Type'] = 'application/json';
    $response->body(json_encode($data));
});
// Step 1: Select language
$app->map('/', function () use($app) {
    $app->render("/step1.php", array());
コード例 #3
0
ファイル: app.php プロジェクト: GerDner/luck-docker
prefixSessionVars($app);
$selectedLanguage = selectLanguage();
$translations = (require __DIR__ . "/../data/lang/{$selectedLanguage}.php");
$container->offsetSet('translations', $translations);
/** @var $translationService TranslationService */
$translationService = $container->offsetGet('translation.service');
$container->offsetSet('install.language', $selectedLanguage);
/** @var $helper MenuHelper */
$menuHelper = $container->offsetGet('menu.helper');
// Set global variables
$app->view()->setData('version', $container->offsetGet('shopware.version'));
$app->view()->setData('t', $translationService);
$app->view()->setData('menuHelper', $menuHelper);
$app->view()->setData('selectedLanguage', $selectedLanguage);
$app->view()->setData('translations', $translations);
$app->view()->setData('baseUrl', Utils::getBaseUrl($app));
$app->view()->setData('app', $app);
$app->view()->setData('error', false);
$app->view()->setData('parameters', $_SESSION["parameters"]);
$app->error(function (\Exception $e) use($app) {
    if (!$app->request()->isAjax()) {
        throw $e;
    }
    $response = $app->response();
    $data = ['code' => $e->getCode(), 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTraceAsString()];
    $response->header('Content-Type', 'application/json');
    $response->body(json_encode($data));
});
$app->map('/', function () use($app, $container, $menuHelper) {
    $menuHelper->setCurrent('language-selection');
    $app->view()->set('languages', ['de', 'en', 'nl']);