if(isset($qspl[0])) {\r
if($qspl[0] == "admin") {\r
if(isset($qspl[1])) {\r
- if($qspl[1] == "create") {\r
- return "gwvpmini_RepoCreate";\r
+ if($qspl[1] == "user") {\r
+ return "gwvpmini_AdminUserCreate";\r
}\r
} else {\r
error_log("i got here, where next?");\r
global $BASE_URL;
$totalusers = gwvpmini_GetNUsers();
+ echo "<table><tr valign=\"top\"><td>";
echo "<h2>Users - $totalusers</h2>";
echo "<table border=\"1\">";
echo "<tr><th>Username</th><th>Email Address</th><th>Full Name</th><th>Description</th><th>Control</th></tr>";
echo "<tr><td>$un</td><td>$em</td><td>$fn</td><td>$ds</td><td><a href=\"$BASE_URL/admin/removeuser&id=$id\">Remove</a> <a href=\"$BASE_URL/admin/disableuser&id=$id\">Disable</a></td></tr>";
}
echo "</table>";
+ echo "</td><td>";
+ echo "<h3>Create User</h3>";
+ echo "<form method=\"post\" action=\"$BASE_URL/admin/user/create\">";
+ echo "<table border=\"1\">";\r
+ echo "<tr><th>Username</th><td><input type=\"text\" name=\"username\"></td></tr>";
+ echo "<tr><th>Password</th><td><input type=\"text\" name=\"password\"></td></tr>";
+ echo "<tr><th>Confirm Password</th><td><input type=\"text\" name=\"confpassword\"></td></tr>";
+ echo "<tr><th>Full Name</th><td><input type=\"text\" name=\"fullname\"></td></tr>";
+ echo "<tr><th>Description</th><td><input type=\"text\" name=\"desc\"></td></tr>";
+ echo "<tr><th>Email</th><td><input type=\"text\" name=\"email\"></td></tr>";
+ echo "<tr><th>Confirm Email</th><td><input type=\"text\" name=\"confemail\"></td></tr>";
+ echo "<tr><th>Admin?</th><td><input type=\"checkbox\" name=\"isadmin\"></td></tr>";
+ echo "<tr><td colspan=\"2\"><input type=\"submit\" name=\"Add\" value=\"Add\"></td></tr>";
+ echo "</table>";
+ echo "</form>";
+ echo "</td></tr></table>";
$totalrepos = gwvpmini_GetNRepos();
echo "<h2>Repo's - $totalrepos</h2>";
echo "</table>";
}\r
+
+function gwvpmini_AdminUserCreate()
+{
+ global $BASE_URL;
+
+ $name = $_REQUEST["username"];
+ $pass1 = $_REQUEST["password"];
+ $pass2 = $_REQUEST["confpassword"];\r
+ $fname = $_REQUEST["fullname"];
+ $desc = $_REQUEST["desc"];
+ $email1 = $_REQUEST["email"];\r
+ $email2 = $_REQUEST["confemail"];
+ if(isset($_REQUEST["isadmin"])) $level = 1;
+ else $level = 0;\r
+
+ $id = gwvpmini_GetUserId($name);
+
+ if(!$id) {
+ if($pass1 != $pass2) {
+ gwvpmini_SendMessage("error", "Passwords dont match");
+ header("Location: $BASE_URL/admin");
+ return;
+ }
+ if($email1 != $email2) {
+ gwvpmini_SendMessage("error", "Email Addresses dont match");
+ header("Location: $BASE_URL/admin");
+ return;
+ }
+
+ gwvpmini_AddUser($name, $pass1, $fname, $email1, $desc, $level, 0);
+ gwvpmini_SendMessage("info", "User $fname created");
+ } else {
+ gwvpmini_SendMessage("error", "User $name already exists, cant create");
+ }
+
+ header("Location: $BASE_URL/admin");
+ return;
+
+}
?>
\ No newline at end of file
function gwvpmini_RepoMainPageBody()
{
+ global $BASE_URL;
+
gwvpmini_GitCreateRepoForm();
if(gwvpmini_isLoggedIn()) {
$repos = gwvpmini_GetOwnedRepos($_SESSION["username"]);
foreach($repos as $repo) {
$name = $repo["name"];
$desc = $repo["desc"];
- echo "<tr><td>$name</td><td>$desc</td>";
+ echo "<tr><td><a href=\"$BASE_URL/view/$name\">$name</a></td><td>$desc</td>";
echo "<td>";\r
$repo_base = gwvpmini_getConfigVal("repodir");\r
$cmd = "git --git-dir=\"$repo_base/$name.git\" log -1 2>&1";\r
*\r
* Or... should we instead just list every repo?\r
*/
+
+ global $BASE_URL;
+
echo "<h2>Repo Activity</h2>";
if(gwvpmini_isLoggedIn()) {\r
$repos = gwvpmini_GetOwnedRepos($_SESSION["username"]);
foreach($repos as $repo) {
$name = $repo["name"];
$desc = $repo["desc"];
- echo "<tr><td>$name</td><td>$desc</td>";
+ echo "<tr><td><a href=\"$BASE_URL/view/$name\">$name</a></td><td>$desc</td>";
echo "<td>";
$repo_base = gwvpmini_getConfigVal("repodir");
$cmd = "git --git-dir=\"$repo_base/$name.git\" log -1 2>&1";
--- /dev/null
+<?php
+global $HOME_PAGE_PROVIDERS;
+
+
+$CALL_ME_FUNCTIONS["repoview"] = "gwvpmini_RepoViewCallMe";
+
+
+
+function gwvpmini_RepoViewCallMe()
+{
+ global $repo_view_call;
+
+ error_log("in admin callme");\r
+ if(isset($_REQUEST["q"])) {\r
+ $query = $_REQUEST["q"];\r
+ $qspl = explode("/", $query);\r
+ if(isset($qspl[0])) {\r
+ if($qspl[0] == "view") {\r
+ if(isset($qspl[1])) {
+ $repo_view_call = $qspl[1];
+ return "gwvpmini_RepoViewPage";\r
+ } else return false;\r
+ } else return false;\r
+ }\r
+ else return false;\r
+ }\r
+\r
+ return false;\r
+
+
+}
+
+function gwvpmini_RepoViewPage()\r
+{
+ global $repo_view_call, $MENU_ITEMS, $BASE_URL;\r
+ \r
+ $MENU_ITEMS["40thisrepo"]["text"] = "$repo_view_call";\r
+ $MENU_ITEMS["40thisrepo"]["link"] = "$BASE_URL/view/$repo_view_call";\r
+ \r
+ gwvpmini_goMainPage("gwvpmini_RepoViewPageBody");\r
+}
+
+function gwvpmini_RepoViewPageBody()
+{
+ global $repo_view_call, $MENU_ITEMS;\r
+
+
+ echo "In repoview call for $repo_view_call";
+}
+\r
+
+?>
\ No newline at end of file