summaryrefslogtreecommitdiffstats
path: root/system/libraries/Validation.php
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2008-01-28 16:54:45 +0100
committerDerek Jones <derek.jones@ellislab.com>2008-01-28 16:54:45 +0100
commit15130caa8d3f4650d383647050ce918de728bc53 (patch)
treed57277bef5e51e7ae4fc72e9fe360f9e17463db7 /system/libraries/Validation.php
parentb261439cf3f12ce047b4dcc576fcbd511075ba29 (diff)
* Added valid_base64() to the Validation class
* Tightened up validation of the supplied string given to the decode() method of the Encryption class (#3320)
Diffstat (limited to 'system/libraries/Validation.php')
-rw-r--r--system/libraries/Validation.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/system/libraries/Validation.php b/system/libraries/Validation.php
index 162d362da..7720a7d17 100644
--- a/system/libraries/Validation.php
+++ b/system/libraries/Validation.php
@@ -573,6 +573,23 @@ class CI_Validation {
// --------------------------------------------------------------------
/**
+ * Valid Base64
+ *
+ * Tests a string for characters outside of the Base64 alphabet
+ * as defined by RFC 2045 http://www.faqs.org/rfcs/rfc2045
+ *
+ * @access public
+ * @param string
+ * @return bool
+ */
+ function valid_base64($str)
+ {
+ return (bool) ! preg_match('/[^a-zA-Z0-9\/\+=]/', $str);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Set Select
*
* Enables pull-down lists to be set to the value the user