Cheetah
ChWsbForm.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbSession');
9 
10 define('CH_WSB_FORM_METHOD_GET', 'get');
11 define('CH_WSB_FORM_METHOD_POST', 'post');
12 
103 {
104  var $_isValid = true;
106 
109  var $aInputs;
110  var $aParams;
111 
116  var $id;
117 
118  function __construct ($aInfo)
119  {
120  $this->aFormAttrs = isset($aInfo['form_attrs']) ? $aInfo['form_attrs'] : array();
121  $this->aTableAttrs = isset($aInfo['table_attrs']) ? $aInfo['table_attrs'] : array();
122  $this->aInputs = isset($aInfo['inputs']) ? $aInfo['inputs'] : array();
123  $this->aParams = isset($aInfo['params']) ? $aInfo['params'] : array();
124 
125  // get form element id
126  $this->id = $this->aFormAttrs['id'] = (!empty($this->aFormAttrs['id']) ? $this->aFormAttrs['id'] : (!empty($this->aFormAttrs['name']) ? $this->aFormAttrs['name'] : 'form_advanced'));
127 
128  // set default method
129  if (!isset($this->aFormAttrs['method']))
130  $this->aFormAttrs['method'] = CH_WSB_FORM_METHOD_GET;
131 
132  // set default action
133  if (!isset($this->aFormAttrs['action']))
134  $this->aFormAttrs['action'] = '';
135 
136  $this->_sCheckerHelper = isset($this->aParams['checker_helper']) ? $this->aParams['checker_helper'] : '';
137 
139 
140  $oZ = new ChWsbAlerts('form', 'init', 0, 0, array(
141  'form_object' => $this,
142  'form_attrs' => &$this->aFormAttrs,
143  'table_attrs' => &$this->aTableAttrs,
144  'params' => &$this->aParams,
145  'inputs' => &$this->aInputs,
146  ));
147  $oZ->alert();
148  }
149 
150  function initChecker ($aValues = array ())
151  {
152  $oChecker = new ChWsbFormChecker($this->_sCheckerHelper);
153  $oChecker->setFormMethod($this->aFormAttrs['method']);
154 
155  if ($this->isSubmitted ()) {
156  $oChecker->enableFormCsrfChecking(isset($this->aParams['csrf']['disable']) && $this->aParams['csrf']['disable'] === true ? false : true);
157  $this->_isValid = $oChecker->check($this->aInputs);
158  }
159  elseif ($aValues) {
160  $oChecker->fillWithValues($this->aInputs, $aValues);
161  }
162 
163  $oZ = new ChWsbAlerts('form', 'init_checker', 0, 0, array(
164  'values' => $aValues,
165  'checker_object' => $oChecker,
166  'form_object' => $this,
167  'form_attrs' => &$this->aFormAttrs,
168  'table_attrs' => &$this->aTableAttrs,
169  'params' => &$this->aParams,
170  'inputs' => &$this->aInputs,
171  ));
172 
173  $oZ->alert();
174  }
175 
176  function insert ($aValsToAdd = array())
177  {
178  $oChecker = new ChWsbFormChecker($this->_sCheckerHelper);
179  $oChecker->setFormMethod($this->aFormAttrs['method']);
180  $sSql = $oChecker->dbInsert($this->aParams['db'], $this->aInputs, $aValsToAdd);
181  if (!$sSql) return false;
182  if (!db_res ($sSql))
183  return false;
184  $iLastId = db_last_id();
185 
186  $oZ = new ChWsbAlerts('form', 'insert_data', 0, 0, array(
187  'vals_to_add' => $aValsToAdd,
188  'checker_object' => $oChecker,
189  'form_object' => $this,
190  'form_attrs' => &$this->aFormAttrs,
191  'table_attrs' => &$this->aTableAttrs,
192  'params' => &$this->aParams,
193  'inputs' => &$this->aInputs,
194  ));
195  $oZ->alert();
196 
197  return $iLastId;
198  }
199 
200  function update ($val, $aValsToAdd = array())
201  {
202  $oChecker = new ChWsbFormChecker($this->_sCheckerHelper);
203  $oChecker->setFormMethod($this->aFormAttrs['method']);
204  $sSql = $oChecker->dbUpdate($val, $this->aParams['db'], $this->aInputs, $aValsToAdd);
205  if (!$sSql)
206  return false;
207  if (!($res = db_res ($sSql)))
208  return false;
209 
210  $oZ = new ChWsbAlerts('form', 'update_data', 0, 0, array(
211  'val' => $val,
212  'vals_to_add' => $aValsToAdd,
213  'checker_object' => $oChecker,
214  'form_object' => $this,
215  'form_attrs' => &$this->aFormAttrs,
216  'table_attrs' => &$this->aTableAttrs,
217  'params' => &$this->aParams,
218  'inputs' => &$this->aInputs,
219  ));
220  $oZ->alert();
221 
222  return $res;
223  }
224 
225  function generateUri ()
226  {
227  $f = &$this->aParams['db'];
228  $sUri = $this->getCleanValue ($f['uri_title']);
229  return uriGenerate($sUri, $f['table'], $f['uri']);
230  }
231 
233  {
234  $oChecker = new ChWsbFormChecker($this->_sCheckerHelper);
235  $oChecker->setFormMethod($this->aFormAttrs['method']);
236  $a = $this->aInputs[$sName];
237  if ($a)
238  return $oChecker->get ($a['name'], $a['db']['pass'], $a['db']['params'] ? $a['db']['params'] : array());
239  else
240  return $oChecker->get ($sName);
241  }
242 
243  function isSubmitted ()
244  {
245  return ChWsbForm::getSubmittedValue($this->aParams['db']['submit_name'], $this->aFormAttrs['method']) ? true : false;
246  }
247 
248  function isValid ()
249  {
250  return $this->_isValid;
251  }
252 
254  {
255  return ($this->isSubmitted() && $this->isValid());
256  }
257 
258  public static function getSubmittedValue($sKey, $sMethod)
259  {
260  $aData = array();
261  if($sMethod == CH_WSB_FORM_METHOD_GET)
262  $aData = &$_GET;
263  else if($sMethod == CH_WSB_FORM_METHOD_POST)
264  $aData = &$_POST;
265 
266  return isset($aData[$sKey]) ? $aData[$sKey] : false;
267  }
268 
269  // Static Methods related to CSRF Tocken
270  function genCsrfToken($bReturn = false)
271  {
272  if($GLOBALS['MySQL']->getParam('sys_security_form_token_enable') != 'on' || defined('CH_WSB_CRON_EXECUTE'))
273  return;
274 
275  $oSession = ChWsbSession::getInstance();
276 
277  $iCsrfTokenLifetime = (int)$GLOBALS['MySQL']->getParam('sys_security_form_token_lifetime');
278  if($oSession->getValue('csrf_token') === false || ($iCsrfTokenLifetime != 0 && time() - (int)$oSession->getValue('csrf_token_time') > $iCsrfTokenLifetime)) {
279  $sToken = genRndPwd(20, true);
280  $oSession->setValue('csrf_token', $sToken);
281  $oSession->setValue('csrf_token_time', time());
282  } else
283  $sToken = $oSession->getValue('csrf_token');
284 
285  if($bReturn)
286  return $sToken;
287  }
288 
289  public static function getCsrfToken()
290  {
291  $oSession = ChWsbSession::getInstance();
292  return $oSession->getValue('csrf_token');
293  }
294 
295  function getCsrfTokenTime()
296  {
297  $oSession = ChWsbSession::getInstance();
298  return $oSession->getValue('csrf_token_time');
299  }
300 }
301 
303 {
307 
308  function __construct ($sHelper = '')
309  {
310  $this->_sFormMethod = CH_WSB_FORM_METHOD_GET;
311  $this->_bFormCsrfChecking = true;
312 
313  $sCheckerName = !empty($sHelper) ? $sHelper : 'ChWsbFormCheckerHelper';
314  $this->_oChecker = new $sCheckerName();
315  }
316 
317  function setFormMethod($sMethod)
318  {
319  $this->_sFormMethod = $sMethod;
320  }
321 
322  function enableFormCsrfChecking($bFormCsrfChecking)
323  {
324  $this->_bFormCsrfChecking = $bFormCsrfChecking;
325  }
326 
327  // check function
328  function check (&$aInputs)
329  {
330  $oChecker = $this->_oChecker;
331  $iErrors = 0;
332 
333  // check CSRF token if it's needed.
334  if($GLOBALS['MySQL']->getParam('sys_security_form_token_enable') == 'on' && !defined('CH_WSB_CRON_EXECUTE') && $this->_bFormCsrfChecking === true && ($mixedCsrfTokenSys = ChWsbForm::getCsrfToken()) !== false) {
335  $mixedCsrfTokenUsr = ChWsbForm::getSubmittedValue('csrf_token', $this->_sFormMethod);
336  unset($aInputs['csrf_token']);
337 
338  if($mixedCsrfTokenUsr === false || $mixedCsrfTokenSys != $mixedCsrfTokenUsr)
339  return false;
340  }
341 
342  foreach ($aInputs as $k => $a) {
343  $a['name'] = str_replace('[]', '', $a['name']);
344  $val = ChWsbForm::getSubmittedValue($a['name'], $this->_sFormMethod);
345  if($val === false)
346  $val = isset($_FILES[$a['name']]) ? $_FILES[$a['name']] : '';
347 
348  if (!isset ($a['checker'])) {
349  if ($a['type'] != 'checkbox' && $a['type'] != 'submit')
350  $aInputs[$k]['value'] = $_FILES[$a['name']] ? '' : $val;
351  continue;
352  }
353 
354  $sCheckFunction = array($oChecker, 'check'.ucfirst($a['checker']['func']));
355 
356  if (is_callable($sCheckFunction))
357  $bool = call_user_func_array ($sCheckFunction, $a['checker']['params'] ? array_merge(array($val), $a['checker']['params']) : array ($val));
358  else
359  $bool = true;
360 
361  if (is_string($bool)) {
362  ++$iErrors;
363  $aInputs[$k]['error'] = $bool;
364  } elseif (!$bool) {
365  ++$iErrors;
366  $aInputs[$k]['error'] = $a['checker']['error'];
367  }
368  $aInputs[$k]['value'] = $_FILES[$a['name']] ? '' : $val;
369  }
370 
371  // check for spam
372  if (!$iErrors && ('on' == getParam('sys_uridnsbl_enable') || 'on' == getParam('sys_akismet_enable'))) {
373 
374  foreach ($aInputs as $k => $a) {
375 
376  if ($a['type'] != 'textarea')
377  continue;
378 
379  $a['name'] = str_replace('[]', '', $a['name']);
380  $val = ChWsbForm::getSubmittedValue($a['name'], $this->_sFormMethod);
381  if (!$val)
382  continue;
383 
384  if ($oChecker->checkNoSpam($val))
385  continue;
386 
387  ++$iErrors;
388  $aInputs[$k]['error'] = sprintf(_t("_sys_spam_detected"), CH_WSB_URL_ROOT . 'contact.php');
389 
390  }
391  }
392 
393  return $iErrors ? false : true;
394  }
395 
396  // get clean value from GET/POST
397  function get ($sName, $sPass = 'Xss', $aParams = array(), $sType = '')
398  {
399  if (!$sPass)
400  $sPass = 'Xss';
402  $val = ChWsbForm::getSubmittedValue($sName, $this->_sFormMethod);
403  $mixedVal = call_user_func_array (array($this->_oChecker, 'pass'.ucfirst($sPass)), $aParams ? array_merge(array($val), $aParams) : array ($val));
404  if (is_array($mixedVal) && 'select_multiple' == $sType)
405  $mixedVal = serialize($mixedVal);
406  return $mixedVal;
407  }
408 
409  // db functions
410  function serializeDbValues (&$aInputs, &$aValsToAdd)
411  {
412  $oChecker = $this->_oChecker;
413  $s = '';
414  foreach ($aInputs as $k => $a) {
415  if (!isset ($a['db'])) continue;
416  $valClean = $this->get ($a['name'], $a['db']['pass'], $a['db']['params'] ? $a['db']['params'] : array(), $a['type']);
417  $s .= "`{$a['name']}` = '$valClean',";
418  $aInputs[$k]['db']['value'] = $valClean;
419  }
420  foreach ($aValsToAdd as $k => $val) {
421  $s .= "`{$k}` = '$val',";
422  }
423  return $s ? substr ($s, 0, -1) : '';
424  }
425 
426  function dbInsert (&$aDb, &$aInputs, $aValsToAdd = array())
427  {
428  if (!$aDb['table']) return '';
429  $sFields = $this->serializeDbValues ($aInputs, $aValsToAdd);
430  if (!$sFields) return '';
431  return "INSERT INTO `{$aDb['table']}` SET $sFields";
432  }
433 
434  function dbUpdate ($val, &$aDb, &$aInputs, $aValsToAdd = array())
435  {
436  if (!$aDb['table'] || !$aDb['key']) return '';
437  $sFields = $this->serializeDbValues ($aInputs, $aValsToAdd);
438  if (!$sFields) return '';
439  return "UPDATE `{$aDb['table']}` SET $sFields WHERE `{$aDb['key']}` = '$val'";
440  }
441 
442  function fillWithValues (&$aInputs, &$aValues)
443  {
444  foreach ($aInputs as $k => $a) {
445  if (!isset($aValues[$k])) continue;
446  $sMethod = 'display'.ucfirst($a['db']['pass']);
447  if (method_exists($this->_oChecker, $sMethod))
448  $aInputs[$k]['value'] = call_user_func_array (array($this->_oChecker, $sMethod), $a['db']['params'] ? array_merge(array($aValues[$k]), $a['db']['params']) : array ($aValues[$k]));
449  else
450  $aInputs[$k]['value'] = $aValues[$k];
451 
452  if ($a['type'] == 'select_box')
453  $aInputs[$k]['value'] = explode (';', $aInputs[$k]['value']);
454  elseif ($a['type'] == 'select_multiple')
455  $aInputs[$k]['value'] = @unserialize($aInputs[$k]['value']);
456  }
457  }
458 }
459 
461 {
462  // check functions - check values for limits or patterns
463 
464  public static function checkLength ($s, $iLenMin, $iLenMax)
465  {
466  if (is_array($s)) {
467  foreach ($s as $k => $v) {
468  $iLen = get_mb_len ($v);
469  if ($iLen < $iLenMin || $iLen > $iLenMax)
470  return false;
471  }
472  return true;
473  }
474  $iLen = get_mb_len ($s);
475  return $iLen >= $iLenMin && $iLen <= $iLenMax ? true : false;
476  }
477 
478  public static function checkDate ($s)
479  {
480  return self::checkPreg ($s, '#^\d+\-\d+\-\d+$#');
481  }
482 
483  public static function checkDateTime ($s)
484  {
485  // remove unnecessary opera's input value;
486  $s = str_replace('T', ' ', $s);
487  $s = str_replace('Z', ':00', $s);
488 
489  return self::checkPreg ($s, '#^\d+\-\d+\-\d+[\sT]{1}\d+:\d+$#');
490  }
491 
492  public static function checkPreg ($s, $r)
493  {
494  if (is_array($s)) {
495  foreach ($s as $k => $v)
496  if (!preg_match($r, $v))
497  return false;
498  return true;
499  }
500  return preg_match($r, $s) ? true : false;
501  }
502 
503  public static function checkAvail ($s)
504  {
505  if (is_array($s)) {
506  return !self::_isEmptyArray($s);
507  }
508  return $s ? true : false;
509  }
510 
511  public static function checkEmail($s)
512  {
513  return filter_var($s, FILTER_VALIDATE_EMAIL) !== false;
514  }
515 
516  public static function checkCaptcha($s)
517  {
518  // init captcha object
519  ch_import('ChWsbCaptcha');
520  $oCaptcha = ChWsbCaptcha::getObjectInstance();
521  if (!$oCaptcha)
522  return false;
523 
524  // try to get "cached" value
525  ch_import('ChWsbSession');
526  $oSession = ChWsbSession::getInstance();
527  $sSessKey = 'captcha-' . $oCaptcha->getUserResponse();
528  if ($iSessVal = $oSession->getValue($sSessKey)) {
529  $oSession->setValue($sSessKey, --$iSessVal);
530  return true;
531  }
532 
533  // perform captcha check
534  if (!$oCaptcha->check ())
535  return false;
536 
537  // "cache" success result (need for repeated AJAX submittions, since origonal captcha can't perform duplicate checking)
538  ch_import('ChWsbSession');
539  $oSession = ChWsbSession::getInstance();
540  $oSession->setValue($sSessKey, 3);
541 
542  return true;
543  }
544 
545  public static function checkNoSpam($val)
546  {
547  return !ch_is_spam($val);
548  }
549 
550  // pass functions, prepare values to insert to database
551  public static function passInt ($s)
552  {
553  if (is_array($s)) {
554  $a = array ();
555  foreach ($s as $k => $v) {
556  $a[$k] = (int)trim($v);
557  }
558  return $a;
559  }
560  return (int)$s;
561  }
562 
563  public static function passFloat ($s)
564  {
565  if (is_array($s)) {
566  $a = array ();
567  foreach ($s as $k => $v) {
568  $a[$k] = (float)$v;
569  }
570  return $a;
571  }
572  return (float)$s;
573  }
574 
575  public static function passDate ($s)
576  {
577  if (is_array($s)) {
578  $a = array ();
579  foreach ($s as $k => $v) {
580  $a[$k] = self::_passDate ($v);
581  }
582  return $a;
583  }
584  return self::_passDate ($s);
585  }
586 
587  public static function passDateUTC ($s)
588  {
589  if (is_array($s)) {
590  $a = array ();
591  foreach ($s as $k => $v) {
592  $a[$k] = self::_passDate ($v, 'gmmktime');
593  }
594  return $a;
595  }
596  return self::_passDate ($s, 'gmmktime');
597  }
598 
599  public static function _passDate ($s, $sFunc = 'mktime')
600  {
601  list($iYear, $iMonth, $iDay) = explode( '-', $s);
602  $iDay = (int)$iDay;
603  $iMonth = (int)$iMonth;
604  $iYear = (int)$iYear;
605  $iRet = $sFunc (0, 0, 0, $iMonth, $iDay, $iYear);
606  return $iRet > 0 ? $iRet : 0;
607  }
608 
609  public static function passDateTime ($s)
610  {
611  if (is_array($s)) {
612  $a = array ();
613  foreach ($s as $k => $v) {
614  $a[$k] = self::_passDateTime ($v);
615  }
616  return $a;
617  }
618  return self::_passDateTime ($s);
619  }
620 
621  public static function passDateTimeUTC ($s)
622  {
623  if (is_array($s)) {
624  $a = array ();
625  foreach ($s as $k => $v) {
626  $a[$k] =self::_passDateTime ($v, 'gmmktime');
627  }
628  return $a;
629  }
630  return self::_passDateTime ($s, 'gmmktime');
631  }
632 
633  public static function _passDateTime ($s, $sFunc = 'mktime')
634  {
635  if (preg_match('#(\d+)\-(\d+)\-(\d+)[\sT]{1}(\d+):(\d+)#', $s, $m)) {
636  $iDay = $m[3];
637  $iMonth = $m[2];
638  $iYear = $m[1];
639  $iH = $m[4];
640  $iM = $m[5];
641  $iRet = $sFunc ($iH, $iM, 0, $iMonth, $iDay, $iYear);
642  return $iRet > 0 ? $iRet : 0;
643  }
644  return self::passDate ($s);
645  }
646 
647  public static function passXss ($s)
648  {
649  if (is_array($s)) {
650  $a = array ();
651  foreach ($s as $k => $v) {
652  $a[$k] = process_db_input ($v, CH_TAGS_STRIP);
653  }
654  return $a;
655  }
657  }
658 
659  public static function passXssHtml ($s)
660  {
661  if (is_array($s)) {
662  $a = array ();
663  foreach ($s as $k => $v) {
664  $a[$k] = process_db_input ($v, CH_TAGS_VALIDATE);
665  }
666  return $a;
667  }
669  }
670 
671  public static function passAll ($s)
672  {
673  if (is_array($s)) {
674  $a = array ();
675  foreach ($s as $k => $v) {
676  $a[$k] = process_db_input ($v, CH_TAGS_NO_ACTION);
677  }
678  return $a;
679  }
681  }
682 
683  public static function passPreg ($s, $r)
684  {
685  if (is_array($s)) {
686  $a = array ();
687  foreach ($s as $k => $v) {
688  $a[$k] = self::_passPreg ($v, $r);
689  }
690  return $a;
691  }
692  return self::_passPreg($s, $r);
693  }
694 
695  public static function _passPreg ($s, $r)
696  {
697  if (preg_match ($r, $s, $m)) {
698  return $m[1];
699  }
700  return '';
701  }
702 
703  public static function passTags ($s)
704  {
705  if (is_array($s)) {
706  $a = array ();
707  foreach ($s as $k => $v) {
708  $a[$k] = self::_passTags ($v);
709  }
710  return $a;
711  }
712  return self::_passTags($s);
713  }
714 
715  public static function _passTags ($s)
716  {
717  $sTags = self::passXss ($s);
718  $aTags = explodeTags($sTags);
719  return implode(",", $aTags);
720  }
721 
722  public static function passCategories ($aa)
723  {
724  if (is_array($aa)) {
725  $a = array ();
726  foreach ($aa as $k => $v)
727  if ($v)
728  $a[$k] = self::passXss ($v);
729  } else {
730  $a = self::passXss ($aa);
731  }
732  return is_array($a) ? implode(CATEGORIES_DIVIDER, $a) : $a;
733 
734  }
735 
736  public static function passBoolean ($s)
737  {
738  if (is_array($s)) {
739  $a = array ();
740  foreach ($s as $k => $v) {
741  $a[$k] = $v == 'on' ? true : false;
742  }
743  return $a;
744  }
745  return $s == 'on' ? true : false;
746  }
747 
748  // display functions, prepare values to output to the screen
749  public static function displayDate ($i)
750  {
751  return date("Y-m-d", $i);
752  }
753 
754  public static function displayDateTime ($i)
755  {
756  return date("Y-m-d H:i", $i);
757  }
758 
759  public static function displayDateUTC ($i)
760  {
761  return gmdate("Y-m-d", $i);
762  }
763 
764  public static function displayDateTimeUTC ($i)
765  {
766  return gmdate("Y-m-d H:i", $i);
767  }
768 
769  // for internal usage only
770  public static function _isEmptyArray ($a)
771  {
772  if (!is_array($a))
773  return true;
774  if (empty($a))
775  return true;
776  foreach ($a as $k => $v)
777  if ($v)
778  return false;
779  return true;
780  }
781 }
process_db_input
process_db_input($sText, $iStripTags=0)
Definition: utils.inc.php:256
ChWsbFormChecker\check
check(&$aInputs)
Definition: ChWsbForm.php:328
explodeTags
explodeTags( $text)
Definition: tags.inc.php:15
ChWsbFormCheckerHelper\_isEmptyArray
static _isEmptyArray($a)
Definition: ChWsbForm.php:770
ChWsbFormCheckerHelper\passXss
static passXss($s)
Definition: ChWsbForm.php:647
ChWsbFormCheckerHelper\checkAvail
static checkAvail($s)
Definition: ChWsbForm.php:503
CH_WSB_FORM_METHOD_GET
const CH_WSB_FORM_METHOD_GET
Definition: ChWsbForm.php:10
ChWsbFormCheckerHelper\_passTags
static _passTags($s)
Definition: ChWsbForm.php:715
ChWsbFormCheckerHelper\checkCaptcha
static checkCaptcha($s)
Definition: ChWsbForm.php:516
$sToken
$sToken
Definition: get_file.php:13
ChWsbFormCheckerHelper\passDateUTC
static passDateUTC($s)
Definition: ChWsbForm.php:587
true
if(!defined("TRUE_VAL")) define("TRUE_VAL" true
Definition: constants.inc.php:8
ChWsbFormCheckerHelper\passCategories
static passCategories($aa)
Definition: ChWsbForm.php:722
ChWsbFormChecker\enableFormCsrfChecking
enableFormCsrfChecking($bFormCsrfChecking)
Definition: ChWsbForm.php:322
ChWsbFormCheckerHelper\checkDate
static checkDate($s)
Definition: ChWsbForm.php:478
$f
global $f
Definition: callback.php:13
ChWsbForm\getCsrfTokenTime
getCsrfTokenTime()
Definition: ChWsbForm.php:295
ChWsbForm\getCleanValue
getCleanValue($sName)
Definition: ChWsbForm.php:232
ChWsbFormCheckerHelper\passDateTimeUTC
static passDateTimeUTC($s)
Definition: ChWsbForm.php:621
ChWsbFormChecker\serializeDbValues
serializeDbValues(&$aInputs, &$aValsToAdd)
Definition: ChWsbForm.php:410
ChWsbForm\__construct
__construct($aInfo)
Definition: ChWsbForm.php:118
uriGenerate
uriGenerate($s, $sTable, $sField, $iMaxLen=255)
Definition: utils.inc.php:900
ChWsbForm\$aParams
$aParams
Definition: ChWsbForm.php:110
ChWsbForm\$_sCheckerHelper
$_sCheckerHelper
Definition: ChWsbForm.php:105
ChWsbFormCheckerHelper\_passPreg
static _passPreg($s, $r)
Definition: ChWsbForm.php:695
CH_TAGS_VALIDATE
const CH_TAGS_VALIDATE
Definition: utils.inc.php:24
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
ChWsbFormChecker\$_oChecker
$_oChecker
Definition: ChWsbForm.php:304
ChWsbFormCheckerHelper\_passDateTime
static _passDateTime($s, $sFunc='mktime')
Definition: ChWsbForm.php:633
php
ChWsbFormCheckerHelper\passXssHtml
static passXssHtml($s)
Definition: ChWsbForm.php:659
$oZ
$oZ
Definition: db.php:20
ChWsbForm\isValid
isValid()
Definition: ChWsbForm.php:248
CH_WSB_FORM_METHOD_POST
const CH_WSB_FORM_METHOD_POST
Definition: ChWsbForm.php:11
ChWsbFormCheckerHelper\passInt
static passInt($s)
Definition: ChWsbForm.php:551
ChWsbFormChecker\$_sFormMethod
$_sFormMethod
Definition: ChWsbForm.php:305
ChWsbForm\isSubmittedAndValid
isSubmittedAndValid()
Definition: ChWsbForm.php:253
CATEGORIES_DIVIDER
const CATEGORIES_DIVIDER
Definition: ChWsbCategories.php:10
ChWsbForm\generateUri
generateUri()
Definition: ChWsbForm.php:225
ChWsbFormChecker\$_bFormCsrfChecking
$_bFormCsrfChecking
Definition: ChWsbForm.php:306
$aInfo
$aInfo
Definition: constants.inc.php:21
ChWsbForm\isSubmitted
isSubmitted()
Definition: ChWsbForm.php:243
ChWsbFormCheckerHelper\checkNoSpam
static checkNoSpam($val)
Definition: ChWsbForm.php:545
ChWsbForm\$aFormAttrs
$aFormAttrs
Definition: ChWsbForm.php:107
ChWsbAlerts
Definition: ChWsbAlerts.php:39
ChWsbFormChecker\fillWithValues
fillWithValues(&$aInputs, &$aValues)
Definition: ChWsbForm.php:442
ChWsbFormCheckerHelper\passAll
static passAll($s)
Definition: ChWsbForm.php:671
ChWsbFormCheckerHelper\passTags
static passTags($s)
Definition: ChWsbForm.php:703
$sType
$sType
Definition: actions.inc.php:11
$_GET
$_GET['debug']
Definition: index.php:67
ChWsbForm\$id
$id
Definition: ChWsbForm.php:116
getParam
getParam($sParamName, $bUseCache=true)
Definition: db.inc.php:130
ChWsbFormCheckerHelper\displayDateUTC
static displayDateUTC($i)
Definition: ChWsbForm.php:759
ChWsbFormCheckerHelper\passDate
static passDate($s)
Definition: ChWsbForm.php:575
ChWsbForm\$_isValid
$_isValid
Definition: ChWsbForm.php:104
ChWsbFormCheckerHelper\displayDateTime
static displayDateTime($i)
Definition: ChWsbForm.php:754
ChWsbFormChecker\dbUpdate
dbUpdate($val, &$aDb, &$aInputs, $aValsToAdd=array())
Definition: ChWsbForm.php:434
ChWsbForm\getCsrfToken
static getCsrfToken()
Definition: ChWsbForm.php:289
ChWsbFormCheckerHelper\displayDate
static displayDate($i)
Definition: ChWsbForm.php:749
db_last_id
db_last_id()
Definition: db.inc.php:47
ChWsbForm\$aInputs
$aInputs
Definition: ChWsbForm.php:109
ChWsbCaptcha\getObjectInstance
static getObjectInstance($sObject=false)
Definition: ChWsbCaptcha.php:74
$sTags
$sTags
Definition: actions.inc.php:12
ChWsbFormCheckerHelper\passFloat
static passFloat($s)
Definition: ChWsbForm.php:563
CH_TAGS_NO_ACTION
const CH_TAGS_NO_ACTION
Definition: utils.inc.php:21
ChWsbFormCheckerHelper\passDateTime
static passDateTime($s)
Definition: ChWsbForm.php:609
ChWsbFormCheckerHelper\checkEmail
static checkEmail($s)
Definition: ChWsbForm.php:511
ChWsbFormCheckerHelper\checkPreg
static checkPreg($s, $r)
Definition: ChWsbForm.php:492
genRndPwd
genRndPwd($iLength=8, $bSpecialCharacters=true)
Definition: utils.inc.php:1618
ChWsbFormCheckerHelper\_passDate
static _passDate($s, $sFunc='mktime')
Definition: ChWsbForm.php:599
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
ChWsbFormChecker
Definition: ChWsbForm.php:303
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
ChWsbForm\insert
insert($aValsToAdd=array())
Definition: ChWsbForm.php:176
ChWsbForm
Definition: ChWsbForm.php:103
ChWsbForm\getSubmittedValue
static getSubmittedValue($sKey, $sMethod)
Definition: ChWsbForm.php:258
ChWsbSession\getInstance
static getInstance()
Definition: ChWsbSession.php:28
ChWsbForm\genCsrfToken
genCsrfToken($bReturn=false)
Definition: ChWsbForm.php:270
CH_TAGS_STRIP
const CH_TAGS_STRIP
Definition: utils.inc.php:22
ChWsbFormCheckerHelper\displayDateTimeUTC
static displayDateTimeUTC($i)
Definition: ChWsbForm.php:764
$s
$s
Definition: embed.php:13
ChWsbFormCheckerHelper\checkDateTime
static checkDateTime($s)
Definition: ChWsbForm.php:483
db_res
db_res($query, $bindings=[])
Definition: db.inc.php:39
get_mb_len
get_mb_len($s)
Definition: utils.inc.php:959
ChWsbFormChecker\setFormMethod
setFormMethod($sMethod)
Definition: ChWsbForm.php:317
ChWsbFormChecker\__construct
__construct($sHelper='')
Definition: ChWsbForm.php:308
ChWsbFormCheckerHelper
Definition: ChWsbForm.php:461
ChWsbFormChecker\dbInsert
dbInsert(&$aDb, &$aInputs, $aValsToAdd=array())
Definition: ChWsbForm.php:426
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
ChWsbFormCheckerHelper\checkLength
static checkLength($s, $iLenMin, $iLenMax)
Definition: ChWsbForm.php:464
ChWsbFormCheckerHelper\passPreg
static passPreg($s, $r)
Definition: ChWsbForm.php:683
as
as
Definition: Filter.ExtractStyleBlocks.Escaping.txt:10
ChWsbForm\initChecker
initChecker($aValues=array())
Definition: ChWsbForm.php:150
$sName
$sName
Definition: ChWsbAdminTools.php:853
false
if(!defined("FALSE_VAL")) define("FALSE_VAL" false
Definition: constants.inc.php:9
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10
ch_is_spam
ch_is_spam($val)
Definition: utils.inc.php:1080
ChWsbFormCheckerHelper\passBoolean
static passBoolean($s)
Definition: ChWsbForm.php:736
ChWsbForm\$aTableAttrs
$aTableAttrs
Definition: ChWsbForm.php:108
ChWsbForm\update
update($val, $aValsToAdd=array())
Definition: ChWsbForm.php:200