No regular expressions were active.
1 |
|
<?php
|
|
1 |
|
<?php
|
2 |
|
|
|
2 |
|
|
3 |
|
/*********
**********
**********
**********
**********
**********
**********
******
|
|
3 |
|
/*********
**********
**********
**********
**********
**********
**********
******
|
4 |
|
*
D
olphin Sma
rt Communi
ty Builder
|
|
4 |
|
*
D
olphin Sma
rt Communi
ty Builder
|
5 |
|
*
---------
--------
|
|
5 |
|
*
---------
--------
|
6 |
|
* begi
n
: M
on Mar 23
2006
|
|
6 |
|
* begi
n
: M
on Mar 23
2006
|
7 |
|
* copy
right
: (
C) 2006 Bo
onEx Group
|
|
7 |
|
* copy
right
: (
C) 2006 Bo
onEx Group
|
8 |
|
* webs
ite
: h
ttp://www.
boonex.com
/
|
|
8 |
|
* webs
ite
: h
ttp://www.
boonex.com
/
|
9 |
|
* This fil
e is part
of Dolphin
- Smart C
ommunity B
uilder
|
|
9 |
|
* This fil
e is part
of Dolphin
- Smart C
ommunity B
uilder
|
10 |
|
*
|
|
10 |
|
*
|
11 |
|
* Dolphin
is free so
ftware. Th
is work is
licensed
under a Cr
eative Com
mons Attri
bution 3.0
License.
|
|
11 |
|
* Dolphin
is free so
ftware. Th
is work is
licensed
under a Cr
eative Com
mons Attri
bution 3.0
License.
|
12 |
|
* http://c
reativecom
mons.org/l
icenses/by
/3.0/
|
|
12 |
|
* http://c
reativecom
mons.org/l
icenses/by
/3.0/
|
13 |
|
*
|
|
13 |
|
*
|
14 |
|
* Dolphin
is distrib
uted in th
e hope tha
t it will
be useful,
but WITHO
UT ANY WAR
RANTY;
|
|
14 |
|
* Dolphin
is distrib
uted in th
e hope tha
t it will
be useful,
but WITHO
UT ANY WAR
RANTY;
|
15 |
|
* without
even the i
mplied war
ranty of
MERCHANTAB
ILITY or F
ITNESS FOR
A PARTICU
LAR PURPOS
E.
|
|
15 |
|
* without
even the i
mplied war
ranty of
MERCHANTAB
ILITY or F
ITNESS FOR
A PARTICU
LAR PURPOS
E.
|
16 |
|
* See the
Creative C
ommons Att
ribution 3
.0 License
for more
details.
|
|
16 |
|
* See the
Creative C
ommons Att
ribution 3
.0 License
for more
details.
|
17 |
|
* You shou
ld have re
ceived a c
opy of the
Creative
Commons At
tribution
3.0 Licens
e along wi
th Dolphin
,
|
|
17 |
|
* You shou
ld have re
ceived a c
opy of the
Creative
Commons At
tribution
3.0 Licens
e along wi
th Dolphin
,
|
18 |
|
* see lice
nse.txt fi
le; if not
, write to
marketing
@boonex.co
m
|
|
18 |
|
* see lice
nse.txt fi
le; if not
, write to
marketing
@boonex.co
m
|
19 |
|
**********
**********
**********
**********
**********
**********
**********
*****/
|
|
19 |
|
**********
**********
**********
**********
**********
**********
**********
*****/
|
20 |
|
|
|
20 |
|
|
21 |
|
require_on
ce( 'heade
r.inc.php'
);
|
|
21 |
|
require_on
ce( 'heade
r.inc.php'
);
|
22 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'd
b.inc.php'
);
|
|
22 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'd
b.inc.php'
);
|
23 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'u
tils.inc.p
hp' );
|
|
23 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'u
tils.inc.p
hp' );
|
24 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'p
rofiles.in
c.php' );
|
|
24 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'p
rofiles.in
c.php' );
|
25 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 's
dating.inc
.php' );
|
|
25 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 's
dating.inc
.php' );
|
26 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'm
embership_
levels.inc
.php' );
|
|
26 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'm
embership_
levels.inc
.php' );
|
27 |
|
|
|
27 |
|
|
28 |
|
$separator
= '|';
|
|
28 |
|
$separator
= '|';
|
29 |
|
$dir['chec
kout']
=
$dir['root
']
.
'checkout/
';
|
|
29 |
|
$dir['chec
kout']
=
BX_DIRECTO
RY_PATH_RO
OT
.
'checkout/
';
|
30 |
|
$site['che
ckout'] =
$site['url
'] . 'chec
kout/';
|
|
30 |
|
$site['che
ckout'] =
$site['url
'] . 'chec
kout/';
|
31 |
|
|
|
31 |
|
|
32 |
|
$memberID
= (int)$_C
OOKIE['mem
berID'];
|
|
32 |
|
$memberID
= (int)$_C
OOKIE['mem
berID'];
|
33 |
|
$currency_
code = get
Param( 'cu
rrency_cod
e' );
|
|
33 |
|
$currency_
code = get
Param( 'cu
rrency_cod
e' );
|
34 |
|
$enable_re
curring =
getParam(
'enable_re
curring' )
== 'on';
|
|
34 |
|
$enable_re
curring =
getParam(
'enable_re
curring' )
== 'on';
|
35 |
|
|
|
35 |
|
|
36 |
|
$cryptKey
= 'secret_
string';
|
|
36 |
|
$cryptKey
= 'secret_
string';
|
37 |
|
|
|
37 |
|
|
38 |
|
/**
|
|
38 |
|
/**
|
39 |
|
* Implode
s data arr
ay key ele
ments usin
g global s
eparator
|
|
39 |
|
* Implode
s data arr
ay key ele
ments usin
g global s
eparator
|
40 |
|
*
|
|
40 |
|
*
|
41 |
|
* @param
array $dat
a
- array wi
th transac
tion data
|
|
41 |
|
* @param
array $dat
a
- array wi
th transac
tion data
|
42 |
|
*
|
|
42 |
|
*
|
43 |
|
* @return
string
- imploded
string
|
|
43 |
|
* @return
string
- imploded
string
|
44 |
|
*
|
|
44 |
|
*
|
45 |
|
*
|
|
45 |
|
*
|
46 |
|
*/
|
|
46 |
|
*/
|
47 |
|
function t
ransDataTo
String( $d
ata )
|
|
47 |
|
function t
ransDataTo
String( $d
ata )
|
48 |
|
{
|
|
48 |
|
{
|
49 |
|
global
$separato
r;
|
|
49 |
|
global
$separato
r;
|
50 |
|
|
|
50 |
|
|
51 |
|
$res =
$data['me
mberID'] .
$separato
r;
|
|
51 |
|
$res =
$data['me
mberID'] .
$separato
r;
|
52 |
|
$res .
= $data['a
ction'] .
$separator
;
|
|
52 |
|
$res .
= $data['a
ction'] .
$separator
;
|
53 |
|
$res .
= $data['a
mount'] .
$separator
;
|
|
53 |
|
$res .
= $data['a
mount'] .
$separator
;
|
54 |
|
$res .
= $data['c
ryptedAmou
nt'] . $se
parator;
|
|
54 |
|
$res .
= $data['c
ryptedAmou
nt'] . $se
parator;
|
55 |
|
$res .
= $data['c
urrency']
. $separat
or;
|
|
55 |
|
$res .
= $data['c
urrency']
. $separat
or;
|
56 |
|
$res .
= $data['d
ata'] . $s
eparator;
|
|
56 |
|
$res .
= $data['d
ata'] . $s
eparator;
|
57 |
|
$res .
= $data['c
ryptedData
'] . $sepa
rator;
|
|
57 |
|
$res .
= $data['c
ryptedData
'] . $sepa
rator;
|
58 |
|
$res .
= $data['t
ranID'];
|
|
58 |
|
$res .
= $data['t
ranID'];
|
59 |
|
|
|
59 |
|
|
60 |
|
return
$res;
|
|
60 |
|
return
$res;
|
61 |
|
}
|
|
61 |
|
}
|
62 |
|
|
|
62 |
|
|
63 |
|
/**
|
|
63 |
|
/**
|
64 |
|
* Explode
s string i
nto data a
rray using
global se
parator
|
|
64 |
|
* Explode
s string i
nto data a
rray using
global se
parator
|
65 |
|
*
|
|
65 |
|
*
|
66 |
|
* @param
string $st
ring
- string t
o explode
|
|
66 |
|
* @param
string $st
ring
- string t
o explode
|
67 |
|
*
|
|
67 |
|
*
|
68 |
|
* @return
array
- exploded
associati
ve array
|
|
68 |
|
* @return
array
- exploded
associati
ve array
|
69 |
|
*
|
|
69 |
|
*
|
70 |
|
*
|
|
70 |
|
*
|
71 |
|
*/
|
|
71 |
|
*/
|
72 |
|
function t
ransString
ToData( $s
tring )
|
|
72 |
|
function t
ransString
ToData( $s
tring )
|
73 |
|
{
|
|
73 |
|
{
|
74 |
|
global
$separato
r;
|
|
74 |
|
global
$separato
r;
|
75 |
|
|
|
75 |
|
|
76 |
|
$arr =
explode(
$separator
, $string
);
|
|
76 |
|
$arr =
explode(
$separator
, $string
);
|
77 |
|
$res =
array();
|
|
77 |
|
$res =
array();
|
78 |
|
$res['
memberID']
= $arr[0]
;
|
|
78 |
|
$res['
memberID']
= $arr[0]
;
|
79 |
|
$res['
action'] =
$arr[1];
|
|
79 |
|
$res['
action'] =
$arr[1];
|
80 |
|
$res['
amount'] =
$arr[2];
|
|
80 |
|
$res['
amount'] =
$arr[2];
|
81 |
|
$res['
cryptedAmo
unt'] = $a
rr[3];
|
|
81 |
|
$res['
cryptedAmo
unt'] = $a
rr[3];
|
82 |
|
$res['
currency']
= $arr[4]
;
|
|
82 |
|
$res['
currency']
= $arr[4]
;
|
83 |
|
$res['
data'] = $
arr[5];
|
|
83 |
|
$res['
data'] = $
arr[5];
|
84 |
|
$res['
cryptedDat
a'] = $arr
[6];
|
|
84 |
|
$res['
cryptedDat
a'] = $arr
[6];
|
85 |
|
$res['
tranID'] =
$arr[7];
|
|
85 |
|
$res['
tranID'] =
$arr[7];
|
86 |
|
|
|
86 |
|
|
87 |
|
return
$res;
|
|
87 |
|
return
$res;
|
88 |
|
}
|
|
88 |
|
}
|
89 |
|
|
|
89 |
|
|
90 |
|
/**
|
|
90 |
|
/**
|
91 |
|
* Encodes
data stri
ng to pass
it throug
h checkout
system
|
|
91 |
|
* Encodes
data stri
ng to pass
it throug
h checkout
system
|
92 |
|
*
|
|
92 |
|
*
|
93 |
|
* @param
string $st
ring
- string t
o encode
|
|
93 |
|
* @param
string $st
ring
- string t
o encode
|
94 |
|
*
|
|
94 |
|
*
|
95 |
|
* @return
string
- encoded
string
|
|
95 |
|
* @return
string
- encoded
string
|
96 |
|
*
|
|
96 |
|
*
|
97 |
|
*
|
|
97 |
|
*
|
98 |
|
*/
|
|
98 |
|
*/
|
99 |
|
function e
ncodeStrin
g( $string
)
|
|
99 |
|
function e
ncodeStrin
g( $string
)
|
100 |
|
{
|
|
100 |
|
{
|
101 |
|
return
urlencode
( base64_e
ncode( $st
ring ) );
|
|
101 |
|
return
urlencode
( base64_e
ncode( $st
ring ) );
|
102 |
|
}
|
|
102 |
|
}
|
103 |
|
|
|
103 |
|
|
104 |
|
/**
|
|
104 |
|
/**
|
105 |
|
* Decodes
data stri
ng receive
d from che
ckout syst
em
|
|
105 |
|
* Decodes
data stri
ng receive
d from che
ckout syst
em
|
106 |
|
*
|
|
106 |
|
*
|
107 |
|
* @param
string $st
ring
- string t
o decode
|
|
107 |
|
* @param
string $st
ring
- string t
o decode
|
108 |
|
*
|
|
108 |
|
*
|
109 |
|
* @return
string
- decoded
string
|
|
109 |
|
* @return
string
- decoded
string
|
110 |
|
*
|
|
110 |
|
*
|
111 |
|
*
|
|
111 |
|
*
|
112 |
|
*/
|
|
112 |
|
*/
|
113 |
|
function d
ecodeStrin
g( $string
)
|
|
113 |
|
function d
ecodeStrin
g( $string
)
|
114 |
|
{
|
|
114 |
|
{
|
115 |
|
return
base64_de
code( urld
ecode( $st
ring ) );
|
|
115 |
|
return
base64_de
code( urld
ecode( $st
ring ) );
|
116 |
|
}
|
|
116 |
|
}
|
117 |
|
|
|
117 |
|
|
118 |
|
/**
|
|
118 |
|
/**
|
119 |
|
* Returns
URL where
member sh
ould be di
rected aft
er payment
completio
n
|
|
119 |
|
* Returns
URL where
member sh
ould be di
rected aft
er payment
completio
n
|
120 |
|
*
|
|
120 |
|
*
|
121 |
|
* @param
string $ch
eckoutActi
on
- payment
type actio
n (e.g mem
ership, cr
edits, etc
)
|
|
121 |
|
* @param
string $ch
eckoutActi
on
- payment
type actio
n (e.g mem
ership, cr
edits, etc
)
|
122 |
|
* @param
string $da
ta
- payment
action dat
a (e.g. me
mbership I
D or event
ID)
|
|
122 |
|
* @param
string $da
ta
- payment
action dat
a (e.g. me
mbership I
D or event
ID)
|
123 |
|
*
|
|
123 |
|
*
|
124 |
|
* @return
string
- return U
RL
|
|
124 |
|
* @return
string
- return U
RL
|
125 |
|
*
|
|
125 |
|
*
|
126 |
|
*
|
|
126 |
|
*
|
127 |
|
*/
|
|
127 |
|
*/
|
128 |
|
function r
eturnURLBy
Action( $c
heckoutAct
ion, $data
)
|
|
128 |
|
function r
eturnURLBy
Action( $c
heckoutAct
ion, $data
)
|
129 |
|
{
|
|
129 |
|
{
|
130 |
|
global
$site;
|
|
130 |
|
global
$site;
|
131 |
|
|
|
131 |
|
|
132 |
|
switch
( $checko
utAction )
|
|
132 |
|
switch
( $checko
utAction )
|
133 |
|
{
|
|
133 |
|
{
|
134 |
|
ca
se 'member
ship':
|
|
134 |
|
ca
se 'member
ship':
|
135 |
|
return "
{$site['ur
l']}member
ship.php";
|
|
135 |
|
return "
{$site['ur
l']}member
ship.php";
|
136 |
|
ca
se 'speedd
ating':
|
|
136 |
|
ca
se 'speedd
ating':
|
137 |
|
return "
{$site['ur
l']}events
.php?actio
n=show_inf
o&event_id
={$data}";
|
|
137 |
|
return "
{$site['ur
l']}events
.php?actio
n=show_inf
o&event_id
={$data}";
|
138 |
|
ca
se 'profil
es':
|
|
138 |
|
ca
se 'profil
es':
|
139 |
|
return "
{$site['ur
l']}result
.php";
|
|
139 |
|
return "
{$site['ur
l']}result
.php";
|
140 |
|
de
fault:
|
|
140 |
|
de
fault:
|
141 |
|
return '
';
|
|
141 |
|
return '
';
|
142 |
|
}
|
|
142 |
|
}
|
143 |
|
}
|
|
143 |
|
}
|
144 |
|
|
|
144 |
|
|
145 |
|
/**
|
|
145 |
|
/**
|
146 |
|
* Returns
transacti
on descrip
tion
|
|
146 |
|
* Returns
transacti
on descrip
tion
|
147 |
|
*
|
|
147 |
|
*
|
148 |
|
* @param
string $ch
eckoutActi
on
- payment
type actio
n (e.g mem
ership, cr
edits, etc
)
|
|
148 |
|
* @param
string $ch
eckoutActi
on
- payment
type actio
n (e.g mem
ership, cr
edits, etc
)
|
149 |
|
* @param
string $da
ta
- payment
action dat
a (e.g. me
mbership I
D or event
ID)
|
|
149 |
|
* @param
string $da
ta
- payment
action dat
a (e.g. me
mbership I
D or event
ID)
|
150 |
|
* @param
bool $lang
uageParse
- indicate
s if descr
iption sho
uld be lan
guage-pars
ed
|
|
150 |
|
* @param
bool $lang
uageParse
- indicate
s if descr
iption sho
uld be lan
guage-pars
ed
|
151 |
|
*
|
|
151 |
|
*
|
152 |
|
* @return
string
- return U
RL
|
|
152 |
|
* @return
string
- return U
RL
|
153 |
|
*
|
|
153 |
|
*
|
154 |
|
*
|
|
154 |
|
*
|
155 |
|
*/
|
|
155 |
|
*/
|
156 |
|
function r
eturnDescB
yAction( $
checkoutAc
tion, $dat
a, $langua
geParse )
|
|
156 |
|
function r
eturnDescB
yAction( $
checkoutAc
tion, $dat
a, $langua
geParse )
|
157 |
|
{
|
|
157 |
|
{
|
158 |
|
switch
( $checko
utAction )
|
|
158 |
|
switch
( $checko
utAction )
|
159 |
|
{
|
|
159 |
|
{
|
160 |
|
ca
se 'member
ship':
|
|
160 |
|
ca
se 'member
ship':
|
161 |
|
$members
hipArr = g
etMembersh
ipInfo( $d
ata );
|
|
161 |
|
$members
hipArr = g
etMembersh
ipInfo( $d
ata );
|
162 |
|
if ( $la
nguagePars
e )
|
|
162 |
|
if ( $la
nguagePars
e )
|
163 |
|
retu
rn _t('_Me
mbership p
urchase')
. ' - ' .
$membershi
pArr['Name
'];
|
|
163 |
|
retu
rn _t('_Me
mbership p
urchase')
. ' - ' .
$membershi
pArr['Name
'];
|
164 |
|
else
|
|
164 |
|
else
|
165 |
|
retu
rn 'Member
ship purch
ase - ' .
$membershi
pArr['Name
'];
|
|
165 |
|
retu
rn 'Member
ship purch
ase - ' .
$membershi
pArr['Name
'];
|
166 |
|
ca
se 'speedd
ating':
|
|
166 |
|
ca
se 'speedd
ating':
|
167 |
|
$eventAr
r = db_arr
( 'SELECT
`Title` FR
OM `SDatin
gEvents` W
HERE `ID`
= '. (int)
$data );
|
|
167 |
|
$eventAr
r = db_arr
( 'SELECT
`Title` FR
OM `SDatin
gEvents` W
HERE `ID`
= '. (int)
$data );
|
168 |
|
if ( $la
nguagePars
e )
|
|
168 |
|
if ( $la
nguagePars
e )
|
169 |
|
retu
rn _t('_Sp
eedDating
ticket pur
chase') .
' - ' . $e
ventArr['T
itle'];
|
|
169 |
|
retu
rn _t('_Sp
eedDating
ticket pur
chase') .
' - ' . $e
ventArr['T
itle'];
|
170 |
|
else
|
|
170 |
|
else
|
171 |
|
retu
rn 'SpeedD
ating tick
et purchas
e - ' . $e
ventArr['T
itle'];
|
|
171 |
|
retu
rn 'SpeedD
ating tick
et purchas
e - ' . $e
ventArr['T
itle'];
|
172 |
|
ca
se 'profil
es':
|
|
172 |
|
ca
se 'profil
es':
|
173 |
|
if ( $la
nguagePars
e )
|
|
173 |
|
if ( $la
nguagePars
e )
|
174 |
|
retu
rn _t('_Pr
ofiles pur
chase') .
' - ' . $d
ata;
|
|
174 |
|
retu
rn _t('_Pr
ofiles pur
chase') .
' - ' . $d
ata;
|
175 |
|
else
|
|
175 |
|
else
|
176 |
|
retu
rn 'Profil
es purchas
e - ' . $d
ata;
|
|
176 |
|
retu
rn 'Profil
es purchas
e - ' . $d
ata;
|
177 |
|
de
fault:
|
|
177 |
|
de
fault:
|
178 |
|
return '
';
|
|
178 |
|
return '
';
|
179 |
|
}
|
|
179 |
|
}
|
180 |
|
}
|
|
180 |
|
}
|
181 |
|
|
|
181 |
|
|
182 |
|
/**
|
|
182 |
|
/**
|
183 |
|
* Puts in
itial tran
saction da
ta into th
e database
|
|
183 |
|
* Puts in
itial tran
saction da
ta into th
e database
|
184 |
|
*
|
|
184 |
|
*
|
185 |
|
* @param
array $che
ckoutData
- transact
ion data a
rray
|
|
185 |
|
* @param
array $che
ckoutData
- transact
ion data a
rray
|
186 |
|
* (
'checkout_
action',
- action f
or which t
ransaction
need to b
e created
|
|
186 |
|
* (
'checkout_
action',
- action f
or which t
ransaction
need to b
e created
|
187 |
|
*
'amount',
- payment
sum
|
|
187 |
|
*
'amount',
- payment
sum
|
188 |
|
*
'data',
- action s
pecific da
ta
|
|
188 |
|
*
'data',
- action s
pecific da
ta
|
189 |
|
*
'descripti
on'
- transact
ion descri
ption
|
|
189 |
|
*
'descripti
on'
- transact
ion descri
ption
|
190 |
|
* )
|
|
190 |
|
* )
|
191 |
|
*
|
|
191 |
|
*
|
192 |
|
* @param
int $membe
rID
- initiati
ng member
ID
|
|
192 |
|
* @param
int $membe
rID
- initiati
ng member
ID
|
193 |
|
* @param
int $provi
derID
- payment
provider I
D
|
|
193 |
|
* @param
int $provi
derID
- payment
provider I
D
|
194 |
|
*
|
|
194 |
|
*
|
195 |
|
* @return
int/bool
- ID of in
itiated tr
ansaction
on success
, false ot
herwise
|
|
195 |
|
* @return
int/bool
- ID of in
itiated tr
ansaction
on success
, false ot
herwise
|
196 |
|
*
|
|
196 |
|
*
|
197 |
|
*
|
|
197 |
|
*
|
198 |
|
*/
|
|
198 |
|
*/
|
199 |
|
function i
nitiateTra
nsaction(
$checkoutD
ata, $memb
erID, $pro
viderID )
|
|
199 |
|
function i
nitiateTra
nsaction(
$checkoutD
ata, $memb
erID, $pro
viderID )
|
200 |
|
{
|
|
200 |
|
{
|
201 |
|
global
$MySQL;
|
|
201 |
|
global
$MySQL;
|
202 |
|
global
$cryptKey
;
|
|
202 |
|
global
$cryptKey
;
|
203 |
|
global
$currency
_code;
|
|
203 |
|
global
$currency
_code;
|
204 |
|
|
|
204 |
|
|
205 |
|
// arg
uments val
idation
|
|
205 |
|
// arg
uments val
idation
|
206 |
|
$provi
derID = (i
nt)$provid
erID;
|
|
206 |
|
$provi
derID = (i
nt)$provid
erID;
|
207 |
|
$membe
rID = (int
)$memberID
;
|
|
207 |
|
$membe
rID = (int
)$memberID
;
|
208 |
|
|
|
208 |
|
|
209 |
|
$trans
actionData
['memberID
'] = $memb
erID;
|
|
209 |
|
$trans
actionData
['memberID
'] = $memb
erID;
|
210 |
|
$trans
actionData
['action']
= $checko
utData['ch
eckout_act
ion'];
|
|
210 |
|
$trans
actionData
['action']
= $checko
utData['ch
eckout_act
ion'];
|
211 |
|
$trans
actionData
['amount']
= sprintf
( "%.2f",
(float)$ch
eckoutData
['amount']
);
|
|
211 |
|
$trans
actionData
['amount']
= sprintf
( "%.2f",
(float)$ch
eckoutData
['amount']
);
|
212 |
|
$trans
actionData
['cryptedA
mount'] =
crypt( $tr
ansactionD
ata['amoun
t'], $cryp
tKey );
|
|
212 |
|
$trans
actionData
['cryptedA
mount'] =
crypt( $tr
ansactionD
ata['amoun
t'], $cryp
tKey );
|
213 |
|
$trans
actionData
['currency
'] = $curr
ency_code;
|
|
213 |
|
$trans
actionData
['currency
'] = $curr
ency_code;
|
214 |
|
$trans
actionData
['data'] =
$checkout
Data['data
'];
|
|
214 |
|
$trans
actionData
['data'] =
$checkout
Data['data
'];
|
215 |
|
$trans
actionData
['cryptedD
ata'] = cr
ypt( $tran
sactionDat
a['data'],
$cryptKey
);
|
|
215 |
|
$trans
actionData
['cryptedD
ata'] = cr
ypt( $tran
sactionDat
a['data'],
$cryptKey
);
|
216 |
|
list($
usec, $sec
) = explod
e(' ', mic
rotime());
|
|
216 |
|
list($
usec, $sec
) = explod
e(' ', mic
rotime());
|
217 |
|
srand(
$usec + $
sec );
|
|
217 |
|
srand(
$usec + $
sec );
|
218 |
|
$trans
actionData
['tranID']
= time()
. rand(100
0, 9999);
|
|
218 |
|
$trans
actionData
['tranID']
= time()
. rand(100
0, 9999);
|
219 |
|
|
|
219 |
|
|
220 |
|
$trans
actionStri
ng = trans
DataToStri
ng( $trans
actionData
);
|
|
220 |
|
$trans
actionStri
ng = trans
DataToStri
ng( $trans
actionData
);
|
221 |
|
$trans
actionDesc
= process
_db_input(
$checkout
Data['desc
ription'],
0, 1 );
|
|
221 |
|
$trans
actionDesc
= process
_db_input(
$checkout
Data['desc
ription'],
0, 1 );
|
222 |
|
$res =
db_res( "
INSERT INT
O `Transac
tions` SET
|
|
222 |
|
$res =
db_res( "
INSERT INT
O `Transac
tions` SET
|
223 |
|
`IDMem
ber` = {$m
emberID},
|
|
223 |
|
`IDMem
ber` = {$m
emberID},
|
224 |
|
`IDPro
vider` = {
$providerI
D},
|
|
224 |
|
`IDPro
vider` = {
$providerI
D},
|
225 |
|
`gtwTr
ansactionI
D` = '{$tr
ansactionD
ata['tranI
D']}',
|
|
225 |
|
`gtwTr
ansactionI
D` = '{$tr
ansactionD
ata['tranI
D']}',
|
226 |
|
`Date`
= NOW(),
|
|
226 |
|
`Date`
= NOW(),
|
227 |
|
`Amoun
t` = {$tra
nsactionDa
ta['amount
']},
|
|
227 |
|
`Amoun
t` = {$tra
nsactionDa
ta['amount
']},
|
228 |
|
`Curre
ncy` = '{$
transactio
nData['cur
rency']}',
|
|
228 |
|
`Curre
ncy` = '{$
transactio
nData['cur
rency']}',
|
229 |
|
`Statu
s` = 'pend
ing',
|
|
229 |
|
`Statu
s` = 'pend
ing',
|
230 |
|
`Data`
= '{$tran
sactionStr
ing}',
|
|
230 |
|
`Data`
= '{$tran
sactionStr
ing}',
|
231 |
|
`Descr
iption` =
'{$transac
tionDesc}'
" );
|
|
231 |
|
`Descr
iption` =
'{$transac
tionDesc}'
" );
|
232 |
|
if ( $
res && mys
ql_affecte
d_rows( $M
ySQL->link
) > 0 )
|
|
232 |
|
if ( $
res && mys
ql_affecte
d_rows( $M
ySQL->link
) > 0 )
|
233 |
|
{
|
|
233 |
|
{
|
234 |
|
re
turn mysql
_insert_id
( $MySQL->
link );
|
|
234 |
|
re
turn mysql
_insert_id
( $MySQL->
link );
|
235 |
|
}
|
|
235 |
|
}
|
236 |
|
else
|
|
236 |
|
else
|
237 |
|
re
turn false
;
|
|
237 |
|
re
turn false
;
|
238 |
|
}
|
|
238 |
|
}
|
239 |
|
|
|
239 |
|
|
240 |
|
/**
|
|
240 |
|
/**
|
241 |
|
* Updates
transacti
on state a
nd data in
the datab
ase
|
|
241 |
|
* Updates
transacti
on state a
nd data in
the datab
ase
|
242 |
|
*
|
|
242 |
|
*
|
243 |
|
* @param
int $local
TranID
- transact
ion ID in
the databa
se
|
|
243 |
|
* @param
int $local
TranID
- transact
ion ID in
the databa
se
|
244 |
|
* @param
string $gt
wTranID
- payment
gateway tr
ansaction
identifier
|
|
244 |
|
* @param
string $gt
wTranID
- payment
gateway tr
ansaction
identifier
|
245 |
|
* @param
bool $appr
oved
- indicate
s if trans
action was
successfu
l
|
|
245 |
|
* @param
bool $appr
oved
- indicate
s if trans
action was
successfu
l
|
246 |
|
* @param
string $no
te
- customer
note for
the transa
ction
|
|
246 |
|
* @param
string $no
te
- customer
note for
the transa
ction
|
247 |
|
*
|
|
247 |
|
*
|
248 |
|
* @return
bool
- true on
success, f
alse other
wise
|
|
248 |
|
* @return
bool
- true on
success, f
alse other
wise
|
249 |
|
*
|
|
249 |
|
*
|
250 |
|
*
|
|
250 |
|
*
|
251 |
|
*/
|
|
251 |
|
*/
|
252 |
|
function f
inishTrans
action( $l
ocalTranID
, $gtwTran
ID, $appro
ved = true
, $note =
'' )
|
|
252 |
|
function f
inishTrans
action( $l
ocalTranID
, $gtwTran
ID, $appro
ved = true
, $note =
'' )
|
253 |
|
{
|
|
253 |
|
{
|
254 |
|
global
$MySQL;
|
|
254 |
|
global
$MySQL;
|
255 |
|
|
|
255 |
|
|
256 |
|
// arg
uments val
idation
|
|
256 |
|
// arg
uments val
idation
|
257 |
|
$local
TranID = (
int)$local
TranID;
|
|
257 |
|
$local
TranID = (
int)$local
TranID;
|
258 |
|
|
|
258 |
|
|
259 |
|
$gtwTr
anID = pro
cess_db_in
put( $gtwT
ranID );
|
|
259 |
|
$gtwTr
anID = pro
cess_db_in
put( $gtwT
ranID );
|
260 |
|
$note
= process_
db_input(
$note );
|
|
260 |
|
$note
= process_
db_input(
$note );
|
261 |
|
$statu
s = ($appr
oved ? 'ap
proved' :
'declined'
);
|
|
261 |
|
$statu
s = ($appr
oved ? 'ap
proved' :
'declined'
);
|
262 |
|
|
|
262 |
|
|
263 |
|
$res =
db_res( "
UPDATE `Tr
ansactions
` SET
|
|
263 |
|
$res =
db_res( "
UPDATE `Tr
ansactions
` SET
|
264 |
|
`Statu
s` = '{$st
atus}',
|
|
264 |
|
`Statu
s` = '{$st
atus}',
|
265 |
|
`Date`
= NOW(),
|
|
265 |
|
`Date`
= NOW(),
|
266 |
|
`gtwTr
ansactionI
D` = '{$gt
wTranID}',
|
|
266 |
|
`gtwTr
ansactionI
D` = '{$gt
wTranID}',
|
267 |
|
`Note`
= '{$note
}'
|
|
267 |
|
`Note`
= '{$note
}'
|
268 |
|
WHERE `ID`
= {$local
TranID}
|
|
268 |
|
WHERE `ID`
= {$local
TranID}
|
269 |
|
AND `S
tatus` = '
pending'"
);
|
|
269 |
|
AND `S
tatus` = '
pending'"
);
|
270 |
|
if ( $
res && mys
ql_affecte
d_rows( $M
ySQL->link
) > 0 )
|
|
270 |
|
if ( $
res && mys
ql_affecte
d_rows( $M
ySQL->link
) > 0 )
|
271 |
|
{
|
|
271 |
|
{
|
272 |
|
re
turn true;
|
|
272 |
|
re
turn true;
|
273 |
|
}
|
|
273 |
|
}
|
274 |
|
else
|
|
274 |
|
else
|
275 |
|
re
turn false
;
|
|
275 |
|
re
turn false
;
|
276 |
|
}
|
|
276 |
|
}
|
277 |
|
|
|
277 |
|
|
278 |
|
/**
|
|
278 |
|
/**
|
279 |
|
* Perform
s script p
urchase ac
tions for
specified
transactio
n
|
|
279 |
|
* Perform
s script p
urchase ac
tions for
specified
transactio
n
|
280 |
|
*
|
|
280 |
|
*
|
281 |
|
* @param
int $local
TranID
- transact
ion ID in
the databa
se
|
|
281 |
|
* @param
int $local
TranID
- transact
ion ID in
the databa
se
|
282 |
|
* @param
int $resul
t
- purchase
result fr
om checkou
t file
|
|
282 |
|
* @param
int $resul
t
- purchase
result fr
om checkou
t file
|
283 |
|
*
(it coul
d be chang
ed inside)
|
|
283 |
|
*
(it coul
d be chang
ed inside)
|
284 |
|
*
|
|
284 |
|
*
|
285 |
|
* @return
bool
- true on
success, f
alse other
wise
|
|
285 |
|
* @return
bool
- true on
success, f
alse other
wise
|
286 |
|
*
|
|
286 |
|
*
|
287 |
|
*
|
|
287 |
|
*
|
288 |
|
*/
|
|
288 |
|
*/
|
289 |
|
function p
urchaseTra
nsaction(
$localTran
ID, &$resu
lt )
|
|
289 |
|
function p
urchaseTra
nsaction(
$localTran
ID, &$resu
lt )
|
290 |
|
{
|
|
290 |
|
{
|
291 |
|
// arg
uments val
idation
|
|
291 |
|
// arg
uments val
idation
|
292 |
|
$local
TranID = (
int)$local
TranID;
|
|
292 |
|
$local
TranID = (
int)$local
TranID;
|
293 |
|
|
|
293 |
|
|
294 |
|
$tranR
es = db_re
s( "SELECT
`Data` FR
OM `Transa
ctions`
|
|
294 |
|
$tranR
es = db_re
s( "SELECT
`Data` FR
OM `Transa
ctions`
|
295 |
|
WH
ERE `ID` =
{$localTr
anID}" );
|
|
295 |
|
WH
ERE `ID` =
{$localTr
anID}" );
|
296 |
|
if ( !
$tranRes |
| mysql_nu
m_rows($tr
anRes) ==
0 )
|
|
296 |
|
if ( !
$tranRes |
| mysql_nu
m_rows($tr
anRes) ==
0 )
|
297 |
|
re
turn false
;
|
|
297 |
|
re
turn false
;
|
298 |
|
|
|
298 |
|
|
299 |
|
$tranA
rr = mysql
_fetch_ass
oc( $tranR
es );
|
|
299 |
|
$tranA
rr = mysql
_fetch_ass
oc( $tranR
es );
|
300 |
|
$tranD
ata = tran
sStringToD
ata( $tran
Arr['Data'
] );
|
|
300 |
|
$tranD
ata = tran
sStringToD
ata( $tran
Arr['Data'
] );
|
301 |
|
|
|
301 |
|
|
302 |
|
return
performPu
rchase( $t
ranData['m
emberID'],
$tranData
['action']
, $tranDat
a['data'],
|
|
302 |
|
return
performPu
rchase( $t
ranData['m
emberID'],
$tranData
['action']
, $tranDat
a['data'],
|
303 |
|
$t
ranData['a
mount'], $
result, $l
ocalTranID
);
|
|
303 |
|
$t
ranData['a
mount'], $
result, $l
ocalTranID
);
|
304 |
|
}
|
|
304 |
|
}
|
305 |
|
|
|
305 |
|
|
306 |
|
/**
|
|
306 |
|
/**
|
307 |
|
* Puts in
itial subs
cription d
ata into t
he databas
e
|
|
307 |
|
* Puts in
itial subs
cription d
ata into t
he databas
e
|
308 |
|
*
|
|
308 |
|
*
|
309 |
|
* @param
int $local
TranID
- ID of tr
ansaction
which was
initiated
on checkou
t
|
|
309 |
|
* @param
int $local
TranID
- ID of tr
ansaction
which was
initiated
on checkou
t
|
310 |
|
*
request
|
|
310 |
|
*
request
|
311 |
|
* @param
int $recur
ringDays
- subscrip
tion perio
d days
|
|
311 |
|
* @param
int $recur
ringDays
- subscrip
tion perio
d days
|
312 |
|
*
|
|
312 |
|
*
|
313 |
|
* @return
bool
- true on
success, f
alse other
wise
|
|
313 |
|
* @return
bool
- true on
success, f
alse other
wise
|
314 |
|
*
|
|
314 |
|
*
|
315 |
|
*
|
|
315 |
|
*
|
316 |
|
*/
|
|
316 |
|
*/
|
317 |
|
function i
nitiateSub
scription(
$localTra
nID, $recu
rringDays
)
|
|
317 |
|
function i
nitiateSub
scription(
$localTra
nID, $recu
rringDays
)
|
318 |
|
{
|
|
318 |
|
{
|
319 |
|
global
$MySQL;
|
|
319 |
|
global
$MySQL;
|
320 |
|
|
|
320 |
|
|
321 |
|
// arg
uments val
idation
|
|
321 |
|
// arg
uments val
idation
|
322 |
|
$local
TranID = (
int)$local
TranID;
|
|
322 |
|
$local
TranID = (
int)$local
TranID;
|
323 |
|
$recur
ringDays =
(int)$rec
urringDays
;
|
|
323 |
|
$recur
ringDays =
(int)$rec
urringDays
;
|
324 |
|
|
|
324 |
|
|
325 |
|
// lin
k subscrip
tion info
to dummy t
ransaction
|
|
325 |
|
// lin
k subscrip
tion info
to dummy t
ransaction
|
326 |
|
$res =
db_res( "
INSERT INT
O `Payment
Subscripti
ons` SET
|
|
326 |
|
$res =
db_res( "
INSERT INT
O `Payment
Subscripti
ons` SET
|
327 |
|
`T
ransaction
ID` = {$lo
calTranID}
,
|
|
327 |
|
`T
ransaction
ID` = {$lo
calTranID}
,
|
328 |
|
`S
tartDate`
= NOW(),
|
|
328 |
|
`S
tartDate`
= NOW(),
|
329 |
|
`P
eriod` = {
$recurring
Days},
|
|
329 |
|
`P
eriod` = {
$recurring
Days},
|
330 |
|
`C
hargesNumb
er` = 0" )
;
|
|
330 |
|
`C
hargesNumb
er` = 0" )
;
|
331 |
|
if ( $
res && mys
ql_affecte
d_rows( $M
ySQL->link
) > 0 )
|
|
331 |
|
if ( $
res && mys
ql_affecte
d_rows( $M
ySQL->link
) > 0 )
|
332 |
|
{
|
|
332 |
|
{
|
333 |
|
re
turn true;
|
|
333 |
|
re
turn true;
|
334 |
|
}
|
|
334 |
|
}
|
335 |
|
else
|
|
335 |
|
else
|
336 |
|
re
turn false
;
|
|
336 |
|
re
turn false
;
|
337 |
|
}
|
|
337 |
|
}
|
338 |
|
|
|
338 |
|
|
339 |
|
/**
|
|
339 |
|
/**
|
340 |
|
* Removes
subscript
ion data f
rom the da
tabase
|
|
340 |
|
* Removes
subscript
ion data f
rom the da
tabase
|
341 |
|
*
|
|
341 |
|
*
|
342 |
|
* @param
int $local
TranID
- ID of tr
ansaction
which was
created on
subscript
ion
|
|
342 |
|
* @param
int $local
TranID
- ID of tr
ansaction
which was
created on
subscript
ion
|
343 |
|
*
|
|
343 |
|
*
|
344 |
|
* @return
bool
- true on
success, f
alse other
wise
|
|
344 |
|
* @return
bool
- true on
success, f
alse other
wise
|
345 |
|
*
|
|
345 |
|
*
|
346 |
|
*
|
|
346 |
|
*
|
347 |
|
*/
|
|
347 |
|
*/
|
348 |
|
function c
ancelSubsc
ription( $
localTranI
D )
|
|
348 |
|
function c
ancelSubsc
ription( $
localTranI
D )
|
349 |
|
{
|
|
349 |
|
{
|
350 |
|
global
$MySQL;
|
|
350 |
|
global
$MySQL;
|
351 |
|
|
|
351 |
|
|
352 |
|
// arg
uments val
idation
|
|
352 |
|
// arg
uments val
idation
|
353 |
|
$local
TranID = (
int)$local
TranID;
|
|
353 |
|
$local
TranID = (
int)$local
TranID;
|
354 |
|
|
|
354 |
|
|
355 |
|
// rem
ove subscr
iption inf
o with dum
my transac
tion
|
|
355 |
|
// rem
ove subscr
iption inf
o with dum
my transac
tion
|
356 |
|
$res =
db_res( "
DELETE FRO
M `Payment
Subscripti
ons`
|
|
356 |
|
$res =
db_res( "
DELETE FRO
M `Payment
Subscripti
ons`
|
357 |
|
WHERE
`Transacti
onID` = {$
localTranI
D}" );
|
|
357 |
|
WHERE
`Transacti
onID` = {$
localTranI
D}" );
|
358 |
|
if ( !
$res || my
sql_affect
ed_rows( $
MySQL->lin
k ) == 0 )
|
|
358 |
|
if ( !
$res || my
sql_affect
ed_rows( $
MySQL->lin
k ) == 0 )
|
359 |
|
{
|
|
359 |
|
{
|
360 |
|
re
turn false
;
|
|
360 |
|
re
turn false
;
|
361 |
|
}
|
|
361 |
|
}
|
362 |
|
|
|
362 |
|
|
363 |
|
// del
ete dummy
transactio
n
|
|
363 |
|
// del
ete dummy
transactio
n
|
364 |
|
$res =
db_res( "
DELETE FRO
M `Transac
tions`
|
|
364 |
|
$res =
db_res( "
DELETE FRO
M `Transac
tions`
|
365 |
|
WHERE
`ID` = {$l
ocalTranID
}" );
|
|
365 |
|
WHERE
`ID` = {$l
ocalTranID
}" );
|
366 |
|
if ( $
res && mys
ql_affecte
d_rows( $M
ySQL->link
) > 0 )
|
|
366 |
|
if ( $
res && mys
ql_affecte
d_rows( $M
ySQL->link
) > 0 )
|
367 |
|
{
|
|
367 |
|
{
|
368 |
|
re
turn true;
|
|
368 |
|
re
turn true;
|
369 |
|
}
|
|
369 |
|
}
|
370 |
|
else
|
|
370 |
|
else
|
371 |
|
re
turn false
;
|
|
371 |
|
re
turn false
;
|
372 |
|
}
|
|
372 |
|
}
|
373 |
|
|
|
373 |
|
|
374 |
|
/**
|
|
374 |
|
/**
|
375 |
|
* Checks
if specifi
ed member
was subscr
ibed by sp
ecified pr
ovider and
then
|
|
375 |
|
* Checks
if specifi
ed member
was subscr
ibed by sp
ecified pr
ovider and
then
|
376 |
|
* initiat
es new tra
nsaction b
asing on d
ata from t
ransaction
, which wa
s created
|
|
376 |
|
* initiat
es new tra
nsaction b
asing on d
ata from t
ransaction
, which wa
s created
|
377 |
|
* on subs
cription
|
|
377 |
|
* on subs
cription
|
378 |
|
*
|
|
378 |
|
*
|
379 |
|
* @param
int $local
TranID
- ID of tr
ansaction
which was
created on
subscript
ion
|
|
379 |
|
* @param
int $local
TranID
- ID of tr
ansaction
which was
created on
subscript
ion
|
380 |
|
*
Function
initiates
new trans
action usi
ng data fr
om
|
|
380 |
|
*
Function
initiates
new trans
action usi
ng data fr
om
|
381 |
|
*
this tra
nsaction
|
|
381 |
|
*
this tra
nsaction
|
382 |
|
*
|
|
382 |
|
*
|
383 |
|
* @return
int/bool
- ID of in
itiated tr
ansaction
on success
, false ot
herwise
|
|
383 |
|
* @return
int/bool
- ID of in
itiated tr
ansaction
on success
, false ot
herwise
|
384 |
|
*
|
|
384 |
|
*
|
385 |
|
*
|
|
385 |
|
*
|
386 |
|
*/
|
|
386 |
|
*/
|
387 |
|
function i
nitiateSub
scriptionT
ransaction
( $localTr
anID )
|
|
387 |
|
function i
nitiateSub
scriptionT
ransaction
( $localTr
anID )
|
388 |
|
{
|
|
388 |
|
{
|
389 |
|
// arg
uments val
idation
|
|
389 |
|
// arg
uments val
idation
|
390 |
|
$local
TranID = (
int)$local
TranID;
|
|
390 |
|
$local
TranID = (
int)$local
TranID;
|
391 |
|
|
|
391 |
|
|
392 |
|
// sel
ect dummy
transactio
n info
|
|
392 |
|
// sel
ect dummy
transactio
n info
|
393 |
|
$tranR
es = db_re
s( "SELECT
`IDProvid
er`, `Data
` FROM `Tr
ansactions
`
|
|
393 |
|
$tranR
es = db_re
s( "SELECT
`IDProvid
er`, `Data
` FROM `Tr
ansactions
`
|
394 |
|
WH
ERE `ID` =
{$localTr
anID}" );
|
|
394 |
|
WH
ERE `ID` =
{$localTr
anID}" );
|
395 |
|
if ( !
$tranRes |
| mysql_nu
m_rows($tr
anRes) ==
0 )
|
|
395 |
|
if ( !
$tranRes |
| mysql_nu
m_rows($tr
anRes) ==
0 )
|
396 |
|
re
turn false
;
|
|
396 |
|
re
turn false
;
|
397 |
|
|
|
397 |
|
|
398 |
|
$tranA
rr = mysql
_fetch_ass
oc( $tranR
es );
|
|
398 |
|
$tranA
rr = mysql
_fetch_ass
oc( $tranR
es );
|
399 |
|
$tranD
ata = tran
sStringToD
ata( $tran
Arr['Data'
] );
|
|
399 |
|
$tranD
ata = tran
sStringToD
ata( $tran
Arr['Data'
] );
|
400 |
|
|
|
400 |
|
|
401 |
|
// che
ck if memb
er subscri
bed
|
|
401 |
|
// che
ck if memb
er subscri
bed
|
402 |
|
$subsA
rr = db_ar
r( "SELECT
`Transact
ionID`, `C
hargesNumb
er` FROM `
PaymentSub
scriptions
`
|
|
402 |
|
$subsA
rr = db_ar
r( "SELECT
`Transact
ionID`, `C
hargesNumb
er` FROM `
PaymentSub
scriptions
`
|
403 |
|
WH
ERE `Trans
actionID`
= {$localT
ranID}" );
|
|
403 |
|
WH
ERE `Trans
actionID`
= {$localT
ranID}" );
|
404 |
|
if ( !
$subsArr )
|
|
404 |
|
if ( !
$subsArr )
|
405 |
|
re
turn false
;
|
|
405 |
|
re
turn false
;
|
406 |
|
|
|
406 |
|
|
407 |
|
$check
outData['c
heckout_ac
tion'] = $
tranData['
action'];
|
|
407 |
|
$check
outData['c
heckout_ac
tion'] = $
tranData['
action'];
|
408 |
|
$check
outData['a
mount'] =
$tranData[
'amount'];
|
|
408 |
|
$check
outData['a
mount'] =
$tranData[
'amount'];
|
409 |
|
$check
outData['d
ata'] = $t
ranData['d
ata'];
|
|
409 |
|
$check
outData['d
ata'] = $t
ranData['d
ata'];
|
410 |
|
$check
outData['d
escription
'] = retur
nDescByAct
ion( $tran
Data['acti
on'], $tra
nData['dat
a'], true
);
|
|
410 |
|
$check
outData['d
escription
'] = retur
nDescByAct
ion( $tran
Data['acti
on'], $tra
nData['dat
a'], true
);
|
411 |
|
|
|
411 |
|
|
412 |
|
$res =
initiateT
ransaction
( $checkou
tData, $tr
anData['me
mberID'],
$tranArr['
IDProvider
'] );
|
|
412 |
|
$res =
initiateT
ransaction
( $checkou
tData, $tr
anData['me
mberID'],
$tranArr['
IDProvider
'] );
|
413 |
|
if ( !
$res )
|
|
413 |
|
if ( !
$res )
|
414 |
|
re
turn false
;
|
|
414 |
|
re
turn false
;
|
415 |
|
else
|
|
415 |
|
else
|
416 |
|
re
turn $res;
|
|
416 |
|
re
turn $res;
|
417 |
|
}
|
|
417 |
|
}
|
418 |
|
|
|
418 |
|
|
419 |
|
/**
|
|
419 |
|
/**
|
420 |
|
* Checks
if specifi
ed member
was subscr
ibed by sp
ecified pr
ovider the
n
|
|
420 |
|
* Checks
if specifi
ed member
was subscr
ibed by sp
ecified pr
ovider the
n
|
421 |
|
* updates
database
info about
subscript
ion and ca
lls finish
Transactio
n function
|
|
421 |
|
* updates
database
info about
subscript
ion and ca
lls finish
Transactio
n function
|
422 |
|
*
|
|
422 |
|
*
|
423 |
|
* @param
int $local
TranID
- transact
ion ID in
the databa
se
|
|
423 |
|
* @param
int $local
TranID
- transact
ion ID in
the databa
se
|
424 |
|
* @param
int $subsT
ranID
- ID of tr
ansaction
which was
created on
subscript
ion
|
|
424 |
|
* @param
int $subsT
ranID
- ID of tr
ansaction
which was
created on
subscript
ion
|
425 |
|
* @param
string $gt
wTranID
- payment
gateway tr
ansaction
identifier
|
|
425 |
|
* @param
string $gt
wTranID
- payment
gateway tr
ansaction
identifier
|
426 |
|
* @param
bool $appr
oved
- indicate
s if trans
action was
successfu
l
|
|
426 |
|
* @param
bool $appr
oved
- indicate
s if trans
action was
successfu
l
|
427 |
|
* @param
string $no
te
- customer
note for
the transa
ction
|
|
427 |
|
* @param
string $no
te
- customer
note for
the transa
ction
|
428 |
|
*
|
|
428 |
|
*
|
429 |
|
* @return
bool
- true on
success, f
alse other
wise
|
|
429 |
|
* @return
bool
- true on
success, f
alse other
wise
|
430 |
|
*
|
|
430 |
|
*
|
431 |
|
*
|
|
431 |
|
*
|
432 |
|
*/
|
|
432 |
|
*/
|
433 |
|
function f
inishSubsc
riptionTra
nsaction(
$localTran
ID, $subsT
ranID, $gt
wTranID, $
approved =
true, $no
te = '' )
|
|
433 |
|
function f
inishSubsc
riptionTra
nsaction(
$localTran
ID, $subsT
ranID, $gt
wTranID, $
approved =
true, $no
te = '' )
|
434 |
|
{
|
|
434 |
|
{
|
435 |
|
global
$MySQL;
|
|
435 |
|
global
$MySQL;
|
436 |
|
|
|
436 |
|
|
437 |
|
// arg
uments val
idation
|
|
437 |
|
// arg
uments val
idation
|
438 |
|
$local
TranID = (
int)$local
TranID;
|
|
438 |
|
$local
TranID = (
int)$local
TranID;
|
439 |
|
$subsT
ranID = (i
nt)$subsTr
anID;
|
|
439 |
|
$subsT
ranID = (i
nt)$subsTr
anID;
|
440 |
|
|
|
440 |
|
|
441 |
|
$res =
true;
|
|
441 |
|
$res =
true;
|
442 |
|
if ( $
approved )
|
|
442 |
|
if ( $
approved )
|
443 |
|
{
|
|
443 |
|
{
|
444 |
|
$r
es = db_re
s( "UPDATE
`PaymentS
ubscriptio
ns` SET
|
|
444 |
|
$r
es = db_re
s( "UPDATE
`PaymentS
ubscriptio
ns` SET
|
445 |
|
`Charges
Number` =
`ChargesNu
mber` + 1
|
|
445 |
|
`Charges
Number` =
`ChargesNu
mber` + 1
|
446 |
|
WH
ERE `Trans
actionID`
= {$subsTr
anID}" );
|
|
446 |
|
WH
ERE `Trans
actionID`
= {$subsTr
anID}" );
|
447 |
|
$r
es = ( $re
s && mysql
_affected_
rows( $MyS
QL->link )
> 0);
|
|
447 |
|
$r
es = ( $re
s && mysql
_affected_
rows( $MyS
QL->link )
> 0);
|
448 |
|
}
|
|
448 |
|
}
|
449 |
|
|
|
449 |
|
|
450 |
|
if ( $
res )
|
|
450 |
|
if ( $
res )
|
451 |
|
{
|
|
451 |
|
{
|
452 |
|
re
turn finis
hTransacti
on( $local
TranID, $g
twTranID,
$approved,
$note );
|
|
452 |
|
re
turn finis
hTransacti
on( $local
TranID, $g
twTranID,
$approved,
$note );
|
453 |
|
}
|
|
453 |
|
}
|
454 |
|
else
|
|
454 |
|
else
|
455 |
|
re
turn false
;
|
|
455 |
|
re
turn false
;
|
456 |
|
}
|
|
456 |
|
}
|
457 |
|
|
|
457 |
|
|
458 |
|
/**
|
|
458 |
|
/**
|
459 |
|
* Perform
s script p
urchase ac
tions for
specified
parameters
and makes
fraud che
ck also
|
|
459 |
|
* Perform
s script p
urchase ac
tions for
specified
parameters
and makes
fraud che
ck also
|
460 |
|
*
|
|
460 |
|
*
|
461 |
|
* @param
int $membe
rID
- member I
D
|
|
461 |
|
* @param
int $membe
rID
- member I
D
|
462 |
|
* @param
string $ch
eckoutActi
on
- payment
type actio
n (e.g mem
ership, cr
edits, etc
)
|
|
462 |
|
* @param
string $ch
eckoutActi
on
- payment
type actio
n (e.g mem
ership, cr
edits, etc
)
|
463 |
|
* @param
string $da
ta
- payment
action dat
a (e.g. me
mbership I
D or event
ID)
|
|
463 |
|
* @param
string $da
ta
- payment
action dat
a (e.g. me
mbership I
D or event
ID)
|
464 |
|
* @param
string $am
ount
- payment
sum
|
|
464 |
|
* @param
string $am
ount
- payment
sum
|
465 |
|
* @param
int $resul
t
- purchase
result fr
om checkou
t file
|
|
465 |
|
* @param
int $resul
t
- purchase
result fr
om checkou
t file
|
466 |
|
*
(it coul
d be chang
ed inside)
|
|
466 |
|
*
(it coul
d be chang
ed inside)
|
467 |
|
* @param
int $local
TranID
- transact
ion ID in
the databa
se
|
|
467 |
|
* @param
int $local
TranID
- transact
ion ID in
the databa
se
|
468 |
|
*
|
|
468 |
|
*
|
469 |
|
* @return
bool
- true on
success, f
alse other
wise
|
|
469 |
|
* @return
bool
- true on
success, f
alse other
wise
|
470 |
|
*
|
|
470 |
|
*
|
471 |
|
*
|
|
471 |
|
*
|
472 |
|
*/
|
|
472 |
|
*/
|
473 |
|
function p
erformPurc
hase( $mem
berID, $ch
eckoutActi
on, $data,
$amount,
&$result,
$localTran
ID = 0 )
|
|
473 |
|
function p
erformPurc
hase( $mem
berID, $ch
eckoutActi
on, $data,
$amount,
&$result,
$localTran
ID = 0 )
|
474 |
|
{
|
|
474 |
|
{
|
475 |
|
global
$site;
|
|
475 |
|
global
$site;
|
476 |
|
|
|
476 |
|
|
477 |
|
// arg
uments val
idation
|
|
477 |
|
// arg
uments val
idation
|
478 |
|
$amoun
t = sprint
f( '%.2f',
(float)$a
mount );
|
|
478 |
|
$amoun
t = sprint
f( '%.2f',
(float)$a
mount );
|
479 |
|
|
|
479 |
|
|
480 |
|
switch
( $checko
utAction )
|
|
480 |
|
switch
( $checko
utAction )
|
481 |
|
{
|
|
481 |
|
{
|
482 |
|
ca
se 'member
ship':
|
|
482 |
|
ca
se 'member
ship':
|
483 |
|
$members
hipID = (i
nt)$data;
|
|
483 |
|
$members
hipID = (i
nt)$data;
|
484 |
|
$res = b
uyMembersh
ip( $membe
rID, $memb
ershipID,
$amount, $
localTranI
D );
|
|
484 |
|
$res = b
uyMembersh
ip( $membe
rID, $memb
ershipID,
$amount, $
localTranI
D );
|
485 |
|
return $
res;
|
|
485 |
|
return $
res;
|
486 |
|
|
|
486 |
|
|
487 |
|
ca
se 'speedd
ating':
|
|
487 |
|
ca
se 'speedd
ating':
|
488 |
|
$eventID
= (int)$d
ata;
|
|
488 |
|
$eventID
= (int)$d
ata;
|
489 |
|
$res = i
sTicketAva
ilable( $m
emberID, $
eventID );
|
|
489 |
|
$res = i
sTicketAva
ilable( $m
emberID, $
eventID );
|
490 |
|
// fraud
check
|
|
490 |
|
// fraud
check
|
491 |
|
if ( $re
s === fals
e )
|
|
491 |
|
if ( $re
s === fals
e )
|
492 |
|
retu
rn false;
|
|
492 |
|
retu
rn false;
|
493 |
|
if ( $re
s != $amou
nt )
|
|
493 |
|
if ( $re
s != $amou
nt )
|
494 |
|
retu
rn false;
|
|
494 |
|
retu
rn false;
|
495 |
|
|
|
495 |
|
|
496 |
|
$res = p
urchaseTic
ket( $memb
erID, $eve
ntID, $loc
alTranID )
;
|
|
496 |
|
$res = p
urchaseTic
ket( $memb
erID, $eve
ntID, $loc
alTranID )
;
|
497 |
|
// if ti
cket purch
ased, but
email wasn
't sent th
en change
result val
ue
|
|
497 |
|
// if ti
cket purch
ased, but
email wasn
't sent th
en change
result val
ue
|
498 |
|
if ( $re
s === 3 )
|
|
498 |
|
if ( $re
s === 3 )
|
499 |
|
{
|
|
499 |
|
{
|
500 |
|
$res
ult = 3;
|
|
500 |
|
$res
ult = 3;
|
501 |
|
retu
rn true;
|
|
501 |
|
retu
rn true;
|
502 |
|
}
|
|
502 |
|
}
|
503 |
|
else
|
|
503 |
|
else
|
504 |
|
{
|
|
504 |
|
{
|
505 |
|
retu
rn $res;
|
|
505 |
|
retu
rn $res;
|
506 |
|
}
|
|
506 |
|
}
|
507 |
|
|
|
507 |
|
|
508 |
|
de
fault:
|
|
508 |
|
de
fault:
|
509 |
|
return f
alse;
|
|
509 |
|
return f
alse;
|
510 |
|
}
|
|
510 |
|
}
|
511 |
|
}
|
|
511 |
|
}
|
512 |
|
|
|
512 |
|
|
513 |
|
/**
|
|
513 |
|
/**
|
514 |
|
* Perform
s appropri
ate action
for payme
nt result
|
|
514 |
|
* Perform
s appropri
ate action
for payme
nt result
|
515 |
|
*
|
|
515 |
|
*
|
516 |
|
* If data
base trans
action ID
specified
and it is
possible t
o determin
e return U
RL
|
|
516 |
|
* If data
base trans
action ID
specified
and it is
possible t
o determin
e return U
RL
|
517 |
|
* then it
posts res
ult to ret
urn page.
Otherwise
it just sh
ows error
message.
|
|
517 |
|
* then it
posts res
ult to ret
urn page.
Otherwise
it just sh
ows error
message.
|
518 |
|
*
|
|
518 |
|
*
|
519 |
|
* @param
int $resul
t
- payment
result
|
|
519 |
|
* @param
int $resul
t
- payment
result
|
520 |
|
* -1
- fraud a
ttempt
|
|
520 |
|
* -1
- fraud a
ttempt
|
521 |
|
* 0
- transac
tion decli
ned or not
completed
|
|
521 |
|
* 0
- transac
tion decli
ned or not
completed
|
522 |
|
* 1
- transac
tion succe
ssful
|
|
522 |
|
* 1
- transac
tion succe
ssful
|
523 |
|
* 2
- interna
l error
|
|
523 |
|
* 2
- interna
l error
|
524 |
|
* @param
string $er
rorMessage
- error me
ssage whic
h was
|
|
524 |
|
* @param
string $er
rorMessage
- error me
ssage whic
h was
|
525 |
|
* @param
int $local
TranID
- transact
ion ID
|
|
525 |
|
* @param
int $local
TranID
- transact
ion ID
|
526 |
|
*
|
|
526 |
|
*
|
527 |
|
*
|
|
527 |
|
*
|
528 |
|
*/
|
|
528 |
|
*/
|
529 |
|
function p
rocessVali
dationResu
lt( $resul
t, $errorM
essage, $l
ocalTranID
= 0, $ret
urnURL = '
' )
|
|
529 |
|
function p
rocessVali
dationResu
lt( $resul
t, $errorM
essage, $l
ocalTranID
= 0, $ret
urnURL = '
' )
|
530 |
|
{
|
|
530 |
|
{
|
531 |
|
global
$site;
|
|
531 |
|
global
$site;
|
532 |
|
|
|
532 |
|
|
533 |
|
// arg
uments val
idation
|
|
533 |
|
// arg
uments val
idation
|
534 |
|
$resul
t = (int)$
result;
|
|
534 |
|
$resul
t = (int)$
result;
|
535 |
|
$local
TranID = (
int)$local
TranID;
|
|
535 |
|
$local
TranID = (
int)$local
TranID;
|
536 |
|
|
|
536 |
|
|
537 |
|
$formD
ata = arra
y( 'result
' => $resu
lt );
|
|
537 |
|
$formD
ata = arra
y( 'result
' => $resu
lt );
|
538 |
|
|
|
538 |
|
|
539 |
|
if ( $
localTranI
D )
|
|
539 |
|
if ( $
localTranI
D )
|
540 |
|
{
|
|
540 |
|
{
|
541 |
|
$t
ranRes = d
b_res( "SE
LECT `Data
` FROM `Tr
ansactions
`
|
|
541 |
|
$t
ranRes = d
b_res( "SE
LECT `Data
` FROM `Tr
ansactions
`
|
542 |
|
WHERE `I
D` = {$loc
alTranID}"
);
|
|
542 |
|
WHERE `I
D` = {$loc
alTranID}"
);
|
543 |
|
if
( $tranRe
s && mysql
_num_rows(
$tranRes)
> 0 )
|
|
543 |
|
if
( $tranRe
s && mysql
_num_rows(
$tranRes)
> 0 )
|
544 |
|
{
|
|
544 |
|
{
|
545 |
|
$tranArr
= mysql_f
etch_assoc
($tranRes)
;
|
|
545 |
|
$tranArr
= mysql_f
etch_assoc
($tranRes)
;
|
546 |
|
$tranDat
a = transS
tringToDat
a( $tranAr
r['Data']
);
|
|
546 |
|
$tranDat
a = transS
tringToDat
a( $tranAr
r['Data']
);
|
547 |
|
$returnU
RL = retur
nURLByActi
on( $tranD
ata['actio
n'], $tran
Data['data
'] );
|
|
547 |
|
$returnU
RL = retur
nURLByActi
on( $tranD
ata['actio
n'], $tran
Data['data
'] );
|
548 |
|
}
|
|
548 |
|
}
|
549 |
|
}
|
|
549 |
|
}
|
550 |
|
|
|
550 |
|
|
551 |
|
switch
( $result
)
|
|
551 |
|
switch
( $result
)
|
552 |
|
{
|
|
552 |
|
{
|
553 |
|
ca
se -1:
|
|
553 |
|
ca
se -1:
|
554 |
|
reportFr
audAttempt
( $errorMe
ssage );
|
|
554 |
|
reportFr
audAttempt
( $errorMe
ssage );
|
555 |
|
if ( str
len($retur
nURL) )
|
|
555 |
|
if ( str
len($retur
nURL) )
|
556 |
|
Redi
rect( $ret
urnURL, $f
ormData, '
post' );
|
|
556 |
|
Redi
rect( $ret
urnURL, $f
ormData, '
post' );
|
557 |
|
else
|
|
557 |
|
else
|
558 |
|
Prin
tErrorPage
( _t('_RES
ULT-1') );
|
|
558 |
|
Prin
tErrorPage
( _t('_RES
ULT-1') );
|
559 |
|
break;
|
|
559 |
|
break;
|
560 |
|
|
|
560 |
|
|
561 |
|
ca
se 0:
|
|
561 |
|
ca
se 0:
|
562 |
|
if ( str
len($retur
nURL) )
|
|
562 |
|
if ( str
len($retur
nURL) )
|
563 |
|
Redi
rect( $ret
urnURL, $f
ormData, '
post' );
|
|
563 |
|
Redi
rect( $ret
urnURL, $f
ormData, '
post' );
|
564 |
|
else
|
|
564 |
|
else
|
565 |
|
Prin
tErrorPage
( _t('_RES
ULT0') );
|
|
565 |
|
Prin
tErrorPage
( _t('_RES
ULT0') );
|
566 |
|
break;
|
|
566 |
|
break;
|
567 |
|
|
|
567 |
|
|
568 |
|
ca
se 1:
|
|
568 |
|
ca
se 1:
|
569 |
|
if ( str
len($retur
nURL) )
|
|
569 |
|
if ( str
len($retur
nURL) )
|
570 |
|
Redi
rect( $ret
urnURL, $f
ormData, '
post' );
|
|
570 |
|
Redi
rect( $ret
urnURL, $f
ormData, '
post' );
|
571 |
|
else
|
|
571 |
|
else
|
572 |
|
Redi
rect( $sit
e['url'] .
'member.p
hp', $form
Data, 'pos
t' );
|
|
572 |
|
Redi
rect( $sit
e['url'] .
'member.p
hp', $form
Data, 'pos
t' );
|
573 |
|
break;
|
|
573 |
|
break;
|
574 |
|
|
|
574 |
|
|
575 |
|
ca
se 2:
|
|
575 |
|
ca
se 2:
|
576 |
|
PrintErr
orPage( 'I
nternal er
ror occure
d: ' . $er
rorMessage
);
|
|
576 |
|
PrintErr
orPage( 'I
nternal er
ror occure
d: ' . $er
rorMessage
);
|
577 |
|
break;
|
|
577 |
|
break;
|
578 |
|
|
|
578 |
|
|
579 |
|
ca
se 1000:
|
|
579 |
|
ca
se 1000:
|
580 |
|
if ( str
len($retur
nURL) )
|
|
580 |
|
if ( str
len($retur
nURL) )
|
581 |
|
Redi
rect( $ret
urnURL, $f
ormData, '
post' );
|
|
581 |
|
Redi
rect( $ret
urnURL, $f
ormData, '
post' );
|
582 |
|
else
|
|
582 |
|
else
|
583 |
|
Prin
tErrorPage
( _t('_RES
ULT1000')
);
|
|
583 |
|
Prin
tErrorPage
( _t('_RES
ULT1000')
);
|
584 |
|
break;
|
|
584 |
|
break;
|
585 |
|
}
|
|
585 |
|
}
|
586 |
|
}
|
|
586 |
|
}
|
587 |
|
|
|
587 |
|
|
588 |
|
/**
|
|
588 |
|
/**
|
589 |
|
* Sends e
mail to si
te admin w
ith paymen
t and user
informati
on
|
|
589 |
|
* Sends e
mail to si
te admin w
ith paymen
t and user
informati
on
|
590 |
|
*
|
|
590 |
|
*
|
591 |
|
* @return
bool
- true if
sending su
cceed, fal
se otherwi
se
|
|
591 |
|
* @return
bool
- true if
sending su
cceed, fal
se otherwi
se
|
592 |
|
*
|
|
592 |
|
*
|
593 |
|
*
|
|
593 |
|
*
|
594 |
|
*/
|
|
594 |
|
*/
|
595 |
|
function r
eportFraud
Attempt( $
message )
|
|
595 |
|
function r
eportFraud
Attempt( $
message )
|
596 |
|
{
|
|
596 |
|
{
|
597 |
|
global
$site;
|
|
597 |
|
global
$site;
|
598 |
|
|
|
598 |
|
|
599 |
|
$payme
ntModuleNa
me = PAYME
NT_MODULE_
NAME;
|
|
599 |
|
$payme
ntModuleNa
me = PAYME
NT_MODULE_
NAME;
|
600 |
|
$userI
P = getenv
('HTTP_CLI
ENT_IP') ?
getenv('H
TTP_CLIENT
_IP') : ge
tenv('REMO
TE_ADDR');
|
|
600 |
|
$userI
P = getenv
('HTTP_CLI
ENT_IP') ?
getenv('H
TTP_CLIENT
_IP') : ge
tenv('REMO
TE_ADDR');
|
601 |
|
$curre
ntDatetime
= date("l
dS of F Y
h:i:s A")
;
|
|
601 |
|
$curre
ntDatetime
= date("l
dS of F Y
h:i:s A")
;
|
602 |
|
|
|
602 |
|
|
603 |
|
|
|
603 |
|
|
604 |
|
$subje
ct = 'Frau
d attempt
report';
|
|
604 |
|
$subje
ct = 'Frau
d attempt
report';
|
605 |
|
|
|
605 |
|
|
606 |
|
$messa
ge = <<<EO
M
|
|
606 |
|
$messa
ge = <<<EO
M
|
607 |
|
Fraud atte
mpt was de
tected in
{$site['ti
tle']} che
ckout syst
em.
|
|
607 |
|
Fraud atte
mpt was de
tected in
{$site['ti
tle']} che
ckout syst
em.
|
608 |
|
Here is de
tails:
|
|
608 |
|
Here is de
tails:
|
609 |
|
Date/t
ime: {$cur
rentDateti
me}
|
|
609 |
|
Date/t
ime: {$cur
rentDateti
me}
|
610 |
|
IP: {$
userIP}
|
|
610 |
|
IP: {$
userIP}
|
611 |
|
Paymen
t module n
ame: {$pay
mentModule
Name}
|
|
611 |
|
Paymen
t module n
ame: {$pay
mentModule
Name}
|
612 |
|
Messag
e: {$messa
ge}
|
|
612 |
|
Messag
e: {$messa
ge}
|
613 |
|
EOM;
|
|
613 |
|
EOM;
|
614 |
|
|
|
614 |
|
|
615 |
|
$ret =
sendMail(
$site['em
ail'], $su
bject, $me
ssage );
|
|
615 |
|
$ret =
sendMail(
$site['em
ail'], $su
bject, $me
ssage );
|
616 |
|
|
|
616 |
|
|
617 |
|
|
|
617 |
|
|
618 |
|
return
$ret;
|
|
618 |
|
return
$ret;
|
619 |
|
}
|
|
619 |
|
}
|
620 |
|
|
|
620 |
|
|
621 |
|
/**
|
|
621 |
|
/**
|
622 |
|
* Selects
all or on
ly active
payment pr
oviders an
d returns
array with
their
|
|
622 |
|
* Selects
all or on
ly active
payment pr
oviders an
d returns
array with
their
|
623 |
|
* names a
nd caption
s
|
|
623 |
|
* names a
nd caption
s
|
624 |
|
*
|
|
624 |
|
*
|
625 |
|
* @param
bool $acti
veOnly
- indicate
s if only
active pay
ment provi
ders shoul
d be
|
|
625 |
|
* @param
bool $acti
veOnly
- indicate
s if only
active pay
ment provi
ders shoul
d be
|
626 |
|
*
selected
|
|
626 |
|
*
selected
|
627 |
|
*
|
|
627 |
|
*
|
628 |
|
* @return
array
- array of
providers
|
|
628 |
|
* @return
array
- array of
providers
|
629 |
|
*
( pr
oviderID =
> Array('N
ame' => pr
oviderName
, 'Caption
' => provi
derCaption
),
|
|
629 |
|
*
( pr
oviderID =
> Array('N
ame' => pr
oviderName
, 'Caption
' => provi
derCaption
),
|
630 |
|
*
..
. )
|
|
630 |
|
*
..
. )
|
631 |
|
*
|
|
631 |
|
*
|
632 |
|
*
|
|
632 |
|
*
|
633 |
|
*/
|
|
633 |
|
*/
|
634 |
|
function g
etPaymentP
roviders(
$activeOnl
y = false
)
|
|
634 |
|
function g
etPaymentP
roviders(
$activeOnl
y = false
)
|
635 |
|
{
|
|
635 |
|
{
|
636 |
|
$resul
t = array(
);
|
|
636 |
|
$resul
t = array(
);
|
637 |
|
if ( $
activeOnly
)
|
|
637 |
|
if ( $
activeOnly
)
|
638 |
|
$q
ueryFilter
= 'WHERE
`Active`';
|
|
638 |
|
$q
ueryFilter
= 'WHERE
`Active`';
|
639 |
|
|
|
639 |
|
|
640 |
|
$provi
derRes = d
b_res( "SE
LECT `ID`,
`Name`, `
Caption` F
ROM `Payme
ntProvider
s` {$query
Filter}" )
;
|
|
640 |
|
$provi
derRes = d
b_res( "SE
LECT `ID`,
`Name`, `
Caption` F
ROM `Payme
ntProvider
s` {$query
Filter}" )
;
|
641 |
|
while
( $provide
rArr = mys
ql_fetch_a
ssoc($prov
iderRes) )
|
|
641 |
|
while
( $provide
rArr = mys
ql_fetch_a
ssoc($prov
iderRes) )
|
642 |
|
{
|
|
642 |
|
{
|
643 |
|
$r
esult[$pro
viderArr['
ID']]['Nam
e'] = $pro
viderArr['
Name'];
|
|
643 |
|
$r
esult[$pro
viderArr['
ID']]['Nam
e'] = $pro
viderArr['
Name'];
|
644 |
|
$r
esult[$pro
viderArr['
ID']]['Cap
tion'] = $
providerAr
r['Caption
'];
|
|
644 |
|
$r
esult[$pro
viderArr['
ID']]['Cap
tion'] = $
providerAr
r['Caption
'];
|
645 |
|
}
|
|
645 |
|
}
|
646 |
|
|
|
646 |
|
|
647 |
|
return
$result;
|
|
647 |
|
return
$result;
|
648 |
|
}
|
|
648 |
|
}
|
649 |
|
|
|
649 |
|
|
650 |
|
/**
|
|
650 |
|
/**
|
651 |
|
* Reads c
urrent mod
ule config
uration fr
om the dat
abase
|
|
651 |
|
* Reads c
urrent mod
ule config
uration fr
om the dat
abase
|
652 |
|
* (acco
rding to t
he 'PAYMEN
T_MODULE_N
AME' const
ant)
|
|
652 |
|
* (acco
rding to t
he 'PAYMEN
T_MODULE_N
AME' const
ant)
|
653 |
|
*
|
|
653 |
|
*
|
654 |
|
*
|
|
654 |
|
*
|
655 |
|
*/
|
|
655 |
|
*/
|
656 |
|
function i
nitProvide
rConfigura
tion()
|
|
656 |
|
function i
nitProvide
rConfigura
tion()
|
657 |
|
{
|
|
657 |
|
{
|
658 |
|
global
$provider
Conf;
|
|
658 |
|
global
$provider
Conf;
|
659 |
|
|
|
659 |
|
|
660 |
|
$provi
derConf =
array();
|
|
660 |
|
$provi
derConf =
array();
|
661 |
|
|
|
661 |
|
|
662 |
|
if ( !
defined( '
PAYMENT_MO
DULE_NAME'
) )
|
|
662 |
|
if ( !
defined( '
PAYMENT_MO
DULE_NAME'
) )
|
663 |
|
re
turn;
|
|
663 |
|
re
turn;
|
664 |
|
$provi
derRes = d
b_res( "SE
LECT `ID`,
`Name`, `
Caption`,
`Active`,
`Mode`, `D
ebug`, `Ch
eckoutFile
name`, `Ch
eckoutURL`
, `Support
sRecurring
` FROM `Pa
ymentProvi
ders` WHER
E `Name` =
'". PAYME
NT_MODULE_
NAME ."'"
);
|
|
664 |
|
$provi
derRes = d
b_res( "SE
LECT `ID`,
`Name`, `
Caption`,
`Active`,
`Mode`, `D
ebug`, `Ch
eckoutFile
name`, `Ch
eckoutURL`
, `Support
sRecurring
` FROM `Pa
ymentProvi
ders` WHER
E `Name` =
'". PAYME
NT_MODULE_
NAME ."'"
);
|
665 |
|
$provi
derArr = m
ysql_fetch
_assoc($pr
oviderRes)
;
|
|
665 |
|
$provi
derArr = m
ysql_fetch
_assoc($pr
oviderRes)
;
|
666 |
|
foreac
h ( $provi
derArr as
$key => $v
alue )
|
|
666 |
|
foreac
h ( $provi
derArr as
$key => $v
alue )
|
667 |
|
$p
roviderCon
f[$key] =
$value;
|
|
667 |
|
$p
roviderCon
f[$key] =
$value;
|
668 |
|
|
|
668 |
|
|
669 |
|
$param
Res = db_r
es( "SELEC
T `Name`,
`Type`, `V
alue` FROM
`PaymentP
arameters`
WHERE `ID
Provider`
= {$provid
erConf['ID
']}" );
|
|
669 |
|
$param
Res = db_r
es( "SELEC
T `Name`,
`Type`, `V
alue` FROM
`PaymentP
arameters`
WHERE `ID
Provider`
= {$provid
erConf['ID
']}" );
|
670 |
|
while
( $paramAr
r = mysql_
fetch_asso
c($paramRe
s) )
|
|
670 |
|
while
( $paramAr
r = mysql_
fetch_asso
c($paramRe
s) )
|
671 |
|
{
|
|
671 |
|
{
|
672 |
|
if
( $paramA
rr['Type']
== 'check
' )
|
|
672 |
|
if
( $paramA
rr['Type']
== 'check
' )
|
673 |
|
$provide
rConf['Par
am_' . $pa
ramArr['Na
me']] = ($
paramArr['
Value'] ==
'on' ? tr
ue : false
);
|
|
673 |
|
$provide
rConf['Par
am_' . $pa
ramArr['Na
me']] = ($
paramArr['
Value'] ==
'on' ? tr
ue : false
);
|
674 |
|
el
se
|
|
674 |
|
el
se
|
675 |
|
$provide
rConf['Par
am_' . $pa
ramArr['Na
me']] = $p
aramArr['V
alue'];
|
|
675 |
|
$provide
rConf['Par
am_' . $pa
ramArr['Na
me']] = $p
aramArr['V
alue'];
|
676 |
|
}
|
|
676 |
|
}
|
677 |
|
}
|
|
677 |
|
}
|
678 |
|
|
|
678 |
|
|
679 |
|
/**
|
|
679 |
|
/**
|
680 |
|
* Perform
s common p
ayment mod
ule config
uration va
lidation
|
|
680 |
|
* Perform
s common p
ayment mod
ule config
uration va
lidation
|
681 |
|
*
|
|
681 |
|
*
|
682 |
|
* @param
string &$e
rrorMessag
e
- error me
ssage when
return re
sult is no
t true
|
|
682 |
|
* @param
string &$e
rrorMessag
e
- error me
ssage when
return re
sult is no
t true
|
683 |
|
*
|
|
683 |
|
*
|
684 |
|
* @return
bool
- true if
configurat
ion is val
id, false
otherwise
|
|
684 |
|
* @return
bool
- true if
configurat
ion is val
id, false
otherwise
|
685 |
|
*
|
|
685 |
|
*
|
686 |
|
*
|
|
686 |
|
*
|
687 |
|
*/
|
|
687 |
|
*/
|
688 |
|
function c
ommonValid
ateConfigu
ration( &$
errorMessa
ge )
|
|
688 |
|
function c
ommonValid
ateConfigu
ration( &$
errorMessa
ge )
|
689 |
|
{
|
|
689 |
|
{
|
690 |
|
global
$provider
Conf;
|
|
690 |
|
global
$provider
Conf;
|
691 |
|
global
$debugFil
ename;
|
|
691 |
|
global
$debugFil
ename;
|
692 |
|
|
|
692 |
|
|
693 |
|
if ( !
defined( '
PAYMENT_MO
DULE_NAME'
) )
|
|
693 |
|
if ( !
defined( '
PAYMENT_MO
DULE_NAME'
) )
|
694 |
|
re
turn false
;
|
|
694 |
|
re
turn false
;
|
695 |
|
|
|
695 |
|
|
696 |
|
if ( $
providerCo
nf['Debug'
] )
|
|
696 |
|
if ( $
providerCo
nf['Debug'
] )
|
697 |
|
{
|
|
697 |
|
{
|
698 |
|
$f
ileExists
= file_exi
sts( $debu
gFilename
);
|
|
698 |
|
$f
ileExists
= file_exi
sts( $debu
gFilename
);
|
699 |
|
if
( $fileEx
ists )
|
|
699 |
|
if
( $fileEx
ists )
|
700 |
|
{
|
|
700 |
|
{
|
701 |
|
clea
rstatcache
();
|
|
701 |
|
clea
rstatcache
();
|
702 |
|
$per
ms = filep
erms( $deb
ugFilename
);
|
|
702 |
|
$per
ms = filep
erms( $deb
ugFilename
);
|
703 |
|
$fil
eRWAccessi
ble = ($pe
rms & 0x00
04 && $per
ms & 0x000
2) ? true
: false;
|
|
703 |
|
$fil
eRWAccessi
ble = ($pe
rms & 0x00
04 && $per
ms & 0x000
2) ? true
: false;
|
704 |
|
}
|
|
704 |
|
}
|
705 |
|
if
( !$fileE
xists || !
$fileRWAcc
essible )
|
|
705 |
|
if
( !$fileE
xists || !
$fileRWAcc
essible )
|
706 |
|
{
|
|
706 |
|
{
|
707 |
|
$errorMe
ssage = 'D
ebug mode
enabled, b
ut debug f
ile is not
writable'
;
|
|
707 |
|
$errorMe
ssage = 'D
ebug mode
enabled, b
ut debug f
ile is not
writable'
;
|
708 |
|
return f
alse;
|
|
708 |
|
return f
alse;
|
709 |
|
}
|
|
709 |
|
}
|
710 |
|
}
|
|
710 |
|
}
|
711 |
|
|
|
711 |
|
|
712 |
|
return
true;
|
|
712 |
|
return
true;
|
713 |
|
}
|
|
713 |
|
}
|
714 |
|
|
|
714 |
|
|
715 |
|
/**
|
|
715 |
|
/**
|
716 |
|
* Perform
s common p
ayment tra
nsaction v
alidation
|
|
716 |
|
* Perform
s common p
ayment tra
nsaction v
alidation
|
717 |
|
*
|
|
717 |
|
*
|
718 |
|
* @param
int $local
TranID
- transact
ion ID
|
|
718 |
|
* @param
int $local
TranID
- transact
ion ID
|
719 |
|
* @param
string $am
ount
- payment
sum, recei
ved from t
he gateway
|
|
719 |
|
* @param
string $am
ount
- payment
sum, recei
ved from t
he gateway
|
720 |
|
* @param
string &$e
rrorMessag
e
- error me
ssage when
return re
sult is no
t true
|
|
720 |
|
* @param
string &$e
rrorMessag
e
- error me
ssage when
return re
sult is no
t true
|
721 |
|
*
|
|
721 |
|
*
|
722 |
|
* @return
bool
- true if
configurat
ion is val
id, false
otherwise
|
|
722 |
|
* @return
bool
- true if
configurat
ion is val
id, false
otherwise
|
723 |
|
*
|
|
723 |
|
*
|
724 |
|
*
|
|
724 |
|
*
|
725 |
|
*/
|
|
725 |
|
*/
|
726 |
|
function c
ommonValid
ateTransac
tion( $loc
alTranID,
$amount, &
$errorMess
age )
|
|
726 |
|
function c
ommonValid
ateTransac
tion( $loc
alTranID,
$amount, &
$errorMess
age )
|
727 |
|
{
|
|
727 |
|
{
|
728 |
|
global
$cryptKey
;
|
|
728 |
|
global
$cryptKey
;
|
729 |
|
|
|
729 |
|
|
730 |
|
// arg
uments val
idation
|
|
730 |
|
// arg
uments val
idation
|
731 |
|
$local
TranID = (
int)$local
TranID;
|
|
731 |
|
$local
TranID = (
int)$local
TranID;
|
732 |
|
|
|
732 |
|
|
733 |
|
$tranR
es = db_re
s( "SELECT
`Data` FR
OM `Transa
ctions`
|
|
733 |
|
$tranR
es = db_re
s( "SELECT
`Data` FR
OM `Transa
ctions`
|
734 |
|
WH
ERE `ID` =
{$localTr
anID}" );
|
|
734 |
|
WH
ERE `ID` =
{$localTr
anID}" );
|
735 |
|
if ( !
$tranRes |
| mysql_nu
m_rows($tr
anRes) ==
0 )
|
|
735 |
|
if ( !
$tranRes |
| mysql_nu
m_rows($tr
anRes) ==
0 )
|
736 |
|
{
|
|
736 |
|
{
|
737 |
|
$e
rrorMessag
e = 'Inval
id transac
tion ID';
|
|
737 |
|
$e
rrorMessag
e = 'Inval
id transac
tion ID';
|
738 |
|
re
turn false
;
|
|
738 |
|
re
turn false
;
|
739 |
|
}
|
|
739 |
|
}
|
740 |
|
|
|
740 |
|
|
741 |
|
$tranA
rr = mysql
_fetch_ass
oc( $tranR
es );
|
|
741 |
|
$tranA
rr = mysql
_fetch_ass
oc( $tranR
es );
|
742 |
|
$tranD
ata = tran
sStringToD
ata( $tran
Arr['Data'
] );
|
|
742 |
|
$tranD
ata = tran
sStringToD
ata( $tran
Arr['Data'
] );
|
743 |
|
|
|
743 |
|
|
744 |
|
if ( $
tranData['
amount'] !
= sprintf(
"%.2f", (
float)$amo
unt ) )
|
|
744 |
|
if ( $
tranData['
amount'] !
= sprintf(
"%.2f", (
float)$amo
unt ) )
|
745 |
|
{
|
|
745 |
|
{
|
746 |
|
$e
rrorMessag
e = 'Inval
id payment
sum';
|
|
746 |
|
$e
rrorMessag
e = 'Inval
id payment
sum';
|
747 |
|
re
turn false
;
|
|
747 |
|
re
turn false
;
|
748 |
|
}
|
|
748 |
|
}
|
749 |
|
|
|
749 |
|
|
750 |
|
$res =
db_res( "
SELECT `ID
` FROM `Pr
ofiles` WH
ERE `ID` =
{$tranDat
a['memberI
D']}" );
|
|
750 |
|
$res =
db_res( "
SELECT `ID
` FROM `Pr
ofiles` WH
ERE `ID` =
{$tranDat
a['memberI
D']}" );
|
751 |
|
if ( !
$res )
|
|
751 |
|
if ( !
$res )
|
752 |
|
{
|
|
752 |
|
{
|
753 |
|
$e
rrorMessag
e = 'Inval
id member
ID';
|
|
753 |
|
$e
rrorMessag
e = 'Inval
id member
ID';
|
754 |
|
re
turn false
;
|
|
754 |
|
re
turn false
;
|
755 |
|
}
|
|
755 |
|
}
|
756 |
|
|
|
756 |
|
|
757 |
|
if ( c
rypt($tran
Data['amou
nt'], $cry
ptKey) !=
$tranData[
'cryptedAm
ount'] ||
|
|
757 |
|
if ( c
rypt($tran
Data['amou
nt'], $cry
ptKey) !=
$tranData[
'cryptedAm
ount'] ||
|
758 |
|
c
rypt($tran
Data['data
'], $crypt
Key) != $t
ranData['c
ryptedData
'] )
|
|
758 |
|
c
rypt($tran
Data['data
'], $crypt
Key) != $t
ranData['c
ryptedData
'] )
|
759 |
|
{
|
|
759 |
|
{
|
760 |
|
$e
rrorMessag
e = 'Inval
id verific
ation data
';
|
|
760 |
|
$e
rrorMessag
e = 'Inval
id verific
ation data
';
|
761 |
|
re
turn false
;
|
|
761 |
|
re
turn false
;
|
762 |
|
}
|
|
762 |
|
}
|
763 |
|
|
|
763 |
|
|
764 |
|
return
true;
|
|
764 |
|
return
true;
|
765 |
|
}
|
|
765 |
|
}
|
766 |
|
|
|
766 |
|
|
767 |
|
/**
|
|
767 |
|
/**
|
768 |
|
* Writes
debug outp
ut to the
appropriat
e text fil
e
|
|
768 |
|
* Writes
debug outp
ut to the
appropriat
e text fil
e
|
769 |
|
*
|
|
769 |
|
*
|
770 |
|
* @param
string $da
taName
- name of
data to be
written
|
|
770 |
|
* @param
string $da
taName
- name of
data to be
written
|
771 |
|
* @param
undef $dat
a
- data to
be written
|
|
771 |
|
* @param
undef $dat
a
- data to
be written
|
772 |
|
* @param
bool $incl
udeDateTim
e
- indicate
s if date
and time s
hould be i
ncluded in
to the out
put
|
|
772 |
|
* @param
bool $incl
udeDateTim
e
- indicate
s if date
and time s
hould be i
ncluded in
to the out
put
|
773 |
|
*
|
|
773 |
|
*
|
774 |
|
* @return
bool
- true if
write succ
ess, false
otherwise
|
|
774 |
|
* @return
bool
- true if
write succ
ess, false
otherwise
|
775 |
|
*
|
|
775 |
|
*
|
776 |
|
*
|
|
776 |
|
*
|
777 |
|
*/
|
|
777 |
|
*/
|
778 |
|
function w
riteDebugL
og( $dataN
ame, $data
, $include
DateTime =
true )
|
|
778 |
|
function w
riteDebugL
og( $dataN
ame, $data
, $include
DateTime =
true )
|
779 |
|
{
|
|
779 |
|
{
|
780 |
|
global
$provider
Conf;
|
|
780 |
|
global
$provider
Conf;
|
781 |
|
global
$debugFil
ename;
|
|
781 |
|
global
$debugFil
ename;
|
782 |
|
|
|
782 |
|
|
783 |
|
if ( !
defined( '
PAYMENT_MO
DULE_NAME'
) )
|
|
783 |
|
if ( !
defined( '
PAYMENT_MO
DULE_NAME'
) )
|
784 |
|
re
turn false
;
|
|
784 |
|
re
turn false
;
|
785 |
|
|
|
785 |
|
|
786 |
|
$fileE
xists = fi
le_exists(
$debugFil
ename );
|
|
786 |
|
$fileE
xists = fi
le_exists(
$debugFil
ename );
|
787 |
|
if ( $
fileExists
)
|
|
787 |
|
if ( $
fileExists
)
|
788 |
|
{
|
|
788 |
|
{
|
789 |
|
cl
earstatcac
he();
|
|
789 |
|
cl
earstatcac
he();
|
790 |
|
$p
erms = fil
eperms( $d
ebugFilena
me );
|
|
790 |
|
$p
erms = fil
eperms( $d
ebugFilena
me );
|
791 |
|
$f
ileRWAcces
sible = ($
perms & 0x
0004 && $p
erms & 0x0
002) ? tru
e : false;
|
|
791 |
|
$f
ileRWAcces
sible = ($
perms & 0x
0004 && $p
erms & 0x0
002) ? tru
e : false;
|
792 |
|
}
|
|
792 |
|
}
|
793 |
|
|
|
793 |
|
|
794 |
|
if ( !
$fileExist
s || !$fil
eRWAccessi
ble )
|
|
794 |
|
if ( !
$fileExist
s || !$fil
eRWAccessi
ble )
|
795 |
|
re
turn false
;
|
|
795 |
|
re
turn false
;
|
796 |
|
|
|
796 |
|
|
797 |
|
$fp =
fopen( $de
bugFilenam
e, 'a' );
|
|
797 |
|
$fp =
fopen( $de
bugFilenam
e, 'a' );
|
798 |
|
|
|
798 |
|
|
799 |
|
if ( $
includeDat
eTime )
|
|
799 |
|
if ( $
includeDat
eTime )
|
800 |
|
fw
rite( $fp,
'Debug st
arted at '
. date ("
l dS of F
Y h:i:s A"
) . "\n" )
;
|
|
800 |
|
fw
rite( $fp,
'Debug st
arted at '
. date ("
l dS of F
Y h:i:s A"
) . "\n" )
;
|
801 |
|
|
|
801 |
|
|
802 |
|
if ( i
s_array($d
ata) )
|
|
802 |
|
if ( i
s_array($d
ata) )
|
803 |
|
{
|
|
803 |
|
{
|
804 |
|
fw
rite( $fp,
"\t{$data
Name}: Arr
ay\n" );
|
|
804 |
|
fw
rite( $fp,
"\t{$data
Name}: Arr
ay\n" );
|
805 |
|
fo
reach ( $d
ata as $ke
y => $valu
e )
|
|
805 |
|
fo
reach ( $d
ata as $ke
y => $valu
e )
|
806 |
|
fwrite(
$fp, "\t\t
{$key}: {$
value}\n"
);
|
|
806 |
|
fwrite(
$fp, "\t\t
{$key}: {$
value}\n"
);
|
807 |
|
}
|
|
807 |
|
}
|
808 |
|
else
|
|
808 |
|
else
|
809 |
|
{
|
|
809 |
|
{
|
810 |
|
fw
rite( $fp,
"\t{$data
Name}: {$d
ata}\n" );
|
|
810 |
|
fw
rite( $fp,
"\t{$data
Name}: {$d
ata}\n" );
|
811 |
|
}
|
|
811 |
|
}
|
812 |
|
|
|
812 |
|
|
813 |
|
fclose
( $fp );
|
|
813 |
|
fclose
( $fp );
|
814 |
|
|
|
814 |
|
|
815 |
|
return
true;
|
|
815 |
|
return
true;
|
816 |
|
}
|
|
816 |
|
}
|
817 |
|
|
|
817 |
|
|
818 |
|
/**
|
|
818 |
|
/**
|
819 |
|
* Calcula
tes financ
ial statis
tic for sp
ecified qu
ery parame
ters group
ed by
|
|
819 |
|
* Calcula
tes financ
ial statis
tic for sp
ecified qu
ery parame
ters group
ed by
|
820 |
|
* transac
tion type
for specif
ied affili
ate
|
|
820 |
|
* transac
tion type
for specif
ied affili
ate
|
821 |
|
*
|
|
821 |
|
*
|
822 |
|
* @param
int $affID
- affiliat
e ID
|
|
822 |
|
* @param
int $affID
- affiliat
e ID
|
823 |
|
* @param
array $tra
nArray
- array wi
th data fo
r transact
ion query
|
|
823 |
|
* @param
array $tra
nArray
- array wi
th data fo
r transact
ion query
|
824 |
|
*
( 'order
_num',
- select t
ransaction
with spec
ified orde
r number
|
|
824 |
|
*
( 'order
_num',
- select t
ransaction
with spec
ified orde
r number
|
825 |
|
*
'last_
days',
- select t
ransaction
s for spec
ified last
days
|
|
825 |
|
*
'last_
days',
- select t
ransaction
s for spec
ified last
days
|
826 |
|
*
'exact
_date',
- select t
ransaction
s for spec
ified date
|
|
826 |
|
*
'exact
_date',
- select t
ransaction
s for spec
ified date
|
827 |
|
*
'betwe
en_date1',
- select t
ransaction
s between
date1 and
date2
|
|
827 |
|
*
'betwe
en_date1',
- select t
ransaction
s between
date1 and
date2
|
828 |
|
*
'betwe
en_date2'
)
|
|
828 |
|
*
'betwe
en_date2'
)
|
829 |
|
*
|
|
829 |
|
*
|
830 |
|
* @return
array
- array wi
th financi
al statist
ic
|
|
830 |
|
* @return
array
- array wi
th financi
al statist
ic
|
831 |
|
*
( 'membe
rship_amou
nt',
- sum of m
embership
transactio
ns
|
|
831 |
|
*
( 'membe
rship_amou
nt',
- sum of m
embership
transactio
ns
|
832 |
|
*
'sales
_amount',
- sum of p
rofile pur
chase tran
sactions
|
|
832 |
|
*
'sales
_amount',
- sum of p
rofile pur
chase tran
sactions
|
833 |
|
*
'sdati
ng_amount'
,
- sum of S
peedDating
ticket pu
rchase tra
nsactions
|
|
833 |
|
*
'sdati
ng_amount'
,
- sum of S
peedDating
ticket pu
rchase tra
nsactions
|
834 |
|
*
'total
' )
- total su
m
|
|
834 |
|
*
'total
' )
- total su
m
|
835 |
|
*
|
|
835 |
|
*
|
836 |
|
*
|
|
836 |
|
*
|
837 |
|
*/
|
|
837 |
|
*/
|
838 |
|
function g
etFinanceA
ffStat( $a
ffID, $tra
nArray )
|
|
838 |
|
function g
etFinanceA
ffStat( $a
ffID, $tra
nArray )
|
839 |
|
{
|
|
839 |
|
{
|
840 |
|
global
$currency
_code;
|
|
840 |
|
global
$currency
_code;
|
841 |
|
global
$separato
r;
|
|
841 |
|
global
$separato
r;
|
842 |
|
|
|
842 |
|
|
843 |
|
$affID
= (int)$a
ffID;
|
|
843 |
|
$affID
= (int)$a
ffID;
|
844 |
|
|
|
844 |
|
|
845 |
|
if ( i
sset($tran
Array['ord
er_num'])
)
|
|
845 |
|
if ( i
sset($tran
Array['ord
er_num'])
)
|
846 |
|
{
|
|
846 |
|
{
|
847 |
|
$t
ranFilter
= "`gtwTra
nsactionID
` = '". pr
ocess_db_i
nput( $tra
nArray['or
der_num'],
0, 1 ) ."
'";
|
|
847 |
|
$t
ranFilter
= "`gtwTra
nsactionID
` = '". pr
ocess_db_i
nput( $tra
nArray['or
der_num'],
0, 1 ) ."
'";
|
848 |
|
}
|
|
848 |
|
}
|
849 |
|
elseif
( isset($
tranArray[
'last_days
']) )
|
|
849 |
|
elseif
( isset($
tranArray[
'last_days
']) )
|
850 |
|
{
|
|
850 |
|
{
|
851 |
|
$t
ranFilter
= "( TO_DA
YS( NOW()
) - TO_DAY
S( `Date`
) <= ". ((
int)$tranA
rray['last
_days']) .
" )";
|
|
851 |
|
$t
ranFilter
= "( TO_DA
YS( NOW()
) - TO_DAY
S( `Date`
) <= ". ((
int)$tranA
rray['last
_days']) .
" )";
|
852 |
|
}
|
|
852 |
|
}
|
853 |
|
elseif
( isset($
tranArray[
'exact_dat
e']) )
|
|
853 |
|
elseif
( isset($
tranArray[
'exact_dat
e']) )
|
854 |
|
{
|
|
854 |
|
{
|
855 |
|
$e
xactDate =
strtotime
( $tranArr
ay['exact_
date'] );
|
|
855 |
|
$e
xactDate =
strtotime
( $tranArr
ay['exact_
date'] );
|
856 |
|
if
( $exactD
ate != -1
)
|
|
856 |
|
if
( $exactD
ate != -1
)
|
857 |
|
$tranFil
ter = "TO_
DAYS( FROM
_UNIXTIME(
$exactDate
) ) = TO_D
AYS( `Date
` )";
|
|
857 |
|
$tranFil
ter = "TO_
DAYS( FROM
_UNIXTIME(
$exactDate
) ) = TO_D
AYS( `Date
` )";
|
858 |
|
el
se
|
|
858 |
|
el
se
|
859 |
|
$tranFil
ter = "1";
|
|
859 |
|
$tranFil
ter = "1";
|
860 |
|
}
|
|
860 |
|
}
|
861 |
|
elseif
( isset($
tranArray[
'between_d
ate1']) &&
isset($tr
anArray['b
etween_dat
e2']) )
|
|
861 |
|
elseif
( isset($
tranArray[
'between_d
ate1']) &&
isset($tr
anArray['b
etween_dat
e2']) )
|
862 |
|
{
|
|
862 |
|
{
|
863 |
|
if
( $tranAr
ray['betwe
en_date1']
== 'start
' )
|
|
863 |
|
if
( $tranAr
ray['betwe
en_date1']
== 'start
' )
|
864 |
|
$between
Date1 = 0;
|
|
864 |
|
$between
Date1 = 0;
|
865 |
|
el
seif ( $tr
anArray['b
etween_dat
e1'] == 'n
ow' )
|
|
865 |
|
el
seif ( $tr
anArray['b
etween_dat
e1'] == 'n
ow' )
|
866 |
|
$between
Date1 = ti
me();
|
|
866 |
|
$between
Date1 = ti
me();
|
867 |
|
el
se
|
|
867 |
|
el
se
|
868 |
|
$between
Date1 = st
rtotime( $
tranArray[
'between_d
ate1'] );
|
|
868 |
|
$between
Date1 = st
rtotime( $
tranArray[
'between_d
ate1'] );
|
869 |
|
if
( $tranAr
ray['betwe
en_date2']
== 'start
' )
|
|
869 |
|
if
( $tranAr
ray['betwe
en_date2']
== 'start
' )
|
870 |
|
$between
Date2 = 0;
|
|
870 |
|
$between
Date2 = 0;
|
871 |
|
el
seif ( $tr
anArray['b
etween_dat
e2'] == 'n
ow' )
|
|
871 |
|
el
seif ( $tr
anArray['b
etween_dat
e2'] == 'n
ow' )
|
872 |
|
$between
Date2 = ti
me();
|
|
872 |
|
$between
Date2 = ti
me();
|
873 |
|
el
se
|
|
873 |
|
el
se
|
874 |
|
$between
Date2 = st
rtotime( $
tranArray[
'between_d
ate2'] );
|
|
874 |
|
$between
Date2 = st
rtotime( $
tranArray[
'between_d
ate2'] );
|
875 |
|
|
|
875 |
|
|
876 |
|
if
( $betwee
nDate1 !=
-1 && $bet
weenDate2
!= -1 )
|
|
876 |
|
if
( $betwee
nDate1 !=
-1 && $bet
weenDate2
!= -1 )
|
877 |
|
$tranFil
ter = "( T
O_DAYS( FR
OM_UNIXTIM
E($between
Date1) ) <
= TO_DAYS(
`Date` )
AND TO_DAY
S( FROM_UN
IXTIME($be
tweenDate2
) ) >= TO_
DAYS( `Dat
e` ) )";
|
|
877 |
|
$tranFil
ter = "( T
O_DAYS( FR
OM_UNIXTIM
E($between
Date1) ) <
= TO_DAYS(
`Date` )
AND TO_DAY
S( FROM_UN
IXTIME($be
tweenDate2
) ) >= TO_
DAYS( `Dat
e` ) )";
|
878 |
|
el
se
|
|
878 |
|
el
se
|
879 |
|
$tranFil
ter = "1";
|
|
879 |
|
$tranFil
ter = "1";
|
880 |
|
}
|
|
880 |
|
}
|
881 |
|
else
|
|
881 |
|
else
|
882 |
|
{
|
|
882 |
|
{
|
883 |
|
$t
ranFilter
= "1";
|
|
883 |
|
$t
ranFilter
= "1";
|
884 |
|
}
|
|
884 |
|
}
|
885 |
|
|
|
885 |
|
|
886 |
|
// Fil
l the arra
y
|
|
886 |
|
// Fil
l the arra
y
|
887 |
|
$fin =
array();
|
|
887 |
|
$fin =
array();
|
888 |
|
$arr =
db_arr( "
SELECT `Pe
rcent` FRO
M `aff` WH
ERE `ID` =
$affID");
|
|
888 |
|
$arr =
db_arr( "
SELECT `Pe
rcent` FRO
M `aff` WH
ERE `ID` =
$affID");
|
889 |
|
$perce
nt = (floa
t)$arr['Pe
rcent'] /
100.0;
|
|
889 |
|
$perce
nt = (floa
t)$arr['Pe
rcent'] /
100.0;
|
890 |
|
$arr =
db_arr( "
SELECT SUM
( `Amount`
) FROM `T
ransaction
s` INNER J
OIN `aff_m
embers` ON
(`idProfi
le` = `IDM
ember`) WH
ERE {$tran
Filter} AN
D `idAff`
= {$affID}
AND `Stat
us` = 'app
roved' AND
`Data` LI
KE '%{$sep
arator}mem
bership{$s
eparator}%
' AND `Cur
rency` = '
{$currency
_code}'" )
;
|
|
890 |
|
$arr =
db_arr( "
SELECT SUM
( `Amount`
) FROM `T
ransaction
s` INNER J
OIN `aff_m
embers` ON
(`idProfi
le` = `IDM
ember`) WH
ERE {$tran
Filter} AN
D `idAff`
= {$affID}
AND `Stat
us` = 'app
roved' AND
`Data` LI
KE '%{$sep
arator}mem
bership{$s
eparator}%
' AND `Cur
rency` = '
{$currency
_code}'" )
;
|
891 |
|
$fin['
membership
_amount']
= sprintf(
"%.2f", $
percent *
(float)$ar
r[0] );
|
|
891 |
|
$fin['
membership
_amount']
= sprintf(
"%.2f", $
percent *
(float)$ar
r[0] );
|
892 |
|
$arr =
db_arr( "
SELECT SUM
( `Amount`
) FROM `T
ransaction
s` INNER J
OIN `aff_m
embers` ON
(`idProfi
le` = `IDM
ember`) WH
ERE {$tran
Filter} AN
D `idAff`
= {$affID}
AND `Stat
us` = 'app
roved' AND
`Data` LI
KE '%{$sep
arator}pro
files{$sep
arator}%'
AND `Curre
ncy` = '{$
currency_c
ode}'" );
|
|
892 |
|
$arr =
db_arr( "
SELECT SUM
( `Amount`
) FROM `T
ransaction
s` INNER J
OIN `aff_m
embers` ON
(`idProfi
le` = `IDM
ember`) WH
ERE {$tran
Filter} AN
D `idAff`
= {$affID}
AND `Stat
us` = 'app
roved' AND
`Data` LI
KE '%{$sep
arator}pro
files{$sep
arator}%'
AND `Curre
ncy` = '{$
currency_c
ode}'" );
|
893 |
|
$fin['
sales_amou
nt'] = spr
intf( "%.2
f", $perce
nt * (floa
t)$arr[0]
);
|
|
893 |
|
$fin['
sales_amou
nt'] = spr
intf( "%.2
f", $perce
nt * (floa
t)$arr[0]
);
|
894 |
|
$arr =
db_arr( "
SELECT SUM
( `Amount`
) FROM `T
ransaction
s` INNER J
OIN `aff_m
embers` ON
(`idProfi
le` = `IDM
ember`) WH
ERE {$tran
Filter} AN
D `idAff`
= {$affID}
AND `Stat
us` = 'app
roved' AND
`Data` LI
KE '%{$sep
arator}spe
eddating{$
separator}
%' AND `Cu
rrency` =
'{$currenc
y_code}'"
);
|
|
894 |
|
$arr =
db_arr( "
SELECT SUM
( `Amount`
) FROM `T
ransaction
s` INNER J
OIN `aff_m
embers` ON
(`idProfi
le` = `IDM
ember`) WH
ERE {$tran
Filter} AN
D `idAff`
= {$affID}
AND `Stat
us` = 'app
roved' AND
`Data` LI
KE '%{$sep
arator}spe
eddating{$
separator}
%' AND `Cu
rrency` =
'{$currenc
y_code}'"
);
|
895 |
|
$fin['
sdating_am
ount'] = s
printf( "%
.2f", $per
cent * (fl
oat)$arr[0
] );
|
|
895 |
|
$fin['
sdating_am
ount'] = s
printf( "%
.2f", $per
cent * (fl
oat)$arr[0
] );
|
896 |
|
$arr =
db_arr( "
SELECT SUM
( `Amount`
) FROM `T
ransaction
s` INNER J
OIN `aff_m
embers` ON
(`idProfi
le` = `IDM
ember`) WH
ERE {$tran
Filter} AN
D `idAff`
= {$affID}
AND `Stat
us` = 'app
roved' AND
`Currency
` = '{$cur
rency_code
}'" );
|
|
896 |
|
$arr =
db_arr( "
SELECT SUM
( `Amount`
) FROM `T
ransaction
s` INNER J
OIN `aff_m
embers` ON
(`idProfi
le` = `IDM
ember`) WH
ERE {$tran
Filter} AN
D `idAff`
= {$affID}
AND `Stat
us` = 'app
roved' AND
`Currency
` = '{$cur
rency_code
}'" );
|
897 |
|
$fin['
total'] =
sprintf( "
%.2f", $pe
rcent * (f
loat)$arr[
0] );
|
|
897 |
|
$fin['
total'] =
sprintf( "
%.2f", $pe
rcent * (f
loat)$arr[
0] );
|
898 |
|
|
|
898 |
|
|
899 |
|
return
$fin;
|
|
899 |
|
return
$fin;
|
900 |
|
}
|
|
900 |
|
}
|
901 |
|
|
|
901 |
|
|
902 |
|
/**
|
|
902 |
|
/**
|
903 |
|
* Calcula
tes financ
ial statis
tic for sp
ecified qu
ery parame
ters group
ed by
|
|
903 |
|
* Calcula
tes financ
ial statis
tic for sp
ecified qu
ery parame
ters group
ed by
|
904 |
|
* transac
tion type
|
|
904 |
|
* transac
tion type
|
905 |
|
*
|
|
905 |
|
*
|
906 |
|
* @param
array $tra
nArray
- array wi
th data fo
r transact
ion query
|
|
906 |
|
* @param
array $tra
nArray
- array wi
th data fo
r transact
ion query
|
907 |
|
*
( 'order
_num',
- select t
ransaction
with spec
ified orde
r number
|
|
907 |
|
*
( 'order
_num',
- select t
ransaction
with spec
ified orde
r number
|
908 |
|
*
'last_
days',
- select t
ransaction
s for spec
ified last
days
|
|
908 |
|
*
'last_
days',
- select t
ransaction
s for spec
ified last
days
|
909 |
|
*
'exact
_date',
- select t
ransaction
s for spec
ified date
|
|
909 |
|
*
'exact
_date',
- select t
ransaction
s for spec
ified date
|
910 |
|
*
'betwe
en_date1',
- select t
ransaction
s between
date1 and
date2
|
|
910 |
|
*
'betwe
en_date1',
- select t
ransaction
s between
date1 and
date2
|
911 |
|
*
'betwe
en_date2'
)
|
|
911 |
|
*
'betwe
en_date2'
)
|
912 |
|
*
|
|
912 |
|
*
|
913 |
|
* @return
array
- array wi
th financi
al statist
ic
|
|
913 |
|
* @return
array
- array wi
th financi
al statist
ic
|
914 |
|
*
( 'membe
rship_amou
nt',
- sum of m
embership
transactio
ns
|
|
914 |
|
*
( 'membe
rship_amou
nt',
- sum of m
embership
transactio
ns
|
915 |
|
*
'sales
_amount',
- sum of p
rofile pur
chase tran
sactions
|
|
915 |
|
*
'sales
_amount',
- sum of p
rofile pur
chase tran
sactions
|
916 |
|
*
'sdati
ng_amount'
,
- sum of S
peedDating
ticket pu
rchase tra
nsactions
|
|
916 |
|
*
'sdati
ng_amount'
,
- sum of S
peedDating
ticket pu
rchase tra
nsactions
|
917 |
|
*
'total
' )
- total su
m
|
|
917 |
|
*
'total
' )
- total su
m
|
918 |
|
*
|
|
918 |
|
*
|
919 |
|
*
|
|
919 |
|
*
|
920 |
|
*/
|
|
920 |
|
*/
|
921 |
|
function g
etFinanceS
tat( $tran
Array )
|
|
921 |
|
function g
etFinanceS
tat( $tran
Array )
|
922 |
|
{
|
|
922 |
|
{
|
923 |
|
global
$currency
_code;
|
|
923 |
|
global
$currency
_code;
|
924 |
|
global
$separato
r;
|
|
924 |
|
global
$separato
r;
|
925 |
|
|
|
925 |
|
|
926 |
|
if ( i
sset($tran
Array['ord
er_num'])
)
|
|
926 |
|
if ( i
sset($tran
Array['ord
er_num'])
)
|
927 |
|
{
|
|
927 |
|
{
|
928 |
|
$t
ranFilter
= "`gtwTra
nsactionID
` = '". pr
ocess_db_i
nput( $tra
nArray['or
der_num'],
0, 1 ) ."
'";
|
|
928 |
|
$t
ranFilter
= "`gtwTra
nsactionID
` = '". pr
ocess_db_i
nput( $tra
nArray['or
der_num'],
0, 1 ) ."
'";
|
929 |
|
}
|
|
929 |
|
}
|
930 |
|
elseif
( isset($
tranArray[
'last_days
']) )
|
|
930 |
|
elseif
( isset($
tranArray[
'last_days
']) )
|
931 |
|
{
|
|
931 |
|
{
|
932 |
|
$t
ranFilter
= "( TO_DA
YS( NOW()
) - TO_DAY
S( `Date`
) <= ". ((
int)$tranA
rray['last
_days']) .
" )";
|
|
932 |
|
$t
ranFilter
= "( TO_DA
YS( NOW()
) - TO_DAY
S( `Date`
) <= ". ((
int)$tranA
rray['last
_days']) .
" )";
|
933 |
|
}
|
|
933 |
|
}
|
934 |
|
elseif
( isset($
tranArray[
'exact_dat
e']) )
|
|
934 |
|
elseif
( isset($
tranArray[
'exact_dat
e']) )
|
935 |
|
{
|
|
935 |
|
{
|
936 |
|
$e
xactDate =
strtotime
( $tranArr
ay['exact_
date'] );
|
|
936 |
|
$e
xactDate =
strtotime
( $tranArr
ay['exact_
date'] );
|
937 |
|
if
( $exactD
ate != -1
)
|
|
937 |
|
if
( $exactD
ate != -1
)
|
938 |
|
$tranFil
ter = "TO_
DAYS( FROM
_UNIXTIME(
$exactDate
) ) = TO_D
AYS( `Date
` )";
|
|
938 |
|
$tranFil
ter = "TO_
DAYS( FROM
_UNIXTIME(
$exactDate
) ) = TO_D
AYS( `Date
` )";
|
939 |
|
el
se
|
|
939 |
|
el
se
|
940 |
|
$tranFil
ter = "1";
|
|
940 |
|
$tranFil
ter = "1";
|
941 |
|
}
|
|
941 |
|
}
|
942 |
|
elseif
( isset($
tranArray[
'between_d
ate1']) &&
isset($tr
anArray['b
etween_dat
e2']) )
|
|
942 |
|
elseif
( isset($
tranArray[
'between_d
ate1']) &&
isset($tr
anArray['b
etween_dat
e2']) )
|
943 |
|
{
|
|
943 |
|
{
|
944 |
|
if
( $tranAr
ray['betwe
en_date1']
== 'start
' )
|
|
944 |
|
if
( $tranAr
ray['betwe
en_date1']
== 'start
' )
|
945 |
|
$between
Date1 = 0;
|
|
945 |
|
$between
Date1 = 0;
|
946 |
|
el
seif ( $tr
anArray['b
etween_dat
e1'] == 'n
ow' )
|
|
946 |
|
el
seif ( $tr
anArray['b
etween_dat
e1'] == 'n
ow' )
|
947 |
|
$between
Date1 = ti
me();
|
|
947 |
|
$between
Date1 = ti
me();
|
948 |
|
el
se
|
|
948 |
|
el
se
|
949 |
|
$between
Date1 = st
rtotime( $
tranArray[
'between_d
ate1'] );
|
|
949 |
|
$between
Date1 = st
rtotime( $
tranArray[
'between_d
ate1'] );
|
950 |
|
if
( $tranAr
ray['betwe
en_date2']
== 'start
' )
|
|
950 |
|
if
( $tranAr
ray['betwe
en_date2']
== 'start
' )
|
951 |
|
$between
Date2 = 0;
|
|
951 |
|
$between
Date2 = 0;
|
952 |
|
el
seif ( $tr
anArray['b
etween_dat
e2'] == 'n
ow' )
|
|
952 |
|
el
seif ( $tr
anArray['b
etween_dat
e2'] == 'n
ow' )
|
953 |
|
$between
Date2 = ti
me();
|
|
953 |
|
$between
Date2 = ti
me();
|
954 |
|
el
se
|
|
954 |
|
el
se
|
955 |
|
$between
Date2 = st
rtotime( $
tranArray[
'between_d
ate2'] );
|
|
955 |
|
$between
Date2 = st
rtotime( $
tranArray[
'between_d
ate2'] );
|
956 |
|
|
|
956 |
|
|
957 |
|
if
( $betwee
nDate1 !=
-1 && $bet
weenDate2
!= -1 )
|
|
957 |
|
if
( $betwee
nDate1 !=
-1 && $bet
weenDate2
!= -1 )
|
958 |
|
$tranFil
ter = "( T
O_DAYS( FR
OM_UNIXTIM
E($between
Date1) ) <
= TO_DAYS(
`Date` )
AND TO_DAY
S( FROM_UN
IXTIME($be
tweenDate2
) ) >= TO_
DAYS( `Dat
e` ) )";
|
|
958 |
|
$tranFil
ter = "( T
O_DAYS( FR
OM_UNIXTIM
E($between
Date1) ) <
= TO_DAYS(
`Date` )
AND TO_DAY
S( FROM_UN
IXTIME($be
tweenDate2
) ) >= TO_
DAYS( `Dat
e` ) )";
|
959 |
|
el
se
|
|
959 |
|
el
se
|
960 |
|
$tranFil
ter = "1";
|
|
960 |
|
$tranFil
ter = "1";
|
961 |
|
}
|
|
961 |
|
}
|
962 |
|
else
|
|
962 |
|
else
|
963 |
|
{
|
|
963 |
|
{
|
964 |
|
$t
ranFilter
= "1";
|
|
964 |
|
$t
ranFilter
= "1";
|
965 |
|
}
|
|
965 |
|
}
|
966 |
|
|
|
966 |
|
|
967 |
|
// Fil
l the arra
y
|
|
967 |
|
// Fil
l the arra
y
|
968 |
|
$fin =
array();
|
|
968 |
|
$fin =
array();
|
969 |
|
$arr =
db_arr( "
SELECT SUM
( `Amount`
) FROM `T
ransaction
s` WHERE {
$tranFilte
r} AND `St
atus` = 'a
pproved' A
ND `Data`
LIKE '%{$s
eparator}m
embership{
$separator
}%' AND `C
urrency` =
'{$curren
cy_code}'"
);
|
|
969 |
|
$arr =
db_arr( "
SELECT SUM
( `Amount`
) FROM `T
ransaction
s` WHERE {
$tranFilte
r} AND `St
atus` = 'a
pproved' A
ND `Data`
LIKE '%{$s
eparator}m
embership{
$separator
}%' AND `C
urrency` =
'{$curren
cy_code}'"
);
|
970 |
|
$fin['
membership
_amount']
= sprintf(
"%.2f", (
float)$arr
[0] );
|
|
970 |
|
$fin['
membership
_amount']
= sprintf(
"%.2f", (
float)$arr
[0] );
|
971 |
|
$arr =
db_arr( "
SELECT SUM
( `Amount`
) FROM `T
ransaction
s` WHERE {
$tranFilte
r} AND `St
atus` = 'a
pproved' A
ND `Data`
LIKE '%{$s
eparator}p
rofiles{$s
eparator}%
' AND `Cur
rency` = '
{$currency
_code}'" )
;
|
|
971 |
|
$arr =
db_arr( "
SELECT SUM
( `Amount`
) FROM `T
ransaction
s` WHERE {
$tranFilte
r} AND `St
atus` = 'a
pproved' A
ND `Data`
LIKE '%{$s
eparator}p
rofiles{$s
eparator}%
' AND `Cur
rency` = '
{$currency
_code}'" )
;
|
972 |
|
$fin['
sales_amou
nt'] = spr
intf( "%.2
f", (float
)$arr[0] )
;
|
|
972 |
|
$fin['
sales_amou
nt'] = spr
intf( "%.2
f", (float
)$arr[0] )
;
|
973 |
|
$arr =
db_arr( "
SELECT SUM
( `Amount`
) FROM `T
ransaction
s` WHERE {
$tranFilte
r} AND `St
atus` = 'a
pproved' A
ND `Data`
LIKE '%{$s
eparator}s
peeddating
{$separato
r}%' AND `
Currency`
= '{$curre
ncy_code}'
" );
|
|
973 |
|
$arr =
db_arr( "
SELECT SUM
( `Amount`
) FROM `T
ransaction
s` WHERE {
$tranFilte
r} AND `St
atus` = 'a
pproved' A
ND `Data`
LIKE '%{$s
eparator}s
peeddating
{$separato
r}%' AND `
Currency`
= '{$curre
ncy_code}'
" );
|
974 |
|
$fin['
sdating_am
ount'] = s
printf( "%
.2f", (flo
at)$arr[0]
);
|
|
974 |
|
$fin['
sdating_am
ount'] = s
printf( "%
.2f", (flo
at)$arr[0]
);
|
975 |
|
$arr =
db_arr( "
SELECT SUM
( `Amount`
) FROM `T
ransaction
s` WHERE {
$tranFilte
r} AND `St
atus` = 'a
pproved' A
ND `Curren
cy` = '{$c
urrency_co
de}'" );
|
|
975 |
|
$arr =
db_arr( "
SELECT SUM
( `Amount`
) FROM `T
ransaction
s` WHERE {
$tranFilte
r} AND `St
atus` = 'a
pproved' A
ND `Curren
cy` = '{$c
urrency_co
de}'" );
|
976 |
|
$fin['
total'] =
sprintf( "
%.2f", (fl
oat)$arr[0
] );
|
|
976 |
|
$fin['
total'] =
sprintf( "
%.2f", (fl
oat)$arr[0
] );
|
977 |
|
|
|
977 |
|
|
978 |
|
return
$fin;
|
|
978 |
|
return
$fin;
|
979 |
|
}
|
|
979 |
|
}
|
980 |
|
|
|
980 |
|
|
981 |
|
?>
|
|
981 |
|
?>
|