From 464f4d3497617fadb9d7752868f1175849cfa6d2 Mon Sep 17 00:00:00 2001
From: Luke Shumaker <LukeShu@sbcglobal.net>
Date: Sat, 7 Jan 2012 08:21:00 -0800
Subject: Refactor to separate the framework from the app; drop message stuff,
 this app is just user management. Add a json view for individual users

---
 src/plugins/InformationPlugin.class.php | 62 ---------------------------------
 src/plugins/ReCaptcha.class.php         | 47 -------------------------
 src/plugins/SenderGVSMS.class.php       | 34 ------------------
 src/plugins/SenderIdentica.class.php    | 35 -------------------
 src/plugins/maildir.php                 | 58 ------------------------------
 5 files changed, 236 deletions(-)
 delete mode 100644 src/plugins/InformationPlugin.class.php
 delete mode 100644 src/plugins/ReCaptcha.class.php
 delete mode 100644 src/plugins/SenderGVSMS.class.php
 delete mode 100644 src/plugins/SenderIdentica.class.php
 delete mode 100644 src/plugins/maildir.php

(limited to 'src/plugins')

diff --git a/src/plugins/InformationPlugin.class.php b/src/plugins/InformationPlugin.class.php
deleted file mode 100644
index 70ec8ac..0000000
--- a/src/plugins/InformationPlugin.class.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-require_once('Plugin.class.php');
-
-class InformationPlugin extends Plugin {
-	public static function configList() { return array(); }
-	public function init() {}
-	public static function description() {
-		return "Get information about the user.";
-	}
-	public function userConfig(&$arr) {
-		$group = 'Information';
-		$this->addConfigGroup($arr, $group);
-		$arr[$group][] = array('firstname','First Name','text');
-		$arr[$group][] = array('lastname','Last Name','text');
-		$arr[$group][] = array('school','Home School','text');
-		$arr[$group][] = array('hsclass','Highschool Class of','text');
-		
-		$group = 'New Member Questions';
-		$this->addConfigGroup($arr, $group);
-		$arr[$group][] = array('q_why_team',
-		                       'Why do you want to be a part of the robotics team?',
-		                       'textarea');
-		$arr[$group][] = array('q_strengths',
-		                       'What strengths do you have that can contribute to the robotics team?',
-		                       'textarea');
-		$arr[$group][] = array('q_other_activities',
-		                       'Other after school activities--sports, performing arts, extracurricular activities. (January through March)',
-		                       'textarea');
-		$arr[$group][] = array('q_other_commitments',
-		                       'After school/weekend work commitments. (January through March)',
-		                       'textarea');
-		// TODO: Top 3 subteams
-		$arr[$group][] = array('q_who_you_know',
-		                       'Who do you know that could possibly help our team this year? '.
-		                       'This includes material resources, supplying or preparing food '.
-		                       'for work nights/competitions, corporate sponsorship, travel, '.
-		                       'engineers, computer programmers, web developers, and fundraisers.',
-		                       'textarea');
-		$arr[$group][] = array('x_bogus_recommend',
-		                       "List two teachers who we could contact for your recommendation to be a member of this year's team.",
-		                       'paragraph');
-		$arr[$group][] = array('q_teacher_recommend1', 'Teacher 1', 'text');
-		$arr[$group][] = array('q_teacher_recommend2', 'Teacher 2', 'text');
-		$arr[$group][] = array('x_bogus_agreement',
-		                       "I understand that if I am chosen to participate ".
-		                       "in the robotics project, I will represent my ".
-		                       "school in a positive manner. If I fail to do so, ".
-		                       "I may be removed from the team at any time. In ".
-		                       "addition, if I do not have good attendance ".
-		                       "during this project, I will not be allowed to ".
-		                       "travel with the team to the competitions. I also ".
-		                       "understand that all of the school rules will be ".
-		                       "in effect at all times.",
-		                       'paragraph');
-		$arr[$group][] = array('q_i_agree',
-		                       "I agree",
-		                       'checkbox');
-	}
-	public function sendPrivate($to, $id, $subject, $body) {}
-	public function sendBroadcast($id, $subject, $body) {}
-}
diff --git a/src/plugins/ReCaptcha.class.php b/src/plugins/ReCaptcha.class.php
deleted file mode 100644
index 165493b..0000000
--- a/src/plugins/ReCaptcha.class.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-// We only include the recaptchalib.php file when we use it because we don't
-// want it polluting the global namespace thing.
-
-class ReCaptcha extends Plugin {
-	protected $config = array('public_key'=>'',
-	                          'private_key'=>'');
-	public static function description() {
-		return 'Add a reCaptcha to keep out spam users.';
-	}
-	public static function configList() {
-		return array('public_key'=>'text',
-		             'private_key'=>'text');
-	}
-	public function init() {}
-
-	private $resp = null;
-	private function getResp() {
-		if ($this->resp===null) {
-			require_once('recaptchalib.php');
-			@$response = $_POST['recaptcha_response_field'];
-			@$challenge = $_POST['recaptcha_challenge_field'];
-			$this->resp = recaptcha_check_answer($this->config['private_key'],
-			                                     $_SERVER['REMOTE_ADDR'],
-			                                     $challenge,
-			                                     $response);
-		}
-		return $this->resp;
-	}
-
-	private function getError() {
-		if ($_POST["recaptcha_response_field"] && !$this->antispam_verify()) {
-			return $this->getResp()->error;
-		} else {
-			return false;
-		}
-	}
-
-	public function antispam_verify() {
-		return $this->getResp()->is_valid;
-	}
-	
-	public function antispam_html() {
-		require_once('recaptchalib.php');
-		return recaptcha_get_html($this->config['public_key'], $this->getError());
-	}
-}
diff --git a/src/plugins/SenderGVSMS.class.php b/src/plugins/SenderGVSMS.class.php
deleted file mode 100644
index 7919007..0000000
--- a/src/plugins/SenderGVSMS.class.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-require_once('GoogleVoice.class.php');
-
-class SenderGVSMS extends Plugin {
-	protected $config = array('username'=>'',
-	                          'password'=>'',
-	                          'length'=>160);
-	private $obj;
-	
-	public static function description() {
-		return 'Send messages over SMS via GoogleVoice.';
-	}
-	
-	public static function configList() {
-		return array('username'=>'text',
-		             'password'=>'password');
-	}
-	
-	public function init() {
-		$this->obj = new GoogleVoice($this->config['username'],
-		                             $this->config['password']);
-	}
-	
-	public function sendPrivate($phoneNum, $id, $subject, $body) {
-		global $shorturl, $messenger;
-		$url = $shorturl->get($messenger->id2url($id));
-		$maxlen = $this->config['length']-(strlen($url)+1);
-		if($maxlen < strlen($subject)) {
-			$subject = substr($subject,0,$maxlen-3).'...';
-		}
-		$this->obj->sms($phoneNum, $subject.' '.$url);
-	}
-}
diff --git a/src/plugins/SenderIdentica.class.php b/src/plugins/SenderIdentica.class.php
deleted file mode 100644
index ea9b343..0000000
--- a/src/plugins/SenderIdentica.class.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-require_once('Identica.class.php');
-
-class SenderIdentica extends Plugin {
-	protected $config = array('username'=>'',
-	                          'password'=>'',
-	                          'length'=>140);
-	private $obj;
-	
-	public static function description() {
-		return 'Dent messages to Identi.ca.';
-	}
-	
-	public static function configList() {
-		return array('username'=>'text',
-		             'password'=>'password',
-		             'length'=>'int');
-	}
-	
-	public function init() {
-		$this->obj = new Identica($this->config['username'],
-		                          $this->config['password']);
-	}
-	
-	public function sendBroadcast($id, $subject, $body) {
-		global $shorturl, $messenger;
-		$url = $shorturl->get($messenger->id2url($id));
-		$maxlen = $this->config['length']-(strlen($url)+1);
-		if($maxlen < strlen($subject)) {
-			$subject = substr($subject,0,$maxlen-3).'...';
-		}
-		$this->obj->updateStatus($subject.' '.$url);
-	}
-}
diff --git a/src/plugins/maildir.php b/src/plugins/maildir.php
deleted file mode 100644
index 28211b5..0000000
--- a/src/plugins/maildir.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-require_once('Getter.class.php');
-////////////////////////////////////////////////////////////////////////////////
-class Maildir implements Getter {
-	private $config = array('dir'=>'');
-	
-	public function configList() {
-		return array('dir'=>'text');
-	}
-	
-	public function init() {}
-	
-	public function get() {
-		$this->handle_new();
-		$this->handle_cur();
-		$this->handle_tmp();
-	}
-	
-	private function handle_new() {
-		// move files in new to cur
-		$new = $this->config['dir'].'/new';
-		$cur = $this->config['dir'].'/cur';
-		$dh = opendir($new);
-		
-		while (($file = readdir($dh)) !== false) {
-			if (substr($file,0,1)!='.' && is_file($new.'/'.$file)) {
-				rename($new.'/'.$file,
-				       $cur.'/'.$file.':');
-			}
-		}
-	}
-	private function handle_cur() {
-		$cur = $this->config['dir'].'/cur';
-		$dh = opendir($cur);
-		
-		while (($file = readdir($dh)) !== false) {
-			if (substr($file,0,1)!='.' && is_file($cur.'/'.$file)) {
-				
-			}
-		}
-	}
-	private function handle_tmp() {
-		// Clean up files that haven't been accessed for 36 hours
-		$tmp = $this->config['dir'].'/tmp';
-		$dh = opendir($cur);
-		
-		while (($file = readdir($dh)) !== false) {
-			if (is_file($tmp.'/'.$file)) {
-				$atime = fileatime($tmp.'/'.$file);
-				$time = time();
-				if (($time-$atime)>(36*60*60)) {
-					unlink($tmp.'/'.$file);
-				}
-			}
-		}
-	}
-
-}
-- 
cgit v1.2.3-2-g168b