X-Git-Url: http://git.pjr.cc/?a=blobdiff_plain;f=gwvpmini%2Fgwvpmini_gitrepo.php;h=1b1466a0337846c7a462562e6fa77fdf24bdc816;hb=d76aa228c79718838a8874fc10a21163e31b732e;hp=1f42a7fab7bb01f355279ea7c4496e036f7d3478;hpb=4d6a42b605b8c52c5621fb704b284e4c12672755;p=gwvp-mini.git diff --git a/gwvpmini/gwvpmini_gitrepo.php b/gwvpmini/gwvpmini_gitrepo.php index 1f42a7f..1b1466a 100644 --- a/gwvpmini/gwvpmini_gitrepo.php +++ b/gwvpmini/gwvpmini_gitrepo.php @@ -124,23 +124,47 @@ function gwvpmini_GitCreateRepoForm() echo "Create Repo"; echo "Repo Name"; echo "Repo Description"; + echo "Read Permissions"; + echo ""; + echo ""; echo ""; echo ""; echo ""; -} +} function gwvpmini_RepoCreate() { global $BASE_URL; - if(gwvpmini_isLoggedIn()) { + // TODO: check the stuff out + // first reponame + $inputcheck = true; + + // remove a .git at the end if it was input + $_REQUEST["reponame"] = preg_replace("/\.git$/", "", $_REQUEST["reponame"]); + + // check for valid chars + $replcheck = preg_replace("/[a-zA-Z0-9_\-\.]/", "", $_REQUEST["reponame"]); + if(strlen($replcheck)>0) { + $inputcheck = false; + $inputcheckerror = "Repo name contains invalid characters, repos can only contain a-z, A-Z, 0-9, _, - and ."; + } + + if(!$inputcheck) { + gwvpmini_SendMessage("error", "$inputcheckerror"); + header("Location: $BASE_URL/repos"); + } else if(gwvpmini_isLoggedIn()) { //gwvpmini_createGitRepo($name, $ownerid, $desc, $bundle=null, $defaultperms=0) if(gwvpmini_HaveRepo($_REQUEST["reponame"])) { gwvpmini_SendMessage("error", "Repo ".$_REQUEST["reponame"]." already exists"); header("Location: $BASE_URL/repos"); } else { - gwvpmini_createGitRepo($_REQUEST["reponame"], $_SESSION["id"], $_REQUEST["repodesc"]); + gwvpmini_createGitRepo($_REQUEST["reponame"], $_SESSION["id"], $_REQUEST["repodesc"], $_REQUEST["perms"]); gwvpmini_SendMessage("info", "Repo ".$_REQUEST["reponame"]." has been created"); header("Location: $BASE_URL/repos"); }