X-Git-Url: http://git.pjr.cc/?p=gwvp.git;a=blobdiff_plain;f=gwvplib%2Fgwvpdatabase.php;fp=gwvplib%2Fgwvpdatabase.php;h=8746f0fb40cf288e0951c24589d8a0ccaec99c56;hp=172ffbb3c7d20f11c214014cf2113519c11b0f15;hb=1a1ed3388655bbc4001022fd91f3f5ea3ad4d03a;hpb=4bf1f2ca1b688395eac6e2517fdbce4e87cce0d5 diff --git a/gwvplib/gwvpdatabase.php b/gwvplib/gwvpdatabase.php index 172ffbb..8746f0f 100644 --- a/gwvplib/gwvpdatabase.php +++ b/gwvplib/gwvpdatabase.php @@ -285,6 +285,44 @@ function gwvp_getUser($username=null, $email=null, $id=null) } +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();