Cheetah
ChWsbProfileFields.php
Go to the documentation of this file.
1 <?php
2 
8 require_once( CH_DIRECTORY_PATH_CLASSES . 'Thing.php' );
9 require_once( CH_DIRECTORY_PATH_CLASSES . 'ChWsbPFM.php' );
10 require_once( CH_DIRECTORY_PATH_CLASSES . 'ChWsbPrivacy.php' );
11 
13 {
14  var $iAreaID;
15  var $aArea; // just a cache array
16  var $aBlocks; // array of current blocks
17  var $aCache; // full cache of profile fields
18  var $aCoupleMutual; //couple mutual fields
19  var $aCoupleMutualCopy; //couple mutual fields, which values should be coppied in second profile.
20 
21  var $sLinkPref = '#!'; //prefix for values links
22 
23  var $aAddPleaseSelect = array(
24  'join' => array('Country', 'Sex'),
25  );
26 
27  function __construct( $iAreaID )
28  {
29  $this -> iAreaID = $iAreaID;
30 
31  if( !$this -> loadCache() )
32  return false;
33 
34  }
35 
36  function loadCache( $bCycle = true )
37  {
38  $oCache = $GLOBALS['MySQL']->getDbCacheObject();
39  $this -> aCache = $oCache->getData($GLOBALS['MySQL']->genDbCacheKey('sys_profile_fields'));
40  if (null === $this -> aCache || !is_array($this->aCache)) {
41 
42  $oPFM = new ChWsbPFMCacher();
43 
44  if (!$oPFM -> createCache())
45  return false;
46 
47  if ($bCycle) //to prevent cycling
48  return $this -> loadCache (false); // try againg
49  else
50  return false;
51  }
52 
53  $bBotCheck = ('on' == getParam(sys_antispam_bot_check) ? true : false);
54  if($bBotCheck) {
55  $iJoinBlock = $GLOBALS['MySQL']->getOne("SELECT `JoinBlock` FROM `sys_profile_fields` WHERE `Name` = 'Password'");
56  if($this -> iAreaID == 1) {
57  $this -> aCache[1][0][$iJoinBlock]['Items'][] = array(
58  'Name' => 'starttime',
59  'Type' => 'text',
60  'Control' => '',
61  'Extra' => '',
62  'Min' => '0',
63  'Max' => '512',
64  'Values' => '',
65  'Check' => '',
66  'Unique' => '',
67  'Mandatory' => '',
68  'UseLKey' => 'LKey',
69  'Default' => 'spam',
70  'Caption' => '',
71  'Desc' => '',
72  'MandatoryMsg' => '',
73  'MinMsg' => '',
74  'MaxMsg' => '',
75  'UniqueMsg' => '',
76  'CheckMsg' => '',
77  );
78  $this -> aCache[1][0][$iJoinBlock]['Items'][] = array(
79  'Name' => 'youremail',
80  'Type' => 'text',
81  'Control' => '',
82  'Extra' => '',
83  'Min' => '0',
84  'Max' => '512',
85  'Values' => '',
86  'Check' => '',
87  'Unique' => '',
88  'Mandatory' => '',
89  'UseLKey' => 'LKey',
90  'Default' => 'spam',
91  'Caption' => '',
92  'Desc' => '',
93  'MandatoryMsg' => '',
94  'MinMsg' => '',
95  'MaxMsg' => '',
96  'UniqueMsg' => '',
97  'CheckMsg' => '',
98  );
99  $this -> aCache[1][0][$iJoinBlock]['Items'][] = array(
100  'Name' => 'reg_email',
101  'Type' => 'text',
102  'Control' => '',
103  'Extra' => '',
104  'Min' => '0',
105  'Max' => '512',
106  'Values' => '',
107  'Check' => '',
108  'Unique' => '',
109  'Mandatory' => '',
110  'UseLKey' => 'LKey',
111  'Default' => 'spam',
112  'Caption' => '',
113  'Desc' => '',
114  'MandatoryMsg' => '',
115  'MinMsg' => '',
116  'MaxMsg' => '',
117  'UniqueMsg' => '',
118  'CheckMsg' => '',
119  );
120  $this -> aCache[1][0][$iJoinBlock]['Items'][] = array(
121  'Name' => 'reg_name',
122  'Type' => 'text',
123  'Control' => '',
124  'Extra' => '',
125  'Min' => '0',
126  'Max' => '512',
127  'Values' => '',
128  'Check' => '',
129  'Unique' => '',
130  'Mandatory' => '',
131  'UseLKey' => 'LKey',
132  'Default' => 'spam',
133  'Caption' => '',
134  'Desc' => '',
135  'MandatoryMsg' => '',
136  'MinMsg' => '',
137  'MaxMsg' => '',
138  'UniqueMsg' => '',
139  'CheckMsg' => '',
140  );
141  $this -> aCache[1][0][$iJoinBlock]['Items'][] = array(
142  'Name' => 'reg_nickname',
143  'Type' => 'text',
144  'Control' => '',
145  'Extra' => '',
146  'Min' => '0',
147  'Max' => '512',
148  'Values' => '',
149  'Check' => '',
150  'Unique' => '',
151  'Mandatory' => '',
152  'UseLKey' => 'LKey',
153  'Default' => 'spam',
154  'Caption' => '',
155  'Desc' => '',
156  'MandatoryMsg' => '',
157  'MinMsg' => '',
158  'MaxMsg' => '',
159  'UniqueMsg' => '',
160  'CheckMsg' => '',
161  );
162 
163  $this -> aCache[100][0]['Items'][] = array(
164  'Name' => 'starttime',
165  'Type' => 'text',
166  'Default' => 'spam',
167  'Unique' => '',
168  'Extra' => '',
169  );
170  $this -> aCache[100][0]['Items'][] = array(
171  'Name' => 'youremail',
172  'Type' => 'text',
173  'Default' => 'spam',
174  'Unique' => '',
175  'Extra' => '',
176  );
177  $this -> aCache[100][0]['Items'][] = array(
178  'Name' => 'reg_email',
179  'Type' => 'text',
180  'Default' => 'spam',
181  'Unique' => '',
182  'Extra' => '',
183  );
184  $this -> aCache[100][0]['Items'][] = array(
185  'Name' => 'reg_name',
186  'Type' => 'text',
187  'Default' => 'spam',
188  'Unique' => '',
189  'Extra' => '',
190  );
191  $this -> aCache[100][0]['Items'][] = array(
192  'Name' => 'reg_nickname',
193  'Type' => 'text',
194  'Default' => 'spam',
195  'Unique' => '',
196  'Extra' => '',
197  );
198  }
199  }
200 
201  $this -> aArea = $this -> aCache[ $this -> iAreaID ];
202 
203  //load blocks
204  $this -> aBlocks = $this -> aArea;
205 
206  //get mutual fields
207  $this -> _getCoupleMutualFields();
208 
209  return true;
210  }
211 
212  function genJsonErrors( $aErrors, $bCouple )
213  {
214  $aJsonErrors = array();
215 
216  $aJsonErrors[0] = $aErrors[0];
217  if( $bCouple )
218  $aJsonErrors[1] = $aErrors[1];
219 
220  return json_encode( $aJsonErrors );
221  }
222 
223  //sets to $Errors intuitive array
224  function processPostValues( $bCouple, &$aValues, &$aErrors, $iPage = 0, $iProfileID = 0, $iBlockOnly = 0 )
225  {
226  $iHumans = $bCouple ? 2 : 1; // number of members in profile (single/couple), made for double arrays
227 
228  if( $this -> iAreaID == 1 ) // join
229  $this -> aBlocks = $this -> aArea[$iPage];
230 
231  foreach( $this -> aBlocks as $iBlockID => $aBlock ) {
232  if ($iBlockOnly > 0 and $iBlockOnly != $iBlockID)
233  continue;
234 
235  $aItems = $aBlock['Items'];
236  foreach ($aItems as $iItemID => $aItem) {
237  $sItemName = $aItem['Name'];
238 
239  for( $iHuman = 0; $iHuman < $iHumans; $iHuman ++ ) {
240  if( $iHuman == 1 and in_array( $sItemName, $this -> aCoupleMutual ) )
241  continue;
242 
243  $mValue = null;
244  switch( $aItem['Type'] ) {
245  case 'text':
246  case 'area':
247  case 'pass':
248  case 'select_one':
249  if( isset( $_POST[$sItemName] ) and isset( $_POST[$sItemName][$iHuman] ) )
250  $mValue = process_pass_data( $_POST[$sItemName][$iHuman] );
251  break;
252 
253  case 'html_area':
254  if( isset( $_POST[$sItemName] ) and isset( $_POST[$sItemName][$iHuman] ) )
255  $mValue = clear_xss( process_pass_data($_POST[$sItemName][$iHuman]) );
256  break;
257 
258  case 'bool':
259  if( isset( $_POST[$sItemName] ) and isset( $_POST[$sItemName][$iHuman] ) and $_POST[$sItemName][$iHuman] == 'yes' )
260  $mValue = true;
261  else
262  $mValue = false;
263  break;
264 
265  case 'num':
266  if( isset( $_POST[$sItemName] ) and isset( $_POST[$sItemName][$iHuman] ) and trim( $_POST[$sItemName][$iHuman] ) !== '' )
267  $mValue = (int)trim( $_POST[$sItemName][$iHuman] );
268  break;
269 
270  case 'date':
271  if( isset( $_POST[$sItemName] ) and isset( $_POST[$sItemName][$iHuman] ) and trim( $_POST[$sItemName][$iHuman] ) !== '' ) {
272  list( $iYear, $iMonth, $iDay ) = explode( '-', $_POST[$sItemName][$iHuman] ); // 1985-10-28
273 
274  $iDay = intval($iDay);
275  $iMonth = intval($iMonth);
276  $iYear = intval($iYear);
277 
278  $mValue = sprintf("%04d-%02d-%02d", $iYear, $iMonth, $iDay);
279  }
280  break;
281 
282  case 'select_set':
283  $mValue = array();
284  if( isset( $_POST[$sItemName] ) and isset( $_POST[$sItemName][$iHuman] ) and is_array( $_POST[$sItemName][$iHuman] ) ) {
285  foreach ($_POST[$sItemName][$iHuman] as $sValue ) {
286  $mValue[] = process_pass_data( $sValue );
287  }
288  }
289  break;
290 
291  case 'range':
292  if( isset( $_POST[$sItemName] ) and isset( $_POST[$sItemName][$iHuman] ) ) {
293  if (is_array($_POST[$sItemName][$iHuman]))
294  $aRange = $_POST[$sItemName][$iHuman];
295  else
296  $aRange = explode('-', $_POST[$sItemName][$iHuman], 2);
297 
298  $mValue = array( null, null );
299 
300  $aRange[0] = isset( $aRange[0] ) ? trim( $aRange[0] ) : '';
301  $aRange[1] = isset( $aRange[1] ) ? trim( $aRange[1] ) : '';
302 
303  if( $aRange[0] !== '' )
304  $mValue[0] = (int)$aRange[0];
305 
306  if( $aRange[1] !== '' )
307  $mValue[1] = (int)$aRange[1];
308  }
309  break;
310 
311  case 'system':
312  switch( $aItem['Name'] ) {
313  case 'Couple':
314  case 'TermsOfUse':
315  case 'Featured': //they are boolean
316  if( isset( $_POST[$sItemName] ) and $_POST[$sItemName] == 'yes' )
317  $mValue = true;
318  else
319  $mValue = false;
320  break;
321 
322  case 'Captcha':
323  case 'Status': // they are select_one
324  if( isset( $_POST[$sItemName] ) )
325  $mValue = process_pass_data( $_POST[$sItemName] );
326  break;
327 
328  case 'ProfilePhoto':
329  if (isset($_FILES['ProfilePhoto'])) {
330  if ($_FILES['ProfilePhoto']['error'] == UPLOAD_ERR_OK) {
331  $sTmpName = tempnam($GLOBALS['dir']['tmp'], 'pphot');
332  if (move_uploaded_file($_FILES['ProfilePhoto']['tmp_name'], $sTmpName))
333  $mValue = basename($sTmpName);
334  }
335  } elseif (isset($_POST['ProfilePhoto']) && trim($_POST['ProfilePhoto'])) {
336  $mValue = preg_replace('/[^a-zA-Z0-9\.]/', '', $_POST['ProfilePhoto']);
337  }
338  break;
339  }
340  break;
341  }
342 
343  $rRes = $this -> checkPostValue( $iBlockID, $iItemID, $mValue, $iHuman, $iProfileID );
344 
345  if( $rRes !== true )
346  $aErrors[$iHuman][$sItemName] = $rRes; //it is returned error text
347 
348  //if password on edit page
349  if( $aItem['Type'] == 'pass' and ( $this -> iAreaID == 2 or $this -> iAreaID == 3 or $this -> iAreaID == 4 ) ) {
350  if( empty($mValue) )
351  $mValue = $aValues[$iHuman][$sItemName];
352  else
353  $mValue = encryptUserPwd($mValue, $aValues[$iHuman]['Salt']);
354  }
355 
356  $aValues[$iHuman][$sItemName] = $mValue;
357  }
358  }
359  }
360  }
361 
362  function checkPostValue( $iBlockID, $iItemID, $mValue, $iHuman, $iProfileID )
363  {
364  // get item
365  $aItem = $this -> aBlocks[$iBlockID]['Items'][$iItemID];
366  if( !$aItem )
367  return 'Item not found';
368 
369  $aChecks = array(
370  'text' => array( 'Mandatory', 'Min', 'Max', 'Unique', 'Check' ),
371  'area' => array( 'Mandatory', 'Min', 'Max', 'Unique', 'Check' ),
372  'html_area' => array( 'Mandatory', 'Min', 'Max', 'Unique', 'Check' ),
373  'pass' => array( 'Mandatory', 'Min', 'Max', 'Check', 'PassConfirm' ),
374  'date' => array( 'Mandatory', 'Min', 'Max', 'Check' ),
375  'select_one' => array( 'Min', 'Max', 'Mandatory', 'Values', 'Check' ),
376  'select_set' => array( 'Min', 'Max', 'Mandatory', 'Values', 'Check' ),
377  'num' => array( 'Mandatory', 'Min', 'Max', 'Unique', 'Check' ),
378  'range' => array( 'Mandatory', 'RangeCorrect', 'Min', 'Max', 'Check' ),
379  'system' => array( 'System' ),
380  'bool' => array( 'Mandatory' )
381  );
382 
383  $aMyChecks = $aChecks[ $aItem['Type'] ];
384 
385  // if ($aItem['Type'] == 'date') return $mValue;
386 
387  foreach ($aMyChecks as $sCheck ) {
388  $sFunc = 'checkPostValueFor' . $sCheck;
389 
390  $mRes = $this -> $sFunc( $aItem, $mValue, $iHuman, $iProfileID );
391 
392  if( $mRes !== true ) {
393  if( is_bool( $mRes ) ) // it is false...
394  return _t( $aItem[ $sCheck . 'Msg' ], $aItem[$sCheck] );
395  else
396  return $mRes; // returned as text
397  }
398  }
399 
400  return true;
401  }
402 
403  function checkPostValueForPassConfirm( $aItem, $mValue, $iHuman )
404  {
405  $sConfPass = process_pass_data( $_POST[ "{$aItem['Name']}_confirm" ][$iHuman] );
406  if( $sConfPass != $mValue )
407  return _t( '_Password confirmation failed' );
408  else
409  return true;
410  }
411 
412  function checkPostValueForRangeCorrect( $aItem, $mValue )
413  {
414  if( is_null($mValue[0]) or is_null($mValue[1]) )
415  return true; // if not set, pass this check
416 
417  if( $mValue[0] > $mValue[1] )
418  return _t( '_First value must be bigger' );
419 
420  return true;
421  }
422 
423  function checkPostValueForMin( $aItem, $mValue )
424  {
425  $iMin = $aItem['Min'];
426  if( is_null($iMin) )
427  return true;
428 
429  if(mb_strlen($mValue) == 0 && !$aItem['Mandatory'])
430  return true;
431 
432  switch( $aItem['Type'] ) {
433  case 'text':
434  case 'area':
435  if( mb_strlen( $mValue ) < $iMin )
436  return false;
437  break;
438 
439  case 'html_area' :
440  if( mb_strlen( strip_tags($mValue) ) < $iMin )
441  return false;
442  break;
443 
444  case 'pass':
445  if( mb_strlen( $mValue ) > 0 and mb_strlen( $mValue ) < $iMin )
446  return false;
447  break;
448 
449  case 'num':
450  if( $mValue < $iMin )
451  return false;
452  break;
453 
454  case 'date':
455  if( $this -> getAge($mValue) < $iMin )
456  return false;
457  break;
458 
459  case 'range':
460  if( $mValue[0] < $iMin || $mValue[1] < $iMin )
461  return false;
462  break;
463 
464  case 'select_set':
465  if( count( $mValue ) < $iMin )
466  return false;
467  break;
468  }
469 
470  return true;
471  }
472 
473  function checkPostValueForMax( $aItem, $mValue )
474  {
475  $iMax = $aItem['Max'];
476  if( is_null($iMax) )
477  return true;
478 
479  if(mb_strlen($mValue) == 0 && !$aItem['Mandatory'])
480  return true;
481 
482  switch( $aItem['Type'] ) {
483  case 'text':
484  case 'area':
485  case 'pass':
486  if( mb_strlen( $mValue ) > $iMax )
487  return false;
488  break;
489 
490  case 'html_area':
491  if( mb_strlen( strip_tags($mValue) ) > $iMax )
492  return false;
493  break;
494 
495  case 'num':
496  if( $mValue > $iMax )
497  return false;
498  break;
499 
500  case 'date':
501  if( $this -> getAge($mValue) > $iMax )
502  return false;
503  break;
504 
505  case 'range':
506  if( $mValue[0] > $iMax || $mValue[1] > $iMax )
507  return false;
508  break;
509 
510  case 'select_set':
511  if( count( $mValue ) > $iMax )
512  return false;
513  break;
514  }
515 
516  return true;
517  }
518 
519  function checkPostValueForUnique( $aItem, $mValue, $iHuman, $iProfileID )
520  {
521  global $logged;
522 
523  if( !$aItem['Unique'] )
524  return true;
525 
526  $iProfileID = (int)$iProfileID;
527  if( $iProfileID ) {
528  $sAdd = "AND `ID` != $iProfileID";
529  } else
530  $sAdd = '';
531 
532  $sQuery = "SELECT COUNT(*) FROM `Profiles` WHERE `{$aItem['Name']}` = ? $sAdd";
533  if( (int)db_value( $sQuery, [$mValue] ) )
534  return false;
535 
536  return true;
537  }
538 
539  function checkPostValueForCheck( $aItem, $mValue )
540  {
541  $sCheck = $aItem['Check'];
542  if( empty($sCheck) )
543  return true;
544 
545  $sFunc = function($arg0) use ($sCheck) {
546  return eval($sCheck);
547  };
548 
549  if( !$sFunc( $mValue ) )
550  return false;
551 
552  return true;
553  }
554 
555  function checkPostValueForMandatory( $aItem, $mValue )
556  {
557  if( !$aItem['Mandatory'] )
558  return true;
559 
560  if( $aItem['Type'] == 'num' ) {
561  if( is_null($mValue) )
562  return false;
563  } elseif( $aItem['Type'] == 'range' ) {
564  if( is_null($mValue[0]) or is_null($mValue[1]) )
565  return false;
566  } elseif( $aItem['Type'] == 'pass' ) {
567  if( $this -> iAreaID == 2 or $this -> iAreaID == 3 or $this -> iAreaID == 4 ) // if area is edit, non-mandatory
568  return true;
569  else
570  if( empty($mValue) ) // standard check
571  return false;
572  } else {
573  if( empty($mValue) )
574  return false;
575  }
576 
577  return true;
578  }
579 
580  function checkPostValueForValues( $aItem, $mValue )
581  {
582  if( empty($mValue) ) //it is not selected
583  return true;
584 
585  if( is_array( $aItem['Values'] ) )
586  $aValues = $aItem['Values'];
587  else
588  $aValues = $this -> getPredefinedKeysArr( $aItem['Values'] );
589 
590  if( !$aValues )
591  return 'Cannot find list';
592 
593  if( $aItem['Type'] == 'select_one' ) {
594  if( !in_array( $mValue, $aValues ) )
595  return 'Value not in list. Hack attempt!';
596  } elseif( $aItem['Type'] == 'select_set' ) {
597  foreach( $mValue as $sValue )
598  if( !in_array( $sValue, $aValues ) )
599  return 'Value not in list. Hack attempt!';
600  }
601 
602  return true;
603  }
604 
605  function getDefaultValues()
606  {
607  $aItems = array();
608  foreach($this -> aCache[100][0]['Items'] as $aItem)
609  if(!empty($aItem["Default"]))
610  $aItems[$aItem["Name"]] = $aItem["Default"];
611  return $aItems;
612  }
613 
614  function getPredefinedKeysArr( $sKey )
615  {
616  global $aPreValues;
617 
618  if( substr( $sKey, 0, 2 ) == $this->sLinkPref )
619  $sKey = substr( $sKey, 2 );
620 
621  return @array_keys( $aPreValues[$sKey] );
622  }
623 
624  function checkPostValueForSystem( $aItem, $mValue )
625  {
626  switch( $aItem['Name'] ) {
627  case 'Captcha':
628  return ( $this -> checkCaptcha( $mValue ) ) ? true : _t( '_Captcha check failed' );
629  break;
630 
631  case 'Status':
632  if( !in_array($mValue, $aItem['Values'] ) )
633  return 'Status hack attempt!';
634  break;
635 
636  case 'Agree':
637  case 'TermsOfUse':
638  ch_import('ChWsbStopForumSpam');
639  $oChWsbStopForumSpam = new ChWsbStopForumSpam();
640  if (2 == getParam('ipBlacklistMode') && ch_is_ip_blocked())
641  return _t('_Sorry, your IP been banned');
642  elseif (('on' == getParam('sys_dnsbl_enable') && 'block' == getParam('sys_dnsbl_behaviour') && ch_is_ip_dns_blacklisted('', 'join')) || $oChWsbStopForumSpam->isSpammer(array('email' => $_POST['Email'][0], 'ip' => getVisitorIP(false)), 'join'))
643  return sprintf(_t('_sys_spam_detected'), CH_WSB_URL_ROOT . 'contact.php');
644  else
645  return $aItem['Name'] != 'TermsOfUse' || $mValue ? true : _t( '_You must agree with terms of use' );
646  break;
647 
648  case 'ProfilePhoto':
649  if ($aItem['Mandatory'] && is_null($mValue))
650  return _t( '_Please specify image file' );
651 
652  if (( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) and $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ))
653  return true;
654 
655  $sFileName = $GLOBALS['dir']['tmp'] . $mValue;
656 
657  if ($mValue && !file_exists($sFileName)) // hack attempt
658  return 'No way! File not exists: ' . $sFileName;
659 
660  $aSize = @getimagesize($sFileName);
661  if ($mValue && !$aSize) {
662  @unlink($sFileName);
663  return _t( '_Please specify image file' );
664  }
665 
666  if ($mValue && $aSize[2] != IMAGETYPE_GIF && $aSize[2] != IMAGETYPE_JPEG && $aSize[2] != IMAGETYPE_PNG) {
667  unlink($sFileName);
668  return _t( '_Please specify image of JPEG, GIF or PNG format' );
669  }
670 
671  return true;
672  break;
673  }
674 
675  return true;
676  }
677 
678  function checkCaptcha( $mValue )
679  {
680  ch_import('ChWsbForm');
681  return (new ChWsbFormCheckerHelper)->checkCaptcha($mValue);
682  }
683 
684  function getAge( $sBirthDate )
685  {
686  /*
687  // Old style 28/10/1985
688  $bd = explode( '/', $sBirthDate );
689  foreach ($bd as $i => $v) $bd[$i] = (int)$v;
690 
691  if ( date('n') > $bd[1] || ( date('n') == $bd[1] && date('j') >= $bd[0] ) )
692  $age = date('Y') - $bd[2];
693  else
694  $age = date('Y') - $bd[2] - 1;
695  */
696 
697  // New style 1985-10-28
698  $bd = explode( '-', $sBirthDate );
699  foreach ($bd as $i => $v) $bd[$i] = intval($v);
700 
701  if (intval(date('n')) > $bd[1] || (intval(date('n')) == $bd[1] && intval(date('j')) >= $bd[2]))
702  $age = intval(date('Y')) - $bd[0];
703  else
704  $age = intval(date('Y')) - $bd[0] - 1;
705 
706  return $age;
707  }
708 
709  // create intuitive array of values from default text profile array (getProfileInfo)
711  {
712  $aValues = array();
713 
714  foreach( $this -> aBlocks as $aBlock ) {
715  foreach( $aBlock['Items'] as $aItem ) {
716  $sItemName = $aItem['Name'];
717  if( !array_key_exists( $sItemName, $aProfile ))
718  continue; //pass this
719 
720  $mValue = $aProfile[$sItemName];
721 
722  switch( $aItem['Type'] ) {
723  case 'select_set':
724  $mValue = explode( ',', $mValue );
725  break;
726 
727  case 'range':
728  $mValue = explode( ',', $mValue );
729  foreach( $mValue as $iInd => $sValue )
730  $mValue[$iInd] = (int)$sValue;
731  break;
732 
733  case 'bool':
734  $mValue = (bool)$mValue;
735  break;
736 
737  case 'num':
738  $mValue = (int)$mValue;
739  break;
740 
741  case 'date':
742  /*
743  $aDate = explode( '-', $mValue ); //YYYY-MM-DD
744  $mValue = (int)$aDate[2] . '/' . (int)$aDate[1] . '/' . $aDate[0];
745  */
746 
747  //return $mValue;
748  break;
749 
750  case 'system':
751  switch( $sItemName ) {
752  case 'Couple':
753  case 'ID':
754  $mValue = (int)$mValue;
755  break;
756 
757  case 'Featured':
758  $mValue = (bool)$mValue;
759  break;
760  }
761  break;
762  }
763 
764  $aValues[$sItemName] = $mValue;
765  }
766  }
767  $aValues['Salt'] = $aProfile['Salt']; // encryptUserPwd
768 
769  return $aValues;
770  }
771 
772  // reverse of previous function. convert intuitive array to text array
773  function getProfileFromValues( $aValues )
774  {
775  $aProfile = array();
776 
777  if( $this -> iAreaID == 1 ) {
778  $aBlocks = array();
779  foreach( array_keys( $this -> aArea ) as $iPage )
780  $aBlocks = array_merge( $aBlocks, $this -> aArea[ $iPage ] );
781  } else
782  $aBlocks = $this -> aBlocks;
783 
784  foreach( $aBlocks as $aBlock ) {
785  foreach( $aBlock['Items'] as $aItem ) {
786  $sItemName = $aItem['Name'];
787  if( !array_key_exists( $sItemName, $aValues ) )
788  continue; //pass this
789 
790  $mValue = $aValues[$sItemName];
791 
792  /*
793  // convertation
794  switch( $aItem['Type'] ) {
795  case 'date':
796  $aDate = explode( '/', $mValue );
797  $mValue = sprintf( '%04d-%02d-%02d', $aDate[2], $aDate[1], $aDate[0] );
798  break;
799 
800  //impl others
801  }
802  */
803 
804  $aProfile[$sItemName] = $mValue;
805  }
806  }
807 
808  return $aProfile;
809  }
810 
811  //internal function
813  {
814  $aAllItems = $this -> aCache[100][0]['Items'];
815 
816  $this -> aCoupleMutual = array( 'NickName', 'Password', 'Email', 'Country', 'City', 'zip', 'EmailNotify' );
817  $this -> aCoupleMutualCopy = array('Country', 'City', 'zip');
818 
819  foreach( $aAllItems as $aItem ) {
820  if( $aItem['Name'] == 'Couple' ) {
821  $a = explode("\n", $aItem['Extra']);
822  array_walk($a, function (&$sItem, $iKey) {
823  $sItem = trim($sItem);
824  });
825  $this -> aCoupleMutual = array_merge( $this -> aCoupleMutual, $a ); // add specified values
826  }
827 
828  if( $aItem['Type'] == 'system' && 'Age' != $aItem['Name'])
829  $this -> aCoupleMutual[] = $aItem['Name'];
830 
831  if( $aItem['Type'] == 'pass' )
832  $this -> aCoupleMutual[] = $aItem['Name'] . '_confirm';
833  }
834  }
835 
836  //external function
838  {
839  return $this -> aCoupleMutual;
840  }
841 
843  {
844  return $this -> aCoupleMutualCopy;
845  }
846 
847  function getViewableValue( $aItem, $sValue )
848  {
849  global $site;
850 
851  switch( $aItem['Type'] ) {
852  case 'text':
853  case 'num':
854  case 'area':
855  return nl2br(htmlspecialchars_adv($sValue));
856 
857  case 'html_area':
858  return $sValue;
859 
860  case 'date':
861  return $this -> getViewableDate($sValue);
862 
863  case 'range':
864  return htmlspecialchars_adv( str_replace( ',', ' - ', $sValue ) );
865 
866  case 'bool':
867  return _t( $sValue ? '_Yes' : '_No' );
868 
869  case 'select_one':
870  $sValueView = $this -> getViewableSelectOne( $aItem['Values'], $sValue );
871 
872  if ($aItem['Name'] == 'Country') {
873  $sFlagName = strtolower($sValue);
874  $sValueView = '<img src="' . $site['flags'] . $sFlagName . '.gif" /> ' . $sValueView;
875  }
876 
877  return $sValueView;
878 
879  case 'select_set':
880  return $this -> getViewableSelectSet( $aItem['Values'], $sValue );
881 
882  case 'system':
883  switch( $aItem['Name'] ) {
884  case 'Age':
885  return age($sValue);
886 
887  case 'DateReg':
888  case 'DateLastEdit':
889  case 'DateLastLogin':
890  case 'DateLastNav':
891  return $this -> getViewableDate($sValue, CH_WSB_LOCALE_DATE);
892 
893  case 'Status':
894  return _t( "_$sValue" );
895 
896  case 'ID':
897  return $sValue;
898 
899  case 'Featured':
900  return _t( $sValue ? '_Yes' : '_No' );
901 
902  default:
903  return '&nbsp;';
904  }
905  break;
906 
907  case 'pass':
908  default:
909  return '&nbsp;';
910  }
911  }
912 
920  function getViewableDate($sDate, $iFormat = CH_WSB_LOCALE_DATE_SHORT)
921  {
922  $sViewableDate = $sDate != '0000-00-00 00:00:00' && $sDate != '0000-00-00'
923  ? getLocaleDate( strtotime($sDate), $iFormat)
924  : _t('_undefined');
925 
926  return $sViewableDate;
927  }
928 
929  function getViewableSelectOne( $mValues, $sValue, $sUseLKey = 'LKey' )
930  {
931  global $aPreValues;
932 
933  if( is_string($mValues) and substr($mValues, 0, 2) == $this->sLinkPref ) {
934  $sKey = substr($mValues, 2);
935 
936  if( !isset( $aPreValues[$sKey][$sUseLKey] ) )
937  $sUseLKey = 'LKey';
938 
939  return htmlspecialchars_adv( _t( $aPreValues[$sKey][$sValue][$sUseLKey] ) );
940  } elseif( is_array($mValues) ) {
941  if( in_array($sValue, $mValues) )
942  return htmlspecialchars_adv( _t( "_FieldValues_{$sValue}" ) );
943  //return htmlspecialchars_adv( _t( "_$sValue" ) );
944  else
945  return '';
946  } else
947  return '';
948  }
949 
950  function getViewableSelectSet( $mValues, $sValue, $sUseLKey = 'LKey' )
951  {
952  global $aPreValues;
953 
954  if( is_string($mValues) and substr($mValues, 0, 2) == $this->sLinkPref ) {
955  $sKey = substr($mValues, 2);
956  if( !isset( $aPreValues[$sKey] ) )
957  return '&nbsp;';
958 
959  $aValues = explode( ',', $sValue );
960 
961  $aTValues = array();
962 
963  foreach( $aValues as $sValue )
964  $aTValues[] = _t( $aPreValues[$sKey][$sValue][$sUseLKey] );
965 
966  return htmlspecialchars_adv( implode( ', ', $aTValues ) );
967  } elseif( is_array($mValues) ) {
968  $aValues = array();
969  foreach( explode( ',', $sValue ) as $sValueOne )
970  $aValues[] = _t( "_FieldValues_{$sValueOne}" );
971  //$aValues[] = _t( "_$sValueOne" );
972 
973  return htmlspecialchars_adv( implode( ', ', $aValues ) );
974  } else
975  return '';
976  }
977 
979  {
980  $aParams = array();
981 
982  if( empty($_GET) and empty($_POST) )
983  return $aParams;
984 
985  foreach( $this -> aBlocks as $aBlock ) {
986  foreach( $aBlock['Items'] as $aItem ) {
987  $sItemName = $aItem['Name'];
988  $mValue = null;
989 
990  switch( $aItem['Type'] ) {
991  case 'text':
992  case 'area':
993  case 'html_area':
994  if( isset( $_REQUEST[$sItemName] ) and $_REQUEST[$sItemName] )
995  $mValue = process_pass_data( $_REQUEST[$sItemName] );
996  break;
997 
998  case 'num':
999  case 'date':
1000  case 'range':
1001  if( isset( $_REQUEST[$sItemName] ) and !empty( $_REQUEST[$sItemName] ) ) {
1002  $mValue = explode('-', $_REQUEST[$sItemName], 2);
1003 
1004  $mValue[0] = (int)$mValue[0];
1005  $mValue[1] = (int)$mValue[1];
1006 
1007  if( !$mValue[0] and !$mValue[1] )
1008  $mValue = null; // if no values entered, skip them
1009  }
1010  break;
1011 
1012  case 'select_one':
1013  case 'select_set':
1014  if( isset( $_REQUEST[$sItemName] ) and !empty( $_REQUEST[$sItemName] ) ) {
1015  if (is_array( $_REQUEST[$sItemName] )) {
1016  $mValue = array();
1017 
1018  foreach( $_REQUEST[$sItemName] as $sValue ) {
1019  $sValue = trim( process_pass_data( $sValue ) );
1020  if( $sValue )
1021  $mValue[] = $sValue;
1022  }
1023  } else {
1024  $mValue = trim( process_pass_data( $_REQUEST[$sItemName] ) );
1025  }
1026  }
1027  if (!$mValue)
1028  $mValue = null;
1029  break;
1030 
1031  case 'bool':
1032  if( isset( $_REQUEST[$sItemName] ) and $_REQUEST[$sItemName] )
1033  $mValue = true;
1034  break;
1035 
1036  case 'system':
1037  switch( $sItemName ) {
1038  case 'ID':
1039  if( isset( $_REQUEST[$sItemName] ) and (int)$_REQUEST[$sItemName] )
1040  $mValue = (int)$_REQUEST[$sItemName];
1041  break;
1042 
1043  case 'Couple':
1044  if( isset( $_REQUEST[$sItemName] ) and is_array( $_REQUEST[$sItemName] ) ) {
1045  if( isset( $_REQUEST[$sItemName][0] ) and isset( $_REQUEST[$sItemName][1] ) )
1046  $mValue = '-1'; //pass
1047  elseif( isset( $_REQUEST[$sItemName][0] ) )
1048  $mValue = 0;
1049  elseif( isset( $_REQUEST[$sItemName][1] ) )
1050  $mValue = 1;
1051  } elseif( isset( $_REQUEST[$sItemName] ) ) {
1052  $mValue = 'yes' == $_REQUEST[$sItemName] ? 1 : 0;
1053  }
1054  break;
1055 
1056  case 'Location':
1057 
1058  break;
1059 
1060  case 'Keyword':
1061  if( isset( $_REQUEST[$sItemName] ) and trim( $_REQUEST[$sItemName] ) )
1062  $mValue = trim( process_pass_data( $_REQUEST[$sItemName] ) );
1063  break;
1064 
1065  }
1066  break;
1067  }
1068 
1069  if( !is_null( $mValue ) )
1070  $aParams[ $sItemName ] = $mValue;
1071  }
1072  }
1073 
1074  return $aParams;
1075  }
1076 
1077  function getProfilesMatch( $aProf1, $aProf2 )
1078  {
1079  if( !$this -> aArea )
1080  return 0;
1081 
1082  $aFields1 = $this -> aBlocks[0]['Items'];
1083  $aFields2 = $this -> aCache[100][0]['Items'];
1084 
1085  $iMyPercent = 0;
1086  $iTotalPercent = 0;
1087  foreach( $aFields1 as $aField1 ) {
1088  $aField2 = $aFields2[ $aField1['MatchField'] ];
1089  if( !$aField2 )
1090  continue;
1091 
1092  $iTotalPercent += $aField1['MatchPercent'];
1093 
1094  $sVal1 = $aProf1[ $aField1['Name'] ];
1095  $sVal2 = $aProf2[ $aField2['Name'] ];
1096 
1097  if( !strlen($sVal1) or !strlen($sVal2) )
1098  continue;
1099 
1100  $iAddPart = 0;
1101  switch( "{$aField1['Type']} {$aField1['Type']}" ) {
1102  case 'select_set select_one':
1103  $aVal1 = explode( ',', $sVal1 );
1104 
1105  if( in_array( $sVal2, $aVal1 ) )
1106  $iAddPart = 1;
1107  break;
1108 
1109  case 'select_one select_set':
1110  $aVal2 = explode( ',', $sVal2 );
1111 
1112  if( in_array( $sVal1, $aVal2 ) )
1113  $iAddPart = 1;
1114  break;
1115 
1116  case 'select_set select_set':
1117  $aVal1 = explode( ',', $sVal1 );
1118  $aVal2 = explode( ',', $sVal2 );
1119 
1120  $iFound = 0;
1121  foreach( $aVal1 as $sTempVal1 ) {
1122  if( in_array( $sTempVal1, $aVal2 ) )
1123  $iFound ++;
1124  }
1125 
1126  $iAddPart = $iFound / count( $aVal1 );
1127  break;
1128 
1129  case 'range num':
1130  $aVal1 = explode( ',', $sVal1 );
1131  $sVal2 = (int)$sVal2;
1132 
1133  if( (int)$aVal1[0] <= $sVal2 and $sVal2 <= (int)$aVal1[0] )
1134  $iAddPart = 1;
1135  break;
1136 
1137  case 'range date':
1138  $aVal1 = explode( ',', $sVal1 );
1139 
1140  $aDate = explode( '-', $sVal2 );
1141  $sVal2 = sprintf( '%d/%d/%d', $aDate[2], $aDate[1], $aDate[0] );
1142  $sAge = $this -> getAge( $sVal2 );
1143 
1144  if( (int)$aVal1[0] <= $sVal2 and $sVal2 <= (int)$aVal1[0] )
1145  $iAddPart = 1;
1146  break;
1147 
1148  default:
1149  if( $sVal1 == $sVal2 )
1150  $iAddPart = 1;
1151  }
1152 
1153  $iMyPercent += round( $aField1['MatchPercent'] * $iAddPart );
1154  }
1155 
1156  if( $iTotalPercent != 100 && $iTotalPercent != 0 )
1157  $iMyPercent = (int)( ( $iMyPercent / $iTotalPercent ) * 100 );
1158 
1159  return $iMyPercent;
1160  }
1161 
1162  function getFormCode($aParams = null)
1163  {
1164  switch ($this->iAreaID) {
1165  // join
1166  case 1:
1167  $aForm = $this->getFormJoin($aParams);
1168  break;
1169 
1170  // edit
1171  case 2:
1172  case 3:
1173  case 4:
1174  $aForm = $this->getFormEdit($aParams);
1175  break;
1176 
1177  // search
1178  case 9:
1179  case 10:
1180  case 11:
1181  return $this->getFormsSearch($aParams);
1182  break;
1183 
1184  default:
1185  return false;
1186  }
1187 
1188  $oForm = new ChTemplFormView($aForm);
1189 
1190  ch_import('ChWsbAlerts');
1191  $sCustomHtmlBefore = '';
1192  $sCustomHtmlAfter = '';
1193  $oAlert = new ChWsbAlerts('profile', 'show_profile_form', 0, 0, array('oProfileFields' => $this, 'oForm' => $oForm, 'sCustomHtmlBefore' => &$sCustomHtmlBefore, 'sCustomHtmlAfter' => &$sCustomHtmlAfter));
1194  $oAlert->alert();
1195 
1196  return $sCustomHtmlBefore . $oForm->getCode() . $sCustomHtmlAfter;
1197  }
1198 
1199  function getFormsSearch($aParams, $bReturnArray = false)
1200  {
1201  $aShowModes = array('featured', 'birthdays', 'top_rated', 'popular', 'moderators');
1202 
1203  // original member profile, used for setting default search params
1204  $aDefaultParams = $aParams['default_params'];
1205 
1206  $sSearchModeName = ($this->iAreaID == 10 ? 'quick' : ($this->iAreaID == 11 ? 'adv' : 'simple'));
1207 
1208  $sResult = '';
1209  $aResult = array();
1210 
1211  $iFormCounter = 1;
1212 
1213  // generate blocks
1214  foreach ($this->aBlocks as $iBlockId => $aBlock) {
1215 
1216  $bAddFlags = true; // flags "online only" and "photos only"
1217 
1218  //collect inputs
1219  $aInputs = array();
1220 
1221  // create search mode hidden input
1222  $aInputs[] = array(
1223  'type' => 'hidden',
1224  'name' => 'search_mode',
1225  'value' => $sSearchModeName,
1226  );
1227 
1228  // create search result mode hidden input (if requested)
1229  $sSrmKey = 'search_result_mode';
1230  if(!empty($aDefaultParams[$sSrmKey])) {
1231  $aInputs[] = array(
1232  'type' => 'hidden',
1233  'name' => $sSrmKey,
1234  'value' => $aDefaultParams[$sSrmKey],
1235  );
1236 
1237  unset($aDefaultParams[$sSrmKey]);
1238  }
1239 
1240  // create show parameter as hidden input
1241  $aInputs[] = array(
1242  'type' => 'hidden',
1243  'name' => 'show',
1244  'value' => isset($_REQUEST['show']) && in_array($_REQUEST['show'], $aShowModes) ? $_REQUEST['show'] : '',
1245  );
1246 
1247  // generate block input
1248  $aInputs[] = array(
1249  'type' => 'block_header',
1250  'caption' => _t($aBlock['Caption']),
1251  );
1252 
1253  // generate inputs for items of this block
1254  foreach ($aBlock['Items'] as $iItemId => $aItem) {
1255 
1256  if ($iItemId == 1 or $iItemId == 2)
1257  $bAddFlags = false; // do not add flags when username or id available
1258 
1259  // generate input
1260  $aFormInput = array(
1261  'name' => $aItem['Name'],
1262  'caption' => (_t($aItem['Caption']) != $aItem['Caption']) ? _t($aItem['Caption']) : null,
1263  'info' => (_t($aItem['Desc']) != $aItem['Desc']) ? _t($aItem['Desc']) : null,
1264  'value' => empty($aDefaultParams[$aItem['Name']]) ? '' : $aDefaultParams[$aItem['Name']],
1265  );
1266 
1267  switch ($aItem['Type']) {
1268  case 'text':
1269  case 'area': // search in area like simple keyword
1270  case 'html_area': // search in area like simple keyword
1271  $aFormInput['type'] = 'text';
1272  break;
1273 
1274  case 'bool':
1275  $aFormInput['value'] = 'yes';
1276  $aFormInput['type'] = 'checkbox';
1277  break;
1278 
1279  case 'select_one':
1280  case 'select_set':
1281 
1282  switch($aItem['Control']) {
1283  case 'select' :
1284  $aFormInput['type'] = 'select_box';
1285  $aFormInput['attrs']['add_other'] = 'false';
1286  break;
1287 
1288  case 'checkbox' :
1289  $aFormInput['type'] = $aItem['Name'] == 'LookingFor' ? 'select' : 'checkbox_set';
1290  break;
1291 
1292  default :
1293  $aFormInput['type'] = $aItem['Name'] == 'Sex' ? 'checkbox_set' : 'select';
1294  }
1295 
1296  $aFormInput['values'] = $this->convertValues4Input($aItem['Values'], $aItem['UseLKey'], 'search');
1297  if($aItem['Type'] == 'select_one' && is_array($aFormInput['value'])) {
1298  $aFormInput['value'] = $aFormInput['value'][0];
1299  }
1300  break;
1301 
1302  case 'date':
1303  case 'num':
1304  case 'range':
1305  $aFormInput['type'] = 'doublerange'; /* Changed because of realisation of WebForms 2.0 */
1306  $aFormInput['attrs'] = array(
1307  'min' => $aItem['Min'],
1308  'max' => $aItem['Max'],
1309  );
1310  break;
1311 
1312  case 'system':
1313  switch ($aItem['Name']) {
1314  case 'ID':
1315  $aFormInput['type'] = 'number';
1316  $aFormInput['attrs']['min'] = 1;
1317  break;
1318 
1319  case 'Keyword':
1320  $aFormInput['type'] = 'text';
1321  break;
1322 
1323  case 'Location':
1324  $sLivingWithinC = _t("_living within");
1325  $sMilesC = _t("_miles");
1326  $sKmC = _t("_kilometers");
1327  $sFromZipC = _t("_from zip/postal code");
1328 
1329  $aFormInput['type'] = 'custom';
1330 
1331  $aFormInput['content'] = <<<EOF
1332  <div class="location_wrapper">
1333  <div>
1334  <input type="text" name="distance" class="form_input_distance ch-def-round-corners-with-border ch-def-font" />
1335  <select name="metric" class="form_input_select form_input_metric">
1336  <option selected="selected" value="miles">$sMilesC</option>
1337  <option value="km">$sKmC</option>
1338  </select>
1339  </div>
1340  <div>
1341  $sFromZipC
1342  <input type="text" name="zip" class="form_input_zip ch-def-round-corners-with-border ch-def-font" />
1343  </div>
1344  </div>
1345 EOF;
1346  break;
1347 
1348  case 'Couple':
1349  if ('on' == getParam('enable_global_couple')) {
1350  $aFormInput['type'] = 'select';
1351  $aFormInput['values'] = array(
1352  'no' => _t('_Single'),
1353  'yes' => _t('_Couple')
1354  );
1355  } else {
1356  $aFormInput['type'] = 'hidden';
1357  $aFormInput['value'] = 'no';
1358  }
1359  break;
1360  }
1361  break;
1362  }
1363 
1364  $aInputs[] = $aFormInput;
1365  }
1366 
1367  if ($bAddFlags /* array_search($iBlockId, array_keys($this->aBlocks)) != 0 */) {
1368  // create input for "online only"
1369  $aInputs[] = array(
1370  'type' => 'checkbox',
1371  'name' => 'online_only',
1372  'label' => _t('_online only'),
1373  'checked' => !empty($aDefaultParams['online_only']) &&
1374  ($aDefaultParams['online_only'] == 'on'),
1375  );
1376 
1377  // create input for "with photos only"
1378  ch_import('ChWsbMemberInfo');
1379  $oMemberInfo = ChWsbMemberInfo::getObjectInstance(getParam('sys_member_info_thumb'));
1380  if($oMemberInfo->isAvatarSearchAllowed())
1381  $aInputs[] = array(
1382  'type' => 'checkbox',
1383  'name' => 'photos_only',
1384  'label' => _t('_With photos only'),
1385  'checked' => !empty($aDefaultParams['photos_only']) &&
1386  $aDefaultParams['photos_only'] == 'on',
1387  );
1388  }
1389 
1390  // create submit button
1391  $aInputs[] = array(
1392  'type' => 'submit',
1393  'name' => 'submit',
1394  'value' => _t('_Search'),
1395  'colspan' => true, // colspan
1396  );
1397 
1398  // create form array
1399  $aForm = array(
1400  'form_attrs' => array(
1401  'method' => 'get',
1402  'action' => $GLOBALS['site']['url'] . 'search.php',
1403  'name' => $sSearchModeName . '_search_form' . $iFormCounter,
1404  ),
1405  'inputs' => $aInputs,
1406  );
1407 
1408  if (isset($aParams['form_attrs']) && is_array($aParams['form_attrs']))
1409  $aForm['form_attrs'] = array_merge ($aForm['form_attrs'], $aParams['form_attrs']);
1410 
1411  if (isset($aParams['inputs']) && is_array($aParams['inputs']))
1412  $aForm['inputs'] = array_merge ($aForm['inputs'], $aParams['inputs']);
1413 
1414  if(!$bReturnArray) {
1415  $oForm = new ChTemplFormView($aForm);
1416  $sResult .= $oForm->getCode();
1417  }
1418  else
1419  $aResult[] = $aForm;
1420 
1421  $iFormCounter++;
1422  } // block generation finished
1423 
1424  return !$bReturnArray ? $sResult : $aResult;
1425  }
1426 
1431  function getFormJoin($aParams)
1432  {
1433  // get parameters
1434  $bDynamic = !empty($aParams['dynamic']) ? $aParams['dynamic'] : false;
1435  $bCoupleEnabled = $aParams['couple_enabled'];
1436  $bCouple = $aParams['couple'];
1437  $aHiddenItems = $aParams['hiddens'];
1438  $iPage = $aParams['page'];
1439 
1440  $aValues = $aParams['values'];
1441  $aErrors = $aParams['errors'];
1442 
1443  // collect inputs
1444  $aInputs = array();
1445 
1446  // convert array of hidden fields to inputs
1447  foreach ($aHiddenItems as $sName => $sValue) {
1448  $aInputs[] = array(
1449  'type' => 'hidden',
1450  'name' => $sName,
1451  'value' => $sValue,
1452  );
1453  }
1454 
1455  // add table headers
1456  /*
1457  $aInputs[] = array(
1458  'type' => 'headers',
1459  'tr_class' => 'hidable',
1460  0 => '&nbsp;',
1461  1 => _t( '_First Person' ),
1462  2 => _t( '_Second Person' ),
1463  );
1464  */
1465 
1466  // add every block on this page
1467  foreach( $this->aArea[$iPage] as $aBlock ) {
1468  // generate block header
1469  $aInputs[] = array(
1470  'type' => 'block_header',
1471  'caption' => _t( $aBlock['Caption'] ),
1472  );
1473 
1474  $aAddInputs = array();
1475 
1476  // add every item
1477  foreach( $aBlock['Items'] as $aItem ) {
1478 
1479  $aInputParams = array(
1480  'dynamic' => $bDynamic,
1481  'couple' => $bCouple,
1482  'values' => array(
1483  0 => isset($aValues[0][$aItem['Name']]) ? $aValues[0][$aItem['Name']] : null,
1484  1 => isset($aValues[1][$aItem['Name']]) ? $aValues[1][$aItem['Name']] : null,
1485  ),
1486  'errors' => array(
1487  0 => isset($aErrors[0][$aItem['Name']]) ? $aErrors[0][$aItem['Name']] : null,
1488  1 => isset($aErrors[1][$aItem['Name']]) ? $aErrors[1][$aItem['Name']] : null,
1489  ),
1490  );
1491 
1492  $bBotCheck = ('on' == getParam(sys_antispam_bot_check) ? true : false);
1493  if($bBotCheck) {
1494  $aInputsTemp = $this->convertJoinField2Input($aItem, $aInputParams, 0);
1495  if($aItem['Default'] == 'spam') {
1496  $aInputsTemp['value'] = '';
1497  $aInputsTemp['Default'] = '';
1498  $aInputsTemp['tr_attrs'] = array('class' => 'hidable');
1499  }
1500  if($aItem['Name'] == 'starttime') {
1501  $aInputsTemp['value'] = (int)time();
1502  }
1503  $aInputs[] = $aInputsTemp;
1504  } else {
1505  $aInputs[] = $this->convertJoinField2Input($aItem, $aInputParams, 0);
1506  }
1507 
1508  if ($bCoupleEnabled && !in_array( $aItem['Name'], $this -> aCoupleMutual ))
1509  $aAddInputs[] = $this->convertJoinField2Input($aItem, $aInputParams, 1);
1510 
1511  // duplicate password (confirmation)
1512  if ($aItem['Type'] == 'pass') {
1513  $aItem_confirm = $aItem;
1514 
1515  $aItem_confirm['Name'] .= '_confirm';
1516  $aItem_confirm['Caption'] = '_Confirm password';
1517  $aItem_confirm['Desc'] = '_Confirm password descr';
1518 
1519  $aInputs[] = $this->convertJoinField2Input($aItem_confirm, $aInputParams, 0);
1520 
1521  if ($bCoupleEnabled && !in_array( $aItem['Name'], $this -> aCoupleMutual ))
1522  $aAddInputs[] = $this->convertJoinField2Input($aItem_confirm, $aInputParams, 1);
1523  }
1524  }
1525 
1526  // add second person
1527  if (!empty($aAddInputs)) {
1528 
1529  $aInputs[] = array(
1530  'type' => 'block_header',
1531  'caption' => _t( $aBlock['Caption'] ) . ' - ' . _t('_Second Person'),
1532  'attrs' => array(
1533  'class' => 'hidable',
1534  'style' => 'display: ' . ($bCouple ? 'table-row' : 'none'),
1535  ),
1536  );
1537 
1538  $aInputs = array_merge($aInputs, $aAddInputs);
1539  }
1540  }
1541 
1542  // add submit button
1543  $aInputs[] = array(
1544  'type' => 'submit',
1545  'name' => 'do_submit',
1546  'value' => _t( '_Join_now' ),
1547  'attrs' => array(
1548  'class' => 'ch-btn-primary'
1549  ),
1550  'colspan' => false,
1551  );
1552 
1553  // generate form array
1554  $aForm = array(
1555  'form_attrs' => array(
1556  'name' => 'join_form',
1557  'action' => CH_WSB_URL_ROOT . 'join.php',
1558  'method' => 'post',
1559  'onsubmit' => 'return validateJoinForm(this);',
1560  'enctype' => 'multipart/form-data',
1561  ),
1562  'table_attrs' => array(
1563  'id' => 'join_form_table'
1564  ),
1565  'params' => array(
1566  'double' => $bCoupleEnabled,
1567  'second_enabled' => $bCouple
1568  ),
1569  'inputs' => $aInputs,
1570  );
1571 
1572  return $aForm;
1573  }
1574 
1579  function getFormEdit($aParams)
1580  {
1581  // get parameters
1582  $bCoupleEnabled = $aParams['couple_enabled'];
1583  $bCouple = $aParams['couple'];
1584  $aHiddenItems = $aParams['hiddens'];
1585 
1586  $iProfileID = $aParams['profile_id'];
1587 
1588  $aValues = $aParams['values'];
1589  $aErrors = $aParams['errors'];
1590 
1591  // collect inputs
1592  $aInputs = array();
1593 
1594  // convert array of hidden fields to inputs
1595  foreach ($aHiddenItems as $sName => $sValue) {
1596  $aInputs[] = array(
1597  'type' => 'hidden',
1598  'name' => $sName,
1599  'value' => $sValue,
1600  );
1601  }
1602 
1603  // add table headers (only if couple)
1604  /*
1605  if ($bCouple) {
1606  $aInputs[] = array(
1607  'type' => 'headers',
1608  'tr_class' => 'hidable',
1609  0 => '&nbsp;',
1610  1 => _t( '_First Person' ),
1611  2 => _t( '_Second Person' ),
1612  );
1613  }
1614  */
1615 
1616  // add every block on this page
1617  foreach( $this->aBlocks as $aBlock ) {
1618  // generate block header
1619  $aInputs[] = array(
1620  'type' => 'block_header',
1621  'caption' => _t( $aBlock['Caption'] ),
1622  );
1623 
1624  $aAddInputs = array();
1625 
1626  // add every item
1627  foreach( $aBlock['Items'] as $aItem ) {
1628 
1629  $aInputParams = array(
1630  'couple' => $bCouple,
1631  'values' => array(
1632  0 => isset($aValues[0][$aItem['Name']]) ? $aValues[0][$aItem['Name']] : null,
1633  1 => isset($aValues[1][$aItem['Name']]) ? $aValues[1][$aItem['Name']] : null,
1634  ),
1635  'errors' => array(
1636  0 => isset($aErrors[0][$aItem['Name']]) ? $aErrors[0][$aItem['Name']] : null,
1637  1 => isset($aErrors[1][$aItem['Name']]) ? $aErrors[1][$aItem['Name']] : null,
1638  ),
1639  'profile_id' => $iProfileID,
1640  );
1641 
1642  $aInputs[] = $this->convertEditField2Input($aItem, $aInputParams, 0);
1643 
1644  if ($bCoupleEnabled && !in_array( $aItem['Name'], $this -> aCoupleMutual ))
1645  $aAddInputs[] = $this->convertEditField2Input($aItem, $aInputParams, 1);
1646 
1647  // duplicate password (confirmation)
1648  if ($aItem['Type'] == 'pass') {
1649  $aItem_confirm = $aItem;
1650 
1651  $aItem_confirm['Name'] .= '_confirm';
1652  $aItem_confirm['Caption'] = '_Confirm password';
1653  $aItem_confirm['Desc'] = '_Confirm password descr';
1654 
1655  $aInputs[] = $this->convertEditField2Input($aItem_confirm, $aInputParams, 0);
1656 
1657  if ($bCoupleEnabled && !in_array( $aItem['Name'], $this -> aCoupleMutual ))
1658  $aAddInputs[] = $this->convertEditField2Input($aItem, $aInputParams, 1);
1659  }
1660  }
1661 
1662  // add second person
1663  if (!empty($aAddInputs)) {
1664 
1665  $aInputs[] = array(
1666  'type' => 'block_header',
1667  'caption' => _t( $aBlock['Caption'] ) . ' - ' . _t('_Second Person'),
1668  'attrs' => array(
1669  'class' => 'hidable',
1670  'style' => 'display: ' . ($bCouple ? 'table-row' : 'none'),
1671  ),
1672  );
1673 
1674  $aInputs = array_merge($aInputs, $aAddInputs);
1675  }
1676  }
1677 
1678  // add submit button
1679  $aInputs[] = array(
1680  'type' => 'submit',
1681  'name' => 'do_save',
1682  'value' => _t( '_Save' ),
1683  'colspan' => false,
1684  );
1685 
1686  // generate form array
1687  $aForm = array(
1688  'form_attrs' => array(
1689  'name' => 'edit_form',
1690  'action' => CH_WSB_URL_ROOT . 'pedit.php?ID=' . $iProfileID,
1691  'method' => 'post',
1692  'onsubmit' => 'return validateEditForm(this);',
1693  ),
1694  'table_attrs' => array(
1695  'id' => 'edit_form_table'
1696  ),
1697  'params' => array(
1698  'double' => $bCoupleEnabled,
1699  'second_enabled' => $bCouple
1700  ),
1701  'inputs' => $aInputs,
1702  );
1703 
1704  return $aForm;
1705  }
1706 
1707  function convertEditField2Input($aItem, $aParams, $iPerson)
1708  {
1709  $bCouple = $aParams['couple'];
1710  $aValues = $aParams['values'];
1711  $aErrors = $aParams['errors'];
1712 
1713  $iProfileID = $aParams['profile_id'];
1714 
1715  $aInput = array();
1716 
1717  switch ($aItem['Type']) {
1718  case 'text': $aInput['type'] = 'text'; $aInput['value'] = $aValues[$iPerson]; break;
1719  case 'area': $aInput['type'] = 'textarea'; $aInput['value'] = $aValues[$iPerson]; break;
1720  case 'html_area': $aInput['type'] = 'textarea'; $aInput['html'] = true; $aInput['value'] = $aValues[$iPerson]; break;
1721  case 'date': $aInput['type'] = 'date'; $aInput['value'] = $aValues[$iPerson]; break;
1722  case 'datetime': $aInput['type'] = 'datetime'; $aInput['value'] = $aValues[$iPerson]; break;
1723  case 'num': $aInput['type'] = 'number'; $aInput['value'] = $aValues[$iPerson]; break;
1724  case 'pass': $aInput['type'] = 'password'; break;
1725  case 'range':
1726  $aInput['type'] = 'doublerange';
1727  $aInput['value'] = is_array($aValues[$iPerson]) ? $aValues[$iPerson][0] . '-' . $aValues[$iPerson][1] : $aValues[$iPerson];
1728  break;
1729  case 'bool':
1730  $aInput['type'] = 'checkbox';
1731  $aInput['value'] = 'yes';
1732  $aInput['checked'] = (bool)(int)$aValues[$iPerson];
1733  break;
1734 
1735  case 'select_one':
1736  switch ($aItem['Control']) {
1737  case 'select': $aInput['type'] = 'select'; break;
1738  case 'radio': $aInput['type'] = 'radio_set'; break;
1739 
1740  default: return false;
1741  }
1742 
1743  $aInput['values'] = $this->convertValues4Input($aItem['Values'], $aItem['UseLKey'], 'edit');
1744 
1745  $aInput['value'] = $aValues[$iPerson];
1746  break;
1747 
1748  case 'select_set':
1749  switch ($aItem['Control']) {
1750  case 'select': $aInput['type'] = 'select_multiple'; break;
1751  case 'checkbox': $aInput['type'] = 'checkbox_set'; break;
1752 
1753  default: return false;
1754  }
1755 
1756  $aInput['values'] = $this->convertValues4Input($aItem['Values'], $aItem['UseLKey'], 'edit');
1757 
1758  $aInput['value'] = $aValues[$iPerson];
1759  break;
1760 
1761  case 'system':
1762  switch ($aItem['Name']) {
1763  case 'Featured':
1764  $aInput = array(
1765  'type' => 'checkbox',
1766  'value' => 'yes',
1767  'checked' => $aValues[0]
1768  );
1769  break;
1770 
1771  case 'Status':
1772  $aInput = array(
1773  'type' => 'select',
1774  'value' => $aValues[0],
1775  'values' => array(),
1776  );
1777 
1778  foreach ($aItem['Values'] as $sValue) {
1779  $aInput['values'][$sValue] = _t("_FieldValues_$sValue");
1780  }
1781  break;
1782 
1783  case 'ID':
1784  case 'DateReg':
1785  case 'DateLastEdit':
1786  case 'DateLastLogin':
1787  case 'DateLastNav':
1788  //non editable
1789  return false;
1790  break;
1791 
1792  default: return false;
1793  }
1794  break;
1795 
1796  default: return false;
1797  }
1798 
1799  $aInput['name'] = ( $aItem['Type'] == 'system' ) ? $aItem['Name'] : ( $aItem['Name'] . "[$iPerson]" );
1800  $aInput['caption'] = _t( $aItem['Caption'] );
1801  $aInput['required'] = $aItem['Type'] == 'pass' ? false : $aItem['Mandatory'];
1802  $aInput['info'] = (
1803  ($sInfo = _t( $aItem['Desc'], $aItem['Min'], $aItem['Max'] )) != $aItem['Desc']) // if info is translated
1804  ? $sInfo : null;
1805 
1806  if ($aItem['Type'] == 'date') {
1807  $aInput['attrs']['min'] = $aItem['Max'] ? (date('Y') - $aItem['Max']) . '-' . date('m') . '-' . date('d') : (date('Y') - 100) . '-' . date('m') . '-' . date('d');
1808  $aInput['attrs']['max'] = $aItem['Min'] ? (date('Y') - $aItem['Min']) . '-' . date('m') . '-' . date('d') : (date('Y') + 100) . '-' . date('m') . '-' . date('d');
1809  } else {
1810  $aInput['attrs']['min'] = $aItem['Min'];
1811  $aInput['attrs']['max'] = $aItem['Max'];
1812  }
1813 
1814  $aInput['error'] = $aErrors[$iPerson];
1815 
1816  if ($iPerson == 1) {
1817  $aInput['tr_attrs'] = array(
1818  'class' => 'hidable',
1819  'style' => 'display: ' . ($bCouple ? 'table-row' : 'none'),
1820  );
1821 
1822  }
1823 
1824  return $aInput;
1825  }
1826 
1827  function convertJoinField2Input($aItem, $aParams, $iPerson)
1828  {
1829  $bDynamic = $aParams['dynamic'];
1830  $bCouple = $aParams['couple'];
1831  $aValues = $aParams['values'];
1832  $aErrors = $aParams['errors'];
1833 
1834  $aInput = array();
1835 
1836  switch ($aItem['Type']) {
1837  case 'text': $aInput['type'] = 'text'; $aInput['value'] = $aValues[$iPerson]; break;
1838  case 'area': $aInput['type'] = 'textarea'; $aInput['value'] = $aValues[$iPerson]; break;
1839  case 'html_area':
1840  $aInput['type'] = 'textarea';
1841  $aInput['html'] = true;
1842  $aInput['dynamic'] = $bDynamic;
1843  $aInput['value'] = $aValues[$iPerson];
1844  break;
1845  case 'date': $aInput['type'] = 'date'; $aInput['value'] = $aValues[$iPerson]; break;
1846  case 'datetime': $aInput['type'] = 'datetime'; $aInput['value'] = $aValues[$iPerson]; break;
1847  case 'num': $aInput['type'] = 'number'; $aInput['value'] = $aValues[$iPerson]; break;
1848  case 'range':
1849  $aInput['type'] = 'doublerange';
1850  $aInput['value'] = is_array($aValues[$iPerson]) ? $aValues[$iPerson][0] . '-' . $aValues[$iPerson][1] : $aValues[$iPerson];
1851  break;
1852  case 'pass': $aInput['type'] = 'password'; break;
1853  case 'bool':
1854  $aInput['type'] = 'checkbox';
1855  $aInput['value'] = 'yes';
1856  $aInput['checked'] = (bool)(int)$aValues[$iPerson];
1857  break;
1858 
1859  case 'select_one':
1860  switch ($aItem['Control']) {
1861  case 'select': $aInput['type'] = 'select'; break;
1862  case 'radio': $aInput['type'] = 'radio_set'; break;
1863  }
1864 
1865  $aInput['values'] = $this->convertValues4Input($aItem['Values'], $aItem['UseLKey'], 'join');
1866 
1867  $aInput['value'] = $aValues[$iPerson];
1868  break;
1869 
1870  case 'select_set':
1871  switch ($aItem['Control']) {
1872  case 'select': $aInput['type'] = 'select_multiple'; break;
1873  case 'checkbox': $aInput['type'] = 'checkbox_set'; break;
1874  }
1875 
1876  $aInput['values'] = $this->convertValues4Input($aItem['Values'], $aItem['UseLKey'], 'join');
1877 
1878  $aInput['value'] = $aValues[$iPerson];
1879  break;
1880 
1881  case 'system':
1882  switch ($aItem['Name']) {
1883  case 'TermsOfUse':
1884  $aInput = array(
1885  'type' => 'checkbox',
1886  'label' => _t($aItem['Caption']),
1887  'colspan' => false,
1888  'value' => 'yes',
1889  );
1890  $aItem['Caption'] = '';
1891  break;
1892 
1893  case 'Couple':
1894  if ('on' == getParam('enable_global_couple')) {
1895  $aInput = array(
1896  'type' => 'select',
1897  'values' => array(
1898  'no' => _t('_Single'),
1899  'yes' => _t('_Couple'),
1900  ),
1901  'attrs' => array(
1902  'onchange' => 'doShowHideSecondProfile(this.value, this.form);',
1903  ),
1904  'value' => $bCouple ? 'yes' : 'no',
1905  );
1906  } else {
1907  $aInput = array(
1908  'type' => 'hidden',
1909  'value' => 'no',
1910  );
1911  }
1912  break;
1913 
1914  case 'Captcha':
1915  $aInput['type'] = 'captcha';
1916  $aInput['dynamic'] = $bDynamic;
1917  break;
1918 
1919  case 'ProfilePhoto':
1920  $aInput['type'] = 'file';
1921  break;
1922 
1923  case 'Agree':
1924  $aInput = array(
1925  'type' => 'custom',
1926  'colspan' => true,
1927  'content' => _t('_join_form_note', CH_WSB_URL_ROOT) . '<input type="hidden" name="Agree" />',
1928  );
1929  $aItem['Caption'] = '';
1930  break;
1931  }
1932  break;
1933  }
1934 
1935  $aInput['name'] = ( $aItem['Type'] == 'system' ) ? $aItem['Name'] : ( $aItem['Name'] . "[$iPerson]" );
1936  $aInput['caption'] = _t( $aItem['Caption'] );
1937  $aInput['required'] = $aItem['Mandatory'];
1938  $aInput['info'] = (
1939  ($sInfo = _t( $aItem['Desc'], $aItem['Min'], $aItem['Max'] )) != $aItem['Desc']) // if info is translated
1940  ? $sInfo : null;
1941 
1942  if ($aItem['Type'] == 'date') {
1943  $aInput['attrs']['min'] = $aItem['Max'] ? (date('Y') - $aItem['Max']) . '-' . date('m') . '-' . date('d') : (date('Y') - 100) . '-' . date('m') . '-' . date('d');
1944  $aInput['attrs']['max'] = $aItem['Min'] ? (date('Y') - $aItem['Min']) . '-' . date('m') . '-' . date('d') : (date('Y') + 100) . '-' . date('m') . '-' . date('d');
1945  } else {
1946  $aInput['attrs']['min'] = $aItem['Min'];
1947  $aInput['attrs']['max'] = $aItem['Max'];
1948  }
1949 
1950  $aInput['error'] = $aErrors[$iPerson];
1951 
1952  if ($iPerson == 1) {
1953  $aInput['tr_attrs'] = array(
1954  'class' => 'hidable',
1955  'style' => 'display: ' . ($bCouple ? 'table-row' : 'none'),
1956  );
1957 
1958  }
1959 
1960  return $aInput;
1961  }
1962 
1963  function convertValues4Input($mValues, $sUseLKey = 'LKey', $sFormName = '')
1964  {
1965  $aValues = array();
1966 
1967  if (is_array($mValues)) {
1968  foreach ($mValues as $sKey)
1969  $aValues[$sKey] = _t('_FieldValues_' . $sKey);
1970  } elseif (is_string($mValues) and !empty($mValues) and substr($mValues, 0, 2) == $this->sLinkPref) {
1971  $sKey = substr($mValues, 2);
1972  if (isset($GLOBALS['aPreValues'][$sKey]) ) {
1973  $aPValues = $GLOBALS['aPreValues'][$sKey];
1974 
1975  foreach ($aPValues as $k => $r) {
1976  if (!isset($r[$sUseLKey]))
1977  $sUseLKey = 'LKey';
1978  $aValues[$k] = _t($r[$sUseLKey]);
1979  }
1980 
1981  if ('Country' == $sKey && $GLOBALS['oTemplConfig']->bForceSortCountries)
1982  natsort($aValues);
1983 
1984  if(!empty($sFormName) && !empty($this->aAddPleaseSelect[$sFormName]) && is_array($this->aAddPleaseSelect[$sFormName]) && in_array($sKey, $this->aAddPleaseSelect[$sFormName]))
1985  $aValues = array('' => _t('_Please_Select_')) + $aValues;
1986  }
1987  }
1988 
1989  return $aValues;
1990  }
1991 }
CH_WSB_LOCALE_DATE
const CH_WSB_LOCALE_DATE
Definition: utils.inc.php:16
ChWsbProfileFields\collectSearchRequestParams
collectSearchRequestParams()
Definition: ChWsbProfileFields.php:978
getVisitorIP
getVisitorIP($isProxyCheck=true)
Definition: utils.inc.php:643
ChWsbMemberInfo\getObjectInstance
static getObjectInstance($sObject)
Definition: ChWsbMemberInfo.php:39
ChTemplFormView
Definition: ChTemplFormView.php:11
true
if(!defined("TRUE_VAL")) define("TRUE_VAL" true
Definition: constants.inc.php:8
ChWsbProfileFields\checkPostValueForMax
checkPostValueForMax( $aItem, $mValue)
Definition: ChWsbProfileFields.php:473
ChWsbProfileFields
Definition: ChWsbProfileFields.php:13
name
Core AllowHostnameUnderscore underscores are not permitted in host most browsers do the right thing when faced with an underscore in the host name
Definition: Core.AllowHostnameUnderscore.txt:11
$sResult
$sResult
Definition: advanced_settings.php:26
ChWsbProfileFields\checkPostValueForPassConfirm
checkPostValueForPassConfirm( $aItem, $mValue, $iHuman)
Definition: ChWsbProfileFields.php:403
ChWsbProfileFields\getViewableSelectOne
getViewableSelectOne( $mValues, $sValue, $sUseLKey='LKey')
Definition: ChWsbProfileFields.php:929
ChWsbProfileFields\$aBlocks
$aBlocks
Definition: ChWsbProfileFields.php:16
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
$aResult
$aResult
Definition: index.php:19
use
GNU LESSER GENERAL PUBLIC LICENSE February Free Software Inc Franklin Fifth MA USA Everyone is permitted to copy and distribute verbatim copies of this license but changing it is not allowed[This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it By the GNU General Public Licenses are intended to guarantee your freedom to share and change free software to make sure the software is free for all its users This the Lesser General Public applies to some specially designated software packages typically libraries of the Free Software Foundation and other authors who decide to use it You can use it but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular based on the explanations below When we speak of free we are referring to freedom of use
Definition: license.txt:27
$oAlert
$oAlert
Definition: embed.php:15
php
ChWsbStopForumSpam
Definition: ChWsbStopForumSpam.php:12
ChWsbProfileFields\checkPostValueForValues
checkPostValueForValues( $aItem, $mValue)
Definition: ChWsbProfileFields.php:580
ChWsbProfileFields\$aCache
$aCache
Definition: ChWsbProfileFields.php:17
ChWsbProfileFields\getFormsSearch
getFormsSearch($aParams, $bReturnArray=false)
Definition: ChWsbProfileFields.php:1199
ChWsbProfileFields\getDefaultValues
getDefaultValues()
Definition: ChWsbProfileFields.php:605
Thing
Definition: Thing.php:9
ChWsbProfileFields\getFormJoin
getFormJoin($aParams)
Definition: ChWsbProfileFields.php:1431
ChWsbProfileFields\$sLinkPref
$sLinkPref
Definition: ChWsbProfileFields.php:21
$oCache
$oCache
Definition: prof.inc.php:10
ChWsbProfileFields\checkPostValueForSystem
checkPostValueForSystem( $aItem, $mValue)
Definition: ChWsbProfileFields.php:624
ChWsbProfileFields\getPredefinedKeysArr
getPredefinedKeysArr( $sKey)
Definition: ChWsbProfileFields.php:614
$aDate
$aDate
Definition: cron.php:133
ChWsbProfileFields\checkPostValueForUnique
checkPostValueForUnique( $aItem, $mValue, $iHuman, $iProfileID)
Definition: ChWsbProfileFields.php:519
ChWsbProfileFields\checkCaptcha
checkCaptcha( $mValue)
Definition: ChWsbProfileFields.php:678
$oForm
$oForm
Definition: host_tools.php:42
ChWsbProfileFields\getAge
getAge( $sBirthDate)
Definition: ChWsbProfileFields.php:684
ChWsbProfileFields\getProfileFromValues
getProfileFromValues( $aValues)
Definition: ChWsbProfileFields.php:773
ChWsbProfileFields\loadCache
loadCache( $bCycle=true)
Definition: ChWsbProfileFields.php:36
ChWsbProfileFields\processPostValues
processPostValues( $bCouple, &$aValues, &$aErrors, $iPage=0, $iProfileID=0, $iBlockOnly=0)
Definition: ChWsbProfileFields.php:224
ChWsbAlerts
Definition: ChWsbAlerts.php:39
$_GET
$_GET['debug']
Definition: index.php:67
and
and
Definition: license.txt:18
ChWsbProfileFields\getProfilesMatch
getProfilesMatch( $aProf1, $aProf2)
Definition: ChWsbProfileFields.php:1077
getParam
getParam($sParamName, $bUseCache=true)
Definition: db.inc.php:130
$aErrors
switch($last) $aErrors
Definition: index.php:39
ChWsbProfileFields\getValuesFromProfile
getValuesFromProfile( $aProfile)
Definition: ChWsbProfileFields.php:710
ChWsbProfileFields\getCoupleMutualFieldsCopy
getCoupleMutualFieldsCopy()
Definition: ChWsbProfileFields.php:842
ChWsbProfileFields\$aCoupleMutualCopy
$aCoupleMutualCopy
Definition: ChWsbProfileFields.php:19
ChWsbProfileFields\checkPostValueForRangeCorrect
checkPostValueForRangeCorrect( $aItem, $mValue)
Definition: ChWsbProfileFields.php:412
ChWsbProfileFields\_getCoupleMutualFields
_getCoupleMutualFields()
Definition: ChWsbProfileFields.php:812
ChWsbProfileFields\getViewableSelectSet
getViewableSelectSet( $mValues, $sValue, $sUseLKey='LKey')
Definition: ChWsbProfileFields.php:950
$aProfile
$aProfile
Definition: flash.php:14
ChWsbProfileFields\checkPostValue
checkPostValue( $iBlockID, $iItemID, $mValue, $iHuman, $iProfileID)
Definition: ChWsbProfileFields.php:362
htmlspecialchars_adv
htmlspecialchars_adv($string)
Definition: utils.inc.php:302
$site
$site['ver']
Definition: version.inc.php:8
$_REQUEST
$_REQUEST['action']
Definition: cmd.php:11
ChWsbProfileFields\__construct
__construct( $iAreaID)
Definition: ChWsbProfileFields.php:27
type
if(!defined("USER_STATUS_TYPE")) define("USER_STATUS_TYPE" type
Definition: constants.inc.php:13
global
if(!defined("GLOBAL_MODULE")) define("GLOBAL_MODULE" global
Definition: header.inc.php:25
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
time
that in the case of a Adaptation or at a minimum such credit will if a credit for all contributing authors of the Adaptation or Collection then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors For the avoidance of You may only use the credit required by this Section for the purpose of attribution in the manner set out above by exercising Your rights under this You may not implicitly or explicitly assert or imply any connection sponsorship or endorsement by the Original Licensor and or Attribution as of You or Your use of the without the express prior written permission of the Original Licensor and or Attribution Parties Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable if You Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or You must not modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author s honor or reputation Licensor agrees that in those in which any exercise of the right granted in modification or other derogatory action prejudicial to the Original Author s honor and the Licensor will waive or not as this to the fullest extent permitted by the applicable national to enable You to reasonably exercise Your right under Warranties and Disclaimer UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN LICENSOR OFFERS THE WORK AS IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE STATUTORY OR WITHOUT WARRANTIES OF FITNESS FOR A PARTICULAR OR THE ABSENCE OF LATENT OR OTHER OR THE PRESENCE OF ABSENCE OF WHETHER OR NOT DISCOVERABLE SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED SO SUCH EXCLUSION MAY NOT APPLY TO YOU Limitation on Liability EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES Termination This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License Individuals or entities who have received Adaptations or Collections from You under this will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses and will survive any termination of this License Subject to the above terms and the license granted here is Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time
Definition: license.txt:56
value
URI Base such as when URI MakeAbsolute is on You may use a non absolute URI for this value
Definition: URI.Base.txt:11
ChWsbProfileFields\genJsonErrors
genJsonErrors( $aErrors, $bCouple)
Definition: ChWsbProfileFields.php:212
CH_WSB_LOCALE_DATE_SHORT
const CH_WSB_LOCALE_DATE_SHORT
Definition: utils.inc.php:15
ChWsbProfileFields\checkPostValueForCheck
checkPostValueForCheck( $aItem, $mValue)
Definition: ChWsbProfileFields.php:539
ChWsbProfileFields\getCoupleMutualFields
getCoupleMutualFields()
Definition: ChWsbProfileFields.php:837
age
age( $birth_date)
Definition: profiles.inc.php:119
ChWsbProfileFields\checkPostValueForMin
checkPostValueForMin( $aItem, $mValue)
Definition: ChWsbProfileFields.php:423
ChWsbProfileFields\getFormCode
getFormCode($aParams=null)
Definition: ChWsbProfileFields.php:1162
process_pass_data
process_pass_data($text, $strip_tags=0)
Definition: utils.inc.php:290
$iPage
$iPage
Definition: browse.php:50
ChWsbProfileFields\convertJoinField2Input
convertJoinField2Input($aItem, $aParams, $iPerson)
Definition: ChWsbProfileFields.php:1827
default
Attr AllowedFrameTargets _parent and _top Values should be as validation will be done in a case sensitive manner despite W3C s recommendation XHTML Strict does not permit the target attribute so this directive will have no effect in that doctype XHTML does not enable the Target module by default
Definition: Attr.AllowedFrameTargets.txt:10
$logged
$logged['member']
Definition: activation_email.php:16
db_value
db_value($query, $bindings=[], $error_checking=true, $index=0)
Definition: db.inc.php:98
ChWsbProfileFields\getViewableValue
getViewableValue( $aItem, $sValue)
Definition: ChWsbProfileFields.php:847
$aForm
$aForm
Definition: forgot.php:43
ChWsbProfileFields\$aAddPleaseSelect
$aAddPleaseSelect
Definition: ChWsbProfileFields.php:23
ChWsbProfileFields\convertValues4Input
convertValues4Input($mValues, $sUseLKey='LKey', $sFormName='')
Definition: ChWsbProfileFields.php:1963
encryptUserPwd
encryptUserPwd($sPwd, $sSalt)
Definition: utils.inc.php:1643
ChWsbProfileFields\getFormEdit
getFormEdit($aParams)
Definition: ChWsbProfileFields.php:1579
ChWsbProfileFields\$aCoupleMutual
$aCoupleMutual
Definition: ChWsbProfileFields.php:18
ChWsbProfileFields\convertEditField2Input
convertEditField2Input($aItem, $aParams, $iPerson)
Definition: ChWsbProfileFields.php:1707
ChWsbFormCheckerHelper
Definition: ChWsbForm.php:461
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
getLocaleDate
getLocaleDate($sTimestamp='', $iCode=CH_WSB_LOCALE_DATE_SHORT)
Definition: utils.inc.php:70
ChWsbProfileFields\checkPostValueForMandatory
checkPostValueForMandatory( $aItem, $mValue)
Definition: ChWsbProfileFields.php:555
as
as
Definition: Filter.ExtractStyleBlocks.Escaping.txt:10
ChWsbProfileFields\$iAreaID
$iAreaID
Definition: ChWsbProfileFields.php:14
$sName
$sName
Definition: ChWsbAdminTools.php:853
ch_is_ip_dns_blacklisted
ch_is_ip_dns_blacklisted($sCurIP='', $sType='')
Definition: utils.inc.php:995
ch_is_ip_blocked
ch_is_ip_blocked($sCurIP='')
Definition: utils.inc.php:1042
false
if(!defined("FALSE_VAL")) define("FALSE_VAL" false
Definition: constants.inc.php:9
ChWsbProfileFields\getViewableDate
getViewableDate($sDate, $iFormat=CH_WSB_LOCALE_DATE_SHORT)
Definition: ChWsbProfileFields.php:920
ChWsbPFMCacher
Definition: ChWsbPFM.php:1432
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10
or
Voluntary License Schemes The Licensor waives the right to collect whether individually or
Definition: license.txt:37
$sAge
$sAge
Definition: browse.php:25
ChWsbProfileFields\$aArea
$aArea
Definition: ChWsbProfileFields.php:15
clear_xss
clear_xss($val)
Definition: utils.inc.php:700