/**
  * Check then return multilingual fields for database interaction
  *
  * @return array Multilingual fields
  */
 public function getTranslationsFieldsChild()
 {
     parent::validateFieldsLang();
     $fieldsArray = array('title', 'url');
     $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']][self::$definition['primary']] = (int) $this->id;
         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']], true);
             } elseif (in_array($field, $this->fieldsRequiredLang)) {
                 $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage], true);
             } else {
                 $fields[$language['id_lang']][$field] = '';
             }
         }
     }
     return $fields;
 }
Example #2
0
 public function __construct()
 {
     parent::__construct();
     $this->opo_app_config = Configuration::load();
     $vs_external_app_config_path = $this->opo_app_config->get('external_applications');
     $this->opo_external_app_config = Configuration::load($vs_external_app_config_path);
 }
Example #3
0
 public function loadClass($class)
 {
     // Enable PSR-4 style namespace support.
     $class = str_replace('\\', DIRECTORY_SEPARATOR, $class);
     if (substr($class, -10) == 'Controller') {
         // This is a controller class file.
         $filename = "{$this->controllerPath}/{$class}.class.php";
     } else {
         if (substr($class, -4) == 'Form') {
             // This is a form class file.
             $filename = "{$this->applicationPath}/forms/{$class}.class.php";
         } elseif (substr($class, -5) == 'Model') {
             // This is a model class file.
             $filename = "{$this->applicationPath}/models/{$class}.class.php";
         } else {
             // This is an application class file (outside of MVC).
             $filename = "{$this->applicationPath}/classes/{$class}.class.php";
         }
     }
     if (file_exists($filename) == true) {
         /** @noinspection PhpIncludeInspection */
         include $filename;
     } else {
         if ($this->configuration->get('library', 'autoload-chain', false) == false) {
             throw new ErrorException("La classe <strong>{$class}</strong> ne se trouve pas " . "dans le fichier<br><strong>{$filename}</strong>");
         }
     }
 }
 /**
  * connection using the injected config
  */
 public function connect()
 {
     $host = $this->configuration->get('host');
     // connection to host, authentication etc...
     //if connected
     $this->host = $host;
 }
function zcssleedmaker_plugin_setting_bloc(&$myUser)
{
    $configurationManager = new Configuration();
    $configurationManager->getAll();
    $filescss = getCSSMaker();
    $filecss = $configurationManager->get('plugin_cssLeedMaker_css');
    echo '
	<section id="CSSLeedMaker" class="CSSLeedMaker" style="display:none;">
		<form action="action.php?action=zcssleedmaker_update" method="POST">
		<h2>' . _t('P_CSSLEEDMAKER_TITLE') . '</h2>

		<section class="preferenceBloc">
			<h3>' . _t('P_CSSLEEDMAKER_DEFAULT_FILE') . '</h3>
			<select name="plugin_cssLeedMaker_css" id="plugin_cssLeedMaker_css">
				<option value="none">' . _t('P_CSSLEEDMAKER_NONE') . '</option>';
    foreach ($filescss as $file) {
        if ($file != ".htaccess" && $file != "@eadir" && $file != ".DS_Store") {
            if ($file == $filecss) {
                echo '<option selected="selected" value="' . $file . '">' . $file . '</option>';
            } else {
                echo '<option value="' . $file . '">' . $file . '</option>';
            }
        }
    }
    echo '	</select>
			<h3>' . _t('P_CSSLEEDMAKER_ADD_CSS_PERSO') . '</h3>
			<textarea name="plugin_cssLeedMaker_addcss" rows=20 cols=40 wrap=physical>' . rawurldecode($configurationManager->get('plugin_cssLeedMaker_addcss')) . '</textarea>
		</section>
		<input type="submit" class="button" value="' . _t('P_CSSLEEDMAKER_BTN_SAVE') . '">
		</form>
		
		<p>' . _t('P_CSSLEEDMAKER_COMMENT_AUTHOR') . '</p>
	</section>
	';
}
Example #6
0
 /**
  * Mapping constructor.
  */
 public function __construct()
 {
     // set up basic properties
     $this->opo_datamodel = \Datamodel::load();
     $this->opo_search_conf = \Configuration::load(\Configuration::load()->get('search_config'));
     $this->opo_indexing_conf = \Configuration::load($this->opo_search_conf->get('search_indexing_config'));
     $this->opo_db = new \Db();
     $this->opo_search_base = new \SearchBase($this->opo_db, null, false);
     $this->opa_element_info = array();
     $this->opo_app_vars = new \ApplicationVars($this->opo_db);
     $this->prefetchElementInfo();
 }
Example #7
0
 public function hookCreateAccountTop($params)
 {
     global $smarty;
     $tag = '<img src=' . (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://') . 'api.reversoform.com/includes/' . (Configuration::get('PS_SSL_ENABLED') ? 'www.reversoform.com/' : '') . 'js/trans.giff?d=' . date('U') . ' with="0" height="0" />';
     $smarty->assign(array('reverso_tag' => $tag));
     return $this->display(__FILE__, 'reverso.tpl');
 }
Example #8
0
 /**
  * The Symphony constructor initialises the class variables of Symphony.
  * It will set the DateTime settings, define new date constants and initialise
  * the correct Language for the currently logged in Author. If magic quotes
  * are enabled, Symphony will sanitize the `$_SERVER`, `$_COOKIE`,
  * `$_GET` and `$_POST` arrays. The constructor loads in
  * the initial Configuration values from the `CONFIG` file
  */
 protected function __construct()
 {
     self::$Profiler = Profiler::instance();
     self::$Profiler->sample('Engine Initialisation');
     if (get_magic_quotes_gpc()) {
         General::cleanArray($_SERVER);
         General::cleanArray($_COOKIE);
         General::cleanArray($_GET);
         General::cleanArray($_POST);
     }
     $this->initialiseConfiguration();
     define_safe('__SYM_DATE_FORMAT__', self::Configuration()->get('date_format', 'region'));
     define_safe('__SYM_TIME_FORMAT__', self::Configuration()->get('time_format', 'region'));
     define_safe('__SYM_DATETIME_FORMAT__', __SYM_DATE_FORMAT__ . self::Configuration()->get('datetime_separator', 'region') . __SYM_TIME_FORMAT__);
     DateTimeObj::setSettings(self::Configuration()->get('region'));
     // Initialize language management
     Lang::initialize();
     $this->initialiseLog();
     GenericExceptionHandler::initialise(self::Log());
     GenericErrorHandler::initialise(self::Log());
     $this->initialiseDatabase();
     $this->initialiseExtensionManager();
     $this->initialiseCookie();
     // If the user is not a logged in Author, turn off the verbose error messages.
     if (!self::isLoggedIn() && is_null($this->Author)) {
         GenericExceptionHandler::$enabled = false;
     }
     // Set system language
     Lang::set(self::$Configuration->get('lang', 'symphony'));
 }
Example #9
0
 public function initContent()
 {
     if (Configuration::get('PS_DISPLAY_BEST_SELLERS')) {
         parent::initContent();
         $this->productSort();
         $nb_products = (int) ProductSale::getNbSales();
         $this->pagination($nb_products);
         if (!Tools::getValue('orderby')) {
             $this->orderBy = 'sales';
         }
         $products = ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay);
         $this->addColorsToProductList($products);
         /************************* /Images Array ******************************/
         if (method_exists('Product', 'getProductsImgs')) {
             $image_array = array();
             for ($i = 0; $i < $nb_products; $i++) {
                 if (isset($products[$i]['id_product'])) {
                     $image_array[$products[$i]['id_product']] = Product::getProductsImgs($products[$i]['id_product']);
                 }
             }
             $this->context->smarty->assign('productimg', (isset($image_array) and $image_array) ? $image_array : NULL);
         }
         /************************* /Images Array ******************************/
         $this->context->smarty->assign(array('products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nb_products, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
         $this->setTemplate(_PS_THEME_DIR_ . 'best-sales.tpl');
     } else {
         Tools::redirect('index.php?controller=404');
     }
 }
Example #10
0
 public function renderForm($args, $data)
 {
     # validate module
     unset($args);
     $this->checkFolderImage();
     $helper = $this->getFormHelper();
     $items = '';
     $slide_edit = '';
     if ($data['params'] && isset($data['params']['leoslide']) && $data['params']['leoslide']) {
         $slides = $data['params']['leoslide'];
         $items = $this->getSlide($slides);
         if (Tools::getValue('id_slide')) {
             $id_slide = Tools::getValue('id_slide');
             $slide_edit = $items[$id_slide] ? $items[$id_slide] : '';
         }
     }
     $this->fields_form[1]['form'] = array('legend' => array('title' => $this->l('Carousel Form.')), 'input' => array(array('type' => 'text', 'label' => $this->l('Image Size Width'), 'name' => 'img_width', 'class' => 'fixed-width-xl', 'default' => 1170), array('type' => 'text', 'label' => $this->l('Image size Height'), 'name' => 'img_height', 'class' => 'fixed-width-xl', 'default' => 400), array('type' => 'text', 'label' => $this->l('Thumb Size Width'), 'name' => 'thumb_width', 'class' => 'fixed-width-xl', 'default' => 100), array('type' => 'text', 'label' => $this->l('Thumb size Height'), 'name' => 'thumb_height', 'class' => 'fixed-width-xl', 'default' => 100), array('type' => 'text', 'label' => $this->l('Interval'), 'name' => 'interval', 'class' => 'fixed-width-xl', 'default' => 400, 'desc' => $this->l('Enter Time(miniseconds) to play slide. Value 0 to stop.')), array('type' => 'text', 'label' => $this->l('Transition Speed'), 'name' => 'transitionSpeed', 'class' => 'fixed-width-xl', 'default' => 900, 'desc' => $this->l('Enter Time(miniseconds) to next each slide.')), array('type' => 'select', 'label' => $this->l('Display Progress Bar'), 'name' => 'displayProgressBar', 'default' => '1', 'options' => array('query' => array(array('id' => 1, 'name' => $this->l('Enable')), array('id' => 0, 'name' => $this->l('Disable'))), 'id' => 'id', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Display Thumbnail Numbers'), 'name' => 'displayThumbnailNumbers', 'default' => '1', 'options' => array('query' => array(array('id' => 1, 'name' => $this->l('Enable')), array('id' => 0, 'name' => $this->l('Disable'))), 'id' => 'id', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Display Thumbnail Background'), 'name' => 'displayThumbnailBackground', 'default' => '1', 'options' => array('query' => array(array('id' => 1, 'name' => $this->l('Enable')), array('id' => 0, 'name' => $this->l('Disable'))), 'id' => 'id', 'name' => 'name')), array('type' => 'slide', 'name' => 'slide', 'lang' => true, 'selectImg' => Context::getContext()->link->getAdminLink('AdminLeotempcpImages'), 'tree' => '', 'default' => '')), 'buttons' => array(array('title' => $this->l('Save And Stay'), 'icon' => 'process-icon-save', 'class' => 'pull-right', 'type' => 'submit', 'name' => 'saveandstayleotempcp'), array('title' => $this->l('Save'), 'icon' => 'process-icon-save', 'class' => 'pull-right', 'type' => 'submit', 'name' => 'saveleotempcp')));
     $theme_dir = Context::getContext()->shop->theme_directory;
     $images = array();
     $thums = array();
     $images = LeoWidgetBase::getImageList(_PS_ROOT_DIR_ . '/themes/' . $theme_dir . '/img/modules/' . $this->name . '/image');
     $thums = LeoWidgetBase::getImageList(_PS_ROOT_DIR_ . '/themes/' . $theme_dir . '/img/modules/' . $this->name . '/thum');
     $iso = Context::getContext()->language->iso_code;
     $helper->tpl_vars = array('fields_value' => $this->getConfigFieldsValues($data), 'languages' => Context::getContext()->controller->getLanguages(), 'id_lang_default' => Configuration::get('PS_LANG_DEFAULT'), 'iso_code' => Context::getContext()->language->iso_code, 'iso' => file_exists(_PS_CORE_DIR_ . '/js/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en', 'path_css' => _THEME_CSS_DIR_, 'ad' => __PS_BASE_URI__ . basename(_PS_ADMIN_DIR_), 'images' => $images, 'thums' => $thums, 'items' => $items, 'slide_edit' => $slide_edit, 'url' => AdminController::$currentIndex . '&id_leowidgets=' . Tools::getValue('id_leowidgets') . '&updateleowidgets&token=' . Tools::getValue('token') . '&conf=4', 'pathimg' => __PS_BASE_URI__ . 'themes/' . $theme_dir . '/img/modules/' . $this->name . '/image/', 'paththum' => __PS_BASE_URI__ . 'themes/' . $theme_dir . '/img/modules/' . $this->name . '/thum/');
     return $helper->generateForm($this->fields_form);
 }
Example #11
0
 public function loadConfig()
 {
     $this->installed = html_entity_decode(Configuration::get('DJL_INSTALLED'), ENT_COMPAT, 'UTF-8');
     $this->useSSL = (int) html_entity_decode(Configuration::get('DJL_USE_SSL'), ENT_COMPAT, 'UTF-8');
     $this->serviceURL = html_entity_decode(Configuration::get('DJL_SERVICE_URL'), ENT_COMPAT, 'UTF-8');
     $this->sandboxServiceURL = html_entity_decode(Configuration::get('DJL_SANDBOX_SERVICE_URL'), ENT_COMPAT, 'UTF-8');
     $this->mode = html_entity_decode(Configuration::get('DJL_MODE'), ENT_COMPAT, 'UTF-8');
     $this->login = html_entity_decode(Configuration::get('DJL_LOGIN'), ENT_COMPAT, 'UTF-8');
     $this->password = html_entity_decode(Configuration::get('DJL_PASSWORD'), ENT_COMPAT, 'UTF-8');
     $this->trigerringStatuses = html_entity_decode(Configuration::get('DJL_TRIGERRING_STATUSES'), ENT_COMPAT, 'UTF-8');
     $this->shippingPrefix = html_entity_decode(Configuration::get('DJL_SHIPPING_PREFIX'), ENT_COMPAT, 'UTF-8');
     $this->country = html_entity_decode(Configuration::get('DJL_COUNTRY'), ENT_COMPAT, 'UTF-8');
     if (strlen($this->country) == 0) {
         $this->country = 'fr';
     }
     $this->visibility_status = html_entity_decode(Configuration::get('DJL_VISIBILITY_STATUS'), ENT_COMPAT, 'UTF-8');
     $this->visible_users_list = html_entity_decode(Configuration::get('DJL_VISIBLE_USERS_LIST'), ENT_COMPAT, 'UTF-8');
     $this->internal_version = Configuration::get('DJL_VERSION');
     // Backward compatibility
     $activeVal = html_entity_decode(Configuration::get('DJL_ACTIVE'), ENT_COMPAT, 'UTF-8');
     if ($activeVal != "") {
         $this->active = (int) $activeVal;
         $this->visibility_status = $this->active == 0 ? "invisible" : "visible";
     }
     if ($this->visibility_status == "") {
         $this->visibility_status = "invisible";
     }
 }
Example #12
0
 public static function redirect($url, $base_uri = __PS_BASE_URI__, Link $link = null, $headers = null)
 {
     if (!$link) {
         $link = Context::getContext()->link;
     }
     if (strpos($url, 'http://') === false && strpos($url, 'https://') === false && $link) {
         if (strpos($url, $base_uri) === 0) {
             $url = substr($url, strlen($base_uri));
         }
         if (strpos($url, 'index.php?controller=') !== false && strpos($url, 'index.php/') == 0) {
             $url = substr($url, strlen('index.php?controller='));
             if (Configuration::get('PS_REWRITING_SETTINGS')) {
                 $url = Tools::strReplaceFirst('&', '?', $url);
             }
         }
         $explode = explode('?', $url);
         // don't use ssl if url is home page
         // used when logout for example
         $use_ssl = !empty($url);
         $url = $link->getPageLink($explode[0], $use_ssl);
         if (isset($explode[1])) {
             $url .= '?' . $explode[1];
         }
     }
     // Send additional headers
     if ($headers) {
         if (!is_array($headers)) {
             $headers = array($headers);
         }
         foreach ($headers as $header) {
             header($header);
         }
     }
     Context::getContext()->controller->setRedirectAfter($url);
 }
 public static function sds_init_error_warning()
 {
     if ((int) Configuration::get('config_maintenance') == 1) {
         echo "<div class='alert alert-warning'>Maintenance mode is enabled. This may cause functional problem at your slider revolution module.</div>";
         if (!in_array(Tools::getRemoteAddr(), explode(',', Configuration::get('PS_MAINTENANCE_IP')))) {
             echo "<div class='alert alert-warning'>It's seemed that your IP is not present in Maintenance IP.</div>";
         }
     }
     if (get_magic_quotes_gpc()) {
         echo "<div class='alert alert-warning'>magic_quotes_gpc is enabled. This may cause functional problem at your slider revolution module. Please disable magic_quotes_gpc.</div>";
     }
     if (get_magic_quotes_runtime()) {
         echo "<div class='alert alert-warning'>magic_quotes_runtime is enabled. This may cause functional problem at your slider revolution module. Please disable magic_quotes_runtime.</div>";
     }
     if (!defined('ABSPATH')) {
         echo "<div class='alert alert-warning'>Fatal Error: 'ABSPATH' isn't defined.</div>";
         return;
     }
     if (!is_writable(ABSPATH . '/uploads')) {
         echo "<div class='alert alert-warning'>'" . ABSPATH . "/uploads' folder is not writeable. Change the folder permission.</div>";
     }
     if (!is_writable(ABSPATH . '/rs-plugin/css')) {
         echo "<div class='alert alert-warning'>'" . ABSPATH . "/rs-plugin/css' folder is not writeable. Change the folder permission.</div>";
     }
     //                    if(!is_executable(ABSPATH.'/rs-plugin/fileuploader/uploadify.php')){
     //                        echo "<div class='alert alert-warning'>'".ABSPATH."/rs-plugin/fileuploader/uploadify.php' file is not executable. Change the file permission.</div>";
     //                    }
     if (!is_writable(ABSPATH . '/cache')) {
         echo "<div class='alert alert-warning'>'" . ABSPATH . "/cache' folder is not writeable. Change the folder permission.</div>";
     }
 }
Example #14
0
 public function renderForm($args, $data)
 {
     # validate module
     unset($args);
     $this->checkFolderImage();
     $helper = $this->getFormHelper();
     $items = '';
     $slide_edit = '';
     if ($data['params'] && isset($data['params']['leoslide']) && $data['params']['leoslide']) {
         $slides = $data['params']['leoslide'];
         $items = $this->getSlide($slides);
         if (Tools::getValue('id_slide')) {
             $id_slide = Tools::getValue('id_slide');
             $slide_edit = $items[$id_slide] ? $items[$id_slide] : '';
         }
     }
     $this->fields_form[1]['form'] = array('legend' => array('title' => $this->l('Widget Form')), 'input' => array(array('type' => 'html', 'html_content' => 'Please access <a href="http://apollotheme.com/" target="_blank" title="apollo site">Apollotheme.com</a> to buy professional version to use this '), array('type' => 'html', 'html_content' => '<a target="_blank" href="http://apollotheme.com/how-to-buy-pro-version/" target="_blank" title="How to buy">How to buy Professional Version</a>'), array('type' => 'html', 'html_content' => '<a target="_blank" href="http://apollotheme.com/different-between-free-pro-version/" target="_blank" title="Why should use">Why should use Professional Version</a>')), 'buttons' => array(array('title' => $this->l('Save And Stay'), 'icon' => 'process-icon-save', 'class' => 'pull-right', 'type' => 'submit', 'name' => 'saveandstayleotempcp'), array('title' => $this->l('Save'), 'icon' => 'process-icon-save', 'class' => 'pull-right', 'type' => 'submit', 'name' => 'saveleotempcp')));
     $theme_dir = Context::getContext()->shop->theme_directory;
     $images = array();
     $thums = array();
     $images = LeoWidgetBase::getImageList(_PS_ROOT_DIR_ . '/themes/' . $theme_dir . '/img/modules/' . $this->name . '/image');
     $thums = LeoWidgetBase::getImageList(_PS_ROOT_DIR_ . '/themes/' . $theme_dir . '/img/modules/' . $this->name . '/thum');
     $iso = Context::getContext()->language->iso_code;
     $helper->tpl_vars = array('fields_value' => $this->getConfigFieldsValues($data), 'languages' => Context::getContext()->controller->getLanguages(), 'id_lang_default' => Configuration::get('PS_LANG_DEFAULT'), 'iso_code' => Context::getContext()->language->iso_code, 'iso' => file_exists(_PS_CORE_DIR_ . '/js/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en', 'path_css' => _THEME_CSS_DIR_, 'ad' => __PS_BASE_URI__ . basename(_PS_ADMIN_DIR_), 'images' => $images, 'thums' => $thums, 'items' => $items, 'slide_edit' => $slide_edit, 'url' => AdminController::$currentIndex . '&id_leowidgets=' . Tools::getValue('id_leowidgets') . '&updateleowidgets&token=' . Tools::getValue('token') . '&conf=4', 'pathimg' => __PS_BASE_URI__ . 'themes/' . $theme_dir . '/img/modules/' . $this->name . '/image/', 'paththum' => __PS_BASE_URI__ . 'themes/' . $theme_dir . '/img/modules/' . $this->name . '/thum/');
     return $helper->generateForm($this->fields_form);
 }
Example #15
0
 /**
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     $shop_name = htmlentities(Configuration::get('PS_SHOP_NAME'), NULL, 'utf-8');
     $shop_url = Tools::getHttpHost(true, true);
     $customer = Context::getContext()->customer;
     if (!preg_match("#.*\\.html\$#Ui", Tools::getValue('mail')) or !preg_match("#.*\\.html\$#Ui", Tools::getValue('mail'))) {
         die(Tools::redirect());
     }
     $file = file_get_contents(dirname(__FILE__) . '/../../mails/' . strval(preg_replace('#\\.{2,}#', '.', Tools::getValue('mail'))));
     $file = str_replace('{shop_name}', $shop_name, $file);
     $file = str_replace('{shop_url}', $shop_url . __PS_BASE_URI__, $file);
     $file = str_replace('{shop_logo}', $shop_url . _PS_IMG_ . 'logo.jpg', $file);
     $file = str_replace('{firstname}', $customer->firstname, $file);
     $file = str_replace('{lastname}', $customer->lastname, $file);
     $file = str_replace('{email}', $customer->email, $file);
     $file = str_replace('{firstname_friend}', 'XXXXX', $file);
     $file = str_replace('{lastname_friend}', 'xxxxxx', $file);
     $file = str_replace('{link}', 'authentication.php?create_account=1', $file);
     $discount_type = (int) Configuration::get('REFERRAL_DISCOUNT_TYPE');
     if ($discount_type == 1) {
         $file = str_replace('{discount}', Discount::display((double) Configuration::get('REFERRAL_PERCENTAGE'), $discount_type, new Currency($this->context->currency->id)), $file);
     } else {
         $file = str_replace('{discount}', Discount::display((double) Configuration::get('REFERRAL_DISCOUNT_VALUE_' . $this->context->currency->id), $discount_type, new Currency($this->context->currency->id)), $file);
     }
     $this->context->smarty->assign(array('content' => $file));
     $this->setTemplate('email.tpl');
 }
Example #16
0
 public function openSession($debug_post = null, $debug_response = null)
 {
     $this->session_id = Configuration::get('adminmarketing_session_api');
     $this->error = null;
     $parameters = array();
     $response_array = array();
     // S'il existe déjà une session, on vérifie qu'elle est toujours active
     // --------------------------------------------------------------------
     if (!empty($this->session_id)) {
         if ($this->call('server', 'session', 'get_current', $parameters, $response_array, $debug_post, $debug_response)) {
             if ($this->session_id == $response_array['session_id']) {
                 return true;
             }
         }
     }
     // Sinon on ouvre une nouvelle session (application_id dépend de la langue FR/PL)
     // ------------------------------------------------------------------------------
     $this->error = null;
     $parameters = array('application_id' => $this->application_id);
     $response_array = array();
     if ($this->call('server', 'session', 'open_session', $parameters, $response_array, $debug_post, $debug_response)) {
         $this->session_id = $response_array['session_id'];
         Configuration::updateValue('adminmarketing_session_api', $this->session_id);
         return true;
     }
     // S'il est impossible d'ouvrir une session on affichera une erreur dans le code appelant
     // --------------------------------------------------------------------------------------
     return false;
 }
 public function renderOptions()
 {
     // This field is not declared in class constructor because we want it to be manually post processed
     $this->fields_options['geolocationCountries']['fields']['countries'] = array('title' => $this->l('Select the countries from which your store is accessible'), 'type' => 'checkbox_table', 'identifier' => 'iso_code', 'list' => Country::getCountries($this->context->language->id), 'auto_value' => false);
     $this->tpl_option_vars = array('allowed_countries' => explode(';', Configuration::get('PS_ALLOWED_COUNTRIES')));
     return parent::renderOptions();
 }
Example #18
0
 public function renderForm($args, $data)
 {
     # validate module
     unset($args);
     $this->checkFolderImage();
     $helper = $this->getFormHelper();
     $items = '';
     $slide_edit = '';
     if ($data['params'] && isset($data['params']['leoslide']) && $data['params']['leoslide']) {
         $slides = $data['params']['leoslide'];
         $items = $this->getSlide($slides);
         if (Tools::getValue('id_slide')) {
             $id_slide = Tools::getValue('id_slide');
             $slide_edit = $items[$id_slide] ? $items[$id_slide] : '';
         }
     }
     $this->fields_form[1]['form'] = array('legend' => array('title' => $this->l('Carousel Form.')), 'input' => array(array('type' => 'text', 'label' => $this->l('Image Size Width'), 'name' => 'img_width', 'default' => 1170), array('type' => 'text', 'label' => $this->l('Image size Height'), 'name' => 'img_height', 'default' => 400), array('type' => 'text', 'label' => $this->l('Thumb Size Width'), 'name' => 'thumb_width', 'default' => 100), array('type' => 'text', 'label' => $this->l('Thumb size Height'), 'name' => 'thumb_height', 'default' => 100), array('type' => 'text', 'label' => $this->l('Interval'), 'name' => 'interval', 'default' => 8000)), 'buttons' => array(array('title' => $this->l('Save And Stay'), 'icon' => 'process-icon-save', 'class' => 'pull-right', 'type' => 'submit', 'name' => 'saveandstayleotempcp'), array('title' => $this->l('Save'), 'icon' => 'process-icon-save', 'class' => 'pull-right', 'type' => 'submit', 'name' => 'saveleotempcp')));
     if (Tools::getIsset('addleowidgets')) {
         $this->fields_form[1]['form']['input'][] = array('type' => 'html', 'name' => 'html', 'default' => '', 'html_content' => '<div class="alert alert-info">' . $this->l('Please Click save to input image') . '</div>');
     } else {
         $this->fields_form[1]['form']['input'][] = array('type' => 'slide', 'name' => 'slide', 'lang' => true, 'selectImg' => Context::getContext()->link->getAdminLink('AdminLeomanagewidgetsImages'), 'tree' => '', 'default' => '');
     }
     $theme_dir = Context::getContext()->shop->theme_directory;
     $images = array();
     $thums = array();
     $images = LeoWidgetBase::getImageList(_PS_ROOT_DIR_ . '/themes/' . $theme_dir . '/img/modules/' . $this->name . '/image');
     $thums = LeoWidgetBase::getImageList(_PS_ROOT_DIR_ . '/themes/' . $theme_dir . '/img/modules/' . $this->name . '/thum');
     $iso = Context::getContext()->language->iso_code;
     $helper->tpl_vars = array('fields_value' => $this->getConfigFieldsValues($data), 'languages' => Context::getContext()->controller->getLanguages(), 'id_lang_default' => Configuration::get('PS_LANG_DEFAULT'), 'iso_code' => Context::getContext()->language->iso_code, 'iso' => file_exists(_PS_CORE_DIR_ . '/js/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en', 'path_css' => _THEME_CSS_DIR_, 'ad' => __PS_BASE_URI__ . basename(_PS_ADMIN_DIR_), 'images' => $images, 'thums' => $thums, 'items' => $items, 'slide_edit' => $slide_edit, 'url' => AdminController::$currentIndex . '&id_leowidgets=' . Tools::getValue('id_leowidgets') . '&updateleowidgets&token=' . Tools::getValue('token') . '&conf=4', 'pathimg' => __PS_BASE_URI__ . 'themes/' . $theme_dir . '/img/modules/' . $this->name . '/image/', 'paththum' => __PS_BASE_URI__ . 'themes/' . $theme_dir . '/img/modules/' . $this->name . '/thum/');
     return $helper->generateForm($this->fields_form);
 }
 function hookRightColumn($params)
 {
     global $smarty;
     $newProducts = Product::getNewProducts(intval($params['cookie']->id_lang), 0, intval(Configuration::get('NEW_PRODUCTS_NBR')));
     $smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('medium')));
     return $this->display(__FILE__, 'blocknewproducts.tpl');
 }
Example #20
0
 /**
  * Get the page handler for the current URL.
  *
  * @param string $url
  *   The current URL requested.
  * @param boolean $cli
  *   Whether the request was made from the command line.
  *
  * @return string
  *   The namespace of the URL handler.
  */
 public static function parseRoute($url, $cli)
 {
     if (empty(self::$routes)) {
         self::$routes = Configuration::get('routes');
     }
     // If we are in CLI mode, and there is a command for cli only.
     if ($cli && isset(self::$routes['cli_only'][$url])) {
         return self::$routes['cli_only'][$url];
     }
     // If this is listed in the static url list.
     if (isset(self::$routes['static'][$url])) {
         return self::$routes['static'][$url];
     }
     // If this matches one of the regex urls.
     if (!empty(self::$routes['dynamic'])) {
         foreach (self::$routes['dynamic'] as $expr => $route) {
             if (preg_match('|' . $expr . '|', $url)) {
                 return $route;
             }
         }
     }
     // Nothing found, use the default route.
     if (!empty(self::$routes['default'])) {
         return self::$routes['default'];
     }
 }
 public function hookHeader($params)
 {
     if (Configuration::get('PS_CATALOG_MODE')) {
         return;
     }
     $this->context->controller->addCSS($this->_path . 'blockcurrencies.css', 'all');
 }
 public function getTaxTabContent()
 {
     $invoice_address = new Address((int) $this->order->id_address_invoice);
     $tax_exempt = Configuration::get('VATNUMBER_MANAGEMENT') && !empty($invoice_address->vat_number) && $invoice_address->id_country != Configuration::get('VATNUMBER_COUNTRY');
     $this->smarty->assign(array('tax_exempt' => $tax_exempt, 'tax_details' => $this->order->getOrderTaxDetails(false, $this->order_slip), 'order' => $this->order, 'is_order_slip' => true));
     return $this->smarty->fetch($this->getTemplate('invoice.tax-tab'));
 }
 public function hookDisplayHome($params)
 {
     !isset($params['tpl']) && ($params['tpl'] = 'hookHome');
     $config = Tools::jsonDecode(Configuration::get($this->name), true);
     $this->smarty->assign($config);
     return $this->display(__FILE__, $params['tpl'] . '.tpl');
 }
 public function process()
 {
     $this->productSort();
     $nbProducts = (int) ProductSale::getNbSales();
     $this->pagination($nbProducts);
     self::$smarty->assign(array('products' => ProductSale::getBestSales((int) self::$cookie->id_lang, (int) $this->p - 1, (int) $this->n, $this->orderBy, $this->orderWay), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nbProducts, 'homeSize' => Image::getSize('home')));
 }
Example #25
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;
 }
 public static function get($key, $id_lang = null, $id_shop_group = null, $id_shop = null)
 {
     ConfigurationKPI::setKpiDefinition();
     $r = parent::get($key, $id_lang, $id_shop_group, $id_shop);
     ConfigurationKPI::unsetKpiDefinition();
     return $r;
 }
 /**
  * Enable / disable multishop menu if multishop feature is activated
  *
  * @param string $value
  */
 public function updateOptionPsMultishopFeatureActive($value)
 {
     Configuration::updateValue('PS_MULTISHOP_FEATURE_ACTIVE', $value);
     $tab = Tab::getInstanceFromClassName('AdminShopGroup');
     $tab->active = (bool) Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE');
     $tab->update();
 }
 protected function canonicalRedirection()
 {
     global $link, $cookie;
     if (Configuration::get('PS_CANONICAL_REDIRECT') && strtoupper($_SERVER['REQUEST_METHOD']) == 'GET') {
         // Automatically redirect to the canonical URL if needed
         if (isset($this->php_self) && !empty($this->php_self)) {
             // $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
             $canonicalURL = $link->getPageLink($this->php_self, $this->ssl, $cookie->id_lang);
             if (!Tools::getValue('ajax') && !preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', ($this->ssl && _PS_SSL_ENABLED_ ? 'https://' : 'http://') . urldecode($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']))) {
                 if ($_SERVER['REQUEST_URI'] == __PS_BASE_URI__) {
                     header('HTTP/1.0 303 See Other');
                     header('Cache-Control: no-cache');
                 } else {
                     header('HTTP/1.0 301 Moved Permanently');
                     header('Cache-Control: no-cache');
                 }
                 $params = '';
                 $excludedKey = array('isolang', 'id_lang');
                 foreach ($_GET as $key => $value) {
                     if (!in_array($key, $excludedKey)) {
                         $params .= ($params == '' ? '?' : '&') . $key . '=' . $value;
                     }
                 }
                 Module::hookExec('frontCanonicalRedirect');
                 if (defined('_PS_MODE_DEV_') && _PS_MODE_DEV_ && $_SERVER['REQUEST_URI'] != __PS_BASE_URI__) {
                     die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . $params . '">' . $canonicalURL . $params . '</a>');
                 }
                 Tools::redirectLink($canonicalURL . $params);
             }
         }
     }
 }
Example #29
0
 public function postProcess()
 {
     if ($this->context->cart->id_customer == 0 || $this->context->cart->id_address_delivery == 0 || $this->context->cart->id_address_invoice == 0 || !$this->module->active) {
         Tools::redirectLink(__PS_BASE_URI__ . 'order.php?step=1');
     }
     // Check that this payment option is still available in case the customer changed his address just before the end of the checkout process
     $authorized = false;
     foreach (Module::getPaymentModules() as $module) {
         if ($module['name'] == 'cashondelivery') {
             $authorized = true;
             break;
         }
     }
     //		if (!$authorized)
     //			die(Tools::displayError('This payment method is not available.'));
     $customer = new Customer($this->context->cart->id_customer);
     if (!Validate::isLoadedObject($customer)) {
         Tools::redirectLink(__PS_BASE_URI__ . 'order.php?step=1');
     }
     if (Tools::getValue('confirm')) {
         $customer = new Customer((int) $this->context->cart->id_customer);
         $total = $this->context->cart->getOrderTotal(true, Cart::BOTH);
         $this->module->validateOrder((int) $this->context->cart->id, Configuration::get('PS_OS_PREPARATION'), $total, $this->module->displayName, null, array(), null, false, $customer->secure_key);
         Tools::redirectLink(__PS_BASE_URI__ . 'order-confirmation.php?key=' . $customer->secure_key . '&id_cart=' . (int) $this->context->cart->id . '&id_module=' . (int) $this->module->id . '&id_order=' . (int) $this->module->currentOrder);
     }
 }
Example #30
0
 public function postProcess()
 {
     $cart = $this->context->cart;
     if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) {
         Tools::redirect('index.php?controller=order&step=1');
     }
     // Check that this payment option is still available in case the customer changed his address just before the end of the checkout process
     $authorized = false;
     foreach (Module::getPaymentModules() as $module) {
         if ($module['name'] == 'cheque') {
             $authorized = true;
             break;
         }
     }
     if (!$authorized) {
         die($this->module->l('This payment method is not available.', 'validation'));
     }
     $customer = new Customer($cart->id_customer);
     if (!Validate::isLoadedObject($customer)) {
         Tools::redirect('index.php?controller=order&step=1');
     }
     $currency = $this->context->currency;
     $total = (double) $cart->getOrderTotal(true, Cart::BOTH);
     $mailVars = array('{cheque_name}' => Configuration::get('CHEQUE_NAME'), '{cheque_address}' => Configuration::get('CHEQUE_ADDRESS'), '{cheque_address_html}' => str_replace("\n", '<br />', Configuration::get('CHEQUE_ADDRESS')));
     $this->module->validateOrder((int) $cart->id, Configuration::get('PS_OS_CHEQUE'), $total, $this->module->displayName, NULL, $mailVars, (int) $currency->id, false, $customer->secure_key);
     Tools::redirect('index.php?controller=order-confirmation&id_cart=' . (int) $cart->id . '&id_module=' . (int) $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key);
 }