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

811.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.0.5 search_result.php Wed Oct 17 08:48:28 2007 UTC
2 Mon May 12 13:07:12 2008 UTC

811.2 Comparison summary

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

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

811.4 Active regular expressions

No regular expressions were active.

811.5 Comparison detail

1   <?    
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      
21   require_on ce( 'inc/h eader.inc. php' );    
22   require_on ce( BX_DIR ECTORY_PAT H_INC . 'p rofiles.in c.php' );    
23   require_on ce( BX_DIR ECTORY_PAT H_INC . 'd esign.inc. php' );    
24   require_on ce( BX_DIR ECTORY_PAT H_INC . 'p rofile_dis p.inc.php'  );    
25   require_on ce( BX_DIR ECTORY_PAT H_INC . 'm embers.inc .php' );    
26   require_on ce( BX_DIR ECTORY_PAT H_INC . 'u tils.inc.p hp' );    
27      
28   $enable_ma tch = getP aram("enab le_match")  == "on" ?  1 : 0;    
29   if ( $enab le_match )    
30       requir e_once( BX _DIRECTORY _PATH_INC  . 'match.i nc.php' );    
31   if ( $en_z iploc )    
32       requir e_once( BX _DIRECTORY _PATH_INC  . 'RadiusA ssistant.i nc' );    
33      
34   $is_first_ call = !(  (int)$_GET ['p_per_pa ge'] && (i nt)$_GET[' page'] );    
35      
36   if ( !(int )$_GET['p_ per_page']  ) $_GET[' p_per_page '] = $oTem plConfig - > def_p_pe r_page;    
37   if ( !(int )$_GET['pa ge'] ) $_G ET['page']  = 1;    
38      
39   // ------- -------- p age variab les and lo gin    
40      
41   $_page['na me_index']  = 32;    
42   $_page['cs s_name'] =  'search_r esult.css' ;    
43      
44   if ( !( $l ogged['adm in'] = mem ber_auth(  1, false )  ) )    
45   {    
46       if ( ! ( $logged[ 'member']  = member_a uth( 0, fa lse ) ) )    
47       {    
48           if  ( !( $log ged['aff']  = member_ auth( 2, f alse ) ) )    
49           {    
50                $logged[ 'moderator '] = membe r_auth( 3,  false );    
51           }    
52       }    
53   }    
54      
55      
56   $_page['he ader'] = _ t("_Search  result");    
57   $_page['he ader_text' ] = _t("_S EARCH_SORT ED");    
58   //$_page[' header_tex t'] = ('g4 ' != $tmpl ) ? _t("_S EARCH_SORT ED") : "<i mg src=\"{ $site['ima ges']}sear ch_res.gif \">";    
59      
60   // ------- -------- G ET/POST ac tions    
61      
62      
63   // check i f user pos et correct  data    
64   if ( !isse t($_GET['L ookingFor' ]) && !$_G ET['ID'] & & !$_GET[' NickName']  && !$_GET ['distance '] && !$_G ET['zip']    
65       && !$_ GET['onlin e_only'] & & !$_GET[' gallery_vi ew'] && !$ _GET['view _friends']  && !$_GET ['tag'] )    
66   {    
67       echo ' <script la nguage="Ja vascript"> location.h ref=\'sear ch.php\';< /script>';    
68       exit;    
69   }    
70      
71   // check f or gallery  view    
72   $gallery_c ols = $oTe mplConfig  -> iSearch ResultGall eryCols;    
73   $gallery_v iew = $_RE QUEST['gal lery_view' ];    
74      
75   // --- mov e    
76      
77   // check f or members hip restri ctions    
78   $member['I D'] = (int )$_COOKIE[ 'memberID' ];    
79   $check_res  = checkAc tion( $mem ber['ID'],  ACTION_ID _MAKE_SEAR CH );    
80   if ( $chec k_res[CHEC K_ACTION_R ESULT] !=  CHECK_ACTI ON_RESULT_ ALLOWED &&  !$logged[ 'admin'] & & !$logged ['moderato r'] )    
81   {    
82       $ret   = "    
83           <t able width =100% heig ht=100% ce llpadding= 0 cellspac ing=0 clas s=text2>    
84                <td alig n=center b gcolor=$bo xbg2>    
85                    ". $ check_res[ CHECK_ACTI ON_MESSAGE ] ."<br />    
86                </td>    
87           </ table>\n";    
88      
89       $_page ['name_ind ex'] = 0;    
90       $_page _cont[0][' page_main_ code'] = $ ret;    
91       PageCo de();    
92       exit() ;    
93   }    
94      
95   // Number  of profile s which wi ll be show n in one s earch resu lt    
96   $profiles_ limit = 0;    
97   if ( $chec k_res[CHEC K_ACTION_P ARAMETER]  && !$logge d['admin']  && !$logg ed['modera tor'] )    
98       $profi les_limit  = (int)$ch eck_res[CH ECK_ACTION _PARAMETER ];    
99      
100   // --- mov e    
101      
102   // search  vasriables  and page  navigation  data    
103      
104   $ID = getI D( htmlspe cialchars_ adv($_GET[ 'ID']), 0  );    
105   $NickName  = htmlspec ialchars_a dv($_GET[' NickName'] );    
106   $LookingFo r = htmlsp ecialchars _adv($_GET ['LookingF or']);    
107   $Tag = $_G ET['tag'];    
108      
109   $zip = htm lspecialch ars_adv($_ GET['zip'] );    
110   $distance  = htmlspec ialchars_a dv($_GET[' distance'] );    
111   $metric =  htmlspecia lchars_adv ($_GET['me tric']);    
112      
113   $sortorder  = htmlspe cialchars_ adv($_GET[ 'sortorder ']);    
114   $sortby =  htmlspecia lchars_adv ($_GET['so rtby']);    
115   $photos_on ly = htmls pecialchar s_adv($_GE T['photos_ only']);    
116   $online_on ly = htmls pecialchar s_adv($_GE T['online_ only']);    
117      
118   $page = (i nt)$_GET[' page'];    
119   $p_per_pag e = (int)$ _GET['p_pe r_page'];    
120      
121   // build s earch SQL  query    
122      
123   if ( $_GET ['view_fri ends'] )    
124   {    
125       $profi le_id = (i nt)$_GET[' view_frien ds'];    
126       $total _query = " RIGHT JOIN  FriendLis t ON (Prof iles.ID =  FriendList .Profile A ND FriendL ist.ID = $ profile_id  OR Profil es.ID = Fr iendList.I D AND Frie ndList.Pro file = $pr ofile_id)    
127                             WHERE  (FriendLis t.Profile  = $profile _id OR Fri endList.ID  = $profil e_id) AND  FriendList .Check = ' 1' AND Pro files.Stat us = 'Acti ve'";    
128   }    
129   elseif ( i sset($_GET ['ID']) ||  $NickName  )    
130   {    
131       $total _query = " WHERE Stat us = 'Acti ve' ";    
132           
133       if ( i sset($_GET ['ID']) )    
134       {    
135           $a IDs = expl ode( ',',  $_GET['ID' ] );    
136           fo reach ( $a IDs as $ke y => $sID  )    
137           {    
138                $sID = t rim( $sID  );    
139                $sID = p rocess_db_ input( $sI D );    
140                if( !str len( $sID  ) )    
141                    unse t( $aIDs[$ key] );    
142                else    
143                    $aID s[$key] =  $sID;    
144           }    
145           $t otal_query  .= "AND (  `ID` = '"  . implode ( "' OR `I D` = '", $ aIDs ) . " ' ) ";    
146       }    
147       if ( $ NickName )    
148       {    
149           $a Nicks = ex plode( ',' , $NickNam e );    
150           fo reach ( $a Nicks as $ key => $sN ick )    
151           {    
152                $sNick =  trim( $sN ick );    
153                $sNick =  process_d b_input( $ sNick );    
154                if( !str len( $sNic k ) )    
155                    unse t( $aNicks [$key] );    
156                else    
157                    $aNi cks[$key]  = $sNick;    
158           }    
159           $t otal_query  .= "AND (  `NickName ` = '" . i mplode( "'  OR `NickN ame` = '",  $aNicks )  . "' ) ";    
160       }    
161      
162       if ( $ photos_onl y || $gall ery_view )    
163           $t otal_query  .= "AND P icture = ' 1' ";    
164   }    
165   elseif( $T ag )    
166   {    
167       $total _query = " INNER JOIN  `Tags` US ING( `ID`  ) WHERE St atus = 'Ac tive' AND  `Tags`.`Ty pe` = 'pro file' ";    
168           
169       $aTags  = explode ( ',', $Ta g );    
170       foreac h ( $aTags  as $key = > $sTag )    
171       {    
172           $s Tag = trim ( $sTag );    
173           $s Tag = proc ess_db_inp ut( $sTag  );    
174           if ( !strlen(  $sTag ) )    
175                unset( $ aTags[$key ] );    
176           el se    
177                $aTags[$ key] = $sT ag;    
178       }    
179       $total _query .=  "AND ( `Ta gs`.`Tag`  = '" . imp lode( "' O R `Tags`.` Tag` = '",  $aTags )  . "' ) ";    
180      
181       if ( $ photos_onl y || $gall ery_view )    
182           $t otal_query  .= "AND P icture = ' 1' ";    
183      
184   }    
185   else  // g eneral sea rch using  all search able profi le fields    
186   {    
187      
188       if ( $ zip )    
189       {    
190           $z ip = proce ss_db_inpu t( strtoup per( str_r eplace(' ' , '', $zip ) ), 1);    
191           $z _arr = db_ arr("SELEC T `Latitud e`, `Longi tude` FROM  `ZIPCodes ` WHERE RE PLACE(`ZIP Code`,' ', '') = '$zi p'");    
192      
193           if  ( $z_arr  )    
194           {    
195                // ZIP c ode exists    
196                $miles2k m = 0.7; / / miles/ki lometers r atio    
197      
198                $Miles =  $metric = = "km" ? $ distance *  $miles2km  : $distan ce;    
199                $Latitud e = $z_arr ["Latitude "];    
200                $Longitu de = $z_ar r["Longitu de"];    
201      
202                $zcdRadi us = new R adiusAssis tant( $Lat itude, $Lo ngitude, $ Miles );    
203                $minLat  = $zcdRadi us->MinLat itude();    
204                $maxLat  = $zcdRadi us->MaxLat itude();    
205                $minLong  = $zcdRad ius->MinLo ngitude();    
206                $maxLong  = $zcdRad ius->MaxLo ngitude();    
207      
208                $total_q uery = "LE FT JOIN `Z IPCodes` O N UPPER( R EPLACE(`Pr ofiles`.`z ip`, ' ',  '') ) = RE PLACE(`ZIP Codes`.`ZI PCode`,' ' , '')    
209                                      WHERE `Z IPCodes`.` ZIPCode` I S NOT NULL  AND `ZIPC odes`.`Lat itude` >=  $minLat AN D `ZIPCode s`.`Latitu de` <= $ma xLat AND ` ZIPCodes`. `Longitude ` >= $minL ong AND `Z IPCodes`.` Longitude`  <= $maxLo ng ";    
210           }    
211           el se    
212           {    
213                // ZIP c ode doesn' t exist    
214                $total_q uery = "WH ERE 0 ";    
215           }    
216       }    
217       else    
218       {    
219           $t otal_query  = "WHERE  1 ";    
220       }    
221      
222       $total _query .=  "AND `Prof iles`.`Sta tus` = 'Ac tive' ";    
223       if ( $ photos_onl y || $gall ery_view )    
224           $t otal_query  .= "AND ` Profiles`. `Picture`  = '1' ";    
225      
226       if ( $ online_onl y )    
227       {    
228           $o nline_time  = getPara m( "member _online_ti me" );    
229           $t otal_query  .= "AND ` Profiles`. `LastNavTi me` > SUBD ATE(NOW(),  INTERVAL  $online_ti me MINUTE)  ";    
230       }    
231      
232       $respd  = db_res( "SELECT *  FROM Profi lesDesc WH ERE `searc h_type` <>  'none' OR DER BY `se arch_order ` ASC");    
233       while  ( $arrpd =  mysql_fet ch_array($ respd) )    
234       {    
235           $f name = get _field_nam e ( $arrpd  );    
236           $p rocess_fie ld = 1;    
237           $a ll_query_a dd = '';    
238      
239           sw itch ( $ar rpd['searc h_type'] )    
240           {    
241                case 'ra dio':    
242                    $fva l = proces s_db_input ( $_GET[$f name], 1 ) ;    
243                    if (  strlen($f val) && $p rocess_fie ld )    
244                    {    
245                         if ( $arrp d['search_ where'] )    
246                             $s = s printf($ar rpd['searc h_where'],  $fval, $f val, $fval , $fval );    
247                         else    
248                             $s = "  $fname =  '$fval' ";    
249                         $total_que ry .= "AND  ($s $all_ query_add)  ";    
250                    }    
251                    brea k;    
252      
253                case 'li st':    
254                    $fva l = $_GET[ $fname];    
255                    if (  count($fv al) > 0 &&  is_array( $fval) &&  $process_f ield )    
256                    {    
257                         $total_que ry .= " AN D (`Profil es`.`{$fna me}` IN (' -1'";    
258                         while ( li st( $key,  $val ) = e ach( $fval  ) )    
259                             $total _query .=  ",'". proc ess_db_inp ut($val, 1 ) ."'";    
260                         $total_que ry .= ") $ all_query_ add) ";    
261                    }    
262                    brea k;    
263      
264                case 'ch eck':    
265                    if (  $arrpd['t ype'] == ' r' )    
266                    {    
267                         $findok =  0;    
268                         $funcbody  = $arrpd[' extra'];    
269                         $func = cr eate_funct ion('', $f uncbody);    
270                         $ar = $fun c();    
271      
272                         foreach (  $ar as $ke y => $valu e )    
273                         {    
274                             if ( $ _GET["{$fn ame}_{$key }"] == "on " )    
275                             {    
276                                 $f indok = 1;    
277                                 br eak;    
278                             }    
279                         }    
280      
281                         if ( $find ok && $pro cess_field  )    
282                         {    
283                             $total _query_tmp  = '';    
284                             foreac h ( $ar as  $key => $ value )    
285                             {    
286                                 if  ( $_GET[" {$fname}_{ $key}"] ==  "on" )    
287                                      $total_q uery_tmp . = ",$key";    
288                             }    
289      
290                             if ( s trlen($arr pd['search _where'])  > 0 )    
291                             {    
292                                 $s  = sprintf ($arrpd['s earch_wher e'], $tota l_query_tm p, $total_ query_tmp,  $total_qu ery_tmp );    
293                                 $s  = str_rep lace( '{al l_add}', $ all_query_ add, $s );    
294                                 $t otal_query  .= $s . '  ';    
295                             }    
296                             else    
297                             {    
298                                 $t otal_query  .= "AND ( `Profiles` .`{$fname} ` IN (-1{$ total_quer y_tmp}) $a ll_query_a dd) ";    
299                             }    
300                         }    
301                    }    
302                    else if ( $arrp d['type']  == 'e' &&  strlen($_G ET[$fname] ) && $proc ess_field  )    
303                    {    
304                         $total_que ry .= "AND  (`Profile s`.`{$fnam e}` = '".  process_db _input($_G ET[$fname] , 1) ."' $ all_query_ add) ";    
305                    }    
306                    else if ( $arrp d['type']  == 'e')    
307                    {    
308                         $findok =  0;    
309      
310                         $vals = pr eg_split ( "/[,\']+/" , $arrpd[' extra'], - 1, PREG_SP LIT_NO_EMP TY);    
311      
312                         foreach (  $vals as $ key )    
313                         {    
314                             if ( $ _GET["${fn ame}_$key" ] == "on"  )    
315                             {    
316                                 $f indok = 1;    
317                                 br eak;    
318                             }    
319                         }    
320      
321                         if ( $find ok && $pro cess_field  )    
322                         {    
323                             $total _query_tmp  = '';    
324                             foreac h ( $vals  as $key )    
325                             {    
326                                 if  ( $_GET[" {$fname}_$ key"] == " on" )    
327                                      $total_q uery_tmp . = ",'$key' ";    
328                             }    
329      
330                             if ( s trlen($arr pd['search _where'])  > 0 )    
331                             {    
332                                 $s  = sprintf ($arrpd['s earch_wher e'], $tota l_query_tm p, $total_ query_tmp,  $total_qu ery_tmp );    
333                                 $s  = str_rep lace( '{al l_add}', $ all_query_ add, $s );    
334                                 $t otal_query  .= $s . '  ';    
335                             }    
336                             else    
337                             {    
338                                 $t otal_query  .= "AND ( `Profiles` .`{$fname} ` IN (-1{$ total_quer y_tmp}) $a ll_query_a dd) ";    
339                             }    
340                         }    
341                    }    
342                    brea k;    
343      
344                case 'ch eck_set':    
345                    $fin dok = 0;    
346                    $val s = preg_s plit ("/[, \']+/", $a rrpd['extr a'], -1, P REG_SPLIT_ NO_EMPTY);    
347      
348                    // C heck if an y of set c hecked    
349                    $i =  0;    
350                    fore ach ( $val s as $v )    
351                    {    
352                         if ( strle n(trim($v) ) <= 0 ) c ontinue;    
353                         if ( $_GET ["{$fname} _{$i}"] ==  "on" )    
354                         {    
355                             $findo k = 1;    
356                             break;    
357                         }    
358                         $i++;    
359                    }    
360      
361                    if (  $findok & & $process _field )    
362                    {    
363                         if ( $fnam e != 'Zodi ac' )    
364                         {    
365                             $fval  = 0;    
366                             $hex_s tring = "" ;    
367                             $offse t = 0;    
368                             $mask  = 1;    
369      
370                             foreac h ( $vals  as $v )    
371                             {    
372                                 if  ( strlen( trim($v))  <= 0 ) con tinue;    
373      
374                                 if  ( $_GET[" {$fname}_{ $offset}"]  == 'on' )    
375                                      $fval |=  $mask;    
376      
377                                 $o ffset++;    
378                                 //  MySQL all ows only 6 4 bits for  one set f ield    
379                                 if  ( $offset  == 64 )    
380                                      break;    
381                                 //  Limit bit  field wit h BYTE len gth and ou tput BYTE  by BYTE    
382                                 if  ( $offset  % 8 == 0  )    
383                                 {    
384                                      $hex_str ing = spri ntf("%02x" , $fval) .  $hex_stri ng;    
385                                      $mask =  1;    
386                                      $fval =  0;    
387                                 }    
388                                 el se    
389                                 {    
390                                      $mask << = 1;    
391                                 }    
392                             }    
393      
394                             if ( $ offset % 8  != 0 )    
395                             {    
396                                 $h ex_string  = sprintf( "%02x", $f val) . $he x_string;    
397                             }    
398                             if ( ! strlen($he x_string)  )    
399                                 $h ex_string  = "0";    
400      
401                             if ( $ hex_string  != "0" )    
402                                 $t otal_query  .= "AND ( `Profiles` .`{$fname} ` & (0 + 0 x$hex_stri ng) $all_q uery_add)  ";    
403                         }    
404                         else // if  zodiac    
405                         {    
406                             $query _buffer =  "AND (";    
407                             $offse t = 0;    
408                             $any_z odiac = 0;    
409      
410                             foreac h ( $vals  as $v )    
411                             {    
412                                 if  ( $_GET[" {$fname}_{ $offset}"]  == "on" )    
413                                 {    
414                                      $days_st art = 0;    
415                                      $days_en d = 0;    
416                                      switch (  strtolowe r($v) )    
417                                      {    
418                                          case  'aries':    
419                                               $days_star t = 80;    
420                                               $days_end  = 109;    
421                                               break;    
422                                          case  'taurus':    
423                                               $days_star t = 110;    
424                                               $days_end  = 140;    
425                                               break;    
426                                          case  'gemini':    
427                                               $days_star t = 141;    
428                                               $days_end  = 172;    
429                                               break;    
430                                          case  'cancer':    
431                                               $days_star t = 173;    
432                                               $days_end  = 203;    
433                                               break;    
434                                          case  'leo':    
435                                               $days_star t = 204;    
436                                               $days_end  = 234;    
437                                               break;    
438                                          case  'virgo':    
439                                               $days_star t = 235;    
440                                               $days_end  = 265;    
441                                               break;    
442                                          case  'libra':    
443                                               $days_star t = 266;    
444                                               $days_end  = 296;    
445                                               break;    
446                                          case  'scorpio' :    
447                                               $days_star t = 297;    
448                                               $days_end  = 325;    
449                                               break;    
450                                          case  'sagittar ius':    
451                                               $days_star t = 326;    
452                                               $days_end  = 355;    
453                                               break;    
454                                          case  'capricor n':    
455                                               $days_star t = 356;    
456                                               $days_end  = 19;    
457                                               break;    
458                                          case  'aquarius ':    
459                                               $days_star t = 20;    
460                                               $days_end  = 49;    
461                                               break;    
462                                          case  'pisces':    
463                                               $days_star t = 50;    
464                                               $days_end  = 79;    
465                                               break;    
466                                      }    
467      
468                                      if ( $an y_zodiac )    
469                                      {    
470                                          $que ry_buffer  .= "OR ";    
471                                      }    
472                                      if ( str tolower($v ) == 'capr icorn' )    
473                                      {    
474                                          $que ry_buffer  .= "(DAYOF YEAR(`Date OfBirth`)  >= $days_s tart OR DA YOFYEAR(`D ateOfBirth `) <= $day s_end) ";    
475                                      }    
476                                      else    
477                                      {    
478                                          $que ry_buffer  .= "(DAYOF YEAR(`Date OfBirth`)  BETWEEN $d ays_start  AND $days_ end) ";    
479                                      }    
480      
481                                      $any_zod iac = 1;    
482                                 }    
483      
484                                 $o ffset++;    
485                             }    
486      
487                             if ( $ any_zodiac  )    
488                             {    
489                                 $q uery_buffe r .= "$all _query_add ) ";    
490                                 $t otal_query  .= $query _buffer;    
491                             }    
492                         }    
493                    }    
494      
495                    brea k;    
496      
497                case 'da terange':    
498                    $fva l_s = $_GE T["${fname }_start"];    
499                    $fva l_e = $_GE T["${fname }_end"];    
500                    if (  $fval_s | | $fval_e  )    
501                    {    
502                         $fval_s =  (int)( dat e( "Y" ) -  $fval_s ) ;    
503                         $fval_e =  (int)( dat e( "Y" ) -  $fval_e -  1 );    
504                         $fval_s =  $fval_s .  date( "-m- d" );    
505                         $fval_e =  $fval_e .  date( "-m- d" );    
506                         if ( strle n($fval_s)  && $fval_ e && $proc ess_field  )    
507                         {    
508                             $total _query .=  "AND (TO_D AYS(`Profi les`.`{$fn ame}`) BET WEEN TO_DA YS('$fval_ e') AND (T O_DAYS('$f val_s')+1)  $all_quer y_add) ";    
509                         }    
510                    }    
511                    brea k;    
512      
513                case 'te xt':    
514                    $fva l = proces s_db_input ($_GET[$fn ame], 1);    
515                    if (  strlen($f val) && $p rocess_fie ld )    
516                    {    
517                         if ( $arrp d['search_ where'] )    
518                             $s = s printf($ar rpd['searc h_where'],  $fval, $f val, $fval  );    
519                         else    
520                             $s = "  `Profiles `.`{$fname }` LIKE '% $fval%' ";    
521                         $total_que ry .= "AND  ($s $all_ query_add)  ";    
522                    }    
523                    brea k;    
524      
525           }    
526       }    
527   }    
528      
529   // Perform  action if  it's firs t search c all (not n avigation  call)    
530   if ( $is_f irst_call  && !$logge d['admin']  && !$logg ed['modera tor'] )    
531       checkA ction( $me mber['ID'] , ACTION_I D_MAKE_SEA RCH, true  );    
532      
533   $query = " SELECT COU NT(DISTINC T Profiles .ID) FROM  Profiles $ total_quer y";    
534      
535   $p_num = d b_arr( $qu ery );    
536   $p_num = ( int)$p_num [0];    
537      
538   $pages_num  = ceil( ( $profiles_ limit > 0  && $profil es_limit <  $p_num ?  $profiles_ limit : $p _num) / $p _per_page  );    
539   $page = $p age > $pag es_num &&  $pages_num  > 0 ? $pa ges_num :  $page;    
540      
541   $real_firs t_p = (int )($page -  1) * $p_pe r_page;    
542   $page_firs t_p = $rea l_first_p  + 1;    
543      
544   // sorting    
545   $sort_orde r = ($_GET ['sortorde r'] == 'AS C' ? 'ASC'  : 'DESC') ;    
546      
547   switch ( $ _GET['sort by'] )    
548   {    
549       case ' Sort_By_Ag e':    
550           $s ort_by = ' ( 0 - TO_D AYS(DateOf Birth) )';    
551           br eak;    
552       defaul t:    
553           $s ort_by = ' 1';    
554           br eak;    
555   }    
556      
557   // determi ne number  of pages (  for page  navigation  )    
558   if( $profi les_limit  > 0 && $re al_first_p  + $p_per_ page > $pr ofiles_lim it)    
559   {    
560       $p_per _page = $p rofiles_li mit - $rea l_first_p;    
561   }    
562      
563   $page_quer y = "    
564       SELECT  DISTINCT    
565           `P rofiles`.* ,    
566           (L astNavTime  > SUBDATE (NOW(), IN TERVAL 5 M INUTE)) as  is_onl    
567           $q uery_add    
568       FROM P rofiles    
569       $total _query    
570       ORDER  BY    
571           $s ort_by $so rt_order,    
572           Pr ofiles.Las tLoggedIn  DESC    
573       LIMIT  $real_firs t_p, $p_pe r_page    
574       ";    
575   $result =  db_res( $p age_query  );    
576   $page_p_nu m = mysql_ num_rows(  $result );    
577      
578   $w_ex = 12 ;    
579      
580   // profile  actions    
581   if ( $pa_i con_preloa d )    
582   {    
583           $a dd_to_head er = "<scr ipt langua ge=\"JavaS cript\"><! --\n";    
584      
585           $a dd_to_head er .= "pa_ profile=ne w Image;\n ";    
586           $a dd_to_head er .= "pa_ profile.sr c=\"".$sit e['images' ]."pa_prof ile2.gif\" ;\n";    
587      
588           $a dd_to_head er .= "pa_ kiss=new I mage;\n";    
589           $a dd_to_head er .= "pa_ kiss.src=\ "".$site[' images']." pa_kiss2.g if\";\n";    
590      
591           $a dd_to_head er .= "pa_ send=new I mage;\n";    
592           $a dd_to_head er .= "pa_ send.src=\ "".$site[' images']." pa_send2.g if\";\n";    
593      
594           $a dd_to_head er .= "pa_ send=new I mage;\n";    
595           $a dd_to_head er .= "pa_ send.src=\ "".$site[' images']." pa_send2.g if\";\n";    
596      
597           $a dd_to_head er .= "pa_ addtocart= new Image; \n";    
598           $a dd_to_head er .= "pa_ addtocart. src=\"".$s ite['image s']."pa_ad dtocart2.g if\";\n";    
599      
600       $add_t o_header . = "pa_hotl ost=new Im age;\n";    
601       $add_t o_header . = "pa_hotl ost.src=\" ".$site['i mages']."p a_hot2.gif \";\n";    
602      
603       $add_t o_header . = "pa_frie ndlost=new  Image;\n" ;    
604       $add_t o_header . = "pa_frie ndlost.src =\"".$site ['images'] ."pa_frien d2.gif\";\ n";    
605      
606       $add_t o_header . = "pa_bloc klist=new  Image;\n";    
607       $add_t o_header . = "pa_bloc klist.src= \"".$site[ 'images']. "pa_block2 .gif\";\n" ;    
608      
609           $a dd_to_head er .= "--> </script>\ n";    
610   }    
611      
612   $row_space r = "<tabl e cellspac ing=0 cell padding=0  height=10> <td><img s rc=\"".$si te['images ']."spacer .gif\"></t d></table> ";    
613      
614   //-------- ---------- ---    
615      
616   $get_vars  = get_vars ();    
617      
618   $ai_galler y  ="<img  alt=\""._t ("_view as  photo gal lery")."\"  name=is01  src=\"$si te[images] search_gal lery.gif\"  border=0> ";    
619   $al_galler y  ="<a hr ef=\"searc h_result.p hp{$get_va rs}gallery _view=1\"  ";    
620   if ( $pa_i con_preloa d )    
621   {    
622           $a l_gallery. ="onMouseO ver=\"java script: is 01.src='$s ite[images ]search_ga llery2.gif ';\"";    
623           $a l_gallery. ="onMouseO ut =\"java script: is 01.src='$s ite[images ]search_ga llery.gif' ;\"";    
624   }    
625   $al_galler y .= ">";    
626   $ai_galler y  = $al_g allery.$ai _gallery." </a>";    
627   $al_galler y .= _t("_ view as ph oto galler y")."</a>" ;    
628      
629      
630   $ai_profil es  ="<img  alt=\""._ t("_view a s profile  details"). "\" name=i s02 src=\" $site[imag es]search_ profiles.g if\" borde r=0>";    
631   $al_profil es  ="<a h ref=\"sear ch_result. php{$get_v ars}galler y_view=0\"  ";    
632   if ( $pa_i con_preloa d )    
633   {    
634           $a l_profiles .="onMouse Over=\"jav ascript: i s02.src='$ site[image s]search_p rofiles2.g if';\"";    
635           $a l_profiles .="onMouse Out =\"jav ascript: i s02.src='$ site[image s]search_p rofiles.gi f';\"";    
636   }    
637   $al_profil es .= ">";    
638   $ai_profil es  = $al_ profiles.$ ai_profile s."</a>";    
639   $al_profil es .= _t(" _view as p rofile det ails")."</ a>";    
640      
641   // ------- -------- G ET/POST ac tions [ EN D ]    
642      
643   // ------- -------- p age compon ents    
644      
645   $_ni = $_p age['name_ index'];    
646   $_page_con t[$_ni]['p age_main_c ode'] = $p _num ? Pag eCompPageM ainCode()  : PageComp NoResults( );    
647   $_page_con t[$_ni]['s orting'] =  $p_num >  1 ? PageCo mpSorting( ) : "";    
648   $_page_con t[$_ni]['p age_naviga tion'] = $ pages_num  > 1 ? Page CompNaviga tion( 'Fir st' ) : "" ;    
649   $_page_con t[$_ni]['p age_naviga tion_short '] = $page s_num > 1  ? PageComp Navigation Short( 'Fi rstShort'  ) : "";    
650   $_page_con t[$_ni]['p age_naviga tion2'] =  $pages_num  > 1 ? Pag eCompNavig ation( 'Se cond' ) :  "";    
651   $_page_con t[$_ni]['p age_naviga tion_short 2'] = $pag es_num > 1  ? PageCom pNavigatio nShort( 'S econdShort ' ) : "";    
652   $_page_con t[$_ni]['a dd_to_head er'] = $ad d_to_heade r;    
653   $_page_con t[$_ni]['r ow_spacer' ] = $row_s pacer;    
654      
655   $_page_con t[$_ni]['a i_gallery' ] = $ai_ga llery;    
656   $_page_con t[$_ni]['a i_profiles '] = $ai_p rofiles;    
657      
658   $_page_con t[$_ni]['d b_color']  = $search_ result_db_ color;    
659      
660   // ------- -------- [ END] page  components    
661      
662   PageCode() ;    
663      
664   // ------- -------- p age compon ents funct ions    
665      
666   /**    
667    * Place H TML code f or Sorting    
668    */    
669   function P ageCompSor ting ()    
670   {    
671       global  $p_num;    
672       global  $site;    
673      
674      
675      
676      
677       //ob_s tart();    
678      
679       $ret =  '';    
680       $ret . = "<!-- So rting -->\ n";    
681       $ret . = '<form m ethod="get " action=" search_res ult.php' .  get_vars( ) . '">';    
682      
683       if($_R EQUEST['so rtby'])    
684       {    
685           $s ort_sel_ag e = $_REQU EST['sortb y'] == 'So rt_By_Age'  ? 'checke d="checked "' : '';    
686           $s ort_sel_pr ice = $_RE QUEST['sor tby'] == ' Sort_By_Pr ice' ? 'ch ecked="che cked"' : ' ';    
687           $s ort_sel_co nt = $_REQ UEST['sort by'] == 'S ort_By_Con t' ? 'chec ked="check ed"' : '';    
688       }    
689       else    
690       {    
691           $s ort_sel_ag e = 'check ed="checke d"';    
692       }    
693      
694       $ret . = get_vars _controls( );    
695       $ret . = '<table  border="0"  width="10 0%"  cells pacing="1"  cellpaddi ng="2">';    
696           $r et .= '<tr >';    
697                $ret .=  '<td align ="left"><b >' . _t("_ Sort resul ts") . '</ b></td>';    
698                $ret .=  '<td align ="left">';    
699                    $ret  .= '<inpu t type="ra dio" name= "sortby" v alue="Sort _By_Age" i d="Sort_By _Age" ' .  $sort_sel_ age . ' /> &nbsp;<lab el for="So rt_By_Age" >' . _t("_ by age") .  '</label> ';    
700                $ret .=  '</td>';    
701                $ret .=  ' <td alig n="left">< b>' . _t(" _Sort orde r") . '</b ></td>';    
702                $asc_sel  = $_GET[' sortorder' ] == 'ASC'  ? 'checke d="checked "' : '';    
703                $desc_se l = $asc_s el ? '' :  'checked=" checked"';    
704                $ret .=  '<td align ="left">';    
705                    $ret  .= '<inpu t type="ra dio" name= "sortorder " value="A SC" id="AS C" ' . $as c_sel . '  />&nbsp;<l abel for=" ASC">' . _ t("_ascend ing") . '< /label>';    
706                $ret .=  '</td>';    
707                $ret .=  '<td rowsp an="2" ali gn="center " valign=" middle"><i nput class =no type=s ubmit valu e=" ' . _t ("_Go") .  '! " /></t d>';    
708                //$ret . = '<td>';    
709                //$ret . = '</td>';    
710           $r et .= '</t r>';    
711           $r et .= '<tr >';    
712                $ret .=  '<td>&nbsp ;</td>';    
713                $ret .=  '<td align ="left">';    
714                    $ret  .= '<inpu t type="ra dio" name= "sortorder " value="D ESC" id="D ESC" ' . $ desc_sel .  ' />&nbsp ;<label fo r="DESC">'  . _t("_de scending")  . '</labe l>';    
715                $ret .=  '</td>';    
716           $r et .= '</t r>';    
717       $ret . = '</table >';    
718       $ret . = '</form> ';    
719       $ret . = "\n<!--   /Sorting  -->\n";    
720      
721      
722       return  DesignBox ContentBor der( _t("_ sort"), $r et );    
723   }    
724      
725      
726   /**    
727    * Place H TML code f or "page n avigation"    
728    */    
729   function P ageCompNav igation( $ navBoxId )    
730   {    
731      
732       $out =  "<center> ";    
733       $out . = ResNavig ationRet(  'Search'.$ navBoxId,  0 );    
734       $out . = "</cente r>";    
735       return  DesignBox ContentBor der( _t("_ page navig ation"), $ out );    
736   }    
737      
738   /**    
739    * Place H TML code f or short v ersion of  "page navi gation"    
740    */    
741   function P ageCompNav igationSho rt( $navBo xId )    
742   {    
743       return  ResNaviga tionRet( ' Search'.$n avBoxId, 1  );    
744   }    
745      
746   /**    
747    * Place H TML code f or search  result    
748    */    
749   function P ageCompGal lery ( )    
750   {    
751       global  $result;    
752       global  $gallery_ cols;    
753       global  $boxbg;    
754       global  $boxbg2;    
755       global  $boxbg3;    
756       global  $site;    
757       global  $tmpl;    
758       global  $logged;    
759       global  $max_thum b_width;    
760       global  $max_thum b_height;    
761      
762       $ret =  "<table c ellpadding =\"0\" cel lspacing=\ "0\" width =\"100%\"  border=\"0 \">";    
763       $count  = 0;    
764      
765       while  ( $p_arr =  mysql_fet ch_array(  $result )  )    
766       {    
767           //  get user  online sta tus    
768           $u ser_is_onl ine = (int )$p_arr['i s_onl'];// get_user_o nline_stat us($p_arr[ 'ID']);    
769      
770           //  online/of fline stat us    
771           if  ( $user_i s_online )    
772           {    
773                $offline _online =  "<img bord er=\"0\" s rc=\"{$sit e['icons'] }online.gi f\" alt=\" " . _t("_O nline") .  "\" />";    
774                $off_on_ text = _t( "_Online") ;    
775           }    
776           el se    
777           {    
778                $offline _online =  "<img bord er=\"0\" s rc=\"{$sit e['icons'] }offline.g if\" alt=\ "" . _t("_ Offline")  . "\" />";    
779                $off_on_ text = _t( "_Offline" );    
780           }    
781      
782                    if ( $tmpl=='ac t')    
783           {    
784                $offline _online =   "<table s tyle=\"mar gin-top:2p x; margin- bottom:2px ;\" border =0 cellspa cing=0 cel lpadding=0 ><tr heigh t=15><td w idth=4 hei ght=15><im g src=temp lates/tmpl _act/image s_act/butt on2_left.g if width=4  height=15 ></td><td  width=10 h eight=15 v align=midd le backgro und=templa tes/tmpl_a ct/images_ act/button 2_fill.gif >".$offlin e_online." </td>";    
785                $offline _online =   $offline_ online."<t d height=1 5 valign=t op backgro und=templa tes/tmpl_a ct/images_ act/button 2_fill.gif  class=sma ll3>&nbsp; ".$off_on_ text."</td ><td width =4 height= 15><img sr c=template s/tmpl_act /images_ac t/button2_ right.gif  width=4 he ight=15></ td></tr></ table>";    
786      
787           }    
788      
789                    if (  !($count  % $gallery _cols) )    
790                             $ret . = "<tr>    
791                                          <td>    
792                                               <table cel lspacing=\ "2\" cellp adding=\"0 \" border= \"0\" widt h=\"100%\" ><tr><td a lign=\"cen ter\">";    
793                    else    
794                             $ret . = "<td ali gn=\"cente r\">";    
795      
796   // ------- ----------    
797      
798                    $out  = "";    
799                    $out  .= "<tabl e border=\ "0\" align =\"center\ " cellspac ing=\"0\"  cellpaddin g=\"0\" wi dth=\"$max _thumb_wid th\">\n";    
800      
801      
802                    $out  .= "<tr>" ;    
803                    $out  .= "<td h eight=\"$m ax_thumb_h eight\" al ign=\"cent er\">\n";    
804                    $out  .= get_me mber_thumb nail( $p_a rr['ID'],  none );    
805                    $out  .= "</td> ";    
806                    $out  .= "</tr> \n";    
807      
808           $o ut .= "<tr ><td align =\"center\ ">\n";    
809           $o ut .= $off line_onlin e;    
810           $o ut .= "</t d></tr>\n" ;    
811      
812                    $out  .= "</tab le>\n";    
813      
814                    $ret  .= Design BoxContent Border( "< div STYLE= \"font-wei ght:normal ; text-tra nsform:non e; overflo w : hidden \">$p_arr[ NickName]:  ".age( $p _arr[DateO fBirth] ). " "._t("_y /o")."</di v>", $out  );    
815                    // - ---------- --------    
816      
817                    if (  !(($count +1) % $gal lery_cols)  )    
818                             $ret . = "</td></ table> </t d></tr>";    
819                    else    
820                             $ret . = "";    
821                    $cou nt += 1;    
822           }    
823      
824       if ( ( ($count) %  $gallery_ cols) )    
825           $r et .= "</t d></table> \n </td></ tr>\n";    
826      
827           $r et .= "</t able>\n\n" ;    
828      
829           re turn $ret;    
830   }    
831      
832   /**    
833    * Place H TML code f or search  result    
834    */    
835   function P ageCompPag eMainCode  ()    
836   {    
837       global  $p_num;    
838       global  $gallery_ view;    
839       global  $dir;    
840       global  $result;    
841       global  $tmpl;    
842       global  $site;    
843       global  $prof;    
844       global  $enable_m atch;    
845       global  $logged;    
846       global  $pa_icon_ preload;    
847       global  $boxbg2;    
848       global  $profiles _limit;    
849      
850       global  $NickName ;    
851      
852       global  $oTemplCo nfig;    
853       if ( $ gallery_vi ew )    
854       {    
855           $o ut = PageC ompGallery ();    
856           re turn Desig nBoxConten t ( _t("_G allery"),  $out , $oT emplConfig  -> PageSe arcResultG allery_db_ num );    
857       }    
858      
859           //  design bo x    
860           $f s = filesi ze ( "{$di r['root']} templates/ tmpl_{$tmp l}/searchr ow.html" ) ;    
861           $f  = fopen (  "{$dir['r oot']}temp lates/tmpl _{$tmpl}/s earchrow.h tml", "r"  );    
862           $t empl_searc h = fread  ( $f, $fs  );    
863           fc lose ( $f  );    
864      
865           $r et = '';    
866           if ( $profile s_limit >  0 )    
867           {    
868                $ret .=  '<div clas s="no_resu lt">';    
869                    $ret  .= '<div> ';    
870                         $ret .= _t ("_SEARCH_ RESULT_ALL OWED_PROFI LES", $pro files_limi t);    
871                    $ret  .= '</div >';    
872                $ret .=  '</div>';    
873           }    
874           el se    
875           {    
876                $ret .=  '';    
877           }    
878      
879   // get nic kname for  IM    
880       $NickN ame = getN ickName();    
881      
882           wh ile ( $p_a rr = mysql _fetch_ass oc( $resul t ) )    
883           {    
884                $ret .=  PrintSearh Result( $p _arr, $tem pl_search,  1 );    
885           }    
886      
887       return  $ret;    
888   }    
889      
890      
891      
892   /**    
893    * Place H TML code f or no resu lts    
894    */    
895   function P ageCompNoR esults( )    
896   {    
897      
898       $ret =  '';    
899       $ret . = '<div cl ass="no_re sult">';    
900           $r et .= '<di v>';    
901                $ret .=  _t("_NO_RE SULTS");    
902           $r et .= '</d iv>';    
903       $ret . = '</div>' ;    
904      
905       return  $ret;    
906   }    
907      
908   ?>