Código PHP:
<?php
class Muro extends AppModel{
var $name = 'Muro';
var $useTable = 'muro';
var $primaryKey = 'muro_id';
var $validate = array(
'dirigido_muro' => array(
'alphaNumeric' => array(
'rule' => 'alphaNumeric'),
'maxLength' => array(
'rule' => array('maxLength', 100))),
'titulo_muro' => array(
'alphaNumeric' => array(
'rule' => 'alphaNumeric',
'required' => true),
'maxLength' => array(
'rule' => array('maxLength', 100))),
'noticia_muro' => array(
'alphaNumeric' => array(
'rule' => 'alphaNumeric',
'required' => true)),
'fecha_expira_muro' => array(
'rule' => 'date')
);
var $belongsTo = array(
'Persona' => array(
'className' => 'Persona',
'foreignkey' => 'persona_id')
);
}
?>
Código PHP:
function alphaNumeric($check) {
$_this =& Validation::getInstance();
$_this->__reset();
$_this->check = $check;
if (is_array($check)) {
$_this->_extract($check);
}
if (empty($_this->check) && $_this->check != '0') {
return false;
}
$_this->regex = '/[^\\ dA-Z]/i';
if ($_this->_check() === true) {
return false;
} else {
return true;
}
}
gracias.