--- /dev/null
+First (for beta release):
+
+need a standard git log parser/collector deal
+need to add activity for repo creation
+get clone working properly
+put "system'd" stuff into variables
+
+Next:
+
+ability to git-view a source code base?
+Chat between people on the site - simplistic chat (or maybe just a simple form that'll send an email)
+
+Long term:
+
+link multiple sites together
+deal with pull's between forks of a repo
\ No newline at end of file
require_once("gwvpmini_activity.php");
require_once("gwvpmini_register.php");
require_once("gwvpmini_user.php");
+require_once("gwvpmini_debug.php");
// require_once("gwvpmini_chat.php"); TODO: disabling chat for now to work on more important interfaces first
if($IS_WEB_REQUEST) {
if(gwvpmini_isLoggedIn()) if(gwvpmini_isUserAdmin()) {
{
global $BASE_URL;
- $id = $_SESSION["id"];
+ $id = -1;
+ if(isset($_SESSION["id"])) $id = $_SESSION["id"];
if($id < 0) {
$ents = gwvpmini_GetActivityLog();
echo "<h2>News</h2>";
echo "<table border=\"1\">";
- foreach($ents as $vals) {
+ if($ents != null) foreach($ents as $vals) {
/*
* $ret[$nent]["type"] = $vals["activity_type"];
$ret[$nent]["date"] = $vals["activity_date"];
return $conn->query($sql);\r
}
-function gwvpmini_AddRepo($name, $desc, $ownerid, $clonefrom)
+function gwvpmini_AddRepo($name, $desc, $ownerid, $defperms, $clonefrom)
{
// error_log("addrepo in db for $name, $desc, $ownerid");
$conn = gwvpmini_ConnectDB();\r
- $perms["b"] = "a";
+ $perms["b"] = $defperms;
$encperms = base64_encode(serialize($perms));
--- /dev/null
+<?php
+
+$CALL_ME_FUNCTIONS["debug"] = "gwvpmini_DebugCallMe";
+
+$MENU_ITEMS["99debug"]["text"] = "Debug";\r
+$MENU_ITEMS["99debug"]["link"] = "$BASE_URL/debug";\r
+
+
+function gwvpmini_DebugCallMe()\r
+{\r
+\r
+ // 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] == "debug") {
+ return "gwvpmini_DebugPage";
+ }\r
+ }
+ }
+
+ return false;
+} \r
+\r
+function gwvpmini_DebugPage()
+{
+ gwvpmini_goMainPage("gwvpmini_DebugPageBody");
+}
+
+function gwvpmini_DebugPageBody()
+{
+ echo "Dumping perms data:";
+
+ $db = gwvpmini_ConnectDB();
+
+ $res = $db->query("select * from repos");
+ foreach($res as $row) {
+ $repo = $row["repos_name"];
+ $perms = $row["repos_perms"];
+ echo "<br>Repo: $repo: <pre>";
+ print_r(unserialize(base64_decode($perms)));
+ echo "</pre>";
+ }
+}
+?>
\ No newline at end of file
// we do an update server cause its weird and i cant figure out when it actually needs to happen
chdir("$repo_base/$repo.git");
- exec("/usr/bin/git update-server-info");
+ // dont believe i have to do this
+ //exec("/usr/bin/git update-server-info");
if(!file_exists("$repo_base/$repo.git/hooks/pre-receive") || !file_exists("$repo_base/$repo.git/hooks/update")) {
// error_log("WRITING HOOKS");
// 0 - anyone can clone/read, only owner can write
// 1 - noone can clone/read, repo is visible (i.e. name), only owner can read/write repo
// 2 - only owner can see anything
-function gwvpmini_createGitRepo($name, $ownerid, $desc, $clonefrom)
+function gwvpmini_createGitRepo($name, $ownerid, $desc, $defperms, $clonefrom, $isremoteclone)
{
$repo_base = gwvpmini_getConfigVal("repodir");
if($clonefrom !== false) {
-
+ error_log("how did i end up in clonefrom? $clonefrom");
+ if(!$isremoteclone) {
+ exec("/usr/bin/git clone --bare $repo_base/$clonefrom.git $repo_base/$name.git >> /tmp/gitlog 2>&1");
+ }
} else {
// phew, this works, but i tell you this - bundles arent quite as nice as they should be
// error_log("would create $repo_base/$name.git");
- exec("/usr/bin/git init $repo_base/$name.git --bare > /tmp/gitlog 2>&1");
+ exec("/usr/bin/git init $repo_base/$name.git --bare >> /tmp/gitlog 2>&1");
chdir("$repo_base/$name.git");
exec("/usr/bin/git update-server-info");
// gwvpmini_AddRepo($reponame, $repodesc, $repoowner, $defaultperms = 0)
- gwvpmini_AddRepo($name, $desc, $ownerid, $clonefrom);
+ gwvpmini_AddRepo($name, $desc, $ownerid, $defperms, $clonefrom);
}
return true;
if($clonefrom !== false && $fromremote == false) {
// check the local repo exists
$rn = gwvpmini_getRepo(null, $clonefrom, null);
+ $uid = $_SESSION["id"];
+
if($rn == false) {
- gwvpmini_SendMessage("error", "local repo $clonefrom given as upstream clone, however $clonefrom doesnt exist on this site");
+ gwvpmini_SendMessage("error", "local repo $clonefrom given as upstream clone, however $clonefrom doesnt exist on this site (or you cant read it)");
header("Location: $BASE_URL/repos");
return;
}
+
+ // resolve repo permissions on the read/clone
+ if(gwvpmini_GetRepoPerm($rn, $uid) < 1) {
+ gwvpmini_SendMessage("error", "local repo $clonefrom given as upstream clone, however $clonefrom doesnt exist on this site (or you cant read it)");
+ header("Location: $BASE_URL/repos");
+ return;
+ }
+ }
+
+ $defperms = "a";
+ switch($_REQUEST["perms"]) {
+ case "perms-registered":
+ $defperms = "r";
+ break;
+ case "perms-onlywrite":
+ $defperms = "x";
+ break;
}
if(!$inputcheck) {
gwvpmini_SendMessage("error", "Repo ".$_REQUEST["reponame"]." already exists");\r
header("Location: $BASE_URL/repos");
} else {
- gwvpmini_createGitRepo($_REQUEST["reponame"], $_SESSION["id"], $_REQUEST["repodesc"], $_REQUEST["perms"], $clonefrom);
+ gwvpmini_createGitRepo($_REQUEST["reponame"], $_SESSION["id"], $_REQUEST["repodesc"], $defperms, $clonefrom, $fromremote);
gwvpmini_SendMessage("info", "Repo ".$_REQUEST["reponame"]." has been created");
header("Location: $BASE_URL/repos");
}