810. File Comparison Report

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

810.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.0.5 search.php Thu Sep 20 09:00:20 2007 UTC
2 Dolphin-v.6.1.0 search.php Sun Apr 27 07:29:24 2008 UTC

810.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 82 186
Changed 68 652
Inserted 11 32
Removed 4 15

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

810.4 Active regular expressions

No regular expressions were active.

810.5 Comparison detail

1   <?
  1   <? php
2      
3   /********* ********** ********** ********** ********** ********** ********** ******    
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     2  
21   require_on ce(   '
inc/header .inc.php'   );
  3   require_on ce(   ' ./ inc/header .inc.php'   );
22   require_on ce(   BX_DIRECTO RY_PATH_IN C   .   '
d es i g n.inc.php'   );
  4   require_on ce(   BX_DIRECTO RY_PATH_IN C       .   ' a d m i
n.inc.php'   );
23   require_on ce(   BX_DIRECTO RY_PATH_ IN C  
.   ' p rofile s. i nc .php'   );
  5   require_on ce( BX_DIR ECTORY_PAT H_INC      . 'db.inc. php' );
24   require_on ce(   BX_DIRECTO RY_PATH_ IN C  
.   ' p rofile _di s p.i n c .php'   );
  6   require_on ce( BX_DIR ECTORY_PAT H_INC      . 'members .inc.php'  );
    7   require_on ce(   BX_DIRECTO RY_PATH_
C LASSES   .   ' BxDolP rofile F i elds .php'   );
    8   require_on ce(   BX_DIRECTO RY_PATH_
C LASSES   .   ' BxDolP rofile
s Co n troller .php'   );
25     9  
26   // ------- -------- p age variab les and lo gin   10   $bEnZipSea rch = getP aram("enab le_zip_loc ") == "on"  ? 1 : 0;
    11   if ( $bEnZ ipSearch )
    12       requir e_once( BX _DIRECTORY _PATH_INC  . 'RadiusA ssistant.i nc' );
27     13  
28   $_page['na me_index']  = 4;   14   $_page['na me_index']  = 4;
29   $_page['cs s_name'] =  'search.c ss';   15   $_page['cs s_name']    = 'search .css';
30     16  
31   if ( !( $l ogged['adm in'] = mem ber_auth(  1, false )  ) )   17   check_logg ed();
32       if ( ! ( $logged[ 'member']  = member_a uth( 0, fa lse ) ) )    
33           if  ( !( $log ged['aff']  = member_ auth( 2, f alse )) )    
34                $logged[ 'moderator '] = membe r_auth( 3,  false );    
35     18  
36   $_page['he ader'] = _ t("_SEARCH _FOR", $si te['title' ]);    
37   $_page['he ader_text' ] = _t("_S EARCH_H");    
38     19  
39   // ------- -------- p age compon ents   20   // get sea rch mode
    21   if( $_REQU EST['searc h_mode'] )
    22       $sSear chMode = $ _REQUEST[' search_mod e'];
    23   else
    24       $sSear chMode = ' simple';
40     25  
41   $w_ex = 20 ;   26   switch( $_ REQUEST['s earch_mode '] ) {
    27       case ' quick':
    28           $i PFArea = 1 0;
    29           $_ page['head er_text']  = $sPageHe ader = _t(  '_Quick S earch' );
    30       break;
42     31       
43   //simple a nd advance d search   32       case ' adv':
44   if( $_GET[ 'mode'] ==  'simple'  )   33           $i PFArea = 1 1;
45   {   34           $_ page['head er_text']  = $sPageHe ader = _t(  '_Advance d Search'  );
46       $_page ['name_ind ex'] = 124 ;   35       break;
47        $_page['he ader_text' ]   =  
_t( " _Simple   Search " );
  36  
    
    37       defaul t:
    38           $i PFArea = 9 ;
    39           $s SearchMode  = 'simple ';
    40            $_page['he ader_text' ]   =   $sPageHead er   =   _t(   ' _Simple   Search '   );
48   }   41   }
49   elseif( $_ GET['mode' ] == 'adv'  )   42  
50   {   43  
51       $_page ['name_ind ex'] = 125 ;   44   //collect  inputs
52       $_page ['header_t ext'] = _t ("_Advance d search") ;   45   $oPF = new  BxDolProf ileFields( $iPFArea);
    46   $aRequestP arams = $o PF -> coll ectSearchR equestPara ms();
    47  
    48   if( isset(  $_REQUEST ['ID'] ) a nd (int)$_ REQUEST['I D'] )
    49       $aRequ estParams[ 'ID'] = (i nt)$_REQUE ST['ID'];
    50  
    51   if( isset(  $_REQUEST ['NickName '] ) and t rim( $_REQ UEST['Nick Name'] ) )
    52       $aRequ estParams[ 'NickName' ] = trim(  process_pa ss_data( $ _REQUEST[' NickName']  ) );
    53  
    54   if( isset(  $_REQUEST ['Tags'] )  and trim(  $_REQUEST ['Tags'] )  )
    55       $aRequ estParams[ 'Tags'] =  trim( proc ess_pass_d ata( $_REQ UEST['Tags '] ) );
    56  
    57   if( isset(  $_REQUEST ['distance '] ) and ( int)$_REQU EST['dista nce'] )
    58       $aRequ estParams[ 'distance' ] = (int)$ _REQUEST[' distance'] ;
    59  
    60   // start p age genera tion
    61   ob_start() ;
    62  
    63   $bShowForm s = false;
    64   //echoDbg( $aRequestP arams);
    65   if( !empty ( $aReques tParams )  or $_REQUE ST['online _only'] )
    66       PageCo deSearchRe sult( $aRe questParam s );
    67   else {
    68       PageCo deSearchFo rm();
    69       $bShow Forms = tr ue;
53   }   70   }
54     71  
    72  
55   $_ni = $_p age['name_ index'];   73   $_ni = $_p age['name_ index'];
56     74  
57   $_page_con t[$_ni][' s e
a r c h ']              =  
_
t (" _ S ea rch" );
  75   $_page_con t[$_ni][' pag e _m a in_ c ode ']     =   ob _ ge t
_ cl ea n( );
58   $_page_con t[$_ni]['w ith_photos _only'] =  _t("_With  photos onl y");    
59   $_page_con t[$_ni]['o nline_only ']      =  _t("_onlin e only");    
60   $_page_con t[$_ni]['e xtended_se arch']  =  _t("_Exten ded search ");    
61     76  
62   $_page_con t[$_ni]['s earch_by_i d']       =  
PageCodeSe archByID()
;
  77   $_page_con t[$_ni]['s earch_by_i d']       =   $bShowForm s   ?   PageCodeSe archByID()     :   '' ;
63   $_page_con t[$_ni]['s earch_by_n ick']     =  
PageCodeSe archByNick ()
;
  78   $_page_con t[$_ni]['s earch_by_n ick']     =   $bShowForm s   ?   PageCodeSe archByNick ()   :   '' ;
64   $_page_con t[$_ni][' pag e _m a in_ c ode ']     =   PageC o
m p Page Main Code
()
;
  79   $_page_con t[$_ni][' s e
a r c h_by_tag ']      =   $bSh o wFor m s   ?   Page
Code SearchByTa g ()    :   '' ;
65     80  
66   $_page_con t[$_ni]['z ip_locator ']      =  ($en_ziplo c) ? PageC odeZipLoca tor() : '' ;   81   PageCode() ;
67     82  
68   // ------- -------- [ END] page  components    
69     83  
70  
PageCode
() ;
  84   function   PageCode SearchForm ()   {
    85       global  $oPF;
    86       global  $sPageHea der;
    87       global  $sSearchM ode;
71     88       
72   // ------- -------- p age compon ents funct ions   89       ob_sta rt();
    90       ?>
    91   <form meth od="GET" a ction="<?=  $_SERVER[ 'PHP_SELF' ] ?>">
    92       <table  class="se arch_form"  cellspaci ng="0">
    93       <?
73     94       
74   /**   95       foreac h( $oPF ->  aBlocks a s $aBlock  ) {
75    * page co de functio n   96           ?>
76    */   97           <t r class="s earch_form _block">
77   function P ageCompPag eMainCode( )   98                <th cols pan="2"><? = _t( $aBl ock['Capti on'] ) ?>< /th>
78   {   99           </ tr>
79       global  $en_ziplo c;   100           <?
80       global  $_page_co nt;    
81       global  $_ni;    
82       global  $w_ex;    
83       global  $member_s ex;    
84       global  $logged;    
85       global  $search_s tart_age;    
86       global  $search_e nd_age;    
87     101           
88       $gl_se arch_start _age    =  (int)$sear ch_start_a ge;   102           fo reach( $aB lock['Item s'] as $aI tem ) {
89       $gl_se arch_end_a ge      =  (int)$sear ch_end_age ;   103                ?>
    104           <t r class="s earch_form _row">
    105                <td clas s="search_ form_capti on"><?= _t ( $aItem[' Caption']  ) ?>:</td>
    106                <td clas s="search_ form_value ">
    107                <?
90     108           
91       if ( $ logged['me mber'] )   109                
92       {   110                //draw t he control
93           // $arr_sex =  db_arr("S ELECT Sex  FROM Profi les WHERE  ID = ".(in t)$_COOKIE ['memberID ']);   111                switch(  $aItem['Ty pe'] ) {
94           $m ember_sex  = getSex(  $_COOKIE[' memberID']  );//$arr_ sex['Sex'] ;   112                    case  'text':
    113                    case  'area':
    114                         ?>
    115                         <input typ e="text" n ame="<?= $ aItem['Nam e'] ?>" cl ass="input _text" />
    116                         <?
    117                    brea k;
    118                    
    119                    case  'date':
    120                    case  'range':
    121                    case  'num':
    122                         echo _t( ' _From' );
    123                         ?>
    124                         <input typ e="text" n ame="<?= $ aItem['Nam e'] ?>[0]"  class="in put_date"  />
    125                         <?
    126                         echo _t( ' _To' );
    127                         ?>
    128                         <input typ e="text" n ame="<?= $ aItem['Nam e'] ?>[1]"  class="in put_date"  />
    129                         <?
    130                    brea k;
    131                    
    132                    case  'select_o ne':
    133                    case  'select_s et':
    134                         switch ( $ aItem['Con trol'] ) {
    135                             case ' select':
    136                                 ?>
    137                         <select na me="<?= $a Item['Name '] ?>[]" m ultiple="m ultiple" c lass="inpu t_select">
    138                             <?= Se lectOption s( $aItem[ 'Name'] )  ?>
    139                         </select>
    140                                 <?
    141                             break;
    142                             
    143                             case ' radio':
    144                             case ' checkbox':
    145                                 $a Values = g etFieldVal ues( $aIte m['Name']  );
    146                                 
    147                                 fo reach( $aV alues as $ sKey => $s Value ) {
    148                                      ?>
    149                         <input typ e="checkbo x" name="< ?= $aItem[ 'Name'] ?> []" value= "<?= $sKey  ?>" id="< ?= $aItem[ 'Name'] ?> _<?= $sKey  ?>" />
    150                         <label for ="<?= $aIt em['Name']  ?>_<?= $s Key ?>"><? = _t( $sVa lue ) ?></ label>
    151                                      <?
95       }   152                                 }
96       else   153                              break;
97        {    
98           $m ember_sex  = 'male';    
99       }   154                         }
    155                    brea k;
100     156                    
101       $ret =  "";   157                    case  'bool':
    158                         ?>
    159                         <input typ e="checkbo x" name="< ? $aItem[' Name'] ?>"  value="1"  />
    160                         <?
    161                    brea k;
102     162                    
103       // Get  LookingFo r profile  type   163                    case  'system':
104       $defau lt_looking _for = '';   164                         switch(   $ aIt em ['Nam e ']   )   {
105       if ( s trlen($_GE T['Looking For']) )   165                              case   ' Coup le':
106       {   166                                 ?>
107           $d efault_loo king_for =  $_GET['Lo okingFor'] ;   167                         <input typ e="checkbo x" name="C ouple[0]"  value="1"  id="Couple _0" />
108       }   168                         <label for ="Couple_0 "><?= _t(  '_Single'  ) ?></labe l>
109       elseif  ( $fname  == 'Lookin gFor' )   169                         <input typ e="checkbo x" name="C ouple[1]"  value="1"  id="Couple _1" />
110       {   170                         <label for ="Couple_1 "><?= _t(  '_Couple'  ) ?></labe l>
111            switch   (   $ m em ber_s e x   )
  171                                 <?
112           {    
113                 case   ' ma le':    
114                    $def ault_looki ng_for = " female";    
115                    brea k;   172                             break;
116                case 'fe male':   173                             
117                    $def ault_looki ng_for = " male";   174                             case ' Keyword':
    175                                 ?>
    176                         <input typ e="text" n ame="<?= $ aItem['Nam e'] ?>" cl ass="input _text" />
    177                                 <?
    178                             break;
    179                             
    180                             case ' Location':
    181                                 ec ho 'Not im plemented  yet';
    182                                 $s LivingWith inC = _t(" _living wi thin");
    183                                 $s MilesC = _ t("_miles" );
    184                                 $s KmC = _t(" _kilometer s");
    185                                 $s FromZipC =  _t("_from  zip/posta l code");
    186  
    187                                 $s Ret = <<<E OF
    188   <table cla ss=small c ellspacing =3 cellpad ding=0 bor der="0">
    189   <tr>
    190   <td>
    191       &nbsp; {$sLivingW ithinC}&nb sp;
    192       <input  class=no  type=text  name="dist ance"  siz e=12 />
    193   <select na me="metric ">
    194       <optio n selected ="selected " value="m iles">{$sM ilesC}</op tion>
    195       <optio n value="k m">{$sKmC} </option>
    196   </select>
    197       &nbsp; {$sFromZip C}&nbsp;
    198       <input  class=no  type=text  name=zip s ize=12 />
    199   </td>
    200   </tr>
    201   </table>
    202   EOF;
    203                             echo $ sRet;
    204  
118                    brea k;   205                             break;
119           }   206                         }
    207                    brea k;
    208                    
120       }   209                }
121     210  
122       $respd  = db_res( "SELECT *  FROM `Prof ilesDesc`  WHERE `sea rch_type`  <> 'none'  ORDER BY ` search_ord er` ASC");   211                
123       while  ( $arrpd =  mysql_fet ch_array($ respd) )   212                ?>
    213                </td>
    214           </ tr>
    215                <?
    216           }
    217       }
    218       
    219       ?>
    220           <t r>
    221                <td clas s="search_ form_submi t_row" col span="2">
    222                    <inp ut type="c heckbox" n ame="onlin e_only" id ="online_o nly" />
    223                    <lab el for="on line_only" ><?= _t( ' _online on ly' ) ?></ label>
    224                    <inp ut type="c heckbox" n ame="photo s_only" id ="photos_o nly" />
    225                    <lab el for="ph otos_only" ><?= _t( ' _With phot os only' )  ?></label >
    226                    <inp ut type="s ubmit" val ue="<?= _t ( '_Fetch'  ) ?>" />
    227                </td>
    228           </ tr>
    229       </tabl e>
    230   </form>
    231       <?
    232       
    233       echo D esignBoxCo ntentBorde r( $sPageH eader, ob_ get_clean( ) );
    234   }
    235  
    236   function P ageCodeSea rchByID()
124       {   237   {
125           $f name = get _field_nam e ( $arrpd  );   238       ob_sta rt();
    239       ?>
    240       <div c lass="sear ch_by_id">
    241           <f orm method ="GET" act ion="<?= $ _SERVER['P HP_SELF']  ?>">
    242                <input t ype="text"  class="in put_by_id"  name="ID"  />
    243                <br />
    244                <input t ype="submi t" class=" input_subm it" value= "<?= _t( ' _Fetch' )  ?>" />
    245           </ form>
    246       </div>
    247       <?php
    248  
    249       return  DesignBox ContentBor der( _t( ' _Search by  ID' ), ob _get_clean () );
    250   }
126     251  
127           if  ($fname = = "Sex" &&  !$_GET['L ookingFor' ])   252   function P ageCodeSea rchByNick( )
128           {   253   {
129                $arrpd[' search_def ault'] = $ member_sex ;   254       ob_sta rt();
    255       ?>
    256       <div c lass="sear ch_by_nick ">
    257           <f orm method ="GET" act ion="<?= $ _SERVER['P HP_SELF']  ?>">
    258                <input t ype="text"  class="in put_by_nic k" name="N ickName" / >
    259                <br />
    260                <input t ype="submi t" value=" <?= _t( '_ Fetch' ) ? >" />
    261           </ form>
    262       </div>
    263       <?php
    264  
    265       return  DesignBox ContentBor der( _t( ' _Search by  Nickname'  ), ob_get _clean() ) ;
130           }   266   }
131     267  
132           if  ( $fname  == 'Lookin gFor' && s trlen($def ault_looki ng_for) )   268   function P ageCodeSea rchByTag()
133           {   269   {
134                $arrpd[' search_def ault'] = $ default_lo oking_for;   270       ob_sta rt();
    271       ?>
    272       <div c lass="sear ch_by_tag" >
    273           <f orm method ="GET" act ion="<?= $ _SERVER['P HP_SELF']  ?>">
    274                <input t ype="text"  class="in put_by_tag " name="Ta gs" />
    275                <br />
    276                <input t ype="submi t" value=" <?= _t( '_ Fetch' ) ? >" />
    277           </ form>
    278       </div>
    279       <?php
    280  
    281       return  DesignBox ContentBor der( _t( ' _Search by  Tag' ), o b_get_clea n() );
135           }   282   }
136     283  
137           $s ection_hid e = 0;   284   function P ageCodeSea rchResult(  $aParams  ) {
    285       global  $oPF;
    286       global  $dir;
    287       global  $tmpl;
    288       global  $bEnZipSe arch;
138     289  
139           sw itch ($arr pd['search _type'])   290       $sQuer y = 'SELEC T DISTINCT  IF( `Prof iles`.`Cou ple`=0, `P rofiles`.` ID`, IF( ` Profiles`. `Couple`>` Profiles`. `ID`, `Pro files`.`ID `, `Profil es`.`Coupl e` ) ) AS  `ID` FROM  `Profiles`  ';
140           {   291       $sJoin   = '';
141                case 'ra dio':   292       $aWher e = array( );
142                    $ret  .= print_ row_search _radio( $a rrpd, $arr pd['search _default'] , "table",  $javascri pt, $secti on_hide );   293       
    294       
    295       $aMyBl ocks = $oP F -> aBloc ks;
    296       $aMyBl ocks['addS pecial'] =  array( 'I tems' => a rray(
    297           $o PF -> aCac he[100][0] ['Items'][ 1], //add  id
    298           $o PF -> aCac he[100][0] ['Items'][ 2], //add  nickname
    299           $o PF -> aCac he[100][0] ['Items'][ 38] //add  tags
    300       ) );
    301       
    302       //coll ect where  request ar ray
    303       foreac h( $aMyBlo cks as $iB lockID =>  $aBlock )  {
    304           fo reach( $aB lock['Item s'] as $aI tem ) {
    305                if( !iss et( $aPara ms[ $aItem ['Name'] ]  ) )
    306                    cont inue;
    307                
    308                if( $iBl ockID != ' addSpecial ' and ( $a Item['Name '] == 'ID'  or $aItem ['Name'] = = 'NickNam e' or $aIt em['Name']  == 'Tags'  ) )
    309                    cont inue; // s kip collec ting id, n ick and ta gs for reg ular block s, only in  special
    310                
    311                $sItemNa me = $aIte m['Name'];
    312                $mValue     = $aPar ams[$sItem Name];
    313                
    314                switch(  $aItem['Ty pe'] ) {
    315                    case  'text':
    316                    case  'area':
    317                         if( $sItem Name == 'T ags' ) {
    318                             $sJoin  .= " INNE R JOIN `Ta gs` ON (`T ags`.`Type ` = 'profi le' AND `T ags`.`ID`  = `Profile s`.`ID`) " ;
    319                             $aWher e[] = "`Ta gs`.`Tag`  = '" . add slashes($m Value) . " '";
    320                         } else
    321                             $aWher e[] = "`Pr ofiles`.`$ sItemName`  LIKE '%"  . addslash es($mValue ) . "%'";
143                    brea k;   322                    brea k;
144                 case   ' list ':   323                    
145                    $ret  .= print_ row_search _list( $ar rpd, $arrp d['search_ default'],  "text", $ section_hi de );   324                     case   ' num ':
    325                         $aWhere[]  = "`Profil es`.`$sIte mName` >=  {$mValue[0 ]} AND `Pr ofiles`.`$ sItemName`  <= {$mVal ue[1]}";
146                    brea k;   326                    brea k;
147                 case   ' ch e ck ':   327                    
148                    $ret  .= print_ row_search _check( $a rrpd, $arr pd['search _default'] , "text",  $section_h ide );   328                     case   ' dat e
':
    329                         $iMin = fl oor( $mVal ue[0] * 36 5.25 ); // for leap y ears
    330                         $iMax = fl oor( $mVal ue[1] * 36 5.25 );
    331                        
    332                         $aWhere[]  = "DATEDIF F( NOW(),  `Profiles` .`$sItemNa me` ) >= $ iMin AND D ATEDIFF( N OW(), `Pro files`.`$s ItemName`  ) <= $iMax ";
    333                        
    334                         //$aWhere[ ] = "DATE_ ADD( `$sIt emName`, I NTERVAL {$ mValue[0]}  YEAR ) <=  NOW() AND  DATE_ADD(  `$sItemNa me`, INTER VAL {$mVal ue[1]} YEA R ) >= NOW ()"; //is  it correct  statement ?
149                    brea k;   335                    brea k;
150                 case   ' ch ec k _ s e t ':   336                    
151                    $ret  .= print_ row_search _check_set ( $arrpd,  $arrpd['se arch_defau lt'], "tex t", "", $s ection_hid e );   337                     case   ' sel ec t _ on e
':
    338                         $sValue =  implode( ' ,', $mValu e );
    339                         $aWhere[]  = "FIND_IN _SET( `Pro files`.`$s ItemName`,  '" . adds lashes($sV alue) . "'  )";
152                    brea k;   340                    brea k;
153                 case   ' dat e rang e
':
  341                    
154                    $ret  .= print_ row_search _daterange ( $arrpd,  $arrpd['se arch_defau lt'], "tex t", $secti on_hide );   342                     case   ' s e l e ct_set ':
    343                         $aSet = ar ray();
    344                        
    345                         foreach( $ mValue as  $sValue )  {
    346                             $sValu e = addsla shes( $sVa lue );
    347                             $aSet[ ] = "FIND_ IN_SET( '$ sValue', ` Profiles`. `$sItemNam e` )";
    348                         }
    349                        
    350                         $aWhere[]  = '( ' . i mplode( '  OR ', $aSe t ) . ' )' ;
155                    brea k;   351                    brea k;
156                 case 'text ':   352  
                 
157                    $ret  .= print_ row_search _text( $ar rpd, $arrp d['search_ default'],  "text", $ section_hi de );   353                    case  'range':
    354                         //impl
158                    brea k;   355                    brea k;
    356                    
    357                    case  'bool':
    358                         $aWhere[]  = "`Profil es`.`$sIte mName'";
    359                    brea k;
    360                    
    361                    case  'system':
    362                         switch( $a Item['Name '] ) {
    363                             case ' Couple':
    364                                 if ($mValue = = '-1') {
159           }   365                                 }
160       }   366                                 el seif( $mVa lue )
161       return  $ret;   367                                      $aWhere[ ] = "`Prof iles`.`Cou ple` > `Pr ofiles`.`I D`";
162   }   368                                  else
    369                                      $aWhere[ ] = "`Prof iles`.`Cou ple` = 0";
    370                             break;
163     371                             
164   /**   372                             case ' Location':
165    * Zip Loc ator Code   373                                 $a Fields = e xplode( "\ n", $aItem ['Extra']  );
166    */   374                                 $a Keyw = arr ay();
167   function P ageCodeZip Locator()   375                                 $s Value = ad dslashes(  $mValue );
168   {    
169       global  $w_ex;    
170       global  $member_s ex;    
171       global  $bgcolor;    
172       global  $tmpl;    
173       global  $site;    
174       global  $search_s tart_age;    
175       global  $search_e nd_age;    
176     376                                 
177       $gl_se arch_start _age    =  (int)$sear ch_start_a ge;   377                                 fo reach( $aF ields as $ sField )
178       $gl_se arch_end_a ge      =  (int)$sear ch_end_age ;   378                                      $aKeyw[]  = "`Profi les`.`$sFi eld` LIKE  '%$sValue% '";
179     379                                 
180   $ret = <<< EOF   380                                 $a Where[] =  '( ' . imp lode( ' OR  ', $aKeyw  ) . ')';
    381                             break;
181     382                             
182   <!-- Searc h By Dista nvce -->   383                             case ' ID':
    384                                 $a Where[] =  "`ID` = $m Value";
    385                             break;
    386                         }
    387                    brea k;
    388                }
    389           }
    390       }
183     391  
184   EOF;   392       if ($b EnZipSearc h && $aPar ams['dista nce'] > 0)  {
    393           $s Zip = html specialcha rs_adv($_R EQUEST['zi p']);
    394           $i Distance =  (int)$aPa rams['dist ance'];
    395           $s Metric = h tmlspecial chars_adv( $_REQUEST[ 'metric']) ;
185     396  
186       ob_sta rt();   397           $z ip = proce ss_db_inpu t( strtoup per( str_r eplace(' ' , '', $zip ) ), 1);
187   ?>   398           $a ZipInfo =  db_arr("SE LECT `Lati tude`, `Lo ngitude` F ROM `ZIPCo des` WHERE  REPLACE(` ZIPCode`,'  ','') = ' {$sZip}'") ;
    399           // echoDbg($a ZipInfo);
    400           if  ( $aZipIn fo ) {
    401                // ZIP c ode exists
    402                $miles2k m = 0.7; / / miles/ki lometers r atio
188     403  
189   <form meth od="get" a ction="sea rch_result .php">   404                $Miles =  $sMetric  == "km" ?  $iDistance  * $miles2 km : $iDis tance;
190   <center>   405                $Latitud e = $aZipI nfo["Latit ude"];
191   <table cla ss=small c ellspacing =3 cellpad ding=0 bor der="0">   406                $Longitu de = $aZip Info["Long itude"];
192       <tr>    
193       <td><? =_t("_I am ")?>&nbsp; </td>    
194       <td><s elect name ="Sex">    
195   <?php    
196       echo S electOptio ns("Sex",  $member_se x);    
197   ?>    
198       </sele ct></td>    
199       <td>&n bsp;<?=_t( "_seeking  a")?>&nbsp ;</td>    
200       <td><s elect name ="LookingF or">    
201   <?php    
202       echo S electOptio ns("Lookin gFor", ($m ember_sex= ='male' ?  'female' :  'male') ) ;    
203   ?>    
204       </sele ct></td>    
205       <td>&n bsp;<?=_t( "_from")?> &nbsp;</td >    
206       <td><s elect name ="DateOfBi rth_start" >    
207   <?    
208     407  
209   for ( $i =  $gl_searc h_start_ag e ; $i <=  $gl_search _end_age ;  $i++ )   408                $zcdRadi us = new R adiusAssis tant( $Lat itude, $Lo ngitude, $ Miles );
210   {   409                //echoDb g($zcdRadi us);
211       $sel =  $i == $gl _search_st art_age ?  'selected'  : '';   410                $minLat  = $zcdRadi us->MinLat itude();
212       echo " <option va lue=$i $se l>$i</opti on>";   411                $maxLat  = $zcdRadi us->MaxLat itude();
    412                $minLong  = $zcdRad ius->MinLo ngitude();
    413                $maxLong  = $zcdRad ius->MaxLo ngitude();
    414  
    415                $sJoin . = " LEFT J OIN `ZIPCo des` ON UP PER( REPLA CE(`Profil es`.`zip`,  ' ', '')  ) = REPLAC E(`ZIPCode s`.`ZIPCod e`,' ', '' ) ";
    416                $aWhere[ ] = "`ZIPC odes`.`ZIP Code` IS N OT NULL AN D `ZIPCode s`.`Latitu de` >= {$m inLat} AND  `ZIPCodes `.`Latitud e` <= {$ma xLat} AND  `ZIPCodes` .`Longitud e` >= {$mi nLong} AND  `ZIPCodes `.`Longitu de` <= {$m axLong} ";
213   }   417           }
214   ?>    
215       </sele ct></td>    
216       <td>&n bsp;<?=_t( "_to")?>&n bsp;</td>    
217       <td><s elect name ="DateOfBi rth_end">    
218   <?    
219   for ( $i =  $gl_searc h_start_ag e ; $i <=  $gl_search _end_age ;  $i++ )    
220   {    
221       $sel =  $i == $gl _search_en d_age ? 's elected' :  '';    
222       echo " <option va lue=$i $se l>$i</opti on>";    
223   }   418       }
224   ?>    
225       </sele ct></td>    
226       </tabl e>    
227     419  
228   <table cla ss=small c ellspacing =3 cellpad ding=0 bor der="0">   420       // col lect query  string
229   <tr>   421       $aWher e[] = "`Pr ofiles`.`S tatus` = ' Active'";
230   <td>    
231       &nbsp; <?=_t("_li ving withi n")?>&nbsp ;    
232       <input  class=no  type=text  name=dista nce  size= 12 />    
233   <select na me="metric ">    
234       <optio n selected ="selected " value="m iles"><?ph p echo _t( "_miles");  ?> </opti on>    
235       <optio n value="k m"><?php e cho _t("_k ilometers" ); ?> </op tion>    
236   </select>    
237       &nbsp; <?=_t("_fr om zip/pos tal code") ?>&nbsp;    
238       <input  class=no  type=text  name=zip s ize=12 />    
239   </td>    
240   </tr>    
241   </table>    
242     422       
    423       // add  online on ly
    424       if( $_ REQUEST['o nline_only '] ) {
    425           $i OnlineTime  = getPara m( 'member _online_ti me' );
    426           $a Where[] =  "DATE_ADD(  `DateLast Nav`, INTE RVAL $iOnl ineTime MI NUTE ) >=  NOW()";
    427       }
243     428       
244   <table cla ss=small c ellspacing =3 cellpad ding=0>   429       if( $_ REQUEST['p hotos_only '] )
245   <tr>   430           $a Where[] =  "`Profiles `.`PrimPho to`";
246     431  
247       <td>   432       $aWher e[] = "(`P rofiles`.` Couple`='0 ' OR `Prof iles`.`Cou ple`>`Prof iles`.`ID` )";
248           <i nput type= checkbox n ame="onlin e_only" /> <?php echo  _t("_onli ne only");  ?>    
249       </td>    
250     433       
251       <td>   434       $sWher e = ' WHER E ' . impl ode( ' AND  ', $aWher e );
252           <i nput type= checkbox n ame=photos _only /><? php echo _ t("_With p hotos only "); ?>    
253       </td>    
254     435       
255       <td>   436       //coll ect the wh ole query  string
256           <i nput class =no type=s ubmit valu e="<?= _t( "_Search") ; ?>" />   437       $sQuer y = $sQuer y . $sJoin  . $sWhere ;
257       </td>    
258     438       
259   </tr>   439       //echo  $sQuery;
260   </table>    
261     440       
262   </center>< /form>   441       //make  search
    442       $rProf iles = db_ res( $sQue ry );
263     443       
    444       $aProf iles = arr ay();
    445       while  ($aProfile  = mysql_f etch_assoc ($rProfile s)) {
    446           $a Profiles[]  = $aProfi le['ID'];
    447       }
264     448       
    449       $iCoun tProfiles  = count( $ aProfiles  );
265     450       
266   <?php   451       if( !$ iCountProf iles ) {
    452           ec ho '<div c lass="no_r esult"><di v>' .  _t( "_NO_RESUL TS") . '</ div></div> ';
    453       } else  {
    454           // collect pa gination
    455           $i CurrentPag e    = iss et( $_GET[ 'page']          ) ?  (int)$_GET ['page']          : 1 ;
    456           $i ResultsPer Page = iss et( $_GET[ 'res_per_p age'] ) ?  (int)$_GET ['res_per_ page'] : 1 0;
267     457           
268       $out =  ob_get_cl ean();   458           if ( $iCurren tPage < 1  )
269       if ( $ tmpl=='adl ' )   459                $iCurren tPage = 1;
270           $w _ex1 = 0;   460           if ( $iResult sPerPage <  1 )
    461                $iResult sPerPage =  10;
271     462           
272       $ret . = DesignBo xContentBo rder( _t(" _Search by  distance" ), $out );   463           $i TotalPages  = ceil( $ iCountProf iles / $iR esultsPerP age );
273     464           
    465           if ( $iTotalP ages > 1 )  {
    466                if( $iCu rrentPage  > $iTotalP ages )
    467                    $iCu rrentPage  = $iTotalP ages;
274     468                
275       return  $ret;   469                $aOutput Profiles       = arra y_slice( $ aProfiles,  ( $iCurre ntPage - 1  ) * $iRes ultsPerPag e, $iResul tsPerPage  );
276   }   470                $iCountO utputProfi les = coun t( $aOutpu tProfiles  );
277     471                
278   /**   472                $iFromRe sults = (  ( $iCurren tPage - 1  ) * $iResu ltsPerPage  ) + 1;
279    * "Search  by NickNa me"    
280    */    
281   function P ageCodeSea rchByNick( )    
282   {    
283       global  $w_ex;    
284       global  $tmpl;    
285     473                
286       ob_sta rt();   474                $sPagina tion = gen SearchPagi nation( $i TotalPages , $iCurren tPage, $iR esultsPerP age );
287  
  475           }  else {
288   ?>   476                $iFromRe sults = 1;
289       <form  method=get  action="s earch_resu lt.php"><b r />   477                $aOutput Profiles       = $aPr ofiles;
290       <input  class=no  name="Nick Name" size =13 id="by _nick_id"  /><br /><b r />   478                $iCountO utputProfi les = $iCo untProfile s;
    479                $sPagina tion = '';
    480            }
291     481           
292   <?php   482           $i ToResults    = ( $iFr omResults  - 1 ) + $i CountOutpu tProfiles;
293      echo "< input clas s=no type= \"submit\"  value=".  _t("_Fetch ")." />";    
294   ?>    
295     483           
    484           $s ShowingRes ults = '<d iv class=" showingRes ults">' .  _t( '_Show ing result s:', $iFro mResults,  $iToResult s, $iCount Profiles )  . '</div> ';
296     485           
297       </form ><br />   486           ec ho $sPagin ation;
298   <?php   487           ec ho $sShowi ngResults;
299     488           
300       $out =  ob_get_co ntents();   489           // output sea rch result s
301       ob_end _clean();   490           $s TemplSearc h = file_g et_content s( "{$dir[ 'root']}te mplates/tm pl_{$tmpl} /searchrow .html" );
302       if ( $ tmpl=='adl ' )    
303           $w _ex = 0;    
304     491           
305       $ret =  DesignBox ContentBor der( _t("_ Search by  Nickname") , $out );   492           fo reach( $aO utputProfi les as $iP rofID ) {
    493                $aProfil eInfo = ge tProfileIn fo( $iProf ID );
306     494                
307       return  $ret;   495                if ($aPr ofileInfo[ 'Couple']  > 0) {
    496                    $aPr ofileInfoC  = getProf ileInfo( $ aProfileIn fo['Couple '] );
    497                    echo  PrintSear hResult( $ aProfileIn fo, $sTemp lSearch, 1 , true, $a ProfileInf oC );
    498                } else {
    499                    echo  PrintSear hResult( $ aProfileIn fo, $sTemp lSearch );
    500                }
    501           }
308     502           
    503           ec ho $sShowi ngResults;
    504           ec ho $sPagin ation;
    505       }
309   }   506   }
310     507  
311   /**   508   function g enSearchPa gination(  $iTotalPag es, $iCurr entPage, $ iResultsPe rPage ) {
312    * "Search  by ID"   509       $aGetP arams = $_ GET;
313    */   510       unset(  $aGetPara ms['page']  );
314   function P ageCodeSea rchByID()   511       unset(  $aGetPara ms['res_pe r_page'] ) ;
315   {    
316       global  $w_ex;    
317       global  $tmpl;    
318     512       
    513       $sRequ estString  = collectR equestStri ng( $aGetP arams );
    514       $sRequ estString  = $_SERVER ['PHP_SELF '] . '?' .  substr( $ sRequestSt ring, 1 );
319     515       
320       ob_sta rt();   516       $sPagi nTmpl       = $sReque stString .  '&res_per _page=' .  $iResultsP erPage . ' &page={pag e}';
321   ?>   517       $sResP erPageTmpl  = $sReque stString .  '&res_per _page={res _per_page} ';
322       <form  method=get  action="s earch_resu lt.php"><b r />    
323       <input  class=no  name="ID"  size=13 id ="by_nick_ id" /><br  />    
324       <br />    
325   <?php    
326     518       
327      echo "< input clas s=no type= \"submit\"  value=".  _t("_Fetch ")." />";   519       $sPagi nation = g enResPerPa ge( array( 10,20,50,1 00), $iRes ultsPerPag e, $sResPe rPageTmpl  );
328   ?>   520       $sPagi nation .=   genPagina tion( $iTo talPages,  $iCurrentP age, $sPag inTmpl );
329     521       
330       </form ><br />   522       return  $sPaginat ion;
331   <?php   523   }
332     524  
333       $out =  ob_get_co ntents();   525   function c ollectRequ estString(  $aGetPara ms, $sKeyP ref = '',  $sKeyPostf  = '' ) {
334       ob_end _clean();   526       if( !i s_array( $ aGetParams  ) )
335       if ( $ tmpl=='adl ' )   527           re turn '';
336           $w _ex = 0;    
337     528       
338       $ret =  DesignBox ContentBor der( _t("_ Search by  ID"), $out  );   529       $sRet  = '';
    530       foreac h( $aGetPa rams as $s Key => $sV alue ) {
    531           if ( $sValue  === '' )
    532                continue ;
339     533           
340       return  $ret;   534           if ( !is_arra y($sValue)  ) {
    535                $sRet .=  '&' . url encode( $s KeyPref .  $sKey . $s KeyPostf )  . '=' . u rlencode(  process_pa ss_data( $ sValue ) ) ;
    536           }  else {
    537                $sRet .=  collectRe questStrin g( $sValue , "{$sKeyP ref}{$sKey }{$sKeyPos tf}[", "]"  ); //recu rsive call
    538           }
341   }   539       }
342     540       
343   ?>   541       return  $sRet;
    542   }