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

@@ -65,23 +65,23 @@ class Controller_Admin_Adsl extends Controller_Adsl {
public function action_edit() {
$apo = ORM::factory('Product_Plugin_Adsl',$this->request->param('id'));
if (! $qpo->loaded())
if (! $apo->loaded())
throw HTTP_Exception::factory(403,'Plan either doesnt exist, or you are not authorised to see it');
$this->meta->title = 'ADSL Plan: '.$qpo->name();
$this->meta->title = 'ADSL Plan: '.$apo->name();
$test_result = array();
if (! $apo->loaded())
HTTP::redirect(URL::link('admin','adsl/list'));
if ($_POST) {
if ($apo->values($_POST)->changed() AND (! $this->save($apo)))
if ($this->request->post()) {
if ($apo->values($this->request->post())->changed() AND (! $this->save($apo)))
$apo->reload();
if (isset($_POST['test'])) {
$charge = isset($_POST['test']['charge']) ? $_POST['test']['charge'] : FALSE;
$test_result = $apo->allowance($_POST['test'],FALSE,$charge,TRUE);
if ($this->request->post('test')) {
$charge = $this->request->post('test.charge');
$test_result = $apo->allowance($this->request->post('test'),FALSE,$charge,TRUE);
}
}
@@ -161,10 +161,10 @@ class Controller_Admin_Adsl extends Controller_Adsl {
* Reconcile billing for an ADSL supplier
*/
public function action_traffic() {
if (empty($_POST['sid']))
if (! $this->request->post('sid'))
HTTP::redirect(URL::link('admin','adsl/index'));
$aso = ORM::factory('ADSL_Supplier',$_POST['sid']);
$aso = ORM::factory('ADSL_Supplier',$this->request->post('sid'));
if (! $aso->loaded())
HTTP::redirect(URL::link('admin','adsl/index'));

View File

@@ -19,10 +19,10 @@ class Controller_Reseller_Adsl extends Controller_Adsl {
* Reconcile billing for an ADSL supplier
*/
public function action_billing() {
if (empty($_POST['sid']) OR ! $_FILES)
if (! $this->request->post('sid') OR ! $_FILES)
HTTP::redirect(URL::link('reseller','adsl/index'));
$aso = ORM::factory('ADSL_Supplier',$_POST['sid']);
$aso = ORM::factory('ADSL_Supplier',$this->request->post('sid'));
// Process upload
$files = Validation::factory($_FILES)
@@ -59,8 +59,8 @@ class Controller_Reseller_Adsl extends Controller_Adsl {
public function action_index() {
$output = '';
if ($_POST and isset($_POST['sid'])) {
$aso = ORM::factory('ADSL_Supplier',$_POST['sid']);
if ($this->request->post() AND $this->request->post('sid')) {
$aso = ORM::factory('ADSL_Supplier',$this->request->post('sid'));
if (! $aso->loaded())
HTTP::redirect('adsl/index');

View File

@@ -333,8 +333,8 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
$c=0;
// If we came in via a post to show a particular month, then show that, otherwise show the yearly result
if (! is_null($month) AND trim($month)) {
$highchart->title(sprintf('DSL traffic usage for %s',$_POST['month']));
$x = $this->get_traffic_typedaily(strtotime($_POST['month'].'-01'));
$highchart->title(sprintf('DSL traffic usage for %s',Arr::get($_POST,'month')));
$x = $this->get_traffic_typedaily(strtotime(Arr::get($_POST,'month').'-01'));
} else {
$highchart->title(sprintf('Monthly DSL traffic usage as at %s',$this->traffic->find_last()->date));
@@ -417,7 +417,7 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
public function traffic_table($month=NULL) {
// If we came in via a post to show a particular month, then show that, otherwise show the yearly result
if (! is_null($month) AND trim($month)) {
$x = $this->get_traffic_dailytype(strtotime($_POST['month'].'-01'));
$x = $this->get_traffic_dailytype(strtotime(Arr::get($_POST,'month').'-01'));
$index = 'Date';
} else {

View File

@@ -2,7 +2,7 @@
<fieldset>
<legend>Exetel VISP Billing</legend>
<?php echo Form::hidden('sid',$_POST['sid']); ?>
<?php echo Form::hidden('sid',Arr::get($_POST,'sid')); ?>
<?php echo Form::file('csv',array('label'=>'Invoice File','required')); ?>
</fieldset>

View File

@@ -53,7 +53,7 @@
<form class="form-inline" method="POST">
<div class="dl-horizontal">
<dt>View Traffic for</dt>
<dd><?php echo Form::select('month',array_merge(array(''),$o->get_traffic_months()),(isset($_POST['month']) ? $_POST['month'] : ''),array('class'=>'input-small','nocg'=>TRUE)); ?>
<dd><?php echo Form::select('month',array_merge(array(''),$o->get_traffic_months()),Arr::get($_POST,'month',''),array('class'=>'input-small','nocg'=>TRUE)); ?>
<button type="submit" class="btn btn-mini">Submit</button></dd>
</div> <!-- dl-horizontal -->
</form>
@@ -66,11 +66,11 @@
<div class="tab-content">
<div class="tab-pane active" id="tab1">
<?php echo $o->traffic_graph(isset($_POST['month']) ? $_POST['month'] : ''); ?>
<?php echo $o->traffic_graph(Arr::get($_POST,'month','')); ?>
</div> <!-- /tab-pane -->
<div class="tab-pane" id="tab2">
<?php echo $o->traffic_table(isset($_POST['month']) ? $_POST['month'] : ''); ?>
<?php echo $o->traffic_table(Arr::get($_POST,'month','')); ?>
</div> <!-- /tab-pane -->
</div> <!-- /tab-content -->