/**
 * Smarty {seo_rewrite module=""} function plugin
 *
 * Type:     function
 * Name:     SEO REWRITE METAS
 * Date:     JUNY 29, 2011
 * Update 		25/07/2011
 * Purpose:  
 * Examples: {seo_rewrite config_param=['level'=>'3','idmetas'=>'1','default'=>''] category="" subcategory="" record=""}
 * Output:   
 * @link 
 * @author   Gerits Aurelien
 * @version  1.1
 * @param array
 * @param Smarty
 * @return string
 */
function smarty_function_seo_rewrite($params, $template)
{
    if (!isset($params['config_param'])) {
        trigger_error("config_param: missing 'config_param' parameter");
        return;
    }
    if (is_array($params['config_param'])) {
        $tabs = $params['config_param'];
    }
    $record = $params['record'];
    $category = $params['category'];
    $subcategory = $params['subcategory'];
    if (isset($_GET['magixmod'])) {
        $magixmod = magixcjquery_filter_var::clean($_GET['magixmod']);
    }
    $filename = substr($_SERVER['SCRIPT_NAME'], 1);
    $position = strpos($filename, '.');
    $attribute = substr($filename, 0, $position);
    if ($attribute == 'plugins') {
        $module = $attribute . ':' . $magixmod;
    } else {
        $module = $attribute;
    }
    $iniseo = new frontend_controller_seo($module, $tabs['level'], $tabs['idmetas'], frontend_model_template::current_Language());
    if ($iniseo->replace_var_rewrite($record, $category, $subcategory) != null) {
        return $iniseo->replace_var_rewrite($record, $category, $subcategory);
    } else {
        if (!isset($tabs['default'])) {
            trigger_error("default: missing 'default' parameter");
            return;
        } else {
            return $tabs['default'];
        }
    }
}
示例#2
0
 /**
  * @param $setParams
  * @return string
  */
 public function getData($setParams)
 {
     //Charge le fichier de traduction
     frontend_model_smarty::getInstance()->configLoad($this->modelSystem->base_path() . 'plugins/ogone/i18n/public_local_' . frontend_model_template::current_Language() . '.conf');
     $data = $this->setData();
     if ($data['formaction'] === 'test') {
         $urlOgone = Form::OGONE_TEST_URL;
     } elseif ($data['formaction'] === 'production') {
         $urlOgone = Form::OGONE_PRODUCTION_URL;
     }
     $url = magixcjquery_html_helpersHtml::getUrl() . '/' . frontend_model_template::current_Language() . '/';
     // Define form options
     // See Ogone_Form for list of supported options
     $options = array('sha1InPassPhrase' => $data['passphrase'], 'formAction' => $urlOgone, 'formSubmitType' => 'image', 'formSubmitImageUrl' => $setParams['formSubmitImageUrl'], 'formSubmitButtonName' => $this->template->getConfigVars('form_submit_button'), 'formSubmitButtonValue' => $this->template->getConfigVars('form_submit_button'), 'formSubmitButtonClass' => frontend_model_template::current_Language() . '_' . 'ogoneSubmitButton');
     $seturl = $this->setUrl();
     // https://github.com/jvandemo/Ogone
     // Define form parameters (see Ogone documentation for list)
     // Default parameter values can be set in Ogone_Form if required
     $params = array('PSPID' => $data['pspid'], 'orderID' => 'your_order_id / transaction ID', 'amount' => 100, 'currency' => 'EUR', 'language' => 'en_EN', 'COMPLUS' => 'custom data', 'OPERATION' => 'SAL', 'CN' => 'name of your client', 'EMAIL' => 'email of your client', 'accepturl' => $url . $setParams['plugin'] . $seturl['seturlok'], 'declineurl' => $url . $setParams['plugin'] . $seturl['seturlnook'], 'exceptionurl' => $url . $setParams['plugin'] . $seturl['seturlexception'], 'cancelurl' => $url . $setParams['plugin'] . $seturl['seturlcancel']);
     // Instantiate form
     $form = new Form($options, $params);
     // You can also add parameters after instantiation
     // with the addParam() method
     $form->addParam('CN', $setParams['lastname'] . ' ' . $setParams['firstname'])->addParam('EMAIL', $setParams['email'])->addParam('language', $setParams['language'])->addParam('orderID', $setParams['transaction'])->addParam('amount', $setParams['amount'])->addParam('COMPLUS', $setParams['COMPLUS'])->addParam('PARAMVAR', $setParams['PARAMVAR']);
     // Automatically generate HTML form with all params and SHA1Sign
     return $form->render();
 }
示例#3
0
 /**
  * function construct
  */
 function __construct()
 {
     if (magixcjquery_filter_request::isGet('strLangue')) {
         $this->getlang = magixcjquery_filter_join::getCleanAlpha($_GET['strLangue'], 3);
     } else {
         $this->getlang = frontend_model_template::current_Language();
     }
 }
/**
* Smarty {widget_cart_session} function plugin
*
* Type:     function
* Name:     widget_cart_session
* Date:     21 september 2012
* Update:   06 january 2014
* Purpose:
* USAGE:
   {widget_cartpay_session}
* Output:   
* @link 	http://www.magix-dev.be
* @author   Gerits Aurelien
* @version  1.5
* @param array
* @param Smarty
* @return string
*/
function smarty_function_widget_cartpay_session($params, $template)
{
    //    plugins_Autoloader::register(); //chargement des function plugins
    $session = new frontend_model_session();
    $session->_start_session('lang');
    //if session key_cart
    if (isset($_SESSION['key_cart'])) {
        $token_cart = $_SESSION['key_cart'];
    } else {
        $token_cart = magixglobal_model_cryptrsa::tokenId();
    }
    $array_sess = array('key_cart' => $token_cart);
    $session->session_run($array_sess);
    //    $session->debug();
    //@todo créer dans l'api une fonction public applicable dans les widgets.
    $modelSystem = new magixglobal_model_system();
    if ($_GET['magixmod'] != 'cartpay') {
        frontend_model_smarty::getInstance()->configLoad($modelSystem->base_path() . 'plugins/cartpay/i18n/public_local_' . frontend_model_template::current_Language() . '.conf');
    }
}
示例#5
0
 /**
 * @param $setParams
 * @return string
 *
     $hipay = new plugins_hipay_public();
     $hipayProcess = $hipay->getData(
    array(
        'plugin'        =>  'cartpay',
        'key'           =>  $session_key,
        'order'         =>  $id_cart,
        'amount'        =>  $amount_pay_with_tax,
        'shipping'      =>  $shipping,
        'locale'        =>  'BE',
        'customerEmail' => $data_cart['email_cart']
    )
     );
 */
 public function getData($setParams)
 {
     try {
         frontend_model_smarty::getInstance()->configLoad($this->modelSystem->base_path() . 'plugins/hipay/i18n/public_local_' . frontend_model_template::current_Language() . '.conf');
         // Chargement des données Hipay en base de données
         $data = $this->setData();
         $collection = $this->about->getData();
         if ($data != null) {
             if ($data['formaction'] === 'test') {
                 $urlOrder = 'https://test-ws.hipay.com/soap/payment-v2?wsdl';
                 $urlCategory = 'https://test-payment.hipay.com/order/list-categories/id/';
             } elseif ($data['formaction'] === 'production') {
                 $urlOrder = 'https://ws.hipay.com/soap/payment-v2?wsdl';
                 $urlCategory = 'https://payment.hipay.com/order/list-categories/id/';
             }
             $getCategory = $this->getCategory(array('url' => $urlCategory . $data['websiteId'], 'debug' => false));
             $urlwebsite = magixcjquery_html_helpersHtml::getUrl() . '/' . $data['iso'] . '/';
             // seturl pour les notifications et process
             $seturl = $this->setUrl();
             if ($getCategory) {
                 // STEP 1 : soap flow options
                 $options = array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP, 'cache_wsdl' => WSDL_CACHE_NONE, 'soap_version' => SOAP_1_1, 'encoding' => 'UTF-8', 'exceptions' => true);
                 // STEP 2 : Soap client initialization
                 $client = new SoapClient($urlOrder, $options);
                 //https://test-ws.hipay.com/soap/payment-v2?wsdl
                 // L'interface de paiement sera, par défaut, en français international
                 $setlocal = $data['iso'] . '_' . strtoupper($setParams['locale']);
                 $executionDate = date('c');
                 // STEP 3 : Soap call on confirm method of manual-capture webservice
                 $result = $client->generate(array('parameters' => array('wsLogin' => $data['wsLogin'], 'wsPassword' => $data['wsPassword'], 'websiteId' => $data['websiteId'], 'categoryId' => $getCategory, 'description' => $this->template->getConfigVars('order_on') . ' ' . $collection['name'], 'freeData' => array(array('key' => 'order', 'value' => $setParams['order']), array('key' => 'shipping', 'value' => $setParams['shipping'])), 'currency' => 'EUR', 'amount' => $setParams['amount'], 'rating' => 'ALL', 'locale' => $setlocal, 'customerIpAddress' => $data['customerIpAddress'], 'manualCapture' => '0', 'executionDate' => $executionDate, 'customerEmail' => $setParams['customerEmail'], 'urlCallback' => $urlwebsite . $setParams['plugin'] . $seturl['seturlack'], 'urlAccept' => $urlwebsite . $setParams['plugin'] . $seturl['seturlok'], 'urlCancel' => $urlwebsite . $setParams['plugin'] . $seturl['seturlcancel'], 'urlDecline' => $urlwebsite . $setParams['plugin'] . $seturl['seturlexception'])));
                 //print_r($result);
                 $forms_hipay = '<a href="' . $result->{'generateResult'}->{'redirectUrl'} . '"><img src="https://www.hipaydirect.com/images/i18n/' . $data['iso'] . '/bt_payment_8.png" /></a>';
                 return $forms_hipay;
             }
         }
     } catch (SoapFault $e) {
         magixglobal_model_system::magixlog("SOAP Fault: (faultcode: {$e->faultcode}, faultstring: {$e->faultstring})", $e);
     }
 }
示例#6
0
 /**
  * Modification du setlocale suivant la langue courante pour les dates
  */
 private function setTimeLocal()
 {
     if (frontend_model_template::current_Language() == 'nl') {
         if ($this->getOS() === 'windows') {
             setlocale(LC_TIME, 'nld_nld', 'nl');
         } else {
             setlocale(LC_TIME, 'nl_NL.UTF8', 'nl');
         }
     } elseif (frontend_model_template::current_Language() == 'fr') {
         setlocale(LC_TIME, 'fr_FR.UTF8', 'fra');
     } elseif (frontend_model_template::current_Language() == 'de') {
         setlocale(LC_TIME, 'de_DE.UTF8', 'de');
     } elseif (frontend_model_template::current_Language() == 'es') {
         setlocale(LC_TIME, 'es_ES.UTF8', 'es');
     } elseif (frontend_model_template::current_Language() == 'it') {
         setlocale(LC_TIME, 'it_IT.UTF8', 'it');
     } else {
         setlocale(LC_TIME, 'en_US.UTF8', 'en');
     }
 }
示例#7
0
 /**
  * Inscription sur mailchimp
  * @param $mail
  * @param $fstname
  * @param $lstname
  * @param bool $notify
  */
 public function subscribe($mail, $fstname, $lstname, $notify = true)
 {
     if (self::install_table() == true) {
         $api = parent::getApi();
         if ($api != null) {
             $iso = frontend_model_template::current_Language();
             $list = parent::getCode($api['idapi'], $iso);
             if ($list != null) {
                 $code = $list['list_id'];
                 $MailChimp = new \Drewm\MailChimp($api['account_api']);
                 $result = $MailChimp->call('lists/subscribe', array('id' => $code, 'email' => array('email' => $mail), 'merge_vars' => array('FNAME' => $fstname, 'LNAME' => $lstname), 'double_optin' => false, 'update_existing' => true, 'replace_interests' => false, 'send_welcome' => false));
                 if ($notify) {
                     $this->getNotify('add');
                 }
             } else {
                 $this->getNotify('error');
             }
         } else {
             $this->getNotify('error');
         }
     }
 }
示例#8
0
 /**
  * Retourne un tableaux contenant les identifiant actif (int OR string)
  * @access public
  * @static
  * @return array
  */
 public static function setCurrentId()
 {
     $ModelTemplate = new frontend_model_template();
     $FilterRequest = new magixcjquery_filter_request();
     $HelperClean = new magixcjquery_form_helpersforms();
     $current = array();
     $current['news']['record']['id'] = null;
     if ($FilterRequest->isGet('getnews')) {
         $current['news']['record']['id'] = $HelperClean->inputAlphaNumeric($_GET['getnews']);
     }
     $current['news']['pagination']['id'] = 1;
     if ($FilterRequest->isGet('page')) {
         $current['news']['pagination']['id'] = $HelperClean->inputNumeric($_GET['page']);
     }
     $current['news']['tag']['id'] = null;
     if ($FilterRequest->isGet('tag')) {
         $current['news']['tag']['id'] = $HelperClean->inputClean($_GET['tag']);
     }
     $current['cms']['record']['id'] = null;
     if ($FilterRequest->isGet('getidpage')) {
         $current['cms']['record']['id'] = $HelperClean->inputNumeric($_GET['getidpage']);
     }
     $current['cms']['parent']['id'] = null;
     if ($FilterRequest->isGet('getidpage_p')) {
         $current['cms']['parent']['id'] = $HelperClean->inputNumeric($_GET['getidpage_p']);
     }
     $current['catalog']['category']['id'] = null;
     if ($FilterRequest->isGet('idclc')) {
         $current['catalog']['category']['id'] = $HelperClean->inputNumeric($_GET['idclc']);
     }
     $current['catalog']['subcategory']['id'] = null;
     if ($FilterRequest->isGet('idcls')) {
         $current['catalog']['subcategory']['id'] = $HelperClean->inputNumeric($_GET['idcls']);
     }
     $current['catalog']['product']['id'] = null;
     if ($FilterRequest->isGet('idproduct')) {
         $current['catalog']['product']['id'] = $HelperClean->inputNumeric($_GET['idproduct']);
     }
     $current['lang']['iso'] = $ModelTemplate->current_Language();
     return $current;
 }
示例#9
0
 /**
  * Fonction multiple de sélection de produit
  * @param $data
  * @return array
  */
 protected static function fetchAllProduct($data)
 {
     $iso = frontend_model_template::current_Language();
     switch ($data['sort']) {
         case 'id':
             $order_clause = 'ORDER BY p.idproduct DESC';
             break;
         case 'product':
             $order_clause = 'ORDER BY p.orderproduct ASC';
             break;
         case 'name':
             $order_clause = 'ORDER BY catalog.titlecatalog ASC';
             break;
     }
     $limit_clause = null;
     $where_clause = 'WHERE lang.iso = :iso';
     if (is_int($data['limit'])) {
         $limit_clause = 'LIMIT ' . $data['limit'];
     }
     if (is_array($data)) {
         switch ($data['context']) {
             case 'last-product-cat':
                 if ($data['selectmode']) {
                     $where_clause .= ' AND p.idclc';
                     $where_clause .= $data['selectmode'] != 'exclude' ? ' IN (' : ' NOT IN (';
                     $where_clause .= $data['selectmodeid'];
                     $where_clause .= ') ';
                 }
                 break;
             case 'last-product-subcat':
                 if ($data['selectmode']) {
                     $where_clause .= ' AND p.idcls';
                     $where_clause .= $data['selectmode'] != 'exclude' ? ' IN (' : ' NOT IN (';
                     $where_clause .= $data['selectmodeid'];
                     $where_clause .= ') ';
                 }
                 break;
             case 'product':
                 if ($data['selectmode']) {
                     $where_clause .= ' AND p.idproduct';
                     $where_clause .= $data['selectmode'] != 'exclude' ? ' IN (' : ' NOT IN (';
                     $where_clause .= $data['selectmodeid'];
                     $where_clause .= ') ';
                 }
                 break;
         }
         $select = "SELECT\r\n                p.idproduct,p.idclc, p.idcls,\r\n                catalog.urlcatalog, catalog.titlecatalog, catalog.idlang,catalog.price,catalog.desccatalog,\r\n                c.pathclibelle,\r\n                s.pathslibelle,\r\n                catalog.imgcatalog,\r\n                lang.iso\r\n            FROM mc_catalog_product AS p\r\n            LEFT JOIN mc_catalog AS catalog ON ( catalog.idcatalog = p.idcatalog )\r\n            LEFT JOIN mc_catalog_c AS c ON ( c.idclc = p.idclc )\r\n            LEFT JOIN mc_catalog_s AS s ON ( s.idcls = p.idcls )\r\n            JOIN mc_lang AS lang ON ( catalog.idlang = lang.idlang )\r\n            {$where_clause}\r\n            {$order_clause}\r\n            {$limit_clause}";
         return magixglobal_model_db::layerDB()->select($select, array(':iso' => $iso));
     }
 }
示例#10
0
/**
 * Smarty {getlang} function plugin
 *
 * Type:     function
 * Name:     getUrl
 * Date:     September 11, 2009
 * Purpose:  Récupère la langue de en cours.
 * Examples: {getlang}
 * Output:   
 * @link 
 * @author   Gerits Aurelien
 * @version  1.0
 * @param array
 * @param Smarty
 * @return string
 */
function smarty_function_getlang($params, $template)
{
    return frontend_model_template::current_Language();
}
示例#11
0
 /**
  * Retourne le nombre d'éléments dans un panier suivant clée de session
  * @access private
  * @param $session_key
  * @param $create
  */
 public function load_cart_data($session_key, $create)
 {
     $data_cart = parent::s_cart_session($session_key);
     $amount_to_pay = 0;
     if ($data_cart != null) {
         //récupération id_panier, mis à null si pas de produits lié
         $id_cart = $data_cart['id_cart'];
         $data_items_cart = parent::s_cart_items($id_cart);
         $id_cart = $data_items_cart != null ? $id_cart : 'null';
         //récupération du montant total de la commande
         $amount_to_pay = $id_cart != null ? $this->load_cart_amount($id_cart) : 0;
         $amount_to_pay = $amount_to_pay['amount_to_pay'];
         $cart_amount = $this->load_cart_amount($id_cart);
         $getConfigCart = $this->getConfigData();
         $shipping = $cart_amount['shipping_ttc'];
         if ($data_cart['country_cart'] != null) {
             $tva = $this->getItemTvaData(array('fetch' => 'one', 'context' => 'config', 'country' => $data_cart['country_cart']));
             $calculate_tva = $tva['amount_tva'];
         } else {
             $calculate_tva = $this->tva_amount;
         }
         // formate la TVA avant le calcule
         $tva_amount = floatval('1.' . sprintf("%.02d", $calculate_tva));
         $tax_amount = $cart_amount['amount_products'] - $cart_amount['amount_products'] / $tva_amount;
         //$amount_pay_with_tax = ($amount_to_pay-$shipping);//$tax_amount+$cart_amount['ammount_products'];
         $amount_pay_with_tax = $cart_amount['amount_products'];
         //Assignation des coordonnée
         if ($this->pstring1 === 'payment') {
             if ($getConfigCart['online_payment'] === '1' && $getConfigCart['ogone'] === '1') {
                 //@todo Revoir la partie ogone
                 $ogone = new plugins_ogone_public();
                 $lang = frontend_model_template::current_Language() . '_' . strtoupper(frontend_model_template::current_Language());
                 $ogoneProcess = $ogone->getData(array('plugin' => 'cartpay', 'formSubmitImageUrl' => '/plugins/ogone/img/ogone-' . frontend_model_template::current_Language() . '.png', 'transaction' => $data_cart['id_cart'], 'lastname' => $data_cart['lastname_cart'], 'firstname' => $data_cart['firstname_cart'], 'email' => $data_cart['email_cart'], 'language' => $lang, 'amount' => number_format($amount_pay_with_tax, 2, '', ''), 'COMPLUS' => 'module=cartpay&idprofil=' . $data_cart['idprofil'] . "&shipping=" . $shipping));
                 $create->assign('ogoneProcess', $ogoneProcess);
                 //"&amount_profil=".$cart_amount['amount_profil']
             }
             if ($getConfigCart['online_payment'] === '1' && $getConfigCart['hipay'] === '1') {
                 $hipay = new plugins_hipay_public();
                 $hipayProcess = $hipay->getData(array('plugin' => 'cartpay', 'key' => $session_key, 'order' => $id_cart, 'amount' => $amount_pay_with_tax, 'shipping' => $shipping, 'locale' => $tva['iso'], 'customerEmail' => $data_cart['email_cart']));
                 $create->assign('hipayProcess', $hipayProcess);
             }
         }
         $assign_exclude = array('amount_to_pay', 'id_cart', 'nbr_items_cart', 'session_key_cart');
         foreach ($data_cart as $key => $val) {
             if (!array_search($key, $assign_exclude)) {
                 $create->assign($key, $val);
             }
         }
     } else {
         $id_cart = 'null';
     }
     $create->assign('id_cart', $id_cart);
     $create->assign('amount_order', $amount_pay_with_tax);
 }
示例#12
0
 /**
  * 
  * Notification suivant la langue
  */
 public function notify_lang()
 {
     if (self::register_lang() != frontend_model_template::current_Language()) {
         switch (self::register_lang()) {
             case "fr":
                 return "test fr";
                 break;
             case "en":
                 return "test en";
                 break;
         }
     } elseif (self::register_lang() == null) {
         switch ($this->getlang) {
             case "fr":
                 return "test fr";
                 break;
             case "en":
                 return "test en";
                 break;
         }
     }
 }