From 03783c4f633dc8353d44ed1578f8941e04c66075 Mon Sep 17 00:00:00 2001 From: Guy Warner Date: Fri, 6 Sep 2013 10:42:02 -0700 Subject: [PATCH] Alert user that projects/ is protected in Phriction Summary: Fixes T3447 - adds check if slug is projects/ alerts user Test Plan: Create new doc in Phriction. Type projects/whatever and get error Reviewers: epriestley Reviewed By: epriestley CC: Korvin, aran Maniphest Tasks: T3447 Differential Revision: https://secure.phabricator.com/D6901 --- .../phriction/controller/PhrictionNewController.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/applications/phriction/controller/PhrictionNewController.php b/src/applications/phriction/controller/PhrictionNewController.php index 0497600ba5..0628406696 100644 --- a/src/applications/phriction/controller/PhrictionNewController.php +++ b/src/applications/phriction/controller/PhrictionNewController.php @@ -33,6 +33,18 @@ final class PhrictionNewController extends PhrictionController { ->addSubmitButton(pht('Edit Document')); return id(new AphrontDialogResponse())->setDialog($dialog); + } elseif (substr($slug, 0, 9) == 'projects/') { + $dialog = new AphrontDialogView(); + $dialog->setSubmitURI('/w/') + ->setTitle(pht('Oops!')) + ->setUser($user) + ->appendChild(pht( + 'You cannot create wiki pages under "projects/", + because they are reserved as project pages. + Create a new project with this name first.')) + ->addCancelButton('/w/', 'Okay'); + return id(new AphrontDialogResponse())->setDialog($dialog); + } else { $uri = '/phriction/edit/?slug='.$slug; return id(new AphrontRedirectResponse())