update prestashop

This commit is contained in:
Thibault GUILLAUME 2015-09-22 18:22:11 +02:00
parent 8afc4c86c0
commit 74b8829296
863 changed files with 147188 additions and 130112 deletions

View File

@ -0,0 +1,38 @@
<?php
/**
* 2007-2015 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-2015 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);
}
}

View File

@ -26,7 +26,6 @@
class Adapter_Configuration implements Core_Business_ConfigurationInterface
{
/**
* Returns constant defined by given $key if exists or check directly into PrestaShop
* Configuration

View File

@ -24,8 +24,8 @@
* International Registered Trademark & Property of PrestaShop SA
*/
class Adapter_EntityMapper {
class Adapter_EntityMapper
{
/**
* Load ObjectModel
* @param $id
@ -47,7 +47,6 @@ class Adapter_EntityMapper {
// 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);
@ -61,19 +60,18 @@ class Adapter_EntityMapper {
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]))
if (!isset($object_datas[$key]) || !is_array($object_datas[$key])) {
$object_datas[$key] = array();
}
$object_datas[$key][$row['id_lang']] = $value;
}
@ -103,5 +101,4 @@ class Adapter_EntityMapper {
}
}
}
}

View File

@ -0,0 +1,54 @@
<?php
/**
* 2007-2015 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-2015 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);
}
}

View File

@ -0,0 +1,87 @@
<?php
/**
* 2007-2015 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-2015 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);
}
}

View File

@ -44,8 +44,7 @@ class Adapter_ProductPriceCalculator
$use_group_reduction = true,
Context $context = null,
$use_customer_price = true
)
{
) {
return Product::getPriceStatic(
$id_product,
$usetax,

View File

@ -0,0 +1,34 @@
<?php
/**
* 2007-2015 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-2015 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));
}
}

View File

@ -39,6 +39,4 @@ class Core_Business_CMS_CMSRoleRepository extends Core_Foundation_Database_Entit
return $this->hydrateMany($this->db->select($sql));
}
}

View File

@ -51,7 +51,6 @@ class Core_Business_Email_EmailLister
// Remove unwanted .html / .txt / .tpl / .php / . / ..
foreach ($mail_directory as $mail) {
if (strpos($mail->getFilename(), '.') !== false) {
$tmp = explode('.', $mail->getFilename());

View File

@ -177,8 +177,9 @@ class Core_Business_Payment_PaymentOption
*/
public static function convertLegacyOption(array $legacyOption)
{
if (!$legacyOption)
if (!$legacyOption) {
return;
}
if (array_key_exists('cta_text', $legacyOption)) {
$legacyOption = array($legacyOption);
@ -195,7 +196,6 @@ class Core_Business_Payment_PaymentOption
);
foreach ($legacyOption as $option) {
$option = array_merge($defaults, $option);
$newOption = new Core_Business_Payment_PaymentOption();

View File

@ -0,0 +1,150 @@
<?php
/**
* 2007-2015 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-2015 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->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
)
);
}
}

View File

@ -34,8 +34,7 @@ class Core_Foundation_Database_EntityManager
public function __construct(
Core_Foundation_Database_DatabaseInterface $db,
Core_Business_ConfigurationInterface $configuration
)
{
) {
$this->db = $db;
$this->configuration = $configuration;
}

View File

@ -36,8 +36,7 @@ class Core_Foundation_Database_EntityRepository
Core_Foundation_Database_EntityManager $entityManager,
$tablesPrefix,
Core_Foundation_Database_EntityMetaData $entityMetaData
)
{
) {
$this->entityManager = $entityManager;
$this->db = $this->entityManager->getDatabase();
$this->tablesPrefix = $tablesPrefix;

View File

@ -51,13 +51,20 @@ class Core_Foundation_FileSystem_FileSystem
if (func_num_args() < 2) {
throw new Core_Foundation_FileSystem_Exception('joinPaths requires at least 2 arguments.');
} else if (func_num_args() === 2) {
return $this->joinTwoPaths(func_get_arg(0), func_get_arg(1));
$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(
func_get_arg(0),
$arg_0,
call_user_func_array(
array($this, 'joinPaths'),
array_slice(func_get_args(), 1)
array($this,
'joinPaths'),
array_slice($func_args, 1)
)
);
}

View File

@ -24,19 +24,23 @@
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_ADMIN_DIR_'))
if (!defined('_PS_ADMIN_DIR_')) {
define('_PS_ADMIN_DIR_', getcwd());
}
require(_PS_ADMIN_DIR_.'/../config/config.inc.php');
require(_PS_ADMIN_DIR_.'/functions.php');
// For retrocompatibility with "tab" parameter
if (!isset($_GET['controller']) && isset($_GET['tab']))
if (!isset($_GET['controller']) && isset($_GET['tab'])) {
$_GET['controller'] = strtolower($_GET['tab']);
if (!isset($_POST['controller']) && isset($_POST['tab']))
}
if (!isset($_POST['controller']) && isset($_POST['tab'])) {
$_POST['controller'] = strtolower($_POST['tab']);
if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab']))
}
if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab'])) {
$_REQUEST['controller'] = strtolower($_REQUEST['tab']);
}
// Retrocompatibility with 1.4
$_REQUEST['ajaxMode'] = $_POST['ajaxMode'] = $_GET['ajaxMode'] = $_REQUEST['ajax'] = $_POST['ajax'] = $_GET['ajax'] = 1;

View File

@ -24,8 +24,9 @@
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_ADMIN_DIR_'))
if (!defined('_PS_ADMIN_DIR_')) {
define('_PS_ADMIN_DIR_', getcwd());
}
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
/* Getting cookie or logout */
@ -33,25 +34,26 @@ require_once(_PS_ADMIN_DIR_.'/init.php');
$context = Context::getContext();
if (Tools::isSubmit('ajaxReferrers'))
if (Tools::isSubmit('ajaxReferrers')) {
require(_PS_CONTROLLER_DIR_.'admin/AdminReferrersController.php');
}
if (Tools::getValue('page') == 'prestastore' AND @fsockopen('addons.prestashop.com', 80, $errno, $errst, 3))
if (Tools::getValue('page') == 'prestastore' and @fsockopen('addons.prestashop.com', 80, $errno, $errst, 3)) {
readfile('http://addons.prestashop.com/adminmodules.php?lang='.$context->language->iso_code);
}
if (Tools::isSubmit('getAvailableFields') AND Tools::isSubmit('entity'))
{
if (Tools::isSubmit('getAvailableFields') and Tools::isSubmit('entity')) {
$jsonArray = array();
$import = new AdminImportController();
$fields = $import->getAvailableFields(true);
foreach ($fields as $field)
foreach ($fields as $field) {
$jsonArray[] = '{"field":"'.addslashes($field).'"}';
}
die('['.implode(',', $jsonArray).']');
}
if (Tools::isSubmit('ajaxProductPackItems'))
{
if (Tools::isSubmit('ajaxProductPackItems')) {
$jsonArray = array();
$products = Db::getInstance()->executeS('
SELECT p.`id_product`, pl.`name`
@ -62,31 +64,28 @@ if (Tools::isSubmit('ajaxProductPackItems'))
AND NOT EXISTS (SELECT 1 FROM `'._DB_PREFIX_.'pack` WHERE `id_product_pack` = p.`id_product`)
AND p.`id_product` != '.(int)(Tools::getValue('id_product')));
foreach ($products as $packItem)
foreach ($products as $packItem) {
$jsonArray[] = '{"value": "'.(int)($packItem['id_product']).'-'.addslashes($packItem['name']).'", "text":"'.(int)($packItem['id_product']).' - '.addslashes($packItem['name']).'"}';
}
die('['.implode(',', $jsonArray).']');
}
if (Tools::isSubmit('getChildrenCategories') && Tools::isSubmit('id_category_parent'))
{
if (Tools::isSubmit('getChildrenCategories') && Tools::isSubmit('id_category_parent')) {
$children_categories = Category::getChildrenWithNbSelectedSubCat(Tools::getValue('id_category_parent'), Tools::getValue('selectedCat'), Context::getContext()->language->id, null, Tools::getValue('use_shop_context'));
die(Tools::jsonEncode($children_categories));
}
if (Tools::isSubmit('getNotifications'))
{
if (Tools::isSubmit('getNotifications')) {
$notification = new Notification;
die(Tools::jsonEncode($notification->getLastElements()));
}
if (Tools::isSubmit('updateElementEmployee') && Tools::getValue('updateElementEmployeeType'))
{
if (Tools::isSubmit('updateElementEmployee') && Tools::getValue('updateElementEmployeeType')) {
$notification = new Notification;
die($notification->updateEmployeeLastElement(Tools::getValue('updateElementEmployeeType')));
}
if (Tools::isSubmit('searchCategory'))
{
if (Tools::isSubmit('searchCategory')) {
$q = Tools::getValue('q');
$limit = Tools::getValue('limit');
$results = Db::getInstance()->executeS(
@ -98,27 +97,29 @@ if (Tools::isSubmit('searchCategory'))
GROUP BY c.id_category
ORDER BY c.`position`
LIMIT '.(int)$limit);
if ($results)
foreach ($results as $result)
if ($results) {
foreach ($results as $result) {
echo trim($result['name']).'|'.(int)$result['id_category']."\n";
}
}
}
if (Tools::isSubmit('getParentCategoriesId') && $id_category = Tools::getValue('id_category'))
{
if (Tools::isSubmit('getParentCategoriesId') && $id_category = Tools::getValue('id_category')) {
$category = new Category((int)$id_category);
$results = Db::getInstance()->executeS('SELECT `id_category` FROM `'._DB_PREFIX_.'category` c WHERE c.`nleft` < '.(int)$category->nleft.' AND c.`nright` > '.(int)$category->nright.'');
$output = array();
foreach ($results as $result)
foreach ($results as $result) {
$output[] = $result;
}
die(Tools::jsonEncode($output));
}
if (Tools::isSubmit('getZones'))
{
if (Tools::isSubmit('getZones')) {
$html = '<select id="zone_to_affect" name="zone_to_affect">';
foreach (Zone::getZones() as $z)
foreach (Zone::getZones() as $z) {
$html .= '<option value="'.$z['id_zone'].'">'.$z['name'].'</option>';
}
$html .= '</select>';
$array = array('hasError' => false, 'errors' => '', 'data' => $html);
die(Tools::jsonEncode($array));

View File

@ -23,15 +23,17 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_ADMIN_DIR_'))
if (!defined('_PS_ADMIN_DIR_')) {
define('_PS_ADMIN_DIR_', getcwd());
}
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
/* Getting cookie or logout */
require_once(_PS_ADMIN_DIR_.'/init.php');
$query = Tools::getValue('q', false);
if (!$query OR $query == '' OR strlen($query) < 1)
if (!$query or $query == '' or strlen($query) < 1) {
die();
}
/*
* In the SQL request the "q" param is used entirely to match result in database.
@ -40,14 +42,16 @@ if (!$query OR $query == '' OR strlen($query) < 1)
* is not write in the name field of the product.
* So the ref pattern will be cut for the search request.
*/
if($pos = strpos($query, ' (ref:'))
if ($pos = strpos($query, ' (ref:')) {
$query = substr($query, 0, $pos);
}
$excludeIds = Tools::getValue('excludeIds', false);
if ($excludeIds && $excludeIds != 'NaN')
if ($excludeIds && $excludeIds != 'NaN') {
$excludeIds = implode(',', array_map('intval', explode(',', $excludeIds)));
else
} else {
$excludeIds = '';
}
// Excluding downloadable products from packs because download from pack is not supported
$excludeVirtuals = (bool)Tools::getValue('excludeVirtuals', true);
@ -70,18 +74,16 @@ $sql = 'SELECT p.`id_product`, pl.`link_rewrite`, p.`reference`, pl.`name`, imag
$items = Db::getInstance()->executeS($sql);
if ($items && ($excludeIds || strpos($_SERVER['HTTP_REFERER'], 'AdminScenes') !== false))
foreach ($items as $item)
if ($items && ($excludeIds || strpos($_SERVER['HTTP_REFERER'], 'AdminScenes') !== false)) {
foreach ($items as $item) {
echo trim($item['name']).(!empty($item['reference']) ? ' (ref: '.$item['reference'].')' : '').'|'.(int)($item['id_product'])."\n";
elseif ($items)
{
}
} elseif ($items) {
// packs
$results = array();
foreach ($items as $item)
{
foreach ($items as $item) {
// check if product have combination
if (Combination::isFeatureActive() && $item['cache_default_attribute'])
{
if (Combination::isFeatureActive() && $item['cache_default_attribute']) {
$sql = 'SELECT pa.`id_product_attribute`, pa.`reference`, ag.`id_attribute_group`, pai.`id_image`, agl.`name` AS group_name, al.`name` AS attribute_name,
a.`id_attribute`
FROM `'._DB_PREFIX_.'product_attribute` pa
@ -97,24 +99,22 @@ elseif ($items)
ORDER BY pa.`id_product_attribute`';
$combinations = Db::getInstance()->executeS($sql);
if (!empty($combinations))
{
foreach ($combinations as $k => $combination)
{
if (!empty($combinations)) {
foreach ($combinations as $k => $combination) {
$results[$combination['id_product_attribute']]['id'] = $item['id_product'];
$results[$combination['id_product_attribute']]['id_product_attribute'] = $combination['id_product_attribute'];
!empty($results[$combination['id_product_attribute']]['name']) ? $results[$combination['id_product_attribute']]['name'] .= ' '.$combination['group_name'].'-'.$combination['attribute_name']
: $results[$combination['id_product_attribute']]['name'] = $item['name'].' '.$combination['group_name'].'-'.$combination['attribute_name'];
if (!empty($combination['reference']))
if (!empty($combination['reference'])) {
$results[$combination['id_product_attribute']]['ref'] = $combination['reference'];
else
} else {
$results[$combination['id_product_attribute']]['ref'] = !empty($item['reference']) ? $item['reference'] : '';
if (empty($results[$combination['id_product_attribute']]['image']))
}
if (empty($results[$combination['id_product_attribute']]['image'])) {
$results[$combination['id_product_attribute']]['image'] = str_replace('http://', Tools::getShopProtocol(), $context->link->getImageLink($item['link_rewrite'], $combination['id_image'], 'home_default'));
}
}
else
{
} else {
$product = array(
'id' => (int)($item['id_product']),
'name' => $item['name'],
@ -123,9 +123,7 @@ elseif ($items)
);
array_push($results, $product);
}
}
else
{
} else {
$product = array(
'id' => (int)($item['id_product']),
'name' => $item['name'],
@ -137,6 +135,6 @@ elseif ($items)
}
$results = array_values($results);
echo Tools::jsonEncode($results);
}
else
} else {
Tools::jsonEncode(new stdClass);
}

View File

@ -24,53 +24,63 @@
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_ADMIN_DIR_'))
if (!defined('_PS_ADMIN_DIR_')) {
define('_PS_ADMIN_DIR_', getcwd());
}
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
if (!Context::getContext()->employee->isLoggedBack())
if (!Context::getContext()->employee->isLoggedBack()) {
Tools::redirectAdmin(Context::getContext()->link->getAdminLink('AdminLogin'));
}
$tabAccess = Profile::getProfileAccess(Context::getContext()->employee->id_profile,
Tab::getIdFromClassName('AdminBackup'));
if ($tabAccess['view'] !== '1')
if ($tabAccess['view'] !== '1') {
die(Tools::displayError('You do not have permission to view this.'));
}
$backupdir = realpath(PrestaShopBackup::getBackupPath());
if ($backupdir === false)
if ($backupdir === false) {
die(Tools::displayError('There is no "/backup" directory.'));
}
if (!$backupfile = Tools::getValue('filename'))
if (!$backupfile = Tools::getValue('filename')) {
die(Tools::displayError('No file has been specified.'));
}
// Check the realpath so we can validate the backup file is under the backup directory
$backupfile = realpath($backupdir.DIRECTORY_SEPARATOR.$backupfile);
if ($backupfile === false OR strncmp($backupdir, $backupfile, strlen($backupdir)) != 0 )
if ($backupfile === false or strncmp($backupdir, $backupfile, strlen($backupdir)) != 0) {
die(Tools::dieOrLog('The backup file does not exist.'));
}
if (substr($backupfile, -4) == '.bz2')
if (substr($backupfile, -4) == '.bz2') {
$contentType = 'application/x-bzip2';
else if (substr($backupfile, -3) == '.gz')
} elseif (substr($backupfile, -3) == '.gz') {
$contentType = 'application/x-gzip';
else
} else {
$contentType = 'text/x-sql';
}
$fp = @fopen($backupfile, 'r');
if ($fp === false)
if ($fp === false) {
die(Tools::displayError('Unable to open backup file(s).').' "'.addslashes($backupfile).'"');
}
// Add the correct headers, this forces the file is saved
header('Content-Type: '.$contentType);
header('Content-Disposition: attachment; filename="'.Tools::getValue('filename'). '"');
if (ob_get_level() && ob_get_length() > 0)
if (ob_get_level() && ob_get_length() > 0) {
ob_clean();
}
$ret = @fpassthru($fp);
fclose($fp);
if ($ret === false)
if ($ret === false) {
die(Tools::displayError('Unable to display backup file(s).').' "'.addslashes($backupfile).'"');
}

View File

@ -24,18 +24,16 @@
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_ADMIN_DIR_'))
if (!defined('_PS_ADMIN_DIR_')) {
define('_PS_ADMIN_DIR_', getcwd());
}
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
if (isset($_GET['secure_key']))
{
if (isset($_GET['secure_key'])) {
$secureKey = md5(_COOKIE_KEY_.Configuration::get('PS_SHOP_NAME'));
if (!empty($secureKey) && $secureKey === $_GET['secure_key'])
{
if (!empty($secureKey) && $secureKey === $_GET['secure_key']) {
$shop_ids = Shop::getCompleteListOfShopsID();
foreach($shop_ids as $shop_id)
{
foreach ($shop_ids as $shop_id) {
Shop::setContext(Shop::CONTEXT_SHOP, (int)$shop_id);
Currency::refreshCurrencies();
}

View File

@ -24,13 +24,13 @@
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_ADMIN_DIR_'))
if (!defined('_PS_ADMIN_DIR_')) {
define('_PS_ADMIN_DIR_', getcwd());
}
require_once(_PS_ADMIN_DIR_.'/../config/config.inc.php');
require_once(_PS_ADMIN_DIR_.'/init.php');
if (isset($_GET['img']) AND Validate::isMd5($_GET['img']) AND isset($_GET['name']) AND Validate::isGenericName($_GET['name']) AND file_exists(_PS_UPLOAD_DIR_.$_GET['img']))
{
if (isset($_GET['img']) and Validate::isMd5($_GET['img']) and isset($_GET['name']) and Validate::isGenericName($_GET['name']) and file_exists(_PS_UPLOAD_DIR_.$_GET['img'])) {
header('Content-type: image/jpeg');
header('Content-Disposition: attachment; filename="'.$_GET['name'].'.jpg"');
echo file_get_contents(_PS_UPLOAD_DIR_.$_GET['img']);

View File

@ -24,8 +24,9 @@
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_ADMIN_DIR_'))
if (!defined('_PS_ADMIN_DIR_')) {
define('_PS_ADMIN_DIR_', getcwd());
}
include_once(_PS_ADMIN_DIR_.'/../config/config.inc.php');
$module = Tools::getValue('module');
@ -38,39 +39,34 @@ $height = Tools::getValue('height');
$id_employee = Tools::getValue('id_employee');
$id_lang = Tools::getValue('id_lang');
if (!isset($cookie->id_employee) || !$cookie->id_employee || $cookie->id_employee != $id_employee)
if (!isset($cookie->id_employee) || !$cookie->id_employee || $cookie->id_employee != $id_employee) {
die(Tools::displayError());
}
if (!Validate::isModuleName($module))
if (!Validate::isModuleName($module)) {
die(Tools::displayError());
}
if (!Tools::file_exists_cache($module_path = _PS_ROOT_DIR_.'/modules/'.$module.'/'.$module.'.php'))
if (!Tools::file_exists_cache($module_path = _PS_ROOT_DIR_.'/modules/'.$module.'/'.$module.'.php')) {
die(Tools::displayError());
}
$shop_id = '';
Shop::setContext(Shop::CONTEXT_ALL);
if (Context::getContext()->cookie->shopContext)
{
if (Context::getContext()->cookie->shopContext) {
$split = explode('-', Context::getContext()->cookie->shopContext);
if (count($split) == 2)
{
if ($split[0] == 'g')
{
if (Context::getContext()->employee->hasAuthOnShopGroup($split[1]))
if (count($split) == 2) {
if ($split[0] == 'g') {
if (Context::getContext()->employee->hasAuthOnShopGroup($split[1])) {
Shop::setContext(Shop::CONTEXT_GROUP, $split[1]);
else
{
} else {
$shop_id = Context::getContext()->employee->getDefaultShopID();
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
}
else if (Shop::getShop($split[1]) && Context::getContext()->employee->hasAuthOnShop($split[1]))
{
} elseif (Shop::getShop($split[1]) && Context::getContext()->employee->hasAuthOnShop($split[1])) {
$shop_id = $split[1];
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
else
{
} else {
$shop_id = Context::getContext()->employee->getDefaultShopID();
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
@ -78,27 +74,30 @@ if (Context::getContext()->cookie->shopContext)
}
// Check multishop context and set right context if need
if (Shop::getContext())
{
if (Shop::getContext() == Shop::CONTEXT_SHOP && !Shop::CONTEXT_SHOP)
if (Shop::getContext()) {
if (Shop::getContext() == Shop::CONTEXT_SHOP && !Shop::CONTEXT_SHOP) {
Shop::setContext(Shop::CONTEXT_GROUP, Shop::getContextShopGroupID());
if (Shop::getContext() == Shop::CONTEXT_GROUP && !Shop::CONTEXT_GROUP)
}
if (Shop::getContext() == Shop::CONTEXT_GROUP && !Shop::CONTEXT_GROUP) {
Shop::setContext(Shop::CONTEXT_ALL);
}
}
// Replace existing shop if necessary
if (!$shop_id)
if (!$shop_id) {
Context::getContext()->shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
elseif (Context::getContext()->shop->id != $shop_id)
} elseif (Context::getContext()->shop->id != $shop_id) {
Context::getContext()->shop = new Shop($shop_id);
}
require_once($module_path);
$graph = new $module();
$graph->setEmployee($id_employee);
$graph->setLang($id_lang);
if ($option)
if ($option) {
$graph->setOption($option, $layers);
}
$graph->create($render, $type, $width, $height, $layers);
$graph->draw();

View File

@ -2,32 +2,35 @@
include('config/config.php');
if ($_SESSION['verify'] != 'RESPONSIVEfilemanager')
if ($_SESSION['verify'] != 'RESPONSIVEfilemanager') {
die('forbiden');
}
include('include/utils.php');
if (isset($_GET['action']))
switch ($_GET['action'])
{
if (isset($_GET['action'])) {
switch ($_GET['action']) {
case 'view':
if (isset($_GET['type']))
if (isset($_GET['type'])) {
$_SESSION['view_type'] = $_GET['type'];
else
} else {
die('view type number missing');
}
break;
case 'sort':
if (isset($_GET['sort_by']))
if (isset($_GET['sort_by'])) {
$_SESSION['sort_by'] = $_GET['sort_by'];
if (isset($_GET['descending']))
}
if (isset($_GET['descending'])) {
$_SESSION['descending'] = $_GET['descending'] === 'true';
}
break;
case 'image_size':
if (realpath(dirname(_PS_ROOT_DIR_.$_POST['path'])) != realpath(_PS_ROOT_DIR_.$upload_dir))
if (realpath(dirname(_PS_ROOT_DIR_.$_POST['path'])) != realpath(_PS_ROOT_DIR_.$upload_dir)) {
die();
}
$pos = strpos($_POST['path'], $upload_dir);
if ($pos !== false)
{
if ($pos !== false) {
$info = getimagesize(substr_replace($_POST['path'], $current_path, $pos, strlen($upload_dir)));
echo json_encode($info);
}
@ -41,21 +44,23 @@ if (isset($_GET['action']))
|| strpos($_POST['url'], 'http://featherfiles.aviary.com/') !== 0
|| $_POST['name'] != fix_filename($_POST['name'], $transliteration)
|| !in_array(strtolower($info['extension']), array('jpg', 'jpeg', 'png'))
)
) {
die('wrong data');
}
$image_data = get_file_by_url($_POST['url']);
if ($image_data === false)
{
if ($image_data === false) {
die('file could not be loaded');
}
$put_contents_path = $current_path;
if (isset($_POST['path']))
if (isset($_POST['path'])) {
$put_contents_path .= str_replace("\0", "", $_POST['path']);
}
if (isset($_POST['name']))
if (isset($_POST['name'])) {
$put_contents_path .= str_replace("\0", "", $_POST['name']);
}
file_put_contents($put_contents_path, $image_data);
//new thumb creation
@ -67,46 +72,40 @@ if (isset($_GET['action']))
}*/
break;
case 'extract':
if (strpos($_POST['path'], '/') === 0 || strpos($_POST['path'], '../') !== false || strpos($_POST['path'], './') === 0)
if (strpos($_POST['path'], '/') === 0 || strpos($_POST['path'], '../') !== false || strpos($_POST['path'], './') === 0) {
die('wrong path');
}
$path = $current_path.$_POST['path'];
$info = pathinfo($path);
$base_folder = $current_path.fix_dirname($_POST['path']).'/';
switch ($info['extension'])
{
switch ($info['extension']) {
case 'zip':
$zip = new ZipArchive;
if ($zip->open($path) === true)
{
if ($zip->open($path) === true) {
//make all the folders
for ($i = 0; $i < $zip->numFiles; $i++)
{
for ($i = 0; $i < $zip->numFiles; $i++) {
$OnlyFileName = $zip->getNameIndex($i);
$FullFileName = $zip->statIndex($i);
if ($FullFileName['name'][strlen($FullFileName['name']) - 1] == '/')
{
if ($FullFileName['name'][strlen($FullFileName['name']) - 1] == '/') {
create_folder($base_folder.$FullFileName['name']);
}
}
//unzip into the folders
for ($i = 0; $i < $zip->numFiles; $i++)
{
for ($i = 0; $i < $zip->numFiles; $i++) {
$OnlyFileName = $zip->getNameIndex($i);
$FullFileName = $zip->statIndex($i);
if (!($FullFileName['name'][strlen($FullFileName['name']) - 1] == '/'))
{
if (!($FullFileName['name'][strlen($FullFileName['name']) - 1] == '/')) {
$fileinfo = pathinfo($OnlyFileName);
if (in_array(strtolower($fileinfo['extension']), $ext))
{
if (in_array(strtolower($fileinfo['extension']), $ext)) {
copy('zip://'.$path.'#'.$OnlyFileName, $base_folder.$FullFileName['name']);
}
}
}
$zip->close();
}
else
} else {
echo 'failed to open file';
}
break;
case 'gz':
$p = new PharData($path);
@ -184,8 +183,7 @@ if (isset($_GET['action']))
</div>
</div>
<?php
if (in_array(strtolower($info['extension']), $ext_music))
{
if (in_array(strtolower($info['extension']), $ext_music)) {
?>
<script type="text/javascript">
@ -194,11 +192,16 @@ if (isset($_GET['action']))
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
title: "<?php Tools::safeOutput($_GET['title']); ?>",
mp3: "<?php echo Tools::safeOutput($preview_file); ?>",
m4a: "<?php echo Tools::safeOutput($preview_file); ?>",
oga: "<?php echo Tools::safeOutput($preview_file); ?>",
wav: "<?php echo Tools::safeOutput($preview_file); ?>"
title: "<?php Tools::safeOutput($_GET['title']);
?>",
mp3: "<?php echo Tools::safeOutput($preview_file);
?>",
m4a: "<?php echo Tools::safeOutput($preview_file);
?>",
oga: "<?php echo Tools::safeOutput($preview_file);
?>",
wav: "<?php echo Tools::safeOutput($preview_file);
?>"
});
},
swfPath: "js",
@ -211,8 +214,8 @@ if (isset($_GET['action']))
</script>
<?php
} elseif (in_array(strtolower($info['extension']), $ext_video))
{
} elseif (in_array(strtolower($info['extension']), $ext_video)) {
?>
<script type="text/javascript">
@ -221,9 +224,12 @@ if (isset($_GET['action']))
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
title: "<?php Tools::safeOutput($_GET['title']); ?>",
m4v: "<?php echo Tools::safeOutput($preview_file); ?>",
ogv: "<?php echo Tools::safeOutput($preview_file); ?>"
title: "<?php Tools::safeOutput($_GET['title']);
?>",
m4v: "<?php echo Tools::safeOutput($preview_file);
?>",
ogv: "<?php echo Tools::safeOutput($preview_file);
?>"
});
},
swfPath: "js",
@ -237,9 +243,11 @@ if (isset($_GET['action']))
</script>
<?php
}
break;
}
else
} else {
die('no action passed');
}
?>

View File

@ -1,20 +1,23 @@
<?php
session_start();
if (!defined('_PS_ADMIN_DIR_'))
if (!defined('_PS_ADMIN_DIR_')) {
define('_PS_ADMIN_DIR_', dirname(__FILE__).'/../../');
}
require_once(_PS_ADMIN_DIR_.'/../config/config.inc.php');
require_once(_PS_ADMIN_DIR_.'/init.php');
if (function_exists('mb_internal_encoding'))
if (function_exists('mb_internal_encoding')) {
mb_internal_encoding('UTF-8');
}
$products_accesses = Profile::getProfileAccess(Context::getContext()->employee->id_profile, Tab::getIdFromClassName('AdminProducts'));
$cms_accesses = Profile::getProfileAccess(Context::getContext()->employee->id_profile, Tab::getIdFromClassName('AdminCmsContent'));
if (!$products_accesses['edit'] && !$cms_accesses['edit'])
if (!$products_accesses['edit'] && !$cms_accesses['edit']) {
die(Tools::displayError());
}
//------------------------------------------------------------------------------
// DON'T COPY THIS VARIABLES IN FOLDERS config.php FILES
//------------------------------------------------------------------------------
@ -167,5 +170,3 @@ $relative_image_creation_name_to_prepend= array('','test_'); //name to prepend o
$relative_image_creation_name_to_append = array('_test',''); //name to append on filename
$relative_image_creation_width = array(300,400); //width of image (you can leave empty if you set height)
$relative_image_creation_height = array(200,''); //height of image (you can leave empty if you set width)
?>

File diff suppressed because it is too large Load Diff

View File

@ -1,45 +1,50 @@
<?php
include('config/config.php');
if ($_SESSION['verify'] != 'RESPONSIVEfilemanager') die('forbiden');
if ($_SESSION['verify'] != 'RESPONSIVEfilemanager') {
die('forbiden');
}
include('include/utils.php');
$_POST['path_thumb'] = $thumbs_base_path.$_POST['path_thumb'];
if (!isset($_POST['path_thumb']) && trim($_POST['path_thumb']) == '')
if (!isset($_POST['path_thumb']) && trim($_POST['path_thumb']) == '') {
die('wrong path');
}
$thumb_pos = strpos($_POST['path_thumb'], $thumbs_base_path);
if ($thumb_pos === false
|| preg_match('/\.{1,2}[\/|\\\]/', $_POST['path_thumb']) !== 0
|| preg_match('/\.{1,2}[\/|\\\]/', $_POST['path']) !== 0
)
) {
die('wrong path');
}
$language_file = 'lang/en.php';
if (isset($_GET['lang']) && $_GET['lang'] != 'undefined' && $_GET['lang'] != '')
{
if (isset($_GET['lang']) && $_GET['lang'] != 'undefined' && $_GET['lang'] != '') {
$path_parts = pathinfo($_GET['lang']);
if (is_readable('lang/'.$path_parts['basename'].'.php'))
if (is_readable('lang/'.$path_parts['basename'].'.php')) {
$language_file = 'lang/'.$path_parts['basename'].'.php';
}
}
require_once $language_file;
$base = $current_path;
if (isset($_POST['path']))
if (isset($_POST['path'])) {
$path = $current_path.str_replace("\0", "", $_POST['path']);
else
} else {
$path = $current_path;
}
$cycle = true;
$max_cycles = 50;
$i = 0;
while ($cycle && $i < $max_cycles)
{
while ($cycle && $i < $max_cycles) {
$i++;
if ($path == $base) $cycle = false;
if ($path == $base) {
$cycle = false;
}
if (file_exists($path.'config.php'))
{
if (file_exists($path.'config.php')) {
require_once($path.'config.php');
$cycle = false;
}
@ -49,157 +54,154 @@ while ($cycle && $i < $max_cycles)
$path = $current_path.str_replace("\0", "", $_POST['path']);
$path_thumb = $_POST['path_thumb'];
if (isset($_POST['name']))
{
if (isset($_POST['name'])) {
$name = $_POST['name'];
if (preg_match('/\.{1,2}[\/|\\\]/', $name) !== 0) die('wrong name');
if (preg_match('/\.{1,2}[\/|\\\]/', $name) !== 0) {
die('wrong name');
}
}
$info = pathinfo($path);
if (isset($info['extension']) && !(isset($_GET['action']) && $_GET['action'] == 'delete_folder') && !in_array(strtolower($info['extension']), $ext))
if (isset($info['extension']) && !(isset($_GET['action']) && $_GET['action'] == 'delete_folder') && !in_array(strtolower($info['extension']), $ext)) {
die('wrong extension');
}
if (isset($_GET['action']))
{
switch ($_GET['action'])
{
if (isset($_GET['action'])) {
switch ($_GET['action']) {
case 'delete_file':
if ($delete_files)
{
if ($delete_files) {
unlink($path);
if (file_exists($path_thumb))
if (file_exists($path_thumb)) {
unlink($path_thumb);
}
$info = pathinfo($path);
if ($relative_image_creation)
{
foreach ($relative_path_from_current_pos as $k => $path)
{
if ($path != '' && $path[strlen($path) - 1] != '/')
if ($relative_image_creation) {
foreach ($relative_path_from_current_pos as $k => $path) {
if ($path != '' && $path[strlen($path) - 1] != '/') {
$path .= '/';
if (file_exists($info['dirname'].'/'.$path.$relative_image_creation_name_to_prepend[$k].$info['filename'].$relative_image_creation_name_to_append[$k].'.'.$info['extension']))
}
if (file_exists($info['dirname'].'/'.$path.$relative_image_creation_name_to_prepend[$k].$info['filename'].$relative_image_creation_name_to_append[$k].'.'.$info['extension'])) {
unlink($info['dirname'].'/'.$path.$relative_image_creation_name_to_prepend[$k].$info['filename'].$relative_image_creation_name_to_append[$k].'.'.$info['extension']);
}
}
}
if ($fixed_image_creation)
{
foreach ($fixed_path_from_filemanager as $k => $path)
{
if ($path != '' && $path[strlen($path) - 1] != '/')
if ($fixed_image_creation) {
foreach ($fixed_path_from_filemanager as $k => $path) {
if ($path != '' && $path[strlen($path) - 1] != '/') {
$path .= '/';
}
$base_dir = $path.substr_replace($info['dirname'].'/', '', 0, strlen($current_path));
if (file_exists($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].'.'.$info['extension']))
if (file_exists($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].'.'.$info['extension'])) {
unlink($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].'.'.$info['extension']);
}
}
}
}
break;
case 'delete_folder':
if ($delete_folders)
{
if (is_dir($path_thumb))
if ($delete_folders) {
if (is_dir($path_thumb)) {
deleteDir($path_thumb);
if (is_dir($path))
{
}
if (is_dir($path)) {
deleteDir($path);
if ($fixed_image_creation)
{
foreach ($fixed_path_from_filemanager as $k => $paths)
{
if ($paths != '' && $paths[strlen($paths) - 1] != '/') $paths .= '/';
if ($fixed_image_creation) {
foreach ($fixed_path_from_filemanager as $k => $paths) {
if ($paths != '' && $paths[strlen($paths) - 1] != '/') {
$paths .= '/';
}
$base_dir = $paths.substr_replace($path, '', 0, strlen($current_path));
if (is_dir($base_dir))
if (is_dir($base_dir)) {
deleteDir($base_dir);
}
}
}
}
}
break;
case 'create_folder':
if ($create_folders)
if ($create_folders) {
create_folder(fix_path($path, $transliteration), fix_path($path_thumb, $transliteration));
}
break;
case 'rename_folder':
if ($rename_folders)
{
if ($rename_folders) {
$name = fix_filename($name, $transliteration);
$name = str_replace('.', '', $name);
if (!empty($name))
{
if (!rename_folder($path, $name, $transliteration))
if (!empty($name)) {
if (!rename_folder($path, $name, $transliteration)) {
die(lang_Rename_existing_folder);
}
rename_folder($path_thumb, $name, $transliteration);
if ($fixed_image_creation)
{
foreach ($fixed_path_from_filemanager as $k => $paths)
{
if ($paths != '' && $paths[strlen($paths) - 1] != '/') $paths .= '/';
if ($fixed_image_creation) {
foreach ($fixed_path_from_filemanager as $k => $paths) {
if ($paths != '' && $paths[strlen($paths) - 1] != '/') {
$paths .= '/';
}
$base_dir = $paths.substr_replace($path, '', 0, strlen($current_path));
rename_folder($base_dir, $name, $transliteration);
}
}
} else
} else {
die(lang_Empty_name);
}
}
break;
case 'rename_file':
if ($rename_files)
{
if ($rename_files) {
$name = fix_filename($name, $transliteration);
if (!empty($name))
{
if (!rename_file($path, $name, $transliteration))
if (!empty($name)) {
if (!rename_file($path, $name, $transliteration)) {
die(lang_Rename_existing_file);
}
rename_file($path_thumb, $name, $transliteration);
if ($fixed_image_creation)
{
if ($fixed_image_creation) {
$info = pathinfo($path);
foreach ($fixed_path_from_filemanager as $k => $paths)
{
if ($paths != '' && $paths[strlen($paths) - 1] != '/') $paths .= '/';
foreach ($fixed_path_from_filemanager as $k => $paths) {
if ($paths != '' && $paths[strlen($paths) - 1] != '/') {
$paths .= '/';
}
$base_dir = $paths.substr_replace($info['dirname'].'/', '', 0, strlen($current_path));
if (file_exists($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].'.'.$info['extension']))
if (file_exists($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].'.'.$info['extension'])) {
rename_file($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].'.'.$info['extension'], $fixed_image_creation_name_to_prepend[$k].$name.$fixed_image_creation_to_append[$k], $transliteration);
}
}
} else
}
} else {
die(lang_Empty_name);
}
}
break;
case 'duplicate_file':
if ($duplicate_files)
{
if ($duplicate_files) {
$name = fix_filename($name, $transliteration);
if (!empty($name))
{
if (!duplicate_file($path, $name))
if (!empty($name)) {
if (!duplicate_file($path, $name)) {
die(lang_Rename_existing_file);
}
duplicate_file($path_thumb, $name);
if ($fixed_image_creation)
{
if ($fixed_image_creation) {
$info = pathinfo($path);
foreach ($fixed_path_from_filemanager as $k => $paths)
{
if ($paths != '' && $paths[strlen($paths) - 1] != '/') $paths .= '/';
foreach ($fixed_path_from_filemanager as $k => $paths) {
if ($paths != '' && $paths[strlen($paths) - 1] != '/') {
$paths .= '/';
}
$base_dir = $paths.substr_replace($info['dirname'].'/', '', 0, strlen($current_path));
if (file_exists($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].'.'.$info['extension']))
if (file_exists($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].'.'.$info['extension'])) {
duplicate_file($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].'.'.$info['extension'], $fixed_image_creation_name_to_prepend[$k].$name.$fixed_image_creation_to_append[$k]);
}
}
} else
}
} else {
die(lang_Empty_name);
}
}
break;
default:
die('wrong action');
break;
}
}
?>

View File

@ -1,20 +1,25 @@
<?php
include('config/config.php');
if ($_SESSION['verify'] != 'RESPONSIVEfilemanager') die('forbiden');
if ($_SESSION['verify'] != 'RESPONSIVEfilemanager') {
die('forbiden');
}
include('include/utils.php');
if (preg_match('/\.{1,2}[\/|\\\]/', $_POST['path']) !== 0)
if (preg_match('/\.{1,2}[\/|\\\]/', $_POST['path']) !== 0) {
die('wrong path');
}
if (strpos($_POST['name'], '/') !== false || strpos($_POST['name'], '\\') !== false)
if (strpos($_POST['name'], '/') !== false || strpos($_POST['name'], '\\') !== false) {
die('wrong path');
}
$path = $current_path.$_POST['path'];
$name = $_POST['name'];
$info = pathinfo($name);
if (!in_array(fix_strtolower($info['extension']), $ext))
if (!in_array(fix_strtolower($info['extension']), $ext)) {
die('wrong extension');
}
header('Pragma: private');
header('Cache-control: private, must-revalidate');
@ -24,4 +29,3 @@ header('Content-Disposition: attachment; filename="'.($name).'"');
readfile($path.$name);
exit;
?>

File diff suppressed because it is too large Load Diff

View File

@ -1,46 +1,67 @@
<?php
if($_SESSION["verify"] != "RESPONSIVEfilemanager") die('forbiden');
if ($_SESSION["verify"] != "RESPONSIVEfilemanager") {
die('forbiden');
}
function deleteDir($dir) {
if (!file_exists($dir)) return true;
if (!is_dir($dir)) return unlink($dir);
function deleteDir($dir)
{
if (!file_exists($dir)) {
return true;
}
if (!is_dir($dir)) {
return unlink($dir);
}
foreach (scandir($dir) as $item) {
if ($item == '.' || $item == '..') continue;
if (!deleteDir($dir.DIRECTORY_SEPARATOR.$item)) return false;
if ($item == '.' || $item == '..') {
continue;
}
if (!deleteDir($dir.DIRECTORY_SEPARATOR.$item)) {
return false;
}
}
return rmdir($dir);
}
function duplicate_file($old_path,$name){
function duplicate_file($old_path, $name)
{
if (file_exists($old_path)) {
$info=pathinfo($old_path);
$new_path=$info['dirname']."/".$name.".".$info['extension'];
if(file_exists($new_path)) return false;
if (file_exists($new_path)) {
return false;
}
return copy($old_path, $new_path);
}
}
function rename_file($old_path,$name,$transliteration){
function rename_file($old_path, $name, $transliteration)
{
$name=fix_filename($name, $transliteration);
if (file_exists($old_path)) {
$info=pathinfo($old_path);
$new_path=$info['dirname']."/".$name.".".$info['extension'];
if(file_exists($new_path)) return false;
if (file_exists($new_path)) {
return false;
}
return rename($old_path, $new_path);
}
}
function rename_folder($old_path,$name,$transliteration){
function rename_folder($old_path, $name, $transliteration)
{
$name=fix_filename($name, $transliteration);
if (file_exists($old_path)) {
$new_path=fix_dirname($old_path)."/".$name;
if(file_exists($new_path)) return false;
if (file_exists($new_path)) {
return false;
}
return rename($old_path, $new_path);
}
}
function create_img_gd($imgfile, $imgthumb, $newwidth, $newheight="") {
function create_img_gd($imgfile, $imgthumb, $newwidth, $newheight="")
{
if (image_check_memory_usage($imgfile, $newwidth, $newheight)) {
require_once('php_image_magician.php');
$magicianObj = new imageLib($imgfile);
@ -51,7 +72,8 @@ function create_img_gd($imgfile, $imgthumb, $newwidth, $newheight="") {
return false;
}
function create_img($imgfile, $imgthumb, $newwidth, $newheight="") {
function create_img($imgfile, $imgthumb, $newwidth, $newheight="")
{
if (image_check_memory_usage($imgfile, $newwidth, $newheight)) {
require_once('php_image_magician.php');
$magicianObj = new imageLib($imgfile);
@ -63,7 +85,8 @@ function create_img($imgfile, $imgthumb, $newwidth, $newheight="") {
}
}
function makeSize($size) {
function makeSize($size)
{
$units = array('B','KB','MB','GB','TB');
$u = 0;
while ((round($size / 1024) > 0) && ($u < 4)) {
@ -73,7 +96,8 @@ function makeSize($size) {
return (number_format($size, 0) . " " . $units[$u]);
}
function foldersize($path) {
function foldersize($path)
{
$total_size = 0;
$files = scandir($path);
$cleanPath = rtrim($path, '/'). '/';
@ -84,8 +108,7 @@ function foldersize($path) {
if (is_dir($currentFile)) {
$size = foldersize($currentFile);
$total_size += $size;
}
else {
} else {
$size = filesize($currentFile);
$total_size += $size;
}
@ -95,24 +118,29 @@ function foldersize($path) {
return $total_size;
}
function create_folder($path=false,$path_thumbs=false){
function create_folder($path=false, $path_thumbs=false)
{
$oldumask = umask(0);
if ($path && !file_exists($path))
mkdir($path, 0777, true); // or even 01777 so you get the sticky bit set
if($path_thumbs && !file_exists($path_thumbs))
mkdir($path_thumbs, 0777, true) or die("$path_thumbs cannot be found"); // or even 01777 so you get the sticky bit set
if ($path && !file_exists($path)) {
mkdir($path, 0777, true);
} // or even 01777 so you get the sticky bit set
if ($path_thumbs && !file_exists($path_thumbs)) {
mkdir($path_thumbs, 0777, true) or die("$path_thumbs cannot be found");
} // or even 01777 so you get the sticky bit set
umask($oldumask);
}
function check_files_extensions_on_path($path,$ext){
function check_files_extensions_on_path($path, $ext)
{
if (!is_dir($path)) {
$fileinfo = pathinfo($path);
if (function_exists('mb_strtolower'))
if(!in_array(mb_strtolower($fileinfo['extension']),$ext))
if (function_exists('mb_strtolower')) {
if (!in_array(mb_strtolower($fileinfo['extension']), $ext)) {
unlink($path);
else
if(!in_array(Tools::strtolower($fileinfo['extension']),$ext))
} elseif (!in_array(Tools::strtolower($fileinfo['extension']), $ext)) {
unlink($path);
}
}
} else {
$files = scandir($path);
foreach ($files as $file) {
@ -121,34 +149,30 @@ function check_files_extensions_on_path($path,$ext){
}
}
function check_files_extensions_on_phar( $phar, &$files, $basepath, $ext ) {
foreach( $phar as $file )
function check_files_extensions_on_phar($phar, &$files, $basepath, $ext)
{
if( $file->isFile() )
{
if (function_exists('mb_strtolower'))
if(in_array(mb_strtolower($file->getExtension()),$ext))
foreach ($phar as $file) {
if ($file->isFile()) {
if (function_exists('mb_strtolower')) {
if (in_array(mb_strtolower($file->getExtension()), $ext)) {
$files[] = $basepath.$file->getFileName();
else
if(in_array(Tools::strtolower($file->getExtension()),$ext))
} elseif (in_array(Tools::strtolower($file->getExtension()), $ext)) {
$files[] = $basepath.$file->getFileName();
}
else if( $file->isDir() )
{
}
} elseif ($file->isDir()) {
$iterator = new DirectoryIterator($file);
check_files_extensions_on_phar($iterator, $files, $basepath.$file->getFileName().'/', $ext);
}
}
}
function fix_filename($str,$transliteration){
function fix_filename($str, $transliteration)
{
if ($transliteration) {
if( function_exists( 'transliterator_transliterate' ) )
{
if (function_exists('transliterator_transliterate')) {
$str = transliterator_transliterate('Accents-Any', $str);
}
else
{
} else {
$str = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $str);
}
@ -161,51 +185,59 @@ function fix_filename($str,$transliteration){
// Empty or incorrectly transliterated filename.
// Here is a point: a good file UNKNOWN_LANGUAGE.jpg could become .jpg in previous code.
// So we add that default 'file' name to fix that issue.
if( strpos( $str, '.' ) === 0 )
{
if (strpos($str, '.') === 0) {
$str = 'file'.$str;
}
return trim($str);
}
function fix_dirname($str){
function fix_dirname($str)
{
return str_replace('~', ' ', dirname(str_replace(' ', '~', $str)));
}
function fix_strtoupper($str){
if( function_exists( 'mb_strtoupper' ) )
function fix_strtoupper($str)
{
if (function_exists('mb_strtoupper')) {
return mb_strtoupper($str);
else
} else {
return strtoupper($str);
}
function fix_strtolower($str){
if( function_exists( 'mb_strtoupper' ) )
return mb_strtolower($str);
else
return strtolower($str);
}
function fix_path($path,$transliteration){
$info=pathinfo($path);
if (($s = strrpos($path, '/')) !== false) $s++;
if (($e = strrpos($path, '.') - $s) !== strlen($info['filename']))
function fix_strtolower($str)
{
if (function_exists('mb_strtoupper')) {
return mb_strtolower($str);
} else {
return strtolower($str);
}
}
function fix_path($path, $transliteration)
{
$info=pathinfo($path);
if (($s = strrpos($path, '/')) !== false) {
$s++;
}
if (($e = strrpos($path, '.') - $s) !== strlen($info['filename'])) {
$info['filename'] = substr($path, $s, $e);
$info['basename'] = substr($path, $s);
}
$tmp_path = $info['dirname'].DIRECTORY_SEPARATOR.$info['basename'];
$str=fix_filename($info['filename'], $transliteration);
if($tmp_path!="")
if ($tmp_path!="") {
return $tmp_path.DIRECTORY_SEPARATOR.$str;
else
} else {
return $str;
}
}
function base_url(){
function base_url()
{
return sprintf(
"%s://%s",
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http',
@ -213,7 +245,8 @@ function base_url(){
);
}
function config_loading($current_path,$fld){
function config_loading($current_path, $fld)
{
if (file_exists($current_path.$fld.".config")) {
require_once($current_path.$fld.".config");
return true;
@ -227,7 +260,8 @@ function config_loading($current_path,$fld){
}
function image_check_memory_usage($img, $max_breedte, $max_hoogte){
function image_check_memory_usage($img, $max_breedte, $max_hoogte)
{
if (file_exists($img)) {
$K64 = 65536; // number of bytes in 64K
$memory_usage = memory_get_usage();
@ -260,37 +294,50 @@ function endsWith($haystack, $needle)
return $needle === "" || substr($haystack, -strlen($needle)) === $needle;
}
function new_thumbnails_creation($targetPath,$targetFile,$name,$current_path,$relative_image_creation,$relative_path_from_current_pos,$relative_image_creation_name_to_prepend,$relative_image_creation_name_to_append,$relative_image_creation_width,$relative_image_creation_height,$fixed_image_creation,$fixed_path_from_filemanager,$fixed_image_creation_name_to_prepend,$fixed_image_creation_to_append,$fixed_image_creation_width,$fixed_image_creation_height){
function new_thumbnails_creation($targetPath, $targetFile, $name, $current_path, $relative_image_creation, $relative_path_from_current_pos, $relative_image_creation_name_to_prepend, $relative_image_creation_name_to_append, $relative_image_creation_width, $relative_image_creation_height, $fixed_image_creation, $fixed_path_from_filemanager, $fixed_image_creation_name_to_prepend, $fixed_image_creation_to_append, $fixed_image_creation_width, $fixed_image_creation_height)
{
//create relative thumbs
$all_ok=true;
if ($relative_image_creation) {
foreach ($relative_path_from_current_pos as $k=>$path) {
if($path!="" && $path[strlen($path)-1]!="/") $path.="/";
if (!file_exists($targetPath.$path)) create_folder($targetPath.$path,false);
if ($path!="" && $path[strlen($path)-1]!="/") {
$path.="/";
}
if (!file_exists($targetPath.$path)) {
create_folder($targetPath.$path, false);
}
$info=pathinfo($name);
if(!endsWith($targetPath,$path))
if(!create_img($targetFile, $targetPath.$path.$relative_image_creation_name_to_prepend[$k].$info['filename'].$relative_image_creation_name_to_append[$k].".".$info['extension'], $relative_image_creation_width[$k], $relative_image_creation_height[$k]))
if (!endsWith($targetPath, $path)) {
if (!create_img($targetFile, $targetPath.$path.$relative_image_creation_name_to_prepend[$k].$info['filename'].$relative_image_creation_name_to_append[$k].".".$info['extension'], $relative_image_creation_width[$k], $relative_image_creation_height[$k])) {
$all_ok=false;
}
}
}
}
//create fixed thumbs
if ($fixed_image_creation) {
foreach ($fixed_path_from_filemanager as $k=>$path) {
if($path!="" && $path[strlen($path)-1]!="/") $path.="/";
if ($path!="" && $path[strlen($path)-1]!="/") {
$path.="/";
}
$base_dir=$path.substr_replace($targetPath, '', 0, strlen($current_path));
if (!file_exists($base_dir)) create_folder($base_dir,false);
if (!file_exists($base_dir)) {
create_folder($base_dir, false);
}
$info=pathinfo($name);
if(!create_img($targetFile, $base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension'], $fixed_image_creation_width[$k], $fixed_image_creation_height[$k]))
if (!create_img($targetFile, $base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension'], $fixed_image_creation_width[$k], $fixed_image_creation_height[$k])) {
$all_ok=false;
}
}
}
return $all_ok;
}
// Get a remote file, using whichever mechanism is enabled
function get_file_by_url($url) {
function get_file_by_url($url)
{
if (ini_get('allow_url_fopen')) {
return file_get_contents($url);
}
@ -309,5 +356,3 @@ function get_file_by_url($url) {
return $data;
}
?>

View File

@ -55,4 +55,3 @@ define('lang_Extract','bura çıxart');
define('lang_File_info', 'fayl məlumatı');
define('lang_Edit_image', 'şəkli redaktə et');
define('lang_Duplicate', 'Dublikat');
?>

View File

@ -55,4 +55,3 @@ define('lang_Extract','extract here');
define('lang_File_info', 'file info');
define('lang_Edit_image', 'edit image');
define('lang_Duplicate', 'Duplicate');
?>

View File

@ -55,4 +55,3 @@ define('lang_Extract','extract here');
define('lang_File_info', 'file info');
define('lang_Edit_image', 'edit image');
define('lang_Duplicate', 'Duplicate');
?>

View File

@ -51,4 +51,3 @@ define('lang_OK','OK');
define('lang_Cancel', 'Zrušit');
define('lang_Sorting', 'řazení');
define('lang_Duplicate', 'Duplicate');
?>

View File

@ -55,4 +55,3 @@ define('lang_Extract','extract here');
define('lang_File_info', 'file info');
define('lang_Edit_image', 'edit image');
define('lang_Duplicate', 'Duplicate');
?>

View File

@ -55,5 +55,3 @@ define('lang_Extract','extract here');
define('lang_File_info', 'file info');
define('lang_Edit_image', 'edit image');
define('lang_Duplicate', 'Duplicate');
?>

View File

@ -55,4 +55,3 @@ define('lang_Extract','Extraer aquí');
define('lang_File_info', 'Información');
define('lang_Edit_image', 'Editar imagen');
define('lang_Duplicate', 'Duplicate');
?>

View File

@ -55,4 +55,3 @@ define('lang_Extract','استخراج در اینجا');
define('lang_File_info', 'اطلاعات فایل');
define('lang_Edit_image', 'ویرایش تصویر');
define('lang_Duplicate', 'Duplicate');
?>

View File

@ -55,4 +55,3 @@ define('lang_Extract','Extraire ici');
define('lang_File_info', 'Information');
define('lang_Edit_image', 'Editer l\'image');
define('lang_Duplicate', 'Dupliquer');
?>

View File

@ -55,5 +55,3 @@ define('lang_Extract','raspakiraj ovdje');
define('lang_File_info', 'informacije');
define('lang_Edit_image', 'uredi sliku');
define('lang_Duplicate', 'kopiraj');
?>

View File

@ -55,4 +55,3 @@ define('lang_Extract','kibontás ide');
define('lang_File_info', 'fájl info');
define('lang_Edit_image', 'kép szerkesztése');
define('lang_Duplicate', 'Klónozás');
?>

View File

@ -55,5 +55,3 @@ define('lang_Extract','extract disini');
define('lang_File_info', 'info berkas');
define('lang_Edit_image', 'edit gambar');
define('lang_Duplicate', 'Duplikat');
?>

View File

@ -55,4 +55,3 @@ define('lang_Extract','estrai qui');
define('lang_File_info', 'informazioni file');
define('lang_Edit_image', 'modifica immagine');
define('lang_Duplicate', 'Duplica');
?>

View File

@ -55,5 +55,3 @@ define('lang_Extract','энд задла');
define('lang_File_info', 'файлын мэдээлэл');
define('lang_Edit_image', 'зураг засварлах');
define('lang_Duplicate', 'Давхардуулах');
?>

View File

@ -55,5 +55,3 @@ define('lang_Extract','extract here');
define('lang_File_info', 'Fil-info');
define('lang_Edit_image', 'Rediger bilde');
define('lang_Duplicate', 'Duplicate');
?>

View File

@ -55,4 +55,3 @@ define('lang_Extract','hier uitpakken');
define('lang_File_info', 'bestands-info');
define('lang_Edit_image', 'afbeelding bewerken');
define('lang_Duplicate', 'Duplicate');
?>

View File

@ -55,4 +55,3 @@ define('lang_Extract','extract here');
define('lang_File_info', 'file info');
define('lang_Edit_image', 'edit image');
define('lang_Duplicate', 'Duplicate');
?>

View File

@ -55,4 +55,3 @@ define('lang_Extract','extract here');
define('lang_File_info', 'file info');
define('lang_Edit_image', 'edit image');
define('lang_Duplicate', 'Duplicate');
?>

View File

@ -55,4 +55,3 @@ define('lang_Extract','Распаковать здесь');
define('lang_File_info', 'Свойства файла');
define('lang_Edit_image', 'Редактировать');
define('lang_Duplicate', 'Duplicate');
?>

View File

@ -55,5 +55,3 @@ define('lang_Extract','packa upp här'); // extract here
define('lang_File_info', 'fil information'); // file info
define('lang_Edit_image', 'editera bild'); // edit image
define('lang_Duplicate', 'Duplicera'); // Duplicate
?>

View File

@ -55,5 +55,3 @@ define('lang_Extract','Rozbaliť sem');
define('lang_File_info', 'Informácie o súbore');
define('lang_Edit_image', 'Upraviť obrázok');
define('lang_Duplicate', 'Duplikovať');
?>

View File

@ -55,4 +55,3 @@ define('lang_Extract','buraya çıkart');
define('lang_File_info', 'dosya bilgisi');
define('lang_Edit_image', 'resmi düzenle');
define('lang_Duplicate', 'Çoğalt');
?>

View File

@ -55,4 +55,3 @@ define('lang_Extract','extract here');
define('lang_File_info', 'file info');
define('lang_Edit_image', 'edit image');
define('lang_Duplicate', 'Duplicate');
?>

View File

@ -1,6 +1,8 @@
<?php
include('config/config.php');
if ($_SESSION['verify'] != 'RESPONSIVEfilemanager') die('forbiden');
if ($_SESSION['verify'] != 'RESPONSIVEfilemanager') {
die('forbiden');
}
include('include/utils.php');
$_POST['path'] = $current_path.str_replace('\0', '', $_POST['path']);
@ -14,30 +16,29 @@ $thumb_pos = strpos($_POST['path_thumb'], $thumbs_base_path);
if ($path_pos === false || $thumb_pos === false
|| preg_match('/\.{1,2}[\/|\\\]/', $_POST['path_thumb']) !== 0
|| preg_match('/\.{1,2}[\/|\\\]/', $_POST['path']) !== 0)
|| preg_match('/\.{1,2}[\/|\\\]/', $_POST['path']) !== 0) {
die('wrong path');
}
$path = $storeFolder;
$cycle = true;
$max_cycles = 50;
$i = 0;
while ($cycle && $i < $max_cycles)
{
while ($cycle && $i < $max_cycles) {
$i++;
if ($path == $current_path) $cycle = false;
if (file_exists($path.'config.php'))
{
if ($path == $current_path) {
$cycle = false;
}
if (file_exists($path.'config.php')) {
require_once($path.'config.php');
$cycle = false;
}
$path = fix_dirname($path).'/';
}
if (!empty($_FILES))
{
if (!empty($_FILES)) {
$info = pathinfo($_FILES['file']['name']);
if (isset($info['extension']) && in_array(fix_strtolower($info['extension']), $ext))
{
if (isset($info['extension']) && in_array(fix_strtolower($info['extension']), $ext)) {
$tempFile = $_FILES['file']['tmp_name'];
$targetPath = $storeFolder;
@ -48,12 +49,10 @@ if (!empty($_FILES))
array_pop($file_name_splitted);
$_FILES['file']['name'] = implode('-', $file_name_splitted).'.'.$info['extension'];
if (file_exists($targetPath.$_FILES['file']['name']))
{
if (file_exists($targetPath.$_FILES['file']['name'])) {
$i = 1;
$info = pathinfo($_FILES['file']['name']);
while (file_exists($targetPath.$info['filename'].'_'.$i.'.'.$info['extension']))
{
while (file_exists($targetPath.$info['filename'].'_'.$i.'.'.$info['extension'])) {
$i++;
}
$_FILES['file']['name'] = $info['filename'].'_'.$i.'.'.$info['extension'];
@ -61,88 +60,78 @@ if (!empty($_FILES))
$targetFile = $targetPath.$_FILES['file']['name'];
$targetFileThumb = $targetPathThumb.$_FILES['file']['name'];
if (in_array(fix_strtolower($info['extension']), $ext_img) && @getimagesize($tempFile) != false)
if (in_array(fix_strtolower($info['extension']), $ext_img) && @getimagesize($tempFile) != false) {
$is_img = true;
else
} else {
$is_img = false;
}
if ($is_img)
{
if ($is_img) {
move_uploaded_file($tempFile, $targetFile);
chmod($targetFile, 0755);
$memory_error = false;
if (!create_img_gd($targetFile, $targetFileThumb, 122, 91))
if (!create_img_gd($targetFile, $targetFileThumb, 122, 91)) {
$memory_error = false;
else
{
if (!new_thumbnails_creation($targetPath, $targetFile, $_FILES['file']['name'], $current_path, $relative_image_creation, $relative_path_from_current_pos, $relative_image_creation_name_to_prepend, $relative_image_creation_name_to_append, $relative_image_creation_width, $relative_image_creation_height, $fixed_image_creation, $fixed_path_from_filemanager, $fixed_image_creation_name_to_prepend, $fixed_image_creation_to_append, $fixed_image_creation_width, $fixed_image_creation_height))
} else {
if (!new_thumbnails_creation($targetPath, $targetFile, $_FILES['file']['name'], $current_path, $relative_image_creation, $relative_path_from_current_pos, $relative_image_creation_name_to_prepend, $relative_image_creation_name_to_append, $relative_image_creation_width, $relative_image_creation_height, $fixed_image_creation, $fixed_path_from_filemanager, $fixed_image_creation_name_to_prepend, $fixed_image_creation_to_append, $fixed_image_creation_width, $fixed_image_creation_height)) {
$memory_error = false;
else
{
} else {
$imginfo = getimagesize($targetFile);
$srcWidth = $imginfo[0];
$srcHeight = $imginfo[1];
if ($image_resizing)
{
if ($image_resizing_width == 0)
{
if ($image_resizing_height == 0)
{
if ($image_resizing) {
if ($image_resizing_width == 0) {
if ($image_resizing_height == 0) {
$image_resizing_width = $srcWidth;
$image_resizing_height = $srcHeight;
} else
} else {
$image_resizing_width = $image_resizing_height * $srcWidth / $srcHeight;
} elseif ($image_resizing_height == 0)
}
} elseif ($image_resizing_height == 0) {
$image_resizing_height = $image_resizing_width * $srcHeight / $srcWidth;
}
$srcWidth = $image_resizing_width;
$srcHeight = $image_resizing_height;
create_img_gd($targetFile, $targetFile, $image_resizing_width, $image_resizing_height);
}
//max resizing limit control
$resize = false;
if ($image_max_width != 0 && $srcWidth > $image_max_width)
{
if ($image_max_width != 0 && $srcWidth > $image_max_width) {
$resize = true;
$srcHeight = $image_max_width * $srcHeight / $srcWidth;
$srcWidth = $image_max_width;
}
if ($image_max_height != 0 && $srcHeight > $image_max_height)
{
if ($image_max_height != 0 && $srcHeight > $image_max_height) {
$resize = true;
$srcWidth = $image_max_height * $srcWidth / $srcHeight;
$srcHeight = $image_max_height;
}
if ($resize)
if ($resize) {
create_img_gd($targetFile, $targetFile, $srcWidth, $srcHeight);
}
}
if ($memory_error)
{
}
if ($memory_error) {
//error
unlink($targetFile);
header('HTTP/1.1 406 Not enought Memory', true, 406);
exit();
}
}
else
{
} else {
move_uploaded_file($tempFile, $targetFile);
chmod($targetFile, 0755);
}
} else
{
} else {
header('HTTP/1.1 406 file not permitted', true, 406);
exit();
}
} else
{
} else {
header('HTTP/1.1 405 Bad Request', true, 405);
exit();
}
if (isset($_POST['submit']))
{
if (isset($_POST['submit'])) {
$query = http_build_query(
array(
'type' => $_POST['type'],
@ -154,5 +143,3 @@ if (isset($_POST['submit']))
);
header('location: dialog.php?'.$query);
}
?>

View File

@ -23,12 +23,13 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_ADMIN_DIR_'))
if (!defined('_PS_ADMIN_DIR_')) {
define('_PS_ADMIN_DIR_', getcwd());
}
require_once(_PS_ADMIN_DIR_.'/../images.inc.php');
function bindDatepicker($id, $time)
{
if ($time)
if ($time) {
echo '
var dateObj = new Date();
var hours = dateObj.getHours();
@ -38,6 +39,7 @@ function bindDatepicker($id, $time)
if (mins < 10) { mins = "0" + mins; }
if (secs < 10) { secs = "0" + secs; }
var time = " "+hours+":"+mins+":"+secs;';
}
echo '
$(function() {
@ -60,14 +62,17 @@ function includeDatepicker($id, $time = false)
echo '<link type="text/css" rel="stylesheet" href="'.__PS_BASE_URI__.'js/jquery/ui/themes/ui-lightness/jquery.ui.theme.css" />';
echo '<link type="text/css" rel="stylesheet" href="'.__PS_BASE_URI__.'js/jquery/ui/themes/ui-lightness/jquery.ui.datepicker.css" />';
$iso = Db::getInstance()->getValue('SELECT iso_code FROM '._DB_PREFIX_.'lang WHERE `id_lang` = '.(int)Context::getContext()->language->id);
if ($iso != 'en')
if ($iso != 'en') {
echo '<script type="text/javascript" src="'.__PS_BASE_URI__.'js/jquery/ui/i18n/jquery.ui.datepicker-'.Tools::htmlentitiesUTF8($iso).'.js"></script>';
}
echo '<script type="text/javascript">';
if (is_array($id))
foreach ($id as $id2)
if (is_array($id)) {
foreach ($id as $id2) {
bindDatepicker($id2, $time);
else
}
} else {
bindDatepicker($id, $time);
}
echo '</script>';
}
@ -93,22 +98,23 @@ function rewriteSettingsFile($base_urls = null, $theme = null, $array_db = null)
$defines['_COOKIE_IV_'] = addslashes(_COOKIE_IV_);
$defines['_PS_CREATION_DATE_'] = addslashes(_PS_CREATION_DATE_);
if (defined('_RIJNDAEL_KEY_'))
if (defined('_RIJNDAEL_KEY_')) {
$defines['_RIJNDAEL_KEY_'] = addslashes(_RIJNDAEL_KEY_);
if (defined('_RIJNDAEL_IV_'))
}
if (defined('_RIJNDAEL_IV_')) {
$defines['_RIJNDAEL_IV_'] = addslashes(_RIJNDAEL_IV_);
}
$defines['_PS_VERSION_'] = addslashes(_PS_VERSION_);
$content = "<?php\n\n";
foreach ($defines as $k => $value)
{
if ($k == '_PS_VERSION_')
foreach ($defines as $k => $value) {
if ($k == '_PS_VERSION_') {
$content .= 'if (!defined(\''.$k.'\'))'."\n\t";
}
$content .= 'define(\''.$k.'\', \''.addslashes($value).'\');'."\n";
}
copy(_PS_ADMIN_DIR_.'/../config/settings.inc.php', _PS_ADMIN_DIR_.'/../config/settings.old.php');
if ($fd = fopen(_PS_ADMIN_DIR_.'/../config/settings.inc.php', 'w'))
{
if ($fd = fopen(_PS_ADMIN_DIR_.'/../config/settings.inc.php', 'w')) {
fwrite($fd, $content);
fclose($fd);
return true;
@ -140,14 +146,12 @@ function displayDate($sql_date, $with_time = false)
function getPath($url_base, $id_category, $path = '', $highlight = '', $category_type = 'catalog', $home = false)
{
$context = Context::getContext();
if ($category_type == 'catalog')
{
if ($category_type == 'catalog') {
$category = Db::getInstance()->getRow('
SELECT id_category, level_depth, nleft, nright
FROM '._DB_PREFIX_.'category
WHERE id_category = '.(int)$id_category);
if (isset($category['id_category']))
{
if (isset($category['id_category'])) {
$sql = 'SELECT c.id_category, cl.name, cl.link_rewrite
FROM '._DB_PREFIX_.'category c
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category'.Shop::addSqlRestrictionOnLang('cl').')
@ -163,8 +167,7 @@ function getPath($url_base, $id_category, $path = '', $highlight = '', $category
$full_path = '';
$n = 1;
$n_categories = (int)count($categories);
foreach ($categories as $category)
{
foreach ($categories as $category) {
$link = Context::getContext()->link->getAdminLink('AdminCategories');
$edit = '<a href="'.Tools::safeOutput($link.'&id_category='.(int)$category['id_category'].'&'.(($category['id_category'] == 1 || $home) ? 'viewcategory' : 'updatecategory')).'" title="'.($category['id_category'] == Category::getRootCategory()->id_category ? 'Home' : 'Modify').'"><i class="icon-'.(($category['id_category'] == Category::getRootCategory()->id_category || $home) ? 'home' : 'pencil').'"></i></a> ';
$full_path .= $edit.
@ -176,23 +179,24 @@ function getPath($url_base, $id_category, $path = '', $highlight = '', $category
return $full_path.$path;
}
}
elseif ($category_type == 'cms')
{
} elseif ($category_type == 'cms') {
$category = new CMSCategory($id_category, $context->language->id);
if (!$category->id)
if (!$category->id) {
return $path;
}
$name = ($highlight != null) ? str_ireplace($highlight, '<span class="highlight">'.$highlight.'</span>', CMSCategory::hideCMSCategoryPosition($category->name)) : CMSCategory::hideCMSCategoryPosition($category->name);
$edit = '<a href="'.Tools::safeOutput($url_base.'&id_cms_category='.$category->id.'&addcategory&token='.Tools::getAdminToken('AdminCmsContent'.(int)Tab::getIdFromClassName('AdminCmsContent').(int)$context->employee->id)).'">
<i class="icon-pencil"></i></a> ';
if ($category->id == 1)
if ($category->id == 1) {
$edit = '<li><a href="'.Tools::safeOutput($url_base.'&id_cms_category='.$category->id.'&viewcategory&token='.Tools::getAdminToken('AdminCmsContent'.(int)Tab::getIdFromClassName('AdminCmsContent').(int)$context->employee->id)).'">
<i class="icon-home"></i></a></li> ';
}
$path = $edit.'<li><a href="'.Tools::safeOutput($url_base.'&id_cms_category='.$category->id.'&viewcategory&token='.Tools::getAdminToken('AdminCmsContent'.(int)Tab::getIdFromClassName('AdminCmsContent').(int)$context->employee->id)).'">
'.$name.'</a></li> > '.$path;
if ($category->id == 1)
if ($category->id == 1) {
return substr($path, 0, strlen($path) - 3);
}
return getPath($url_base, $category->id_parent, $path, '', 'cms');
}
}
@ -200,12 +204,13 @@ function getPath($url_base, $id_category, $path = '', $highlight = '', $category
function getDirContent($path)
{
$content = array();
if (is_dir($path))
{
if (is_dir($path)) {
$d = dir($path);
while (false !== ($entry = $d->read()))
if ($entry{0} != '.')
while (false !== ($entry = $d->read())) {
if ($entry{0} != '.') {
$content[] = $entry;
}
}
$d->close();
}
return $content;
@ -213,8 +218,9 @@ function getDirContent($path)
function createDir($path, $rights)
{
if (file_exists($path))
if (file_exists($path)) {
return true;
}
return @mkdir($path, $rights);
}
@ -235,8 +241,9 @@ function translate($string)
Tools::displayAsDeprecated();
global $_LANGADM;
if (!is_array($_LANGADM))
if (!is_array($_LANGADM)) {
return str_replace('"', '&quot;', $string);
}
$key = md5(str_replace('\'', '\\\'', $string));
$str = (array_key_exists('index'.$key, $_LANGADM)) ? $_LANGADM['index'.$key] : ((array_key_exists('index'.$key, $_LANGADM)) ? $_LANGADM['index'.$key] : $string);
return str_replace('"', '&quot;', stripslashes($str));
@ -251,26 +258,25 @@ function translate($string)
function checkingTab($tab)
{
$tab_lowercase = Tools::strtolower(trim($tab));
if (!Validate::isTabName($tab))
if (!Validate::isTabName($tab)) {
return false;
}
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT id_tab, module, class_name FROM `'._DB_PREFIX_.'tab` WHERE LOWER(class_name) = \''.pSQL($tab).'\'');
if (!$row['id_tab'])
{
if (isset(AdminTab::$tabParenting[$tab]))
if (!$row['id_tab']) {
if (isset(AdminTab::$tabParenting[$tab])) {
Tools::redirectAdmin('?tab='.AdminTab::$tabParenting[$tab].'&token='.Tools::getAdminTokenLite(AdminTab::$tabParenting[$tab]));
}
echo sprintf(Tools::displayError('Page %s cannot be found.'), $tab);
return false;
}
// Class file is included in Dispatcher::dispatch() function
if (!class_exists($tab, false) || !$row['id_tab'])
{
if (!class_exists($tab, false) || !$row['id_tab']) {
echo sprintf(Tools::displayError('The class %s cannot be found.'), $tab);
return false;
}
$admin_obj = new $tab;
if (!$admin_obj->viewAccess() && ($admin_obj->table != 'employee' || Context::getContext()->employee->id != Tools::getValue('id_employee') || !Tools::isSubmit('updateemployee')))
{
if (!$admin_obj->viewAccess() && ($admin_obj->table != 'employee' || Context::getContext()->employee->id != Tools::getValue('id_employee') || !Tools::isSubmit('updateemployee'))) {
$admin_obj->_errors = array(Tools::displayError('Access denied.'));
echo $admin_obj->displayErrors();
return false;
@ -285,11 +291,13 @@ function checkTabRights($id_tab)
{
static $tab_accesses = null;
if ($tab_accesses === null)
if ($tab_accesses === null) {
$tab_accesses = Profile::getProfileAccesses(Context::getContext()->employee->id_profile);
}
if (isset($tab_accesses[(int)$id_tab]['view']))
if (isset($tab_accesses[(int)$id_tab]['view'])) {
return ($tab_accesses[(int)$id_tab]['view'] === '1');
}
return false;
}
@ -335,59 +343,61 @@ function checkTabRights($id_tab)
function simpleXMLToArray($xml, $flatten_values = true, $flatten_attributes = true, $flatten_children = true, $value_key = '@value', $attributes_key = '@attributes', $children_key = '@children')
{
$return = array();
if (!($xml instanceof SimpleXMLElement))
if (!($xml instanceof SimpleXMLElement)) {
return $return;
}
$name = $xml->getName();
$value = trim((string)$xml);
if (strlen($value) == 0)
if (strlen($value) == 0) {
$value = null;
}
if ($value !== null)
{
if (!$flatten_values)
if ($value !== null) {
if (!$flatten_values) {
$return[$value_key] = $value;
else
} else {
$return = $value;
}
}
$children = array();
$first = true;
foreach ($xml->children() as $element_name => $child)
{
foreach ($xml->children() as $element_name => $child) {
$value = simpleXMLToArray($child, $flatten_values, $flatten_attributes, $flatten_children, $value_key, $attributes_key, $children_key);
if (isset($children[$element_name]))
{
if ($first)
{
if (isset($children[$element_name])) {
if ($first) {
$temp = $children[$element_name];
unset($children[$element_name]);
$children[$element_name][] = $temp;
$first = false;
}
$children[$element_name][] = $value;
}
else
} else {
$children[$element_name] = $value;
}
}
if (count($children) > 0)
{
if (!$flatten_children)
if (count($children) > 0) {
if (!$flatten_children) {
$return[$children_key] = $children;
else
} else {
$return = array_merge($return, $children);
}
}
$attributes = array();
foreach ($xml->attributes() as $name => $value)
foreach ($xml->attributes() as $name => $value) {
$attributes[$name] = trim($value);
}
if (count($attributes) > 0)
if (!$flatten_attributes)
if (count($attributes) > 0) {
if (!$flatten_attributes) {
$return[$attributes_key] = $attributes;
else
} else {
$return = array_merge($return, $attributes);
}
}
return $return;
}
@ -403,137 +413,135 @@ function runAdminTab($tab, $ajax_mode = false)
require_once(_PS_ADMIN_DIR_.'/init.php');
$cookie = Context::getContext()->cookie;
if (empty($tab) && !count($_POST))
{
if (empty($tab) && !count($_POST)) {
$tab = 'AdminDashboard';
$_POST['tab'] = $tab;
$_POST['token'] = Tools::getAdminTokenLite($tab);
}
// $tab = $_REQUEST['tab'];
if ($admin_obj = checkingTab($tab))
{
if ($admin_obj = checkingTab($tab)) {
Context::getContext()->controller = $admin_obj;
// init is different for new tabs (AdminController) and old tabs (AdminTab)
if ($admin_obj instanceof AdminController)
{
if ($ajax_mode)
if ($admin_obj instanceof AdminController) {
if ($ajax_mode) {
$admin_obj->ajax = true;
}
$admin_obj->path = dirname($_SERVER['PHP_SELF']);
$admin_obj->run();
}
else
{
if (!$ajax_mode)
} else {
if (!$ajax_mode) {
require_once(_PS_ADMIN_DIR_.'/header.inc.php');
}
$iso_user = Context::getContext()->language->id;
$tabs = array();
$tabs = Tab::recursiveTab($admin_obj->id, $tabs);
$tabs = array_reverse($tabs);
$bread = '';
foreach ($tabs as $key => $item)
{
foreach ($tabs as $key => $item) {
$bread .= ' <img src="../img/admin/separator_breadcrumb.png" style="margin-right:5px" alt="&gt;" />';
if (count($tabs) - 1 > $key)
if (count($tabs) - 1 > $key) {
$bread .= '<a href="?tab='.$item['class_name'].'&token='.Tools::getAdminToken($item['class_name'].(int)$item['id_tab'].(int)Context::getContext()->employee->id).'">';
}
$bread .= $item['name'];
if (count($tabs) - 1 > $key)
if (count($tabs) - 1 > $key) {
$bread .= '</a>';
}
}
if (!$ajax_mode && Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL && Context::getContext()->controller->multishop_context != Shop::CONTEXT_ALL)
{
if (!$ajax_mode && Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL && Context::getContext()->controller->multishop_context != Shop::CONTEXT_ALL) {
echo '<div class="multishop_info">';
if (Shop::getContext() == Shop::CONTEXT_GROUP)
{
if (Shop::getContext() == Shop::CONTEXT_GROUP) {
$shop_group = new ShopGroup((int)Shop::getContextShopGroupID());
printf(Translate::getAdminTranslation('You are configuring your store for group shop %s'), '<b>'.$shop_group->name.'</b>');
}
elseif (Shop::getContext() == Shop::CONTEXT_SHOP)
} elseif (Shop::getContext() == Shop::CONTEXT_SHOP) {
printf(Translate::getAdminTranslation('You are configuring your store for shop %s'), '<b>'.Context::getContext()->shop->name.'</b>');
}
echo '</div>';
}
if (Validate::isLoadedObject($admin_obj))
{
if ($admin_obj->checkToken())
{
if ($ajax_mode)
{
if (Validate::isLoadedObject($admin_obj)) {
if ($admin_obj->checkToken()) {
if ($ajax_mode) {
// the differences with index.php is here
$admin_obj->ajaxPreProcess();
$action = Tools::getValue('action');
// no need to use displayConf() here
if (!empty($action) && method_exists($admin_obj, 'ajaxProcess'.Tools::toCamelCase($action)))
if (!empty($action) && method_exists($admin_obj, 'ajaxProcess'.Tools::toCamelCase($action))) {
$admin_obj->{'ajaxProcess'.Tools::toCamelCase($action)}();
else
} else {
$admin_obj->ajaxProcess();
}
// @TODO We should use a displayAjaxError
$admin_obj->displayErrors();
if (!empty($action) && method_exists($admin_obj, 'displayAjax'.Tools::toCamelCase($action)))
if (!empty($action) && method_exists($admin_obj, 'displayAjax'.Tools::toCamelCase($action))) {
$admin_obj->{'displayAjax'.$action}();
else
} else {
$admin_obj->displayAjax();
}
else
{
} else {
/* Filter memorization */
if (isset($_POST) && !empty($_POST) && isset($admin_obj->table))
foreach ($_POST as $key => $value)
if (is_array($admin_obj->table))
{
foreach ($admin_obj->table as $table)
if (strncmp($key, $table.'Filter_', 7) === 0 || strncmp($key, 'submitFilter', 12) === 0)
if (isset($_POST) && !empty($_POST) && isset($admin_obj->table)) {
foreach ($_POST as $key => $value) {
if (is_array($admin_obj->table)) {
foreach ($admin_obj->table as $table) {
if (strncmp($key, $table.'Filter_', 7) === 0 || strncmp($key, 'submitFilter', 12) === 0) {
$cookie->$key = !is_array($value) ? $value : serialize($value);
}
elseif (strncmp($key, $admin_obj->table.'Filter_', 7) === 0 || strncmp($key, 'submitFilter', 12) === 0)
}
} elseif (strncmp($key, $admin_obj->table.'Filter_', 7) === 0 || strncmp($key, 'submitFilter', 12) === 0) {
$cookie->$key = !is_array($value) ? $value : serialize($value);
}
}
}
if (isset($_GET) && !empty($_GET) && isset($admin_obj->table))
foreach ($_GET as $key => $value)
if (is_array($admin_obj->table))
{
foreach ($admin_obj->table as $table)
if (strncmp($key, $table.'OrderBy', 7) === 0 || strncmp($key, $table.'Orderway', 8) === 0)
if (isset($_GET) && !empty($_GET) && isset($admin_obj->table)) {
foreach ($_GET as $key => $value) {
if (is_array($admin_obj->table)) {
foreach ($admin_obj->table as $table) {
if (strncmp($key, $table.'OrderBy', 7) === 0 || strncmp($key, $table.'Orderway', 8) === 0) {
$cookie->$key = $value;
}
elseif (strncmp($key, $admin_obj->table.'OrderBy', 7) === 0 || strncmp($key, $admin_obj->table.'Orderway', 12) === 0)
}
} elseif (strncmp($key, $admin_obj->table.'OrderBy', 7) === 0 || strncmp($key, $admin_obj->table.'Orderway', 12) === 0) {
$cookie->$key = $value;
}
}
}
$admin_obj->displayConf();
$admin_obj->postProcess();
$admin_obj->displayErrors();
$admin_obj->display();
include(_PS_ADMIN_DIR_.'/footer.inc.php');
}
}
else
{
if ($ajax_mode)
{
} else {
if ($ajax_mode) {
// If this is an XSS attempt, then we should only display a simple, secure page
if (ob_get_level() && ob_get_length() > 0)
if (ob_get_level() && ob_get_length() > 0) {
ob_clean();
}
// ${1} in the replacement string of the regexp is required, because the token may begin with a number and mix up with it (e.g. $17)
$url = preg_replace('/([&?]token=)[^&]*(&.*)?$/', '${1}'.$admin_obj->token.'$2', $_SERVER['REQUEST_URI']);
if (false === strpos($url, '?token=') && false === strpos($url, '&token='))
if (false === strpos($url, '?token=') && false === strpos($url, '&token=')) {
$url .= '&token='.$admin_obj->token;
}
// we can display the correct url
// die(Tools::jsonEncode(array(Translate::getAdminTranslation('Invalid security token'),$url)));
die(Tools::jsonEncode(Translate::getAdminTranslation('Invalid security token')));
}
else
{
} else {
// If this is an XSS attempt, then we should only display a simple, secure page
if (ob_get_level() && ob_get_length() > 0)
if (ob_get_level() && ob_get_length() > 0) {
ob_clean();
}
// ${1} in the replacement string of the regexp is required, because the token may begin with a number and mix up with it (e.g. $17)
$url = preg_replace('/([&?]token=)[^&]*(&.*)?$/', '${1}'.$admin_obj->token.'$2', $_SERVER['REQUEST_URI']);
if (false === strpos($url, '?token=') && false === strpos($url, '&token='))
if (false === strpos($url, '?token=') && false === strpos($url, '&token=')) {
$url .= '&token='.$admin_obj->token;
}
$message = Translate::getAdminTranslation('Invalid security token');
echo '<html><head><title>'.$message.'</title></head><body style="font-family:Arial,Verdana,Helvetica,sans-serif;background-color:#EC8686">

View File

@ -24,7 +24,8 @@
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_ADMIN_DIR_'))
if (!defined('_PS_ADMIN_DIR_')) {
define('_PS_ADMIN_DIR_', getcwd());
}
require(_PS_ADMIN_DIR_.'/../config/config.inc.php');
Controller::getController('GetFileController')->run();

View File

@ -24,8 +24,9 @@
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_ADMIN_DIR_'))
if (!defined('_PS_ADMIN_DIR_')) {
define('_PS_ADMIN_DIR_', getcwd());
}
include_once(_PS_ADMIN_DIR_.'/../config/config.inc.php');
$module = Tools::getValue('module');
@ -42,40 +43,35 @@ $id_employee = (int)(Tools::getValue('id_employee'));
$id_lang = (int)(Tools::getValue('id_lang'));
if (!isset($cookie->id_employee) || !$cookie->id_employee || $cookie->id_employee != $id_employee)
if (!isset($cookie->id_employee) || !$cookie->id_employee || $cookie->id_employee != $id_employee) {
die(Tools::displayError());
}
if (!Validate::isModuleName($module))
if (!Validate::isModuleName($module)) {
die(Tools::displayError());
}
if (!Tools::file_exists_cache($module_path = _PS_ROOT_DIR_.'/modules/'.$module.'/'.$module.'.php'))
if (!Tools::file_exists_cache($module_path = _PS_ROOT_DIR_.'/modules/'.$module.'/'.$module.'.php')) {
die(Tools::displayError());
}
$shop_id = '';
Shop::setContext(Shop::CONTEXT_ALL);
if (Context::getContext()->cookie->shopContext)
{
if (Context::getContext()->cookie->shopContext) {
$split = explode('-', Context::getContext()->cookie->shopContext);
if (count($split) == 2)
{
if ($split[0] == 'g')
{
if (Context::getContext()->employee->hasAuthOnShopGroup($split[1]))
if (count($split) == 2) {
if ($split[0] == 'g') {
if (Context::getContext()->employee->hasAuthOnShopGroup($split[1])) {
Shop::setContext(Shop::CONTEXT_GROUP, $split[1]);
else
{
} else {
$shop_id = Context::getContext()->employee->getDefaultShopID();
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
}
else if (Shop::getShop($split[1]) && Context::getContext()->employee->hasAuthOnShop($split[1]))
{
} elseif (Shop::getShop($split[1]) && Context::getContext()->employee->hasAuthOnShop($split[1])) {
$shop_id = $split[1];
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
else
{
} else {
$shop_id = Context::getContext()->employee->getDefaultShopID();
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
@ -83,19 +79,21 @@ if (Context::getContext()->cookie->shopContext)
}
// Check multishop context and set right context if need
if (Shop::getContext())
{
if (Shop::getContext() == Shop::CONTEXT_SHOP && !Shop::CONTEXT_SHOP)
if (Shop::getContext()) {
if (Shop::getContext() == Shop::CONTEXT_SHOP && !Shop::CONTEXT_SHOP) {
Shop::setContext(Shop::CONTEXT_GROUP, Shop::getContextShopGroupID());
if (Shop::getContext() == Shop::CONTEXT_GROUP && !Shop::CONTEXT_GROUP)
}
if (Shop::getContext() == Shop::CONTEXT_GROUP && !Shop::CONTEXT_GROUP) {
Shop::setContext(Shop::CONTEXT_ALL);
}
}
// Replace existing shop if necessary
if (!$shop_id)
if (!$shop_id) {
Context::getContext()->shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
elseif (Context::getContext()->shop->id != $shop_id)
} elseif (Context::getContext()->shop->id != $shop_id) {
Context::getContext()->shop = new Shop($shop_id);
}
require_once($module_path);
@ -103,8 +101,9 @@ require_once($module_path);
$grid = new $module();
$grid->setEmployee($id_employee);
$grid->setLang($id_lang);
if ($option)
if ($option) {
$grid->setOption($option);
}
$grid->create($render, $type, $width, $height, $start, $limit, $sort, $dir);
$grid->render();

View File

@ -39,6 +39,7 @@ Context::getContext()->smarty->assign(array(
'navigationPipe', Configuration::get('PS_NAVIGATION_PIPE'),
'meta_title' => implode(' '.Configuration::get('PS_NAVIGATION_PIPE').' ', $title),
'display_header' => true,
'display_header_javascript' => true,
'display_footer' => true,
));
$dir = Context::getContext()->smarty->getTemplateDir(0).'controllers'.DIRECTORY_SEPARATOR.trim($con->override_folder, '\\/').DIRECTORY_SEPARATOR;

View File

@ -25,30 +25,34 @@
*/
$timer_start = microtime(true);
if (!defined('_PS_ADMIN_DIR_'))
if (!defined('_PS_ADMIN_DIR_')) {
define('_PS_ADMIN_DIR_', getcwd());
}
if (!defined('PS_ADMIN_DIR'))
if (!defined('PS_ADMIN_DIR')) {
define('PS_ADMIN_DIR', _PS_ADMIN_DIR_);
}
require(_PS_ADMIN_DIR_.'/../config/config.inc.php');
require(_PS_ADMIN_DIR_.'/functions.php');
//small test to clear cache after upgrade
if (Configuration::get('PS_UPGRADE_CLEAR_CACHE'))
{
if (Configuration::get('PS_UPGRADE_CLEAR_CACHE')) {
header('Cache-Control: max-age=0, must-revalidate');
header('Expires: Mon, 06 Jun 1985 06:06:00 GMT+1');
Configuration::updateValue('PS_UPGRADE_CLEAR_CACHE', 0);
}
// For retrocompatibility with "tab" parameter
if (!isset($_GET['controller']) && isset($_GET['tab']))
if (!isset($_GET['controller']) && isset($_GET['tab'])) {
$_GET['controller'] = strtolower($_GET['tab']);
if (!isset($_POST['controller']) && isset($_POST['tab']))
}
if (!isset($_POST['controller']) && isset($_POST['tab'])) {
$_POST['controller'] = strtolower($_POST['tab']);
if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab']))
}
if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab'])) {
$_REQUEST['controller'] = strtolower($_REQUEST['tab']);
}
// Prepare and trigger admin dispatcher
Dispatcher::getInstance()->dispatch();

View File

@ -30,71 +30,76 @@ $timerStart = microtime(true);
// $_GET['tab'] = $_GET['controller'];
// $_POST['tab'] = $_POST['controller'];
// $_REQUEST['tab'] = $_REQUEST['controller'];
try
{
try {
$context = Context::getContext();
if (isset($_GET['logout']))
if (isset($_GET['logout'])) {
$context->employee->logout();
}
if (!isset($context->employee) || !$context->employee->isLoggedBack())
if (!isset($context->employee) || !$context->employee->isLoggedBack()) {
Tools::redirectAdmin('index.php?controller=AdminLogin&redirect='.$_SERVER['REQUEST_URI']);
}
// Set current index
// @deprecated global
global $currentIndex; // retrocompatibility;
$currentIndex = $_SERVER['SCRIPT_NAME'].(($controller = Tools::getValue('controller')) ? '?controller='.$controller: '');
if ($back = Tools::getValue('back'))
if ($back = Tools::getValue('back')) {
$currentIndex .= '&back='.urlencode($back);
}
AdminTab::$currentIndex = $currentIndex;
$iso = $context->language->iso_code;
if (file_exists(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php'))
if (file_exists(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php')) {
include(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php');
if (file_exists(_PS_TRANSLATIONS_DIR_.$iso.'/fields.php'))
}
if (file_exists(_PS_TRANSLATIONS_DIR_.$iso.'/fields.php')) {
include(_PS_TRANSLATIONS_DIR_.$iso.'/fields.php');
if (file_exists(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php'))
}
if (file_exists(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php')) {
include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
}
/* Server Params */
$protocol_link = (Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://';
$protocol_content = (isset($useSSL) AND $useSSL AND Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://';
$protocol_content = (isset($useSSL) and $useSSL and Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://';
$link = new Link($protocol_link, $protocol_content);
$context->link = $link;
if (!defined('_PS_BASE_URL_'))
if (!defined('_PS_BASE_URL_')) {
define('_PS_BASE_URL_', Tools::getShopDomain(true));
if (!defined('_PS_BASE_URL_SSL_'))
}
if (!defined('_PS_BASE_URL_SSL_')) {
define('_PS_BASE_URL_SSL_', Tools::getShopDomainSsl(true));
}
$path = dirname(__FILE__).'/themes/';
// if the current employee theme is not valid (check layout.tpl presence),
// reset to default theme
if (empty($context->employee->bo_theme) ||
!file_exists($path.$context->employee->bo_theme.'/template/layout.tpl'))
{
!file_exists($path.$context->employee->bo_theme.'/template/layout.tpl')) {
// default admin theme is "default".
$context->employee->bo_theme = '';
if (file_exists($path.'default/template/layout.tpl'))
if (file_exists($path.'default/template/layout.tpl')) {
$context->employee->bo_theme = 'default';
else
{
} else {
// if default theme doesn't exists, try to find one, otherwise throw exception
foreach (scandir($path) as $theme)
if ($theme[0] != '.' && file_exists($path.$theme.'/template/layout.tpl'))
{
foreach (scandir($path) as $theme) {
if ($theme[0] != '.' && file_exists($path.$theme.'/template/layout.tpl')) {
$context->employee->bo_theme = $theme;
break;
}
}
// if no theme is found, admin can't work.
if (empty($context->employee->bo_theme))
if (empty($context->employee->bo_theme)) {
throw new PrestaShopException('Unable to load theme for employee, and no valid theme found');
}
}
$context->employee->update();
}
// Change shop context ?
if (Shop::isFeatureActive() && Tools::getValue('setShopContext') !== false)
{
if (Shop::isFeatureActive() && Tools::getValue('setShopContext') !== false) {
$context->cookie->shopContext = Tools::getValue('setShopContext');
$url = parse_url($_SERVER['REQUEST_URI']);
$query = (isset($url['query'])) ? $url['query'] : '';
@ -106,32 +111,23 @@ try
$context->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
if ($context->employee->isLoggedBack())
{
if ($context->employee->isLoggedBack()) {
$shop_id = '';
Shop::setContext(Shop::CONTEXT_ALL);
if ($context->cookie->shopContext)
{
if ($context->cookie->shopContext) {
$split = explode('-', $context->cookie->shopContext);
if (count($split) == 2)
{
if ($split[0] == 'g')
{
if ($context->employee->hasAuthOnShopGroup($split[1]))
if (count($split) == 2) {
if ($split[0] == 'g') {
if ($context->employee->hasAuthOnShopGroup($split[1])) {
Shop::setContext(Shop::CONTEXT_GROUP, $split[1]);
else
{
} else {
$shop_id = $context->employee->getDefaultShopID();
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
}
elseif ($context->employee->hasAuthOnShop($split[1]))
{
} elseif ($context->employee->hasAuthOnShop($split[1])) {
$shop_id = $split[1];
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
else
{
} else {
$shop_id = $context->employee->getDefaultShopID();
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
@ -139,13 +135,12 @@ try
}
// Replace existing shop if necessary
if (!$shop_id)
if (!$shop_id) {
$context->shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
else if ($context->shop->id != $shop_id)
} elseif ($context->shop->id != $shop_id) {
$context->shop = new Shop($shop_id);
}
}
catch(PrestaShopException $e)
{
} catch (PrestaShopException $e) {
$e->displayMessage();
}

View File

@ -24,8 +24,9 @@
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_ADMIN_DIR_'))
if (!defined('_PS_ADMIN_DIR_')) {
define('_PS_ADMIN_DIR_', getcwd());
}
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
/**
@ -34,8 +35,9 @@ include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
*/
Tools::displayFileAsDeprecated();
if (!Context::getContext()->employee->id)
if (!Context::getContext()->employee->id) {
Tools::redirectAdmin('index.php?controller=AdminLogin');
}
$function_array = array(
'pdf' => 'generateInvoicePDF',
@ -50,11 +52,11 @@ $function_array = array(
);
$pdf_controller = new AdminPdfController();
foreach ($function_array as $var => $function)
if (isset($_GET[$var]))
{
foreach ($function_array as $var => $function) {
if (isset($_GET[$var])) {
$pdf_controller->{'process'.$function}();
exit;
}
}
exit;

View File

@ -24,19 +24,23 @@
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_ADMIN_DIR_'))
if (!defined('_PS_ADMIN_DIR_')) {
define('_PS_ADMIN_DIR_', getcwd());
}
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
if (!Tools::getValue('id_shop'))
if (!Tools::getValue('id_shop')) {
Context::getContext()->shop->setContext(Shop::CONTEXT_ALL);
else
} else {
Context::getContext()->shop->setContext(Shop::CONTEXT_SHOP, (int)Tools::getValue('id_shop'));
}
if (substr(_COOKIE_KEY_, 34, 8) != Tools::getValue('token'))
if (substr(_COOKIE_KEY_, 34, 8) != Tools::getValue('token')) {
die;
}
ini_set('max_execution_time', 7200);
Search::indexation(Tools::getValue('full'));
if (Tools::getValue('redirect'))
if (Tools::getValue('redirect')) {
Tools::redirectAdmin($_SERVER['HTTP_REFERER'].'&conf=4');
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,33 +1,2 @@
/* This stylesheet should be used to add your custom styles to the back-office without using the Sass sources. It will be loaded after all the default styles.
You should NOT edit any other exisiting back-office CSS file manually: they are generated by the Sass preprocessor: http://www.sass-lang.com/ . */
.defaultForm .result {}
.defaultForm .result li {
list-style: none;
padding: 5px 10px;
}
.defaultForm .result li span {
margin-left: 10px;
}
.defaultForm .searchResult {
padding: 0;
position: absolute;
width: 50%;
z-index: 3;
}
.defaultForm .searchResult ul {
background: #fff;
border-radius: 5px;
margin: 0px;
padding: 0;
border:1px solid #ccc;
}
.defaultForm .searchResult ul li {
cursor: pointer;
list-style-type: none;
margin: 0;
padding: 5px 10px;
}
.defaultForm .searchResult ul li:hover {
background: #f1f1f1;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -160,11 +160,6 @@ $(document).ready(function() {
$('.page-head .breadcrumb').css('left', '70px');
$('.page-head .page-subtitle').css('left', '70px');
} else {
menuCollapse.css('margin-left', '');
$('.page-head .page-title').css('padding-left', '230px');
$('.page-head .breadcrumb').css('left', '230px');
$('.page-head .page-subtitle').css('left', '230px');
}
}

View File

@ -13,6 +13,7 @@ Tree.prototype =
{
var that = $(this);
var name = this.$element.parent().find('ul.tree input').first().attr('name');
var idTree = this.$element.parent().find('.cattree.tree').first().attr('id');
this.$element.find("label.tree-toggler, .icon-folder-close, .icon-folder-open").unbind('click');
this.$element.find("label.tree-toggler, .icon-folder-close, .icon-folder-open").click(
function ()
@ -95,17 +96,10 @@ Tree.prototype =
}
});
}
if (name != 'id_parent')
if (typeof(treeClickFunc) != 'undefined')
{
this.$element.find(":input[type=radio]").unbind('click');
this.$element.find(":input[type=radio]").click(
function()
{
location.href = location.href.replace(
/&id_category=[0-9]*/, "")+"&id_category="
+$(this).val();
}
);
this.$element.find(":input[type=radio]").click(treeClickFunc);
}
}
@ -144,7 +138,8 @@ Tree.prototype =
expandAll : function($speed)
{
if (typeof(idTree) != 'undefined' && typeof(full_loaded) == 'undefined')
var idTree = this.$element.parent().find('.cattree.tree').first().attr('id');
if (typeof(idTree) != 'undefined' && !$('#'+idTree).hasClass('full_loaded'))
{
var selected = [];
that = this;
@ -154,13 +149,14 @@ Tree.prototype =
selected.push($(this).val());
}
);
var name = $('#'+idTree).parent().find('ul.tree input').first().attr('name');
var inputType = $('#'+idTree).parent().find('ul.tree input').first().attr('type');
var name = $('#'+idTree).find('ul.tree input').first().attr('name');
var inputType = $('#'+idTree).find('ul.tree input').first().attr('type');
var useCheckBox = 0;
if (inputType == 'checkbox')
{
useCheckBox = 1;
}
$.get(
'ajax-tab.php',
{controller:'AdminProducts',token:currentToken,action:'getCategoryTree',type:idTree,fullTree:1,selected:selected, inputName:name,useCheckBox:useCheckBox},
@ -175,7 +171,7 @@ Tree.prototype =
.removeClass("icon-folder-close")
.addClass("icon-folder-open");
$(this).parent().parent().children("ul.tree").show($speed);
full_loaded = true;
$('#'+idTree).addClass('full_loaded');
}
);
}

View File

@ -148,6 +148,8 @@
dd.data_value
color: #aaa
@extend .clearfix
small
font-size: 0.5em
dd.dash_trend
background-color: white
width: 80px

View File

@ -20,7 +20,7 @@ $chosen-focus-box-shadow: 0 1px 1px rgba(0, 0, 0, .075) inset, 0 0 8px rgba(82,
$chosen-focus-transition: border linear .2s, box-shadow linear .2s
$chosen-height: $input-height-base
$chosen-multi-height: $input-height-base + 6px
$chosen-sprite-path: 'chosen-sprite.png'
$chosen-sprite-path: '../img/chosen-sprite.png'
.chosen-select
width: 100%

View File

@ -33,6 +33,8 @@
border-color: darken(#CAE5F4,10%)
input, select
margin: 0
&.center
margin: 0 auto
tbody
> tr > td
border-top: none
@ -153,9 +155,22 @@ tr.highlighted td
table, thead, tbody, th, td, tr
display: block
thead tr
position: absolute
top: -9999px
left: -9999px
display: block
float: left
width: 70%
&:first-child
width: 30%
th
width: 100% !important
&:first-child:last-child
display: none
th
height: 48px
text-align: center
th .fixed-width-md
float: left
th .fixed-width-sm
width: 100% !important
tr
border: 1px solid #ccc
@include box-shadow(#EAEDEF 0 2px 0 0 )

View File

@ -371,6 +371,13 @@ if (secs < 10)
secs = "0" + secs;
$('.datepicker').datetimepicker({
beforeShow: function (input, inst) {
setTimeout(function () {
inst.dpDiv.css({
'z-index': 1031
});
}, 0);
},
prevText: '',
nextText: '',
dateFormat: 'yy-mm-dd',

View File

@ -14,7 +14,7 @@
<input class="form-control" type="text" name="product_rule_group_{$product_rule_group_id|intval}_quantity" value="{$product_rule_group_quantity|intval}" />
</div>
<div class="col-lg-7">
<p class="form-control-static">{l s='product(s) matching the following rules:'}</p>
<label class="control-label pull-left">{l s='product(s) matching the following rules:'}</label>
</div>
</div>

View File

@ -151,7 +151,7 @@
else
$('#message_forward_email').hide(200);
});
$('teaxtrea[name=message_forward]').click(function(){
$('textarea[name=message_forward]').click(function(){
if($(this).val() == '{l s='You can add a comment here.'}')
{
$(this).val('');

View File

@ -420,6 +420,8 @@
<th><span class="title_box">{l s='Code'}</span></th>
<th><span class="title_box">{l s='Name'}</span></th>
<th><span class="title_box">{l s='Status'}</span></th>
<th><span class="title_box">{l s='Qty available'}</span></th>
<th><span class="title_box">{l s='Actions'}</span></th>
<tr/>
</thead>
<tbody>
@ -430,16 +432,17 @@
<td>{$discount['name']}</td>
<td>
{if $discount['active']}
<i class="icon-ok"></i>
<i class="icon-check"></i>
{else}
<i class="icon-remove"></i>
{/if}
</td>
<td>{if $discount['quantity'] > 0}{$discount['quantity_for_user']|intval}{else}0{/if}</td>
<td>
<a href="?tab=AdminCartRules&amp;id_cart_rule={$discount['id_cart_rule']}&amp;addcart_rule&amp;token={getAdminToken tab='AdminCartRules'}">
<a href="?tab=AdminCartRules&amp;id_cart_rule={$discount['id_cart_rule']|intval}&amp;addcart_rule&amp;token={getAdminToken tab='AdminCartRules'}">
<i class="icon-pencil"></i>
</a>
<a href="?tab=AdminCartRules&amp;id_cart_rule={$discount['id_cart_rule']}&amp;deletecart_rule&amp;token={getAdminToken tab='AdminCartRules'}">
<a href="?tab=AdminCartRules&amp;id_cart_rule={$discount['id_cart_rule']|intval}&amp;deletecart_rule&amp;token={getAdminToken tab='AdminCartRules'}">
<i class="icon-remove"></i>
</a>
</td>
@ -617,7 +620,7 @@
</td>
<td class="text-right">
<div class="btn-group">
<a class="btn btn-default" href="?tab=AdminAddresses&amp;id_address={$address['id_address']}&amp;addaddress=1&amp;token={getAdminToken tab='AdminAddresses'}">
<a class="btn btn-default" href="?tab=AdminAddresses&amp;id_address={$address['id_address']}&amp;addaddress=1&amp;token={getAdminToken tab='AdminAddresses'}&amp;back={$smarty.server.REQUEST_URI|urlencode}">
<i class="icon-edit"></i> {l s='Edit'}
</a>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
@ -625,7 +628,7 @@
</button>
<ul class="dropdown-menu">
<li>
<a href="?tab=AdminAddresses&amp;id_address={$address['id_address']}&amp;deleteaddress&amp;token={getAdminToken tab='AdminAddresses'}">
<a href="?tab=AdminAddresses&amp;id_address={$address['id_address']}&amp;deleteaddress&amp;token={getAdminToken tab='AdminAddresses'}&amp;back={$smarty.server.REQUEST_URI|urlencode}">
<i class="icon-trash"></i>
{l s='Delete'}
</a>

View File

@ -25,14 +25,13 @@
<div class="panel">
{if isset($header)}{$header}{/if}
{if isset($nodes)}
<ul id="{$id|escape:'html':'UTF-8'}" class="tree">
<ul id="{$id|escape:'html':'UTF-8'}" class="cattree tree">
{$nodes}
</ul>
{/if}
</div>
<script type="text/javascript">
var currentToken="{$token|@addslashes}";
var idTree="{$id|escape:'html':'UTF-8'}";
{if isset($use_checkbox) && $use_checkbox == true}
function checkAllAssociatedCategories($tree)
{

View File

@ -23,9 +23,9 @@
* International Registered Trademark & Property of PrestaShop SA
*}
<li class="tree-item{if isset($node['disabled']) && $node['disabled'] == true} tree-item-disable{/if}">
<label class="tree-item-name">
<span class="tree-item-name">
<input type="radio" name="id_category" value="{$node['id_category']}"{if isset($node['disabled']) && $node['disabled'] == true} disabled="disabled"{/if} />
<i class="tree-dot"></i>
{$node['name']}
</label>
<label class="tree-toggler">{$node['name']}</label>
</span>
</li>

View File

@ -42,7 +42,7 @@
{/if}
</td>
<td class="fixed-width-xs">
<img width="32" alt="{$module->displayName|escape:'html':'UTF-8'}" title="{$module->displayName|escape:'html':'UTF-8'}" src="{if isset($module->image)}{$module->image}{else}{$modules_uri}/{$module->name}/{$module->logo}{/if}" />
<img width="57" alt="{$module->displayName|escape:'html':'UTF-8'}" title="{$module->displayName|escape:'html':'UTF-8'}" src="{if isset($module->image)}{$module->image}{else}{$modules_uri}/{$module->name}/{$module->logo}{/if}" />
</td>
<td>
<div id="anchor{$module->name|ucfirst}" title="{$module->displayName|escape:'html':'UTF-8'}">
@ -81,7 +81,7 @@
<div class="btn-group pull-right">
{if isset($module->type) && $module->type == 'addonsMustHave'}
<a class="btn btn-default _blank" href="{$module->addons_buy_url|replace:' ':'+'|escape:'html':'UTF-8'}">
<i class="icon-shopping-cart"></i> &nbsp;{if $module->price|floatval == 0}{l s='Free'}{elseif isset($module->id_currency) && isset($module->price)}{displayPrice price=$module->price currency=$module->id_currency}{/if}
<i class="icon-shopping-cart"></i> &nbsp;{if isset($module->price)}{if $module->price|floatval == 0}{l s='Free'}{elseif isset($module->id_currency)}{displayPrice price=$module->price currency=$module->id_currency}{/if}{/if}
</a>
{else}
{if isset($module->id) && $module->id gt 0}

View File

@ -43,7 +43,7 @@
{/foreach}
{assign var='modules' value=$modules|substr:0:-1}
<li>
<a id="desc-module-update-all" class="toolbar_btn" href="{$currentIndex|escape:'html':'UTF-8'}&amp;token={$token|escape:'html':'UTF-8'}&amp;update={$modules|urlencode}" title="{l s='Update all'}">
<a id="desc-module-update-all" class="toolbar_btn" href="{$currentIndex|escape:'html':'UTF-8'}&amp;token={$token|escape:'html':'UTF-8'}&amp;updateAll=1" title="{l s='Update all'}">
<i class="process-icon-refresh"></i>
<div>{l s='Update all'}</div>
</a>

View File

@ -27,7 +27,13 @@
<img src="{$image}" alt="{$displayName}" class="img-thumbnail" />
{if isset($badges)}
{foreach $badges as $badge}
{if is_array($badge)}
{foreach $badge as $_badge}
<img src="{$_badge}" alt="" class="clearfix quickview-badge" />
{/foreach}
{else}
<img src="{$badge}" alt="" class="clearfix quickview-badge" />
{/if}
{/foreach}
{/if}
</div>

View File

@ -62,7 +62,7 @@
<p>
<a href="{$module->addons_buy_url|replace:' ':'+'|escape:'html':'UTF-8'}" class="button updated _blank">
<span class="btn btn-default">
<i class="icon-shopping-cart"></i>{if $module->price|floatval == 0}{l s='Free'}{elseif isset($module->price) && isset($module->id_currency)} &nbsp;&nbsp;{displayPrice price=$module->price currency=$module->id_currency}{/if}
<i class="icon-shopping-cart"></i>{if isset($module->price)}{if $module->price|floatval == 0}{l s='Free'}{elseif isset($module->id_currency)} &nbsp;&nbsp;{displayPrice price=$module->price currency=$module->id_currency}{/if}{/if}
</span>
</a>
</p>

View File

@ -50,7 +50,7 @@
<div class="form-group">
<label class="control-label col-lg-3 required"> {l s='Transplant to'}</label>
<div class="col-lg-9">
<select name="id_hook" disabled="disabled">
<select name="id_hook"{if !$hooks|@count} disabled="disabled"{/if}>
{if !$hooks}
<option value="0">{l s='Select a module above before choosing from available hooks'}</option>
{else}

View File

@ -51,7 +51,7 @@
<div class="input-group">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax excl.'}</div>{/if}
<input type="text" name="product_price_tax_excl" class="edit_product_price_tax_excl edit_product_price" value="{Tools::ps_round($product['unit_price_tax_excl'], 2)}" size="5" />
{if !$currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax excl.'}</div>{/if}
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign} {l s='tax excl.'}</div>{/if}
</div>
</div>
<br/>
@ -59,7 +59,7 @@
<div class="input-group">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax incl.'}</div>{/if}
<input type="text" name="product_price_tax_incl" class="edit_product_price_tax_incl edit_product_price" value="{Tools::ps_round($product['unit_price_tax_incl'], 2)}" size="5" />
{if !$currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax incl.'}</div>{/if}
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign} {l s='tax incl.'}</div>{/if}
</div>
</div>
</div>
@ -216,7 +216,7 @@
<div class="input-group">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign}</div>{/if}
<input onchange="checkPartialRefundProductAmount(this)" type="text" name="partialRefundProduct[{$product['id_order_detail']|intval}]" />
{if !$currency->format % 2}<div class="input-group-addon">{$currency->sign}</div>{/if}
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign}</div>{/if}
</div>
<p class="help-block"><i class="icon-warning-sign"></i> {l s='(Max %s %s)' sprintf=[Tools::displayPrice(Tools::ps_round($amount_refundable, 2), $currency->id), $smarty.capture.TaxMethod]}</p>
</div>

View File

@ -50,20 +50,17 @@
<td style="display:none;">
<div class="row">
<div class="input-group fixed-width-xl">
<div class="input-group-addon">
{$currency->sign}
{l s='tax excl.'}
</div>
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax excl.'}</div>{/if}
<input type="text" name="add_product[product_price_tax_excl]" id="add_product_product_price_tax_excl" value="" disabled="disabled" />
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign} {l s='tax excl.'}</div>{/if}
</div>
</div>
<br/>
<div class="row">
<div class="input-group fixed-width-xl">
<div class="input-group-addon">
{$currency->sign}
{l s='tax incl.'}
</div>
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax incl.'}</div>{/if}
<input type="text" name="add_product[product_price_tax_incl]" id="add_product_product_price_tax_incl" value="" disabled="disabled" />
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign} {l s='tax incl.'}</div>{/if}
</div>
</div>
</td>

View File

@ -55,7 +55,7 @@
<div class="input-group">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax excl.'}</div>{/if}
<input type="text" name="product_price_tax_excl" class="edit_product_price_tax_excl edit_product_price" value="{Tools::ps_round($product['unit_price_tax_excl'], 2)}"/>
{if !$currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax excl.'}</div>{/if}
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign} {l s='tax excl.'}</div>{/if}
</div>
</div>
<br/>
@ -63,7 +63,7 @@
<div class="input-group">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax incl.'}</div>{/if}
<input type="text" name="product_price_tax_incl" class="edit_product_price_tax_incl edit_product_price" value="{Tools::ps_round($product['unit_price_tax_incl'], 2)}"/>
{if !$currency->format % 2}<div class="input-group-addon">{$currency->sign} {l s='tax incl.'}</div>{/if}
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign} {l s='tax incl.'}</div>{/if}
</div>
</div>
</div>
@ -183,7 +183,7 @@
<div class="input-group">
{if $currency->format % 2}<div class="input-group-addon">{$currency->sign}</div>{/if}
<input onchange="checkPartialRefundProductAmount(this)" type="text" name="partialRefundProduct[{$product['id_order_detail']}]" />
{if !$currency->format % 2}<div class="input-group-addon">{$currency->sign}</div>{/if}
{if !($currency->format % 2)}<div class="input-group-addon">{$currency->sign}</div>{/if}
</div>
<p class="help-block"><i class="icon-warning-sign"></i> {l s='(Max %s %s)' sprintf=[Tools::displayPrice(Tools::ps_round($amount_refundable, 2), $currency->id) , $smarty.capture.TaxMethod]}</p>
</div>

View File

@ -588,7 +588,7 @@
{if ($customer->isGuest())}
{l s='This order has been placed by a guest.'}
{if (!Customer::customerExists($customer->email))}
<form method="post" action="index.php?tab=AdminCustomers&amp;id_customer={$customer->id}&amp;token={getAdminToken tab='AdminCustomers'}">
<form method="post" action="index.php?tab=AdminCustomers&amp;id_customer={$customer->id}&amp;id_order={$order->id|intval}&amp;token={getAdminToken tab='AdminCustomers'}">
<input type="hidden" name="id_lang" value="{$order->id_lang}" />
<input class="btn btn-default" type="submit" name="submitGuestToCustomer" value="{l s='Transform a guest into a customer'}" />
<p class="help-block">{l s='This feature will generate a random password and send an email to the customer.'}</p>
@ -1351,21 +1351,22 @@
}
});
var date = new Date();
var hours = date.getHours();
if (hours < 10)
hours = "0" + hours;
var mins = date.getMinutes();
if (mins < 10)
mins = "0" + mins;
var secs = date.getSeconds();
if (secs < 10)
secs = "0" + secs;
$('.datepicker').datetimepicker({
prevText: '',
nextText: '',
dateFormat: 'yy-mm-dd ' + hours + ':' + mins + ':' + secs
dateFormat: 'yy-mm-dd',
// Define a custom regional settings in order to use PrestaShop translation tools
currentText: '{l s='Now' js=1}',
closeText: '{l s='Done' js=1}',
ampm: false,
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
timeFormat: 'hh:mm:ss tt',
timeSuffix: '',
timeOnlyTitle: '{l s='Choose Time' js=1}',
timeText: '{l s='Time' js=1}',
hourText: '{l s='Hour' js=1}',
minuteText: '{l s='Minute' js=1}'
});
});

View File

@ -175,6 +175,7 @@
$('#testMemcachedServer').click(function() {
var host = $('input:text[name=memcachedIp]').val();
var port = $('input:text[name=memcachedPort]').val();
var type = $('input[name="caching_system"]:radio:checked').val() == 'CacheMemcached' ? 'memcached' : 'memcache';
if (host && port)
{
$.ajax({
@ -186,6 +187,7 @@
action: 'test_server',
sHost: host,
sPort: port,
type: type,
ajax: true
},
context: document.body,

View File

@ -31,8 +31,8 @@
{assign var=imploded_selected_categories value='","'|implode:$selected_categories}
var selected_categories = new Array("{$imploded_selected_categories}");
$('#'+idTree).tree('collapseAll');
$('#'+idTree).find(":input").each(
$('#{$id_tree}').tree('collapseAll');
$('#{$id_tree}').find(":input").each(
function()
{
if ($.inArray($(this).val(), selected_categories) != -1)

View File

@ -25,14 +25,26 @@
<div class="panel">
{if isset($header)}{$header}{/if}
{if isset($nodes)}
<ul id="{$id|escape:'html':'UTF-8'}" class="tree">
<ul id="{$id|escape:'html':'UTF-8'}" class="cattree tree">
{$nodes}
</ul>
{/if}
</div>
<script type="text/javascript">
var currentToken="{$token|@addslashes}";
var idTree="{$id|escape:'html':'UTF-8'}";
var treeClickFunc = function() {
var loc = location.href;
if (loc.indexOf("&id_category") !== -1) {
loc = location.href.replace(
/&id_category=[0-9]*/, "&id_category="
+ $(this).val());
}
else {
loc = location.href + "&id_category="
+ $(this).val();
}
location.href = loc;
};
function addDefaultCategory(elem)
{
$('select#id_category_default').append('<option value="' + elem.val()+'">' + (elem.val() !=1 ? elem.parent().find('label').html() : home) + '</option>');
@ -121,9 +133,7 @@
{/if}
$(document).ready(function(){
$('#{$id|escape:'html':'UTF-8'}').tree('collapseAll');
$('#{$id|escape:'html':'UTF-8'}').find(':input[type=radio]').click(function(){
location.href = location.href.replace(/&id_category=[0-9]*/, '') + '&id_category=' + $(this).val();
});
$('#{$id|escape:'html':'UTF-8'}').find(':input[type=radio]').click(treeClickFunc);
{if isset($selected_categories)}
$('#no_default_category').hide();

View File

@ -26,7 +26,7 @@
{if isset($header)}{$header}{/if}
<div id="block_category_tree"{if !$is_category_filter} style="display:none"{/if}>
{if isset($nodes)}
<ul id="{$id|escape:'html':'UTF-8'}" class="tree">
<ul id="{$id|escape:'html':'UTF-8'}" class="cattree tree">
{$nodes}
</ul>
{/if}
@ -34,7 +34,19 @@
</div>
<script type="text/javascript">
var currentToken="{$token|@addslashes}";
var idTree="{$id|escape:'html':'UTF-8'}";
var treeClickFunc = function() {
var loc = location.href;
if (loc.indexOf("&id_category") !== -1) {
loc = location.href.replace(
/&id_category=[0-9]*/, "&id_category="
+ $(this).val());
}
else {
loc = location.href + "&id_category="
+ $(this).val();
}
location.href = loc;
};
{if isset($use_checkbox) && $use_checkbox == true}
function checkAllAssociatedCategories($tree)
{
@ -93,14 +105,7 @@
});
$('#collapse-all-{$id|escape:'html':'UTF-8'}').hide();
$("#{$id|escape:'html':'UTF-8'}").find(":input[type=radio]").click(
function()
{
location.href = location.href.replace(
/&id_category=[0-9]*/, "")+"&id_category="
+$(this).val();
}
);
$("#{$id|escape:'html':'UTF-8'}").find(":input[type=radio]").click(treeClickFunc);
{if isset($selected_categories)}
{assign var=imploded_selected_categories value='","'|implode:$selected_categories}

View File

@ -467,7 +467,7 @@ $(document).ready(function () {
timeOnlyTitle: '{l s='Choose Time' js=1}',
timeText: '{l s='Time' js=1}',
hourText: '{l s='Hour' js=1}',
minuteText: '{l s='Minute' js=1}',
minuteText: '{l s='Minute' js=1}'
});
$('#sp_reduction_type').on('change', function() {
if (this.value == 'percentage')

View File

@ -158,7 +158,7 @@
</tr>
</thead>
{foreach from=$attributes item=attribute}
<tr>
<tr{if $attribute['default_on']} class="highlighted"{/if}>
<td class="available_quantity" id="qty_{$attribute['id_product_attribute']}">
<span>{$available_quantity[$attribute['id_product_attribute']]}</span>
<input type="text" name="qty_{$attribute['id_product_attribute']}" class="fixed-width-sm" value="{$available_quantity[$attribute['id_product_attribute']]|htmlentities}"/>

View File

@ -128,7 +128,7 @@
<label class="control-label col-lg-3 required">{l s='Number of days'}</label>
<div class="col-lg-3">
<input type="text" id="virtual_product_nb_days" name="virtual_product_nb_days" value="{if !$product->productDownload->nb_days_accessible}0{else}{$product->productDownload->nb_days_accessible|htmlentities}{/if}" class="" size="4" />
<p class="help-block">{l s='Number of days this file can be accessed by customers. Set to zero for unlimited access.'})</p>
<p class="help-block">{l s='Number of days this file can be accessed by customers. Set to zero for unlimited access.'}</p>
</div>
</div>
{* Feature not implemented *}

Some files were not shown because too many files have changed in this diff Show More