Пример #1
0
/**
 * Smarty {script src="" type="javascript"} function plugin
 *
 * Type:     function
 * Name:     
 * Date:     
 * Purpose:  
 * Examples: {script}
 * Output:   
 * @link 
 * @author   Gerits Aurelien
 * @version  1.0
 * @param array
 * @param Smarty
 * @return string
 */
function smarty_function_script($params, $template)
{
    $src = $params['src'];
    $type = $params['type'];
    $load = $params['load'] ? $params['load'] : 'normal';
    if (!isset($src)) {
        trigger_error("src: missing 'src' parameter in link", E_USER_WARNING);
        return;
    }
    if (!isset($type)) {
        trigger_error("type: missing 'type' parameter in type", E_USER_WARNING);
        return;
    }
    $ini = new magixcjquery_view_helper_script();
    $concat = $params['concat'];
    if ($concat == '1') {
        $system = new magixglobal_model_system();
        if (defined('PATHADMIN')) {
            $url = $system->getUrlConcat(array('src' => $src, 'caches' => 'caching/caches', 'filesgroups' => 'min/groupsConfig.php', 'minDir' => '/' . PATHADMIN . '/min/', 'callback' => '/admin'));
        } else {
            $url = $system->getUrlConcat(array('src' => $src, 'caches' => 'var/caches', 'filesgroups' => 'min/groupsConfig.php', 'minDir' => '/min/', 'callback' => ''));
        }
    } elseif ($concat == '0') {
        $url = $src;
    } else {
        $url = $src;
    }
    $head = $ini->src($url, $type, $load);
    return $head;
}
/**
 * Smarty {widget_product_gallery} function plugin
 *
 * Type:     function
 * Name:     microgalery
 * Date:     January 11 2013
 * Update:     March 20 2014
 * Purpose:  
 * Output:
 * @author   Gerits Aurelien
 * @author   Sire Sam (sire-sam.be)
 * @link http://www.magix-cms.com
 * @version  1.0
 * @param array
 * @param Smarty
 * @return string
 *
 */
function smarty_function_widget_product_gallery($params, $template)
{
    $ModelSystem = new magixglobal_model_system();
    $ModelConstructor = new magixglobal_model_constructor();
    $ModelCatalog = new frontend_model_catalog();
    // Set and load data
    $current = $ModelSystem->setCurrentId();
    $conf = array('context' => 'product-gallery');
    $data = $ModelCatalog->getData($conf, $current);
    $html = null;
    if ($data != null) {
        $pattern['default'] = patternMicroGallery();
        $pattern['custom'] = null;
        if ($params['pattern']) {
            $pattern['custom'] = is_array($params['pattern']) ? $params['pattern'] : patternMicroGallery($params['pattern']);
        }
        $pattern['global'] = $ModelConstructor->mergeHtmlPattern($pattern['default'], $pattern['custom']);
        magixcjquery_debug_magixfire::magixFireTable('pattern', $pattern);
        magixcjquery_debug_magixfire::magixFireTable('pattern global', $pattern['global']);
        $i = 0;
        $items['html'] = null;
        foreach ($data as $row) {
            $i++;
            // *** Construit donées de l'item en array avec clée nominative unifiée ('name' => 'monname,'descr' => '<p>ma descr</p>,...)
            $item['data'] = $ModelCatalog->setItemData($row, $current);
            // Configuration de la structure HTML de l'item
            $pattern['item'] = $ModelConstructor->setItemPattern($pattern['global'], $i);
            if ($pattern['item']['img']['classLink'] != '') {
                $pattern['item']['img']['classLink'] = ' class="' . $pattern['item']['img']['classLink'] . '"';
            }
            // remise à zero du compteur si élément est le dernier de la ligne
            if ($pattern['item']['is_last'] == 1) {
                $i = 0;
            }
            $items['html'] .= $pattern['item']['item']['before'];
            $items['html'] .= '<a href="' . $item['data']['imgSrc']['medium'] . '" rel="productGallery" title="Agrandir"' . $pattern['item']['img']['classLink'] . '>';
            $items['html'] .= '<img src="' . $item['data']['imgSrc']['small'] . '" alt="Galery" />';
            $items['html'] .= '</a>';
            $items['html'] .= $pattern['item']['item']['after'];
        }
    }
    // *** ouput
    if ($items['html'] != null) {
        $html = isset($params['title']) ? $params['title'] : '';
        $html .= $pattern['global']['container']['before'];
        $html .= isset($params['htmlPrepend']) ? $params['htmlPrepend'] : null;
        $html .= $items['html'];
        $html .= isset($params['htmlAppend']) ? $params['htmlAppend'] : null;
        $html .= $pattern['global']['container']['after'];
    }
    return $html;
}
Пример #3
0
 /**
  * 
  * Enter description here ...
  * @param string $filtermod
  * @param string $levelmod
  * @param bolean $rootPath
  */
 private function setPath($filtermod, $levelmod = '', $rootPath = false)
 {
     if ($rootPath != false) {
         $rootPath = magixglobal_model_system::base_path();
     } else {
         $rootPath = '/';
     }
     if (!isset($filtermod)) {
         throw new Exception('Error filterPathImg :filtermod is not defined');
     }
     switch ($filtermod) {
         case 'catalog':
             if ($levelmod == 'category') {
                 $setPath = $rootPath . 'upload/catalogimg/category/';
             } elseif ($levelmod == 'subcategory') {
                 $setPath = $rootPath . 'upload/catalogimg/subcategory/';
             } elseif ($levelmod == 'galery') {
                 $setPath = $rootPath . 'upload/catalogimg/galery/';
             } else {
                 $setPath = $rootPath . 'upload/catalogimg/';
             }
             break;
         case 'news':
             $setPath = $rootPath . 'upload/news/';
             break;
         default:
             $setPath = $rootPath . $filtermod;
             break;
     }
     return $setPath;
 }
Пример #4
0
 /**
  * Retourne le dossier racine de l'installation de magix cms pour l'écriture du fichier XML
  * @access private
  **/
 private function dir_XML_FILE()
 {
     try {
         return magixglobal_model_system::base_path() . DIRECTORY_SEPARATOR;
     } catch (Exception $e) {
         magixglobal_model_system::magixlog('An error has occured :', $e);
     }
 }
Пример #5
0
 /**
  * Chargement du fichier de configuration suivant la langue en cours de session.
  * @access private
  * return string
  */
 private function pathConfigLoad($configfile)
 {
     try {
         return $configfile . backend_model_language::current_Language() . '.conf';
     } catch (Exception $e) {
         magixglobal_model_system::magixlog('An error has occured :', $e);
     }
 }
/**
* Smarty {widget_news_nav}
* function plugin
*
* Type:     function
* Name:     widget news nav
* Date:     September 26, 2012
* Update:   December  29, 2012
* Purpose:  
* Examples:

   {widget_news_nav}

   {widget_news_nav
       htmlAttribut=[
           'id_container' => 'secondary-nav',
           'class_container' => 'v-nav'
       ]
       title='<p class="title">Actualités par thèmes</p>'
   }

* Output: string (<ul><li><a>tag_name<///)
* @link
* @author   Gerits Aurelien
* @author   Samuel Lesre
* @version  1.1
* @param array
* @param Smarty
* @return string
*/
function smarty_function_widget_news_nav($params, $template)
{
    $ModelNews = new frontend_model_news();
    $ModelSystem = new magixglobal_model_system();
    // *** Load SQL DATA
    $current = $ModelSystem->setCurrentId();
    $conf = array('level' => 'tag', 'limit' => null);
    $data = $ModelNews->getData($conf, $current);
    $current = $current['news'];
    $output = null;
    if ($data != null) {
        // *** set default html attributs
        if ($params['htmlAttribut']) {
            $htmlAttr = $params['htmlAttribut'];
            $id_container = isset($htmlAttr['id_container']) ? ' id="' . $htmlAttr['id_container'] . '"' : null;
            $class_container = isset($htmlAttr['class_container']) ? ' class="' . $htmlAttr['class_container'] . '"' : null;
            $class_current = isset($htmlAttr['class_current']) ? $htmlAttr['class_current'] : 'current';
        }
        // *** Set translation var
        $tr_show_news = frontend_model_template::getConfigVars('show_news');
        // *** format items loop (foreach item)
        $items = null;
        foreach ($data as $row) {
            $current_item = $row['name_tag'] == $current['tag']['id'] ? $class_current : null;
            $uri_item = magixglobal_model_rewrite::filter_news_tag_url($row['iso'], urlencode($row['name_tag']), true);
            $name_item = $row['name_tag'];
            $class_item = $current_item != null ? ' class="' . $current_item . '"' : null;
            // *** item construct
            $item = '<li' . $class_item . '>';
            $item .= '<a href="' . $uri_item . '" title="' . $tr_show_news . ': ' . $name_item . '">';
            $item .= $name_item;
            $item .= '</a>';
            $item .= '</li>';
            $items .= $item;
        }
        // *** container construct
        $output = isset($params['title']) ? $params['title'] : '';
        $output .= '<ul' . $id_container . $class_container . '>';
        $output .= isset($params['prepend']) ? $params['prepend'] : null;
        $output .= $items;
        $output .= isset($params['append']) ? $params['append'] : null;
        $output .= '</ul>';
    }
    return $output;
}
/**
* 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');
    }
}
/**
 * Smarty plugin
 * @package     Smarty
 * @subpackage  plugins
 * Type:        function
 * Name:        widget_news_display
 * date:        25/12/2013
 * Update:      10/03/2013
 * Examples:    {widget_news_display}
 * @author      Sire Sam (sire-sam.be)
 * @link        htt://www.sire-sam.be, http://www.magix-dev.be
 * @author      Gerits Aurelien
 * @version     1.1
 * @param       array
 * @param       Smarty
 * @return      string
 */
function smarty_function_widget_news_data($params, $template)
{
    $ModelSystem = new magixglobal_model_system();
    $ModelRewrite = new magixglobal_model_rewrite();
    $ModelNews = new frontend_model_news();
    $ModelPager = new magixglobal_model_pager();
    // Set and load data
    $current = $ModelSystem->setCurrentId();
    $conf = is_array($params['conf']) ? $params['conf'] : array();
    $override = $params['conf']['plugins']['override'] ? $params['conf']['plugins']['override'] : '';
    $data = $ModelNews->getData($conf, $current, $override);
    $newrow = is_array($params['conf']['plugins']['item']) ? $params['conf']['plugins']['item'] : array();
    // Set Pagination
    $pagination = array();
    if (isset($data['total']) and isset($data['limit'])) {
        $pagination = $ModelPager->setPaginationData($data['total'], $data['limit'], '/' . $current['lang']['iso'] . $ModelRewrite->mod_news_lang($current['lang']['iso']), $current['news']['pagination']['id'], '/');
        unset($data['total']);
        unset($data['limit']);
    }
    $current = $current['news'];
    // Format data
    $items = array();
    if ($data != null) {
        foreach ($data as $row) {
            if (isset($row['idnews'])) {
                $items[] = $ModelNews->setItemData($row, $current, $newrow);
            } elseif (isset($row['name_tag'])) {
                $items[] = array('id' => $row['name_tag'], 'name' => $row['name_tag'], 'iso' => $row['iso'], 'url' => magixglobal_model_rewrite::filter_news_tag_url($row['iso'], urlencode($row['name_tag']), true));
            }
        }
    }
    $assign = isset($params['assign']) ? $params['assign'] : 'data';
    $template->assign($assign, $items);
    $assignPager = isset($params['assignPagination']) ? $params['assignPagination'] : 'paginationData';
    $template->assign($assignPager, $pagination);
}
Пример #9
0
/**
 * Smarty {headlink rel="" href="" optionnal(media="")} function plugin
 *
 * Type:     function
 * Name:     
 * Date:     
 * Purpose:  
 * Examples: {headlink}
 * Output:   
 * @link 
 * @author   Gerits Aurelien
 * @version  1.0
 * @param array
 * @param Smarty
 * @return string
 */
function smarty_function_headlink($params, $template)
{
    $rel = $params['rel'];
    if (!isset($rel)) {
        trigger_error("rel: missing 'rel' parameter in link");
        return;
    }
    $href = $params['href'];
    if (!isset($href)) {
        trigger_error("href: missing 'href' parameter in link");
        return;
    }
    $concat = $params['concat'];
    if ($concat == '1') {
        $system = new magixglobal_model_system();
        if (defined('PATHADMIN')) {
            $url = $system->getUrlConcat(array('href' => $href, 'caches' => 'caching/caches', 'filesgroups' => 'min/groupsConfig.php', 'minDir' => '/' . PATHADMIN . '/min/', 'callback' => '/admin'));
        } else {
            $url = $system->getUrlConcat(array('href' => $href, 'caches' => 'var/caches', 'filesgroups' => 'min/groupsConfig.php', 'minDir' => '/min/', 'callback' => ''));
        }
    } elseif ($concat == '0') {
        $url = $href;
    } else {
        $url = $href;
    }
    $ini = new magixcjquery_view_helper_headLink();
    switch ($rel) {
        case 'stylesheet':
            $head = $ini->linkStyleSheet($url, $params['media']);
            break;
        case 'rss':
            $head = $ini->linkRss($href);
            break;
    }
    return $head;
}
Пример #10
0
/**
 * Smarty {static_metas} function plugin
 *
 * Type:     function
 * Name:     static_metas
 * Date:     January, 2010
 * Purpose:  Ajoute une métas statique
 * Examples: {static_metas param=""}
 * Output:   
 * @link 
 * @author   Gerits Aurelien
 * @version  1.1
 * @param array
 * @param Smarty
 * @return string
 */
function smarty_function_static_metas($params, $template)
{
    $param = !empty($params['param']) ? $params['param'] : "";
    $dynamic = $params['dynamic'];
    if (!isset($param)) {
        trigger_error("config: missing 'param' parameter");
        return;
    }
    if ($param == null) {
        if (empty($dynamic)) {
            $seo = magixglobal_model_system::extract_domain();
        } else {
            $seo = $dynamic;
        }
    } elseif ($param != null) {
        $seo = $param;
    }
    return magixcjquery_form_helpersforms::inputClean($seo);
}
Пример #11
0
 /**
  * Parcourt le dossier des snippets HTML
  * @param $dir
  */
 private function jsSnippet($dir)
 {
     $path = magixglobal_model_system::base_path() . PATHADMIN . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR . $dir;
     $directory = new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS);
     $iterator = new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::LEAVES_ONLY);
     //extension
     $extensions = array("html");
     // delimiteur
     $delimiter = "\n";
     if (is_object($iterator)) {
         foreach ($iterator as $fileinfo) {
             // Compatibility with php < 5.3.6
             if (version_compare(phpversion(), '5.3.6', '<')) {
                 $getExtension = pathinfo($fileinfo->getFilename(), PATHINFO_EXTENSION);
             } else {
                 $getExtension = $fileinfo->getExtension();
             }
             if (in_array($getExtension, $extensions)) {
                 $pos = strpos($fileinfo->getPathname(), PATHADMIN);
                 $len = strlen($pos);
                 if (stripos($_SERVER['HTTP_USER_AGENT'], 'win')) {
                     $url = '/' . PATHADMIN . '/template/' . $dir . '/' . $fileinfo->getFilename();
                 } else {
                     $url = DIRECTORY_SEPARATOR . substr($fileinfo->getPathname(), $pos);
                 }
                 $files[] = $delimiter . '{' . 'title:"' . $fileinfo->getBasename('.' . $getExtension) . '", url:"' . $url . '"}';
             }
         }
         if (is_array($files)) {
             asort($files, SORT_REGULAR);
             $ouput = 'templates = [';
             $ouput .= implode(',', $files);
             $ouput .= $delimiter . ']';
             print $ouput;
         }
     }
 }
/**
 * Smarty plugin
 * @package     Smarty
 * @subpackage  plugins
 * Type:        function
 * Name:        widget_news_display
 * date:        25/12/2013
 * Update:      10/03/2013
 * Examples:    {widget_news_display}
 * @author      Sire Sam (sire-sam.be)
 * @link        htt://www.sire-sam.be, http://www.magix-dev.be
 * @author      Gerits Aurelien
 * @version     1.1
 * @param       array
 * @param       Smarty
 * @return      string
 */
function smarty_function_widget_news_display($params, $template)
{
    $ModelSystem = new magixglobal_model_system();
    $ModelRewrite = new magixglobal_model_rewrite();
    $ModelConstructor = new magixglobal_model_constructor();
    $ModelNews = new frontend_model_news();
    $ModelPager = new magixglobal_model_pager();
    $Debug = new magixcjquery_debug_magixfire();
    // Set and load data
    $current = $ModelSystem->setCurrentId();
    $conf = is_array($params['conf']) ? $params['conf'] : array();
    $data = $ModelNews->getData($conf, $current);
    // Set Pagination
    $pagination['html'] = null;
    if (isset($data['total']) and isset($data['limit'])) {
        $pagination['src'] = $ModelPager->setPaginationData($data['total'], $data['limit'], '/' . $current['lang']['iso'] . $ModelRewrite->mod_news_lang($current['lang']['iso']), $current['news']['pagination']['id'], '/');
        $pagination['html'] = $ModelConstructor->formatPaginationHtml($pagination['src'], $current['news']['pagination']['id']);
        unset($data['total']);
        unset($data['limit']);
    }
    $current = $current['news'];
    // Format data
    $html = null;
    if ($data != null) {
        $pattern['default'] = patternNews();
        $pattern['custom'] = null;
        if ($params['pattern']) {
            $pattern['custom'] = is_array($params['pattern']) ? $params['pattern'] : patternNews($params['pattern']);
        }
        $pattern['global'] = $ModelConstructor->mergeHtmlPattern($pattern['default'], $pattern['custom']);
        $i = 0;
        $items['html'] = null;
        foreach ($data as $row) {
            $i++;
            $itemData = $ModelNews->setItemData($row, $current);
            // *** set item html structure & var
            $pattern['global']['is_active'] = $itemData['active'] === true ? 1 : 0;
            $pattern['global']['id'] = isset($itemData['id']) ? $itemData['id'] : 0;
            $pattern['global']['url'] = isset($itemData['uri']) ? $itemData['uri'] : '#';
            $pattern['item'] = $ModelConstructor->setItemPattern($pattern['global'], $i);
            // *** Reset iteration if item is last of the line
            if ($pattern['item']['is_last'] == 1) {
                $i = 0;
            }
            // *** in case diplay is null, we take default value
            if ($pattern['item']['display'][1] == null) {
                $pattern['item']['display'][1] = $pattern['default']['display'][1];
            }
            $imgSize = isset($pattern['item']['img']['size']) ? $pattern['item']['img']['size'] : 'small';
            if (isset($itemData['imgSrc'][$imgSize])) {
                $itemData['imgSrc'] = $itemData['imgSrc'][$imgSize];
            } else {
                $itemData['imgSrc'] = $itemData['imgSrc']['default'];
            }
            // *** format item loop (foreach element)
            $itemHtml = null;
            foreach ($pattern['item']['display'][1] as $elem_type) {
                $pattern['elem'] = $pattern['item'][$elem_type];
                if (array_search($elem_type, $pattern['item']['display'][1])) {
                    switch ($elem_type) {
                        case 'name':
                            $elem = $itemData['name'];
                            break;
                        case 'img':
                            $elem = '<img src="' . $itemData['imgSrc'] . '" alt="' . $itemData['name'] . '"/>';
                            break;
                        case 'descr':
                            $elem = magixcjquery_form_helpersforms::inputCleanTruncate(magixcjquery_form_helpersforms::inputTagClean($itemData['content']), $pattern['item']['descr']['lenght'], $pattern['item']['descr']['delemiter']);
                            break;
                        case 'date':
                            $elem = $ModelConstructor->formatDateHtml($itemData['date']['publish'], $pattern['item']);
                            break;
                        case 'tag':
                            $elem = $itemData['tag'];
                            break;
                        default:
                            $elem = null;
                    }
                    if ($elem != null or isset($pattern['elem']['before']) or isset($pattern['elem']['after'])) {
                        $itemHtml .= $pattern['elem']['before'];
                        $itemHtml .= $elem;
                        $itemHtml .= $pattern['elem']['after'];
                    }
                }
            }
            // *** item construct
            $items['html'] .= $pattern['item']['item']['before'];
            $items['html'] .= $itemHtml;
            $items['html'] .= $pattern['item']['item']['after'];
        }
        // *** container construct
        $html = isset($params['title']) ? $params['title'] : '';
        $html .= $pattern['global']['container']['before'];
        $html .= isset($params['prepend']) ? $params['prepend'] : null;
        $html .= $items['html'];
        $html .= isset($params['append']) ? $params['append'] : null;
        $html .= $pattern['global']['container']['after'];
        $html .= $pagination['html'];
    }
    return $html;
}
Пример #13
0
/**
 * Smarty {widget_cms_nav} function plugin
 *
 * Type:     function
 * Name:     widget_cms_nav
 * Date:     22/09/2012
 * Update:   10/03/2012
 * Output:
 * @author   Sire Sam (http://www.sire-sam.be)
 * @author   Gerits Aurélien (http://www.magix-dev.be)
 * @version  1.1
 * @param array
 * @param Smarty
 * @return string
 */
function smarty_function_widget_cms_nav($params, $template)
{
    $ModelSystem = new magixglobal_model_system();
    $ModelConstructor = new magixglobal_model_constructor();
    $ModelCms = new frontend_model_cms();
    // Set and load data
    $current = $ModelSystem->setCurrentId();
    $conf = is_array($params['conf']) ? $params['conf'] : array('level' => 'all');
    $data = $ModelCms->getData($conf, $current);
    $current = $current['cms'];
    $i = 1;
    $items = null;
    $output = null;
    if ($data != null) {
        // *** set default html attributs
        if ($params['htmlAttribut']) {
            $htmlAttr = $params['htmlAttribut'];
            $id_container = isset($htmlAttr['id_container']) ? ' id="' . $htmlAttr['id_container'] . '"' : null;
            $class_container = isset($htmlAttr['class_container']) ? ' class="' . $htmlAttr['class_container'] . '"' : null;
            $class_active = isset($htmlAttr['class_active']) ? $htmlAttr['class_active'] : 'active';
        }
        // *** format items loop (foreach item)
        foreach ($data as $row_1) {
            $items_2 = null;
            if (isset($row_1['subdata']) and is_array($row_1['subdata'])) {
                foreach ($row_1['subdata'] as $row_2) {
                    /** HTML FORMAT (LEVEL 2)**/
                    $data_item_2 = $ModelCms->setItemData($row_2, $current);
                    if ($data_item_2['active'] === true) {
                        $current_item = ' class="' . $class_active . '"';
                    } else {
                        $current_item = null;
                    }
                    $items_2 .= '<li' . $current_item . '>';
                    $items_2 .= '<a href="' . $data_item_2['url'] . '" title="' . $data_item_2['name'] . '">';
                    $items_2 .= $data_item_2['name'];
                    $items_2 .= '</a>';
                    $items_2 .= '</li>';
                }
            }
            /** HTML FORMAT (LEVEL 1)**/
            $data_item = $ModelCms->setItemData($row_1, $current);
            if ($data_item['active'] === true) {
                $current_item = ' class="' . $class_active . '"';
            } else {
                $current_item = null;
            }
            $items .= '<li' . $current_item . '>';
            $items .= '<a href="' . $data_item['url'] . '" title="' . $data_item['name'] . '">';
            $items .= $data_item['name'];
            $items .= '</a>';
            $items .= $items_2 != null ? '<ul class="hidden-sm">' . $items_2 . '</ul>' : '';
            $items .= '</li>';
        }
        if ($items != null) {
            $output = isset($params['title']) ? $params['title'] : '';
            $output .= '<ul' . $id_container . $class_container . '>';
            $output .= isset($params['htmlPrepend']) ? $params['htmlPrepend'] : null;
            $output .= $items;
            $output .= isset($params['htmlAppend']) ? $params['htmlAppend'] : null;
            $output .= '</ul>';
        }
    }
    return $output;
}
Пример #14
0
 /**
  * @param $dir
  * @return string
  */
 private function pathCacheDir($dir)
 {
     return magixglobal_model_system::base_path() . 'var' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR;
 }
Пример #15
0
 /**
  * @access public
  * Initialise la session ou renouvelle la session
  * @param array $session
  * @param bool $debug
  */
 public function session_run($session_tabs)
 {
     try {
         $lang = new frontend_model_IniLang();
         $lang->autoLangSession();
         $this->ini_session_var($session_tabs);
     } catch (Exception $e) {
         magixglobal_model_system::magixlog('An error has occured :', $e);
     }
 }
Пример #16
0
 /**
  * Charge le theme selectionné ou le theme par défaut
  */
 public function load_theme()
 {
     $db = self::$collectionsSetting->fetch('theme');
     if ($db['setting_value'] != null) {
         if ($db['setting_value'] == 'default') {
             $theme = $db['setting_value'];
         } elseif (file_exists(magixglobal_model_system::base_path() . '/skin/' . $db['setting_value'] . '/')) {
             $theme = $db['setting_value'];
         } else {
             try {
                 $theme = 'default';
                 throw new Exception('template ' . $db['setting_value'] . ' is not found');
             } catch (Exception $e) {
                 $logger = new debug_logger(MP_LOG_DIR);
                 $logger->log('php', 'error', 'An error has occured : ' . $e->getMessage(), debug_logger::LOG_MONTH);
             }
         }
     } else {
         $theme = 'default';
     }
     return $theme;
 }
Пример #17
0
 /**
  * Retourne au format JSON les permissions de dossier
  */
 private function json_chmod()
 {
     $root = magixglobal_model_system::base_path();
     $json[] = '{"var_caching":' . json_encode($this->chmod_var($root)) . ',"config":' . json_encode($this->chmod_config($root)) . ',"caching":' . json_encode($this->chmod_caching($root)) . '}';
     print '[' . implode(',', $json) . ']';
 }
Пример #18
0
 /**
  * @access private
  * Insert une image dans les news
  * @param string $nimage
  * @param void $confimg
  * @param bool $update
  * @return string
  * @throws Exception
  */
 private function insert_image_news($nimage, $confimg, $update = false)
 {
     if (isset($nimage)) {
         try {
             $makeFiles = new magixcjquery_files_makefiles();
             $initImg = new backend_model_image();
             if ($update == true) {
                 $vimage = parent::s_n_image_news($this->edit);
                 if (file_exists(self::dir_img_news() . $vimage['n_image'])) {
                     $makeFiles->removeFile(self::dir_img_news(), $vimage['n_image']);
                     $makeFiles->removeFile(self::dir_img_news(), 's_' . $vimage['n_image']);
                 } else {
                     throw new Exception('file: ' . $vimage['n_image'] . ' is not found');
                 }
             }
             /**
              * Envoi une image dans le dossier "racine" catalogimg
              */
             $initImg->upload_img($confimg, 'upload' . DIRECTORY_SEPARATOR . 'news' . DIRECTORY_SEPARATOR, false);
             /**
              * Analyze l'extension du fichier en traitement
              * @var $fileextends
              */
             $fileextends = $initImg->image_analyze(self::dir_img_news() . $nimage);
             /**
              * 
              * Enter description here ...
              * @var unknown_type
              */
             $rimage = magixglobal_model_cryptrsa::uniq_id();
             /**
              * Initialisation de la classe phpthumb 
              * @var void
              */
             $thumb = PhpThumbFactory::create(self::dir_img_news() . $nimage);
             $imageuri = $rimage . $fileextends;
             $imgsetting = new backend_model_setting();
             $imgsizesmall = $initImg->dataImgSize('news', 'news', 'small');
             $imgsizemed = $initImg->dataImgSize('news', 'news', 'medium');
             //Redimensionnement et changement de nom suivant la catégorie
             switch ($imgsizemed['img_resizing']) {
                 case 'basic':
                     $thumb->resize($imgsizemed['width'], $imgsizemed['height'])->save(self::dir_img_news() . $imageuri);
                     break;
                 case 'adaptive':
                     $thumb->adaptiveResize($imgsizemed['width'], $imgsizemed['height'])->save(self::dir_img_news() . $imageuri);
                     break;
             }
             switch ($imgsizesmall['img_resizing']) {
                 case 'basic':
                     $thumb->resize($imgsizesmall['width'], $imgsizesmall['height'])->save(self::dir_img_news() . 's_' . $imageuri);
                     break;
                 case 'adaptive':
                     $thumb->adaptiveResize($imgsizesmall['width'], $imgsizesmall['height'])->save(self::dir_img_news() . 's_' . $imageuri);
                     break;
             }
             //Supprime le fichier original pour gagner en espace
             if (file_exists(self::dir_img_news() . $nimage)) {
                 $makeFiles->removeFile(self::dir_img_news(), $nimage);
             }
             /*else{
             			throw new Exception('file: '.$nimage.' is not found');
             		}*/
             return $imageuri;
         } catch (Exception $e) {
             magixglobal_model_system::magixlog('An error has occured :', $e);
         }
     }
 }
Пример #19
0
 private function setPath()
 {
     return magixglobal_model_system::base_path();
 }
/**
 * Smarty {widget_cms_display} function plugin
 *
 * Type:     function
 * Name:     widget_cms_display
 * Date:     29/12/2012
 * Update:   10/03/2013
 * @author   Sire Sam (http://www.sire-sam.be)
 * @author   Gerits Aurélien (http://www.magix-dev.be)
 * @version  1.0
 * @param array
 * @param Smarty
 * @return string
 */
function smarty_function_widget_cms_data($params, $template)
{
    $ModelSystem = new magixglobal_model_system();
    $ModelConstructor = new magixglobal_model_constructor();
    $ModelCms = new frontend_model_cms();
    // Set and load data
    $current = $ModelSystem->setCurrentId();
    $conf = is_array($params['conf']) ? $params['conf'] : array();
    $data = $ModelCms->getData($conf, $current);
    $current = $current['cms'];
    $htm = null;
    if ($data != null) {
        // ** Loop management var
        $deep = 1;
        $deep_minus = $deep - 1;
        $deep_plus = $deep + 1;
        $pass_trough = 0;
        $data_empty = false;
        // ** Loop format & output var
        $row = array();
        $items = array();
        $i[$deep] = 0;
        do {
            // *** loop management START
            if ($pass_trough == 0) {
                // Si je n'ai plus de données à traiter je vide ma variable
                $row[$deep] = null;
            } else {
                // Sinon j'active le traitement des données
                $pass_trough = 0;
            }
            // Si je suis au premier niveaux et que je n'ai pas de donnée à traiter
            if ($deep == 1 and $row[$deep] == null) {
                // récupération des données dans $data
                $row[$deep] = array_shift($data);
            }
            // Si ma donnée possède des sous-donnée sous-forme de tableau
            if (isset($row[$deep]['subdata'])) {
                if (is_array($row[$deep]['subdata']) and $row[$deep]['subdata'] != null) {
                    // On monte d'une profondeur
                    $deep++;
                    $deep_minus++;
                    $deep_plus++;
                    // on récupére la  première valeur des sous-données en l'éffacant du tableau d'origine
                    $row[$deep] = array_shift($row[$deep_minus]['subdata']);
                    // Désactive le traitement des données
                    $pass_trough = 1;
                }
            } elseif ($deep != 1) {
                if ($row[$deep] == null) {
                    if ($row[$deep_minus]['subdata'] == null) {
                        // Si je n'ai pas de sous-données & pas de données à traiter & pas de frères à récupérer dans mon parent
                        // ====> désactive le tableaux de sous-données du parent et retourne au niveau de mon parent
                        unset($row[$deep_minus]['subdata']);
                        unset($i[$deep]);
                        $deep--;
                        $deep_minus = $deep - 1;
                        $deep_plus = $deep + 1;
                    } else {
                        // Je récupère un frère dans mon parent
                        $row[$deep] = array_shift($row[$deep_minus]['subdata']);
                    }
                    // Désactive le traitement des données
                    $pass_trough = 1;
                }
            }
            // *** loop management END
            // *** list format START
            if ($row[$deep] != null and $pass_trough != 1) {
                $i[$deep]++;
                // Construit doonées de l'item en array avec clée nominative unifiée ('name' => 'monname,'descr' => '<p>ma descr</p>,...)
                $itemData = $ModelCms->setItemData($row[$deep], $current);
                // Récupération des sous-données (enfants)
                if (isset($items[$deep_plus]) != null) {
                    $itemData['subdata'] = $items[$deep_plus];
                    $items[$deep_plus] = null;
                } else {
                    $subitems = null;
                }
                $items[$deep][] = $itemData;
            }
            // *** list format END
            // Si $data est vide ET que je n'ai plus de données en traitement => arrête la boucle
            if (empty($data) and $row[1] == null) {
                $data_empty = true;
            }
        } while ($data_empty == false);
    }
    $assign = isset($params['assign']) ? $params['assign'] : 'data';
    $template->assign($assign, $items[$deep]);
}
Пример #21
0
 /**
  * execute ou instance la class du plugin
  * @param $module
  * @return
  * @internal param void $className
  */
 private function get_call_class($module)
 {
     try {
         $class = new $module();
         if ($class instanceof $module) {
             return $class;
         } else {
             throw new Exception('not instantiate the class: ' . $module);
         }
     } catch (Exception $e) {
         magixglobal_model_system::magixlog("Error plugins execute", $e);
     }
 }
Пример #22
0
 /**
  * @access public
  * @static
  * Affiche la page index du plugin et execute la fonction run (obligatoire)
  */
 public function display_plugins()
 {
     if ($this->getplugin()) {
         try {
             $this->load_plugin();
         } catch (Exception $e) {
             magixglobal_model_system::magixlog("Error plugins execute", $e);
         }
     }
 }
Пример #23
0
 /**
  * fusion des plugins anti flood et throttler pour un envoi de masse
  * @param void $mailer
  * @param integer $threshold
  * @param integer $sleep
  * @param string $throttlermode
  */
 public function plugins_massive_mailer($threshold = 100, $sleep = 10, $throttlermode = 'bytes')
 {
     try {
         switch ($throttlermode) {
             case "bytes":
                 $rate = 1024 * 1024 * 10;
                 $mode = Swift_Plugins_ThrottlerPlugin::BYTES_PER_MINUTE;
                 break;
             case "messages":
                 $rate = 100;
                 $mode = Swift_Plugins_ThrottlerPlugin::MESSAGES_PER_MINUTE;
                 break;
             default:
                 $rate = 100;
                 $mode = Swift_Plugins_ThrottlerPlugin::MESSAGES_PER_MINUTE;
                 break;
         }
         if (!empty($threshold) and !empty($sleep) and !empty($throttlermode)) {
             if (!is_numeric($threshold)) {
                 throw new Exception("threshold is not numeric");
             } elseif (!is_numeric($sleep)) {
                 throw new Exception("sleep is not numeric");
             } else {
                 $this->plugin_antiflood($threshold, $sleep);
                 $this->plugin_throttler($rate, $mode);
             }
         }
     } catch (Exception $e) {
         magixglobal_model_system::magixlog('An error has occured :', $e);
     }
 }
Пример #24
0
 /**
  * @access private
  * load sql file
  */
 private function load_sql_file($version)
 {
     return magixglobal_model_system::base_path() . 'install' . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR . 'update.' . $version . '.sql';
 }
/**
 * Smarty plugin
 * @package     Smarty
 * @subpackage  plugins
 * Type:        function
 * Name:        widget_catalog_display
 * Date:        27/09/2013
 * Update:      05/03/2013
 * @author      Samuel Lesire
 * @author      Gerits Aurelien
 * @link        htt://www.sire-sam.be, http://www.magix-dev.be
 * @version     1.1
 * @param       array
 * @param       Smarty
 * @return      string
 */
function smarty_function_widget_catalog_display($params, $template)
{
    $ModelSystem = new magixglobal_model_system();
    $ModelConstructor = new magixglobal_model_constructor();
    $ModelCatalog = new frontend_model_catalog();
    // Set and load data
    $current = $ModelSystem->setCurrentId();
    $conf = is_array($params['conf']) ? $params['conf'] : array();
    $data = $ModelCatalog->getData($conf, $current);
    $html = null;
    if ($data != null) {
        $pattern['default'] = patternCatalog();
        $pattern['custom'] = null;
        if ($params['pattern']) {
            $pattern['custom'] = is_array($params['pattern']) ? $params['pattern'] : patternCatalog($params['pattern']);
        }
        $pattern['global'] = $ModelConstructor->mergeHtmlPattern($pattern['default'], $pattern['custom']);
        // *** format items loop (foreach item)
        // ** Loop management var
        $deep = 1;
        $deep_minus = $deep - 1;
        $deep_plus = $deep + 1;
        $pass_trough = 0;
        $data_empty = false;
        // ** Loop format & output var
        $row = array();
        $items = array();
        $i[$deep] = 0;
        // *** boucle / loop
        do {
            // *** loop management START
            if ($pass_trough == 0) {
                // Si je n'ai plus de données à traiter je vide ma variable
                $row[$deep] = null;
            } else {
                // Sinon j'active le traitement des données
                $pass_trough = 0;
            }
            // Si je suis au premier niveaux et que je n'ai pas de donnée à traiter
            if ($deep == 1 and $row[$deep] == null) {
                // récupération des données dans $data
                $row[$deep] = array_shift($data);
            }
            // Si ma donnée possède des sous-donnée sous-forme de tableau
            if (isset($row[$deep]['subdata'])) {
                if (is_array($row[$deep]['subdata']) and $row[$deep]['subdata'] != null) {
                    // On monte d'une profondeur
                    $deep++;
                    $deep_minus++;
                    $deep_plus++;
                    // on récupére la  première valeur des sous-données en l'éffacant du tableau d'origine
                    $row[$deep] = array_shift($row[$deep_minus]['subdata']);
                    // Désactive le traitement des données
                    $pass_trough = 1;
                }
            } elseif ($deep != 1) {
                if ($row[$deep] == null) {
                    if ($row[$deep_minus]['subdata'] == null) {
                        // Si je n'ai pas de sous-données & pas de données à traiter & pas de frères à récupérer dans mon parent
                        // ====> désactive le tableaux de sous-données du parent et retourne au niveau de mon parent
                        unset($row[$deep_minus]['subdata']);
                        unset($i[$deep]);
                        $items[$deep] = $pattern['item']['container']['before'] . $items[$deep] . $pattern['item']['container']['after'];
                        $deep--;
                        $deep_minus = $deep - 1;
                        $deep_plus = $deep + 1;
                    } else {
                        // Je récupère un frère dans mon parent
                        $row[$deep] = array_shift($row[$deep_minus]['subdata']);
                    }
                    // Désactive le traitement des données
                    $pass_trough = 1;
                }
            }
            // *** loop management END
            // *** list format START
            if ($row[$deep] != null and $pass_trough != 1) {
                $i[$deep]++;
                // Construit doonées de l'item en array avec clée nominative unifiée ('name' => 'monname,'descr' => '<p>ma descr</p>,...)
                $itemData = $ModelCatalog->setItemData($row[$deep], $current['catalog']);
                // Configuration de la structure HTML de l'item
                $pattern['global']['is_current'] = $itemData['active'];
                $pattern['global']['id'] = isset($itemData['id']) ? $itemData['id'] : 0;
                $pattern['global']['url'] = isset($itemData['url']) ? $itemData['url'] : '#';
                $pattern['item'] = $ModelConstructor->setItemPattern($pattern['global'], $i[$deep], $deep);
                // Récupération de la taille de l'image
                if (isset($pattern['global']['img']['size_' . $deep])) {
                    $row[$deep]['img_size'] = $pattern['global']['img']['size_' . $deep];
                } elseif (isset($pattern['global']['img']['size'])) {
                    $row[$deep]['img_size'] = $pattern['global']['img']['size'];
                } else {
                    $row[$deep]['img_size'] = 'medium';
                }
                $imgSize = isset($pattern['item']['img']['size']) ? $pattern['item']['img']['size'] : 'small';
                if (isset($itemData['imgSrc'][$imgSize])) {
                    $itemData['imgSrc'] = $itemData['imgSrc'][$imgSize];
                } else {
                    $itemData['imgSrc'] = $itemData['imgSrc']['default'];
                }
                // remise à zero du compteur si élément est le dernier de la ligne
                if ($pattern['item']['is_last'] == 1) {
                    $i[$deep] = 0;
                }
                // Récupération de l'affichage pour le niveau
                $pattern['item']['display'] = is_array($pattern['global']['display'][$deep]) ? $pattern['global']['display'][$deep] : $pattern['global']['display'][1];
                if ($pattern['item']['display'] == null) {
                    $pattern['item']['display'] = $pattern['default']['display'][1];
                }
                // Récupération des sous-données (enfants)
                if (isset($items[$deep_plus]) != null) {
                    $subitems = $items[$deep_plus];
                    $items[$deep_plus] = null;
                } else {
                    $subitems = null;
                }
                $item = null;
                foreach ($pattern['item']['display'] as $elem_type) {
                    // BOUCLE de formatage des éléments contenus dans item
                    $pattern['elem'] = $pattern['item'][$elem_type];
                    if (array_search($elem_type, $pattern['item']['display'])) {
                        // Config class link
                        $item_classLink = null;
                        if (isset($pattern['elem']['classLink'])) {
                            $item_classLink = ' class="' . $pattern['elem']['classLink'] . '"';
                            $item_classLink = $pattern['elem']['classLink'] == 'none' ? 'none' : $item_classLink;
                        }
                        // Format element on switch
                        switch ($elem_type) {
                            case 'name':
                                $elem = $item_classLink != 'none' ? '<a' . $item_classLink . ' href="' . $itemData['url'] . '" title="' . $itemData['name'] . '">' : '';
                                $elem .= $itemData['name'];
                                $elem .= $item_classLink != 'none' ? '</a>' : '';
                                break;
                            case 'img':
                                $elem = $item_classLink != 'none' ? '<a' . $item_classLink . ' href="' . $itemData['url'] . '" title="' . $itemData['name'] . '">' : '';
                                $elem .= '<img src="' . $itemData['imgSrc'] . '" alt="' . $itemData['name'] . '"/>';
                                $elem .= $item_classLink != 'none' ? '</a>' : '';
                                break;
                            case 'descr':
                                $elem = magixcjquery_form_helpersforms::inputCleanTruncate(magixcjquery_form_helpersforms::inputTagClean($itemData['content']), $pattern['item']['descr']['lenght'], $pattern['item']['descr']['delemiter']);
                                break;
                            case 'price':
                                if (is_numeric($itemData['price'])) {
                                    $elem = $itemData['price'] . $pattern['item']['price']['currency'];
                                } else {
                                    $elem = null;
                                }
                                break;
                            default:
                                $elem = null;
                        }
                        if ($elem != null) {
                            $item .= $pattern['elem']['before'];
                            $item .= $elem;
                            $item .= $pattern['elem']['after'];
                        }
                    }
                }
                $items[$deep] .= $pattern['item']['item']['before'];
                $items[$deep] .= $item;
                $items[$deep] .= $subitems;
                $items[$deep] .= $pattern['item']['item']['after'];
            }
            // *** list format END
            // Si $data est vide => arrête la boucle
            if (empty($data) and $row[1] == null) {
                $data_empty = true;
            }
        } while ($data_empty == false);
        // *** container construct
        if ($items[1] != null) {
            $html = isset($params['title']) ? $params['title'] : '';
            $html .= $pattern['global']['container']['before'];
            $html .= isset($params['prepend']) ? $params['prepend'] : null;
            $html .= $items[1];
            $html .= isset($params['append']) ? $params['append'] : null;
            $html .= $pattern['global']['container']['after'];
        } else {
            $html = null;
        }
    }
    return $html;
}
Пример #26
0
 /**
  * Scanne les plugins et vérifie si la fonction d'execution exist afin de l'intégrer dans le module
  * @access private
  * @param string $methodName
  * @return array|null
  */
 public function menu_item_plugin($methodName)
 {
     try {
         plugins_Autoloader::register();
         // Si le dossier est accessible en lecture
         if (!is_readable($this->directory_plugins())) {
             throw new exception('Error in load plugin: Plugin is not minimal permission');
         }
         $makefiles = new magixcjquery_files_makefiles();
         $dir = $makefiles->scanRecursiveDir($this->directory_plugins());
         if ($dir != null) {
             $data = '';
             $arrData = '';
             foreach ($dir as $d) {
                 if (file_exists($this->directory_plugins() . $d . DIRECTORY_SEPARATOR . 'admin.php')) {
                     $pluginPath = $this->directory_plugins() . $d;
                     if ($makefiles->scanDir($pluginPath) != null) {
                         if (class_exists('plugins_' . $d . '_admin')) {
                             if (method_exists('plugins_' . $d . '_admin', $methodName)) {
                                 if (method_exists('plugins_' . $d . '_admin', 'setConfig')) {
                                     $class_name = $this->execute_plugins('plugins_' . $d . '_admin');
                                     $setConfig = $class_name->setConfig();
                                     if (array_key_exists('url', $setConfig)) {
                                         if (isset($setConfig['url']['name'])) {
                                             $data['name'] = $setConfig['url']['name'];
                                         } else {
                                             $data['name'] = $d;
                                         }
                                     }
                                     $data['url'] = $d;
                                 } else {
                                     $data['url'] = $d;
                                     $data['name'] = null;
                                 }
                                 $arrData[] = $data;
                             }
                         }
                     }
                 }
             }
             if (is_array($arrData)) {
                 $arr_item = $arrData;
             } else {
                 $arr_item = null;
             }
             return $arr_item;
         }
     } catch (Exception $e) {
         magixglobal_model_system::magixlog('An error has occured :', $e);
     }
 }
Пример #27
0
 /**
  * Charge le theme selectionné ou le theme par défaut
  */
 public function load_theme()
 {
     $db = parent::s_setting_id('theme');
     if ($db['setting_value'] != null) {
         if ($db['setting_value'] == 'default') {
             $theme = $db['setting_value'];
         } elseif (file_exists(magixglobal_model_system::base_path() . '/skin/' . $db['setting_value'] . '/')) {
             $theme = $db['setting_value'];
         } else {
             try {
                 $theme = 'default';
                 throw new Exception('template ' . $db['setting_value'] . ' is not found');
             } catch (Exception $e) {
                 magixglobal_model_system::magixlog('An error has occured :', $e);
             }
         }
     } else {
         $theme = 'default';
     }
     return $theme;
 }
Пример #28
0
 /**
  * Scanne les plugins et vérifie si la fonction createSitemap 
  * exist afin de l'intégrer dans le sitemap
  * @access private
  */
 private function writeplugin($idlang)
 {
     try {
         plugins_Autoloader::register();
         // Si le dossier est accessible en lecture
         if (!is_readable($this->directory_plugins())) {
             throw new exception('Error in writeplugin: Plugin is not minimal permission');
         }
         $makefiles = new magixcjquery_files_makefiles();
         $dir = $makefiles->scanRecursiveDir($this->directory_plugins());
         if ($dir != null) {
             foreach ($dir as $d) {
                 if (file_exists($this->directory_plugins() . $d . DIRECTORY_SEPARATOR . 'admin.php')) {
                     $pluginPath = $this->directory_plugins() . $d;
                     if ($makefiles->scanDir($pluginPath) != null) {
                         if (class_exists('plugins_' . $d . '_admin')) {
                             $this->loadConfigPlugins('plugins_' . $d . '_admin', $idlang);
                         }
                     }
                 }
             }
         }
     } catch (Exception $e) {
         magixglobal_model_system::magixlog('An error has occured :', $e);
     }
 }
Пример #29
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);
     }
 }
/**
 * Smarty {notify_dir_header} function plugin
 *
 * Type:     function
 * Name:     notify
 * Date:     May 17 2010
 * Update    September 09 2010
 * Purpose:  
 * Examples: {notify_dir_header}
 * Output:   HTML
 * @link 
 * @author   Gerits Aurelien
 * @version  1.1
 * @param params
 * @param Smarty
 * @return string
 */
function smarty_function_notify_dir_header($params, $template)
{
    $pathdir = dirname(realpath(__FILE__));
    $arraydir = array('app\\extends\\core', 'app/extends/core');
    if (file_exists(magixglobal_model_system::root_path($arraydir, array("install", "install"), $pathdir))) {
        $dom = '<div id="notify-install">
				<a href="#" class="close-notify ui-state-default ui-corner-all">Close</a>
				<a class="dont-notify ui-state-default ui-corner-all">Don\'t Show Again</a>	
				<div id="message-notification">
					<div class="mc-rep-request">
						<span class="notify-32-icon notify-32-icon-folder-delete" style="float:left;"></span><div style="padding-top:10px;">Please delete the &laquo;install&raquo; folder after installation</div>
					</div>
				</div>
		</div>';
    } elseif (!is_writable(magixglobal_model_system::root_path($arraydir, array("upload", "upload"), $pathdir))) {
        $dom = '<div id="notify-folder">
				<a href="#" class="close-notify ui-state-default ui-corner-all">Close</a>
				<a class="dont-notify ui-state-default ui-corner-all">Don\'t Show Again</a>	
				<div id="message-notification">
					<div class="mc-rep-request">
						<span class="notify-32-icon notify-32-icon-folder-conflict" style="float:left;"></span><div style="padding-top:10px;">You don\'t have permission to write in &laquo;upload&raquo; folder</div>
					</div>
				</div>
		</div>';
    } elseif (!is_writable(magixglobal_model_system::root_path($arraydir, array("var", "var"), $pathdir))) {
        $dom = '<div id="notify-folder">
				<a href="#" class="close-notify ui-state-default ui-corner-all">Close</a>
				<a class="dont-notify ui-state-default ui-corner-all">Don\'t Show Again</a>	
				<div id="message-notification">
					<div class="mc-rep-request">
						<span class="notify-32-icon notify-32-icon-folder-conflict" style="float:left;"></span><div style="padding-top:10px;">You don\'t have permission to write in &laquo;upload&raquo; folder</div>
					</div>
				</div>
		</div>';
    } elseif (!is_writable(magixglobal_model_system::root_path($arraydir, array("media", "media"), $pathdir))) {
        $dom = '<div id="notify-folder">
				<a href="#" class="close-notify ui-state-default ui-corner-all">Close</a>
				<a class="dont-notify ui-state-default ui-corner-all">Don\'t Show Again</a>	
				<div id="message-notification">
					<div class="mc-rep-request">
						<span class="notify-32-icon notify-32-icon-folder-conflict" style="float:left;"></span><div style="padding-top:10px;">You don\'t have permission to write in &laquo;upload&raquo; folder</div>
					</div>
				</div>
		</div>';
    } else {
        $dom = '';
    }
    return $dom;
}