$DB_CONNECTION = false;
}
+
+function gwvp_getConfigVal($confname)
+{
+ /*
+ * $configsql = '
+ CREATE TABLE "config" (
+ "config_name" TEXT,
+ "config_value" TEXT
+ )';
+
+ */
+
+ $conn = gwvp_ConnectDB();
+
+ $sql = "select * from config where config_name='$confname'";
+
+ $res = $conn->query($sql);
+
+ $return = null;
+ foreach($res as $val) {
+ $return = $val;
+ }
+
+}
+
+function gwvp_eraseConfigVal($confname)
+{
+ /*
+ * $configsql = '
+ CREATE TABLE "config" (
+ "config_name" TEXT,
+ "config_value" TEXT
+ )';
+
+ */
+
+ $conn = gwvp_ConnectDB();
+
+ $sql = "delete from config where config_name='$confname'";
+
+ return $conn->query($sql);
+}
+
+function gwvp_setConfigVal($confname, $confval)
+{
+ /*
+ * $configsql = '
+ CREATE TABLE "config" (
+ "config_name" TEXT,
+ "config_value" TEXT
+ )';
+
+ */
+ gwvp_eraseConfigVal($confname);
+
+ $conn = gwvp_ConnectDB();
+
+ $sql = "insert into config values('$confname', '$confval')";
+
+ return $conn->query($sql);
+}
+
+
function gwvp_isDBSetup()
{
// for sqlite, we just check if the db exists, for everyone else, we check for a conneciton and go yay or nay
$rn++;
}
- foreach($gid as $gid_t) {
+ if($gid !== false) foreach($gid as $gid_t) {
/*
* CREATE TABLE groups (
"groups_id" INTEGER,
--- /dev/null
+<?php
+
+// the purpose of this php is to provide input validation functions
+function gwvp_checkEmail($email)
+{
+ $match = preg_match("/^[a-zA-Z0-9\+]+@[a-zA-Z0-9\.]+$/", $email);
+
+ if($match != 1) return false;
+ else return true;
+}
+
+?>
\ No newline at end of file
require_once("gwvpdatabase.php");
require_once("gwvpconfig.php");
require_once("gwvpgitcontrol.php");
+require_once("gwvpinputcheck.php");
// this is loaded second last
require_once("gwvppluginloader.php");
$ingroups = gwvp_getGroupsForUser($email);
$ownedgroups = gwvp_getGroupsOwnedByUser($email);
+ //echo "vardump: ";
+ //var_dump($ownedgroups);
$ugroups = "";
if($ownedgroups == false) $ogroups = "-";
else {
trim($ugroups);
- foreach($ingroups as $grname) {
+ if($ingroups !== false) foreach($ingroups as $grname) {
$isownedgroup = false;
- foreach($ownedgroups as $gr_u) {
+ if($ownedgroups !== false) foreach($ownedgroups as $gr_u) {
if($grname == $gr_u) $isownedgroup = true;
}
if(!$isownedgroup) $ugroups .= "$grname<br>";
--- /dev/null
+<?php
+$lib_base = "../gwvplib/";
+
+// initial http file
+$WEB_ROOT_FS = realpath(dirname(__FILE__));
+$BASE_URL = dirname($_SERVER["PHP_SELF"]);
+
+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);
+}
+
+require_once("gwvplib.php");
+
+
+echo "Doing email validation\n";
+echo "\tasfd@asdf.com (should pass)\n";
+if(gwvp_checkEmail("asdf@asfd.com")) {
+ echo "\tpass\n";
+} else {
+ echo "\tFAIL\n";
+}
+
+echo "\tasfd@asd+af..com (should fail)\n";
+if(gwvp_checkEmail("asfd@asd+af..com")) {
+ echo "\tPASS\n";
+} else {
+ echo "\tfail\n";
+}
+
+
+?>
\ No newline at end of file
<?php
+// this config file is going to reduce down to just db connectivity - thats all
+// all other config will be kept in the db, but not just yet
+
// the config file, this is as exciting as it gets really
$repo_base = "/some/path/to/a/location/where/repos/are/stored";
$lib_base = "../gwvplib/"; // generally this will be correct