From 8d077da40e2795406de3fe68bf9f99d5b921abe5 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 12 Apr 2017 15:38:09 -0700 Subject: [PATCH] DownloadsL Pagination (next/prev) fix. SEF Url methods updated. --- e107_plugins/download/handlers/download_class.php | 13 ++++++------- e107_plugins/download/includes/admin.php | 13 ++++++++----- e107_plugins/download/request.php | 11 +++++++---- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/e107_plugins/download/handlers/download_class.php b/e107_plugins/download/handlers/download_class.php index 92a87f929..ab0af5cf9 100644 --- a/e107_plugins/download/handlers/download_class.php +++ b/e107_plugins/download/handlers/download_class.php @@ -112,7 +112,7 @@ class download $this->qry['id'] = intval($_GET['id']); $this->qry['order'] = vartrue($_GET['order']) && in_array("download_".$_GET['order'],$this->orderOptions) ? $_GET['order'] : $this->qry['order']; $this->qry['sort'] = (varset($_GET['sort']) == 'asc') ? "asc" : 'desc'; - $this->qry['from'] = vartrue($_GET['from'],0); + $this->qry['from'] = varset($_GET['from'],0); if($this->qry['action'] == 'error') { @@ -555,7 +555,7 @@ class download { // $dlrow = $sql->fetch(); - + $catRows = $dlrow; $sc->setVars($dlrow); // Used below for header / breadcrumb. $sc->parent = $this->getParent($this->qry['id']); @@ -728,13 +728,12 @@ class download "; } - - // $newUrl = e_SELF . "?action=list&id={$this->qry['id']}&from=[FROM]&view={$this->qry['view']}&order={$this->qry['order']}&sort={$this->qry['sort']}."; - + $nextprevQry = $this->qry; $nextprevQry['from'] = '[FROM]'; - - $newUrl = e107::getUrl()->create('download/list/category',$nextprevQry); + unset($nextprevQry['id'],$nextprevQry['name'],$nextprevQry['action']); + + $newUrl = e107::url('download','category',$catRows, array('query'=>$nextprevQry)); $nextprev = array( 'tmpl_prefix' =>'default', diff --git a/e107_plugins/download/includes/admin.php b/e107_plugins/download/includes/admin.php index e51444e91..19d104ec5 100644 --- a/e107_plugins/download/includes/admin.php +++ b/e107_plugins/download/includes/admin.php @@ -417,15 +417,18 @@ $columnInfo = array( } } - + + + // optional public function init() { - - $this->action = vartrue($_GET['mode']); - $this->subAction = vartrue($_GET['action']); - $this->id = vartrue($_GET['id']); + + + $this->action = $this->getMode(); // vartrue($_GET['mode']); + $this->subAction = $this->getAction(); // vartrue($_GET['action']); + $this->id = $this->getId(); // vartrue($_GET['id']); $this->observe(); diff --git a/e107_plugins/download/request.php b/e107_plugins/download/request.php index 11414e549..287ed11e0 100644 --- a/e107_plugins/download/request.php +++ b/e107_plugins/download/request.php @@ -76,7 +76,7 @@ if(strstr(e_QUERY, "mirror")) exit(); } - $goUrl = e107::getUrl()->create('download/index')."?action=error&id=1"; + $goUrl = e107::url('download', 'index', null, array('query'=>array('action'=>'error','id'=>1))); // ."?action=error&id=1"; e107::redirect($goUrl); //header("Location: ".e_BASE."download.php?error.{$download_id}.1"); exit; @@ -252,7 +252,8 @@ if ($type == "file") (strpos($pref['download_denied'],"signup.php") && USER == TRUE) )) { - $goUrl = e107::getUrl()->create('download/index')."?action=error&id=1"; + // $goUrl = e107::getUrl()->create('download/index')."?action=error&id=1"; + $goUrl = e107::url('download', 'index', null, array('query'=>array('action'=>'error','id'=>1))); e107::redirect($goUrl); exit(); } @@ -389,7 +390,8 @@ function check_download_limits() if($row['count'] >= $limits['gen_intdata']) { // Exceeded download count limit - $goUrl = e107::getUrl()->create('download/index')."?action=error&id=2"; + // $goUrl = e107::getUrl()->create('download/index')."?action=error&id=2"; + $goUrl = e107::url('download', 'index', null, array('query'=>array('action'=>'error','id'=>2))); e107::redirect($goUrl); // e107::redirect(e_BASE."download.php?error.{$cutoff}.2"); /* require_once(HEADERF); @@ -421,7 +423,8 @@ function check_download_limits() if($row['total_bw'] / 1024 > $limit['gen_user_id']) { //Exceed bandwith limit - $goUrl = e107::getUrl()->create('download/index')."?action=error&id=2"; + // $goUrl = e107::getUrl()->create('download/index')."?action=error&id=2"; + $goUrl = e107::url('download', 'index', null, array('query'=>array('action'=>'error','id'=>2))); e107::redirect($goUrl); // e107::redirect(e_BASE."download.php?error.{$cutoff}.2"); /* require(HEADERF);