Esempio n. 1
0
<?php

/*************************************************************************************/
/*      This file is part of the Thelia package.                                     */
/*                                                                                   */
/*      Copyright (c) OpenStudio                                                     */
/*      email : dev@thelia.net                                                       */
/*      web : http://www.thelia.net                                                  */
/*                                                                                   */
/*      For the full copyright and license information, please view the LICENSE.txt  */
/*      file that was distributed with this source code.                             */
/*************************************************************************************/
use Thelia\Core\Thelia;
use Thelia\Core\HttpFoundation\Response;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\HttpKernel\HttpCache\HttpCache;
//use Symfony\Component\DependencyInjection;
$env = 'dev';
require __DIR__ . '/../core/vendor/autoload.php';
// List of allowed IP
$trustedIp = array('::1', '127.0.0.1');
$request = Request::createFromGlobals();
$thelia = new Thelia("dev", true);
if (false === in_array($request->getClientIp(), $trustedIp)) {
    $response = Response::create('Forbidden', 403)->send();
    $thelia->terminate($request, $response);
} else {
    $response = $thelia->handle($request)->prepare($request)->send();
    $thelia->terminate($request, $response);
}
Esempio n. 2
0
        \Thelia\Model\ConfigQuery::create()->filterByName('store_notification_emails')->update(array('Value' => $_POST['store_email']));
        \Thelia\Model\ConfigQuery::create()->filterByName('store_name')->update(array('Value' => $_POST['store_name']));
        \Thelia\Model\ConfigQuery::create()->filterByName('url_site')->update(array('Value' => $_POST['url_site']));
        $lang = \Thelia\Model\LangQuery::create()->findOneByLocale(empty($_POST['shop_locale']) ? "en_US" : $_POST['shop_locale']);
        if (null !== $lang) {
            $lang->toggleDefault();
        }
        $secret = \Thelia\Tools\TokenProvider::generateToken();
        \Thelia\Model\ConfigQuery::write('form.secret', $secret, 0, 0);
    }
    //clean up cache directories
    $fs = new \Symfony\Component\Filesystem\Filesystem();
    $fs->remove(THELIA_ROOT . '/cache/prod');
    $fs->remove(THELIA_ROOT . '/cache/dev');
    $fs->remove(THELIA_ROOT . '/cache/install');
    $request = \Thelia\Core\HttpFoundation\Request::createFromGlobals();
    $_SESSION['install']['step'] = $step;
    // Retrieve the website url
    $url = $_SERVER['PHP_SELF'];
    $website_url = preg_replace("#/install/[a-z](.*)#", '', $url);
    ?>
    <div class="well">
        <p class="lead text-center">
            <?php 
    echo $trans->trans('Thelia is now installed. Thank you !');
    ?>
        </p>

<?php 
    $scriptHook = <<<SCRIPT
<script>