1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 06:07:32 +02:00

Fixes #1486 - Download error-page redirect issue.

This commit is contained in:
Cameron
2016-04-05 10:26:34 -07:00
parent 14d696ae5d
commit 925704309e
3 changed files with 30 additions and 16 deletions

View File

@@ -373,9 +373,12 @@ class redirection
{ {
$error = debug_backtrace(); $error = debug_backtrace();
e107::getLog()->addDebug("URL: ".$url."\nFile: ".$error[1]['file']."\nLine: ".$error[1]['line']."\nClass: ".$error[1]['class']."\nFunction: ".$error[1]['function']."\n\n"); $message = "URL: ".$url."\nFile: ".$error[1]['file']."\nLine: ".$error[1]['line']."\nClass: ".$error[1]['class']."\nFunction: ".$error[1]['function']."\n\n";
e107::getLog()->addDebug($message, true);
echo "Debug active";
print_a($message);
echo "Go to : <a href='".$url."'>".$url."</a>";
e107::getLog()->toFile('redirect.log',true); e107::getLog()->toFile('redirect.log',true);
echo "debug active";
return; return;
} }

View File

@@ -56,7 +56,7 @@ class download
$this->qry['from'] = 0; $this->qry['from'] = 0;
// v2.x // v2.x
if(varset($_GET['action'])) if(!empty($_GET['action']))
{ {
$this->qry['action'] = (string) $_GET['action']; $this->qry['action'] = (string) $_GET['action'];
$this->qry['view'] = varset($_GET['view']) ? intval($_GET['view']) : $this->qry['view']; $this->qry['view'] = varset($_GET['view']) ? intval($_GET['view']) : $this->qry['view'];
@@ -64,6 +64,11 @@ class download
$this->qry['order'] = vartrue($_GET['order']) && in_array("download_".$_GET['order'],$this->orderOptions) ? $_GET['order'] : $this->qry['order']; $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['sort'] = (varset($_GET['sort']) == 'asc') ? "asc" : 'desc';
$this->qry['from'] = vartrue($_GET['from'],0); $this->qry['from'] = vartrue($_GET['from'],0);
if($this->qry['action'] == 'error')
{
$this->qry['error'] = intval($this->qry['id']);
}
} }
else // v1.x Legacy URL support. else // v1.x Legacy URL support.
{ {
@@ -84,8 +89,6 @@ class download
} }
// v1.x // v1.x
if(varset($_POST['view'])) if(varset($_POST['view']))
{ {
@@ -894,7 +897,7 @@ class download
$errmsg = LAN_ERROR." ".$this->qry['error']; $errmsg = LAN_ERROR." ".$this->qry['error'];
} }
return $ns->tablerender(LAN_ERROR, $header. "<div class='alert alert-error alert-danger alert-block' style='text-align:center'>".$errmsg."</div>". $footer, 'download-error', true); return $ns->tablerender(LAN_PLUGIN_DOWNLOAD_NAME, $header. "<div class='alert alert-error alert-danger alert-block' style='text-align:center'>".$errmsg."</div>". $footer, 'download-error', true);
} }

View File

@@ -75,7 +75,10 @@ if(strstr(e_QUERY, "mirror"))
header("Location: {$gaddress}"); header("Location: {$gaddress}");
exit(); exit();
} }
header("Location: ".e_BASE."download.php?error.{$download_id}.1");
$goUrl = e107::getUrl()->create('download/index')."?action=error&id=".$download_id;
e107::redirect($goUrl);
//header("Location: ".e_BASE."download.php?error.{$download_id}.1");
exit; exit;
} }
} }
@@ -246,12 +249,13 @@ if ($type == "file")
(strpos($pref['download_denied'],"signup.php") && USER == TRUE) (strpos($pref['download_denied'],"signup.php") && USER == TRUE)
)) ))
{ {
header("Location: ".e_BASE."download.php?error.{$id}.1"); $goUrl = e107::getUrl()->create('download/index')."?action=error&id=".$id;
e107::redirect($goUrl);
exit(); exit();
} }
else else
{ {
header("Location: ".trim($pref['download_denied'])); e107::redirect(trim($pref['download_denied']));
exit(); exit();
} }
} }
@@ -305,7 +309,7 @@ $image = ($table == "upload" ? $upload_ss : $download_image);
if (strpos($image, "http") !== FALSE) if (strpos($image, "http") !== FALSE)
{ {
header("Location: {$image}"); e107::redirect($image);
exit(); exit();
} }
else else
@@ -379,7 +383,9 @@ function check_download_limits()
if($row['count'] >= $limits['gen_intdata']) if($row['count'] >= $limits['gen_intdata'])
{ {
// Exceeded download count limit // Exceeded download count limit
header("Location: ".e_BASE."download.php?error.{$cutoff}.2"); $goUrl = e107::getUrl()->create('download/index')."?action=error&id=".$cutoff;
e107::redirect($goUrl);
// e107::redirect(e_BASE."download.php?error.{$cutoff}.2");
/* require_once(HEADERF); /* require_once(HEADERF);
$ns->tablerender(LAN_ERROR, LAN_dl_62); $ns->tablerender(LAN_ERROR, LAN_dl_62);
require(FOOTERF); */ require(FOOTERF); */
@@ -409,7 +415,9 @@ function check_download_limits()
if($row['total_bw'] / 1024 > $limit['gen_user_id']) if($row['total_bw'] / 1024 > $limit['gen_user_id'])
{ //Exceed bandwith limit { //Exceed bandwith limit
header("Location: ".e_BASE."download.php?error.{$cutoff}.2"); $goUrl = e107::getUrl()->create('download/index')."?action=error&id=".$cutoff;
e107::redirect($goUrl);
// e107::redirect(e_BASE."download.php?error.{$cutoff}.2");
/* require(HEADERF); /* require(HEADERF);
$ns->tablerender(LAN_ERROR, LAN_dl_62); $ns->tablerender(LAN_ERROR, LAN_dl_62);
require(FOOTERF); */ require(FOOTERF); */