Пример #1
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);
     }
 }
Пример #2
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);
     }
 }
Пример #3
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);
     }
 }
Пример #4
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);
     }
 }
Пример #5
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);
         }
     }
 }
Пример #6
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);
     }
 }
Пример #7
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);
     }
 }
Пример #8
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;
 }
Пример #9
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);
         }
     }
 }
Пример #10
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);
     }
 }
Пример #11
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);
     }
 }
Пример #12
0
 /**
  * Retourne l'extension du fichier image
  * @param $filename
  * @return size
  */
 public static function image_analyze($filename)
 {
     try {
         $size = getimagesize($filename);
         switch ($size['mime']) {
             case "image/gif":
                 $imgtype = '.gif';
                 break;
             case "image/jpeg":
                 $imgtype = '.jpg';
                 break;
             case "image/png":
                 $imgtype = '.png';
                 break;
             case false:
                 break;
         }
         return $imgtype;
     } catch (Exception $e) {
         magixglobal_model_system::magixlog('An error has occured :', $e);
     }
 }
Пример #13
0
 /**
  * Insertion d'une image dans la galerie spécifique à un produit
  * @param $img
  * @param $imgcatalog
  * @param bool $debug
  * @return string
  * @throws Exception
  */
 private function insert_image_galery($img, $imgcatalog, $debug = false)
 {
     if (isset($this->{$img})) {
         try {
             //Supprime le fichier original pour gagner en espace
             $makeFiles = new magixcjquery_files_makefiles();
             // Charge la classe de traitement des images
             $initImg = new backend_model_image();
             /**
              * Envoi une image dans le dossier "racine" catalogimg
              */
             $initImg->upload_img('imgcatalog', 'upload' . DIRECTORY_SEPARATOR . 'catalogimg' . DIRECTORY_SEPARATOR . 'galery' . DIRECTORY_SEPARATOR, $debug);
             /**
              * Analyze l'extension du fichier en traitement
              * @var $fileextends
              */
             $fileextends = $initImg->image_analyze(self::dirImgProductGalery() . $this->{$img});
             if ($initImg->imgSizeMin(self::dirImgProductGalery() . $this->{$img}, 25, 25)) {
                 // Charge la classe pour renommer le fichier
                 $makeFiles = new magixcjquery_files_makefiles();
                 /*
                  * Renomme le fichier
                  */
                 $makeFiles->renameFiles(self::dirImgProductGalery(), self::dirImgProductGalery() . $this->{$img}, self::dirImgProductGalery() . $imgcatalog . $fileextends);
                 /**
                  * Initialisation de la classe phpthumb
                  * @var void
                  */
                 $thumb = PhpThumbFactory::create(self::dirImgProductGalery() . $imgcatalog . $fileextends);
                 //Charge la taille des images des galeries du catalogue
                 $firebug = new magixcjquery_debug_magixfire();
                 /**
                  * Création des images et miniatures utile.
                  * 2 tailles !!!
                  */
                 $imgsizelarge = $initImg->dataImgSize('catalog', 'galery', 'large');
                 $imgsizesmall = $initImg->dataImgSize('catalog', 'galery', 'small');
                 if ($debug) {
                     $firebug->magixFireGroup('Setting image');
                 }
                 switch ($imgsizelarge['img_resizing']) {
                     case 'basic':
                         if ($debug) {
                             $firebug->magixFireGroup($imgsizelarge['config_size_attr'] . ' => ' . $imgsizelarge['type']);
                             $firebug->magixFireLog($imgsizelarge['img_resizing'], 'Type');
                             $firebug->magixFireLog($imgsizelarge['width'], 'Width');
                             $firebug->magixFireLog($imgsizelarge['height'], 'Height');
                             $firebug->magixFireGroupEnd();
                         }
                         $thumb->resize($imgsizelarge['width'], $imgsizelarge['height'])->save(self::dirImgProductGalery() . 'maxi' . DIRECTORY_SEPARATOR . $imgcatalog . $fileextends);
                         break;
                     case 'adaptive':
                         if ($debug) {
                             $firebug->magixFireGroup($imgsizelarge['config_size_attr'] . ' => ' . $imgsizelarge['type']);
                             $firebug->magixFireLog($imgsizelarge['img_resizing'], 'Type');
                             $firebug->magixFireLog($imgsizelarge['width'], 'Width');
                             $firebug->magixFireLog($imgsizelarge['height'], 'Height');
                             $firebug->magixFireGroupEnd();
                         }
                         $thumb->adaptiveResize($imgsizelarge['width'], $imgsizelarge['height'])->save(self::dirImgProductGalery() . 'maxi' . DIRECTORY_SEPARATOR . $imgcatalog . $fileextends);
                         break;
                 }
                 switch ($imgsizesmall['img_resizing']) {
                     case 'basic':
                         if ($debug) {
                             $firebug->magixFireGroup($imgsizesmall['config_size_attr'] . ' => ' . $imgsizesmall['type']);
                             $firebug->magixFireLog($imgsizesmall['img_resizing'], 'Type');
                             $firebug->magixFireLog($imgsizesmall['width'], 'Width');
                             $firebug->magixFireLog($imgsizesmall['height'], 'Height');
                             $firebug->magixFireGroupEnd();
                         }
                         $thumb->resize($imgsizesmall['width'], $imgsizesmall['height'])->save(self::dirImgProductGalery() . 'mini' . DIRECTORY_SEPARATOR . $imgcatalog . $fileextends);
                         break;
                     case 'adaptive':
                         if ($debug) {
                             $firebug->magixFireGroup($imgsizesmall['config_size_attr'] . ' => ' . $imgsizesmall['type']);
                             $firebug->magixFireLog($imgsizesmall['img_resizing'], 'Type');
                             $firebug->magixFireLog($imgsizesmall['width'], 'Width');
                             $firebug->magixFireLog($imgsizesmall['height'], 'Height');
                             $firebug->magixFireGroupEnd();
                         }
                         $thumb->adaptiveResize($imgsizesmall['width'], $imgsizesmall['height'])->save(self::dirImgProductGalery() . 'mini' . DIRECTORY_SEPARATOR . $imgcatalog . $fileextends);
                         break;
                 }
                 if ($debug) {
                     $firebug->magixFireGroupEnd();
                 }
                 if (file_exists(self::dirImgProductGalery() . $imgcatalog . $fileextends)) {
                     $makeFiles->removeFile(self::dirImgProductGalery(), $imgcatalog . $fileextends);
                 }
                 return $imgcatalog . $fileextends;
             } else {
                 if (file_exists(self::dirImgProductGalery() . $this->{$img})) {
                     $makeFiles->removeFile(self::dirImgProductGalery(), $this->{$img});
                 } else {
                     throw new Exception('file: ' . $this->{$img} . ' is not found');
                 }
             }
         } catch (Exception $e) {
             magixglobal_model_system::magixlog('An error has occured :', $e);
         }
     }
 }
Пример #14
0
 /**
  * Lit le fichier version.xml local et retourne la phase en court (alpha,beta,RC,Stable)
  */
 private function read_local_phase()
 {
     try {
         $xml = new SimpleXMLElement(self::load_local_file(), 0, TRUE);
         $v = $xml->phase;
     } catch (Exception $e) {
         magixglobal_model_system::magixlog('An error has occured :', $e);
     }
     return $v;
 }
Пример #15
0
 /**
  * @access private
  * Charge le theme selectionné ou le theme par défaut
  */
 private function load_theme()
 {
     // Charge le théme courant dans la base de donnée
     $db = parent::s_current_theme();
     if ($db['setting_value'] != null) {
         if ($db['setting_value'] == 'default') {
             if (file_exists(magixglobal_model_system::base_path() . '/skin/default/')) {
                 $theme = 'default';
             }
         } 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 {
         if (file_exists(magixglobal_model_system::base_path() . '/skin/default/')) {
             $theme = 'default';
         }
     }
     return $theme;
 }