1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 05:37: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

@@ -372,10 +372,13 @@ class redirection
if(defset('e_DEBUG') === 'redirect')
{
$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");
e107::getLog()->toFile('redirect.log',true);
echo "debug active";
$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);
return;
}

View File

@@ -56,7 +56,7 @@ class download
$this->qry['from'] = 0;
// v2.x
if(varset($_GET['action']))
if(!empty($_GET['action']))
{
$this->qry['action'] = (string) $_GET['action'];
$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['sort'] = (varset($_GET['sort']) == 'asc') ? "asc" : 'desc';
$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.
{
@@ -84,9 +89,7 @@ class download
}
// v1.x
// v1.x
if(varset($_POST['view']))
{
$this->qry['view'] = varset($_POST['view']) ? intval($_POST['view']) : 10;
@@ -94,7 +97,7 @@ class download
$this->qry['sort'] = (strtolower($_POST['sort']) == 'asc') ? "asc" : 'desc';
}
}
@@ -894,7 +897,7 @@ class download
$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}");
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;
}
}
@@ -246,12 +249,13 @@ if ($type == "file")
(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();
}
else
{
header("Location: ".trim($pref['download_denied']));
e107::redirect(trim($pref['download_denied']));
exit();
}
}
@@ -305,7 +309,7 @@ $image = ($table == "upload" ? $upload_ss : $download_image);
if (strpos($image, "http") !== FALSE)
{
header("Location: {$image}");
e107::redirect($image);
exit();
}
else
@@ -379,7 +383,9 @@ function check_download_limits()
if($row['count'] >= $limits['gen_intdata'])
{
// 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);
$ns->tablerender(LAN_ERROR, LAN_dl_62);
require(FOOTERF); */
@@ -409,7 +415,9 @@ function check_download_limits()
if($row['total_bw'] / 1024 > $limit['gen_user_id'])
{ //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);
$ns->tablerender(LAN_ERROR, LAN_dl_62);
require(FOOTERF); */