예제 #1
0
function install_step3($init_data = 0)
{
    check_installed();
    global $twig;
    $connection = _create_connection();
    $serviceKernel = ServiceKernel::create('prod', true);
    $serviceKernel->setParameterBag(new ParameterBag(array('kernel' => array('root_dir' => realpath(__DIR__ . '/../../app')))));
    $serviceKernel->setConnection($connection);
    $error = null;
    if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') {
        $init = new SystemInit();
        if (!empty($init_data)) {
            $connection->exec("delete from `user` where id=1;");
            $connection->exec("delete from `user_profile` where id=1;");
        }
        $admin = $init->initAdmin($_POST);
        $init->initSiteSettings($_POST);
        if (empty($init_data)) {
            $init->initRegisterSetting($admin);
            $init->initMailerSetting($_POST['sitename']);
            $init->initPaymentSetting();
            $init->initStorageSetting();
            $init->initTag();
            $init->initCategory();
            $init->initFile();
            $init->initPages();
            $init->initNavigations();
            $init->initBlocks();
            $init->initThemes();
            $init->initRefundSetting();
            $init->initArticleSetting();
            $init->initDefaultSetting();
            $init->initCrontabJob();
        } else {
            $init->deleteKey();
            $connection->exec("update `user_profile` set id = 1 where id = (select id from `user` where nickname = '" . $_POST['nickname'] . "');");
            $connection->exec("update `user` set id = 1 where nickname = '" . $_POST['nickname'] . "';");
        }
        $init->initLockFile();
        header("Location: start-install.php?step=4");
        exit;
    }
    echo $twig->render('step-3.html.twig', array('step' => 3, 'error' => $error, 'request' => $_POST));
}