Merge pull request #94 from xcxnig/patch-3

精简404、405、500页面逻辑
master
NimaQu 9 years ago committed by GitHub
commit a13413c12e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -64,45 +64,17 @@ class HomeController extends BaseController
public function page404($request, $response, $args)
{
$pics=scandir(BASE_PATH."/public/theme/".(Auth::getUser()->isLogin==false?Config::get("theme"):Auth::getUser()->theme)."/images/error/404/");
if (count($pics)>2) {
$pic=$pics[rand(2, count($pics)-1)];
} else {
$pic="4041.png";
}
$newResponse = $response->withStatus(404);
$newResponse->getBody()->write($this->view()->assign("pic", "/theme/".(Auth::getUser()->isLogin==false?Config::get("theme"):Auth::getUser()->theme)."/images/error/404/".$pic)->display('404.tpl'));
return $newResponse;
return $this->view()->display('404.tpl');
}
public function page405($request, $response, $args)
{
$pics=scandir(BASE_PATH."/public/theme/".(Auth::getUser()->isLogin==false?Config::get("theme"):Auth::getUser()->theme)."/images/error/405/");
if (count($pics)>2) {
$pic=$pics[rand(2, count($pics)-1)];
} else {
$pic="4051.png";
}
$newResponse = $response->withStatus(405);
$newResponse->getBody()->write($this->view()->assign("pic", "/theme/".(Auth::getUser()->isLogin==false?Config::get("theme"):Auth::getUser()->theme)."/images/error/405/".$pic)->display('405.tpl'));
return $newResponse;
return $this->view()->display('4405.tpl');
}
public function page500($request, $response, $args)
{
$pics=scandir(BASE_PATH."/public/theme/".(Auth::getUser()->isLogin==false?Config::get("theme"):Auth::getUser()->theme)."/images/error/500/");
if (count($pics)>2) {
$pic=$pics[rand(2, count($pics)-1)];
} else {
$pic="5001.png";
}
$newResponse = $response->withStatus(500);
$newResponse->getBody()->write($this->view()->assign("pic", "/theme/".(Auth::getUser()->isLogin==false?Config::get("theme"):Auth::getUser()->theme)."/images/error/500/".$pic)->display('500.tpl'));
return $newResponse;
return $this->view()->display('500.tpl');
}
public function codepay_callback($request, $response, $args)

Loading…
Cancel
Save