Removed direct references to $_REQUEST and $_POST

This commit is contained in:
Deon George
2016-08-03 16:20:25 +10:00
parent 5f84d2c14f
commit 7adcd1d983
24 changed files with 85 additions and 85 deletions

View File

@@ -23,14 +23,14 @@ class Controller_Admin_Module_Method extends Controller_Admin_Module {
if (! $mo->loaded() OR ! in_array($method,$mm['methods']))
HTTP::redirect(URL::link('admin','module/list'));
if ($_POST) {
if ($this->request->post()) {
$mmo = $mo->module_method;
$mmo->name = $method;
$mmo->module_id = $mo->id;
$mmo->values($_POST);
$mmo->values($this->request->post());
if (! $this->save($mmo))
throw HTTP_Exception::factory(501,'Unable to save data :post',array(':post'=>serialize($_POST)));
throw HTTP_Exception::factory(501,'Unable to save data :post',array(':post'=>serialize($this->request->post())));
HTTP::redirect(URL::link('admin','module/edit/'.$mo->id));
}
@@ -61,15 +61,15 @@ class Controller_Admin_Module_Method extends Controller_Admin_Module {
HTTP::redirect(URL::link('admin','module/list'));
}
if ($_POST) {
$mmo->values($_POST);
if ($this->request->post()) {
$mmo->values($this->request->post());
if (! $this->save($mmo))
throw HTTP_Exception::factory(501,'Unable to save data :post',array(':post'=>serialize($_POST)));
throw HTTP_Exception::factory(501,'Unable to save data :post',array(':post'=>serialize($this->request->post())));
foreach (ORM::factory('Group')->find_all() as $go) {
// If the group was defined and no longer
if ($mmo->has('group',$go) AND (! isset($_POST['groups']) OR ! in_array($go->id,$_POST['groups']))) {
if ($mmo->has('group',$go) AND (! $this->request->post('groups')) OR ! in_array($go->id,$this->request->post('groups'))) {
$gmo = ORM::factory('Group_Method',array('method_id'=>$mmo->id,'group_id'=>$go->id));
if (! $gmo->delete())
@@ -79,7 +79,7 @@ class Controller_Admin_Module_Method extends Controller_Admin_Module {
->body(sprintf(_('Unable to delete Group Method for method %s and group %s'),$mmo->name,$go->name));
// If the group was not defined and now is
} elseif (! $mmo->has('group',$go) AND isset($_POST['groups']) AND in_array($go->id,$_POST['groups'])) {
} elseif (! $mmo->has('group',$go) AND $this->request->post('groups') AND in_array($go->id,$this->request->post('groups'))) {
$gmo = ORM::factory('Group_Method')
->values(array(
'method_id'=>$mmo->id,