39. File Comparison Report

Produced on Wed Jun 18 08:01:44 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.

39.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.1.1\inc\classes BxDolProfileFields.php Mon May 12 06:28:56 2008 UTC
2 Dolphin-v.6.1.2\inc\classes BxDolProfileFields.php Wed May 28 09:31:20 2008 UTC

39.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 4 1650
Changed 3 13
Inserted 0 0
Removed 0 0

39.3 Comparison options

Whitespace All differences in whitespace within lines are ignored
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

39.4 Active regular expressions

No regular expressions were active.

39.5 Comparison detail

1   <?php   1   <?php
2     2  
3   require_on ce( 'BxDol PFM.php' ) ;   3   require_on ce( 'BxDol PFM.php' ) ;
4   require_on ce( $dir[' plugins']  . 'Service s_JSON.php ' );   4   require_on ce( $dir[' plugins']  . 'Service s_JSON.php ' );
5   require_on ce( $dir[' classes']  . 'Thing.p hp' );   5   require_on ce( $dir[' classes']  . 'Thing.p hp' );
6     6  
7   class BxDo lProfileFi elds {   7   class BxDo lProfileFi elds {
8       var $i AreaID;   8       var $i AreaID;
9       var $s CacheFile;  // path t o cache fi le   9       var $s CacheFile;  // path t o cache fi le
10       var $a Area; // j ust a cach e array   10       var $a Area; // j ust a cach e array
11       var $a Blocks; //  array of  current bl ocks   11       var $a Blocks; //  array of  current bl ocks
12       var $a Cache; //  full cache  of profil e fields   12       var $a Cache; //  full cache  of profil e fields
13       var $a CoupleMutu al; //coup le mutual  fields   13       var $a CoupleMutu al; //coup le mutual  fields
14          14       
15       functi on BxDolPr ofileField s( $iAreaI D ) {   15       functi on BxDolPr ofileField s( $iAreaI D ) {
16           $t his -> iAr eaID = $iA reaID;   16           $t his -> iAr eaID = $iA reaID;
17              17           
18           $t his -> sCa cheFile =  BX_DIRECTO RY_PATH_IN C . 'db_ca ched/Profi leFields.i nc';   18           $t his -> sCa cheFile =  BX_DIRECTO RY_PATH_IN C . 'db_ca ched/Profi leFields.i nc';
19              19           
20           if ( !$this - > loadCach e() )   20           if ( !$this - > loadCach e() )
21                return f alse;   21                return f alse;
22              22           
23              23           
24       }   24       }
25          25       
26       functi on loadCac he( $bCycl e = true )  {   26       functi on loadCac he( $bCycl e = true )  {
27           if (   27           if (
28                !file_ex ists( $thi s -> sCach eFile ) or   28                !file_ex ists( $thi s -> sCach eFile ) or
29                !$sCache  = file_ge t_contents ( $this ->  sCacheFil e ) or   29                !$sCache  = file_ge t_contents ( $this ->  sCacheFil e ) or
30                !$this - > aCache =  eval( $sC ache ) or   30                !$this - > aCache =  eval( $sC ache ) or
31                !is_arra y($this ->  aCache)   31                !is_arra y($this ->  aCache)
32           )  {   32           )  {
33                $oPFM =  new BxDolP FMCacher() ;   33                $oPFM =  new BxDolP FMCacher() ;
34                   34                
35                if( !$oP FM -> crea teCache()  )   35                if( !$oP FM -> crea teCache()  )
36                    retu rn false;   36                    retu rn false;
37                   37                
38                if( $bCy cle ) //to  prevent c ycling   38                if( $bCy cle ) //to  prevent c ycling
39                    retu rn $this - > loadCach e( false ) ; // try a gaing   39                    retu rn $this - > loadCach e( false ) ; // try a gaing
40                else   40                else
41                    retu rn false;   41                    retu rn false;
42           }   42           }
43              43           
44           $t his -> aAr ea = $this  -> aCache [ $this ->  iAreaID ] ;   44           $t his -> aAr ea = $this  -> aCache [ $this ->  iAreaID ] ;
45              45           
46           // load block s   46           // load block s
47           $t his -> aBl ocks = $th is -> aAre a;   47           $t his -> aBl ocks = $th is -> aAre a;
48              48           
49           // get mutual  fields   49           // get mutual  fields
50           $t his -> _ge tCoupleMut ualFields( );   50           $t his -> _ge tCoupleMut ualFields( );
51              51           
52           re turn true;   52           re turn true;
53       }   53       }
54          54       
55       functi on genJson Errors( $a Errors, $b Couple ) {   55       functi on genJson Errors( $a Errors, $b Couple ) {
56           $a JsonErrors  = array() ;   56           $a JsonErrors  = array() ;
57              57           
58           $a JsonErrors [0] = $aEr rors[0];   58           $a JsonErrors [0] = $aEr rors[0];
59           if ( $bCouple  )   59           if ( $bCouple  )
60                $aJsonEr rors[1] =  $aErrors[1 ];   60                $aJsonEr rors[1] =  $aErrors[1 ];
61              61           
62           $o Parser = n ew Service s_JSON();   62           $o Parser = n ew Service s_JSON();
63           re turn $oPar ser -> enc ode( $aJso nErrors );   63           re turn $oPar ser -> enc ode( $aJso nErrors );
64       }   64       }
65          65       
66          66       
67       //sets  to $Error s intuitiv e array   67       //sets  to $Error s intuitiv e array
68       functi on process PostValues ( $bCouple , &$aValue s, &$aErro rs, $iPage  = 0, $iPr ofileID =  0 ) {   68       functi on process PostValues ( $bCouple , &$aValue s, &$aErro rs, $iPage  = 0, $iPr ofileID =  0 ) {
69           $i Humans = $ bCouple ?  2 : 1; //  number of  members in  profile ( single/cou ple), made  for doubl e arrays   69           $i Humans = $ bCouple ?  2 : 1; //  number of  members in  profile ( single/cou ple), made  for doubl e arrays
70              70           
71           if ( $this ->  iAreaID = = 1 ) // j oin   71           if ( $this ->  iAreaID = = 1 ) // j oin
72                $this ->  aBlocks =  $this ->  aArea[$iPa ge];   72                $this ->  aBlocks =  $this ->  aArea[$iPa ge];
73              73           
74           fo reach( $th is -> aBlo cks as $iB lockID =>  $aBlock )  {   74           fo reach( $th is -> aBlo cks as $iB lockID =>  $aBlock )  {
75                $aItems  = $aBlock[ 'Items'];   75                $aItems  = $aBlock[ 'Items'];
76                foreach  ($aItems a s $iItemID  => $aItem ) {   76                foreach  ($aItems a s $iItemID  => $aItem ) {
77                    $sIt emName = $ aItem['Nam e'];   77                    $sIt emName = $ aItem['Nam e'];
78                       78                    
79                    for(  $iHuman =  0; $iHuma n < $iHuma ns; $iHuma n ++ ) {   79                    for(  $iHuman =  0; $iHuma n < $iHuma ns; $iHuma n ++ ) {
80                         if( $iHuma n == 1 and  in_array(  $sItemNam e, $this - > aCoupleM utual ) )   80                         if( $iHuma n == 1 and  in_array(  $sItemNam e, $this - > aCoupleM utual ) )
81                             contin ue;   81                             contin ue;
82                           82                        
83                         $mValue =  null;   83                         $mValue =  null;
84                         switch( $a Item['Type '] ) {   84                         switch( $a Item['Type '] ) {
85                             case ' text':   85                             case ' text':
86                             case ' area':   86                             case ' area':
87                             case ' pass':   87                             case ' pass':
88                             case ' select_one ':   88                             case ' select_one ':
89                                 if ( isset( $ _POST[$sIt emName] )  and isset(  $_POST[$s ItemName][ $iHuman] )  )   89                                 if ( isset( $ _POST[$sIt emName] )  and isset(  $_POST[$s ItemName][ $iHuman] )  )
90                                      $mValue  = process_ pass_data(  $_POST[$s ItemName][ $iHuman] ) ;   90                                      $mValue  = process_ pass_data(  $_POST[$s ItemName][ $iHuman] ) ;
91                             break;   91                             break;
92                                92                             
93                             case ' bool':   93                             case ' bool':
94                                 if ( isset( $ _POST[$sIt emName] )  and isset(  $_POST[$s ItemName][ $iHuman] )  and $_POS T[$sItemNa me][$iHuma n] == 'yes ' )   94                                 if ( isset( $ _POST[$sIt emName] )  and isset(  $_POST[$s ItemName][ $iHuman] )  and $_POS T[$sItemNa me][$iHuma n] == 'yes ' )
95                                      $mValue  = true;   95                                      $mValue  = true;
96                                 el se   96                                 el se
97                                      $mValue  = false;   97                                      $mValue  = false;
98                             break;   98                             break;
99                                99                             
100                             case ' num':   100                             case ' num':
101                                 if ( isset( $ _POST[$sIt emName] )  and isset(  $_POST[$s ItemName][ $iHuman] )  and trim(  $_POST[$s ItemName][ $iHuman] )  !== '' )   101                                 if ( isset( $ _POST[$sIt emName] )  and isset(  $_POST[$s ItemName][ $iHuman] )  and trim(  $_POST[$s ItemName][ $iHuman] )  !== '' )
102                                      $mValue  = (int)tri m( $_POST[ $sItemName ][$iHuman]  );   102                                      $mValue  = (int)tri m( $_POST[ $sItemName ][$iHuman]  );
103                             break;   103                             break;
104                                104                             
105                             case ' date':   105                             case ' date':
106                                 if ( isset( $ _POST[$sIt emName] )  and isset(  $_POST[$s ItemName][ $iHuman] )  and trim(  $_POST[$s ItemName][ $iHuman] )  !== '' )  {   106                                 if ( isset( $ _POST[$sIt emName] )  and isset(  $_POST[$s ItemName][ $iHuman] )  and trim(  $_POST[$s ItemName][ $iHuman] )  !== '' )  {
107                                      list( $i Day, $iMon th, $iYear  ) = explo de( '/', $ _POST[$sIt emName][$i Human] );   107                                      list( $i Day, $iMon th, $iYear  ) = explo de( '/', $ _POST[$sIt emName][$i Human] );
108                                         108                                      
109                                      $iDay    = (int)$iD ay;   109                                      $iDay    = (int)$iD ay;
110                                      $iMonth  = (int)$iM onth;   110                                      $iMonth  = (int)$iM onth;
111                                      $iYear   = (int)$iY ear;   111                                      $iYear   = (int)$iY ear;
112                                         112                                      
113                                      $mValue  = "$iDay/$ iMonth/$iY ear";   113                                      $mValue  = "$iDay/$ iMonth/$iY ear";
114                                 }   114                                 }
115                             break;   115                             break;
116                                116                             
117                             case ' select_set ':   117                             case ' select_set ':
118                                 $m Value = ar ray();   118                                 $m Value = ar ray();
119                                 if ( isset( $ _POST[$sIt emName] )  and isset(  $_POST[$s ItemName][ $iHuman] )  and is_ar ray( $_POS T[$sItemNa me][$iHuma n] ) ) {   119                                 if ( isset( $ _POST[$sIt emName] )  and isset(  $_POST[$s ItemName][ $iHuman] )  and is_ar ray( $_POS T[$sItemNa me][$iHuma n] ) ) {
120                                      foreach  ($_POST[$s ItemName][ $iHuman] a s $sValue  ) {   120                                      foreach  ($_POST[$s ItemName][ $iHuman] a s $sValue  ) {
121                                          $mVa lue[] = pr ocess_pass _data( $sV alue );   121                                          $mVa lue[] = pr ocess_pass _data( $sV alue );
122                                      }   122                                      }
123                                 }   123                                 }
124                             break;   124                             break;
125                                125                             
126                             case ' range':   126                             case ' range':
127                                 if ( isset( $ _POST[$sIt emName] )  and isset(  $_POST[$s ItemName][ $iHuman] )  and is_ar ray( $_POS T[$sItemNa me][$iHuma n] ) ) {   127                                 if ( isset( $ _POST[$sIt emName] )  and isset(  $_POST[$s ItemName][ $iHuman] )  and is_ar ray( $_POS T[$sItemNa me][$iHuma n] ) ) {
128                                      $aRange  = $_POST[$ sItemName] [$iHuman];   128                                      $aRange  = $_POST[$ sItemName] [$iHuman];
129                                      $mValue  = array( n ull, null  );   129                                      $mValue  = array( n ull, null  );
130                                         130                                      
131                                      $aRange[ 0] = isset ( $aRange[ 0] ) ? tri m( $aRange [0] ) : '' ;   131                                      $aRange[ 0] = isset ( $aRange[ 0] ) ? tri m( $aRange [0] ) : '' ;
132                                      $aRange[ 1] = isset ( $aRange[ 1] ) ? tri m( $aRange [1] ) : '' ;   132                                      $aRange[ 1] = isset ( $aRange[ 1] ) ? tri m( $aRange [1] ) : '' ;
133                                         133                                      
134                                      if( $aRa nge[0] !==  '' )   134                                      if( $aRa nge[0] !==  '' )
135                                          $mVa lue[0] = ( int)$aRang e[0];   135                                          $mVa lue[0] = ( int)$aRang e[0];
136                                         136                                      
137                                      if( $aRa nge[1] !==  '' )   137                                      if( $aRa nge[1] !==  '' )
138                                          $mVa lue[1] = ( int)$aRang e[1];   138                                          $mVa lue[1] = ( int)$aRang e[1];
139                                 }   139                                 }
140                             break;   140                             break;
141                                141                             
142                             case ' system':   142                             case ' system':
143                                 sw itch( $aIt em['Name']  ) {   143                                 sw itch( $aIt em['Name']  ) {
144                                      case 'Co uple':   144                                      case 'Co uple':
145                                      case 'Te rmsOfUse':   145                                      case 'Te rmsOfUse':
146                                      case 'Fe atured': / /they are  boolean   146                                      case 'Fe atured': / /they are  boolean
147                                          if(  isset( $_P OST[$sItem Name] ) an d $_POST[$ sItemName]  == 'yes'  )   147                                          if(  isset( $_P OST[$sItem Name] ) an d $_POST[$ sItemName]  == 'yes'  )
148                                               $mValue =  true;   148                                               $mValue =  true;
149                                          else   149                                          else
150                                               $mValue =  false;   150                                               $mValue =  false;
151                                      break;   151                                      break;
152                                         152                                      
153                                      case 'Ca ptcha':   153                                      case 'Ca ptcha':
154                                      case 'St atus': //  they are s elect_one   154                                      case 'St atus': //  they are s elect_one
155                                          if(  isset( $_P OST[$sItem Name] ) )   155                                          if(  isset( $_P OST[$sItem Name] ) )
156                                               $mValue =  process_pa ss_data( $ _POST[$sIt emName] );   156                                               $mValue =  process_pa ss_data( $ _POST[$sIt emName] );
157                                      break;   157                                      break;
158                                 }   158                                 }
159                             break;   159                             break;
160                         }   160                         }
161                           161                        
162                         $rRes = $t his -> che ckPostValu e( $iBlock ID, $iItem ID, $mValu e, $iHuman , $iProfil eID );   162                         $rRes = $t his -> che ckPostValu e( $iBlock ID, $iItem ID, $mValu e, $iHuman , $iProfil eID );
163                           163                        
164                         if( $rRes  !== true )   164                         if( $rRes  !== true )
165                             $aErro rs[$iHuman ][$sItemNa me] = $rRe s; //it is  returned  error text   165                             $aErro rs[$iHuman ][$sItemNa me] = $rRe s; //it is  returned  error text
166                           166                        
167                           167                        
168                           168                        
169                         //if passw ord on edi t page   169                         //if passw ord on edi t page
170                         if( $aItem ['Type'] = = 'pass' a nd ( $this  -> iAreaI D == 2 or  $this -> i AreaID ==  3 or $this  -> iAreaI D == 4 ) )  {   170                         if( $aItem ['Type'] = = 'pass' a nd ( $this  -> iAreaI D == 2 or  $this -> i AreaID ==  3 or $this  -> iAreaI D == 4 ) )  {
171                             if( em pty($mValu e) )   171                             if( em pty($mValu e) )
172                                 $m Value = $a Values[$iH uman][$sIt emName];   172                                 $m Value = $a Values[$iH uman][$sIt emName];
173                             else   173                             else
174                                 $m Value = md 5( $mValue  );   174                                 $m Value = md 5( $mValue  );
175                         }   175                         }
176                           176                        
177                         $aValues[$ iHuman][$s ItemName]  = $mValue;   177                         $aValues[$ iHuman][$s ItemName]  = $mValue;
178                    }   178                    }
179                }   179                }
180           }   180           }
181       }   181       }
182          182       
183       functi on checkPo stValue( $ iBlockID,  $iItemID,  $mValue, $ iHuman, $i ProfileID  ) {   183       functi on checkPo stValue( $ iBlockID,  $iItemID,  $mValue, $ iHuman, $i ProfileID  ) {
184           //  get item   184           //  get item
185           $a Item = $th is -> aBlo cks[$iBloc kID]['Item s'][$iItem ID];   185           $a Item = $th is -> aBlo cks[$iBloc kID]['Item s'][$iItem ID];
186           if ( !$aItem  )   186           if ( !$aItem  )
187                return ' Item not f ound';   187                return ' Item not f ound';
188              188           
189           $a Checks = a rray(   189           $a Checks = a rray(
190                'text' = > array( ' Mandatory' , 'Min', ' Max', 'Uni que', 'Che ck' ),   190                'text' = > array( ' Mandatory' , 'Min', ' Max', 'Uni que', 'Che ck' ),
191                'area' = > array( ' Mandatory' , 'Min', ' Max', 'Uni que', 'Che ck' ),   191                'area' = > array( ' Mandatory' , 'Min', ' Max', 'Uni que', 'Che ck' ),
192                'pass' = > array( ' Mandatory' , 'Min', ' Max', 'Che ck', 'Pass Confirm' ) ,   192                'pass' = > array( ' Mandatory' , 'Min', ' Max', 'Che ck', 'Pass Confirm' ) ,
193                'date' = > array( ' Mandatory' , 'Min', ' Max', 'Che ck' ),   193                'date' = > array( ' Mandatory' , 'Min', ' Max', 'Che ck' ),
194                'select_ one' => ar ray( 'Min' , 'Max', ' Mandatory' , 'Values' , 'Check'  ),   194                'select_ one' => ar ray( 'Min' , 'Max', ' Mandatory' , 'Values' , 'Check'  ),
195                'select_ set' => ar ray( 'Min' , 'Max', ' Mandatory' , 'Values' , 'Check'  ),   195                'select_ set' => ar ray( 'Min' , 'Max', ' Mandatory' , 'Values' , 'Check'  ),
196                'num'     => array(  'Mandator y', 'Min',  'Max', 'U nique', 'C heck' ),   196                'num'     => array(  'Mandator y', 'Min',  'Max', 'U nique', 'C heck' ),
197                'range'   => array(  'Mandator y', 'Range Correct',  'Min', 'Ma x', 'Check ' ),   197                'range'   => array(  'Mandator y', 'Range Correct',  'Min', 'Ma x', 'Check ' ),
198                'system'  => array(  'System'  ),   198                'system'  => array(  'System'  ),
199                'bool'    => array(  'Mandator y' )   199                'bool'    => array(  'Mandator y' )
200           );   200           );
201              201           
202           $a MyChecks =  $aChecks[  $aItem['T ype'] ];   202           $a MyChecks =  $aChecks[  $aItem['T ype'] ];
203              203           
204           fo reach ($aM yChecks as  $sCheck )  {   204           fo reach ($aM yChecks as  $sCheck )  {
205                $sFunc =  'checkPos tValueFor'  . $sCheck ;   205                $sFunc =  'checkPos tValueFor'  . $sCheck ;
206                   206                
207                $mRes =  $this -> $ sFunc( $aI tem, $mVal ue, $iHuma n, $iProfi leID );   207                $mRes =  $this -> $ sFunc( $aI tem, $mVal ue, $iHuma n, $iProfi leID );
208                   208                
209                if( $mRe s !== true  ) {   209                if( $mRe s !== true  ) {
210                    if(  is_bool( $ mRes ) ) / / it is fa lse...   210                    if(  is_bool( $ mRes ) ) / / it is fa lse...
211                         return _t(  $aItem[ $ sCheck . ' Msg' ], $a Item[$sChe ck] );   211                         return _t(  $aItem[ $ sCheck . ' Msg' ], $a Item[$sChe ck] );
212                    else   212                    else
213                         return $mR es; // ret urned as t ext   213                         return $mR es; // ret urned as t ext
214                }   214                }
215           }   215           }
216              216           
217           re turn true;   217           re turn true;
218       }   218       }
219          219       
220       functi on checkPo stValueFor PassConfir m( $aItem,  $mValue,  $iHuman )  {   220       functi on checkPo stValueFor PassConfir m( $aItem,  $mValue,  $iHuman )  {
221           $s ConfPass =  process_p ass_data(  $_POST[ "{ $aItem['Na me']}_conf irm" ][$iH uman] );   221           $s ConfPass =  process_p ass_data(  $_POST[ "{ $aItem['Na me']}_conf irm" ][$iH uman] );
222           if ( $sConfPa ss != $mVa lue )   222           if ( $sConfPa ss != $mVa lue )
223                return _ t( '_Passw ord confir mation fai led' );   223                return _ t( '_Passw ord confir mation fai led' );
224           el se   224           el se
225                return t rue;   225                return t rue;
226       }   226       }
227          227       
228       functi on checkPo stValueFor RangeCorre ct( $aItem , $mValue  ) {   228       functi on checkPo stValueFor RangeCorre ct( $aItem , $mValue  ) {
229           if ( is_null( $mValue[0] ) or is_nu ll($mValue [1]) )   229           if ( is_null( $mValue[0] ) or is_nu ll($mValue [1]) )
230                return t rue; // if  not set,  pass this  check   230                return t rue; // if  not set,  pass this  check
231              231           
232           if ( $mValue[ 0] > $mVal ue[1] )   232           if ( $mValue[ 0] > $mVal ue[1] )
233                return _ t( '_First  value mus t be bigge r' );   233                return _ t( '_First  value mus t be bigge r' );
234              234           
235           re turn true;   235           re turn true;
236       }   236       }
237          237       
238       functi on checkPo stValueFor Min( $aIte m, $mValue  ) {   238       functi on checkPo stValueFor Min( $aIte m, $mValue  ) {
239           $i Min = $aIt em['Min'];   239           $i Min = $aIt em['Min'];
240           if ( is_null( $iMin) )   240           if ( is_null( $iMin) )
241                return t rue;   241                return t rue;
242              242           
243           sw itch( $aIt em['Type']  ) {   243           sw itch( $aIt em['Type']  ) {
244                case 'te xt':   244                case 'te xt':
245                case 'ar ea':   245                case 'ar ea':
246                    if(  strlen( $m Value ) <  $iMin )   246                    if(  strlen( $m Value ) <  $iMin )
247                         return fal se;   247                         return fal se;
248                break;   248                break;
249                   249                
250                case 'pa ss':   250                case 'pa ss':
251                    if(  strlen( $m Value ) >  0 and strl en( $mValu e ) < $iMi n )   251                    if(  strlen( $m Value ) >  0 and strl en( $mValu e ) < $iMi n )
252                         return fal se;   252                         return fal se;
253                break;   253                break;
254                   254                
255                case 'nu m':   255                case 'nu m':
256                    if(  $mValue <  $iMin )   256                    if(  $mValue <  $iMin )
257                         return fal se;   257                         return fal se;
258                break;   258                break;
259                   259                
260                case 'da te':   260                case 'da te':
261                    if(  $this -> g etAge($mVa lue) < $iM in )   261                    if(  $this -> g etAge($mVa lue) < $iM in )
262                         return fal se;   262                         return fal se;
263                break;   263                break;
264                   264                
265                case 'ra nge':   265                case 'ra nge':
266                    if(  $mValue[0]  < $iMin | | $mValue[ 1] < $iMin  )   266                    if(  $mValue[0]  < $iMin | | $mValue[ 1] < $iMin  )
267                         return fal se;   267                         return fal se;
268                break;   268                break;
269                   269                
270                case 'se lect_set':   270                case 'se lect_set':
271                    if(  count( $mV alue ) < $ iMin )   271                    if(  count( $mV alue ) < $ iMin )
272                         return fal se;   272                         return fal se;
273                break;   273                break;
274           }   274           }
275              275           
276           re turn true;   276           re turn true;
277       }   277       }
278          278       
279       functi on checkPo stValueFor Max( $aIte m, $mValue  ) {   279       functi on checkPo stValueFor Max( $aIte m, $mValue  ) {
280           $i Max = $aIt em['Max'];   280           $i Max = $aIt em['Max'];
281           if ( is_null( $iMax) )   281           if ( is_null( $iMax) )
282                return t rue;   282                return t rue;
283              283           
284           sw itch( $aIt em['Type']  ) {   284           sw itch( $aIt em['Type']  ) {
285                case 'te xt':   285                case 'te xt':
286                case 'ar ea':   286                case 'ar ea':
287                case 'pa ss':   287                case 'pa ss':
288                    if(  strlen( $m Value ) >  $iMax )   288                    if(  strlen( $m Value ) >  $iMax )
289                         return fal se;   289                         return fal se;
290                break;   290                break;
291                   291                
292                case 'nu m':   292                case 'nu m':
293                    if(  $mValue >  $iMax )   293                    if(  $mValue >  $iMax )
294                         return fal se;   294                         return fal se;
295                break;   295                break;
296                   296                
297                case 'da te':   297                case 'da te':
298                    if(  $this -> g etAge($mVa lue) > $iM ax )   298                    if(  $this -> g etAge($mVa lue) > $iM ax )
299                         return fal se;   299                         return fal se;
300                break;   300                break;
301                   301                
302                case 'ra nge':   302                case 'ra nge':
303                    if(  $mValue[0]  > $iMax | | $mValue[ 1] > $iMax  )   303                    if(  $mValue[0]  > $iMax | | $mValue[ 1] > $iMax  )
304                         return fal se;   304                         return fal se;
305                break;   305                break;
306                   306                
307                case 'se lect_set':   307                case 'se lect_set':
308                    if(  count( $mV alue ) > $ iMax )   308                    if(  count( $mV alue ) > $ iMax )
309                         return fal se;   309                         return fal se;
310                break;   310                break;
311           }   311           }
312              312           
313           re turn true;   313           re turn true;
314       }   314       }
315          315       
316       functi on checkPo stValueFor Unique( $a Item, $mVa lue, $iHum an, $iProf ileID ) {   316       functi on checkPo stValueFor Unique( $a Item, $mVa lue, $iHum an, $iProf ileID ) {
317           gl obal $logg ed;   317           gl obal $logg ed;
318              318           
319           if ( !$aItem[ 'Unique']  )   319           if ( !$aItem[ 'Unique']  )
320                return t rue;   320                return t rue;
321              321           
322           $i ProfileID  = (int)$iP rofileID;   322           $i ProfileID  = (int)$iP rofileID;
323           if ( $iProfil eID ) {   323           if ( $iProfil eID ) {
324                $sAdd =  "AND `ID`  != $iProfi leID";   324                $sAdd =  "AND `ID`  != $iProfi leID";
325           }  else   325           }  else
326                $sAdd =  '';   326                $sAdd =  '';
327              327           
328           $m Value_db =  addslashe s( $mValue  );   328           $m Value_db =  addslashe s( $mValue  );
329           $s Query = "S ELECT COUN T(*) FROM  `Profiles`  WHERE `{$ aItem['Nam e']}` = '$ mValue_db'  $sAdd";   329           $s Query = "S ELECT COUN T(*) FROM  `Profiles`  WHERE `{$ aItem['Nam e']}` = '$ mValue_db'  $sAdd";
330           if ( (int)db_ value( $sQ uery ) )   330           if ( (int)db_ value( $sQ uery ) )
331                return f alse;   331                return f alse;
332              332           
333           re turn true;   333           re turn true;
334       }   334       }
335          335       
336       functi on checkPo stValueFor Check( $aI tem, $mVal ue ) {   336       functi on checkPo stValueFor Check( $aI tem, $mVal ue ) {
337           $s Check = $a Item['Chec k'];   337           $s Check = $a Item['Chec k'];
338           if ( empty($s Check) )   338           if ( empty($s Check) )
339                return t rue;   339                return t rue;
340              340           
341           $s Func = cre ate_functi on( '$arg0 ', $sCheck  );   341           $s Func = cre ate_functi on( '$arg0 ', $sCheck  );
342              342           
343           if ( !$sFunc(  $mValue )  )   343           if ( !$sFunc(  $mValue )  )
344                return f alse;   344                return f alse;
345              345           
346           re turn true;   346           re turn true;
347       }   347       }
348          348       
349       functi on checkPo stValueFor Mandatory(  $aItem, $ mValue ) {   349       functi on checkPo stValueFor Mandatory(  $aItem, $ mValue ) {
350           if ( !$aItem[ 'Mandatory '] )   350           if ( !$aItem[ 'Mandatory '] )
351                return t rue;   351                return t rue;
352              352           
353           if ( $aItem[' Type'] ==  'num' ) {   353           if ( $aItem[' Type'] ==  'num' ) {
354                if( is_n ull($mValu e) )   354                if( is_n ull($mValu e) )
355                    retu rn false;   355                    retu rn false;
356           }  elseif( $a Item['Type '] == 'ran ge' ) {   356           }  elseif( $a Item['Type '] == 'ran ge' ) {
357                if( is_n ull($mValu e[0]) or i s_null($mV alue[1]) )   357                if( is_n ull($mValu e[0]) or i s_null($mV alue[1]) )
358                    retu rn false;   358                    retu rn false;
359           }  elseif( $a Item['Type '] == 'pas s' ) {   359           }  elseif( $a Item['Type '] == 'pas s' ) {
360                if( $thi s -> iArea ID == 2 or  $this ->  iAreaID ==  3 or $thi s -> iArea ID == 4 )  // if area  is edit,  non-mandat ory   360                if( $thi s -> iArea ID == 2 or  $this ->  iAreaID ==  3 or $thi s -> iArea ID == 4 )  // if area  is edit,  non-mandat ory
361                    retu rn true;   361                    retu rn true;
362                else   362                else
363                    if(  empty($mVa lue) ) //  standard c heck   363                    if(  empty($mVa lue) ) //  standard c heck
364                         return fal se;   364                         return fal se;
365           }  else {   365           }  else {
366                if( empt y($mValue)  )   366                if( empt y($mValue)  )
367                    retu rn false;   367                    retu rn false;
368           }   368           }
369              369           
370           re turn true;   370           re turn true;
371       }   371       }
372          372       
373       functi on checkPo stValueFor Values( $a Item, $mVa lue ) {   373       functi on checkPo stValueFor Values( $a Item, $mVa lue ) {
374           if ( empty($m Value) ) / /it is not  selected   374           if ( empty($m Value) ) / /it is not  selected
375                return t rue;   375                return t rue;
376              376           
377           if ( is_array ( $aItem[' Values'] )  )   377           if ( is_array ( $aItem[' Values'] )  )
378                $aValues  = $aItem[ 'Values'];   378                $aValues  = $aItem[ 'Values'];
379           el se   379           el se
380                $aValues  = $this - > getPrede finedKeysA rr( $aItem ['Values']  );   380                $aValues  = $this - > getPrede finedKeysA rr( $aItem ['Values']  );
381              381           
382           if ( !$aValue s )   382           if ( !$aValue s )
383                return ' Cannot fin d list';   383                return ' Cannot fin d list';
384              384           
385           if ( $aItem[' Type'] ==  'select_on e' ) {   385           if ( $aItem[' Type'] ==  'select_on e' ) {
386                if( !in_ array( $mV alue, $aVa lues ) )   386                if( !in_ array( $mV alue, $aVa lues ) )
387                    retu rn 'Value  not in lis t. Hack at tempt!';   387                    retu rn 'Value  not in lis t. Hack at tempt!';
388           }  elseif( $a Item['Type '] == 'sel ect_set' )  {   388           }  elseif( $a Item['Type '] == 'sel ect_set' )  {
389                foreach(  $mValue a s $sValue  )   389                foreach(  $mValue a s $sValue  )
390                    if(  !in_array(  $sValue,  $aValues )  )   390                    if(  !in_array(  $sValue,  $aValues )  )
391                         return 'Va lue not in  list. Hac k attempt! ';   391                         return 'Va lue not in  list. Hac k attempt! ';
392           }   392           }
393              393           
394           re turn true;   394           re turn true;
395       }   395       }
396          396       
397       functi on getPred efinedKeys Arr( $sKey  ) {   397       functi on getPred efinedKeys Arr( $sKey  ) {
398           gl obal $aPre Values;   398           gl obal $aPre Values;
399              399           
400           if ( substr(  $sKey, 0,  2 ) == '#! ' )   400           if ( substr(  $sKey, 0,  2 ) == '#! ' )
401                $sKey =  substr( $s Key, 2 );   401                $sKey =  substr( $s Key, 2 );
402              402           
403           re turn @arra y_keys( $a PreValues[ $sKey] );   403           re turn @arra y_keys( $a PreValues[ $sKey] );
404       }   404       }
405          405       
406       functi on checkPo stValueFor System( $a Item, $mVa lue ) {   406       functi on checkPo stValueFor System( $a Item, $mVa lue ) {
407              407           
408           sw itch( $aIt em['Name']  ) {   408           sw itch( $aIt em['Name']  ) {
409                case 'Ca ptcha':   409                case 'Ca ptcha':
410                    retu rn ( $this  -> checkC aptcha( $m Value ) )  ? true : _ t( '_Captc ha check f ailed' );   410                    retu rn ( $this  -> checkC aptcha( $m Value ) )  ? true : _ t( '_Captc ha check f ailed' );
411                break;   411                break;
412                   412                
413                case 'St atus':   413                case 'St atus':
414                    if(  !in_array( $mValue, $ aItem['Val ues'] ) )   414                    if(  !in_array( $mValue, $ aItem['Val ues'] ) )
415                         return 'St atus hack  attempt!';   415                         return 'St atus hack  attempt!';
416                break;   416                break;
417                   417                
418                case 'Te rmsOfUse':   418                case 'Te rmsOfUse':
419                    retu rn $mValue  ? true :  _t( '_You  must agree  with term s of use'  );   419                    retu rn $mValue  ? true :  _t( '_You  must agree  with term s of use'  );
420                break;   420                break;
421           }   421           }
422              422           
423           re turn true;   423           re turn true;
424       }   424       }
425          425       
426       functi on checkCa ptcha( $mV alue ) {   426       functi on checkCa ptcha( $mV alue ) {
427           if ( $_COOKIE ['strSec']  === md5(  $mValue )  ) {   427           if ( $_COOKIE ['strSec']  === md5(  $mValue )  ) {
428                return t rue;   428                return t rue;
429           }  else   429           }  else
430                return f alse;   430                return f alse;
431       }   431       }
432          432       
433       functi on getAge(  $sBirthDa te ) { //  28/10/1985   433       functi on getAge(  $sBirthDa te ) { //  28/10/1985
434           $b d = explod e( '/', $s BirthDate  );   434           $b d = explod e( '/', $s BirthDate  );
435           fo reach ($bd  as $i =>  $v) $bd[$i ] = (int)$ v;   435           fo reach ($bd  as $i =>  $v) $bd[$i ] = (int)$ v;
436              436           
437           if  ( date('n ') > $bd[1 ] || ( dat e('n') ==  $bd[1] &&  date('j')  >= $bd[0]  ) )   437           if  ( date('n ') > $bd[1 ] || ( dat e('n') ==  $bd[1] &&  date('j')  >= $bd[0]  ) )
438                $age = d ate('Y') -  $bd[2];   438                $age = d ate('Y') -  $bd[2];
439           el se   439           el se
440                $age = d ate('Y') -  $bd[2] -  1;   440                $age = d ate('Y') -  $bd[2] -  1;
441              441           
442           re turn $age;   442           re turn $age;
443       }   443       }
444          444       
445       // cre ate intuit ive array  of values  from defau lt text pr ofile arra y (getProf ileInfo)   445       // cre ate intuit ive array  of values  from defau lt text pr ofile arra y (getProf ileInfo)
446       functi on getValu esFromProf ile( $aPro file ) {   446       functi on getValu esFromProf ile( $aPro file ) {
447           $a Values = a rray();   447           $a Values = a rray();
448              448           
449           fo reach( $th is -> aBlo cks as $aB lock ) {   449           fo reach( $th is -> aBlo cks as $aB lock ) {
450                foreach(  $aBlock[' Items'] as  $aItem )  {   450                foreach(  $aBlock[' Items'] as  $aItem )  {
451                    $sIt emName = $ aItem['Nam e'];   451                    $sIt emName = $ aItem['Nam e'];
452                    if(  !array_key _exists( $ sItemName,  $aProfile  ) )   452                    if(  !array_key _exists( $ sItemName,  $aProfile  ) )
453                         continue;  //pass thi s   453                         continue;  //pass thi s
454                       454                    
455                    $mVa lue = $aPr ofile[$sIt emName];   455                    $mVa lue = $aPr ofile[$sIt emName];
456                       456                    
457                    swit ch( $aItem ['Type'] )  {   457                    swit ch( $aItem ['Type'] )  {
458                         case 'sele ct_set':   458                         case 'sele ct_set':
459                             $mValu e = explod e( ',', $m Value );   459                             $mValu e = explod e( ',', $m Value );
460                         break;   460                         break;
461                           461                        
462                         case 'rang e':   462                         case 'rang e':
463                             $mValu e = explod e( ',', $m Value );   463                             $mValu e = explod e( ',', $m Value );
464                             foreac h( $mValue  as $iInd  => $sValue  )   464                             foreac h( $mValue  as $iInd  => $sValue  )
465                                 $m Value[$iIn d] = (int) $sValue;   465                                 $m Value[$iIn d] = (int) $sValue;
466                         break;   466                         break;
467                           467                        
468                         case 'bool ':   468                         case 'bool ':
469                             $mValu e = (bool) $mValue;   469                             $mValu e = (bool) $mValue;
470                         break;   470                         break;
471                           471                        
472                         case 'num' :   472                         case 'num' :
473                             $mValu e = (int)$ mValue;   473                             $mValu e = (int)$ mValue;
474                         break;   474                         break;
475                           475                        
476                         case 'date ':   476                         case 'date ':
477                             $aDate  = explode ( '-', $mV alue ); // YYYY-MM-DD   477                             $aDate  = explode ( '-', $mV alue ); // YYYY-MM-DD
478                             $mValu e = (int)$ aDate[2] .  '/' . (in t)$aDate[1 ] . '/' .  $aDate[0];   478                             $mValu e = (int)$ aDate[2] .  '/' . (in t)$aDate[1 ] . '/' .  $aDate[0];
479                         break;   479                         break;
480                           480                        
481                         case 'syst em':   481                         case 'syst em':
482                             switch ( $sItemNa me ) {   482                             switch ( $sItemNa me ) {
483                                 ca se 'Couple ':   483                                 ca se 'Couple ':
484                                 ca se 'ID':   484                                 ca se 'ID':
485                                      $mValue  = (int)$mV alue;   485                                      $mValue  = (int)$mV alue;
486                                 br eak;   486                                 br eak;
487                                    487                                 
488                                 ca se 'Featur ed':   488                                 ca se 'Featur ed':
489                                      $mValue  = (bool)$m Value;   489                                      $mValue  = (bool)$m Value;
490                                 br eak;   490                                 br eak;
491                             }   491                             }
492                         break;   492                         break;
493                    }   493                    }
494                       494                    
495                    $aVa lues[$sIte mName] = $ mValue;   495                    $aVa lues[$sIte mName] = $ mValue;
496                }   496                }
497           }   497           }
498              498           
499           re turn $aVal ues;   499           re turn $aVal ues;
500       }   500       }
501          501       
502       // rev erse of pr evious fun ction. con vert intui tive array  to text a rray   502       // rev erse of pr evious fun ction. con vert intui tive array  to text a rray
503       functi on getProf ileFromVal ues( $aVal ues ) {   503       functi on getProf ileFromVal ues( $aVal ues ) {
504           $a Profile =  array();   504           $a Profile =  array();
505              505           
506            foreach(   $ this   ->   aBlocks   as   $aBlock   )   {   506           if ( $this ->  iAreaID = = 1 ) {
    507                $aBlocks  = array() ;
    508                foreach(  array_key s( $this - > aArea )  as $iPage  )
    509                    $aBl ocks = arr ay_merge(  $aBlocks,  $this -> a Area[ $iPa ge ] );
    510           }  else
    511                $aBlocks  = $this - > aBlocks;
    512           
    513            foreach(   $
aBlocks   as   $aBlock   )   {
507                foreach(  $aBlock[' Items'] as  $aItem )  {   514                foreach(  $aBlock[' Items'] as  $aItem )  {
508                    $sIt emName = $ aItem['Nam e'];   515                    $sIt emName = $ aItem['Nam e'];
509                    if(  !array_key _exists( $ sItemName,  $aValues  ) )   516                    if(  !array_key _exists( $ sItemName,  $aValues  ) )
510                         continue;  //pass thi s   517                         continue;  //pass thi s
511                       518                    
512                    $mVa lue = $aVa lues[$sIte mName];   519                    $mVa lue = $aVa lues[$sIte mName];
513                       520                    
514                    swit ch( $aItem ['Type'] )  {   521                    swit ch( $aItem ['Type'] )  {
515                         case 'date ':   522                         case 'date ':
516                             $aDate  = explode ( '/', $mV alue );   523                             $aDate  = explode ( '/', $mV alue );
517                             $mValu e = sprint f( '%04d-% 02d-%02d',  $aDate[2] , $aDate[1 ], $aDate[ 0] );   524                             $mValu e = sprint f( '%04d-% 02d-%02d',  $aDate[2] , $aDate[1 ], $aDate[ 0] );
518                         break;   525                         break;
519                           526                        
520                         //impl oth ers   527                         //impl oth ers
521                    }   528                    }
522                       529                    
523                    $aPr ofile[$sIt emName] =  $mValue;   530                    $aPr ofile[$sIt emName] =  $mValue;
524                }   531                }
525           }   532           }
526              533           
527           re turn $aPro file;   534           re turn $aPro file;
528       }   535       }
529          536       
530       //inte rnal funct ion   537       //inte rnal funct ion
531       functi on _getCou pleMutualF ields() {   538       functi on _getCou pleMutualF ields() {
532           $a AllItems =  $this ->  aCache[100 ][0]['Item s'];   539           $a AllItems =  $this ->  aCache[100 ][0]['Item s'];
533              540           
534           $t his -> aCo upleMutual  = array(  'NickName' , 'Passwor d', 'Email ' );   541           $t his -> aCo upleMutual  = array(  'NickName' , 'Passwor d', 'Email ' );
535              542           
536           fo reach( $aA llItems as  $aItem )  {   543           fo reach( $aA llItems as  $aItem )  {
537                if( $aIt em['Name']  == 'Coupl e' )   544                if( $aIt em['Name']  == 'Coupl e' )
538                    $thi s -> aCoup leMutual =  array_mer ge( $this  -> aCouple Mutual, ex plode( "\n ", $aItem[ 'Extra'] )  ); // add  specified  values   545                    $thi s -> aCoup leMutual =  array_mer ge( $this  -> aCouple Mutual, ex plode( "\n ", $aItem[ 'Extra'] )  ); // add  specified  values
539                   546                
540                if( $aIt em['Type']  == 'syste m' )   547                if( $aIt em['Type']  == 'syste m' )
541                    $thi s -> aCoup leMutual[]  = $aItem[ 'Name'];   548                    $thi s -> aCoup leMutual[]  = $aItem[ 'Name'];
542           }   549           }
543              550           
544           // echoDbg( $ this -> aC oupleMutua l );   551           // echoDbg( $ this -> aC oupleMutua l );
545       }   552       }
546          553       
547       //exte rnal funct ion   554       //exte rnal funct ion
548       functi on getCoup leMutualFi elds() {   555       functi on getCoup leMutualFi elds() {
549           re turn $this  -> aCoupl eMutual;   556           re turn $this  -> aCoupl eMutual;
550       }   557       }
551          558       
552       functi on getView ableValue(  $aItem, $ sValue ) {   559       functi on getView ableValue(  $aItem, $ sValue ) {
553           sw itch( $aIt em['Type']  ) {   560           sw itch( $aIt em['Type']  ) {
554                case 'te xt':   561                case 'te xt':
555                case 'nu m':   562                case 'nu m':
556                case 'ar ea':   563                case 'ar ea':
557                     return  
htmlspecia lchars_adv ($sValue)
;
  564                     return   nl2br( htmlspecia lchars_adv ($sValue) ) ;
558                   565                
559                case 'da te':   566                case 'da te':
560                    retu rn $this - > getViewa bleDate( $ sValue );   567                    retu rn $this - > getViewa bleDate( $ sValue );
561                       568                    
562                case 'ra nge':   569                case 'ra nge':
563                     return   htmlspecia lchars_adv (   str
replace(   ',',   '   -   ',$sValue   )   );
  570                     return   htmlspecia lchars_adv (   str _ replace(   ',',   '   -   ',$sValue   )   );
564                   571                
565                case 'bo ol':   572                case 'bo ol':
566                    retu rn _t( $sV alue ? '_Y es' : '_No ' );   573                    retu rn _t( $sV alue ? '_Y es' : '_No ' );
567                   574                
568                case 'se lect_one':   575                case 'se lect_one':
569                    retu rn $this - > getViewa bleSelectO ne( $aItem ['Values'] , $sValue  );   576                    retu rn $this - > getViewa bleSelectO ne( $aItem ['Values'] , $sValue  );
570                       577                    
571                case 'se lect_set':   578                case 'se lect_set':
572                    retu rn $this - > getViewa bleSelectS et( $aItem ['Values'] , $sValue  );   579                    retu rn $this - > getViewa bleSelectS et( $aItem ['Values'] , $sValue  );
573                   580                
574                   581                
575                case 'sy stem':   582                case 'sy stem':
576                    swit ch( $aItem ['Name'] )  {   583                    swit ch( $aItem ['Name'] )  {
577                         case 'Date Reg':   584                         case 'Date Reg':
578                         case 'Date LastEdit':   585                         case 'Date LastEdit':
579                         case 'Date LastLogin' :   586                         case 'Date LastLogin' :
580                             return  $this ->  getViewabl eDate( $sV alue );   587                             return  $this ->  getViewabl eDate( $sV alue );
581                                588                             
582                         case 'Stat us':   589                         case 'Stat us':
583                             return  _t( "_$sV alue" );   590                             return  _t( "_$sV alue" );
584                           591                        
585                         case 'ID':   592                         case 'ID':
586                             return  $sValue;   593                             return  $sValue;
587                           594                        
588                         case 'Feat ured':   595                         case 'Feat ured':
589                             return  _t( $sVal ue ? '_Yes ' : '_No'  );   596                             return  _t( $sVal ue ? '_Yes ' : '_No'  );
590                           597                        
591                         default:   598                         default:
592                             return  '&nbsp;';   599                             return  '&nbsp;';
593                    }   600                    }
594                break;   601                break;
595                   602                
596                case 'pa ss':   603                case 'pa ss':
597                default:   604                default:
598                    retu rn '&nbsp; ';   605                    retu rn '&nbsp; ';
599           }   606           }
600       }   607       }
601          608       
602       functi on getView ableDate(  $sDate ) {   609       functi on getView ableDate(  $sDate ) {
603           re turn $sDat e;   610           re turn $sDat e;
604       }   611       }
605          612       
606       functi on getView ableSelect One( $mVal ues, $sVal ue, $sUseL Key = 'LKe y' ) {   613       functi on getView ableSelect One( $mVal ues, $sVal ue, $sUseL Key = 'LKe y' ) {
607           gl obal $aPre Values;   614           gl obal $aPre Values;
608              615           
609           if ( is_strin g($mValues ) and subs tr($mValue s, 0, 2) = = '#!' ) {   616           if ( is_strin g($mValues ) and subs tr($mValue s, 0, 2) = = '#!' ) {
610                $sKey =  substr($mV alues, 2);   617                $sKey =  substr($mV alues, 2);
611     618  
612                if( !iss et( $aPreV alues[$sKe y][$sUseLK ey] ) )   619                if( !iss et( $aPreV alues[$sKe y][$sUseLK ey] ) )
613                    $sUs eLKey = 'L Key';   620                    $sUs eLKey = 'L Key';
614     621  
615                return h tmlspecial chars_adv(  _t( $aPre Values[$sK ey][$sValu e][$sUseLK ey] ) );   622                return h tmlspecial chars_adv(  _t( $aPre Values[$sK ey][$sValu e][$sUseLK ey] ) );
616           }  elseif( is _array($mV alues) ) {   623           }  elseif( is _array($mV alues) ) {
617                if( in_a rray($sVal ue, $mValu es) )   624                if( in_a rray($sVal ue, $mValu es) )
618                    retu rn htmlspe cialchars_ adv( _t( " _FieldValu es_{$sValu e}" ) );   625                    retu rn htmlspe cialchars_ adv( _t( " _FieldValu es_{$sValu e}" ) );
619                    //re turn htmls pecialchar s_adv( _t(  "_$sValue " ) );   626                    //re turn htmls pecialchar s_adv( _t(  "_$sValue " ) );
620                else   627                else
621                    retu rn '';   628                    retu rn '';
622           }  else   629           }  else
623                return ' ';   630                return ' ';
624       }   631       }
625          632       
626       functi on getView ableSelect Set( $mVal ues, $sVal ue, $sUseL Key = 'LKe y' ) {   633       functi on getView ableSelect Set( $mVal ues, $sVal ue, $sUseL Key = 'LKe y' ) {
627           gl obal $aPre Values;   634           gl obal $aPre Values;
628              635           
629           if ( is_strin g($mValues ) and subs tr($mValue s, 0, 2) = = '#!' ) {   636           if ( is_strin g($mValues ) and subs tr($mValue s, 0, 2) = = '#!' ) {
630                $sKey =  substr($mV alues, 2);   637                $sKey =  substr($mV alues, 2);
631                if( !iss et( $aPreV alues[$sKe y] ) )   638                if( !iss et( $aPreV alues[$sKe y] ) )
632                    retu rn '&nbsp; ';   639                    retu rn '&nbsp; ';
633                   640                
634                $aValues  = explode ( ',', $sV alue );   641                $aValues  = explode ( ',', $sV alue );
635                   642                
636                $aTValue s = array( );   643                $aTValue s = array( );
637                   644                
638                foreach(  $aValues  as $sValue  )   645                foreach(  $aValues  as $sValue  )
639                    $aTV alues[] =  _t( $aPreV alues[$sKe y][$sValue ][$sUseLKe y] );   646                    $aTV alues[] =  _t( $aPreV alues[$sKe y][$sValue ][$sUseLKe y] );
640                   647                
641                return h tmlspecial chars_adv(  implode(  ', ', $aTV alues ) );   648                return h tmlspecial chars_adv(  implode(  ', ', $aTV alues ) );
642           }  elseif( is _array($mV alues) ) {   649           }  elseif( is _array($mV alues) ) {
643                $aValues  = array() ;   650                $aValues  = array() ;
644                foreach(  explode(  ',', $sVal ue ) as $s ValueOne )   651                foreach(  explode(  ',', $sVal ue ) as $s ValueOne )
645                    $aVa lues[] = _ t( "_Field Values_{$s ValueOne}"  );   652                    $aVa lues[] = _ t( "_Field Values_{$s ValueOne}"  );
646                    //$a Values[] =  _t( "_$sV alueOne" ) ;   653                    //$a Values[] =  _t( "_$sV alueOne" ) ;
647                   654                
648                return h tmlspecial chars_adv(  implode(  ', ', $aVa lues ) );   655                return h tmlspecial chars_adv(  implode(  ', ', $aVa lues ) );
649           }  else   656           }  else
650                return ' ';   657                return ' ';
651       }   658       }
652          659       
653       functi on collect SearchRequ estParams( ) {   660       functi on collect SearchRequ estParams( ) {
654           $a Params = a rray();   661           $a Params = a rray();
655              662           
656           if ( empty($_ GET) and e mpty($_POS T) )   663           if ( empty($_ GET) and e mpty($_POS T) )
657                return $ aParams;   664                return $ aParams;
658              665           
659           fo reach( $th is -> aBlo cks as $aB lock ) {   666           fo reach( $th is -> aBlo cks as $aB lock ) {
660                foreach(  $aBlock[' Items'] as  $aItem )  {   667                foreach(  $aBlock[' Items'] as  $aItem )  {
661                    $sIt emName = $ aItem['Nam e'];   668                    $sIt emName = $ aItem['Nam e'];
662                    $mVa lue = null ;   669                    $mVa lue = null ;
663                       670                    
664                    swit ch( $aItem ['Type'] )  {   671                    swit ch( $aItem ['Type'] )  {
665                         case 'text ':   672                         case 'text ':
666                         case 'area ':   673                         case 'area ':
667                             if( is set( $_REQ UEST[$sIte mName] ) a nd $_REQUE ST[$sItemN ame] )   674                             if( is set( $_REQ UEST[$sIte mName] ) a nd $_REQUE ST[$sItemN ame] )
668                                 $m Value = pr ocess_pass _data( $_R EQUEST[$sI temName] ) ;   675                                 $m Value = pr ocess_pass _data( $_R EQUEST[$sI temName] ) ;
669                         break;   676                         break;
670                           677                        
671                         case 'num' :   678                         case 'num' :
672                         case 'date ':   679                         case 'date ':
673                         case 'rang e':   680                         case 'rang e':
674                             if( is set( $_REQ UEST[$sIte mName] ) a nd is_arra y( $_REQUE ST[$sItemN ame] ) ) {   681                             if( is set( $_REQ UEST[$sIte mName] ) a nd is_arra y( $_REQUE ST[$sItemN ame] ) ) {
675                                 $m Value = ar ray();   682                                 $m Value = ar ray();
676                                    683                                 
677                                 $m Value[0] =  (int)$_RE QUEST[$sIt emName][0] ;   684                                 $m Value[0] =  (int)$_RE QUEST[$sIt emName][0] ;
678                                 $m Value[1] =  (int)$_RE QUEST[$sIt emName][1] ;   685                                 $m Value[1] =  (int)$_RE QUEST[$sIt emName][1] ;
679                                    686                                 
680                                 if ( !$mValue [0] and !$ mValue[1]  )   687                                 if ( !$mValue [0] and !$ mValue[1]  )
681                                      $mValue  = null; //  if no val ues entere d, skip th em   688                                      $mValue  = null; //  if no val ues entere d, skip th em
682                             }   689                             }
683                         break;   690                         break;
684                           691                        
685                         case 'sele ct_one':   692                         case 'sele ct_one':
686                         case 'sele ct_set':   693                         case 'sele ct_set':
687                             if( is set( $_REQ UEST[$sIte mName] ) a nd is_arra y( $_REQUE ST[$sItemN ame] ) ) {   694                             if( is set( $_REQ UEST[$sIte mName] ) a nd is_arra y( $_REQUE ST[$sItemN ame] ) ) {
688                                 $m Value = ar ray();   695                                 $m Value = ar ray();
689                                    696                                 
690                                 fo reach( $_R EQUEST[$sI temName] a s $sValue  ) {   697                                 fo reach( $_R EQUEST[$sI temName] a s $sValue  ) {
691                                      $sValue  = trim( pr ocess_pass _data( $sV alue ) );   698                                      $sValue  = trim( pr ocess_pass _data( $sV alue ) );
692                                      if( $sVa lue )   699                                      if( $sVa lue )
693                                          $mVa lue[] = $s Value;   700                                          $mVa lue[] = $s Value;
694                                 }   701                                 }
695                                    702                                 
696                                 if ( empty( $ mValue ) )   703                                 if ( empty( $ mValue ) )
697                                      $mValue  = null; // if nothing  selected,  skip   704                                      $mValue  = null; // if nothing  selected,  skip
698                             }   705                             }
699                         break;   706                         break;
700                           707                        
701                         case 'bool ':   708                         case 'bool ':
702                             if( is set( $_REQ UEST[$sIte mName] ) a nd $_REQUE ST[$sItemN ame] )   709                             if( is set( $_REQ UEST[$sIte mName] ) a nd $_REQUE ST[$sItemN ame] )
703                                 $m Value = tr ue;   710                                 $m Value = tr ue;
704                         break;   711                         break;
705                           712                        
706                         case 'syst em':   713                         case 'syst em':
707                             switch ( $sItemNa me ) {   714                             switch ( $sItemNa me ) {
708                                 ca se 'ID':   715                                 ca se 'ID':
709                                      if( isse t( $_REQUE ST[$sItemN ame] ) and  (int)$_RE QUEST[$sIt emName] )   716                                      if( isse t( $_REQUE ST[$sItemN ame] ) and  (int)$_RE QUEST[$sIt emName] )
710                                          $mVa lue = (int )$_REQUEST [$sItemNam e];   717                                          $mVa lue = (int )$_REQUEST [$sItemNam e];
711                                 br eak;   718                                 br eak;
712                                    719                                 
713                                 ca se 'Couple ':   720                                 ca se 'Couple ':
714                                      if( isse t( $_REQUE ST[$sItemN ame] ) and  is_array(  $_REQUEST [$sItemNam e] ) ) {   721                                      if( isse t( $_REQUE ST[$sItemN ame] ) and  is_array(  $_REQUEST [$sItemNam e] ) ) {
715                                          if(  isset( $_R EQUEST[$sI temName][0 ] ) and is set( $_REQ UEST[$sIte mName][1]  ) )   722                                          if(  isset( $_R EQUEST[$sI temName][0 ] ) and is set( $_REQ UEST[$sIte mName][1]  ) )
716                                               $mValue =  '-1'; //pa ss   723                                               $mValue =  '-1'; //pa ss
717                                          else if( isset(  $_REQUEST [$sItemNam e][0] ) )   724                                          else if( isset(  $_REQUEST [$sItemNam e][0] ) )
718                                               $mValue =  0;   725                                               $mValue =  0;
719                                          else if( isset(  $_REQUEST [$sItemNam e][1] ) )   726                                          else if( isset(  $_REQUEST [$sItemNam e][1] ) )
720                                               $mValue =  1;   727                                               $mValue =  1;
721                                      }   728                                      }
722                                 br eak;   729                                 br eak;
723                                    730                                 
724                                 ca se 'Locati on':   731                                 ca se 'Locati on':
725                                         732                                      
726                                 br eak;   733                                 br eak;
727                                    734                                 
728                                 ca se 'Keywor d':   735                                 ca se 'Keywor d':
729                                      if( isse t( $_REQUE ST[$sItemN ame] ) and  trim( $_R EQUEST[$sI temName] )  )   736                                      if( isse t( $_REQUE ST[$sItemN ame] ) and  trim( $_R EQUEST[$sI temName] )  )
730                                          $mVa lue = trim ( process_ pass_data(  $mValue )  );   737                                          $mVa lue = trim ( process_ pass_data(  $mValue )  );
731                                 br eak;   738                                 br eak;
732                                    739                                 
733                             }   740                             }
734                         break;   741                         break;
735                    }   742                    }
736                       743                    
737                    if(  !is_null(  $mValue )  )   744                    if(  !is_null(  $mValue )  )
738                         $aParams[  $sItemName  ] = $mVal ue;   745                         $aParams[  $sItemName  ] = $mVal ue;
739                }   746                }
740           }   747           }
741              748           
742           re turn $aPar ams;   749           re turn $aPar ams;
743       }   750       }
744          751       
745       functi on getProf ilesMatch(  $aProf1,  $aProf2 )  {   752       functi on getProf ilesMatch(  $aProf1,  $aProf2 )  {
746           if ( !$this - > aArea )   753           if ( !$this - > aArea )
747                return 0 ;   754                return 0 ;
748              755           
749           $a Fields1 =  $this -> a Blocks[0][ 'Items'];   756           $a Fields1 =  $this -> a Blocks[0][ 'Items'];
750           $a Fields2 =  $this -> a Cache[100] [0]['Items '];   757           $a Fields2 =  $this -> a Cache[100] [0]['Items '];
751              758           
752           $i MyPercent  = 0;   759           $i MyPercent  = 0;
753           $i TotalPerce nt = 0;   760           $i TotalPerce nt = 0;
754           fo reach( $aF ields1 as  $aField1 )  {   761           fo reach( $aF ields1 as  $aField1 )  {
755                $aField2  = $aField s2[ $aFiel d1['MatchF ield'] ];   762                $aField2  = $aField s2[ $aFiel d1['MatchF ield'] ];
756                if( !$aF ield2 )   763                if( !$aF ield2 )
757                    cont inue;   764                    cont inue;
758                   765                
759                $iTotalP ercent +=  $aField1[' MatchPerce nt'];   766                $iTotalP ercent +=  $aField1[' MatchPerce nt'];
760                   767                
761                $sVal1 =  $aProf1[  $aField1[' Name'] ];   768                $sVal1 =  $aProf1[  $aField1[' Name'] ];
762                $sVal2 =  $aProf2[  $aField2[' Name'] ];   769                $sVal2 =  $aProf2[  $aField2[' Name'] ];
763                   770                
764                if( !str len($sVal1 ) or !strl en($sVal2)  )   771                if( !str len($sVal1 ) or !strl en($sVal2)  )
765                    cont inue;   772                    cont inue;
766                   773                
767                $iAddPar t = 0;   774                $iAddPar t = 0;
768                switch(  "{$aField1 ['Type']}  {$aField1[ 'Type']}"  ) {   775                switch(  "{$aField1 ['Type']}  {$aField1[ 'Type']}"  ) {
769                    case  'select_s et select_ one':   776                    case  'select_s et select_ one':
770                         $aVal1 = e xplode( ', ', $sVal1  );   777                         $aVal1 = e xplode( ', ', $sVal1  );
771                           778                        
772                         if( in_arr ay( $sVal2 , $aVal1 )  )   779                         if( in_arr ay( $sVal2 , $aVal1 )  )
773                             $iAddP art = 1;   780                             $iAddP art = 1;
774                    brea k;   781                    brea k;
775                       782                    
776                    case  'select_o ne select_ set':   783                    case  'select_o ne select_ set':
777                         $aVal2 = e xplode( ', ', $sVal2  );   784                         $aVal2 = e xplode( ', ', $sVal2  );
778                           785                        
779                         if( in_arr ay( $sVal1 , $aVal2 )  )   786                         if( in_arr ay( $sVal1 , $aVal2 )  )
780                             $iAddP art = 1;   787                             $iAddP art = 1;
781                    brea k;   788                    brea k;
782                       789                    
783                    case  'select_s et select_ set':   790                    case  'select_s et select_ set':
784                         $aVal1 = e xplode( ', ', $sVal1  );   791                         $aVal1 = e xplode( ', ', $sVal1  );
785                         $aVal2 = e xplode( ', ', $sVal2  );   792                         $aVal2 = e xplode( ', ', $sVal2  );
786                           793                        
787                         $iFound =  0;   794                         $iFound =  0;
788                         foreach( $ aVal1 as $ sTempVal1  ) {   795                         foreach( $ aVal1 as $ sTempVal1  ) {
789                             if( in _array( $s TempVal1,  $aVal2 ) )   796                             if( in _array( $s TempVal1,  $aVal2 ) )
790                                 $i Found ++;   797                                 $i Found ++;
791                         }   798                         }
792                           799                        
793                         $iAddPart  = $iFound  / count( $ aVal1 );   800                         $iAddPart  = $iFound  / count( $ aVal1 );
794                    brea k;   801                    brea k;
795                       802                    
796                    case  'range nu m':   803                    case  'range nu m':
797                         $aVal1 = e xplode( ', ', $sVal1  );   804                         $aVal1 = e xplode( ', ', $sVal1  );
798                         $sVal2 = ( int)$sVal2 ;   805                         $sVal2 = ( int)$sVal2 ;
799                           806                        
800                         if( (int)$ aVal1[0] < = $sVal2 a nd $sVal2  <= (int)$a Val1[0] )   807                         if( (int)$ aVal1[0] < = $sVal2 a nd $sVal2  <= (int)$a Val1[0] )
801                             $iAddP art = 1;   808                             $iAddP art = 1;
802                    brea k;   809                    brea k;
803                       810                    
804                    case  'range da te':   811                    case  'range da te':
805                         $aVal1 = e xplode( ', ', $sVal1  );   812                         $aVal1 = e xplode( ', ', $sVal1  );
806                           813                        
807                         $aDate = e xplode( '- ', $sVal2  );   814                         $aDate = e xplode( '- ', $sVal2  );
808                         $sVal2 = s printf( '% d/%d/%d',  $aDate[2],  $aDate[1] , $aDate[0 ] );   815                         $sVal2 = s printf( '% d/%d/%d',  $aDate[2],  $aDate[1] , $aDate[0 ] );
809                         $sAge = $t his -> get Age( $sVal 2 );   816                         $sAge = $t his -> get Age( $sVal 2 );
810                           817                        
811                         if( (int)$ aVal1[0] < = $sVal2 a nd $sVal2  <= (int)$a Val1[0] )   818                         if( (int)$ aVal1[0] < = $sVal2 a nd $sVal2  <= (int)$a Val1[0] )
812                             $iAddP art = 1;   819                             $iAddP art = 1;
813                    brea k;   820                    brea k;
814                       821                    
815                    defa ult:   822                    defa ult:
816                         if( $sVal1  == $sVal2  )   823                         if( $sVal1  == $sVal2  )
817                             $iAddP art = 1;   824                             $iAddP art = 1;
818                }   825                }
819                   826                
820                $iMyPerc ent    +=  round( $aF ield1['Mat chPercent' ] * $iAddP art );   827                $iMyPerc ent    +=  round( $aF ield1['Mat chPercent' ] * $iAddP art );
821           }   828           }
822              829           
823           if ( $iTotalP ercent !=  100 && $iT otalPercen t != 0 )   830           if ( $iTotalP ercent !=  100 && $iT otalPercen t != 0 )
824                $iMyPerc ent = (int )( ( $iMyP ercent / $ iTotalPerc ent ) * 10 0 );   831                $iMyPerc ent = (int )( ( $iMyP ercent / $ iTotalPerc ent ) * 10 0 );
825              832           
826           re turn $iMyP ercent;   833           re turn $iMyP ercent;
827       }   834       }
828   }   835   }