This commit is contained in:
mespeche
2013-09-18 11:55:04 +02:00
239 changed files with 23621 additions and 10230 deletions

12
web/.htaccess Executable file
View File

@@ -0,0 +1,12 @@
Options +FollowSymlinks -Indexes
AddDefaultCharset UTF-8
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

View File

@@ -51,5 +51,7 @@ $response = $thelia->handle($request)->prepare($request)->send();
$thelia->terminate($request, $response);
echo "\n<!-- page parsed in : " . (microtime(true) - $thelia->getStartTime())." s. -->";
echo "\n<!-- memory peak : " . memory_get_peak_usage()/1024/1024 . " MiB. -->";
if (strstr($response->headers->get('content-type'), 'text/html') !== false) {
echo "\n<!-- page parsed in : " . (microtime(true) - $thelia->getStartTime())." s. -->";
echo "\n<!-- memory peak : " . memory_get_peak_usage()/1024/1024 . " MiB. -->";
}

119
web/install/bdd.php Executable file
View File

@@ -0,0 +1,119 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
$step=4;
include("header.php");
if (isset($_POST['host']) && isset($_POST['username']) && isset($_POST['password']) && isset($_POST['port'])){
$_SESSION['install']['host'] = $_POST['host'];
$_SESSION['install']['username'] = $_POST['username'];
$_SESSION['install']['password'] = $_POST['password'];
$_SESSION['install']['port'] = $_POST['port'];
$checkConnection = new \Thelia\Install\CheckDatabaseConnection($_POST['host'], $_POST['username'], $_POST['password'], $_POST['port']);
if(! $checkConnection->exec() || $checkConnection->getConnection()->query('show databases') === false){
header('location: connection.php?err=1');
exit;
}
}
elseif($_SESSION['install']['step'] >=3) {
$checkConnection = new \Thelia\Install\CheckDatabaseConnection($_SESSION['install']['host'], $_SESSION['install']['username'], $_SESSION['install']['password'], $_SESSION['install']['port']);
}
else {
header('location: connection.php?err=1');
exit;
}
$_SESSION['install']['step'] = 4;
$connection = $checkConnection->getConnection();
$databases = $connection->query('show databases');
?>
<div class="well">
<form action="config.php" method="post">
<fieldset>
<legend>Choose your database</legend>
<p>
The SQL server contains multiple databases.<br/>
Select below the one you want to use.
</p>
<?php foreach($databases as $database): ?>
<?php if ($database['Database'] == 'information_schema') continue; ?>
<?php
$connection->exec(sprintf('use %s', $database['Database']));
$tables = $connection->query('SHOW TABLES');
$found = false;
foreach($tables as $table) {
if($table[0] == 'cart_item') {
$found = true;
break;
}
}
?>
<div class="radio">
<label for="database_<?php echo $database['Database']; ?>">
<input type="radio" name="database" id="database_<?php echo $database['Database']; ?>" value="<?php echo $database['Database']; ?>" <?php if($found){ echo "disabled"; } ?>>
<?php echo $database['Database']; ?>
</label>
</div>
<?php endforeach; ?>
<?php
$connection->exec('use information_schema');
$permissions = $connection->query("SELECT COUNT( * ) FROM `USER_PRIVILEGES`
WHERE PRIVILEGE_TYPE = 'CREATE'
AND GRANTEE LIKE '%".$_SESSION['install']['username']."%'
AND IS_GRANTABLE = 'YES';");
$writePermission = false;
if($permissions->fetchColumn(0) > 0) {
?>
<p>
or
</p>
<div class="radio">
<label>
Create an other database
</label>
</div>
<div class="form-group">
<input type="text" name="database_create" class="form-control">
</div>
<?php } ?>
</fieldset>
<div class="clearfix">
<div class="control-btn">
<button type="submit" class="pull-right btn btn-default btn-primary">Continue</button>
</div>
</div>
</form>
</div>
<?php include 'footer.php'; ?>

27
web/install/bootstrap.php Executable file
View File

@@ -0,0 +1,27 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
include __DIR__ . "/../../core/bootstrap.php";
$thelia = new \Thelia\Core\Thelia("install", false);
$thelia->boot();

110
web/install/config.php Executable file
View File

@@ -0,0 +1,110 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
$step = 5;
include("header.php");
global $thelia;
$err = isset($_GET['err']) && $_GET['err'];
if (!$err && $_SESSION['install']['step'] != $step) {
$checkConnection = new \Thelia\Install\CheckDatabaseConnection($_SESSION['install']['host'], $_SESSION['install']['username'], $_SESSION['install']['password'], $_SESSION['install']['port']);
$connection = $checkConnection->getConnection();
$connection->exec("SET NAMES UTF8");
$database = new \Thelia\Install\Database($connection);
if (isset($_POST['database'])) {
$_SESSION['install']['database'] = $_POST['database'];
}
if (isset($_POST['database_create']) && $_POST['database_create'] != "") {
$_SESSION['install']['database'] = $_POST['database_create'];
$database->createDatabase($_SESSION['install']['database']);
}
$database->insertSql($_SESSION['install']['database']);
if(!file_exists(THELIA_ROOT . "/local/config/database.yml")) {
$fs = new \Symfony\Component\Filesystem\Filesystem();
$sampleConfigFile = THELIA_ROOT . "/local/config/database.yml.sample";
$configFile = THELIA_ROOT . "/local/config/database.yml";
$fs->copy($sampleConfigFile, $configFile, true);
$configContent = file_get_contents($configFile);
$configContent = str_replace("%DRIVER%", "mysql", $configContent);
$configContent = str_replace("%USERNAME%", $_SESSION['install']['username'], $configContent);
$configContent = str_replace("%PASSWORD%", $_SESSION['install']['password'], $configContent);
$configContent = str_replace(
"%DSN%",
sprintf("mysql:host=%s;dbname=%s;port=%s", $_SESSION['install']['host'], $_SESSION['install']['database'], $_SESSION['install']['port']),
$configContent
);
file_put_contents($configFile, $configContent);
// FA - no, as no further install will be possible
// $fs->remove($sampleConfigFile);
$fs->remove($thelia->getContainer()->getParameter("kernel.cache_dir"));
}
}
$_SESSION['install']['step'] = $step;
?>
<form action="end.php" method="POST" >
<div class="well">
<div class="form-group">
<label for="admin_login">Administrator login :</label>
<input id="admin_login" class="form-control" type="text" name="admin_login" placeholder="admin" value="" required>
</div>
<div class="form-group">
<label for="admin_password">Administrator password :</label>
<input id="admin_password" class="form-control" type="password" name="admin_password" value="" required>
</div>
<div class="form-group">
<label for="admin_password_verif">Administrator password verification :</label>
<input id="admin_password_verif" class="form-control" type="password" name="admin_password_verif" value="" required>
</div>
<div class="form-group">
<label for="email_contact">Contact email :</label>
<input id="email_contact" class="form-control" type="text" name="email_contact" placeholder="foo@bar.com" value="" required>
</div>
<div class="form-group">
<label for="site_name">Site name :</label>
<input id="site_name" class="form-control" type="text" name="site_name" placeholder="" value="" required>
</div>
<div class="clearfix">
<div class="control-btn">
<button type="submit" class="pull-right btn btn-default btn-primary">Continue</button>
</div>
</div>
</div>
</form>
<?php include('footer.php'); ?>

67
web/install/connection.php Executable file
View File

@@ -0,0 +1,67 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
$step = 3;
include("header.php");
if(!$_SESSION['install']['continue'] && $_SESSION['install']['step'] == 2) {
header(sprintf('location: %s', $_SESSION['install']['return_step']));
}
$_SESSION['install']['step'] = 3;
?>
<form action="bdd.php" method="POST" >
<?php if(isset($_GET['err']) && $_GET['err'] == 1){ ?>
<div class="alert alert-danger">Wrong connection information</div>
<?php } ?>
<div class="well">
<div class="form-group">
<label for="host">Host :</label>
<input id="host" class="form-control" type="text" name="host" placeholder="localhost" value="<?php if(isset($_SESSION['install']['host'])){ echo $_SESSION['install']['host']; } ?>">
</div>
<div class="form-group">
<label for="user">Username :</label>
<input id="user" type="text" class="form-control" name="username" placeholder="john" value="<?php if(isset($_SESSION['install']['username'])){ echo $_SESSION['install']['username']; } ?>">
</div>
<div class="form-group">
<label for="password">Password :</label>
<input id="password" type="password" class="form-control" name="password" placeholder="l33t 5p34k" >
</div>
<div class="form-group">
<label for="port">Port :</label>
<input id="port" type="text" class="form-control" name="port" value="<?php if(isset($_SESSION['install']['port'])){ echo $_SESSION['install']['port']; } else { echo '3306'; } ?>">
</div>
</div>
<div class="clearfix">
<div class="control-btn">
<button type="submit" class="pull-right btn btn-default btn-primary">Continue</button>
</div>
</div>
</form>
<?php include("footer.php"); ?>

57
web/install/end.php Executable file
View File

@@ -0,0 +1,57 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
$step=6;
include "header.php";
if($_SESSION['install']['step'] != $step && (empty($_POST['admin_login']) || empty($_POST['admin_password']) || ($_POST['admin_password'] != $_POST['admin_password_verif']))) {
header('location: config.php?err=1');
}
if($_SESSION['install']['step'] == 5) {
$admin = new \Thelia\Model\Admin();
$admin->setLogin($_POST['admin_login'])
->setPassword($_POST['admin_password'])
->setFirstname('admin')
->setLastname('admin')
->save();
$config = new \Thelia\Model\Config();
$config->setName('contact_email')
->setValue($_POST['email_contact'])
->save();
;
}
$_SESSION['install']['step'] = $step;
?>
<div class="well">
<p class="lead text-center">
Thank you have installed Thelia
</p>
<p class="lead text-center">
Don't forget to delete the web/install directory.
</p>
</div>
<?php include "footer.php"; ?>

BIN
web/install/fd33fd0-6fda040.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

41
web/install/footer.php Executable file
View File

@@ -0,0 +1,41 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
?>
</div>
</div>
</div>
</div>
</div>
<hr />
<footer class="footer">
<div class="container">
<p>&copy; Thelia 2013
- <a href="http://www.openstudio.fr/" target="_blank">Édité par OpenStudio</a>
- <a href="http://forum.thelia.net/" target="_blank">Forum Thelia</a>
- <a href="http://contrib.thelia.net/" target="_blank">Contributions Thelia</a>
</p>
</div>
</footer>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
</body>
</html>

59
web/install/header.php Executable file
View File

@@ -0,0 +1,59 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
session_start();
include 'bootstrap.php';
?>
<!DOCTYPE html>
<html lang="">
<head>
<title>Installation</title>
<link rel="shortcut icon" href="fd33fd0-6fda040.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="topbar">
<div class="container">
<div class="row">
<div class="col-md-6">
<div class="version-info">Version undefined</div>
</div>
</div>
</div>
</div>
<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">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>Welcome<span class="chevron"></span></li>
<li class="<?php if($step == 2){ echo 'active'; } elseif ($step > 2) { echo 'complete'; }?>"><span class="badge">2</span>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>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>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>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>Thanks<span class="chevron"></span></li>
</ul>
</div>

39
web/install/index.php Executable file
View File

@@ -0,0 +1,39 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
?>
<?php
$step = 1;
include("header.php");
?>
<div class="well">
<p class="lead text-center">
Welcome in the Thelia installation wizard.
</p>
<p class="text-center">
We will guide you throughout this process to install any application on your system.
</p>
</div>
<div class="clearfix">
<a href="permission.php" class="pull-right btn btn-default btn-primary"><span class="glyphicon glyphicon-chevron-right"></span> Continue</a>
</div>
<?php include("footer.php"); ?>

56
web/install/permission.php Executable file
View File

@@ -0,0 +1,56 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
?>
<?php
$step = 2;
include("header.php");
global $thelia;
$checkPermission = new \Thelia\Install\CheckPermission(true, $thelia->getContainer()->get('thelia.translator'));
$isValid = $checkPermission->exec();
$validationMessage = $checkPermission->getValidationMessages();
$_SESSION['install']['return_step'] = 'permission.php';
$_SESSION['install']['continue'] = $isValid;
$_SESSION['install']['current_step'] = 'permission.php';
$_SESSION['install']['step'] = 2;
?>
<div class="well">
<p>Checking permissions</p>
<ul class="list-unstyled list-group">
<?php foreach($validationMessage as $item => $data): ?>
<li class="list-group-item <?php if ($data['status']) {echo 'text-success';} else { echo 'text-danger';} ?>">
<?php echo $data['text']; ?>
<?php if (!$data['status']) { echo $data['hint']; } ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<div class="clearfix">
<?php if($isValid){ ?>
<a href="connection.php" class="pull-right btn btn-default btn-primary"><span class="glyphicon glyphicon-chevron-right"></span> Continue</a>
<?php } else { ?>
<a href="permission.php" class="pull-right btn btn-default btn-danger"><span class="glyphicon glyphicon-refresh"></span> refresh</a>
<?php } ?>
</div>
<?php include("footer.php"); ?>

1999
web/install/script.js Executable file

File diff suppressed because it is too large Load Diff

7534
web/install/styles.css Executable file

File diff suppressed because one or more lines are too long

View File

@@ -1,85 +0,0 @@
{
"breadcrumb" : [
{
"url" : "0",
"display" : "Racine",
"edit" : "",
"browse" : ""
}
],
"categories" : [
{
"id" : "1",
"ligne" : "1",
"classement" : "1",
"titre" : "Boyaux",
"langue_courante" : true,
"parent" : 0
},
{
"id" : "18",
"ligne" : "1",
"classement" : "2",
"titre" : "Epices \/ condiments",
"langue_courante" : true,
"parent" : 0
},
{
"id" : "100",
"ligne" : "1",
"classement" : "3",
"titre" : "Emballage",
"langue_courante" : true,
"parent" : 0
},
{
"id" : "194",
"ligne" : "1",
"classement" : "4",
"titre" : "Petits mat\u00e9riels",
"langue_courante" : true,
"parent" : 0
},
{
"id" : "355",
"ligne" : "1",
"classement" : "5",
"titre" : "Materiel de cuisine",
"langue_courante" : true,
"parent" : 0
},
{
"id" : "426",
"ligne" : "0",
"classement" : "6",
"titre" : "Bacs",
"langue_courante" : true,
"parent" : 0
},
{
"id" : "458",
"ligne" : "1",
"classement" : "7",
"titre" : "Hygi\u00e8ne & entretien",
"langue_courante" : true,
"parent" : 0
},
{
"id" : "592",
"ligne" : "1",
"classement" : "8",
"titre" : "Art de la table",
"langue_courante" : true,
"parent" : 0
},
{
"id" : "601",
"ligne" : "1",
"classement" : "9",
"titre" : "Mat\u00e9riels",
"langue_courante" : true,
"parent" : 0
}
],
"products":[]
}