summaryrefslogtreecommitdiffstats
path: root/apps/admin/lib/myDenyStringValidator.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/admin/lib/myDenyStringValidator.php')
-rw-r--r--apps/admin/lib/myDenyStringValidator.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/apps/admin/lib/myDenyStringValidator.php b/apps/admin/lib/myDenyStringValidator.php
new file mode 100644
index 0000000..d817ea9
--- /dev/null
+++ b/apps/admin/lib/myDenyStringValidator.php
@@ -0,0 +1,38 @@
+<?php
+
+class myDenyStringValidator extends sfValidator
+{
+ public function initialize($context, $parameters = null)
+ {
+ // initialize parent
+ parent::initialize($context);
+
+ // set defaults
+ $this->setParameter('values_error', 'Invalid input');
+
+ $this->getParameterHolder()->add($parameters);
+
+ return true;
+ }
+
+ public function execute(&$value, &$error)
+ {
+ $values = $this->getParameter('values');
+
+ if(!is_array($values))
+ return true;
+
+ foreach($values as $check)
+ {
+ if($check==$value)
+ {
+ $error = $this->getParameter('values_error');
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
+
+?>