/
header.php
130 lines (114 loc) · 5.94 KB
/
header.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?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. */
/*************************************************************************************/
ini_set('display_errors', '1');
set_time_limit(0);
ob_start();
session_start();
include 'bootstrap.php';
use Symfony\Component\Translation\Translator;
$lang = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : null;
if($lang){
$_SESSION['install']['lang'] = $_REQUEST['lang'];
}
elseif(!$lang && !isset($_SESSION['install']['lang'])){
$_SESSION['install']['lang'] = "en_US";
}
$trans = new Translator($_SESSION['install']['lang']);
$trans->addLoader("php", new Symfony\Component\Translation\Loader\PhpFileLoader());
$trans->addResource('php', __DIR__.'/I18n/'.$_SESSION['install']['lang'].'.php', $_SESSION['install']['lang']);
if (!isset($context)) {
$context = 'install';
}
// Check if we store is already configured and if we have to switch on an update process
if ($context == "install" && $step == 1) {
try {
$checkPermission = new \Thelia\Install\CheckPermission(true, $trans);
$isValid = $checkPermission->exec();
$validationMessage = $checkPermission->getValidationMessages();
} catch (\Thelia\Install\Exception\AlreadyInstallException $ex) {
$update = new \Thelia\Install\Update(false);
if (!$update->isLatestVersion()) {
$updateLocation = str_replace('/index.php', '', $_SERVER["REQUEST_URI"]) . '/update.php';
header("Location: " . $updateLocation);
die();
}
}
}
?>
<!DOCTYPE html>
<html lang="">
<head>
<title><?php
if ($context == "install") {
echo $trans->trans('Installation');
} else {
echo $trans->trans('Update');
}
?></title>
<link rel="shortcut icon" href="../favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<style>
<?php
// because the installation folder is deleted after the update
echo file_get_contents('styles.css');
?>
</style>
</head>
<body>
<div class="topbar">
<div class="container">
<div class="row">
<div class="col-md-6">
<div class="version-info">
<?php echo $trans->trans('Version') . " " . \Thelia\Core\Thelia::THELIA_VERSION ; ?>
</div>
</div>
</div>
</div>
</div>
<?php
// Installation
if ($context == "install") { ?>
<div class="install">
<div id="wrapper" class="container">
<div class="row">
<div class="col-md-12">
<div class="general-block-decorator">
<h3 class="title title-without-tabs"><?php echo $trans->trans('Thelia installation wizard'); ?></h3>
<div class="wizard">
<ul>
<li class="<?php if($step == 1){ echo 'active'; } elseif ($step > 1) { echo 'complete'; }?>"><span class="badge">1</span><?php echo $trans->trans('Welcome'); ?><span class="chevron"></span></li>
<li class="<?php if($step == 2){ echo 'active'; } elseif ($step > 2) { echo 'complete'; }?>"><span class="badge">2</span><?php echo $trans->trans('Checking permissions'); ?><span class="chevron"></span></li>
<li class="<?php if($step == 3){ echo 'active'; } elseif ($step > 3) { echo 'complete'; }?>"><span class="badge">3</span><?php echo $trans->trans('Database connection'); ?><span class="chevron"></span></li>
<li class="<?php if($step == 4){ echo 'active'; } elseif ($step > 4) { echo 'complete'; }?>"><span class="badge">4</span><?php echo $trans->trans('Database selection'); ?><span class="chevron"></span></li>
<li class="<?php if($step == 5){ echo 'active'; } elseif ($step > 5) { echo 'complete'; }?>"><span class="badge">5</span><?php echo $trans->trans('General information'); ?><span class="chevron"></span></li>
<li class="<?php if($step == 6){ echo 'active'; } elseif ($step > 6) { echo 'complete'; }?>"><span class="badge">6</span><?php echo $trans->trans('Thanks'); ?><span class="chevron"></span></li>
</ul>
</div>
<?php
// Update
} else { ?>
<div class="update">
<div id="wrapper" class="container">
<div class="row">
<div class="col-md-12">
<div class="general-block-decorator">
<h3 class="title title-without-tabs"><?php echo $trans->trans('Thelia installation wizard'); ?></h3>
<div class="wizard">
<ul>
<li class="<?php if($step == 1){ echo 'active'; } elseif ($step > 1) { echo 'complete'; }?>"><span class="badge">1</span><?php echo $trans->trans('Welcome'); ?><span class="chevron"></span></li>
<li class="<?php if($step == 2){ echo 'active'; } elseif ($step > 2) { echo 'complete'; }?>"><span class="badge">2</span><?php echo $trans->trans('Update'); ?><span class="chevron"></span></li>
</ul>
</div>
<?php
}