Init
91
.gitignore
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
#### GENERAL ####
|
||||
/www/.htpasswd
|
||||
/www/.htaccess
|
||||
*.zip
|
||||
*.sql
|
||||
*.tar.gz
|
||||
*.gzip
|
||||
download/*
|
||||
/www/log/*
|
||||
/www/modules/gamification/
|
||||
/www/upload/*
|
||||
*sitemap.xml
|
||||
|
||||
#### IMAGES ####
|
||||
/www/img/*/*
|
||||
!/www/img/index.php
|
||||
!/www/img/*/index.php
|
||||
|
||||
#### ADMIN ####
|
||||
/www/adm/backups/*
|
||||
/www/adm/export/*
|
||||
/www/adm/import/*
|
||||
/www/adm/autoupgrade/*
|
||||
/www/adm/backups/*
|
||||
!/www/adm/backups/index.php
|
||||
|
||||
#### CACHE ####
|
||||
/www/themes/*/cache/
|
||||
/www/cache/smarty/cache/*
|
||||
!/www/cache/smarty/cache/index.php
|
||||
/www/cache/smarty/compile/*
|
||||
!/www/cache/smarty/compile/index.php
|
||||
/www/cache/class_index.php
|
||||
/www/cache/tcpdf/*
|
||||
!/www/cache/tcpdf/index.php
|
||||
/www/tools/smarty*/cache/*.php
|
||||
!/www/tools/smarty*/cache/index.php
|
||||
|
||||
#### CONFIG ####
|
||||
/www/config/settings.*.php
|
||||
/www/config/xml/*.xml
|
||||
/www/config/settings.inc.php
|
||||
/www/config/settings.old.php
|
||||
/www/config/xml/*.xml
|
||||
/www/modules/*/config*.xml
|
||||
|
||||
#### THEME ####
|
||||
/www/themes/default/cache/*.js
|
||||
/www/themes/default/cache/*.css
|
||||
/www/themes/default-bootstrap/cache/*.js
|
||||
/www/themes/default-bootstrap/cache/*.css
|
||||
|
||||
/www/tools/smarty*/compile/*.php
|
||||
!/www/tools/smarty*/compile/index.php
|
||||
/www/themes/default/modules/*/*.php
|
||||
!/www/themes/default/modules/*/index.php
|
||||
/www/themes/default/lang/*.php
|
||||
!/www/themes/default/lang/index.php
|
||||
/www/themes/default-bootstrap/modules/*/*.php
|
||||
!/www/themes/default-bootstrap/modules/*/index.php
|
||||
/www/themes/default-bootstrap/lang/*.php
|
||||
!/www/themes/default-bootstrap/lang/index.php
|
||||
|
||||
#### TRADUCTIONS ####
|
||||
/www/translations/*
|
||||
/www/themes/default-bootstrap/lang/*
|
||||
/www/themes/default-bootstrap/modules/*/translations/*.php
|
||||
!/www/themes/default-bootstrap/modules/*/translations/index.php
|
||||
!/www/translations/*.gzip
|
||||
|
||||
#### MAILS ####
|
||||
/www/mails/*
|
||||
!/www/mails/en
|
||||
!/www/mails/fr
|
||||
/www/modules/*/mails/*
|
||||
!/www/modules/*/mails/en
|
||||
|
||||
#### OTHER ####
|
||||
.buildpath
|
||||
.project
|
||||
.settings
|
||||
.idea
|
||||
.svn
|
||||
.DS_Store
|
||||
.sass-cache
|
||||
config.codekit
|
||||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
.zfs/
|
||||
/ftp/in/*
|
||||
/ftp/out/*
|
3
README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Chocolat de Mariage
|
||||
|
||||
[Site](http://www.chocolatdemariage.com)
|
51
www/Adapter/Adapter_AddressFactory.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Adapter_AddressFactory
|
||||
{
|
||||
/**
|
||||
* Initilize an address corresponding to the specified id address or if empty to the
|
||||
* default shop configuration
|
||||
* @param null $id_address
|
||||
* @param bool $with_geoloc
|
||||
* @return Address
|
||||
*/
|
||||
public function findOrCreate($id_address = null, $with_geoloc = false)
|
||||
{
|
||||
$func_args = func_get_args();
|
||||
return call_user_func_array(array('Address', 'initialize'), $func_args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an address exists depending on given $id_address
|
||||
* @param $id_address
|
||||
* @return bool
|
||||
*/
|
||||
public function addressExists($id_address)
|
||||
{
|
||||
return Address::addressExists($id_address);
|
||||
}
|
||||
}
|
38
www/Adapter/Adapter_CacheManager.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Adapter_CacheManager
|
||||
{
|
||||
/**
|
||||
* Cleans the cache for specific cache key.
|
||||
*
|
||||
* @param $key
|
||||
*/
|
||||
public function clean($key)
|
||||
{
|
||||
Cache::clean($key);
|
||||
}
|
||||
}
|
43
www/Adapter/Adapter_Configuration.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Adapter_Configuration implements Core_Business_ConfigurationInterface
|
||||
{
|
||||
/**
|
||||
* Returns constant defined by given $key if exists or check directly into PrestaShop
|
||||
* Configuration
|
||||
* @param $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($key)
|
||||
{
|
||||
if (defined($key)) {
|
||||
return constant($key);
|
||||
} else {
|
||||
return Configuration::get($key);
|
||||
}
|
||||
}
|
||||
}
|
52
www/Adapter/Adapter_Database.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Adapter_Database implements Core_Foundation_Database_DatabaseInterface
|
||||
{
|
||||
/**
|
||||
* Perform a SELECT sql statement
|
||||
* @param $sqlString
|
||||
* @return array|false
|
||||
* @throws PrestaShopDatabaseException
|
||||
*/
|
||||
public function select($sqlString)
|
||||
{
|
||||
return Db::getInstance()->executeS($sqlString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape $unsafe to be used into a SQL statement
|
||||
* @param $unsafeData
|
||||
* @return string
|
||||
*/
|
||||
public function escape($unsafeData)
|
||||
{
|
||||
// Prepare required params
|
||||
$html_ok = true;
|
||||
$bq_sql = true;
|
||||
return Db::getInstance()->escape($unsafeData, $html_ok, $bq_sql);
|
||||
}
|
||||
}
|
104
www/Adapter/Adapter_EntityMapper.php
Normal file
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Adapter_EntityMapper
|
||||
{
|
||||
/**
|
||||
* Load ObjectModel
|
||||
* @param $id
|
||||
* @param $id_lang
|
||||
* @param $entity ObjectModel
|
||||
* @param $entity_defs
|
||||
* @param $id_shop
|
||||
* @param $should_cache_objects
|
||||
* @throws PrestaShopDatabaseException
|
||||
*/
|
||||
public function load($id, $id_lang, $entity, $entity_defs, $id_shop, $should_cache_objects)
|
||||
{
|
||||
// Load object from database if object id is present
|
||||
$cache_id = 'objectmodel_' . $entity_defs['classname'] . '_' . (int)$id . '_' . (int)$id_shop . '_' . (int)$id_lang;
|
||||
if (!$should_cache_objects || !Cache::isStored($cache_id)) {
|
||||
$sql = new DbQuery();
|
||||
$sql->from($entity_defs['table'], 'a');
|
||||
$sql->where('a.`' . bqSQL($entity_defs['primary']) . '` = ' . (int)$id);
|
||||
|
||||
// Get lang informations
|
||||
if ($id_lang && isset($entity_defs['multilang']) && $entity_defs['multilang']) {
|
||||
$sql->leftJoin($entity_defs['table'] . '_lang', 'b', 'a.`' . bqSQL($entity_defs['primary']) . '` = b.`' . bqSQL($entity_defs['primary']) . '` AND b.`id_lang` = ' . (int)$id_lang);
|
||||
if ($id_shop && !empty($entity_defs['multilang_shop'])) {
|
||||
$sql->where('b.`id_shop` = ' . (int)$id_shop);
|
||||
}
|
||||
}
|
||||
|
||||
// Get shop informations
|
||||
if (Shop::isTableAssociated($entity_defs['table'])) {
|
||||
$sql->leftJoin($entity_defs['table'] . '_shop', 'c', 'a.`' . bqSQL($entity_defs['primary']) . '` = c.`' . bqSQL($entity_defs['primary']) . '` AND c.`id_shop` = ' . (int)$id_shop);
|
||||
}
|
||||
|
||||
if ($object_datas = Db::getInstance()->getRow($sql)) {
|
||||
if (!$id_lang && isset($entity_defs['multilang']) && $entity_defs['multilang']) {
|
||||
$sql = 'SELECT *
|
||||
FROM `' . bqSQL(_DB_PREFIX_ . $entity_defs['table']) . '_lang`
|
||||
WHERE `' . bqSQL($entity_defs['primary']) . '` = ' . (int)$id
|
||||
.(($id_shop && $entity->isLangMultishop()) ? ' AND `id_shop` = ' . (int)$id_shop : '');
|
||||
|
||||
if ($object_datas_lang = Db::getInstance()->executeS($sql)) {
|
||||
foreach ($object_datas_lang as $row) {
|
||||
foreach ($row as $key => $value) {
|
||||
if ($key != $entity_defs['primary'] && array_key_exists($key, $entity)) {
|
||||
if (!isset($object_datas[$key]) || !is_array($object_datas[$key])) {
|
||||
$object_datas[$key] = array();
|
||||
}
|
||||
|
||||
$object_datas[$key][$row['id_lang']] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$entity->id = (int)$id;
|
||||
foreach ($object_datas as $key => $value) {
|
||||
if (array_key_exists($key, $entity)) {
|
||||
$entity->{$key} = $value;
|
||||
} else {
|
||||
unset($object_datas[$key]);
|
||||
}
|
||||
}
|
||||
if ($should_cache_objects) {
|
||||
Cache::store($cache_id, $object_datas);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$object_datas = Cache::retrieve($cache_id);
|
||||
if ($object_datas) {
|
||||
$entity->id = (int)$id;
|
||||
foreach ($object_datas as $key => $value) {
|
||||
$entity->{$key} = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
51
www/Adapter/Adapter_EntityMetaDataRetriever.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Adapter_EntityMetaDataRetriever
|
||||
{
|
||||
public function getEntityMetaData($className)
|
||||
{
|
||||
$metaData = new Core_Foundation_Database_EntityMetaData;
|
||||
|
||||
$metaData->setEntityClassName($className);
|
||||
|
||||
if (property_exists($className, 'definition')) {
|
||||
// Legacy entity
|
||||
$classVars = get_class_vars($className);
|
||||
$metaData->setTableName($classVars['definition']['table']);
|
||||
$metaData->setPrimaryKeyFieldNames(array($classVars['definition']['primary']));
|
||||
} else {
|
||||
throw new Adapter_Exception(
|
||||
sprintf(
|
||||
'Cannot get metadata for entity `%s`.',
|
||||
$className
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $metaData;
|
||||
}
|
||||
}
|
29
www/Adapter/Adapter_Exception.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Adapter_Exception extends Core_Foundation_Exception_Exception
|
||||
{
|
||||
}
|
54
www/Adapter/Adapter_HookManager.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Adapter_HookManager
|
||||
{
|
||||
/**
|
||||
* Execute modules for specified hook
|
||||
*
|
||||
* @param string $hook_name Hook Name
|
||||
* @param array $hook_args Parameters for the functions
|
||||
* @param int $id_module Execute hook for this module only
|
||||
* @param bool $array_return If specified, module output will be set by name in an array
|
||||
* @param bool $check_exceptions Check permission exceptions
|
||||
* @param bool $use_push Force change to be refreshed on Dashboard widgets
|
||||
* @param int $id_shop If specified, hook will be execute the shop with this ID
|
||||
*
|
||||
* @throws PrestaShopException
|
||||
*
|
||||
* @return string/array modules output
|
||||
*/
|
||||
public function exec($hook_name,
|
||||
$hook_args = array(),
|
||||
$id_module = null,
|
||||
$array_return = false,
|
||||
$check_exceptions = true,
|
||||
$use_push = false,
|
||||
$id_shop = null)
|
||||
{
|
||||
return Hook::exec($hook_name, $hook_args, $id_module, $array_return, $check_exceptions, $use_push, $id_shop);
|
||||
}
|
||||
}
|
87
www/Adapter/Adapter_PackItemsManager.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Adapter_PackItemsManager
|
||||
{
|
||||
/**
|
||||
* Get the Products contained in the given Pack.
|
||||
*
|
||||
* @param Pack $pack
|
||||
* @param integer $id_lang Optional
|
||||
* @return Array[Product] The products contained in this Pack, with special dynamic attributes [pack_quantity, id_pack_product_attribute]
|
||||
*/
|
||||
public function getPackItems($pack, $id_lang = false)
|
||||
{
|
||||
if ($id_lang === false) {
|
||||
$configuration = Adapter_ServiceLocator::get('Core_Business_ConfigurationInterface');
|
||||
$id_lang = (int)$configuration->get('PS_LANG_DEFAULT');
|
||||
}
|
||||
return Pack::getItems($pack->id, $id_lang);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all Packs that contains the given item in the corresponding declination.
|
||||
*
|
||||
* @param Product $item
|
||||
* @param integer $item_attribute_id
|
||||
* @param integer $id_lang Optional
|
||||
* @return Array[Pack] The packs that contains the given item, with special dynamic attribute [pack_item_quantity]
|
||||
*/
|
||||
public function getPacksContainingItem($item, $item_attribute_id, $id_lang = false)
|
||||
{
|
||||
if ($id_lang === false) {
|
||||
$configuration = Adapter_ServiceLocator::get('Core_Business_ConfigurationInterface');
|
||||
$id_lang = (int)$configuration->get('PS_LANG_DEFAULT');
|
||||
}
|
||||
return Pack::getPacksContainingItem($item->id, $item_attribute_id, $id_lang);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this product a pack?
|
||||
*
|
||||
* @param Product $product
|
||||
* @return boolean
|
||||
*/
|
||||
public function isPack($product)
|
||||
{
|
||||
return Pack::isPack($product->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this product in a pack?
|
||||
* If $id_product_attribute specified, then will restrict search on the given combination,
|
||||
* else this method will match a product if at least one of all its combination is in a pack.
|
||||
*
|
||||
* @param Product $product
|
||||
* @param integer $id_product_attribute Optional combination of the product
|
||||
* @return boolean
|
||||
*/
|
||||
public function isPacked($product, $id_product_attribute = false)
|
||||
{
|
||||
return Pack::isPacked($product->id, $id_product_attribute);
|
||||
}
|
||||
|
||||
}
|
68
www/Adapter/Adapter_ProductPriceCalculator.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Adapter_ProductPriceCalculator
|
||||
{
|
||||
public function getProductPrice(
|
||||
$id_product,
|
||||
$usetax = true,
|
||||
$id_product_attribute = null,
|
||||
$decimals = 6,
|
||||
$divisor = null,
|
||||
$only_reduc = false,
|
||||
$usereduc = true,
|
||||
$quantity = 1,
|
||||
$force_associated_tax = false,
|
||||
$id_customer = null,
|
||||
$id_cart = null,
|
||||
$id_address = null,
|
||||
&$specific_price_output = null,
|
||||
$with_ecotax = true,
|
||||
$use_group_reduction = true,
|
||||
Context $context = null,
|
||||
$use_customer_price = true
|
||||
) {
|
||||
return Product::getPriceStatic(
|
||||
$id_product,
|
||||
$usetax,
|
||||
$id_product_attribute,
|
||||
$decimals,
|
||||
$divisor,
|
||||
$only_reduc,
|
||||
$usereduc,
|
||||
$quantity,
|
||||
$force_associated_tax,
|
||||
$id_customer,
|
||||
$id_cart,
|
||||
$id_address,
|
||||
$specific_price_output,
|
||||
$with_ecotax,
|
||||
$use_group_reduction,
|
||||
$context,
|
||||
$use_customer_price
|
||||
);
|
||||
}
|
||||
}
|
54
www/Adapter/Adapter_ServiceLocator.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Adapter_ServiceLocator
|
||||
{
|
||||
/**
|
||||
* Set a service container Instance
|
||||
* @var Core_Foundation_IoC_Container
|
||||
*/
|
||||
private static $service_container;
|
||||
|
||||
public static function setServiceContainerInstance(Core_Foundation_IoC_Container $container)
|
||||
{
|
||||
self::$service_container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a service depending on its given $serviceName
|
||||
* @param $serviceName
|
||||
* @return mixed|object
|
||||
* @throws Adapter_Exception
|
||||
*/
|
||||
public static function get($serviceName)
|
||||
{
|
||||
if (empty(self::$service_container) || is_null(self::$service_container)) {
|
||||
throw new Adapter_Exception('Service container is not set.');
|
||||
}
|
||||
|
||||
return self::$service_container->make($serviceName);
|
||||
}
|
||||
}
|
34
www/Adapter/Adapter_StockManager.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Adapter_StockManager
|
||||
{
|
||||
|
||||
public function getStockAvailableByProduct($product, $id_product_attribute = null, $id_shop = null)
|
||||
{
|
||||
return new StockAvailable(StockAvailable::getStockAvailableIdByProductId($product->id, $id_product_attribute, $id_shop));
|
||||
}
|
||||
}
|
80
www/Core/Business/CMS/Core_Business_CMS_CMSRepository.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Core_Business_CMS_CMSRepository extends Core_Foundation_Database_EntityRepository
|
||||
{
|
||||
/**
|
||||
* Return CMSRepository lang associative table name
|
||||
* @return string
|
||||
*/
|
||||
private function getLanguageTableNameWithPrefix()
|
||||
{
|
||||
return $this->getTableNameWithPrefix() . '_lang';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all CMSRepositories depending on $id_lang/$id_shop tuple
|
||||
* @param $id_lang
|
||||
* @param $id_shop
|
||||
* @return array|null
|
||||
*/
|
||||
public function i10nFindAll($id_lang, $id_shop)
|
||||
{
|
||||
$sql = '
|
||||
SELECT *
|
||||
FROM `'.$this->getTableNameWithPrefix().'` c
|
||||
JOIN `'.$this->getPrefix().'cms_lang` cl ON c.`id_cms`= cl.`id_cms`
|
||||
WHERE cl.`id_lang` = '.(int)$id_lang.'
|
||||
AND cl.`id_shop` = '.(int)$id_shop.'
|
||||
|
||||
';
|
||||
|
||||
return $this->hydrateMany($this->db->select($sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all CMSRepositories depending on $id_lang/$id_shop tuple
|
||||
* @param $id_cms
|
||||
* @param $id_lang
|
||||
* @param $id_shop
|
||||
* @return CMS|null
|
||||
* @throws Core_Foundation_Database_Exception
|
||||
*/
|
||||
public function i10nFindOneById($id_cms, $id_lang, $id_shop)
|
||||
{
|
||||
$sql = '
|
||||
SELECT *
|
||||
FROM `'.$this->getTableNameWithPrefix().'` c
|
||||
JOIN `'.$this->getPrefix().'cms_lang` cl ON c.`id_cms`= cl.`id_cms`
|
||||
WHERE c.`id_cms` = '.(int)$id_cms.'
|
||||
AND cl.`id_lang` = '.(int)$id_lang.'
|
||||
AND cl.`id_shop` = '.(int)$id_shop.'
|
||||
LIMIT 0 , 1
|
||||
';
|
||||
|
||||
return $this->hydrateOne($this->db->select($sql));
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Core_Business_CMS_CMSRoleRepository extends Core_Foundation_Database_EntityRepository
|
||||
{
|
||||
/**
|
||||
* Return all CMSRoles which are already associated
|
||||
* @return array|null
|
||||
*/
|
||||
public function getCMSRolesAssociated()
|
||||
{
|
||||
$sql = '
|
||||
SELECT *
|
||||
FROM `'.$this->getTableNameWithPrefix().'`
|
||||
WHERE `id_cms` != 0';
|
||||
|
||||
return $this->hydrateMany($this->db->select($sql));
|
||||
}
|
||||
}
|
30
www/Core/Business/Core_Business_ConfigurationInterface.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
interface Core_Business_ConfigurationInterface
|
||||
{
|
||||
public function get($key);
|
||||
}
|
43
www/Core/Business/Core_Business_ContainerBuilder.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Core_Business_ContainerBuilder
|
||||
{
|
||||
/**
|
||||
* Construct PrestaShop Core Service container
|
||||
* @return Core_Foundation_IoC_Container
|
||||
* @throws Core_Foundation_IoC_Exception
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$container = new Core_Foundation_IoC_Container;
|
||||
|
||||
$container->bind('Core_Business_ConfigurationInterface', 'Adapter_Configuration', true);
|
||||
$container->bind('Core_Foundation_Database_DatabaseInterface', 'Adapter_Database', true);
|
||||
|
||||
return $container;
|
||||
}
|
||||
}
|
91
www/Core/Business/Email/Core_Business_Email_EmailLister.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Core_Business_Email_EmailLister
|
||||
{
|
||||
private $filesystem;
|
||||
|
||||
public function __construct(Core_Foundation_FileSystem_FileSystem $fs)
|
||||
{
|
||||
// Register dependencies
|
||||
$this->filesystem = $fs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of available mails
|
||||
* @param null $lang
|
||||
* @param null $dir
|
||||
* @return array|null
|
||||
*/
|
||||
public function getAvailableMails($dir)
|
||||
{
|
||||
if (!is_dir($dir)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$mail_directory = $this->filesystem->listEntriesRecursively($dir);
|
||||
$mail_list = array();
|
||||
|
||||
// Remove unwanted .html / .txt / .tpl / .php / . / ..
|
||||
foreach ($mail_directory as $mail) {
|
||||
if (strpos($mail->getFilename(), '.') !== false) {
|
||||
$tmp = explode('.', $mail->getFilename());
|
||||
|
||||
// Check for filename existence (left part) and if extension is html (right part)
|
||||
if (($tmp === false || !isset($tmp[0])) || (isset($tmp[1]) && $tmp[1] !== 'html')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$mail_name_no_ext = $tmp[0];
|
||||
if (!in_array($mail_name_no_ext, $mail_list)) {
|
||||
$mail_list[] = $mail_name_no_ext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $mail_list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Give in input getAvailableMails(), will output a human readable and proper string name
|
||||
* @return string
|
||||
*/
|
||||
public function getCleanedMailName($mail_name)
|
||||
{
|
||||
if (strpos($mail_name, '.') !== false) {
|
||||
$tmp = explode('.', $mail_name);
|
||||
|
||||
if ($tmp === false || !isset($tmp[0])) {
|
||||
return $mail_name;
|
||||
}
|
||||
|
||||
$mail_name = $tmp[0];
|
||||
}
|
||||
|
||||
return ucfirst(str_replace(array('_', '-'), ' ', $mail_name));
|
||||
}
|
||||
}
|
@ -0,0 +1,214 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Core_Business_Payment_PaymentOption
|
||||
{
|
||||
private $callToActionText;
|
||||
private $logo;
|
||||
private $action;
|
||||
private $method;
|
||||
private $inputs;
|
||||
private $form;
|
||||
private $moduleName;
|
||||
|
||||
/**
|
||||
* Return Call to Action Text
|
||||
* @return string
|
||||
*/
|
||||
public function getCallToActionText()
|
||||
{
|
||||
return $this->callToActionText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Call To Action Text
|
||||
* @param $callToActionText
|
||||
* @return $this
|
||||
*/
|
||||
public function setCallToActionText($callToActionText)
|
||||
{
|
||||
$this->callToActionText = $callToActionText;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return logo path
|
||||
* @return string
|
||||
*/
|
||||
public function getLogo()
|
||||
{
|
||||
return $this->logo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set logo path
|
||||
* @param $logo
|
||||
* @return $this
|
||||
*/
|
||||
public function setLogo($logo)
|
||||
{
|
||||
$this->logo = $logo;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return action to perform (POST/GET)
|
||||
* @return string
|
||||
*/
|
||||
public function getAction()
|
||||
{
|
||||
return $this->action;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set action to be performed by this option
|
||||
* @param $action
|
||||
* @return $this
|
||||
*/
|
||||
public function setAction($action)
|
||||
{
|
||||
$this->action = $action;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMethod()
|
||||
{
|
||||
return $this->method;
|
||||
}
|
||||
|
||||
public function setMethod($method)
|
||||
{
|
||||
$this->method = $method;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return inputs contained in this payment option
|
||||
* @return mixed
|
||||
*/
|
||||
public function getInputs()
|
||||
{
|
||||
return $this->inputs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set inputs for this payment option
|
||||
* @param $inputs
|
||||
* @return $this
|
||||
*/
|
||||
public function setInputs($inputs)
|
||||
{
|
||||
$this->inputs = $inputs;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get payment option form
|
||||
* @return mixed
|
||||
*/
|
||||
public function getForm()
|
||||
{
|
||||
return $this->form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set payment option form
|
||||
* @param $form
|
||||
* @return $this
|
||||
*/
|
||||
public function setForm($form)
|
||||
{
|
||||
$this->form = $form;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get related module name to this payment option
|
||||
* @return string
|
||||
*/
|
||||
public function getModuleName()
|
||||
{
|
||||
return $this->moduleName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set related module name to this payment option
|
||||
* @param $moduleName
|
||||
* @return $this
|
||||
*/
|
||||
public function setModuleName($moduleName)
|
||||
{
|
||||
$this->moduleName = $moduleName;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy options were specified this way:
|
||||
* - either an array with a top level property 'cta_text'
|
||||
* and then the other properties
|
||||
* - or a numerically indexed array or arrays as described above
|
||||
* Since this was a mess, this method is provided to convert them.
|
||||
* It takes as input a legacy option (in either form) and always
|
||||
* returns an array of instances of Core_Business_Payment_PaymentOption
|
||||
*/
|
||||
public static function convertLegacyOption(array $legacyOption)
|
||||
{
|
||||
if (!$legacyOption) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (array_key_exists('cta_text', $legacyOption)) {
|
||||
$legacyOption = array($legacyOption);
|
||||
}
|
||||
|
||||
$newOptions = array();
|
||||
|
||||
$defaults = array(
|
||||
'action' => null,
|
||||
'form' => null,
|
||||
'method' => null,
|
||||
'inputs' => array(),
|
||||
'logo' => null
|
||||
);
|
||||
|
||||
foreach ($legacyOption as $option) {
|
||||
$option = array_merge($defaults, $option);
|
||||
|
||||
$newOption = new Core_Business_Payment_PaymentOption();
|
||||
$newOption->setCallToActionText($option['cta_text'])
|
||||
->setAction($option['action'])
|
||||
->setForm($option['form'])
|
||||
->setInputs($option['inputs'])
|
||||
->setLogo($option['logo'])
|
||||
->setMethod($option['method']);
|
||||
|
||||
$newOptions[] = $newOption;
|
||||
}
|
||||
|
||||
return $newOptions;
|
||||
}
|
||||
}
|
152
www/Core/Business/Stock/Core_Business_Stock_StockManager.php
Normal file
@ -0,0 +1,152 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Core_Business_Stock_StockManager
|
||||
{
|
||||
/**
|
||||
* This will update a Pack quantity and will decrease the quantity of containing Products if needed.
|
||||
*
|
||||
* @param Product $product A product pack object to update its quantity
|
||||
* @param StockAvailable $stock_available the stock of the product to fix with correct quantity
|
||||
* @param integer $delta_quantity The movement of the stock (negative for a decrease)
|
||||
* @param integer|null $id_shop Opional shop ID
|
||||
*/
|
||||
public function updatePackQuantity($product, $stock_available, $delta_quantity, $id_shop = null)
|
||||
{
|
||||
$configuration = Adapter_ServiceLocator::get('Core_Business_ConfigurationInterface');
|
||||
if ($product->pack_stock_type == 1 || $product->pack_stock_type == 2 || ($product->pack_stock_type == 3 && $configuration->get('PS_PACK_STOCK_TYPE') > 0)) {
|
||||
$packItemsManager = Adapter_ServiceLocator::get('Adapter_PackItemsManager');
|
||||
$products_pack = $packItemsManager->getPackItems($product);
|
||||
$stockAvailable = new Core_Business_Stock_StockManager();
|
||||
$stockManager = Adapter_ServiceLocator::get('Adapter_StockManager');
|
||||
$cacheManager = Adapter_ServiceLocator::get('Adapter_CacheManager');
|
||||
foreach ($products_pack as $product_pack) {
|
||||
$productStockAvailable = $stockManager->getStockAvailableByProduct($product_pack, $product_pack->id_pack_product_attribute, $id_shop);
|
||||
$productStockAvailable->quantity = $productStockAvailable->quantity + ($delta_quantity * $product_pack->pack_quantity);
|
||||
$productStockAvailable->update();
|
||||
|
||||
$cacheManager->clean('StockAvailable::getQuantityAvailableByProduct_'.(int)$product_pack->id.'*');
|
||||
}
|
||||
}
|
||||
|
||||
$stock_available->quantity = $stock_available->quantity + $delta_quantity;
|
||||
|
||||
if ($product->pack_stock_type == 0 || $product->pack_stock_type == 2 ||
|
||||
($product->pack_stock_type == 3 && ($configuration->get('PS_PACK_STOCK_TYPE') == 0 || $configuration->get('PS_PACK_STOCK_TYPE') == 2))) {
|
||||
$stock_available->update();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This will decrease (if needed) Packs containing this product
|
||||
* (with the right declinaison) if there is not enough product in stocks.
|
||||
*
|
||||
* @param Product $product A product object to update its quantity
|
||||
* @param integer $id_product_attribute The product attribute to update
|
||||
* @param StockAvailable $stock_available the stock of the product to fix with correct quantity
|
||||
* @param integer|null $id_shop Opional shop ID
|
||||
*/
|
||||
public function updatePacksQuantityContainingProduct($product, $id_product_attribute, $stock_available, $id_shop = null)
|
||||
{
|
||||
$configuration = Adapter_ServiceLocator::get('Core_Business_ConfigurationInterface');
|
||||
$packItemsManager = Adapter_ServiceLocator::get('Adapter_PackItemsManager');
|
||||
$stockManager = Adapter_ServiceLocator::get('Adapter_StockManager');
|
||||
$cacheManager = Adapter_ServiceLocator::get('Adapter_CacheManager');
|
||||
$packs = $packItemsManager->getPacksContainingItem($product, $id_product_attribute);
|
||||
foreach($packs as $pack) {
|
||||
// Decrease stocks of the pack only if pack is in linked stock mode (option called 'Decrement both')
|
||||
if (!((int)$pack->pack_stock_type == 2) &&
|
||||
!((int)$pack->pack_stock_type == 3 && $configuration->get('PS_PACK_STOCK_TYPE') == 2)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Decrease stocks of the pack only if there is not enough items to constituate the actual pack stocks.
|
||||
|
||||
// How many packs can be constituated with the remaining product stocks
|
||||
$quantity_by_pack = $pack->pack_item_quantity;
|
||||
$max_pack_quantity = max(array(0, floor($stock_available->quantity / $quantity_by_pack)));
|
||||
|
||||
$stock_available_pack = $stockManager->getStockAvailableByProduct($pack, null, $id_shop);
|
||||
if ($stock_available_pack->quantity > $max_pack_quantity) {
|
||||
$stock_available_pack->quantity = $max_pack_quantity;
|
||||
$stock_available_pack->update();
|
||||
|
||||
$cacheManager->clean('StockAvailable::getQuantityAvailableByProduct_'.(int)$pack->id.'*');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Will update Product available stock int he given declinaison. If product is a Pack, could decrease the sub products.
|
||||
* If Product is contained in a Pack, Pack could be decreased or not (only if sub product stocks become not sufficient).
|
||||
*
|
||||
* @param Product $product The product to update its stockAvailable
|
||||
* @param integer $id_product_attribute The declinaison to update (null if not)
|
||||
* @param integer $delta_quantity The quantity change (positive or negative)
|
||||
* @param integer|null $id_shop Optional
|
||||
*/
|
||||
public function updateQuantity($product, $id_product_attribute, $delta_quantity, $id_shop = null)
|
||||
{
|
||||
$stockManager = Adapter_ServiceLocator::get('Adapter_StockManager');
|
||||
$stockAvailable = $stockManager->getStockAvailableByProduct($product, $id_product_attribute, $id_shop);
|
||||
$packItemsManager = Adapter_ServiceLocator::get('Adapter_PackItemsManager');
|
||||
$cacheManager = Adapter_ServiceLocator::get('Adapter_CacheManager');
|
||||
$hookManager = Adapter_ServiceLocator::get('Adapter_HookManager');
|
||||
|
||||
// Update quantity of the pack products
|
||||
if ($packItemsManager->isPack($product)) {
|
||||
// The product is a pack
|
||||
$this->updatePackQuantity($product, $stockAvailable, $delta_quantity, $id_shop);
|
||||
} else {
|
||||
// The product is not a pack
|
||||
$stockAvailable->quantity = $stockAvailable->quantity + $delta_quantity;
|
||||
$stockAvailable->id_product = (int)$product->id;
|
||||
$stockAvailable->id_product_attribute = (int)$id_product_attribute;
|
||||
$stockAvailable->update();
|
||||
|
||||
// Decrease case only: the stock of linked packs should be decreased too.
|
||||
if ($delta_quantity < 0) {
|
||||
// The product is not a pack, but the product combination is part of a pack (use of isPacked, not isPack)
|
||||
if ($packItemsManager->isPacked($product, $id_product_attribute)) {
|
||||
$this->updatePacksQuantityContainingProduct($product, $id_product_attribute, $stockAvailable, $id_shop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$cacheManager->clean('StockAvailable::getQuantityAvailableByProduct_'.(int)$product->id.'*');
|
||||
|
||||
$hookManager->exec('actionUpdateQuantity',
|
||||
array(
|
||||
'id_product' => $product->id,
|
||||
'id_product_attribute' => $id_product_attribute,
|
||||
'quantity' => $stockAvailable->quantity
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
interface Core_Foundation_Database_DatabaseInterface
|
||||
{
|
||||
public function select($sqlString);
|
||||
public function escape($unsafeData);
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
interface Core_Foundation_Database_EntityInterface
|
||||
{
|
||||
/**
|
||||
* Returns the name of the repository class for this entity.
|
||||
* If unspecified, a generic repository will be used for the entity.
|
||||
*
|
||||
* @return string or falsey value
|
||||
*/
|
||||
public static function getRepositoryClassName();
|
||||
|
||||
public function save();
|
||||
|
||||
public function delete();
|
||||
|
||||
public function hydrate(array $keyValueData);
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Core_Foundation_Database_EntityManager
|
||||
{
|
||||
private $db;
|
||||
private $configuration;
|
||||
|
||||
private $entityMetaData = array();
|
||||
|
||||
public function __construct(
|
||||
Core_Foundation_Database_DatabaseInterface $db,
|
||||
Core_Business_ConfigurationInterface $configuration
|
||||
) {
|
||||
$this->db = $db;
|
||||
$this->configuration = $configuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current database object used
|
||||
* @return Core_Foundation_Database_DatabaseInterface
|
||||
*/
|
||||
public function getDatabase()
|
||||
{
|
||||
return $this->db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current repository used
|
||||
* @param $className
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRepository($className)
|
||||
{
|
||||
if (is_callable(array($className, 'getRepositoryClassName'))) {
|
||||
$repositoryClass = call_user_func(array($className, 'getRepositoryClassName'));
|
||||
} else {
|
||||
$repositoryClass = null;
|
||||
}
|
||||
|
||||
if (!$repositoryClass) {
|
||||
$repositoryClass = 'Core_Foundation_Database_EntityRepository';
|
||||
}
|
||||
|
||||
$repository = new $repositoryClass(
|
||||
$this,
|
||||
$this->configuration->get('_DB_PREFIX_'),
|
||||
$this->getEntityMetaData($className)
|
||||
);
|
||||
|
||||
return $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return entity's meta data
|
||||
* @param $className
|
||||
* @return mixed
|
||||
* @throws Adapter_Exception
|
||||
*/
|
||||
public function getEntityMetaData($className)
|
||||
{
|
||||
if (!array_key_exists($className, $this->entityMetaData)) {
|
||||
$metaDataRetriever = new Adapter_EntityMetaDataRetriever;
|
||||
$this->entityMetaData[$className] = $metaDataRetriever->getEntityMetaData($className);
|
||||
}
|
||||
|
||||
return $this->entityMetaData[$className];
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush entity to DB
|
||||
* @param Core_Foundation_Database_EntityInterface $entity
|
||||
* @return $this
|
||||
*/
|
||||
public function save(Core_Foundation_Database_EntityInterface $entity)
|
||||
{
|
||||
$entity->save();
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* DElete entity from DB
|
||||
* @param Core_Foundation_Database_EntityInterface $entity
|
||||
* @return $this
|
||||
*/
|
||||
public function delete(Core_Foundation_Database_EntityInterface $entity)
|
||||
{
|
||||
$entity->delete();
|
||||
return $this;
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Core_Foundation_Database_EntityMetaData
|
||||
{
|
||||
private $tableName;
|
||||
private $primaryKeyFieldnames;
|
||||
|
||||
public function setTableName($name)
|
||||
{
|
||||
$this->tableName = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTableName()
|
||||
{
|
||||
return $this->tableName;
|
||||
}
|
||||
|
||||
public function setPrimaryKeyFieldNames(array $primaryKeyFieldnames)
|
||||
{
|
||||
$this->primaryKeyFieldnames = $primaryKeyFieldnames;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrimaryKeyFieldnames()
|
||||
{
|
||||
return $this->primaryKeyFieldnames;
|
||||
}
|
||||
|
||||
public function setEntityClassName($entityClassName)
|
||||
{
|
||||
$this->entityClassName = $entityClassName;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEntityClassName()
|
||||
{
|
||||
return $this->entityClassName;
|
||||
}
|
||||
}
|
@ -0,0 +1,220 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Core_Foundation_Database_EntityRepository
|
||||
{
|
||||
protected $entityManager;
|
||||
protected $db;
|
||||
protected $tablesPrefix;
|
||||
protected $entityMetaData;
|
||||
protected $queryBuilder;
|
||||
|
||||
public function __construct(
|
||||
Core_Foundation_Database_EntityManager $entityManager,
|
||||
$tablesPrefix,
|
||||
Core_Foundation_Database_EntityMetaData $entityMetaData
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
$this->db = $this->entityManager->getDatabase();
|
||||
$this->tablesPrefix = $tablesPrefix;
|
||||
$this->entityMetaData = $entityMetaData;
|
||||
$this->queryBuilder = new Core_Foundation_Database_EntityManager_QueryBuilder($this->db);
|
||||
}
|
||||
|
||||
public function __call($method, $arguments)
|
||||
{
|
||||
if (0 === strpos($method, 'findOneBy')) {
|
||||
$one = true;
|
||||
$by = substr($method, 9);
|
||||
} elseif (0 === strpos($method, 'findBy')) {
|
||||
$one = false;
|
||||
$by = substr($method, 6);
|
||||
} else {
|
||||
throw new Core_Foundation_Database_Exception(sprintf('Undefind method %s.', $method));
|
||||
}
|
||||
|
||||
if (count($arguments) !== 1) {
|
||||
throw new Core_Foundation_Database_Exception(sprintf('Method %s takes exactly one argument.', $method));
|
||||
}
|
||||
|
||||
if (!$by) {
|
||||
$where = $arguments[0];
|
||||
} else {
|
||||
$where = array();
|
||||
$by = $this->convertToDbFieldName($by);
|
||||
$where[$by] = $arguments[0];
|
||||
}
|
||||
|
||||
return $this->doFind($one, $where);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a camelCase field name to a snakeCase one
|
||||
* e.g.: findAllByIdCMS => id_cms
|
||||
* @param $camel_case_field_name
|
||||
* @return string
|
||||
*/
|
||||
private function convertToDbFieldName($camel_case_field_name)
|
||||
{
|
||||
return strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $camel_case_field_name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return ID field name
|
||||
* @return mixed
|
||||
* @throws Core_Foundation_Database_Exception
|
||||
*/
|
||||
protected function getIdFieldName()
|
||||
{
|
||||
$primary = $this->entityMetaData->getPrimaryKeyFieldnames();
|
||||
|
||||
if (count($primary) === 0) {
|
||||
throw new Core_Foundation_Database_Exception(
|
||||
sprintf(
|
||||
'No primary key defined in entity `%s`.',
|
||||
$this->entityMetaData->getEntityClassName()
|
||||
)
|
||||
);
|
||||
} elseif (count($primary) > 1) {
|
||||
throw new Core_Foundation_Database_Exception(
|
||||
sprintf(
|
||||
'Entity `%s` has a composite primary key, which is not supported by entity repositories.',
|
||||
$this->entityMetaData->getEntityClassName()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $primary[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns escaped+prefixed current table name
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getTableNameWithPrefix()
|
||||
{
|
||||
return $this->db->escape($this->tablesPrefix . $this->entityMetaData->getTableName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns escaped DB table prefix
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getPrefix()
|
||||
{
|
||||
return $this->db->escape($this->tablesPrefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new empty Entity depending on current Repository selected
|
||||
* @return mixed
|
||||
*/
|
||||
public function getNewEntity()
|
||||
{
|
||||
$entityClassName = $this->entityMetaData->getEntityClassName();
|
||||
return new $entityClassName;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function takes an array of database rows as input
|
||||
* and returns an hydrated entity if there is one row only.
|
||||
*
|
||||
* Null is returned when there are no rows, and an exception is thrown
|
||||
* if there are too many rows.
|
||||
*
|
||||
* @param array $rows Database rows
|
||||
*/
|
||||
protected function hydrateOne(array $rows)
|
||||
{
|
||||
if (count($rows) === 0) {
|
||||
return null;
|
||||
} elseif (count($rows) > 1) {
|
||||
throw new Core_Foundation_Database_Exception('Too many rows returned.');
|
||||
} else {
|
||||
$data = $rows[0];
|
||||
$entity = $this-> getNewEntity();
|
||||
$entity->hydrate($data);
|
||||
return $entity;
|
||||
}
|
||||
}
|
||||
|
||||
protected function hydrateMany(array $rows)
|
||||
{
|
||||
$entities = array();
|
||||
foreach ($rows as $row) {
|
||||
$entity = $this->getNewEntity();
|
||||
$entity->hydrate($row);
|
||||
$entities[] = $entity;
|
||||
}
|
||||
return $entities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs and performs 'SELECT' in DB
|
||||
* @param $one
|
||||
* @param array $cumulativeConditions
|
||||
* @return array|mixed|null
|
||||
* @throws Core_Foundation_Database_Exception
|
||||
*/
|
||||
private function doFind($one, array $cumulativeConditions)
|
||||
{
|
||||
$whereClause = $this->queryBuilder->buildWhereConditions('AND', $cumulativeConditions);
|
||||
|
||||
$sql = 'SELECT * FROM ' . $this->getTableNameWithPrefix() . ' WHERE ' . $whereClause;
|
||||
|
||||
$rows = $this->db->select($sql);
|
||||
|
||||
if ($one) {
|
||||
return $this->hydrateOne($rows);
|
||||
} else {
|
||||
return $this->hydrateMany($rows);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find one entity in DB
|
||||
* @param $id
|
||||
* @return array|mixed|null
|
||||
* @throws Core_Foundation_Database_Exception
|
||||
*/
|
||||
public function findOne($id)
|
||||
{
|
||||
$conditions = array();
|
||||
$conditions[$this->getIdFieldName()] = $id;
|
||||
|
||||
return $this->doFind(true, $conditions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find all entities in DB
|
||||
* @return array
|
||||
*/
|
||||
public function findAll()
|
||||
{
|
||||
$sql = 'SELECT * FROM ' . $this->getTableNameWithPrefix();
|
||||
return $this->hydrateMany($this->db->select($sql));
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Core_Foundation_Database_Exception extends Core_Foundation_Exception_Exception
|
||||
{
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Core_Foundation_Database_EntityManager_QueryBuilder
|
||||
{
|
||||
private $db;
|
||||
|
||||
public function __construct(Core_Foundation_Database_DatabaseInterface $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
public function quote($value)
|
||||
{
|
||||
$escaped = $this->db->escape($value);
|
||||
|
||||
if (is_string($value)) {
|
||||
return "'" . $escaped . "'";
|
||||
} else {
|
||||
return $escaped;
|
||||
}
|
||||
}
|
||||
|
||||
public function buildWhereConditions($andOrOr, array $conditions)
|
||||
{
|
||||
$operator = strtoupper($andOrOr);
|
||||
|
||||
if ($operator !== 'AND' && $operator !== 'OR') {
|
||||
throw new Core_Foundation_Database_Exception(sprintf('Invalid operator %s - must be "and" or "or".', $andOrOr));
|
||||
}
|
||||
|
||||
$parts = array();
|
||||
|
||||
foreach ($conditions as $key => $value) {
|
||||
if (is_scalar($value)) {
|
||||
$parts[] = $key . ' = ' . $this->quote($value);
|
||||
} else {
|
||||
$list = array();
|
||||
foreach ($value as $item) {
|
||||
$list[] = $this->quote($item);
|
||||
}
|
||||
$parts[] = $key . ' IN (' . implode(', ', $list) . ')';
|
||||
}
|
||||
}
|
||||
|
||||
return implode(" $operator ", $parts);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Core_Foundation_Exception_Exception extends Exception
|
||||
{
|
||||
public function __construct($message = null, $code = 0, Exception $previous = null)
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Core_Foundation_FileSystem_Exception extends Core_Foundation_Exception_Exception
|
||||
{
|
||||
}
|
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Core_Foundation_FileSystem_FileSystem
|
||||
{
|
||||
/**
|
||||
* Replaces directory separators with the system's native one
|
||||
* and trims the trailing separator.
|
||||
*/
|
||||
public function normalizePath($path)
|
||||
{
|
||||
return rtrim(
|
||||
str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path),
|
||||
DIRECTORY_SEPARATOR
|
||||
);
|
||||
}
|
||||
|
||||
private function joinTwoPaths($a, $b)
|
||||
{
|
||||
return $this->normalizePath($a) . DIRECTORY_SEPARATOR . $this->normalizePath($b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Joins an arbitrary number of paths, normalizing them along the way.
|
||||
*/
|
||||
public function joinPaths()
|
||||
{
|
||||
if (func_num_args() < 2) {
|
||||
throw new Core_Foundation_FileSystem_Exception('joinPaths requires at least 2 arguments.');
|
||||
} else if (func_num_args() === 2) {
|
||||
$arg_O = func_get_arg(0);
|
||||
$arg_1 = func_get_arg(1);
|
||||
|
||||
return $this->joinTwoPaths($arg_O, $arg_1);
|
||||
} else if (func_num_args() > 2) {
|
||||
$func_args = func_get_args();
|
||||
$arg_0 = func_get_arg(0);
|
||||
|
||||
return $this->joinPaths(
|
||||
$arg_0,
|
||||
call_user_func_array(
|
||||
array($this,
|
||||
'joinPaths'),
|
||||
array_slice($func_args, 1)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a depth first listing of directory entries.
|
||||
* Throws exception if $path is not a file.
|
||||
* If $path is a file and not a directory, just gets the file info for it
|
||||
* and return it in an array.
|
||||
* @return an array of SplFileInfo object indexed by file path
|
||||
*/
|
||||
public function listEntriesRecursively($path)
|
||||
{
|
||||
if (!file_exists($path)) {
|
||||
throw new Core_Foundation_FileSystem_Exception(
|
||||
sprintf(
|
||||
'No such file or directory: %s',
|
||||
$path
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (!is_dir($path)) {
|
||||
throw new Core_Foundation_FileSystem_Exception(
|
||||
sprintf(
|
||||
'%s is not a directory',
|
||||
$path
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$entries = array();
|
||||
|
||||
foreach (scandir($path) as $entry) {
|
||||
if ($entry === '.' || $entry === '..') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$newPath = $this->joinPaths($path, $entry);
|
||||
$info = new SplFileInfo($newPath);
|
||||
|
||||
$entries[$newPath] = $info;
|
||||
|
||||
if ($info->isDir()) {
|
||||
$entries = array_merge(
|
||||
$entries,
|
||||
$this->listEntriesRecursively($newPath)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter used by listFilesRecursively.
|
||||
*/
|
||||
private function matchOnlyFiles(SplFileInfo $info)
|
||||
{
|
||||
return $info->isFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as listEntriesRecursively but returns only files.
|
||||
*/
|
||||
public function listFilesRecursively($path)
|
||||
{
|
||||
return array_filter(
|
||||
$this->listEntriesRecursively($path),
|
||||
array($this, 'matchOnlyFiles')
|
||||
);
|
||||
}
|
||||
}
|
172
www/Core/Foundation/IoC/Core_Foundation_IoC_Container.php
Normal file
@ -0,0 +1,172 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Core_Foundation_IoC_Container
|
||||
{
|
||||
private $bindings = array();
|
||||
private $instances = array();
|
||||
private $namespaceAliases = array();
|
||||
|
||||
public function knows($serviceName)
|
||||
{
|
||||
return array_key_exists($serviceName, $this->bindings);
|
||||
}
|
||||
|
||||
private function knowsNamespaceAlias($alias)
|
||||
{
|
||||
return array_key_exists($alias, $this->namespaceAliases);
|
||||
}
|
||||
|
||||
public function bind($serviceName, $constructor, $shared = false)
|
||||
{
|
||||
if ($this->knows($serviceName)) {
|
||||
throw new Core_Foundation_IoC_Exception(
|
||||
sprintf('Cannot bind `%s` again. A service name can only be bound once.', $serviceName)
|
||||
);
|
||||
}
|
||||
|
||||
$this->bindings[$serviceName] = array(
|
||||
'constructor' => $constructor,
|
||||
'shared' => $shared
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function aliasNamespace($alias, $namespacePrefix)
|
||||
{
|
||||
if ($this->knowsNamespaceAlias($alias)) {
|
||||
throw new Core_Foundation_IoC_Exception(
|
||||
sprintf(
|
||||
'Namespace alias `%1$s` already exists and points to `%2$s`',
|
||||
$alias, $this->namespaceAliases[$alias]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$this->namespaceAliases[$alias] = $namespacePrefix;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function resolveClassName($className)
|
||||
{
|
||||
$colonPos = strpos($className, ':');
|
||||
if (0 !== $colonPos) {
|
||||
$alias = substr($className, 0, $colonPos);
|
||||
if ($this->knowsNamespaceAlias($alias)) {
|
||||
$class = ltrim(substr($className, $colonPos + 1), '\\');
|
||||
return $this->namespaceAliases[$alias] . '\\' . $class;
|
||||
}
|
||||
}
|
||||
|
||||
return $className;
|
||||
}
|
||||
|
||||
private function makeInstanceFromClassName($className, array $alreadySeen)
|
||||
{
|
||||
$className = $this->resolveClassName($className);
|
||||
|
||||
try {
|
||||
$refl = new ReflectionClass($className);
|
||||
} catch (ReflectionException $re) {
|
||||
throw new Core_Foundation_IoC_Exception(sprintf('This doesn\'t seem to be a class name: `%s`.', $className));
|
||||
}
|
||||
|
||||
$args = array();
|
||||
|
||||
if ($refl->isAbstract()) {
|
||||
throw new Core_Foundation_IoC_Exception(sprintf('Cannot build abstract class: `%s`.', $className));
|
||||
}
|
||||
|
||||
$classConstructor = $refl->getConstructor();
|
||||
|
||||
if ($classConstructor) {
|
||||
foreach ($classConstructor->getParameters() as $param) {
|
||||
$paramClass = $param->getClass();
|
||||
if ($paramClass) {
|
||||
$args[] = $this->doMake($param->getClass()->getName(), $alreadySeen);
|
||||
} elseif ($param->isDefaultValueAvailable()) {
|
||||
$args[] = $param->getDefaultValue();
|
||||
} else {
|
||||
throw new Core_Foundation_IoC_Exception(sprintf('Cannot build a `%s`.', $className));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($args) > 0) {
|
||||
return $refl->newInstanceArgs($args);
|
||||
} else {
|
||||
// newInstanceArgs with empty array fails in PHP 5.3 when the class
|
||||
// doesn't have an explicitly defined constructor
|
||||
return $refl->newInstance();
|
||||
}
|
||||
}
|
||||
|
||||
private function doMake($serviceName, array $alreadySeen = array())
|
||||
{
|
||||
if (array_key_exists($serviceName, $alreadySeen)) {
|
||||
throw new Core_Foundation_IoC_Exception(sprintf(
|
||||
'Cyclic dependency detected while building `%s`.',
|
||||
$serviceName
|
||||
));
|
||||
}
|
||||
|
||||
$alreadySeen[$serviceName] = true;
|
||||
|
||||
if (!$this->knows($serviceName)) {
|
||||
$this->bind($serviceName, $serviceName);
|
||||
}
|
||||
|
||||
$binding = $this->bindings[$serviceName];
|
||||
|
||||
if ($binding['shared'] && array_key_exists($serviceName, $this->instances)) {
|
||||
return $this->instances[$serviceName];
|
||||
} else {
|
||||
$constructor = $binding['constructor'];
|
||||
|
||||
if (is_callable($constructor)) {
|
||||
$service = call_user_func($constructor);
|
||||
} elseif (!is_string($constructor)) {
|
||||
// user already provided the value, no need to construct it.
|
||||
$service = $constructor;
|
||||
} else {
|
||||
// assume the $constructor is a class name
|
||||
$service = $this->makeInstanceFromClassName($constructor, $alreadySeen);
|
||||
}
|
||||
|
||||
if ($binding['shared']) {
|
||||
$this->instances[$serviceName] = $service;
|
||||
}
|
||||
|
||||
return $service;
|
||||
}
|
||||
}
|
||||
|
||||
public function make($serviceName)
|
||||
{
|
||||
return $this->doMake($serviceName, array());
|
||||
}
|
||||
}
|
29
www/Core/Foundation/IoC/Core_Foundation_IoC_Exception.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Core_Foundation_IoC_Exception extends Core_Foundation_Exception_Exception
|
||||
{
|
||||
}
|
5279
www/LICENSES
Normal file
168
www/_install/classes/controllerConsole.php
Normal file
@ -0,0 +1,168 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
abstract class InstallControllerConsole
|
||||
{
|
||||
/**
|
||||
* @var array List of installer steps
|
||||
*/
|
||||
protected static $steps = array('process');
|
||||
|
||||
protected static $instances = array();
|
||||
|
||||
/**
|
||||
* @var string Current step
|
||||
*/
|
||||
public $step;
|
||||
|
||||
/**
|
||||
* @var array List of errors
|
||||
*/
|
||||
public $errors = array();
|
||||
|
||||
public $controller;
|
||||
|
||||
/**
|
||||
* @var InstallSession
|
||||
*/
|
||||
public $session;
|
||||
|
||||
/**
|
||||
* @var InstallLanguages
|
||||
*/
|
||||
public $language;
|
||||
|
||||
/**
|
||||
* @var InstallAbstractModel
|
||||
*/
|
||||
public $model;
|
||||
|
||||
/**
|
||||
* Validate current step
|
||||
*/
|
||||
abstract public function validate();
|
||||
|
||||
final public static function execute($argc, $argv)
|
||||
{
|
||||
if (!($argc-1)) {
|
||||
$available_arguments = Datas::getInstance()->getArgs();
|
||||
echo 'Arguments available:'."\n";
|
||||
foreach ($available_arguments as $key => $arg) {
|
||||
$name = isset($arg['name']) ? $arg['name'] : $key;
|
||||
echo '--'.$name."\t".(isset($arg['help']) ? $arg['help'] : '').(isset($arg['default']) ? "\t".'(Default: '.$arg['default'].')' : '')."\n";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
$errors = Datas::getInstance()->getAndCheckArgs($argv);
|
||||
if (Datas::getInstance()->show_license) {
|
||||
echo strip_tags(file_get_contents(_PS_INSTALL_PATH_.'theme/views/license_content.phtml'));
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($errors !== true) {
|
||||
if (count($errors)) {
|
||||
foreach ($errors as $error) {
|
||||
echo $error."\n";
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!file_exists(_PS_INSTALL_CONTROLLERS_PATH_.'console/process.php')) {
|
||||
throw new PrestashopInstallerException("Controller file 'console/process.php' not found");
|
||||
}
|
||||
|
||||
require_once _PS_INSTALL_CONTROLLERS_PATH_.'console/process.php';
|
||||
$classname = 'InstallControllerConsoleProcess';
|
||||
self::$instances['process'] = new InstallControllerConsoleProcess('process');
|
||||
|
||||
$datas = Datas::getInstance();
|
||||
|
||||
/* redefine HTTP_HOST */
|
||||
$_SERVER['HTTP_HOST'] = $datas->http_host;
|
||||
|
||||
@date_default_timezone_set($datas->timezone);
|
||||
|
||||
self::$instances['process']->process();
|
||||
}
|
||||
|
||||
final public function __construct($step)
|
||||
{
|
||||
$this->step = $step;
|
||||
$this->datas = Datas::getInstance();
|
||||
|
||||
// Set current language
|
||||
$this->language = InstallLanguages::getInstance();
|
||||
if (!$this->datas->language) {
|
||||
die('No language defined');
|
||||
}
|
||||
$this->language->setLanguage($this->datas->language);
|
||||
|
||||
$this->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize model
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
|
||||
public function printErrors()
|
||||
{
|
||||
$errors = $this->model_install->getErrors();
|
||||
if (count($errors)) {
|
||||
if (!is_array($errors)) {
|
||||
$errors = array($errors);
|
||||
}
|
||||
echo 'Errors :'."\n";
|
||||
foreach ($errors as $error_process) {
|
||||
foreach ($error_process as $error) {
|
||||
echo (is_string($error) ? $error : print_r($error, true))."\n";
|
||||
}
|
||||
}
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get translated string
|
||||
*
|
||||
* @param string $str String to translate
|
||||
* @param ... All other params will be used with sprintf
|
||||
* @return string
|
||||
*/
|
||||
public function l($str)
|
||||
{
|
||||
$args = func_get_args();
|
||||
return call_user_func_array(array($this->language, 'l'), $args);
|
||||
}
|
||||
|
||||
public function process()
|
||||
{
|
||||
}
|
||||
}
|
479
www/_install/classes/controllerHttp.php
Normal file
@ -0,0 +1,479 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
abstract class InstallControllerHttp
|
||||
{
|
||||
/**
|
||||
* @var array List of installer steps
|
||||
*/
|
||||
protected static $steps = array('welcome', 'license', 'system', 'configure', 'database', 'process');
|
||||
protected $phone;
|
||||
protected static $instances = array();
|
||||
|
||||
/**
|
||||
* @var string Current step
|
||||
*/
|
||||
public $step;
|
||||
|
||||
/**
|
||||
* @var array List of errors
|
||||
*/
|
||||
public $errors = array();
|
||||
|
||||
public $controller;
|
||||
|
||||
/**
|
||||
* @var InstallSession
|
||||
*/
|
||||
public $session;
|
||||
|
||||
/**
|
||||
* @var InstallLanguages
|
||||
*/
|
||||
public $language;
|
||||
|
||||
/**
|
||||
* @var bool If false, disable next button access
|
||||
*/
|
||||
public $next_button = true;
|
||||
|
||||
/**
|
||||
* @var bool If false, disable previous button access
|
||||
*/
|
||||
public $previous_button = true;
|
||||
|
||||
/**
|
||||
* @var InstallAbstractModel
|
||||
*/
|
||||
public $model;
|
||||
|
||||
/**
|
||||
* @var array Magic vars
|
||||
*/
|
||||
protected $__vars = array();
|
||||
|
||||
/**
|
||||
* Process form to go to next step
|
||||
*/
|
||||
abstract public function processNextStep();
|
||||
|
||||
/**
|
||||
* Validate current step
|
||||
*/
|
||||
abstract public function validate();
|
||||
|
||||
/**
|
||||
* Display current step view
|
||||
*/
|
||||
abstract public function display();
|
||||
|
||||
final public static function execute()
|
||||
{
|
||||
if (Tools::getValue('compile_templates')) {
|
||||
require_once(_PS_INSTALL_CONTROLLERS_PATH_.'http/smarty_compile.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$session = InstallSession::getInstance();
|
||||
if (!$session->last_step || $session->last_step == 'welcome') {
|
||||
Tools::generateIndex();
|
||||
}
|
||||
|
||||
// Include all controllers
|
||||
foreach (self::$steps as $step) {
|
||||
if (!file_exists(_PS_INSTALL_CONTROLLERS_PATH_.'http/'.$step.'.php')) {
|
||||
throw new PrestashopInstallerException("Controller file 'http/{$step}.php' not found");
|
||||
}
|
||||
|
||||
require_once _PS_INSTALL_CONTROLLERS_PATH_.'http/'.$step.'.php';
|
||||
$classname = 'InstallControllerHttp'.$step;
|
||||
self::$instances[$step] = new $classname($step);
|
||||
}
|
||||
|
||||
if (!$session->last_step || !in_array($session->last_step, self::$steps)) {
|
||||
$session->last_step = self::$steps[0];
|
||||
}
|
||||
|
||||
// Set timezone
|
||||
if ($session->shop_timezone) {
|
||||
@date_default_timezone_set($session->shop_timezone);
|
||||
}
|
||||
|
||||
// Get current step (check first if step is changed, then take it from session)
|
||||
if (Tools::getValue('step')) {
|
||||
$current_step = Tools::getValue('step');
|
||||
$session->step = $current_step;
|
||||
} else {
|
||||
$current_step = (isset($session->step)) ? $session->step : self::$steps[0];
|
||||
}
|
||||
|
||||
if (!in_array($current_step, self::$steps)) {
|
||||
$current_step = self::$steps[0];
|
||||
}
|
||||
|
||||
// Validate all steps until current step. If a step is not valid, use it as current step.
|
||||
foreach (self::$steps as $check_step) {
|
||||
// Do not validate current step
|
||||
if ($check_step == $current_step) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!self::$instances[$check_step]->validate()) {
|
||||
$current_step = $check_step;
|
||||
$session->step = $current_step;
|
||||
$session->last_step = $current_step;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Submit form to go to next step
|
||||
if (Tools::getValue('submitNext')) {
|
||||
self::$instances[$current_step]->processNextStep();
|
||||
|
||||
// If current step is validated, let's go to next step
|
||||
if (self::$instances[$current_step]->validate()) {
|
||||
$current_step = self::$instances[$current_step]->findNextStep();
|
||||
}
|
||||
$session->step = $current_step;
|
||||
|
||||
// Change last step
|
||||
if (self::getStepOffset($current_step) > self::getStepOffset($session->last_step)) {
|
||||
$session->last_step = $current_step;
|
||||
}
|
||||
}
|
||||
// Go to previous step
|
||||
elseif (Tools::getValue('submitPrevious') && $current_step != self::$steps[0]) {
|
||||
$current_step = self::$instances[$current_step]->findPreviousStep($current_step);
|
||||
$session->step = $current_step;
|
||||
}
|
||||
|
||||
self::$instances[$current_step]->process();
|
||||
self::$instances[$current_step]->display();
|
||||
}
|
||||
|
||||
final public function __construct($step)
|
||||
{
|
||||
$this->step = $step;
|
||||
$this->session = InstallSession::getInstance();
|
||||
|
||||
// Set current language
|
||||
$this->language = InstallLanguages::getInstance();
|
||||
$detect_language = $this->language->detectLanguage();
|
||||
if (isset($this->session->lang)) {
|
||||
$lang = $this->session->lang;
|
||||
} else {
|
||||
$lang = (isset($detect_language['primarytag'])) ? $detect_language['primarytag'] : false;
|
||||
}
|
||||
|
||||
if (!in_array($lang, $this->language->getIsoList())) {
|
||||
$lang = 'en';
|
||||
}
|
||||
$this->language->setLanguage($lang);
|
||||
|
||||
$this->init();
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
|
||||
public function process()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Get steps list
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSteps()
|
||||
{
|
||||
return self::$steps;
|
||||
}
|
||||
|
||||
public function getLastStep()
|
||||
{
|
||||
return $this->session->last_step;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find offset of a step by name
|
||||
*
|
||||
* @param string $step Step name
|
||||
* @return int
|
||||
*/
|
||||
public static function getStepOffset($step)
|
||||
{
|
||||
static $flip = null;
|
||||
|
||||
if (is_null($flip)) {
|
||||
$flip = array_flip(self::$steps);
|
||||
}
|
||||
return $flip[$step];
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a HTTP redirection to a step
|
||||
*
|
||||
* @param string $step
|
||||
*/
|
||||
public function redirect($step)
|
||||
{
|
||||
header('location: index.php?step='.$step);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get translated string
|
||||
*
|
||||
* @param string $str String to translate
|
||||
* @param ... All other params will be used with sprintf
|
||||
* @return string
|
||||
*/
|
||||
public function l($str)
|
||||
{
|
||||
$args = func_get_args();
|
||||
return call_user_func_array(array($this->language, 'l'), $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find previous step
|
||||
*
|
||||
* @param string $step
|
||||
*/
|
||||
public function findPreviousStep()
|
||||
{
|
||||
return (isset(self::$steps[$this->getStepOffset($this->step) - 1])) ? self::$steps[$this->getStepOffset($this->step) - 1] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find next step
|
||||
*
|
||||
* @param string $step
|
||||
*/
|
||||
public function findNextStep()
|
||||
{
|
||||
$nextStep = (isset(self::$steps[$this->getStepOffset($this->step) + 1])) ? self::$steps[$this->getStepOffset($this->step) + 1] : false;
|
||||
if ($nextStep == 'system' && self::$instances[$nextStep]->validate()) {
|
||||
$nextStep = self::$instances[$nextStep]->findNextStep();
|
||||
}
|
||||
return $nextStep;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if current step is first step in list of steps
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isFirstStep()
|
||||
{
|
||||
return self::getStepOffset($this->step) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if current step is last step in list of steps
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isLastStep()
|
||||
{
|
||||
return self::getStepOffset($this->step) == (count(self::$steps) - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check is given step is already finished
|
||||
*
|
||||
* @param string $step
|
||||
* @return bool
|
||||
*/
|
||||
public function isStepFinished($step)
|
||||
{
|
||||
return self::getStepOffset($step) < self::getStepOffset($this->getLastStep());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get telephone used for this language
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPhone()
|
||||
{
|
||||
if (InstallSession::getInstance()->support_phone != null) {
|
||||
return InstallSession::getInstance()->support_phone;
|
||||
}
|
||||
if ($this->phone === null) {
|
||||
$this->phone = $this->language->getInformation('phone', false);
|
||||
if ($iframe = Tools::file_get_contents('http://api.prestashop.com/iframe/install.php?lang='.$this->language->getLanguageIso(), false, null, 3)) {
|
||||
if (preg_match('/<img.+alt="([^"]+)".*>/Ui', $iframe, $matches) && isset($matches[1])) {
|
||||
$this->phone = $matches[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
InstallSession::getInstance()->support_phone = $this->phone;
|
||||
return $this->phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link to documentation for this language
|
||||
*
|
||||
* Enter description here ...
|
||||
*/
|
||||
public function getDocumentationLink()
|
||||
{
|
||||
return $this->language->getInformation('documentation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link to tutorial video for this language
|
||||
*
|
||||
* Enter description here ...
|
||||
*/
|
||||
public function getTutorialLink()
|
||||
{
|
||||
return $this->language->getInformation('tutorial');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link to tailored help for this language
|
||||
*
|
||||
* Enter description here ...
|
||||
*/
|
||||
public function getTailoredHelp()
|
||||
{
|
||||
return $this->language->getInformation('tailored_help');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link to forum for this language
|
||||
*
|
||||
* Enter description here ...
|
||||
*/
|
||||
public function getForumLink()
|
||||
{
|
||||
return $this->language->getInformation('forum');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link to blog for this language
|
||||
*
|
||||
* Enter description here ...
|
||||
*/
|
||||
public function getBlogLink()
|
||||
{
|
||||
return $this->language->getInformation('blog');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link to support for this language
|
||||
*
|
||||
* Enter description here ...
|
||||
*/
|
||||
public function getSupportLink()
|
||||
{
|
||||
return $this->language->getInformation('support');
|
||||
}
|
||||
|
||||
public function getDocumentationUpgradeLink()
|
||||
{
|
||||
return $this->language->getInformation('documentation_upgrade', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send AJAX response in JSON format {success: bool, message: string}
|
||||
*
|
||||
* @param bool $success
|
||||
* @param string $message
|
||||
*/
|
||||
public function ajaxJsonAnswer($success, $message = '')
|
||||
{
|
||||
if (!$success && empty($message)) {
|
||||
$message = print_r(@error_get_last(), true);
|
||||
}
|
||||
die(Tools::jsonEncode(array(
|
||||
'success' => (bool)$success,
|
||||
'message' => $message,
|
||||
// 'memory' => round(memory_get_peak_usage()/1024/1024, 2).' Mo',
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a template
|
||||
*
|
||||
* @param string $template Template name
|
||||
* @param bool $get_output Is true, return template html
|
||||
* @return string
|
||||
*/
|
||||
public function displayTemplate($template, $get_output = false, $path = null)
|
||||
{
|
||||
if (!$path) {
|
||||
$path = _PS_INSTALL_PATH_.'theme/views/';
|
||||
}
|
||||
|
||||
if (!file_exists($path.$template.'.phtml')) {
|
||||
throw new PrestashopInstallerException("Template '{$template}.phtml' not found");
|
||||
}
|
||||
|
||||
if ($get_output) {
|
||||
ob_start();
|
||||
}
|
||||
|
||||
include($path.$template.'.phtml');
|
||||
|
||||
if ($get_output) {
|
||||
$content = ob_get_contents();
|
||||
if (ob_get_level() && ob_get_length() > 0) {
|
||||
ob_end_clean();
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
||||
public function &__get($varname)
|
||||
{
|
||||
if (isset($this->__vars[$varname])) {
|
||||
$ref = &$this->__vars[$varname];
|
||||
} else {
|
||||
$null = null;
|
||||
$ref = &$null;
|
||||
}
|
||||
return $ref;
|
||||
}
|
||||
|
||||
public function __set($varname, $value)
|
||||
{
|
||||
$this->__vars[$varname] = $value;
|
||||
}
|
||||
|
||||
public function __isset($varname)
|
||||
{
|
||||
return isset($this->__vars[$varname]);
|
||||
}
|
||||
|
||||
public function __unset($varname)
|
||||
{
|
||||
unset($this->__vars[$varname]);
|
||||
}
|
||||
}
|
233
www/_install/classes/datas.php
Normal file
@ -0,0 +1,233 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class Datas
|
||||
{
|
||||
private static $instance = null;
|
||||
protected static $available_args = array(
|
||||
'step' => array(
|
||||
'name' => 'step',
|
||||
'default' => 'all',
|
||||
'validate' => 'isGenericName',
|
||||
'help' => 'all / database,fixtures,theme,modules,addons_modules',
|
||||
),
|
||||
'language' => array(
|
||||
'default' => 'en',
|
||||
'validate' => 'isLanguageIsoCode',
|
||||
'alias' => 'l',
|
||||
'help' => 'language iso code',
|
||||
),
|
||||
'all_languages' => array(
|
||||
'default' => '0',
|
||||
'validate' => 'isInt',
|
||||
'alias' => 'l',
|
||||
'help' => 'install all available languages',
|
||||
),
|
||||
'timezone' => array(
|
||||
'default' => 'Europe/Paris',
|
||||
'alias' => 't',
|
||||
),
|
||||
'base_uri' => array(
|
||||
'name' => 'base_uri',
|
||||
'validate' => 'isUrl',
|
||||
'default' => '/',
|
||||
),
|
||||
'http_host' => array(
|
||||
'name' => 'domain',
|
||||
'validate' => 'isGenericName',
|
||||
'default' => 'localhost',
|
||||
),
|
||||
'database_server' => array(
|
||||
'name' => 'db_server',
|
||||
'default' => 'localhost',
|
||||
'validate' => 'isGenericName',
|
||||
'alias' => 'h',
|
||||
),
|
||||
'database_login' => array(
|
||||
'name' => 'db_user',
|
||||
'alias' => 'u',
|
||||
'default' => 'root',
|
||||
'validate' => 'isGenericName',
|
||||
),
|
||||
'database_password' => array(
|
||||
'name' => 'db_password',
|
||||
'alias' => 'p',
|
||||
'default' => '',
|
||||
),
|
||||
'database_name' => array(
|
||||
'name' => 'db_name',
|
||||
'alias' => 'd',
|
||||
'default' => 'prestashop',
|
||||
'validate' => 'isGenericName',
|
||||
),
|
||||
'database_clear' => array(
|
||||
'name' => 'db_clear',
|
||||
'default' => '1',
|
||||
'validate' => 'isInt',
|
||||
'help' => 'Drop existing tables'
|
||||
),
|
||||
'database_create' => array(
|
||||
'name' => 'db_create',
|
||||
'default' => '0',
|
||||
'validate' => 'isInt',
|
||||
'help' => 'Create the database if not exist'
|
||||
),
|
||||
'database_prefix' => array(
|
||||
'name' => 'prefix',
|
||||
'default' => 'ps_',
|
||||
'validate' => 'isGenericName',
|
||||
),
|
||||
'database_engine' => array(
|
||||
'name' => 'engine',
|
||||
'validate' => 'isMySQLEngine',
|
||||
'default' => 'InnoDB',
|
||||
'help' => 'InnoDB/MyISAM',
|
||||
),
|
||||
'shop_name' => array(
|
||||
'name' => 'name',
|
||||
'validate' => 'isGenericName',
|
||||
'default' => 'PrestaShop',
|
||||
),
|
||||
'shop_activity' => array(
|
||||
'name' => 'activity',
|
||||
'default' => 0,
|
||||
'validate' => 'isInt',
|
||||
),
|
||||
'shop_country' => array(
|
||||
'name' => 'country',
|
||||
'validate' => 'isLanguageIsoCode',
|
||||
'default' => 'fr',
|
||||
),
|
||||
'admin_firstname' => array(
|
||||
'name' => 'firstname',
|
||||
'validate' => 'isName',
|
||||
'default' => 'John',
|
||||
),
|
||||
'admin_lastname' => array(
|
||||
'name' => 'lastname',
|
||||
'validate' => 'isName',
|
||||
'default' => 'Doe',
|
||||
),
|
||||
'admin_password' => array(
|
||||
'name' => 'password',
|
||||
'validate' => 'isPasswd',
|
||||
'default' => '0123456789',
|
||||
),
|
||||
'admin_email' => array(
|
||||
'name' => 'email',
|
||||
'validate' => 'isEmail',
|
||||
'default' => 'pub@prestashop.com'
|
||||
),
|
||||
'show_license' => array(
|
||||
'name' => 'license',
|
||||
'default' => 0,
|
||||
'help' => 'show PrestaShop license'
|
||||
),
|
||||
'newsletter' => array(
|
||||
'name' => 'newsletter',
|
||||
'default' => 1,
|
||||
'help' => 'get news from PrestaShop',
|
||||
),
|
||||
'send_email' => array(
|
||||
'name' => 'send_email',
|
||||
'default' => 1,
|
||||
'help' => 'send an email to the administrator after installation',
|
||||
),
|
||||
);
|
||||
|
||||
protected $datas = array();
|
||||
|
||||
public function __get($key)
|
||||
{
|
||||
if (isset($this->datas[$key])) {
|
||||
return $this->datas[$key];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function __set($key, $value)
|
||||
{
|
||||
$this->datas[$key] = $value;
|
||||
}
|
||||
|
||||
public static function getInstance()
|
||||
{
|
||||
if (Datas::$instance === null) {
|
||||
Datas::$instance = new Datas();
|
||||
}
|
||||
return Datas::$instance;
|
||||
}
|
||||
|
||||
public static function getArgs()
|
||||
{
|
||||
return Datas::$available_args;
|
||||
}
|
||||
|
||||
public function getAndCheckArgs($argv)
|
||||
{
|
||||
if (!$argv) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$args_ok = array();
|
||||
foreach ($argv as $arg) {
|
||||
if (!preg_match('/^--([^=\'"><|`]+)(?:=([^=><|`]+)|(?!license))/i', trim($arg), $res)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($res[1] == 'license' && !isset($res[2])) {
|
||||
$res[2] = 1;
|
||||
} elseif (!isset($res[2])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$args_ok[$res[1]] = $res[2];
|
||||
}
|
||||
|
||||
$errors = array();
|
||||
foreach (Datas::getArgs() as $key => $row) {
|
||||
if (isset($row['name'])) {
|
||||
$name = $row['name'];
|
||||
} else {
|
||||
$name = $key;
|
||||
}
|
||||
if (!isset($args_ok[$name])) {
|
||||
if (!isset($row['default'])) {
|
||||
$errors[] = 'Field '.$row['name'].' is empty';
|
||||
} else {
|
||||
$this->$key = $row['default'];
|
||||
}
|
||||
} elseif (isset($row['validate']) && !call_user_func(array('Validate', $row['validate']), $args_ok[$name])) {
|
||||
$errors[] = 'Field '.$key.' is not valid';
|
||||
} else {
|
||||
$this->$key = $args_ok[$name];
|
||||
}
|
||||
}
|
||||
|
||||
return count($errors) ? $errors : true;
|
||||
}
|
||||
}
|
29
www/_install/classes/exception.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class PrestashopInstallerException extends PrestaShopException
|
||||
{
|
||||
}
|
35
www/_install/classes/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../');
|
||||
exit;
|
116
www/_install/classes/language.php
Normal file
@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class InstallLanguage
|
||||
{
|
||||
/**
|
||||
* @var string Current language folder
|
||||
*/
|
||||
protected $path;
|
||||
|
||||
/**
|
||||
* @var string Current language iso
|
||||
*/
|
||||
protected $iso;
|
||||
|
||||
/**
|
||||
* @var array Cache list of installer translations for this language
|
||||
*/
|
||||
protected $data;
|
||||
|
||||
protected $fixtures_data;
|
||||
|
||||
/**
|
||||
* @var array Cache list of informations in language.xml file
|
||||
*/
|
||||
protected $meta;
|
||||
|
||||
/**
|
||||
* @var array Cache list of countries for this language
|
||||
*/
|
||||
protected $countries;
|
||||
|
||||
public function __construct($iso)
|
||||
{
|
||||
$this->path = _PS_INSTALL_LANGS_PATH_.$iso.'/';
|
||||
$this->iso = $iso;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get iso for current language
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIso()
|
||||
{
|
||||
return $this->iso;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an information from language.xml file (E.g. $this->getMetaInformation('name'))
|
||||
*
|
||||
* @param string $key
|
||||
* @return string
|
||||
*/
|
||||
public function getMetaInformation($key)
|
||||
{
|
||||
if (!is_array($this->meta)) {
|
||||
$this->meta = array();
|
||||
$xml = @simplexml_load_file($this->path.'language.xml');
|
||||
if ($xml) {
|
||||
foreach ($xml->children() as $node) {
|
||||
$this->meta[$node->getName()] = (string)$node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return isset($this->meta[$key]) ? $this->meta[$key] : null;
|
||||
}
|
||||
|
||||
public function getTranslation($key, $type = 'translations')
|
||||
{
|
||||
if (!is_array($this->data)) {
|
||||
$this->data = file_exists($this->path.'install.php') ? include($this->path.'install.php') : array();
|
||||
}
|
||||
|
||||
return isset($this->data[$type][$key]) ? $this->data[$type][$key] : null;
|
||||
}
|
||||
|
||||
public function getCountries()
|
||||
{
|
||||
if (!is_array($this->countries)) {
|
||||
$this->countries = array();
|
||||
if (file_exists($this->path.'data/country.xml')) {
|
||||
if ($xml = @simplexml_load_file($this->path.'data/country.xml')) {
|
||||
foreach ($xml->country as $country) {
|
||||
$this->countries[strtolower((string)$country['id'])] = (string)$country->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->countries;
|
||||
}
|
||||
}
|
227
www/_install/classes/languages.php
Normal file
@ -0,0 +1,227 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class InstallLanguages
|
||||
{
|
||||
const DEFAULT_ISO = 'en';
|
||||
/**
|
||||
* @var array List of available languages
|
||||
*/
|
||||
protected $languages;
|
||||
|
||||
/**
|
||||
* @var string Current language
|
||||
*/
|
||||
protected $language;
|
||||
|
||||
/**
|
||||
* @var InstallLanguage Default language (english)
|
||||
*/
|
||||
protected $default;
|
||||
|
||||
protected static $_instance;
|
||||
|
||||
public static function getInstance()
|
||||
{
|
||||
if (!self::$_instance) {
|
||||
self::$_instance = new self();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// English language is required
|
||||
if (!file_exists(_PS_INSTALL_LANGS_PATH_.'en/language.xml')) {
|
||||
throw new PrestashopInstallerException('English language is missing');
|
||||
}
|
||||
|
||||
$this->languages = array(
|
||||
self::DEFAULT_ISO => new InstallLanguage(self::DEFAULT_ISO),
|
||||
);
|
||||
|
||||
// Load other languages
|
||||
foreach (scandir(_PS_INSTALL_LANGS_PATH_) as $lang) {
|
||||
if ($lang[0] != '.' && is_dir(_PS_INSTALL_LANGS_PATH_.$lang) && $lang != self::DEFAULT_ISO && file_exists(_PS_INSTALL_LANGS_PATH_.$lang.'/install.php')) {
|
||||
$this->languages[$lang] = new InstallLanguage($lang);
|
||||
}
|
||||
}
|
||||
uasort($this->languages, 'ps_usort_languages');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set current language
|
||||
*
|
||||
* @param string $iso Language iso
|
||||
*/
|
||||
public function setLanguage($iso)
|
||||
{
|
||||
if (!in_array($iso, $this->getIsoList())) {
|
||||
throw new PrestashopInstallerException('Language '.$iso.' not found');
|
||||
}
|
||||
$this->language = $iso;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current language
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLanguageIso()
|
||||
{
|
||||
return $this->language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current language
|
||||
*
|
||||
* @return InstallLanguage
|
||||
*/
|
||||
public function getLanguage($iso = null)
|
||||
{
|
||||
if (!$iso) {
|
||||
$iso = $this->language;
|
||||
}
|
||||
return $this->languages[$iso];
|
||||
}
|
||||
|
||||
public function getIsoList()
|
||||
{
|
||||
return array_keys($this->languages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of languages iso supported by installer
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getLanguages()
|
||||
{
|
||||
return $this->languages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get translated string
|
||||
*
|
||||
* @param string $str String to translate
|
||||
* @param ... All other params will be used with sprintf
|
||||
* @return string
|
||||
*/
|
||||
public function l($str)
|
||||
{
|
||||
$args = func_get_args();
|
||||
$translation = $this->getLanguage()->getTranslation($args[0]);
|
||||
if (is_null($translation)) {
|
||||
$translation = $this->getLanguage(self::DEFAULT_ISO)->getTranslation($args[0]);
|
||||
if (is_null($translation)) {
|
||||
$translation = $args[0];
|
||||
}
|
||||
}
|
||||
|
||||
$args[0] = $translation;
|
||||
if (count($args) > 1) {
|
||||
return call_user_func_array('sprintf', $args);
|
||||
} else {
|
||||
return $translation;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an information from language (phone, links, etc.)
|
||||
*
|
||||
* @param string $key Information identifier
|
||||
*/
|
||||
public function getInformation($key, $with_default = true)
|
||||
{
|
||||
$information = $this->getLanguage()->getTranslation($key, 'informations');
|
||||
if (is_null($information) && $with_default) {
|
||||
return $this->getLanguage(self::DEFAULT_ISO)->getTranslation($key, 'informations');
|
||||
}
|
||||
return $information;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of countries for current language
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCountries()
|
||||
{
|
||||
static $countries = null;
|
||||
|
||||
if (is_null($countries)) {
|
||||
$countries = array();
|
||||
$countries_lang = $this->getLanguage()->getCountries();
|
||||
$countries_default = $this->getLanguage(self::DEFAULT_ISO)->getCountries();
|
||||
$xml = @simplexml_load_file(_PS_INSTALL_DATA_PATH_.'xml/country.xml');
|
||||
if ($xml) {
|
||||
foreach ($xml->entities->country as $country) {
|
||||
$iso = strtolower((string)$country['iso_code']);
|
||||
$countries[$iso] = isset($countries_lang[$iso]) ? $countries_lang[$iso] : $countries_default[$iso];
|
||||
}
|
||||
}
|
||||
asort($countries);
|
||||
}
|
||||
|
||||
return $countries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse HTTP_ACCEPT_LANGUAGE and get first data matching list of available languages
|
||||
*
|
||||
* @return bool|array
|
||||
*/
|
||||
public function detectLanguage()
|
||||
{
|
||||
// This code is from a php.net comment : http://www.php.net/manual/fr/reserved.variables.server.php#94237
|
||||
$split_languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
||||
if (!is_array($split_languages)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($split_languages as $lang) {
|
||||
$pattern = '/^(?P<primarytag>[a-zA-Z]{2,8})'.
|
||||
'(?:-(?P<subtag>[a-zA-Z]{2,8}))?(?:(?:;q=)'.
|
||||
'(?P<quantifier>\d\.\d))?$/';
|
||||
if (preg_match($pattern, $lang, $m)) {
|
||||
if (in_array($m['primarytag'], $this->getIsoList())) {
|
||||
return $m;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function ps_usort_languages($a, $b)
|
||||
{
|
||||
$aname = $a->getMetaInformation('name');
|
||||
$bname = $b->getMetaInformation('name');
|
||||
if ($aname == $bname) {
|
||||
return 0;
|
||||
}
|
||||
return ($aname < $bname) ? -1 : 1;
|
||||
}
|
57
www/_install/classes/model.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
abstract class InstallAbstractModel
|
||||
{
|
||||
/**
|
||||
* @var InstallLanguages
|
||||
*/
|
||||
public $language;
|
||||
|
||||
/**
|
||||
* @var array List of errors
|
||||
*/
|
||||
protected $errors = array();
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->language = InstallLanguages::getInstance();
|
||||
}
|
||||
|
||||
public function setError($errors)
|
||||
{
|
||||
if (!is_array($errors)) {
|
||||
$errors = array($errors);
|
||||
}
|
||||
|
||||
$this->errors[] = $errors;
|
||||
}
|
||||
|
||||
public function getErrors()
|
||||
{
|
||||
return $this->errors;
|
||||
}
|
||||
}
|
120
www/_install/classes/session.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Manage session for install script
|
||||
*/
|
||||
class InstallSession
|
||||
{
|
||||
protected static $_instance;
|
||||
protected static $_cookie_mode = false;
|
||||
protected static $_cookie = false;
|
||||
|
||||
public static function getInstance()
|
||||
{
|
||||
if (!self::$_instance) {
|
||||
self::$_instance = new self();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
session_name('install_'.substr(md5($_SERVER['HTTP_HOST']), 0, 12));
|
||||
$session_started = session_start();
|
||||
if (!($session_started)
|
||||
|| (!isset($_SESSION['session_mode']) && (isset($_GET['_']) || isset($_POST['submitNext']) || isset($_POST['submitPrevious']) || isset($_POST['language'])))) {
|
||||
InstallSession::$_cookie_mode = true;
|
||||
InstallSession::$_cookie = new Cookie('ps_install', null, time() + 7200, null, true);
|
||||
}
|
||||
if ($session_started && !isset($_SESSION['session_mode'])) {
|
||||
$_SESSION['session_mode'] = 'session';
|
||||
session_write_close();
|
||||
}
|
||||
}
|
||||
|
||||
public function clean()
|
||||
{
|
||||
if (InstallSession::$_cookie_mode) {
|
||||
InstallSession::$_cookie->logout();
|
||||
} else {
|
||||
foreach ($_SESSION as $k => $v) {
|
||||
unset($_SESSION[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function &__get($varname)
|
||||
{
|
||||
if (InstallSession::$_cookie_mode) {
|
||||
$ref = InstallSession::$_cookie->{$varname};
|
||||
if (0 === strncmp($ref, 'serialized_array:', strlen('serialized_array:'))) {
|
||||
$ref = unserialize(substr($ref, strlen('serialized_array:')));
|
||||
}
|
||||
} else {
|
||||
if (isset($_SESSION[$varname])) {
|
||||
$ref = &$_SESSION[$varname];
|
||||
} else {
|
||||
$null = null;
|
||||
$ref = &$null;
|
||||
}
|
||||
}
|
||||
return $ref;
|
||||
}
|
||||
|
||||
public function __set($varname, $value)
|
||||
{
|
||||
if (InstallSession::$_cookie_mode) {
|
||||
if ($varname == 'xml_loader_ids') {
|
||||
return;
|
||||
}
|
||||
if (is_array($value)) {
|
||||
$value = 'serialized_array:'.serialize($value);
|
||||
}
|
||||
InstallSession::$_cookie->{$varname} = $value;
|
||||
} else {
|
||||
$_SESSION[$varname] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
public function __isset($varname)
|
||||
{
|
||||
if (InstallSession::$_cookie_mode) {
|
||||
return isset(InstallSession::$_cookie->{$varname});
|
||||
} else {
|
||||
return isset($_SESSION[$varname]);
|
||||
}
|
||||
}
|
||||
|
||||
public function __unset($varname)
|
||||
{
|
||||
if (InstallSession::$_cookie_mode) {
|
||||
unset(InstallSession::$_cookie->{$varname});
|
||||
} else {
|
||||
unset($_SESSION[$varname]);
|
||||
}
|
||||
}
|
||||
}
|
72
www/_install/classes/simplexml.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class InstallSimplexmlElement extends SimpleXMLElement
|
||||
{
|
||||
/**
|
||||
* Can add SimpleXMLElement values in XML tree
|
||||
*
|
||||
* @see SimpleXMLElement::addChild()
|
||||
*/
|
||||
public function addChild($name, $value = null, $namespace = null)
|
||||
{
|
||||
if ($value instanceof SimplexmlElement) {
|
||||
$content = trim((string)$value);
|
||||
if (strlen($content) > 0) {
|
||||
$new_element = parent::addChild($name, str_replace('&', '&', $content), $namespace);
|
||||
} else {
|
||||
$new_element = parent::addChild($name);
|
||||
foreach ($value->attributes() as $k => $v) {
|
||||
$new_element->addAttribute($k, $v);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($value->children() as $child) {
|
||||
$new_element->addChild($child->getName(), $child);
|
||||
}
|
||||
} else {
|
||||
return parent::addChild($name, str_replace('&', '&', $value), $namespace);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate nice and sweet XML
|
||||
*
|
||||
* @see SimpleXMLElement::asXML()
|
||||
*/
|
||||
public function asXML($filename = null)
|
||||
{
|
||||
$dom = new DOMDocument('1.0');
|
||||
$dom->preserveWhiteSpace = false;
|
||||
$dom->formatOutput = true;
|
||||
$dom->loadXML(parent::asXML());
|
||||
|
||||
if ($filename) {
|
||||
return (bool)file_put_contents($filename, $dom->saveXML());
|
||||
}
|
||||
return $dom->saveXML();
|
||||
}
|
||||
}
|
125
www/_install/classes/sqlLoader.php
Normal file
@ -0,0 +1,125 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class InstallSqlLoader
|
||||
{
|
||||
/**
|
||||
* @var Db
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* @var array List of keywords which will be replaced in queries
|
||||
*/
|
||||
protected $metadata = array();
|
||||
|
||||
/**
|
||||
* @var array List of errors during last parsing
|
||||
*/
|
||||
protected $errors = array();
|
||||
|
||||
/**
|
||||
* @param Db $db
|
||||
*/
|
||||
public function __construct(Db $db = null)
|
||||
{
|
||||
if (is_null($db)) {
|
||||
$db = Db::getInstance();
|
||||
}
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a list of keywords which will be replaced in queries
|
||||
*
|
||||
* @param array $data
|
||||
*/
|
||||
public function setMetaData(array $data)
|
||||
{
|
||||
foreach ($data as $k => $v) {
|
||||
$this->metadata[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a SQL file and execute queries
|
||||
*
|
||||
* @param string $filename
|
||||
* @param bool $stop_when_fail
|
||||
*/
|
||||
public function parse_file($filename, $stop_when_fail = true)
|
||||
{
|
||||
if (!file_exists($filename)) {
|
||||
throw new PrestashopInstallerException("File $filename not found");
|
||||
}
|
||||
|
||||
return $this->parse(file_get_contents($filename), $stop_when_fail);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse and execute a list of SQL queries
|
||||
*
|
||||
* @param string $content
|
||||
* @param bool $stop_when_fail
|
||||
*/
|
||||
public function parse($content, $stop_when_fail = true)
|
||||
{
|
||||
$this->errors = array();
|
||||
|
||||
$content = str_replace(array_keys($this->metadata), array_values($this->metadata), $content);
|
||||
$queries = preg_split('#;\s*[\r\n]+#', $content);
|
||||
foreach ($queries as $query) {
|
||||
$query = trim($query);
|
||||
if (!$query) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$this->db->execute($query)) {
|
||||
$this->errors[] = array(
|
||||
'errno' => $this->db->getNumberError(),
|
||||
'error' => $this->db->getMsgError(),
|
||||
'query' => $query,
|
||||
);
|
||||
|
||||
if ($stop_when_fail) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return count($this->errors) ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of errors from last parsing
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getErrors()
|
||||
{
|
||||
return $this->errors;
|
||||
}
|
||||
}
|
1320
www/_install/classes/xmlLoader.php
Normal file
35
www/_install/controllers/console/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../');
|
||||
exit;
|
341
www/_install/controllers/console/process.php
Normal file
@ -0,0 +1,341 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class InstallControllerConsoleProcess extends InstallControllerConsole
|
||||
{
|
||||
const SETTINGS_FILE = 'config/settings.inc.php';
|
||||
|
||||
protected $model_install;
|
||||
public $process_steps = array();
|
||||
public $previous_button = false;
|
||||
|
||||
public function init()
|
||||
{
|
||||
require_once _PS_INSTALL_MODELS_PATH_.'install.php';
|
||||
require_once _PS_INSTALL_MODELS_PATH_.'database.php';
|
||||
$this->model_install = new InstallModelInstall();
|
||||
$this->model_database = new InstallModelDatabase();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see InstallAbstractModel::processNextStep()
|
||||
*/
|
||||
public function processNextStep()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @see InstallAbstractModel::validate()
|
||||
*/
|
||||
public function validate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function initializeContext()
|
||||
{
|
||||
global $smarty;
|
||||
|
||||
// Clean all cache values
|
||||
Cache::clean('*');
|
||||
|
||||
Context::getContext()->shop = new Shop(1);
|
||||
Shop::setContext(Shop::CONTEXT_SHOP, 1);
|
||||
Configuration::loadConfiguration();
|
||||
if (!isset(Context::getContext()->language) || !Validate::isLoadedObject(Context::getContext()->language)) {
|
||||
if ($id_lang = (int)Configuration::get('PS_LANG_DEFAULT')) {
|
||||
Context::getContext()->language = new Language($id_lang);
|
||||
}
|
||||
}
|
||||
if (!isset(Context::getContext()->country) || !Validate::isLoadedObject(Context::getContext()->country)) {
|
||||
if ($id_country = (int)Configuration::get('PS_COUNTRY_DEFAULT')) {
|
||||
Context::getContext()->country = new Country((int)$id_country);
|
||||
}
|
||||
}
|
||||
if (!isset(Context::getContext()->currency) || !Validate::isLoadedObject(Context::getContext()->currency)) {
|
||||
if ($id_currency = (int)Configuration::get('PS_CURRENCY_DEFAULT')) {
|
||||
Context::getContext()->currency = new Currency((int)$id_currency);
|
||||
}
|
||||
}
|
||||
|
||||
Context::getContext()->cart = new Cart();
|
||||
Context::getContext()->employee = new Employee(1);
|
||||
if (!defined('_PS_SMARTY_FAST_LOAD_')) {
|
||||
define('_PS_SMARTY_FAST_LOAD_', true);
|
||||
}
|
||||
require_once _PS_ROOT_DIR_.'/config/smarty.config.inc.php';
|
||||
|
||||
Context::getContext()->smarty = $smarty;
|
||||
}
|
||||
|
||||
public function process()
|
||||
{
|
||||
$steps = explode(',', $this->datas->step);
|
||||
if (in_array('all', $steps)) {
|
||||
$steps = array('database','fixtures','theme','modules','addons_modules');
|
||||
}
|
||||
|
||||
if (in_array('database', $steps)) {
|
||||
if (!$this->processGenerateSettingsFile()) {
|
||||
$this->printErrors();
|
||||
}
|
||||
|
||||
if ($this->datas->database_create) {
|
||||
$this->model_database->createDatabase($this->datas->database_server, $this->datas->database_name, $this->datas->database_login, $this->datas->database_password);
|
||||
}
|
||||
|
||||
if (!$this->model_database->testDatabaseSettings($this->datas->database_server, $this->datas->database_name, $this->datas->database_login, $this->datas->database_password, $this->datas->database_prefix, $this->datas->database_engine, $this->datas->database_clear)) {
|
||||
$this->printErrors();
|
||||
}
|
||||
if (!$this->processInstallDatabase()) {
|
||||
$this->printErrors();
|
||||
}
|
||||
if (!$this->processInstallDefaultData()) {
|
||||
$this->printErrors();
|
||||
}
|
||||
if (!$this->processPopulateDatabase()) {
|
||||
$this->printErrors();
|
||||
}
|
||||
if (!$this->processConfigureShop()) {
|
||||
$this->printErrors();
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array('fixtures', $steps)) {
|
||||
if (!$this->processInstallFixtures()) {
|
||||
$this->printErrors();
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array('modules', $steps)) {
|
||||
if (!$this->processInstallModules()) {
|
||||
$this->printErrors();
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array('addons_modules', $steps)) {
|
||||
if (!$this->processInstallAddonsModules()) {
|
||||
$this->printErrors();
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array('theme', $steps)) {
|
||||
if (!$this->processInstallTheme()) {
|
||||
$this->printErrors();
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->datas->newsletter) {
|
||||
$params = http_build_query(array(
|
||||
'email' => $this->datas->admin_email,
|
||||
'method' => 'addMemberToNewsletter',
|
||||
'language' => $this->datas->lang,
|
||||
'visitorType' => 1,
|
||||
'source' => 'installer'
|
||||
));
|
||||
Tools::file_get_contents('http://www.prestashop.com/ajax/controller.php?'.$params);
|
||||
}
|
||||
|
||||
if ($this->datas->send_email) {
|
||||
if (!$this->processSendEmail()) {
|
||||
$this->printErrors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PROCESS : generateSettingsFile
|
||||
*/
|
||||
public function processGenerateSettingsFile()
|
||||
{
|
||||
return $this->model_install->generateSettingsFile(
|
||||
$this->datas->database_server,
|
||||
$this->datas->database_login,
|
||||
$this->datas->database_password,
|
||||
$this->datas->database_name,
|
||||
$this->datas->database_prefix,
|
||||
$this->datas->database_engine
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* PROCESS : installDatabase
|
||||
* Create database structure
|
||||
*/
|
||||
public function processInstallDatabase()
|
||||
{
|
||||
return $this->model_install->installDatabase($this->datas->database_clear);
|
||||
}
|
||||
|
||||
/**
|
||||
* PROCESS : installDefaultData
|
||||
* Create default shop and languages
|
||||
*/
|
||||
public function processInstallDefaultData()
|
||||
{
|
||||
$this->initializeContext();
|
||||
if (!$res = $this->model_install->installDefaultData($this->datas->shop_name, $this->datas->shop_country, (int)$this->datas->all_languages, true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->datas->base_uri != '/') {
|
||||
$shop_url = new ShopUrl(1);
|
||||
$shop_url->physical_uri = $this->datas->base_uri;
|
||||
$shop_url->save();
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* PROCESS : populateDatabase
|
||||
* Populate database with default data
|
||||
*/
|
||||
public function processPopulateDatabase()
|
||||
{
|
||||
$this->initializeContext();
|
||||
|
||||
$this->model_install->xml_loader_ids = $this->datas->xml_loader_ids;
|
||||
$result = $this->model_install->populateDatabase();
|
||||
$this->datas->xml_loader_ids = $this->model_install->xml_loader_ids;
|
||||
Configuration::updateValue('PS_INSTALL_XML_LOADERS_ID', Tools::jsonEncode($this->datas->xml_loader_ids));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* PROCESS : configureShop
|
||||
* Set default shop configuration
|
||||
*/
|
||||
public function processConfigureShop()
|
||||
{
|
||||
$this->initializeContext();
|
||||
|
||||
return $this->model_install->configureShop(array(
|
||||
'shop_name' => $this->datas->shop_name,
|
||||
'shop_activity' => $this->datas->shop_activity,
|
||||
'shop_country' => $this->datas->shop_country,
|
||||
'shop_timezone' => $this->datas->timezone,
|
||||
'use_smtp' => false,
|
||||
'admin_firstname' => $this->datas->admin_firstname,
|
||||
'admin_lastname' => $this->datas->admin_lastname,
|
||||
'admin_password' => $this->datas->admin_password,
|
||||
'admin_email' => $this->datas->admin_email,
|
||||
'configuration_agrement' => true,
|
||||
'send_informations' => true,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* PROCESS : installModules
|
||||
* Install all modules in ~/modules/ directory
|
||||
*/
|
||||
public function processInstallModules()
|
||||
{
|
||||
$this->initializeContext();
|
||||
|
||||
return $this->model_install->installModules();
|
||||
}
|
||||
|
||||
/**
|
||||
* PROCESS : installFixtures
|
||||
* Install fixtures (E.g. demo products)
|
||||
*/
|
||||
public function processInstallFixtures()
|
||||
{
|
||||
$this->initializeContext();
|
||||
|
||||
if ((!$this->datas->xml_loader_ids || !is_array($this->datas->xml_loader_ids)) && ($xml_ids = Tools::jsonDecode(Configuration::get('PS_INSTALL_XML_LOADERS_ID'), true))) {
|
||||
$this->datas->xml_loader_ids = $xml_ids;
|
||||
}
|
||||
|
||||
$this->model_install->xml_loader_ids = $this->datas->xml_loader_ids;
|
||||
$result = $this->model_install->installFixtures(null, array('shop_activity' => $this->datas->shop_activity, 'shop_country' => $this->datas->shop_country));
|
||||
$this->datas->xml_loader_ids = $this->model_install->xml_loader_ids;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* PROCESS : installTheme
|
||||
* Install theme
|
||||
*/
|
||||
public function processInstallTheme()
|
||||
{
|
||||
$this->initializeContext();
|
||||
|
||||
return $this->model_install->installTheme();
|
||||
}
|
||||
|
||||
/**
|
||||
* PROCESS : installModulesAddons
|
||||
* Install modules from addons
|
||||
*/
|
||||
public function processInstallAddonsModules()
|
||||
{
|
||||
return $this->model_install->installModulesAddons();
|
||||
}
|
||||
|
||||
/**
|
||||
* PROCESS : sendEmail
|
||||
* Send information e-mail
|
||||
*/
|
||||
public function processSendEmail()
|
||||
{
|
||||
require_once _PS_INSTALL_MODELS_PATH_.'mail.php';
|
||||
$mail = new InstallModelMail(
|
||||
false,
|
||||
$this->datas->smtp_server,
|
||||
$this->datas->smtp_login,
|
||||
$this->datas->smtp_password,
|
||||
$this->datas->smtp_port,
|
||||
$this->datas->smtp_encryption,
|
||||
$this->datas->admin_email
|
||||
);
|
||||
|
||||
if (file_exists(_PS_INSTALL_LANGS_PATH_.$this->language->getLanguageIso().'/mail_identifiers.txt')) {
|
||||
$content = file_get_contents(_PS_INSTALL_LANGS_PATH_.$this->language->getLanguageIso().'/mail_identifiers.txt');
|
||||
} else {
|
||||
$content = file_get_contents(_PS_INSTALL_LANGS_PATH_.InstallLanguages::DEFAULT_ISO.'/mail_identifiers.txt');
|
||||
}
|
||||
|
||||
$vars = array(
|
||||
'{firstname}' => $this->datas->admin_firstname,
|
||||
'{lastname}' => $this->datas->admin_lastname,
|
||||
'{shop_name}' => $this->datas->shop_name,
|
||||
'{passwd}' => $this->datas->admin_password,
|
||||
'{email}' => $this->datas->admin_email,
|
||||
'{shop_url}' => Tools::getHttpHost(true).__PS_BASE_URI__,
|
||||
);
|
||||
$content = str_replace(array_keys($vars), array_values($vars), $content);
|
||||
|
||||
$mail->send(
|
||||
$this->l('%s Login information', $this->datas->shop_name),
|
||||
$content
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
319
www/_install/controllers/http/configure.php
Normal file
@ -0,0 +1,319 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Step 4 : configure the shop and admin access
|
||||
*/
|
||||
class InstallControllerHttpConfigure extends InstallControllerHttp
|
||||
{
|
||||
public $list_countries = array();
|
||||
|
||||
/**
|
||||
* @see InstallAbstractModel::processNextStep()
|
||||
*/
|
||||
public function processNextStep()
|
||||
{
|
||||
if (Tools::isSubmit('shop_name')) {
|
||||
// Save shop configuration
|
||||
$this->session->shop_name = trim(Tools::getValue('shop_name'));
|
||||
$this->session->shop_activity = Tools::getValue('shop_activity');
|
||||
$this->session->install_type = Tools::getValue('db_mode');
|
||||
$this->session->shop_country = Tools::getValue('shop_country');
|
||||
$this->session->shop_timezone = Tools::getValue('shop_timezone');
|
||||
|
||||
// Save admin configuration
|
||||
$this->session->admin_firstname = trim(Tools::getValue('admin_firstname'));
|
||||
$this->session->admin_lastname = trim(Tools::getValue('admin_lastname'));
|
||||
$this->session->admin_email = trim(Tools::getValue('admin_email'));
|
||||
$this->session->send_informations = Tools::getValue('send_informations');
|
||||
if ($this->session->send_informations) {
|
||||
$params = http_build_query(array(
|
||||
'email' => $this->session->admin_email,
|
||||
'method' => 'addMemberToNewsletter',
|
||||
'language' => $this->language->getLanguageIso(),
|
||||
'visitorType' => 1,
|
||||
'source' => 'installer'
|
||||
));
|
||||
Tools::file_get_contents('http://www.prestashop.com/ajax/controller.php?'.$params);
|
||||
}
|
||||
|
||||
// If password fields are empty, but are already stored in session, do not fill them again
|
||||
if (!$this->session->admin_password || trim(Tools::getValue('admin_password'))) {
|
||||
$this->session->admin_password = trim(Tools::getValue('admin_password'));
|
||||
}
|
||||
|
||||
if (!$this->session->admin_password_confirm || trim(Tools::getValue('admin_password_confirm'))) {
|
||||
$this->session->admin_password_confirm = trim(Tools::getValue('admin_password_confirm'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see InstallAbstractModel::validate()
|
||||
*/
|
||||
public function validate()
|
||||
{
|
||||
// List of required fields
|
||||
$required_fields = array('shop_name', 'shop_country', 'shop_timezone', 'admin_firstname', 'admin_lastname', 'admin_email', 'admin_password');
|
||||
foreach ($required_fields as $field) {
|
||||
if (!$this->session->$field) {
|
||||
$this->errors[$field] = $this->l('Field required');
|
||||
}
|
||||
}
|
||||
|
||||
// Check shop name
|
||||
if ($this->session->shop_name && !Validate::isGenericName($this->session->shop_name)) {
|
||||
$this->errors['shop_name'] = $this->l('Invalid shop name');
|
||||
} elseif (strlen($this->session->shop_name) > 64) {
|
||||
$this->errors['shop_name'] = $this->l('The field %s is limited to %d characters', $this->l('shop name'), 64);
|
||||
}
|
||||
|
||||
// Check admin name
|
||||
if ($this->session->admin_firstname && !Validate::isName($this->session->admin_firstname)) {
|
||||
$this->errors['admin_firstname'] = $this->l('Your firstname contains some invalid characters');
|
||||
} elseif (strlen($this->session->admin_firstname) > 32) {
|
||||
$this->errors['admin_firstname'] = $this->l('The field %s is limited to %d characters', $this->l('firstname'), 32);
|
||||
}
|
||||
|
||||
if ($this->session->admin_lastname && !Validate::isName($this->session->admin_lastname)) {
|
||||
$this->errors['admin_lastname'] = $this->l('Your lastname contains some invalid characters');
|
||||
} elseif (strlen($this->session->admin_lastname) > 32) {
|
||||
$this->errors['admin_lastname'] = $this->l('The field %s is limited to %d characters', $this->l('lastname'), 32);
|
||||
}
|
||||
|
||||
// Check passwords
|
||||
if ($this->session->admin_password) {
|
||||
if (!Validate::isPasswdAdmin($this->session->admin_password)) {
|
||||
$this->errors['admin_password'] = $this->l('The password is incorrect (alphanumeric string with at least 8 characters)');
|
||||
} elseif ($this->session->admin_password != $this->session->admin_password_confirm) {
|
||||
$this->errors['admin_password'] = $this->l('Password and its confirmation are different');
|
||||
}
|
||||
}
|
||||
|
||||
// Check email
|
||||
if ($this->session->admin_email && !Validate::isEmail($this->session->admin_email)) {
|
||||
$this->errors['admin_email'] = $this->l('This e-mail address is invalid');
|
||||
}
|
||||
|
||||
return count($this->errors) ? false : true;
|
||||
}
|
||||
|
||||
public function process()
|
||||
{
|
||||
if (Tools::getValue('uploadLogo')) {
|
||||
$this->processUploadLogo();
|
||||
} elseif (Tools::getValue('timezoneByIso')) {
|
||||
$this->processTimezoneByIso();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the upload of new logo
|
||||
*/
|
||||
public function processUploadLogo()
|
||||
{
|
||||
$error = '';
|
||||
if (isset($_FILES['fileToUpload']['tmp_name']) && $_FILES['fileToUpload']['tmp_name']) {
|
||||
$file = $_FILES['fileToUpload'];
|
||||
$error = ImageManager::validateUpload($file, 300000);
|
||||
if (!strlen($error)) {
|
||||
$tmp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS');
|
||||
if (!$tmp_name || !move_uploaded_file($file['tmp_name'], $tmp_name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
list($width, $height, $type) = getimagesize($tmp_name);
|
||||
|
||||
$newheight = ($height > 500) ? 500 : $height;
|
||||
$percent = $newheight / $height;
|
||||
$newwidth = $width * $percent;
|
||||
$newheight = $height * $percent;
|
||||
|
||||
if (!is_writable(_PS_ROOT_DIR_.'/img/')) {
|
||||
$error = $this->l('Image folder %s is not writable', _PS_ROOT_DIR_.'/img/');
|
||||
}
|
||||
if (!$error) {
|
||||
list($src_width, $src_height, $type) = getimagesize($tmp_name);
|
||||
$src_image = ImageManager::create($type, $tmp_name);
|
||||
$dest_image = imagecreatetruecolor($src_width, $src_height);
|
||||
$white = imagecolorallocate($dest_image, 255, 255, 255);
|
||||
imagefilledrectangle($dest_image, 0, 0, $src_width, $src_height, $white);
|
||||
imagecopyresampled($dest_image, $src_image, 0, 0, 0, 0, $src_width, $src_height, $src_width, $src_height);
|
||||
if (!imagejpeg($dest_image, _PS_ROOT_DIR_.'/img/logo.jpg', 95)) {
|
||||
$error = $this->l('An error occurred during logo copy.');
|
||||
} else {
|
||||
imagedestroy($dest_image);
|
||||
@chmod($filename, 0664);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error = $this->l('An error occurred during logo upload.');
|
||||
}
|
||||
}
|
||||
|
||||
$this->ajaxJsonAnswer(($error) ? false : true, $error);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the timezone associated to an iso
|
||||
*/
|
||||
public function processTimezoneByIso()
|
||||
{
|
||||
$timezone = $this->getTimezoneByIso(Tools::getValue('iso'));
|
||||
$this->ajaxJsonAnswer(($timezone) ? true : false, $timezone);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of timezones
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getTimezones()
|
||||
{
|
||||
if (!is_null($this->cache_timezones)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!file_exists(_PS_INSTALL_DATA_PATH_.'xml/timezone.xml')) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$xml = @simplexml_load_file(_PS_INSTALL_DATA_PATH_.'xml/timezone.xml');
|
||||
$timezones = array();
|
||||
if ($xml) {
|
||||
foreach ($xml->entities->timezone as $timezone) {
|
||||
$timezones[] = (string)$timezone['name'];
|
||||
}
|
||||
}
|
||||
return $timezones;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a timezone associated to an iso
|
||||
*
|
||||
* @param string $iso
|
||||
* @return string
|
||||
*/
|
||||
public function getTimezoneByIso($iso)
|
||||
{
|
||||
if (!file_exists(_PS_INSTALL_DATA_PATH_.'iso_to_timezone.xml')) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$xml = @simplexml_load_file(_PS_INSTALL_DATA_PATH_.'iso_to_timezone.xml');
|
||||
$timezones = array();
|
||||
if ($xml) {
|
||||
foreach ($xml->relation as $relation) {
|
||||
$timezones[(string)$relation['iso']] = (string)$relation['zone'];
|
||||
}
|
||||
}
|
||||
return isset($timezones[$iso]) ? $timezones[$iso] : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @see InstallAbstractModel::display()
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
// List of activities
|
||||
$list_activities = array(
|
||||
1 => $this->l('Lingerie and Adult'),
|
||||
2 => $this->l('Animals and Pets'),
|
||||
3 => $this->l('Art and Culture'),
|
||||
4 => $this->l('Babies'),
|
||||
5 => $this->l('Beauty and Personal Care'),
|
||||
6 => $this->l('Cars'),
|
||||
7 => $this->l('Computer Hardware and Software'),
|
||||
8 => $this->l('Download'),
|
||||
9 => $this->l('Fashion and accessories'),
|
||||
10 => $this->l('Flowers, Gifts and Crafts'),
|
||||
11 => $this->l('Food and beverage'),
|
||||
12 => $this->l('HiFi, Photo and Video'),
|
||||
13 => $this->l('Home and Garden'),
|
||||
14 => $this->l('Home Appliances'),
|
||||
15 => $this->l('Jewelry'),
|
||||
16 => $this->l('Mobile and Telecom'),
|
||||
17 => $this->l('Services'),
|
||||
18 => $this->l('Shoes and accessories'),
|
||||
19 => $this->l('Sports and Entertainment'),
|
||||
20 => $this->l('Travel'),
|
||||
);
|
||||
|
||||
asort($list_activities);
|
||||
$this->list_activities = $list_activities;
|
||||
|
||||
// Countries list
|
||||
$this->list_countries = array();
|
||||
$countries = $this->language->getCountries();
|
||||
$top_countries = array(
|
||||
'fr', 'es', 'us',
|
||||
'gb', 'it', 'de',
|
||||
'nl', 'pl', 'id',
|
||||
'be', 'br', 'se',
|
||||
'ca', 'ru', 'cn',
|
||||
);
|
||||
|
||||
foreach ($top_countries as $iso) {
|
||||
$this->list_countries[] = array('iso' => $iso, 'name' => $countries[$iso]);
|
||||
}
|
||||
$this->list_countries[] = array('iso' => 0, 'name' => '-----------------');
|
||||
|
||||
foreach ($countries as $iso => $lang) {
|
||||
if (!in_array($iso, $top_countries)) {
|
||||
$this->list_countries[] = array('iso' => $iso, 'name' => $lang);
|
||||
}
|
||||
}
|
||||
|
||||
// Try to detect default country
|
||||
if (!$this->session->shop_country) {
|
||||
$detect_language = $this->language->detectLanguage();
|
||||
if (isset($detect_language['primarytag'])) {
|
||||
$this->session->shop_country = strtolower(isset($detect_language['subtag']) ? $detect_language['subtag'] : $detect_language['primarytag']);
|
||||
$this->session->shop_timezone = $this->getTimezoneByIso($this->session->shop_country);
|
||||
}
|
||||
}
|
||||
|
||||
// Install type
|
||||
$this->install_type = ($this->session->install_type) ? $this->session->install_type : 'full';
|
||||
|
||||
$this->displayTemplate('configure');
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to display error for a field
|
||||
*
|
||||
* @param string $field
|
||||
* @return string|void
|
||||
*/
|
||||
public function displayError($field)
|
||||
{
|
||||
if (!isset($this->errors[$field])) {
|
||||
return;
|
||||
}
|
||||
|
||||
return '<span class="result aligned errorTxt">'.$this->errors[$field].'</span>';
|
||||
}
|
||||
}
|
180
www/_install/controllers/http/database.php
Normal file
@ -0,0 +1,180 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Step 3 : configure database and email connection
|
||||
*/
|
||||
class InstallControllerHttpDatabase extends InstallControllerHttp
|
||||
{
|
||||
/**
|
||||
* @var InstallModelDatabase
|
||||
*/
|
||||
public $model_database;
|
||||
|
||||
/**
|
||||
* @var InstallModelMail
|
||||
*/
|
||||
public $model_mail;
|
||||
|
||||
public function init()
|
||||
{
|
||||
require_once _PS_INSTALL_MODELS_PATH_.'database.php';
|
||||
$this->model_database = new InstallModelDatabase();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see InstallAbstractModel::processNextStep()
|
||||
*/
|
||||
public function processNextStep()
|
||||
{
|
||||
// Save database config
|
||||
$this->session->database_server = trim(Tools::getValue('dbServer'));
|
||||
$this->session->database_name = trim(Tools::getValue('dbName'));
|
||||
$this->session->database_login = trim(Tools::getValue('dbLogin'));
|
||||
$this->session->database_password = trim(Tools::getValue('dbPassword'));
|
||||
$this->session->database_prefix = trim(Tools::getValue('db_prefix'));
|
||||
$this->session->database_clear = Tools::getValue('database_clear');
|
||||
|
||||
$this->session->rewrite_engine = Tools::getValue('rewrite_engine');
|
||||
}
|
||||
|
||||
/**
|
||||
* Database configuration must be valid to validate this step
|
||||
*
|
||||
* @see InstallAbstractModel::validate()
|
||||
*/
|
||||
public function validate()
|
||||
{
|
||||
$this->errors = $this->model_database->testDatabaseSettings(
|
||||
$this->session->database_server,
|
||||
$this->session->database_name,
|
||||
$this->session->database_login,
|
||||
$this->session->database_password,
|
||||
$this->session->database_prefix,
|
||||
// We do not want to validate table prefix if we are already in install process
|
||||
($this->session->step == 'process') ? true : $this->session->database_clear
|
||||
);
|
||||
if (count($this->errors)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isset($this->session->database_engine)) {
|
||||
$this->session->database_engine = $this->model_database->getBestEngine($this->session->database_server, $this->session->database_name, $this->session->database_login, $this->session->database_password);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function process()
|
||||
{
|
||||
if (Tools::getValue('checkDb')) {
|
||||
$this->processCheckDb();
|
||||
} elseif (Tools::getValue('createDb')) {
|
||||
$this->processCreateDb();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a connection to database is possible with these data
|
||||
*/
|
||||
public function processCheckDb()
|
||||
{
|
||||
$server = Tools::getValue('dbServer');
|
||||
$database = Tools::getValue('dbName');
|
||||
$login = Tools::getValue('dbLogin');
|
||||
$password = Tools::getValue('dbPassword');
|
||||
$prefix = Tools::getValue('db_prefix');
|
||||
$clear = Tools::getValue('clear');
|
||||
|
||||
$errors = $this->model_database->testDatabaseSettings($server, $database, $login, $password, $prefix, $clear);
|
||||
|
||||
$this->ajaxJsonAnswer(
|
||||
(count($errors)) ? false : true,
|
||||
(count($errors)) ? implode('<br />', $errors) : $this->l('Database is connected')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to create the database
|
||||
*/
|
||||
public function processCreateDb()
|
||||
{
|
||||
$server = Tools::getValue('dbServer');
|
||||
$database = Tools::getValue('dbName');
|
||||
$login = Tools::getValue('dbLogin');
|
||||
$password = Tools::getValue('dbPassword');
|
||||
|
||||
$success = $this->model_database->createDatabase($server, $database, $login, $password);
|
||||
|
||||
$this->ajaxJsonAnswer(
|
||||
$success,
|
||||
$success ? $this->l('Database is created') : $this->l('Cannot create the database automatically')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see InstallAbstractModel::display()
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
if (!$this->session->database_server) {
|
||||
if (file_exists(_PS_ROOT_DIR_.'/config/settings.inc.php')) {
|
||||
@include_once _PS_ROOT_DIR_.'/config/settings.inc.php';
|
||||
$this->database_server = _DB_SERVER_;
|
||||
$this->database_name = _DB_NAME_;
|
||||
$this->database_login = _DB_USER_;
|
||||
$this->database_password = _DB_PASSWD_;
|
||||
$this->database_engine = _MYSQL_ENGINE_;
|
||||
$this->database_prefix = _DB_PREFIX_;
|
||||
} else {
|
||||
$this->database_server = 'localhost';
|
||||
$this->database_name = 'prestashop';
|
||||
$this->database_login = 'root';
|
||||
$this->database_password = '';
|
||||
$this->database_engine = 'InnoDB';
|
||||
$this->database_prefix = 'ps_';
|
||||
}
|
||||
|
||||
$this->database_clear = true;
|
||||
$this->use_smtp = false;
|
||||
$this->smtp_encryption = 'off';
|
||||
$this->smtp_port = 25;
|
||||
} else {
|
||||
$this->database_server = $this->session->database_server;
|
||||
$this->database_name = $this->session->database_name;
|
||||
$this->database_login = $this->session->database_login;
|
||||
$this->database_password = $this->session->database_password;
|
||||
$this->database_engine = $this->session->database_engine;
|
||||
$this->database_prefix = $this->session->database_prefix;
|
||||
$this->database_clear = $this->session->database_clear;
|
||||
|
||||
$this->use_smtp = $this->session->use_smtp;
|
||||
$this->smtp_encryption = $this->session->smtp_encryption;
|
||||
$this->smtp_port = $this->session->smtp_port;
|
||||
}
|
||||
|
||||
$this->displayTemplate('database');
|
||||
}
|
||||
}
|
35
www/_install/controllers/http/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../');
|
||||
exit;
|
64
www/_install/controllers/http/license.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Step 2 : display license form
|
||||
*/
|
||||
class InstallControllerHttpLicense extends InstallControllerHttp
|
||||
{
|
||||
/**
|
||||
* Process license form
|
||||
*
|
||||
* @see InstallAbstractModel::process()
|
||||
*/
|
||||
public function processNextStep()
|
||||
{
|
||||
$this->session->licence_agrement = Tools::getValue('licence_agrement');
|
||||
$this->session->configuration_agrement = Tools::getValue('configuration_agrement');
|
||||
}
|
||||
|
||||
/**
|
||||
* Licence agrement must be checked to validate this step
|
||||
*
|
||||
* @see InstallAbstractModel::validate()
|
||||
*/
|
||||
public function validate()
|
||||
{
|
||||
return $this->session->licence_agrement;
|
||||
}
|
||||
|
||||
public function process()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Display license step
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
$this->displayTemplate('license');
|
||||
}
|
||||
}
|
356
www/_install/controllers/http/process.php
Normal file
@ -0,0 +1,356 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class InstallControllerHttpProcess extends InstallControllerHttp
|
||||
{
|
||||
const SETTINGS_FILE = 'config/settings.inc.php';
|
||||
|
||||
protected $model_install;
|
||||
public $process_steps = array();
|
||||
public $previous_button = false;
|
||||
|
||||
public function init()
|
||||
{
|
||||
require_once _PS_INSTALL_MODELS_PATH_.'install.php';
|
||||
$this->model_install = new InstallModelInstall();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see InstallAbstractModel::processNextStep()
|
||||
*/
|
||||
public function processNextStep()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @see InstallAbstractModel::validate()
|
||||
*/
|
||||
public function validate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function initializeContext()
|
||||
{
|
||||
global $smarty;
|
||||
|
||||
Context::getContext()->shop = new Shop(1);
|
||||
Shop::setContext(Shop::CONTEXT_SHOP, 1);
|
||||
Configuration::loadConfiguration();
|
||||
Context::getContext()->language = new Language(Configuration::get('PS_LANG_DEFAULT'));
|
||||
Context::getContext()->country = new Country(Configuration::get('PS_COUNTRY_DEFAULT'));
|
||||
Context::getContext()->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
Context::getContext()->cart = new Cart();
|
||||
Context::getContext()->employee = new Employee(1);
|
||||
define('_PS_SMARTY_FAST_LOAD_', true);
|
||||
require_once _PS_ROOT_DIR_.'/config/smarty.config.inc.php';
|
||||
|
||||
Context::getContext()->smarty = $smarty;
|
||||
}
|
||||
|
||||
public function process()
|
||||
{
|
||||
if (file_exists(_PS_ROOT_DIR_.'/'.self::SETTINGS_FILE)) {
|
||||
require_once _PS_ROOT_DIR_.'/'.self::SETTINGS_FILE;
|
||||
}
|
||||
|
||||
if (!$this->session->process_validated) {
|
||||
$this->session->process_validated = array();
|
||||
}
|
||||
|
||||
if (Tools::getValue('generateSettingsFile')) {
|
||||
$this->processGenerateSettingsFile();
|
||||
} elseif (Tools::getValue('installDatabase') && !empty($this->session->process_validated['generateSettingsFile'])) {
|
||||
$this->processInstallDatabase();
|
||||
} elseif (Tools::getValue('installDefaultData')) {
|
||||
$this->processInstallDefaultData();
|
||||
} elseif (Tools::getValue('populateDatabase') && !empty($this->session->process_validated['installDatabase'])) {
|
||||
$this->processPopulateDatabase();
|
||||
} elseif (Tools::getValue('configureShop') && !empty($this->session->process_validated['populateDatabase'])) {
|
||||
$this->processConfigureShop();
|
||||
} elseif (Tools::getValue('installFixtures') && !empty($this->session->process_validated['configureShop'])) {
|
||||
$this->processInstallFixtures();
|
||||
} elseif (Tools::getValue('installModules') && (!empty($this->session->process_validated['installFixtures']) || $this->session->install_type != 'full')) {
|
||||
$this->processInstallModules();
|
||||
} elseif (Tools::getValue('installModulesAddons') && !empty($this->session->process_validated['installModules'])) {
|
||||
$this->processInstallAddonsModules();
|
||||
} elseif (Tools::getValue('installTheme') && !empty($this->session->process_validated['installModulesAddons'])) {
|
||||
$this->processInstallTheme();
|
||||
} elseif (Tools::getValue('sendEmail') && !empty($this->session->process_validated['installTheme'])) {
|
||||
$this->processSendEmail();
|
||||
} else {
|
||||
// With no parameters, we consider that we are doing a new install, so session where the last process step
|
||||
// was stored can be cleaned
|
||||
if (Tools::getValue('restart')) {
|
||||
$this->session->process_validated = array();
|
||||
$this->session->database_clear = true;
|
||||
if (Tools::getSafeModeStatus()) {
|
||||
$this->session->safe_mode = true;
|
||||
}
|
||||
} elseif (!Tools::getValue('submitNext')) {
|
||||
$this->session->step = 'configure';
|
||||
$this->session->last_step = 'configure';
|
||||
Tools::redirect('index.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PROCESS : generateSettingsFile
|
||||
*/
|
||||
public function processGenerateSettingsFile()
|
||||
{
|
||||
$success = $this->model_install->generateSettingsFile(
|
||||
$this->session->database_server,
|
||||
$this->session->database_login,
|
||||
$this->session->database_password,
|
||||
$this->session->database_name,
|
||||
$this->session->database_prefix,
|
||||
$this->session->database_engine
|
||||
);
|
||||
|
||||
if (!$success) {
|
||||
$this->ajaxJsonAnswer(false);
|
||||
}
|
||||
$this->session->process_validated = array_merge($this->session->process_validated, array('generateSettingsFile' => true));
|
||||
$this->ajaxJsonAnswer(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* PROCESS : installDatabase
|
||||
* Create database structure
|
||||
*/
|
||||
public function processInstallDatabase()
|
||||
{
|
||||
if (!$this->model_install->installDatabase($this->session->database_clear) || $this->model_install->getErrors()) {
|
||||
$this->ajaxJsonAnswer(false, $this->model_install->getErrors());
|
||||
}
|
||||
$this->session->process_validated = array_merge($this->session->process_validated, array('installDatabase' => true));
|
||||
$this->ajaxJsonAnswer(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* PROCESS : installDefaultData
|
||||
* Create default shop and languages
|
||||
*/
|
||||
public function processInstallDefaultData()
|
||||
{
|
||||
// @todo remove true in populateDatabase for 1.5.0 RC version
|
||||
$result = $this->model_install->installDefaultData($this->session->shop_name, $this->session->shop_country, false, true);
|
||||
|
||||
if (!$result || $this->model_install->getErrors()) {
|
||||
$this->ajaxJsonAnswer(false, $this->model_install->getErrors());
|
||||
}
|
||||
$this->ajaxJsonAnswer(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* PROCESS : populateDatabase
|
||||
* Populate database with default data
|
||||
*/
|
||||
public function processPopulateDatabase()
|
||||
{
|
||||
$this->initializeContext();
|
||||
|
||||
$this->model_install->xml_loader_ids = $this->session->xml_loader_ids;
|
||||
$result = $this->model_install->populateDatabase(Tools::getValue('entity'));
|
||||
if (!$result || $this->model_install->getErrors()) {
|
||||
$this->ajaxJsonAnswer(false, $this->model_install->getErrors());
|
||||
}
|
||||
$this->session->xml_loader_ids = $this->model_install->xml_loader_ids;
|
||||
$this->session->process_validated = array_merge($this->session->process_validated, array('populateDatabase' => true));
|
||||
$this->ajaxJsonAnswer(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* PROCESS : configureShop
|
||||
* Set default shop configuration
|
||||
*/
|
||||
public function processConfigureShop()
|
||||
{
|
||||
$this->initializeContext();
|
||||
|
||||
$success = $this->model_install->configureShop(array(
|
||||
'shop_name' => $this->session->shop_name,
|
||||
'shop_activity' => $this->session->shop_activity,
|
||||
'shop_country' => $this->session->shop_country,
|
||||
'shop_timezone' => $this->session->shop_timezone,
|
||||
'admin_firstname' => $this->session->admin_firstname,
|
||||
'admin_lastname' => $this->session->admin_lastname,
|
||||
'admin_password' => $this->session->admin_password,
|
||||
'admin_email' => $this->session->admin_email,
|
||||
'send_informations' => $this->session->send_informations,
|
||||
'configuration_agrement' => $this->session->configuration_agrement,
|
||||
'rewrite_engine' => $this->session->rewrite_engine,
|
||||
));
|
||||
|
||||
if (!$success || $this->model_install->getErrors()) {
|
||||
$this->ajaxJsonAnswer(false, $this->model_install->getErrors());
|
||||
}
|
||||
|
||||
$this->session->process_validated = array_merge($this->session->process_validated, array('configureShop' => true));
|
||||
$this->ajaxJsonAnswer(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* PROCESS : installModules
|
||||
* Install all modules in ~/modules/ directory
|
||||
*/
|
||||
public function processInstallModules()
|
||||
{
|
||||
$this->initializeContext();
|
||||
|
||||
$result = $this->model_install->installModules(Tools::getValue('module'));
|
||||
if (!$result || $this->model_install->getErrors()) {
|
||||
$this->ajaxJsonAnswer(false, $this->model_install->getErrors());
|
||||
}
|
||||
$this->session->process_validated = array_merge($this->session->process_validated, array('installModules' => true));
|
||||
$this->ajaxJsonAnswer(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* PROCESS : installModulesAddons
|
||||
* Install modules from addons
|
||||
*/
|
||||
public function processInstallAddonsModules()
|
||||
{
|
||||
$this->initializeContext();
|
||||
if (($module = Tools::getValue('module')) && $id_module = Tools::getValue('id_module')) {
|
||||
$result = $this->model_install->installModulesAddons(array('name' => $module, 'id_module' => $id_module));
|
||||
} else {
|
||||
$result = $this->model_install->installModulesAddons();
|
||||
}
|
||||
if (!$result || $this->model_install->getErrors()) {
|
||||
$this->ajaxJsonAnswer(false, $this->model_install->getErrors());
|
||||
}
|
||||
$this->session->process_validated = array_merge($this->session->process_validated, array('installModulesAddons' => true));
|
||||
$this->ajaxJsonAnswer(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* PROCESS : installFixtures
|
||||
* Install fixtures (E.g. demo products)
|
||||
*/
|
||||
public function processInstallFixtures()
|
||||
{
|
||||
$this->initializeContext();
|
||||
|
||||
$this->model_install->xml_loader_ids = $this->session->xml_loader_ids;
|
||||
if (!$this->model_install->installFixtures(Tools::getValue('entity', null), array('shop_activity' => $this->session->shop_activity, 'shop_country' => $this->session->shop_country)) || $this->model_install->getErrors()) {
|
||||
$this->ajaxJsonAnswer(false, $this->model_install->getErrors());
|
||||
}
|
||||
$this->session->xml_loader_ids = $this->model_install->xml_loader_ids;
|
||||
$this->session->process_validated = array_merge($this->session->process_validated, array('installFixtures' => true));
|
||||
$this->ajaxJsonAnswer(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* PROCESS : installTheme
|
||||
* Install theme
|
||||
*/
|
||||
public function processInstallTheme()
|
||||
{
|
||||
$this->initializeContext();
|
||||
|
||||
$this->model_install->installTheme();
|
||||
if ($this->model_install->getErrors()) {
|
||||
$this->ajaxJsonAnswer(false, $this->model_install->getErrors());
|
||||
}
|
||||
|
||||
$this->session->process_validated = array_merge($this->session->process_validated, array('installTheme' => true));
|
||||
$this->ajaxJsonAnswer(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see InstallAbstractModel::display()
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
// The installer SHOULD take less than 32M, but may take up to 35/36M sometimes. So 42M is a good value :)
|
||||
$low_memory = Tools::getMemoryLimit() < Tools::getOctets('42M');
|
||||
|
||||
// We fill the process step used for Ajax queries
|
||||
$this->process_steps[] = array('key' => 'generateSettingsFile', 'lang' => $this->l('Create settings.inc file'));
|
||||
$this->process_steps[] = array('key' => 'installDatabase', 'lang' => $this->l('Create database tables'));
|
||||
$this->process_steps[] = array('key' => 'installDefaultData', 'lang' => $this->l('Create default shop and languages'));
|
||||
|
||||
// If low memory, create subtasks for populateDatabase step (entity per entity)
|
||||
$populate_step = array('key' => 'populateDatabase', 'lang' => $this->l('Populate database tables'));
|
||||
if ($low_memory) {
|
||||
$populate_step['subtasks'] = array();
|
||||
$xml_loader = new InstallXmlLoader();
|
||||
foreach ($xml_loader->getSortedEntities() as $entity) {
|
||||
$populate_step['subtasks'][] = array('entity' => $entity);
|
||||
}
|
||||
}
|
||||
|
||||
$this->process_steps[] = $populate_step;
|
||||
$this->process_steps[] = array('key' => 'configureShop', 'lang' => $this->l('Configure shop information'));
|
||||
|
||||
if ($this->session->install_type == 'full') {
|
||||
// If low memory, create subtasks for installFixtures step (entity per entity)
|
||||
$fixtures_step = array('key' => 'installFixtures', 'lang' => $this->l('Install demonstration data'));
|
||||
if ($low_memory) {
|
||||
$fixtures_step['subtasks'] = array();
|
||||
$xml_loader = new InstallXmlLoader();
|
||||
$xml_loader->setFixturesPath();
|
||||
foreach ($xml_loader->getSortedEntities() as $entity) {
|
||||
$fixtures_step['subtasks'][] = array('entity' => $entity);
|
||||
}
|
||||
}
|
||||
$this->process_steps[] = $fixtures_step;
|
||||
}
|
||||
|
||||
$install_modules = array('key' => 'installModules', 'lang' => $this->l('Install modules'));
|
||||
if ($low_memory) {
|
||||
foreach ($this->model_install->getModulesList() as $module) {
|
||||
$install_modules['subtasks'][] = array('module' => $module);
|
||||
}
|
||||
}
|
||||
$this->process_steps[] = $install_modules;
|
||||
|
||||
$install_modules = array('key' => 'installModulesAddons', 'lang' => $this->l('Install Addons modules'));
|
||||
|
||||
$params = array(
|
||||
'iso_lang' => $this->language->getLanguageIso(),
|
||||
'iso_country' => $this->session->shop_country,
|
||||
'email' => $this->session->admin_email,
|
||||
'shop_url' => Tools::getHttpHost(),
|
||||
'version' => _PS_INSTALL_VERSION_
|
||||
);
|
||||
|
||||
if ($low_memory) {
|
||||
foreach ($this->model_install->getAddonsModulesList($params) as $module) {
|
||||
$install_modules['subtasks'][] = array('module' => (string)$module['name'], 'id_module' => (string)$module['id_module']);
|
||||
}
|
||||
}
|
||||
$this->process_steps[] = $install_modules;
|
||||
|
||||
$this->process_steps[] = array('key' => 'installTheme', 'lang' => $this->l('Install theme'));
|
||||
|
||||
$this->displayTemplate('process');
|
||||
}
|
||||
}
|
45
www/_install/controllers/http/smarty_compile.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
define('_PS_DO_NOT_LOAD_CONFIGURATION_', true);
|
||||
if (Tools::getValue('bo')) {
|
||||
if (!is_dir(_PS_ROOT_DIR_.'/admin/')) {
|
||||
exit;
|
||||
}
|
||||
define('_PS_ADMIN_DIR_', _PS_ROOT_DIR_.'/admin/');
|
||||
$directory = _PS_ADMIN_DIR_.'themes/default/';
|
||||
} else {
|
||||
$directory = _PS_THEME_DIR_;
|
||||
}
|
||||
|
||||
require_once(_PS_ROOT_DIR_.'/config/smarty.config.inc.php');
|
||||
|
||||
$smarty->setTemplateDir($directory);
|
||||
ob_start();
|
||||
$smarty->compileAllTemplates('.tpl', false);
|
||||
if (ob_get_level() && ob_get_length() > 0) {
|
||||
ob_end_clean();
|
||||
}
|
157
www/_install/controllers/http/system.php
Normal file
@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Step 2 : check system configuration (permissions on folders, PHP version, etc.)
|
||||
*/
|
||||
class InstallControllerHttpSystem extends InstallControllerHttp
|
||||
{
|
||||
public $tests = array();
|
||||
|
||||
/**
|
||||
* @var InstallModelSystem
|
||||
*/
|
||||
public $model_system;
|
||||
|
||||
/**
|
||||
* @see InstallAbstractModel::init()
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
require_once _PS_INSTALL_MODELS_PATH_.'system.php';
|
||||
$this->model_system = new InstallModelSystem();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see InstallAbstractModel::processNextStep()
|
||||
*/
|
||||
public function processNextStep()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Required tests must be passed to validate this step
|
||||
*
|
||||
* @see InstallAbstractModel::validate()
|
||||
*/
|
||||
public function validate()
|
||||
{
|
||||
$this->tests['required'] = $this->model_system->checkRequiredTests();
|
||||
|
||||
return $this->tests['required']['success'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Display system step
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
if (!isset($this->tests['required'])) {
|
||||
$this->tests['required'] = $this->model_system->checkRequiredTests();
|
||||
}
|
||||
if (!isset($this->tests['optional'])) {
|
||||
$this->tests['optional'] = $this->model_system->checkOptionalTests();
|
||||
}
|
||||
|
||||
if (!is_callable('getenv') || !($user = @getenv('APACHE_RUN_USER'))) {
|
||||
$user = 'Apache';
|
||||
}
|
||||
|
||||
// Generate display array
|
||||
$this->tests_render = array(
|
||||
'required' => array(
|
||||
array(
|
||||
'title' => $this->l('Required PHP parameters'),
|
||||
'success' => 1,
|
||||
'checks' => array(
|
||||
'phpversion' => $this->l('PHP 5.1.2 or later is not enabled'),
|
||||
'upload' => $this->l('Cannot upload files'),
|
||||
'system' => $this->l('Cannot create new files and folders'),
|
||||
'gd' => $this->l('GD library is not installed'),
|
||||
'mysql_support' => $this->l('MySQL support is not activated')
|
||||
)
|
||||
),
|
||||
array(
|
||||
'title' => $this->l('Files'),
|
||||
'success' => 1,
|
||||
'checks' => array(
|
||||
'files' => $this->l('Not all files were successfully uploaded on your server')
|
||||
)
|
||||
),
|
||||
array(
|
||||
'title' => $this->l('Permissions on files and folders'),
|
||||
'success' => 1,
|
||||
'checks' => array(
|
||||
'config_dir' => $this->l('Recursive write permissions for %1$s user on %2$s', $user, '~/config/'),
|
||||
'cache_dir' => $this->l('Recursive write permissions for %1$s user on %2$s', $user, '~/cache/'),
|
||||
'log_dir' => $this->l('Recursive write permissions for %1$s user on %2$s', $user, '~/log/'),
|
||||
'img_dir' => $this->l('Recursive write permissions for %1$s user on %2$s', $user, '~/img/'),
|
||||
'mails_dir' => $this->l('Recursive write permissions for %1$s user on %2$s', $user, '~/mails/'),
|
||||
'module_dir' => $this->l('Recursive write permissions for %1$s user on %2$s', $user, '~/modules/'),
|
||||
'theme_lang_dir' => $this->l('Recursive write permissions for %1$s user on %2$s', $user, '~/themes/default-bootstrap/lang/'),
|
||||
'theme_pdf_lang_dir' => $this->l('Recursive write permissions for %1$s user on %2$s', $user, '~/themes/default-bootstrap/pdf/lang/'),
|
||||
'theme_cache_dir' => $this->l('Recursive write permissions for %1$s user on %2$s', $user, '~/themes/default-bootstrap/cache/'),
|
||||
'translations_dir' => $this->l('Recursive write permissions for %1$s user on %2$s', $user, '~/translations/'),
|
||||
'customizable_products_dir' => $this->l('Recursive write permissions for %1$s user on %2$s', $user, '~/upload/'),
|
||||
'virtual_products_dir' => $this->l('Recursive write permissions for %1$s user on %2$s', $user, '~/download/')
|
||||
)
|
||||
),
|
||||
),
|
||||
'optional' => array(
|
||||
array(
|
||||
'title' => $this->l('Recommended PHP parameters'),
|
||||
'success' => $this->tests['optional']['success'],
|
||||
'checks' => array(
|
||||
'new_phpversion' => sprintf($this->l('You are using PHP %s version. Soon, the latest PHP version supported by PrestaShop will be PHP 5.4. To make sure you’re ready for the future, we recommend you to upgrade to PHP 5.4 now!'), phpversion()),
|
||||
'fopen' => $this->l('Cannot open external URLs'),
|
||||
'register_globals' => $this->l('PHP register_globals option is enabled'),
|
||||
'gz' => $this->l('GZIP compression is not activated'),
|
||||
'mcrypt' => $this->l('Mcrypt extension is not enabled'),
|
||||
'mbstring' => $this->l('Mbstring extension is not enabled'),
|
||||
'magicquotes' => $this->l('PHP magic quotes option is enabled'),
|
||||
'dom' => $this->l('Dom extension is not loaded'),
|
||||
'pdo_mysql' => $this->l('PDO MySQL extension is not loaded')
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
foreach ($this->tests_render['required'] as &$category) {
|
||||
foreach ($category['checks'] as $id => $check) {
|
||||
if ($this->tests['required']['checks'][$id] != 'ok') {
|
||||
$category['success'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If required tests failed, disable next button
|
||||
if (!$this->tests['required']['success']) {
|
||||
$this->next_button = false;
|
||||
}
|
||||
|
||||
$this->displayTemplate('system');
|
||||
}
|
||||
}
|
68
www/_install/controllers/http/welcome.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Step 1 : display language form
|
||||
*/
|
||||
class InstallControllerHttpWelcome extends InstallControllerHttp
|
||||
{
|
||||
public function processNextStep()
|
||||
{
|
||||
}
|
||||
|
||||
public function validate()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change language
|
||||
*/
|
||||
public function process()
|
||||
{
|
||||
if (Tools::getValue('language')) {
|
||||
$this->session->lang = Tools::getValue('language');
|
||||
$this->redirect('welcome');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display welcome step
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
$this->can_upgrade = false;
|
||||
if (file_exists(_PS_ROOT_DIR_.'/config/settings.inc.php')) {
|
||||
@include_once(_PS_ROOT_DIR_.'/config/settings.inc.php');
|
||||
if (version_compare(_PS_VERSION_, _PS_INSTALL_VERSION_, '<')) {
|
||||
$this->can_upgrade = true;
|
||||
$this->ps_version = _PS_VERSION_;
|
||||
}
|
||||
}
|
||||
|
||||
$this->displayTemplate('welcome');
|
||||
}
|
||||
}
|
35
www/_install/controllers/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../');
|
||||
exit;
|
BIN
www/_install/data/img/genders/Mr.jpg
Normal file
After Width: | Height: | Size: 482 B |
BIN
www/_install/data/img/genders/Mrs.jpg
Normal file
After Width: | Height: | Size: 470 B |
BIN
www/_install/data/img/genders/Unknown.jpg
Normal file
After Width: | Height: | Size: 466 B |
35
www/_install/data/img/genders/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../../');
|
||||
exit;
|
35
www/_install/data/img/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../');
|
||||
exit;
|
BIN
www/_install/data/img/os/Awaiting_PayPal_payment.gif
Normal file
After Width: | Height: | Size: 608 B |
BIN
www/_install/data/img/os/Awaiting_bank_wire_payment.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
www/_install/data/img/os/Awaiting_cheque_payment.gif
Normal file
After Width: | Height: | Size: 356 B |
BIN
www/_install/data/img/os/Awaiting_cod_validation.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
www/_install/data/img/os/Canceled.gif
Normal file
After Width: | Height: | Size: 378 B |
BIN
www/_install/data/img/os/Delivered.gif
Normal file
After Width: | Height: | Size: 580 B |
BIN
www/_install/data/img/os/On_backorder_paid.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
www/_install/data/img/os/On_backorder_unpaid.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
www/_install/data/img/os/Payment_accepted.gif
Normal file
After Width: | Height: | Size: 334 B |
BIN
www/_install/data/img/os/Payment_error.gif
Normal file
After Width: | Height: | Size: 386 B |
BIN
www/_install/data/img/os/Payment_remotely_accepted.gif
Normal file
After Width: | Height: | Size: 576 B |
BIN
www/_install/data/img/os/Preparation_in_progress.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
www/_install/data/img/os/Refund.gif
Normal file
After Width: | Height: | Size: 390 B |
BIN
www/_install/data/img/os/Shipped.gif
Normal file
After Width: | Height: | Size: 613 B |
35
www/_install/data/img/os/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../../');
|
||||
exit;
|
BIN
www/_install/data/img/os/order_state_1.gif
Normal file
After Width: | Height: | Size: 356 B |
BIN
www/_install/data/img/os/order_state_10.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
www/_install/data/img/os/order_state_11.gif
Normal file
After Width: | Height: | Size: 608 B |
BIN
www/_install/data/img/os/order_state_12.gif
Normal file
After Width: | Height: | Size: 576 B |
BIN
www/_install/data/img/os/order_state_2.gif
Normal file
After Width: | Height: | Size: 334 B |
BIN
www/_install/data/img/os/order_state_3.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
www/_install/data/img/os/order_state_4.gif
Normal file
After Width: | Height: | Size: 613 B |
BIN
www/_install/data/img/os/order_state_5.gif
Normal file
After Width: | Height: | Size: 580 B |
BIN
www/_install/data/img/os/order_state_6.gif
Normal file
After Width: | Height: | Size: 378 B |
BIN
www/_install/data/img/os/order_state_7.gif
Normal file
After Width: | Height: | Size: 390 B |
BIN
www/_install/data/img/os/order_state_8.gif
Normal file
After Width: | Height: | Size: 386 B |
BIN
www/_install/data/img/os/order_state_9.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
35
www/_install/data/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../');
|
||||
exit;
|
244
www/_install/data/iso_to_timezone.xml
Normal file
@ -0,0 +1,244 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<iso_to_timezone>
|
||||
<relation iso="ci" zone="Africa/Abidjan" />
|
||||
<relation iso="gh" zone="Africa/Accra" />
|
||||
<relation iso="et" zone="Africa/Addis_Ababa" />
|
||||
<relation iso="dz" zone="Africa/Algiers" />
|
||||
<relation iso="er" zone="Africa/Asmara" />
|
||||
<relation iso="ml" zone="Africa/Bamako" />
|
||||
<relation iso="cf" zone="Africa/Bangui" />
|
||||
<relation iso="gm" zone="Africa/Banjul" />
|
||||
<relation iso="gw" zone="Africa/Bissau" />
|
||||
<relation iso="mw" zone="Africa/Blantyre" />
|
||||
<relation iso="cg" zone="Africa/Brazzaville" />
|
||||
<relation iso="bi" zone="Africa/Bujumbura" />
|
||||
<relation iso="eg" zone="Africa/Cairo" />
|
||||
<relation iso="ma" zone="Africa/Casablanca" />
|
||||
<relation iso="gn" zone="Africa/Conakry" />
|
||||
<relation iso="sn" zone="Africa/Dakar" />
|
||||
<relation iso="tz" zone="Africa/Dar_es_Salaam" />
|
||||
<relation iso="dj" zone="Africa/Djibouti" />
|
||||
<relation iso="cm" zone="Africa/Douala" />
|
||||
<relation iso="eh" zone="Africa/El_Aaiun" />
|
||||
<relation iso="sl" zone="Africa/Freetown" />
|
||||
<relation iso="bw" zone="Africa/Gaborone" />
|
||||
<relation iso="zw" zone="Africa/Harare" />
|
||||
<relation iso="za" zone="Africa/Johannesburg" />
|
||||
<relation iso="ug" zone="Africa/Kampala" />
|
||||
<relation iso="sd" zone="Africa/Khartoum" />
|
||||
<relation iso="rw" zone="Africa/Kigali" />
|
||||
<relation iso="cd" zone="Africa/Kinshasa" />
|
||||
<relation iso="ng" zone="Africa/Lagos" />
|
||||
<relation iso="ga" zone="Africa/Libreville" />
|
||||
<relation iso="tg" zone="Africa/Lome" />
|
||||
<relation iso="ao" zone="Africa/Luanda" />
|
||||
<relation iso="zm" zone="Africa/Lusaka" />
|
||||
<relation iso="gq" zone="Africa/Malabo" />
|
||||
<relation iso="mz" zone="Africa/Maputo" />
|
||||
<relation iso="ls" zone="Africa/Maseru" />
|
||||
<relation iso="sz" zone="Africa/Mbabane" />
|
||||
<relation iso="so" zone="Africa/Mogadishu" />
|
||||
<relation iso="lr" zone="Africa/Monrovia" />
|
||||
<relation iso="ke" zone="Africa/Nairobi" />
|
||||
<relation iso="td" zone="Africa/Ndjamena" />
|
||||
<relation iso="ne" zone="Africa/Niamey" />
|
||||
<relation iso="mr" zone="Africa/Nouakchott" />
|
||||
<relation iso="bf" zone="Africa/Ouagadougou" />
|
||||
<relation iso="bj" zone="Africa/Porto-Novo" />
|
||||
<relation iso="st" zone="Africa/Sao_Tome" />
|
||||
<relation iso="ly" zone="Africa/Tripoli" />
|
||||
<relation iso="tn" zone="Africa/Tunis" />
|
||||
<relation iso="na" zone="Africa/Windhoek" />
|
||||
<relation iso="ai" zone="America/Anguilla" />
|
||||
<relation iso="ag" zone="America/Antigua" />
|
||||
<relation iso="ar" zone="America/Argentina/Buenos_Aires" />
|
||||
<relation iso="aw" zone="America/Aruba" />
|
||||
<relation iso="py" zone="America/Asuncion" />
|
||||
<relation iso="bb" zone="America/Barbados" />
|
||||
<relation iso="bz" zone="America/Belize" />
|
||||
<relation iso="co" zone="America/Bogota" />
|
||||
<relation iso="ve" zone="America/Caracas" />
|
||||
<relation iso="gf" zone="America/Cayenne" />
|
||||
<relation iso="ky" zone="America/Cayman" />
|
||||
<relation iso="cr" zone="America/Costa_Rica" />
|
||||
<relation iso="an" zone="America/Curacao" />
|
||||
<relation iso="dm" zone="America/Dominica" />
|
||||
<relation iso="sv" zone="America/El_Salvador" />
|
||||
<relation iso="gl" zone="America/Godthab" />
|
||||
<relation iso="tc" zone="America/Grand_Turk" />
|
||||
<relation iso="gd" zone="America/Grenada" />
|
||||
<relation iso="gp" zone="America/Guadeloupe" />
|
||||
<relation iso="gt" zone="America/Guatemala" />
|
||||
<relation iso="ec" zone="America/Guayaquil" />
|
||||
<relation iso="gy" zone="America/Guyana" />
|
||||
<relation iso="cu" zone="America/Havana" />
|
||||
<relation iso="jm" zone="America/Jamaica" />
|
||||
<relation iso="bo" zone="America/La_Paz" />
|
||||
<relation iso="pe" zone="America/Lima" />
|
||||
<relation iso="ni" zone="America/Managua" />
|
||||
<relation iso="mf" zone="America/Marigot" />
|
||||
<relation iso="mq" zone="America/Martinique" />
|
||||
<relation iso="mx" zone="America/Mexico_City" />
|
||||
<relation iso="pm" zone="America/Miquelon" />
|
||||
<relation iso="uy" zone="America/Montevideo" />
|
||||
<relation iso="ms" zone="America/Montserrat" />
|
||||
<relation iso="bs" zone="America/Nassau" />
|
||||
<relation iso="br" zone="America/Noronha" />
|
||||
<relation iso="pa" zone="America/Panama" />
|
||||
<relation iso="sr" zone="America/Paramaribo" />
|
||||
<relation iso="ht" zone="America/Port-au-Prince" />
|
||||
<relation iso="tt" zone="America/Port_of_Spain" />
|
||||
<relation iso="pr" zone="America/Puerto_Rico" />
|
||||
<relation iso="cl" zone="America/Santiago" />
|
||||
<relation iso="do" zone="America/Santo_Domingo" />
|
||||
<relation iso="bl" zone="America/St_Barthelemy" />
|
||||
<relation iso="kn" zone="America/St_Kitts" />
|
||||
<relation iso="lc" zone="America/St_Lucia" />
|
||||
<relation iso="vi" zone="America/St_Thomas" />
|
||||
<relation iso="vc" zone="America/St_Vincent" />
|
||||
<relation iso="hn" zone="America/Tegucigalpa" />
|
||||
<relation iso="ca" zone="America/Toronto" />
|
||||
<relation iso="vg" zone="America/Tortola" />
|
||||
<relation iso="aq" zone="Antarctica/McMurdo" />
|
||||
<relation iso="sj" zone="Arctic/Longyearbyen" />
|
||||
<relation iso="ye" zone="Asia/Aden" />
|
||||
<relation iso="kz" zone="Asia/Almaty" />
|
||||
<relation iso="jo" zone="Asia/Amman" />
|
||||
<relation iso="tm" zone="Asia/Ashgabat" />
|
||||
<relation iso="iq" zone="Asia/Baghdad" />
|
||||
<relation iso="bh" zone="Asia/Bahrain" />
|
||||
<relation iso="az" zone="Asia/Baku" />
|
||||
<relation iso="th" zone="Asia/Bangkok" />
|
||||
<relation iso="lb" zone="Asia/Beirut" />
|
||||
<relation iso="kg" zone="Asia/Bishkek" />
|
||||
<relation iso="bn" zone="Asia/Brunei" />
|
||||
<relation iso="lk" zone="Asia/Colombo" />
|
||||
<relation iso="sy" zone="Asia/Damascus" />
|
||||
<relation iso="bd" zone="Asia/Dhaka" />
|
||||
<relation iso="tl" zone="Asia/Dili" />
|
||||
<relation iso="ae" zone="Asia/Dubai" />
|
||||
<relation iso="tj" zone="Asia/Dushanbe" />
|
||||
<relation iso="ps" zone="Asia/Gaza" />
|
||||
<relation iso="hk" zone="Asia/Hong_Kong" />
|
||||
<relation iso="vn" zone="Asia/Ho_Chi_Minh" />
|
||||
<relation iso="id" zone="Asia/Jakarta" />
|
||||
<relation iso="il" zone="Asia/Jerusalem" />
|
||||
<relation iso="af" zone="Asia/Kabul" />
|
||||
<relation iso="pk" zone="Asia/Karachi" />
|
||||
<relation iso="np" zone="Asia/Kathmandu" />
|
||||
<relation iso="in" zone="Asia/Kolkata" />
|
||||
<relation iso="my" zone="Asia/Kuala_Lumpur" />
|
||||
<relation iso="kw" zone="Asia/Kuwait" />
|
||||
<relation iso="mo" zone="Asia/Macau" />
|
||||
<relation iso="ph" zone="Asia/Manila" />
|
||||
<relation iso="om" zone="Asia/Muscat" />
|
||||
<relation iso="cy" zone="Asia/Nicosia" />
|
||||
<relation iso="kh" zone="Asia/Phnom_Penh" />
|
||||
<relation iso="kp" zone="Asia/Pyongyang" />
|
||||
<relation iso="qa" zone="Asia/Qatar" />
|
||||
<relation iso="mm" zone="Asia/Rangoon" />
|
||||
<relation iso="sa" zone="Asia/Riyadh" />
|
||||
<relation iso="uz" zone="Asia/Samarkand" />
|
||||
<relation iso="kr" zone="Asia/Seoul" />
|
||||
<relation iso="cn" zone="Asia/Shanghai" />
|
||||
<relation iso="sg" zone="Asia/Singapore" />
|
||||
<relation iso="tw" zone="Asia/Taipei" />
|
||||
<relation iso="ge" zone="Asia/Tbilisi" />
|
||||
<relation iso="ir" zone="Asia/Tehran" />
|
||||
<relation iso="bt" zone="Asia/Thimphu" />
|
||||
<relation iso="jp" zone="Asia/Tokyo" />
|
||||
<relation iso="mn" zone="Asia/Ulaanbaatar" />
|
||||
<relation iso="la" zone="Asia/Vientiane" />
|
||||
<relation iso="am" zone="Asia/Yerevan" />
|
||||
<relation iso="bm" zone="Atlantic/Bermuda" />
|
||||
<relation iso="cv" zone="Atlantic/Cape_Verde" />
|
||||
<relation iso="fo" zone="Atlantic/Faroe" />
|
||||
<relation iso="is" zone="Atlantic/Reykjavik" />
|
||||
<relation iso="gs" zone="Atlantic/South_Georgia" />
|
||||
<relation iso="fk" zone="Atlantic/Stanley" />
|
||||
<relation iso="au" zone="Australia/Lord_Howe" />
|
||||
<relation iso="nl" zone="Europe/Amsterdam" />
|
||||
<relation iso="ad" zone="Europe/Andorra" />
|
||||
<relation iso="gr" zone="Europe/Athens" />
|
||||
<relation iso="rs" zone="Europe/Belgrade" />
|
||||
<relation iso="de" zone="Europe/Berlin" />
|
||||
<relation iso="sk" zone="Europe/Bratislava" />
|
||||
<relation iso="be" zone="Europe/Brussels" />
|
||||
<relation iso="ro" zone="Europe/Bucharest" />
|
||||
<relation iso="hu" zone="Europe/Budapest" />
|
||||
<relation iso="md" zone="Europe/Chisinau" />
|
||||
<relation iso="dk" zone="Europe/Copenhagen" />
|
||||
<relation iso="ie" zone="Europe/Dublin" />
|
||||
<relation iso="gi" zone="Europe/Gibraltar" />
|
||||
<relation iso="gg" zone="Europe/Guernsey" />
|
||||
<relation iso="fi" zone="Europe/Helsinki" />
|
||||
<relation iso="im" zone="Europe/Isle_of_Man" />
|
||||
<relation iso="tr" zone="Europe/Istanbul" />
|
||||
<relation iso="je" zone="Europe/Jersey" />
|
||||
<relation iso="ua" zone="Europe/Kiev" />
|
||||
<relation iso="pt" zone="Europe/Lisbon" />
|
||||
<relation iso="si" zone="Europe/Ljubljana" />
|
||||
<relation iso="gb" zone="Europe/London" />
|
||||
<relation iso="lu" zone="Europe/Luxembourg" />
|
||||
<relation iso="es" zone="Europe/Madrid" />
|
||||
<relation iso="mt" zone="Europe/Malta" />
|
||||
<relation iso="ax" zone="Europe/Mariehamn" />
|
||||
<relation iso="by" zone="Europe/Minsk" />
|
||||
<relation iso="mc" zone="Europe/Monaco" />
|
||||
<relation iso="ru" zone="Europe/Moscow" />
|
||||
<relation iso="no" zone="Europe/Oslo" />
|
||||
<relation iso="fr" zone="Europe/Paris" />
|
||||
<relation iso="me" zone="Europe/Podgorica" />
|
||||
<relation iso="cz" zone="Europe/Prague" />
|
||||
<relation iso="lv" zone="Europe/Riga" />
|
||||
<relation iso="it" zone="Europe/Rome" />
|
||||
<relation iso="sm" zone="Europe/San_Marino" />
|
||||
<relation iso="ba" zone="Europe/Sarajevo" />
|
||||
<relation iso="mk" zone="Europe/Skopje" />
|
||||
<relation iso="bg" zone="Europe/Sofia" />
|
||||
<relation iso="se" zone="Europe/Stockholm" />
|
||||
<relation iso="ee" zone="Europe/Tallinn" />
|
||||
<relation iso="al" zone="Europe/Tirane" />
|
||||
<relation iso="li" zone="Europe/Vaduz" />
|
||||
<relation iso="va" zone="Europe/Vatican" />
|
||||
<relation iso="at" zone="Europe/Vienna" />
|
||||
<relation iso="lt" zone="Europe/Vilnius" />
|
||||
<relation iso="pl" zone="Europe/Warsaw" />
|
||||
<relation iso="hr" zone="Europe/Zagreb" />
|
||||
<relation iso="ch" zone="Europe/Zurich" />
|
||||
<relation iso="mg" zone="Indian/Antananarivo" />
|
||||
<relation iso="io" zone="Indian/Chagos" />
|
||||
<relation iso="cx" zone="Indian/Christmas" />
|
||||
<relation iso="cc" zone="Indian/Cocos" />
|
||||
<relation iso="km" zone="Indian/Comoro" />
|
||||
<relation iso="tf" zone="Indian/Kerguelen" />
|
||||
<relation iso="sc" zone="Indian/Mahe" />
|
||||
<relation iso="mv" zone="Indian/Maldives" />
|
||||
<relation iso="mu" zone="Indian/Mauritius" />
|
||||
<relation iso="yt" zone="Indian/Mayotte" />
|
||||
<relation iso="re" zone="Indian/Reunion" />
|
||||
<relation iso="ws" zone="Pacific/Apia" />
|
||||
<relation iso="nz" zone="Pacific/Auckland" />
|
||||
<relation iso="vu" zone="Pacific/Efate" />
|
||||
<relation iso="tk" zone="Pacific/Fakaofo" />
|
||||
<relation iso="fj" zone="Pacific/Fiji" />
|
||||
<relation iso="tv" zone="Pacific/Funafuti" />
|
||||
<relation iso="sb" zone="Pacific/Guadalcanal" />
|
||||
<relation iso="gu" zone="Pacific/Guam" />
|
||||
<relation iso="mh" zone="Pacific/Majuro" />
|
||||
<relation iso="nr" zone="Pacific/Nauru" />
|
||||
<relation iso="nu" zone="Pacific/Niue" />
|
||||
<relation iso="nf" zone="Pacific/Norfolk" />
|
||||
<relation iso="nc" zone="Pacific/Noumea" />
|
||||
<relation iso="as" zone="Pacific/Pago_Pago" />
|
||||
<relation iso="pw" zone="Pacific/Palau" />
|
||||
<relation iso="pn" zone="Pacific/Pitcairn" />
|
||||
<relation iso="pg" zone="Pacific/Port_Moresby" />
|
||||
<relation iso="ck" zone="Pacific/Rarotonga" />
|
||||
<relation iso="mp" zone="Pacific/Saipan" />
|
||||
<relation iso="pf" zone="Pacific/Tahiti" />
|
||||
<relation iso="ki" zone="Pacific/Tarawa" />
|
||||
<relation iso="to" zone="Pacific/Tongatapu" />
|
||||
<relation iso="wf" zone="Pacific/Wallis" />
|
||||
<relation iso="us" zone="US/Eastern" />
|
||||
</iso_to_timezone>
|
102
www/_install/data/xml/access.xml
Normal file
@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity_access>
|
||||
<fields primary="id_profile, id_tab" sql="a.id_profile = 1">
|
||||
<field name="id_profile" relation="profile"/>
|
||||
<field name="id_tab" relation="tab"/>
|
||||
<field name="view"/>
|
||||
<field name="add"/>
|
||||
<field name="edit"/>
|
||||
<field name="delete"/>
|
||||
</fields>
|
||||
<entities>
|
||||
<access id="access_1_0" id_profile="SuperAdmin" id_tab="" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_1" id_profile="SuperAdmin" id_tab="Home" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_2" id_profile="SuperAdmin" id_tab="CMS_pages" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_3" id_profile="SuperAdmin" id_tab="CMS_categories" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_4" id_profile="SuperAdmin" id_tab="Combinations_generator" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_5" id_profile="SuperAdmin" id_tab="Search" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_7" id_profile="SuperAdmin" id_tab="Shops" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_8" id_profile="SuperAdmin" id_tab="Shop_Urls" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_9" id_profile="SuperAdmin" id_tab="Catalog" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_10" id_profile="SuperAdmin" id_tab="Orders" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_11" id_profile="SuperAdmin" id_tab="Customers" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_13" id_profile="SuperAdmin" id_tab="Shipping" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_14" id_profile="SuperAdmin" id_tab="Localization" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_15" id_profile="SuperAdmin" id_tab="Modules" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_16" id_profile="SuperAdmin" id_tab="Preferences" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_19" id_profile="SuperAdmin" id_tab="Stats" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_20" id_profile="SuperAdmin" id_tab="Stock" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_21" id_profile="SuperAdmin" id_tab="Products" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_22" id_profile="SuperAdmin" id_tab="Categories" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_23" id_profile="SuperAdmin" id_tab="Monitoring" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_24" id_profile="SuperAdmin" id_tab="Attributes_and_Values" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_25" id_profile="SuperAdmin" id_tab="Features" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_26" id_profile="SuperAdmin" id_tab="Manufacturers" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_27" id_profile="SuperAdmin" id_tab="Suppliers" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_29" id_profile="SuperAdmin" id_tab="Tags" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_30" id_profile="SuperAdmin" id_tab="Attachments" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_32" id_profile="SuperAdmin" id_tab="Invoices" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_33" id_profile="SuperAdmin" id_tab="Merchandise_Returns" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_34" id_profile="SuperAdmin" id_tab="Delivery_Slips" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_35" id_profile="SuperAdmin" id_tab="Credit_Slips" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_36" id_profile="SuperAdmin" id_tab="Statuses" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_37" id_profile="SuperAdmin" id_tab="Order_Messages" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_39" id_profile="SuperAdmin" id_tab="Addresses" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_40" id_profile="SuperAdmin" id_tab="Groups" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_41" id_profile="SuperAdmin" id_tab="Shopping_Carts" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_42" id_profile="SuperAdmin" id_tab="Customer_Service" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_43" id_profile="SuperAdmin" id_tab="Contacts" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_44" id_profile="SuperAdmin" id_tab="Genders" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_45" id_profile="SuperAdmin" id_tab="Outstanding" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_46" id_profile="SuperAdmin" id_tab="Cart_Rules" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_47" id_profile="SuperAdmin" id_tab="Catalog_price_rules" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_49" id_profile="SuperAdmin" id_tab="CarrierWizard" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_49" id_profile="SuperAdmin" id_tab="Carriers" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_50" id_profile="SuperAdmin" id_tab="Price_Ranges" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_51" id_profile="SuperAdmin" id_tab="Weight_Ranges" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_53" id_profile="SuperAdmin" id_tab="Languages" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_54" id_profile="SuperAdmin" id_tab="Zones" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_55" id_profile="SuperAdmin" id_tab="Countries" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_56" id_profile="SuperAdmin" id_tab="States" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_57" id_profile="SuperAdmin" id_tab="Currencies" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_58" id_profile="SuperAdmin" id_tab="Tax_Rules" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_59" id_profile="SuperAdmin" id_tab="Taxes" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_60" id_profile="SuperAdmin" id_tab="Translations" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_62" id_profile="SuperAdmin" id_tab="Modules_Themes_Catalog" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_63" id_profile="SuperAdmin" id_tab="Positions" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_64" id_profile="SuperAdmin" id_tab="Payment" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_67" id_profile="SuperAdmin" id_tab="Products_1" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_68" id_profile="SuperAdmin" id_tab="Customers_2" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_69" id_profile="SuperAdmin" id_tab="Themes" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_70" id_profile="SuperAdmin" id_tab="SEO_URLs" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_71" id_profile="SuperAdmin" id_tab="CMS" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_72" id_profile="SuperAdmin" id_tab="Images" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_73" id_profile="SuperAdmin" id_tab="Contact_stores" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_74" id_profile="SuperAdmin" id_tab="Search_1" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_75" id_profile="SuperAdmin" id_tab="Maintenance" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_76" id_profile="SuperAdmin" id_tab="Geolocation" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_77" id_profile="SuperAdmin" id_tab="Configuration_Information" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_78" id_profile="SuperAdmin" id_tab="Performance" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_79" id_profile="SuperAdmin" id_tab="E-mail" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_81" id_profile="SuperAdmin" id_tab="CSV_Import" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_82" id_profile="SuperAdmin" id_tab="DB_Backup" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_83" id_profile="SuperAdmin" id_tab="SQL_Manager" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_84" id_profile="SuperAdmin" id_tab="Logs" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_85" id_profile="SuperAdmin" id_tab="Webservice" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_87" id_profile="SuperAdmin" id_tab="Quick_Access" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_88" id_profile="SuperAdmin" id_tab="Employees" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_89" id_profile="SuperAdmin" id_tab="Profiles" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_90" id_profile="SuperAdmin" id_tab="Permissions" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_91" id_profile="SuperAdmin" id_tab="Tabs" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_93" id_profile="SuperAdmin" id_tab="Search_Engines" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_94" id_profile="SuperAdmin" id_tab="Referrers" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_95" id_profile="SuperAdmin" id_tab="Warehouses" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_96" id_profile="SuperAdmin" id_tab="Stock_Management" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_97" id_profile="SuperAdmin" id_tab="Stock_Movement" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_98" id_profile="SuperAdmin" id_tab="Stock_instant_state" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_99" id_profile="SuperAdmin" id_tab="Stock_cover" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_100" id_profile="SuperAdmin" id_tab="Supply_orders" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_101" id_profile="SuperAdmin" id_tab="Configuration" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_1_102" id_profile="SuperAdmin" id_tab="Dashboard" view="1" add="1" edit="1" delete="1"/>
|
||||
</entities>
|
||||
</entity_access>
|
2696
www/_install/data/xml/address_format.xml
Normal file
27
www/_install/data/xml/carrier.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity_carrier>
|
||||
<fields id="name" class="Carrier" sql="a.id_carrier = 1">
|
||||
<field name="id_reference"/>
|
||||
<field name="id_tax_rules_group"/>
|
||||
<field name="name"/>
|
||||
<field name="url"/>
|
||||
<field name="active"/>
|
||||
<field name="shipping_handling"/>
|
||||
<field name="range_behavior"/>
|
||||
<field name="is_free"/>
|
||||
<field name="shipping_external"/>
|
||||
<field name="need_range"/>
|
||||
<field name="shipping_method"/>
|
||||
<field name="max_width"/>
|
||||
<field name="max_height"/>
|
||||
<field name="max_depth"/>
|
||||
<field name="max_weight"/>
|
||||
<field name="grade"/>
|
||||
</fields>
|
||||
<entities>
|
||||
<carrier id="carrier_1" id_reference="1" id_tax_rules_group="0" active="1" shipping_handling="0" range_behavior="0" is_free="1" shipping_external="0" need_range="0" shipping_method="0" max_width="0" max_height="0" max_depth="0" max_weight="0" grade="0">
|
||||
<name>0</name>
|
||||
<url/>
|
||||
</carrier>
|
||||
</entities>
|
||||
</entity_carrier>
|
12
www/_install/data/xml/carrier_group.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity_carrier_group>
|
||||
<fields primary="id_carrier, id_group" sql="a.id_carrier = 1">
|
||||
<field name="id_carrier" relation="carrier"/>
|
||||
<field name="id_group" relation="group"/>
|
||||
</fields>
|
||||
<entities>
|
||||
<carrier_group id="carrier_group_1_1" id_carrier="carrier_1" id_group="Visitor"/>
|
||||
<carrier_group id="carrier_group_1_2" id_carrier="carrier_1" id_group="Guest"/>
|
||||
<carrier_group id="carrier_group_1_3" id_carrier="carrier_1" id_group="Customer"/>
|
||||
</entities>
|
||||
</entity_carrier_group>
|
11
www/_install/data/xml/carrier_tax_rules_group_shop.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<entity_carrier_tax_rules_group_shop>
|
||||
<fields primary="id_carrier,id_tax_rules_group,id_shop">
|
||||
<field name="id_carrier" relation="carrier"/>
|
||||
<field name="id_tax_rules_group"/>
|
||||
<field name="id_shop"/>
|
||||
</fields>
|
||||
<entities>
|
||||
<carrier_tax_rules_group_shop id="carrier_tax_rules_group_shop_1_1_1" id_carrier="carrier_1" id_tax_rules_group="1" id_shop="1"/>
|
||||
</entities>
|
||||
</entity_carrier_tax_rules_group_shop>
|
10
www/_install/data/xml/carrier_zone.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity_carrier_zone>
|
||||
<fields primary="id_carrier, id_zone" sql="a.id_carrier = 1">
|
||||
<field name="id_carrier" relation="carrier"/>
|
||||
<field name="id_zone" relation="zone"/>
|
||||
</fields>
|
||||
<entities>
|
||||
<carrier_zone id="carrier_zone_1_1" id_carrier="carrier_1" id_zone="Europe"/>
|
||||
</entities>
|
||||
</entity_carrier_zone>
|
11
www/_install/data/xml/category.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity_category>
|
||||
<fields id="name" class="Category" sql="a.id_category <= 2">
|
||||
<field name="id_parent" relation="category"/>
|
||||
<field name="active"/>
|
||||
</fields>
|
||||
<entities>
|
||||
<category id="Root" id_parent="" active="1"/>
|
||||
<category id="Home" id_parent="Root" active="1" is_root_category="1" />
|
||||
</entities>
|
||||
</entity_category>
|
12
www/_install/data/xml/category_group.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<entity_category_group>
|
||||
<fields primary="id_category, id_group" sql="a.id_category = 1">
|
||||
<field name="id_category" relation="category"/>
|
||||
<field name="id_group" relation="group"/>
|
||||
</fields>
|
||||
<entities>
|
||||
<category_group id="category_group_1_1" id_category="Home" id_group="Visitor"/>
|
||||
<category_group id="category_group_1_2" id_category="Home" id_group="Guest"/>
|
||||
<category_group id="category_group_1_3" id_category="Home" id_group="Customer"/>
|
||||
</entities>
|
||||
</entity_category_group>
|
14
www/_install/data/xml/cms.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity_cms>
|
||||
<fields id="meta_title" class="CMS">
|
||||
<field name="id_cms_category" relation="cms_category"/>
|
||||
<field name="active"/>
|
||||
</fields>
|
||||
<entities>
|
||||
<cms id="Delivery" id_cms_category="Home" active="1"/>
|
||||
<cms id="Legal_Notice" id_cms_category="Home" active="1"/>
|
||||
<cms id="Terms_and_conditions_of_use" id_cms_category="Home" active="1"/>
|
||||
<cms id="About_us" id_cms_category="Home" active="1"/>
|
||||
<cms id="Secure_payment" id_cms_category="Home" active="1"/>
|
||||
</entities>
|
||||
</entity_cms>
|