Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added MY_Form_validation plus other fix
- Loading branch information
Alessandro Arnodo
committed
Feb 27, 2012
1 parent
c465f6e
commit 6b4f480
Showing
6 changed files
with
107 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | ||
/** | ||
* CodeIgniter MongoDB Library | ||
* | ||
* A library to interact with the NoSQL database MongoDB. | ||
* For more information see http://www.mongodb.org | ||
* | ||
* @package CodeIgniter | ||
* @author Alessandro Arnodo | a.arnodo@gmail.com | @vesparny | ||
* @copyright Copyright (c) 2012, Alessandro Arnodo. | ||
* @license http://www.opensource.org/licenses/mit-license.php | ||
* @link | ||
* @version Version 1.1.0 | ||
* | ||
*/ | ||
|
||
/** | ||
* MY_Form_validation | ||
* | ||
* Override core methods forcing them to interact with MongoDB. | ||
* @since v1.1 | ||
*/ | ||
class MY_Form_validation extends CI_Form_validation{ | ||
|
||
public function __construct($rules = array()) | ||
{ | ||
log_message('debug', '*** Hello from MY_Session ***'); | ||
$this->CI->load->library("cimongo/cimongo"); | ||
parent::__construct($rules); | ||
} | ||
|
||
/** | ||
* is_unique | ||
* | ||
*/ | ||
public function is_unique($str, $field) | ||
{ | ||
list($table, $field)=explode('.', $field); | ||
$query = $this->CI->cimongo->limit(1)->get_where($table, array($field => $str)); | ||
|
||
return $query->num_rows() === 0; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters