X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=app%2FController%2FGithub%2FRepoHook.php;h=9d9ad2cbcabea571cc81ef2e068f2d06d6765479;hb=303950054385d4c55cfef9a8828ee79420b7366e;hp=96240f678015f891be45df43c623fcafe4fc9757;hpb=9e35d9e1f6adb610b17e940616cd1dc4ec8aa0d7;p=pharext%2Fpharext.org diff --git a/app/Controller/Github/RepoHook.php b/app/Controller/Github/RepoHook.php index 96240f6..9d9ad2c 100644 --- a/app/Controller/Github/RepoHook.php +++ b/app/Controller/Github/RepoHook.php @@ -8,19 +8,20 @@ use app\Github\API\Hooks\ListHooks; class RepoHook extends Github { function __invoke(array $args = null) { - if ($this->checkToken()) { - if ($this->app->getRequest()->getRequestMethod() != "POST") { - // user had to re-authenticate, and was redirected here - $this->app->redirect($this->app->getBaseUrl()->mod([ - "path" => "./github/repo/" . $args["owner"] ."/". $args["name"], - "query" => "modal=hook&hook=" . $args["action"] - ])); - } else { - $this->changeHook($args)->done(function() use($args) { - $this->redirectBack($args["owner"]."/".$args["name"]); - }); - $this->github->drain(); - } + if (!$this->checkToken()) { + return; + } + if ($this->app->getRequest()->getRequestMethod() != "POST") { + // user had to re-authenticate, and was redirected here + $this->app->redirect($this->app->getBaseUrl()->mod([ + "path" => "./github/repo/" . $args["owner"] ."/". $args["name"], + "query" => "modal=hook&hook=" . $args["action"] + ])); + } else { + $this->changeHook($args)->done(function() use($args) { + $this->redirectBack($args["owner"]."/".$args["name"]); + }); + $this->github->drain(); } } @@ -79,7 +80,7 @@ class RepoHook extends Github if (($back = $this->app->getRequest()->getForm("returnback")) && isset($this->session->previous)) { $this->app->redirect($this->app->getBaseUrl()->mod($this->session->previous)); } else { - $this->app->redirect($this->app->getBaseUrl()->mod("./github/repo/" . $repo)); + $this->app->redirect($this->app->getBaseUrl()->mod(":./github/repo/" . $repo)); } } }