summaryrefslogtreecommitdiffstats
path: root/system/libraries/Form_validation.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries/Form_validation.php')
-rw-r--r--system/libraries/Form_validation.php37
1 files changed, 26 insertions, 11 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index c78583f4f..3f5323233 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -4,10 +4,22 @@
*
* An open source application development framework for PHP 5.1.6 or newer
*
+ * NOTICE OF LICENSE
+ *
+ * Licensed under the Open Software License version 3.0
+ *
+ * This source file is subject to the Open Software License (OSL 3.0) that is
+ * bundled with this package in the files license.txt / license.rst. It is
+ * also available through the world wide web at this URL:
+ * http://opensource.org/licenses/OSL-3.0
+ * If you did not receive a copy of the license and are unable to obtain it
+ * through the world wide web, please send an email to
+ * licensing@ellislab.com so we can send you a copy immediately.
+ *
* @package CodeIgniter
- * @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
- * @license http://codeigniter.com/user_guide/license.html
+ * @author EllisLab Dev Team
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
* @filesource
@@ -21,7 +33,7 @@
* @package CodeIgniter
* @subpackage Libraries
* @category Validation
- * @author ExpressionEngine Dev Team
+ * @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/libraries/form_validation.html
*/
class CI_Form_validation {
@@ -734,7 +746,7 @@ class CI_Form_validation {
}
// If the data is an array output them one at a time.
- // E.g: form_input('name[]', set_value('name[]');
+ // E.g: form_input('name[]', set_value('name[]');
if (is_array($this->_field_data[$field]['postdata']))
{
return array_shift($this->_field_data[$field]['postdata']);
@@ -937,7 +949,7 @@ class CI_Form_validation {
return ($str !== $field) ? FALSE : TRUE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -950,11 +962,14 @@ class CI_Form_validation {
*/
public function is_unique($str, $field)
{
- list($table, $field)=explode('.', $field);
- $query = $this->CI->db->limit(1)->get_where($table, array($field => $str));
-
- return $query->num_rows() === 0;
- }
+ list($table, $field) = explode('.', $field);
+ if (isset($this->CI->db))
+ {
+ $query = $this->CI->db->limit(1)->get_where($table, array($field => $str));
+ return $query->num_rows() === 0;
+ }
+ return FALSE;
+ }
// --------------------------------------------------------------------