summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/database/drivers/mysql/mysql_driver.php5
-rw-r--r--system/libraries/Validation.php27
2 files changed, 28 insertions, 4 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 2bc66ecf2..f435c0bc4 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -314,11 +314,8 @@ class CI_DB_mysql_driver extends CI_DB {
$query = $this->query($this->_count_string . $this->_protect_identifiers('numrows'). " FROM " . $this->_protect_identifiers($this->dbprefix.$table));
- if ($query->num_rows() == 0)
- return '0';
-
$row = $query->row();
- return $row->numrows;
+ return (int)$row->numrows;
}
// --------------------------------------------------------------------
diff --git a/system/libraries/Validation.php b/system/libraries/Validation.php
index d0714d040..18fdba2d3 100644
--- a/system/libraries/Validation.php
+++ b/system/libraries/Validation.php
@@ -488,6 +488,33 @@ class CI_Validation {
// --------------------------------------------------------------------
/**
+ * Valid Emails
+ *
+ * @access public
+ * @param string
+ * @return bool
+ */
+ function valid_emails($str)
+ {
+ if (strpos($str, ',') === FALSE)
+ {
+ return $this->valid_email(trim($str));
+ }
+
+ foreach(explode(',', $str) as $email)
+ {
+ if (trim($email) != '' && $this->valid_email(trim($email)) === FALSE)
+ {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Validate IP Address
*
* @access public