Skip to content

Commit

Permalink
Pre-Release of Verion 1.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
BadPixxel committed Feb 5, 2018
1 parent 8a401fc commit 47558aa
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 13 deletions.
62 changes: 50 additions & 12 deletions modules/splashsync/splashsync.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct()
// Init Module Main Information Fields
$this->name = 'splashsync';
$this->tab = 'administration';
$this->version = '1.0.6';
$this->version = '1.0.8';
$this->author = 'SplashSync';
$this->need_instance = 0;
$this->ps_versions_compliancy = array('min' => '1.5', 'max' => '1.7');
Expand Down Expand Up @@ -271,6 +271,7 @@ public function displayForm()
// Load current value
$helper->fields_value['SPLASH_WS_ID'] = Configuration::get('SPLASH_WS_ID');
$helper->fields_value['SPLASH_WS_KEY'] = Configuration::get('SPLASH_WS_KEY');
$helper->fields_value['SPLASH_WS_METHOD'] = Configuration::get('SPLASH_WS_METHOD');
$helper->fields_value['SPLASH_WS_EXPERT'] = Configuration::get('SPLASH_WS_EXPERT');
$helper->fields_value['SPLASH_WS_HOST'] = Configuration::get('SPLASH_WS_HOST');
$helper->fields_value['SPLASH_LANG_ID'] = Configuration::get('SPLASH_LANG_ID');
Expand Down Expand Up @@ -305,12 +306,14 @@ public function getMainFormArray()
'size' => 60,
'required' => true
);

//====================================================================//
// Expert Mode
$Fields[] = array(
'type' => 'checkbox',
'name' => 'SPLASH_WS',
'label' => $this->l('Enable Expert Mode'),
'hint' => $this->l('Enable this option only if requested by Splash Team.'),
'values' => array(
'query' => array(
array(
Expand All @@ -325,6 +328,31 @@ public function getMainFormArray()
);

if ( Configuration::get('SPLASH_WS_EXPERT') ) {


//====================================================================//
// Webservice SOAP Protocol
$Fields[] = array(
'label' => $this->l('Webservice'),
'hint' => $this->l('Webservice libary used for communication.'),
'type' => 'select',
'name' => 'SPLASH_WS_METHOD',
'options' => array(
'query' => array(
array(
'id' => 'SOAP',
'name' => "Generic PHP SOAP",
),
array(
'id' => 'NuSOAP',
'name' => "NuSOAP Library",
),
),
'id' => 'id',
'name' => 'name'
)
);

//====================================================================//
// Server Host Url
$Fields[] = array(
Expand Down Expand Up @@ -417,12 +445,6 @@ public function setMainFormValues()

if (Tools::isSubmit('submit'.$this->name))
{
//====================================================================//
// Verify Server Host Url
$host = Tools::getValue('SPLASH_WS_HOST');
if ( !empty($host) && !Validate::isUrlOrEmpty($host) ) {
$output .= $this->displayError( $this->l('Invalid Server Url!') );
}

//====================================================================//
// Verify USER ID
Expand Down Expand Up @@ -451,20 +473,36 @@ public function setMainFormValues()
if ( empty($UserId) || !Validate::isInt($UserId) ) {
$output .= $this->displayError( $this->l('Invalid User') );
}

//====================================================================//
// Verify Expert Mode
$expert = Tools::getValue('SPLASH_WS_EXPERT');
if ( !$expert ) {
$host = "";
if ( !$expert || !Configuration::get('SPLASH_WS_EXPERT') ) {
$WsHost = "https://www.splashsync.com/ws/soap";
$WsMethod = "SOAP";
} else {
$WsHost = Tools::getValue('SPLASH_WS_HOST');
$WsMethod = Tools::getValue('SPLASH_WS_METHOD');
}


//====================================================================//
// Verify Server Host Url
if ( empty($WsHost) || !Validate::isUrlOrEmpty($WsHost) ) {
$output .= $this->displayError( $this->l('Invalid Server Url!') );
}

//====================================================================//
// Verify WS Method
if ( empty($WsMethod) || !Validate::isString($WsMethod) || !in_array($WsMethod, [ "NuSOAP", "SOAP"]) ) {
$output .= $this->displayError( $this->l('Invalid WebService Protocol') );
}

if ( $output == null )
{
Configuration::updateValue('SPLASH_WS_EXPERT', trim($expert));
Configuration::updateValue('SPLASH_WS_HOST', trim($host));
Configuration::updateValue('SPLASH_WS_HOST', trim($WsHost));
Configuration::updateValue('SPLASH_WS_ID', trim($ServerId));
Configuration::updateValue('SPLASH_WS_METHOD', trim($WsMethod));
Configuration::updateValue('SPLASH_WS_KEY', trim($UserKey));
Configuration::updateValue('SPLASH_LANG_ID', trim($LangId));
Configuration::updateValue('SPLASH_USER_ID', trim($UserId));
Expand Down
8 changes: 7 additions & 1 deletion modules/splashsync/src/Local.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,15 @@ public static function Parameters()
// Server Identification Parameters
$Parameters["WsIdentifier"] = Configuration::get('SPLASH_WS_ID');
$Parameters["WsEncryptionKey"] = Configuration::get('SPLASH_WS_KEY');

//====================================================================//
// If Expert Mode => Allow Overide of Communication Protocol
if ( (Configuration::get('SPLASH_WS_EXPERT')) && !empty(Configuration::get('SPLASH_WS_METHOD')) ) {
$Parameters["WsMethod"] = Configuration::get('SPLASH_WS_METHOD');
}

//====================================================================//
// If Debug Mode => Allow Overide of Server Host Address
// If Expert Mode => Allow Overide of Server Host Address
if ( (Configuration::get('SPLASH_WS_EXPERT')) && !empty(Configuration::get('SPLASH_WS_HOST')) ) {
$Parameters["WsHost"] = Configuration::get('SPLASH_WS_HOST');
}
Expand Down

0 comments on commit 47558aa

Please sign in to comment.