2008-11-05 05:32:47 +00:00
|
|
|
<?php defined("SYSPATH") or die("No direct script access.");
|
|
|
|
|
/**
|
|
|
|
|
* Gallery - a web based photo album viewer and editor
|
|
|
|
|
* Copyright (C) 2000-2008 Bharat Mediratta
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or (at
|
|
|
|
|
* your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*/
|
|
|
|
|
class User_Model extends ORM {
|
2008-11-14 05:09:07 +00:00
|
|
|
protected $has_and_belongs_to_many = array("groups");
|
2008-11-11 20:02:43 +00:00
|
|
|
|
2008-11-16 07:51:42 +00:00
|
|
|
var $rules = array(
|
2008-11-15 06:23:09 +00:00
|
|
|
"name" => "required|length[4,32]",
|
2008-11-18 00:38:36 +00:00
|
|
|
"display_name" => "length[0,255]",
|
|
|
|
|
"email" => "valid_email|length[4,255]",
|
2008-11-15 06:23:09 +00:00
|
|
|
"password" => "required|length[5,40]");
|
|
|
|
|
|
2008-11-11 20:02:43 +00:00
|
|
|
public function __set($column, $value) {
|
|
|
|
|
switch ($column) {
|
|
|
|
|
case "password":
|
2008-11-12 15:53:39 +00:00
|
|
|
$value = user::hash_password($value);
|
2008-11-11 20:02:43 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
parent::__set($column, $value);
|
|
|
|
|
}
|
2008-11-05 05:32:47 +00:00
|
|
|
}
|