public function install()
 {
     if (!parent::install() or !$this->registerHook('header') or !$this->registerHook('productFooter') or !$this->registerHook('footer') or !$this->installDB() or !$this->fixCSS() or !$this->updatePosition(Hook::get('header'), 0, 1)) {
         return false;
     }
     return true;
 }
Example #2
0
 private function loadAddons()
 {
     $data = S('hooks');
     if (!$data) {
         $hooks = M('hooks')->getField('name,addons', true);
         foreach ($hooks as $key => $value) {
             if ($value) {
                 $map['status'] = 1;
                 $names = explode(',', $value);
                 $map['name'] = array('IN', $names);
                 $data = M('Addons')->where($map)->getField('id,name');
                 if ($data) {
                     $addons = array_intersect($names, $data);
                     Hook::add($key, $addons);
                 }
             }
         }
         S('hooks', Hook::get());
         //插件标签
         $tpl_tags = array();
         $data = M('addons')->getField('id,name');
         if ($data) {
             foreach ($data as $addon) {
                 if (is_file("HDCMS/Addons/{$addon}/Tag/{$addon}Tag.class.php")) {
                     $tpl_tags[] = "@.Addons.{$addon}.Tag.{$addon}Tag";
                 }
             }
         }
         S('HookTag', array_unique($tpl_tags));
     } else {
         Hook::import($data, false);
         C('TPL_TAGS', array_unique(array_merge(C('TPL_TAGS'), S('HookTag'))));
     }
 }
Example #3
0
 private function _checkValues()
 {
     $errors = array();
     if (isset($_POST['submitPaypalSettings'])) {
         if (!isset($_POST['sandbox'])) {
             $_POST['sandbox'] = 1;
         }
         if (!isset($_POST['expressCheckout'])) {
             $_POST['expressCheckout'] = 0;
         }
         if (!$this->_expressCheckout and intval($_POST['expressCheckout'])) {
             if (!$this->registerHook('shoppingCartExtra')) {
                 $errors[] = $this->l('Cannot register module to validCart hook, ExpressCheckout not enabled');
                 $_POST['expressCheckout'] = 0;
             }
         }
         if ($this->_expressCheckout and !intval($_POST['expressCheckout'])) {
             if (!$this->unregisterHook(Hook::get('shoppingCartExtra'))) {
                 $errors[] = $this->l('Cannot unregister module to validCart hook, ExpressCheckout not disabled');
                 $_POST['expressCheckout'] = 1;
             }
         }
     } elseif (isset($_POST['submitPaypalAPI'])) {
         if (!isset($_POST['apiUser']) or !$_POST['apiUser']) {
             $errors[] = $this->l('You need to configure your PayPal API username');
         }
         if (!isset($_POST['apiPassword']) or !$_POST['apiPassword']) {
             $errors[] = $this->l('You need to configure your PayPal API password');
         }
         if (!isset($_POST['apiSignature']) or !$_POST['apiSignature']) {
             $errors[] = $this->l('You need to configure your PayPal API signature');
         }
     }
     return $errors;
 }
Example #4
0
 public function install()
 {
     self::$obj_ts_common->install();
     $return = parent::install() && $this->registerHook('displayBackOfficeHeader') && $this->registerHook('orderConfirmation') && $this->registerHook('newOrder') && $this->registerHook('actionOrderStatusPostUpdate') && $this->registerHook('Footer') && $this->registerHook('paymentTop') && $this->registerHook('orderConfirmation');
     $id_hook = _PS_VERSION_ < '1.5' ? Hook::get('payment') : Hook::getIdByName('payment');
     $this->updatePosition($id_hook, 0, 1);
     return $return;
 }
Example #5
0
 public function install()
 {
     $homeHookID = $this->isPrestaShop15x ? $this->isPrestaShop16x ? Hook::getIdByName('displayTopColumn') : Hook::getIdByName('displayHome') : Hook::get('home');
     $headerHookID = $this->isPrestaShop15x ? Hook::getIdByName('displayHeader') : Hook::get('header');
     if (!parent::install() or !$this->registerHook($this->isPrestaShop15x ? 'displayHeader' : 'header') or !$this->registerHook($this->isPrestaShop15x ? 'displayFooterProduct' : 'productFooter') or !$this->registerHook($this->isPrestaShop15x ? 'displayFooter' : 'footer') or !$this->installDB() or !$this->fixCSS() or !$this->registerHook($this->isPrestaShop15x ? $this->isPrestaShop16x ? 'displayTopColumn' : 'displayHome' : 'home') or !$this->updatePosition($homeHookID, 0, 1) or !$this->createImageFolder('magicscroll') or !$this->updatePosition($headerHookID, 0, 1)) {
         return false;
     }
     $this->sendStat('install');
     return true;
 }
 public function install()
 {
     $return = true;
     foreach (self::$objects_list as $object) {
         $return = $object->install();
         if (!$return) {
             break;
         }
     }
     $return = $return ? parent::install() and $this->registerHook('orderConfirmation') and $this->registerHook('newOrder') and $this->registerHook('rightColumn') and $this->registerHook('paymentTop') and $this->registerHook('orderConfirmation') : $return;
     $id_hook = Hook::get('payment');
     $this->updatePosition($id_hook, 0, 1);
     return $return;
 }
Example #7
0
 function install()
 {
     if (Hook::get('orderPages') == false) {
         $hook = new Hook();
         $hook->name = 'orderPages';
         $hook->title = 'Order process pages';
         $hook->description = 'Adds new pages in the order process';
         $hook->add();
     }
     if (parent::install() == false or $this->registerHook('orderPages') == false) {
         return false;
     }
     return true;
 }
Example #8
0
 function install()
 {
     if (Hook::get('orderPriceAdjustment') == false) {
         $hook = new Hook();
         $hook->name = 'orderPriceAdjustment';
         $hook->title = 'Order price adjustment';
         $hook->description = 'Allows modules to adjust prices in an order after the user has logged in and registered an address, e.g. allows prices based on group memberships and the like.';
         $hook->add();
     }
     if (parent::install() == false) {
         return false;
     }
     return true;
 }
Example #9
0
 function install()
 {
     if (Hook::get('orderAddressVerification') == false) {
         $hook = new Hook();
         $hook->name = 'orderAddressVerification';
         $hook->title = 'Order address verificatio';
         $hook->description = 'Allows modules to verify delivery and billing address in an order, e.g. require them to be in the same country';
         $hook->add();
     }
     if (parent::install() == false) {
         return false;
     }
     return true;
 }
Example #10
0
 function install()
 {
     if (Hook::get('extraCarrierDetails') == false) {
         $hook = new Hook();
         $hook->name = 'extraCarrierDetails';
         $hook->title = 'Extra carrier dietails';
         $hook->description = 'Extra carrier dietails display part';
         $hook->add();
     }
     if (Hook::get('extraCarrierDetailsProcess') == false) {
         $hook = new Hook();
         $hook->name = 'extraCarrierDetailsProcess';
         $hook->title = 'Extra carrier dietails';
         $hook->description = 'Extra carrier dietails processing part';
         $hook->add();
     }
     return parent::install();
 }
Example #11
0
 public function moveRightColumn($position)
 {
     if (_PS_VERSION_ < '1.5') {
         $hookRight = (int) Hook::get('rightColumn');
     } else {
         $hookRight = (int) Hook::getIdByName('rightColumn');
     }
     $moduleInstance = Module::getInstanceByName($this->name);
     if (_PS_VERSION_ < '1.5') {
         $moduleInfo = Hook::getModuleFromHook($hookRight, $moduleInstance->id);
     } else {
         $moduleInfo = Hook::getModulesFromHook($hookRight, $moduleInstance->id);
     }
     if (isset($moduleInfo['position']) && (int) $moduleInfo['position'] > (int) $position || isset($moduleInfo['m.position']) && (int) $moduleInfo['m.position'] > (int) $position) {
         return $moduleInstance->updatePosition($hookRight, 0, (int) $position);
     }
     return $moduleInstance->updatePosition($hookRight, 1, (int) $position);
 }
Example #12
0
 public function run(&$content)
 {
     $data = S('hooks');
     if (!$data) {
         $hooks = M('Hooks')->getField('name,plugins');
         foreach ($hooks as $key => $value) {
             if ($value) {
                 $map['status'] = 1;
                 $names = explode(',', $value);
                 $map['name'] = array('IN', $names);
                 $data = M('Plugins')->where($map)->getField('id,name');
                 if ($data) {
                     $plugins = array_intersect($names, $data);
                     Hook::add($key, $plugins);
                 }
             }
         }
         S('hooks', Hook::get());
     } else {
         Hook::import($data, false);
     }
 }
Example #13
0
 /**
  * 加载系统插件
  */
 private function loadAddons()
 {
     $data = S('hooks');
     if (!$data || DEBUG) {
         $hooks = M('hooks')->where("status=1")->getField('name,addons', true);
         if ($hooks) {
             foreach ($hooks as $key => $value) {
                 if ($value) {
                     $map['status'] = 1;
                     $names = explode(',', $value);
                     $map['name'] = array('IN', $names);
                     $data = M('addons')->where($map)->getField('id,name');
                     if ($data) {
                         $addons = array_intersect($names, $data);
                         Hook::add($key, $addons);
                     }
                 }
             }
         }
         S('hooks', Hook::get());
     } else {
         Hook::import($data, false);
     }
 }
    public function installHook()
    {
        return Db::getInstance()->Execute('INSERT INTO `' . _DB_PREFIX_ . 'hook` (`name`, `title`, `description`)
		VALUE (\'displayMobileHeader\', \'' . pSQL($this->l('Header of mobile pages')) . '\', \'' . pSQL($this->l('A hook which allow you to do things in the header of each pages of the Mobile version')) . '\')') && Configuration::updateValue('PS_MOBILE_HOOK_HEADER_ID', Hook::get('displayMobileHeader'));
    }
Example #15
0
<?php

/**
 * Arxmin Config Option Can be Overrided
 *
 */
return Hook::get('arxmin::config', array('prefix' => 'arxmin', 'theme' => 'arx/arxmin/dist', 'namespace' => 'Arxmin\\', 'database' => array('default' => Config::get('database.default')), 'paths' => array('packages' => app_path('packages'), 'workbench' => base_path('workbench'), 'modules' => base_path('modules'), 'theme' => public_path('packages/arx/arxmin/dist')), 'auth' => array('filter' => 'arxmin-auth', 'controller' => 'Arxmin\\AuthController', 'model' => 'Arxmin\\UserModel')));
Example #16
0
    private function _displayForm4()
    {
        $xml = simplexml_load_file(_IMPORT_FOLDER_ . XMLFILENAME);
        $this->xml = $xml;
        self::getModules();
        $hook = array();
        $hookedModule = array();
        $position = array();
        $msg = '';
        foreach ($this->xml->modules->hooks->hook as $row) {
            $hookedModule[] = strval($row['module']);
            $hook[] = strval($row['hook']);
            $position[] = strval($row['position']);
            $exceptions[] = isset($row['exceptions']) ? explode(',', strval($row['exceptions'])) : array();
        }
        if (file_exists(_IMPORT_FOLDER_ . 'doc') and sizeof($xml->docs->doc) != 0) {
            self::_loadDocForm();
        }
        // install selected modules
        $flag = 0;
        if (isset($this->to_export) and $this->to_export) {
            foreach ($this->to_export as $row) {
                if (in_array($row, $this->native_modules)) {
                    continue;
                }
                if ($flag++ == 0) {
                    $msg .= '<b>' . $this->l('The following modules have been installed') . ' :</b><br />';
                }
                self::recurseCopy(_IMPORT_FOLDER_ . 'modules/' . $row, _PS_ROOT_DIR_ . '/modules/' . $row);
                $obj = Module::getInstanceByName($row);
                if (Validate::isLoadedObject($obj)) {
                    Db::getInstance()->Execute('
						UPDATE `' . _DB_PREFIX_ . 'module`
						SET `active`= 1
						WHERE `name` = \'' . pSQL($row) . '\'');
                } elseif (!$obj or !$obj->install()) {
                    continue;
                }
                $msg .= '<i>- ' . pSQL($row) . '</i><br />';
                Db::getInstance()->Execute('
					DELETE FROM `' . _DB_PREFIX_ . 'hook_module` 
					WHERE `id_module` = ' . pSQL($obj->id));
                $count = -1;
                while (isset($hookedModule[++$count])) {
                    if ($hookedModule[$count] == $row) {
                        Db::getInstance()->Execute('
							INSERT INTO `' . _DB_PREFIX_ . 'hook_module` (`id_module`, `id_hook`, `position`)
							VALUES (' . (int) $obj->id . ', ' . (int) Hook::get($hook[$count]) . ', ' . (int) $position[$count] . ')');
                        if ($exceptions[$count]) {
                            foreach ($exceptions[$count] as $file_name) {
                                Db::getInstance()->Execute('
									INSERT INTO `' . _DB_PREFIX_ . 'hook_module_exceptions` (`id_module`, `id_hook`, `file_name`)
									VALUES (' . (int) $obj->id . ', ' . (int) Hook::get($hook[$count]) . ', "' . pSQL($file_name) . '")');
                            }
                        }
                    }
                }
            }
        }
        if (($val = (int) Tools::getValue('nativeModules')) != 1) {
            $flag = 0;
            // Disable native modules
            if ($val == 2 and $this->to_disable and count($this->to_disable)) {
                foreach ($this->to_disable as $row) {
                    $obj = Module::getInstanceByName($row);
                    if (Validate::isLoadedObject($obj)) {
                        if ($flag++ == 0) {
                            $msg .= '<b>' . $this->l('The following modules have been disabled') . ' :</b><br />';
                        }
                        $msg .= '<i>- ' . pSQL($row) . '</i><br />';
                        Db::getInstance()->Execute('
						UPDATE `' . _DB_PREFIX_ . 'module`
						SET `active`= 0
						WHERE `name` = \'' . pSQL($row) . '\'');
                    }
                }
            }
            $flag = 0;
            if ($this->to_enable and count($this->to_enable)) {
                foreach ($this->to_enable as $row) {
                    $obj = Module::getInstanceByName($row);
                    if (Validate::isLoadedObject($obj)) {
                        Db::getInstance()->Execute('
							UPDATE `' . _DB_PREFIX_ . 'module`
							SET `active`= 1
							WHERE `name` = \'' . pSQL($row) . '\'');
                    } elseif (!is_object($obj) or !$obj->install()) {
                        continue;
                    }
                    if ($flag++ == 0) {
                        $msg .= '<b>' . $this->l('The following modules have been enabled') . ' :</b><br />';
                    }
                    $msg .= '<i>- ' . pSQL($row) . '</i><br />';
                    Db::getInstance()->Execute('
						DELETE FROM `' . _DB_PREFIX_ . 'hook_module` 
						WHERE `id_module` = ' . pSQL($obj->id));
                    $count = -1;
                    while (isset($hookedModule[++$count])) {
                        if ($hookedModule[$count] == $row) {
                            Db::getInstance()->Execute('
								INSERT INTO `' . _DB_PREFIX_ . 'hook_module` (`id_module`, `id_hook`, `position`)
								VALUES (' . (int) $obj->id . ', ' . (int) Hook::get($hook[$count]) . ', ' . (int) $position[$count] . ')');
                            foreach ($exceptions[$count] as $filename) {
                                if (!empty($filename)) {
                                    Db::getInstance()->Execute('
										INSERT INTO `' . _DB_PREFIX_ . 'hook_module_exceptions` (`id_module`, `id_hook`, `file_name`)
										VALUES (' . (int) $obj->id . ', ' . (int) Hook::get($hook[$count]) . ', "' . pSQL($filename) . '")');
                                }
                            }
                        }
                    }
                }
            }
        }
        if ((int) Tools::getValue('imagesConfig') != 3 and self::updateImages()) {
            $msg .= '<br /><b>' . $this->l('Images have been correctly updated in database') . '</b><br />';
        }
        $this->_msg .= parent::displayConfirmation($msg);
        $this->_html .= '
			<input type="submit" class="button" name="submitThemes" value="' . $this->l('Previous') . '" />
			<input type="submit" class="button" name="Finish" value="' . $this->l('Finish') . '" />
		</form>';
    }
Example #17
0
 public function getModuleAssign($module_name = '', $hook_name = '')
 {
     $module = Module::getInstanceByName($module_name);
     if (_PS_VERSION_ <= "1.5") {
         $id_hook = Hook::get($hook_name);
     } else {
         $id_hook = Hook::getIdByName($hook_name);
     }
     if (Validate::isLoadedObject($module) && $module->id) {
         $array = array();
         $array['id_hook'] = $id_hook;
         $array['module'] = $module_name;
         $array['id_module'] = $module->id;
         if (_PS_VERSION_ < "1.5") {
             return self::lofHookExec($hook_name, array(), $module->id, $array);
         } else {
             $hook_name = substr($hook_name, 7, strlen($hook_name));
             return self::lofHookExecV15($hook_name, array(), $module->id, $array);
         }
     }
     return '';
 }
Example #18
0
 /**
  * 应用程序初始化
  * @access public
  * @return void
  */
 public static function start()
 {
     // 注册AUTOLOAD方法
     spl_autoload_register('Think\\Think::autoload');
     // 设定错误和异常处理
     register_shutdown_function('Think\\Think::fatalError');
     set_error_handler('Think\\Think::appError');
     set_exception_handler('Think\\Think::appException');
     // 初始化文件存储方式
     Storage::connect(STORAGE_TYPE);
     $runtimefile = RUNTIME_PATH . APP_MODE . '~runtime.php';
     if (!APP_DEBUG && Storage::has($runtimefile)) {
         Storage::load($runtimefile);
     } else {
         if (Storage::has($runtimefile)) {
             Storage::unlink($runtimefile);
         }
         $content = '';
         // 读取应用模式
         $mode = (include is_file(CONF_PATH . 'core.php') ? CONF_PATH . 'core.php' : MODE_PATH . APP_MODE . '.php');
         // 加载核心文件
         foreach ($mode['core'] as $file) {
             if (is_file($file)) {
                 include $file;
                 if (!APP_DEBUG) {
                     $content .= compile($file);
                 }
             }
         }
         // 加载应用模式配置文件
         foreach ($mode['config'] as $key => $file) {
             is_numeric($key) ? C(include $file) : C($key, include $file);
         }
         // 读取当前应用模式对应的配置文件
         if ('common' != APP_MODE && is_file(CONF_PATH . 'config_' . APP_MODE . '.php')) {
             C(include CONF_PATH . 'config_' . APP_MODE . '.php');
         }
         // 加载模式别名定义
         if (isset($mode['alias'])) {
             self::addMap(is_array($mode['alias']) ? $mode['alias'] : (include $mode['alias']));
         }
         // 加载应用别名定义文件
         if (is_file(CONF_PATH . 'alias.php')) {
             self::addMap(include CONF_PATH . 'alias.php');
         }
         // 加载模式行为定义
         if (isset($mode['tags'])) {
             Hook::import(is_array($mode['tags']) ? $mode['tags'] : (include $mode['tags']));
         }
         // 加载应用行为定义
         if (is_file(CONF_PATH . 'tags.php')) {
             // 允许应用增加开发模式配置定义
             Hook::import(include CONF_PATH . 'tags.php');
         }
         // 加载框架底层语言包
         L(include THINK_PATH . 'Lang/' . strtolower(C('DEFAULT_LANG')) . '.php');
         if (!APP_DEBUG) {
             $content .= "\nnamespace { Think\\Think::addMap(" . var_export(self::$_map, true) . ");";
             $content .= "\nL(" . var_export(L(), true) . ");\nC(" . var_export(C(), true) . ');Think\\Hook::import(' . var_export(Hook::get(), true) . ');}';
             Storage::put($runtimefile, strip_whitespace('<?php ' . $content));
         } else {
             // 调试模式加载系统默认的配置文件
             C(include THINK_PATH . 'Conf/debug.php');
             // 读取应用调试配置文件
             if (is_file(CONF_PATH . 'debug.php')) {
                 C(include CONF_PATH . 'debug.php');
             }
         }
     }
     // 读取当前应用状态对应的配置文件
     if (APP_STATUS && is_file(CONF_PATH . APP_STATUS . '.php')) {
         C(include CONF_PATH . APP_STATUS . '.php');
     }
     // 设置系统时区
     date_default_timezone_set(C('DEFAULT_TIMEZONE'));
     // 检查应用目录结构 如果不存在则自动创建
     if (C('CHECK_APP_DIR') && !is_dir(LOG_PATH)) {
         // 创建应用目录结构
         require THINK_PATH . 'Common/build.php';
     }
     // 记录加载文件时间
     G('loadTime');
     // 运行应用
     App::run();
 }
Example #19
0
    private function displayForm4()
    {
        $xml = simplexml_load_file(_IMPORT_FOLDER_ . XMLFILENAME);
        $this->xml = $xml;
        self::getModules();
        $hook = array();
        $hooked_module = array();
        $position = array();
        $msg = '';
        foreach ($this->xml->modules->hooks->hook as $row) {
            $hooked_module[] = strval($row['module']);
            $hook[] = strval($row['hook']);
            $position[] = strval($row['position']);
            $exceptions[] = isset($row['exceptions']) ? explode(',', strval($row['exceptions'])) : array();
        }
        if (file_exists(_IMPORT_FOLDER_ . 'doc') && count($xml->docs->doc) != 0) {
            self::loadDocForm();
        }
        // install selected modules
        $flag = 0;
        foreach ($this->selected_shops as $id_shop) {
            if (isset($this->to_export) && $this->to_export) {
                foreach ($this->to_export as $row) {
                    if (in_array($row, $this->native_modules)) {
                        continue;
                    }
                    if ($flag++ == 0) {
                        $msg .= '<b>' . $this->l('The following modules have been installed:') . '</b><br />';
                    }
                    // We copy module only if it does not already exists
                    if (!file_exists(_PS_ROOT_DIR_ . '/modules/' . $row)) {
                        self::recurseCopy(_IMPORT_FOLDER_ . 'modules/' . $row, _PS_ROOT_DIR_ . '/modules/' . $row);
                    }
                    $obj = Module::getInstanceByName($row);
                    if (Validate::isLoadedObject($obj)) {
                        Db::getInstance()->execute('
							UPDATE `' . _DB_PREFIX_ . 'module`
							SET `active`= 1
							WHERE `name` = \'' . pSQL($row) . '\'
						');
                    } else {
                        if (!$obj || !$obj->install()) {
                            continue;
                        }
                    }
                    if (_PS_VERSION_ < '1.5') {
                        $sql = 'DELETE FROM `' . _DB_PREFIX_ . 'hook_module` WHERE `id_module` = ' . pSQL($obj->id);
                    } else {
                        Db::getInstance()->execute('INSERT IGNORE INTO ' . _DB_PREFIX_ . 'module_shop (id_module, id_shop) VALUES(' . (int) $obj->id . ', ' . (int) $id_shop . ')');
                        $sql = 'DELETE FROM `' . _DB_PREFIX_ . 'hook_module` WHERE `id_module` = ' . pSQL($obj->id) . ' AND id_shop = ' . (int) $id_shop;
                    }
                    if (Db::getInstance()->execute($sql)) {
                        $msg .= '<i>- ' . pSQL($row) . '</i><br />';
                    } else {
                        $msg .= '<i>- ' . pSQL($row) . ' - ERROR</i><br />';
                    }
                    $count = -1;
                    while (isset($hooked_module[++$count])) {
                        if ($hooked_module[$count] == $row) {
                            if (_PS_VERSION_ < '1.5') {
                                $sql_hook_module = 'INSERT INTO `' . _DB_PREFIX_ . 'hook_module` (`id_module`, `id_hook`, `position`)
									VALUES (' . (int) $obj->id . ', ' . (int) Hook::get($hook[$count]) . ', ' . (int) $position[$count] . ')';
                            } else {
                                $sql_hook_module = 'INSERT INTO `' . _DB_PREFIX_ . 'hook_module` (`id_module`, `id_shop`, `id_hook`, `position`)
									VALUES (' . (int) $obj->id . ', ' . (int) $id_shop . ', ' . (int) Hook::getIdByName($hook[$count]) . ', ' . (int) $position[$count] . ')';
                            }
                            Db::getInstance()->execute($sql_hook_module);
                            if ($exceptions[$count]) {
                                foreach ($exceptions[$count] as $file_name) {
                                    if (_PS_VERSION_ < '1.5') {
                                        $sql_hook_module_except = 'INSERT INTO `' . _DB_PREFIX_ . 'hook_module_exceptions` (`id_module`, `id_hook`, `file_name`)
											VALUES (' . (int) $obj->id . ', ' . (int) Hook::get($hook[$count]) . ', "' . pSQL($file_name) . '")';
                                    } else {
                                        $sql_hook_module_except = 'INSERT INTO `' . _DB_PREFIX_ . 'hook_module_exceptions` (`id_module`, `id_hook`, `file_name`)
											VALUES (' . (int) $obj->id . ', ' . (int) Hook::getIdByName($hook[$count]) . ', "' . pSQL($file_name) . '")';
                                    }
                                    Db::getInstance()->execute($sql_hook_module_except);
                                }
                            }
                        }
                    }
                }
            }
            if (($val = (int) Tools::getValue('nativeModules')) != 1) {
                $flag = 0;
                // Disable native modules
                if ($val == 2 && ($this->to_disable && count($this->to_disable) || $this->selected_disable_modules && count($this->selected_disable_modules)) && _PS_VERSION_ > '1.5') {
                    foreach (array_merge($this->to_disable, $this->selected_disable_modules) as $row) {
                        $obj = Module::getInstanceByName($row);
                        if (Validate::isLoadedObject($obj)) {
                            if ($flag++ == 0) {
                                $msg .= '<b>' . $this->l('The following modules have been disabled:') . '</b><br />';
                            }
                            // Delete all native module which are in the front office feature category and in selected shops
                            if (_PS_VERSION_ < '1.5') {
                                $sql = 'DELETE FROM `' . _DB_PREFIX_ . 'hook_module` WHERE `id_module` = ' . pSQL($obj->id) . ' AND `id_shop` = ' . (int) $id_shop;
                                if (Db::getInstance()->execute($sql)) {
                                    $msg .= '<i>- ' . pSQL($row) . '</i><br />';
                                }
                            } else {
                                $sql = 'DELETE FROM `' . _DB_PREFIX_ . 'module_shop` WHERE `id_module` = ' . pSQL($obj->id) . ' AND `id_shop` = ' . (int) $id_shop;
                                $sql1 = 'DELETE FROM `' . _DB_PREFIX_ . 'hook_module` WHERE `id_module` = ' . pSQL($obj->id) . ' AND `id_shop` = ' . (int) $id_shop;
                                if (Db::getInstance()->execute($sql) && Db::getInstance()->execute($sql1)) {
                                    $msg .= '<i>- ' . pSQL($row) . '</i><br />';
                                }
                            }
                        }
                    }
                }
                $flag = 0;
                if ($this->to_enable && count($this->to_enable)) {
                    foreach ($this->to_enable as $row) {
                        $obj = Module::getInstanceByName($row);
                        if (Validate::isLoadedObject($obj)) {
                            if (_PS_VERSION_ < '1.5') {
                                Db::getInstance()->execute('
									UPDATE `' . _DB_PREFIX_ . 'module`
									SET `active`= 1
									WHERE `name` = \'' . pSQL($row) . '\'');
                            } else {
                                Db::getInstance()->execute('
									UPDATE `' . _DB_PREFIX_ . 'module`
									SET `active`= 1
									WHERE `name` = \'' . pSQL($row) . '\'');
                                Db::getInstance()->execute('
									INSERT IGNORE INTO ' . _DB_PREFIX_ . 'module_shop (id_module, id_shop)
									VALUES(' . (int) $obj->id . ', ' . (int) $id_shop . ')
								');
                            }
                        } else {
                            if (!is_object($obj) || !$obj->install()) {
                                continue;
                            }
                        }
                        if ($flag++ == 0) {
                            $msg .= '<b>' . $this->l('The following modules have been enabled:') . '</b><br />';
                        }
                        if (_PS_VERSION_ < '1.5') {
                            $sql = 'DELETE FROM `' . _DB_PREFIX_ . 'hook_module` WHERE `id_module` = ' . pSQL($obj->id);
                        } else {
                            $sql = 'DELETE FROM `' . _DB_PREFIX_ . 'hook_module` WHERE `id_module` = ' . pSQL($obj->id) . ' AND id_shop = ' . (int) $id_shop;
                        }
                        if (Db::getInstance()->execute($sql)) {
                            $msg .= '<i>- ' . pSQL($row) . '</i><br />';
                        }
                        $count = -1;
                        while (isset($hooked_module[++$count])) {
                            if ($hooked_module[$count] == $row) {
                                if (_PS_VERSION_ < '1.5') {
                                    Db::getInstance()->execute('
										INSERT IGNORE INTO `' . _DB_PREFIX_ . 'hook_module` (`id_module`, `id_hook`, `position`)
										VALUES (' . (int) $obj->id . ', ' . (int) Hook::get($hook[$count]) . ', ' . (int) $position[$count] . ')
									');
                                } else {
                                    Db::getInstance()->execute('
										INSERT IGNORE INTO `' . _DB_PREFIX_ . 'hook_module` (`id_module`, `id_shop`, `id_hook`, `position`)
										VALUES (' . (int) $obj->id . ', ' . (int) $id_shop . ', ' . (int) Hook::getIdByName($hook[$count]) . ', ' . (int) $position[$count] . ')
									');
                                }
                                foreach ($exceptions[$count] as $filename) {
                                    if (!empty($filename)) {
                                        if (_PS_VERSION_ < '1.5') {
                                            Db::getInstance()->execute('
												INSERT INTO `' . _DB_PREFIX_ . 'hook_module_exceptions` (`id_module`, `id_hook`, `file_name`)
												VALUES (' . (int) $obj->id . ', ' . (int) Hook::get($hook[$count]) . ', "' . pSQL($filename) . '")
											');
                                        } else {
                                            Db::getInstance()->execute('
												INSERT INTO `' . _DB_PREFIX_ . 'hook_module_exceptions` (`id_module`, id_shop, `id_hook`, `file_name`)
												VALUES (' . (int) $obj->id . ', ' . (int) $id_shop . ', ' . (int) Hook::getIdByName($hook[$count]) . ', "' . pSQL($filename) . '")
											');
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (_PS_VERSION_ > '1.5') {
                $theme = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'theme` WHERE `name` LIKE \'' . (string) $this->xml['name'] . '\'');
                $shop = new Shop((int) $id_shop);
                $shop->id_theme = (int) $theme['id_theme'];
                $shop->update();
            }
        }
        // note : theme was previously created at this point.
        // It is now created during displayForm3
        $result = $this->updateImages();
        if (!isset($result['error'])) {
            $msg .= $this->l('Images have been correctly updated in the database.');
        } else {
            $errors = '<em><strong>' . $this->l('Warning: Copy/Paste your errors if you want to manually set the image type (in the "Images" page under the "Preferences" menu):') . '</em></strong><br />';
            $errors .= $this->l('Some types of image could not be added because they already exist. Here\'s the list:');
            $errors .= '<ul>';
            foreach ($result['error'] as $error) {
                $errors .= '<li style="color:#D8000C">' . $this->l('Name image type:') . ' <strong>' . $error['name'] . '</strong> (' . $this->l('Width:') . ' ' . $error['width'] . 'px, ' . $this->l('Height:') . ' ' . $error['height'] . 'px)</li>';
            }
            $errors .= '</ul>';
        }
        if (isset($error)) {
            $this->_msg .= parent::displayError($errors);
        }
        if (!empty($msg)) {
            $this->_msg .= parent::displayConfirmation($msg);
        }
        $this->_html .= '
			<input type="submit" class="button" name="submitThemes" value="' . $this->l('Previous') . '" />
			<input type="submit" class="button" name="Finish" value="' . $this->l('Finish') . '" />
		</form>';
    }
Example #20
0
 private function _postProcess()
 {
     Configuration::updateValue('TREEPODIA_INTEGRATION_TYPE', (int) Tools::getValue('trpd_integration_type'));
     $position = Tools::getValue('trpd_position');
     if ($position < 0 || $position > 2) {
         $position = 0;
     }
     Configuration::updateValue('TREEPODIA_POSITION', $position);
     $file = $_FILES['trpd_logo_file'];
     if ($file and $file['name']) {
         $name = time() . '-' . $_FILES['trpd_logo_file']['name'];
         move_uploaded_file($_FILES['trpd_logo_file']['tmp_name'], _PS_MODULE_DIR_ . $this->name . '/logos/' . $name);
         Configuration::updateValue('TREEPODIA_PLAY_LOGO', $name);
     } else {
         Configuration::updateValue('TREEPODIA_PLAY_LOGO', Tools::getValue('trpd_play_logo'));
     }
     $this->_sendUpdate();
     if (Tools::getValue('trpd_hook_position') == 0) {
         Configuration::updateValue('TREEPODIA_HOOK', 0);
         $this->unregisterHook(Hook::get('productFooter'));
         $this->registerHook('extraLeft');
     } else {
         Configuration::updateValue('TREEPODIA_HOOK', 1);
         $this->unregisterHook(Hook::get('extraLeft'));
         $this->registerHook('productFooter');
     }
     $dataSync = '<img src="http://www.prestashop.com/modules/' . $this->name . '.png?account_code=' . Configuration::get('TREEPODIA_ACCOUNT_CODE') . '" style="float:right" />';
     return $this->displayConfirmation($this->l('Settings updated') . $dataSync);
 }
Example #21
0
    protected function _postProcess()
    {
        $languages = Language::getLanguages();
        $result = Db::getInstance()->ExecuteS('SHOW TABLES');
        $existing_tables = array();
        foreach ($result as $row) {
            foreach ($row as $key => $table) {
                array_push($existing_tables, $table);
            }
        }
        //hide or display installation instructions
        if (Tools::getValue('dhl_shi') != "") {
            if (Tools::getValue('dhl_shi') == "inline") {
                Configuration::updateValue('DHL_INSTALL', "none");
            } else {
                Configuration::updateValue('DHL_INSTALL', "inline");
            }
        }
        if (Tools::isSubmit('updateSettings')) {
            if (Tools::getValue('dhl_pack') != $this->_dhl_pack) {
                $query = 'TRUNCATE `' . _DB_PREFIX_ . 'fe_dhl_invalid_dest`';
                Db::getInstance()->Execute($query);
            }
            if (!Configuration::updateValue('DHL_SITE_ID', str_replace(' ', '', Tools::getValue('dhl_site_id'))) || !Configuration::updateValue('DHL_PASS', str_replace(' ', '', Tools::getValue('dhl_pass'))) || !Configuration::updateValue('DHL_ACCOUNT_NUMBER', str_replace(' ', '', Tools::getValue('dhl_account_number'))) || !Configuration::updateValue('DHL_DROPOFF', Tools::getValue('dhl_dropoff')) || !Configuration::updateValue('DHL_UNIT', Tools::getValue('dhl_unit')) || !Configuration::updateValue('DHL_PACK', Tools::getValue('dhl_pack')) || !Configuration::updateValue('DHL_WIDTH', Tools::getValue('dhl_width')) || !Configuration::updateValue('DHL_HEIGHT', Tools::getValue('dhl_height')) || !Configuration::updateValue('DHL_DEPTH', Tools::getValue('dhl_depth')) || !Configuration::updateValue('DHL_WEIGHT', Tools::getValue('dhl_weight')) || !Configuration::updateValue('DHL_ORIGIN_ZIP', Tools::getValue('dhl_origin_zip')) || !Configuration::updateValue('DHL_ORIGIN_COUNTRY', Tools::getValue('dhl_origin_country')) || !Configuration::updateValue('DHL_ORIGIN_CITY', Tools::getValue('dhl_origin_city')) || !Configuration::updateValue('DHL_TYPE', Tools::getValue('dhl_type')) || !Configuration::updateValue('DHL_PACKAGES', Tools::getValue('dhl_packages')) || !Configuration::updateValue('DHL_PACKAGE_SIZE', Tools::getValue('dhl_package_size')) || !Configuration::updateValue('DHL_PACKAGES_PER_BOX', Tools::getValue('dhl_packages_per_box')) || !Configuration::updateValue('DHL_OVERRIDE_ADDRESS', Tools::getValue('dhl_override_address')) || !Configuration::updateValue('DHL_DEBUG_MODE', Tools::getValue('dhl_debug_mode')) || !Configuration::updateValue('DHL_ADDRESS_DISPLAY', serialize(array('country' => Tools::getValue('dhl_country_display'), 'state' => Tools::getValue('dhl_state_display'), 'city' => Tools::getValue('dhl_city_display'), 'zip' => Tools::getValue('dhl_zip_display')))) || !Configuration::updateValue('DHL_XML_LOG', Tools::getValue('dhl_xml_log')) || !Configuration::updateValue('DHL_CURRENCY_USED', Tools::getValue('dhl_currency_used')) || !Configuration::updateValue('DHL_DISCOUNT_RATE', Tools::getValue('dhl_discount_rate')) || !Configuration::updateValue('DHL_MODE', Tools::getValue('dhl_mode'))) {
                if ($this->getPSV() == 1.6) {
                    $this->_html .= $this->displayError($this->l('Cannot update settings'));
                } else {
                    $this->_html .= '<div class="alert error">' . $this->l('Cannot update settings') . '</div>';
                }
            } else {
                if ($this->getPSV() == 1.6) {
                    $this->_html .= $this->displayConfirmation($this->l('Settings updated'));
                } else {
                    $this->_html .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="' . $this->l('Confirmation') . '" />' . $this->l('Settings updated') . '</div>';
                }
            }
        }
        if (Tools::getValue('ssr') == 'show') {
            $this->registerHook($this->getPSV() >= 1.5 ? 'displayProductButtons' : 'productActions');
            $this->registerHook('cartShippingPreview');
            Configuration::updateValue('DHL_SHIPPING_RATES_BUTTON', 'show');
        } elseif (Tools::getValue('ssr') == 'hide') {
            $this->unregisterHook($this->getPSV() >= 1.5 ? Hook::getIdByName('displayProductButtons') : Hook::get('productActions'));
            $this->unregisterHook($this->getPSV() >= 1.5 ? Hook::getIdByName('cartShippingPreview') : Hook::get('cartShippingPreview'));
            Configuration::updateValue('DHL_SHIPPING_RATES_BUTTON', 'hide');
        }
        if (Tools::isSubmit('addMethod')) {
            $query = 'INSERT INTO `' . _DB_PREFIX_ . 'carrier` (name, url, active, is_module, shipping_external, need_range, shipping_method, external_module_name) VALUES("' . (Tools::getValue('dhl_carrier_name') != "" ? Tools::getValue('dhl_carrier_name') : " ") . '", "http://www.dhl.com/content/g0/en/express/tracking.shtml?brand=DHL&AWB=@",  "1","1","1","1","1","dhl")';
            Db::getInstance()->Execute($query);
            $id_carrier = Db::getInstance()->Insert_ID();
            if ($this->getPSV() >= 1.5) {
                Db::getInstance()->execute('UPDATE ' . _DB_PREFIX_ . 'carrier set id_reference = ' . $id_carrier . ' WHERE id_carrier = ' . $id_carrier);
            }
            if (in_array(_DB_PREFIX_ . "carrier_group", $existing_tables)) {
                $id_groups = Db::getInstance()->executeS('SELECT id_group FROM ' . _DB_PREFIX_ . 'group GROUP BY id_group');
                foreach ($id_groups as $group) {
                    $query = 'INSERT INTO `' . _DB_PREFIX_ . 'carrier_group` (id_carrier, id_group) VALUES("' . $id_carrier . '", "' . $group['id_group'] . '")';
                    Db::getInstance()->Execute($query);
                }
            }
            if ($this->getPSV() >= 1.5) {
                /** $this->context->shop is not accurate */
                $id_shop_group = Shop::getContextShopGroupID(true);
                $id_shop = Shop::getContextShopID(true);
                /** if shop group is selected */
                if (!$id_shop && $id_shop_group) {
                    $shops = Shop::getShops(false, $id_shop_group);
                } elseif (!$id_shop && !$id_shop_group) {
                    $shops = Shop::getShops(false);
                } else {
                    $shops = array(0 => array('id_shop' => $id_shop));
                }
                if (is_array($shops) && count($shops)) {
                    foreach ($shops as $shop) {
                        if (in_array(_DB_PREFIX_ . "carrier_tax_rules_group_shop", $existing_tables)) {
                            $query = 'INSERT INTO `' . _DB_PREFIX_ . 'carrier_tax_rules_group_shop` (id_carrier, id_tax_rules_group, id_shop) VALUES("' . $id_carrier . '", "0","' . $shop['id_shop'] . '")';
                            Db::getInstance()->Execute($query);
                        }
                        if (in_array(_DB_PREFIX_ . "carrier_shop", $existing_tables)) {
                            $query = 'INSERT INTO `' . _DB_PREFIX_ . 'carrier_shop` (id_carrier, id_shop) VALUES("' . $id_carrier . '", "' . $shop['id_shop'] . '")';
                            Db::getInstance()->Execute($query);
                        }
                        /** insert carrier language for the store */
                        foreach ($languages as $language) {
                            $query = 'INSERT INTO `' . _DB_PREFIX_ . 'carrier_lang` (id_carrier, id_shop, id_lang, delay) VALUES("' . (int) $id_carrier . '", "' . $shop['id_shop'] . '", "' . (int) $language['id_lang'] . '", "' . (Tools::getValue('dhl_transit_time') != "" ? Tools::getValue('dhl_transit_time') : " ") . '")';
                            Db::getInstance()->Execute($query);
                        }
                    }
                } else {
                    die('fatal error: could not create carrier, reload the page and try again');
                }
            } else {
                /** insert carrier language for the store */
                foreach ($languages as $language) {
                    $query = 'INSERT INTO `' . _DB_PREFIX_ . 'carrier_lang` (id_carrier, id_lang, delay) VALUES("' . (int) $id_carrier . '", "' . (int) $language['id_lang'] . '", "' . (Tools::getValue('dhl_transit_time') != "" ? Tools::getValue('dhl_transit_time') : " ") . '")';
                    Db::getInstance()->Execute($query);
                }
            }
            $query = 'INSERT INTO `' . _DB_PREFIX_ . 'fe_dhl_method` (id_carrier, method, free_shipping, extra_shipping_type, extra_shipping_amount, insurance_minimum, insurance_type, insurance_amount, free_shipping_product, free_shipping_category, free_shipping_manufacturer, free_shipping_supplier) VALUES
				("' . $id_carrier . '","' . Tools::getValue('dhl_method') . '","' . intval(Tools::getValue('dhl_free_shipping')) . '",
				"' . intval(Tools::getValue('dhl_extra_charge')) . '","' . intval(Tools::getValue('dhl_extra_amount')) . '",
				"' . intval(Tools::getValue('dhl_minimum_insurance_amount')) . '","' . intval(Tools::getValue('dhl_insurance_charge')) . '",
				"' . intval(Tools::getValue('dhl_insurance_amount')) . '","","","","")';
            Db::getInstance()->Execute($query);
            $query = 'INSERT INTO `' . _DB_PREFIX_ . 'carrier_zone` (id_carrier, id_zone) VALUES("' . $id_carrier . '", "' . Tools::getValue('dhl_zone') . '")';
            Db::getInstance()->Execute($query);
            $query = 'INSERT INTO `' . _DB_PREFIX_ . 'range_weight` (id_carrier, delimiter1, delimiter2) VALUES("' . $id_carrier . '", "0.00", "100000.00")';
            Db::getInstance()->Execute($query);
            $id_range_weight = Db::getInstance()->Insert_ID();
            $query = 'INSERT INTO `' . _DB_PREFIX_ . 'delivery` (id_carrier, id_range_weight, id_zone, price) VALUES("' . $id_carrier . '", "' . $id_range_weight . '", "' . Tools::getValue('dhl_zone') . '","0")';
            Db::getInstance()->Execute($query);
            if ($this->getPSV() == 1.6) {
                $this->_html .= $this->displayConfirmation($this->l('Carrier created successfully'));
            } else {
                $this->_html .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="' . $this->l('Confirmation') . '" />' . $this->l('Carrier created successfully') . '</div>';
            }
        }
        if (Tools::isSubmit('updateShipping') || Tools::isSubmit('deleteCache') || Tools::isSubmit('updateSettings')) {
            $query = 'TRUNCATE `' . _DB_PREFIX_ . 'fe_dhl_rate_cache`';
            Db::getInstance()->Execute($query);
            $query = 'TRUNCATE `' . _DB_PREFIX_ . 'fe_dhl_hash_cache`';
            Db::getInstance()->Execute($query);
            $query = 'TRUNCATE `' . _DB_PREFIX_ . 'fe_dhl_package_rate_cache`';
            Db::getInstance()->Execute($query);
            $query = 'TRUNCATE `' . _DB_PREFIX_ . 'fe_dhl_invalid_dest`';
            Db::getInstance()->Execute($query);
            Configuration::updateValue('DHL_DOWN_TIME', '');
            //delete logs:
            $files = glob(dirname(__FILE__) . '/logs/*');
            // get all file names
            foreach ($files as $file) {
                // iterate files
                if (is_file($file) and !strstr($file, 'index.php')) {
                    unlink($file);
                }
                // delete file
            }
            if ($this->getPSV() == 1.6 && Tools::isSubmit('deleteCache')) {
                $this->_html .= $this->displayConfirmation($this->l('Shipping cache deleted successfully'));
            } elseif (Tools::isSubmit('deleteCache')) {
                $this->_html .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="' . $this->l('Confirmation') . '" />' . $this->l('Shipping cache deleted successfully') . '</div>';
            }
        }
        if (Tools::isSubmit('updateShipping')) {
            $i = 1;
            while (isset($_POST['id_' . $i]) && $_POST['id_' . $i]) {
                $query = 'UPDATE `' . _DB_PREFIX_ . 'fe_dhl_method` SET free_shipping = "' . $_POST['dhl_free_shipping_' . $i] . '",free_shipping_product = "' . $_POST['dhl_free_shipping_product_' . $i] . '",
						free_shipping_category = "' . $_POST['dhl_free_shipping_category_' . $i] . '",free_shipping_manufacturer = "' . $_POST['dhl_free_shipping_manufacturer_' . $i] . '",
						free_shipping_supplier = "' . $_POST['dhl_free_shipping_supplier_' . $i] . '",extra_shipping_type = "' . $_POST['dhl_extra_charge_' . $i] . '", extra_shipping_amount = "' . $_POST['dhl_extra_amount_' . $i] . '",
						insurance_minimum = "' . $_POST['dhl_minimum_insurance_amount_' . $i] . '", insurance_type = "' . $_POST['dhl_insurance_charge_' . $i] . '",
						insurance_amount = "' . $_POST['dhl_insurance_amount_' . $i] . '" WHERE id_carrier = "' . $_POST['id_' . $i] . '"';
                Db::getInstance()->Execute($query);
                $i++;
            }
            if ($this->getPSV() == 1.6) {
                $this->_html .= $this->displayConfirmation($this->l('Settings updated'));
            } else {
                $this->_html .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="' . $this->l('Confirmation') . '" />' . $this->l('Settings updated') . '</div>';
            }
        }
        if (Tools::isSubmit('updateShipperInfo')) {
            Configuration::updateValue('DHL_SHIPPER_SHOP_NAME', Tools::getValue('shipper_shop_name'));
            Configuration::updateValue('DHL_SHIPPER_ATTENTION_NAME', Tools::getValue('shipper_attention_name'));
            Configuration::updateValue('DHL_SHIPPER_PHONE', Tools::getValue('shipper_phone'));
            Configuration::updateValue('DHL_SHIPPER_ADDR1', Tools::getValue('shipper_address1'));
            Configuration::updateValue('DHL_SHIPPER_ADDR2', Tools::getValue('shipper_address2'));
            Configuration::updateValue('DHL_SHIPPER_CITY', Tools::getValue('shipper_city'));
            Configuration::updateValue('DHL_SHIPPER_COUNTRY', Tools::getValue('shipper_country'));
            Configuration::updateValue('DHL_SHIPPER_STATE', Tools::getValue('shipper_state'));
            Configuration::updateValue('DHL_SHIPPER_POSTCODE', Tools::getValue('shipper_postcode'));
            Configuration::updateValue('DHL_ENABLE_LABELS', Tools::getValue('dhl_enable_labels'));
            Configuration::updateValue('DHL_LABEL_ORDER_STATUS', Tools::getValue('label_order_status'));
            if ($this->getPSV() == 1.6) {
                $this->_html .= $this->displayConfirmation($this->l('Settings updated'));
            } else {
                $this->_html .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="' . $this->l('Confirmation') . '" />' . $this->l('Settings updated') . '</div>';
            }
        }
        $this->_refreshProperties();
    }
Example #22
0
 private function printJS()
 {
     $this->JS = Hook::get('MVC', 'JS')->call($this->JS, NEMESIS_PROCESS_PATH . 'resources/', $this->version);
     if (!empty($this->JS)) {
         foreach ($this->JS as $lib) {
             echo '<script type="text/javascript" src="' . $this->getResource($lib) . '?' . $this->version . '"></script>' . "\n";
         }
         unset($this->JS);
     }
 }
Example #23
0
 /**
  * Check the server configuration variables
  */
 public function checkServerConfiguration()
 {
     $this->_warnings = array();
     $this->_errors = array();
     // API can't be call if curl extension is not installed on PHP config.
     if (!extension_loaded('curl')) {
         $this->_warnings[] = $this->l('Please activate the PHP extension "curl" to allow use of Prediggo.');
     }
     if (!extension_loaded('dom')) {
         $this->_warnings[] = $this->l('Please activate the PHP extension "dom" to allow use of Prediggo.');
     }
     if ((int) ini_get('max_execution_time') < 3000) {
         $this->_warnings[] = $this->l('Please update the PHP option "max_execution_time" to a minimum of "3000". (Current value : ') . (int) ini_get('max_execution_time') . $this->l(')');
     }
     if ((int) ini_get('max_input_time') < 3000) {
         $this->_warnings[] = $this->l('Please update the PHP option "max_execution_time" to a minimum of "3000". (Current value : ') . (int) ini_get('max_input_time') . $this->l(')');
     }
     if ((int) ini_get('memory_limit') < 384) {
         $this->_warnings[] = $this->l('Please update the PHP option "max_execution_time" to a minimum of "384M". (Current value : ') . ini_get('memory_limit') . $this->l(')');
     }
     if (empty($this->oPrediggoExportConfig->htpasswd_user)) {
         $this->_errors[] = $this->l('The export folder is not protected!') . '<br/>' . $this->l('Please set a protection from the part "Export File protection" of the module configuration.') . '<br/> => ' . $this->oDataExtractorController->getRepositoryPath();
     }
     // Set a new warning to display on the top of the list of module in AdminModules Tab
     $this->warning = '';
     foreach ($this->_warnings as $sWarning) {
         $this->warning .= '[ ' . $sWarning . ' ] ';
     }
     // Check if blocklayered is installed =>
     // so put prediggo registration after layered registration due to js override
     if ($oModule = Module::getInstanceByName('blocklayered')) {
         $id_hook = (int) Hook::get('header');
         if (($iPos = (int) $oModule->getPosition((int) $id_hook)) && (int) $this->getPosition((int) $id_hook) < (int) $iPos) {
             $this->updatePosition((int) $id_hook, true, (int) $iPos);
         }
     }
 }
Example #24
0
 /**
  * Load CSS file
  * @author Daniel Sum
  * @version 0.1
  * @package arx
  * @comments :
  */
 public static function css($name = 'css')
 {
     return Asset::css(Hook::get($name));
 }
Example #25
0
 public function getContent()
 {
     $this->_html .= '<h2><a href="http://buyster.fr/solution-de-paiement-en-ligne-securisee-par-mobile-pour-votre-e-commerce?format=Pro"><img src="' . $this->_path . 'logo.png" alt="" /></a></h2>';
     if (!empty($_POST) and Tools::isSubmit('submitSave')) {
         $this->_postValidation();
         if (!sizeof($this->_postErrors)) {
             $this->_postProcess();
         } else {
             foreach ($this->_postErrors as $err) {
                 $this->_html .= '<div class="error"><img src="' . _PS_IMG_ . 'admin/forbbiden.gif" alt="nok" />&nbsp;' . $err . '</div>';
             }
         }
     }
     if (Tools::getValue('submitLogo')) {
         foreach (array('leftColumn', 'rightColumn') as $hookName) {
             if ($this->isRegisteredInHook($hookName)) {
                 $this->unregisterHook(Hook::get($hookName));
             }
         }
         if (Tools::getValue('logo_position') == self::LEFT_COLUMN) {
             $this->registerHook('leftColumn');
         } else {
             if (Tools::getValue('logo_position') == self::RIGHT_COLUMN) {
                 $this->registerHook('rightColumn');
             }
         }
     }
     $this->_displayForm();
     return $this->_html;
 }
Example #26
0
 public static function getNav($items)
 {
     foreach ($items as $item) {
         $item = Hook::get('App', 'getNav')->call($item);
         if (is_array($item)) {
             $new_menu_items[] = array('name' => $item[0], 'url' => $item[1], 'target' => '_blank');
         } else {
             $new_menu_items[] = array('name' => $item, 'url' => new URL($item));
         }
     }
     return $new_menu_items;
 }
Example #27
0
 public static function _getHookIdByName($hook_name)
 {
     if (version_compare(_PS_VERSION_, '1.5.0.0', '<')) {
         return Hook::get($hook_name);
     } else {
         return Hook::getIdByName($hook_name);
     }
 }
Example #28
0
 public function getModuleAssign($module_name = '', $hook_name = '')
 {
     $module = Module::getInstanceByName($module_name);
     if (_PS_VERSION_ <= "1.5") {
         $id_hook = Hook::get($hook_name);
     } else {
         $id_hook = Hook::getIdByName($hook_name);
     }
     if (Validate::isLoadedObject($module) && $module->id) {
         if (!isset($hookArgs['cookie']) or !$hookArgs['cookie']) {
             $hookArgs['cookie'] = $this->context->cookie;
         }
         if (!isset($hookArgs['cart']) or !$hookArgs['cart']) {
             $hookArgs['cart'] = $this->context->cart;
         }
         if (_PS_VERSION_ < "1.5") {
             //return self::lofHookExec( $hook_name, array(), $module->id, $array );
             $hook_name = strtolower($hook_name);
             if (!Validate::isHookName($hook_name)) {
                 die(Tools::displayError());
             }
             $altern = 0;
             if (is_callable(array($module, 'hook' . $hook_name))) {
                 $hookArgs['altern'] = ++$altern;
                 $output = call_user_func(array($module, 'hook' . $hook_name), $hookArgs);
             }
             return $output;
         } else {
             $hook_name = substr($hook_name, 7, strlen($hook_name));
             if (!Validate::isHookName($hook_name)) {
                 die(Tools::displayError());
             }
             $retro_hook_name = Hook::getRetroHookName($hook_name);
             $hook_callable = is_callable(array($module, 'hook' . $hook_name));
             $hook_retro_callable = is_callable(array($module, 'hook' . $retro_hook_name));
             $output = '';
             if (($hook_callable || $hook_retro_callable) && Module::preCall($module->name)) {
                 if ($hook_callable) {
                     $output = $module->{'hook' . $hook_name}($hookArgs);
                 } else {
                     if ($hook_retro_callable) {
                         $output = $module->{'hook' . $retro_hook_name}($hookArgs);
                     }
                 }
             }
             return $output;
         }
     }
     return '';
 }
 function install()
 {
     if (!$this->updateDB() || !parent::install()) {
         return false;
     }
     if (!$this->registerHook('top') || !$this->registerHook('header') || version_compare(_PS_VERSION_, '1.4.0.0', '>=') && !$this->registerHook('categoryUpdate') || !$this->installDefaultConfig()) {
         return false;
     }
     Db::getInstance()->AutoExecute(_DB_PREFIX_ . 'hook_module', array('position' => 255), 'UPDATE', 'id_module = ' . $this->id . ' AND id_hook = ' . (version_compare(_PS_VERSION_, '1.5.0.0', '>=') ? Hook::getIdByName('top') : Hook::get('top')));
     /*Update*/
     //$this->checkIfModuleIsUpdate(true, false);
     return true;
 }
Example #30
0
    public function getContent()
    {
        global $cookie;
        $errors = array();
        $output = '
			<p><img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logo-mb.gif" alt="Moneybookers" /></p><br />';
        /* Validate account */
        if (isset($_POST['SubmitValidation'])) {
            if (isset($_POST['mb_email_to_validate']) && !empty($_POST['mb_email_to_validate'])) {
                try {
                    $url = 'http://moneybookers.prestashop.com/email_check.php?email=' . $_POST['mb_email_to_validate'] . '&url=http://' . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__;
                    $content = $this->_fetchWebContent($url);
                    $response = trim(strtolower($content));
                    if (!strstr('ok', $response)) {
                        $errors[] = $this->l('Account validation failed, please check your e-mail.');
                    } else {
                        Configuration::updateValue('MB_PAY_TO_EMAIL', $_POST['mb_email_to_validate']);
                        Configuration::updateValue('MB_PARAMETERS', 1);
                        $output .= '
							<ul style="color: green; font-weight: bold; margin-bottom: 30px; width: 506px; background: #E1FFE9; border: 1px dashed #BBB; padding: 10px;">
								<li>' . $this->l('E-mail activation successful, you can now validate your secret word.') . '<img src="http://api.prestashop.com/modules/moneybookers.png?email=' . urlencode($_POST['mb_email_to_validate']) . '" style="float:right" /></li>
							</ul>';
                    }
                } catch (Exception $e) {
                    $errors[] = $this->l('Unable to contact activation server, please try again later.');
                }
            } else {
                $errors[] = $this->l('E-mail field is required');
            }
        }
        /* Validate secret word */
        if (isset($_POST['SubmitSecret'])) {
            if (isset($_POST['mb_sw_to_validate']) and !empty($_POST['mb_sw_to_validate'])) {
                try {
                    $url = 'http://moneybookers.prestashop.com/email_check.php?email=' . Configuration::get('MB_PAY_TO_EMAIL') . '&url=http://' . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__ . '&sw=1&secret_word=' . md5($_POST['mb_sw_to_validate']);
                    $content = $this->_fetchWebContent($url);
                    $response = trim(strtolower($content));
                    if (strstr('velocity_check_exceeded', $response)) {
                        $errors[] = $this->l('Secret word validation failed, exceeded max attempts (3 per hour)');
                    } elseif (!strstr('ok', $response)) {
                        $errors[] = $this->l('Secret word validation failed, please check your secret word.');
                    } else {
                        Configuration::updateValue('MB_SECRET_WORD', $_POST['mb_sw_to_validate']);
                        Configuration::updateValue('MB_PARAMETERS_2', 1);
                        $output .= '
						<ul style="color: green; font-weight: bold; margin-bottom: 30px; width: 506px; background: #E1FFE9; border: 1px dashed #BBB; padding: 10px;">
							<li>' . $this->l('Account activation successful, secret word OK') . '</li>
						</ul>';
                    }
                } catch (Exception $e) {
                    $errors[] = $this->l('Unable to contact activation server, please try again later.');
                }
            } else {
                $errors[] = $this->l('Secret word field is required');
            }
        }
        /* Update configuration variables */
        if (isset($_POST['submitMoneyBookers'])) {
            if (!isset($_POST['mb_hide_login'])) {
                $_POST['mb_hide_login'] = 0;
            }
            Configuration::updateValue('MB_CANCEL_URL', $_POST['mb_cancel_url']);
            Configuration::updateValue('MB_HIDE_LOGIN', (int) $_POST['mb_hide_login']);
            $local = '';
            $inter = '';
            foreach ($_POST as $key => $value) {
                if (strstr($key, 'mb_local_')) {
                    preg_match('/mb_local_([0-9]+)/', $key, $matches);
                    if (isset($matches[1])) {
                        $local .= $matches[1] . '|';
                    }
                } elseif (strstr($key, 'mb_inter_')) {
                    preg_match('/mb_inter_([0-9]+)/', $key, $matches);
                    if (isset($matches[1])) {
                        $inter .= $matches[1] . '|';
                    }
                }
            }
            $local = rtrim($local, '|');
            $inter = rtrim($inter, '|');
            Configuration::updateValue('MB_LOCAL_METHODS', $local);
            Configuration::updateValue('MB_INTER_METHODS', $inter);
            Configuration::updateValue('MB_DISPLAY_MODE', (int) $_POST['mb_display_mode']);
        }
        if (Tools::getValue('submitSettings')) {
            foreach (array('leftColumn', 'rightColumn') as $hookName) {
                if ($this->isRegisteredInHook($hookName)) {
                    $this->unregisterHook(Hook::get($hookName));
                }
            }
            if (Tools::getValue('logo_position') == self::LEFT_COLUMN) {
                $this->registerHook('leftColumn');
            } else {
                if (Tools::getValue('logo_position') == self::RIGHT_COLUMN) {
                    $this->registerHook('rightColumn');
                }
            }
        }
        /* Display errors */
        if (sizeof($errors)) {
            $output .= '<ul style="color: red; font-weight: bold; margin-bottom: 30px; width: 506px; background: #FFDFDF; border: 1px dashed #BBB; padding: 10px;">';
            foreach ($errors as $error) {
                $output .= '<li>' . $error . '</li>';
            }
            $output .= '</ul>';
        }
        $lang = new Language((int) $cookie->id_lang);
        $iso_img = $lang->iso_code;
        if ($lang->iso_code != 'fr' and $lang->iso_code != 'en') {
            $iso_img = 'en';
        }
        $manual_links = array('en' => 'http://moneybookers.com/creatives/integrationmanual/MB-Prestashop-Integration_en.pdf', 'es' => 'http://www.moneybookers.com/creatives/integrationmanual/MB-Prestashop-Integration_es.pdf', 'fr' => 'http://www.moneybookers.com/creatives/integrationmanual/MB-Prestashop-Integration_fr.pdf');
        $iso_manual = $lang->iso_code;
        if (!array_key_exists($lang->iso_code, $manual_links)) {
            $iso_manual = 'en';
        }
        $blockPositionList = array(self::DISABLE => $this->l('Disable'), self::LEFT_COLUMN => $this->l('Left Column'), self::RIGHT_COLUMN => $this->l('Right Column'));
        $currentLogoBlockPosition = $this->isRegisteredInHook('leftColumn') ? self::LEFT_COLUMN : ($this->isRegisteredInHook('rightColumn') ? self::RIGHT_COLUMN : -1);
        /* Display settings form */
        $output .= '
		<b>' . $this->l('About Moneybookers') . '</b><br /><br /><p style="font-size: 11px;">' . $this->l('Take advantage of the special fees offered by Moneybookers to PrestaShop merchants !') . '<br /><br />' . $this->l('Moneybookers, controlled by Skrill Holdings, is one of the largest online payment systems in Europe, and proposes more than 100 payment options, 41 currencies in more than 200 countries and territories. More than 80,000 merchants already use this solution among which eBay.com, Skype and Thomas Cook.') . '<br /><br />' . $this->l('With more than 17 million users and more than 15,000 new accounts created per day, Moneybookers also offers one of the biggest electronic wallets in the world. Your customers can also pay by using their email and password thanks to the e-Wallet solution.') . '<br /><br />' . $this->l('Moneybookers changes its name and becomes Skrill!') . '<br /><br />
                <div style="clear: both;"></div>

		<form method="post" action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" id="form-settings">
			<fieldset class="width2" style="margin: 20px 0; width: 800px;">
				<legend><img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logo.gif" alt="" />' . $this->l('Settings') . '</legend>
				<div class="margin-form" style="margin:0; padding:0 0 1em 20px">' . $this->l('You can display the Skrill/Moneybookers logo on your shop, this may reassure your customers about the fact that you are a serious merchant.') . '</div>
				<div class="margin-form" style="margin:0; padding:0 0 1em 20px">
					<b>' . $this->l('Select the logo position') . '</b> :
					<select name="logo_position">';
        foreach ($blockPositionList as $position => $translation) {
            $selected = $currentLogoBlockPosition == $position ? 'selected="selected"' : '';
            $output .= '<option value="' . $position . '" ' . $selected . '>' . $translation . '</option>';
        }
        $link = new Link();
        $admin_dir = substr(_PS_ADMIN_DIR_, strrpos(_PS_ADMIN_DIR_, '/') + 1);
        $iso_code = strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT')));
        $landingPage = $iso_code == 'en' || $iso_code == 'us' ? 'http://www.moneybookers.com/ads/partners/index.html?p=Prestashop' : 'http://www.moneybookers.com/ads/partners/' . $iso_code . '/index.html?p=Prestashop';
        $output .= '
					</select>
					<p>' . $this->l('Change your logo position in the Front Office. Works with') . '
						<a href="' . $link->getPageLink('index.php') . '?live_edit&ad=' . $admin_dir . '&liveToken=' . sha1($admin_dir . _COOKIE_KEY_) . '">' . $this->l(' Live edit.') . '</a></p>
				</div>
				<div style="text-align:center;">
					<input type="submit" name="submitSettings" value="' . $this->l('Submit settings') . '" />
				</div>
			</fieldset>
		</form>

		<form method="post" action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" id="form-activation"' . ((!Configuration::get('MB_PARAMETERS') and !isset($_POST['SubmitValidation'])) ? ' style="display: none;"' : '') . '>
			<fieldset class="width2" style="margin: 20px 0; width: 800px;">
				<legend><img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logo.gif" alt="" />' . $this->l('Account validation') . '</legend>
				' . (Configuration::get('MB_PARAMETERS') == 1 ? '<p style="font-weight: bold; color: green;"><img src="../img/admin/ok.gif" alt="" /> ' . $this->l('Your account has been activated') . '</p>' : '') . '
				<p style="line-height: 20px;">' . $this->l('You need to') . ' <b>' . $this->l('validate your account') . '</b>.<br /><br />
				<input type="text" name="mb_email_to_validate" value="' . Configuration::get('MB_PAY_TO_EMAIL') . '" style="width: 250px;" />
				<input type="submit" name="SubmitValidation" class="button" value="' . $this->l('Validate my account') . '" /></p>
				<p style="font-size: 14px;"><a href="' . $manual_links[$iso_manual] . '" target="_blank"><img src="../img/admin/pdf.gif" alt="" /></a><a href="' . $manual_links[$iso_manual] . '" target="_blank"><b>' . $this->l('For help, refer to the activation manual.') . '</b></a></p>
				<p style="font-size: 12px;">
' . $this->l('You can test Moneybookers payment with the test account testaccount2@moneybookers.com and the secret word mbtest.') . '<br />
' . $this->l('Beware, this is only a test account: you will not receive money if you use this test account on your shop. To receive money, you have to use the login and password of your personal Moneybookers account !') . '
				</p>
			</fieldset>
		</form>
		
		<form method="post" action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" id="form-opening">
			<fieldset class="width2" style="margin: 20px 0; width: 800px;">
				<legend><img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logo.gif" alt="" />' . $this->l('Open Account') . '</legend>
				' . $this->l('Start by opening a') . ' <b>' . $this->l('free account') . '</b> ' . $this->l('with Moneybookers:') . '
				<p><a href="http://www.moneybookers.com/partners/prestashop/' . ($lang->iso_code == 'fr' ? '' : strtolower($lang->iso_code) . '/') . '"><img src="../modules/moneybookers/prestashop_mb_' . $iso_img . '.gif" alt="PrestaShop & Moneybookers" /></a><br /><br />
				<p style="margin: 0;">
					' . $this->l('Then click here:') . ' <input type="button" class="button" value="' . $this->l('I already have a Moneybookers account') . '" style="margin: 0 auto;" onclick="$(\'#form-activation\').show(1500);" />
					<hr size="1" style="margin: 0 0 15px 0;" noshade />
				</p>
				<span style="color: #CC0000; font-weight: bold; line-height: 20px;"><img src="../img/admin/gold.gif" alt="" /> ' . $this->l('Thanks to the PrestaShop/Moneybookers partnership,') . ' ' . $this->l('you will get a preferential commission rate!') . '</span></p>

<br /><br />
<style>
.tdMBL { border-left: 1px solid black; border-top: 1px solid black; }
.tdMBR { border-left: 1px solid black; border-top: 1px solid black; border-right: 1px solid black; }
.tdMBLast { border-top: 1px solid black; border-right: 1px solid black; }
</style>

<p>' . $this->l('Fees available since March 21st 2011') . '</p>


<table cellpadding="2" cellspacing="0" style="width: 750px;">
 <tr><td class="tdMBL" style="background-color: grey;"><b>PrestaShop</b></td><td colspan="2" class="tdMBR" style="background-color: grey;"><b>' . $this->l('Online payment solution by Moneybookers') . '</b></td></tr>
 <tr><td class="tdMBL">' . $this->l('Monthly volume for payments made via Moneybookers') . '</td><td class="tdMBL">Quick Checkout Moneybookers ***</td><td class="tdMBR">Moneybookers eWallet **</td></tr>
 <tr><td class="tdMBL">€ 0 - € 1,000</td><td class="tdMBR">2.9% + 0.19€</td><td rowspan="5" class="tdMBLast">0.9% + 0.19€</td></tr>
 <tr><td class="tdMBL">€ 1,000.01 - € 10,000</td><td class="tdMBR">1.8% + 0.19€</td></tr>
 <tr><td class="tdMBL">€ 10,000.01 - € 50,000</td><td class="tdMBR">1.6% + 0.19€</td></tr>
 <tr><td class="tdMBL">€ 50,000.01 - € 100,000</td><td class="tdMBR">1.4% + 0.19€</td></tr>
 <tr><td class="tdMBL">€ 100,000</td><td class="tdMBR">1.2% + 0.19€</td></tr>
 <tr><td colspan="3" style="border-top: 1px solid black;"><small>' . $this->l('For merchants over €100,000 fees can be negotiated.') . ' Contact: ecommerce@moneybookers.com</small></td></tr>
</table>
<br />
' . $this->l('To view the last update of the detailed fees') . '<a href="' . $landingPage . '"> <b>' . $this->l('Click here') . '</b></a>

<p align="left">
** ' . $this->l('Moneybookers eWallet') . '<br />
*** ' . $this->l('Quick Checkout Moneybookers') . '
</p>

			</fieldset>
		</form>

		<form method="post" action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" id="form-secret"' . ((!Configuration::get('MB_PARAMETERS') and !isset($_POST['SubmitSecret'])) ? ' style="display: none;"' : '') . '>
			<fieldset class="width2" style="margin: 20px 0; width: 800px;">
				<legend><img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logo.gif" alt="" />' . $this->l('Secret word validation') . '</legend>
				' . (Configuration::get('MB_PARAMETERS_2') == 1 ? '<p style="font-weight: bold; color: green;"><img src="../img/admin/ok.gif" alt="" /> ' . $this->l('Your secret word has been activated') . '</p>' : '') . '
				<p style="line-height: 20px;">' . $this->l('You need to ') . ' <b>' . $this->l('validate your secret word') . '</b>, ' . $this->l('Please enter the secret word entered on your Moneybookers account:') . '<br /><br />
				<input type="password" name="mb_sw_to_validate" value="' . Configuration::get('MB_SECRET_WORD') . '" style="width: 250px;" />
				<input type="submit" name="SubmitSecret" class="button" value="' . $this->l('Validate my secret word') . '" /></p>

				<br />
				<p><b>' . $this->l('What is the secret word ?') . '</b></p>
				<p>' . $this->l('The secret word is different from the password. It is used by Moneybookers to securely encrypt the transmission from your server.') . '</p>
				<p><b>' . $this->l('Why do you need a secret word as well as the  password?') . '</b></p>
				<p>' . $this->l('The secret word is used to reinforce the payment security.') . '</p>
				<p>' . $this->l('The password is only used to securely connect to your Moneybookers account. If the password changes, it won\'t affect your secret word. So it is recommended to have a different password from your secret word.') . '</p>
				<p><b>' . $this->l('Where can I find my secret word ?') . '</b></p>
				<p>' . $this->l('Once your account has been validated, go to your account in the "Merchant Tools" section. There, you will be able to define your secret word.') . '</p>


			</fieldset>
		</form>

		<form method="post" action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" id="form-settings"' . (!Configuration::get('MB_PARAMETERS') ? ' style="display: none;"' : '') . '>
			<style type="text/css">
				label {
					width: 300px;
					margin-right: 10px;
					font-size: 12px;
				}
			</style>
			<fieldset style="width: 800px;">';
        $interActivated = Configuration::get('MB_INTER_METHODS') != '' ? explode('|', Configuration::get('MB_INTER_METHODS')) : array();
        $localActivated = Configuration::get('MB_LOCAL_METHODS') != '' ? explode('|', Configuration::get('MB_LOCAL_METHODS')) : array();
        $output .= '
				<p>' . $this->l('Click the') . ' <b>' . $this->l('international payment methods') . '</b> ' . $this->l('that you would like to enable:') . '</p>
				<div style="width: 200px; float: left; margin-right: 25px; line-height: 75px;">';
        for ($i = 0; $i != 3; $i++) {
            $output .= '<input type="checkbox" name="mb_inter_' . (int) $i . '" value="1"' . (in_array($i, $interActivated) ? ' checked="checked"' : '') . ' /> <img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logos/international/' . $this->_internationalPaymentMethods[$i]['file'] . '.gif" alt="" style="vertical-align: middle;" /><br />';
        }
        $output .= '
				</div>
				<div style="width: 250px; float: left; margin-right: 25px; line-height: 75px;">';
        for ($i = 3; $i != 6; $i++) {
            $output .= '<input type="checkbox" name="mb_inter_' . (int) $i . '" value="1"' . (in_array($i, $interActivated) ? ' checked="checked"' : '') . ' /> <img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logos/international/' . $this->_internationalPaymentMethods[$i]['file'] . '.gif" alt="" style="vertical-align: middle;" /><br />';
        }
        $output .= '
				</div>
				<div style="width: 200px; float: left; line-height: 75px;">';
        for ($i = 6; $i != sizeof($this->_internationalPaymentMethods); $i++) {
            $output .= '<input type="checkbox" name="mb_inter_' . (int) $i . '" value="1"' . (in_array($i, $interActivated) ? ' checked="checked"' : '') . ' /> <img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logos/international/' . $this->_internationalPaymentMethods[$i]['file'] . '.gif" alt="" style="vertical-align: middle;" /><br />';
        }
        $output .= '
				</div>
				<div style="clear: both;"></div>
				<hr size="1" noshade />
				<p>' . $this->l('Click the') . ' <b>' . $this->l('local payment methods') . '</b> ' . $this->l('that you would like to enable:') . '</p>
				<div style="width: 200px; float: left; margin-right: 25px; line-height: 75px;">';
        for ($i = 0; $i != 7; $i++) {
            $output .= '<input type="checkbox" name="mb_local_' . (int) $i . '" value="1"' . (in_array($i, $localActivated) ? ' checked="checked"' : '') . ' /> <img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logos/local/' . $this->_localPaymentMethods[$i]['file'] . '.gif" alt="" style="vertical-align: middle;" /><br />';
        }
        $output .= '
				</div>
				<div style="width: 250px; float: left; margin-right: 25px; line-height: 75px;">';
        for ($i = 8; $i != 15; $i++) {
            $output .= '<input type="checkbox" name="mb_local_' . (int) $i . '" value="1"' . (in_array($i, $localActivated) ? ' checked="checked"' : '') . ' /> <img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logos/local/' . $this->_localPaymentMethods[$i]['file'] . '.gif" alt="" style="vertical-align: middle;" /><br />';
        }
        $output .= '
				</div>
				<div style="width: 200px; float: left; line-height: 75px;">';
        for ($i = 16; $i != sizeof($this->_localPaymentMethods); $i++) {
            $output .= '<input type="checkbox" name="mb_local_' . (int) $i . '" value="1"' . (in_array($i, $localActivated) ? ' checked="checked"' : '') . ' /> <img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logos/local/' . $this->_localPaymentMethods[$i]['file'] . '.gif" alt="" style="vertical-align: middle;" /><br />';
        }
        $output .= '
				</div>
				<div style="clear: both;"></div>

				<hr size="1" noshade />
				<legend><img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logo.gif" alt="" />' . $this->l('Settings and payment methods') . '</legend>
				<label>' . $this->l('Page displayed if payment error:') . '</label>
				<div class="margin-form">
					<input type="text" name="mb_cancel_url" value="' . Configuration::get('MB_CANCEL_URL') . '" style="width: 300px;" />
				</div>
				<div style="clear: both;"></div>
				<label>' . $this->l('Hide the login form on Moneybookers page') . '</label>
				<div class="margin-form">
					<input type="checkbox" name="mb_hide_login" value="1" ' . (Configuration::get('MB_HIDE_LOGIN') ? 'checked="checked"' : '') . ' style="margin-top: 4px;" />
				</div>
				<div style="clear: both;"></div>
				<label>' . $this->l('Display mode:') . '</label>
				<div class="margin-form">
					<input type="radio" name="mb_display_mode" value="0" ' . (!Configuration::get('MB_DISPLAY_MODE') ? 'checked="checked"' : '') . ' style="vertical-align: text-bottom;" /> ' . $this->l('All logos in 1 block') . '
					<input type="radio" name="mb_display_mode" value="1" ' . (Configuration::get('MB_DISPLAY_MODE') ? 'checked="checked"' : '') . ' style="vertical-align: text-bottom; margin-left: 10px;" /> ' . $this->l('1 block for each logo') . '
				</div>
				<div style="clear: both;"></div>

				<center><input type="submit" class="button" name="submitMoneyBookers" value="' . $this->l('Save settings') . '" style="margin-top: 25px;" /></center>
			</fieldset>
		</form>';
        return $output;
    }