763. File Comparison Report

Produced on Mon May 12 13:07:03 2008 UTC. This report uses XHTML and CSS2, and is best viewed with a reasonably standards compliant browser such as the latest version of Firefox or Internet Explorer. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

763.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.0.5 checkout.php Thu Sep 20 09:00:22 2007 UTC
2 Dolphin-v.6.1.0 checkout.php Sat Apr 26 08:19:18 2008 UTC

763.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 10 826
Changed 0 0
Inserted 0 0
Removed 9 94

763.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

763.4 Active regular expressions

No regular expressions were active.

763.5 Comparison detail

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( 'inc/h eader.inc. php' );   21   require_on ce( 'inc/h eader.inc. php' );
22   require_on ce( BX_DIR ECTORY_PAT H_INC . 'd esign.inc. php' );   22   require_on ce( BX_DIR ECTORY_PAT H_INC . 'd esign.inc. php' );
23   require_on ce( BX_DIR ECTORY_PAT H_INC . 'p rofiles.in c.php' );   23   require_on ce( BX_DIR ECTORY_PAT H_INC . 'p rofiles.in c.php' );
24   require_on ce( BX_DIR ECTORY_PAT H_INC . 'c heckout.in c.php' );   24   require_on ce( BX_DIR ECTORY_PAT H_INC . 'c heckout.in c.php' );
25     25  
26   // ------- -------- p age variab les and lo gin   26   // ------- -------- p age variab les and lo gin
27     27  
28   $_page['na me_index']     = 56;   28   $_page['na me_index']     = 56;
29   $_page['cs s_name']       = 'che ckout.css' ;   29   $_page['cs s_name']       = 'che ckout.css' ;
30     30  
31   $logged['m ember'] =  member_aut h( 0 );   31   $logged['m ember'] =  member_aut h( 0 );
32     32  
33   $_page['he ader'] = _ t('_CHECKO UT_H');   33   $_page['he ader'] = _ t('_CHECKO UT_H');
34   $_page['he ader_text' ] = _t('_C HECKOUT_H' );   34   $_page['he ader_text' ] = _t('_C HECKOUT_H' );
35     35  
36   define( 'P AYMENT_MOD ULE_AS_HEA DER', 'on'  );   36   define( 'P AYMENT_MOD ULE_AS_HEA DER', 'on'  );
37     37  
38   $en_credit s = (getPa ram('en_cr edits') ==  'on');    
39   $credit2mo ney = getP aram('cred it2money') ;  // how  many credi ts for one  money uni t    
40   $collectDa taArr = ar ray(); //  array with  collected  data   38   $collectDa taArr = ar ray(); //  array with  collected  data
41   $collectDa taInputs =  '';  // s tring with  inputs fo r data res ending   39   $collectDa taInputs =  '';  // s tring with  inputs fo r data res ending
42     40  
43   // ------- -------- p age compon ents   41   // ------- -------- p age compon ents
44     42  
45   $_ni = $_p age['name_ index'];   43   $_ni = $_p age['name_ index'];
46     44  
47   switch ( $ _REQUEST[' action'] )   45   switch ( $ _REQUEST[' action'] )
48   {   46   {
49       case ' calculate' :   47       case ' calculate' :
50           $c alculateAr r = Calcul ateCheckou tInfo( $_R EQUEST );   48           $c alculateAr r = Calcul ateCheckou tInfo( $_R EQUEST );
51           if  ( $calcul ateArr ===  false )   49           if  ( $calcul ateArr ===  false )
52           {   50           {
53                PageComp ErrorMessa ge( _t('_n o data giv en') );   51                PageComp ErrorMessa ge( _t('_n o data giv en') );
54           }   52           }
55           $r es = Colle ctCheckout Info( $cal culateArr  );   53           $r es = Colle ctCheckout Info( $cal culateArr  );
56           if  ( !$res )   54           if  ( !$res )
57           {   55           {
58                PageComp ErrorMessa ge( _t('_n o data giv en') );   56                PageComp ErrorMessa ge( _t('_n o data giv en') );
59           }   57           }
60           el se   58           el se
61           {   59           {
62                $_page_c ont[$_ni][ 'checkout_ info'] = D esignBoxCo ntent( _t( '_Payment  info'), Pa geCompChec koutInfo() , $oTemplC onfig -> P ageCompChe ckoutInfo_ db_num );   60                $_page_c ont[$_ni][ 'checkout_ info'] = D esignBoxCo ntent( _t( '_Payment  info'), Pa geCompChec koutInfo() , $oTemplC onfig -> P ageCompChe ckoutInfo_ db_num );
63                $_page_c ont[$_ni][ 'provider_ list'] = D esignBoxCo ntent( _t( '_Payment  methods'),  PageCompP roviderLis t(), $oTem plConfig - > PageComp ProviderLi st_db_num  );   61                $_page_c ont[$_ni][ 'provider_ list'] = D esignBoxCo ntent( _t( '_Payment  methods'),  PageCompP roviderLis t(), $oTem plConfig - > PageComp ProviderLi st_db_num  );
64           }   62           }
65           br eak;   63           br eak;
66     64  
67       case ' collect':   65       case ' collect':
68           $r es = Colle ctCheckout Info( $_RE QUEST );   66           $r es = Colle ctCheckout Info( $_RE QUEST );
69           if  ( !$res )   67           if  ( !$res )
70           {   68           {
71                PageComp ErrorMessa ge( _t('_n o data giv en') );   69                PageComp ErrorMessa ge( _t('_n o data giv en') );
72           }   70           }
73           el se   71           el se
74           {   72           {
75                $_page_c ont[$_ni][ 'checkout_ info'] = D esignBoxCo ntent( _t( '_Payment  info'), Pa geCompChec koutInfo() , $oTemplC onfig -> P ageCompChe ckoutInfo_ db_num );   73                $_page_c ont[$_ni][ 'checkout_ info'] = D esignBoxCo ntent( _t( '_Payment  info'), Pa geCompChec koutInfo() , $oTemplC onfig -> P ageCompChe ckoutInfo_ db_num );
76                $_page_c ont[$_ni][ 'provider_ list'] = D esignBoxCo ntent( _t( '_Payment  methods'),  PageCompP roviderLis t(), $oTem plConfig - > PageComp ProviderLi st_db_num  );   74                $_page_c ont[$_ni][ 'provider_ list'] = D esignBoxCo ntent( _t( '_Payment  methods'),  PageCompP roviderLis t(), $oTem plConfig - > PageComp ProviderLi st_db_num  );
77           }   75           }
78           br eak;   76           br eak;
79     77  
80       case ' start_chec kout':   78       case ' start_chec kout':
81           $r es = Colle ctCheckout Info( $_RE QUEST );   79           $r es = Colle ctCheckout Info( $_RE QUEST );
82           if  ( !$res )   80           if  ( !$res )
83           {   81           {
84                PageComp ErrorMessa ge( _t('_n o data giv en') );   82                PageComp ErrorMessa ge( _t('_n o data giv en') );
85           }   83           }
86           el se   84           el se
87           {   85           {
88                $res = S tartChecko ut( $error Message );   86                $res = S tartChecko ut( $error Message );
89                if ( !$r es )   87                if ( !$r es )
90                {   88                {
91                    Page CompErrorM essage( $e rrorMessag e );   89                    Page CompErrorM essage( $e rrorMessag e );
92                }   90                }
93           }   91           }
94           br eak;   92           br eak;
95     93  
96       defaul t:   94       defaul t:
97           Pa geCompErro rMessage(  _t('_no da ta given')  );   95           Pa geCompErro rMessage(  _t('_no da ta given')  );
98           br eak;   96           br eak;
99   }   97   }
100     98  
101   // ------- -------- [ END] page  components   99   // ------- -------- [ END] page  components
102     100  
103   PageCode() ;   101   PageCode() ;
104     102  
105   // ------- -------- p age compon ents funct ions   103   // ------- -------- p age compon ents funct ions
106     104  
107   /**   105   /**
108    * calcula te checkou t info   106    * calcula te checkou t info
109    */   107    */
110   function C alculateCh eckoutInfo ( $source  )   108   function C alculateCh eckoutInfo ( $source  )
111   {   109   {
112       if ( ! isset($sou rce['check out_action ']) || str len($sourc e['data'])  == 0 )   110       if ( ! isset($sou rce['check out_action ']) || str len($sourc e['data'])  == 0 )
113           re turn false ;   111           re turn false ;
114     112  
115       $res =  array();   113       $res =  array();
116     114  
117       $res[' checkout_a ction'] =  $source['c heckout_ac tion'];   115       $res[' checkout_a ction'] =  $source['c heckout_ac tion'];
118       $res[' data'] = $ source['da ta'];   116       $res[' data'] = $ source['da ta'];
119       if ( i sset($sour ce['allow_ subscribe' ]) )   117       if ( i sset($sour ce['allow_ subscribe' ]) )
120       {   118       {
121           $r es['allow_ subscribe' ] = $sourc e['allow_s ubscribe'] ;   119           $r es['allow_ subscribe' ] = $sourc e['allow_s ubscribe'] ;
122       }   120       }
123       if ( i sset($sour ce['subscr ibe_days'] ) )   121       if ( i sset($sour ce['subscr ibe_days'] ) )
124       {   122       {
125           $r es['subscr ibe_days']  = $source ['subscrib e_days'];   123           $r es['subscr ibe_days']  = $source ['subscrib e_days'];
126       }   124       }
127     125  
128       switch  ( $source ['checkout _action']  )   126       switch  ( $source ['checkout _action']  )
129       {   127       {
130           ca se 'member ship':   128           ca se 'member ship':
131                $res['am ount'] = $ source['am ount'];   129                $res['am ount'] = $ source['am ount'];
132                $prices  = getMembe rshipPrice s( $res['d ata'] );   130                $prices  = getMembe rshipPrice s( $res['d ata'] );
133                $pricing OptionExis ts = false ;   131                $pricing OptionExis ts = false ;
134                foreach  ($prices a s $days =>  $price)   132                foreach  ($prices a s $days =>  $price)
135                {   133                {
136                    if (  $res['amo unt'] == $ price )   134                    if (  $res['amo unt'] == $ price )
137                    {   135                    {
138                         if ( $days  == 0 )   136                         if ( $days  == 0 )
139                         {   137                         {
140                             $res[' allow_subs cribe'] =  '';   138                             $res[' allow_subs cribe'] =  '';
141                             $res[' subscribe_ days'] = 0 ;   139                             $res[' subscribe_ days'] = 0 ;
142                         }   140                         }
143                         else   141                         else
144                         {   142                         {
145                             $res[' allow_subs cribe'] =  'on';   143                             $res[' allow_subs cribe'] =  'on';
146                             $res[' subscribe_ days'] = $ days;   144                             $res[' subscribe_ days'] = $ days;
147                         }   145                         }
148                         $pricingOp tionExists  = true;   146                         $pricingOp tionExists  = true;
149                         break;   147                         break;
150                    }   148                    }
151                }   149                }
152                if ( !$p ricingOpti onExists )   150                if ( !$p ricingOpti onExists )
153                    retu rn false;   151                    retu rn false;
154                else   152                else
155                    retu rn $res;   153                    retu rn $res;
156     154  
157           ca se 'speedd ating':   155           ca se 'speedd ating':
158                return $ res;   156                return $ res;
159     157  
160           ca se 'credit s':    
161                $credInd ex = (int) $source['d ata'];    
162                $res['am ount'] = g etCreditsP riceByInde x( $credIn dex );    
163                return $ res;    
164      
165           ca se 'profil es':   158           ca se 'profil es':
166                return $ res;   159                return $ res;
167     160  
168           de fault:   161           de fault:
169                return f alse;   162                return f alse;
170       }   163       }
171   }   164   }
172     165  
173   /**   166   /**
174    * collect  data from  source   167    * collect  data from  source
175    */   168    */
176   function C ollectChec koutInfo(  $source )   169   function C ollectChec koutInfo(  $source )
177   {   170   {
178       global  $collectD ataArr;   171       global  $collectD ataArr;
179       global  $collectD ataInputs;   172       global  $collectD ataInputs;
180     173  
181       if ( ! isset($sou rce['check out_action ']) || str len($sourc e['data'])  == 0 )   174       if ( ! isset($sou rce['check out_action ']) || str len($sourc e['data'])  == 0 )
182           re turn false ;   175           re turn false ;
183     176  
184       $colle ctDataArr[ 'checkout_ action'] =  process_p ass_data(  $source['c heckout_ac tion'] );   177       $colle ctDataArr[ 'checkout_ action'] =  process_p ass_data(  $source['c heckout_ac tion'] );
185       $colle ctDataArr[ 'amount']  = process_ pass_data(  $source[' amount'] ) ;   178       $colle ctDataArr[ 'amount']  = process_ pass_data(  $source[' amount'] ) ;
186       $colle ctDataArr[ 'data'] =  process_pa ss_data( $ source['da ta'] );   179       $colle ctDataArr[ 'data'] =  process_pa ss_data( $ source['da ta'] );
187       if ( i sset($sour ce['allow_ subscribe' ]) )   180       if ( i sset($sour ce['allow_ subscribe' ]) )
188       {   181       {
189           $c ollectData Arr['allow _subscribe '] = proce ss_pass_da ta( $sourc e['allow_s ubscribe']  );   182           $c ollectData Arr['allow _subscribe '] = proce ss_pass_da ta( $sourc e['allow_s ubscribe']  );
190       }   183       }
191       if ( i sset($sour ce['subscr ibe_days'] ) )   184       if ( i sset($sour ce['subscr ibe_days'] ) )
192       {   185       {
193           $c ollectData Arr['subsc ribe_days' ] = proces s_pass_dat a( $source ['subscrib e_days'] ) ;   186           $c ollectData Arr['subsc ribe_days' ] = proces s_pass_dat a( $source ['subscrib e_days'] ) ;
194       }   187       }
195     188  
196       $colle ctDataArr[ 'descripti on'] = ret urnDescByA ction( $co llectDataA rr['checko ut_action' ], $collec tDataArr[' data'], tr ue );   189       $colle ctDataArr[ 'descripti on'] = ret urnDescByA ction( $co llectDataA rr['checko ut_action' ], $collec tDataArr[' data'], tr ue );
197       if ( s trlen($col lectDataAr r['descrip tion']) ==  0 )   190       if ( s trlen($col lectDataAr r['descrip tion']) ==  0 )
198           re turn false ;   191           re turn false ;
199     192  
200       $colle ctDataInpu ts = '';   193       $colle ctDataInpu ts = '';
201       $colle ctDataInpu ts .= "<in put type=\ "hidden\"  name=\"che ckout_acti on\" value =\"{$colle ctDataArr[ 'checkout_ action']}\ " />\n";   194       $colle ctDataInpu ts .= "<in put type=\ "hidden\"  name=\"che ckout_acti on\" value =\"{$colle ctDataArr[ 'checkout_ action']}\ " />\n";
202       $colle ctDataInpu ts .= "<in put type=\ "hidden\"  name=\"amo unt\" valu e=\"{$coll ectDataArr ['amount'] }\" />\n";   195       $colle ctDataInpu ts .= "<in put type=\ "hidden\"  name=\"amo unt\" valu e=\"{$coll ectDataArr ['amount'] }\" />\n";
203       $colle ctDataInpu ts .= "<in put type=\ "hidden\"  name=\"dat a\" value= \"{$collec tDataArr[' data']}\"  />\n";   196       $colle ctDataInpu ts .= "<in put type=\ "hidden\"  name=\"dat a\" value= \"{$collec tDataArr[' data']}\"  />\n";
204       if ( i sset($sour ce['allow_ subscribe' ]) )   197       if ( i sset($sour ce['allow_ subscribe' ]) )
205       {   198       {
206           $c ollectData Inputs .=  "<input ty pe=\"hidde n\" name=\ "allow_sub scribe\" v alue=\"{$c ollectData Arr['allow _subscribe ']}\" />\n ";   199           $c ollectData Inputs .=  "<input ty pe=\"hidde n\" name=\ "allow_sub scribe\" v alue=\"{$c ollectData Arr['allow _subscribe ']}\" />\n ";
207       }   200       }
208       if ( i sset($sour ce['subscr ibe_days'] ) )   201       if ( i sset($sour ce['subscr ibe_days'] ) )
209       {   202       {
210           $c ollectData Inputs .=  "<input ty pe=\"hidde n\" name=\ "subscribe _days\" va lue=\"{$co llectDataA rr['subscr ibe_days'] }\" />\n";   203           $c ollectData Inputs .=  "<input ty pe=\"hidde n\" name=\ "subscribe _days\" va lue=\"{$co llectDataA rr['subscr ibe_days'] }\" />\n";
211       }   204       }
212     205  
213       return  true;   206       return  true;
214   }   207   }
215     208  
216   /**   209   /**
217    * start c heckout pr ocess   210    * start c heckout pr ocess
218    */   211    */
219   function S tartChecko ut( &$erro rMessage )   212   function S tartChecko ut( &$erro rMessage )
220   {   213   {
221       global  $dir;   214       global  $dir;
222       global  $memberID ; // defin ed in chec kout.inc.p hp   215       global  $memberID ; // defin ed in chec kout.inc.p hp
223       global  $collectD ataArr;   216       global  $collectD ataArr;
224       global  $enable_r ecurring;   217       global  $enable_r ecurring;
225       global  $en_credi ts;    
226       global  $credit2m oney;    
227       // the se globals  for modul e require  call   218       // the se globals  for modul e require  call
228       global  $site;   219       global  $site;
229       global  $provider Conf;   220       global  $provider Conf;
230       global  $checkout Filename;   221       global  $checkout Filename;
231       global  $checkout URL;   222       global  $checkout URL;
232       global  $debugFil ename;   223       global  $debugFil ename;
233     224  
234       // if  buy for cr edits    
235       if ( $ _REQUEST[' use_credit s'] == 'on ' && $en_c redits )    
236       {    
237           $a mount = sp rintf( '%. 2f', (floa t)$collect DataArr['a mount'] );    
238           $c reditsAmou nt = sprin tf( "%.2f" , (float)( $collectDa taArr['amo unt'] * $c redit2mone y) );    
239           $c reditBalan ce = getPr ofileCredi ts( $membe rID );    
240      
241           $r esult = 0;    
242           if  ( $collec tDataArr[' checkout_a ction'] ==  'credits'  )    
243           {    
244                $errorMe ssage = 'C redits cou ldn\'t be  bought by  credits';    
245                return f alse;    
246           }    
247      
248           if  ( $credit Balance <  $creditsAm ount )    
249           {    
250                $result  = 1000;    
251           }    
252           el se    
253           {    
254                $purchas eRes = per formPurcha se( $membe rID, $coll ectDataArr ['checkout _action'],    
255                    $col lectDataAr r['data'],  $amount,  $result );    
256      
257                if ( $pu rchaseRes  )    
258                {    
259                    decP rofileCred its( $memb erID, $cre ditsAmount  );    
260                    $res ult = 1;    
261                }    
262                else    
263                {    
264                    $res ult = -1;    
265                }    
266           }    
267      
268           $r eturnURL =  returnURL ByAction(  $collectDa taArr['che ckout_acti on'], $col lectDataAr r['data']  );    
269           pr ocessValid ationResul t( $result , $errorMe ssage, 0,  $returnURL  );    
270       }    
271       else / / if buy v ia payment  provider    
272       {    
273           $p roviderID  = (int)$_R EQUEST['pr ov_id'];   225       $provi derID = (i nt)$_REQUE ST['prov_i d'];
274           $p roviderRes  = db_res(  "SELECT ` Name`, `Ch eckoutFile name` FROM  `PaymentP roviders`  WHERE `ID`  = {$provi derID} AND  `Active`"  );   226       $provi derRes = d b_res( "SE LECT `Name `, `Checko utFilename ` FROM `Pa ymentProvi ders` WHER E `ID` = { $providerI D} AND `Ac tive`" );
275           if  ( !$provi derRes ||  mysql_num_ rows($prov iderRes) = = 0 )   227       if ( ! $providerR es || mysq l_num_rows ($provider Res) == 0  )
276           {   228       {
277                $errorMe ssage = 'W rong payme nt provide r specifie d';   229           $e rrorMessag e = 'Wrong  payment p rovider sp ecified';
278                return f alse;   230           re turn false ;
279           }   231       }
280           $p roviderArr  = mysql_f etch_assoc ( $provide rRes );   232       $provi derArr = m ysql_fetch _assoc( $p roviderRes  );
281           if  ( strlen( trim($prov iderArr['C heckoutFil ename']))  )   233       if ( s trlen(trim ($provider Arr['Check outFilenam e'])) )
282                $checkou tFilename  = $provide rArr['Chec koutFilena me'];   234           $c heckoutFil ename = $p roviderArr ['Checkout Filename'] ;
283           el se   235       else
284                $checkou tFilename  = $dir['ch eckout'] .  $provider Arr['Name' ] . '.php' ;   236           $c heckoutFil ename = $d ir['checko ut'] . $pr oviderArr[ 'Name'] .  '.php';
285           if  ( !file_e xists( $ch eckoutFile name ) )   237       if ( ! file_exist s( $checko utFilename  ) )
286           {   238       {
287                $errorMe ssage = 'C heckout fi le not fou nd';   239           $e rrorMessag e = 'Check out file n ot found';
288                return f alse;   240           re turn false ;
289           }   241       }
290     242  
291           re quire_once ( $checkou tFilename  );   243       requir e_once( $c heckoutFil ename );
292     244  
293           $v alidateRes  = moduleV alidateCon figuration ( $errorMe ssage );   245       $valid ateRes = m oduleValid ateConfigu ration( $e rrorMessag e );
294           if  ( !$valid ateRes )   246       if ( ! $validateR es )
295           {   247       {
296                return f alse;   248           re turn false ;
297           }   249       }
298     250  
299           $l ocalTranID  = initiat eTransacti on( $colle ctDataArr,  $memberID , $provide rID );   251       $local TranID = i nitiateTra nsaction(  $collectDa taArr, $me mberID, $p roviderID  );
300           if  ( $localT ranID ===  false )   252       if ( $ localTranI D === fals e )
301           {   253       {
302                $errorMe ssage = 'T ransaction  initiatin g error';   254           $e rrorMessag e = 'Trans action ini tiating er ror';
303                return f alse;   255           re turn false ;
304           }   256       }
305      
306           $s ubscriptio nalPayment  = $enable _recurring  && $colle ctDataArr[ 'allow_sub scribe'] = = 'on'   257       $subsc riptionalP ayment = $ enable_rec urring &&  $collectDa taArr['all ow_subscri be'] == 'o n'
307                && $_REQ UEST['prov _recurring '] == 'on' ;   258           &&  $_REQUEST ['prov_rec urring'] = = 'on';
308     259  
309           if  ( $subscr iptionalPa yment )   260       if ( $ subscripti onalPaymen t )
310           {   261       {
311                $subsRes  = initiat eSubscript ion( $loca lTranID, $ collectDat aArr['subs cribe_days '] );   262           $s ubsRes = i nitiateSub scription(  $localTra nID, $coll ectDataArr ['subscrib e_days'] ) ;
312                if ( !$s ubsRes )   263           if  ( !$subsR es )
313                {   264                {
314                    $err orMessage  = 'Subscri ption init iating err or';   265                    $err orMessage  = 'Subscri ption init iating err or';
315                    retu rn false;   266                    retu rn false;
316                }   267                }
317           }   268           }
318     269  
319           $s tartRes =  moduleStar tTransacti on( $local TranID, $s ubscriptio nalPayment , $collect DataArr['s ubscribe_d ays'] );   270           $s tartRes =  moduleStar tTransacti on( $local TranID, $s ubscriptio nalPayment , $collect DataArr['s ubscribe_d ays'] );
320           if  ( !$start Res )   271           if  ( !$start Res )
321           {   272           {
322                $errorMe ssage = 'T ransaction  starting  error';   273                $errorMe ssage = 'T ransaction  starting  error';
323                return f alse;   274                return f alse;
324           }   275           }
325       }    
326     276  
327       return  true;   277       return  true;
328   }   278   }
329     279  
330   /**   280   /**
331    * prints  errom mess age in che ckout info  box end e mpty provi der list b ox   281    * prints  errom mess age in che ckout info  box end e mpty provi der list b ox
332    */   282    */
333   function P ageCompErr orMessage(  $message  )   283   function P ageCompErr orMessage(  $message  )
334   {   284   {
335       global  $_page_co nt;   285       global  $_page_co nt;
336       global  $_ni;   286       global  $_ni;
337       global  $oTemplCo nfig;   287       global  $oTemplCo nfig;
338     288  
339       $desig nBox = Des ignBoxCont entBorder(  _t('_Erro r'), '<cen ter>'. $me ssage .'</ center>' ) ;   289       $desig nBox = Des ignBoxCont entBorder(  _t('_Erro r'), '<cen ter>'. $me ssage .'</ center>' ) ;
340       $conte nt = "<div  class=\"e rror_box\" >\n{$desig nBox}\n</d iv>\n";   290       $conte nt = "<div  class=\"e rror_box\" >\n{$desig nBox}\n</d iv>\n";
341       $_page _cont[$_ni ]['checkou t_info'] =  DesignBox Content( _ t('_Paymen t info'),  $content,  $oTemplCon fig -> Pag eCompError Message_db _num );   291       $_page _cont[$_ni ]['checkou t_info'] =  DesignBox Content( _ t('_Paymen t info'),  $content,  $oTemplCon fig -> Pag eCompError Message_db _num );
342       $_page _cont[$_ni ]['provide r_list'] =  '';   292       $_page _cont[$_ni ]['provide r_list'] =  '';
343   }   293   }
344     294  
345   /**   295   /**
346    * common  checkout i nfo   296    * common  checkout i nfo
347    */   297    */
348   function P ageCompChe ckoutInfo( )   298   function P ageCompChe ckoutInfo( )
349   {   299   {
350       global  $collectD ataArr;   300       global  $collectD ataArr;
351       global  $doll;   301       global  $doll;
352     302  
353       ob_sta rt();   303       ob_sta rt();
354     304  
355   ?>   305   ?>
356   <table cel lpadding=" 2" cellspa cing="0" b order="0"  width="100 %">   306   <table cel lpadding=" 2" cellspa cing="0" b order="0"  width="100 %">
357       <tr>   307       <tr>
358           <t d class="f ield_capti on" align= "right" wi dth="50%"> <?= _t('_P ayment des cription')  ?>:</td>   308           <t d class="f ield_capti on" align= "right" wi dth="50%"> <?= _t('_P ayment des cription')  ?>:</td>
359           <t d class="f ield_value " align="l eft" width ="50%"><?=  $collectD ataArr['de scription' ] ?></td>   309           <t d class="f ield_value " align="l eft" width ="50%"><?=  $collectD ataArr['de scription' ] ?></td>
360       </tr>   310       </tr>
361       <tr>   311       <tr>
362           <t d class="f ield_capti on" align= "right" wi dth="50%"> <?= _t('_P ayment amo unt') ?>:< /td>   312           <t d class="f ield_capti on" align= "right" wi dth="50%"> <?= _t('_P ayment amo unt') ?>:< /td>
363           <t d class="f ield_value " align="l eft" width ="50%"><?=  $doll . $ collectDat aArr['amou nt'] ?></t d>   313           <t d class="f ield_value " align="l eft" width ="50%"><?=  $doll . $ collectDat aArr['amou nt'] ?></t d>
364       </tr>   314       </tr>
365   <?   315   <?
366       if ( $ collectDat aArr['allo w_subscrib e'] == 'on ' && (int) $collectDa taArr['sub scribe_day s'] > 0 )   316       if ( $ collectDat aArr['allo w_subscrib e'] == 'on ' && (int) $collectDa taArr['sub scribe_day s'] > 0 )
367       {   317       {
368   ?>   318   ?>
369       <tr>   319       <tr>
370           <t d class="f ield_capti on" align= "right" wi dth="50%"> <?= _t('_P ossible su bscription  period')  ?>:</td>   320           <t d class="f ield_capti on" align= "right" wi dth="50%"> <?= _t('_P ossible su bscription  period')  ?>:</td>
371           <t d class="f ield_value " align="l eft" width ="50%"><?=  $collectD ataArr['su bscribe_da ys'] . _t( '_days') ? ></td>   321           <t d class="f ield_value " align="l eft" width ="50%"><?=  $collectD ataArr['su bscribe_da ys'] . _t( '_days') ? ></td>
372       </tr>   322       </tr>
373   <?   323   <?
374       }   324       }
375   ?>   325   ?>
376   </table>   326   </table>
377   <?   327   <?
378     328  
379       $conte nt = ob_ge t_contents ();   329       $conte nt = ob_ge t_contents ();
380       ob_end _clean();   330       ob_end _clean();
381     331  
382       $desig nBox = Des ignBoxCont entBorder(  _t('_Paym ent info') , $content  );   332       $desig nBox = Des ignBoxCont entBorder(  _t('_Paym ent info') , $content  );
383     333  
384       $conte nt = "<div  class=\"c heckout_in fo\">\n{$d esignBox}\ n</div>\n" ;   334       $conte nt = "<div  class=\"c heckout_in fo\">\n{$d esignBox}\ n</div>\n" ;
385     335  
386       return  $content;   336       return  $content;
387   }   337   }
388     338  
389   /**   339   /**
390    * list of  all activ e payment  providers   340    * list of  all activ e payment  providers
391    */   341    */
392   function P ageCompPro viderList( )   342   function P ageCompPro viderList( )
393   {   343   {
394       global  $dir;   344       global  $dir;
395       global  $site;   345       global  $site;
396       global  $en_credi ts;    
397       global  $enable_r ecurring;   346       global  $enable_r ecurring;
398       global  $credit2m oney;    
399       global  $memberID ; // defin ed in chec kout.inc.p hp   347       global  $memberID ; // defin ed in chec kout.inc.p hp
400       global  $collectD ataArr;   348       global  $collectD ataArr;
401       global  $collectD ataInputs;   349       global  $collectD ataInputs;
402     350  
403       $ret =  '';   351       $ret =  '';
404     352  
405       // sho w credit c heckout on ly if cred its enable d and chec kout not f or credit  buying    
406       if ( $ en_credits  && $colle ctDataArr[ 'checkout_ action'] ! = 'credits ' )    
407       {    
408           $c reditBalan ce = getPr ofileCredi ts( $membe rID );    
409           if  ( $credit Balance >  0.0 )    
410                $creditT ext = _t(  "_MEMBERSH IP_CREDITS _YES", $cr editBalanc e );    
411           el se    
412                $creditT ext = _t(  "_MEMBERSH IP_CREDITS _NO");    
413           $c reditsAmou nt = sprin tf( "%.2f" , (float)( $collectDa taArr['amo unt'] * $c redit2mone y) );    
414      
415           ob _start();    
416      
417   ?>    
418   <form id=" fcreditsPr oviderForm " action=" <?= $_SERV ER['PHP_SE LF'] ?>" m ethod="pos t" style=" margin: 10 px;">    
419   <input typ e="hidden"  name="act ion" value ="start_ch eckout" />    
420   <input typ e="hidden"  name="use _credits"  value="on"  />    
421   <?= $colle ctDataInpu ts ?>    
422   <table cel lpadding=" 4" cellspa cing="0" b order="0"  width="100 %">    
423       <tr>    
424           <t d class="f ield_capti on" align= "right" wi dth="50%"> <?= _t('_C redit bala nce') ?>:< /td>    
425           <t d align="l eft" width ="50%"><?=  $creditTe xt ?></td>    
426       </tr>    
427       <tr>    
428           <t d class="f ield_capti on" align= "right" wi dth="50%"> <?= _t('_P ayment amo unt in cre dits') ?>: </td>    
429           <t d class="f ield_value " align="l eft" width ="50%"><?=  $creditsA mount ?></ td>    
430       </tr>    
431       <tr>    
432           <t d align="c enter" col span="2">    
433                <?= $cre ditsAmount  > $credit Balance ?  _t('_Not e nough cred its') : '< input type ="submit"  class="no"  value="'.  _t('_Chec k Out') .' " style="w idth: 100p x; vertica l-align: m iddle" />'  ?>    
434           </ td>    
435       </tr>    
436   </table>    
437   </form>    
438   <?    
439      
440           $c ontent = o b_get_cont ents();    
441           ob _end_clean ();    
442      
443           $d esignBox =  DesignBox ContentBor der( _t('_ MEMBERSHIP _CREDITS') , $content  );    
444           $r et .= "<di v class=\" credits_bo x\">\n{$de signBox}\n </div>\n";    
445       }    
446      
447       $res =  db_res( " SELECT `ID `, `Name`,  `Caption` , `Support sRecurring `, `LogoFi lename` FR OM `Paymen tProviders ` WHERE `A ctive`" );   353       $res =  db_res( " SELECT `ID `, `Name`,  `Caption` , `Support sRecurring `, `LogoFi lename` FR OM `Paymen tProviders ` WHERE `A ctive`" );
448     354  
449       while  ( $arr = m ysql_fetch _assoc($re s) )   355       while  ( $arr = m ysql_fetch _assoc($re s) )
450       {   356       {
451           if  ( $enable _recurring  && $colle ctDataArr[ 'allow_sub scribe'] = = 'on' )   357           if  ( $enable _recurring  && $colle ctDataArr[ 'allow_sub scribe'] = = 'on' )
452           {   358           {
453                if ( $ar r['Support sRecurring '] )   359                if ( $ar r['Support sRecurring '] )
454                {   360                {
455                    $rec urringFiel d = "<inpu t type=\"c heckbox\"  name=\"pro v_recurrin g\" id=\"p rov{$arr[' ID']}_recu rring_id\"  style=\"v ertical-al ign: middl e;\" oncli ck=\"javas cript: doc ument.getE lementById ('subscrib e{$arr['ID ']}_days_i d').disabl ed = !this .checked;\ " />&nbsp; <label for =\"prov{$a rr['ID']}_ recurring_ id\">". _t ('_recurri ng payment ') ."</lab el>";   361                    $rec urringFiel d = "<inpu t type=\"c heckbox\"  name=\"pro v_recurrin g\" id=\"p rov{$arr[' ID']}_recu rring_id\"  style=\"v ertical-al ign: middl e;\" oncli ck=\"javas cript: doc ument.getE lementById ('subscrib e{$arr['ID ']}_days_i d').disabl ed = !this .checked;\ " />&nbsp; <label for =\"prov{$a rr['ID']}_ recurring_ id\">". _t ('_recurri ng payment ') ."</lab el>";
456                    if (  (int)$col lectDataAr r['subscri be_days']  == 0 )   362                    if (  (int)$col lectDataAr r['subscri be_days']  == 0 )
457                    {   363                    {
458                         $daysVaria nts = arra y( 10, 20,  30, 60, 1 80 );   364                         $daysVaria nts = arra y( 10, 20,  30, 60, 1 80 );
459                         $recurring Field .= " &nbsp<sele ct name=\" subscribe_ days\" id= \"subscrib e{$arr['ID ']}_days_i d\" disabl ed=\"disab led\" styl e=\"vertic al-align:  middle;\"> \n";   365                         $recurring Field .= " &nbsp<sele ct name=\" subscribe_ days\" id= \"subscrib e{$arr['ID ']}_days_i d\" disabl ed=\"disab led\" styl e=\"vertic al-align:  middle;\"> \n";
460                         foreach (  $daysVaria nts as $da ys )   366                         foreach (  $daysVaria nts as $da ys )
461                         {   367                         {
462                             $recur ringField  .= "<optio n value=\" {$days}\"> {$days} ".  _t('_days ') ."</opt ion>";   368                             $recur ringField  .= "<optio n value=\" {$days}\"> {$days} ".  _t('_days ') ."</opt ion>";
463                         }   369                         }
464                         $recurring Field .= " </select>\ n";   370                         $recurring Field .= " </select>\ n";
465                    }   371                    }
466                }   372                }
467                else   373                else
468                {   374                {
469                    $rec urringFiel d = _t('_r ecurring n ot support ed');   375                    $rec urringFiel d = _t('_r ecurring n ot support ed');
470                }   376                }
471           }   377           }
472           el se   378           el se
473           {   379           {
474                $recurri ngField =  _t('_recur ring not a llowed');   380                $recurri ngField =  _t('_recur ring not a llowed');
475           }   381           }
476     382  
477           ob _start();   383           ob _start();
478   ?>   384   ?>
479   <form id=" f<?= $arr[ 'Name'] ?> ProviderFo rm" action ="<?= $_SE RVER['PHP_ SELF'] ?>"  method="p ost" style ="margin:  10px;">   385   <form id=" f<?= $arr[ 'Name'] ?> ProviderFo rm" action ="<?= $_SE RVER['PHP_ SELF'] ?>"  method="p ost" style ="margin:  10px;">
480   <input typ e="hidden"  name="act ion" value ="start_ch eckout" />   386   <input typ e="hidden"  name="act ion" value ="start_ch eckout" />
481   <?= $colle ctDataInpu ts ?>   387   <?= $colle ctDataInpu ts ?>
482   <input typ e="hidden"  name="pro v_id" valu e="<?= $ar r['ID'] ?> " />   388   <input typ e="hidden"  name="pro v_id" valu e="<?= $ar r['ID'] ?> " />
483   <table cel lpadding=" 4" cellspa cing="0" b order="0"  width="100 %">   389   <table cel lpadding=" 4" cellspa cing="0" b order="0"  width="100 %">
484       <tr>   390       <tr>
485           <t d align="l eft" width ="35%" row span="2">< ?= strlen( $arr['Logo Filename'] ) > 0 && f ile_exists ($dir['che ckout'] .  'images/'  . $arr['Lo goFilename ']) ? "<im g src=\"{$ site['chec kout']}ima ges/{$arr[ 'LogoFilen ame']}\" a lt=\"". pr ocess_line _output($a rr['Captio n']) ."\"  />" : '&nb sp;' ?></t d>   391           <t d align="l eft" width ="35%" row span="2">< ?= strlen( $arr['Logo Filename'] ) > 0 && f ile_exists ($dir['che ckout'] .  'images/'  . $arr['Lo goFilename ']) ? "<im g src=\"{$ site['chec kout']}ima ges/{$arr[ 'LogoFilen ame']}\" a lt=\"". pr ocess_line _output($a rr['Captio n']) ."\"  />" : '&nb sp;' ?></t d>
486           <t d class="f ield_capti on" align= "right" wi dth="65%"> <?= $recur ringField  ?></td>   392           <t d class="f ield_capti on" align= "right" wi dth="65%"> <?= $recur ringField  ?></td>
487       </tr>   393       </tr>
488       <tr>   394       <tr>
489           <t d align="r ight" widt h="65%">   395           <t d align="r ight" widt h="65%">
490                <input t ype="submi t" class=" no" value= "<?= _t('_ Check Out' ) ?>" styl e="width:  100px; ver tical-alig n: middle"  />   396                <input t ype="submi t" class=" no" value= "<?= _t('_ Check Out' ) ?>" styl e="width:  100px; ver tical-alig n: middle"  />
491           </ td>   397           </ td>
492       </tr>   398       </tr>
493   </table>   399   </table>
494   </form>   400   </form>
495   <?   401   <?
496           $c ontent = o b_get_cont ents();   402           $c ontent = o b_get_cont ents();
497           ob _end_clean ();   403           ob _end_clean ();
498     404  
499           $d esignBox =  DesignBox ContentBor der( $arr[ 'Caption'] , $content  );   405           $d esignBox =  DesignBox ContentBor der( $arr[ 'Caption'] , $content  );
500     406  
501           $r et .= "<di v class=\" provider_b ox\">\n{$d esignBox}\ n</div>\n" ;   407           $r et .= "<di v class=\" provider_b ox\">\n{$d esignBox}\ n</div>\n" ;
502       }   408       }
503     409  
504       return  $ret;   410       return  $ret;
505   }   411   }
506     412  
507   ?>   413   ?>