diff options
author | 2007-02-21 01:26:11 +0000 | |
---|---|---|
committer | 2007-02-21 01:26:11 +0000 | |
commit | 359697a716a42e9ba82b601ec6ae5f5db9dd0a14 (patch) | |
tree | 2b1baea5e23d4817ba2230271861e22882090855 | |
download | adopt-a-dev-359697a716a42e9ba82b601ec6ae5f5db9dd0a14.tar.gz adopt-a-dev-359697a716a42e9ba82b601ec6ae5f5db9dd0a14.tar.bz2 adopt-a-dev-359697a716a42e9ba82b601ec6ae5f5db9dd0a14.zip |
svn path=/; revision=1
31 files changed, 4529 insertions, 0 deletions
diff --git a/site/archive/adopt-a-dev.tar.bz2 b/site/archive/adopt-a-dev.tar.bz2 Binary files differnew file mode 100644 index 0000000..8528c66 --- /dev/null +++ b/site/archive/adopt-a-dev.tar.bz2 diff --git a/site/data/aad-210207.sql b/site/data/aad-210207.sql new file mode 100644 index 0000000..7d4ac21 --- /dev/null +++ b/site/data/aad-210207.sql @@ -0,0 +1,281 @@ +-- MySQL dump 10.9 +-- +-- Host: localhost Database: bagel +-- ------------------------------------------------------ +-- Server version 4.1.20 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `accesslevels` +-- + +DROP TABLE IF EXISTS `accesslevels`; +CREATE TABLE `accesslevels` ( + `levelid` int(10) unsigned NOT NULL auto_increment, + `name` varchar(32) default NULL, + PRIMARY KEY (`levelid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `accesslevels` +-- + + +/*!40000 ALTER TABLE `accesslevels` DISABLE KEYS */; +LOCK TABLES `accesslevels` WRITE; +INSERT INTO `accesslevels` VALUES (2,'admin'),(1,'guest'); +UNLOCK TABLES; +/*!40000 ALTER TABLE `accesslevels` ENABLE KEYS */; + +-- +-- Table structure for table `menu` +-- + +DROP TABLE IF EXISTS `menu`; +CREATE TABLE `menu` ( + `menuid` int(10) unsigned NOT NULL auto_increment, + `action` varchar(64) default NULL, + `text` varchar(255) default NULL, + `priority` int(10) unsigned default NULL, + `accesslevel` int(10) unsigned default NULL, + PRIMARY KEY (`menuid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `menu` +-- + + +/*!40000 ALTER TABLE `menu` DISABLE KEYS */; +LOCK TABLES `menu` WRITE; +INSERT INTO `menu` VALUES (1,'logout','Logout',99,2),(2,'default','Home',1,2),(3,'resource','Resources',25,2),(4,'passwd','Change Password',80,2),(5,'xml','Generate Project Page',65,2),(6,'project','Projects',22,2),(7,'people','People',24,2); +UNLOCK TABLES; +/*!40000 ALTER TABLE `menu` ENABLE KEYS */; + +-- +-- Table structure for table `people` +-- + +DROP TABLE IF EXISTS `people`; +CREATE TABLE `people` ( + `peopleid` int(10) unsigned NOT NULL auto_increment, + `first` varchar(64) default NULL, + `last` varchar(64) default NULL, + `email` varchar(255) default NULL, + `location` varchar(255) default NULL, + PRIMARY KEY (`peopleid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `people` +-- + + +/*!40000 ALTER TABLE `people` DISABLE KEYS */; +LOCK TABLES `people` WRITE; +INSERT INTO `people` VALUES (1,'Thomas','Cort','tcort@gentoo.org','Williamstown, VT, USA'),(5,'Ryan','Gibbons','gibbonsr@routedtechnologies.com','Fort Worth, Texas, USA'),(6,'Gregory','Shikhman','cornmander@cornmander.com','Detroit, MI, USA'),(7,'Christian','Heim','phreak@gentoo.org','Germany'),(8,'Marius','Mauch','genone@gentoo.org','Northern Germany'),(9,'Alexandre','Buisse','nattfodd@gentoo.org','France'),(10,'Stefan','Schweizer','genstef@gentoo.org','Germany'),(11,'Simon','Stelling','blubb@gentoo.org','Switzerland'),(12,'Andrey','Falko','ma3oxuct@gmail.com','New York, NY, USA'),(13,'Thomas','Kear','thomas.kear@gmail.com','New Zealand'),(14,'Chris','White','ChrisWhite@gentoo.org','CA, USA'),(15,'Stephen','Becker','geoman@gentoo.org','Blacksburg, VA, USA'),(16,'Steve','Dibb','beandog@gentoo.org','West Jordan, UT, USA'),(17,'Steven','Oliver','oliver.steven@gmail.com','Bluefield, WV, USA'),(18,'Jann - Ove','Risvik','jann.ove@risvik.ath.cx','Norway'),(19,'Scott','Jubenville','linux.scott@gmail.com','ON, Canada'),(20,'Caleb','Tennis','caleb@gentoo.org','Columbus, IN, USA'),(21,'Steev','Klimaszewski','steev@gentoo.org','Tulsa, OK, USA'),(22,'Richard','Fish','bigfish@asmallpond.org','Phoenix, AZ, USA'),(23,'Tom','Wesley','tom@tomaw.net','UK'),(24,'Thomas','Heinrichsdobler','dertyp@gmail.com','Germany'),(25,'Luis Francisco','Araujo','araujo@gentoo.org','Maracaibo, Zulia state, Venezuela'),(26,'Patrick','Lauer','patrick@gentoo.org','Aachen, Germany'),(27,'Joshua','Jackson','tsunam@gentoo.org','Reno, NV, USA'),(28,'Carl','Fongheiser','carlfongheiser@gmail.com','Iowa City, IA, USA'),(29,'Joshua','Nichols','nichoj@gentoo.org','Boston, MA, USA'),(30,'Ioannis','Aslanidis','deathwing00@gentoo.org','Tarragona, Spain'),(31,'Kurt','Hindenburg','kurt.hindenburg@gmail.com','Indianapolis, IN, USA'),(32,'Andrew','Gaffney','agaffney@gentoo.org','St. Louis, MO, USA'),(33,'Robin','Johnson','robbat2@gentoo.org','Burnaby, BC, Canada'),(34,'Ildar','Sagdejev','specious@gmail.com','Durham, NC, USA'),(35,'Mr.','Anonymous','Anonymous','Paris, France'); +UNLOCK TABLES; +/*!40000 ALTER TABLE `people` ENABLE KEYS */; + +-- +-- Table structure for table `project_members` +-- + +DROP TABLE IF EXISTS `project_members`; +CREATE TABLE `project_members` ( + `userid` int(10) unsigned default NULL, + `roleid` int(10) unsigned default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `project_members` +-- + + +/*!40000 ALTER TABLE `project_members` DISABLE KEYS */; +LOCK TABLES `project_members` WRITE; +INSERT INTO `project_members` VALUES (1,1),(2,2),(3,2),(4,2); +UNLOCK TABLES; +/*!40000 ALTER TABLE `project_members` ENABLE KEYS */; + +-- +-- Table structure for table `project_specific_resources` +-- + +DROP TABLE IF EXISTS `project_specific_resources`; +CREATE TABLE `project_specific_resources` ( + `resourceid` int(10) unsigned default NULL, + `projectid` int(10) unsigned default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `project_specific_resources` +-- + + +/*!40000 ALTER TABLE `project_specific_resources` DISABLE KEYS */; +LOCK TABLES `project_specific_resources` WRITE; +INSERT INTO `project_specific_resources` VALUES (15,NULL),(16,NULL),(17,4),(18,4),(17,5),(18,5),(17,6),(18,6),(19,NULL),(20,7),(19,7),(21,NULL),(22,8),(23,9),(24,10),(25,11),(26,12),(27,4),(28,12),(29,12),(15,13),(30,NULL),(31,NULL),(32,NULL),(33,NULL),(34,NULL),(35,NULL),(36,NULL),(37,NULL),(38,NULL),(39,NULL),(40,NULL),(41,NULL),(42,NULL),(43,NULL),(44,7),(44,14),(45,NULL),(46,NULL),(47,NULL),(48,NULL),(49,NULL),(50,15),(51,17),(52,11),(53,17),(54,NULL),(55,NULL),(56,18),(57,19),(57,20),(57,21),(58,7),(58,12),(59,7),(59,12),(60,22),(60,23),(61,NULL),(62,12),(63,1),(63,24),(64,25),(64,12),(65,NULL),(66,NULL),(67,NULL),(68,NULL),(69,NULL),(70,NULL),(71,NULL),(72,NULL); +UNLOCK TABLES; +/*!40000 ALTER TABLE `project_specific_resources` ENABLE KEYS */; + +-- +-- Table structure for table `projects` +-- + +DROP TABLE IF EXISTS `projects`; +CREATE TABLE `projects` ( + `projectid` int(10) unsigned NOT NULL auto_increment, + `name` varchar(255) default NULL, + `url` text, + PRIMARY KEY (`projectid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `projects` +-- + + +/*!40000 ALTER TABLE `projects` DISABLE KEYS */; +LOCK TABLES `projects` WRITE; +INSERT INTO `projects` VALUES (1,'alpha','http://alpha.gentoo.org'),(2,'amd64','http://amd64.gentoo.org'),(3,'user-relations','http://www.gentoo.org/proj/en/devrel/user-relations/'),(4,'portage','http://gentoo.org/proj/en/portage'),(5,'gentoolkit','http://www.gentoo.org/doc/en/gentoolkit.xml'),(6,'gentoo-stats','http://sources.gentoo.org/viewcvs.py/portage/gentoo-stats/'),(7,'mobile','http://www.gentoo.org/proj/en/metastructure/herds/herds.xml#doc_chap68'),(8,'kernel','http://www.gentoo.org/proj/en/kernel/index.xml'),(9,'mips','http://www.gentoo.org/proj/en/base/mips/'),(10,'perl','http://www.gentoo.org/proj/en/perl/'),(11,'common-lisp','http://www.gentoo.org/proj/en/metastructure/herds/herds.xml#doc_chap20'),(12,'misc','http://gentoo.org'),(13,'java','http://www.gentoo.org/proj/en/java/'),(14,'gentopia','https://gentopia.gentooexperimental.org/'),(15,'haskell','http://www.gentoo.org/proj/en/metastructure/herds/herds.xml#doc_chap49'),(16,'scheme','http://www.gentoo.org/proj/en/metastructure/herds/herds.xml#doc_chap100'),(17,'lang-misc','http://www.gentoo.org/proj/en/metastructure/herds/herds.xml#doc_chap58'),(18,'x86','http://www.gentoo.org/proj/en/base/x86/'),(19,'ppc','http://ppc.gentoo.org'),(20,'macos','http://www.gentoo.org/proj/en/gentoo-alt/macos/'),(21,'ppc64','http://ppc64.gentoo.org'),(22,'kde','http://www.gentoo.org/proj/en/desktop/kde/index.xml'),(23,'gdp','http://www.gentoo.org/proj/en/gdp/'),(24,'installer','http://www.gentoo.org/proj/en/releng/installer/'),(25,'app-backup','http://www.gentoo.org/proj/en/metastructure/herds/herds.xml#doc_chap10'); +UNLOCK TABLES; +/*!40000 ALTER TABLE `projects` ENABLE KEYS */; + +-- +-- Table structure for table `resources` +-- + +DROP TABLE IF EXISTS `resources`; +CREATE TABLE `resources` ( + `resourceid` int(10) unsigned NOT NULL auto_increment, + `donorid` int(10) unsigned default NULL, + `devid` int(10) unsigned default NULL, + `quantity` int(10) unsigned default NULL, + `resource` text, + `purpose` text, + `status` int(10) unsigned default NULL, + `date_created` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `date_modified` timestamp NOT NULL default '0000-00-00 00:00:00', + `comment` text, + PRIMARY KEY (`resourceid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `resources` +-- + + +/*!40000 ALTER TABLE `resources` DISABLE KEYS */; +LOCK TABLES `resources` WRITE; +INSERT INTO `resources` VALUES (2,1,NULL,1,'D-Link DFE-670TXD 10/100Mbps PCMCIA Fast Ethernet Adapter','null',2,'2006-07-03 14:49:14','2006-07-03 14:49:14',NULL),(3,1,NULL,1,'CentreCOM 210TS AUI to 10baseT Transceiver',NULL,2,'2006-07-03 14:46:48','2006-07-03 14:46:48',NULL),(17,13,8,1,'PCI parallel-ATA controller card with 2+ channels (no RAID\r\nfunctionality needed)','Replacing existing components that are suspected to overheat/fail from time to time causing my home server to go offline for hours or days, resulting in disrupted workflows and corrupted data == lost time.',4,'2006-08-08 10:39:51','2006-08-09 20:12:31',NULL),(15,5,14,1,'Hosting / Shell Accounts (6mbit, unlimited throughput)','apache tomcat work',3,'2006-08-04 10:58:15','2006-08-11 10:02:48',NULL),(16,6,NULL,1,'Hosting / Shell Accounts on Gentoo/x86 (100mbit, 1000GB/mo transfer)','null',2,'2006-08-05 05:15:03','2006-08-05 05:15:03',NULL),(18,NULL,8,1,'AGP (or PCI) low-end, passively cooled graphics card (must work in a\r\nsocket-A mainboard)','Replacing existing components that are suspected to overheat/fail from time to time causing my home server to go offline for hours or days, resulting in disrupted workflows and corrupted data == lost time.',4,'2006-08-08 10:40:28','2006-08-16 07:13:41',NULL),(19,NULL,9,1,'GPS receiver usable without a PDA (laptop or standalone units are fine). It must be in the list of the gpsd supported devices.','The purpose is to join the mobile herd and help with testing/maintenance of GPS related software. According to steev, nobody in this herd is currently owning a GPS device, which makes it pretty much impossible to maintain those applications.',1,'2006-08-08 10:59:30','2006-08-08 11:32:38',NULL),(20,NULL,10,1,'GPS receiver usable without a PDA (laptop or standalone units are fine). It must be in the list of the gpsd supported devices.','The purpose is to join the mobile herd and help with testing/maintenance of GPS related software. According to steev, nobody in this herd is currently owning a GPS device, which makes it pretty much impossible to maintain those applications.',1,'2006-08-08 11:29:17','2006-08-08 11:32:48',NULL),(21,11,NULL,1,'1x Firewire/IEEE-1394 PCI-card with a VIA VT6306 chipset and 3 plugs','null',2,'2006-08-08 12:17:23','2006-08-08 12:17:23',NULL),(22,12,7,1,'A shell account on a single box with root access and permission to reboot when needed.','Kernel development, testing, and rollout along with other day to day remote development.',3,'2006-08-08 13:20:28','2006-08-12 06:03:15',NULL),(23,NULL,15,1,'SGI Octane system board with support for R12000 and R14000 CPU modules. SGI Part No: 030-1467-001','Keeping X-related packages up to date on Gentoo/MIPS.',1,'2006-08-09 21:18:00','2006-08-09 21:18:00',NULL),(24,19,14,1,'Book: Programming perl By Larry Wall, Tom Christiansen, Jon Orwant ISBN: 0-596-00027-8','improve perl knowledge to help with perl packages',3,'2006-08-09 21:49:09','2006-08-11 10:03:12',NULL),(25,NULL,14,1,'Book: ANSI Common LISP ; ISBN 0133708756','improve lisp knowledge to help with lisp packages',1,'2006-08-09 21:52:16','2006-08-19 08:02:15',NULL),(26,NULL,14,1,'Book: GNU Autoconf, Automake, and Libtool ; ISBN 1578701902','improve auto-tool knowledge to help with the maintenance of many packages',4,'2006-08-09 21:54:51','2006-08-31 06:27:25',NULL),(51,NULL,25,1,'Book: Smalltalk, Objects, and Design ; ISBN 1583484906','I maintain all of our existing Smalltalk implementations packages (around 5 at the moment). I would like to improve our support for them and extend it including new packages (and maybe even creating a herd if possible). This book will be ideal to help me doing this.',1,'2006-08-19 08:09:45','2006-08-19 08:18:40',NULL),(27,NULL,14,1,'Book: Dive Into Python ; ISBN 1590593561','improve python skills to help understand portage code',1,'2006-08-09 21:56:13','2006-08-19 08:02:59',NULL),(28,28,14,1,'Dell Inspiron 4000 256MB memory stick','general development work, improve productivity',4,'2006-08-09 21:57:56','2006-08-23 14:35:01',NULL),(29,22,14,2,'PC2700 333mhz 512MB RAM','general development work, improve productivity',3,'2006-08-09 21:58:30','2006-08-23 16:16:11',NULL),(30,16,NULL,1,'SIIG USB 2.0 Dual-Port PCI Host Adapter','null',2,'2006-08-10 05:33:19','2006-08-10 05:33:19',NULL),(31,16,NULL,1,'ATI USB RF Remote','null',2,'2006-08-10 05:33:37','2006-08-10 05:33:37',NULL),(32,17,NULL,1,'Conexant F1156I/R2F PCI Modem (RS56-PCI Chipset)','null',2,'2006-08-10 09:59:26','2006-08-10 09:59:26',NULL),(33,17,NULL,1,'Linksys LNE100TX ver. 5.1 PCI EtherFast 10/100 LAN Card','null',2,'2006-08-10 09:59:54','2006-08-10 09:59:54',NULL),(34,17,NULL,1,'Single stick of 512M 133Mhz RAM (possibly made by Memorex)','null',2,'2006-08-10 10:00:49','2006-08-10 10:00:49',NULL),(35,17,NULL,1,'Black 3 1/2 inch floppy drive from a Dell. No faceplate.','null',2,'2006-08-10 10:01:59','2006-08-10 10:02:53',NULL),(36,17,NULL,1,'White 3 1/2 inch floppy drive.','null',2,'2006-08-10 10:03:29','2006-08-10 10:03:29',NULL),(37,5,NULL,1,'Xen Virtual Server, Unlimited storage within reason, 100MB+ Ram, 100Mbit Burstable, 5Mbit dedicated, unlimited throughput. Backup and Restore points can be created by request.','null',2,'2006-08-10 10:13:03','2006-08-16 13:15:05',NULL),(38,18,NULL,1,'Shell accounts on a 6/6mbit line with unlimited transfer.','null',2,'2006-08-10 14:12:26','2006-08-10 14:12:26',NULL),(39,20,NULL,1,'Book: OReilly MySQL reference manual ; ISBN 636920002659','null',4,'2006-08-11 10:04:42','2006-10-23 20:05:24',NULL),(40,20,NULL,1,'Book: Serial Communications in C++ ; ISBN 1558281983','null',2,'2006-08-11 10:05:04','2006-08-19 08:04:10',NULL),(41,20,NULL,1,'Book: Effective C++, 2nd Ed ; ISBN 0201924889','null',4,'2006-08-11 10:05:38','2006-10-23 20:05:27',NULL),(42,20,NULL,1,'Book: Programming Embedded Systems in C/C++ ; ISBN 1565923545','null',4,'2006-08-11 10:05:56','2006-09-06 06:21:35',NULL),(43,20,NULL,1,'Book: Programming Perl ; ISBN 0596000278','null',2,'2006-08-11 10:06:32','2006-08-19 08:04:31',NULL),(44,22,21,1,'Seagate 5400 100GB 2.5\" PATA HD','Upgrade a desktop machine which currently has a 20GB HD or a laptop which currently has a 10GB HD.',3,'2006-08-13 18:22:51','2006-08-19 13:41:27',NULL),(45,22,NULL,1,'Hitachi HTS721010G9SA00 100GB, 7200rpm, 2.5\" SATA HD.','null',2,'2006-08-13 18:25:04','2006-08-13 18:25:04',NULL),(46,22,NULL,1,'Hitachi HTS541080G9SA00, 80GB, 5400rpm, 2.5\" SATA HD.','null',2,'2006-08-13 18:25:15','2006-08-13 18:25:15',NULL),(47,16,NULL,1,'TDK 4800B IDE 52x CD-RW internal drive (beige)','null',2,'2006-08-14 05:35:12','2006-08-14 05:35:12',NULL),(48,23,NULL,1,'Sharp Zaurus SL-5500, dock and charger.','null',2,'2006-08-15 11:11:20','2006-08-15 11:11:20',NULL),(49,24,NULL,1,'Belkin Nostromo n50 Speedpad. For supporting [url=http://sf.net/projects/nostromodriver]nostromo driver[/url] ([url=http://bugs.gentoo.org/show_bug.cgi?id=80623]Bug #80623[/url]).','null',2,'2006-08-18 19:56:32','2006-08-19 10:57:10',NULL),(50,NULL,25,1,'Book: Types and Programming Languages ; ISBN 0262162091','This book will help me understand better the design of type systems in different programming languages. I am mainly requesting this book because i maintain Haskell (and belong to that herd too) packages which highly would benefit from the knowledge i can gain from it.',1,'2006-08-19 07:59:29','2006-08-19 08:03:28',NULL),(52,NULL,25,1,'Book: ANSI Common Lisp ; ISBN 0133708756','We got a bunch of Common Lisp packages in our tree. Nevertheless, the Lisp herd is very understaffed. I would like to give some help with them. This book will give me the necessary background to improve my Lisp knowledge so i can cooperate in a more accurate manner.',1,'2006-08-19 08:11:39','2006-08-19 08:11:39',NULL),(53,NULL,25,1,'Book: Dylan Programming: An Object Oriented and Dynamic Language ; ISBN 0201479761','Dylan is a very powerful object oriented language. I included support for this language inside Gentoo, adding one of its most famous compilers available inside the tree. This book would give me the necessary knowledge to continue enhancing and extending such a support.',1,'2006-08-19 08:13:50','2006-08-19 08:13:50',NULL),(54,26,NULL,1,'Access to gentooexperimental.org AMD64 server, useable for webhosting and other services','null',2,'2006-08-19 13:15:14','2006-08-19 13:16:22',NULL),(55,26,NULL,1,'Access to dev.gentooexperimental.org AMD64 server, uncapped 100Mbit connection, 250G diskspace, compile machine','null',2,'2006-08-19 13:15:51','2006-08-19 13:15:51',NULL),(56,NULL,27,1,'A scanner that is supported by the sane backend. [url=http://www.sane-project.org/sane-supported-devices.html]SANE - Supported Devices List[/url].','As no member of the x86 team has a scanner, it makes it hard to test the packages for stabilization. The maintainer of packages that require a scanner might not have a x86 box that is stable.',1,'2006-08-20 05:57:04','2006-08-20 05:59:04',NULL),(57,NULL,29,1,'Any ethernet card that is known to work in Linux and Mac OS X on a PowerMac G5.','To do testing of Java and other packages on ppc, ppc64, and maybe even ppc-macos.',4,'2006-08-31 14:46:51','2006-09-04 20:19:10',NULL),(58,NULL,21,1,'orinoco gold usb wireless device','To help with the drivers.',1,'2006-08-31 16:05:21','2006-08-31 16:05:37',NULL),(59,NULL,21,1,'Battery for a Japanese Sharp Mebius PC-CB1-CD to replace a dead battery (model number CE-BN12).','So that Steev isn\'t stuck to a power outlet.',1,'2006-08-31 16:07:56','2006-08-31 16:08:12',NULL),(60,NULL,30,1,'A bluetooth USB dongle from this [url=http://www.holtmann.org/linux/bluetooth/features.html]list[/url]','Replacement of a usb dongle, required to perform development and tests on kdebluetooth and other bluetooth-related applications running on Gentoo. Also required to keep an up-to-date bluetooth guide.',4,'2006-09-02 14:41:14','2006-09-08 07:46:03',NULL),(61,31,NULL,1,'Book: GNU Autoconf, Automake, and Libtool ; ISBN 1578701902','null',4,'2006-09-02 14:46:44','2006-10-23 20:05:21',NULL),(62,NULL,14,1,'[url=http://www.pricegrabber.com/search_getprod.php/masterid=535580/search=intel+pentium+4+2.0+ghz/]Intel Pentium 4 Northwood - 2.0A GHz Processor[/url] (2.0GHz, 512KB, 400 MHz, Socket 478 - MPN: BX80532PC2000D)','general development work, improve productivity',1,'2006-09-02 17:33:26','2006-09-02 17:33:26',NULL),(63,NULL,32,1,'Any linux-supported DEC Alpha workstation with at least a 400MHz processor, >=128MB of memory, a supported PCI video card, and a CD-ROM (bonus if it can read CD-RW without a problem).','Support for the alpha architecture in the Gentoo Installer.',1,'2006-09-04 15:28:45','2006-09-04 15:29:05',NULL),(64,NULL,33,1,'A PCI-E SCSI controller (needs to be U160 or better and and not wider than PCI-E x4; must have an external connector to use with tape drives) or a SCSI->iSCSI converter','To maintain iSCSI packages and to maintain a lot of the backup packages dealing with tape drives.',1,'2006-09-08 08:06:11','2006-09-08 08:06:50',NULL),(65,34,NULL,1,'External 8X DVD-ROM / 32X CD-ROM drive, connects via PCMCIA card (included)','null',2,'2006-09-19 16:43:51','2006-09-19 16:43:51',NULL),(66,34,NULL,1,'SpeedStream DSL/Cable router (one LAN port only)','null',2,'2006-09-19 16:44:16','2006-09-19 16:44:16',NULL),(67,35,NULL,3,'Pentium III 800/256/133/1.7V - Slot 1 CPU','null',2,'2006-10-17 03:48:33','2006-10-17 03:52:51',NULL),(68,35,NULL,1,'Pentium III 866/256/133/1.7V - Slot 1 CPU','null',2,'2006-10-17 03:49:04','2006-10-17 03:53:12',NULL),(69,35,NULL,1,'Pentium III 800/256/133/1.7V - Socket 370 CPU','null',2,'2006-10-17 03:49:41','2006-10-17 03:49:41',NULL),(70,35,NULL,2,'Pentium III 733/256/133/1.7V - Socket 370 CPU','null',2,'2006-10-17 03:50:18','2006-10-17 03:50:18',NULL),(71,35,NULL,10,'128MB Memory DIMM SDRAM *ECC* (Various brands)','null',2,'2006-10-17 03:50:34','2006-10-17 03:50:34',NULL),(72,NULL,14,1,'10GB+ SCSI Disk','I\'d currently like to use the alpha workstation I have for desktop related testing for the alpha herd, however I have a small drive (about 3 gigs) which could work for the basics, but I\'d like to do a bit more testing than that.',1,'2006-10-17 03:51:35','2006-10-17 03:51:35',NULL); +UNLOCK TABLES; +/*!40000 ALTER TABLE `resources` ENABLE KEYS */; + +-- +-- Table structure for table `roles` +-- + +DROP TABLE IF EXISTS `roles`; +CREATE TABLE `roles` ( + `roleid` int(10) unsigned NOT NULL auto_increment, + `role` varchar(64) default NULL, + PRIMARY KEY (`roleid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `roles` +-- + + +/*!40000 ALTER TABLE `roles` DISABLE KEYS */; +LOCK TABLES `roles` WRITE; +INSERT INTO `roles` VALUES (1,'Lead'),(2,'Member'); +UNLOCK TABLES; +/*!40000 ALTER TABLE `roles` ENABLE KEYS */; + +-- +-- Table structure for table `sessions` +-- + +DROP TABLE IF EXISTS `sessions`; +CREATE TABLE `sessions` ( + `sessionid` varchar(32) default NULL, + `userid` int(10) unsigned NOT NULL default '0' +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `sessions` +-- + + +/*!40000 ALTER TABLE `sessions` DISABLE KEYS */; +LOCK TABLES `sessions` WRITE; +INSERT INTO `sessions` VALUES ('2792b9b2ed7f3bb339c7bfb6010bda54',5),('l3ogg0m6b3eppb8o1atv5qi740',2),('5kmueilnr17d796mdgq23vjtn0',1); +UNLOCK TABLES; +/*!40000 ALTER TABLE `sessions` ENABLE KEYS */; + +-- +-- Table structure for table `status` +-- + +DROP TABLE IF EXISTS `status`; +CREATE TABLE `status` ( + `statusid` int(10) unsigned NOT NULL auto_increment, + `status` varchar(255) default NULL, + PRIMARY KEY (`statusid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `status` +-- + + +/*!40000 ALTER TABLE `status` DISABLE KEYS */; +LOCK TABLES `status` WRITE; +INSERT INTO `status` VALUES (1,'seeking'),(2,'offering'),(4,'hidden'),(3,'thanks'); +UNLOCK TABLES; +/*!40000 ALTER TABLE `status` ENABLE KEYS */; + +-- +-- Table structure for table `users` +-- + +DROP TABLE IF EXISTS `users`; +CREATE TABLE `users` ( + `userid` int(10) unsigned NOT NULL auto_increment, + `first` varchar(64) default NULL, + `last` varchar(64) default NULL, + `username` varchar(64) default NULL, + `passwd` varchar(32) default NULL, + `accesslevel` int(10) unsigned default NULL, + PRIMARY KEY (`userid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `users` +-- + + +/*!40000 ALTER TABLE `users` DISABLE KEYS */; +LOCK TABLES `users` WRITE; +INSERT INTO `users` VALUES (1,'Thomas','Cort','tcort','449884d825dc41836cbdf026892220c6',2),(2,'Christel','Dahlskjær','christel','d6d38c300f94b81760281c2f6a370ffa',2),(4,'Joshua','Jackson','tsunam','159e683b42c950c710c74844a719f474',2); +UNLOCK TABLES; +/*!40000 ALTER TABLE `users` ENABLE KEYS */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + diff --git a/site/source/classes/actor.class.php b/site/source/classes/actor.class.php new file mode 100644 index 0000000..8489af8 --- /dev/null +++ b/site/source/classes/actor.class.php @@ -0,0 +1,49 @@ +<?php +# CATS Online Registration System +# 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 actor { + var $name; + var $priority; # integer from 0-99 (0 is the most urgent / first done) + + function actor($name,$priority) { + $this->name = $name; + $this->priority = $priority; + } + + function set_priority($priority) { + $this->priority = $priority; + } + + function get_priority() { + return $this->priority; + } + + function execute() { + return; + } + + function set_name($name) { + $this->name = $name; + } + + function get_name() { + return $this->name; + } +} + +?> diff --git a/site/source/classes/cats_smtp.class.php b/site/source/classes/cats_smtp.class.php new file mode 100644 index 0000000..444bec7 --- /dev/null +++ b/site/source/classes/cats_smtp.class.php @@ -0,0 +1,183 @@ +<?php + +# CATS Online Registration System +# 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 file contains a PHP SMTP client +class cats_smtp { + var $connection; + var $host; + var $port; + + function cats_smtp() { + global $smtp_host; + global $smtp_port; + + if (!isset($smtp_host)) { + $this->host = "localhost"; # try the localhost + } else { + $this->host = $smtp_host; + } + + if (!isset($smtp_port)) { + $this->port = 25; # use default smtp port + } else { + $this->port = $smtp_port; + } + + $this->connection = 0; + } + + function connect() { + $this->connection = fsockopen($this->host,$this->port); + + if (!$this->connection) { + $r = new return_result(false); + $r->add_message("No Connection\n"); + return $r; + } + + $result = $this->get_sock_data(); + + if (strncmp($result,"220",3) != 0) { + $r = new return_result(false); + $r->add_message("Error connecting\n$result\n"); + return $r; + } + + return new return_result(true); + } + + function disconnect() { + fclose($this->connection); + $this->connection = 0; + } + + # read as much data from the socket as possible + function get_sock_data() { + $data = ""; + + while($str = fgets($this->connection,515)) { + $data .= $str; + if(substr($str,3,1) == " ") { + break; + } + } + return $data; + } + + # write data to a socket and append "\r\n" + function put_sock_data($data) { + fwrite($this->connection,$data . "\r\n"); + } + + # SMTP Commands + function cmd_helo() { + $this->put_sock_data("ehlo " . $this->host); + $result = $this->get_sock_data(); + + if (strncmp($result,"250",3) != 0) { + $r = new return_result(false); + $r->add_message("Error with HELO command\n$result\n"); + return $r; + } + + return new return_result(true); + } + + function cmd_auth() { + global $smtp_user, $smtp_pass; + $coded_pass = base64_encode("$smtp_user\0$smtp_user\0$smtp_pass"); + + $this->put_sock_data("AUTH PLAIN " . $coded_pass); + $result = $this->get_sock_data(); + + if (strncmp($result,"235",3) != 0) { + $r = new return_result(false); + $r->add_message("Error with AUTH command\n$result\n"); + return $r; + } + + return new return_result(true); + } + + function cmd_quit() { + $this->put_sock_data("quit"); + $result = $this->get_sock_data(); + + if (strncmp($result,"221",3) != 0) { + $r = new return_result(false); + $r->add_message("Error with QUIT command\n$result\n"); + return $r; + } + + return new return_result(true); + } + + function cmd_mail_from($addr) { + $this->put_sock_data("mail from: $addr"); + $result = $this->get_sock_data(); + + if (strncmp($result,"250",3) != 0) { + $r = new return_result(false); + $r->add_message("Error with MAIL FROM: $addr command\n$result\n"); + return $r; + } + + return new return_result(true); + } + + function cmd_rcpt_to($addr) { + $this->put_sock_data("rcpt to: $addr"); + $result = $this->get_sock_data(); + + if (strncmp($result,"250",3) != 0) { + $r = new return_result(false); + $r->add_message("Error with RCPT TO: $addr command\n$result\n"); + return $r; + } + + return new return_result(true); + } + + function cmd_data($from,$to,$subject,$data) { + $this->put_sock_data("DATA"); + $result = $this->get_sock_data(); + + if (strncmp($result,"354",3) != 0) { + $r = new return_result(false); + $r->add_message("Error with DATA command\n$result\n"); + return $r; + } + + $this->put_sock_data("From: $from"); + $this->put_sock_data("To: $to"); + $this->put_sock_data("Subject: $subject"); + $this->put_sock_data($data); + $this->put_sock_data("."); + $result = $this->get_sock_data(); + + if (strncmp($result,"250",3) != 0) { + $r = new return_result(false); + $r->add_message("Error with DATA command\n$result\n"); + return $r; + } + + return new return_result(true); + } +} +?> diff --git a/site/source/classes/collection.class.php b/site/source/classes/collection.class.php new file mode 100644 index 0000000..9b406cb --- /dev/null +++ b/site/source/classes/collection.class.php @@ -0,0 +1,83 @@ +<?php + +# CATS Online Registration System +# 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 + +# A sort that we use with the actor class. It allows us to sort by priority +function priority_sort($a,$b) { + if ($a->get_priority() == $b->get_priority()) { + return 0; + } + return ($a->get_priority() < $b->get_priority()) ? -1 : 1; +} + +# General Collection Class +class collection { + var $items; + + # $key should be a string + # $value should be an actor + function put($key,$value) { + if (isset($this->items[$key])) { + $this->items[$key][count($this->items[$key])] = $value; + uasort($this->items[$key],"priority_sort"); + } else { + $this->items[$key] = array($value); + } + } + + # get will return an array of actors or false + # You _MUST_ use php's iterator each() to access to elements in order + # indexing them 0,1,...,n-1 will not work because sorting != re-indexing + # There is a working example of this class at the bottom of this file... + function get($key) { + if (isset($this->items[$key])) { + return $this->items[$key]; + } else { + return false; + } + } +} + +# Example Code using class collection. +# +# $col = new collection(); +# include("event_handler.class.php"); +# +# $one = new event_handler(); +# $two = new event_handler(); +# $thr = new event_handler(); +# +# $one->set_priority(1); +# $two->set_priority(2); +# $thr->set_priority(3); +# +# $one->set_name("one"); +# $two->set_name("two"); +# $thr->set_name("thr"); +# +# $col->put("event_name",$thr); # 3 +# $col->put("event_name",$one); # 1 +# $col->put("event_name",$two); # 2 +# +# $x = $col->get("event_name"); +# while (list($key, $value) = each($x)) { +# echo $x[$key]->get_priority(); +# echo " "; +# } +# echo "\n"; +?> diff --git a/site/source/classes/dbresult.class.php b/site/source/classes/dbresult.class.php new file mode 100644 index 0000000..7952bd7 --- /dev/null +++ b/site/source/classes/dbresult.class.php @@ -0,0 +1,97 @@ +<?php + +# CATS Online Registration System +# 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 DBResult +{ + var $resultset; + var $rownum; + var $arr; + var $maxrows; + var $query; + + function DBResult($rs,$q) + { + $this->query = $q; + if ($rs == FALSE) + { + $this->maxrows = 0; + print "<p>SQL FAILURE (Query follows...)<p>".$this->query."<p>"; + } + else + { + $this->maxrows = db_get_max_rows($rs); + } + $this->resultset = $rs; + $this->arr = NULL; + $this->rownum = 0; + } + + function set_index($pos) + { + db_data_seek($this->resultset,$pos); + } + + function get_maxrows() + { + return $this->maxrows; + } + + function has_next() + { + return $this->rownum < $this->maxrows; + } + + function get_row() + { + if ($this->has_next()) + { + $this->arr = db_fetch_array($this->resultset); + $this->rownum++; + } + return $this->arr; + } + + # resets the internal counters to 0 so that get_row() will return row 0 + function reset() { + db_data_seek($this->resultset,0); + $this->rownum = 0; + } + + function print_all() + { + print "<p>"; + while ($this->has_next()) + { + $row = $this->get_row(); + print_r($row); + print "<p>"; + } + print "<p>"; + $this->reset(); + } + + function has_more($num) + { + if ($this->maxrows > $num) + return true; + else + return false; + } +} +?> diff --git a/site/source/classes/return_result.class.php b/site/source/classes/return_result.class.php new file mode 100644 index 0000000..d237ee1 --- /dev/null +++ b/site/source/classes/return_result.class.php @@ -0,0 +1,51 @@ +<?php +# CATS Online Registration System +# 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 return_result { + var $success; + var $messages; + + function return_result($suc) { + $this->success = $suc; + $this->messages = array(); + } + + # true if OK : false if failure + function success() { + return $this->success; + } + + function set_result($result) { + $this->success = $result; + } + + function add_message($mes) { + array_push($this->messages,$mes); + } + + function get_messages() { + if (count($this->messages) > 0) { + return $this->messages; + } else { + $temp = array(); + array_push($temp,""); + return $temp; + } + } +} +?> diff --git a/site/source/functions/bbcode.guidexml.tpl b/site/source/functions/bbcode.guidexml.tpl new file mode 100644 index 0000000..fbac3f3 --- /dev/null +++ b/site/source/functions/bbcode.guidexml.tpl @@ -0,0 +1,50 @@ +<!-- BEGIN ulist_open --><ul><!-- END ulist_open --> +<!-- BEGIN ulist_close --></ul><!-- END ulist_close --> + +<!-- BEGIN olist_open --><ol type="{LIST_TYPE}"><!-- END olist_open --> +<!-- BEGIN olist_close --></ol><!-- END olist_close --> + +<!-- BEGIN listitem --><li><!-- END listitem --> + +<!-- BEGIN quote_username_open --><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"> + <tr> + <td class="quote"><!-- END quote_username_open --> +<!-- BEGIN quote_open --></span> +<table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"> +<tr> + <td><span class="genmed"><b>{L_QUOTE}:</b></span></td> + </tr> + <tr> + <td class="quote"><!-- END quote_open --> +<!-- BEGIN quote_close --></td> + </tr> +</table><!-- END quote_close --> + +<!-- BEGIN code_open --><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"> + <tr> + <td class="code"><!-- END code_open --> +<!-- BEGIN code_close --></td> + </tr> +</table><!-- END code_close --> + + +<!-- BEGIN b_open --><span style="font-weight: bold"><!-- END b_open --> +<!-- BEGIN b_close --></span><!-- END b_close --> + +<!-- BEGIN u_open --><span style="text-decoration: underline"><!-- END u_open --> +<!-- BEGIN u_close --></span><!-- END u_close --> + +<!-- BEGIN i_open --><span style="font-style: italic"><!-- END i_open --> +<!-- BEGIN i_close --></span><!-- END i_close --> + +<!-- BEGIN color_open --><span style="color: {COLOR}"><!-- END color_open --> +<!-- BEGIN color_close --></span><!-- END color_close --> + +<!-- BEGIN size_open --><span style="font-size: {SIZE}px; line-height: normal"><!-- END size_open --> +<!-- BEGIN size_close --></span><!-- END size_close --> + +<!-- BEGIN img --><img src="{URL}" border="0" /><!-- END img --> + +<!-- BEGIN url --><uri link="{URL}">{DESCRIPTION}</uri><!-- END url --> + +<!-- BEGIN email --><mail link="mailto:{EMAIL}">{EMAIL}</mail><!-- END email --> diff --git a/site/source/functions/bbcode.html.tpl b/site/source/functions/bbcode.html.tpl new file mode 100644 index 0000000..f9a6962 --- /dev/null +++ b/site/source/functions/bbcode.html.tpl @@ -0,0 +1,50 @@ +<!-- BEGIN ulist_open --><ul><!-- END ulist_open --> +<!-- BEGIN ulist_close --></ul><!-- END ulist_close --> + +<!-- BEGIN olist_open --><ol type="{LIST_TYPE}"><!-- END olist_open --> +<!-- BEGIN olist_close --></ol><!-- END olist_close --> + +<!-- BEGIN listitem --><li><!-- END listitem --> + +<!-- BEGIN quote_username_open --><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"> + <tr> + <td class="quote"><!-- END quote_username_open --> +<!-- BEGIN quote_open --></span> +<table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"> +<tr> + <td><span class="genmed"><b>{L_QUOTE}:</b></span></td> + </tr> + <tr> + <td class="quote"><!-- END quote_open --> +<!-- BEGIN quote_close --></td> + </tr> +</table><!-- END quote_close --> + +<!-- BEGIN code_open --><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"> + <tr> + <td class="code"><!-- END code_open --> +<!-- BEGIN code_close --></td> + </tr> +</table><!-- END code_close --> + + +<!-- BEGIN b_open --><span style="font-weight: bold"><!-- END b_open --> +<!-- BEGIN b_close --></span><!-- END b_close --> + +<!-- BEGIN u_open --><span style="text-decoration: underline"><!-- END u_open --> +<!-- BEGIN u_close --></span><!-- END u_close --> + +<!-- BEGIN i_open --><span style="font-style: italic"><!-- END i_open --> +<!-- BEGIN i_close --></span><!-- END i_close --> + +<!-- BEGIN color_open --><span style="color: {COLOR}"><!-- END color_open --> +<!-- BEGIN color_close --></span><!-- END color_close --> + +<!-- BEGIN size_open --><span style="font-size: {SIZE}px; line-height: normal"><!-- END size_open --> +<!-- BEGIN size_close --></span><!-- END size_close --> + +<!-- BEGIN img --><img src="{URL}" border="0" /><!-- END img --> + +<!-- BEGIN url --><a href="{URL}">{DESCRIPTION}</a><!-- END url --> + +<!-- BEGIN email --><a href="mailto:{EMAIL}">{EMAIL}</A><!-- END email --> diff --git a/site/source/functions/bbcode.php b/site/source/functions/bbcode.php new file mode 100644 index 0000000..f9757a5 --- /dev/null +++ b/site/source/functions/bbcode.php @@ -0,0 +1,799 @@ +<?php +/*************************************************************************** + * bbcode.php + * ------------------- + * begin : Saturday, Feb 13, 2001 + * copyright : (C) 2001 The phpBB Group + * email : support@phpbb.com + * + * $Id: bbcode.php,v 1.36.2.32 2004/07/11 16:46:19 acydburn Exp $ + * + ***************************************************************************/ + +/*************************************************************************** + * + * 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. + * + ***************************************************************************/ + +define("BBCODE_UID_LEN", 10); + +// global that holds loaded-and-prepared bbcode templates, so we only have to do +// that stuff once. + +$bbcode_tpl = null; + +/** + * Loads bbcode templates from the bbcode.tpl file of the current template set. + * Creates an array, keys are bbcode names like "b_open" or "url", values + * are the associated template. + * Probably pukes all over the place if there's something really screwed + * with the bbcode.tpl file. + * + * Nathan Codding, Sept 26 2001. + * + * Load different files depending on the output we want. + * Thomas Cort, Aug 19 2006. + */ +function load_bbcode_template() +{ + global $guidexml; + + if ($guidexml == 1) { + $tpl_filename = "../functions/bbcode.guidexml.tpl"; + } else if ($guidexml == -1) { + $tpl_filename = "../functions/bbcode.txt.tpl"; + } else { + $tpl_filename = "../functions/bbcode.html.tpl"; + } + + $tpl = fread(fopen($tpl_filename, 'r'), filesize($tpl_filename)); + + // replace \ with \\ and then ' with \'. + $tpl = str_replace('\\', '\\\\', $tpl); + $tpl = str_replace('\'', '\\\'', $tpl); + + // strip newlines. + $tpl = str_replace("\n", '', $tpl); + + // Turn template blocks into PHP assignment statements for the values of $bbcode_tpls.. + $tpl = preg_replace('#<!-- BEGIN (.*?) -->(.*?)<!-- END (.*?) -->#', "\n" . '$bbcode_tpls[\'\\1\'] = \'\\2\';', $tpl); + + $bbcode_tpls = array(); + + eval($tpl); + + return $bbcode_tpls; +} + + +/** + * Prepares the loaded bbcode templates for insertion into preg_replace() + * or str_replace() calls in the bbencode_second_pass functions. This + * means replacing template placeholders with the appropriate preg backrefs + * or with language vars. NOTE: If you change how the regexps work in + * bbencode_second_pass(), you MUST change this function. + * + * Nathan Codding, Sept 26 2001 + * + */ +function prepare_bbcode_template($bbcode_tpl) +{ + global $lang; + + $bbcode_tpl['olist_open'] = str_replace('{LIST_TYPE}', '\\1', $bbcode_tpl['olist_open']); + + $bbcode_tpl['color_open'] = str_replace('{COLOR}', '\\1', $bbcode_tpl['color_open']); + + $bbcode_tpl['size_open'] = str_replace('{SIZE}', '\\1', $bbcode_tpl['size_open']); + + $bbcode_tpl['quote_open'] = str_replace('{L_QUOTE}', $lang['Quote'], $bbcode_tpl['quote_open']); + + $bbcode_tpl['quote_username_open'] = str_replace('{L_QUOTE}', $lang['Quote'], $bbcode_tpl['quote_username_open']); + $bbcode_tpl['quote_username_open'] = str_replace('{L_WROTE}', $lang['wrote'], $bbcode_tpl['quote_username_open']); + $bbcode_tpl['quote_username_open'] = str_replace('{USERNAME}', '\\1', $bbcode_tpl['quote_username_open']); + + $bbcode_tpl['code_open'] = str_replace('{L_CODE}', $lang['Code'], $bbcode_tpl['code_open']); + + $bbcode_tpl['img'] = str_replace('{URL}', '\\1', $bbcode_tpl['img']); + + // We do URLs in several different ways.. + $bbcode_tpl['url1'] = str_replace('{URL}', '\\1', $bbcode_tpl['url']); + $bbcode_tpl['url1'] = str_replace('{DESCRIPTION}', '\\1', $bbcode_tpl['url1']); + + $bbcode_tpl['url2'] = str_replace('{URL}', 'http://\\1', $bbcode_tpl['url']); + $bbcode_tpl['url2'] = str_replace('{DESCRIPTION}', '\\1', $bbcode_tpl['url2']); + + $bbcode_tpl['url3'] = str_replace('{URL}', '\\1', $bbcode_tpl['url']); + $bbcode_tpl['url3'] = str_replace('{DESCRIPTION}', '\\2', $bbcode_tpl['url3']); + + $bbcode_tpl['url4'] = str_replace('{URL}', 'http://\\1', $bbcode_tpl['url']); + $bbcode_tpl['url4'] = str_replace('{DESCRIPTION}', '\\3', $bbcode_tpl['url4']); + + $bbcode_tpl['email'] = str_replace('{EMAIL}', '\\1', $bbcode_tpl['email']); + + define("BBCODE_TPL_READY", true); + + return $bbcode_tpl; +} + + +/** + * Does second-pass bbencoding. This should be used before displaying the message in + * a thread. Assumes the message is already first-pass encoded, and we are given the + * correct UID as used in first-pass encoding. + */ +function bbencode_second_pass($text, $uid) +{ + global $lang, $bbcode_tpl; + + // pad it with a space so we can distinguish between FALSE and matching the 1st char (index 0). + // This is important; bbencode_quote(), bbencode_list(), and bbencode_code() all depend on it. + $text = " " . $text; + + // First: If there isn't a "[" and a "]" in the message, don't bother. + if (! (strpos($text, "[") && strpos($text, "]")) ) + { + // Remove padding, return. + $text = substr($text, 1); + return $text; + } + + // Only load the templates ONCE.. + if (!defined("BBCODE_TPL_READY")) + { + // load templates from file into array. + $bbcode_tpl = load_bbcode_template(); + + // prepare array for use in regexps. + $bbcode_tpl = prepare_bbcode_template($bbcode_tpl); + } + + // [CODE] and [/CODE] for posting code (HTML, PHP, C etc etc) in your posts. + $text = bbencode_second_pass_code($text, $uid, $bbcode_tpl); + + // [QUOTE] and [/QUOTE] for posting replies with quote, or just for quoting stuff. + $text = str_replace("[quote:$uid]", $bbcode_tpl['quote_open'], $text); + $text = str_replace("[/quote:$uid]", $bbcode_tpl['quote_close'], $text); + + // New one liner to deal with opening quotes with usernames... + // replaces the two line version that I had here before.. + $text = preg_replace("/\[quote:$uid=\"(.*?)\"\]/si", $bbcode_tpl['quote_username_open'], $text); + + // [list] and [list=x] for (un)ordered lists. + // unordered lists + $text = str_replace("[list:$uid]", $bbcode_tpl['ulist_open'], $text); + // li tags + $text = str_replace("[*:$uid]", $bbcode_tpl['listitem'], $text); + // ending tags + $text = str_replace("[/list:u:$uid]", $bbcode_tpl['ulist_close'], $text); + $text = str_replace("[/list:o:$uid]", $bbcode_tpl['olist_close'], $text); + // Ordered lists + $text = preg_replace("/\[list=([a1]):$uid\]/si", $bbcode_tpl['olist_open'], $text); + + // colours + $text = preg_replace("/\[color=(\#[0-9A-F]{6}|[a-z]+):$uid\]/si", $bbcode_tpl['color_open'], $text); + $text = str_replace("[/color:$uid]", $bbcode_tpl['color_close'], $text); + + // size + $text = preg_replace("/\[size=([1-2]?[0-9]):$uid\]/si", $bbcode_tpl['size_open'], $text); + $text = str_replace("[/size:$uid]", $bbcode_tpl['size_close'], $text); + + // [b] and [/b] for bolding text. + $text = str_replace("[b:$uid]", $bbcode_tpl['b_open'], $text); + $text = str_replace("[/b:$uid]", $bbcode_tpl['b_close'], $text); + + // [u] and [/u] for underlining text. + $text = str_replace("[u:$uid]", $bbcode_tpl['u_open'], $text); + $text = str_replace("[/u:$uid]", $bbcode_tpl['u_close'], $text); + + // [i] and [/i] for italicizing text. + $text = str_replace("[i:$uid]", $bbcode_tpl['i_open'], $text); + $text = str_replace("[/i:$uid]", $bbcode_tpl['i_close'], $text); + + // Patterns and replacements for URL and email tags.. + $patterns = array(); + $replacements = array(); + + // [img]image_url_here[/img] code.. + // This one gets first-passed.. + $patterns[] = "#\[img:$uid\](.*?)\[/img:$uid\]#si"; + $replacements[] = $bbcode_tpl['img']; + + // matches a [url]xxxx://www.phpbb.com[/url] code.. + $patterns[] = "#\[url\]([\w]+?://[^ \"\n\r\t<]*?)\[/url\]#is"; + $replacements[] = $bbcode_tpl['url1']; + + // [url]www.phpbb.com[/url] code.. (no xxxx:// prefix). + $patterns[] = "#\[url\]((www|ftp)\.[^ \"\n\r\t<]*?)\[/url\]#is"; + $replacements[] = $bbcode_tpl['url2']; + + // [url=xxxx://www.phpbb.com]phpBB[/url] code.. + $patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is"; + $replacements[] = $bbcode_tpl['url3']; + + // [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix). + $patterns[] = "#\[url=((www|ftp)\.[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is"; + $replacements[] = $bbcode_tpl['url4']; + + // [email]user@domain.tld[/email] code.. + $patterns[] = "#\[email\]([a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#si"; + $replacements[] = $bbcode_tpl['email']; + + $text = preg_replace($patterns, $replacements, $text); + + // Remove our padding from the string.. + $text = substr($text, 1); + + return $text; + +} // bbencode_second_pass() + +// Need to initialize the random numbers only ONCE +mt_srand( (double) microtime() * 1000000); + +function make_bbcode_uid() +{ + // Unique ID for this message.. + + $uid = md5(mt_rand()); + $uid = substr($uid, 0, BBCODE_UID_LEN); + + return $uid; +} + +function bbencode_first_pass($text, $uid) +{ + // pad it with a space so we can distinguish between FALSE and matching the 1st char (index 0). + // This is important; bbencode_quote(), bbencode_list(), and bbencode_code() all depend on it. + $text = " " . $text; + + // [CODE] and [/CODE] for posting code (HTML, PHP, C etc etc) in your posts. + $text = bbencode_first_pass_pda($text, $uid, '[code]', '[/code]', '', true, ''); + + // [QUOTE] and [/QUOTE] for posting replies with quote, or just for quoting stuff. + $text = bbencode_first_pass_pda($text, $uid, '[quote]', '[/quote]', '', false, ''); + $text = bbencode_first_pass_pda($text, $uid, '/\[quote=(\\\".*?\\\")\]/is', '[/quote]', '', false, '', "[quote:$uid=\\1]"); + + // [list] and [list=x] for (un)ordered lists. + $open_tag = array(); + $open_tag[0] = "[list]"; + + // unordered.. + $text = bbencode_first_pass_pda($text, $uid, $open_tag, "[/list]", "[/list:u]", false, 'replace_listitems'); + + $open_tag[0] = "[list=1]"; + $open_tag[1] = "[list=a]"; + + // ordered. + $text = bbencode_first_pass_pda($text, $uid, $open_tag, "[/list]", "[/list:o]", false, 'replace_listitems'); + + // [color] and [/color] for setting text color + $text = preg_replace("#\[color=(\#[0-9A-F]{6}|[a-z\-]+)\](.*?)\[/color\]#si", "[color=\\1:$uid]\\2[/color:$uid]", $text); + + // [size] and [/size] for setting text size + $text = preg_replace("#\[size=([1-2]?[0-9])\](.*?)\[/size\]#si", "[size=\\1:$uid]\\2[/size:$uid]", $text); + + // [b] and [/b] for bolding text. + $text = preg_replace("#\[b\](.*?)\[/b\]#si", "[b:$uid]\\1[/b:$uid]", $text); + + // [u] and [/u] for underlining text. + $text = preg_replace("#\[u\](.*?)\[/u\]#si", "[u:$uid]\\1[/u:$uid]", $text); + + // [i] and [/i] for italicizing text. + $text = preg_replace("#\[i\](.*?)\[/i\]#si", "[i:$uid]\\1[/i:$uid]", $text); + + // [img]image_url_here[/img] code.. + $text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text); + + // Remove our padding from the string.. + return substr($text, 1);; + +} // bbencode_first_pass() + +/** + * $text - The text to operate on. + * $uid - The UID to add to matching tags. + * $open_tag - The opening tag to match. Can be an array of opening tags. + * $close_tag - The closing tag to match. + * $close_tag_new - The closing tag to replace with. + * $mark_lowest_level - boolean - should we specially mark the tags that occur + * at the lowest level of nesting? (useful for [code], because + * we need to match these tags first and transform HTML tags + * in their contents.. + * $func - This variable should contain a string that is the name of a function. + * That function will be called when a match is found, and passed 2 + * parameters: ($text, $uid). The function should return a string. + * This is used when some transformation needs to be applied to the + * text INSIDE a pair of matching tags. If this variable is FALSE or the + * empty string, it will not be executed. + * If open_tag is an array, then the pda will try to match pairs consisting of + * any element of open_tag followed by close_tag. This allows us to match things + * like [list=A]...[/list] and [list=1]...[/list] in one pass of the PDA. + * + * NOTES: - this function assumes the first character of $text is a space. + * - every opening tag and closing tag must be of the [...] format. + */ +function bbencode_first_pass_pda($text, $uid, $open_tag, $close_tag, $close_tag_new, $mark_lowest_level, $func, $open_regexp_replace = false) +{ + $open_tag_count = 0; + + if (!$close_tag_new || ($close_tag_new == '')) + { + $close_tag_new = $close_tag; + } + + $close_tag_length = strlen($close_tag); + $close_tag_new_length = strlen($close_tag_new); + $uid_length = strlen($uid); + + $use_function_pointer = ($func && ($func != '')); + + $stack = array(); + + if (is_array($open_tag)) + { + if (0 == count($open_tag)) + { + // No opening tags to match, so return. + return $text; + } + $open_tag_count = count($open_tag); + } + else + { + // only one opening tag. make it into a 1-element array. + $open_tag_temp = $open_tag; + $open_tag = array(); + $open_tag[0] = $open_tag_temp; + $open_tag_count = 1; + } + + $open_is_regexp = false; + + if ($open_regexp_replace) + { + $open_is_regexp = true; + if (!is_array($open_regexp_replace)) + { + $open_regexp_temp = $open_regexp_replace; + $open_regexp_replace = array(); + $open_regexp_replace[0] = $open_regexp_temp; + } + } + + if ($mark_lowest_level && $open_is_regexp) + { + message_die(GENERAL_ERROR, "Unsupported operation for bbcode_first_pass_pda()."); + } + + // Start at the 2nd char of the string, looking for opening tags. + $curr_pos = 1; + while ($curr_pos && ($curr_pos < strlen($text))) + { + $curr_pos = strpos($text, "[", $curr_pos); + + // If not found, $curr_pos will be 0, and the loop will end. + if ($curr_pos) + { + // We found a [. It starts at $curr_pos. + // check if it's a starting or ending tag. + $found_start = false; + $which_start_tag = ""; + $start_tag_index = -1; + + for ($i = 0; $i < $open_tag_count; $i++) + { + // Grab everything until the first "]"... + $possible_start = substr($text, $curr_pos, strpos($text, ']', $curr_pos + 1) - $curr_pos + 1); + + // + // We're going to try and catch usernames with "[' characters. + // + if( preg_match('#\[quote=\\\"#si', $possible_start, $match) && !preg_match('#\[quote=\\\"(.*?)\\\"\]#si', $possible_start) ) + { + // OK we are in a quote tag that probably contains a ] bracket. + // Grab a bit more of the string to hopefully get all of it.. + if ($close_pos = strpos($text, '"]', $curr_pos + 9)) + { + if (strpos(substr($text, $curr_pos + 9, $close_pos - ($curr_pos + 9)), '[quote') === false) + { + $possible_start = substr($text, $curr_pos, $close_pos - $curr_pos + 2); + } + } + } + + // Now compare, either using regexp or not. + if ($open_is_regexp) + { + $match_result = array(); + if (preg_match($open_tag[$i], $possible_start, $match_result)) + { + $found_start = true; + $which_start_tag = $match_result[0]; + $start_tag_index = $i; + break; + } + } + else + { + // straightforward string comparison. + if (0 == strcasecmp($open_tag[$i], $possible_start)) + { + $found_start = true; + $which_start_tag = $open_tag[$i]; + $start_tag_index = $i; + break; + } + } + } + + if ($found_start) + { + // We have an opening tag. + // Push its position, the text we matched, and its index in the open_tag array on to the stack, and then keep going to the right. + $match = array("pos" => $curr_pos, "tag" => $which_start_tag, "index" => $start_tag_index); + bbcode_array_push($stack, $match); + // + // Rather than just increment $curr_pos + // Set it to the ending of the tag we just found + // Keeps error in nested tag from breaking out + // of table structure.. + // + $curr_pos += strlen($possible_start); + } + else + { + // check for a closing tag.. + $possible_end = substr($text, $curr_pos, $close_tag_length); + if (0 == strcasecmp($close_tag, $possible_end)) + { + // We have an ending tag. + // Check if we've already found a matching starting tag. + if (sizeof($stack) > 0) + { + // There exists a starting tag. + $curr_nesting_depth = sizeof($stack); + // We need to do 2 replacements now. + $match = bbcode_array_pop($stack); + $start_index = $match['pos']; + $start_tag = $match['tag']; + $start_length = strlen($start_tag); + $start_tag_index = $match['index']; + + if ($open_is_regexp) + { + $start_tag = preg_replace($open_tag[$start_tag_index], $open_regexp_replace[$start_tag_index], $start_tag); + } + + // everything before the opening tag. + $before_start_tag = substr($text, 0, $start_index); + + // everything after the opening tag, but before the closing tag. + $between_tags = substr($text, $start_index + $start_length, $curr_pos - $start_index - $start_length); + + // Run the given function on the text between the tags.. + if ($use_function_pointer) + { + $between_tags = $func($between_tags, $uid); + } + + // everything after the closing tag. + $after_end_tag = substr($text, $curr_pos + $close_tag_length); + + // Mark the lowest nesting level if needed. + if ($mark_lowest_level && ($curr_nesting_depth == 1)) + { + if ($open_tag[0] == '[code]') + { + $code_entities_match = array('#<#', '#>#', '#"#', '#:#', '#\[#', '#\]#', '#\(#', '#\)#', '#\{#', '#\}#'); + $code_entities_replace = array('<', '>', '"', ':', '[', ']', '(', ')', '{', '}'); + $between_tags = preg_replace($code_entities_match, $code_entities_replace, $between_tags); + } + $text = $before_start_tag . substr($start_tag, 0, $start_length - 1) . ":$curr_nesting_depth:$uid]"; + $text .= $between_tags . substr($close_tag_new, 0, $close_tag_new_length - 1) . ":$curr_nesting_depth:$uid]"; + } + else + { + if ($open_tag[0] == '[code]') + { + $text = $before_start_tag . '[code]'; + $text .= $between_tags . '[/code]'; + } + else + { + if ($open_is_regexp) + { + $text = $before_start_tag . $start_tag; + } + else + { + $text = $before_start_tag . substr($start_tag, 0, $start_length - 1) . ":$uid]"; + } + $text .= $between_tags . substr($close_tag_new, 0, $close_tag_new_length - 1) . ":$uid]"; + } + } + + $text .= $after_end_tag; + + // Now.. we've screwed up the indices by changing the length of the string. + // So, if there's anything in the stack, we want to resume searching just after it. + // otherwise, we go back to the start. + if (sizeof($stack) > 0) + { + $match = bbcode_array_pop($stack); + $curr_pos = $match['pos']; +// bbcode_array_push($stack, $match); +// ++$curr_pos; + } + else + { + $curr_pos = 1; + } + } + else + { + // No matching start tag found. Increment pos, keep going. + ++$curr_pos; + } + } + else + { + // No starting tag or ending tag.. Increment pos, keep looping., + ++$curr_pos; + } + } + } + } // while + + return $text; + +} // bbencode_first_pass_pda() + +/** + * Does second-pass bbencoding of the [code] tags. This includes + * running htmlspecialchars() over the text contained between + * any pair of [code] tags that are at the first level of + * nesting. Tags at the first level of nesting are indicated + * by this format: [code:1:$uid] ... [/code:1:$uid] + * Other tags are in this format: [code:$uid] ... [/code:$uid] + */ +function bbencode_second_pass_code($text, $uid, $bbcode_tpl) +{ + global $lang; + + $code_start_html = $bbcode_tpl['code_open']; + $code_end_html = $bbcode_tpl['code_close']; + + // First, do all the 1st-level matches. These need an htmlspecialchars() run, + // so they have to be handled differently. + $match_count = preg_match_all("#\[code:1:$uid\](.*?)\[/code:1:$uid\]#si", $text, $matches); + + for ($i = 0; $i < $match_count; $i++) + { + $before_replace = $matches[1][$i]; + $after_replace = $matches[1][$i]; + + // Replace 2 spaces with " " so non-tabbed code indents without making huge long lines. + $after_replace = str_replace(" ", " ", $after_replace); + // now Replace 2 spaces with " " to catch odd #s of spaces. + $after_replace = str_replace(" ", " ", $after_replace); + + // Replace tabs with " " so tabbed code indents sorta right without making huge long lines. + $after_replace = str_replace("\t", " ", $after_replace); + + // now Replace space occurring at the beginning of a line + $after_replace = preg_replace("/^ {1}/m", ' ', $after_replace); + + $str_to_match = "[code:1:$uid]" . $before_replace . "[/code:1:$uid]"; + + $replacement = $code_start_html; + $replacement .= $after_replace; + $replacement .= $code_end_html; + + $text = str_replace($str_to_match, $replacement, $text); + } + + // Now, do all the non-first-level matches. These are simple. + $text = str_replace("[code:$uid]", $code_start_html, $text); + $text = str_replace("[/code:$uid]", $code_end_html, $text); + + return $text; + +} // bbencode_second_pass_code() + +/** + * Rewritten by Nathan Codding - Feb 6, 2001. + * - Goes through the given string, and replaces xxxx://yyyy with an HTML <a> tag linking + * to that URL + * - Goes through the given string, and replaces www.xxxx.yyyy[zzzz] with an HTML <a> tag linking + * to http://www.xxxx.yyyy[/zzzz] + * - Goes through the given string, and replaces xxxx@yyyy with an HTML mailto: tag linking + * to that email address + * - Only matches these 2 patterns either after a space, or at the beginning of a line + * + * Notes: the email one might get annoying - it's easy to make it more restrictive, though.. maybe + * have it require something like xxxx@yyyy.zzzz or such. We'll see. + */ +function make_clickable($text) +{ + + // pad it with a space so we can match things at the start of the 1st line. + $ret = ' ' . $text; + + // matches an "xxxx://yyyy" URL at the start of a line, or after a space. + // xxxx can only be alpha characters. + // yyyy is anything up to the first space, newline, comma, double quote or < + $ret = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret); + + // matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing + // Must contain at least 2 dots. xxxx contains either alphanum, or "-" + // zzzz is optional.. will contain everything up to the first space, newline, + // comma, double quote or <. + $ret = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret); + + // matches an email@domain type address at the start of a line, or after a space. + // Note: Only the followed chars are valid; alphanums, "-", "_" and or ".". + $ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret); + + // Remove our padding.. + $ret = substr($ret, 1); + + return($ret); +} + +/** + * Nathan Codding - Feb 6, 2001 + * Reverses the effects of make_clickable(), for use in editpost. + * - Does not distinguish between "www.xxxx.yyyy" and "http://aaaa.bbbb" type URLs. + * + */ +function undo_make_clickable($text) +{ + $text = preg_replace("#<!-- BBCode auto-link start --><a href=\"(.*?)\" target=\"_blank\">.*?</a><!-- BBCode auto-link end -->#i", "\\1", $text); + $text = preg_replace("#<!-- BBcode auto-mailto start --><a href=\"mailto:(.*?)\">.*?</a><!-- BBCode auto-mailto end -->#i", "\\1", $text); + + return $text; + +} + +/** + * Nathan Codding - August 24, 2000. + * Takes a string, and does the reverse of the PHP standard function + * htmlspecialchars(). + */ +function undo_htmlspecialchars($input) +{ + $input = preg_replace("/>/i", ">", $input); + $input = preg_replace("/</i", "<", $input); + $input = preg_replace("/"/i", "\"", $input); + $input = preg_replace("/&/i", "&", $input); + + return $input; +} + +/** + * This is used to change a [*] tag into a [*:$uid] tag as part + * of the first-pass bbencoding of [list] tags. It fits the + * standard required in order to be passed as a variable + * function into bbencode_first_pass_pda(). + */ +function replace_listitems($text, $uid) +{ + $text = str_replace("[*]", "[*:$uid]", $text); + + return $text; +} + +/** + * Escapes the "/" character with "\/". This is useful when you need + * to stick a runtime string into a PREG regexp that is being delimited + * with slashes. + */ +function escape_slashes($input) +{ + $output = str_replace('/', '\/', $input); + return $output; +} + +/** + * This function does exactly what the PHP4 function array_push() does + * however, to keep phpBB compatable with PHP 3 we had to come up with our own + * method of doing it. + */ +function bbcode_array_push(&$stack, $value) +{ + $stack[] = $value; + return(sizeof($stack)); +} + +/** + * This function does exactly what the PHP4 function array_pop() does + * however, to keep phpBB compatable with PHP 3 we had to come up with our own + * method of doing it. + */ +function bbcode_array_pop(&$stack) +{ + $arrSize = count($stack); + $x = 1; + + while(list($key, $val) = each($stack)) + { + if($x < count($stack)) + { + $tmpArr[] = $val; + } + else + { + $return_val = $val; + } + $x++; + } + $stack = $tmpArr; + + return($return_val); +} + +// +// Smilies code ... would this be better tagged on to the end of bbcode.php? +// Probably so and I'll move it before B2 +// +function smilies_pass($message) +{ + static $orig, $repl; + + if (!isset($orig)) + { + global $db, $board_config; + $orig = $repl = array(); + + $sql = 'SELECT * FROM ' . SMILIES_TABLE; + if( !$result = $db->sql_query($sql) ) + { + message_die(GENERAL_ERROR, "Couldn't obtain smilies data", "", __LINE__, __FILE__, $sql); + } + $smilies = $db->sql_fetchrowset($result); + + if (count($smilies)) + { + usort($smilies, 'smiley_sort'); + } + + for ($i = 0; $i < count($smilies); $i++) + { + $orig[] = "/(?<=.\W|\W.|^\W)" . phpbb_preg_quote($smilies[$i]['code'], "/") . "(?=.\W|\W.|\W$)/"; + $repl[] = '<img src="'. $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['emoticon'] . '" border="0" />'; + } + } + + if (count($orig)) + { + $message = preg_replace($orig, $repl, ' ' . $message . ' '); + $message = substr($message, 1, -1); + } + + return $message; +} + +function smiley_sort($a, $b) +{ + if ( strlen($a['code']) == strlen($b['code']) ) + { + return 0; + } + + return ( strlen($a['code']) > strlen($b['code']) ) ? -1 : 1; +} + +load_bbcode_template(); +/* +$m = "[url]http://tomcort.com[/url]"; +$uid = make_bbcode_uid(); +$m = bbencode_first_pass($m, $uid); +$m = bbencode_second_pass($m,$uid); +echo "$m"; +*/ +?> diff --git a/site/source/functions/bbcode.txt.tpl b/site/source/functions/bbcode.txt.tpl new file mode 100644 index 0000000..a0ee500 --- /dev/null +++ b/site/source/functions/bbcode.txt.tpl @@ -0,0 +1,50 @@ +<!-- BEGIN ulist_open --><ul><!-- END ulist_open --> +<!-- BEGIN ulist_close --></ul><!-- END ulist_close --> + +<!-- BEGIN olist_open --><ol type="{LIST_TYPE}"><!-- END olist_open --> +<!-- BEGIN olist_close --></ol><!-- END olist_close --> + +<!-- BEGIN listitem --><li><!-- END listitem --> + +<!-- BEGIN quote_username_open --><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"> + <tr> + <td class="quote"><!-- END quote_username_open --> +<!-- BEGIN quote_open --></span> +<table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"> +<tr> + <td><span class="genmed"><b>{L_QUOTE}:</b></span></td> + </tr> + <tr> + <td class="quote"><!-- END quote_open --> +<!-- BEGIN quote_close --></td> + </tr> +</table><!-- END quote_close --> + +<!-- BEGIN code_open --><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"> + <tr> + <td class="code"><!-- END code_open --> +<!-- BEGIN code_close --></td> + </tr> +</table><!-- END code_close --> + + +<!-- BEGIN b_open --><span style="font-weight: bold"><!-- END b_open --> +<!-- BEGIN b_close --></span><!-- END b_close --> + +<!-- BEGIN u_open --><span style="text-decoration: underline"><!-- END u_open --> +<!-- BEGIN u_close --></span><!-- END u_close --> + +<!-- BEGIN i_open --><span style="font-style: italic"><!-- END i_open --> +<!-- BEGIN i_close --></span><!-- END i_close --> + +<!-- BEGIN color_open --><span style="color: {COLOR}"><!-- END color_open --> +<!-- BEGIN color_close --></span><!-- END color_close --> + +<!-- BEGIN size_open --><span style="font-size: {SIZE}px; line-height: normal"><!-- END size_open --> +<!-- BEGIN size_close --></span><!-- END size_close --> + +<!-- BEGIN img --><img src="{URL}" border="0" /><!-- END img --> + +<!-- BEGIN url -->{DESCRIPTION} ( {URL} )<!-- END url --> + +<!-- BEGIN email --><mail link="mailto:{EMAIL}">{EMAIL}</mail><!-- END email --> diff --git a/site/source/functions/cats_mail.php b/site/source/functions/cats_mail.php new file mode 100644 index 0000000..38c0aa9 --- /dev/null +++ b/site/source/functions/cats_mail.php @@ -0,0 +1,82 @@ +<?php + +# CATS Online Registration System +# 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 + +# executes the required sequence of SMTP commands to send a basic [authenticated] email +function cats_mail($to,$from,$subject,$body) { + $mailer = new cats_smtp(); + + $result = $mailer->connect(); + + if (!$result->success()) { + return $result; + } + + $result = $mailer->cmd_helo(); + + if (!$result->success()) { + echo "HELO FAILED!"; + return $result; + } + + $result = $mailer->cmd_auth(); + + if (!$result->success()) { + echo "AUTH FAILED!"; + return $result; + } + + $result = $mailer->cmd_mail_from($from); + + if (!$result->success()) { + echo "MAIL FROM FAILED"; + return $result; + } + + $result = $mailer->cmd_rcpt_to($to); + + if (!$result->success()) { + echo "RCPT TO FAILED"; + return $result; + } + + $result = $mailer->cmd_data($from,$to,$subject,$body); + + if (!$result->success()) { + echo "DATA FAILED"; + return $result; + } + + $result = $mailer->cmd_quit(); + + if (!$result->success()) { + echo "QUIT FAILED"; + return $result; + } + + $mailer->disconnect(); + return new return_result(true); +} + +# test code +#$smtp_host = "cs.ubishops.ca"; +#$r = cats_mail("tcort@cs.ubishops.ca","tcort@cs.ubishops.ca","Final Last Tests","Hey Tom, +#Dag, yo. This email api is r0x0r. U r a 1337 h4x0r. w00t! +#Mr Deeds"); + +?> diff --git a/site/source/functions/databases/mysql.inc b/site/source/functions/databases/mysql.inc new file mode 100644 index 0000000..e9a57e2 --- /dev/null +++ b/site/source/functions/databases/mysql.inc @@ -0,0 +1,75 @@ +<?php + +# CATS Online Registration System +# 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 + +function db_get_max_rows($rs) +{ + return mysql_num_rows($rs); +} + +function db_fetch_array($rs) +{ + return mysql_fetch_array($rs); +} + +function db_query($query) +{ + global $db_conn; + db_connect(); + $result = mysql_query($query, $db_conn); + return new DBResult($result,$query); +} + +function db_exec($query) +{ + global $db_conn; + db_connect(); + $result = mysql_query($query, $db_conn); + if (mysql_affected_rows($db_conn) > 0) + { + return TRUE; + } + else + { + return FALSE; + } +} + +function db_connect() +{ + global $db_conn, $db_name, $db_user, $db_pass, $db_host; + if ($db_conn == NULL || $db_conn == FALSE) + { + $db_conn = mysql_connect($db_host, $db_user, $db_pass); + mysql_select_db($db_name); + } +} + +function db_data_seek($rs, $pos) +{ + mysql_data_seek($rs, $pos); +} + + +function db_close() +{ + global $db_conn; + mysql_close($db_conn); +} + +?> diff --git a/site/source/functions/databases/postgres.inc b/site/source/functions/databases/postgres.inc new file mode 100644 index 0000000..f50fdca --- /dev/null +++ b/site/source/functions/databases/postgres.inc @@ -0,0 +1,85 @@ +<?php + +# CATS Online Registration System +# 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 + +function db_get_max_rows($rs) +{ + return pg_num_rows($rs); +} + +function db_fetch_array($rs) +{ + return pg_fetch_array($rs); +} + +function db_query($query) +{ + global $db_conn; + db_connect(); + #print "---------IN----------"; + #print "<p>$query<p>"; + $result = pg_query($db_conn, $query); + #print "<p>$query<p>"; + #print "----------OUT---------"; + return new DBResult($result,$query); +} + +function db_exec($query) +{ + global $db_conn; + db_connect(); + #print "*********IN**********"; + #print "<p>$query<p>"; + $result = pg_query($db_conn, $query); + #print "*********OUT*********"; + if ($result == FALSE) + print "<p>db_exec() failed, query: $query<p>"; + if (pg_affected_rows($result) > 0) + { + return TRUE; + } + else + { + return FALSE; + } +} + +function db_connect() +{ + global $db_conn, $db_name, $db_user, $db_pass; + if ($db_conn == NULL || $db_conn == FALSE) + { + $db_conn = pg_connect("dbname=$db_name user=$db_user"); + + # For debugging purposes only + #print "<p>Formed a new connection<p>"; + } +} + +function db_data_seek($rs, $pos) +{ + @pg_fetch_row($rs, $pos); +} + +function db_close() +{ + global $db_conn; + pg_close($db_conn); +} + +?> diff --git a/site/source/functions/db_access.php b/site/source/functions/db_access.php new file mode 100644 index 0000000..3da2568 --- /dev/null +++ b/site/source/functions/db_access.php @@ -0,0 +1,22 @@ +<?php + +# CATS Online Registration System +# 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 + +include_once("../functions/databases/$db_type.inc"); + +?> diff --git a/site/source/globals.php b/site/source/globals.php new file mode 100644 index 0000000..e91bfb9 --- /dev/null +++ b/site/source/globals.php @@ -0,0 +1,51 @@ +<?php +# CATS Online Registration System +# 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 + +# A place to put our global variables + +$username = "guest"; +$accesslevel = "1"; + +$db_conn = ""; + +# Database type this install will use: +# (Current options are: postgres || mysql) +$db_type = "mysql"; + +# Name of database the system will use +$db_name = "bagel"; +# Database user name +$db_user = "bagel"; +# Password corresponding to above user name +$db_pass = "astr0fuck"; +# Hostname of mysql server +$db_host = "localhost"; + +# maps String -> array(actor); +$event_table = new collection(); + +# maps String -> array(actor); +$action_table = new collection(); + +# SMTP Address +$smtp_host = "cs.ubishops.ca"; +$smtp_port = 25; +$smtp_user = "tcort"; +$smtp_pass = "cuntassbitch"; + +?> diff --git a/site/source/htdocs/.htaccess b/site/source/htdocs/.htaccess new file mode 100644 index 0000000..75c389b --- /dev/null +++ b/site/source/htdocs/.htaccess @@ -0,0 +1,3 @@ +RewriteEngine on + +RewriteRule ^post_(.*).php /index.php?a=default&postid=$1 diff --git a/site/source/htdocs/index.php b/site/source/htdocs/index.php new file mode 100644 index 0000000..905be73 --- /dev/null +++ b/site/source/htdocs/index.php @@ -0,0 +1,99 @@ +<?php +# blog.tomcort.com +# Copyright (C) 2004 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 + +session_start(); +header("Cache-control: private"); //IE 6 Fix +include_once("../main.php"); + +$sessionid = session_id(); + +$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]; +} + +$action = isset($_REQUEST['a']) ? $_REQUEST['a'] : "default"; + +# load_modules +foreach (glob("../modules/*.php") as $filename) { + include_once($filename); +} + +# Run the action +$actions = $action_table->get($action); + +if ($actions == false) { + # someone entered an action that doesn't have any registered actions + # ex someone did something like index.php?a=0u9gfqej09fqnoi + + $action = "default"; + foreach (glob("../modules/*.php") as $filename) { + include_once($filename); + } + + $actions = $action_table->get($action); + + if ($actions == false) { + # If we get here then we are total screwed. No default action or + # requested action. This should only happen if the modules are deleted + echo "<html><head><title>Fatal Error!</title></head><body>"; + echo "<h1><font color=\"#FF0000\">Fatal System Error</font></h1><hr>No module to available to complete the requested action. The default module was missing too! Contact an administrator immediately."; + echo "</body></html>"; + } else { + while (list($key, $value) = each($actions)) { + $action_result = $actions[$key]->execute(); + + # on failure get messages + if (!$action_result->success()) { + $msg = $handler_result->get_messages(); + + for ($i = 0; $i < count($msg); $i++) { + $result->add_message($msg[$i]); + } + + if ($result->success()) { + $result->set_result(false); + } + } + } + } + return true; +} else { + while (list($key, $value) = each($actions)) { + $action_result = $actions[$key]->execute(); + + # on failure get messages + if (!$action_result->success()) { + $msg = $action_result->get_messages(); + + if (isset($result) && is_object($result)) { + for ($i = 0; $i < count($msg); $i++) { + $result->add_message($msg[$i]); + } + + if ($result->success()) { + $result->set_result(false); + } + } + } + } +} +?> diff --git a/site/source/htdocs/style.css b/site/source/htdocs/style.css new file mode 100644 index 0000000..96f730c --- /dev/null +++ b/site/source/htdocs/style.css @@ -0,0 +1,118 @@ +body { + background-color: #eeeeee; +} + + +p,ul,ol { + color: black; + font-size: 80%; + font-family: Verdana, "Lucida Sans", Arial, Geneva, Helvetica, Helv, "Myriad Web", Syntax, sans-serif; + text-align: justify; +} + +h1, h2, h3, h4, h5, h6 +{ + font-family: "Trebuchet MS", Verdana, "Lucida Sans", Arial, Geneva, Helvetica, Helv, "Myriad Web", Syntax, sans-serif; +} + +th +{ + font-weight: bold; + background-color: #cccccc; + font-family: "Trebuchet MS", Verdana, "Lucida Sans", Arial, Geneva, Helvetica, Helv, "Myriad Web", Syntax, sans-serif; +} + + +h1 +{ + color: #454545; + font-size: 175%; + font-weight: bold; +} + +h2 +{ + color: #707070; + font-size: 130%; + font-weight: normal; + border: 1px solid #cccccc; + border-width: 0px 0px 1px 0px; + padding-bottom: 0px; +} + +h3 +{ + color: #707070; + font-size: 100%; + font-weight: bold; + border: 1px solid #cccccc; + border-width: 0px 0px 1px 0px; + padding-bottom: 0px; + text-align: center; +} + +.right { + text-align: right; +} + +.left { + text-align: left; +} + +.center { + text-align: center; +} + +.nav { + color: #000000; + font-weight: bold; + text-decoration: none; + font-size: 80%; + font-family: Verdana, "Lucida Sans", Arial, Geneva, Helvetica, Helv, "Myriad Web", Syntax, sans-serif; +} + +.title { + color: #000000; + font-weight: bold; + text-decoration: none; + font-size: 80%; + font-family: Verdana, "Lucida Sans", Arial, Geneva, Helvetica, Helv, "Myriad Web", Syntax, sans-serif; +} + +.small { + color: #000000; + font-size: 60%; + font-family: Verdana, "Lucida Sans", Arial, Geneva, Helvetica, Helv, "Myriad Web", Syntax, sans-serif; +} + + +.footer { + color: #555555; + font-size: 60%; + font-family: Verdana, "Lucida Sans", Arial, Geneva, Helvetica, Helv, "Myriad Web", Syntax, sans-serif; + text-align: center; +} + +a { + color: black; + font-weight: bold; + text-decoration: none; +} + +a:link { + text-decoration: none; +} + +a:visited { + text-decoration: none; +} + +a:active { + text-decoration: none; +} + +a:hover { + color: #ff0033; + text-decoration: underline; +} + diff --git a/site/source/html/index.html b/site/source/html/index.html new file mode 100644 index 0000000..cacf1dc --- /dev/null +++ b/site/source/html/index.html @@ -0,0 +1,8 @@ +<html> +<head> +<title>Moved</title> +</head> +<body> +Moved to <a href="https://larrythecow.com">https://larrythecow.com</a>. +</body> +</html> diff --git a/site/source/main.php b/site/source/main.php new file mode 100644 index 0000000..4506c98 --- /dev/null +++ b/site/source/main.php @@ -0,0 +1,90 @@ +<?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 file contains our main functions + +# Include classes for later use +include_once("../classes/actor.class.php"); +include_once("../classes/collection.class.php"); +include_once("../classes/cats_smtp.class.php"); +include_once("../classes/dbresult.class.php"); +include_once("../classes/return_result.class.php"); +# We need ../classes/filename because this is being executed by ../public_html/index.php + +# Include global variable(s) +include_once("../globals.php"); + +# Functions +include_once("../functions/cats_mail.php"); +include_once("../functions/db_access.php"); + +# trigger should be called from actions. trigger looks up the event name +# that it gets as a parameter and executes it. trigger returns false if +# there are no events known by the name $event_name +function trigger($event_name) { + global $event_table; + $event_handlers = $event_table->get($event_name); + if ($event_handlers == false) { + $result = new return_result(false); + $result->add_message("No Event Handlers for $event_name event"); + return $result; + } else { + $result = new return_result(true); + + while (list($key, $value) = each($event_handlers)) { + $handler_result = $event_handlers[$key]->execute(); + + # on failure get messages + if (!$handler_result->success()) { + $msg = $handler_result->get_messages(); + + for ($i = 0; $i < count($msg); $i++) { + $result->add_message($msg[$i]); + } + + if ($result->success()) { + $result->set_result(false); + } + } + } + return $result; + } +} + +function register_action($action) { + global $action_table; + $action_table->put($action->get_name(),$action); +} + +function register_handler($event_handler) { + global $event_table; + $event_table->put($event_handler->get_name(),$event_handler); +} + +# little function that escapes variables, if necessary +function doslashes($str) { + if (!get_magic_quotes_gpc()) { + return addslashes($str); + } + + return $str; +} + +?> 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)); +?> |