This commit is contained in:
@@ -1,274 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
** PHP implementation of the RSA Data Security, Inc. MD5 Message
|
||||
** Digest Algorithm, as defined in RFC 1321.
|
||||
*
|
||||
** Version 1.1
|
||||
** Copyright 2004 Marcus Campbell
|
||||
** http://www.tecknik.net/md5/
|
||||
*
|
||||
** This code is available under the GNU Lesser General Public License:
|
||||
** http://www.gnu.org/licenses/lgpl.txt
|
||||
*
|
||||
** Based on the JavaScript implementation by Paul Johnston
|
||||
** http://pajhome.org.uk/
|
||||
*/
|
||||
Class HashMD5 {
|
||||
var $a;
|
||||
var $b;
|
||||
var $c;
|
||||
var $d;
|
||||
|
||||
var $Save_a;
|
||||
var $Save_b;
|
||||
var $Save_c;
|
||||
var $Save_d;
|
||||
|
||||
function HashMD5() {
|
||||
/*
|
||||
$a = 1732584190;
|
||||
$b = -271733879;
|
||||
$c = -1732584194;
|
||||
$d = 271733878; */
|
||||
$this->a = -279229019;
|
||||
$this->b = -1875190530;
|
||||
$this->c = 1737040641;
|
||||
$this->d = 315143286;
|
||||
|
||||
$this->Save_a = $this->a;
|
||||
$this->Save_b = $this->b;
|
||||
$this->Save_c = $this->c;
|
||||
$this->Save_d = $this->d;
|
||||
}
|
||||
|
||||
function FlushKey($k0, $k1, $k2, $k3) {
|
||||
$this->a = $k0;
|
||||
$this->b = $k1;
|
||||
$this->c = $k2;
|
||||
$this->d = $k3;
|
||||
|
||||
$this->Save_a = $this->a;
|
||||
$this->Save_b = $this->b;
|
||||
$this->Save_c = $this->c;
|
||||
$this->Save_d = $this->d;
|
||||
}
|
||||
|
||||
function Init() {
|
||||
$this->a = $this->Save_a;
|
||||
$this->b = $this->Save_b;
|
||||
$this->c = $this->Save_c;
|
||||
$this->d = $this->Save_d;
|
||||
}
|
||||
|
||||
function rhex($num) {
|
||||
$hex_chr = "0123456789abcdef";
|
||||
$str = "";
|
||||
for($j = 0; $j <= 3; $j++)
|
||||
$str .= substr($hex_chr, ($num >> ($j * 8 + 4)) & 0x0F, 1) . substr($hex_chr, ($num >> ($j * 8)) & 0x0F, 1);
|
||||
return $str;
|
||||
}
|
||||
|
||||
function str2blks_MD5($str) {
|
||||
$nblk = ((strlen($str) + 8) >> 6) + 1;
|
||||
for($i = 0; $i < $nblk * 16; $i++) $blks[$i] = 0;
|
||||
for($i = 0; $i < strlen($str); $i++)
|
||||
$blks[$i >> 2] |= ord(substr($str, $i, 1)) << (($i % 4) * 8);
|
||||
$blks[$i >> 2] |= 0x80 << (($i % 4) * 8);
|
||||
$blks[$nblk * 16 - 2] = strlen($str) * 8;
|
||||
return $blks;
|
||||
}
|
||||
|
||||
function add($x, $y) {
|
||||
$lsw = ($x & 0xFFFF) + ($y & 0xFFFF);
|
||||
$msw = ($x >> 16) + ($y >> 16) + ($lsw >> 16);
|
||||
return ($msw << 16) | ($lsw & 0xFFFF);
|
||||
}
|
||||
|
||||
function rol($num, $cnt) {
|
||||
return ($num << $cnt) | $this->zeroFill($num, 32 - $cnt);
|
||||
}
|
||||
|
||||
function zeroFill($a, $b) {
|
||||
$bin = decbin($a);
|
||||
if (strlen($bin) < $b) $bin = 0;
|
||||
else $bin = substr($bin, 0, strlen($bin) - $b);
|
||||
for ($i=0; $i < $b; $i++) {
|
||||
$bin = "0".$bin;
|
||||
}
|
||||
return bindec($bin);
|
||||
}
|
||||
|
||||
function cmn($q, $a, $b, $x, $s, $t) {
|
||||
return $this->add($this->rol($this->add($this->add($a, $q), $this->add($x, $t)), $s), $b);
|
||||
}
|
||||
|
||||
function ff($a, $b, $c, $d, $x, $s, $t) {
|
||||
return $this->cmn(($b & $c) | ((~$b) & $d), $a, $b, $x, $s, $t);
|
||||
}
|
||||
|
||||
function gg($a, $b, $c, $d, $x, $s, $t) {
|
||||
return $this->cmn(($b & $d) | ($c & (~$d)), $a, $b, $x, $s, $t);
|
||||
}
|
||||
|
||||
function hh($a, $b, $c, $d, $x, $s, $t) {
|
||||
return $this->cmn($b ^ $c ^ $d, $a, $b, $x, $s, $t);
|
||||
}
|
||||
|
||||
function ii($a, $b, $c, $d, $x, $s, $t) {
|
||||
return $this->cmn($c ^ ($b | (~$d)), $a, $b, $x, $s, $t);
|
||||
}
|
||||
|
||||
function hash($str) {
|
||||
$x = $this->str2blks_MD5($str);
|
||||
|
||||
$this->Init();
|
||||
|
||||
for($i = 0; $i < sizeof($x); $i += 16) {
|
||||
$olda = $this->a;
|
||||
$oldb = $this->b;
|
||||
$oldc = $this->c;
|
||||
$oldd = $this->d;
|
||||
|
||||
$this->a = $this->ff($this->a, $this->b, $this->c, $this->d, $x[$i+ 0], 7 , -680876936);
|
||||
$this->d = $this->ff($this->d, $this->a, $this->b, $this->c, $x[$i+ 1], 12, -389564586);
|
||||
$this->c = $this->ff($this->c, $this->d, $this->a, $this->b, $x[$i+ 2], 17, 606105819);
|
||||
$this->b = $this->ff($this->b, $this->c, $this->d, $this->a, $x[$i+ 3], 22, -1044525330);
|
||||
$this->a = $this->ff($this->a, $this->b, $this->c, $this->d, $x[$i+ 4], 7 , -176418897);
|
||||
$this->d = $this->ff($this->d, $this->a, $this->b, $this->c, $x[$i+ 5], 12, 1200080426);
|
||||
$this->c = $this->ff($this->c, $this->d, $this->a, $this->b, $x[$i+ 6], 17, -1473231341);
|
||||
$this->b = $this->ff($this->b, $this->c, $this->d, $this->a, $x[$i+ 7], 22, -45705983);
|
||||
$this->a = $this->ff($this->a, $this->b, $this->c, $this->d, $x[$i+ 8], 7 , 1770035416);
|
||||
$this->d = $this->ff($this->d, $this->a, $this->b, $this->c, $x[$i+ 9], 12, -1958414417);
|
||||
$this->c = $this->ff($this->c, $this->d, $this->a, $this->b, $x[$i+10], 17, -42063);
|
||||
$this->b = $this->ff($this->b, $this->c, $this->d, $this->a, $x[$i+11], 22, -1990404162);
|
||||
$this->a = $this->ff($this->a, $this->b, $this->c, $this->d, $x[$i+12], 7 , 1804603682);
|
||||
$this->d = $this->ff($this->d, $this->a, $this->b, $this->c, $x[$i+13], 12, -40341101);
|
||||
$this->c = $this->ff($this->c, $this->d, $this->a, $this->b, $x[$i+14], 17, -1502002290);
|
||||
$this->b = $this->ff($this->b, $this->c, $this->d, $this->a, $x[$i+15], 22, 1236535329);
|
||||
|
||||
$this->a = $this->gg($this->a, $this->b, $this->c, $this->d, $x[$i+ 1], 5 , -165796510);
|
||||
$this->d = $this->gg($this->d, $this->a, $this->b, $this->c, $x[$i+ 6], 9 , -1069501632);
|
||||
$this->c = $this->gg($this->c, $this->d, $this->a, $this->b, $x[$i+11], 14, 643717713);
|
||||
$this->b = $this->gg($this->b, $this->c, $this->d, $this->a, $x[$i+ 0], 20, -373897302);
|
||||
$this->a = $this->gg($this->a, $this->b, $this->c, $this->d, $x[$i+ 5], 5 , -701558691);
|
||||
$this->d = $this->gg($this->d, $this->a, $this->b, $this->c, $x[$i+10], 9 , 38016083);
|
||||
$this->c = $this->gg($this->c, $this->d, $this->a, $this->b, $x[$i+15], 14, -660478335);
|
||||
$this->b = $this->gg($this->b, $this->c, $this->d, $this->a, $x[$i+ 4], 20, -405537848);
|
||||
$this->a = $this->gg($this->a, $this->b, $this->c, $this->d, $x[$i+ 9], 5 , 568446438);
|
||||
$this->d = $this->gg($this->d, $this->a, $this->b, $this->c, $x[$i+14], 9 , -1019803690);
|
||||
$this->c = $this->gg($this->c, $this->d, $this->a, $this->b, $x[$i+ 3], 14, -187363961);
|
||||
$this->b = $this->gg($this->b, $this->c, $this->d, $this->a, $x[$i+ 8], 20, 1163531501);
|
||||
$this->a = $this->gg($this->a, $this->b, $this->c, $this->d, $x[$i+13], 5 , -1444681467);
|
||||
$this->d = $this->gg($this->d, $this->a, $this->b, $this->c, $x[$i+ 2], 9 , -51403784);
|
||||
$this->c = $this->gg($this->c, $this->d, $this->a, $this->b, $x[$i+ 7], 14, 1735328473);
|
||||
$this->b = $this->gg($this->b, $this->c, $this->d, $this->a, $x[$i+12], 20, -1926607734);
|
||||
|
||||
$this->a = $this->hh($this->a, $this->b, $this->c, $this->d, $x[$i+ 5], 4 , -378558);
|
||||
$this->d = $this->hh($this->d, $this->a, $this->b, $this->c, $x[$i+ 8], 11, -2022574463);
|
||||
$this->c = $this->hh($this->c, $this->d, $this->a, $this->b, $x[$i+11], 16, 1839030562);
|
||||
$this->b = $this->hh($this->b, $this->c, $this->d, $this->a, $x[$i+14], 23, -35309556);
|
||||
$this->a = $this->hh($this->a, $this->b, $this->c, $this->d, $x[$i+ 1], 4 , -1530992060);
|
||||
$this->d = $this->hh($this->d, $this->a, $this->b, $this->c, $x[$i+ 4], 11, 1272893353);
|
||||
$this->c = $this->hh($this->c, $this->d, $this->a, $this->b, $x[$i+ 7], 16, -155497632);
|
||||
$this->b = $this->hh($this->b, $this->c, $this->d, $this->a, $x[$i+10], 23, -1094730640);
|
||||
$this->a = $this->hh($this->a, $this->b, $this->c, $this->d, $x[$i+13], 4 , 681279174);
|
||||
$this->d = $this->hh($this->d, $this->a, $this->b, $this->c, $x[$i+ 0], 11, -358537222);
|
||||
$this->c = $this->hh($this->c, $this->d, $this->a, $this->b, $x[$i+ 3], 16, -722521979);
|
||||
$this->b = $this->hh($this->b, $this->c, $this->d, $this->a, $x[$i+ 6], 23, 76029189);
|
||||
$this->a = $this->hh($this->a, $this->b, $this->c, $this->d, $x[$i+ 9], 4 , -640364487);
|
||||
$this->d = $this->hh($this->d, $this->a, $this->b, $this->c, $x[$i+12], 11, -421815835);
|
||||
$this->c = $this->hh($this->c, $this->d, $this->a, $this->b, $x[$i+15], 16, 530742520);
|
||||
$this->b = $this->hh($this->b, $this->c, $this->d, $this->a, $x[$i+ 2], 23, -995338651);
|
||||
|
||||
$this->a = $this->ii($this->a, $this->b, $this->c, $this->d, $x[$i+ 0], 6 , -198630844);
|
||||
$this->d = $this->ii($this->d, $this->a, $this->b, $this->c, $x[$i+ 7], 10, 1126891415);
|
||||
$this->c = $this->ii($this->c, $this->d, $this->a, $this->b, $x[$i+14], 15, -1416354905);
|
||||
$this->b = $this->ii($this->b, $this->c, $this->d, $this->a, $x[$i+ 5], 21, -57434055);
|
||||
$this->a = $this->ii($this->a, $this->b, $this->c, $this->d, $x[$i+12], 6 , 1700485571);
|
||||
$this->d = $this->ii($this->d, $this->a, $this->b, $this->c, $x[$i+ 3], 10, -1894986606);
|
||||
$this->c = $this->ii($this->c, $this->d, $this->a, $this->b, $x[$i+10], 15, -1051523);
|
||||
$this->b = $this->ii($this->b, $this->c, $this->d, $this->a, $x[$i+ 1], 21, -2054922799);
|
||||
$this->a = $this->ii($this->a, $this->b, $this->c, $this->d, $x[$i+ 8], 6 , 1873313359);
|
||||
$this->d = $this->ii($this->d, $this->a, $this->b, $this->c, $x[$i+15], 10, -30611744);
|
||||
$this->c = $this->ii($this->c, $this->d, $this->a, $this->b, $x[$i+ 6], 15, -1560198380);
|
||||
$this->b = $this->ii($this->b, $this->c, $this->d, $this->a, $x[$i+13], 21, 1309151649);
|
||||
$this->a = $this->ii($this->a, $this->b, $this->c, $this->d, $x[$i+ 4], 6 , -145523070);
|
||||
$this->d = $this->ii($this->d, $this->a, $this->b, $this->c, $x[$i+11], 10, -1120210379);
|
||||
$this->c = $this->ii($this->c, $this->d, $this->a, $this->b, $x[$i+ 2], 15, 718787259);
|
||||
$this->b = $this->ii($this->b, $this->c, $this->d, $this->a, $x[$i+ 9], 21, -343485551);
|
||||
|
||||
$this->a = $this->add($this->a, $olda);
|
||||
$this->b = $this->add($this->b, $oldb);
|
||||
$this->c = $this->add($this->c, $oldc);
|
||||
$this->d = $this->add($this->d, $oldd);
|
||||
}
|
||||
return $this->rhex($this->a) . $this->rhex($this->b) . $this->rhex($this->c) . $this->rhex($this->d);
|
||||
}
|
||||
}
|
||||
Class EncodingKey {
|
||||
var $clMD5;
|
||||
|
||||
function EncodingKey() {
|
||||
$this->clMD5 = new HashMD5();
|
||||
}
|
||||
|
||||
function giveHashCode($pkey, $second, $email, $refid, $montant, $nom) {
|
||||
|
||||
$modulo = $second % 4;
|
||||
|
||||
switch($modulo) {
|
||||
case 0:
|
||||
$select = $montant;
|
||||
break;
|
||||
case 1:
|
||||
$select = $email;
|
||||
break;
|
||||
case 2:
|
||||
$select = $refid;
|
||||
break;
|
||||
case 3:
|
||||
$select = $nom;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return $this->clMD5->hash($pkey.$refid.$select);
|
||||
|
||||
}
|
||||
|
||||
function giveHashCode2($pkey, $second, $email, $refid, $montant, $nom) {
|
||||
$modulo = $second % 4;
|
||||
|
||||
$montant = sprintf("%01.2f",$montant);
|
||||
|
||||
switch($modulo) {
|
||||
case 0:
|
||||
$select = $montant;
|
||||
break;
|
||||
case 1:
|
||||
$select = $email;
|
||||
break;
|
||||
case 2:
|
||||
$select = $refid;
|
||||
break;
|
||||
case 3:
|
||||
$select = $nom;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/*
|
||||
$fp = fopen('/var/www/fianet/test_greg.txt','ab');
|
||||
fwrite($fp,"second=".$second."\n");
|
||||
fwrite($fp,"montant=".$montant."\n");
|
||||
fwrite($fp,"email=".$email."\n");
|
||||
fwrite($fp,"refid=".$refid."\n");
|
||||
fwrite($fp,"nom=".$nom."\n");
|
||||
fclose($fp);
|
||||
*/
|
||||
|
||||
return $this->clMD5->hash($pkey.$refid.$montant.$email.$select);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,279 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
** PHP implementation of the RSA Data Security, Inc. MD5 Message
|
||||
** Digest Algorithm, as defined in RFC 1321.
|
||||
*
|
||||
** Version 1.1
|
||||
** Copyright 2004 Marcus Campbell
|
||||
** http://www.tecknik.net/md5/
|
||||
*
|
||||
** This code is available under the GNU Lesser General Public License:
|
||||
** http://www.gnu.org/licenses/lgpl.txt
|
||||
*
|
||||
** Based on the JavaScript implementation by Paul Johnston
|
||||
** http://pajhome.org.uk/
|
||||
*
|
||||
** Modified by PJ ALBERT
|
||||
** for 64bit system
|
||||
*/
|
||||
Class HashMD5 {
|
||||
var $a;
|
||||
var $b;
|
||||
var $c;
|
||||
var $d;
|
||||
|
||||
var $Save_a;
|
||||
var $Save_b;
|
||||
var $Save_c;
|
||||
var $Save_d;
|
||||
|
||||
function HashMD5() {
|
||||
/*
|
||||
$a = 1732584190;
|
||||
$b = -271733879;
|
||||
$c = -1732584194;
|
||||
$d = 271733878; */
|
||||
$this->a = -279229019;
|
||||
$this->b = -1875190530;
|
||||
$this->c = 1737040641;
|
||||
$this->d = 315143286;
|
||||
|
||||
$this->Save_a = $this->a;
|
||||
$this->Save_b = $this->b;
|
||||
$this->Save_c = $this->c;
|
||||
$this->Save_d = $this->d;
|
||||
}
|
||||
|
||||
function FlushKey($k0, $k1, $k2, $k3) {
|
||||
$this->a = $k0;
|
||||
$this->b = $k1;
|
||||
$this->c = $k2;
|
||||
$this->d = $k3;
|
||||
|
||||
$this->Save_a = $this->a;
|
||||
$this->Save_b = $this->b;
|
||||
$this->Save_c = $this->c;
|
||||
$this->Save_d = $this->d;
|
||||
}
|
||||
|
||||
function Init() {
|
||||
$this->a = $this->Save_a;
|
||||
$this->b = $this->Save_b;
|
||||
$this->c = $this->Save_c;
|
||||
$this->d = $this->Save_d;
|
||||
}
|
||||
|
||||
function rhex($num) {
|
||||
$hex_chr = "0123456789abcdef";
|
||||
$str = "";
|
||||
for($j = 0; $j <= 3; $j++)
|
||||
$str .= substr($hex_chr, ($num >> ($j * 8 + 4)) & 0x0F, 1) . substr($hex_chr, ($num >> ($j * 8)) & 0x0F, 1);
|
||||
return $str;
|
||||
}
|
||||
|
||||
function str2blks_MD5($str) {
|
||||
$nblk = ((strlen($str) + 8) >> 6) + 1;
|
||||
for($i = 0; $i < $nblk * 16; $i++) $blks[$i] = 0;
|
||||
for($i = 0; $i < strlen($str); $i++)
|
||||
$blks[$i >> 2] |= ord(substr($str, $i, 1)) << (($i % 4) * 8);
|
||||
$blks[$i >> 2] |= 0x80 << (($i % 4) * 8);
|
||||
$blks[$nblk * 16 - 2] = strlen($str) * 8;
|
||||
return $blks;
|
||||
}
|
||||
|
||||
function parse_unsigned_int($s) {
|
||||
$x = (float)$s;
|
||||
if($x > (float)2147483647)
|
||||
$x -= (float)"4294967296";
|
||||
if($x < (float)-2147483648)
|
||||
$x += (float)"4294967296";
|
||||
return (int)$x;
|
||||
}
|
||||
|
||||
function add($x, $y) {
|
||||
$lsw = ($x & 0xFFFF) + ($y & 0xFFFF);
|
||||
$msw = ($x >> 16) + ($y >> 16) + ($lsw >> 16);
|
||||
return $this->parse_unsigned_int(($msw << 16) | ($lsw & 0xFFFF));
|
||||
}
|
||||
|
||||
function rol($num, $cnt) {
|
||||
$num = $num & 0xFFFFFFFF;
|
||||
return $this->parse_unsigned_int(($num << $cnt) & 0xFFFFFFFF | $this->zeroFill($num, 32 - $cnt));
|
||||
}
|
||||
|
||||
function zeroFill($a, $b) {
|
||||
$bin = decbin($a);
|
||||
if (strlen($bin) < $b) $bin = 0;
|
||||
else $bin = substr($bin, 0, strlen($bin) - $b);
|
||||
for ($i=0; $i < $b; $i++) {
|
||||
$bin = "0".$bin;
|
||||
}
|
||||
return bindec($bin);
|
||||
}
|
||||
|
||||
function cmn($q, $a, $b, $x, $s, $t) {
|
||||
return $this->add($this->rol($this->add($this->add($a, $q), $this->add($x, $t)), $s), $b);
|
||||
}
|
||||
|
||||
function ff($a, $b, $c, $d, $x, $s, $t) {
|
||||
return $this->cmn(($b & $c) | ((~$b) & $d), $a, $b, $x, $s, $t);
|
||||
}
|
||||
|
||||
function gg($a, $b, $c, $d, $x, $s, $t) {
|
||||
return $this->cmn(($b & $d) | ($c & (~$d)), $a, $b, $x, $s, $t);
|
||||
}
|
||||
|
||||
function hh($a, $b, $c, $d, $x, $s, $t) {
|
||||
return $this->cmn($b ^ $c ^ $d, $a, $b, $x, $s, $t);
|
||||
}
|
||||
|
||||
function ii($a, $b, $c, $d, $x, $s, $t) {
|
||||
return $this->cmn($c ^ ($b | (~$d)), $a, $b, $x, $s, $t);
|
||||
}
|
||||
|
||||
function hash($str) {
|
||||
|
||||
$x = $this->str2blks_MD5($str);
|
||||
$this->Init();
|
||||
|
||||
for($i = 0; $i < sizeof($x); $i += 16) {
|
||||
$olda = $this->a;
|
||||
$oldb = $this->b;
|
||||
$oldc = $this->c;
|
||||
$oldd = $this->d;
|
||||
|
||||
$this->a = $this->ff($this->a, $this->b, $this->c, $this->d, $x[$i+ 0], 7 , -680876936);
|
||||
$this->d = $this->ff($this->d, $this->a, $this->b, $this->c, $x[$i+ 1], 12, -389564586);
|
||||
$this->c = $this->ff($this->c, $this->d, $this->a, $this->b, $x[$i+ 2], 17, 606105819);
|
||||
$this->b = $this->ff($this->b, $this->c, $this->d, $this->a, $x[$i+ 3], 22, -1044525330);
|
||||
$this->a = $this->ff($this->a, $this->b, $this->c, $this->d, $x[$i+ 4], 7 , -176418897);
|
||||
$this->d = $this->ff($this->d, $this->a, $this->b, $this->c, $x[$i+ 5], 12, 1200080426);
|
||||
$this->c = $this->ff($this->c, $this->d, $this->a, $this->b, $x[$i+ 6], 17, -1473231341);
|
||||
$this->b = $this->ff($this->b, $this->c, $this->d, $this->a, $x[$i+ 7], 22, -45705983);
|
||||
$this->a = $this->ff($this->a, $this->b, $this->c, $this->d, $x[$i+ 8], 7 , 1770035416);
|
||||
$this->d = $this->ff($this->d, $this->a, $this->b, $this->c, $x[$i+ 9], 12, -1958414417);
|
||||
$this->c = $this->ff($this->c, $this->d, $this->a, $this->b, $x[$i+10], 17, -42063);
|
||||
$this->b = $this->ff($this->b, $this->c, $this->d, $this->a, $x[$i+11], 22, -1990404162);
|
||||
$this->a = $this->ff($this->a, $this->b, $this->c, $this->d, $x[$i+12], 7 , 1804603682);
|
||||
$this->d = $this->ff($this->d, $this->a, $this->b, $this->c, $x[$i+13], 12, -40341101);
|
||||
$this->c = $this->ff($this->c, $this->d, $this->a, $this->b, $x[$i+14], 17, -1502002290);
|
||||
$this->b = $this->ff($this->b, $this->c, $this->d, $this->a, $x[$i+15], 22, 1236535329);
|
||||
|
||||
$this->a = $this->gg($this->a, $this->b, $this->c, $this->d, $x[$i+ 1], 5 , -165796510);
|
||||
$this->d = $this->gg($this->d, $this->a, $this->b, $this->c, $x[$i+ 6], 9 , -1069501632);
|
||||
$this->c = $this->gg($this->c, $this->d, $this->a, $this->b, $x[$i+11], 14, 643717713);
|
||||
$this->b = $this->gg($this->b, $this->c, $this->d, $this->a, $x[$i+ 0], 20, -373897302);
|
||||
$this->a = $this->gg($this->a, $this->b, $this->c, $this->d, $x[$i+ 5], 5 , -701558691);
|
||||
$this->d = $this->gg($this->d, $this->a, $this->b, $this->c, $x[$i+10], 9 , 38016083);
|
||||
$this->c = $this->gg($this->c, $this->d, $this->a, $this->b, $x[$i+15], 14, -660478335);
|
||||
$this->b = $this->gg($this->b, $this->c, $this->d, $this->a, $x[$i+ 4], 20, -405537848);
|
||||
$this->a = $this->gg($this->a, $this->b, $this->c, $this->d, $x[$i+ 9], 5 , 568446438);
|
||||
$this->d = $this->gg($this->d, $this->a, $this->b, $this->c, $x[$i+14], 9 , -1019803690);
|
||||
$this->c = $this->gg($this->c, $this->d, $this->a, $this->b, $x[$i+ 3], 14, -187363961);
|
||||
$this->b = $this->gg($this->b, $this->c, $this->d, $this->a, $x[$i+ 8], 20, 1163531501);
|
||||
$this->a = $this->gg($this->a, $this->b, $this->c, $this->d, $x[$i+13], 5 , -1444681467);
|
||||
$this->d = $this->gg($this->d, $this->a, $this->b, $this->c, $x[$i+ 2], 9 , -51403784);
|
||||
$this->c = $this->gg($this->c, $this->d, $this->a, $this->b, $x[$i+ 7], 14, 1735328473);
|
||||
$this->b = $this->gg($this->b, $this->c, $this->d, $this->a, $x[$i+12], 20, -1926607734);
|
||||
|
||||
$this->a = $this->hh($this->a, $this->b, $this->c, $this->d, $x[$i+ 5], 4 , -378558);
|
||||
$this->d = $this->hh($this->d, $this->a, $this->b, $this->c, $x[$i+ 8], 11, -2022574463);
|
||||
$this->c = $this->hh($this->c, $this->d, $this->a, $this->b, $x[$i+11], 16, 1839030562);
|
||||
$this->b = $this->hh($this->b, $this->c, $this->d, $this->a, $x[$i+14], 23, -35309556);
|
||||
$this->a = $this->hh($this->a, $this->b, $this->c, $this->d, $x[$i+ 1], 4 , -1530992060);
|
||||
$this->d = $this->hh($this->d, $this->a, $this->b, $this->c, $x[$i+ 4], 11, 1272893353);
|
||||
$this->c = $this->hh($this->c, $this->d, $this->a, $this->b, $x[$i+ 7], 16, -155497632);
|
||||
$this->b = $this->hh($this->b, $this->c, $this->d, $this->a, $x[$i+10], 23, -1094730640);
|
||||
$this->a = $this->hh($this->a, $this->b, $this->c, $this->d, $x[$i+13], 4 , 681279174);
|
||||
$this->d = $this->hh($this->d, $this->a, $this->b, $this->c, $x[$i+ 0], 11, -358537222);
|
||||
$this->c = $this->hh($this->c, $this->d, $this->a, $this->b, $x[$i+ 3], 16, -722521979);
|
||||
$this->b = $this->hh($this->b, $this->c, $this->d, $this->a, $x[$i+ 6], 23, 76029189);
|
||||
$this->a = $this->hh($this->a, $this->b, $this->c, $this->d, $x[$i+ 9], 4 , -640364487);
|
||||
$this->d = $this->hh($this->d, $this->a, $this->b, $this->c, $x[$i+12], 11, -421815835);
|
||||
$this->c = $this->hh($this->c, $this->d, $this->a, $this->b, $x[$i+15], 16, 530742520);
|
||||
$this->b = $this->hh($this->b, $this->c, $this->d, $this->a, $x[$i+ 2], 23, -995338651);
|
||||
|
||||
$this->a = $this->ii($this->a, $this->b, $this->c, $this->d, $x[$i+ 0], 6 , -198630844);
|
||||
$this->d = $this->ii($this->d, $this->a, $this->b, $this->c, $x[$i+ 7], 10, 1126891415);
|
||||
$this->c = $this->ii($this->c, $this->d, $this->a, $this->b, $x[$i+14], 15, -1416354905);
|
||||
$this->b = $this->ii($this->b, $this->c, $this->d, $this->a, $x[$i+ 5], 21, -57434055);
|
||||
$this->a = $this->ii($this->a, $this->b, $this->c, $this->d, $x[$i+12], 6 , 1700485571);
|
||||
$this->d = $this->ii($this->d, $this->a, $this->b, $this->c, $x[$i+ 3], 10, -1894986606);
|
||||
$this->c = $this->ii($this->c, $this->d, $this->a, $this->b, $x[$i+10], 15, -1051523);
|
||||
$this->b = $this->ii($this->b, $this->c, $this->d, $this->a, $x[$i+ 1], 21, -2054922799);
|
||||
$this->a = $this->ii($this->a, $this->b, $this->c, $this->d, $x[$i+ 8], 6 , 1873313359);
|
||||
$this->d = $this->ii($this->d, $this->a, $this->b, $this->c, $x[$i+15], 10, -30611744);
|
||||
$this->c = $this->ii($this->c, $this->d, $this->a, $this->b, $x[$i+ 6], 15, -1560198380);
|
||||
$this->b = $this->ii($this->b, $this->c, $this->d, $this->a, $x[$i+13], 21, 1309151649);
|
||||
$this->a = $this->ii($this->a, $this->b, $this->c, $this->d, $x[$i+ 4], 6 , -145523070);
|
||||
$this->d = $this->ii($this->d, $this->a, $this->b, $this->c, $x[$i+11], 10, -1120210379);
|
||||
$this->c = $this->ii($this->c, $this->d, $this->a, $this->b, $x[$i+ 2], 15, 718787259);
|
||||
$this->b = $this->ii($this->b, $this->c, $this->d, $this->a, $x[$i+ 9], 21, -343485551);
|
||||
|
||||
$this->a = $this->add($this->a, $olda);
|
||||
$this->b = $this->add($this->b, $oldb);
|
||||
$this->c = $this->add($this->c, $oldc);
|
||||
$this->d = $this->add($this->d, $oldd);
|
||||
}
|
||||
|
||||
return $this->rhex($this->a) . $this->rhex($this->b) . $this->rhex($this->c) . $this->rhex($this->d);
|
||||
}
|
||||
}
|
||||
|
||||
Class EncodingKey {
|
||||
var $clMD5;
|
||||
|
||||
function EncodingKey() {
|
||||
$this->clMD5 = new HashMD5();
|
||||
}
|
||||
|
||||
function giveHashCode($pkey, $second, $email, $refid, $montant, $nom) {
|
||||
|
||||
$modulo = $second % 4;
|
||||
|
||||
switch($modulo) {
|
||||
case 0:
|
||||
$select = $montant;
|
||||
break;
|
||||
case 1:
|
||||
$select = $email;
|
||||
break;
|
||||
case 2:
|
||||
$select = $refid;
|
||||
break;
|
||||
case 3:
|
||||
$select = $nom;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return $this->clMD5->hash($pkey.$refid.$select);
|
||||
}
|
||||
|
||||
function giveHashCode2($pkey, $second, $email, $refid, $montant, $nom) {
|
||||
$modulo = $second % 4;
|
||||
|
||||
switch($modulo) {
|
||||
case 0:
|
||||
$select = $montant;
|
||||
break;
|
||||
case 1:
|
||||
$select = $email;
|
||||
break;
|
||||
case 2:
|
||||
$select = $refid;
|
||||
break;
|
||||
case 3:
|
||||
$select = $nom;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//echo "String PHP : ".$pkey.$refid.$montant.$email.$select."<br>";
|
||||
|
||||
return $this->clMD5->hash($pkey.$refid.$montant.$email.$select);
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,473 +0,0 @@
|
||||
<?php
|
||||
|
||||
class fianet_sender
|
||||
{
|
||||
var $mode = null;
|
||||
var $orders = array();
|
||||
|
||||
function fianet_sender()
|
||||
{
|
||||
}
|
||||
|
||||
function add_order($order)
|
||||
{
|
||||
if (!is_array($order))
|
||||
{
|
||||
if (var_is_object_of_class($order, 'fianet_order_xml'))
|
||||
{
|
||||
$this->orders[] = $order;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($order as $o)
|
||||
{
|
||||
if (var_is_object_of_class($o, 'fianet_order_xml'))
|
||||
{
|
||||
$this->orders[] = $o;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Envoie toutes les commandes une par une
|
||||
function send_orders_singet()
|
||||
{
|
||||
if (!count($this->orders) > 0)
|
||||
{
|
||||
fianet_insert_log("fianet_sender.php - send_orders_singet() <br />\nNo order to send.");
|
||||
return;
|
||||
}
|
||||
if (!$this->check_order_data())
|
||||
{
|
||||
fianet_insert_log("fianet_sender.php - send_orders_singet() <br />\nOrders list is not valid.");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->orders as $order)
|
||||
{
|
||||
$xml = '<?xml version="1.0" encoding="'. FIANET_ENCODING . '" ?>' . "\n";
|
||||
$xml .= $order->get_xml();
|
||||
$data['siteid'] = $order->info_commande->siteid;
|
||||
$data['controlcallback'] = clean_xml($xml);
|
||||
$this->send_fsock_singet($data);
|
||||
}
|
||||
}
|
||||
|
||||
//Envoie les commandes par lot de 25
|
||||
function send_orders_stacking()
|
||||
{
|
||||
if (!count($this->orders) > 0)
|
||||
{
|
||||
fianet_insert_log("fianet_sender.php - send_orders_stackfast() <br />\nNo order to send.");
|
||||
return;
|
||||
}
|
||||
if (!$this->check_order_data())
|
||||
{
|
||||
fianet_insert_log("fianet_sender.php - send_orders_stackfast() <br />\nOrders list is not valid.");
|
||||
return;
|
||||
}
|
||||
$stack = array();
|
||||
$count = 0;
|
||||
$results = array();
|
||||
foreach ($this->orders as $order)
|
||||
{
|
||||
if ($count < 25)
|
||||
{
|
||||
$count++;
|
||||
$stack[] = $order;
|
||||
}
|
||||
elseif ($count == 25)
|
||||
{
|
||||
|
||||
$results = array_merge($results, $this->process_stack($stack));
|
||||
$stack = array();
|
||||
$stack[] = $order;
|
||||
$count = 1;
|
||||
}
|
||||
}
|
||||
$results = array_merge($results, $this->process_stack($stack));
|
||||
return ($results);
|
||||
}
|
||||
|
||||
//Recupère une liste d'évaluations
|
||||
function get_evaluation($order_list, $Separ = ',')
|
||||
{
|
||||
$evaluations = array();
|
||||
if (count($order_list) > 0)
|
||||
{
|
||||
$order_list_by_stack = array_chunk($order_list, 50, true);
|
||||
foreach ($order_list_by_stack as $stack)
|
||||
{
|
||||
$evaluations = array_merge($this->get_evaluation_by_stack($stack, $Separ), $evaluations);
|
||||
}
|
||||
}
|
||||
return ($evaluations);
|
||||
}
|
||||
|
||||
|
||||
function get_evaluation_by_stack($order_list, $Separ = ',')
|
||||
{
|
||||
if (count($order_list) > 0)
|
||||
{
|
||||
if ($this->mode == 'production')
|
||||
{
|
||||
$url = URL_SAC_PROD;
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = URL_SAC_TEST;
|
||||
}
|
||||
$siteid = FIANET_SAC_SITE_ID;
|
||||
$pwd = FIANET_SAC_PWD;
|
||||
$mode = 'mini';
|
||||
$repFT = '0';
|
||||
$listID = '';
|
||||
foreach ($order_list as $id_order)
|
||||
{
|
||||
if ($listID != '')
|
||||
{
|
||||
$listID .= $Separ . $id_order;
|
||||
}
|
||||
else
|
||||
{
|
||||
$listID .= $id_order;
|
||||
}
|
||||
}
|
||||
$data['SiteID'] = $siteid;
|
||||
$data['Pwd'] = $pwd;
|
||||
$data['Mode'] = $mode;
|
||||
$data['RepFT'] = $repFT;
|
||||
$data['ListID'] = $listID;
|
||||
$data['Separ'] = $Separ;
|
||||
|
||||
$s = new fianet_socket($url, URl_SAC_GETVALIDSTACK, 'POST', $data);
|
||||
$result = $s->send();
|
||||
$evaluations = array();
|
||||
if ($result === false)
|
||||
{
|
||||
fianet_insert_log("fianet_sender.php - get_evaluation() <br />\nError when opening file : <br />\n".$url);
|
||||
}
|
||||
else
|
||||
{
|
||||
$xmldata = $result['data'];
|
||||
$xml_array = xml2array($xmldata);
|
||||
//debug($xml_array);
|
||||
$evaluations = $this->process_result($xml_array);
|
||||
return ($evaluations);
|
||||
}
|
||||
return ($evaluations);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
méthodes privées
|
||||
*/
|
||||
|
||||
function process_result($xml_array)
|
||||
{
|
||||
$evaluations = array();
|
||||
//debug($xml_array, 'xml_array');
|
||||
if (isset($xml_array['stack']['result']))
|
||||
{
|
||||
if (isset($xml_array['stack']['result'][0]))
|
||||
{
|
||||
foreach ($xml_array['stack']['result'] as $res)
|
||||
{
|
||||
if (eregi("error", $res['attr']['retour']))
|
||||
{
|
||||
fianet_insert_log("fianet_sender.php - process_result() <br />\nErreur : <br />\n".$res['attr']['message']);
|
||||
}
|
||||
else
|
||||
{
|
||||
//$index = count($evaluations);
|
||||
//$evaluations[$index] = $this->process_result_array($res);
|
||||
$eval = $this->process_result_array($res);
|
||||
if ($eval['refid'] != null)
|
||||
{
|
||||
$evaluations[$eval['refid']] = $eval;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$res = $xml_array['stack']['result'];
|
||||
if (eregi("error", $res['attr']['retour']))
|
||||
{
|
||||
fianet_insert_log("fianet_sender.php - process_result() <br />\nErreur : <br />\n".$res['attr']['message']);
|
||||
}
|
||||
else
|
||||
{
|
||||
//$index = count($evaluations);
|
||||
$eval = $this->process_result_array($res);
|
||||
if ($eval['refid'] != null)
|
||||
{
|
||||
$evaluations[$eval['refid']] = $eval;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isset($xml_array['result']['transaction']))
|
||||
{
|
||||
if (isset($xml_array['result']['transaction'][0]))
|
||||
{
|
||||
foreach ($xml_array['result']['transaction'] as $transaction)
|
||||
{
|
||||
$eval = $this->process_transaction_array($transaction);
|
||||
//debug($eval);
|
||||
if ($eval['refid'] != null)
|
||||
{
|
||||
$evaluations[$eval['refid']] = $eval;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$transaction = $xml_array['result']['transaction'];
|
||||
$eval = $this->process_transaction_array($transaction);
|
||||
if ($eval['refid'] != null)
|
||||
{
|
||||
$evaluations[$eval['refid']] = $eval;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ($evaluations);
|
||||
}
|
||||
|
||||
function process_result_array($res)
|
||||
{
|
||||
//debug($res, 'Result');
|
||||
$eval['refid'] = $res['attr']['refid'];
|
||||
if ( $res['attr']['retour'] == 'absente')
|
||||
{
|
||||
$eval['info'] = 'absente';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($res['transaction'][0]))
|
||||
{
|
||||
$transaction = end($res['transaction']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$transaction = $res['transaction'];
|
||||
}
|
||||
$etat = $this->process_transaction_array($transaction);
|
||||
$eval['eval'] = $etat['eval'];
|
||||
$eval['info'] = $etat['info'];
|
||||
$eval['cid'] = $etat['cid'];
|
||||
}
|
||||
return ($eval);
|
||||
}
|
||||
|
||||
function process_transaction_array($transaction)
|
||||
{
|
||||
$eval = array();
|
||||
//debug($transaction);
|
||||
|
||||
if ($transaction['attr']['avancement'] == 'error')
|
||||
{
|
||||
$eval['eval'] = 'error';
|
||||
$eval['info'] = $transaction['detail']['value'];
|
||||
$eval['cid'] = '';
|
||||
$eval['refid'] = $transaction['attr']['refid'];
|
||||
}
|
||||
elseif ($transaction['attr']['avancement'] == 'encours')
|
||||
{
|
||||
$eval['eval'] = 'encours';
|
||||
$eval['info'] = $transaction['detail']['value'];
|
||||
$eval['cid'] = '';
|
||||
$eval['refid'] = $transaction['attr']['refid'];
|
||||
}
|
||||
elseif ($transaction['attr']['avancement'] == 'traitee')
|
||||
{
|
||||
$eval['eval'] = $transaction['analyse']['eval']['value'];
|
||||
$eval['info'] = $transaction['analyse']['eval']['attr']['info'];
|
||||
$eval['cid'] = $transaction['attr']['cid'];
|
||||
$eval['refid'] = $transaction['attr']['refid'];
|
||||
}
|
||||
|
||||
return ($eval);
|
||||
}
|
||||
|
||||
function process_stack($stack)
|
||||
{
|
||||
$xml = '<?xml version="1.0" encoding="'. FIANET_ENCODING . '" ?>' . "\n";
|
||||
$xml .= '<stack>' . "\n";
|
||||
foreach ($stack as $order)
|
||||
{
|
||||
$xml .= $order->get_xml();
|
||||
if (!isset($siteid))
|
||||
{
|
||||
$siteid = $order->info_commande->siteid;
|
||||
}
|
||||
}
|
||||
$xml .= '</stack>';
|
||||
$data['siteid'] = $siteid;
|
||||
$data['controlcallback'] = clean_xml($xml);
|
||||
$result = array();
|
||||
$result = $this->send_fsock_stacking($data);
|
||||
return ($result);
|
||||
}
|
||||
|
||||
function process_result_stacking($xml_data)
|
||||
{
|
||||
$result = array();
|
||||
$xml_array = xml2array($xml_data);
|
||||
//debug($xml_array);
|
||||
if (isset($xml_array['validstack']['unluck']))
|
||||
{
|
||||
fianet_insert_log("fianet_sender.php - process_result_stacking() <br />\nError : <br />\n".$xml_array['validstack']['unluck']['value']);
|
||||
return ($result);
|
||||
}
|
||||
elseif (isset($xml_array['validstack']['result']))
|
||||
{
|
||||
$xml_array = $xml_array['validstack']['result'];
|
||||
//debug($xml_array);
|
||||
if (isset($xml_array[0]))
|
||||
{
|
||||
foreach ($xml_array as $transaction_result)
|
||||
{
|
||||
$index = count($result);
|
||||
$result[$index]['refid'] = $transaction_result['attr']['refid'];
|
||||
$result[$index]['etat'] = $transaction_result['attr']['avancement'];
|
||||
$result[$index]['details'] = $transaction_result['detail']['value'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$index = count($result);
|
||||
$result[$index]['refid'] = $xml_array['attr']['refid'];
|
||||
$result[$index]['etat'] = $xml_array['attr']['avancement'];
|
||||
$result[$index]['details'] = $xml_array['detail']['value'];
|
||||
}
|
||||
}
|
||||
return ($result);
|
||||
}
|
||||
|
||||
function check_order_data()
|
||||
{
|
||||
$res = true;
|
||||
foreach ($this->orders as $order)
|
||||
{
|
||||
if (!var_is_object_of_class($order, 'fianet_order_xml'))
|
||||
{
|
||||
$res = false;
|
||||
}
|
||||
}
|
||||
return ($res);
|
||||
}
|
||||
|
||||
function send_fsock_singet($data)
|
||||
{
|
||||
if ($this->mode == 'production')
|
||||
{
|
||||
$url_action = URL_SAC_PROD;
|
||||
}
|
||||
else
|
||||
{
|
||||
$url_action = URL_SAC_TEST;
|
||||
}
|
||||
$path = URl_SAC_SINGET;
|
||||
|
||||
$s = new fianet_socket($url_action, $path, 'GET', $data);
|
||||
$res = $s->send();
|
||||
if ($res === false)
|
||||
{
|
||||
fianet_insert_log("fianet_sender.php - send_fsock_post() <br />\nError when connecting : <br />\n".$url_action . $path);
|
||||
return (false);
|
||||
}
|
||||
return (true);
|
||||
}
|
||||
|
||||
function send_fsock_stacking($data)
|
||||
{
|
||||
if ($this->mode == 'production')
|
||||
{
|
||||
$url_action = URL_SAC_PROD;
|
||||
}
|
||||
else
|
||||
{
|
||||
$url_action = URL_SAC_TEST;
|
||||
}
|
||||
$path = URl_SAC_STACKING;
|
||||
|
||||
$s = new fianet_socket($url_action, $path, 'POST', $data);
|
||||
$res = $s->send();
|
||||
if ($res === false)
|
||||
{
|
||||
fianet_insert_log("fianet_sender.php - send_fsock_post() <br />\nError when connecting : <br />\n".$url_action . $path);
|
||||
return (false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->process_result_stacking($res['data']);
|
||||
return ($result);
|
||||
}
|
||||
}
|
||||
|
||||
function get_reevaluated_order()
|
||||
{
|
||||
if ($this->mode == 'production')
|
||||
{
|
||||
$url_action = URL_SAC_PROD;
|
||||
}
|
||||
else
|
||||
{
|
||||
$url_action = URL_SAC_TEST;
|
||||
}
|
||||
$path = URl_SAC_GETALERT;
|
||||
$mode = 'new';
|
||||
$output = 'mini';
|
||||
$repFT = '0';
|
||||
|
||||
$data['SiteID'] = FIANET_SAC_SITE_ID;
|
||||
$data['Pwd'] = FIANET_SAC_PWD;
|
||||
$data['Mode'] = $mode;
|
||||
$data['Output'] = $output;
|
||||
$data['RepFT'] = $repFT;
|
||||
|
||||
$s = new fianet_socket($url_action, $path, "POST", $data);
|
||||
$res = $s->send();
|
||||
$evaluations = array();
|
||||
if ($res === false)
|
||||
{
|
||||
fianet_insert_log("fianet_sender.php - get_reevaluated_order() <br />\nError when opening file : <br />\n".$url);
|
||||
}
|
||||
else
|
||||
{
|
||||
$xmldata = $res['data'];
|
||||
//Le code commenté suivant permet de tester la réception d'une réevaluation
|
||||
/*$xmldata = '<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<result version="3.1" site="10" retour="trouvee" count="1">
|
||||
<transaction avancement="traitee" cid="95458898" refid="Refresh04">
|
||||
<detail>Paiement validé</detail>
|
||||
<analyse>
|
||||
<eval date="20/05/2008 10:27:46" critere="16" validation="Acheteur connu" info="acheteur certifié">100</eval>
|
||||
<classement id="1">Transactions à traiter/Nouvelles/Contrôle visuel</classement>
|
||||
</analyse>
|
||||
</transaction>
|
||||
<transaction avancement="traitee" cid="15458898" refid="Refresh05">
|
||||
<detail>Paiement validé</detail>
|
||||
<analyse>
|
||||
<eval date="20/05/2008 10:27:46" critere="16" validation="Acheteur connu" info="acheteur certifié">100</eval>
|
||||
<classement id="1">Transactions à traiter/Nouvelles/Contrôle visuel</classement>
|
||||
</analyse>
|
||||
</transaction>
|
||||
</result>';*/
|
||||
$xml_array = xml2array($xmldata);
|
||||
if (isset($xml_array['result']['attr']['retour']))
|
||||
{
|
||||
if ($xml_array['result']['attr']['retour'] == "param_error")
|
||||
{
|
||||
fianet_insert_log("fianet_sender.php - get_reevaluated_order() <br />\nParam_error : <br />\n".$xml_array['result']['attr']['message']."\n<br>$url_action");
|
||||
}
|
||||
}
|
||||
$evaluations = $this->process_result($xml_array);
|
||||
}
|
||||
return ($evaluations);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,235 +0,0 @@
|
||||
<?php
|
||||
|
||||
function process_result($xml_array)
|
||||
{
|
||||
$evaluations = array();
|
||||
//debug($xml_array, 'xml_array');
|
||||
if (isset($xml_array['stack']['result'][0]))
|
||||
{
|
||||
foreach ($xml_array['stack']['result'] as $res)
|
||||
{
|
||||
if (eregi("error", $res['attr']['retour']))
|
||||
{
|
||||
fianet_insert_log("fianet_sender.php - process_result() <br />\nErreur : <br />\n".$res['attr']['message']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$index = count($evaluations);
|
||||
$evaluations[$index] = $this->process_result_array($res);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$res = $xml_array['stack']['result'];
|
||||
if (eregi("error", $res['attr']['retour']))
|
||||
{
|
||||
fianet_insert_log("fianet_sender.php - process_result() <br />\nErreur : <br />\n".$res['attr']['message']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$index = count($evaluations);
|
||||
$evaluations[$index] = $this->process_result_array($res);
|
||||
}
|
||||
}
|
||||
return ($evaluations);
|
||||
}
|
||||
|
||||
function process_result_array($res)
|
||||
{
|
||||
//debug($res, 'Result');
|
||||
$eval['refid'] = $res['attr']['refid'];
|
||||
if ( $res['attr']['retour'] == 'absente')
|
||||
{
|
||||
$eval['info'] = 'absente';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($res['transaction'][0]))
|
||||
{
|
||||
$transaction = end($res['transaction']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$transaction = $res['transaction'];
|
||||
}
|
||||
$etat = $this->process_transaction_array($transaction);
|
||||
$eval['eval'] = $etat['eval'];
|
||||
$eval['info'] = $etat['info'];
|
||||
$eval['cid'] = $etat['cid'];
|
||||
}
|
||||
return ($eval);
|
||||
}
|
||||
|
||||
function process_transaction_array($transaction)
|
||||
{
|
||||
$eval = array();
|
||||
//debug($transaction);
|
||||
|
||||
if ($transaction['attr']['avancement'] == 'error')
|
||||
{
|
||||
$eval['refid'] = $transaction['attr']['refid'];
|
||||
$eval['eval'] = 'error';
|
||||
$eval['info'] = $transaction['detail']['value'];
|
||||
$eval['cid'] = '';
|
||||
}
|
||||
elseif ($transaction['attr']['avancement'] == 'encours')
|
||||
{
|
||||
$eval['refid'] = $transaction['attr']['refid'];
|
||||
$eval['eval'] = 'encours';
|
||||
$eval['info'] = $transaction['detail']['value'];
|
||||
$eval['cid'] = '';
|
||||
}
|
||||
elseif ($transaction['attr']['avancement'] == 'traitee')
|
||||
{
|
||||
$eval['refid'] = $transaction['attr']['refid'];
|
||||
$eval['eval'] = $transaction['analyse']['eval']['value'];
|
||||
$eval['info'] = $transaction['analyse']['eval']['attr']['info'];
|
||||
$eval['cid'] = $transaction['attr']['cid'];
|
||||
}
|
||||
|
||||
return ($eval);
|
||||
}
|
||||
|
||||
function process_stack($stack)
|
||||
{
|
||||
$xml = '<?xml version="1.0" encoding="'. FIANET_ENCODING . '" ?>' . "\n";
|
||||
$xml .= '<stack>' . "\n";
|
||||
foreach ($stack as $order)
|
||||
{
|
||||
$xml .= $order->get_xml();
|
||||
if (!isset($siteid))
|
||||
{
|
||||
$siteid = $order->info_commande->siteid;
|
||||
}
|
||||
}
|
||||
$xml .= '</stack>';
|
||||
$data['siteid'] = $siteid;
|
||||
$data['controlcallback'] = clean_xml($xml);
|
||||
$this->send_fsock_stacking($data);
|
||||
}
|
||||
|
||||
function process_result_stacking($xml_data)
|
||||
{
|
||||
$result = array();
|
||||
$xml_array = xml2array($xml_data);
|
||||
//debug($xml_array);
|
||||
if (isset($xml_array['validstack']['unluck']))
|
||||
{
|
||||
fianet_insert_log("fianet_sender.php - process_result_stacking() <br />\nError : <br />\n".$xml_array['validstack']['unluck']['value']);
|
||||
return ($result);
|
||||
}
|
||||
elseif (isset($xml_array['validstack']['result']))
|
||||
{
|
||||
$xml_array = $xml_array['validstack']['result'];
|
||||
//debug($xml_array);
|
||||
if (isset($xml_array[0]))
|
||||
{
|
||||
foreach ($xml_array as $transaction_result)
|
||||
{
|
||||
$index = count($result);
|
||||
$result[$index]['refid'] = $transaction_result['attr']['refid'];
|
||||
$result[$index]['etat'] = $transaction_result['attr']['avancement'];
|
||||
$result[$index]['details'] = $transaction_result['detail']['value'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$index = count($result);
|
||||
$result[$index]['refid'] = $xml_array['attr']['refid'];
|
||||
$result[$index]['etat'] = $xml_array['attr']['avancement'];
|
||||
$result[$index]['details'] = $xml_array['detail']['value'];
|
||||
}
|
||||
}
|
||||
return ($result);
|
||||
}
|
||||
|
||||
function check_order_data()
|
||||
{
|
||||
$res = true;
|
||||
foreach ($this->orders as $order)
|
||||
{
|
||||
if (!var_is_object_of_class($order, 'fianet_order_xml'))
|
||||
{
|
||||
$res = false;
|
||||
}
|
||||
}
|
||||
return ($res);
|
||||
}
|
||||
|
||||
function send_fsock_singet($data)
|
||||
{
|
||||
if ($mode == 'production')
|
||||
{
|
||||
$url_action = URL_SAC_PROD;
|
||||
}
|
||||
else
|
||||
{
|
||||
$url_action = URL_SAC_TEST;
|
||||
}
|
||||
$path = URl_SAC_SINGET;
|
||||
|
||||
$s = new fianet_socket($url_action, $path, 'GET', $data);
|
||||
$res = $s->send();
|
||||
if ($res === false)
|
||||
{
|
||||
fianet_insert_log("fianet_sender.php - send_fsock_post() <br />\nError when connecting : <br />\n".$url_action . $path);
|
||||
return (false);
|
||||
}
|
||||
return (true);
|
||||
}
|
||||
|
||||
function send_fsock_stacking($data)
|
||||
{
|
||||
if ($this->mode == 'production')
|
||||
{
|
||||
$url_action = URL_SAC_PROD;
|
||||
}
|
||||
else
|
||||
{
|
||||
$url_action = URL_SAC_TEST;
|
||||
}
|
||||
$path = URl_SAC_STACKING;
|
||||
|
||||
$s = new fianet_socket($url_action, $path, 'POST', $data);
|
||||
$res = $s->send();
|
||||
if ($res === false)
|
||||
{
|
||||
fianet_insert_log("fianet_sender.php - send_fsock_post() <br />\nError when connecting : <br />\n".$url_action . $path);
|
||||
return (false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->process_result_stacking($res['data']);
|
||||
//debug($result);
|
||||
return ($result);
|
||||
}
|
||||
}
|
||||
|
||||
function process_result_nostack($xml_array)
|
||||
{
|
||||
$evaluations = array();
|
||||
//debug($xml_array, 'xml_array');
|
||||
if (isset($xml_array['result']['transaction'][0]))
|
||||
{
|
||||
foreach ($xml_array['result']['transaction'] as $res)
|
||||
{
|
||||
$eval = $this->process_transaction_array($res);
|
||||
if ($eval['refid'] != null)
|
||||
{
|
||||
$evaluations[$eval['refid']] = $eval;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$res = $xml_array['result']['transaction'];
|
||||
$eval = $this->process_transaction_array($res);
|
||||
if ($eval['refid'] != null)
|
||||
{
|
||||
$evaluations[$eval['refid']] = $eval;
|
||||
}
|
||||
}
|
||||
return ($evaluations);
|
||||
}
|
||||
|
||||
@@ -1,172 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
class fianet_socket
|
||||
{
|
||||
var $host;
|
||||
var $port;
|
||||
|
||||
var $is_ssl = false;
|
||||
|
||||
var $method = 'GET';
|
||||
|
||||
var $data = array();
|
||||
var $path;
|
||||
|
||||
function fianet_socket($fianet_url, $fianet_file, $method = 'GET', $data = array())
|
||||
{
|
||||
if (is_array($data))
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
$this->parse_fianet_url($fianet_url, $fianet_file);
|
||||
if (strtoupper($method) == 'GET' || strtoupper($method) == 'POST')
|
||||
{
|
||||
$this->method = strtoupper($method);
|
||||
}
|
||||
}
|
||||
|
||||
function parse_fianet_url($fianet_url, $fianet_file)
|
||||
{
|
||||
if (ereg("^http://", $fianet_url))
|
||||
{
|
||||
$this->is_ssl = false;
|
||||
$this->host = eregi_replace("http://([^/]+)/.+", "\\1", $fianet_url);
|
||||
$this->port = 80;
|
||||
$this->path = eregi_replace("http://[^/]+/", "/", $fianet_url) . $fianet_file;
|
||||
}
|
||||
if (ereg("^https://", $fianet_url))
|
||||
{
|
||||
$this->is_ssl = true;
|
||||
$this->host = eregi_replace("https://([^/]+)/.+", "\\1", $fianet_url);
|
||||
$this->port = 443;
|
||||
$this->path = eregi_replace("https://[^/]+/", "/", $fianet_url) . $fianet_file;
|
||||
}
|
||||
//debug($this->path);
|
||||
}
|
||||
|
||||
function determine_boundary()
|
||||
{
|
||||
srand((double)microtime() * 1000000);
|
||||
return ("---------------------".substr(md5(rand(0,32000)),0,10));
|
||||
}
|
||||
|
||||
function build_header($boundary, $data)
|
||||
{
|
||||
if ($this->method == 'POST')
|
||||
{
|
||||
$header = "POST ".$this->path." HTTP/1.0\r\n";
|
||||
$header .= "Host: ".$this->host."\r\n";
|
||||
$header .= "Content-type: application/x-www-form-urlencoded; boundary=$boundary\r\n";
|
||||
$header .= "Content-length: " . strlen($data) . "\r\n\r\n";
|
||||
}
|
||||
elseif ($this->method == 'GET')
|
||||
{
|
||||
if ($data != '')
|
||||
{
|
||||
if (strlen($this->path."?".$data) > 2048)
|
||||
{
|
||||
fianet_insert_log("fianet_socket.php - build_header() <br />\nMaximum length in get method reached(".strlen($this->path."?".$data).") : <br />\n".$this->path."?".$data);
|
||||
}
|
||||
$header = "GET ".$this->path."?".$data." HTTP/1.1\r\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$header = "GET ".$this->path." HTTP/1.1\r\n";
|
||||
}
|
||||
$header .= "Host: ".$this->host."\r\n";
|
||||
$header .= "Connection: close\r\n\r\n";
|
||||
}
|
||||
return ($header);
|
||||
}
|
||||
|
||||
function build_data($boundary)
|
||||
{
|
||||
$data = "";
|
||||
foreach($this->data as $index => $value)
|
||||
{
|
||||
if ($data == '')
|
||||
{
|
||||
$data .= $index . '='. urlencode($value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data .= '&'.$index . '='. urlencode($value);
|
||||
}
|
||||
}
|
||||
return ($data);
|
||||
}
|
||||
|
||||
function send()
|
||||
{
|
||||
$boundary = $this->determine_boundary();
|
||||
$data = $this->build_data($boundary);
|
||||
$header = $this->build_header($boundary, $data);
|
||||
|
||||
//debug($header, 'header');
|
||||
//debug(htmlentities($data), 'data');
|
||||
$response = $this->connect($header, $data);
|
||||
if ($response != false)
|
||||
{
|
||||
$d['header'] = $response['header'];
|
||||
$d['data'] = htmlentities($response['data']);
|
||||
//debug($d, 'Réponse');
|
||||
}
|
||||
|
||||
return ($response);
|
||||
}
|
||||
|
||||
function connect($header, $data)
|
||||
{
|
||||
$res['header'] = "";
|
||||
$res['data'] = "";
|
||||
if ($this->is_ssl)
|
||||
{
|
||||
$host = 'ssl://'.$this->host . ':'.$this->port;
|
||||
$socket = fsockopen ('ssl://'.$this->host, $this->port);
|
||||
}
|
||||
else
|
||||
{
|
||||
$host = $this->host . ':' . $this->port;
|
||||
$socket = fsockopen ($this->host, $this->port);
|
||||
}
|
||||
if ($socket !== false)
|
||||
{
|
||||
$data_reached = false;
|
||||
if (@fputs($socket, $header.$data))
|
||||
{
|
||||
while (!feof($socket))
|
||||
{
|
||||
$line = fgets($socket);
|
||||
if (!$data_reached)
|
||||
{
|
||||
if ($line == "\r\n")
|
||||
{
|
||||
$data_reached = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$res['header'] .= $line;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$res['data'] .= $line;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fianet_insert_log("fianet_socket.php - connect() <br />\nEnvoie des données impossible sur : <br />\n".$host);
|
||||
$res = false;
|
||||
}
|
||||
fclose($socket);
|
||||
}
|
||||
else
|
||||
{
|
||||
fianet_insert_log("fianet_socket.php - connect() <br />\nConnexion socket impossible : <br />\n".$host);
|
||||
$res = false;
|
||||
}
|
||||
return ($res);
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
<?php
|
||||
|
||||
class fianet_adress_xml
|
||||
{
|
||||
var $type;
|
||||
var $format = 1;
|
||||
var $rue1;
|
||||
var $rue2;
|
||||
var $cpostal;
|
||||
var $ville;
|
||||
var $pays;
|
||||
var $appartement = null;
|
||||
|
||||
function get_xml()
|
||||
{
|
||||
$xml = '';
|
||||
if ($this->type != null)
|
||||
{
|
||||
$xml .= "\t" . '<adresse type="'.$this->type.'" format="'.$this->format.'">' . "\n";
|
||||
if ($this->rue1 != '')
|
||||
{
|
||||
$xml .= "\t\t" . '<rue1>'.clean_invalid_char($this->rue1).'</rue1>' . "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
fianet_insert_log("fianet_adress_xml.php - get_xml() <br />\n rue1 is undefined");
|
||||
return;
|
||||
}
|
||||
if ($this->rue2 != "")
|
||||
{
|
||||
$xml .= "\t\t" . '<rue2>'.clean_invalid_char($this->rue2).'</rue2>' . "\n";
|
||||
}
|
||||
if ($this->cpostal != "")
|
||||
{
|
||||
$xml .= "\t\t" . '<cpostal>'.clean_invalid_char($this->cpostal).'</cpostal>' . "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
fianet_insert_log("fianet_adress_xml.php - get_xml() <br />\n cpostal is undefined");
|
||||
return;
|
||||
}
|
||||
if ($this->ville != "")
|
||||
{
|
||||
$xml .= "\t\t" . '<ville>'.clean_invalid_char($this->ville).'</ville>' . "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
fianet_insert_log("fianet_adress_xml.php - get_xml() <br />\n ville is undefined");
|
||||
return;
|
||||
}
|
||||
if ($this->pays != "")
|
||||
{
|
||||
$xml .= "\t\t" . '<pays>'.clean_invalid_char($this->pays).'</pays>' . "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
fianet_insert_log("fianet_adress_xml.php - get_xml() <br />\n pays is undefined");
|
||||
return;
|
||||
}
|
||||
if ($this->appartement != null)
|
||||
{
|
||||
if (var_is_object_of_class($this->appartement, 'fianet_appartment_xml'))
|
||||
{
|
||||
$xml .= $this->appartement->get_xml();
|
||||
}
|
||||
else
|
||||
{
|
||||
fianet_insert_log("fianet_adress_xml.php - get_xml() <br />\nAppartement is not an object of type fianet_appartment_xml");
|
||||
}
|
||||
}
|
||||
$xml .= "\t" . '</adresse>' . "\n";
|
||||
}
|
||||
return ($xml);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
class fianet_appartment_xml
|
||||
{
|
||||
var $digicode1;
|
||||
var $digicode2;
|
||||
var $escalier;
|
||||
var $etage;
|
||||
var $nporte;
|
||||
var $batiment;
|
||||
|
||||
function get_xml()
|
||||
{
|
||||
$xml = '';
|
||||
$xml .= "\t\t" . '<appartement>' . "\n";
|
||||
if ($this->digicode1 != '')
|
||||
{
|
||||
$xml .= "\t\t\t" . '<digicode1>'.clean_invalid_char($this->digicode1).'</digicode1>' . "\n";
|
||||
}
|
||||
if ($this->digicode2 != '')
|
||||
{
|
||||
$xml .= "\t\t\t" . '<digicode2>'.clean_invalid_char($this->digicode2).'</digicode2>' . "\n";
|
||||
}
|
||||
if ($this->escalier != '')
|
||||
{
|
||||
$xml .= "\t\t\t" . '<escalier>'.clean_invalid_char($this->escalier).'</escalier>' . "\n";
|
||||
}
|
||||
if ($this->etage != '')
|
||||
{
|
||||
$xml .= "\t\t\t" . '<etage>'.clean_invalid_char($this->etage).'</etage>' . "\n";
|
||||
}
|
||||
if ($this->nporte != '')
|
||||
{
|
||||
$xml .= "\t\t\t" . '<nporte>'.clean_invalid_char($this->nporte).'</nporte>' . "\n";
|
||||
}
|
||||
if ($this->batiment != '')
|
||||
{
|
||||
$xml .= "\t\t\t" . '<batiment>'.clean_invalid_char($this->batiment).'</batiment>' . "\n";
|
||||
}
|
||||
$xml .= "\t\t" . '</appartement>' . "\n";
|
||||
return ($xml);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
class fianet_billing_adress_xml extends fianet_adress_xml
|
||||
{
|
||||
var $type = 'facturation';
|
||||
|
||||
function fianet_billing_adress_xml($order = null)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
class fianet_billing_user_xml extends fianet_user_xml
|
||||
{
|
||||
var $type = 'facturation';
|
||||
|
||||
function fianet_billing_user_xml($order = null)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
class fianet_delivery_adress_xml extends fianet_adress_xml
|
||||
{
|
||||
var $type = 'livraison';
|
||||
|
||||
function fianet_delivery_adress_xml()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
class fianet_delivery_user_xml extends fianet_user_xml
|
||||
{
|
||||
var $type = 'livraison';
|
||||
|
||||
function fianet_delivery_user_xml($order = null)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
class fianet_info_order_xml
|
||||
{
|
||||
var $siteid = 0;
|
||||
var $refid = 0;
|
||||
var $montant = 0;
|
||||
var $devise = "EUR";
|
||||
var $ip;
|
||||
var $timestamp;
|
||||
var $transport;
|
||||
var $list;
|
||||
|
||||
function fianet_info_order_xml()
|
||||
{
|
||||
$this->list = new fianet_product_list_xml();
|
||||
$this->transport = new fianet_transport_xml();
|
||||
$this->siteid = FIANET_SAC_SITE_ID;
|
||||
}
|
||||
|
||||
|
||||
function get_xml()
|
||||
{
|
||||
$xml = '';
|
||||
if (!($this->siteid != "" && $this->refid != "" && $this->montant > 0 && $this->devise != ""))
|
||||
{
|
||||
fianet_insert_log("fianet_info_order_xml.php - get_xml() <br />Somes values are undefined\n");
|
||||
}
|
||||
if ($this->transport == null)
|
||||
{
|
||||
fianet_insert_log("fianet_info_order_xml.php - get_xml() <br />Transport is undefined\n");
|
||||
}
|
||||
if ($this->list == null)
|
||||
{
|
||||
fianet_insert_log("fianet_info_order_xml.php - get_xml() <br />List products is undefined\n");
|
||||
}
|
||||
$xml .= "\t" . '<infocommande>' . "\n";
|
||||
$xml .= "\t\t" . '<siteid>'.$this->siteid.'</siteid>' . "\n";
|
||||
$xml .= "\t\t" . '<refid>'.$this->refid.'</refid>' . "\n";
|
||||
$xml .= "\t\t" . '<montant devise="'.$this->devise.'">'.number_format($this->montant, 2, '.', '').'</montant>' . "\n";
|
||||
if ($this->ip != null && $this->timestamp != null)
|
||||
{
|
||||
$xml .= "\t\t" . '<ip timestamp="'.$this->timestamp.'">'.$this->ip.'</ip>' . "\n";
|
||||
}
|
||||
$xml .= $this->transport->get_xml();
|
||||
$xml .= $this->list->get_xml();
|
||||
$xml .= "\t" . '</infocommande>' . "\n";
|
||||
return ($xml);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
<?php
|
||||
|
||||
class fianet_order_xml
|
||||
{
|
||||
var $billing_user = null;
|
||||
var $billing_adress = null;
|
||||
var $info_commande = null;
|
||||
var $payment = null;
|
||||
|
||||
var $delivery_user = null;
|
||||
var $delivery_adress = null;
|
||||
|
||||
function fianet_order_xml()
|
||||
{
|
||||
$this->billing_user = new fianet_billing_user_xml();
|
||||
$this->billing_adress = new fianet_billing_adress_xml();
|
||||
$this->info_commande = new fianet_info_order_xml();
|
||||
$this->payment = new fianet_payment_xml();
|
||||
}
|
||||
|
||||
function reset()
|
||||
{
|
||||
$this->billing_user = new fianet_billing_user_xml();
|
||||
$this->delivery_user = null;
|
||||
$this->billing_adress = new fianet_billing_adress_xml();
|
||||
$this->delivery_adress = null;
|
||||
$this->info_commande = new fianet_info_order_xml();
|
||||
$this->payment = new fianet_payment_xml();
|
||||
}
|
||||
|
||||
function get_xml()
|
||||
{
|
||||
$xml = '';
|
||||
$xml .= '<control fianetmodule="'.FIANET_MODULE.'" version="'.FIANET_VERSION.'">' . "\n";
|
||||
$xml .= $this->billing_user->get_xml();
|
||||
$xml .= $this->billing_adress->get_xml();
|
||||
if ($this->delivery_user != null)
|
||||
{
|
||||
if (var_is_object_of_class($this->delivery_user, 'fianet_delivery_user_xml'))
|
||||
{
|
||||
$xml .= $this->delivery_user->get_xml();
|
||||
}
|
||||
else
|
||||
{
|
||||
fianet_insert_log("fianet_order_xml.php - get_xml() <br />\nDelivery user is not an object of type fianet_delivery_user_xml");
|
||||
}
|
||||
}
|
||||
if ($this->delivery_adress != null && ($this->info_commande->transport->type == 4 || $this->info_commande->transport->type == 5))
|
||||
{
|
||||
if (var_is_object_of_class($this->delivery_adress, 'fianet_delivery_adress_xml'))
|
||||
{
|
||||
$xml .= $this->delivery_adress->get_xml();
|
||||
}
|
||||
else
|
||||
{
|
||||
fianet_insert_log("fianet_order_xml.php - get_xml() <br />\nDelivery adress is not an object of type fianet_delivery_adress_xml");
|
||||
}
|
||||
}
|
||||
$xml .= $this->info_commande->get_xml();
|
||||
$xml .= $this->payment->get_xml();
|
||||
$xml .= '</control>';
|
||||
|
||||
save_flux_xml($xml, $this->info_commande->refid);
|
||||
return ($xml);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
class fianet_paraobject_xml
|
||||
{
|
||||
var $name;
|
||||
var $value;
|
||||
|
||||
function fianet_paraobject_xml($name, $value)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
function get_xml()
|
||||
{
|
||||
$xml = "\t". '<obj>' . "\n";
|
||||
$xml .= "\t\t". '<name>'.$this->name.'</name>' . "\n";
|
||||
$xml .= "\t\t". '<value>'.$this->value.'</value>' . "\n";
|
||||
$xml .= "\t". '</obj>' . "\n";
|
||||
return ($xml);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
<?php
|
||||
|
||||
class fianet_payment_xml
|
||||
{
|
||||
var $type;
|
||||
var $numcb;
|
||||
var $dateval;
|
||||
var $bin;
|
||||
var $bin4;
|
||||
var $bin42;
|
||||
|
||||
function fianet_payment_xml($order = null)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function set_cb_number($cb, $dateval)
|
||||
{
|
||||
if (!eregi("^[0-9]{16}$", $cb))
|
||||
{
|
||||
fianet_insert_log("fianet_payment_xml.php - set_cb_number() <br />Cb number format is invalid, must be 00001111222233334444\n");
|
||||
}
|
||||
else if (!eregi("^[0-9]{2}/[0-9]{4}$", $dateval))
|
||||
{
|
||||
fianet_insert_log("fianet_payment_xml.php - set_cb_number() <br />Validity date format is invalid, must be MM/YYYY\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
$crypt = new HashMD5();
|
||||
$this->numcb = $crypt->hash($cb);
|
||||
$this->dateval = $crypt->hash($dateval);
|
||||
}
|
||||
}
|
||||
|
||||
function get_xml()
|
||||
{
|
||||
$xml = '';
|
||||
if ($this->type != null)
|
||||
{
|
||||
$xml .= "\t".'<paiement>'."\n";
|
||||
|
||||
$xml .= "\t\t".'<type>'.$this->type.'</type>'."\n";
|
||||
if ($this->type == 'carte' || $this->type == 'paypal')
|
||||
{
|
||||
if ($this->numcb != null)
|
||||
{
|
||||
$xml .= "\t\t".'<numcb>'.$this->numcb.'</numcb>'."\n";
|
||||
}
|
||||
if ($this->dateval != null)
|
||||
{
|
||||
$xml .= "\t\t".'<dateval>'.$this->dateval.'</dateval>'."\n";
|
||||
}
|
||||
if ($this->bin != null)
|
||||
{
|
||||
$xml .= "\t\t".'<bin>'.$this->bin.'</bin>'."\n";
|
||||
}
|
||||
if ($this->bin4 != null)
|
||||
{
|
||||
$xml .= "\t\t".'<bin4>'.$this->bin4.'</bin4>'."\n";
|
||||
}
|
||||
if ($this->bin42 != null)
|
||||
{
|
||||
$xml .= "\t\t".'<bin42>'.$this->bin42.'</bin42>'."\n";
|
||||
}
|
||||
}
|
||||
$xml .= "\t".'</paiement>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
fianet_insert_log("fianet_payment_xml.php - get_xml() <br />Type is undefined\n");
|
||||
return;
|
||||
}
|
||||
return ($xml);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
class fianet_product_list_xml
|
||||
{
|
||||
var $products_list = array();
|
||||
|
||||
function fianet_product_list_xml()
|
||||
{
|
||||
}
|
||||
|
||||
function add_product($product)
|
||||
{
|
||||
if (var_is_object_of_class($product, 'fianet_product_xml'))
|
||||
{
|
||||
$this->products_list[] = $product;
|
||||
}
|
||||
else
|
||||
{
|
||||
fianet_insert_log("fianet_product_list_xml.php - add_product() <br />Data are not a valid fianet_product_xml type\n");
|
||||
}
|
||||
}
|
||||
|
||||
function get_xml()
|
||||
{
|
||||
$xml = '';
|
||||
if (count($this->products_list) > 0)
|
||||
{
|
||||
|
||||
$xml .= "\t\t". '<list nbproduit="'.$this->count_nbproduct().'">' . "\n";
|
||||
foreach ($this->products_list as $product)
|
||||
{
|
||||
$xml .= $product->get_xml();
|
||||
}
|
||||
$xml .= "\t\t". '</list>' . "\n";
|
||||
}
|
||||
return ($xml);
|
||||
}
|
||||
|
||||
function count_nbproduct()
|
||||
{
|
||||
$n = 0;
|
||||
foreach ($this->products_list as $product)
|
||||
{
|
||||
$n += $product->nb;
|
||||
}
|
||||
return ($n);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
<?php
|
||||
|
||||
class fianet_product_xml
|
||||
{
|
||||
var $type;
|
||||
var $ref;
|
||||
var $nb = 0;
|
||||
var $prixunit;
|
||||
var $name;
|
||||
|
||||
function fianet_product_xml()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function get_xml()
|
||||
{
|
||||
$xml = '';
|
||||
if ($this->name != null)
|
||||
{
|
||||
$nb = '';
|
||||
$prixunit = '';
|
||||
if ($this->type != null)
|
||||
{
|
||||
$type = ' type="'.$this->type.'"';
|
||||
}
|
||||
else
|
||||
{
|
||||
fianet_insert_log("fianet_product_xml.php - get_xml() <br />\nproduct type is missing");
|
||||
return;
|
||||
}
|
||||
if ($this->ref != null)
|
||||
{
|
||||
$ref = ' ref="'.clean_invalid_char($this->ref).'"';
|
||||
}
|
||||
else
|
||||
{
|
||||
fianet_insert_log("fianet_product_xml.php - get_xml() <br />\nproduct ref is missing");
|
||||
return;
|
||||
}
|
||||
if ($this->nb != null)
|
||||
{
|
||||
$nb = ' nb="'.$this->nb.'"';
|
||||
}
|
||||
if ($this->prixunit != null)
|
||||
{
|
||||
$prixunit = ' prixunit="'.number_format($this->prixunit, 2, '.', '').'"';
|
||||
}
|
||||
$xml .= "\t\t\t<produit$type$ref$nb$prixunit>".clean_invalid_char($this->name)."</produit>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
fianet_insert_log("fianet_product_xml.php - get_xml() <br />\nproduct name is missing");
|
||||
return;
|
||||
}
|
||||
return ($xml);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
class fianet_rnp_info_order_xml
|
||||
{
|
||||
var $siteid = 0;
|
||||
var $refid = 0;
|
||||
var $montant = 0;
|
||||
var $devise = 'EUR';
|
||||
var $transport;
|
||||
var $list;
|
||||
|
||||
function fianet_rnp_info_order_xml()
|
||||
{
|
||||
$this->list = new fianet_product_list_xml();
|
||||
$this->transport = new fianet_transport_xml();
|
||||
$this->siteid = FIANET_RNP_SITE_ID;
|
||||
}
|
||||
|
||||
function get_xml()
|
||||
{
|
||||
$xml = '';
|
||||
|
||||
if ($this->siteid == '' || $this->refid == '' || $this->montant <= 0 || $this->devise == '')
|
||||
{
|
||||
fianet_insert_log("fianet_rnp_info_order_xml.php - get_xml() <br />Somes values are undefined\n");
|
||||
}
|
||||
$xml .= "\t" . '<infocommande>' . "\n";
|
||||
$xml .= "\t\t" . '<siteid>'.$this->siteid.'</siteid>' . "\n";
|
||||
$xml .= "\t\t" . '<refid>'.$this->refid.'</refid>' . "\n";
|
||||
$xml .= "\t\t" . '<montant devise="'.$this->devise.'">'.number_format($this->montant, 2, '.', '').'</montant>' . "\n";
|
||||
$xml .= $this->transport->get_xml();
|
||||
$xml .= $this->list->get_xml();
|
||||
$xml .= "\t" . '</infocommande>' . "\n";
|
||||
return ($xml);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
<?php
|
||||
|
||||
class fianet_rnp_order_xml
|
||||
{
|
||||
var $billing_user = null;
|
||||
var $billing_adress = null;
|
||||
var $info_commande = null;
|
||||
var $wallet = null;
|
||||
|
||||
var $delivery_user = null;
|
||||
var $delivery_adress = null;
|
||||
|
||||
function fianet_rnp_order_xml()
|
||||
{
|
||||
$this->billing_user = new fianet_billing_user_xml();
|
||||
$this->billing_adress = new fianet_billing_adress_xml();
|
||||
$this->info_commande = new fianet_rnp_info_order_xml();
|
||||
$this->wallet = new fianet_rnp_wallet_xml();
|
||||
}
|
||||
|
||||
function reset()
|
||||
{
|
||||
$this->billing_user = new fianet_billing_user_xml();
|
||||
$this->delivery_user = null;
|
||||
$this->billing_adress = new fianet_billing_adress_xml();
|
||||
$this->delivery_adress = null;
|
||||
$this->info_commande = new fianet_rnp_info_order_xml();
|
||||
$this->wallet = new fianet_rnp_wallet_xml();
|
||||
}
|
||||
|
||||
function get_xml()
|
||||
{
|
||||
$xml = '';
|
||||
$xml .= '<?xml version="1.0" encoding="'. FIANET_ENCODING . '" ?>' . "\n";
|
||||
$xml .= '<control fianetmodule="'.FIANET_MODULE.'" version="'.FIANET_VERSION.'">' . "\n";
|
||||
$xml .= $this->billing_user->get_xml();
|
||||
$xml .= $this->billing_adress->get_xml();
|
||||
if ($this->delivery_user != null)
|
||||
{
|
||||
if (var_is_object_of_class($this->delivery_user, 'fianet_delivery_user_xml'))
|
||||
{
|
||||
$xml .= $this->delivery_user->get_xml();
|
||||
}
|
||||
else
|
||||
{
|
||||
fianet_insert_log("fianet_rnp_order_xml.php - get_xml() <br />\nDelivery user is not an object of type fianet_delivery_user_xml");
|
||||
}
|
||||
}
|
||||
if ($this->delivery_adress != null && ($this->info_commande->transport->type == 4 || $this->info_commande->transport->type == 5))
|
||||
{
|
||||
if (var_is_object_of_class($this->delivery_adress, 'fianet_delivery_adress_xml'))
|
||||
{
|
||||
$xml .= $this->delivery_adress->get_xml();
|
||||
}
|
||||
else
|
||||
{
|
||||
fianet_insert_log("fianet_rnp_order_xml.php - get_xml() <br />\nDelivery adress is not an object of type fianet_delivery_adress_xml");
|
||||
}
|
||||
}
|
||||
$xml .= $this->info_commande->get_xml();
|
||||
|
||||
$this->wallet->generate_wallet_crypt_data($this->info_commande->refid, $this->billing_user->nom, $this->billing_user->email, $this->info_commande->montant);
|
||||
$xml .= $this->wallet->get_xml();
|
||||
|
||||
$xml .= '</control>';
|
||||
|
||||
save_flux_xml($xml, $this->info_commande->refid);
|
||||
return ($xml);
|
||||
}
|
||||
|
||||
/*
|
||||
Cette fonction génère le formulaire de redirection vers ReceiveAndPay
|
||||
Elle prends des paramètres optionnels
|
||||
url_call : url de retour sur le site marchand
|
||||
url_sys : url de réponse des tags asynchrone pour le serveur ReceiveAndPay
|
||||
ParamCallBack : tableau associatif des données que vous souhaitez voir retourner par le serveur ReceiveAndPay sur url_sys et url_call
|
||||
typeIHM : 1 pour carte bancaire seulement, 2 pour à crédit uniquement, 3 pour les deux en même temps
|
||||
enProd : mettre à true pour rediriger vers ReceiveAndPay de production
|
||||
auto_send : si true : génère un javascript qui soumettra immédiatement le formulaire
|
||||
*/
|
||||
function get_formular($url_call = null, $url_sys = null, $ParamCallBack = array(), $typeIHM = 3, $enProd = false, $auto_send = true)
|
||||
{
|
||||
|
||||
$flux = $this->get_xml();
|
||||
$flux = clean_xml($flux);
|
||||
$flux = str_replace('"', "'", $flux);
|
||||
$flux = str_replace('&', '&amp;', $flux);
|
||||
$flux = str_replace('<', '&lt;', $flux);
|
||||
$flux = str_replace('>', '&gt;', $flux);
|
||||
$my_hashmd5 = new HashMD5();
|
||||
//$toto = html_entity_decode($flux);
|
||||
//debug($toto);
|
||||
$checksum = $my_hashmd5->hash(html_entity_decode($flux));
|
||||
|
||||
if (is_array($ParamCallBack) && count($ParamCallBack) > 0)
|
||||
{
|
||||
$XMLParam = new fianet_xml_paracallback_builder();
|
||||
foreach ($ParamCallBack as $index => $value)
|
||||
{
|
||||
$XMLParam->add_param(new fianet_paraobject_xml($index, urlencode(htmlentities($value))));
|
||||
}
|
||||
}
|
||||
|
||||
if ($enProd)
|
||||
{
|
||||
$url = URL_RNP_PROD;
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = URL_RNP_TEST;
|
||||
}
|
||||
$url .= URL_RNP_FRONTLINE;
|
||||
|
||||
$form = '';
|
||||
$form .= '<form name="RnPform" action="'.$url.'" method="post">';
|
||||
$form .= '<input type="hidden" name="MerchID" value="'. $this->info_commande->siteid .'">' . "\n";
|
||||
$form .= '<input type="hidden" name="XMLInfo" value="'. $flux .'">' . "\n";
|
||||
if ($url_call != null && $url_call != '')
|
||||
{
|
||||
$form .= '<input type="hidden" name="URLCall" value="'. $url_call .'">' . "\n";
|
||||
}
|
||||
if ($url_sys != null && $url_sys != '')
|
||||
{
|
||||
$form .= '<input type="hidden" name="URLSys" value="'. $url_sys .'">' . "\n";
|
||||
}
|
||||
if (isset($XMLParam))
|
||||
{
|
||||
$form .= '<input type="hidden" name="XMLParam" value="'.clean_xml(str_replace('"', "'", $XMLParam->get_xml())).'">' . "\n";
|
||||
}
|
||||
$form .= '<input type="hidden" name="CheckSum" value="'. $checksum .'">' . "\n";
|
||||
$form .= '<input type="hidden" name="TypeIHM" value="'. $typeIHM .'">' . "\n";
|
||||
$form .= '</form>';
|
||||
if ($auto_send)
|
||||
{
|
||||
$form .= '<script>document.RnPform.submit();</script>';
|
||||
}
|
||||
|
||||
return ($form);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
<?php
|
||||
|
||||
class fianet_rnp_wallet_xml
|
||||
{
|
||||
var $version = '1.0';
|
||||
var $datelivr = null;
|
||||
var $datecom = null;
|
||||
var $crypt = null;
|
||||
var $crypt_version = '2.0';
|
||||
|
||||
var $order_date_time_seconds = null;
|
||||
|
||||
function fianet_rnp_wallet_xml()
|
||||
{
|
||||
//$this->datecom = "2008-05-28 14:25:31";
|
||||
$this->datecom = date("Y-m-d H:i:s");
|
||||
$this->order_date_time_seconds = substr($this->datecom, -2, 2);
|
||||
}
|
||||
|
||||
function generate_wallet_crypt_data($order_id, $billing_lastname, $customer_email, $total)
|
||||
{
|
||||
$total = number_format($total, 2, '.', '');
|
||||
$this->generate_crypt_key($order_id, $billing_lastname, $customer_email, $total);
|
||||
}
|
||||
|
||||
function get_xml()
|
||||
{
|
||||
$xml = '';
|
||||
|
||||
$xml .= "\t" . '<wallet version="'.$this->version.'">' . "\n";
|
||||
$xml .= "\t\t" . '<datelivr>'.$this->datelivr.'</datelivr>' . "\n";
|
||||
$xml .= "\t\t" . '<datecom>'.$this->datecom.'</datecom>' . "\n";
|
||||
$xml .= "\t\t" . '<crypt version="'.$this->crypt_version.'">'.$this->crypt.'</crypt>' . "\n";
|
||||
$xml .= "\t" . '</wallet>' . "\n";
|
||||
|
||||
return ($xml);
|
||||
}
|
||||
|
||||
function generate_crypt_key($order_id, $billing_lastname, $customer_email, $total)
|
||||
{
|
||||
if (FIANET_ENCODING == 'UTF-8')
|
||||
{
|
||||
$billing_lastname = utf8_decode($billing_lastname);
|
||||
}
|
||||
else
|
||||
{
|
||||
$billing_lastname = $billing_lastname;
|
||||
}
|
||||
$key = FIANET_RNP_KEY;
|
||||
|
||||
$encodingKey = new EncodingKey();
|
||||
$this->crypt = $encodingKey->giveHashCode2( $key,
|
||||
$this->order_date_time_seconds,
|
||||
$customer_email,
|
||||
$order_id,
|
||||
$total,
|
||||
$billing_lastname);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
class fianet_transport_xml
|
||||
{
|
||||
var $type;
|
||||
var $nom;
|
||||
var $rapidite;
|
||||
|
||||
function fianet_transport_xml()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function get_xml()
|
||||
{
|
||||
$xml = '';
|
||||
if ($this->type == null)
|
||||
{
|
||||
fianet_insert_log("fianet_transport_xml.php - get_xml() <br />\nTransport type undefined");
|
||||
return;
|
||||
}
|
||||
if ($this->nom == null)
|
||||
{
|
||||
fianet_insert_log("fianet_transport_xml.php - get_xml() <br />\nTransport name undefined");
|
||||
return;
|
||||
}
|
||||
if ($this->rapidite == null)
|
||||
{
|
||||
fianet_insert_log("fianet_transport_xml.php - get_xml() <br />\nTransport time undefined");
|
||||
return;
|
||||
}
|
||||
$xml .= "\t\t". '<transport>' . "\n";
|
||||
|
||||
$xml .= "\t\t\t". '<type>'.$this->type.'</type>' . "\n";
|
||||
$xml .= "\t\t\t". '<nom>'.clean_invalid_char($this->nom).'</nom>' . "\n";
|
||||
$xml .= "\t\t\t". '<rapidite>'.$this->rapidite.'</rapidite>' . "\n";
|
||||
|
||||
$xml .= "\t\t". '</transport>' . "\n";
|
||||
return ($xml);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
class fianet_user_siteconso_xml
|
||||
{
|
||||
var $nb = 0;
|
||||
var $ca = 0;
|
||||
var $datepremcmd = null;
|
||||
var $datederncmd = null;
|
||||
|
||||
function fianet_user_siteconso_xml()
|
||||
{
|
||||
}
|
||||
|
||||
function get_xml()
|
||||
{
|
||||
$xml = '';
|
||||
if ($this->nb > 0)
|
||||
{
|
||||
$xml .= "\t\t" . '<siteconso>' . "\n";
|
||||
$xml .= "\t\t\t" . '<nb>'.$this->nb.'</nb>' . "\n";
|
||||
$xml .= "\t\t\t" . '<ca>'.number_format($this->ca, 2, '.', '').'</ca>' . "\n";
|
||||
$xml .= "\t\t\t" . '<datepremcmd>'.$this->datepremcmd.'</datepremcmd>' . "\n";
|
||||
$xml .= "\t\t\t" . '<datederncmd>'.$this->datederncmd.'</datederncmd>' . "\n";
|
||||
$xml .= "\t\t" . '</siteconso>' . "\n";
|
||||
}
|
||||
return ($xml);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
<?php
|
||||
|
||||
class fianet_user_xml
|
||||
{
|
||||
var $type;
|
||||
//Qualité des clients par défaut
|
||||
var $qualite = 2;
|
||||
var $titre;
|
||||
var $nom;
|
||||
var $prenom;
|
||||
var $societe;
|
||||
var $telhome;
|
||||
var $teloffice;
|
||||
var $telmobile;
|
||||
var $telfax;
|
||||
var $email;
|
||||
var $site_conso = null;
|
||||
|
||||
function set_quality_professional()
|
||||
{
|
||||
$this->qualite = 1;
|
||||
}
|
||||
|
||||
function set_quality_nonprofessional()
|
||||
{
|
||||
$this->qualite = 2;
|
||||
}
|
||||
|
||||
function get_xml()
|
||||
{
|
||||
$xml = '';
|
||||
$xml .= "\t" . '<utilisateur type="'.$this->type.'" qualite="'.$this->qualite.'">' . "\n";
|
||||
if ($this->titre != '')
|
||||
{
|
||||
if ($this->titre == 'f')
|
||||
{
|
||||
$this->titre = 'mme';
|
||||
}
|
||||
$xml .= "\t\t" . '<nom titre="'.$this->titre.'">'.clean_invalid_char($this->nom).'</nom>' . "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$xml .= "\t\t" . '<nom>'.clean_invalid_char($this->nom).'</nom>' . "\n";
|
||||
}
|
||||
$xml .= "\t\t" . '<prenom>'.clean_invalid_char($this->prenom).'</prenom>' . "\n";
|
||||
if ($this->societe != '')
|
||||
{
|
||||
$xml .= "\t\t" . '<societe>'.clean_invalid_char($this->societe).'</societe>' . "\n";
|
||||
}
|
||||
if ($this->telhome != '')
|
||||
{
|
||||
$xml .= "\t\t" . '<telhome>'.clean_invalid_char($this->telhome).'</telhome>' . "\n";
|
||||
}
|
||||
if ($this->teloffice != '')
|
||||
{
|
||||
$xml .= "\t\t" . '<teloffice>'.clean_invalid_char($this->teloffice).'</teloffice>' . "\n";
|
||||
}
|
||||
if ($this->telmobile != '')
|
||||
{
|
||||
$xml .= "\t\t" . '<telmobile>'.clean_invalid_char($this->telmobile).'</telmobile>' . "\n";
|
||||
}
|
||||
if ($this->telfax != '')
|
||||
{
|
||||
$xml .= "\t\t" . '<telfax>'.clean_invalid_char($this->telfax).'</telfax>' . "\n";
|
||||
}
|
||||
if ($this->email != '')
|
||||
{
|
||||
$xml .= "\t\t" . '<email>'.clean_invalid_char($this->email).'</email>' . "\n";
|
||||
}
|
||||
if ($this->site_conso != null)
|
||||
{
|
||||
$xml .= $this->site_conso->get_xml();
|
||||
}
|
||||
$xml .= "\t" . '</utilisateur>' . "\n";
|
||||
|
||||
return ($xml);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
class fianet_xml_paracallback_builder
|
||||
{
|
||||
var $param_list = array();
|
||||
|
||||
function fianet_xml_paracallback_builder()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function add_param($param)
|
||||
{
|
||||
if (var_is_object_of_class($param, 'fianet_paraobject_xml'))
|
||||
{
|
||||
$this->param_list[] = $param;
|
||||
}
|
||||
else
|
||||
{
|
||||
fianet_insert_log("Erreur : le paramètre n'est pas un objet fianet_paraobject_xml mais un objet : ".get_class($param)."<br>");
|
||||
}
|
||||
}
|
||||
|
||||
function get_xml()
|
||||
{
|
||||
$xml = '';
|
||||
|
||||
if (count($this->param_list) > 0)
|
||||
{
|
||||
$xml .= '<?xml version="1.0" encoding="'.FIANET_ENCODING.'" ?>
|
||||
<ParamCBack>' . "\n";
|
||||
|
||||
foreach ($this->param_list as $param)
|
||||
{
|
||||
$xml .= $param->get_xml();
|
||||
}
|
||||
|
||||
$xml .= '</ParamCBack>' . "\n";
|
||||
}
|
||||
|
||||
return($xml);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user