2008-11-20 01:25:29 +00:00
|
|
|
<?php defined("SYSPATH") or die("No direct script access.");
|
|
|
|
|
/**
|
|
|
|
|
* Gallery - a web based photo album viewer and editor
|
2009-05-13 20:04:58 +00:00
|
|
|
* Copyright (C) 2000-2009 Bharat Mediratta
|
2008-11-20 01:25:29 +00:00
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2008-11-16 06:43:31 +00:00
|
|
|
class Forge extends Forge_Core {
|
2008-12-19 01:24:27 +00:00
|
|
|
/**
|
|
|
|
|
* Force a CSRF element into every form.
|
|
|
|
|
*/
|
|
|
|
|
public function __construct($action=null, $title='', $method=null, $attr=array()) {
|
|
|
|
|
parent::__construct($action, $title, $method, $attr);
|
2009-11-25 20:05:38 -08:00
|
|
|
$this->hidden("csrf")->value(access::csrf_token());
|
2008-12-19 01:24:27 +00:00
|
|
|
}
|
2009-06-01 22:40:22 -07:00
|
|
|
|
2008-12-19 01:24:27 +00:00
|
|
|
/**
|
|
|
|
|
* Use our own template
|
|
|
|
|
*/
|
2008-11-16 06:43:31 +00:00
|
|
|
public function render($template="form.html", $custom=false) {
|
|
|
|
|
return parent::render($template, $custom);
|
|
|
|
|
}
|
2008-11-16 07:51:42 +00:00
|
|
|
|
2008-12-19 01:24:27 +00:00
|
|
|
/**
|
|
|
|
|
* Validate our CSRF value as a mandatory part of all form validation.
|
|
|
|
|
*/
|
|
|
|
|
public function validate() {
|
|
|
|
|
$status = parent::validate();
|
2008-12-22 04:33:18 +00:00
|
|
|
access::verify_csrf();
|
2008-12-19 01:24:27 +00:00
|
|
|
return $status;
|
|
|
|
|
}
|
2008-11-16 06:43:31 +00:00
|
|
|
}
|