202. File Comparison Report

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

202.1 Files compared

# Location File Last Modified
1 Mon May 12 13:05:10 2008 UTC
2 Dolphin-v.6.1.0\inc\classes BxDolProfilesController.php Mon Apr 21 05:39:10 2008 UTC

202.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 0 0
Changed 0 0
Inserted 1 276
Removed 0 0

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

202.4 Active regular expressions

No regular expressions were active.

202.5 Comparison detail

    1   <?php
    2  
    3   require_on ce( BX_DIR ECTORY_PAT H_CLASSES  . 'BxDolPr ofileField s.php' );
    4  
    5   class BxDo lProfilesC ontroller  {
    6       var $o PF;
    7       var $a Items;
    8       
    9       functi on BxDolPr ofilesCont roller() {
    10           
    11       }
    12       
    13       functi on createP rofile( $a Data, $bSe ndMails =  true, $iMa inMemberID  = 0 ) {
    14           
    15           if ( !$aData  or !is_arr ay($aData)  or empty( $aData) )
    16                return f alse;
    17           
    18           un set( $aDat a['Couple' ] );
    19           un set( $aDat a['Captcha '] );
    20           un set( $aDat a['TermsOf Use'] );
    21           
    22           /*  @var $thi s->oPF BxD olProfileF ields */
    23           $t his -> oPF  = new BxD olProfileF ields(100) ;
    24           
    25           if ( !$this - > oPF -> a Area ) {
    26                echo 'Pr ofile Fiel ds cache n ot loaded.  Cannot co ntinue.';
    27                return f alse;
    28           }
    29           
    30           $t his -> aIt ems = $thi s -> oPF - > aArea[0] ['Items'];
    31           
    32           if ( $iMainMe mberID )
    33                $aMainMe mber = $th is -> getP rofileInfo ( $iMainMe mberID );
    34           el se
    35                $aMainMe mber = fal se;
    36           
    37           //  begin pro file info  collecting
    38           $a NewProfile  = array() ;
    39           
    40           fo reach( $th is -> aIte ms as $aIt em ) {
    41                $sItemNa me = $aIte m['Name'];
    42                
    43                if( arra y_key_exis ts( $sItem Name, $aDa ta ) ) {
    44                    $aNe wProfile[$ sItemName]  = $aData[ $sItemName ];
    45                } elseif ( $aMainMe mber and a rray_key_e xists( $sI temName, $ aMainMembe r ) and $a Item['Type '] != 'sys tem' ) {
    46                    if(  $aItem['Un ique'] )
    47                         $aNewProfi le[$sItemN ame] = $th is -> genU niqueValue ( $sItemNa me, $aMain Member[$sI temName] ) ;
    48                    else
    49                         $aNewProfi le[$sItemN ame] = $aM ainMember[ $sItemName ];
    50                } else {
    51                    swit ch( $aItem ['Type'] )  {
    52                         case 'pass ':
    53                             $aNewP rofile[$sI temName] =  $this ->  genRandomP assword();
    54                         break;
    55                        
    56                         case 'num' :
    57                             $aNewP rofile[$sI temName] =  (int)$aIt em['Defaul t'];
    58                         break;
    59                        
    60                         case 'bool ':
    61                             $aNewP rofile[$sI temName] =  (bool)$aI tem['Defau lt'];
    62                         break;
    63                        
    64                         case 'syst em':
    65                             switch ( $sItemNa me ) {
    66                                 ca se 'ID': / /set autom atically
    67                                 ca se 'Captch a': //not  been inser ted
    68                                 ca se 'Locati on': //not  been inse rted
    69                                 ca se 'Keywor d': //not  been inser ted
    70                                 ca se 'TermsO fUse': //n ot been in serted
    71                                      //pass
    72                                 br eak;
    73                                 
    74                                 ca se 'DateRe g':
    75                                      $aNewPro file[$sIte mName] = d ate( 'Y-m- d H:i:s' ) ; // set c urrent dat e
    76                                 br eak;
    77                                 
    78                                 ca se 'DateLa stEdit':
    79                                 ca se 'DateLa stLogin':
    80                                      $aNewPro file[$sIte mName] = ' 0000-00-00 ';
    81                                 br eak;
    82                                 
    83                                 ca se 'Couple ':
    84                                      $aNewPro file[$sIte mName] = $ aMainMembe r ? $iMain MemberID :  0; //if m ain member  exists, s et him as  a couple l ink
    85                                 br eak;
    86                                 
    87                                 ca se 'Featur ed':
    88                                      $aNewPro file[$sIte mName] = f alse;
    89                                 br eak;
    90                                 
    91                                 ca se 'Status ':
    92                                      if ( get Param('aut oApproval_ ifNoConfEm ail') == ' on' ) {
    93                                          if (  getParam( 'autoAppro val_ifJoin ') == 'on'  )
    94                                               $aNewProfi le[$sItemN ame] = 'Ac tive';
    95                                          else
    96                                               $aNewProfi le[$sItemN ame] = 'Ap proval';
    97                                      } else
    98                                          $aNe wProfile[$ sItemName]  = 'Unconf irmed';
    99                                 br eak;
    100                             }
    101                         break;
    102                        
    103                         default:
    104                             $aNewP rofile[$sI temName] =  $aItem['D efault'];
    105                    }
    106                }
    107           }  //we compl eted colle cting
    108           
    109           $s Set = $thi s -> colle ctSetStrin g( $aNewPr ofile );
    110           $s Query = "I NSERT INTO  `Profiles ` SET \n$s Set";
    111           $r Res = db_r es( $sQuer y );
    112           
    113           if ( $rRes )  {
    114                $iNewID  = mysql_in sert_id();
    115                
    116                $this ->  createPro fileCache(  $iNewID ) ;
    117                
    118                if( $aMa inMember )
    119                    $thi s -> updat eProfile(  $iMainMemb erID, arra y('Couple'  => $iNewI D ) ); //s et main me mber's cou ple. they  will be li nked each  other
    120                
    121                //collec t status t ext
    122                if( $bSe ndMails an d !$aMainM ember ) {  //send mai l only to  main membe r, not to  couple
    123                    if(  getParam(' autoApprov al_ifNoCon fEmail') = = 'on' ) {
    124                         if ( getPa ram('autoA pproval_if Join') ==  'on' ) {
    125                             $sStat usText = ' Active';
    126                             $this  -> sendAct ivationMai l( $iNewID  );
    127                         } else {
    128                             $sStat usText = ' Approval';
    129                             $this  -> sendApp rovalMail(  $iNewID ) ;
    130                         }
    131                    } el se {
    132                         if( $this  -> sendCon fMail( $iN ewID ) )
    133                             $sStat usText = ' Unconfirme d';
    134                         else
    135                             $sStat usText = ' NotSent';
    136                    }
    137                } else
    138                    $sSt atusText =  'OK';
    139                
    140                //set cr ypted pass word
    141                $this ->  updatePro file( $iNe wID, array ( 'Passwor d' => md5(  $aNewProf ile['Passw ord'] ) )  );
    142                
    143                return a rray( $iNe wID, $sSta tusText );
    144           }  else
    145                return a rray( fals e, 'Failed ' );
    146       }
    147       
    148       functi on createP rofileCach e( $iMemID  ) {
    149           cr eateUserDa taFile( $i MemID );
    150       }
    151       
    152       functi on sendCon fMail( $iM emID ) {
    153           gl obal $site ;
    154           
    155           $i MemID = (i nt)$iMemID ;
    156           $a Member = $ this -> ge tProfileIn fo( $iMemI D );
    157           if ( !$aMembe r )
    158                return f alse;
    159           
    160           $s Email    =  $aMember[ 'Email'];
    161           $s Subject  =  getParam(  't_Confir mation_sub ject' );
    162           $s Message  =  getParam(  't_Confir mation' );
    163           
    164           $s ConfCode =  base64_en code( base 64_encode(  crypt( $s Email, 'se ' ) ) );
    165           $s ConfLink =  "{$site[' url']}prof ile_activa te.php?Con fID={$iMem ID}&ConfCo de=" . url encode( $s ConfCode ) ;
    166           
    167           $a Plus = arr ay( 'ConfC ode' => $s ConfCode,  'Confirmat ionLink' = > $sConfLi nk );
    168           
    169           re turn sendM ail( $sEma il, $sSubj ect, $sMes sage, $iMe mID, $aPlu s );
    170       }
    171       
    172       // sen t when use r status c hanged to  active
    173       functi on sendAct ivationMai l( $iMemID  ) {
    174           $i MemID = (i nt)$iMemID ;
    175           $a Member  =  $this -> g etProfileI nfo( $iMem ID );
    176           if ( !$aMembe r )
    177                return f alse;
    178           
    179           $s Email   =  $aMember[' Email'];
    180           $s Subject =  getParam(' t_Activati on_subject ');
    181           $s Message =  getParam(' t_Activati on');
    182           
    183           re turn sendM ail( $sEma il, $sSubj ect, $sMes sage, $iMe mID );
    184       }
    185       
    186       //sent  if member  in approv al status
    187       functi on sendApp rovalMail(  $iMemId )  {
    188           
    189       }
    190       
    191       // sen t to admin
    192       functi on sendNew UserNotify ( $iMemID  ) {
    193           gl obal $site ;
    194           
    195           $i MemID = (i nt)$iMemID ;
    196           $a Member = $ this -> ge tProfileIn fo( $iMemI D );
    197           if ( !$aMembe r )
    198                return f alse;
    199                
    200           $s Subject    = "New use r confirme d";
    201           $s Message = 
    202   "New user  {$aMember[ 'NickName' ]} with em ail {$aMem ber['Email ']} has be en confirm ed,
    203   his/her ID  is {$iMem ID}.
    204   --
    205   {$site['ti tle']} mai l delivery  system
    206   Auto-gener ated e-mai l, please,  do not re ply
    207   ";
    208           re turn sendM ail( $site ['email_no tify'], $s Subject, $ sMessage ) ;
    209       }
    210       
    211       functi on updateP rofile( $i MemberID,  $aData ) {
    212           if ( !$aData  or !is_arr ay($aData)  or empty( $aData) )
    213                return f alse;
    214           
    215           $s Set = $thi s -> colle ctSetStrin g( $aData  );
    216           $s Query = "U PDATE `Pro files` SET  {$sSet} W HERE `ID`  = " . (int )$iMemberI D;
    217           // echo $sQue ry ;
    218           db _res($sQue ry);
    219           $t his -> cre ateProfile Cache( $iM emberID );
    220           re turn (bool )mysql_aff ected_rows ();
    221       }
    222       
    223       functi on collect SetString(  $aData )  {
    224           $s RequestSet  = '';
    225           
    226           fo reach( $aD ata as $sF ield => $m Value ) {
    227                if( is_s tring($mVa lue) )
    228                    $sVa lue = "'"  . addslash es( $mValu e ) . "'";
    229                elseif(  is_bool($m Value) )
    230                    $sVa lue = (int )$mValue;
    231                elseif(  is_array($ mValue) )  {
    232                    $sVa lue = '';
    233                    fore ach( $mVal ue as $sSt r )
    234                         $sValue .=  addslashe s( str_rep lace( ',',  '', $sStr  ) ) . ',' ;
    235                        
    236                    $sVa lue = "'"  . substr($ sValue,0,- 1) . "'";
    237                } elseif ( is_int($ mValue) )  {
    238                    $sVa lue = $mVa lue;
    239                } else
    240                    $sVa lue = 'NUL L';
    241                
    242                $sReques tSet .= "` $sField` =  $sValue,\ n";
    243           }
    244           
    245           $s RequestSet  = substr(  $sRequest Set,0, -2  );// remov e ,\n
    246           
    247           re turn $sReq uestSet;
    248       }
    249       
    250       functi on deleteP rofile( $i MemberID )  {
    251           
    252       }
    253       
    254       functi on genRand omPassword () {
    255           re turn 'aaaa aa';
    256       }
    257       
    258       functi on getProf ileInfo( $ iMemberID  ) {
    259           re turn db_as soc_arr( " SELECT * F ROM `Profi les` WHERE  `ID` = "  . (int)$iM emberID );
    260       }
    261       
    262       functi on genUniq ueValue( $ sFieldName , $sValue,  $bRandMor e = false  ) {
    263           if ( $bRandMo re )
    264                $sRand =  '(' . ran d(1000, 99 99) . ')';
    265           el se
    266                $sRand =  '(2)';
    267                
    268           $s NewValue =  $sValue .  $sRand;
    269           
    270           $i Count = (i nt)db_valu e( "SELECT  COUNT(*)  FROM `Prof iles` WHER E `$sField Name` = '"  . addslas hes($sNewV alue) . "' " );
    271           if ( $iCount  )
    272                return g enUniqueVa lue( $sFie ldName, $s Value, tru e );
    273           el se
    274                return $ sNewValue;
    275       }
    276   }