X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=index.php;h=dac5a8071a17be2227e0e9b49b3205df25bcaa6c;hb=60bf87bb34c4c0216fbbe42458d194e1e76c0aaa;hp=387b642e2c6a2e8a81772bbbf8b29f36b1c1ffcc;hpb=f294eab92a4e44c0ad8790b7875173a1340f4b5c;p=quix0rs-gnu-social.git diff --git a/index.php b/index.php index 387b642e2c..dac5a8071a 100644 --- a/index.php +++ b/index.php @@ -47,7 +47,10 @@ if (!$user && common_config('site', 'private') && $actionfile = INSTALLDIR."/actions/$action.php"; -if (file_exists($actionfile)) { +if (!file_exists($actionfile)) { + $cac = new ClientErrorAction(_('Unknown action'), 404); + $cac->showPage(); +} else { include_once $actionfile; @@ -66,9 +69,19 @@ if (file_exists($actionfile)) { } $config['db']['database'] = $mirror; } - if (call_user_func(array($action_obj, 'prepare'), $_REQUEST)) { - call_user_func(array($action_obj, 'handle'), $_REQUEST); + + try { + if ($action_obj->prepare($_REQUEST)) { + $action_obj->handle($_REQUEST); + } + } catch (ClientException $cex) { + $cac = new ClientErrorAction($cex->getMessage(), $cex->getCode()); + $cac->showPage(); + } catch (ServerException $sex) { // snort snort guffaw + $sac = new ServerErrorAction($sex->getMessage(), $sex->getCode()); + $sac->showPage(); + } catch (Exception $ex) { + $sac = new ServerErrorAction($ex->getMessage()); + $sac->showPage(); } -} else { - common_user_error(_('Unknown action')); -} \ No newline at end of file +}