public function renderConfigurationForm()
 {
     $lang = new Language((int) Configuration::get('PS_LANG_DEFAULT'));
     $langs = Language::getLanguages();
     $id_shop = (int) $this->context->shop->id;
     foreach ($langs as $key => $language) {
         $options[] = array('id_option' => $language['id_lang'], 'name' => $language['name']);
     }
     $cats = $this->getCategories($lang->id, true, $id_shop);
     $categories[] = array('id_option' => 99999, 'name' => 'All');
     foreach ($cats as $key => $cat) {
         $categories[] = array('id_option' => $cat['id_category'], 'name' => $cat['name']);
     }
     $inputs = array(array('type' => 'select', 'label' => $this->l('Language'), 'desc' => $this->l('Choose a language you wish to export'), 'name' => 'export_language', 'class' => 't', 'options' => array('query' => $options, 'id' => 'id_option', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('Delimiter'), 'name' => 'export_delimiter', 'value' => ',', 'desc' => $this->l('The character to separate the fields')), array('type' => 'radio', 'label' => $this->l('Export active products?'), 'name' => 'export_active', 'values' => array(array('id' => 'active_off', 'value' => 0, 'label' => 'no, export all products.'), array('id' => 'active_on', 'value' => 1, 'label' => 'yes, export only active products')), 'is_bool' => true), array('type' => 'select', 'label' => $this->l('Product Category'), 'desc' => $this->l('Choose a product category you wish to export'), 'name' => 'export_category', 'class' => 't', 'options' => array('query' => $categories, 'id' => 'id_option', 'name' => 'name')));
     $fields_form = array('form' => array('legend' => array('title' => $this->l('Export Options'), 'icon' => 'icon-cogs'), 'input' => $inputs, 'submit' => array('title' => $this->l('Export'))));
     $helper = new HelperForm();
     $helper->show_toolbar = false;
     $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;
     $this->fields_form = array();
     $helper->identifier = $this->identifier;
     $helper->submit_action = 'submitExport';
     $helper->currentIndex = self::$currentIndex;
     $helper->token = Tools::getAdminTokenLite('AdminExportProducts');
     $helper->tpl_vars = array('fields_value' => $this->getConfigFieldsValues(), 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id);
     return $helper->generateForm(array($fields_form));
 }
function migrate_block_info_to_cms_block()
{
    //get ids cms of block information
    $id_blockinfos = Db::getInstance()->getValue('SELECT id_module FROM  `' . _DB_PREFIX_ . 'module` WHERE name = \'blockinfos\'');
    //get ids cms of block information
    $ids_cms = Db::getInstance()->ExecuteS('SELECT * FROM  `' . _DB_PREFIX_ . 'block_cms` WHERE `id_block` = ' . (int) $id_blockinfos);
    //check if block info is installed and active
    if (sizeof($ids_cms)) {
        //install module blockcms
        if (Module::getInstanceByName('blockcms')->install()) {
            //add new block in new cms block
            Db::getInstance()->Execute('INSERT INTO `' . _DB_PREFIX_ . 'cms_block` (`id_cms_category`, `name`, `location`, `position`) VALUES( 1, \'\', 0, 0)');
            $id_block = Db::getInstance()->Insert_ID();
            $languages = Language::getLanguages(false);
            foreach ($languages as $language) {
                Db::getInstance()->Execute('INSERT INTO `' . _DB_PREFIX_ . 'cms_block_lang` (`id_cms_block`, `id_lang`, `name`) VALUES (' . (int) $id_block . ', ' . (int) $language['id_lang'] . ', \'Information\')');
            }
            //save ids cms of block information in new module cms bloc
            foreach ($ids_cms as $id_cms) {
                Db::getInstance()->Execute('INSERT INTO `' . _DB_PREFIX_ . 'cms_block_page` (`id_cms_block`, `id_cms`, `is_category`) VALUES (' . (int) $id_block . ', ' . (int) $id_cms['id_cms'] . ', 0)');
            }
        } else {
            return true;
        }
    } else {
        return true;
    }
}
 public function __construct()
 {
     $this->bootstrap = true;
     $this->context = Context::getContext();
     $this->table = 'customer_thread';
     $this->className = 'CustomerThread';
     $this->lang = false;
     $contact_array = array();
     $contacts = Contact::getContacts($this->context->language->id);
     foreach ($contacts as $contact) {
         $contact_array[$contact['id_contact']] = $contact['name'];
     }
     $language_array = array();
     $languages = Language::getLanguages();
     foreach ($languages as $language) {
         $language_array[$language['id_lang']] = $language['name'];
     }
     $icon_array = array('open' => array('class' => 'icon-circle text-success', 'alt' => $this->l('Open')), 'closed' => array('class' => 'icon-circle text-danger', 'alt' => $this->l('Closed')), 'pending1' => array('class' => 'icon-circle text-warning', 'alt' => $this->l('Pending 1')), 'pending2' => array('class' => 'icon-circle text-warning', 'alt' => $this->l('Pending 2')));
     $status_array = array();
     foreach ($icon_array as $k => $v) {
         $status_array[$k] = $v['alt'];
     }
     $this->fields_list = array('id_customer_thread' => array('title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs'), 'customer' => array('title' => $this->l('Customer'), 'filter_key' => 'customer', 'tmpTableFilter' => true), 'email' => array('title' => $this->l('Email'), 'filter_key' => 'a!email'), 'contact' => array('title' => $this->l('Type'), 'type' => 'select', 'list' => $contact_array, 'filter_key' => 'cl!id_contact', 'filter_type' => 'int'), 'language' => array('title' => $this->l('Language'), 'type' => 'select', 'list' => $language_array, 'filter_key' => 'l!id_lang', 'filter_type' => 'int'), 'status' => array('title' => $this->l('Status'), 'type' => 'select', 'list' => $status_array, 'icon' => $icon_array, 'align' => 'center', 'filter_key' => 'a!status', 'filter_type' => 'string'), 'employee' => array('title' => $this->l('Employee'), 'filter_key' => 'employee', 'tmpTableFilter' => true), 'messages' => array('title' => $this->l('Messages'), 'filter_key' => 'messages', 'tmpTableFilter' => true, 'maxlength' => 40), 'date_upd' => array('title' => $this->l('Last message'), 'havingFilter' => true, 'type' => 'datetime'));
     $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'), 'icon' => 'icon-trash'));
     $this->shopLinkType = 'shop';
     $this->fields_options = array('contact' => array('title' => $this->l('Contact options'), 'fields' => array('PS_CUSTOMER_SERVICE_FILE_UPLOAD' => array('title' => $this->l('Allow file uploading'), 'hint' => $this->l('Allow customers to upload files using the contact page.'), 'type' => 'bool'), 'PS_CUSTOMER_SERVICE_SIGNATURE' => array('title' => $this->l('Default message'), 'hint' => $this->l('Please fill out the message fields that appear by default when you answer a thread on the customer service page.'), 'type' => 'textareaLang', 'lang' => true)), 'submit' => array('title' => $this->l('Save'))), 'general' => array('title' => $this->l('Customer service options'), 'fields' => array('PS_SAV_IMAP_URL' => array('title' => $this->l('IMAP URL'), 'hint' => $this->l('URL for your IMAP server (ie.: mail.server.com).'), 'type' => 'text'), 'PS_SAV_IMAP_PORT' => array('title' => $this->l('IMAP port'), 'hint' => $this->l('Port to use to connect to your IMAP server.'), 'type' => 'text', 'defaultValue' => 143), 'PS_SAV_IMAP_USER' => array('title' => $this->l('IMAP user'), 'hint' => $this->l('User to use to connect to your IMAP server.'), 'type' => 'text'), 'PS_SAV_IMAP_PWD' => array('title' => $this->l('IMAP password'), 'hint' => $this->l('Password to use to connect your IMAP server.'), 'type' => 'text'), 'PS_SAV_IMAP_DELETE_MSG' => array('title' => $this->l('Delete messages'), 'hint' => $this->l('Delete messages after synchronization. If you do not enable this option, the synchronization will take more time.'), 'type' => 'bool'), 'PS_SAV_IMAP_CREATE_THREADS' => array('title' => $this->l('Create new threads'), 'hint' => $this->l('Create new threads for unrecognized emails.'), 'type' => 'bool'), 'PS_SAV_IMAP_OPT_NORSH' => array('title' => $this->l('IMAP options') . ' (/norsh)', 'type' => 'bool', 'hint' => $this->l('Do not use RSH or SSH to establish a preauthenticated IMAP sessions.')), 'PS_SAV_IMAP_OPT_SSL' => array('title' => $this->l('IMAP options') . ' (/ssl)', 'type' => 'bool', 'hint' => $this->l('Use the Secure Socket Layer (TLS/SSL) to encrypt the session.')), 'PS_SAV_IMAP_OPT_VALIDATE-CERT' => array('title' => $this->l('IMAP options') . ' (/validate-cert)', 'type' => 'bool', 'hint' => $this->l('Validate certificates from the TLS/SSL server.')), 'PS_SAV_IMAP_OPT_NOVALIDATE-CERT' => array('title' => $this->l('IMAP options') . ' (/novalidate-cert)', 'type' => 'bool', 'hint' => $this->l('Do not validate certificates from the TLS/SSL server. This is only needed if a server uses self-signed certificates.')), 'PS_SAV_IMAP_OPT_TLS' => array('title' => $this->l('IMAP options') . ' (/tls)', 'type' => 'bool', 'hint' => $this->l('Force use of start-TLS to encrypt the session, and reject connection to servers that do not support it.')), 'PS_SAV_IMAP_OPT_NOTLS' => array('title' => $this->l('IMAP options') . ' (/notls)', 'type' => 'bool', 'hint' => $this->l('Do not use start-TLS to encrypt the session, even with servers that support it.'))), 'submit' => array('title' => $this->l('Save'))));
     parent::__construct();
 }
function add_order_state($conf_name, $name, $invoice, $send_email, $color, $unremovable, $logable, $delivery, $template = null)
{
    $name_lang = array();
    $template_lang = array();
    foreach (explode('|', $name) as $item) {
        $temp = explode(':', $item);
        $name_lang[$temp[0]] = $temp[1];
    }
    if ($template) {
        foreach (explode('|', $template) as $item) {
            $temp = explode(':', $item);
            $template_lang[$temp[0]] = $temp[1];
        }
    }
    Db::getInstance()->Execute('
		INSERT INTO `' . _DB_PREFIX_ . 'order_state` (`invoice`, `send_email`, `color`, `unremovable`, `logable`, `delivery`) 
		VALUES (' . (int) $invoice . ', ' . (int) $send_email . ', \'' . pSQL($color) . '\', ' . (int) $unremovable . ', ' . (int) $logable . ', ' . (int) $delivery . ')');
    $id_order_state = Db::getInstance()->getValue('
		SELECT MAX(`id_order_state`)
		FROM `' . _DB_PREFIX_ . 'order_state`
	');
    foreach (Language::getLanguages() as $lang) {
        Db::getInstance()->Execute('
		INSERT IGNORE INTO `' . _DB_PREFIX_ . 'order_state_lang` (`id_lang`, `id_order_state`, `name`, `template`) 
		VALUES (' . (int) $lang['id_lang'] . ', ' . (int) $id_order_state . ', \'' . pSQL(isset($name_lang[$lang['iso_code']]) ? $name_lang[$lang['iso_code']] : $name_lang['en']) . '\', \'' . pSQL(isset($template_lang[$lang['iso_code']]) ? $template_lang[$lang['iso_code']] : (isset($template_lang['en']) ? $template_lang['en'] : '')) . '\')
		');
    }
    Configuration::updateValue($conf_name, $id_order_state);
}
示例#5
0
function add_new_tab($className, $name, $id_parent)
{
    $array = array();
    foreach (explode('|', $name) as $item) {
        $temp = explode(':', $item);
        $array[$temp[0]] = $temp[1];
    }
    if (!(int) Db::getInstance()->getValue('SELECT count(id_tab) FROM `' . _DB_PREFIX_ . 'tab` WHERE `class_name` = \'' . pSQL($className) . '\' ')) {
        Db::getInstance()->Execute('INSERT INTO `' . _DB_PREFIX_ . 'tab` (`id_parent`, `class_name`, `module`, `position`) VALUES (' . (int) $id_parent . ', \'' . pSQL($className) . '\', \'\', 
									(SELECT MAX(t.position)+ 1 FROM `' . _DB_PREFIX_ . 'tab` t WHERE t.id_parent = ' . (int) $id_parent . '))');
    }
    foreach (Language::getLanguages() as $lang) {
        Db::getInstance()->Execute('
		INSERT IGNORE INTO `' . _DB_PREFIX_ . 'tab_lang` (`id_lang`, `id_tab`, `name`) 
		VALUES (' . (int) $lang['id_lang'] . ', (
				SELECT `id_tab`
				FROM `' . _DB_PREFIX_ . 'tab`
				WHERE `class_name` = \'' . pSQL($className) . '\' LIMIT 0,1
			), \'' . pSQL(isset($array[$lang['iso_code']]) ? $array[$lang['iso_code']] : $array['en']) . '\')
		');
    }
    Db::getInstance()->Execute('INSERT IGNORE INTO `' . _DB_PREFIX_ . 'access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) 
								(SELECT `id_profile`, (
								SELECT `id_tab`
								FROM `' . _DB_PREFIX_ . 'tab`
								WHERE `class_name` = \'' . pSQL($className) . '\' LIMIT 0,1
								), 1, 1, 1, 1 FROM `' . _DB_PREFIX_ . 'profile` )');
}
 /**
  * Initialise the object variables
  *
  */
 public function __construct($oContext = false)
 {
     if (is_object($oContext) && get_class($oContext) == 'Context') {
         $this->oContext = $oContext;
     }
     $aLanguages = Language::getLanguages(false);
     foreach ($this->aConfs as $var => $aConf) {
         $aParams = array(0 => $aConf['name'], 1 => false, 2 => false, 3 => false);
         if ($this->oContext) {
             if ((int) $aConf['multishopgroup']) {
                 $aParams[2] = (int) $this->oContext->shop->id_shop_group;
             }
             if ((int) $aConf['multishop']) {
                 $aParams[3] = (int) $this->oContext->shop->id;
             }
         }
         switch ($aConf['type']) {
             case 'int':
                 $this->{$var} = (int) call_user_func_array(array('Configuration', 'get'), $aParams);
                 break;
             default:
                 if ($this->oContext && (int) $aConf['multilang']) {
                     // Set the multilingual configurations
                     foreach ($aLanguages as $aLanguage) {
                         $aParams[1] = (int) $aLanguage['id_lang'];
                         $this->{$var}[(int) $aLanguage['id_lang']] = pSQL(call_user_func_array(array('Configuration', 'get'), $aParams));
                     }
                 } else {
                     $this->{$var} = pSQL(call_user_func_array(array('Configuration', 'get'), $aParams));
                 }
                 break;
         }
     }
 }
示例#7
0
 public function install()
 {
     Configuration::updateValue('PS_DASHGOALS_CURRENT_YEAR', date('Y'));
     for ($month = '01'; $month <= 12; $month = sprintf('%02d', $month + 1)) {
         $key = Tools::strtoupper('dashgoals_traffic_' . $month . '_' . date('Y'));
         if (!ConfigurationKPI::get($key)) {
             ConfigurationKPI::updateValue($key, 600);
         }
         $key = Tools::strtoupper('dashgoals_conversion_' . $month . '_' . date('Y'));
         if (!ConfigurationKPI::get($key)) {
             ConfigurationKPI::updateValue($key, 2);
         }
         $key = Tools::strtoupper('dashgoals_avg_cart_value_' . $month . '_' . date('Y'));
         if (!ConfigurationKPI::get($key)) {
             ConfigurationKPI::updateValue($key, 80);
         }
     }
     // Prepare tab
     $tab = new Tab();
     $tab->active = 1;
     $tab->class_name = 'AdminDashgoals';
     $tab->name = array();
     foreach (Language::getLanguages(true) as $lang) {
         $tab->name[$lang['id_lang']] = 'Dashgoals';
     }
     $tab->id_parent = -1;
     $tab->module = $this->name;
     return $tab->add() && parent::install() && $this->registerHook('dashboardZoneTwo') && $this->registerHook('dashboardData') && $this->registerHook('actionAdminControllerSetMedia');
 }
示例#8
0
 public function getTranslationsFieldsChild()
 {
     parent::validateFieldsLang();
     $fieldsArray = array('meta_title', 'meta_description', 'meta_keywords', 'link_rewrite');
     $fields = array();
     $languages = Language::getLanguages(false);
     $defaultLanguage = (int) Configuration::get('PS_LANG_DEFAULT');
     foreach ($languages as $language) {
         $fields[$language['id_lang']]['id_lang'] = (int) $language['id_lang'];
         $fields[$language['id_lang']][$this->identifier] = (int) $this->id;
         $fields[$language['id_lang']]['content'] = isset($this->content[$language['id_lang']]) ? pSQL($this->content[$language['id_lang']], true) : '';
         foreach ($fieldsArray as $field) {
             if (!Validate::isTableOrIdentifier($field)) {
                 die(Tools::displayError());
             }
             if (isset($this->{$field}[$language['id_lang']]) and !empty($this->{$field}[$language['id_lang']])) {
                 $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']]);
             } elseif (in_array($field, $this->fieldsRequiredLang)) {
                 $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage]);
             } else {
                 $fields[$language['id_lang']][$field] = '';
             }
         }
     }
     return $fields;
 }
示例#9
0
 /**
  * @param object &$object Object
  * @param string $table Object table
  * @ DONE
  */
 protected function copyFromPost(&$object, $table, $post = array())
 {
     /* Classical fields */
     foreach ($post as $key => $value) {
         if (key_exists($key, $object) && $key != 'id_' . $table) {
             /* Do not take care of password field if empty */
             if ($key == 'passwd' && Tools::getValue('id_' . $table) && empty($value)) {
                 continue;
             }
             if ($key == 'passwd' && !empty($value)) {
                 /* Automatically encrypt password in MD5 */
                 $value = Tools::encrypt($value);
             }
             $object->{$key} = $value;
         }
     }
     /* Multilingual fields */
     $rules = call_user_func(array(get_class($object), 'getValidationRules'), get_class($object));
     if (count($rules['validateLang'])) {
         $languages = Language::getLanguages(false);
         foreach ($languages as $language) {
             foreach (array_keys($rules['validateLang']) as $field) {
                 $field_name = $field . '_' . (int) $language['id_lang'];
                 $value = Tools::getValue($field_name);
                 if (isset($value)) {
                     # validate module
                     $object->{$field}[(int) $language['id_lang']] = $value;
                 }
             }
         }
     }
 }
示例#10
0
 public static function createtdDefaultData()
 {
     $context = Context::getContext();
     $id_shop = $context->shop->id;
     $psbaseurl = _PS_BASE_URL_ . __PS_BASE_URI__;
     $modlink = _PS_BASE_URL_ . __PS_BASE_URI__ . 'blog';
     $sql = Db::getInstance()->Execute('
         INSERT INTO `' . _DB_PREFIX_ . 'tdmegamenu`(`id_tdmegamenu`,`menu_type`,`order`,`parent`,`custome_type`,`id_shop`) 
         VALUES(1,"LNK1",1,0,"cus_url",' . $id_shop . ')');
     $sql = Db::getInstance()->Execute('
         INSERT INTO `' . _DB_PREFIX_ . 'tdmegamenu`(`id_tdmegamenu`,`menu_type`,`order`,`parent`,`custome_type`,`id_shop`) 
         VALUES(2,"LNK2",2,0,"cus_url",' . $id_shop . ')');
     $languages = Language::getLanguages(false);
     for ($i = 1; $i <= 2; $i++) {
         if ($i == 1) {
             $title = "Home";
             $links = $psbaseurl;
         } elseif ($i == 2) {
             $title = "Blog";
             $links = $modlink;
         }
         foreach ($languages as $language) {
             $sql .= Db::getInstance()->Execute('
             INSERT INTO `' . _DB_PREFIX_ . 'tdmegal`(`id_tdmegamenu`,`id_lang`,`menu_title`,`menu_link`,`description`) 
             VALUES(' . (int) $i . ', ' . (int) $language['id_lang'] . ', "' . $title . '","' . $links . '", "")');
         }
     }
     return true;
 }
示例#11
0
 public function install()
 {
     // Install SQL
     include dirname(__FILE__) . '/sql/install.php';
     foreach ($sql as $s) {
         if (!Db::getInstance()->execute($s)) {
             return false;
         }
     }
     // Install Tabs
     if (!(int) Tab::getIdFromClassName('AdminPosMenu')) {
         $parent_tab = new Tab();
         // Need a foreach for the language
         $parent_tab->name[$this->context->language->id] = $this->l('PosExtentions');
         $parent_tab->class_name = 'AdminPosMenu';
         $parent_tab->id_parent = 0;
         // Home tab
         $parent_tab->module = $this->name;
         $parent_tab->add();
     }
     $tab = new Tab();
     // Need a foreach for the language
     foreach (Language::getLanguages() as $language) {
         $tab->name[$language['id_lang']] = $this->l('Manage Static Footer');
     }
     $tab->class_name = 'AdminPosstaticfooter';
     $tab->id_parent = (int) Tab::getIdFromClassName('AdminPosMenu');
     $tab->module = $this->name;
     $tab->add();
     // Set some defaults
     return parent::install() && $this->registerHook('footer') && $this->_installHookCustomer() && $this->registerHook('blockFooter1') && $this->registerHook('blockFooter2') && $this->registerHook('blockFooter3') && $this->registerHook('displayBackOfficeHeader');
 }
 public function install()
 {
     if (!parent::install() || !Configuration::updateValue('eicmslinks_admin_path', 0)) {
         return false;
     }
     //Copie des dossier de l'editeur tinyMce
     $this->copyDir(dirname(__FILE__) . '/tiny_mce/', dirname(__FILE__) . '/../../js/tiny_mce/plugins/');
     //Copie de l'override du formulaire cms de l'admin (Normalement devrait fonctionner via prestashop)
     $this->copyDir(dirname(__FILE__) . '/override/controllers/admin/templates/', dirname(__FILE__) . '/../../override/controllers/admin/templates/');
     //Création d'une tab prestashop ( nécessaire pour le controller back office )
     $tab = new Tab();
     $tab->class_name = 'wysiwyg';
     //On va la ranger dans "Préférences comme les pages cms y sont insérée
     $id_parent = Tab::getIdFromClassName('AdminParentPreferences');
     $tab->id_parent = $id_parent;
     $tab->module = $this->name;
     $languages = Language::getLanguages();
     foreach ($languages as $lang) {
         $tab->name[$lang['id_lang']] = 'EiCmsLinks';
     }
     try {
         $tab->save();
     } catch (Exception $e) {
         echo $e->getMessage();
         return false;
     }
     //Spécifique 1.5 ( on renomme le fichier de surcharge avec le bon nom car ils ne sont pas compatibles entre les versions )
     if (_PS_VERSION_ < '1.6') {
         rename(dirname(__FILE__) . '/../../override/controllers/admin/templates/cms/helpers/form/form.tpl', dirname(__FILE__) . '/../../override/controllers/admin/templates/cms/helpers/form/form16.tpl');
         rename(dirname(__FILE__) . '/../../override/controllers/admin/templates/cms/helpers/form/form15.tpl', dirname(__FILE__) . '/../../override/controllers/admin/templates/cms/helpers/form/form.tpl');
     }
     return true;
 }
 public function init()
 {
     ${"GLOBALS"}["pcwndnxzm"] = "isoTinyMCE";
     parent::init();
     ${"GLOBALS"}["akprgggjmj"] = "languages";
     ${"GLOBALS"}["tbvspw"] = "deflang";
     ${"GLOBALS"}["vhicmlpg"] = "custom_labels";
     ${${"GLOBALS"}["tbvspw"]} = new Language(self::$cookie->id_lang);
     $tmulinwrlntj = "str_custom_multi_lang_fields";
     ${"GLOBALS"}["ktemnns"] = "custom_multi_lang_fields";
     ${${"GLOBALS"}["gdwbgebyw"]} = file_exists(_PS_ROOT_DIR_ . "/js/tiny_mce/langs/" . $deflang->iso_code . ".js") ? $deflang->iso_code : "en";
     ${${"GLOBALS"}["iffkuw"]} = str_replace("\\", "\\\\", dirname($_SERVER["PHP_SELF"]));
     ${${"GLOBALS"}["akprgggjmj"]} = Language::getLanguages(false);
     ${"GLOBALS"}["aecuqgnp"] = "custom_multi_lang_fields";
     ${${"GLOBALS"}["ijwyqrvm"]} = new AgileMultipleSeller();
     ${${"GLOBALS"}["iqpxuil"]} = Configuration::getMultiple($sellermodule->getCustomFields());
     ${${"GLOBALS"}["vhicmlpg"]} = $sellermodule->getCustomLabels(":");
     ${"GLOBALS"}["ppyvhso"] = "custom_labels";
     ${${"GLOBALS"}["aecuqgnp"]} = SellerInfo::getCustomMultiLanguageFields();
     ${$tmulinwrlntj} = "";
     ${"GLOBALS"}["wsahmoa"] = "isoTinyMCE";
     foreach (${${"GLOBALS"}["ktemnns"]} as ${${"GLOBALS"}["jbuucd"]}) {
         ${"GLOBALS"}["krcvdjennfj"] = "custom_multi_lang_field";
         ${${"GLOBALS"}["lkuqcxcngl"]} .= "&curren;" . ${${"GLOBALS"}["krcvdjennfj"]};
     }
     self::$smarty->assign(array("seller_tab_id" => 2, "ad" => ${${"GLOBALS"}["iffkuw"]}, "isoTinyMCE" => ${${"GLOBALS"}["pcwndnxzm"]}, "theme_css_dir" => _THEME_CSS_DIR_, "languages" => ${${"GLOBALS"}["tgpizrhrpccv"]}, "current_id_lang" => self::$cookie->id_lang, "conf" => ${${"GLOBALS"}["iqpxuil"]}, "custom_labels" => ${${"GLOBALS"}["ppyvhso"]}, "str_custom_multi_lang_fields" => ${${"GLOBALS"}["lkuqcxcngl"]}, "shop_url_mode" => (int) Configuration::get("ASP_SHOP_URL_MODE"), "iso_code" => ${${"GLOBALS"}["wsahmoa"]}));
 }
示例#14
0
 public function saveBlog()
 {
     // Validate
     $this->validateBlog();
     $languages = Language::getLanguages(0);
     // insert new data
     $title = Tools::getValue('title');
     $link_rewrite = Tools::str2url($title);
     $short_description = Tools::getValue('short_description');
     $content = Tools::getValue('content');
     // Insert into smart_blog_post table
     $query_blog = "INSERT INTO " . _DB_PREFIX_ . "smart_blog_post (`id_author`, `id_category`, `position`, `active`, `available`, `created`, `post_type`, `comment_status`,`viewed`, `is_featured`)\n\t\t\t\t  VALUES ('" . $this->context->controller->seller->id . "', 1, 0, 1, 1, '" . date('Y-m-d H:i:s') . "', 0, 1,0,0)";
     Db::getInstance()->execute($query_blog);
     $last_id = Db::getInstance()->Insert_ID();
     // insert into smart_blog_post_lang table
     $insert_data = array();
     foreach ($languages as $key => $value) {
         $id_lang = $value['id_lang'];
         $insert_data[] = '(' . $last_id . ', ' . $id_lang . ', "' . pSQL($title) . '", "' . pSQL($short_description) . '", "' . pSQL($short_description) . '", "' . pSQL($content) . '", "' . pSQL($link_rewrite) . '")';
     }
     $flat_data = implode(",", $insert_data);
     $query_blog_lang = "INSERT INTO " . _DB_PREFIX_ . "smart_blog_post_lang (`id_smart_blog_post`, `id_lang`, `meta_title`, `meta_description`, `short_description`, `content`, `link_rewrite`) VALUES \n\t\t" . $flat_data;
     Db::getInstance()->execute($query_blog_lang);
     // insert into smart_blog_post_shop
     $blog_shop = "INSERT INTO " . _DB_PREFIX_ . "smart_blog_post_shop (`id_smart_blog_post`,`id_shop`) VALUES(" . $last_id . ",1)";
     Db::getInstance()->execute($blog_shop);
     return $last_id;
     // die('<pre>'.print_r($query, true));
 }
 public function renderForm()
 {
     if (Context::getContext()->shop->getContext() != Shop::CONTEXT_SHOP && Shop::isFeatureActive()) {
         $this->errors[] = $this->l('You have to select a shop before creating new orders.');
     }
     $id_cart = (int) Tools::getValue('id_cart');
     $cart = new Cart((int) $id_cart);
     if ($id_cart && !Validate::isLoadedObject($cart)) {
         $this->errors[] = $this->l('This cart does not exists');
     }
     if ($id_cart && Validate::isLoadedObject($cart) && !$cart->id_customer) {
         $this->errors[] = $this->l('The cart must have a customer');
     }
     if (count($this->errors)) {
         return false;
     }
     parent::renderForm();
     unset($this->toolbar_btn['save']);
     $this->addJqueryPlugin(array('autocomplete', 'fancybox', 'typewatch'));
     $defaults_order_state = array('cheque' => (int) Configuration::get('PS_OS_CHEQUE'), 'bankwire' => (int) Configuration::get('PS_OS_BANKWIRE'), 'cashondelivery' => Configuration::get('PS_OS_COD_VALIDATION') ? (int) Configuration::get('PS_OS_COD_VALIDATION') : (int) Configuration::get('PS_OS_PREPARATION'), 'other' => (int) Configuration::get('PS_OS_PAYMENT'));
     $payment_modules = array();
     foreach (PaymentModule::getInstalledPaymentModules() as $p_module) {
         $payment_modules[] = Module::getInstanceById((int) $p_module['id_module']);
     }
     $this->context->smarty->assign(array('recyclable_pack' => (int) Configuration::get('PS_RECYCLABLE_PACK'), 'gift_wrapping' => (int) Configuration::get('PS_GIFT_WRAPPING'), 'cart' => $cart, 'currencies' => Currency::getCurrenciesByIdShop(Context::getContext()->shop->id), 'langs' => Language::getLanguages(true, Context::getContext()->shop->id), 'payment_modules' => $payment_modules, 'order_states' => OrderState::getOrderStates((int) Context::getContext()->language->id), 'defaults_order_state' => $defaults_order_state, 'show_toolbar' => $this->show_toolbar, 'toolbar_btn' => $this->toolbar_btn, 'toolbar_scroll' => $this->toolbar_scroll, 'PS_CATALOG_MODE' => Configuration::get('PS_CATALOG_MODE'), 'title' => array($this->l('Orders'), $this->l('Create order'))));
     $this->content .= $this->createTemplate('form.tpl')->fetch();
 }
 public function install()
 {
     // Install SQL
     include dirname(__FILE__) . '/sql/install.php';
     foreach ($sql as $s) {
         if (!Db::getInstance()->execute($s)) {
             return false;
         }
     }
     // Install Tabs
     if (!(int) Tab::getIdFromClassName('AdminPosMenu')) {
         $parent_tab = new Tab();
         // Need a foreach for the language
         $parent_tab->name[$this->context->language->id] = $this->l('PosExtentions');
         $parent_tab->class_name = 'AdminPosMenu';
         $parent_tab->id_parent = 0;
         // Home tab
         $parent_tab->module = $this->name;
         $parent_tab->add();
     }
     $tab = new Tab();
     // Need a foreach for the language
     foreach (Language::getLanguages() as $language) {
         $tab->name[$language['id_lang']] = $this->l('Manage Staticblocks');
     }
     $tab->class_name = 'AdminPosstaticblocks';
     $tab->id_parent = (int) Tab::getIdFromClassName('AdminPosMenu');
     $tab->module = $this->name;
     $tab->add();
     // Set some defaults
     return parent::install() && $this->registerHook('top') && $this->registerHook('brandSlider') && $this->registerHook('bannerSlide') && $this->registerHook('blockPosition1') && $this->registerHook('blockPosition2') && $this->registerHook('blockPosition3') && $this->registerHook('blockPosition4') && $this->registerHook('blockPosition5') && $this->registerHook('blockPosition6') && $this->registerHook('bannerTabcate') && $this->registerHook('blockDetailProduct') && $this->registerHook('leftColumn') && $this->registerHook('rightColumn') && $this->registerHook('home') && $this->registerHook('footer') && $this->registerHook('displayHeader') && $this->registerHook('displayBackOfficeHeader');
 }
    public function __construct()
    {
        $this->bootstrap = true;
        if (Configuration::get('PS_LOG_EMAILS')) {
            $this->table = 'mail';
            $this->className = 'Mail';
            $this->lang = false;
            $this->noLink = true;
            $this->list_no_link = true;
            $this->explicitSelect = true;
            $this->addRowAction('delete');
            $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'), 'icon' => 'icon-trash'));
            foreach (Language::getLanguages() as $language) {
                $languages[$language['id_lang']] = $language['name'];
            }
            $this->fields_list = array('id_mail' => array('title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs'), 'recipient' => array('title' => $this->l('Recipient')), 'template' => array('title' => $this->l('Template')), 'language' => array('title' => $this->l('Language'), 'type' => 'select', 'color' => 'color', 'list' => $languages, 'filter_key' => 'a!id_lang', 'filter_type' => 'int', 'order_key' => 'language'), 'subject' => array('title' => $this->l('Subject')), 'date_add' => array('title' => $this->l('Sent'), 'type' => 'datetime'));
            $this->_select .= 'l.name as language';
            $this->_join .= ' LEFT JOIN ' . _DB_PREFIX_ . 'lang l ON (a.id_lang = l.id_lang)';
            $this->_use_found_rows = false;
        }
        parent::__construct();
        foreach (Contact::getContacts($this->context->language->id) as $contact) {
            $arr[] = array('email_message' => $contact['id_contact'], 'name' => $contact['name']);
        }
        $this->fields_options = array('email' => array('title' => $this->l('Email'), 'icon' => 'icon-envelope', 'fields' => array('PS_MAIL_EMAIL_MESSAGE' => array('title' => $this->l('Send email to'), 'desc' => $this->l('Where customers send messages from the order page.'), 'validation' => 'isUnsignedId', 'type' => 'select', 'cast' => 'intval', 'identifier' => 'email_message', 'list' => $arr), 'PS_MAIL_METHOD' => array('title' => '', 'validation' => 'isGenericName', 'type' => 'radio', 'required' => true, 'choices' => array(3 => $this->l('Never send emails (may be useful for testing purposes)'), 2 => $this->l('Set my own SMTP parameters (for advanced users ONLY)'))), 'PS_MAIL_TYPE' => array('title' => '', 'validation' => 'isGenericName', 'type' => 'radio', 'required' => true, 'choices' => array(Mail::TYPE_HTML => $this->l('Send email in HTML format'), Mail::TYPE_TEXT => $this->l('Send email in text format'), Mail::TYPE_BOTH => $this->l('Both'))), 'PS_LOG_EMAILS' => array('title' => $this->l('Log Emails'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool')), 'submit' => array('title' => $this->l('Save'))), 'smtp' => array('title' => $this->l('Email'), 'fields' => array('PS_MAIL_DOMAIN' => array('title' => $this->l('Mail domain name'), 'hint' => $this->l('Fully qualified domain name (keep this field empty if you don\'t know).'), 'empty' => true, 'validation' => 'isUrl', 'type' => 'text'), 'PS_MAIL_SERVER' => array('title' => $this->l('SMTP server'), 'hint' => $this->l('IP address or server name (e.g. smtp.mydomain.com).'), 'validation' => 'isGenericName', 'type' => 'text'), 'PS_MAIL_USER' => array('title' => $this->l('SMTP username'), 'hint' => $this->l('Leave blank if not applicable.'), 'validation' => 'isGenericName', 'type' => 'text'), 'PS_MAIL_PASSWD' => array('title' => $this->l('SMTP password'), 'hint' => $this->l('Leave blank if not applicable.'), 'validation' => 'isAnything', 'type' => 'password', 'autocomplete' => false), 'PS_MAIL_SMTP_ENCRYPTION' => array('title' => $this->l('Encryption'), 'hint' => $this->l('Use an encrypt protocol'), 'desc' => extension_loaded('openssl') ? '' : '/!\\ ' . $this->l('SSL does not seem to be available on your server.'), 'type' => 'select', 'cast' => 'strval', 'identifier' => 'mode', 'list' => array(array('mode' => 'off', 'name' => $this->l('None')), array('mode' => 'tls', 'name' => $this->l('TLS')), array('mode' => 'ssl', 'name' => $this->l('SSL')))), 'PS_MAIL_SMTP_PORT' => array('title' => $this->l('Port'), 'hint' => $this->l('Port number to use.'), 'validation' => 'isInt', 'type' => 'text', 'cast' => 'intval', 'class' => 'fixed-width-sm')), 'submit' => array('title' => $this->l('Save'))), 'test' => array('title' => $this->l('Test your email configuration'), 'hide_multishop_checkbox' => true, 'fields' => array('PS_SHOP_EMAIL' => array('title' => $this->l('Send a test email to'), 'type' => 'text', 'id' => 'testEmail', 'no_multishop_checkbox' => true)), 'bottom' => '<div class="row"><div class="col-lg-9 col-lg-offset-3">
					<div class="alert" id="mailResultCheck" style="display:none;"></div>
				</div></div>', 'buttons' => array(array('title' => $this->l('Send a test email'), 'icon' => 'process-icon-envelope', 'name' => 'btEmailTest', 'js' => 'verifyMail()', 'class' => 'btn btn-default pull-right'))));
        if (!defined('_PS_HOST_MODE_')) {
            $this->fields_options['email']['fields']['PS_MAIL_METHOD']['choices'][1] = $this->l('Use PHP\'s mail() function (recommended; works in most cases)');
        }
        ksort($this->fields_options['email']['fields']['PS_MAIL_METHOD']['choices']);
    }
示例#18
0
    public function __construct()
    {
        global $cookie;
        $this->table = 'customer_thread';
        $this->lang = false;
        $this->className = 'CustomerThread';
        $this->edit = false;
        $this->view = true;
        $this->delete = true;
        $this->_select = 'CONCAT(c.firstname," ",c.lastname) as customer, cl.name as contact, l.name as language, group_concat(message) as messages, (
			SELECT IFNULL(CONCAT(LEFT(e.firstname, 1),". ",e.lastname), "--")
			FROM ' . _DB_PREFIX_ . 'customer_message cm2 INNER JOIN ' . _DB_PREFIX_ . 'employee e ON e.id_employee = cm2.id_employee
			WHERE cm2.id_employee > 0 AND cm2.`id_customer_thread` = a.`id_customer_thread`
			ORDER BY cm2.date_add DESC LIMIT 1) as employee';
        $this->_group = 'GROUP BY cm.id_customer_thread';
        $this->_join = '
		LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON c.`id_customer` = a.`id_customer`
		LEFT JOIN `' . _DB_PREFIX_ . 'customer_message` cm ON cm.`id_customer_thread` = a.`id_customer_thread`
		LEFT JOIN `' . _DB_PREFIX_ . 'lang` l ON l.`id_lang` = a.`id_lang`
		LEFT JOIN `' . _DB_PREFIX_ . 'contact_lang` cl ON (cl.`id_contact` = a.`id_contact` AND cl.`id_lang` = ' . (int) $cookie->id_lang . ')';
        $contactArray = array();
        $contacts = Contact::getContacts($cookie->id_lang);
        foreach ($contacts as $contact) {
            $contactArray[$contact['id_contact']] = $contact['name'];
        }
        $languageArray = array();
        $languages = Language::getLanguages();
        foreach ($languages as $language) {
            $languageArray[$language['id_lang']] = $language['name'];
        }
        $statusArray = array('open' => $this->l('Open'), 'closed' => $this->l('Closed'), 'pending1' => $this->l('Pending 1'), 'pending2' => $this->l('Pending 2'));
        $imagesArray = array('open' => 'status_green.gif', 'closed' => 'status_red.gif', 'pending1' => 'status_orange.gif', 'pending2' => 'status_orange.gif');
        $this->fieldsDisplay = array('id_customer_thread' => array('title' => $this->l('ID'), 'width' => 25), 'customer' => array('title' => $this->l('Customer'), 'width' => 100, 'filter_key' => 'customer', 'tmpTableFilter' => true), 'email' => array('title' => $this->l('E-mail'), 'width' => 100, 'filter_key' => 'a!email'), 'contact' => array('title' => $this->l('Type'), 'width' => 75, 'type' => 'select', 'select' => $contactArray, 'filter_key' => 'cl!id_contact', 'filter_type' => 'int'), 'language' => array('title' => $this->l('Language'), 'width' => 60, 'type' => 'select', 'select' => $languageArray, 'filter_key' => 'l!id_lang', 'filter_type' => 'int'), 'status' => array('title' => $this->l('Status'), 'width' => 50, 'type' => 'select', 'select' => $statusArray, 'icon' => $imagesArray, 'align' => 'center', 'filter_key' => 'a!status', 'filter_type' => 'string'), 'employee' => array('title' => $this->l('Employee'), 'width' => 100, 'filter_key' => 'employee', 'tmpTableFilter' => true), 'messages' => array('title' => $this->l('Messages'), 'width' => 50, 'filter_key' => 'messages', 'tmpTableFilter' => true, 'maxlength' => 0), 'date_upd' => array('title' => $this->l('Last message'), 'width' => 90));
        parent::__construct();
    }
示例#19
0
 public function install()
 {
     // Prepare tab
     $tab = new Tab();
     $tab->active = 1;
     $tab->class_name = "AdminBlockCategories";
     $tab->name = array();
     foreach (Language::getLanguages(true) as $lang) {
         $tab->name[$lang['id_lang']] = 'BlockCategories';
     }
     $tab->id_parent = -1;
     $tab->module = $this->name;
     if (!$tab->add() || !parent::install() || !$this->registerHook('footer') || !$this->registerHook('header') || !$this->registerHook('categoryAddition') || !$this->registerHook('categoryUpdate') || !$this->registerHook('categoryDeletion') || !$this->registerHook('actionAdminMetaControllerUpdate_optionsBefore') || !$this->registerHook('actionAdminLanguagesControllerStatusBefore') || !$this->registerHook('displayBackOfficeCategory') || !Configuration::updateValue('BLOCK_CATEG_MAX_DEPTH', 4) || !Configuration::updateValue('BLOCK_CATEG_DHTML', 1) || !Configuration::updateValue('BLOCK_CATEG_ROOT_CATEGORY', 1)) {
         return false;
     }
     // Hook the module either on the left or right column
     $theme = new Theme(Context::getContext()->shop->id_theme);
     if ((!$theme->default_left_column || !$this->registerHook('leftColumn')) && (!$theme->default_right_column || !$this->registerHook('rightColumn'))) {
         // If there are no colums implemented by the template, throw an error and uninstall the module
         $this->_errors[] = $this->l('This module need to be hooked in a column and your theme does not implement one');
         parent::uninstall();
         return false;
     }
     return true;
 }
 public function __construct()
 {
     $this->context = Context::getContext();
     $this->table = 'customer_thread';
     $this->className = 'CustomerThread';
     $this->lang = false;
     $contact_array = array();
     $contacts = Contact::getContacts($this->context->language->id);
     foreach ($contacts as $contact) {
         $contact_array[$contact['id_contact']] = $contact['name'];
     }
     $language_array = array();
     $languages = Language::getLanguages();
     foreach ($languages as $language) {
         $language_array[$language['id_lang']] = $language['name'];
     }
     $images_array = array('open' => array('src' => 'status_green.png', 'alt' => $this->l('Open')), 'closed' => array('src' => 'status_red.png', 'alt' => $this->l('Closed')), 'pending1' => array('src' => 'status_orange.png', 'alt' => $this->l('Pending 1')), 'pending2' => array('src' => 'status_orange.png', 'alt' => $this->l('Pending 2')));
     $status_array = array();
     foreach ($images_array as $k => $v) {
         $status_array[$k] = $v['alt'];
     }
     $this->fields_list = array('id_customer_thread' => array('title' => $this->l('ID'), 'width' => 25), 'customer' => array('title' => $this->l('Customer'), 'width' => 100, 'filter_key' => 'customer', 'tmpTableFilter' => true), 'email' => array('title' => $this->l('E-mail'), 'width' => 100, 'filter_key' => 'a!email'), 'contact' => array('title' => $this->l('Type'), 'width' => 75, 'type' => 'select', 'list' => $contact_array, 'filter_key' => 'cl!id_contact', 'filter_type' => 'int'), 'language' => array('title' => $this->l('Language'), 'width' => 60, 'type' => 'select', 'list' => $language_array, 'filter_key' => 'l!id_lang', 'filter_type' => 'int'), 'status' => array('title' => $this->l('Status'), 'width' => 50, 'type' => 'select', 'list' => $status_array, 'icon' => $images_array, 'align' => 'center', 'filter_key' => 'a!status', 'filter_type' => 'string'), 'employee' => array('title' => $this->l('Employee'), 'width' => 100, 'filter_key' => 'employee', 'tmpTableFilter' => true), 'messages' => array('title' => $this->l('Messages'), 'width' => 50, 'filter_key' => 'messages', 'tmpTableFilter' => true, 'maxlength' => 40), 'date_upd' => array('title' => $this->l('Last message'), 'width' => 90, 'havingFilter' => true));
     $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
     $this->shopLinkType = 'shop';
     $this->fields_options = array('contact' => array('title' => $this->l('Contact options'), 'fields' => array('PS_CUSTOMER_SERVICE_FILE_UPLOAD' => array('title' => $this->l('Allow file upload'), 'desc' => $this->l('Allow customers to upload file using contact page'), 'type' => 'bool'), 'PS_CUSTOMER_SERVICE_SIGNATURE' => array('title' => $this->l('Default message'), 'desc' => $this->l('Please fill the message that appears by default when you answer a thread on the customer service page'), 'type' => 'textareaLang', 'lang' => true, 'rows' => 10, 'cols' => 40))), 'general' => array('title' => $this->l('Customer service options'), 'fields' => array('PS_SAV_IMAP_URL' => array('title' => $this->l('IMAP URL'), 'desc' => $this->l('URL for IMAP server (mail.server.com)'), 'type' => 'text', 'size' => 40), 'PS_SAV_IMAP_PORT' => array('title' => $this->l('IMAP port'), 'desc' => $this->l('Port to use to connect to IMAP server'), 'type' => 'text', 'defaultValue' => 143), 'PS_SAV_IMAP_USER' => array('title' => $this->l('IMAP user'), 'desc' => $this->l('User to use to connect to IMAP server'), 'type' => 'text', 'size' => 40), 'PS_SAV_IMAP_PWD' => array('title' => $this->l('IMAP password'), 'desc' => $this->l('Password to use to connect IMAP server'), 'type' => 'text', 'size' => 40), 'PS_SAV_IMAP_DELETE_MSG' => array('title' => $this->l('Delete messages'), 'desc' => $this->l('Delete messages after sync. If you do not active this option, the sync will be longer'), 'type' => 'bool'), 'PS_SAV_IMAP_OPT_NORSH' => array('title' => $this->l('IMAP options') . ' (/norsh)', 'type' => 'bool', 'desc' => $this->l('Do not use RSH or SSH to establish a preauthenticated IMAP session')), 'PS_SAV_IMAP_OPT_SSL' => array('title' => $this->l('IMAP options') . ' (/ssl)', 'type' => 'bool', 'desc' => $this->l('Use the Secure Socket Layer to encrypt the session')), 'PS_SAV_IMAP_OPT_VALIDATE-CERT' => array('title' => $this->l('IMAP options') . ' (/validate-cert)', 'type' => 'bool', 'desc' => $this->l('Validate certificates from TLS/SSL server')), 'PS_SAV_IMAP_OPT_NOVALIDATE-CERT' => array('title' => $this->l('IMAP options') . ' (/novalidate-cert)', 'type' => 'bool', 'desc' => $this->l('Do not validate certificates from TLS/SSL server, needed if server uses self-signed certificates')), 'PS_SAV_IMAP_OPT_TLS' => array('title' => $this->l('IMAP options') . ' (/tls)', 'type' => 'bool', 'desc' => $this->l('Force use of start-TLS to encrypt the session, and reject connection to servers that do not support it')), 'PS_SAV_IMAP_OPT_NOTLS' => array('title' => $this->l('IMAP options') . ' (/notls)', 'type' => 'bool', 'desc' => $this->l('Do not use start-TLS to encrypt the session, even with servers that support it'))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button')));
     parent::__construct();
 }
 protected function _regenerateThumbnails($type = 'all', $deleteOldImages = false)
 {
     $this->start_time = time();
     ini_set('max_execution_time', $this->max_execution_time);
     // ini_set may be disabled, we need the real value
     $this->max_execution_time = (int) ini_get('max_execution_time');
     $languages = Language::getLanguages(false);
     $process = array(array('type' => 'categories', 'dir' => _PS_CAT_IMG_DIR_), array('type' => 'manufacturers', 'dir' => _PS_MANU_IMG_DIR_), array('type' => 'suppliers', 'dir' => _PS_SUPP_IMG_DIR_), array('type' => 'scenes', 'dir' => _PS_SCENE_IMG_DIR_), array('type' => 'products', 'dir' => _PS_PROD_IMG_DIR_), array('type' => 'stores', 'dir' => _PS_STORE_IMG_DIR_));
     // Launching generation process
     foreach ($process as $proc) {
         if ($type != 'all' && $type != $proc['type']) {
             continue;
         }
         // Getting format generation
         $formats = ImageType::getImagesTypes($proc['type']);
         if ($type != 'all') {
             $format = strval(Tools::getValue('format_' . $type));
             if ($format != 'all') {
                 foreach ($formats as $k => $form) {
                     if ($form['id_image_type'] != $format) {
                         unset($formats[$k]);
                     } else {
                         $this_format = $formats[$k]['name'];
                     }
                 }
             }
         }
         if ($deleteOldImages) {
             $this->_deleteOldImages($proc['dir'], $formats, $proc['type'] == 'products' ? true : false);
         }
         if ($type == 'stores' && !empty($this_format) && stripos($this_format, 'aph_offer') !== false && ($return = $this->_regenerateNewImagesOfOffers($proc['dir'], $formats)) === true) {
             error_log(__LINE__);
             if (!count($this->errors)) {
                 $this->errors[] = sprintf(Tools::displayError('Cannot write images for this type: %s. Please check the %s folder\'s writing permissions.'), $proc['type'], $proc['dir']);
             }
         } elseif ($type == 'stores' && ($return = $this->_regenerateNewImagesOfShops($proc['dir'], $formats)) === true) {
             if (!count($this->errors)) {
                 $this->errors[] = sprintf(Tools::displayError('Cannot write images for this type: %s. Please check the %s folder\'s writing permissions.'), $proc['type'], $proc['dir']);
             }
         } elseif (($return = $this->_regenerateNewImages($proc['dir'], $formats, $proc['type'] == 'products' ? true : false)) === true) {
             if (!count($this->errors)) {
                 $this->errors[] = sprintf(Tools::displayError('Cannot write images for this type: %s. Please check the %s folder\'s writing permissions.'), $proc['type'], $proc['dir']);
             }
         } elseif ($return == 'timeout') {
             $this->errors[] = Tools::displayError('Only part of the images have been regenerated. The server timed out before finishing.');
         } else {
             if ($proc['type'] == 'products') {
                 if ($this->_regenerateWatermark($proc['dir'], $formats) == 'timeout') {
                     $this->errors[] = Tools::displayError('Server timed out. The watermark may not have been applied to all images.');
                 }
             }
             if (!count($this->errors)) {
                 if ($this->_regenerateNoPictureImages($proc['dir'], $formats, $languages)) {
                     $this->errors[] = sprintf(Tools::displayError('Cannot write "No picture" image to (%s) images folder. Please check the folder\'s writing permissions.'), $proc['type']);
                 }
             }
         }
     }
     return count($this->errors) > 0 ? false : true;
 }
示例#22
0
 public function getTranslationsFieldsChild()
 {
     $fieldsArray = array('description', 'short_description', 'meta_title', 'meta_keywords', 'meta_description');
     $fields = array();
     $languages = Language::getLanguages();
     $defaultLanguage = Configuration::get('PS_LANG_DEFAULT');
     foreach ($languages as $language) {
         $fields[$language['id_lang']]['id_lang'] = $language['id_lang'];
         $fields[$language['id_lang']][$this->identifier] = intval($this->id);
         $fields[$language['id_lang']]['description'] = isset($this->description[$language['id_lang']]) ? pSQL($this->description[$language['id_lang']], true) : '';
         $fields[$language['id_lang']]['short_description'] = isset($this->short_description[$language['id_lang']]) ? pSQL($this->short_description[$language['id_lang']], true) : '';
         foreach ($fieldsArray as $field) {
             if (!Validate::isTableOrIdentifier($field)) {
                 die(Tools::displayError());
             }
             /* Check fields validity */
             if (isset($this->{$field}[$language['id_lang']]) and !empty($this->{$field}[$language['id_lang']])) {
                 $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']], true);
             } elseif (in_array($field, $this->fieldsRequiredLang)) {
                 $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage]);
             } else {
                 $fields[$language['id_lang']][$field] = '';
             }
         }
     }
     return $fields;
 }
示例#23
0
 public function install()
 {
     if (!parent::install() || !$this->registerHook('leftColumn') || !$this->registerHook('rightColumn') || !$this->registerHook('header') || !$this->registerHook('footer') || !$this->registerHook('actionObjectCmsUpdateAfter') || !$this->registerHook('actionObjectCmsDeleteAfter') || !$this->registerHook('actionShopDataDuplication') || !$this->registerHook('actionAdminStoresControllerUpdate_optionsAfter') || !BlockCMSModel::createTables() || !Configuration::updateValue('FOOTER_CMS', '') || !Configuration::updateValue('FOOTER_BLOCK_ACTIVATION', 1) || !Configuration::updateValue('FOOTER_POWEREDBY', 1) || !Configuration::updateValue('FOOTER_PRICE-DROP', 1) || !Configuration::updateValue('FOOTER_NEW-PRODUCTS', 1) || !Configuration::updateValue('FOOTER_BEST-SALES', 1) || !Configuration::updateValue('FOOTER_CONTACT', 1) || !Configuration::updateValue('FOOTER_SITEMAP', 1)) {
         return false;
     }
     $this->_clearCache('blockcms.tpl');
     // Install fixtures for blockcms
     $default = Db::getInstance()->insert('cms_block', array('id_cms_category' => 1, 'location' => 0, 'position' => 0));
     if (!$default) {
         return false;
     }
     $result = true;
     $id_cms_block = Db::getInstance()->Insert_ID();
     $shops = Shop::getShops(true, null, true);
     foreach ($shops as $shop) {
         $result &= Db::getInstance()->insert('cms_block_shop', array('id_cms_block' => $id_cms_block, 'id_shop' => $shop));
     }
     $languages = Language::getLanguages(false);
     foreach ($languages as $lang) {
         $result &= Db::getInstance()->insert('cms_block_lang', array('id_cms_block' => $id_cms_block, 'id_lang' => $lang['id_lang'], 'name' => $this->l('Information')));
     }
     $pages = CMS::getCMSPages(null, 1);
     foreach ($pages as $cms) {
         $result &= Db::getInstance()->insert('cms_block_page', array('id_cms_block' => $id_cms_block, 'id_cms' => $cms['id_cms'], 'is_category' => 0));
     }
     return $result;
 }
示例#24
0
 public function install()
 {
     /* Before creating a new tab "AdminSelfUpgrade" we need to remove any existing "AdminUpgrade" tab (present in v1.4.4.0 and v1.4.4.1) */
     if ($id_tab = Tab::getIdFromClassName('AdminUpgrade')) {
         $tab = new Tab((int) $id_tab);
         if (!$tab->delete()) {
             $this->_errors[] = sprintf($this->l('Unable to delete outdated AdminUpgrade tab %d'), (int) $id_tab);
         }
     }
     /* If the "AdminSelfUpgrade" tab does not exist yet, create it */
     if (!($id_tab = Tab::getIdFromClassName('AdminSelfUpgrade'))) {
         $tab = new Tab();
         $tab->class_name = 'AdminSelfUpgrade';
         $tab->module = 'autoupgrade';
         $tab->id_parent = (int) Tab::getIdFromClassName('AdminTools');
         foreach (Language::getLanguages(false) as $lang) {
             $tab->name[(int) $lang['id_lang']] = '1-Click Upgrade';
         }
         if (!$tab->save()) {
             return $this->_abortInstall($this->l('Unable to create the "AdminSelfUpgrade" tab'));
         }
         if (!@copy(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'logo.gif', _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 't' . DIRECTORY_SEPARATOR . 'AdminSelfUpgrade.gif')) {
             return $this->_abortInstall(sprintf($this->l('Unable to copy logo.gif in %s'), _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 't' . DIRECTORY_SEPARATOR));
         }
     } else {
         $tab = new Tab((int) $id_tab);
     }
     /* Update the "AdminSelfUpgrade" tab id in database or exit */
     if (Validate::isLoadedObject($tab)) {
         Configuration::updateValue('PS_AUTOUPDATE_MODULE_IDTAB', (int) $tab->id);
     } else {
         return $this->_abortInstall($this->l('Unable to load the "AdminSelfUpgrade" tab'));
     }
     /* Check that the 1-click upgrade working directory is existing or create it */
     $autoupgrade_dir = _PS_ADMIN_DIR_ . DIRECTORY_SEPARATOR . 'autoupgrade';
     if (!file_exists($autoupgrade_dir) && !@mkdir($autoupgrade_dir, 0755)) {
         return $this->_abortInstall(sprintf($this->l('Unable to create the directory "%s"'), $autoupgrade_dir));
     }
     /* Make sure that the 1-click upgrade working directory is writeable */
     if (!is_writable($autoupgrade_dir)) {
         return $this->_abortInstall(sprintf($this->l('Unable to write in the directory "%s"'), $autoupgrade_dir));
     }
     /* If a previous version of ajax-upgradetab.php exists, delete it */
     if (file_exists($autoupgrade_dir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php')) {
         @unlink($autoupgrade_dir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php');
     }
     /* Then, try to copy the newest version from the module's directory */
     if (!@copy(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php', $autoupgrade_dir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php')) {
         return $this->_abortInstall(sprintf($this->l('Unable to copy ajax-upgradetab.php in %s'), $autoupgrade_dir));
     }
     /* Make sure that the XML config directory exists */
     if (!file_exists(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml') && !@mkdir(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml', 0755)) {
         return $this->_abortInstall(sprintf($this->l('Unable to create the directory "%s"'), _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml'));
     }
     /* Create a dummy index.php file in the XML config directory to avoid directory listing */
     if (!file_exists(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'index.php') && (file_exists(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'index.php') && !@copy(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'index.php', _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'index.php'))) {
         return $this->_abortInstall(sprintf($this->l('Unable to create the directory "%s"'), _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml'));
     }
     return parent::install();
 }
 public function getSettings($id_lang = false)
 {
     $settings = $this->index_settings;
     $attributes_to_index = array();
     $attributes_for_faceting = array();
     foreach ($this->index_settings['attributesToIndex'] as $attribute) {
         if ($id_lang === false) {
             foreach (Language::getLanguages() as $language) {
                 array_push($attributes_to_index, $attribute . "_" . $language['iso_code']);
             }
         } else {
             array_push($attributes_to_index, $attribute . "_" . Language::getIsoById($id_lang));
         }
     }
     foreach ($this->index_settings['attributesForFaceting'] as $attribute) {
         if ($id_lang === false) {
             foreach (Language::getLanguages() as $language) {
                 array_push($attributes_for_faceting, $attribute . "_" . $language['iso_code']);
             }
         } else {
             array_push($attributes_for_faceting, $attribute . "_" . Language::getIsoById($id_lang));
         }
     }
     $settings['attributesToIndex'] = $attributes_to_index;
     $settings['attributesForFaceting'] = $attributes_for_faceting;
     return $settings;
 }
示例#26
0
 public function create_states()
 {
     $this->order_state = array(1 => array('ccfbff', '00100', 'PagSeguro - Aguardando Pagto', ''), 2 => array('fcffcf', '00100', 'PagSeguro - Em análise', ''), 3 => array('ffffff', '10100', 'PagSeguro - Aprovado', ''), 4 => array('c9fecd', '11110', 'PagSeguro - Completo', 'payment'), 5 => array('c9fecd', '11110', 'PagSeguro - Em Disputa', 'order_canceled'), 6 => array('d6d6d6', '00100', 'PagSeguro - Em Aberto', ''), 7 => array('fec9c9', '11110', 'PagSeguro - Cancelado', 'order_canceled'));
     /** INSTALANDO STATUS PagSeguro * */
     foreach ($this->order_state as $key => $value) {
         $orderState = new OrderState();
         $orderState->name = array();
         foreach (Language::getLanguages() as $language) {
             $orderState->name[$language['id_lang']] = $value[2];
         }
         $orderState->send_email = (int) $value[1][1];
         $orderState->color = '#' . $value[0];
         $orderState->hidden = false;
         $orderState->delivery = (int) $value[1][4];
         $orderState->logable = (int) $value[1][3];
         $orderState->invoice = (int) $value[1][0];
         if ($orderState->add()) {
             /** COPIANDO O ICONE ATUAL * */
             $file = dirname(__FILE__) . "/icons/{$key}.gif";
             $newfile = dirname(dirname(dirname(__FILE__))) . "/img/os/{$orderState->id}.gif";
             if (!copy($file, $newfile)) {
                 return false;
             }
         }
         /** GRAVA AS CONFIGURAÇÕES  * */
         Configuration::updateValue("PAGSEGURO_STATUS_{$key}", (int) $orderState->id);
     }
     return true;
 }
示例#27
0
 protected function _prepareHook($params)
 {
     $languages = Language::getLanguages(true, $this->context->shop->id);
     if (!count($languages)) {
         return false;
     }
     $link = new Link();
     if ((int) Configuration::get('PS_REWRITING_SETTINGS')) {
         $default_rewrite = array();
         if (Dispatcher::getInstance()->getController() == 'product' && ($id_product = (int) Tools::getValue('id_product'))) {
             $rewrite_infos = Product::getUrlRewriteInformations((int) $id_product);
             foreach ($rewrite_infos as $infos) {
                 $default_rewrite[$infos['id_lang']] = $link->getProductLink((int) $id_product, $infos['link_rewrite'], $infos['category_rewrite'], $infos['ean13'], (int) $infos['id_lang']);
             }
         }
         if (Dispatcher::getInstance()->getController() == 'category' && ($id_category = (int) Tools::getValue('id_category'))) {
             $rewrite_infos = Category::getUrlRewriteInformations((int) $id_category);
             foreach ($rewrite_infos as $infos) {
                 $default_rewrite[$infos['id_lang']] = $link->getCategoryLink((int) $id_category, $infos['link_rewrite'], $infos['id_lang']);
             }
         }
         if (Dispatcher::getInstance()->getController() == 'cms' && (($id_cms = (int) Tools::getValue('id_cms')) || ($id_cms_category = (int) Tools::getValue('id_cms_category')))) {
             $rewrite_infos = isset($id_cms) && !isset($id_cms_category) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category);
             foreach ($rewrite_infos as $infos) {
                 $arr_link = isset($id_cms) && !isset($id_cms_category) ? $link->getCMSLink($id_cms, $infos['link_rewrite'], null, $infos['id_lang']) : $link->getCMSCategoryLink($id_cms_category, $infos['link_rewrite'], $infos['id_lang']);
                 $default_rewrite[$infos['id_lang']] = $arr_link;
             }
         }
         $this->smarty->assign('lang_rewrite_urls', $default_rewrite);
     }
     return true;
 }
 /**
  * Installation du module
  */
 public function install()
 {
     if (!parent::install() || !$this->registerHook('actionCustomerAccountAdd')) {
         return false;
     }
     //Création d'une tab prestashop
     $tab = new Tab();
     $tab->class_name = 'Rules';
     $tab->module = $this->name;
     $tab->id_parent = Tab::getIdFromClassName('AdminParentCustomer');
     $languages = Language::getLanguages();
     foreach ($languages as $lang) {
         $tab->name[$lang['id_lang']] = 'Customer Auto Groups';
     }
     try {
         $tab->save();
     } catch (Exception $e) {
         echo $e->getMessage();
         return false;
     }
     if (!$this->_installSql()) {
         return false;
     }
     return true;
 }
示例#29
0
 public function install()
 {
     if (!parent::install() || !$this->registerHooks() || !BlockCMSModel::createTables() || !Configuration::updateValue('FOOTER_CMS', '') || !Configuration::updateValue('FOOTER_BLOCK_ACTIVATION', 1) || !Configuration::updateValue('FOOTER_POWEREDBY', 1)) {
         return false;
     }
     // Install fixtures for blockcms
     $default = Db::getInstance()->insert('cms_block', array('id_cms_category' => 1, 'location' => 0, 'position' => 0));
     if (!$default) {
         return false;
     }
     $result = true;
     $id_cms_block = Db::getInstance()->Insert_ID();
     $shops = Shop::getShops(true, null, true);
     foreach ($shops as $shop) {
         $result &= Db::getInstance()->insert('cms_block_shop', array('id_cms_block' => $id_cms_block, 'id_shop' => $shop));
     }
     $languages = Language::getLanguages(false);
     foreach ($languages as $lang) {
         $result &= Db::getInstance()->insert('cms_block_lang', array('id_cms_block' => $id_cms_block, 'id_lang' => $lang['id_lang'], 'name' => $this->l('Information')));
     }
     $pages = CMS::getCMSPages(null, 1);
     foreach ($pages as $cms) {
         $result &= Db::getInstance()->insert('cms_block_page', array('id_cms_block' => $id_cms_block, 'id_cms' => $cms['id_cms'], 'is_category' => 0));
     }
     return $result;
 }
示例#30
0
    public function displayForm()
    {
        global $currentIndex;
        $obj = $this->loadObject(true);
        $defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT'));
        $languages = Language::getLanguages();
        echo '
		<script type="text/javascript">
			id_language = Number(' . $defaultLanguage . ');
		</script>
		<form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" method="post" enctype="multipart/form-data">
		' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . '
			<fieldset class="width3"><legend><img src="../img/admin/time.gif" />' . $this->l('Order statues') . '</legend>
				<label>' . $this->l('Status name:') . ' </label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            echo '
					<div id="name_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
						<input size="40" type="text" name="name_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'name', intval($language['id_lang'])), ENT_COMPAT, 'UTF-8') . '" /><sup> *</sup>
						<span class="hint" name="help_box">' . $this->l('Invalid characters: numbers and') . ' !<>,;?=+()@#"�{}_$%:<span class="hint-pointer">&nbsp;</span></span>
						</div>';
        }
        $this->displayFlags($languages, $defaultLanguage, 'name', 'name');
        echo '		<p style="clear: both">' . $this->l('Order return status name') . '</p>
				</div>
				<div class="margin-form">
					<input type="submit" value="' . $this->l('   Save   ') . '" name="submitAdd' . $this->table . '" class="button" />
				</div>
				<div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div>
			</fieldset>
		</form>';
    }