261. File Comparison Report

Produced on Mon May 12 13:05:41 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.

261.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.0.5\orca\classes Login.php Thu Sep 20 08:58:26 2007 UTC
2 Dolphin-v.6.1.0\orca\classes Login.php Wed Apr 9 17:44:52 2008 UTC

261.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 18 434
Changed 17 46
Inserted 0 0
Removed 0 0

261.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

261.4 Active regular expressions

No regular expressions were active.

261.5 Comparison detail

1   <?php   1   <?php
2   /********* ********** ********** ********** ********** ********** ********** ******   2   /********* ********** ********** ********** ********** ********** ********** ******
3   *                              O rca Intera ctive Foru m Script   3   *                              O rca Intera ctive Foru m Script
4   *                                  ---------- -----
  4   *                                  ---------- ----- --
5   *       Start e d                :   Fr   Nov   10   2006   5   *       b e gin                   :   Fr   Nov   10   2006
6   *       C opyright          :   (C)   200 7   BoonEx   Group   6   *       c opyright               :   (C)   200 6   BoonEx   Group
7   *       W ebsite                :   http://www .boonex.co m
  7   *       w ebsite                 :   http://www .boonex.co m /
8   * This fil e is part  of Orca -  Interactiv e Forum Sc ript   8   * This fil e is part  of Orca -  Interactiv e Forum Sc ript
9   *   9   *
10   *   Orca   is   free   software ;   y o u   c a n   r ed
i
s
tribut e   i t   and/ o r   modify   i t   u n d e r  
  10   *   Orca   is   free   software .   This   w o rk   is   li c e n s ed   under   a   Creat i ve   Common s   At tribut
i
o n   3.0   L i ce n s e .  
11   * the term s of the G NU General  Public Li cense as p ublished b y the    11   * http://c reativecom mons.org/l icenses/by /3.0/
12   * Free Sof tware Foun dation; ei ther versi on 2 of th    
13   * License,  or any la ter versio n.          
14   *   12   *
15   * Orca is  distribute d in the h ope that i t will be  useful, bu t WITHOUT  ANY WARRAN TY;   13   * Orca is  distribute d in the h ope that i t will be  useful, bu t WITHOUT  ANY WARRAN TY;
16   * without  even the i mplied war ranty of   MERCHANTAB ILITY or F ITNESS FOR  A PARTICU LAR PURPOS E.   14   * without  even the i mplied war ranty of   MERCHANTAB ILITY or F ITNESS FOR  A PARTICU LAR PURPOS E.
17   *   See   the   GNU   G e n e
r al   Pu b l i c   License   for   more   details.  
  15   *   See   the   Cr e ativ e   Commons   Att r i b ut i on   3.0   License   for   more   details.  
18   *   You   should   have   received   a   copy   of   the   GNU   G e n e
r al   Pu b l i c   License   along   with   Orca,  
  16   *   You   should   have   received   a   copy   of   the   Cr e ativ e   Commons   Att r i b ut i on   3.0   License   along   with   Orca,  
19   * see lice nse.txt fi le; if not , write to  marketing @boonex.co m   17   * see lice nse.txt fi le; if not , write to  marketing @boonex.co m
20   ********** ********** ********** ********** ********** ********** ********** *****/   18   ********** ********** ********** ********** ********** ********** ********** *****/
21     19  
22     20  
23   // login |  join  fun ctions   21   // login |  join  fun ctions
24     22  
25   class Logi n extends  ThingPage   23   class Logi n extends  ThingPage
26   {   24   {
27       // joi n form fie lds   25       // joi n form fie lds
28       var $f _join =  a rray (   26       var $f _join =  a rray (
29           'u sername' = > array (   27           'u sername' = > array (
30                'value'  => '',   28                'value'  => '',
31                'type' = > 'text',   29                'type' = > 'text',
32                 'title'   =>   '
Username
',           
  30                 'title'   =>   ' [L[ Username ]] ',
33                'regexp'  => '/^[A- Za-z0-9_]{ 4,12}$/',   31                'regexp'  => '/^[A- Za-z0-9_]{ 4,12}$/',
34                 'err'   =>   '
Username   must   be   f r om   4   to   12   cha r acte r s ',
  32                 'err'   =>   ' [L[Join   Login   Username   E r
r o r ]] ',  
35                'attribu tes' => ar ray ('clas s' => 'sh' ),   33                'attribu tes' => ar ray ('clas s' => 'sh' ),
36                ),   34                ),
37           'e mail' => a rray (   35           'e mail' => a rray (
38                'value'  => '',   36                'value'  => '',
39                'type' = > 'text',   37                'type' = > 'text',
40                 'title'   =>   '
Email
',
  38                 'title'   =>   ' [L[ Email ]] ',
41                'regexp'  => '/^[\w -]+(\.[\w- ]+)*@([\w- ]+\.)+[a-z A-Z]{2,7}$ /',   39                'regexp'  => '/^[\w -]+(\.[\w- ]+)*@([\w- ]+\.)+[a-z A-Z]{2,7}$ /',
42                 'err'   =>   '
Email   must   be   valid ',
  40                 'err'   =>   ' [L[Join   Email   Error]] ',
43                'attribu tes' => ar ray ('clas s' => 'sh' ),   41                'attribu tes' => ar ray ('clas s' => 'sh' ),
44                ),         42                ),      
45       );   43       );
46     44  
47       // log in form fi elds   45       // log in form fi elds
48       var $f _login =   array (   46       var $f _login =   array (
49           'u sername' = > array (   47           'u sername' = > array (
50                'value'  => '',   48                'value'  => '',
51                'type' = > 'text',   49                'type' = > 'text',
52                 'title'   =>   '
Username
',           
  50                 'title'   =>   ' [L[ Username ]] ',          
53                'regexp'  => '/^[A- Za-z0-9_]{ 4,12}$/',   51                'regexp'  => '/^[A- Za-z0-9_]{ 4,12}$/',
54                 'err'   =>   '
Username   must   be   f r om   4   to   12   cha r acte r s ',
  52                 'err'   =>   ' [L[Join   Login   Username   E r
r o r ]] ',
55                'attribu tes' => ar ray ('clas s' => 'sh' ),   53                'attribu tes' => ar ray ('clas s' => 'sh' ),
56                ),   54                ),
57           'p wd' => arr ay (   55           'p wd' => arr ay (
58                'value'  => '',   56                'value'  => '',
59                'type' = > 'passwor d',   57                'type' = > 'passwor d',
60                 'title'   =>   '
Password
',
  58                 'title'   =>   ' [L[ Password ]] ',
61                'regexp'  => '/^[A- Za-z0-9_]+ $/',   59                'regexp'  => '/^[A- Za-z0-9_]+ $/',
62                 'err'   =>   '
Password   must   be   valid ',
  60                 'err'   =>   ' [L[Login   Password   Error]] ',
63                'attribu tes' => ar ray ('clas s' => 'sh' ),   61                'attribu tes' => ar ray ('clas s' => 'sh' ),
64                ),         62                ),      
65       );   63       );
66              64           
67       /**   65       /**
68        * con structor   66        * con structor
69        */   67        */
70       functi on Login ( )   68       functi on Login ( )
71       {   69       {
72     70  
73       }   71       }
74     72  
75       /**   73       /**
76        * joi n window x ml   74        * joi n window x ml
77        */   75        */
78       functi on getJoin Form ()   76       functi on getJoin Form ()
79       {   77       {
80           $c u = $this- >getUrlsXm l ();    78           $c u = $this- >getUrlsXm l (); 
81           re turn  "<ro ot>$cu<joi n><join_fo rm>" . arr ay2xml ($t his->f_joi n) . "</jo in_form></ join></roo t>";   79           re turn  "<ro ot>$cu<joi n><join_fo rm>" . arr ay2xml ($t his->f_joi n) . "</jo in_form></ join></roo t>";
82       }   80       }
83     81  
84       /**   82       /**
85        * log in window  xml   83        * log in window  xml
86        */   84        */
87       functi on getLogi nForm ()   85       functi on getLogi nForm ()
88       {   86       {
89           $c u = $this- >getUrlsXm l ();    87           $c u = $this- >getUrlsXm l (); 
90           re turn  "<ro ot>$cu<log in><login_ form>" . a rray2xml ( $this->f_l ogin) . "< /login_for m></login> </root>";   88           re turn  "<ro ot>$cu<log in><login_ form>" . a rray2xml ( $this->f_l ogin) . "< /login_for m></login> </root>";
91       }   89       }
92     90  
93       /**   91       /**
94        * sub mit join    92        * sub mit join 
95        *  @p aram $p    join field s   93        *  @p aram $p    join field s
96        */    94        */ 
97       functi on joinSub mit ($p)   95       functi on joinSub mit ($p)
98       {   96       {
99           $j s = '';   97           $j s = '';
100              98           
101           //  check inp ut values   99           //  check inp ut values
102           fo r (reset($ this->f_jo in); list  ($name, $a ) = each ( $this->f_j oin);)   100           fo r (reset($ this->f_jo in); list  ($name, $a ) = each ( $this->f_j oin);)
103           {   101           {
104                if ($a[' regexp'])   102                if ($a[' regexp'])
105                    if ( !preg_matc h($a['rege xp'], $p[$ name]))   103                    if ( !preg_matc h($a['rege xp'], $p[$ name]))
106                         $js .= $th is->_getJs Err($name,  $a['err'] );   104                         $js .= $th is->_getJs Err($name,  $a['err'] );
107                                             105                                          
108                switch ( $name)   106                switch ( $name)
109                {   107                {
110                    case  'username ':   108                    case  'username ':
111                         if (!$this ->_checkUn iqUser($p[ $name]))   109                         if (!$this ->_checkUn iqUser($p[ $name]))
112                              $js   .=   $this->_ge tJsErr($na me,   '
Username   must   be   uniq
');
  110                              $js   .=   $this->_ge tJsErr($na me,   ' [L[ Username   must   be   uniq ]] ');
113                         break;   111                         break;
114                    case  'email':                        112                    case  'email':                     
115                         if (!$this ->_checkUn iqEmail($p [$name]))   113                         if (!$this ->_checkUn iqEmail($p [$name]))
116                              $js   .=   $this->_ge tJsErr($na me,   '
Email   must   be   uniq
');                     
  114                              $js   .=   $this->_ge tJsErr($na me,   ' [L[ Email   must   be   uniq ]] ');
117                         break;   115                         break;
118                }   116                }
119           }   117           }
120     118  
121           //  add user   119           //  add user
122           if  (!$js)   120           if  (!$js)
123           {               121           {            
124                $db = ne w DbLogin( );   122                $db = ne w DbLogin( );
125                   123                
126                $p['pwd' ] = $this- >_genPwd() ;   124                $p['pwd' ] = $this- >_genPwd() ;
127                   125                
128                if (!$db ->insertUs er($p))   126                if (!$db ->insertUs er($p))
129                {   127                {
130                     $js   .=   $this->_ge tJsErr('em ail',   '
Database   error
');
  128                     $js   .=   $this->_ge tJsErr('em ail',   ' [L[ Database   error ]] ');
131                }   129                }
132                   130                
133                // send  activation  mail   131                // send  activation  mail
134                $mail =  new BxMail  ();   132                $mail =  new BxMail  ();
135                if (!$ma il->sendAc tivationMa il($p))   133                if (!$ma il->sendAc tivationMa il($p))
136                {   134                {
137                     $js   .=   $this->_ge tJsErr('em ail',   '
Send   mail   failed
');
  135                     $js   .=   $this->_ge tJsErr('em ail',   ' [L[ Send   mail   failed ]] ');
138                }   136                }
139           }   137           }
140              138           
141           re turn '<js> ' . $js .  '</js>';   139           re turn '<js> ' . $js .  '</js>';
142       }      140       }   
143     141  
144     142  
145       /**   143       /**
146        * sub mit login   144        * sub mit login
147        *  @p aram $p    username/p assword fi elds   145        *  @p aram $p    username/p assword fi elds
148        */         146        */      
149       functi on loginSu bmit ($p)   147       functi on loginSu bmit ($p)
150       {   148       {
151           $j s = '';   149           $j s = '';
152              150           
153           //  check inp ut values   151           //  check inp ut values
154           fo r (reset($ this->f_lo gin); list  ($name, $ a) = each  ($this->f_ login);)   152           fo r (reset($ this->f_lo gin); list  ($name, $ a) = each  ($this->f_ login);)
155           {   153           {
156                if ($a[' regexp'])   154                if ($a[' regexp'])
157                    if ( !preg_matc h($a['rege xp'], $p[$ name]))   155                    if ( !preg_matc h($a['rege xp'], $p[$ name]))
158                         $js .= $th is->_getJs Err($name,  $a['err'] );   156                         $js .= $th is->_getJs Err($name,  $a['err'] );
159                                             157                                          
160           }   158           }
161     159  
162           //  process l ogin   160           //  process l ogin
163           if  (!$js)   161           if  (!$js)
164           {               162           {            
165                $db = ne w DbLogin( );                163                $db = ne w DbLogin( );             
166                   164                
167                $p['pwd' ] = md5($p ['pwd']);   165                $p['pwd' ] = md5($p ['pwd']);
168                   166                
169                if (!$db ->checkLog in($p))   167                if (!$db ->checkLog in($p))
170                {   168                {
171                     $js   .=   $this->_ge tJsErr('pw d',   '
password   or   login   is   incorrect
');
  169                     $js   .=   $this->_ge tJsErr('pw d',   ' [L[ password   or   login   is   incorrect ]] ');
172                }   170                }
173                else   171                else
174                {   172                {
175                    setc ookie ('or ca_user',  $p['userna me']);   173                    setc ookie ('or ca_user',  $p['userna me']);
176                    if ( !setcookie  ('orca_pw d', $p['pw d']))   174                    if ( !setcookie  ('orca_pw d', $p['pw d']))
177                         $js   .=   $this->_ge tJsErr('pw d',   '
Cookies   must   be   enabled   to   process   login
');
  175                         $js   .=   $this->_ge tJsErr('pw d',   ' [L[ Cookies   must   be   enabled   to   process   login ]] ');
178                }   176                }
179           }   177           }
180              178           
181           re turn '<js> ' . $js .  '</js>';   179           re turn '<js> ' . $js .  '</js>';
182       }      180       }   
183          181       
184          182       
185       // pri vate funct ions   183       // pri vate funct ions
186          184       
187       functi on _getJsE rr ($name,  $err)   185       functi on _getJsE rr ($name,  $err)
188       {   186       {
189           re turn <<<EO S   187           re turn <<<EO S
190                {   188                {
191                    var  e = docume nt.getElem entById('f _err_$name ');   189                    var  e = docume nt.getElem entById('f _err_$name ');
192                    e.in nerHTML =  '$err';   190                    e.in nerHTML =  '$err';
193                    e.st yle.displa y = 'inlin e';   191                    e.st yle.displa y = 'inlin e';
194                }   192                }
195   EOS;   193   EOS;
196              194           
197       }   195       }
198          196       
199       functi on  _check UniqUser($ s)   197       functi on  _check UniqUser($ s)
200       {                   198       {                
201           $d b = new Db Login();   199           $d b = new Db Login();
202           re turn $db-> getUserByN ame ($s) = = $s ? fal se : true;   200           re turn $db-> getUserByN ame ($s) = = $s ? fal se : true;
203       }   201       }
204          202       
205       functi on  _check UniqEmail( $s)   203       functi on  _check UniqEmail( $s)
206       {   204       {
207           $d b = new Db Login();        205           $d b = new Db Login();     
208           re turn $db-> getUserByE mail ($s)  == $s ? fa lse : true ;   206           re turn $db-> getUserByE mail ($s)  == $s ? fa lse : true ;
209       }      207       }   
210          208       
211       functi on _genPwd  ()   209       functi on _genPwd  ()
212       {   210       {
213           $r et = '';   211           $r et = '';
214           li st($usec,  $sec) = ex plode(' ',  microtime ());   212           li st($usec,  $sec) = ex plode(' ',  microtime ());
215           $s eed = (flo at) $sec +  ((float)  $usec * 10 0000);   213           $s eed = (flo at) $sec +  ((float)  $usec * 10 0000);
216           sr and($seed) ;   214           sr and($seed) ;
217              215           
218           fo r ($i=0; $ i < 8; ++$ i)   216           fo r ($i=0; $ i < 8; ++$ i)
219           {   217           {
220                   218                
221                switch ( rand(1,3))   219                switch ( rand(1,3))
222                {   220                {
223                    case  1:    221                    case  1: 
224                         $c = chr(r and(ord('a '),ord('z' )));   222                         $c = chr(r and(ord('a '),ord('z' )));
225                         break;   223                         break;
226                    case  2:    224                    case  2: 
227                         $c = chr(r and(ord('A '),ord('Z' )));   225                         $c = chr(r and(ord('A '),ord('Z' )));
228                         break;   226                         break;
229                    case  3:    227                    case  3: 
230                         $c = chr(r and(ord('0 '),ord('9' )));   228                         $c = chr(r and(ord('0 '),ord('9' )));
231                         break;   229                         break;
232                }   230                }
233                $ret .=  $c;   231                $ret .=  $c;
234           }   232           }
235           re turn $ret;            233           re turn $ret;         
236       }   234       }
237              235           
238   }   236   }
239     237  
240     238  
241   ?>   239   ?>