diff options
Diffstat (limited to 'site/source/modules')
-rw-r--r-- | site/source/modules/auth.php | 238 | ||||
-rw-r--r-- | site/source/modules/default.php | 70 | ||||
-rw-r--r-- | site/source/modules/edit.php | 284 | ||||
-rw-r--r-- | site/source/modules/email_report.php | 87 | ||||
-rw-r--r-- | site/source/modules/layout.php | 293 | ||||
-rw-r--r-- | site/source/modules/menu.php | 49 | ||||
-rw-r--r-- | site/source/modules/people.php | 173 | ||||
-rw-r--r-- | site/source/modules/project.php | 162 | ||||
-rw-r--r-- | site/source/modules/resource.php | 412 | ||||
-rw-r--r-- | site/source/modules/xml.php | 435 |
10 files changed, 2203 insertions, 0 deletions
diff --git a/site/source/modules/auth.php b/site/source/modules/auth.php new file mode 100644 index 0000000..91adcfb --- /dev/null +++ b/site/source/modules/auth.php @@ -0,0 +1,238 @@ +<?php +# Adopt a Developer +# +# Copyright (C) 2004, 2006 Thomas Cort +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +class login_action extends actor { + function execute() { + trigger("html_headers"); + if (isset($_REQUEST['login'])) { + trigger("login"); + } else { + trigger("display_login"); + } + trigger("html_footers"); + return new return_result(true); + } +} + +class display_login_event extends actor { + function execute() { + global $username; + + if ($username == "guest") { + + echo "<br><div align=\"center\"><form action=\"./\" method=\"post\"><table>"; + echo "<tr><td><small>Username: </small></td><td>"; + echo "<input type=\"text\" name=\"username\" size=\"10\"></td></tr><tr><td><small>Password: </small></td><td>"; + echo "<input type=\"password\" name=\"passwd\" size=\"10\"></td></tr><tr><td align=\"center\">"; + echo "<input type=\"hidden\" name=\"a\" value=\"login\">"; + echo "<input type=\"hidden\" name=\"login\" value=\"1\">"; + echo "<input type=\"submit\" id=\"button\" style=\"font-size:8pt;background-color:#cccccc;color:#000000\" value=\"login\">"; + echo "</td><td align=\"center\"><input type=\"reset\" id=\"button\" style=\"font-size:8pt;background-color:#cccccc;color:#000000\" value=\"clear\"></td></tr>"; + echo "</table>"; + echo "</form></div>"; + + } else { + + echo "<h2>Already Logged In</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + + } + + return new return_result(true); + } +} + +class login_event extends actor { + function execute() { + global $username, $accesslevel; + + $_username = isset($_REQUEST['username']) ? doslashes($_REQUEST['username']) : ""; + $password = isset($_REQUEST['passwd']) ? md5($_REQUEST['passwd']): ""; + $sessionid = session_id(); + + if ($_username != "" and $password !="") { + $result = db_query("SELECT users.userid,users.accesslevel FROM users WHERE username='$_username' and passwd='$password';"); + if ($result->has_next()) { + $row = $result->get_row(); + $userid = $row[0]; + $_accesslevel = $row[1]; + $result = db_query("SELECT * FROM sessions WHERE userid = '$userid';"); + + if ($result->has_next() && !db_exec("DELETE FROM sessions WHERE userid = '$userid';")) { + trigger("begin_story"); + echo "<h2>Database Error</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + trigger("end_story"); + } + + if (db_exec("INSERT INTO sessions (sessionid,userid) VALUES ('$sessionid','$userid');")) { + $username = $_username; + $accesslevel = $_accesslevel; + trigger("default"); + } else { + trigger("begin_story"); + echo "<h2>Database Error</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + trigger("end_story"); + } + } else { + trigger("begin_story"); + echo "<h2>Authentication Error</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + trigger("end_story"); + } + } else { + trigger("begin_story"); + echo "<h2>Authentication Error</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + trigger("end_story"); + } + return new return_result(true); + } +} + +class logout_action extends actor { + function execute() { + global $accesslevel, $username; + trigger("html_headers"); + + $sessionid = session_id(); + if (db_exec("DELETE FROM sessions WHERE sessionid = '$sessionid';")) { + session_unset(); + session_destroy(); + $accesslevel = 1; + $username = "guest"; + trigger("begin_story"); + echo "<h2>Logged Out!</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + trigger("end_story"); + echo "<br \>"; + trigger("default"); + } else { + trigger("begin_story"); + echo "<h2>Database Error!</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + trigger("end_story"); + } + trigger("html_footers"); + return new return_result(true); + } +} + +class passwd_action extends actor { + function execute() { + global $accesslevel, $username; + trigger("html_headers"); + if (isset($_REQUEST['passwd'])) { + trigger("passwd"); + } else { + trigger("display_passwd"); + } + trigger("html_footers"); + return new return_result(true); + } +} + +class display_passwd_event extends actor { + function execute() { + global $username; + + trigger("begin_story"); + + if ($username != "guest") { + echo "<h2>Change Password</h2>"; + echo "<form action=\"./\" method=\"post\"><table>"; + echo "<tr><th>Old Password: </td><td bgcolor=\"#eeeeee\" colspan=\"2\">"; + echo "<input type=\"password\" name=\"old_passwd\"></td></tr><tr><td>"; + echo "<tr><th>New Password: </td><td bgcolor=\"#eeeeee\" colspan=\"2\">"; + echo "<input type=\"password\" name=\"new_passwd\"></td></tr><tr><td>"; + echo "<tr><th>Again: </td><td bgcolor=\"#eeeeee\" colspan=\"2\">"; + echo "<input type=\"password\" name=\"again_passwd\"></td></tr><tr><td bgcolor=\"#eeeeee\">"; + echo "<input type=\"hidden\" name=\"a\" value=\"passwd\">"; + echo "<input type=\"hidden\" name=\"passwd\" value=\"1\">"; + echo " </td><td bgcolor=\"#eeeeee\"><input type=\"submit\" id=\"button\" value=\"change\">"; + echo "</td><td bgcolor=\"#eeeeee\"><input type=\"reset\" id=\"button\" value=\"clear\"></td></tr>"; + echo "</table></form>"; + } else { + + echo "<h2>You aren't Logged In!</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + + } + + trigger("end_story"); + return new return_result(true); + } +} + +class passwd_event extends actor { + function execute() { + global $username; + + $old_passwd = isset($_REQUEST['old_passwd']) ? md5($_REQUEST['old_passwd']) : ""; + $again_passwd = isset($_REQUEST['again_passwd']) ? md5($_REQUEST['again_passwd']) : ""; + $new_passwd = isset($_REQUEST['new_passwd']) ? md5($_REQUEST['new_passwd']) : ""; + + if ($old_passwd != "" && $again_passwd != "" && $new_passwd != "") { + if ($new_passwd == $again_passwd) { + $result = db_query("SELECT * from users WHERE username = '$username' AND passwd = '$old_passwd';"); + if ($result->has_next()) { + if (db_exec("UPDATE users SET passwd = '$new_passwd' WHERE username = '$username';")) { + trigger("begin_story"); + echo "<h2>Password Updated!</h2>"; + trigger("end_story"); + echo "<br \>"; + trigger("default"); + } else { + trigger("begin_story"); + echo "<h2>Database Error!</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + trigger("end_story"); + } + } else { + trigger("begin_story"); + echo "<h2>Wrong Old Password!</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + trigger("end_story"); + } + } else { + trigger("begin_story"); + echo "<h2>New and Again Passwords Don't Match!</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + trigger("end_story"); + } + } else { + trigger("begin_story"); + echo "<h2>Incomplete Form Data!</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + trigger("end_story"); + } + + return new return_result(true); + } +} + +register_handler(new login_event("login",50)); +register_handler(new display_login_event("display_login",50)); +register_action(new login_action("login",50)); +register_action(new logout_action("logout",50)); +register_handler(new passwd_event("passwd",50)); +register_handler(new display_passwd_event("display_passwd",50)); +register_action(new passwd_action("passwd",50)); +?> diff --git a/site/source/modules/default.php b/site/source/modules/default.php new file mode 100644 index 0000000..bbb3107 --- /dev/null +++ b/site/source/modules/default.php @@ -0,0 +1,70 @@ +<?php +# Adopt a Developer +# +# Copyright (C) 2004, 2006 Thomas Cort +# Copyright (C) 2004 Adam Beaumont, Thomas Cort, Patrick McLean, Scott Stoddard +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +class default_action extends actor { + function execute() { + trigger("html_headers"); + trigger("default"); + trigger("html_footers"); + return new return_result(true); + } +} + +class default_event extends actor { + function execute() { + global $username, $accesslevel; + trigger("begin_story"); + + if ($username == "guest") { +?> +<p> +This web application is used by the Adopt a Developer team to manage project related information +such as resources requested by developers, resources offered by community members, previous +donations, thanks yous, and contact information. Unless you are an authorized member of the +Adopt a Developer project and have a valid login, this page will not very useful to you. +</p> +<p> +If you would like infomation about the Adopt a Developer project, please +visit our project page at the folling URL: <a +href="http://www.gentoo.org/proj/en/userrel/adopt-a-dev">http://www.gentoo.org/proj/en/userrel/adopt-a-dev</a> +</p> +<?php } else { ?> +<h2>Welcome, <?php echo $username; ?>!</h2> +<p> +Please choose from one of the following tasks: +<ul> +<li><a href="./?a=resource">Add/Change Resources</a></li> +<li><a href="./?a=people">Add/Change People</a></li> +<li><a href="./?a=project">Add/Change Projects</a></li> +<li><a href="./?a=xml">Generate a new project page</a></li> +</ul> +</p> +<?php + } + + trigger("end_story"); + return new return_result(true); + } +} + +register_handler(new default_event("default",50)); +register_action(new default_action("default",50)); + +?> diff --git a/site/source/modules/edit.php b/site/source/modules/edit.php new file mode 100644 index 0000000..7bf5b71 --- /dev/null +++ b/site/source/modules/edit.php @@ -0,0 +1,284 @@ +<?php +# Adopt a Developer +# +# Copyright (C) 2006 Thomas Cort +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +class edit_action extends actor { + function execute() { + trigger("html_headers"); + trigger("edit"); + trigger("html_footers"); + return new return_result(true); + } +} + +class edit_event extends actor { + function status_select_list($select) { + $result = db_query("SELECT statusid, status from status"); + echo '<select name="status">'; + while ($result->has_next()) { + $row = $result->get_row(); + echo "<OPTION "; + if ($row[0] == $select) { + echo "selected "; + } + echo "value=\"$row[0]\">$row[1]</option>\n"; + } + echo "</select>"; + } + + function people_select_list($select,$name) { + $result = db_query("SELECT peopleid, last, first from people order by last"); + echo "<select name=\"$name\">"; + echo "<OPTION value=\"NULL\">NULL</OPTION>"; + while ($result->has_next()) { + $row = $result->get_row(); + echo "<OPTION "; + if ($row[0] == $select) { + echo "selected "; + } + echo "value=\"$row[0]\">$row[1], $row[2]</option>\n"; + } + echo "</select>"; + } + + function project_resource_select_list($resourceid) { + $result = db_query("SELECT projects.projectid, name from projects, project_specific_resources where projects.projectid = project_specific_resources.projectid and project_specific_resources.resourceid = '$resourceid'"); + echo "<select name=\"del_project\">"; + echo "<OPTION value=\"NULL\">NULL</OPTION>"; + while ($result->has_next()) { + $row = $result->get_row(); + echo "<OPTION "; + if ($row[0] == $select) { + echo "selected "; + } + echo "value=\"$row[0]\">$row[1]</option>\n"; + } + echo "</select>"; + } + + function project_select_list() { + $result = db_query("SELECT projectid, name from projects order by name"); + echo "<select name=\"add_project\">"; + echo "<OPTION value=\"NULL\">NULL</OPTION>"; + while ($result->has_next()) { + $row = $result->get_row(); + echo "<OPTION "; + if ($row[0] == $select) { + echo "selected "; + } + echo "value=\"$row[0]\">$row[1]</option>\n"; + } + echo "</select>"; + } + + function project_exists($projectid) { + $result = db_query("select count(*) from projects where projectid = '$projectid'"); + $temp = $result->get_row(); + return $temp[0]; + } + + function execute() { + global $username, $accesslevel; + + if ($username == "guest") { + trigger("begin_story"); +?> +<h2>Permission Denied</h2> + trigger("end_story"); + <?php } else { + + $resourceid = (isset($_REQUEST['id']) && is_numeric($_REQUEST['id']) ? $_REQUEST['id'] : -1); + + trigger("begin_story"); + + if ($resourceid == -1) { + echo "<h2>Invalid Resource</h2>"; + } else { + + $result = db_query("select donorid, devid, quantity, resource, purpose, status from resources where resourceid = '$resourceid'"); + + if (!$result->has_next()) { + echo "<h2>Invalid Resource</h2>"; + } else { + $row = $result->get_row(); + + if (isset($_REQUEST['commit']) && $_REQUEST['commit'] = "yes") { + $fail_msg = ""; + $qnty = (isset($_REQUEST['qnty']) && is_numeric($_REQUEST['qnty']) && $_REQUEST['qnty'] > 0) ? $_REQUEST['qnty'] : "null"; + + if ($qnty == "null") { + $fail_msg .= "Quantity must be > 0<br>"; + } + + $resource = (isset($_REQUEST['resource']) && $_REQUEST['resource'] != "") ? $_REQUEST['resource'] : "null"; + if ($resource == "null") { + $fail_msg .= "Resource must not be empty<br>"; + } + $resource = doslashes($resource); + + $statusid = (isset($_REQUEST['status']) && is_numeric($_REQUEST['status'])) ? $_REQUEST['status'] : "null"; + if ($statusid != "null") { + $result = db_query("select status from status where statusid = '$statusid'"); + if (!$result->has_next()) { + $fail_msg .= "Status not found<br>"; + } else { + $myrow = $result->get_row(); + $status = $myrow[0]; + } + } else { + $fail_msg .= "Status ID must be numeric<br>"; + } + + $purpose = (isset($_REQUEST['purpose']) && $_REQUEST['purpose'] != "") ? $_REQUEST['purpose'] : "null"; + if ($purpose == "null" && $status != "offering" && $status != "hidden") { + $fail_msg .= "Purpose must not be empty<br>"; + } + $purpose = doslashes($purpose); + + $devid = (isset($_REQUEST['dev']) && is_numeric($_REQUEST['dev'])) ? $_REQUEST['dev'] : "null"; + if ($status != "offering" && $status != "hidden") { + if ($devid == "null") { + $fail_msg .= "Dev ID must be numeric<br>"; + } else { + $result = db_query("select * from people where peopleid = '$devid'"); + if (!$result->has_next()) { + $fail_msg .= "Developer not found<br>"; + } + } + } + + $donorid = (isset($_REQUEST['donor']) && is_numeric($_REQUEST['donor'])) ? $_REQUEST['donor'] : "null"; + if ($status != "seeking" && $status != "hidden") { + if ($donorid == "null") { + $fail_msg .= "Donor ID must be numeric<br>"; + } else { + $result = db_query("select * from people where peopleid = '$donorid'"); + if (!$result->has_next()) { + $fail_msg .= "Donor not found<br>"; + } + } + } + + $result = db_query("select count(*) from project_specific_resources where resourceid = '$resourceid'"); + $temp = $result->get_row(); + $num_projects = $temp[0]; + + $add_project = (isset($_REQUEST['add_project']) && (is_numeric($_REQUEST['add_project']) || $_REQUEST['add_project'] == "NULL")) ? $_REQUEST['add_project'] : "null"; + $del_project = (isset($_REQUEST['del_project']) && (is_numeric($_REQUEST['del_project']) || $_REQUEST['del_project'] == "NULL")) ? $_REQUEST['del_project'] : "null"; + + if ($add_project == "null") { + $fail_msg .= "Add project must give a numeric id or NULL"; + } + + if ($del_project == "null") { + $fail_msg .= "Del project must give a numeric id or NULL"; + } + + if (is_numeric($add_project) && $this->project_exists($add_project) == 0) { + $fail_msg .= "Add project: invalid project id"; + } + + if (is_numeric($del_project) && $this->project_exists($del_project) == 0) { + $fail_msg .= "Del project: invalid project id"; + } + + if (is_numeric($add_project)) { + $result = db_query("select count(*) from project_specific_resources where resourceid = '$resourceid' and projectid = '$add_project'"); + $temp = $result->get_row(); + if ($temp[0] > 0) { + $fail_msg .= "The project you are trying to add is already associated with this resource"; + } + } + + if ($num_projects == 1 && !is_numeric($add_project) && is_numeric($del_project)) { + $fail_msg .= "A resource must have at least 1 project associated with it"; + } + + if ($fail_msg == "") { + $sql = "update resources set "; + $sql .= "quantity = '$qnty', status = '$statusid', "; + if (is_numeric($donorid)) { + $sql .= "donorid = '$donorid', "; + } else { + $sql .= "donorid = NULL, "; + } + if (is_numeric($devid)) { + $sql .= "devid = '$devid', "; + } else { + $sql .= "devid = NULL, "; + } + $sql .= "resource = '" . doslashes($resource) . "', purpose = '" . doslashes($purpose) ."', "; + $sql .= "date_created = date_created, "; + $sql .= "date_modified = NOW() "; + $sql .= "where resourceid = $resourceid"; + if (db_exec($sql)) { + if (is_numeric($add_project)) { + db_exec("insert into project_specific_resources (resourceid,projectid) values ($resourceid,$add_project)"); + } + if (is_numeric($del_project)) { + db_exec("delete from project_specific_resources where resourceid = $resourceid and projectid = $del_project"); + } + echo "Done"; + } else { + echo "sql failure: $sql"; + } + } else { + echo $fail_msg; + } + trigger("end_story"); + echo "<br>"; + trigger("begin_story"); + } + + $result = db_query("select donorid, devid, quantity, resource, purpose, status from resources where resourceid = '$resourceid'"); + $row = $result->get_row(); +?> + <h2>Edit a Resource</h2> + <form action="./" method="post"> + <table> + <tr><th>ID</th><td bgcolor="#eeeeee"><?php echo $resourceid; ?></td><th>Qnty</th><td bgcolor="#eeeeee"><input type="text" name="qnty" value="<?php echo $row[2]; ?>" size="2"></td><th>Status</th><td bgcolor="#eeeeee"><?php $this->status_select_list($row[5]); ?></td></tr> + <tr><th>Donor</th><td bgcolor="#eeeeee"><?php $this->people_select_list($row[0],"donor"); ?></td><th>Resource</th><td colspan="3" bgcolor="#eeeeee"><input type="text" name="resource" value="<?php echo $row[3]; ?>"></td></tr> + <tr><th>Dev</th><td bgcolor="#eeeeee"><?php $this->people_select_list($row[1],"dev"); ?></td><th>Purpose</th><td colspan="3" bgcolor="#eeeeee"><input type="text" name="purpose" value="<?php echo $row[4]; ?>"></td></tr> + <tr><th>Projects</th><td bgcolor="#eeeeee" colspan="5"><?php + $result = db_query("SELECT name, url from projects, project_specific_resources where projects.projectid = project_specific_resources.projectid and project_specific_resources.resourceid = '$resourceid'"); + while ($result->has_next()) { + $row = $result->get_row(); + echo "<a href=\"$row[1]\">$row[0]</a> "; + } + ?> + </td></tr> + <tr><th>Add Project</th><td bgcolor="#eeeeee"><?php $this->project_select_list(); ?></td></th><th>Del Project</th><td bgcolor="#eeeeee" colspan="3"><?php $this->project_resource_select_list($resourceid); ?></td></th></tr> + <tr><th>Submit</th><td bgcolor="#eeeeee"> + <input type="hidden" name="id" value="<?php echo $resourceid; ?>"> + <input type="hidden" name="a" value="edit"> <input type="hidden" name="commit" value="yes"> + <INPUT type="submit" value="Send"></td><th>Clear</th><td bgcolor="#eeeeee" colspan="3"><INPUT type="reset"></td></tr> + </table> + </form> +<?php + } + } + trigger("end_story"); + } + return new return_result(true); + } +} + +register_handler(new edit_event("edit",50)); +register_action(new edit_action("edit",50)); + +?> diff --git a/site/source/modules/email_report.php b/site/source/modules/email_report.php new file mode 100644 index 0000000..6f11c75 --- /dev/null +++ b/site/source/modules/email_report.php @@ -0,0 +1,87 @@ +<?php +# Adopt a Developer +# +# Copyright (C) 2005, 2006 Thomas Cort +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +class email_report_action extends actor { + function execute() { +global $guidexml; +header ("Content-type: text/plain"); +$sessionid = session_id(); + +$accesslevel = 1; + +$result = db_query("SELECT users.username,users.accesslevel FROM sessions,users WHERE sessions.sessionid = '$sessionid' AND users.userid = sessions.userid"); +if ($result->has_next()) { + $row = $result->get_row(); + $username = $row[0]; + $accesslevel = $row[1]; +} + +if ($accesslevel != 1) { + +$guidexml = -1; +include_once("../functions/bbcode.php"); + + +echo "\n\n"; + +echo "Community Member Offers\n"; +echo "=======================\n\n"; + +$result = db_query("SELECT first, last, location, quantity, resource, date_modified from people, resources, status where status.statusid = resources.status and status.status = 'offering' and people.peopleid = donorid and UNIX_TIMESTAMP(date_modified) > UNIX_TIMESTAMP(now()) - 604800;"); +while ($result->has_next()) { + $row = $result->get_row(); + + for ($i = 0; $i <= 5; $i++) { + $uid = make_bbcode_uid(); + $row[$i] = bbencode_first_pass($row[$i],$uid); + $row[$i] = bbencode_second_pass($row[$i],$uid); + } + + + echo "Offered Resource: $row[4]\n"; + echo "Name: $row[0] $row[1]\n"; + echo "Location: $row[2]\n"; + echo "Last Modified: $row[5]\n\n"; +} + +echo "\n\n"; +echo "New Developer Requests\n"; +echo "======================\n\n"; + + +$result = db_query("SELECT first, last, location, quantity, resource, purpose, resourceid, date_modified from people, resources, status where status.statusid = resources.status and status.status = 'seeking' and people.peopleid = devid and UNIX_TIMESTAMP(date_modified) > UNIX_TIMESTAMP(now()) - 604800;"); +while ($result->has_next()) { + $row = $result->get_row(); + + for ($i = 0; $i <= 5; $i++) { + $uid = make_bbcode_uid(); + $row[$i] = bbencode_first_pass($row[$i],$uid); + $row[$i] = bbencode_second_pass($row[$i],$uid); + } + + echo "Resource: $row[4]\n"; + echo "Purpose: $row[5]\n"; + echo "Name: $row[0] $row[1] // Location: $row[2] // Last Modified: $row[7]\n\n"; +} + +} +return new return_result(true); +}} +register_action(new email_report_action("email_report",1)); +?> diff --git a/site/source/modules/layout.php b/site/source/modules/layout.php new file mode 100644 index 0000000..f04046f --- /dev/null +++ b/site/source/modules/layout.php @@ -0,0 +1,293 @@ +<?php +# Adopt a Developer +# +# Copyright (C) 2004, 2005, 2006 Thomas Cort +# Copyright (C) 2004 Adam Beaumont, Thomas Cort, Patrick McLean, Scott Stoddard +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +$called_footers = 0; +$called_headers = 0; + +class html_headers extends actor { + function execute() { + global $called_headers; + + $site_title = "Welcome to the Adopt a Developer Admin Page"; + $title_size = "6"; # range 1-7 (1 is the biggest) + + # html_headers is a singleton + if (!$called_headers) { + $called_headers = 1; + + # print some headers + ?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd"> +<html> + <head> + <title> + <?php echo "$site_title"; ?> + </title> + <link href="style.css" rel="stylesheet" type="text/css"> + </head> + <body> + <!-- body table --> + <table align="center" border="0" cellpadding="8" cellspacing="0" width="85%"> + <!-- top header --> + <tr> + <td valign="middle" width="25%" colspan="2"> + <!-- title table --> + <table align="center" bgcolor="#000000" border="0" cellpadding="1" cellspacing="0" width="100%"> + <tr> + <td valign="middle"> + <table bgcolor="#ffffff" border="0" cellpadding="8" cellspacing="0" width="100%"> + <tr> + <td align="center" valign="middle"> + <a href="./?a=default"><?php echo "$site_title"; ?></a> + </td> + </tr> + </table> + </td> + </tr> + </table> + <!-- end title table --> + </td> + </tr> + <!-- end top header --> + + <tr> + + <!-- right column --> + <td valign="top" width="75%"> + <table border="0" cellpadding="0" cellspacing="0" width="100%"> + <tr> + <td valign="top" width="100%"> + + <?php + } + return new return_result(true); + } +} + +class html_footers extends actor { + function execute() { + global $called_footers, $username; + $copyright = "© 2004, 2005, 2006 Thomas Cort." + . "<br>© 2004 Thomas Cort, Patrick McLean, Scott Stoddard, Adam Beaumont."; + + # make html_footers a singleton + if (!$called_footers) { + $called_footers = 1; + echo "<br>"; + +?> + </td> + </tr> + </table> + </td> + <!-- end right column --> + + <!-- left column --> + <td valign="top" width="25%"> + + + <?php if ($username == "guest") { ?> + + <!-- sidebox --> + <table bgcolor="#000000" border="0" cellpadding="0" cellspacing="0" width="100%"> + <tr> + <td> + <table border="0" cellpadding="3" cellspacing="1" width="100%"> + <tr> + <td bgcolor="#cccccc"> + <span class="title">Login</span> + </td> + </tr> + <tr> + <td bgcolor="#ffffff"> + <?php trigger("display_login"); + ?> + </td> + </tr> + </table> + </td> + </tr> + </table> + <!-- end sidebox --> + + <br> + + <?php } else { ?> + + <table bgcolor="#000000" border="0" cellpadding="0" cellspacing="0" width="100%"> + <tr> + <td> + <table border="0" cellpadding="3" cellspacing="1" width="100%"> + <tr> + <td bgcolor="#cccccc"> + <span class="title">Menu</span> + </td> + </tr> + <tr> + <td bgcolor="#ffffff"> + <?php trigger("display_menu"); + ?> + </td> + </tr> + </table> + </td> + </tr> + </table> + + + <?php } ?> + </td> + <!-- end left column --> + + </tr> + + <tr> + <td align="center" colspan="2"> + <!-- footer --> + <span class="footer"> + <?php echo $copyright; ?> + </span> + <!-- end footer --> + </td> + </tr> + </table> + <!-- end body table --> + </body> +</html> + +<?php + } + return new return_result(true); + } +} + +class begin_story extends actor{ + function execute() { + ?> + <!-- story --> + <table align="center" bgcolor="#000000" border="0" cellPadding="0" cellSpacing="0" width="100%"> + <tr> + <td> + <table border="0" cellpadding="8" cellspacing="1" width="100%"> + <tr> + <td bgcolor="#ffffff" colspan="2"> + <table border="0" cellpadding="4" cellspacing="0" width="100%"> + <tr> + <td valign="top" width="100%"> + <?php + return new return_result(true); + } +} + +class end_story extends actor{ + function execute() { + ?> + </td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </table> + <!-- end story --> + + <?php + return new return_result(true); + } +} + +class menu_event extends actor { + function execute() { + global $accesslevel; + + # get the menu items for the user's access level + $db_result = db_query("select * from menu,accesslevels where accesslevels.levelid = '$accesslevel' and accesslevels.levelid = menu.accesslevel order by menu.priority;"); + + echo "<ul class=\"navbar\">"; + + # print them all out + while ($db_result->has_next()) { + $row = $db_result->get_row(); + echo "<li><a href=\"./?a=$row[2]\"><b>$row[3]</b></a></li>"; + } + + echo "</ul>"; + + return new return_result(true); + } +} + +class search_action extends actor { + function execute() { + global $accesslevel, $username; + trigger("html_headers"); + trigger("display_search"); + trigger("html_footers"); + return new return_result(true); + } +} + +class display_search_event extends actor { + function execute() { + + echo "<br><div align=\"center\"><form action=\"./\" method=\"post\"><table>"; + echo "<tr><td colspan=\"3\">"; + echo "<input type=\"text\" name=\"query\"></td></tr><tr><td>"; + echo "<input type=\"hidden\" name=\"a\" value=\"default\">"; + echo "<input type=\"hidden\" name=\"search\" value=\"1\">"; + echo " </td><td><input type=\"submit\" id=\"button\" style=\"font-size:8pt;background-color:#cccccc;color:#000000\" value=\"search\">"; + echo "</td><td><input type=\"reset\" id=\"button\" style=\"font-size:8pt;background-color:#cccccc;color:#000000\" value=\"clear\"></td></tr>"; + echo "</table>"; + echo "</form></div>"; + + return new return_result(true); + } +} + +class blogroll_event extends actor { + function execute() { + $result = db_query("SELECT url,name FROM links WHERE UPPER(name) LIKE '%BLOG%' ORDER BY name"); + + echo "<ul class=\"navbar\">"; + + while($result->has_next()) { + $row = $result->get_row(); + $row[1] = preg_split("/\'/",$row[1]); + echo "<li><a href=\"$row[0]\"><b>".$row[1][0]."</b></a></li>"; + } + + echo "</ul>"; + return new return_result(true); + } +} + +register_handler(new blogroll_event("blogroll",50)); +register_handler(new begin_story("begin_story",50)); +register_handler(new end_story("end_story",50)); +register_handler(new html_headers("html_headers",50)); +register_handler(new html_footers("html_footers",50)); +register_handler(new display_search_event("display_search",50)); +register_action(new search_action("search",50)); +register_handler(new menu_event("menu",50)); + +?> diff --git a/site/source/modules/menu.php b/site/source/modules/menu.php new file mode 100644 index 0000000..ccc0ae4 --- /dev/null +++ b/site/source/modules/menu.php @@ -0,0 +1,49 @@ +<?php +# Adopt a Developer +# +# Copyright (C) 2006 Thomas Cort +# Copyright (C) 2004 Adam Beaumont, Thomas Cort, Patrick McLean, Scott Stoddard +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# This event displays the menu on the screen. Menu items are displayed +# appropriately depending on access level and priority. +# +# Output is simple and should be improved with the use of css in the future. +# +# The menu has no associated action (ie. it cannot be directly keyed-into.) +class display_menu_event extends actor { + function execute() { + global $accesslevel; + + # Get the menu items for the user's access level + $db_result = db_query("select * from menu where accesslevel = '$accesslevel' order by priority;"); + + echo "<p><ul>"; + + # Print them all out + while ($db_result->has_next()) { + $row = $db_result->get_row(); + echo "<li><a href=\"./index.php?a=$row[1]\">$row[2]</a></li>"; + } + + echo "</ul></p>"; + + return new return_result(true); + } +} + +register_handler(new display_menu_event("display_menu",50)); +?> diff --git a/site/source/modules/people.php b/site/source/modules/people.php new file mode 100644 index 0000000..84e5dbf --- /dev/null +++ b/site/source/modules/people.php @@ -0,0 +1,173 @@ +<?php +# Adopt a Developer +# +# Copyright (C) 2006 Thomas Cort +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +class people_action extends actor { + function execute() { + global $accesslevel, $username; + trigger("html_headers"); + if (isset($_REQUEST['people'])) { + trigger("people"); + trigger("display_people"); + } else if (isset($_REQUEST['people_add'])) { + trigger("people_add"); + trigger("display_people"); + } else { + trigger("display_people"); + } + trigger("html_footers"); + return new return_result(true); + } +} + +class display_people_event extends actor { + function execute() { + + trigger("begin_story"); + + if ($username != "guest") { + echo "<h2>People (in order by last name)</h2>"; + $result = db_query("select peopleid, first, last, email, location from people order by last"); + while ($result->has_next()) { + $row = $result->get_row(); + echo "<form action=\"./\" method=\"post\"><table>"; + echo "<tr><th>First Name: </th><td bgcolor=\"#eeeeee\" colspan=\"2\">"; + echo "<input type=\"text\" name=\"first\" value=\"$row[1]\"></td>"; + echo "<th>Last Name: </th><td bgcolor=\"#eeeeee\" colspan=\"2\">"; + echo "<input type=\"text\" name=\"last\" value=\"$row[2]\"></td></tr>"; + echo "<tr><th>e-mail: </th><td bgcolor=\"#eeeeee\" colspan=\"2\">"; + echo "<input type=\"text\" name=\"email\" value=\"$row[3]\"></td>"; + echo "<th>Location: </th><td bgcolor=\"#eeeeee\" colspan=\"2\">"; + echo "<input type=\"text\" name=\"location\" value=\"$row[4]\"></td></tr><tr><td bgcolor=\"#eeeeee\">"; + echo "<input type=\"hidden\" name=\"a\" value=\"people\">"; + echo "<input type=\"hidden\" name=\"people\" value=\"1\">"; + echo "<input type=\"hidden\" name=\"peopleid\" value=\"$row[0]\">"; + echo " </td><td bgcolor=\"#eeeeee\"><input type=\"submit\" id=\"button\" value=\"change\">"; + echo "</td><td bgcolor=\"#eeeeee\"> </td><td bgcolor=\"#eeeeee\"> </td><td bgcolor=\"#eeeeee\"><input type=\"reset\" id=\"button\" value=\"clear\"></td></tr>"; + echo "</table></form><br>"; + } + echo "<h2>Add a Person</h2>"; + echo "<form action=\"./\" method=\"post\"><table>"; + echo "<tr><th>First Name: </td><td bgcolor=\"#eeeeee\" colspan=\"2\">"; + echo "<input type=\"text\" name=\"first\"></td></tr><tr><td>"; + echo "<tr><th>Last Name: </td><td bgcolor=\"#eeeeee\" colspan=\"2\">"; + echo "<input type=\"text\" name=\"last\"></td></tr><tr><td bgcolor=\"#eeeeee\">"; + echo "<tr><th>e-mail: </td><td bgcolor=\"#eeeeee\" colspan=\"2\">"; + echo "<input type=\"text\" name=\"email\"></td></tr><tr><td bgcolor=\"#eeeeee\">"; + echo "<tr><th>Location: </td><td bgcolor=\"#eeeeee\" colspan=\"2\">"; + echo "<input type=\"text\" name=\"location\"></td></tr><tr><td bgcolor=\"#eeeeee\">"; + echo "<input type=\"hidden\" name=\"a\" value=\"people\">"; + echo "<input type=\"hidden\" name=\"people_add\" value=\"1\">"; + echo " </td><td bgcolor=\"#eeeeee\"><input type=\"submit\" id=\"button\" value=\"add\">"; + echo "</td><td bgcolor=\"#eeeeee\"><input type=\"reset\" id=\"button\" value=\"clear\"></td></tr>"; + echo "</table></form>"; + + } else { + + echo "<h2>You aren't Logged In!</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + + } + + trigger("end_story"); + return new return_result(true); + } +} + +class people_event extends actor { + function execute() { + + $peopleid = isset($_REQUEST['peopleid']) && is_numeric($_REQUEST['peopleid']) ? $_REQUEST['peopleid'] : ""; + $first = isset($_REQUEST['first']) ? $_REQUEST['first'] : ""; + $last = isset($_REQUEST['last']) ? $_REQUEST['last'] : ""; + $email = isset($_REQUEST['email']) ? $_REQUEST['email'] : ""; + $location = isset($_REQUEST['location']) ? $_REQUEST['location'] : ""; + + if (is_numeric($peopleid) && $first != "" && $last != "" && $email != "" && location != "") { + $result = db_query("SELECT * from people where first = '".doslashes($first)."' and last = '".doslashes($last)."' and email = '".doslashes($email)."' and location = '".doslashes($location)."'"); + if (!$result->has_next()) { + $result = db_query("SELECT * from people where peopleid = $peopleid"); + if ($result->has_next()) { + if (db_exec("update people set first = '".doslashes($first)."', last = '".doslashes($last)."', email = '".doslashes($email)."', location = '".doslashes($location)."' where peopleid = $peopleid")) { + trigger("begin_story"); + echo "<h2>Done!</h2>"; + trigger("end_story"); + } else { + trigger("begin_story"); + echo "<h2>DB Error!</h2>"; + trigger("end_story"); + } + } else { + trigger("begin_story"); + echo "<h2>people ID does not exist!</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + trigger("end_story"); + } + } else { + trigger("begin_story"); + echo "<h2>Nothing Has Changed!</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + trigger("end_story"); + } + } else { + trigger("begin_story"); + echo "<h2>Incomplete Form Data!</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + trigger("end_story"); + } + + echo "<br>"; + return new return_result(true); + } +} + +class people_add_event extends actor { + function execute() { + + $first = isset($_REQUEST['first']) ? $_REQUEST['first'] : ""; + $last = isset($_REQUEST['last']) ? $_REQUEST['last'] : ""; + $email = isset($_REQUEST['email']) ? $_REQUEST['email'] : ""; + $location = isset($_REQUEST['location']) ? $_REQUEST['location'] : ""; + + if ($first != "" && $last != "" && $email != "" && $location != "") { + if (db_exec("insert into people (first,last,email,location) values ('".doslashes($first)."', '".doslashes($last)."', '".doslashes($email)."', '".doslashes($location)."')")) { + trigger("begin_story"); + echo "<h2>Done!</h2>"; + trigger("end_story"); + } else { + trigger("begin_story"); + echo "<h2>DB Error!</h2>"; + trigger("end_story"); + } + } else { + trigger("begin_story"); + echo "<h2>Incomplete Form Data!</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + trigger("end_story"); + } + + echo "<br>"; + return new return_result(true); + } +} + +register_handler(new people_event("people",50)); +register_handler(new people_add_event("people_add",50)); +register_handler(new display_people_event("display_people",50)); +register_action(new people_action("people",50)); +?> diff --git a/site/source/modules/project.php b/site/source/modules/project.php new file mode 100644 index 0000000..251655e --- /dev/null +++ b/site/source/modules/project.php @@ -0,0 +1,162 @@ +<?php +# Adopt a Developer +# +# Copyright (C) 2006 Thomas Cort +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +class project_action extends actor { + function execute() { + global $accesslevel, $username; + trigger("html_headers"); + if (isset($_REQUEST['project'])) { + trigger("project"); + trigger("display_project"); + } else if (isset($_REQUEST['project_add'])) { + trigger("project_add"); + trigger("display_project"); + } else { + trigger("display_project"); + } + trigger("html_footers"); + return new return_result(true); + } +} + +class display_project_event extends actor { + function execute() { + + trigger("begin_story"); + + if ($username != "guest") { + echo "<h2>Projects (ordered by name)</h2>"; + $result = db_query("select projectid, name, url from projects order by name"); + while ($result->has_next()) { + $row = $result->get_row(); + echo "<form action=\"./\" method=\"post\"><table>"; + echo "<tr><th>Name: </td><td bgcolor=\"#eeeeee\" colspan=\"2\">"; + echo "<input type=\"text\" name=\"project_name\" value=\"$row[1]\"></td>"; + echo "<th>URL: </td><td bgcolor=\"#eeeeee\" colspan=\"2\">"; + echo "<input type=\"text\" name=\"project_url\" value=\"$row[2]\"></td><td bgcolor=\"#eeeeee\">"; + echo "<input type=\"hidden\" name=\"a\" value=\"project\">"; + echo "<input type=\"hidden\" name=\"project\" value=\"1\">"; + echo "<input type=\"hidden\" name=\"projectid\" value=\"$row[0]\">"; + echo " </td><td bgcolor=\"#eeeeee\"><input type=\"submit\" id=\"button\" value=\"change\">"; + echo "</td><td bgcolor=\"#eeeeee\"><input type=\"reset\" id=\"button\" value=\"clear\"></td></tr>"; + echo "</table></form><br>"; + } + + echo "<h2>Add a Project</h2>"; + echo "<form action=\"./\" method=\"post\"><table>"; + echo "<tr><th>Project Name: </td><td bgcolor=\"#eeeeee\" colspan=\"2\">"; + echo "<input type=\"text\" name=\"project_name\"></td></tr><tr><td>"; + echo "<tr><th>URL: </td><td bgcolor=\"#eeeeee\" colspan=\"2\">"; + echo "<input type=\"text\" name=\"project_url\"></td></tr><tr><td bgcolor=\"#eeeeee\">"; + echo "<input type=\"hidden\" name=\"a\" value=\"project\">"; + echo "<input type=\"hidden\" name=\"project_add\" value=\"1\">"; + echo " </td><td bgcolor=\"#eeeeee\"><input type=\"submit\" id=\"button\" value=\"add\">"; + echo "</td><td bgcolor=\"#eeeeee\"><input type=\"reset\" id=\"button\" value=\"clear\"></td></tr>"; + echo "</table></form>"; + + } else { + + echo "<h2>You aren't Logged In!</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + + } + + trigger("end_story"); + return new return_result(true); + } +} + +class project_event extends actor { + function execute() { + + $projectid = isset($_REQUEST['projectid']) && is_numeric($_REQUEST['projectid']) ? $_REQUEST['projectid'] : ""; + $project_name = isset($_REQUEST['project_name']) ? $_REQUEST['project_name'] : ""; + $project_url = isset($_REQUEST['project_url']) ? $_REQUEST['project_url'] : ""; + + if (is_numeric($projectid) && $project_url != "" && $project_name != "") { + $result = db_query("SELECT * from projects where url = '".doslashes($project_url)."' and name = '".doslashes($project_name)."';"); + if (!$result->has_next()) { + $result = db_query("SELECT * from projects where projectid = $projectid"); + if ($result->has_next()) { + if (db_exec("update projects set url = '".doslashes($project_url)."', name = '".doslashes($project_name)."' where projectid = $projectid")) { + trigger("begin_story"); + echo "<h2>Done!</h2>"; + trigger("end_story"); + } else { + trigger("begin_story"); + echo "<h2>DB Error!</h2>"; + trigger("end_story"); + } + } else { + trigger("begin_story"); + echo "<h2>Project ID does not exist!</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + trigger("end_story"); + } + } else { + trigger("begin_story"); + echo "<h2>Nothing Has Changed!</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + trigger("end_story"); + } + } else { + trigger("begin_story"); + echo "<h2>Incomplete Form Data!</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + trigger("end_story"); + } + + echo "<br>"; + return new return_result(true); + } +} + +class project_add_event extends actor { + function execute() { + + $project_name = isset($_REQUEST['project_name']) ? $_REQUEST['project_name'] : ""; + $project_url = isset($_REQUEST['project_url']) ? $_REQUEST['project_url'] : ""; + + if ($project_url != "" && $project_name != "") { + if (db_exec("insert into projects (name,url) values ('".doslashes($project_name)."','".doslashes($project_url)."')")) { + trigger("begin_story"); + echo "<h2>Done!</h2>"; + trigger("end_story"); + } else { + trigger("begin_story"); + echo "<h2>DB Error</h2>"; + trigger("end_story"); + } + } else { + trigger("begin_story"); + echo "<h2>Incomplete Form Data!</h2>"; + echo "<h2>Thank You! Come again!</h2>"; + trigger("end_story"); + } + + echo "<br>"; + return new return_result(true); + } +} + +register_handler(new project_event("project",50)); +register_handler(new project_add_event("project_add",50)); +register_handler(new display_project_event("display_project",50)); +register_action(new project_action("project",50)); +?> diff --git a/site/source/modules/resource.php b/site/source/modules/resource.php new file mode 100644 index 0000000..670997a --- /dev/null +++ b/site/source/modules/resource.php @@ -0,0 +1,412 @@ +<?php +# Adopt a Developer +# +# Copyright (C) 2006 Thomas Cort +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +class resource_action extends actor { + function execute() { + trigger("html_headers"); + if (isset($_REQUEST['resource_add'])) { + trigger("resource_add"); + } + trigger("resource"); + trigger("html_footers"); + return new return_result(true); + } +} + +class resource_event extends actor { + function status_select_list($select) { + $result = db_query("SELECT statusid, status from status"); + echo '<select name="status">'; + while ($result->has_next()) { + $row = $result->get_row(); + echo "<OPTION "; + if ($row[0] == $select) { + echo "selected "; + } + echo "value=\"$row[0]\">$row[1]</option>\n"; + } + echo "</select>"; + } + function people_select_list($select,$name) { + $result = db_query("SELECT peopleid, last, first from people order by last"); + echo "<select name=\"$name\">"; + echo "<OPTION value=\"NULL\">NULL</OPTION>"; + while ($result->has_next()) { + $row = $result->get_row(); + echo "<OPTION "; + if ($row[0] == $select) { + echo "selected "; + } + echo "value=\"$row[0]\">$row[1], $row[2]</option>\n"; + } + echo "</select>"; + } + + function project_resource_select_list($resourceid) { + $result = db_query("SELECT projects.projectid, name from projects, project_specific_resources where projects.projectid = project_specific_resources.projectid and project_specific_resources.resourceid = '$resourceid'"); + echo "<select name=\"del_project\">"; + echo "<OPTION value=\"NULL\">NULL</OPTION>"; + while ($result->has_next()) { + $row = $result->get_row(); + echo "<OPTION "; + if ($row[0] == $select) { + echo "selected "; + } + echo "value=\"$row[0]\">$row[1]</option>\n"; + } + echo "</select>"; + } + + function project_select_list() { + $result = db_query("SELECT projectid, name from projects order by name"); + echo "<select name=\"add_project\">"; + echo "<OPTION value=\"NULL\">NULL</OPTION>"; + while ($result->has_next()) { + $row = $result->get_row(); + echo "<OPTION "; + if ($row[0] == $select) { + echo "selected "; + } + echo "value=\"$row[0]\">$row[1]</option>\n"; + } + echo "</select>"; + } + + function project_exists($projectid) { + $result = db_query("select count(*) from projects where projectid = '$projectid'"); + $temp = $result->get_row(); + return $temp[0]; + } + function execute() { + global $username, $accesslevel; + + if ($username == "guest") { + trigger("begin_story"); +?> +<h2>Permission Denied</h2> + <?php + trigger("end_story"); + } else { + + trigger("begin_story"); + + echo "<h2>Developers Seeking Resources</h2><table>"; + $result = db_query("SELECT resourceid, first, last, location, quantity, resource, purpose, status.status, date_created, date_modified, email from people, resources, status where status.statusid = resources.status and status.status = 'seeking' and people.peopleid = devid"); + while ($result->has_next()) { + $row = $result->get_row(); + echo "<tr><th>ID</th><td bgcolor=\"#eeeeee\">$row[0]</td><th>Qnty</th><td bgcolor=\"#eeeeee\">$row[4]</td><th>Status</th><td bgcolor=\"#eeeeee\">$row[7]</td></tr>"; + echo "<tr><th>Donor</th><td bgcolor=\"#eeeeee\">N/A</td><th>Resource</th><td colspan=\"3\" bgcolor=\"#eeeeee\">$row[5]</td></tr>"; + echo "<tr><th>Dev</th><td bgcolor=\"#eeeeee\">$row[1] $row[2]</td><th>Purpose</th><td colspan=\"3\" bgcolor=\"#eeeeee\">$row[6]</td></tr>"; + echo "<tr><th>Dev e-mail</th><td bgcolor=\"#eeeeee\"><a href=\"mailto:$row[10]\">$row[10]</a></td><th>Donor e-mail</th><td bgcolor=\"#eeeeee\">N/A</td><th>Edit</th><td bgcolor=\"#eeeeee\"><a href=\"./?a=edit&id=$row[0]\">Click Here</a></td></tr>"; + + echo "<tr><th>Project</th><td bgcolor=\"#eeeeee\">"; + $subresult = db_query("SELECT name,url from projects, project_specific_resources where projects.projectid = project_specific_resources.projectid and project_specific_resources.resourceid = '$row[0]'"); + while ($subresult->has_next()) { + $subrow = $subresult->get_row(); + echo "<a href=\"$subrow[1]\">$subrow[0]</a> "; + } + echo "<th>Created</th><td bgcolor=\"#eeeeee\">$row[8]</td><th>Modified</th><td bgcolor=\"#eeeeee\">$row[9]</td></tr>"; + if ($result->has_next()) { + echo "<tr><td color=\"#ffffff\"> </td><td color=\"#ffffff\"> </td></tr>"; + } + } + echo "</table>"; + + echo "<h2>Community Members Offering Resources</h2><table>"; + $result = db_query("SELECT resourceid, first, last, location, quantity, resource, status.status, date_created, date_modified, email from people, resources, status where status.statusid = resources.status and status.status = 'offering' and people.peopleid = donorid"); + while ($result->has_next()) { + $row = $result->get_row(); + echo "<tr><th>ID</th><td bgcolor=\"#eeeeee\">$row[0]</td><th>Qnty</th><td bgcolor=\"#eeeeee\">$row[4]</td><th>Status</th><td bgcolor=\"#eeeeee\">$row[6]</td></tr>"; + echo "<tr><th>Donor</th><td bgcolor=\"#eeeeee\">$row[1] $row[2]</td><th>Resource</th><td colspan=\"3\" bgcolor=\"#eeeeee\">$row[5]</td></tr>"; + echo "<tr><th>Dev</th><td bgcolor=\"#eeeeee\">N/A</td><th>Purpose</th><td colspan=\"3\" bgcolor=\"#eeeeee\">N/A</td></tr>"; + echo "<tr><th>Dev e-mail</th><td bgcolor=\"#eeeeee\">N/A</td><th>Donor e-mail</th><td bgcolor=\"#eeeeee\"><a href=\"mailto:$row[9]\">$row[9]</a></td><th>Edit</th><td bgcolor=\"#eeeeee\"><a href=\"./?a=edit&id=$row[0]\">Click Here</a></td></tr>"; + echo "<tr><th>Project</th><td bgcolor=\"#eeeeee\">N/A</td><th>Created</th><td bgcolor=\"#eeeeee\">$row[7]</td><th>Modified</th><td bgcolor=\"#eeeeee\">$row[8]</td></tr>"; + + if ($result->has_next()) { + echo "<tr><td color=\"#ffffff\"> </td><td color=\"#ffffff\"> </td></tr>"; + } + } + echo "</table>"; + + echo "<h2>Completed Donations</h2><table>"; + + $result = db_query("SELECT resourceid, donor.first, donor.last, dev.first, dev.last, quantity, resource, purpose, status.status as status, date_created, date_modified, donor.email, dev.email from people as donor, people as dev, resources, status where dev.peopleid = devid and donor.peopleid = donorid and status.status = 'thanks' and status.statusid = resources.status order by resourceid"); + while ($result->has_next()) { + $row = $result->get_row(); + echo "<tr><th>ID</th><td bgcolor=\"#eeeeee\">$row[0]</td><th>Qnty</th><td bgcolor=\"#eeeeee\">$row[5]</td><th>Status</th><td bgcolor=\"#eeeeee\">$row[8]</td></tr>"; + echo "<tr><th>Donor</th><td bgcolor=\"#eeeeee\">$row[1] $row[2]</td><th>Resource</th><td colspan=\"3\" bgcolor=\"#eeeeee\">$row[6]</td></tr>"; + echo "<tr><th>Dev</th><td bgcolor=\"#eeeeee\">$row[3] $row[4]</td><th>Purpose</th><td colspan=\"3\" bgcolor=\"#eeeeee\">$row[7]</td></tr>"; + echo "<tr><th>Dev e-mail</th><td bgcolor=\"#eeeeee\"><a href=\"mailto:$row[11]\">$row[11]</a></td><th>Donor e-mail</th><td bgcolor=\"#eeeeee\"><a href=\"mailto:$row[12]\">$row[12]</a></td><th>Edit</th><td bgcolor=\"#eeeeee\"><a href=\"./?a=edit&id=$row[0]\">Click Here</a></td></tr>"; + echo "<tr><th>Project</th><td bgcolor=\"#eeeeee\">"; + + $subresult = db_query("SELECT name,url from projects, project_specific_resources where projects.projectid = project_specific_resources.projectid and project_specific_resources.resourceid = '$row[0]'"); + while ($subresult->has_next()) { + $subrow = $subresult->get_row(); + echo "<a href=\"$subrow[1]\">$subrow[0]</a> "; + } + echo "</td><th>Created</th><td bgcolor=\"#eeeeee\">$row[9]</td><th>Modified</th><td colspan=\"3\" bgcolor=\"#eeeeee\">$row[10]</td></tr>"; + + if ($result->has_next()) { + echo "<tr><td color=\"#ffffff\"> </td><td color=\"#ffffff\"> </td></tr>"; + } + } + + echo "</table>"; + echo "<h2>Hidden Resources</h2><table>"; + $result = db_query("SELECT resourceid, quantity, purpose, resource, date_created, date_modified from resources, status where status.statusid = resources.status and status.status = 'hidden'"); + while ($result->has_next()) { + $row = $result->get_row(); + $subresult = db_query("select donorid, devid from resources where resourceid = '$row[0]'"); + $subrow = $subresult->get_row(); + echo "<tr><th>ID</th><td bgcolor=\"#eeeeee\">$row[0]</td><th>Qnty</th><td bgcolor=\"#eeeeee\">$row[1]</td><th>Status</th><td bgcolor=\"#eeeeee\">hidden</td></tr>"; + + if ($subrow[0]) { + $subresult = db_query("select first, last, email from people where peopleid = '$subrow[0]'"); + $don = $subresult->get_row(); + $donor = "$don[0] $don[1]"; + $donor_email = "$don[2]"; + } else { + $donor = "NULL"; + $donor_email = "NULL"; + } + + if ($subrow[1]) { + $subresult = db_query("select first, last, email from people where peopleid = '$subrow[1]'"); + $don = $subresult->get_row(); + $dev = "$don[0] $don[1]"; + $dev_email = "$don[2]"; + } else { + $dev = "NULL"; + $dev_email = "NULL"; + } + + echo "<tr><th>Donor</th><td bgcolor=\"#eeeeee\">$donor</td><th>Resource</th><td colspan=\"3\" bgcolor=\"#eeeeee\">$row[3]</td></tr>"; + echo "<tr><th>Dev</th><td bgcolor=\"#eeeeee\">$dev</td><th>Purpose</th><td colspan=\"3\" bgcolor=\"#eeeeee\">$row[2]</td></tr>"; + echo "<tr><th>Dev e-mail</th><td bgcolor=\"#eeeeee\"><a href=\"mailto:$dev_email\">$dev_email</a></td><th>Donor e-mail</th><td bgcolor=\"#eeeeee\"><a href=\"mailto:$donor_email\">$donor_email</a></td><th>Edit</th><td bgcolor=\"#eeeeee\"><a href=\"./?a=edit&id=$row[0]\">Click Here</a></td></tr>"; + echo "<tr><th>Project</th><td bgcolor=\"#eeeeee\">"; + + $subresult = db_query("SELECT name,url from projects, project_specific_resources where projects.projectid = project_specific_resources.projectid and project_specific_resources.resourceid = '$row[0]'"); + while ($subresult->has_next()) { + $subrow = $subresult->get_row(); + echo "<a href=\"$subrow[1]\">$subrow[0]</a> "; + } + echo "</td><th>Created</th><td bgcolor=\"#eeeeee\">$row[4]</td><th>Modified</th><td colspan=\"3\" bgcolor=\"#eeeeee\">$row[5]</td></tr>"; + + if ($result->has_next()) { + echo "<tr><td color=\"#ffffff\"> </td><td color=\"#ffffff\"> </td></tr>"; + } + } + echo "</table>"; +?> <h2>Add a Resource</h2> + <form action="./" method="post"> + <table> + <tr><th>ID</th><td bgcolor="#eeeeee">N/A</td><th>Qnty</th><td bgcolor="#eeeeee"><input type="text" name="qnty" value="1" size="2"></td><th>Status</th><td bgcolor="#eeeeee"><?php $this->status_select_list(1); ?></td></tr> + <tr><th>Donor</th><td bgcolor="#eeeeee"><?php $this->people_select_list(0,"donor"); ?></td><th>Resource</th><td colspan="3" bgcolor="#eeeeee"><input type="text" name="resource"></td></tr> + <tr><th>Dev</th><td bgcolor="#eeeeee"><?php $this->people_select_list(0,"dev"); ?></td><th>Purpose</th><td colspan="3" bgcolor="#eeeeee"><input type="text" name="purpose"></td></tr> + <tr><th>Add Project</th><td bgcolor="#eeeeee"><?php $this->project_select_list(); ?></td></th> + <th>Submit</th><td bgcolor="#eeeeee"> + <input type="hidden" name="resource_add" value="1"> + <input type="hidden" name="a" value="resource"> <input type="hidden" name="commit" value="yes"> + <INPUT type="submit" value="Add"></td><th>Clear</th><td bgcolor="#eeeeee"><INPUT type="reset"></td></tr> + </table> + </form> +<?php + + + trigger("end_story"); + } + return new return_result(true); + } +} + +class resource_add_event extends actor { + function status_select_list($select) { + $result = db_query("SELECT statusid, status from status"); + echo '<select name="status">'; + while ($result->has_next()) { + $row = $result->get_row(); + echo "<OPTION "; + if ($row[0] == $select) { + echo "selected "; + } + echo "value=\"$row[0]\">$row[1]</option>\n"; + } + echo "</select>"; + } + + function people_select_list($select,$name) { + $result = db_query("SELECT peopleid, last, first from people order by last"); + echo "<select name=\"$name\">"; + echo "<OPTION value=\"NULL\">NULL</OPTION>"; + while ($result->has_next()) { + $row = $result->get_row(); + echo "<OPTION "; + if ($row[0] == $select) { + echo "selected "; + } + echo "value=\"$row[0]\">$row[1], $row[2]</option>\n"; + } + echo "</select>"; + } + + function project_resource_select_list($resourceid) { + $result = db_query("SELECT projects.projectid, name from projects, project_specific_resources where projects.projectid = project_specific_resources.projectid and project_specific_resources.resourceid = '$resourceid'"); + echo "<select name=\"del_project\">"; + echo "<OPTION value=\"NULL\">NULL</OPTION>"; + while ($result->has_next()) { + $row = $result->get_row(); + echo "<OPTION "; + if ($row[0] == $select) { + echo "selected "; + } + echo "value=\"$row[0]\">$row[1]</option>\n"; + } + echo "</select>"; + } + + function project_select_list() { + $result = db_query("SELECT projectid, name from projects order by name"); + echo "<select name=\"add_project\">"; + echo "<OPTION value=\"NULL\">NULL</OPTION>"; + while ($result->has_next()) { + $row = $result->get_row(); + echo "<OPTION "; + if ($row[0] == $select) { + echo "selected "; + } + echo "value=\"$row[0]\">$row[1]</option>\n"; + } + echo "</select>"; + } + + function project_exists($projectid) { + $result = db_query("select count(*) from projects where projectid = '$projectid'"); + $temp = $result->get_row(); + return $temp[0]; + } + + + + function execute() { + trigger("begin_story"); + $fail_msg = ""; + $qnty = (isset($_REQUEST['qnty']) && is_numeric($_REQUEST['qnty']) && $_REQUEST['qnty'] > 0) ? $_REQUEST['qnty'] : "null"; + + if ($qnty == "null") { + $fail_msg .= "Quantity must be > 0<br>"; + } + + $resource = (isset($_REQUEST['resource']) && $_REQUEST['resource'] != "") ? $_REQUEST['resource'] : "null"; + if ($resource == "null") { + $fail_msg .= "Resource must not be empty<br>"; + } + + $statusid = (isset($_REQUEST['status']) && is_numeric($_REQUEST['status'])) ? $_REQUEST['status'] : "null"; + if ($statusid != "null") { + $result = db_query("select status from status where statusid = '$statusid'"); + if (!$result->has_next()) { + $fail_msg .= "Status not found<br>"; + } else { + $myrow = $result->get_row(); + $status = $myrow[0]; + } + } else { + $fail_msg .= "Status ID must be numeric<br>"; + } + + $purpose = (isset($_REQUEST['purpose']) && $_REQUEST['purpose'] != "") ? $_REQUEST['purpose'] : "null"; + if ($purpose == "null" && $status != "offering" && $status != "hidden") { + $fail_msg .= "Purpose must not be empty<br>"; + } + + $devid = (isset($_REQUEST['dev']) && is_numeric($_REQUEST['dev'])) ? $_REQUEST['dev'] : "null"; + if ($status != "offering" && $status != "hidden") { + if ($devid == "null") { + $fail_msg .= "Dev ID must be numeric<br>"; + } else { + $result = db_query("select * from people where peopleid = '$devid'"); + if (!$result->has_next()) { + $fail_msg .= "Developer not found<br>"; + } + } + } + + $donorid = (isset($_REQUEST['donor']) && is_numeric($_REQUEST['donor'])) ? $_REQUEST['donor'] : "null"; + if ($status != "seeking" && $status != "hidden") { + if ($donorid == "null") { + $fail_msg .= "Donor ID must be numeric<br>"; + } else { + $result = db_query("select * from people where peopleid = '$donorid'"); + if (!$result->has_next()) { + $fail_msg .= "Donor not found<br>"; + } + } + } + + $add_project = (isset($_REQUEST['add_project']) && (is_numeric($_REQUEST['add_project']) || $_REQUEST['add_project'] == "NULL")) ? $_REQUEST['add_project'] : "null"; + + if ($add_project == "null") { + $fail_msg .= "Add project must give a numeric id or NULL"; + } + + if (is_numeric($add_project) && $this->project_exists($add_project) == 0) { + $fail_msg .= "Add project: invalid project id"; + } + + if ($fail_msg == "") { + $sql = "insert into resources "; + $sql .= "(quantity,status,"; + if (is_numeric($donorid)) { + $sql .= "donorid,"; + } + if (is_numeric($devid)) { + $sql .= "devid,"; + } + $sql .= "resource,purpose,date_created,date_modified) values ("; + $sql .= "$qnty,$statusid,"; + if (is_numeric($donorid)) { + $sql .= "$donorid,"; + } + if (is_numeric($devid)) { + $sql .= "$devid,"; + } + $sql .= "'".doslashes($resource) . "','" . doslashes($purpose) ."',NOW(),NOW())"; + if (db_exec($sql)) { + $result = db_query("select resourceid from resources where resource = '".doslashes($resource)."' and purpose = '".doslashes($purpose)."' and status = $statusid"); + $row = $result->get_row(); + $resourceid = $row[0]; + db_exec("insert into project_specific_resources (resourceid,projectid) values ($resourceid,$add_project)"); + echo "Done"; + } else { + echo "sql failure: $sql"; + } + } else { + echo $fail_msg; + } + trigger("end_story"); + echo "<br>"; + return new return_result(true); + } +} + +register_handler(new resource_event("resource",50)); +register_handler(new resource_add_event("resource_add",50)); +register_action(new resource_action("resource",50)); + +?> diff --git a/site/source/modules/xml.php b/site/source/modules/xml.php new file mode 100644 index 0000000..666c80a --- /dev/null +++ b/site/source/modules/xml.php @@ -0,0 +1,435 @@ +<?php +# Adopt a Developer +# +# Copyright (C) 2005, 2006 Thomas Cort +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +class xml_action extends actor { + function execute() { + global $guidexml; + +header ("Content-type: text/plain"); +$sessionid = session_id(); + +$accesslevel = 1; + +$result = db_query("SELECT users.username,users.accesslevel FROM sessions,users WHERE sessions.sessionid = '$sessionid' AND users.userid = sessions.userid"); +if ($result->has_next()) { + $row = $result->get_row(); + $username = $row[0]; + $accesslevel = $row[1]; +} + +if ($accesslevel != 1) { + +$guidexml = 1; +include_once("../functions/bbcode.php"); + + +echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; +echo "<?xml-stylesheet href=\"/xsl/project.xsl\" type=\"text/xsl\"?>\n"; +echo "<?xml-stylesheet href=\"/xsl/guide.xsl\" type=\"text/xsl\"?>\n"; + +?> +<!-- This page was automatically generated. DO NOT EDIT IT DIRECTLY! --> +<!-- $Header: $ --> + +<!DOCTYPE project SYSTEM "http://www.gentoo.org/dtd/project.dtd"> + +<project> +<name>adopt-a-dev</name> + +<longname>Adopt a Developer (beta)</longname> + +<date><?php echo date("Y-m-d"); ?></date> + +<author title="Author"> + <mail link="tcort@gentoo.org">Thomas Cort</mail> +</author> + +<description> + This project aims to connect developers who need resources + (ie hardware, technical books, shell accounts, etc) with people + and companies from the community who want to donate resources. +</description> + +<longdescription> + This project aims to connect developers who need resources with people + and companies from the community who want to donate resources. Useful + resources include computer hardware, books, shell accounts, and + anything else that enhances the development process. This project is + not involved with monetary donations; if you wish to donate money, + you may do so through <uri +link="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal@gentoo.org&item_name=Gentoo+Linux+Support&item_number=1000&image_url=/images/paypal.png&no_shipping=1&return=http://www.gentoo.org&cancel_return=http://www.gentoo.org">paypal</uri>. + If you are a developer looking for monetary resources, then you + may be interested in the <uri link="/foundation/en/funds.xml"> + Gentoo Foundation Funding and Expenditures</uri> page. + This project does not collect any resources itself, it only acts + a central point of contact for potential donors and individual + developers. +</longdescription> + +<?php + # Get the list of project members + $db_result = db_query("select username, role from users, roles, project_members where users.userid = project_members.userid and roles.roleid = project_members.roleid ;"); + + # Print them all out + while ($db_result->has_next()) { + $row = $db_result->get_row(); + echo "<dev role=\"$row[1]\">$row[0]</dev>\n"; + } +?> + +<extrachapter> + <title>Project Status</title> + <section> + <body> + + <p> + This project is still in its infancy. It is in <c>beta</c> + since we are still getting feedback and working out all of the + details. If you'd like to share your ideas about the project with us, + we may be contacted at + <mail link="adopt-a-dev@gentoo.org">adopt-a-dev@gentoo.org</mail>. + While the project is in beta, we will only deal with items that can + be obtained for less than $250 USD. + </p> + + </body> + </section> +</extrachapter> + +<extrachapter> + <title>The Need for Resources</title> + <section> + <body> + + <p> + A lot of the packages in the tree require specific hardware to test. + For example, cdrtools requires a CD burner, qc-usb requires a QuickCam, + wireless-tools requires a wireless network card, etc. Donating items + like those allows us to ensure they work on the many architectures we + support. Hardware donations can also be used to replace broken parts; + we all know what it's like to lose a hard drive or some other crucial + component. It is especially hard on developers who are students on a + budget. We are always looking to support new architectures or + architectures that have little developer help. Donating rare and exotic + hardware can improve such situations. + </p> + + <p> + Computer hardware isn't the only thing that a developer might find + useful. Gentoo developers can also benefit greatly from technical + books. Books can enhance a developer's ability to solve bugs and + maintain ebuilds. Books can also aid in the development of Gentoo + related software projects like <uri link="/proj/en/portage">portage</uri>. + Passes to technical conferences can help in these areas too. + Shell accounts on remote computers can be used for compiling and + testing packages. + </p> + + <p> + When a developer makes a request, he or she must state the purpose and + what project(s) benefit from it. So, a "needed resource" is anything that + helps accomplish a project related task for a developer. A full system + may be needed in some cases (example, for building releases and testing + live CDs). Some architecture teams are seriously lacking the CPU power to + build GRP releases in a reasonable amount of time. + </p> + + </body> + </section> +</extrachapter> + +<extrachapter> + <title>Community: How to offer Resources</title> + <section> + <body> + + <p> + If you wish to donate any of the resources listed in the <uri + link="#doc_chap7">Developers Seeking Resources</uri> section or if you + want to purchase 1 or more of those items and have them shipped to a + developer, then you should submit a completed <uri + link="./offer.txt">offer form</uri> to get put in touch with the + developer. Do not contact the developer directly, use + <mail link="adopt-a-dev@gentoo.org">adopt-a-dev@gentoo.org</mail>. We + like to keep track of things to ensure that our lists are as accurate + and as up to date as humanly possible. + </p> + + <p> + You can also offer up any existing resources you have that are + in working good condition and would enhance the development process. + To be listed in the <uri link="#doc_chap8">Community Members + Offering Resources</uri> section, submit a completed <uri + link="./offer.txt">offer form</uri> to + <mail link="adopt-a-dev@gentoo.org">adopt-a-dev@gentoo.org</mail>. If + you wish to remain anonymous, please let us know. More details on + privacy in the <uri link="#doc_chap10">Privacy Policy</uri>. + </p> + + </body> + </section> +</extrachapter> + +<extrachapter> + <title>Developers: How to request Resources</title> + <section> + <body> + + <p> + Submit a completed <uri link="./request.txt">request form</uri> to + <mail link="adopt-a-dev@gentoo.org">adopt-a-dev@gentoo.org</mail>, a + team member will review the request and post it to the site. The + review process is only meant to ensure that the item can be used for a + Gentoo project and to ensure that the request is clearly written. In + general, we will post all requests. If we find that your request needs + elucidation, then we will contact you. Your request must be sent from + your @gentoo.org e-mail address. + </p> + + <p> + You must be an official Gentoo developer for at least 6 months + before requesting or receiving resources through adopt a developer. + You are limited to 4 open requests at any given time. You may ask for any + of your open requests to be changed or removed to make room for a new + request. There is no hard limit on the amount of resources you receive. + However, please use common sense. Only ask for + things you need and will use to improve Gentoo. Additionally, if you + have gotten hardware through adopt-a-dev and you no longer use the + hardware or have a need for it, please consider offering it to + other developers. + </p> + + <p> + The adopt a developer project strongly encourages developers who get + resources through adopt a developer to write publicly (<uri + link="http://planet.gentoo.org">planet</uri>, <uri + link="http://forums.gentoo.org">forums</uri>, <uri + link="http://www.gentoo.org/main/en/lists.xml">mailing lists</uri>, + etc) about any progress they have made with the help of the donated + resources, what goals they have accomplished, and how the resources + have helped them. + </p> + + <p> + In the event that a user offers a resource and 2 or more developers + want the resource, then the adopt-a-dev team will work with the + developers involved to see if the resource can be shared. If its + something like a complete system, then maybe a shell account could be + setup for the other dev(s) involved. If it is a resource that can't easily be + shared, then maybe the developers could swap the item after a certain + amount of time. If those methods fail, then the resource will go to the + developer who requested it first. The one who requested it first is the + developer whose completed request form arrived first. + </p> + + </body> + </section> +</extrachapter> + +<extrachapter> + <title>Developers Seeking Resources</title> + <section> + <body> + + <table> + <tr> + <th>Developer</th> + <th>Location</th> + <th>Qnty</th> + <th>Resource</th> + <th>Purpose</th> + <th>Project</th> + </tr> +<?php +$result = db_query("SELECT first, last, location, quantity, resource, purpose, resourceid from people, resources, status where status.statusid = resources.status and status.status = 'seeking' and people.peopleid = devid"); + +while ($result->has_next()) { + $row = $result->get_row(); + + for ($i = 0; $i <= 5; $i++) { + $uid = make_bbcode_uid(); + $row[$i] = bbencode_first_pass($row[$i],$uid); + $row[$i] = bbencode_second_pass($row[$i],$uid); + } + + echo "<tr>\n"; + echo " <ti>$row[0] $row[1]</ti>\n"; + echo " <ti>$row[2]</ti>\n"; + echo " <ti>$row[3]</ti>\n"; + echo " <ti>$row[4]</ti>\n"; + echo " <ti>$row[5]</ti>\n"; + echo " <ti>"; + $subresult = db_query("SELECT name,url from projects, project_specific_resources where projects.projectid = project_specific_resources.projectid and project_specific_resources.resourceid = '$row[6]'"); + while ($subresult->has_next()) { + $subrow = $subresult->get_row(); + echo "<uri link=\"$subrow[1]\">$subrow[0]</uri> "; + } + echo "</ti>\n"; + echo "</tr>\n"; +} +?> + </table> + + </body> + </section> +</extrachapter> + +<extrachapter> + <title>Community Members Offering Resources</title> + <section> + <body> + + <table> + <tr> + <th>Name</th> + <th>Location</th> + <th>Qnty</th> + <th>Resource</th> + </tr> +<?php +$result = db_query("SELECT first, last, location, quantity, resource from people, resources, status where status.statusid = resources.status and status.status = 'offering' and people.peopleid = donorid"); +while ($result->has_next()) { + $row = $result->get_row(); + + for ($i = 0; $i <= 4; $i++) { + $uid = make_bbcode_uid(); + $row[$i] = bbencode_first_pass($row[$i],$uid); + $row[$i] = bbencode_second_pass($row[$i],$uid); + } + + + echo "<tr>\n"; + echo " <ti>$row[0] $row[1]</ti>\n"; + echo " <ti>$row[2]</ti>\n"; + echo " <ti>$row[3]</ti>\n"; + echo " <ti>$row[4]</ti>\n"; + echo "</tr>\n"; +} +?> + </table> + + </body> + </section> +</extrachapter> + +<extrachapter> + <title>Thank You</title> + <section> + <body> + + <p> + The Gentoo project would very much like to thank the following people + for their generosity. + </p> + + <table> + <tr> + <th>Donor</th> + <th>Developer</th> + <th>Qnty</th> + <th>Resource</th> + <th>Purpose</th> + <th>Project</th> + </tr> +<?php +$result = db_query("SELECT donor.first, donor.last, dev.first, dev.last, quantity, resource, purpose, resourceid from people as donor, people as dev, resources, status where status.statusid = resources.status and status.status = 'thanks' and dev.peopleid = devid and donor.peopleid = donorid"); +while ($result->has_next()) { + $row = $result->get_row(); + + + for ($i = 0; $i <= 6; $i++) { + $uid = make_bbcode_uid(); + $row[$i] = bbencode_first_pass($row[$i],$uid); + $row[$i] = bbencode_second_pass($row[$i],$uid); + } + + + echo "<tr>\n"; + echo " <ti>$row[0] $row[1]</ti>\n"; + echo " <ti>$row[2] $row[3]</ti>\n"; + echo " <ti>$row[4]</ti>\n"; + echo " <ti>$row[5]</ti>\n"; + echo " <ti>$row[6]</ti>\n"; + echo " <ti>"; + $subresult = db_query("SELECT name,url from projects, project_specific_resources where projects.projectid = project_specific_resources.projectid and project_specific_resources.resourceid = '$row[7]'"); + while ($subresult->has_next()) { + $subrow = $subresult->get_row(); + echo "<uri link=\"$subrow[1]\">$subrow[0]</uri> "; + } + echo "</ti>\n"; + echo "</tr>\n"; +} +?> + </table> + + </body> + </section> +</extrachapter> + +<extrachapter> + <title>Privacy Policy</title> + <section> + <body> + + <p> + We aim to balance the respect for the personal privacy of every donor + and potential donor while recognizing their contribution. Donor and + potential donor e-mail addresses will never be posted on the project + page. By default, names will be posted on the project page in the + <uri link="#doc_chap8">Community Members Offering Resources</uri> + and <uri link="#doc_chap9">Thank You</uri> sections. If you wish to + remain anonymous, please let us know in your correspondence with us. + </p> + + </body> + </section> +</extrachapter> + + +<extrachapter> + <title>Disclaimer</title> + <section> + <body> + + <p> + This project is only responsible for connecting donors with individual + developers. Our responsibilities stop there. We hope all + items donated to Gentoo developers are put to good use improving + Gentoo. We cannot guarantee that a developer will accomplish all of + the goals related to the resource(s) he or she receives. + The project does not deal with organizing shipping, nor do we + deal with disputes between developers and donors. + Gentoo is not a 501(c)(3) organization but is applying for 501(c)(6) + status instead. Therefore, donations are not and will not be + tax-deductible in the U.S. In other countries, the laws will differ -- + please check with your lawyer. + </p> + + </body> + </section> +</extrachapter> + +</project> + +<?php +} +return new return_result(true); +}} +register_action(new xml_action("xml",1)); +?> |