$repo_base = gwvpmini_getConfigVal("repodir");
+ sleep(60);
+
$from = $argv[1];
$to = $argv[2];
echo "Would actually clone $from to $to in $data_directory\n";
"repos_status" TEXT,
"repos_origin" TEXT,
UNIQUE(repos_name)\r
- )';\r
+ )';
+
+ $msgsql = '
+ CREATE TABLE "messages" (
+ "msgs_id" INTEGER PRIMARY KEY AUTOINCREMENT,
+ "msgs_type" TEXT,
+ "msgs_data" TEXT,
+ "msgs_to_id" TEXT
+ )';
+ \r
\r
// this looks like null, <repoid>, <read|visible|write>, user:<uid>|group:<gid>|authed|anon\r
// where authed = any authenticated user, anon = everyone (logged in, not logged in, etc)\r
$DB_CONNECTION->query($initialuser_user);
$DB_CONNECTION->query($reposql);\r
$DB_CONNECTION->query($configsql);
- $DB_CONNECTION->query($activitysql);\r
+ $DB_CONNECTION->query($activitysql);
+ $DB_CONNECTION->query($msgsql);\r
}
function gwvpmini_getConfigVal($confname)\r
\r
return $retval;\r
}
+
+function gwvpmini_SendMessageByDb($type, $data, $forid)
+{
+ $conn = gwvpmini_ConnectDB();
+
+ $sql = "insert into messages values (null, '$type', '$data', '$forid')";
+
+ return $conn->query($sql);
+}
+
+function gwvpmini_GetMessagesForId($uid)
+{
+ /*
+ * $msgsql = '
+ CREATE TABLE "messages" (
+ "msgs_id" INTEGER PRIMARY KEY AUTOINCREMENT,
+ "msgs_type" TEXT,
+ "msgs_data" TEXT,
+ "msgs_to_id" TEXT,
+ )';
+
+ */
+ $conn = gwvpmini_ConnectDB();\r
+ \r
+ $sql = "select * from messages where msgs_to_id='$uid'";\r
+ // error_log("desc for name sql: $sql");\r
+ \r
+ $res = $conn->query($sql);
+
+ error_log("request message for uid, $uid with sql $sql");\r
+
+ $i = 0;\r
+ if(!$res) return 0;\r
+ foreach($res as $row) {
+ $retval[$i]["id"] = $row["msgs_id"];
+ $retval[$i]["type"] = $row["msgs_type"];
+ $retval[$i]["data"] = $row["msgs_data"];
+ $i++;\r
+ }
+
+ \r
+ return $retval;\r
+
+}
+
+function gwvpmini_DeleteMessagesById($mid)
+{
+ $conn = gwvpmini_ConnectDB();\r
+ \r
+ $sql = "delete from messages where msgs_id='$mid'";
+
+ return $conn->query($sql);
+}
\r
function gwvpmini_GetRepoOwnerDetailsFromName($reponame)\r
{\r
// error_log(print_r($row, true));
}
- // error_log(print_r($retval, true));\r
+ error_log(print_r($retval, true));\r
return $retval;\r
}
print_r(unserialize(base64_decode($perms)));
echo "</pre>";
}
+
+ echo "<hr>Sending some messages for db<br>";
+ gwvpmini_SendMessageByDb("info", "message 1", $_SESSION["id"]);
+ gwvpmini_SendMessageByDb("error", "message 1", $_SESSION["id"]);
+ gwvpmini_SendMessageByDb("info", "message 1", $_SESSION["id"]);
+ gwvpmini_SendMessageByDb("error", "message really really reallyrea rea asdf asdf asdf asdf asdf qwef asdf asdr qwef asdf qwef asdf asd fqwe fqs dfa sdf qwe fa sdf asd fq wef qdwf asdf qwe fa sdf asdf a ewfqa wesf awefqefd", $_SESSION["id"]);
+ gwvpmini_SendMessageByDb("info", "message 1 sdfg sdfgs fdg sdfg sdfg sdfg sdfg sdfg sdfgwqerg fb sdvbefd wqerg zsdafg asdfgargf aerg afg agfs qrgasg agf wergafgs sag arg arg asgd arg argsa garg aerg sad gf ar gfasdg asd aweg asasd", $_SESSION["id"]);
+ echo "done<br>";
}
?>
\ No newline at end of file
if(gwvpmini_isLoggedIn()) {
$repos = gwvpmini_GetOwnedRepos($_SESSION["username"]);
+ error_log("repos, ".print_r($repos, true));
if(!$repos) {
echo "You currently own no repos<br>";
} else {
foreach($repos as $repo) {
$name = $repo["name"];
$desc = $repo["desc"];
+ $stat = $repo["status"];
+ $llog = "";\r
+ if($stat != 0) {\r
+ switch($stat) {\r
+ case 1:\r
+ $llog = "Repo Administratively Disabled";\r
+ break;\r
+ case 2:\r
+ $llog = "Repo Cloning from remote";\r
+ break;\r
+ }\r
+ } else {
- if($desc == "") $desc = "none";
-
- $repo_base = gwvpmini_getConfigVal("repodir");
- $cmd = "git --git-dir=\"$repo_base/$name.git\" log --all -1 2> /dev/null";
- echo "<tr><td><a href=\"$BASE_URL/view/$name\">$name</a></td><td>$desc</td>";
- echo "<td>";\r
- // error_log("CMD: $cmd");
- //system("$cmd");
- $fls = popen($cmd, "r");
- $tks = "";
- if($fls !== false) while(!feof($fls)) {
- $tks .= fread($fls,1024);
+ if($desc == "") $desc = "none";
+
+ $repo_base = gwvpmini_getConfigVal("repodir");
+ $cmd = "git --git-dir=\"$repo_base/$name.git\" log --all -1 2> /dev/null";
+ // error_log("CMD: $cmd");
+ //system("$cmd");
+ $fls = popen($cmd, "r");
+ $tks = "";
+ if($fls !== false) while(!feof($fls)) {
+ $tks .= fread($fls,1024);
+ }
+
+ if($tks == "") {
+ $llog = "No Log Info Yet";
+ } else $llog = $tks;
+
}
-
- if($tks == "") {
- echo "No Log Info Yet";
- } else echo $tks;
- echo "</td>";
- echo "</tr>";
+ echo "<tr><td><a href=\"$BASE_URL/view/$name\">$name</a></td><td>$desc</td><td>$llog</td></tr>";
}
echo "</table>";
}
foreach($contreps as $repo) {
$name = $repo["name"];\r
$desc = $repo["desc"];
- $repo_base = gwvpmini_getConfigVal("repodir");\r
- $cmd = "git --git-dir=\"$repo_base/$name.git\" log --all -1 2> /dev/null";
- // error_log("CMD: $cmd");
- //system("$cmd");
- $fls = popen($cmd, "r");
- $tks = "";
- if($fls !== false) while(!feof($fls)) {
- $tks .= fread($fls,1024);
+ $stat = $repo["status"];
+ if($stat != 0) {
+ switch($stat) {
+ case 1:
+ $lastlog = "Repo Administratively Disabled";
+ break;
+ case 2:
+ $lastlog = "Repo Cloning from remote";
+ break;
+ }
+ } else {
+ $repo_base = gwvpmini_getConfigVal("repodir");\r
+ $cmd = "git --git-dir=\"$repo_base/$name.git\" log --all -1 2> /dev/null";
+ // error_log("CMD: $cmd");
+ //system("$cmd");
+ $fls = popen($cmd, "r");
+ $tks = "";
+ if($fls !== false) while(!feof($fls)) {
+ $tks .= fread($fls,1024);
+ }
+
+ if($tks == "") {
+ $lastlog = "No Log Info Yet";
+ } else $lastlog = $tks;
}
- if($tks == "") {
- $lastlog = "No Log Info Yet";
- } else $lastlog = $tks;
-
$owner = gwvpmini_getUser(null, null, $repo["owner"]);
$repname = "<a href=\"$BASE_URL/view/$name\">$name</a>";
$repown = gwvpmini_HtmlGravatar($owner["email"], 30, "<br>")."<a href=\"$BASE_URL/user/".$owner["username"]."\">".$owner["username"]."</a>";
gwvpmini_SearchBuilder();
echo "</td></tr>";\r
-
- if(isset($_SESSION["message"])) {
+ $havemessage = false;
+ if(isset($_SESSION["message"])) $havemessage = true;
+ if(isset($_SESSION["id"])) if(gwvpmini_GetMessagesForId($_SESSION["id"]) !== 0) $havemessage = true;
+
+ if($havemessage) {
echo "<tr width=\"100%\"><td colspan=\"2\">";
gwvpmini_MessageBuilder();
echo "</td></tr>";
// builds the message builder if its needed
function gwvpmini_MessageBuilder()
{
+
+ error_log("begin message building?");
$message = "";
$messagetype = "info";
if(isset($_SESSION["message"])) $message = $_SESSION["message"];
if(isset($_SESSION["messagetype"])) $messagetype = $_SESSION["messagetype"];
-
+ if(isset($_SESSION["id"])) $dbmsgs = gwvpmini_GetMessagesForId($_SESSION["id"]);
+
+ error_log("dbmsgs was 0 - ".print_r($_SESSION,true));
+
+ if($dbmsgs !== 0) {
+ foreach($dbmsgs as $mgkey => $mgval) {
+ $data = $mgval["data"];
+ switch($mgval["type"]) {\r
+ case "info":\r
+ echo "<table border=\"1\" width=\"100%\"><tr width=\"100%\"><td bgcolor=\"#AAFFAA\">$data</td></tr></table>";\r
+ break;\r
+ case "error":\r
+ echo "<table border=\"1\" width=\"100%\"><tr width=\"100%\"><td bgcolor=\"#FFAAAA\">$data</td></tr></table>";\r
+ break;\r
+ }
+ gwvpmini_DeleteMessagesById($mgval["id"]);
+ }
+ }
if($message != "") {
switch($messagetype) {
case "info":