806. File Comparison Report

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

806.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.0.5 profile_edit.php Mon Dec 24 09:44:20 2007 UTC
2 Mon May 12 13:07:11 2008 UTC

806.2 Comparison summary

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

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

806.4 Active regular expressions

No regular expressions were active.

806.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 . 'd esign.inc. php' );    
23   require_on ce( BX_DIR ECTORY_PAT H_INC . 'p rofiles.in c.php' );    
24   require_on ce( BX_DIR ECTORY_PAT H_INC . 'p rof.inc.ph p' );    
25   require_on ce( BX_DIR ECTORY_PAT H_INC . 'p rofile_dis p.inc.php'  );    
26   require_on ce( BX_DIR ECTORY_PAT H_INC . 'm odules.inc .php' );    
27   require_on ce( BX_DIR ECTORY_PAT H_INC . 'u tils.inc.p hp' );    
28   require_on ce( BX_DIR ECTORY_PAT H_INC . 'i mages.inc. php' );    
29      
30      
31   // ------- -------- p age variab les and lo gin    
32      
33   $_page['na me_index']     = 25;    
34   $_page['cs s_name']       = 'pro file_edit. css';    
35   $_page['js '] = 1;    
36      
37   $ADMIN = m ember_auth ( 1, false  );    
38   $logged['a dmin'] = $ ADMIN;    
39      
40   // Check i f moderato r logged i n.    
41   $moderator  = member_ auth(3, fa lse);    
42   $logged['m oderator']  = $modera tor;    
43   // Give mo derator al l admin ri ghts for t his page.    
44   $ADMIN = $ ADMIN || $ moderator;    
45   //    
46      
47   if ( !$ADM IN )    
48   $logged['m ember'] =  member_aut h( 0 );    
49      
50      
51   // ------- -------- G ET/POST ac tions    
52      
53   $enable_ma tch = getP aram("enab le_match")  == "on" ?  1 : 0;    
54   $enable_ma tch = (int )$enable_m atch;    
55      
56   $votes_on  = $votes;    
57   $autoAppro val_ifProf ile = isAu toApproval ('profile' );    
58      
59   $enable_ra y = (getPa ram( 'enab le_ray' )  == 'on');    
60      
61   $enable_ra y_pro = (g etParam( ' enable_ray _pro' ) ==  'on');    
62      
63   //-------- ---------- ---------- -----    
64      
65   $ID = getI D( $_GET[' ID'] );    
66      
67   if ( $_COO KIE['membe rID'] == $ ID && !$AD MIN )    
68   {    
69       $membe r['ID']         = (in t)$_COOKIE ['memberID '];    
70       $membe r['Passwor d']    = $ _COOKIE['m emberPassw ord'];    
71       if ( c heck_login ( $member[ 'ID'], $me mber['Pass word'], 'P rofiles',  false ) )    
72       $MEMBE R = true;    
73   }    
74      
75   // check f or access    
76   //if ( (!$ ID && $MEM BER) && !$ ADMIN )    
77   if ( (!$ID  || $ID !=  $member[' ID']) && ! $ADMIN )    
78   {    
79       $_page ['header']  = "$site[ title] "._ t("_Member  Profile") ;    
80       $_page ['header_t ext'] = _t ("_View pr ofile");    
81       $_page ['name_ind ex'] = 0;    
82      
83       $_page _cont[0][' page_main_ code'] = _ t_err("_Me mber Profi le NA for  view").'<b r /><br /> ';    
84       PageCo de();    
85       exit;    
86   }    
87      
88   // check f or existin g profile    
89   if ( $ID )    
90   {    
91       $p_arr  = getProf ileInfo( $ ID );    
92           
93       if ( ! $p_arr )    
94       {    
95           $_ page['head er'] = "$s ite[title]  "._t("_Me mber Profi le");    
96           $_ page['head er_text']  = "$site[t itle] "._t ("_Member  Profile");    
97           $_ page['name _index'] =  0;    
98      
99           $_ page_cont[ 0]['page_m ain_code']  = _t_err( "_Profile  NA").'<br  />aa<br /> ';    
100           Pa geCode();    
101           ex it();    
102       }    
103   }    
104      
105   // databas e field vi sibility    
106      
107   $db_vsbl =  1;    
108   $db_editbl  = 0;    
109   if ( $MEMB ER )    
110   {    
111       $db_vs bl = 2;    
112       $db_ed itbl = 1;    
113   }    
114   elseif ( $ ADMIN )    
115   {    
116       $db_vs bl = 4;    
117       $db_ed itbl = 2;    
118   }    
119      
120   // check f or a new a dded profi le    
121   if ( !$ID  && $ADMIN  )    
122   $NEW_TO_AD D = TRUE;    
123      
124   // admin a ctions suc h as delet e profile  or give me mbership    
125   if ( !$dem o_mode &&  $ADMIN &&  $_GET['ID' ] ) // &&  $_GET[prf_ form_submi t])    
126   {    
127   if ( $_GET ['what_do' ] == "Yes"  )    
128       $add =  1;    
129   elseif ( $ _GET['what _do'] == " No" )    
130       $add =  0;    
131      
132      
133      
134      switch  ( $_GET['p rf_form_su bmit'] )    
135      {    
136       case " Confirm":    
137                activati on_mail($_ GET[ID] ,  0 );    
138                $status_ admin_ex =  _t_err("_ ADM_PROFIL E_CONFIRM_ EM");    
139                break;    
140       case " Send":    
141                profile_ send_messa ge( $_GET[ ID], $_GET [Message]  );    
142                $status_ admin_ex =  _t_err("_ ADM_PROFIL E_SEND_MSG ");    
143                break;    
144      }    
145      
146      
147   }    
148      
149   //-------- ---------- ---------- ------ SAV E CHANGES    
150   // adding  profile -  in admin m ode    
151   // updatin g profile    
152   // check f or changes  - and cha nge profil e status    
153   // check f or modific ation    
154   // check e mail for m odificatio n    
155   // change  cookie - i f password  was chang ed    
156   // feature d profiles  for admin  only    
157   // sending  latter to  user - ab out change d his stat us    
158   // update  field - la st modific ation    
159   $change_er ror_text =  "";    
160      
161   //while (  ( ( $ADMIN  && !$demo _mode) ||  $MEMBER )  && ( $_POS T[SaveChan ges] == 'Y ES' ) )    
162   if ( ( $AD MIN  || $M EMBER ) &&  ( $_POST[ 'SaveChang es'] == 'Y ES' ) )    
163   {    
164       // fil l array wi th POST va lues    
165       $respd  = db_res( "SELECT *  FROM Profi lesDesc WH ERE `visib le` & $db_ vsbl AND (  FIND_IN_S ET('0',sho w_on_page)  OR FIND_I N_SET('".( int)$_page [name_inde x]."',show _on_page))  ORDER BY  `order` AS C");    
166       while  ( $arrpd =  mysql_fet ch_array($ respd) )    
167       {    
168           $f name = get _input_nam e ( $arrpd  );    
169      
170           sw itch ($arr pd['type'] )    
171           {    
172           ca se 'set':  // set of  checkboxes    
173                $vals =  preg_split  ("/[,\']+ /", $arrpd ['extra'],  -1, PREG_ SPLIT_NO_E MPTY);    
174                $p_arr_n ew[$fname]  = '';    
175                foreach  ( $vals as  $v )    
176                {    
177                    if (  strlen(tr im($v)) <=  0 ) conti nue;    
178                    $p_a rr_new[$fn ame."_".$v ] = proces s_pass_dat a($_POST[$ fname."_". $v]);    
179                    if (  $_POST[$f name."_".$ v] == 'on'  )    
180                    {    
181                         if ( strle n($p_arr_n ew[$fname] ) )    
182                             $p_arr _new[$fnam e] .= ",$v ";    
183                         else    
184                             $p_arr _new[$fnam e] .= $v;    
185                    }    
186                }    
187                break;    
188               
189           ca se 'date':    
190                    $p_a rr_new[$fn ame] = spr intf("%04d -%02d-%02d ",    
191                         (int)$_POS T[$fname .  '_year'],    
192                         (int)$_POS T[$fname .  '_month'] ,    
193                         (int)$_POS T[$fname .  '_day']    
194                         );    
195                break;    
196               
197           de fault:    
198                if( $fna me == 'Pas sword1' )  //change p assword    
199                {    
200                    if(  empty( $_P OST[$fname ] ) ) //th e field le aved empty . and we l eaving it  as is    
201                         $p_arr_new [$fname] =  $p_arr['P assword'];    
202                    else    
203                         $p_arr_new [$fname] =  md5( proc ess_pass_d ata( $_POS T[$fname]  ) );    
204                }    
205                else    
206                {    
207                    if (  $arrpd['g et_value']  )    
208                    {    
209                         $funcbody  = $arrpd[' get_value' ];    
210                         $func = cr eate_funct ion('$arg0 ', $funcbo dy);    
211                         $p_arr_new [$fname] =  process_p ass_data($ func($_POS T));    
212                    }    
213                    else    
214                         $p_arr_new [$fname] =  process_p ass_data($ _POST[$fna me]);    
215                }    
216                break;    
217           }    
218       }    
219      
220       // che ck values    
221       if ( ! $ADMIN )    
222       {    
223           $r espd = db_ res("SELEC T * FROM ` ProfilesDe sc` WHERE  `visible`  & $db_vsbl  AND `edit able` & $d b_editbl A ND ( FIND_ IN_SET('0' , `show_on _page`) OR  FIND_IN_S ET('".(int )$_page['n ame_index' ]."', `sho w_on_page` )) ORDER B Y `order`  ASC");    
224           wh ile ( $arr pd = mysql _fetch_arr ay($respd)  )    
225           {    
226                if ( !st rlen($arrp d['check'] ) )    
227                    cont inue;    
228                    
229                $fname =  get_input _name ( $a rrpd );    
230                    
231                $funcbod y = $arrpd ['check'];    
232                $func =  create_fun ction('$ar g0', $func body);    
233                if( !$fu nc($p_arr_ new[$fname ]) )    
234                    $res ult_text . = _t_err($ arrpd['bec ause']);    
235           }    
236       }    
237       else    
238       {    
239           if  ( !conf_n ick($_POST ['NickName ']) && $p_ arr['NickN ame'] != $ p_arr_new[ 'NickName' ] )    
240                $result_ text .= _t _err("_thi s_nick_alr eady_used" );//$resul t_text .=  report_err ( _t("This  Nickname  already us ed !!"));    
241               
242           if ( $_POST[' Password1' ] != $_POS T['Passwor d2'] )    
243                $result_ text .= _t _err( '_PW D_INVALID3 ' );    
244       }    
245      
246       if ( ! strlen ($r esult_text ) )    
247       {    
248           //  check for  modificat ion (chang e status)    
249           if  ( !$autoA pproval_if Profile &&  $MEMBER & & !$NEW_TO _ADD && $p _arr['Stat us'] != "U nconfirmed " && $p_ar r['Status' ] != "Appr oval" )    
250           {    
251                $respd =  db_res("S ELECT * FR OM `Profil esDesc` WH ERE `visib le` & $db_ vsbl AND ` editable`  & $db_edit bl AND ( F IND_IN_SET ('0', `sho w_on_page` ) OR FIND_ IN_SET('". (int)$_pag e['name_in dex']."',  `show_on_p age`)) AND  `to_db` =  1 ORDER B Y `order`  ASC");    
252                while (  $arrpd = m ysql_fetch _array($re spd) )    
253                {    
254                    $fna me = get_i nput_name  ( $arrpd ) ;    
255                    $dbn ame = get_ field_name  ( $arrpd  );    
256      
257                    if (  $dbname = = 'Passwor d' )    
258                         continue;    
259      
260                    swit ch ($arrpd ['type'])    
261                    {    
262                    case  'a':    
263                    case  'c':    
264                         if ( strcm p(trim($p_ arr_new[$f name]),tri m($p_arr[$ dbname]))  )    
265                         {    
266                             $STATU S_CHANGE_T O = "Appro val";    
267                             $p_arr ['Status']  = "Approv al";    
268                         }    
269                    }    
270      
271                    if (  $STATUS_C HANGE_TO = = "Approva l" )    
272                         break;    
273                }    
274           }    
275      
276           //  Check if  email has  changed.   If this is  the case,    
277           //  Check if  it's valid .    
278           if  ( strcmp(  $p_arr['E mail'], $p _arr_new[' Email'] )  )    
279           {    
280                $Email =  $p_arr_ne w['Email'] ;    
281                if ( !co nf_email (  $Email )  )    
282                {    
283                    $res ult_text . = _t("_EMA IL_ALREADY _USED_BY",  $Email, " <a href=\" profile.ph p?ID=$exis t_arr[ID]\ ">$exist_a rr[NickNam e]</a>");    
284                }    
285                else    
286                {    
287                    $STA TUS_CHANGE _TO = "Unc onfirmed";    
288                    $p_a rr['Status '] = $STAT US_CHANGE_ TO; // Nec essary to  correctly  display pr ofile stat us.    
289                }    
290           }    
291      
292      
293           //  new/updat e profile    
294      
295           $c l_where =  "";    
296           if  ( !$ADMIN  && !$exis t_arr )    
297                $cl_valu es = "UPDA TE `Profil es` SET ";    
298           el seif ( $AD MIN && $_P OST['NewPr ofile'] ==  'YES' )    
299                $cl_valu es = "INSE RT INTO `P rofiles` S ET ";    
300           el seif ( $AD MIN )    
301                $cl_valu es = "UPDA TE `Profil es` SET ";    
302           $c l_first =  0;    
303      
304           $r espd = db_ res("SELEC T * FROM P rofilesDes c WHERE `v isible` &  $db_vsbl A ND `editab le` & $db_ editbl AND  `to_db` =  1 AND ( F IND_IN_SET ('0', `sho w_on_page` ) OR FIND_ IN_SET('". (int)$_pag e['name_in dex']."',  `show_on_p age`)) ORD ER BY `ord er` DESC") ;    
305      
306           wh ile ( $arr pd = mysql _fetch_arr ay($respd)  )    
307           {    
308                $fname =  get_input _name ( $a rrpd );    
309                $dbname  = get_fiel d_name ( $ arrpd );    
310                $fval =  $p_arr_new [$fname];    
311      
312                if ( $db name == "S tatus" &&  $fval == ' Active' &&  $enable_m atch && $I D > 0 )    
313                    $sen d_cupid_ma il_id = $I D;    
314      
315                switch (  $arrpd['t ype'] )    
316                {    
317                    case  'set': //  set of ch eckboxes    
318                    case  'r': // r eference t o array fo r combo bo x    
319                    case  'c': // t ext box    
320                    case  'p': // i nput box p assword    
321                    case  'a': // t ext Area -  inputed v alue for t extarea is  checked w hile displ aying    
322                    case  'rb': //  radio butt ons    
323                    case  'e': // e num combo  box    
324                    case  'en': //  enum combo  box with  numbers    
325                    case  'eny': //  enum comb o box with  numbers    
326                    case  'date': / / date    
327                         $fval = pr ocess_db_i nput( $fva l, 0, 1 );    
328                         $cl_values  .= " `$db name` = '$ fval'";    
329                         $cl_values  .= ", ";    
330                    brea k;      
331                }    
332           }    
333               
334           $l en = strle n ($cl_val ues) - 1;    
335           wh ile ( $cl_ values[$le n] == ','  || $cl_val ues[$len]  == ' ' ) {    
336                $cl_valu es[$len] =  ' ';    
337                $len--;    
338           }    
339      
340      
341           $c l_values . = ", `Last Modified`  = NOW() ";    
342      
343           if  ( $ADMIN  )    
344           {    
345                srand(ti me());    
346                $seed =  rand();    
347                if ( $_P OST[NewPro file] == ' YES' )    
348                    $cl_ values .=  "";    
349                else    
350                    $cl_ values .=  " WHERE ID  = '{$p_ar r['ID']}'" ;    
351           }    
352           el seif ( str len($STATU S_CHANGE_T O) )    
353           {    
354                $cl_valu es .= ", ` Status` =  '$STATUS_C HANGE_TO'" ;    
355                $cl_valu es .= " WH ERE ID = " .(int)($ID );    
356           }    
357           el se    
358                $cl_valu es .= " WH ERE ID = " .(int)($ID );    
359      
360      
361           if  ( !$exist _arr || $A DMIN )    
362           {    
363                $create_ result = d b_res( $cl _values );    
364      
365                $affecte d_rows = m ysql_affec ted_rows(  $MySQL->li nk );    
366                if ( !$a ffected_ro ws )    
367                    $res ult_text . = _t("_No  modificati on");//'No  modificat ions were  done.';    
368                else    
369                {    
370                    if (  $ADMIN &&  $_POST['N ewProfile' ] == 'YES'  )    
371                    {    
372                         $IDnormal  = mysql_in sert_id( $ MySQL->lin k );    
373                         createUser DataFile(  $IDnormal  );    
374                            
375                         $result_te xt .= _t_a ction("_Ne w profile  created"). " ID: <a h ref='profi le_edit.ph p?ID=$IDno rmal'>$IDn ormal</a>. ";    
376                    }    
377                    else    
378                    {    
379                         createUser DataFile(  $ID );    
380                         if ( 'Unco nfirmed' = = $STATUS_ CHANGE_TO  )    
381                         {    
382                             // Sen d confirma tion reque st to the  user.    
383                             activa tion_mail(  $ID );    
384                         }    
385                         $result_te xt .= _t_a ction('_MO DIFICATION S_APPLIED' );    
386                    }    
387                }    
388      
389      
390      
391                if ( $AD MIN )    
392                {    
393                    $Fea tured = $_ POST['Feat ured'] ==  "on" ? 1 :  0;    
394                    db_r es( "UPDAT E `Profile s` SET `Fe atured` =  '{$Feature d}' WHERE  `ID` = {$I D};" );    
395                    crea teUserData File( $ID  );    
396                }    
397      
398                if ( $ME MBER )    
399                    setc ookie( "me mberPasswo rd", $p_ar r_new['Pas sword1'],  0, "/" );    
400      
401                if ( $se nd_cupid_m ail_id )    
402                {    
403                    cupi d_email ($ send_cupid _mail_id);    
404                }    
405      
406      
407                //    
408                // MODUL ES [ BEGIN  ]    
409                //    
410      
411                if ( !st rlen($p_ar r_new['Sex ']) && (in t)$p_arr_n ew['Sex']  == 0 )    
412                    $p_a rr_new['Se x'] =  $p_ arr['Sex'] ;    
413      
414                if ( $AD MIN )    
415                {    
416                    if ( $_POST[New Profile] = = 'YES' &&  ! $ID) //  Second co ndition is  here just  in case : )    
417                    {    
418                         $arr = db_ arr("SHOW  TABLE STAT US LIKE 'P rofiles'") ;    
419                         $ID = $arr ['Auto_inc rement'] -  1;    
420                         modules_ad d($ID);    
421      
422                         if (strlen ($p_arr_ne w['Status' ]) > 0 &&  $p_arr_new ['Status']  != 'Activ e')    
423                         {    
424                             module s_block($I D);    
425                         }    
426                         else    
427                         {    
428                             $check _res = che ckAction($ ID, ACTION _ID_USE_CH AT);    
429                             if ( $ check_res[ CHECK_ACTI ON_RESULT]  != CHECK_ ACTION_RES ULT_ALLOWE D )    
430                             {    
431                                 mo dules_bloc k($ID, 'ch at');    
432                             }    
433                             $check _res = che ckAction($ ID, ACTION _ID_USE_FO RUM);    
434                             if ( $ check_res[ CHECK_ACTI ON_RESULT]  != CHECK_ ACTION_RES ULT_ALLOWE D )    
435                             {    
436                                 mo dules_bloc k($ID, 'fo rum');    
437                             }    
438                         }    
439                    }    
440                    else  // If upd ating prof ile, not a dding a ne w one    
441                    {    
442                         if ( $p_ar r['Status' ] != 'Reje cted' && $ p_arr_new[ 'Status']  == 'Reject ed' )    
443                         {    
444                             // Sen d email ab out reject ion    
445      
446      
447                             $recip ient = $p_ arr_new['E mail'];    
448      
449                             $messa ge = getPa ram("t_Rej ection");    
450                             $subje ct = getPa ram('t_Rej ection_sub ject');    
451      
452                             sendMa il( $p_arr _new['Emai l'], $subj ect, $mess age, $p_ar r['ID'] );    
453      
454                         }    
455      
456                         if ( $p_ar r['Status' ] != 'Acti ve' && $p_ arr_new['S tatus'] ==  'Active'  )    
457                         {    
458                             // Sen d emain ab out activa tion HERE    
459                             $recip ient = $p_ arr_new['E mail'];    
460      
461                             $messa ge = getPa ram("t_Act ivation");    
462                             $subje ct = getPa ram('t_Act ivation_su bject');    
463      
464                             sendMa il( $p_arr _new['Emai l'], $subj ect, $mess age, $p_ar r['ID'] );    
465      
466                             $check _res = che ckAction($ ID, ACTION _ID_USE_CH AT);    
467                             if ( $ check_res[ CHECK_ACTI ON_RESULT]  == CHECK_ ACTION_RES ULT_ALLOWE D )    
468                             {    
469                                 mo dules_unbl ock($ID, ' chat');    
470                             }    
471                             $check _res = che ckAction($ ID, ACTION _ID_USE_FO RUM);    
472                             if ( $ check_res[ CHECK_ACTI ON_RESULT]  == CHECK_ ACTION_RES ULT_ALLOWE D )    
473                             {    
474                                 mo dules_unbl ock($ID, ' forum');    
475                             }    
476                         }    
477      
478                         // Block m ember if a dmin chang ed his/her  status no t for the  best    
479                         if ($p_arr ['Status']  == 'Activ e' && strl en($p_arr_ new['Statu s']) > 0 & & $p_arr_n ew['Status '] != 'Act ive')    
480                         {    
481                             module s_block($I D);    
482                         }    
483                    }    
484                }    
485                else    
486                {    
487                    // B lock membe r if his/h er status  was change d in conse quence of  some field s changing    
488                    if ( strlen($ST ATUS_CHANG E_TO) > 0)    
489                    {    
490                         modules_bl ock($ID);    
491                    }    
492                }    
493      
494                if ($_PO ST['NewPro file'] !=  'YES')    
495                {    
496                    if ( $p_arr['Ni ckName'] ! = $p_arr_n ew['NickNa me'])    
497                    {    
498                         modules_up date($ID,  '', $p_arr ['NickName ']);    
499                    }    
500                    else    
501                    {    
502                         modules_up date($ID);    
503                    }    
504                }    
505      
506                    //    
507                    // M ODULES [ E ND ]    
508                    //    
509      
510           }  // see lin e 368    
511       } // s ee line 23 9    
512   } // see l ine 163    
513      
514      
515   //-------- ---------- ---------- ------ SAV E CHANGES  [END]    
516      
517      
518      
519   // check i f we going  to add ne w profile    
520   if ( $ADMI N && !$ID  )    
521       $NEW_T O_ADD = tr ue;    
522      
523   // Set mem bership le vel    
524   if ( $ADMI N && $_POS T['SetMemb ership'] = = 'YES' )    
525   {    
526       if ( i s_numeric( $_POST['Me mbershipDa ys']) || $ _POST['Mem bershipDay s'] == 'un limited' | | !isset($ _POST['Mem bershipDay s']) )    
527       {    
528           if  ( $_POST[ 'Membershi pDays'] ==  'unlimite d' || !iss et($_POST[ 'Membershi pDays']) )    
529                $members hip_days =  0;    
530           el se    
531                $members hip_days =  (int)$_PO ST['Member shipDays'] ;    
532           $m embership_ id = (int) $_POST['Me mbershipID '];    
533           $i mmediately  = ($_POST ['Membersh ipImmediat ely'] == ' on');    
534           $m embership_ result = s etMembersh ip( $ID, $ membership _id, $memb ership_day s, $immedi ately );    
535           if  (!$member ship_resul t)    
536                $members hip_messag e = "<font  color=\"r ed\">Faile d to set m embership< /font>";    
537           el se    
538           {    
539                $check_r es = check Action($ID , ACTION_I D_USE_CHAT );    
540                if ($che ck_res[CHE CK_ACTION_ RESULT] ==  CHECK_ACT ION_RESULT _ALLOWED)    
541                    modu les_unbloc k($ID, 'ch at');    
542                else    
543                    modu les_block( $ID, 'chat ');    
544      
545                $check_r es = check Action($ID , ACTION_I D_USE_FORU M);    
546                if ($che ck_res[CHE CK_ACTION_ RESULT] ==  CHECK_ACT ION_RESULT _ALLOWED)    
547                    modu les_unbloc k($ID, 'fo rum');    
548                else    
549                    modu les_block( $ID, 'foru m');    
550           }    
551       }    
552   }    
553      
554   // fill ar ray with P OST values    
555   if ( !(( ( $ADMIN &&  !$demo_mod e) || $MEM BER ) && (  $_POST['S aveChanges '] == 'YES ' )) )    
556   {    
557       // fil l array wi th POST va lues    
558       $respd  = db_res( "SELECT *  FROM Profi lesDesc WH ERE `visib le` & $db_ vsbl AND (  FIND_IN_S ET('0',sho w_on_page)  OR FIND_I N_SET('".( int)$_page [name_inde x]."',show _on_page))  ORDER BY  `order` AS C");    
559       while  ( $arrpd =  mysql_fet ch_array($ respd) )    
560       {    
561           $f name = get _input_nam e( $arrpd  );    
562      
563           sw itch ($arr pd[type])    
564           {    
565           ca se 'set':  // set of  checkboxes    
566                break;    
567           de fault:    
568                if ( $ar rpd['get_v alue'] )    
569                {    
570                    $fun cbody = $a rrpd['get_ value_db'] ;    
571                    $fun c = create _function( '$arg0', $ funcbody);    
572                    $p_a rr_new[$fn ame] = $fu nc($p_arr) ;    
573                }    
574                break;    
575           }    
576       }    
577   }    
578   else    
579   {    
580       $respd  = db_res( "SELECT *  FROM Profi lesDesc WH ERE `visib le` & $db_ vsbl AND (  FIND_IN_S ET('0',sho w_on_page)  OR FIND_I N_SET('".( int)$_page [name_inde x]."',show _on_page))  ORDER BY  `order` AS C");    
581       while  ( $arrpd =  mysql_fet ch_array($ respd) )    
582       {    
583           $f name = get _input_nam e ( $arrpd  );    
584      
585           sw itch ($arr pd['type'] )    
586           {    
587           ca se 'set':  // set of  checkboxes    
588                break;    
589      
590           ca se 'date':    
591                    $p_a rr_new[$fn ame] = spr intf("%04d -%02d-%02d ",    
592                         (int)$_POS T[$fname .  '_year'],    
593                         (int)$_POS T[$fname .  '_month'] ,    
594                         (int)$_POS T[$fname .  '_day']    
595                         );    
596                break;    
597      
598           de fault:    
599                if( $fna me == 'Pas sword1' )    
600                {    
601                    if(  empty( $_P OST[$fname ] ) )    
602                         $p_arr_new [$fname] =  $p_arr['P assword'];    
603                    else    
604                         $p_arr_new [$fname] =  md5( proc ess_pass_d ata( $_POS T[$fname]  ) );    
605                }    
606                else    
607                    $p_a rr_new[$fn ame] = pro cess_pass_ data($_POS T[$fname]) ;    
608                break;    
609           }    
610       }    
611   }    
612      
613   // check f or feature d  member    
614   if ( $ADMI N  )    
615   {    
616       $featu red_arr =  getProfile Info( $ID  ); //db_ar r( "SELECT  `Featured ` FROM `Pr ofiles` WH ERE `ID` =  $ID" );    
617       $Featu red = (int )$featured _arr['Feat ured'];    
618   }    
619      
620   // ------- -------- [  END ] GET /POST acti ons    
621      
622   // ------- -------- p age compon ents    
623      
624   $_ni = $_p age['name_ index'];    
625      
626   $_page_con t[$_ni]['p age_main_c ode'] = Pa geCompPage MainCode() ;    
627      
628   // ------- -------- [ END] page  components    
629      
630   PageCode() ;    
631      
632   // ------- -------- p age compon ents funct ions    
633      
634   /**    
635    * page co de functio n    
636    */    
637   function P ageCompPag eMainCode( )    
638   {    
639       global  $site;    
640       global  $dir;    
641       global  $_page;    
642       global  $p_arr;    
643       global  $p_arr_ne w;    
644       global  $db_vsbl;    
645       global  $db_editb l;    
646       global  $tab;    
647       global  $autoAppr oval_ifPro file;    
648      
649       global  $ID;    
650       global  $MEMBER;    
651       global  $ADMIN;    
652       global  $NEW_TO_A DD;    
653       global  $Featured ;    
654      
655       global  $pic;    
656       global  $pics;    
657       global  $pic_num;    
658      
659      
660       global  $enable_a udio_uploa d;    
661       global  $enable_v ideo_uploa d;    
662       global  $sound_fi le_exist;    
663       global  $video_fi le_exist;    
664      
665       global  $status_a dmin_ex;    
666       global  $change_e rror_text;    
667       global  $result_t ext;    
668       global  $pictures _text;    
669       global  $membersh ip_message ;    
670      
671       global  $max_thum b_height;    
672       global  $max_thum b_width;    
673      
674       global  $enable_r ay;    
675       global  $enable_r ay_pro;    
676      
677      
678      
679       ob_sta rt();    
680      
681       if ( $ NEW_TO_ADD  )    
682       {    
683           $_ page['head er'] = _t( "_New Memb er");    
684           $_ page['head er_text']  = _t("_New  Member Ad d Here");    
685       }    
686       else    
687       {    
688           $_ page['head er'] = pro cess_line_ output($p_ arr['NickN ame']) .":  ". proces s_line_out put( strma xtextlen($ p_arr['Des criptionMe '], 45) );    
689      
690           $_ page['head er_text']  = "<b>". p rocess_lin e_output($ p_arr['Nic kName']) . "</b> - ";    
691           $_ page['head er_text']  .= _t('_'. $p_arr['Se x']);    
692           $_ page['head er_text']  .= ", " .  _t("_y/o",  age( $p_a rr['DateOf Birth'] ))  ." (ID: $ p_arr[ID]) ";    
693       }    
694      
695      
696       echo ' <table wid th="100%"  cellpaddin g="0" cell spacing="0 " border=" 0"><tr><td >';    
697      
698       if ( $ ADMIN && $ status_adm in_ex )    
699           ec ho ( $stat us_admin_e x );    
700      
701      
702       if ( $ change_err or_text )    
703           ec ho $change _error_tex t . '<br / >';    
704      
705           gl obal $mode rator;    
706           if  ($ADMIN & & !$modera tor)    
707           {    
708           ec ho "<div a lign=right  class=tex t2><a href =\"$_SERVE R[PHP_SELF ]\">"._t(" _Add New P rofile")." </a></div> ";    
709           }    
710      
711     if ( $re sult_text  )    
712         echo  '<center> ' . $resul t_text . ' </center>< br />';    
713      
714   if ( $ADMI N && !$NEW _TO_ADD &&  $enable_v ideo_uploa d && $enab le_ray &&  $enable_ra y_pro && f ile_exists ( $dir['ro ot'] . "ra y/modules/ video/admi n.php" ) )    
715   {    
716       $sRayH eaderPath  = $dir['ro ot'] . "ra y/inc/head er.inc.php ";    
717       $iId =  (int)$p_a rr['ID'];    
718       $aAdmi n = db_arr ("SELECT ` Name`, `Pa ssword` FR OM `Admins ` LIMIT 1" );    
719       $sNick  = $aAdmin ['Name'];    
720       $sPass word = $aA dmin['Pass word'];    
721       echo " <tr><td><d iv style=\ "width:179 px; paddin g-bottom:1 0px; margi n-left:aut o; margin- right:auto ;\">";    
722       requir e_once( $d ir['root']  . "ray/mo dules/vide o/admin.ph p" );    
723       echo " </div></td ></tr>";    
724   }    
725      
726   if ( $ADMI N && !$NEW _TO_ADD )    
727   {    
728       // Pri nt members hip inform ation and  controls    
729       $membe rships_arr  = getMemb erships();    
730       $membe rship_info  = getMemb erMembersh ipInfo($ID );    
731   ?>    
732       <!-- M EMBERSHIP  [BEGIN] -- >    
733      
734       <tr><t d>    
735           <c enter><?=  $membershi p_message  ?></center >    
736           <f orm name=" Membership Form" acti on="profil e_edit.php ?ID=<? ech o $p_arr[' ID']; ?>"  method=pos t>    
737           <i nput type= "hidden" n ame="SetMe mbership"  value="YES ">    
738           <t able width =100% cell spacing=0  cellpaddin g=2 class= "text2" bo rder=0>    
739   <?    
740       echo p rint_rows_ set_member ship( 1, $ membership s_arr, $me mbership_i nfo, 3, "t able", "pa nel", "25% " );    
741   ?>    
742           </ table>    
743           <c enter>    
744                <input c lass=no ty pe="submit " value="S et" style= "width: 50 px;">    
745           </ center>    
746           </ form>    
747       <hr>    
748       </td>< /tr>    
749      
750       <!-- M EMBERSHIP  [ END ] -- >    
751   <?    
752   }    
753      
754   ?>    
755           
756       <form  name="jfor m" method= "post" act ion="profi le_edit.ph p?ID=<? ec ho $p_arr[ 'ID']; ?>" >    
757   <?    
758       if ( $ NEW_TO_ADD  )    
759       {?>    
760           <i nput type= "hidden" n ame="NewPr ofile" val ue="YES" / >    
761       <?}    
762   ?>    
763   <input typ e="hidden"  name="Sav eChanges"  value="YES " />    
764   <?    
765      
766   if ( $ADMI N )    
767   {    
768       ?>    
769       <table  cellspaci ng="0" cel lpadding=" 0" class=" small2" al ign="cente r">    
770           <t r>    
771                <td alig n="right"  width="75% "><?= _t(" _Mark as F eatured")  ?></td>    
772                <td alig n="left" w idth="25%" >    
773                    <inp ut type="c heckbox" n ame="Featu red"    
774                      <?  if ( $Fea tured ) ec ho 'checke d="checked "'; ?> >    
775                </td>    
776           </ tr>    
777       </tabl e>    
778       <?    
779   }    
780      
781   ?>    
782       <table  border="0 " cellspac ing="0" ce llpadding= "0" width= "100%">    
783           <t r>    
784       <td va lign="top" >    
785      
786       <table  border="0 " cellspac ing="1" ce llpadding= "0" width= "100%">    
787       <tr><t d align="c enter" val ign="middl e">    
788   <?    
789      
790      
791   if ( $NEW_ TO_ADD )    
792       echo _ t("_New Me mber").'<b r /><br /> ';    
793   else    
794   {    
795       ?>    
796           <t able borde r="0" cell spacing="0 " cellpadd ing="0" wi dth="250">    
797                <tr>    
798                    <td  align="cen ter" valig n="middle"  style="po sition:rel ative; dis play:block ;width:112 px;">    
799                         <?= get_me mber_thumb nail($p_ar r['ID'], ' none') ?>    
800           </ td>    
801           <t d>    
802       <?    
803       $yes_p h = 0;    
804      
805       requir e_once( BX _DIRECTORY _PATH_ROOT  . 'profil ePhotos.ph p' );    
806       $oPhot o = new Pr ofilePhoto s( $p_arr[ 'ID'] );    
807       $oPhot o -> getMe diaArray() ;    
808       $yes_p h = $oPhot o -> iMedi aCount;    
809      
810       if ( $ yes_ph )    
811       {    
812           ?>    
813                <a href= "<?=$site[ 'url'] ?>p hotos_gall ery.php?ID =<?= $p_ar r['ID'] ?> " ><?= _t( "_More Pho tos") ?></ a><br />    
814           <?    
815       }    
816      
817       if ( ! $MEMBER )    
818       {    
819           ec ho "<div c lass=small 2>"._t("_L ast logged  in").": " ;    
820           if  ( !$p_arr ['LastLogg edIn'] ||  $p_arr['La stLoggedIn '] == "000 0-00-00 00 :00:00" )    
821                echo _t( "_never");    
822           el se    
823                echo $p_ arr['LastL oggedIn'];    
824           ec ho "</div> ";    
825       }    
826       else    
827       {    
828           ec ho _t("_Pr ofile stat us"); ?>:    
829           <b ><font cla ss=prof_st at_<? echo  $p_arr['S tatus']; ? >> <? echo  _t("_".$p _arr['Stat us']); ?>  </font></b ><br />    
830       <?    
831           if  ( $MEMBER  )    
832                switch (  $p_arr['S tatus'] )    
833                {    
834                    case  'Active': echo '<a h ref="chang e_status.p hp">'._t(" _Suspend a ccount").' </a><br /> ';break;    
835                    case  'Suspende d':echo '< a href="ch ange_statu s.php">'._ t("_Activa te account ").'</a><b r />';brea k;    
836                }    
837       }    
838      
839       ?>    
840           </ td></tr>    
841           </ table>    
842       <?    
843   }    
844   ?>    
845       </td>    
846       <td va lign="top"  align="ce nter" widt h="100%">    
847      
848   <?    
849      
850   $free_mode  = getPara m("free_mo de") == "o n" ? 1 : 0 ;    
851      
852   ?>    
853       </td>    
854      
855   </table>    
856      
857   </td></tr>    
858   <tr><td>    
859      
860   <table cla ss="profil e_edit_tab le"><!-- P rofile edi t page -->    
861   <?    
862       $first _row = 1;    
863       $rd =  !( $ADMIN  || $MEMBER  );    
864           
865       $colum ns = 2;    
866           
867       $respd  = db_res( "SELECT *,  (`editabl e` & $db_e ditbl) AS  `is_editab le` FROM ` ProfilesDe sc` WHERE  `visible`  & $db_vsbl  AND ( FIN D_IN_SET(' 0', `show_ on_page`)  OR FIND_IN _SET('".(i nt)$_page[ 'name_inde x']."', sh ow_on_page )) ORDER B Y `order`  ASC");    
868       while  ( $arrpd =  mysql_fet ch_array($ respd) )    
869       {    
870           $f name = get _input_nam e( $arrpd  );    
871      
872           if  ( $arrpd[ 'get_value '] && $arr pd['to_db' ] == 0 )    
873           {    
874                $funcbod y = $arrpd ['get_valu e'];    
875                $func =  create_fun ction('$ar g0',$funcb ody);    
876                $p_arr[$ fname] = $ func($p_ar r_new);    
877           }    
878      
879      
880           if  ( $arrpd[ 'is_editab le'] && is set($p_arr _new[$fnam e]) )    
881           {    
882                $p_arr[$ fname] = $ p_arr_new[ $fname];    
883           }    
884      
885           $n ot_first_r ow = 0;    
886      
887           $r ead_only =  !$arrpd[' is_editabl e'];    
888           sw itch ($arr pd['type'] )    
889           {    
890           ca se 'set':  // set of  checkboxes    
891                echo pri nt_row_set ( $first_r ow, $arrpd , $p_arr[$ fname], "t able", $rd , $columns , "", $rea d_only );    
892                break;    
893           ca se 'rb': / / radio bu ttons    
894                echo pri nt_row_rad io_button(  $first_ro w, $arrpd,  $p_arr[$f name], "ta ble", $rd,  $columns,  "", $read _only );    
895                break;    
896           ca se 'r': //  reference  to array  for combo  box    
897                if ( $fn ame == 'Co untry' )    
898                {    
899                    $onc hange = "f lagImage =  document. getElement ById('flag ImageId');  flagImage .src = '{$ site['flag s']}' + th is.value.t oLowerCase () + '.gif ';";    
900                    if (  strlen($p _arr[$fnam e]) == 0 )    
901                         $p_arr[$fn ame] = get Param( 'de fault_coun try' );    
902                    $ima gecode = ' <img id="f lagImageId " src="'.  ($site['fl ags'].strt olower($p_ arr[$fname ])) .'.gif " alt="fla g" />';    
903                }    
904                else    
905                {    
906                    $onc hange = '' ;    
907                    $ima gecode = ' ';    
908                }    
909                echo pri nt_row_ref ( $first_r ow, $arrpd , $p_arr[$ fname], "t able", $rd , $columns , "", $rea d_only, $o nchange, $ imagecode  );    
910                break;    
911           ca se '0': //  divider    
912                echo pri nt_row_del im( $first _row, $arr pd, "panel ", $column s );    
913                $not_fir st_row = 1 ;    
914                $first_r ow = 1;    
915                break;    
916           ca se 'e': //  enum comb o box. if  field name  is 'Sex',  than this  is simple  text, use r can not  change it    
917                echo pri nt_row_enu m( $first_ row, $arrp d, $p_arr[ $fname], " table", $j avascript,  $rd, $col umns, "",  $read_only  );    
918                break;    
919           ca se 'en': / / enum com bo box wit h numbers    
920                echo pri nt_row_enu m_n( $firs t_row, $ar rpd, $p_ar r[$fname],  "table",  $rd, $colu mns, "", $ read_only  );    
921                break;    
922           ca se 'eny':  // enum co mbo box wi th years    
923                echo pri nt_row_enu m_years( $ first_row,  $arrpd, $ p_arr[$fna me], "tabl e", $rd, $ columns, " ", $read_o nly );    
924                break;    
925           ca se 'a': //  text Area    
926                echo pri nt_row_are a( $first_ row, $arrp d, $p_arr[ $fname], " table", $r d, $column s, "", $re ad_only );    
927                break;    
928           ca se 'c': //  input box    
929                echo pri nt_row_edi t( $first_ row, $arrp d, $p_arr[ $fname], " table", $r d, $column s, "", $re ad_only );    
930                break;    
931           ca se 'date':  // date    
932                echo pri nt_row_dat e( $first_ row, $arrp d, $p_arr[ $fname], " table", $r d, $column s, "", $re ad_only );    
933                break;    
934           ca se 'p': //  input box  password    
935                echo pri nt_row_pwd ( $first_r ow, $arrpd , '', "tab le", $rd,  $columns,  "", $read_ only );    
936                break;    
937           de fault:    
938                $not_fir st_row = 1 ;    
939           }    
940           if  ( !$not_f irst_row & & $first_r ow == 1 )   $first_ro w = 0;    
941       }    
942   ?>    
943   </table>    
944   </td></tr>    
945   </table>    
946      
947   <br />    
948   <?    
949      
950       if ( ! (!($ADMIN  || $MEMBER  )) )    
951       {    
952   ?>    
953   <center><i nput type= "submit" v alue="<?ph p echo _t( "_Save Cha nges"); ?> " /></cent er>    
954   </form>    
955   <br />    
956   <?    
957           if  ( $MEMBER  && !$NEW_ TO_ADD )    
958           {    
959                if (!$au toApproval _ifProfile ) attentio n( _t("_PR OFILE_WARN ING1", $si te['title' ]) );    
960                attentio n( _t("_PR OFILE_WARN ING2", $si te['title' ]) );    
961           }    
962       }    
963      
964       echo " </td></tr> </table>";    
965      
966       $ret =  ob_get_cl ean();    
967      
968       return  $ret;    
969   }    
970      
971   /**    
972    * prints  error mess age    
973    */    
974   /*    
975   function r eport_err(  $str )    
976   {    
977       return  "<font co lor=\"#880 000\"><b>E rror:</b>  $str</font ><br />";    
978   }    
979   */    
980   /**    
981    * prints  submit for m for imag e upload    
982    */    
983   function i mg_form (  $i )    
984   {    
985       global  $pics;    
986       global  $p_arr;    
987      
988       $ret =  "";    
989      
990       $ret . =  "<form  enctype=\" multipart/ form-data\ " action=\ "profile_e dit.php?ID ={$p_arr[' ID']}\" me thod=post> \n";    
991       $ret . = "photo $ i: \n";    
992       if ( $ pics[$i][' exist'] )    
993       {    
994           $r et .="<a t arget=_bla nk href=\" {$pics[$i] ['url']}\" >View phot o</a>&nbsp ;&nbsp;|&n bsp;&nbsp; ";    
995           $r et .="<a h ref=\"prof ile_edit.p hp?ID={$p_ arr['ID']} &amp;actio n=delete_$ i\">Delete </a>";    
996           if ( substr($ p_arr["Pic _".$i."_ad don"], 0,  1) != 'p'  )    
997           {    
998              $ret .="<b r />(not p rivate)";    
999           }    
1000           el se    
1001           {    
1002              $ret .="<b r />(priva te)";    
1003           }    
1004      
1005       }    
1006       $ret . = "<br />" ;    
1007       $ret . = "<input  type=hidde n name=\"M AX_FILE_SI ZE\" value =\"".((int )( 2 * 102 4 * 1024 ) )."\">";    
1008       $ret . = "<input  type=hidde n name=\"$ {i}_UPLOAD \" value=\ "YES\">";    
1009       $ret . = "<input  class=no n ame=file_$ i type=fil e size=10> &nbsp;<inp ut class=n o type=sub mit value= \""._t("_U pload")."\ ">\n";    
1010      
1011       $ret . = "</form> \n";    
1012      
1013       return  $ret;    
1014   }    
1015      
1016   ?>