TODO
====
+Im thinking about changing the name of my project to something like AGOW (all git over web)
+TGOW (total) or something
+
My basic roadmap of the things I want to do with this project in the order I want to do them:
Alpha Release
gwvp_SendMessage("error", "Login Failed");
header("Location: $BASE_URL");
} else {
+ $details = gwvp_getUser($user);
$_SESSION["isloggedin"] = true;
$_SESSION["username"] = "$user";
$_SESSION["fullname"] = $details["fullname"];
+ $_SESSION["id"] = $details["id"];
if(gwvp_IsUserAdmin($details["email"])) {
$_SESSION["usertype"] = "admin";
} else {
}
+function gwvp_getOwnedRepos($userid = null, $username = null)
+{
+ $conn = gwvp_ConnectDB();
+
+ if($username != null) {
+ $details = gwvp_getUser($username);
+ $uid = $details["id"];
+ $sql = "select * from repos where repos_owner='$uid'";
+ $res = $conn->query($sql);
+ error_log("sql: $sql");
+ } else if($userid != null) {
+ $sql = "select * from repos where repos_owner='$userid'";
+ $res = $conn->query($sql);
+ error_log("sql: $sql");
+ } else return false;
+
+ /*
+ * CREATE TABLE "repos" (
+ "repos_id" INTEGER PRIMARY KEY AUTOINCREMENT,
+ "repos_name" TEXT,
+ "repos_description" TEXT,
+ "repos_owner" INTEGER
+ )';
+
+ */
+
+ $returns = false;
+ $rn = 0;
+ foreach($res as $u_res) {
+ $returns[$rn]["id"] = $u_res["repos_id"];
+ $returns[$rn]["name"] = $u_res["repos_name"];
+ $returns[$rn]["description"] = $u_res["repos_description"];
+ $rn++;
+ }
+
+ return $returns;
+}
+
function gwvp_getUsers()
{
$conn = gwvp_ConnectDB();
return true;
}
+function gwvp_gitBackendInterface_new()
+{
+ // and this is where i re-code the git backend interface from scratch
+ global $repo_base, $BASE_URL;
+
+
+ $repo = "";
+ $newloc = "/";
+ if(isset($_REQUEST["q"])) {
+ $query = $_REQUEST["q"];
+ $qspl = explode("/", $query);
+ $repo = $qspl[1];
+ for($i=2; $i < count($qspl); $i++) {
+ $newloc .= "/".$qspl[$i];
+ }
+ }
+
+
+}
+
+
function gwvp_gitBackendInterface()
{
global $repo_base, $BASE_URL;
require_once("gwvppluginloader.php");
// only enable this if you need it:
-// require_once("gwvpdebug.php");
+require_once("gwvpdebug.php");
?>
\ No newline at end of file
echo "<h2>Repo Management</h2>";
echo "<a href=\"$BASE_URL/admin/repos/create\">Create a Repo</a><br>";
+ if(isset($_SESSION["isloggedin"])) {
+ echo "<h3>Your Repo's</h3>";
+ $ownreps = gwvp_getOwnedRepos($_SESSION["id"]);
+ if($ownreps != false) {
+ echo "<table>";
+ echo "<tr><th>Repo Name</th></tr>";
+ foreach($ownreps as $repos) {
+ $mjay = print_r($repos, true);
+ error_log("snafu: $mjay");
+ $reponame = $repos["name"];
+ echo "<tr><td>$reponame</td></tr>";
+ }
+ echo "</table>";
+ } else {
+ echo "You own no repositories";
+ }
+ echo "<hr>";
+ }
+
// next we need a repo list - with perms checking - ug
// i must also remember that the home page will also contain a list of repos and that this page is solely for maintance
return;
}
+// this funciton returns one of three things
+function gwvp_resolvRepoPerms($userid, $repoid)
+{
+
+}
+
?>
\ No newline at end of file
global $WEB_ROOT_FS, $BASE_URL, $repo_base, $data_directory, $db_type, $db_name, $db_username, $db_password;
-// add gwvplib as if it were a path in ../gwvplib
-if(file_exists($lib_base)) {
- $path = realpath($lib_base);
- set_include_path(get_include_path().PATH_SEPARATOR.$path);
+// the index will search for the base library depending on:
+// if lib_base is set in config.php, it'll go there and nowhere else
+// if lib_base is not set, it'll look for ../gwvplib, /usr/share/php/gwbplib and /usr/share/gwvp/gwvplib
+if(isset($lib_base)) {
+ if(file_exists($lib_base."/gwvplib.php")) {
+ $path = realpath($lib_base);
+ set_include_path(get_include_path().PATH_SEPARATOR.$path);
+ } else {
+ echo "Problem: lib_base is set in the config.php file, but I cant find the actual library<br>";
+ echo "I have to bail";
+ return;
+ }
+} else {
+ if(file_exists("../gwvplib/gwvplib.php")) {
+ $path = realpath("../gwvplib/");
+ set_include_path(get_include_path().PATH_SEPARATOR.$path);
+ } else if(file_exists("/usr/share/php/gwvplib/gwvplib.php")) {
+ $path = realpath("/usr/share/php/gwvplib/");
+ set_include_path(get_include_path().PATH_SEPARATOR.$path);
+ } else if(file_exists("/usr/share/gwvp/gwvplib/gwvplib.php")) {
+ $path = realpath("/usr/share/gwvp/gwvplib/");
+ set_include_path(get_include_path().PATH_SEPARATOR.$path);
+ } else {
+ echo "Problem: lib_base is set in the config.php file, but I cant find the actual library<br>";
+ echo "I have to bail";
+ return;
+ }
}
require_once("gwvplib.php");