233. File Comparison Report

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

233.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.0.5\inc match.inc.php Thu Sep 20 08:58:34 2007 UTC
2 Dolphin-v.6.1.0\inc match.inc.php Mon Apr 14 11:47:22 2008 UTC

233.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 28 90
Changed 26 191
Inserted 1 2
Removed 2 4

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

233.4 Active regular expressions

No regular expressions were active.

233.5 Comparison detail

1   <?
  1   <? php
2     2  
3   /********* ********** ********** ********** ********** ********** ********** ******   3   require_on ce( BX_DIR ECTORY_PAT H_CLASSES  . 'BxDolPr ofileField s.php' );
4   *                              D olphin Sma rt Communi ty Builder    
5   *                                 --------- --------    
6   *     begi n                 : M on Mar 23  2006    
7   *     copy right             : ( C) 2006 Bo onEx Group    
8   *     webs ite               : h ttp://www. boonex.com /    
9   * This fil e is part  of Dolphin  - Smart C ommunity B uilder    
10   *    
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/    
13   *    
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.    
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    
18   * see lice nse.txt fi le; if not , write to  marketing @boonex.co m    
19   ********** ********** ********** ********** ********** ********** ********** *****/    
20     4  
21   require_on ce('header .inc.php') ;   5   function g etProfiles Match( $iP ID1 = 0, $ iPID2 = 0  ) {
22   require_on ce(BX_DIRE CTORY_PATH _INC . 'pr ofile_disp .inc.php') ;   6       $iPID1  = (int)$i PID1;
23   require_on ce(BX_DIRE CTORY_PATH _INC . 'ut ils.inc.ph p');   7       $iPID2  = (int)$i PID2;
24     8  
25   /**   9       if( !$ iPID1 or ! $iPID2 )
26    * match p rofiles   10           re turn 0;
27    * return  number ( 0 -100 ) in  percent, h ow match t his profil es    
28    */    
29   function m atch_profi les ( $Mem ber, $Prof ile )    
30   {    
31      
32       $field s = array( );    
33       $extra s = array( );    
34       $match _fields =  array();    
35       $match _types = a rray();    
36       $match _extras =  array();    
37       $i = 0 ;    
38     11  
39       $res =  db_res("S ELECT `nam e`, `match _field`, ` extra`, `m atch_type` , `match_e xtra` FROM  `Profiles Desc` WHER E `match_t ype` <> ''  AND `matc h_type` <>  'none'");   12       if( $i PID1 == $i PID2 )
40       while  ($arr = my sql_fetch_ array($res ))   13           re turn 0; // maybe need  to return  100?? :)
41       {    
42           $f ields[$i]  = get_fiel d_name($ar r);    
43           $e xtras[$i]  = $arr['ex tra'];    
44           $m atch_field s[$i] = $a rr['match_ field'];    
45           $m atch_types [$i] = $ar r['match_t ype'];    
46           $m atch_extra s[$i] = $a rr['match_ extra'];    
47           $i ++;    
48       }    
49     14  
50       foreac h ( $match _fields as  $n => $m_ field )   15       // try  to find i n cache
51       {   16       $sQuer y = "SELEC T `Percent ` FROM `Pr ofilesMatc h` WHERE ` PID1` = $i PID1 AND ` PID2` = $i PID2";
52           $m _field = t rim($m_fie ld);    
53           if  (!strlen( $m_field))  continue;    
54     17  
55            if   (   ! $
n  
)   {
  18       $aPerc ent = db_a ssoc_arr(  $sQuery );
56                $sql_add _m .= " $m _field";   19        if(  
$ aPerce n t   )
57                $sql_add _p .= " $f ields[$n]" ;   20           re turn (int) $aPercent[ 'Percent'] ;
58           }  else {    
59                $sql_add _m .= ", $ m_field";    
60                $sql_add _p .= ", $ fields[$n] ";    
61           }    
62       }    
63     21  
64       $arr_m  = db_arr( "SELECT $s ql_add_p F ROM Profil es WHERE I D = $Membe r");   22       //not  found in c ache
65       $arr_p  = db_arr( "SELECT $s ql_add_m F ROM Profil es WHERE I D = $Profi le");   23       $aProf 1 = getPro fileInfo(  $iPID1 );
    24       $aProf 2 = getPro fileInfo(  $iPID2 );
66     25  
67        if   (   !$a
r
r _m   ||   !$a
r r_p   )
  26        if(   !$a P r of1   o r  
!$a P r of2   )
68           re turn 0;   27           re turn 0;
69     28  
70       $ret =  0;   29       $oPF =  new BxDol ProfileFie lds( 101 ) ; //matchi ng area
71     30  
72       foreac h ( $match _fields as  $n => $m_ field )   31       $iMatc h = $oPF - > getProfi lesMatch(  $aProf1, $ aProf2 );
73       {    
74           sw itch ( $ma tch_types[ $n] )    
75           {    
76                case "en um":    
77                case "en um_ref":    
78                    if (  $arr_m[$f ields[$n]]  == $arr_p [$match_fi elds[$n]]  )    
79                         $ret +=  $ match_extr as[$n];    
80                    brea k;    
81                case "se t":    
82                    $val s = preg_s plit ("/[, \']+/", $e xtras[$n],  -1, PREG_ SPLIT_NO_E MPTY);    
83                    $val s_m = preg _split ("/ [,\']+/",  $arr_m[$fi elds[$n]],  -1, PREG_ SPLIT_NO_E MPTY);    
84                    $val s_p = preg _split ("/ [,\']+/",  $arr_p[$ma tch_fields [$n]], -1,  PREG_SPLI T_NO_EMPTY );    
85     32  
86                    $cou nt = count ($vals);   33       //writ e to cache
87                    $cou nt_m = cou nt($vals_m );   34       $sQuer y = "INSER T INTO `Pr ofilesMatc h` ( `PID1 `, `PID2`,  `Percent`  ) VALUES  ( $iPID1,  $iPID2, $i Match )";
88                    $cou nt_p = cou nt($vals_p );   35       db_res ( $sQuery  );
89     36  
90                    if (  $count_p  + $count_m  > 0 )   37       return  $iMatch;
91                    {    
92                         $per = $ma tch_extras [$n] / max ($count_p,  $count_m) ;    
93                         foreach (  $vals as $ key => $va l )    
94                         {    
95                             if ( s trlen( str str($arr_m [$fields[$ n]], $val)  ) > 0    
96                                      && strle n( strstr( $arr_p[$ma tch_fields [$n]], $va l) ) > 0 )    
97                                 $r et += $per ;    
98                         }    
99                    }   38   }
100     39  
101                    brea k;   40   function c learProfil eMatchCach e( $iProfi leID ) {
102                case "da terange":   41       $iProf ileID = (i nt)$iProfi leID;
103                    $rg  = split (  "-", $arr_ m[$fields[ $n]] );   42       if( !$ iProfileID  )
104                    $age  = age($ar r_p[$match _fields[$n ]]);   43           re turn false ;
105                    if (  $age >= $ rg[0] && $ age <= $rg [1] )    
106                         $ret += $m atch_extra s[$n];    
107                    brea k;    
108           }    
109       }    
110     44       
111       return  (int)$ret ;   45       $sQuer y = "DELET E FROM `Pr ofilesMatc h` WHERE ` PID1` = $i ProfileID  OR `PID2`  = $iProfil eID";
    46       db_res ( $sQuery  );
112   }   47   }
113     48  
114   function   cupid_emai l (   $p ro file   )
  49   function   cupid_emai l _c ro n( )   {
115   {   50       $iMinC upLevel =  (int)getPa ram('match _percent')
116       global  $ret;   51       $sLast CupidCheck Date = get Param('cup id_last_cr on'); 
117       global  $data;   52       if (!s trlen($sLa stCupidChe ckDate)) r eturn;
118       global  $site;    
119     53  
120       $profi le  = (int )$profile;   54       $sLast CupidCheck DateParam  = "(`DateR eg`>='{$sL astCupidCh eckDate}'  OR `DateLa stEdit`>=' {$sLastCup idCheckDat e}') AND";
121       $match _min = (in t)getParam ("match_pe rcent");    
122     55  
123       $prof_ arr = getP rofileInfo ( $profile , true );   56       $sSele ctedSQL =  "SELECT DI STINCT `Pr ofiles`.`I D` FROM `P rofiles` W HERE {$sLa stCupidChe ckDatePara m} `Status `='Active' ";
124     57  
125       if ( ( (int)$prof _arr['ID'] ) <= 0 )   58       $vSelC upProf = d b_res($sSe lectedSQL) ;
126           re turn false ;   59       $aSelC upids = ar ray();
    60       while  ($aSelCup  = mysql_fe tch_array( $vSelCupPr of)) {
    61           $a SelCupids[ ] = $aSelC up['ID'];
    62       }
127     63  
128       $add =  '';   64       $sAllP rofSQL = " SELECT DIS TINCT `Pro files`.* F ROM `Profi les` WHERE  `Status`= 'Active' A ND (`Coupl e`='0' OR  `Couple`>` ID`)";
129       if ( ' all' != $p rof_arr['L ookingFor' ] )   65       $vAllP rof = db_r es($sAllPr ofSQL);
130           $a dd = "AND  `Sex` = '{ $prof_arr[ 'LookingFo r']}' ";   66       while  ($aAnyProf  = mysql_f etch_array ($vAllProf )) {
131       $add . = "AND ( ` LookingFor ` = '{$pro f_arr['Sex ']}' OR `L ookingFor`  = 'all' ) ";   67           fo reach ( $a SelCupids  as $iSelCu pID ) {
132       $memb_ res = db_r es("SELECT  ID, NickN ame, Email , EmailFla g   68                $iCurMat ch = getPr ofilesMatc h( $aAnyPr of['ID'],  $iSelCupID  );
133                    FROM  Profiles   69                if ( $iC urMatch >=  $iMinCupL evel ) //  If the pro file match es less th en predefi ned percen t then go  to next it eration (i .e. next p rofile)
134                    WHER E EmailNot ify = 'Not ifyMe' AND  Status =  'Active' A ND ID <> $ profile $a dd");   70                    send _cupid_ema il($aAnyPr of, $iSelC upID, $iCu rMatch);
135       if ( m ysql_num_r ows($memb_ res) < 1 )   71           }
136           re turn false ;   72       }
137     73  
138       while  ( $memb_ar r = mysql_ fetch_arra y($memb_re s) )   74       $sUpda teCronValS QL = "UPDA TE `GlPara ms` SET `V ALUE`=NOW( ) WHERE `N ame`='cupi d_last_cro n' LIMIT 1 ";
139       {   75       db_res ($sUpdateC ronValSQL) ;
140           $m atch = mat ch_profile s( $memb_a rr['ID'],  $profile ) ;    
141           if  ( $match  < $match_m in )    
142           {    
143                // If th e profile  matches le ss then pr edefined    
144                // perce nt then go  to next i teration ( i.e. next  profile)    
145                continue ;    
146           }   76   }
147     77  
    78   function s end_cupid_ email( $aA nyProf, $i SelCupID)  {
    79       global  $site;
148     80  
149           $m essage = g etParam( " t_CupidMai l" );   81       $messa ge = getPa ram( "t_Cu pidMail" ) ;
150           $s ubject = g etParam('t _CupidMail _subject') ;   82       $subje ct = getPa ram('t_Cup idMail_sub ject');
151           $s ubject = a ddslashes( $subject);   83       $subje ct = addsl ashes($sub ject);
152     84  
153            $recipient    =   $ memb_ a
r r ['Email'];
  85        $recipient    =   $
a AnyP r of ['Email'];
154           $h eaders     = "From: { $site['tit le']} <{$s ite['email _notify']} >";   86       $heade rs    = "F rom: {$sit e['title'] } <{$site[ 'email_not ify']}>";
155           $h eaders2    = "-f{$sit e['email_n otify']}";   87       $heade rs2   = "- f{$site['e mail_notif y']}";
156     88  
157           $m essage     = str_repl ace( "<Sit eName>", $ site['titl e'], $mess age );   89       $messa ge    = st r_replace(  "<SiteNam e>", $site ['title'],  $message  );
158           $m essage     = str_repl ace( "<Dom ain>", $si te['url'],  $message  );   90       $messa ge    = st r_replace(  "<Domain> ", $site[' url'], $me ssage );
159            $message      =   str_replac e(   "<RealName >",   $ memb_ a
r r ['NickName '],   $message   );
  91        $message      =   str_replac e(   "<RealName >",   $
a AnyP r of ['NickName '],   $message   );
160            $message      =   str_replac e(   "<StrID>",   $ memb_ a
r r ['ID'],   $message   );
  92        $message      =   str_replac e(   "<StrID>",   $
a AnyP r of ['ID'],   $message   );
161            $message      =   str_replac e(   "<MatchPro fileLink>" ,   getProfile Link($
p rof_arr[' ID '] ),   $message   );
  93        $message      =   str_replac e(   "<MatchPro fileLink>" ,   getProfile Link($ iSelCu p
ID
),   $message   );
162           $m essage     = addslash es($messag e);   94       $messa ge    = ad dslashes($ message);
163     95  
164            if   ('Text'   ==   $ memb_ a
r r ['EmailFla g'])
  96        if   ('Text'   ==   $
a AnyP r of ['EmailFla g'])   {
165           {    
166                $message  = html2tx t($message );   97           $m essage = h tml2txt($m essage);
167           }   98       }
168            if   ('HTML'   ==   $ memb_ a
r r ['EmailFla g'])
  99        if   ('HTML'   ==   $
a AnyP r of ['EmailFla g'])   {
169           {    
170                $headers  = "MIME-V ersion: 1. 0\r\n" . " Content-ty pe: text/h tml; chars et=UTF-8\r \n" . $hea ders;   100           $h eaders = " MIME-Versi on: 1.0\r\ n" . "Cont ent-type:  text/html;  charset=U TF-8\r\n"  . $headers ;
171           }   101       }
172     102  
173            $sql   =   "INSERT   INTO   `NotifyQue ue`   SET   `Email`   =   {$ memb_ a
r r ['ID']},   Msg   =   0,   `From`   =   'ProfilesM sgText',   Creation   =   NOW(),   MsgText   =   '$message' ,   MsgSubj   =   '$subject' ";
  103        $sql   =   "INSERT   INTO   `NotifyQue ue`   SET   `Email`   =   {$
a AnyP r of ['ID']},   Msg   =   0,   `From`   =   'ProfilesM sgText',   Creation   =   NOW(),   MsgText   =   '$message' ,   MsgSubj   =   '$subject' ";
174      
175           $r es = db_re s($sql);   104       $res =  db_res($s ql);
176       }    
177      
178       return  true;   105       return  true;
179   }   106   }
180      
181   ?>