From 4b2e1344b4e4d110a9f61d09b8756d9948de24ac Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 25 Nov 2009 20:05:38 -0800 Subject: Move the CSRF initialization into the constructor, I don't see why we need it also in render(). --- modules/gallery/libraries/MY_Forge.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'modules/gallery/libraries/MY_Forge.php') diff --git a/modules/gallery/libraries/MY_Forge.php b/modules/gallery/libraries/MY_Forge.php index b40d067d..6bdadea3 100644 --- a/modules/gallery/libraries/MY_Forge.php +++ b/modules/gallery/libraries/MY_Forge.php @@ -24,14 +24,13 @@ class Forge extends Forge_Core { */ public function __construct($action=null, $title='', $method=null, $attr=array()) { parent::__construct($action, $title, $method, $attr); - $this->hidden("csrf")->value(""); + $this->hidden("csrf")->value(access::csrf_token()); } /** * Use our own template */ public function render($template="form.html", $custom=false) { - $this->hidden["csrf"]->value(access::csrf_token()); return parent::render($template, $custom); } -- cgit v1.2.3 From 2ee38b3d8e7c2789c776c6665e2595bb6561acc6 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 26 Nov 2009 11:36:09 -0800 Subject: ORM::$rules now has a special meaning. Use $form_rules for our internal rules code. --- modules/gallery/libraries/MY_Forge.php | 4 ++-- modules/gallery/models/item.php | 2 +- modules/user/models/group.php | 2 +- modules/user/models/user.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'modules/gallery/libraries/MY_Forge.php') diff --git a/modules/gallery/libraries/MY_Forge.php b/modules/gallery/libraries/MY_Forge.php index 6bdadea3..9564f941 100644 --- a/modules/gallery/libraries/MY_Forge.php +++ b/modules/gallery/libraries/MY_Forge.php @@ -42,8 +42,8 @@ class Forge extends Forge_Core { if (isset($input->inputs)) { $input->add_rules_from($model); } - if (isset($model->rules[$name])) { - $input->rules($model->rules[$name]); + if (isset($model->form_rules[$name])) { + $input->rules($model->form_rules[$name]); } } } diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 1efac37f..c8386b1c 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -21,7 +21,7 @@ class Item_Model extends ORM_MPTT { protected $children = 'items'; protected $sorting = array(); - var $rules = array( + var $form_rules = array( "name" => "required|length[0,255]", "title" => "required|length[0,255]", "description" => "length[0,65535]", diff --git a/modules/user/models/group.php b/modules/user/models/group.php index 81f779cf..3a084684 100644 --- a/modules/user/models/group.php +++ b/modules/user/models/group.php @@ -20,7 +20,7 @@ class Group_Model extends ORM implements Group_Definition { protected $has_and_belongs_to_many = array("users"); - var $rules = array( + var $form_rules = array( "name" => "required|length[4,255]"); /** diff --git a/modules/user/models/user.php b/modules/user/models/user.php index 0d5a2bcd..e14d9b31 100644 --- a/modules/user/models/user.php +++ b/modules/user/models/user.php @@ -20,7 +20,7 @@ class User_Model extends ORM implements User_Definition { protected $has_and_belongs_to_many = array("groups"); - var $rules = array( + var $form_rules = array( "name" => "required|length[1,32]", "full_name" => "length[0,255]", "email" => "required|valid_email|length[1,255]", -- cgit v1.2.3