Skip to content

Commit

Permalink
update to upstream 4.5.5: update translations, update xmlrpc.inc and …
Browse files Browse the repository at this point in the history
…wrapper.php, supports for tags and subscription debugging
  • Loading branch information
Server committed Mar 16, 2022
1 parent 6521c31 commit 8d192fa
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 23 deletions.
24 changes: 18 additions & 6 deletions includes/api/class-api-v3-client.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ private function request( $method, $resource, array $data = array() ) {
$data= (object) array('interests'=> $interests);
break;
case '/lists/1/members':
$ip = !empty($data['ip_signup']) ? $data['ip_signup'] : false;
switch ($method) {
case 'GET':
$result=service_user_load($emailtocheck);
Expand All @@ -210,6 +211,7 @@ private function request( $method, $resource, array $data = array() ) {
throw new NL4WP_API_Resource_Not_Found_Exception( "Utente non trovato", "404", $response, $data ); // da mettere a posto
break;
case 'PUT':
$this->get_log()->debug( sprintf( "PUT %s %s", $emailtocheck, print_r($data, true) ) );
$data_to = array('mail' => $data['email_address']);

foreach($data['merge_fields'] as $key=>$value)
Expand All @@ -232,15 +234,22 @@ private function request( $method, $resource, array $data = array() ) {
foreach ($data['interests'] as $key => $value)
{
if ($value)
$data_to['audiences']=$key.','.$data_to['audiences'];
$data_to['audiences']=$key.(!empty($data_to['audiences']) ? ','.$data_to['audiences'] : '');
}
if (!empty($data['tags'])) foreach ($data['tags'] as $value)
{
if ($value)
$data_to['audiences']=$value.(!empty($data_to['audiences']) ? ','.$data_to['audiences'] : '');
}

$data_to['privacy']=1; // forzatura Privacy
// $this->get_log()->info( sprintf( "UTENTE VOX: %s", print_r($data_to,true) ) );
if ($data['status']=='pending') //GESTIONE DOUBLE OPTIN!!
$result=service_user_subscribe($data_to);
else
if ($data['status']=='pending') { //GESTIONE DOUBLE OPTIN!!
$this->get_log()->debug( sprintf( "CALL service_user_subscribe %s %s", print_r($data_to, true), $ip ) );
$result=service_user_subscribe($data_to, $ip);
} else {
$this->get_log()->debug( sprintf( "CALL service_user_create %s %s", print_r($data_to, true) ) );
$result=service_user_create($data_to);
}

if (!$result)
{
Expand All @@ -253,6 +262,7 @@ private function request( $method, $resource, array $data = array() ) {
$data_to['-audiences']=$key.','.$data_to['-audiences'];
}

$this->get_log()->debug( sprintf( "CALL service_user_update %s %s", $data_to["mail"], print_r($data_to, true) ) );
$result=service_user_update($data_to["mail"],$data_to);
if (!$result) throw new NL4WP_API_Exception( service_errormessage(), service_errorcode(), $response, $data ); // verificare
}
Expand All @@ -261,9 +271,11 @@ private function request( $method, $resource, array $data = array() ) {
$data['id']=$result;
break;
case 'PATCH':
$this->get_log()->debug( sprintf( "PATCH %s %s", $emailtocheck, print_r($data, true) ) );
if ($data['status']=='unsubscribed') //al momento viene usato solo per la disicrizione
{
$result = service_user_unsubscribe($emailtocheck);
$this->get_log()->debug( sprintf( "CALL service_user_unsubscribe %s %s", $emailtocheck, $ip ) );
$result = service_user_unsubscribe($emailtocheck, $ip);
$data['id']=$result;
if (!$result) throw new NL4WP_API_Exception( service_errormessage(), service_errorcode(), $response, $data );
}
Expand Down
28 changes: 19 additions & 9 deletions includes/api/wrapper.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
// API Wrapper v1.27(20220315)
// API Wrapper v1.28(20220316)
//
// Compatible with PHP4+ with HASH Cryptography extension (PHP >5.1.2)
// or the MHASH Cryptography extension.
Expand Down Expand Up @@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.

if (!class_exists('xmlrpc_client'))
if (!class_exists('xmlrpc_client') && !function_exists('xmlrpc_encode_request'))
@include_once('xmlrpc.inc');

// Settings
Expand Down Expand Up @@ -79,7 +79,7 @@


function service_version() {
return 1027;
return 1028;
}

function service_init($hostoruniquekey, $api_key = false, $secret = false) {
Expand Down Expand Up @@ -253,6 +253,17 @@ function service_last_method_args() {

}

if (!function_exists('_service_realip')) {
function _service_realip($ip) {
if (empty($ip) && isset($_SERVER) && isset($_SERVER['REMOTE_ADDR'])) $ip = $_SERVER['REMOTE_ADDR'];
$fip = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE);
if (empty($fip) && isset($_SERVER) && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $fip = trim(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])[0]);
$fip = filter_var($fip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE);
if (empty($fip)) $fip = $ip;
return $fip;
}
}

if (!isset($GLOBALS['service_wrapper_uaprefix']))
$GLOBALS['service_wrapper_uaprefix'] = "service-wrapper/".service_version()." ";
function service_info() {
Expand Down Expand Up @@ -316,22 +327,22 @@ function service_user_login($uid_mail, $pass, $fields = array ()) {
}

function service_user_subscribe($data, $ip = false) {
if (empty($ip) && isset($_SERVER) && isset($_SERVER['REMOTE_ADDR'])) $ip = $_SERVER['REMOTE_ADDR'];
$ip = _service_realip($ip);
return service_invoke('service.user.subscribe', $data, $ip);
}

function service_user_unsubscribe($uid_mail, $ip = false) {
if (empty($ip) && isset($_SERVER) && isset($_SERVER['REMOTE_ADDR'])) $ip = $_SERVER['REMOTE_ADDR'];
$ip = _service_realip($ip);
return service_invoke('service.user.unsubscribe', $uid_mail, $ip);
}

function service_user_disable_mail($uid_mail, $type = 'admin', $ip = false) {
if (empty($ip) && isset($_SERVER) && isset($_SERVER['REMOTE_ADDR'])) $ip = $_SERVER['REMOTE_ADDR'];
$ip = _service_realip($ip);
return service_invoke('service.user.disable_mail', $uid_mail, $type, $ip);
}

function service_user_enable_mail($uid_mail, $ip = false) {
if (empty($ip) && isset($_SERVER) && isset($_SERVER['REMOTE_ADDR'])) $ip = $_SERVER['REMOTE_ADDR'];
$ip = _service_realip($ip);
return service_invoke('service.user.enable_mail', $uid_mail, $ip);
}

Expand Down Expand Up @@ -374,5 +385,4 @@ function service_audience_create($data) {
function service_audience_delete($aid) {
return service_invoke('service.audience.delete', $aid);
}



17 changes: 9 additions & 8 deletions includes/api/xmlrpc.inc
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
$GLOBALS['xmlrpc_internalencoding']='ISO-8859-1';

$GLOBALS['xmlrpcName']='XML-RPC for PHP';
$GLOBALS['xmlrpcVersion']='3.1.1';
$GLOBALS['xmlrpcVersion']='3.1.2';

// let user errors start at 800
$GLOBALS['xmlrpcerruser']=800;
Expand Down Expand Up @@ -2165,7 +2165,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha
}
}

/**
/**
* @deprecated
*/
function xmlrpcmsg($meth, $pars=0)
Expand Down Expand Up @@ -2968,7 +2968,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha
}

// poor man's version of print_r ???
// DEPRECATED!
/// @deprecated
function dump($ar)
{
foreach($ar as $key => $val)
Expand Down Expand Up @@ -3128,7 +3128,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha
//}
}

// DEPRECATED
/// @deprecated
function serializeval($o)
{
// add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...
Expand Down Expand Up @@ -3177,19 +3177,20 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha
* Return next member element for xmlrpcvals of type struct.
* @return xmlrpcval
* @access public
* @deprecated this will be removed in future versions
*/
function structeach()
{
return each($this->me['struct']);
return @each($this->me['struct']);
}

// DEPRECATED! this code looks like it is very fragile and has not been fixed
// this code looks like it is very fragile and has not been fixed
// for a long long time. Shall we remove it for 2.0?
/// @deprecated
function getval()
{
// UNSTABLE
$b = reset($this->me);
$a = key($this->me);
// contributed by I Sofer, 2001-03-24
// add support for nested arrays to scalarval
// i've created a new method here, so as to
Expand Down Expand Up @@ -3913,4 +3914,4 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha
}
}

?>
?>
Binary file modified languages/newsletter-for-wp-it_IT.mo
Binary file not shown.
49 changes: 49 additions & 0 deletions languages/newsletter-for-wp-it_IT.po
Original file line number Diff line number Diff line change
Expand Up @@ -1677,3 +1677,52 @@ msgstr "Link alla pagina dell'informativa privacy"

msgid "Agree to terms"
msgstr "Informativa privacy"

#: includes/forms/class-google-recaptcha.php:158
msgid "Enable Google reCaptcha"
msgstr "Abilita Google reCaptcha"

#: includes/forms/class-google-recaptcha.php:164
msgid "Select \"yes\" to enable Google reCAPTCHA spam protection for this form."
msgstr "Seleziona \"si\" per abilitare la protezione Google reCAPTCHA per questo modulo."

#: includes/forms/class-google-recaptcha.php:170
msgid "Google reCAPTCHA Site Key"
msgstr "Site Key di Google reCAPTCHA"

#: includes/forms/class-google-recaptcha.php:174
msgid "Enter your Google reCAPTCHA keys here. You can <a href=\"%s\">retrieve your keys in the Google reCAPTCHA admin console</a> or read our help article on <a href=\"%s\">how to configure Google reCAPTCHA</a>."
msgstr "Inserisci le chiavi Google reCAPTCHA qui. Puoi <a href=\"%s\">recuperare le tue chiavi nella admin console di Google reCAPTCHA</a>."

#: includes/forms/class-google-recaptcha.php:180
msgid "Google reCAPTCHA Secret Key"
msgstr "Secret Key di Google reCPATCHA"

#: includes/integrations/views/integrations.php:30
msgid "Active"
msgstr "Attivo"

#: includes/integrations/views/integrations.php:32
msgid "Inactive"
msgstr "Inattivo"

#: includes/integrations/views/integrations.php:34
msgid "Not installed"
msgstr "Non installato"

#: includes/forms/views/tabs/form-settings.php:90
msgid "Subscriber tags"
msgstr "Gruppi iscritti"

#: includes/forms/views/tabs/form-settings.php:92
msgid "Example: My tag, another tag"
msgstr "Esempio: identificativogruppo1, identificativogruppo2"

#: includes/forms/views/tabs/form-settings.php:94
msgid "The listed tags will be applied to all new subscribers added by this form."
msgstr "I gruppi indicati verranno aggiunti a tutti i nuovi iscritti aggiunti con questo modulo."

#: includes/forms/views/tabs/form-settings.php:95
msgid "Separate multiple values with a comma."
msgstr "Separa valori multipli con una virgola."

0 comments on commit 8d192fa

Please sign in to comment.