// Normalize
This commit is contained in:
@@ -227,7 +227,7 @@ class AdminAccountingExportControllerCore extends AdminController
|
||||
|
||||
// Bufferize line by line and write it to the file
|
||||
// Todo :: Allow to configure the size of the buffer before flushing it
|
||||
foreach($list as $row)
|
||||
foreach ($list as $row)
|
||||
{
|
||||
$buffer = '';
|
||||
foreach ($row as $col => $val)
|
||||
|
||||
@@ -62,7 +62,7 @@ class AdminAccountingManagementControllerCore extends AdminController
|
||||
$zoneShopList = Accounting::getAccountNumberZoneShop($id_shop);
|
||||
|
||||
// Set Account number to the id_zone for the id_shop if exist
|
||||
foreach($zoneShopList as $zoneShop)
|
||||
foreach ($zoneShopList as $zoneShop)
|
||||
$shop['zones'][$zoneShop['id_zone']]['account_number'] = $zoneShop['account_number'];
|
||||
}
|
||||
|
||||
@@ -111,15 +111,15 @@ class AdminAccountingManagementControllerCore extends AdminController
|
||||
Configuration::updateValue(
|
||||
'default_account_number',
|
||||
Tools::getValue('default_account_number'),
|
||||
false, NULL,
|
||||
false, null,
|
||||
$id_shop);
|
||||
|
||||
// If zone still exist, then update the database with the new value
|
||||
if (count($zones = Zone::getZones()))
|
||||
{
|
||||
$tab = array();
|
||||
foreach($zones as $zone)
|
||||
if (($num = Tools::getValue('zone_'.$zone['id_zone'])) !== NULL)
|
||||
foreach ($zones as $zone)
|
||||
if (($num = Tools::getValue('zone_'.$zone['id_zone'])) !== null)
|
||||
$tab[] = array(
|
||||
'id_zone' => $zone['id_zone'],
|
||||
'id_shop' => $id_shop,
|
||||
|
||||
@@ -89,7 +89,7 @@ class AdminCmsContentControllerCore extends AdminController
|
||||
$cms_tabs = array('cms_category', 'cms');
|
||||
// Cleaning links
|
||||
$catBarIndex = self::$currentIndex;
|
||||
foreach ($cms_tabs AS $tab)
|
||||
foreach ($cms_tabs as $tab)
|
||||
if (Tools::getValue($tab.'Orderby') && Tools::getValue($tab.'Orderway'))
|
||||
$catBarIndex = preg_replace('/&'.$tab.'Orderby=([a-z _]*)&'.$tab.'Orderway=([a-z]*)/i', '', self::$currentIndex);
|
||||
|
||||
@@ -97,7 +97,7 @@ class AdminCmsContentControllerCore extends AdminController
|
||||
$this->adminCMS->id_cms_category = $id_cms_category;
|
||||
$this->content .= $this->adminCMS->renderList();
|
||||
$this->context->smarty->assign(array(
|
||||
'cms_breadcrumb' => getPath($catBarIndex, $id_cms_category,'','','cms'),
|
||||
'cms_breadcrumb' => getPath($catBarIndex, $id_cms_category, '', '', 'cms'),
|
||||
));
|
||||
}
|
||||
|
||||
@@ -108,11 +108,11 @@ class AdminCmsContentControllerCore extends AdminController
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (((Tools::isSubmit('submitAddcms_category') || Tools::isSubmit('submitAddcms_categoryAndStay')) && sizeof($this->adminCMSCategories->errors))
|
||||
if (((Tools::isSubmit('submitAddcms_category') || Tools::isSubmit('submitAddcms_categoryAndStay')) && count($this->adminCMSCategories->errors))
|
||||
|| isset($_GET['updatecms_category'])
|
||||
|| isset($_GET['addcms_category']))
|
||||
$this->display = 'edit_category';
|
||||
elseif (((Tools::isSubmit('submitAddcms') || Tools::isSubmit('submitAddcmsAndStay')) && sizeof($this->adminCMS->errors))
|
||||
elseif (((Tools::isSubmit('submitAddcms') || Tools::isSubmit('submitAddcmsAndStay')) && count($this->adminCMS->errors))
|
||||
|| isset($_GET['updatecms'])
|
||||
|| isset($_GET['addcms']))
|
||||
$this->display = 'edit_page';
|
||||
@@ -129,7 +129,7 @@ class AdminCmsContentControllerCore extends AdminController
|
||||
|| Tools::isSubmit('viewcms')
|
||||
|| (Tools::isSubmit('statuscms') && Tools::isSubmit('id_cms')) && (Tools::isSubmit('position') && !Tools::isSubmit('id_cms_category_to_move')))
|
||||
$this->adminCMS->postProcess();
|
||||
elseif(Tools::isSubmit('submitDelcms_category')
|
||||
elseif (Tools::isSubmit('submitDelcms_category')
|
||||
|| Tools::isSubmit('submitAddcms_categoryAndBackToParent')
|
||||
|| Tools::isSubmit('submitAddcms_category')
|
||||
|| isset($_GET['deletecms_category'])
|
||||
|
||||
@@ -75,7 +75,7 @@ class AdminProfilesControllerCore extends AdminController
|
||||
);
|
||||
|
||||
$list_profile = array();
|
||||
foreach(Profile::getProfiles($this->context->language->id) as $profil)
|
||||
foreach (Profile::getProfiles($this->context->language->id) as $profil)
|
||||
$list_profile[] = array('value' => $profil['id_profile'], 'name' => $profil['name']);
|
||||
|
||||
parent::__construct();
|
||||
@@ -91,7 +91,7 @@ class AdminProfilesControllerCore extends AdminController
|
||||
}
|
||||
/* PrestaShop demo mode*/
|
||||
|
||||
if (isset($_GET['delete'.$this->table]) AND $_GET[$this->identifier] == (int)(_PS_ADMIN_PROFILE_))
|
||||
if (isset($_GET['delete'.$this->table]) && $_GET[$this->identifier] == (int)(_PS_ADMIN_PROFILE_))
|
||||
$this->errors[] = $this->l('For security reasons, you cannot delete the Administrator profile');
|
||||
else
|
||||
parent::postProcess();
|
||||
|
||||
@@ -52,8 +52,8 @@ class AdminRangeWeightControllerCore extends AdminController
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$carriers = Carrier::getCarriers($this->context->language->id, true , false, false, NULL, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
|
||||
foreach ($carriers AS $key => $carrier)
|
||||
$carriers = Carrier::getCarriers($this->context->language->id, true, false, false, null, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
|
||||
foreach ($carriers as $key => $carrier)
|
||||
if ($carrier['is_free'])
|
||||
unset($carriers[$key]);
|
||||
|
||||
|
||||
@@ -210,9 +210,7 @@ class AdminRequestSqlControllerCore extends AdminController
|
||||
$this->content .= $this->renderView();
|
||||
}
|
||||
else if ($this->display == 'export')
|
||||
{
|
||||
$this->generateExport();
|
||||
}
|
||||
else if (!$this->ajax)
|
||||
{
|
||||
$this->content .= $this->renderList();
|
||||
|
||||
@@ -123,16 +123,10 @@ class AdminReturnControllerCore extends AdminController
|
||||
|
||||
$order = new Order($this->object->id_order);
|
||||
$quantityDisplayed = array();
|
||||
/* Customized products */
|
||||
// Customized products */
|
||||
if ($returnedCustomizations = OrderReturn::getReturnedCustomizedProducts((int)($this->object->id_order)))
|
||||
{
|
||||
$allCustomizedDatas = Product::getAllCustomizedDatas((int)($order->id_cart));
|
||||
foreach ($returnedCustomizations AS $returnedCustomization)
|
||||
{
|
||||
$customizationDatas = &$allCustomizedDatas[(int)($returnedCustomization['product_id'])][(int)($returnedCustomization['product_attribute_id'])][(int)($returnedCustomization['id_customization'])]['datas'];
|
||||
foreach ($returnedCustomizations as $returnedCustomization)
|
||||
$quantityDisplayed[(int)($returnedCustomization['id_order_detail'])] = isset($quantityDisplayed[(int)($returnedCustomization['id_order_detail'])]) ? $quantityDisplayed[(int)($returnedCustomization['id_order_detail'])] + (int)($returnedCustomization['product_quantity']) : (int)($returnedCustomization['product_quantity']);
|
||||
}
|
||||
}
|
||||
|
||||
// Classic products
|
||||
$products = OrderReturn::getOrdersReturnProducts($this->object->id, $order);
|
||||
@@ -171,9 +165,9 @@ class AdminReturnControllerCore extends AdminController
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
{
|
||||
if (($id_order_detail = (int)(Tools::getValue('id_order_detail'))) AND Validate::isUnsignedId($id_order_detail))
|
||||
if (($id_order_detail = (int)(Tools::getValue('id_order_detail'))) && Validate::isUnsignedId($id_order_detail))
|
||||
{
|
||||
if (($id_order_return = (int)(Tools::getValue('id_order_return'))) AND Validate::isUnsignedId($id_order_return))
|
||||
if (($id_order_return = (int)(Tools::getValue('id_order_return'))) && Validate::isUnsignedId($id_order_return))
|
||||
{
|
||||
$orderReturn = new OrderReturn($id_order_return);
|
||||
if (!Validate::isLoadedObject($orderReturn))
|
||||
@@ -201,7 +195,7 @@ class AdminReturnControllerCore extends AdminController
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
if (($id_order_return = (int)(Tools::getValue('id_order_return'))) AND Validate::isUnsignedId($id_order_return))
|
||||
if (($id_order_return = (int)(Tools::getValue('id_order_return'))) && Validate::isUnsignedId($id_order_return))
|
||||
{
|
||||
$orderReturn = new OrderReturn($id_order_return);
|
||||
$order = new Order($orderReturn->id_order);
|
||||
@@ -216,8 +210,8 @@ class AdminReturnControllerCore extends AdminController
|
||||
'{id_order_return}' => $id_order_return,
|
||||
'{state_order_return}' => (isset($orderReturnState->name[(int)$order->id_lang]) ? $orderReturnState->name[(int)$order->id_lang] : $orderReturnState->name[(int)Configuration::get('PS_LANG_DEFAULT')]));
|
||||
Mail::Send((int)$order->id_lang, 'order_return_state', Mail::l('Your order return state has changed', $order->id_lang),
|
||||
$vars, $customer->email, $customer->firstname.' '.$customer->lastname, NULL, NULL, NULL,
|
||||
NULL, _PS_MAIL_DIR_, true);
|
||||
$vars, $customer->email, $customer->firstname.' '.$customer->lastname, null, null, null,
|
||||
null, _PS_MAIL_DIR_, true);
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,15 +40,15 @@ class AdminSearchControllerCore extends AdminController
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$searchType and strlen($this->query) > 1)
|
||||
if (!$searchType && strlen($this->query) > 1)
|
||||
$this->searchFeatures();
|
||||
|
||||
/* Product research */
|
||||
if (!$searchType OR $searchType == 1)
|
||||
if (!$searchType || $searchType == 1)
|
||||
{
|
||||
/* Handle product ID */
|
||||
if ($searchType == 1 AND (int)$this->query AND Validate::isUnsignedInt((int)$this->query))
|
||||
if ($product = new Product((int)$this->query) AND Validate::isLoadedObject($product))
|
||||
if ($searchType == 1 && (int)$this->query && Validate::isUnsignedInt((int)$this->query))
|
||||
if (($product = new Product($this->query)) && Validate::isLoadedObject($product))
|
||||
Tools::redirectAdmin('index.php?tab=AdminProducts&id_product='.(int)($product->id).'&addproduct'.'&token='.Tools::getAdminTokenLite('AdminProducts'));
|
||||
|
||||
/* Normal catalog search */
|
||||
@@ -56,14 +56,14 @@ class AdminSearchControllerCore extends AdminController
|
||||
}
|
||||
|
||||
/* Customer */
|
||||
if (!$searchType OR $searchType == 2 OR $searchType == 6)
|
||||
if (!$searchType || $searchType == 2 || $searchType == 6)
|
||||
{
|
||||
if (!$searchType OR $searchType == 2)
|
||||
if (!$searchType || $searchType == 2)
|
||||
{
|
||||
/* Handle customer ID */
|
||||
if ($searchType AND (int)$this->query AND Validate::isUnsignedInt((int)$this->query))
|
||||
if ($customer = new Customer((int)$this->query) AND Validate::isLoadedObject($customer))
|
||||
Tools::redirectAdmin('index.php?tab=AdminCustomers&id_customer='.(int)($customer->id).'&viewcustomer'.'&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id));
|
||||
if ($searchType && (int)$this->query && Validate::isUnsignedInt((int)$this->query))
|
||||
if (($customer = new Customer($this->query)) && Validate::isLoadedObject($customer))
|
||||
Tools::redirectAdmin('index.php?tab=AdminCustomers&id_customer='.(int)$customer->id.'&viewcustomer'.'&token='.Tools::getAdminToken('AdminCustomers'.(int)Tab::getIdFromClassName('AdminCustomers').(int)$this->context->employee->id));
|
||||
|
||||
/* Normal customer search */
|
||||
$this->searchCustomer();
|
||||
@@ -76,7 +76,8 @@ class AdminSearchControllerCore extends AdminController
|
||||
/* Order */
|
||||
if ($searchType == 3)
|
||||
{
|
||||
if ((int)$this->query AND Validate::isUnsignedInt((int)$this->query) AND $order = new Order((int)$this->query) AND Validate::isLoadedObject($order))
|
||||
$order = new Order($this->query);
|
||||
if ((int)$this->query && Validate::isUnsignedInt((int)$this->query) && $order && Validate::isLoadedObject($order))
|
||||
Tools::redirectAdmin('index.php?tab=AdminOrders&id_order='.(int)($order->id).'&vieworder'.'&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id));
|
||||
$this->errors[] = Tools::displayError('No order found with this ID:').' '.Tools::htmlentitiesUTF8($this->query);
|
||||
}
|
||||
@@ -84,7 +85,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
/* Invoices */
|
||||
if ($searchType == 4)
|
||||
{
|
||||
if ((int)$this->query AND Validate::isUnsignedInt((int)$this->query) AND $invoice = Order::getInvoice((int)$this->query))
|
||||
if ((int)$this->query && Validate::isUnsignedInt((int)$this->query) && ($invoice = Order::getInvoice((int)$this->query)))
|
||||
Tools::redirectAdmin('pdf.php?id_order='.(int)($invoice['id_order']).'&pdf');
|
||||
$this->errors[] = Tools::displayError('No invoice found with this ID:').' '.Tools::htmlentitiesUTF8($this->query);
|
||||
}
|
||||
@@ -92,7 +93,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
/* Cart */
|
||||
if ($searchType == 5)
|
||||
{
|
||||
if ((int)$this->query AND Validate::isUnsignedInt((int)$this->query) AND $cart = new Cart((int)$this->query) AND Validate::isLoadedObject($cart))
|
||||
if ((int)$this->query && Validate::isUnsignedInt((int)$this->query) && ($cart = new Cart($this->query)) && Validate::isLoadedObject($cart))
|
||||
Tools::redirectAdmin('index.php?tab=AdminCarts&id_cart='.(int)($cart->id).'&viewcart'.'&token='.Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)$this->context->employee->id));
|
||||
$this->errors[] = Tools::displayError('No cart found with this ID:').' '.Tools::htmlentitiesUTF8($this->query);
|
||||
}
|
||||
@@ -221,7 +222,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
$this->addJqueryPlugin('highlight');
|
||||
}
|
||||
|
||||
// Override because we don't want any buttons
|
||||
/* Override because we don't want any buttons */
|
||||
public function initToolbar()
|
||||
{
|
||||
}
|
||||
@@ -236,7 +237,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
$this->tpl_view_vars['query'] = $this->query;
|
||||
$this->tpl_view_vars['show_toolbar'] = true;
|
||||
|
||||
if (sizeof($this->errors))
|
||||
if (count($this->errors))
|
||||
return parent::renderView();
|
||||
else
|
||||
{
|
||||
@@ -245,7 +246,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
if (isset($this->_list['categories']))
|
||||
{
|
||||
$categories = array();
|
||||
foreach($this->_list['categories'] as $category)
|
||||
foreach ($this->_list['categories'] as $category)
|
||||
$categories[] = getPath($this->context->link->getAdminLink('AdminCategories', false), $category['id_category']);
|
||||
$this->tpl_view_vars['categories'] = $categories;
|
||||
}
|
||||
@@ -267,7 +268,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
if ($this->_list['products'])
|
||||
$view = $helper->generateList($this->_list['products'], $this->fieldsDisplay['products']);
|
||||
|
||||
$this->tpl_view_vars['products'] = $view;
|
||||
$this->tpl_view_vars['products'] = $view;
|
||||
}
|
||||
if (isset($this->_list['customers']))
|
||||
{
|
||||
@@ -286,11 +287,11 @@ class AdminSearchControllerCore extends AdminController
|
||||
|
||||
if ($this->_list['customers'])
|
||||
{
|
||||
foreach($this->_list['customers'] as $key => $val)
|
||||
foreach ($this->_list['customers'] as $key => $val)
|
||||
$this->_list['customers'][$key]['orders'] = Order::getCustomerNbOrders((int)$val['id_customer']);
|
||||
$view = $helper->generateList($this->_list['customers'], $this->fieldsDisplay['customers']);
|
||||
}
|
||||
$this->tpl_view_vars['customers'] = $view;
|
||||
$this->tpl_view_vars['customers'] = $view;
|
||||
}
|
||||
return parent::renderView();
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ class AdminShippingControllerCore extends AdminController
|
||||
parent::__construct();
|
||||
$this->table = 'delivery';
|
||||
|
||||
$carriers = Carrier::getCarriers($this->context->language->id, true , false, false, NULL, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
|
||||
foreach ($carriers AS $key => $carrier)
|
||||
$carriers = Carrier::getCarriers($this->context->language->id, true, false, false, null, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
|
||||
foreach ($carriers as $key => $carrier)
|
||||
if ($carrier['is_free'])
|
||||
unset($carriers[$key]);
|
||||
|
||||
@@ -91,8 +91,8 @@ class AdminShippingControllerCore extends AdminController
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
$carriers = Carrier::getCarriers($this->context->language->id, true , false, false, NULL, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
|
||||
foreach ($carriers AS $key => $carrier)
|
||||
$carriers = Carrier::getCarriers($this->context->language->id, true, false, false, null, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
|
||||
foreach ($carriers as $key => $carrier)
|
||||
if ($carrier['is_free'])
|
||||
unset($carriers[$key]);
|
||||
|
||||
@@ -114,7 +114,7 @@ class AdminShippingControllerCore extends AdminController
|
||||
$ranges = $rangeObj->getRanges($id_carrier);
|
||||
$delivery = Carrier::getDeliveryPriceByRanges($rangeTable, $id_carrier);
|
||||
$deliveryArray = array();
|
||||
foreach ($delivery AS $deliv)
|
||||
foreach ($delivery as $deliv)
|
||||
$deliveryArray[$deliv['id_zone']][$deliv['id_carrier']][$deliv[$rangeIdentifier]] = $deliv['price'];
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
@@ -140,7 +140,7 @@ class AdminShippingControllerCore extends AdminController
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
if (($id_carrier = (int)(Tools::getValue('id_carrier'))) AND $id_carrier == ($id_carrier2 = (int)(Tools::getValue('id_carrier2'))))
|
||||
if (($id_carrier = (int)(Tools::getValue('id_carrier'))) && $id_carrier == ($id_carrier2 = (int)(Tools::getValue('id_carrier2'))))
|
||||
{
|
||||
$carrier = new Carrier($id_carrier);
|
||||
if (Validate::isLoadedObject($carrier))
|
||||
@@ -154,7 +154,7 @@ class AdminShippingControllerCore extends AdminController
|
||||
|
||||
/* Build prices list */
|
||||
$priceList = array();
|
||||
foreach ($_POST AS $key => $value)
|
||||
foreach ($_POST as $key => $value)
|
||||
if (strstr($key, 'fees_'))
|
||||
{
|
||||
$tmpArray = explode('_', $key);
|
||||
@@ -183,9 +183,7 @@ class AdminShippingControllerCore extends AdminController
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating fees (cannot load carrier object).');
|
||||
}
|
||||
elseif (isset($id_carrier2))
|
||||
{
|
||||
$_POST['id_carrier'] = $id_carrier2;
|
||||
}
|
||||
else
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating fees (cannot load carrier object).');
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ class AdminShopControllerCore extends AdminController
|
||||
if ((bool)$shop->id)
|
||||
{
|
||||
// adding button for delete this shop
|
||||
if ($this->tabAccess['delete'] && $this->display != 'add' && !Shop::has_dependency($shop->id))
|
||||
if ($this->tabAccess['delete'] && $this->display != 'add' && !Shop::has_dependency($shop->id))
|
||||
$this->toolbar_btn['delete'] = array(
|
||||
'short' => 'Delete',
|
||||
'href' => $this->context->link->getAdminLink('AdminShop').'&id_shop='.$shop->id.'&deleteshop',
|
||||
@@ -143,7 +143,7 @@ class AdminShopControllerCore extends AdminController
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
$shops = Shop::getShopWithoutUrls();
|
||||
$shops = Shop::getShopWithoutUrls();
|
||||
if (count($shops) && !$this->ajax)
|
||||
{
|
||||
foreach ($shops as $shop)
|
||||
@@ -209,7 +209,7 @@ class AdminShopControllerCore extends AdminController
|
||||
{
|
||||
if (!Validate::isLoadedObject($object = $this->loadObject()))
|
||||
$this->errors[] = Tools::displayError('Unable to load this shop.');
|
||||
else if(!Shop::has_dependency($object->id))
|
||||
else if (!Shop::has_dependency($object->id))
|
||||
return $object->deleteCategories() && parent::processDelete($token);
|
||||
else
|
||||
$this->errors[] = Tools::displayError('You can\'t delete this shop (customer and/or order dependency)');
|
||||
|
||||
@@ -154,7 +154,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
{
|
||||
$tpl = $this->createTemplate('stats.tpl');
|
||||
|
||||
if (!($module_name = Tools::getValue('module')) && $module_instance = Module::getInstanceByName('statsforecast') AND $module_instance->active)
|
||||
if (!($module_name = Tools::getValue('module')) && ($module_instance = Module::getInstanceByName('statsforecast')) && $module_instance->active)
|
||||
$module_name = 'statsforecast';
|
||||
|
||||
if ($module_name)
|
||||
|
||||
@@ -78,8 +78,8 @@ class AdminSubDomainsControllerCore extends AdminController
|
||||
SELECT `id_subdomain`
|
||||
FROM `'._DB_PREFIX_.'subdomain`
|
||||
');
|
||||
if (sizeof($result) === 1)
|
||||
foreach ($result AS $row)
|
||||
if (count($result) === 1)
|
||||
foreach ($result as $row)
|
||||
$this->_listSkipDelete = array($row['id_subdomain']);
|
||||
|
||||
return parent::postProcess();
|
||||
|
||||
@@ -311,8 +311,8 @@ class AdminSuppliersControllerCore extends AdminController
|
||||
public function afterImageUpload()
|
||||
{
|
||||
/* Generate image with differents size */
|
||||
if (($id_supplier = (int)Tools::getValue('id_supplier')) AND
|
||||
isset($_FILES) AND count($_FILES) AND file_exists(_PS_SUPP_IMG_DIR_.$id_supplier.'.jpg'))
|
||||
if (($id_supplier = (int)Tools::getValue('id_supplier')) &&
|
||||
isset($_FILES) && count($_FILES) && file_exists(_PS_SUPP_IMG_DIR_.$id_supplier.'.jpg'))
|
||||
{
|
||||
$images_types = ImageType::getImagesTypes('suppliers');
|
||||
foreach ($images_types as $k => $image_type)
|
||||
|
||||
@@ -101,7 +101,7 @@ class AdminTaxesControllerCore extends AdminController
|
||||
*/
|
||||
public function displayEnableLink($token, $id, $value, $active, $id_category = null, $id_product = null)
|
||||
{
|
||||
if ($value AND TaxRule::isTaxInUse($id))
|
||||
if ($value && TaxRule::isTaxInUse($id))
|
||||
$confirm = $this->l('This tax is currently in use in a tax rule. If you continue this tax will be removed from the tax rule, are you sure?');
|
||||
|
||||
$tpl_enable = $this->context->smarty->createTemplate('helper/list/list_action_enable.tpl');
|
||||
@@ -189,12 +189,12 @@ class AdminTaxesControllerCore extends AdminController
|
||||
{
|
||||
/* Checking fields validity */
|
||||
$this->validateRules();
|
||||
if (!sizeof($this->errors))
|
||||
if (!count($this->errors))
|
||||
{
|
||||
$id = (int)(Tools::getValue('id_'.$this->table));
|
||||
|
||||
/* Object update */
|
||||
if (isset($id) AND !empty($id))
|
||||
if (isset($id) && !empty($id))
|
||||
{
|
||||
$object = new $this->className($id);
|
||||
if (Validate::isLoadedObject($object))
|
||||
@@ -205,9 +205,7 @@ class AdminTaxesControllerCore extends AdminController
|
||||
if (!$result)
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.'</b>';
|
||||
elseif ($this->postImage($object->id))
|
||||
{
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_'.$this->table.'='.$object->id.'&conf=4'.'&token='.$this->token);
|
||||
}
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_'.$this->table.'='.$object->id.'&conf=4'.'&token='.$this->token);
|
||||
}
|
||||
else
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
@@ -220,10 +218,8 @@ class AdminTaxesControllerCore extends AdminController
|
||||
$this->copyFromPost($object, $this->table);
|
||||
if (!$object->add())
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating object.').' <b>'.$this->table.'</b>';
|
||||
elseif (($_POST['id_'.$this->table] = $object->id /* voluntary */) AND $this->postImage($object->id) AND $this->_redirect)
|
||||
{
|
||||
elseif (($_POST['id_'.$this->table] = $object->id /* voluntary */) && $this->postImage($object->id) && $this->_redirect)
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_'.$this->table.'='.$object->id.'&conf=3'.'&token='.$this->token);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,19 +136,21 @@ class AdminThemesControllerCore extends AdminController
|
||||
|
||||
}
|
||||
|
||||
public function renderForm(){
|
||||
public function renderForm()
|
||||
{
|
||||
$getAvailableThemes = Theme::getAvailable(false);
|
||||
$available_theme_dir = array();
|
||||
$selected_theme_dir = null;
|
||||
if ($this->object)
|
||||
$selected_theme_dir= $this->object->directory;
|
||||
$selected_theme_dir = $this->object->directory;
|
||||
|
||||
foreach($getAvailableThemes as $k => $dirname)
|
||||
foreach ($getAvailableThemes as $k => $dirname)
|
||||
{
|
||||
$available_theme_dir[$k]['value'] = $dirname;
|
||||
$available_theme_dir[$k]['label'] = $dirname;
|
||||
$available_theme_dir[$k]['id'] = $dirname;
|
||||
};
|
||||
|
||||
$this->fields_form = array(
|
||||
'tinymce' => false,
|
||||
'legend' => array(
|
||||
@@ -209,13 +211,12 @@ class AdminThemesControllerCore extends AdminController
|
||||
|
||||
return parent::renderForm();
|
||||
}
|
||||
public function renderList(){
|
||||
|
||||
public function renderList()
|
||||
{
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
|
||||
// $this->_filter .= ' AND `id_parent` = '.(int)$this->_category->id.' ';
|
||||
// $this->_select = 'position ';
|
||||
|
||||
return parent::renderList();
|
||||
}
|
||||
|
||||
@@ -230,9 +231,9 @@ class AdminThemesControllerCore extends AdminController
|
||||
{
|
||||
$res = true;
|
||||
$base_theme_dir = rtrim($base_theme_dir, '/').'/';
|
||||
$base_dir = _PS_ALL_THEMES_DIR_ . $base_theme_dir;
|
||||
$base_dir = _PS_ALL_THEMES_DIR_.$base_theme_dir;
|
||||
$target_theme_dir = rtrim($target_theme_dir, '/').'/';
|
||||
$target_dir = _PS_ALL_THEMES_DIR_ . $target_theme_dir;
|
||||
$target_dir = _PS_ALL_THEMES_DIR_.$target_theme_dir;
|
||||
$files = scandir($base_dir);
|
||||
|
||||
foreach ($files as $file)
|
||||
@@ -252,7 +253,8 @@ class AdminThemesControllerCore extends AdminController
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function processAdd($token){
|
||||
public function processAdd($token)
|
||||
{
|
||||
$new_dir = Tools::getValue('directory');
|
||||
$res = true;
|
||||
if (Validate::isDirName($new_dir) && !is_dir(_PS_ALL_THEMES_DIR_.$new_dir))
|
||||
@@ -272,7 +274,8 @@ class AdminThemesControllerCore extends AdminController
|
||||
return parent::processAdd($token);
|
||||
}
|
||||
|
||||
public function processDelete($token){
|
||||
public function processDelete($token)
|
||||
{
|
||||
$obj = $this->loadObject();
|
||||
if ($obj && $obj->isUsed())
|
||||
{
|
||||
@@ -328,22 +331,19 @@ class AdminThemesControllerCore extends AdminController
|
||||
*/
|
||||
protected function _isThemeCompatible($theme_dir)
|
||||
{
|
||||
$all_errors='';
|
||||
$return=true;
|
||||
$check_version=AdminThemes::$check_features_version;
|
||||
$return = true;
|
||||
$check_version = AdminThemes::$check_features_version;
|
||||
|
||||
if (!is_file(_PS_ALL_THEMES_DIR_ . $theme_dir . '/config.xml'))
|
||||
if (!is_file(_PS_ALL_THEMES_DIR_.$theme_dir.'/config.xml'))
|
||||
{
|
||||
$this->errors[] = Tools::displayError('config.xml is missing in your theme path.').'<br/>';
|
||||
$xml=null;
|
||||
$xml = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
$xml=@simplexml_load_file(_PS_ALL_THEMES_DIR_.$theme_dir.'/config.xml');
|
||||
$xml = @simplexml_load_file(_PS_ALL_THEMES_DIR_.$theme_dir.'/config.xml');
|
||||
if (!$xml)
|
||||
{
|
||||
$this->errors[] = Tools::displayError('config.xml is not a valid xml file in your theme path.').'<br/>';
|
||||
}
|
||||
}
|
||||
// will be set to false if any version node in xml is correct
|
||||
$xml_version_too_old = true;
|
||||
@@ -352,20 +352,19 @@ class AdminThemesControllerCore extends AdminController
|
||||
// node means feature, attributes has to match
|
||||
// the corresponding value in AdminThemes::$check_features[feature] array
|
||||
$xmlArray = simpleXMLToArray($xml);
|
||||
foreach($xmlArray AS $version)
|
||||
foreach ($xmlArray as $version)
|
||||
{
|
||||
if (isset($version['value']) AND version_compare($version['value'], $check_version) >= 0)
|
||||
if (isset($version['value']) && version_compare($version['value'], $check_version) >= 0)
|
||||
{
|
||||
$checkedFeature = array();
|
||||
foreach (AdminThemes::$check_features AS $codeFeature => $arrConfigToCheck)
|
||||
foreach ($arrConfigToCheck['attributes'] AS $attr => $v)
|
||||
if (!isset($version[$codeFeature]) OR !isset($version[$codeFeature][$attr]) OR $version[$codeFeature][$attr] != $v['value'])
|
||||
foreach (AdminThemes::$check_features as $codeFeature => $arrConfigToCheck)
|
||||
foreach ($arrConfigToCheck['attributes'] as $attr => $v)
|
||||
if (!isset($version[$codeFeature]) || !isset($version[$codeFeature][$attr]) || $version[$codeFeature][$attr] != $v['value'])
|
||||
if (!$this->_checkConfigForFeatures($codeFeature, $attr)) // feature missing in config.xml file, or wrong attribute value
|
||||
$return = false;
|
||||
$xml_version_too_old = false;
|
||||
}
|
||||
}
|
||||
if ($xml_version_too_old AND !$this->_checkConfigForFeatures(array_keys(AdminThemes::$check_features)))
|
||||
if ($xml_version_too_old && !$this->_checkConfigForFeatures(array_keys(AdminThemes::$check_features)))
|
||||
{
|
||||
$this->errors[] .= Tools::displayError('config.xml theme file has not been created for this version of prestashop.');
|
||||
$return = false;
|
||||
@@ -386,12 +385,12 @@ class AdminThemesControllerCore extends AdminController
|
||||
if (is_array($configItem))
|
||||
{
|
||||
foreach ($arrFeatures as $feature)
|
||||
if (!sizeof($configItem))
|
||||
if (!count($configItem))
|
||||
$configItem = array_keys(AdminThemes::$check_features[$feature]['attributes']);
|
||||
foreach ($configItem as $attr)
|
||||
{
|
||||
$check = $this->_checkConfigForFeatures($arrFeatures,$attr);
|
||||
if($check == false)
|
||||
$check = $this->_checkConfigForFeatures($arrFeatures, $attr);
|
||||
if ($check == false)
|
||||
$return = false;
|
||||
}
|
||||
return $return;
|
||||
@@ -415,7 +414,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
.Tools::getAdminTokenLite(AdminThemes::$check_features[$feature]['tab']).'" ><u>'
|
||||
.Tools::displayError('You can disable this function on this page')
|
||||
.'</u></a>':''
|
||||
).'<br/>' ;
|
||||
).'<br/>';
|
||||
$return = false;
|
||||
break; // break for this attributes
|
||||
}
|
||||
@@ -434,7 +433,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
// new check compatibility theme feature (1.4) :
|
||||
$val = Tools::getValue('PS_THEME');
|
||||
Configuration::updateValue('PS_IMG_UPDATE_TIME', time());
|
||||
if (!empty($val) AND !$this->_isThemeCompatible($val)) // don't submit if errors
|
||||
if (!empty($val) && !$this->_isThemeCompatible($val)) // don't submit if errors
|
||||
unset($_POST['submitThemes'.$this->table]);
|
||||
Tools::clearCache($this->context->smarty);
|
||||
|
||||
@@ -447,7 +446,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
public function updateOptionPsLogo()
|
||||
{
|
||||
$id_shop = Context::getContext()->shop->getID();
|
||||
if (isset($_FILES['PS_LOGO']['tmp_name']) AND $_FILES['PS_LOGO']['tmp_name'])
|
||||
if (isset($_FILES['PS_LOGO']['tmp_name']) && $_FILES['PS_LOGO']['tmp_name'])
|
||||
{
|
||||
if ($error = ImageManager::validateUpload($_FILES['PS_LOGO'], 300000))
|
||||
$this->errors[] = $error;
|
||||
@@ -469,7 +468,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
public function updateOptionPsLogoMail()
|
||||
{
|
||||
$id_shop = Context::getContext()->shop->getID();
|
||||
if (isset($_FILES['PS_LOGO_MAIL']['tmp_name']) AND $_FILES['PS_LOGO_MAIL']['tmp_name'])
|
||||
if (isset($_FILES['PS_LOGO_MAIL']['tmp_name']) && $_FILES['PS_LOGO_MAIL']['tmp_name'])
|
||||
{
|
||||
if ($error = ImageManager::validateUpload($_FILES['PS_LOGO_MAIL'], 300000))
|
||||
$this->errors[] = $error;
|
||||
@@ -490,7 +489,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
public function updateOptionPsLogoInvoice()
|
||||
{
|
||||
$id_shop = Context::getContext()->shop->getID();
|
||||
if (isset($_FILES['PS_LOGO_INVOICE']['tmp_name']) AND $_FILES['PS_LOGO_INVOICE']['tmp_name'])
|
||||
if (isset($_FILES['PS_LOGO_INVOICE']['tmp_name']) && $_FILES['PS_LOGO_INVOICE']['tmp_name'])
|
||||
{
|
||||
if ($error = ImageManager::validateUpload($_FILES['PS_LOGO_INVOICE'], 300000))
|
||||
$this->errors[] = $error;
|
||||
@@ -512,7 +511,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
public function updateOptionPsStoresIcon()
|
||||
{
|
||||
$id_shop = Context::getContext()->shop->getID();
|
||||
if (isset($_FILES['PS_STORES_ICON']['tmp_name']) AND $_FILES['PS_STORES_ICON']['tmp_name'])
|
||||
if (isset($_FILES['PS_STORES_ICON']['tmp_name']) && $_FILES['PS_STORES_ICON']['tmp_name'])
|
||||
{
|
||||
if ($error = ImageManager::validateUpload($_FILES['PS_STORES_ICON'], 300000))
|
||||
$this->errors[] = $error;
|
||||
@@ -535,12 +534,12 @@ class AdminThemesControllerCore extends AdminController
|
||||
{
|
||||
if (isset($_FILES[$name]['tmp_name']) && !empty($_FILES[$name]['tmp_name']))
|
||||
{
|
||||
/* Check ico validity */
|
||||
// Check ico validity
|
||||
if ($error = ImageManager::validateIconUpload($_FILES[$name]))
|
||||
$this->errors[] = $error;
|
||||
|
||||
/* Copy new ico */
|
||||
elseif(!copy($_FILES[$name]['tmp_name'], $dest))
|
||||
// Copy new ico
|
||||
elseif (!copy($_FILES[$name]['tmp_name'], $dest))
|
||||
$this->errors[] = Tools::displayError('an error occurred while uploading favicon: '.$_FILES[$name]['tmp_name'].' to '.$dest);
|
||||
}
|
||||
return !count($this->errors) ? true : false;
|
||||
|
||||
@@ -141,9 +141,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
{
|
||||
$_NEW_MODULE = array();
|
||||
foreach ($_MODULE as $key => $value)
|
||||
{
|
||||
$_NEW_MODULE[self::DEFAULT_THEME_NAME.$key] = $value;
|
||||
}
|
||||
$_MODULE = $_NEW_MODULE;
|
||||
}
|
||||
$_MODULES = (is_array($_MODULES) && is_array($_MODULE)) ? array_merge($_MODULES, $_MODULE) : $_MODULE;
|
||||
@@ -733,13 +731,12 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
{
|
||||
if ($group == 'core_mail' || $group == 'module_mail')
|
||||
$array_subjects['core_and_modules']['translations'] = array_merge($array_subjects['core_and_modules']['translations'], $subject_translation);
|
||||
elseif ( isset($array_subjects['themes_and_modules']) && ($group == 'theme_mail' || $group == 'theme_module_mail')) {
|
||||
elseif (isset($array_subjects['themes_and_modules']) && ($group == 'theme_mail' || $group == 'theme_module_mail'))
|
||||
$array_subjects['themes_and_modules']['translations'] = array_merge($array_subjects['themes_and_modules']['translations'], $subject_translation);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($array_subjects))
|
||||
foreach ($array_subjects as $type => $infos)
|
||||
foreach ($array_subjects as $infos)
|
||||
$this->writeSubjectTranslationFile($infos['translations'], $infos['path']);
|
||||
|
||||
if (count($this->errors) == 0)
|
||||
@@ -912,8 +909,6 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$tabs = array_merge($tabs, Tools::scandir(_PS_ADMIN_CONTROLLER_DIR_, 'php', '../../classes/helper'));
|
||||
$tabs[] = '../../classes/AdminController.php';
|
||||
|
||||
$files = array();
|
||||
$i=0;
|
||||
foreach ($tabs as $tab)
|
||||
if (preg_match('/^(.*)\.php$/', $tab) && file_exists($tpl = _PS_ADMIN_CONTROLLER_DIR_.$tab))
|
||||
{
|
||||
@@ -988,7 +983,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$pos = strrpos($prefix_key, DIRECTORY_SEPARATOR);
|
||||
$tmp = substr($prefix_key, 0, $pos);
|
||||
|
||||
if (preg_match("#controllers#", $tmp))
|
||||
if (preg_match('#controllers#', $tmp))
|
||||
{
|
||||
$parentClass = explode(DIRECTORY_SEPARATOR, $tmp);
|
||||
$key = array_search('controllers', $parentClass);
|
||||
@@ -1007,7 +1002,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
|
||||
// @todo retrompatibility : we assume here than files directly in template/
|
||||
// use the prefix "AdminController" (like old php files 'header', 'footer.inc', 'index', 'login', 'password', 'functions'
|
||||
if ( $prefix_key == 'Admin' || $prefix_key == 'AdminTemplate')
|
||||
if ($prefix_key == 'Admin' || $prefix_key == 'AdminTemplate')
|
||||
$prefix_key = 'AdminController';
|
||||
|
||||
$new_lang = array();
|
||||
@@ -1031,9 +1026,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$trans_key = $prefix_key.md5($english_string);
|
||||
|
||||
if (isset($_LANGADM[$trans_key]))
|
||||
{
|
||||
$new_lang[$english_string] = html_entity_decode($_LANGADM[$trans_key], ENT_COMPAT, 'UTF-8');
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_lang[$english_string] = '';
|
||||
@@ -1099,12 +1092,12 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$count = 0;
|
||||
|
||||
foreach ($modules as $module)
|
||||
if (is_dir(_PS_MODULE_DIR_.$module) && $module != '.' && $module != '..' && $module != '.svn' )
|
||||
if (is_dir(_PS_MODULE_DIR_.$module) && $module != '.' && $module != '..' && $module != '.svn')
|
||||
$dirToParse[] = _PS_MODULE_DIR_.$module.'/';
|
||||
}
|
||||
foreach ($dirToParse as $dir)
|
||||
foreach (scandir($dir) as $file)
|
||||
if (preg_match('/\.php$/', $file) AND file_exists($fn = $dir.$file) AND $file != 'index.php')
|
||||
if (preg_match('/\.php$/', $file) && file_exists($fn = $dir.$file) && $file != 'index.php')
|
||||
{
|
||||
if (!filesize($fn))
|
||||
continue;
|
||||
@@ -1112,7 +1105,6 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
foreach ($matches[1] as $key)
|
||||
$stringToTranslate[$key] = (key_exists(md5($key), $_ERRORS)) ? html_entity_decode($_ERRORS[md5($key)], ENT_COMPAT, 'UTF-8') : '';
|
||||
}
|
||||
$irow = 0;
|
||||
|
||||
$this->tpl_view_vars = array(
|
||||
'lang' => Tools::strtoupper($lang),
|
||||
@@ -1142,7 +1134,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
|
||||
foreach (scandir(_PS_CLASS_DIR_) as $classFile)
|
||||
{
|
||||
if (!preg_match('/\.php$/', $classFile) OR $classFile == 'index.php')
|
||||
if (!preg_match('/\.php$/', $classFile) || $classFile == 'index.php')
|
||||
continue;
|
||||
include_once(_PS_CLASS_DIR_.$classFile);
|
||||
$prefix_key = substr($classFile, 0, -4);
|
||||
@@ -1232,25 +1224,23 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
if (strripos($email_file, '.html') > 0 || strripos($email_file, '.txt') > 0)
|
||||
{
|
||||
$email_name = substr($email_file, 0, strripos($email_file, '.'));
|
||||
$type = substr($email_file, strripos($email_file, '.')+1);
|
||||
if (!isset($arr_return['files'][$email_name])) {
|
||||
$type = substr($email_file, strripos($email_file, '.') + 1);
|
||||
if (!isset($arr_return['files'][$email_name]))
|
||||
$arr_return['files'][$email_name] = array();
|
||||
}
|
||||
$arr_return['files'][$email_name][$type]['en'] = $this->getMailContent($dir, $email_file, 'en');
|
||||
|
||||
// check if the file exists in the language to translate
|
||||
if (file_exists($dir.$lang.'/'.$email_file)) {
|
||||
if (file_exists($dir.$lang.'/'.$email_file))
|
||||
$arr_return['files'][$email_name][$type][$lang] = $this->getMailContent($dir, $email_file, $lang);
|
||||
} else {
|
||||
else
|
||||
$arr_return['files'][$email_name][$type][$lang] = '';
|
||||
}
|
||||
if ($arr_return['files'][$email_name][$type][$lang] == '') {
|
||||
|
||||
if ($arr_return['files'][$email_name][$type][$lang] == '')
|
||||
$arr_return['empty_values']++;
|
||||
} else {
|
||||
else
|
||||
$arr_return['total_filled']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $arr_return;
|
||||
}
|
||||
@@ -1265,12 +1255,10 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
*/
|
||||
protected function getMailContent($dir, $file, $lang)
|
||||
{
|
||||
$arr_return = array();
|
||||
$content = file_get_contents($dir.$lang.'/'.$file);
|
||||
|
||||
if (Tools::strlen($content) === 0) {
|
||||
if (Tools::strlen($content) === 0)
|
||||
$content = '';
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
@@ -1291,24 +1279,23 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$str_return = '';
|
||||
$group_name = 'mail';
|
||||
if (key_exists('group_name', $mails))
|
||||
{
|
||||
$group_name = $mails['group_name'];
|
||||
}
|
||||
|
||||
$str_return .= '
|
||||
<div class="mails_field" >
|
||||
<h3 style="cursor : pointer" onclick="$(\'#'.$id_html.'\').slideToggle();">'.$title.' - <font color="red">'.$mails['empty_values'].'</font> '
|
||||
.sprintf($this->l('missing translation(s) on %s template(s) for %s'), '<font color="blue">'.((int)$mails['empty_values']+(int)$mails['total_filled']).'</font>', $obj_lang->name)
|
||||
.sprintf($this->l('missing translation(s) on %s template(s) for %s'), '<font color="blue">'.((int)$mails['empty_values'] + (int)$mails['total_filled']).'</font>', $obj_lang->name)
|
||||
.':</h3>
|
||||
<div name="mails_div" id="'.$id_html.'">';
|
||||
if (!empty($mails['files']))
|
||||
{
|
||||
foreach ($mails['files'] as $mail_name => $mail_files)
|
||||
{
|
||||
if ((key_exists('html', $mail_files) OR key_exists('txt', $mail_files)))
|
||||
if (key_exists('html', $mail_files) || key_exists('txt', $mail_files))
|
||||
{
|
||||
if (key_exists($mail_name, $all_subject_mail))
|
||||
{
|
||||
$subject_mail = $all_subject_mail[$mail_name];
|
||||
$subject_mail = $all_subject_mail[$mail_name];
|
||||
$str_return .= '
|
||||
<div class="label-subject" style="text-align:center;">
|
||||
<label style="text-align:right">'.sprintf($this->l('Subject for %s:'), '<em>'.$mail_name.'</em>').'</label>
|
||||
@@ -1332,9 +1319,8 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$url_mail = $base_uri.$obj_lang->iso_code.'/'.$mail_name.'.html';
|
||||
$str_return .= $this->displayMailBlockHtml($mail_files['html'], $obj_lang->iso_code, $url_mail, $mail_name, $group_name, $name_for_module);
|
||||
}
|
||||
if (key_exists('txt', $mail_files)) {
|
||||
if (key_exists('txt', $mail_files))
|
||||
$str_return .= $this->displayMailBlockTxt($mail_files['txt'], $obj_lang->iso_code, $mail_name, $group_name, $name_for_module);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1399,8 +1385,8 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
|
||||
// The 2 lines below allow to exlude <body> tag from the content.
|
||||
// This allow to exclude body tag even if attributs are setted.
|
||||
$content[$language] = substr($content[$language], stripos($content[$language], '<body')+5);
|
||||
$content[$language] = substr($content[$language], stripos($content[$language], '>')+1);
|
||||
$content[$language] = substr($content[$language], stripos($content[$language], '<body') + 5);
|
||||
$content[$language] = substr($content[$language], stripos($content[$language], '>') + 1);
|
||||
$content[$language] = substr($content[$language], 0, stripos($content[$language], '</body>'));
|
||||
}
|
||||
}
|
||||
@@ -1417,7 +1403,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
<input type="text" name="title_'.$group_name.'_'.$mail_name.'" value="'.(isset($title[$lang]) ? $title[$lang] : '').'" />
|
||||
</div><!-- .label-subject -->';
|
||||
$str_return .= '
|
||||
<iframe style="background:white;border:1px solid #DFD5C3;" border="0" src ="'.$url.'?'.(rand(0,1000000000000)).'" width="565" height="497"></iframe>
|
||||
<iframe style="background:white;border:1px solid #DFD5C3;" border="0" src ="'.$url.'?'.(rand(0, 1000000000000)).'" width="565" height="497"></iframe>
|
||||
<a style="display:block;margin-top:5px;width:130px;" href="#" onclick="$(this).parent().hide(); displayTiny($(this).parent().next()); return false;" class="button">Edit this mail template</a>
|
||||
</div>
|
||||
<textarea style="display:none;" class="rte mailrte" cols="80" rows="30" name="'.$group_name.'[html]['.($name_for_module ? $name_for_module.'|' : '' ).$mail_name.']">'.(isset($content[$lang]) ? Tools::htmlentitiesUTF8(stripslashes($content[$lang])) : '').'</textarea>
|
||||
@@ -1435,20 +1421,15 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
{
|
||||
$arr_modules = array();
|
||||
foreach (scandir(_PS_MODULE_DIR_) as $module_dir)
|
||||
{
|
||||
if ($module_dir[0] != '.' AND file_exists(_PS_MODULE_DIR_.$module_dir.'/mails'))
|
||||
{
|
||||
if ($module_dir[0] != '.' && file_exists(_PS_MODULE_DIR_.$module_dir.'/mails'))
|
||||
$arr_modules[$module_dir] = _PS_MODULE_DIR_.$module_dir;
|
||||
}
|
||||
|
||||
}
|
||||
return $arr_modules;
|
||||
}
|
||||
protected function getTinyMCEForMails($iso_lang)
|
||||
{
|
||||
// TinyMCE
|
||||
$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso_lang.'.js') ? $iso_lang : 'en');
|
||||
$ad = dirname($_SERVER["PHP_SELF"]);
|
||||
$ad = dirname($_SERVER['PHP_SELF']);
|
||||
return '
|
||||
<script type="text/javascript">
|
||||
var iso = \''.$isoTinyMCE.'\' ;
|
||||
@@ -1480,13 +1461,12 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
_PS_ADMIN_DIR_,
|
||||
);
|
||||
$arr_files_to_parse = array_merge($arr_files_to_parse, $modules_has_mails);
|
||||
foreach ($arr_files_to_parse as $path) {
|
||||
foreach ($arr_files_to_parse as $path)
|
||||
$subject_mail = AdminTranslationsController::getSubjectMail($path, $subject_mail);
|
||||
}
|
||||
|
||||
$core_mails = $this->getMailFiles(_PS_MAIL_DIR_, $lang, 'core_mail');
|
||||
$core_mails['subject'] = $this->getSubjectMailContent(_PS_MAIL_DIR_.$lang);
|
||||
foreach ($modules_has_mails as $module_name=>$module_path)
|
||||
foreach ($modules_has_mails as $module_name => $module_path)
|
||||
{
|
||||
$module_mails[$module_name] = $this->getMailFiles($module_path.'/mails/', $lang, 'module_mail');
|
||||
$module_mails[$module_name]['subject'] = $core_mails['subject'];
|
||||
@@ -1507,7 +1487,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
{
|
||||
foreach (scandir(_PS_THEME_DIR_.'/modules') as $module_dir)
|
||||
{
|
||||
if ($module_dir[0] != '.' AND file_exists(_PS_THEME_DIR_.'modules/'.$module_dir.'/mails'))
|
||||
if ($module_dir[0] != '.' && file_exists(_PS_THEME_DIR_.'modules/'.$module_dir.'/mails'))
|
||||
{
|
||||
$theme_mails[$module_dir] = $this->getMailFiles(_PS_THEME_DIR_.'modules/'.$module_dir.'/mails/', $lang, 'theme_module_mail');
|
||||
$theme_mails[$module_dir]['subject'] = $theme_mails['theme_mail']['subject'];
|
||||
@@ -1560,13 +1540,13 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
{
|
||||
foreach (scandir($directory) as $filename)
|
||||
{
|
||||
if (strripos($filename, '.php') > 0 AND $filename != 'AdminTranslations.php')
|
||||
if (strripos($filename, '.php') > 0 && $filename != 'AdminTranslations.php')
|
||||
{
|
||||
$content = file_get_contents($directory.'/'.$filename);
|
||||
$content = str_replace("\n", " ", $content);
|
||||
$content = str_replace("\n", ' ', $content);
|
||||
if (preg_match_all('/Mail::Send([^;]*);/si', $content, $tab))
|
||||
{
|
||||
for ($i = 0 ; isset($tab[1][$i]) ; $i++)
|
||||
for ($i = 0; isset($tab[1][$i]); $i++)
|
||||
{
|
||||
$tab2 = explode(',', $tab[1][$i]);
|
||||
if (is_array($tab2))
|
||||
@@ -1582,7 +1562,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($filename != '.svn' AND $filename != '.' AND $filename != '..' AND is_dir(($directory.'/'.$filename)))
|
||||
if ($filename != '.svn' && $filename != '.' && $filename != '..' && is_dir(($directory.'/'.$filename)))
|
||||
$subject_mail = AdminTranslationsController::getSubjectMail($directory.'/'.$filename, $subject_mail);
|
||||
}
|
||||
return $subject_mail;
|
||||
@@ -1601,7 +1581,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$subject = str_replace('\n', ' ', $subject);
|
||||
$subject = str_replace("\\'", "\'", $subject);
|
||||
|
||||
$subject_mail_content[$key] = htmlentities($subject,ENT_QUOTES,'UTF-8');
|
||||
$subject_mail_content[$key] = htmlentities($subject, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1661,9 +1641,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
if (!empty($dir_module))
|
||||
{
|
||||
foreach ($dir_module as $folder)
|
||||
{
|
||||
$this->recursiveGetModuleFiles($path.$folder.'/', $array_files, $module_name, $lang_file, $is_default);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1682,7 +1660,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$array_files = array();
|
||||
foreach ($modules as $module)
|
||||
{
|
||||
if ($module{0} != '.' AND is_dir($root_dir.$module))
|
||||
if ($module{0} != '.' && is_dir($root_dir.$module))
|
||||
{
|
||||
@include($root_dir.$module.'/'.$lang.'.php');
|
||||
AdminTranslationsController::getModuleTranslations($is_default);
|
||||
@@ -1787,7 +1765,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$regex = '/HTMLTemplate.*::l\(\''._PS_TRANS_PATTERN_.'\'[\)|\,]/U';
|
||||
// need to parse PDF.php in order to find $regex and add this to $tabs_array
|
||||
// this has to be done for the core class, and eventually for the override
|
||||
foreach (glob(_PS_CLASS_DIR_.'pdf/'."*.php") as $filename)
|
||||
foreach (glob(_PS_CLASS_DIR_.'pdf/*.php') as $filename)
|
||||
{
|
||||
$tabs_array = $this->_parsePdfClass($filename, $regex, $_LANGPDF, $prefix_key, $tabs_array);
|
||||
if (file_exists(_PS_ROOT_DIR_.'/override/classes/pdf/'.basename($filename)))
|
||||
@@ -1848,7 +1826,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
{
|
||||
$dir = opendir(_PS_ALL_THEMES_DIR_);
|
||||
while ($folder = readdir($dir))
|
||||
if ($folder != '.' AND $folder != '..' AND is_dir(_PS_ALL_THEMES_DIR_.DIRECTORY_SEPARATOR.$folder) AND file_exists(_PS_ALL_THEMES_DIR_.'/'.$folder.'/preview.jpg'))
|
||||
if ($folder != '.' && $folder != '..' && is_dir(_PS_ALL_THEMES_DIR_.DIRECTORY_SEPARATOR.$folder) && file_exists(_PS_ALL_THEMES_DIR_.'/'.$folder.'/preview.jpg'))
|
||||
$themes[$folder]['name'] = $folder;
|
||||
closedir($dir);
|
||||
return isset($themes) ? $themes : array();
|
||||
|
||||
Reference in New Issue
Block a user