Exemplo n.º 1
0
 /**
  * send an XML stream using sendrating.cgi and method POST and returns the answer of the script as a string
  *
  * @param XMLElement $xml
  * @return string
  */
 public function sendSendrating(SceauControl &$xml)
 {
     $this->addCrypt($xml);
     SceauLogger::insertLogSceau(__METHOD__, $xml->saveXML());
     $data = array('SiteID' => $this->getSiteId(), 'XMLInfo' => $xml->saveXML(), 'CheckSum' => md5($xml->saveXML()));
     $con = new SceauSocket($this->getUrlsendrating(), 'POST', $data);
     $res = $con->send();
     return $res;
 }
 /**
  * switch the status to $mode if available, to 'test' otherwise
  *
  * @version 3.1
  * @param bool $mode
  * @return bool vrai si la mise à jour est ok, faux sinon
  */
 public function switchMode($mode)
 {
     if (!$this->statusIsAvailable($mode)) {
         SceauLogger::insertLogSceau(__FILE__, "Le mode '{$mode}' n'est pas reconnu. 'test' défini à la place.");
         $mode = 'test';
     }
     //switch the status to $mode
     $this->setStatus($mode);
     //reload URLs
     $this->loadURLs();
 }
Exemplo n.º 3
0
 /**
  * save all admin settings on database
  *
  * @return boolean 
  */
 protected function processForm()
 {
     if (!$this->formIsValid()) {
         return false;
     }
     //update configuration
     Configuration::updateValue('FIANETSCEAU_LOGIN', Tools::getValue('fianetsceau_login'));
     Configuration::updateValue('FIANETSCEAU_PASSWORD', Tools::getValue('fianetsceau_password'));
     Configuration::updateValue('FIANETSCEAU_SITEID', Tools::getValue('fianetsceau_siteid'));
     Configuration::updateValue('FIANETSCEAU_AUTHKEY', Tools::getValue('fianetsceau_authkey'));
     Configuration::updateValue('FIANETSCEAU_STATUS', Tools::getValue('fianetsceau_status'));
     Configuration::updateValue('FIANETSCEAU_LOGO_POSITION', Tools::getValue('fianetsceau_logo_position'));
     Configuration::updateValue('FIANETSCEAU_LOGO_SIZE', Tools::getValue('fianetsceau_logo_sizes'));
     Configuration::updateValue('FIANETSCEAU_WIDGET_POSITION', Tools::getValue('fianetsceau_widget_position'));
     Configuration::updateValue('FIANETSCEAU_WIDGET_NUMBER', Tools::getValue('fianetsceau_widget_number'));
     Configuration::updateValue('FIANETSCEAU_SHOW_STATUS_ORDER', (int) Tools::getValue('fianetsceau_showstatus') == 1 ? '1' : '0');
     /** update payment means settings * */
     //list of payment means of the shop
     $payment_modules = $this->loadPaymentMethods();
     foreach (array_keys($payment_modules) as $id) {
         Configuration::updateValue('FIANETSCEAU_' . $id . '_PAYMENT_TYPE', Tools::getValue('fianetsceau_' . $id . '_payment_type'));
     }
     SceauLogger::insertLogSceau(__METHOD__ . " : " . __LINE__, "Configuration module mise à jour");
     return true;
 }
Exemplo n.º 4
0
/**
 * insère une erreur en haut du fichier de log, en le créant s'il n'existe pas déjà
 *
 * @param string $func nom de la fonction reportant le bug
 * @param string $msg description de l'erreur
 */
function insertLogSceau($func, $msg)
{
    SceauLogger::insertLogSceau($func, $msg);
}
Exemplo n.º 5
0
 /**
  * Check Sceau module version and reinstall it if version is too old
  * 
  */
 public function checkSceauUpdate()
 {
     if (_PS_VERSION_ >= '1.5') {
         //check if kwixo is enabled on PS 1.5
         $sceau_is_enabled = Module::isEnabled('fianetsceau');
     } else {
         //check if kwixo is enabled on PS 1.4
         $sceau_is_enabled = $this->checkModuleisEnabled('fianetsceau');
     }
     if (Module::isInstalled('fianetsceau') && $sceau_is_enabled) {
         $sceau_version = $this->getSceauModuleVersion();
         if (!$sceau_version || $sceau_version < $this->version) {
             SceauLogger::insertLogSceau(__METHOD__ . " : " . __LINE__, 'Sceau module version < ' . $this->version);
             if ($this->uninstall()) {
                 SceauLogger::insertLogSceau(__METHOD__ . " : " . __LINE__, 'Sceau module uninstalled');
             }
             if ($this->install()) {
                 SceauLogger::insertLogSceau(__METHOD__ . " : " . __LINE__, 'Sceau module installed');
             }
         }
     }
 }