2 $CALL_ME_FUNCTIONS["setup"] = "gwvp_SetupCall";
5 function gwvp_SetupCall()
7 if(isset($_REQUEST["q"])) {
8 $query = $_REQUEST["q"];
9 if($query == "postsetup") return "gwvp_PostSetup";
17 function gwvp_PostSetup()
19 gwvp_goMainPage("gwvp_PostSetupPageBody");
22 function gwvp_PostSetupPageBody()
24 echo "GWVP Is now setup, login at the top of the page and you should in control!";
27 // TODO: need to do this bit
28 function gwvp_issetup()
34 function gwvp_goSetup()
38 if(isset($_REQUEST["install"])) {
39 switch($_REQUEST["install"]) {
41 gwvp_goSetupDoInstall();
49 header("Location: $BASE_URL/?install=begin");
53 function gwvp_goSetupGoMain()
56 // interesting, TODO: need a non-unix dependant way of doing this
57 $webusername = exec("whoami");
59 $defrepoloc = "/var/lib/gwvp/gitrepos";
60 $defdataloc = "/var/lib/gwvp/data";
62 $repodata = "$defrepoloc";
63 if(file_exists("$defrepoloc")) {
64 $repodata .= " exists";
65 if(is_writable("$defrepoloc")) {
66 $repodata .= " and is wriable - this is ok as it is";
68 $repodata .= " but is not writable - needs permissions for the web user";
70 } else $repodata .= " does not exist (needs to be created)";
72 $datadata = "$defdataloc";
73 if(file_exists("$defdataloc")) {
74 $datadata .= " exists";
75 if(is_writable("$defdataloc")) {
76 $datadata .= " and is wriable - this is ok as it is";
78 $datadata .= " but is not writable - needs permissions for the web user";
80 } else $datadata .= " does not exist (needs to be created)";
82 echo "<html><body><h1>Welcome to the GWVP setup Page</h1>";
83 echo "Fill out the form below and lets get started<br>";
85 echo "<form method=\"post\"><table>";
86 echo "<input type=\"hidden\" name=\"install\" value=\"tryinstall\">";
87 echo "<tr><td>Site Name</td><td><input type=\"text\" name=\"sitename\"></td><td>Some Name for your site</td></tr>";
88 echo "<tr><td>First User Full Name</td><td><input type=\"text\" name=\"firstuserfullname\"></td><td>The name of the admin of your site</td></tr>";
89 echo "<tr><td>First User email address</td><td><input type=\"text\" name=\"firstuseremail\"></td><td>The email address of the admin of your site (login)</td></tr>";
90 echo "<tr><td>First User Username</td><td><input type=\"text\" name=\"firstuserusername\"></td><td>The name used to idenity the user on the site</td></tr>";
91 echo "<tr><td>First User Password</td><td><input type=\"text\" name=\"pass1\"></td><td>Password for the user</td></tr>";
92 echo "<tr><td>First User Password (confirm)</td><td><input type=\"text\" name=\"pass2\"></td><td>and confirm it...</td></tr>";
93 echo "<tr><td>Database Type</td><td><select name=\"dbtype\"><option value=\"sqlite\">SQLite</option></select></td><td>SQLite only at this point</td></tr>";
94 echo "<tr><td>Database name</td><td><input type=\"text\" name=\"dbname\" value=\"gvwp\"></td><td>For SQLite, this is simple the file on disk</td></tr>";
95 echo "<tr><td>GIT repository storage Location</td><td><input type=\"text\" name=\"repoloc\" value=\"$defrepoloc\"></td><td>The location (on disk) of the repos - you need to create this (see below)</td><td><i><b>Note: $repodata</b></i></td></tr>";
96 echo "<tr><td>Data storage Location</td><td><input type=\"text\" name=\"dataloc\" value=\"$defdataloc\"></td><td>The location (on disk) where the database for this site is stored - you need to create this (see below)</td><td><i><b>Note: $datadata</b></i></td></tr>";
97 echo "<tr><td><input type=\"submit\" value=\"Install\" name=\"Install\"></td></tr>";
98 echo "</table></form>";
100 echo "<hr><h2>GIT Repo Storage Location Creation</h2>";
101 echo "<b>GIT Repo Storage Location</b> - A location (accessible by the web user, $webusername) must be created on disk for this application to store git repositories (and only repositories) in.";
102 echo "To do this, do the following (as root or via sudo):<br>";
103 echo "<li>Create a directory - sudo mkdir -p $defrepoloc<br>";
104 echo "<li>Change ownership of the directory to the web user - sudo chown $webusername $defrepoloc<br>";
105 echo "And, your done<br>";
108 echo "<hr><h2>Data Storage Location Creation</h2>";
109 echo "<b>Data Storage Location</b> - A location (accessible by the web user, $webusername) must be created on disk for this application to store data (such as database information) in.";
110 echo "To do this, do the following (as root or via sudo):<br>";
111 echo "<li>Create a directory - sudo mkdir -p $defdataloc<br>";
112 echo "<li>Change ownership of the directory to the web user - sudo chown $webusername $defdataloc<br>";
113 echo "And, your done<br>";
114 echo "</body></html>";
117 function gwvp_goSetupDoInstall()
119 $sitename = $_REQUEST["sitename"];
120 $fufn = $_REQUEST["firstuserfullname"];
121 $fwem = $_REQUEST["firstuseremail"];
122 $fwusername = $_REQUEST["firstuserusername"];
123 $fwpass = $_REQUEST["pass1"];
124 $fwpassconf = $_REQUEST["pass2"];
125 $dbtype = $_REQUEST["dbtype"];
126 $dbname = $_REQUEST["dbname"];
127 $repoloc = $_REQUEST["repoloc"];
128 $dataloc = $_REQUEST["dataloc"];
132 echo "<tr><td>Sitename</td><td>$sitename</td></tr>";
133 echo "<tr><td>fullname</td><td>$fufn</td></tr>";
134 echo "<tr><td>email</td><td>$fwem</td></tr>";
135 echo "<tr><td>username</td><td>$fwusername</td></tr>";
136 echo "<tr><td>pass</td><td>$fwpass</td></tr>";
137 echo "<tr><td>passconfirm</td><td>$fwpassconf</td></tr>";
138 echo "<tr><td>dbtype</td><td>$dbtype</td></tr>";
139 echo "<tr><td>dbname</td><td>$dbname</td></tr>";
140 echo "<tr><td>repoloc</td><td>$repoloc</td></tr>";
141 echo "<tr><td>dataloc</td><td>$dataloc</td></tr>";
143 echo "</body></html>";