diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-01-07 08:21:00 -0800 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-01-07 10:22:21 -0800 |
commit | 83e460cdc3fc09867a3adb48c3d0894579dd3050 (patch) | |
tree | 0771bd935b30971bf2c244b6f158ed7496b644e5 | |
parent | 3d64793a1ee45857856be1cd71c3a0a040a3e869 (diff) |
Refactor to separate the framework from the app; drop message stuff, this app is just user management. Add a json view for individual users
-rw-r--r-- | apps/um/controllers/Authenticator.class.php (renamed from src/controllers/AuthPage.class.php) | 8 | ||||
-rw-r--r-- | apps/um/controllers/Config.class.php (renamed from src/controllers/Config.class.php) | 0 | ||||
-rw-r--r-- | apps/um/controllers/Groups.class.php (renamed from src/controllers/Groups.class.php) | 0 | ||||
-rw-r--r-- | apps/um/controllers/Http404.class.php (renamed from src/controllers/Http404.class.php) | 0 | ||||
-rw-r--r-- | apps/um/controllers/Main.class.php (renamed from src/controllers/Main.class.php) | 0 | ||||
-rw-r--r-- | apps/um/controllers/Plugins.class.php (renamed from src/controllers/Plugins.class.php) | 0 | ||||
-rw-r--r-- | apps/um/controllers/Users.class.php (renamed from src/controllers/Users.class.php) | 0 | ||||
-rw-r--r-- | apps/um/ext/PasswordHash.class.php (renamed from src/ext/PasswordHash.class.php) | 0 | ||||
-rw-r--r-- | apps/um/ext/README.txt | 12 | ||||
-rw-r--r-- | apps/um/ext/recaptchalib.php (renamed from src/ext/recaptchalib.php) | 0 | ||||
-rw-r--r-- | apps/um/lib/DB.class.php (renamed from src/lib/DB.class.php) | 0 | ||||
-rw-r--r-- | apps/um/lib/Database.class.php (renamed from src/lib/Database.class.php) | 0 | ||||
-rw-r--r-- | apps/um/lib/Hasher.class.php (renamed from src/lib/Hasher.class.php) | 0 | ||||
-rw-r--r-- | apps/um/lib/Login.class.php (renamed from src/lib/Login.class.php) | 0 | ||||
-rw-r--r-- | apps/um/lib/Plugin.class.php (renamed from src/lib/Plugin.class.php) | 0 | ||||
-rw-r--r-- | apps/um/lib/PluginManager.class.php (renamed from src/lib/PluginManager.class.php) | 0 | ||||
-rw-r--r-- | apps/um/lib/Singleton.class.php (renamed from src/lib/Singleton.class.php) | 0 | ||||
-rw-r--r-- | apps/um/lib/Site.class.php (renamed from src/lib/Site.class.php) | 0 | ||||
-rw-r--r-- | apps/um/models/Auth.class.php (renamed from src/models/Auth.class.php) | 0 | ||||
-rw-r--r-- | apps/um/models/ContactMethod.class.php (renamed from src/models/ContactMethod.class.php) | 0 | ||||
-rw-r--r-- | apps/um/models/Group.class.php (renamed from src/models/Group.class.php) | 0 | ||||
-rw-r--r-- | apps/um/models/User.class.php (renamed from src/models/User.class.php) | 0 | ||||
-rw-r--r-- | apps/um/plugins/InformationPlugin.class.php (renamed from src/plugins/InformationPlugin.class.php) | 0 | ||||
-rw-r--r-- | apps/um/plugins/ReCaptcha.class.php (renamed from src/plugins/ReCaptcha.class.php) | 0 | ||||
-rw-r--r-- | apps/um/views/Template.class.php (renamed from src/views/Template.class.php) | 0 | ||||
-rw-r--r-- | apps/um/views/includes/header-include.php (renamed from src/views/includes/header-include.php) | 0 | ||||
-rw-r--r-- | apps/um/views/includes/header.php (renamed from src/views/includes/header.php) | 0 | ||||
-rw-r--r-- | apps/um/views/pages/auth/badrequest.html.php (renamed from src/views/pages/auth/badrequest.html.php) | 0 | ||||
-rw-r--r-- | apps/um/views/pages/auth/index.html.php (renamed from src/views/pages/auth/index.html.php) | 0 | ||||
-rw-r--r-- | apps/um/views/pages/auth/login.html.php (renamed from src/views/pages/auth/login.html.php) | 5 | ||||
-rw-r--r-- | apps/um/views/pages/auth/logout.html.php (renamed from src/views/pages/auth/logout.html.php) | 0 | ||||
-rw-r--r-- | apps/um/views/pages/groups/401.html.php (renamed from src/views/pages/groups/401.html.php) | 0 | ||||
-rw-r--r-- | apps/um/views/pages/http404.html.php (renamed from src/views/pages/http404.html.php) | 0 | ||||
-rw-r--r-- | apps/um/views/pages/index.html.php (renamed from src/views/pages/index.html.php) | 0 | ||||
-rw-r--r-- | apps/um/views/pages/plugins/401.html.php (renamed from src/views/pages/plugins/401.html.php) | 0 | ||||
-rw-r--r-- | apps/um/views/pages/plugins/index.html.php (renamed from src/views/pages/plugins/index.html.php) | 0 | ||||
-rw-r--r-- | apps/um/views/pages/users/401.html.php (renamed from src/views/pages/users/401.html.php) | 0 | ||||
-rw-r--r-- | apps/um/views/pages/users/404.html.php (renamed from src/views/pages/users/404.html.php) | 0 | ||||
-rw-r--r-- | apps/um/views/pages/users/500.html.php (renamed from src/views/pages/users/500.html.php) | 0 | ||||
-rw-r--r-- | apps/um/views/pages/users/created.html.php (renamed from src/views/pages/users/created.html.php) | 0 | ||||
-rw-r--r-- | apps/um/views/pages/users/index.csv.php (renamed from src/views/pages/users/index.csv.php) | 0 | ||||
-rw-r--r-- | apps/um/views/pages/users/index.html.php (renamed from src/views/pages/users/index.html.php) | 0 | ||||
-rw-r--r-- | apps/um/views/pages/users/individual.html.php (renamed from src/views/pages/users/individual.html.php) | 0 | ||||
-rw-r--r-- | apps/um/views/pages/users/individual.json.php | 27 | ||||
-rw-r--r-- | apps/um/views/pages/users/new-locked.html.php (renamed from src/views/pages/users/new-locked.html.php) | 0 | ||||
-rw-r--r-- | apps/um/views/pages/users/new-logged-in.html.php (renamed from src/views/pages/users/new-logged-in.html.php) | 0 | ||||
-rw-r--r-- | apps/um/views/pages/users/new.html.php (renamed from src/views/pages/users/new.html.php) | 0 | ||||
-rw-r--r-- | index.php | 35 | ||||
-rw-r--r-- | lpf/ext/HTTP_Accept.class.php (renamed from src/ext/HTTP_Accept.class.php) | 0 | ||||
-rw-r--r-- | lpf/ext/README.txt | 11 | ||||
-rw-r--r-- | lpf/lib/Controller.class.php (renamed from src/lib/Controller.class.php) | 0 | ||||
-rw-r--r-- | lpf/lib/Mime.class.php (renamed from src/lib/Mime.class.php) | 0 | ||||
-rw-r--r-- | lpf/lib/Model.class.php (renamed from src/lib/Model.class.php) | 0 | ||||
-rw-r--r-- | lpf/lib/Router.class.php (renamed from src/lib/Router.class.php) | 0 | ||||
-rw-r--r-- | lpf/lib/View.class.php (renamed from src/lib/View.class.php) | 0 | ||||
-rw-r--r-- | lpf/views/pages/no-conf.html.php (renamed from src/views/pages/no-conf.html.php) | 0 | ||||
-rw-r--r-- | src/controllers/Messages.class.php | 100 | ||||
-rw-r--r-- | src/controllers/NewMessage.class.php | 37 | ||||
-rw-r--r-- | src/ext/GoogleVoice.class.php | 84 | ||||
-rw-r--r-- | src/ext/Identica.class.php | 491 | ||||
-rw-r--r-- | src/ext/MimeMailParser.class.php | 447 | ||||
-rw-r--r-- | src/ext/MimeMailParser_attachment.class.php | 136 | ||||
-rw-r--r-- | src/ext/README.txt | 17 | ||||
-rw-r--r-- | src/plugins/SenderGVSMS.class.php | 34 | ||||
-rw-r--r-- | src/plugins/SenderIdentica.class.php | 35 | ||||
-rw-r--r-- | src/plugins/maildir.php | 58 | ||||
-rw-r--r-- | src/views/pages/messages/401.html.php | 15 | ||||
-rw-r--r-- | src/views/pages/messages/frame.html.php | 57 | ||||
-rw-r--r-- | src/views/pages/messages/index.html.php | 25 |
69 files changed, 88 insertions, 1546 deletions
diff --git a/src/controllers/AuthPage.class.php b/apps/um/controllers/Authenticator.class.php index 1f46f72..0c1bf0c 100644 --- a/src/controllers/AuthPage.class.php +++ b/apps/um/controllers/Authenticator.class.php @@ -2,12 +2,12 @@ require_once('Login.class.php'); require_once('Auth.class.php'); -Router::register('auth', 'AuthPage'); +Router::register('auth', 'Authenticator'); -class AuthPage extends Controller { +class Authenticator extends Controller { public function index($routed, $remainder) { - // So if $_POST['action'] isn't set, it will trip on '', which - // is great, so we don't have to handle GET and PUT separately. + // If $_POST['action'] isn't set, it will trip on '', which is + // great, so we don't have to handle GET and PUT separately. @$action = $_POST['action']; switch ($action) { case 'login' : $this->login(); break; diff --git a/src/controllers/Config.class.php b/apps/um/controllers/Config.class.php index dc6a884..dc6a884 100644 --- a/src/controllers/Config.class.php +++ b/apps/um/controllers/Config.class.php diff --git a/src/controllers/Groups.class.php b/apps/um/controllers/Groups.class.php index 9d99d99..9d99d99 100644 --- a/src/controllers/Groups.class.php +++ b/apps/um/controllers/Groups.class.php diff --git a/src/controllers/Http404.class.php b/apps/um/controllers/Http404.class.php index 322feaa..322feaa 100644 --- a/src/controllers/Http404.class.php +++ b/apps/um/controllers/Http404.class.php diff --git a/src/controllers/Main.class.php b/apps/um/controllers/Main.class.php index 7651b62..7651b62 100644 --- a/src/controllers/Main.class.php +++ b/apps/um/controllers/Main.class.php diff --git a/src/controllers/Plugins.class.php b/apps/um/controllers/Plugins.class.php index 2ed6e7a..2ed6e7a 100644 --- a/src/controllers/Plugins.class.php +++ b/apps/um/controllers/Plugins.class.php diff --git a/src/controllers/Users.class.php b/apps/um/controllers/Users.class.php index 9978ef8..9978ef8 100644 --- a/src/controllers/Users.class.php +++ b/apps/um/controllers/Users.class.php diff --git a/src/ext/PasswordHash.class.php b/apps/um/ext/PasswordHash.class.php index 12958c7..12958c7 100644 --- a/src/ext/PasswordHash.class.php +++ b/apps/um/ext/PasswordHash.class.php diff --git a/apps/um/ext/README.txt b/apps/um/ext/README.txt new file mode 100644 index 0000000..78c4f70 --- /dev/null +++ b/apps/um/ext/README.txt @@ -0,0 +1,12 @@ +These are class files that I've gathered from around the internet. + +I've renamed the files to follow a standard scheme. + +This is where each file came from: + +My Name : Original Name : From +PasswordHash.class.php : PasswordHash.php : http://www.openwall.com/phpass/ +recaptchalib.php : recaptchalib.php : https://code.google.com/p/recaptcha/ + +~ Luke Shumaker <http://lukeshu.ath.cx> +Happy Hacking! diff --git a/src/ext/recaptchalib.php b/apps/um/ext/recaptchalib.php index 32c4f4d..32c4f4d 100644 --- a/src/ext/recaptchalib.php +++ b/apps/um/ext/recaptchalib.php diff --git a/src/lib/DB.class.php b/apps/um/lib/DB.class.php index ac8dafe..ac8dafe 100644 --- a/src/lib/DB.class.php +++ b/apps/um/lib/DB.class.php diff --git a/src/lib/Database.class.php b/apps/um/lib/Database.class.php index a76d891..a76d891 100644 --- a/src/lib/Database.class.php +++ b/apps/um/lib/Database.class.php diff --git a/src/lib/Hasher.class.php b/apps/um/lib/Hasher.class.php index dc16d68..dc16d68 100644 --- a/src/lib/Hasher.class.php +++ b/apps/um/lib/Hasher.class.php diff --git a/src/lib/Login.class.php b/apps/um/lib/Login.class.php index bb21928..bb21928 100644 --- a/src/lib/Login.class.php +++ b/apps/um/lib/Login.class.php diff --git a/src/lib/Plugin.class.php b/apps/um/lib/Plugin.class.php index 9d2fc2e..9d2fc2e 100644 --- a/src/lib/Plugin.class.php +++ b/apps/um/lib/Plugin.class.php diff --git a/src/lib/PluginManager.class.php b/apps/um/lib/PluginManager.class.php index ce5a3ef..ce5a3ef 100644 --- a/src/lib/PluginManager.class.php +++ b/apps/um/lib/PluginManager.class.php diff --git a/src/lib/Singleton.class.php b/apps/um/lib/Singleton.class.php index 2f8c74f..2f8c74f 100644 --- a/src/lib/Singleton.class.php +++ b/apps/um/lib/Singleton.class.php diff --git a/src/lib/Site.class.php b/apps/um/lib/Site.class.php index 1204089..1204089 100644 --- a/src/lib/Site.class.php +++ b/apps/um/lib/Site.class.php diff --git a/src/models/Auth.class.php b/apps/um/models/Auth.class.php index 39f627e..39f627e 100644 --- a/src/models/Auth.class.php +++ b/apps/um/models/Auth.class.php diff --git a/src/models/ContactMethod.class.php b/apps/um/models/ContactMethod.class.php index 1dd40ee..1dd40ee 100644 --- a/src/models/ContactMethod.class.php +++ b/apps/um/models/ContactMethod.class.php diff --git a/src/models/Group.class.php b/apps/um/models/Group.class.php index f981a4f..f981a4f 100644 --- a/src/models/Group.class.php +++ b/apps/um/models/Group.class.php diff --git a/src/models/User.class.php b/apps/um/models/User.class.php index b6dbede..b6dbede 100644 --- a/src/models/User.class.php +++ b/apps/um/models/User.class.php diff --git a/src/plugins/InformationPlugin.class.php b/apps/um/plugins/InformationPlugin.class.php index 70ec8ac..70ec8ac 100644 --- a/src/plugins/InformationPlugin.class.php +++ b/apps/um/plugins/InformationPlugin.class.php diff --git a/src/plugins/ReCaptcha.class.php b/apps/um/plugins/ReCaptcha.class.php index 165493b..165493b 100644 --- a/src/plugins/ReCaptcha.class.php +++ b/apps/um/plugins/ReCaptcha.class.php diff --git a/src/views/Template.class.php b/apps/um/views/Template.class.php index 9d55b75..9d55b75 100644 --- a/src/views/Template.class.php +++ b/apps/um/views/Template.class.php diff --git a/src/views/includes/header-include.php b/apps/um/views/includes/header-include.php index 3826b3a..3826b3a 100644 --- a/src/views/includes/header-include.php +++ b/apps/um/views/includes/header-include.php diff --git a/src/views/includes/header.php b/apps/um/views/includes/header.php index 0a3e161..0a3e161 100644 --- a/src/views/includes/header.php +++ b/apps/um/views/includes/header.php diff --git a/src/views/pages/auth/badrequest.html.php b/apps/um/views/pages/auth/badrequest.html.php index c1fe726..c1fe726 100644 --- a/src/views/pages/auth/badrequest.html.php +++ b/apps/um/views/pages/auth/badrequest.html.php diff --git a/src/views/pages/auth/index.html.php b/apps/um/views/pages/auth/index.html.php index ac80140..ac80140 100644 --- a/src/views/pages/auth/index.html.php +++ b/apps/um/views/pages/auth/index.html.php diff --git a/src/views/pages/auth/login.html.php b/apps/um/views/pages/auth/login.html.php index a246a9e..4e3e0e6 100644 --- a/src/views/pages/auth/login.html.php +++ b/apps/um/views/pages/auth/login.html.php @@ -3,6 +3,11 @@ $t = $VARS['template']; $username = $VARS['username']; $password = $VARS['password']; +switch ($VARS['login_code']) { +case 1: $t->status('401 Unauthorized'); break; +case 2: $t->status('404 Not Found'); break; +} + $t->header('Authentication'); $t->openTag('form',array('action'=>$t->url('auth'), 'method'=>"post")); diff --git a/src/views/pages/auth/logout.html.php b/apps/um/views/pages/auth/logout.html.php index 2d00998..2d00998 100644 --- a/src/views/pages/auth/logout.html.php +++ b/apps/um/views/pages/auth/logout.html.php diff --git a/src/views/pages/groups/401.html.php b/apps/um/views/pages/groups/401.html.php index 23e3778..23e3778 100644 --- a/src/views/pages/groups/401.html.php +++ b/apps/um/views/pages/groups/401.html.php diff --git a/src/views/pages/http404.html.php b/apps/um/views/pages/http404.html.php index 730b0ee..730b0ee 100644 --- a/src/views/pages/http404.html.php +++ b/apps/um/views/pages/http404.html.php diff --git a/src/views/pages/index.html.php b/apps/um/views/pages/index.html.php index 71b0091..71b0091 100644 --- a/src/views/pages/index.html.php +++ b/apps/um/views/pages/index.html.php diff --git a/src/views/pages/plugins/401.html.php b/apps/um/views/pages/plugins/401.html.php index 5b1b222..5b1b222 100644 --- a/src/views/pages/plugins/401.html.php +++ b/apps/um/views/pages/plugins/401.html.php diff --git a/src/views/pages/plugins/index.html.php b/apps/um/views/pages/plugins/index.html.php index b182288..b182288 100644 --- a/src/views/pages/plugins/index.html.php +++ b/apps/um/views/pages/plugins/index.html.php diff --git a/src/views/pages/users/401.html.php b/apps/um/views/pages/users/401.html.php index 0a5a1ce..0a5a1ce 100644 --- a/src/views/pages/users/401.html.php +++ b/apps/um/views/pages/users/401.html.php diff --git a/src/views/pages/users/404.html.php b/apps/um/views/pages/users/404.html.php index 00f9dca..00f9dca 100644 --- a/src/views/pages/users/404.html.php +++ b/apps/um/views/pages/users/404.html.php diff --git a/src/views/pages/users/500.html.php b/apps/um/views/pages/users/500.html.php index 339fe63..339fe63 100644 --- a/src/views/pages/users/500.html.php +++ b/apps/um/views/pages/users/500.html.php diff --git a/src/views/pages/users/created.html.php b/apps/um/views/pages/users/created.html.php index d3027cc..d3027cc 100644 --- a/src/views/pages/users/created.html.php +++ b/apps/um/views/pages/users/created.html.php diff --git a/src/views/pages/users/index.csv.php b/apps/um/views/pages/users/index.csv.php index 0a69cee..0a69cee 100644 --- a/src/views/pages/users/index.csv.php +++ b/apps/um/views/pages/users/index.csv.php diff --git a/src/views/pages/users/index.html.php b/apps/um/views/pages/users/index.html.php index 159ff76..159ff76 100644 --- a/src/views/pages/users/index.html.php +++ b/apps/um/views/pages/users/index.html.php diff --git a/src/views/pages/users/individual.html.php b/apps/um/views/pages/users/individual.html.php index 39360b7..39360b7 100644 --- a/src/views/pages/users/individual.html.php +++ b/apps/um/views/pages/users/individual.html.php diff --git a/apps/um/views/pages/users/individual.json.php b/apps/um/views/pages/users/individual.json.php new file mode 100644 index 0000000..c3dee50 --- /dev/null +++ b/apps/um/views/pages/users/individual.json.php @@ -0,0 +1,27 @@ +<?php global $VARS, $CONTACT_METHODS; +$t = $VARS['template']; +$users = $VARS['users']; +$username = $VARS['username']; + +$json = array(); + +foreach ($users as $user_obj) { + $user_json = array(); + $user_json['username'] = $user_obj->getName(); + $user_json['uid'] = $user_obj->getUID(); + foreach ($CONTACT_METHODS as $method) { + $field = $method->addr_slug; + $user_json[$field] = $user_obj->getConf($field); + } + foreach ($VARS['config_options'] as $groupname=>$options) { + foreach ($options as $option) { + $fieldname = $option[0]; + $fieldlabel = $option[1]; + $fieldtype = $option[2]; + $user_json[$fieldname] = $user_obj->getConf($fieldname); + } + } + $json[] = $user_json; +} + +echo json_encode($json);
\ No newline at end of file diff --git a/src/views/pages/users/new-locked.html.php b/apps/um/views/pages/users/new-locked.html.php index dc7ad0d..dc7ad0d 100644 --- a/src/views/pages/users/new-locked.html.php +++ b/apps/um/views/pages/users/new-locked.html.php diff --git a/src/views/pages/users/new-logged-in.html.php b/apps/um/views/pages/users/new-logged-in.html.php index 51823fe..51823fe 100644 --- a/src/views/pages/users/new-logged-in.html.php +++ b/apps/um/views/pages/users/new-logged-in.html.php diff --git a/src/views/pages/users/new.html.php b/apps/um/views/pages/users/new.html.php index 9df376f..9df376f 100644 --- a/src/views/pages/users/new.html.php +++ b/apps/um/views/pages/users/new.html.php @@ -11,13 +11,34 @@ if (file_exists($xss_file)) { exit(); } } +unset($xss_file); // Decide where to look for things. //////////////////////////////////////////// -define('LIBPATH', BASEPATH.'/src/lib'.PATH_SEPARATOR.BASEPATH.'/src/ext'); -define('MODELPATH', BASEPATH.'/src/models'); -define('VIEWPATH', BASEPATH.'/src/views');// views are not objects -define('CONTROLLERPATH',BASEPATH.'/src/controllers'); -define('PLUGINPATH', BASEPATH.'/src/plugins'); +$app_path = glob(BASEPATH.'/apps/*'); +array_unshift($app_path, BASEPATH.'/lpf'); + +$libpath = array(); +$modelpath = array(); +$viewpath = array(); +$controllerpath = array(); +$pluginpath = array(); + +foreach ($app_path as $dir) { + if (is_dir($dir.'/lib' )) { $libpath[] = $dir.'/lib'; } + if (is_dir($dir.'/ext' )) { $libpath[] = $dir.'/ext'; } + if (is_dir($dir.'/models' )) { $modelpath[] = $dir.'/models'; } + if (is_dir($dir.'/views' )) { $viewpath[] = $dir.'/views'; } + if (is_dir($dir.'/controllers')) { $controllerpath[] = $dir.'/controllers'; } + if (is_dir($dir.'/plugins' )) { $controllerpath[] = $dir.'/plugins'; } +} +unset($app_path); + +define('LIBPATH', implode(PATH_SEPARATOR, $libpath )); unset($libpath); +define('MODELPATH', implode(PATH_SEPARATOR, $modelpath )); unset($modelpath); +/*define('VIEWPATH', implode(PATH_SEPARATOR, $viewpath ));*/ unset($viewpath); +define('VIEWPATH', BASEPATH.'/apps/um/views'); +define('CONTROLLERPATH',implode(PATH_SEPARATOR, $controllerpath)); unset($controllerpath); +define('PLUGINPATH', implode(PATH_SEPARATOR, $pluginpath )); unset($pluginpath); set_include_path(get_include_path() .PATH_SEPARATOR.LIBPATH @@ -29,7 +50,6 @@ set_include_path(get_include_path() // Figure what page is trying to be loaded. //////////////////////////////////// // We don't have to do any check if it's a real file being looked for, if the // requested page exists as a real file, .htaccess won't even let us load -// thisfile. @$PAGE_RAW = $_GET['p']; $PAGE_PARTS = explode('/', $PAGE_RAW); $FILE = array_pop($PAGE_PARTS); @@ -42,6 +62,8 @@ if (preg_match($regex, $FILE, $matches)) { } else { $PAGE = $PAGE_RAW; } +unset($PAGE_RAW); unset($PAGE_PARTS); unset($FILE); unset($regex); + if ($PAGE=='') $PAGE = 'index'; define('PAGE', $PAGE); unset($PAGE); define('PAGE_EXT', $EXT); unset($EXT); @@ -62,6 +84,7 @@ if (file_exists($conf_file)) { $view->show(array()); exit(); } +unset($conf_file); // Kludgy ugly hacky hack ////////////////////////////////////////////////////// require_once('ContactMethod.class.php'); diff --git a/src/ext/HTTP_Accept.class.php b/lpf/ext/HTTP_Accept.class.php index 5efaa5d..5efaa5d 100644 --- a/src/ext/HTTP_Accept.class.php +++ b/lpf/ext/HTTP_Accept.class.php diff --git a/lpf/ext/README.txt b/lpf/ext/README.txt new file mode 100644 index 0000000..c8eddb6 --- /dev/null +++ b/lpf/ext/README.txt @@ -0,0 +1,11 @@ +These are class files that I've gathered from around the internet. + +I've renamed the files to follow a standard scheme. + +This is where each file came from: + +My Name : Original Name : From +HTTP_Accept.class.php : HTTP_Accept.php : http://kevinlocke.name/programs/http_accept.php + +~ Luke Shumaker <http://lukeshu.ath.cx> +Happy Hacking! diff --git a/src/lib/Controller.class.php b/lpf/lib/Controller.class.php index 05736ee..05736ee 100644 --- a/src/lib/Controller.class.php +++ b/lpf/lib/Controller.class.php diff --git a/src/lib/Mime.class.php b/lpf/lib/Mime.class.php index f37c1eb..f37c1eb 100644 --- a/src/lib/Mime.class.php +++ b/lpf/lib/Mime.class.php diff --git a/src/lib/Model.class.php b/lpf/lib/Model.class.php index 0cce525..0cce525 100644 --- a/src/lib/Model.class.php +++ b/lpf/lib/Model.class.php diff --git a/src/lib/Router.class.php b/lpf/lib/Router.class.php index 238e3f8..238e3f8 100644 --- a/src/lib/Router.class.php +++ b/lpf/lib/Router.class.php diff --git a/src/lib/View.class.php b/lpf/lib/View.class.php index d7a21d3..d7a21d3 100644 --- a/src/lib/View.class.php +++ b/lpf/lib/View.class.php diff --git a/src/views/pages/no-conf.html.php b/lpf/views/pages/no-conf.html.php index 1f4e3d3..1f4e3d3 100644 --- a/src/views/pages/no-conf.html.php +++ b/lpf/views/pages/no-conf.html.php diff --git a/src/controllers/Messages.class.php b/src/controllers/Messages.class.php deleted file mode 100644 index 717e18e..0000000 --- a/src/controllers/Messages.class.php +++ /dev/null @@ -1,100 +0,0 @@ -<?php -require_once('Login.class.php'); -require_once('Auth.class.php'); - -Router::register('messages', 'Messages', 'index'); -Router::register('messages/index', 'Messages', 'index'); -Router::register('messages/*', 'Messages', 'message'); - -class Messages extends Controller { - public static $msgdir; - - public function __construct() { - require_once('MimeMailParser.class.php'); - $this->msgdir = BASEPATH.'/msg'; - } - - public function index($routed, $remainder) { - $parser = new MimeMailParser(); - $messages = array(); - $dh = opendir($this->msgdir); - while (($file = readdir($dh)) !== false) { - $path = $this->msgdir."/$file"; - if (is_file($path)) { - $parser->setPath($path); - - $date_string = $parser->getHeader('date'); - $date = strtotime($date_string); - if (!isset($messages[$date])) { - $messages[$date] = array(); - } - $messages[$date][] = - array('id'=>$file, - 'subject'=>$parser->getHeader('subject'), - 'from'=>$parser->getHeader('from')); - } - } - closedir($dh); - - $this->showView('messages/index', array('messages' => $messages)); - exit(); - } - - public function message($routed, $remainder) { - $uid = Login::isLoggedIn(); - if ($uid===false || !Auth::getInstance($uid)->isUser()) { - $this->http401($routed, $remainder); - return; - } - - $msg_id = $remainder[0];// We can trust the router that this is set - $msg_file = $this->msgdir."/$msg_id"; - if (!is_file($msg_file)) { - $this->http404($routed, $remainder); - return; - } - - @$part = $remainder[1]; - @$subpart = $remainder[2]; - $parser = new MimeMailParser(); - $parser->setPath($msg_file); - - switch ($part) { - case '': - $this->showView('messages/frame', - array('msg_id'=>$msg_id, - 'parser'=>$parser, - 'msgdir'=>$this->msgdir, - )); - break; - case 'body': - require_once('Mime.class.php'); - header('Content-type: '.Mime::ext2mime(PAGE_EXT)); - $map = array('html'=>'html', - 'txt' =>'text'); - echo $parser->getMessageBody($map[PAGE_EXT]); - break; - case 'attachment': - $attachment_id = $subpart; - $attachments = $parser->getAttachments(); - $attachment = $attachments[$attachment_id]; - - $type = $attachment->getContentType(); - $filename = $attachment->getFilename(); - - header('Content-Type: '.$type); - header('Content-Disposition: attachment; filename='.$filename ); - while($bytes = $attachment->read()) { - echo $bytes; - } - break; - default: - array_push($routed, array_shift($remainder)); - $this->http404($routed, $remainder); - } - } - - public function http401($routed, $remainder) { - $this->showView('messages/401', array('uid'=>Login::isLoggedIn())); - } -}
\ No newline at end of file diff --git a/src/controllers/NewMessage.class.php b/src/controllers/NewMessage.class.php deleted file mode 100644 index e778385..0000000 --- a/src/controllers/NewMessage.class.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - /* -class NewMessage extends Controller { -$cmdline = isset($argv[0]); // called from the command line -@$method = $_SERVER['REQUEST_METHOD']; // What HTTP method was used -if ( ($method=='PUT') || ($method=='POST') || $cmdline ) { - // We're going to be uploading a new message. - - // so uniqid isn't 'secure', it doesn't need to be, it's to prevent - // random collisions. - $tmpfile = "$BASE/tmp/".uniqid(getmypid().'.'); - $infile = ($cmdline?'php://stdin':'php://input'); - $out = fopen($tmpfile, "w"); - $in = fopen($infile, "r"); - while ($data = fread($in, 1024)) - fwrite($out, $data); - fclose($out); - fclose($in); - //apache_request_headers() - require_once('MimeMailParser.class.php'); - $parser = new MimeMailParser(); - $parser->setPath($tmpfile); - $id = preg_replace('/<(.*)>/', '$1', - $parser->getHeader('message-id')); - $id = str_replace('/', '', $id); // for security reasons - $msg_file = "$BASE/msg/$id"; - rename($tmpfile, $msg_file); - - if (!$cmdline) { - $m->status('201 Created'); - header("Location: ".$m->baseUrl().'messages/'.$id); - } - exit(); -} - -} - */
\ No newline at end of file diff --git a/src/ext/GoogleVoice.class.php b/src/ext/GoogleVoice.class.php deleted file mode 100644 index 9638416..0000000 --- a/src/ext/GoogleVoice.class.php +++ /dev/null @@ -1,84 +0,0 @@ -<?PHP
-/*
-Version 0.2
-License This code is released under the MIT Open Source License. Feel free to do whatever you want with it.
-Author lostleon@gmail.com, http://www.lostleon.com/
-LastUpdate 05/28/2010
-*/
-class GoogleVoice
-{
- public $username;
- public $password;
- public $status;
- private $lastURL;
- private $login_auth;
- private $inboxURL = 'https://www.google.com/voice/m/';
- private $loginURL = 'https://www.google.com/accounts/ClientLogin';
- private $smsURL = 'https://www.google.com/voice/m/sendsms';
-
- public function __construct($username, $password)
- {
- $this->username = $username;
- $this->password = $password;
- }
-
- public function getLoginAuth()
- {
- $login_param = "accountType=GOOGLE&Email={$this->username}&Passwd={$this->password}&service=grandcentral&source=com.lostleon.GoogleVoiceTool";
- $ch = curl_init($this->loginURL);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_2_1 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5H11 Safari/525.20");
- curl_setopt($ch, CURLOPT_REFERER, $this->lastURL);
- curl_setopt($ch, CURLOPT_POST, "application/x-www-form-urlencoded");
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $login_param);
- $html = curl_exec($ch);
- $this->lastURL = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
- curl_close($ch);
- $this->login_auth = $this->match('/Auth=([A-z0-9_-]+)/', $html, 1);
- return $this->login_auth;
- }
-
- public function get_rnr_se()
- {
- $this->getLoginAuth();
- $ch = curl_init($this->inboxURL);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- $headers = array("Authorization: GoogleLogin auth=".$this->login_auth, 'User-Agent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_2_1 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5H11 Safari/525.20');
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- $html = curl_exec($ch);
- $this->lastURL = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
- curl_close($ch);
- $_rnr_se = $this->match('!<input.*?name="_rnr_se".*?value="(.*?)"!ms', $html, 1);
- return $_rnr_se;
- }
-
- public function sms($to_phonenumber, $smstxt)
- {
- $_rnr_se = $this->get_rnr_se();
- $sms_param = "id=&c=&number=".urlencode($to_phonenumber)."&smstext=".urlencode($smstxt)."&_rnr_se=".urlencode($_rnr_se);
- $ch = curl_init($this->smsURL);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- $headers = array("Authorization: GoogleLogin auth=".$this->login_auth, 'User-Agent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_2_1 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5H11 Safari/525.20');
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($ch, CURLOPT_REFERER, $this->lastURL);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $sms_param);
- $this->status = curl_exec($ch);
- $this->lastURL = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
- curl_close($ch);
- return $this->status;
- }
-
- private function match($regex, $str, $out_ary = 0)
- {
- return preg_match($regex, $str, $match) == 1 ? $match[$out_ary] : false;
- }
-}
-?>
diff --git a/src/ext/Identica.class.php b/src/ext/Identica.class.php deleted file mode 100644 index a3e62a9..0000000 --- a/src/ext/Identica.class.php +++ /dev/null @@ -1,491 +0,0 @@ -<?php -/** - * Copyright (c) <2009> Gianluca Urgese <g.urgese@jasone.it> - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - - -/** -* The main identica-php class. Create an object to use your Identi.ca account from php. -*/ -class Identica { - /** Username:password format string */ - private $credentials; - - /** Contains the last HTTP status code returned */ - private $http_status; - - /** Contains the last API call */ - private $last_api_call; - - /** Contains the application calling the API */ - private $application_source; - - /** - * Identi.ca class constructor. - * @param username is a alphanumeric string to perform login on Identi.ca. - * @param password is a alphanumeric string to perform login on Identi.ca. - * @param source is the name of your application. - * @return An Identica object to use to perform all the operation. - */ - function Identica($username, $password, $source=false) { - $this->credentials = sprintf("%s:%s", $username, $password); - $this->application_source = $source; - } - - /** - * Returns the 20 most recent statuses from non-protected users who have set a custom user icon. - * @param format is the extension for the result file (xml, json, rss, atom). - * @param since_id returns only statuses with an ID greater than (that is, more recent than) the specified ID. - * @return the public timeline in the specified format. - */ - function getPublicTimeline($format, $since_id = 0) { - $api_call = sprintf("http://identi.ca/api/statuses/public_timeline.%s", $format); - if ($since_id > 0) { - $api_call .= sprintf("?since_id=%d", $since_id); - } - return $this->APICall($api_call); - } - - /** - * Returns the 20 most recent statuses posted by the authenticating user and that user's friends. - * @param format is the extension for the result file (xml, json, rss, atom). - * @param id returns only statuses from specified ID. - * @param since returns only statuses with an ID greater than (that is, more recent than) the specified ID. - * @return the friends timeline in the specified format. - */ - function getFriendsTimeline($format, $id = NULL, $since = NULL) { - if ($id != NULL) { - $api_call = sprintf("http://identi.ca/api/statuses/friends_timeline/%s.%s", $id, $format); - } - else { - $api_call = sprintf("http://identi.ca/api/statuses/friends_timeline.%s", $format); - } - if ($since != NULL) { - $api_call .= sprintf("?since=%s", urlencode($since)); - } - return $this->APICall($api_call, true); - } - - /** - * Returns the 20 most recent statuses posted from the authenticating user. - * @param format is the extension for the result file (xml, json, rss, atom). - * @param id get only statuses from specified ID. - * @param count specifies the number of statuses to retrieve. May not be greater than 200. - * @param since get only statuses with an ID greater than (that is, more recent than) the specified ID. - * @return the 20 most recent statuses posted from the authenticating user. - */ - function getUserTimeline($format, $id = NULL, $count = 20, $since = NULL) { - if ($id != NULL) { - $api_call = sprintf("http://identi.ca/api/statuses/user_timeline/%s.%s", $id, $format); - } - else { - $api_call = sprintf("http://identi.ca/api/statuses/user_timeline.%s", $format); - } - if ($count != 20) { - $api_call .= sprintf("?count=%d", $count); - } - if ($since != NULL) { - $api_call .= sprintf("%ssince=%s", (strpos($api_call, "?count=") === false) ? "?" : "&", urlencode($since)); - } - return $this->APICall($api_call, true); - } - - /** - * Returns a single status, specified by the id parameter below. The status's author will be returned inline. - * @param format is the extension for the result file (xml, json, rss, atom). - * @param id get only statuses from specified ID. - * @return a single status, specified by the id parameter. - */ - function showStatus($format, $id) { - $api_call = sprintf("http://identi.ca/api/statuses/show/%d.%s", $id, $format); - return $this->APICall($api_call); - } - - /** - * Updates the authenticating user's status. Request must be a POST. Statuses over 140 characters will be forceably truncated. - * @param status is the text of your status update. - * @return the current update from authenticating user. - */ - function updateStatus($status) { - $status = urlencode(stripslashes(urldecode($status))); - $api_call = sprintf("http://identi.ca/api/statuses/update.xml?status=%s", $status); - return $this->APICall($api_call, true, true); - } - - /** - * Returns a list of replies from authenticating user. - * @param format is the extension for the result file (xml, json, rss, atom). - * @param page specifies the page of results to retrieve. - * @return list of replies from authenticating user. - */ - function getReplies($format, $page = 0) { - $api_call = sprintf("http://identi.ca/api/statuses/replies.%s", $format); - if ($page) { - $api_call .= sprintf("?page=%d", $page); - } - return $this->APICall($api_call, true); - } - - /** - * Destroys the status specified by the required ID parameter. The authenticating user must be the author of the specified status. - * @param format is the extension for the result file (xml, json, rss, atom). - * @param id the ID of the status to destroy. - * @return a destroyed status specified by the id parameter. - */ - function destroyStatus($format, $id) { - $api_call = sprintf("http://identi.ca/api/statuses/destroy/%d.%s", $id, $format); - return $this->APICall($api_call, true, true); - } - - /** - * Returns a user's friends, each with current status inline. They are ordered by the order in which - * they were added as friends, 100 at a time. Use the page option to access older friends. With no - * user specified, request defaults to the authenticated user's friends. - * @param format is the extension for the result file (xml, json, rss, atom). - * @param id is the ID of the user for whom to request a list of friends. - * @return a user's friends. - */ - function getFriends($format, $id = NULL) { - if ($id != NULL) { - $api_call = sprintf("http://identi.ca/api/statuses/friends/%s.%s", $id, $format); - } - else { - $api_call = sprintf("http://identi.ca/api/statuses/friends.%s", $format); - } - return $this->APICall($api_call, true); - } - - /** - * Returns a user's followers. They are ordered by the order in which they joined Identi.ca, 100 at a time. - * @param format is the extension for the result file (xml, json, rss, atom). - * @param lite specified if status must be show. - * @return a user's followers. - */ - function getFollowers($format, $lite = NULL) { - $api_call = sprintf("http://identi.ca/api/statuses/followers.%s%s", $format, ($lite) ? "?lite=true" : NULL); - return $this->APICall($api_call, true); - } - - /** - * Returns extended information of a given user, specified by ID or email as per the required id parameter. - * @param format is the extension for the result file (xml, json). - * @param id is the ID of specified user. - * @param email is the email of specified user. - * @return extended information of a given user. - */ - function showUser($format, $id, $email = NULL) { - if ($email == NULL) { - $api_call = sprintf("http://identi.ca/api/users/show/%s.%s", $id, $format); - } - else { - $api_call = sprintf("http://identi.ca/api/users/show.xml?email=%s", $email); - } - return $this->APICall($api_call, true); - } - - /** - * Returns a list of the 20 most recent direct messages sent to the authenticating user. The XML - * and JSON versions include detailed information about the sending and recipient users. - * @param format is the extension for the result file (xml, json, rss, atom). - * @param since get only messages from an ID greater than (that is, more recent than) the specified ID. - * @param since_id returns only statuses from the specified ID. - * @param page Specifies the page of direct messages to retrieve. - * @return a list of the 20 most recent direct messages. - */ - function getMessages($format, $since = NULL, $since_id = 0, $page = 1) { - $api_call = sprintf("http://identi.ca/api/direct_messages.%s", $format); - if ($since != NULL) { - $api_call .= sprintf("?since=%s", urlencode($since)); - } - if ($since_id > 0) { - $api_call .= sprintf("%ssince_id=%d", (strpos($api_call, "?since") === false) ? "?" : "&", $since_id); - } - if ($page > 1) { - $api_call .= sprintf("%spage=%d", (strpos($api_call, "?since") === false) ? "?" : "&", $page); - } - return $this->APICall($api_call, true); - } - - /** - * Returns a list of the 20 most recent direct messages sent by the authenticating user. The XML - * and JSON versions include detailed information about the sending and recipient users. - * @param format is the extension for the result file (xml, json, rss, atom). - * @param since get only messages from an ID greater than (that is, more recent than) the specified ID. - * @param since_id returns only statuses from the specified ID. - * @param page specifies the page of direct messages to retrieve. - * @return a list of the 20 most recent sent direct messages. - */ - function getSentMessages($format, $since = NULL, $since_id = 0, $page = 1) { - $api_call = sprintf("http://identi.ca/api/direct_messages/sent.%s", $format); - if ($since != NULL) { - $api_call .= sprintf("?since=%s", urlencode($since)); - } - if ($since_id > 0) { - $api_call .= sprintf("%ssince_id=%d", (strpos($api_call, "?since") === false) ? "?" : "&", $since_id); - } - if ($page > 1) { - $api_call .= sprintf("%spage=%d", (strpos($api_call, "?since") === false) ? "?" : "&", $page); - } - return $this->APICall($api_call, true); - } - - /** - * Sends a new direct message to the specified user from the authenticating user. Request must be a POST. - * @param format is the extension for the result file (xml, json). - * @param user is the ID of specified user to send the message. - * @param text is the text of your direct message. - * @return the sent message in the requested format when successful. - */ - function newMessage($format, $user, $text) { - $text = urlencode(stripslashes(urldecode($text))); - $api_call = sprintf("http://identi.ca/api/direct_messages/new.%s?user=%s&text=%s", $format, $user, $text); - return $this->APICall($api_call, true, true); - } - - /** - * Destroys the direct message specified in the required ID parameter. The authenticating user - * must be the recipient of the specified direct message. - * @param format is the extension for the result file (xml, json). - * @param id is the ID of specified direct message. - * @return the message destroyed. - */ - function destroyMessage($format, $id) { - $api_call = sprintf("http://identi.ca/api/direct_messages/destroy/%s.%s", $id, $format); - return $this->APICall($api_call, true, true); - } - - /** - * Allows the authenticating users to follow the user specified in the ID parameter. - * @param format is the extension for the result file (xml, json). - * @param id is the ID of specified user. - * @return the befriended user in the requested format when successful. Returns a string describing the - * failure condition when unsuccessful. If you are already friends with the user an HTTP 403 will be returned. - */ - function createFriendship($format, $id) { - $api_call = sprintf("http://identi.ca/api/friendships/create/%s.%s", $id, $format); - return $this->APICall($api_call, true, true); - } - - /** - * Allows the authenticating users to unfollow the user specified in the ID parameter. - * @param format is the extension for the result file (xml, json). - * @param id is the ID of specified user. - * @return the unfollowed user in the requested format when successful. Returns a string - * describing the failure condition when unsuccessful. - */ - function destroyFriendship($format, $id) { - $api_call = sprintf("http://identi.ca/api/friendships/destroy/%s.%s", $id, $format); - return $this->APICall($api_call, true, true); - } - - /** - * Tests for the existence of friendship between two users. - * @param format is the extension for the result file (xml, json). - * @param user_a is the ID of the first specified user. - * @param user_b is the ID of the second specified user. - * @return true if user_a follows user_b, otherwise will return false. - */ - function friendshipExists($format, $user_a, $user_b) { - $api_call = sprintf("http://identi.ca/api/friendships/exists.%s?user_a=%s&user_b=%s", $format, $user_a, $user_b); - return $this->APICall($api_call, true); - } - - /** - * Tests if supplied user credentials are valid. - * @param format is the extension for the result file (xml, json). - * @return an HTTP 200 OK response code and a representation of the requesting user if authentication - * was successful; returns a 401 status code and an error message if not. - */ - function verifyCredentials($format = NULL) { - $api_call = sprintf("http://identi.ca/api/account/verify_credentials%s", ($format != NULL) ? sprintf(".%s", $format) : NULL); - return $this->APICall($api_call, true); - } - - /** - * Ends the session of the authenticating user, returning a null cookie. - * @return NULL - */ - function endSession() { - $api_call = "http://identi.ca/api/account/end_session"; - return $this->APICall($api_call, true); - } - - /** - * Update user's location in the profile. - * @param location is the user's location . - * @return NULL. - */ - function updateLocation($format, $location) { - $api_call = sprintf("http://identi.ca/api/account/update_location.%s?location=%s", $format, $location); - return $this->APICall($api_call, true, true); - } - - /** - * Sets which device Identi.ca delivers updates to for the authenticating user. - * @param format is the extension for the result file (xml, json). - * @param device must be one of: sms, im, none. - * @return user's profile details in a selected format. - */ - function updateDeliveryDevice($format, $device) { - $api_call = sprintf("http://identi.ca/api/account/update_delivery_device.%s?device=%s", $format, $device); - return $this->APICall($api_call, true, true); - } - - /** - * Returns the remaining number of API requests available to the requesting user before the API - * limit is reached for the current hour. Calls to rateLimitStatus() do not count against the rate limit. - * @param format is the extension for the result file (xml, json). - * @return remaining number of API requests. - */ - function rateLimitStatus($format) { - $api_call = sprintf("http://identi.ca/api/account/rate_limit_status.%s", $format); - return $this->APICall($api_call, true); - } - - /** - * Returns the 20 most recent favorite statuses for the authenticating user or user - * specified by the ID parameter in the requested format. - * @param format is the extension for the result file (xml, json, rss, atom). - * @param id is the ID of specified user. - * @param page specifies the page of favorites to retrieve. - * @return a list of the 20 most recent favorite statuses. - */ - function getFavorites($format, $id = NULL, $page = 1) { - if ($id == NULL) { - $api_call = sprintf("http://identi.ca/api/favorites.%s", $format); - } - else { - $api_call = sprintf("http://identi.ca/api/favorites/%s.%s", $id, $format); - } - if ($page > 1) { - $api_call .= sprintf("?page=%d", $page); - } - return $this->APICall($api_call, true); - } - - /** - * Favorites the status specified in the ID parameter as the authenticating user. - * @param format is the extension for the result file (xml, json). - * @param id is the ID of specified user. - * @return the favorite status when successful. - */ - function createFavorite($format, $id) { - $api_call = sprintf("http://identi.ca/api/favorites/create/%d.%s", $id, $format); - return $this->APICall($api_call, true, true); - } - - /** - * Un-favorites the status specified in the ID parameter as the authenticating user. - * @param format is the extension for the result file (xml, json). - * @param id is the ID of specified user. - * @return the un-favorited status in the requested format when successful. - */ - function destroyFavorite($format, $id) { - $api_call = sprintf("http://identi.ca/api/favorites/destroy/%d.%s", $id, $format); - return $this->APICall($api_call, true, true); - } - - /** - * Enables device notifications for updates from the specified user. - * @param format is the extension for the result file (xml, json). - * @param id is the ID of specified user. - * @return the specified user when successful. - */ - function follow($format, $id) { - $api_call = sprintf("http://identi.ca/api/notifications/follow/%d.%s", $id, $format); - return $this->APICall($api_call, true, true); - } - - /** - * Disables notifications for updates from the specified user to the authenticating user. - * @param format is the extension for the result file (xml, json). - * @param id is the ID of specified user. - * @return the specified user when successful. - */ - function leave($format, $id) { - $api_call = sprintf("http://identi.ca/api/notifications/leave/%d.%s", $id, $format); - return $this->APICall($api_call, true, true); - } - - /** - * Blocks the user specified in the ID parameter as the authenticating user. Destroys a friendship to the blocked user if it exists. - * @param format is the extension for the result file (xml, json). - * @param id is the ID of specified user. - * @return the blocked user in the requested format when successful. - */ - function createBlock($format, $id) { - $api_call = sprintf("http://identi.ca/api/blocks/create/%d.%s", $id, $format); - return $this->APICall($api_call, true, true); - } - - /** - * Un-blocks the user specified in the ID parameter for the authenticating user. - * @param format is the extension for the result file (xml, json). - * @param id is the ID of specified user. - * @return the un-blocked user in the requested format when successful. - */ - function destroyBlock($format, $id) { - $api_call = sprintf("http://identi.ca/api/blocks/destroy/%d.%s", $id, $format); - return $this->APICall($api_call, true, true); - } - - /** - * Returns true or false in the requested format with a 200 OK HTTP status code. - * @param format is the extension for the result file (xml, json). - * @return test results. - */ - function test($format) { - $api_call = sprintf("http://identi.ca/api/help/test.%s", $format); - return $this->APICall($api_call, true); - } - - private function APICall($api_url, $require_credentials = false, $http_post = false) { - $curl_handle = curl_init(); - if($this->application_source){ - $api_url .= "&source=" . $this->application_source; - } - curl_setopt($curl_handle, CURLOPT_URL, $api_url); - if ($require_credentials) { - curl_setopt($curl_handle, CURLOPT_USERPWD, $this->credentials); - } - if ($http_post) { - curl_setopt($curl_handle, CURLOPT_POST, true); - } - curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE); - $identica_data = curl_exec($curl_handle); - $this->http_status = curl_getinfo($curl_handle, CURLINFO_HTTP_CODE); - $this->last_api_call = $api_url; - curl_close($curl_handle); - return $identica_data; - } - - function lastStatusCode() { - return $this->http_status; - } - - function lastAPICall() { - return $this->last_api_call; - } -} -?> diff --git a/src/ext/MimeMailParser.class.php b/src/ext/MimeMailParser.class.php deleted file mode 100644 index 0080199..0000000 --- a/src/ext/MimeMailParser.class.php +++ /dev/null @@ -1,447 +0,0 @@ -<?php
-
-require_once('MimeMailParser_attachment.class.php');
-
-/**
- * Fast Mime Mail parser Class using PHP's MailParse Extension
- * @author gabe@fijiwebdesign.com
- * @url http://www.fijiwebdesign.com/
- * @license http://creativecommons.org/licenses/by-sa/3.0/us/
- * @version $Id$
- */
-class MimeMailParser {
-
- /**
- * PHP MimeParser Resource ID
- */
- public $resource;
-
- /**
- * A file pointer to email
- */
- public $stream;
-
- /**
- * A text of an email
- */
- public $data;
-
- /**
- * Stream Resources for Attachments
- */
- public $attachment_streams;
-
- /**
- * Inialize some stuff
- * @return
- */
- public function __construct() {
- $this->attachment_streams = array();
- }
-
- /**
- * Free the held resouces
- * @return void
- */
- public function __destruct() {
- // clear the email file resource
- if (is_resource($this->stream)) {
- fclose($this->stream);
- }
- // clear the MailParse resource
- if (is_resource($this->resource)) {
- mailparse_msg_free($this->resource);
- }
- // remove attachment resources
- foreach($this->attachment_streams as $stream) {
- fclose($stream);
- }
- }
-
- /**
- * Set the file path we use to get the email text
- * @return Object MimeMailParser Instance
- * @param $mail_path Object
- */
- public function setPath($path) {
- // should parse message incrementally from file
- $this->resource = mailparse_msg_parse_file($path);
- $this->stream = fopen($path, 'r');
- $this->parse();
- return $this;
- }
-
- /**
- * Set the Stream resource we use to get the email text
- * @return Object MimeMailParser Instance
- * @param $stream Resource
- */
- public function setStream($stream) {
-
- // streams have to be cached to file first
- if (get_resource_type($stream) == 'stream') {
- $tmp_fp = tmpfile();
- if ($tmp_fp) {
- while(!feof($stream)) {
- fwrite($tmp_fp, fread($stream, 2028));
- }
- fseek($tmp_fp, 0);
- $this->stream =& $tmp_fp;
- } else {
- throw new Exception('Could not create temporary files for attachments. Your tmp directory may be unwritable by PHP.');
- return false;
- }
- fclose($stream);
- } else {
- $this->stream = $stream;
- }
-
- $this->resource = mailparse_msg_create();
- // parses the message incrementally low memory usage but slower
- while(!feof($this->stream)) {
- mailparse_msg_parse($this->resource, fread($this->stream, 2082));
- }
- $this->parse();
- return $this;
- }
-
- /**
- * Set the email text
- * @return Object MimeMailParser Instance
- * @param $data String
- */
- public function setText($data) {
- $this->resource = mailparse_msg_create();
- // does not parse incrementally, fast memory hog might explode
- mailparse_msg_parse($this->resource, $data);
- $this->data = $data;
- $this->parse();
- return $this;
- }
-
- /**
- * Parse the Message into parts
- * @return void
- * @private
- */
- private function parse() {
- $structure = mailparse_msg_get_structure($this->resource);
- $this->parts = array();
- foreach($structure as $part_id) {
- $part = mailparse_msg_get_part($this->resource, $part_id);
- $this->parts[$part_id] = mailparse_msg_get_part_data($part);
- }
- }
-
- /**
- * Retrieve the Email Headers
- * @return Array
- */
- public function getHeaders() {
- if (isset($this->parts[1])) {
- return $this->getPartHeaders($this->parts[1]);
- } else {
- throw new Exception('MimeMailParser::setPath() or MimeMailParser::setText() must be called before retrieving email headers.');
- }
- return false;
- }
- /**
- * Retrieve the raw Email Headers
- * @return string
- */
- public function getHeadersRaw() {
- if (isset($this->parts[1])) {
- return $this->getPartHeaderRaw($this->parts[1]);
- } else {
- throw new Exception('MimeMailParser::setPath() or MimeMailParser::setText() must be called before retrieving email headers.');
- }
- return false;
- }
-
- /**
- * Retrieve a specific Email Header
- * @return String
- * @param $name String Header name
- */
- public function getHeader($name) {
- if (isset($this->parts[1])) {
- $headers = $this->getPartHeaders($this->parts[1]);
- if (isset($headers[$name])) {
- return $headers[$name];
- }
- } else {
- throw new Exception('MimeMailParser::setPath() or MimeMailParser::setText() must be called before retrieving email headers.');
- }
- return false;
- }
-
- /**
- * Returns the part for the message body in the specified format
- * @return Part or False if not found
- * @param $type String[optional]
- */
- public function getMessageBodyPart($type = 'text') {
- $mime_types = array(
- 'text'=> 'text/plain',
- 'html'=> 'text/html'
- );
- $attachment_dispositions = array("attachment","inline");
- if (in_array($type, array_keys($mime_types))) {
- foreach($this->parts as $part) {
- $disposition = $this->getPartContentDisposition($part);
- $mime_type = $this->getPartContentType($part);
- if ( (!in_array($disposition, $attachment_dispositions)) &&
- ($mime_type == $mime_types[$type]) ) {
- return $part;
- }
- }
- } else {
- throw new Exception('Invalid type specified for MimeMailParser::getMessageBodyPart. "type" can either be text or html.');
- }
- return false;
- }
-
- /**
- * Returns the email message body in the specified format
- * @return Mixed String Body or False if not found
- * @param $type Object[optional]
- */
- public function getMessageBody($type = 'text') {
- $body = false;
- $part = $this->getMessageBodyPart($type);
- if ($part!==false) {
- $headers = $this->getPartHeaders($part);
- $body = $this->decode($this->getPartBody($part), array_key_exists('content-transfer-encoding', $headers) ? $headers['content-transfer-encoding'] : '');
- }
- return $body;
- }
-
- /**
- * get the headers for the message body part.
- * @return Array
- * @param $type Object[optional]
- */
- public function getMessageBodyHeaders($type = 'text') {
- $headers = false;
- $part = $this->getMessageBodyPart($type);
- if ($part!==false) {
- $headers = $this->getPartHeaders($part);
- }
- return $headers;
- }
-
-
- /**
- * Returns the attachments contents in order of appearance
- * @return Array
- * @param $type Object[optional]
- */
- public function getAttachments() {
- $attachments = array();
- $dispositions = array("attachment","inline");
- foreach($this->parts as $part) {
- $disposition = $this->getPartContentDisposition($part);
- if (in_array($disposition, $dispositions)) {
- $headers = $this->getPartHeaders($part);
- $attachments[] = new MimeMailParser_attachment(
- $part['disposition-filename'],
- $this->getPartContentType($part),
- $this->getAttachmentStream($part),
- $disposition,
- $headers
- );
- }
- }
- return $attachments;
- }
-
- /**
- * Return the Headers for a MIME part
- * @return Array
- * @param $part Array
- */
- private function getPartHeaders($part) {
- if (isset($part['headers'])) {
- return $part['headers'];
- }
- return false;
- }
-
- /**
- * Return a Specific Header for a MIME part
- * @return Array
- * @param $part Array
- * @param $header String Header Name
- */
- private function getPartHeader($part, $header) {
- if (isset($part['headers'][$header])) {
- return $part['headers'][$header];
- }
- return false;
- }
-
- /**
- * Return the ContentType of the MIME part
- * @return String
- * @param $part Array
- */
- private function getPartContentType($part) {
- if (isset($part['content-type'])) {
- return $part['content-type'];
- }
- return false;
- }
-
- /**
- * Return the Content Disposition
- * @return String
- * @param $part Array
- */
- private function getPartContentDisposition($part) {
- if (isset($part['content-disposition'])) {
- return $part['content-disposition'];
- }
- return false;
- }
-
- /**
- * Retrieve the raw Header of a MIME part
- * @return String
- * @param $part Object
- */
- private function getPartHeaderRaw(&$part) {
- $header = '';
- if ($this->stream) {
- $header = $this->getPartHeaderFromFile($part);
- } else if ($this->data) {
- $header = $this->getPartHeaderFromText($part);
- } else {
- throw new Exception('MimeMailParser::setPath() or MimeMailParser::setText() must be called before retrieving email parts.');
- }
- return $header;
- }
- /**
- * Retrieve the Body of a MIME part
- * @return String
- * @param $part Object
- */
- private function getPartBody(&$part) {
- $body = '';
- if ($this->stream) {
- $body = $this->getPartBodyFromFile($part);
- } else if ($this->data) {
- $body = $this->getPartBodyFromText($part);
- } else {
- throw new Exception('MimeMailParser::setPath() or MimeMailParser::setText() must be called before retrieving email parts.');
- }
- return $body;
- }
-
- /**
- * Retrieve the Header from a MIME part from file
- * @return String Mime Header Part
- * @param $part Array
- */
- private function getPartHeaderFromFile(&$part) {
- $start = $part['starting-pos'];
- $end = $part['starting-pos-body'];
- fseek($this->stream, $start, SEEK_SET);
- $header = fread($this->stream, $end-$start);
- return $header;
- }
- /**
- * Retrieve the Body from a MIME part from file
- * @return String Mime Body Part
- * @param $part Array
- */
- private function getPartBodyFromFile(&$part) {
- $start = $part['starting-pos-body'];
- $end = $part['ending-pos-body'];
- fseek($this->stream, $start, SEEK_SET);
- $body = fread($this->stream, $end-$start);
- return $body;
- }
-
- /**
- * Retrieve the Header from a MIME part from text
- * @return String Mime Header Part
- * @param $part Array
- */
- private function getPartHeaderFromText(&$part) {
- $start = $part['starting-pos'];
- $end = $part['starting-pos-body'];
- $header = substr($this->data, $start, $end-$start);
- return $header;
- }
- /**
- * Retrieve the Body from a MIME part from text
- * @return String Mime Body Part
- * @param $part Array
- */
- private function getPartBodyFromText(&$part) {
- $start = $part['starting-pos-body'];
- $end = $part['ending-pos-body'];
- $body = substr($this->data, $start, $end-$start);
- return $body;
- }
-
- /**
- * Read the attachment Body and save temporary file resource
- * @return String Mime Body Part
- * @param $part Array
- */
- private function getAttachmentStream(&$part) {
- $temp_fp = tmpfile();
-
- array_key_exists('content-transfer-encoding', $part['headers']) ? $encoding = $part['headers']['content-transfer-encoding'] : $encoding = '';
-
- if ($temp_fp) {
- if ($this->stream) {
- $start = $part['starting-pos-body'];
- $end = $part['ending-pos-body'];
- fseek($this->stream, $start, SEEK_SET);
- $len = $end-$start;
- $written = 0;
- $write = 2028;
- $body = '';
- while($written < $len) {
- if (($written+$write < $len )) {
- $write = $len - $written;
- }
- $part = fread($this->stream, $write);
- fwrite($temp_fp, $this->decode($part, $encoding));
- $written += $write;
- }
- } else if ($this->data) {
- $attachment = $this->decode($this->getPartBodyFromText($part), $encoding);
- fwrite($temp_fp, $attachment, strlen($attachment));
- }
- fseek($temp_fp, 0, SEEK_SET);
- } else {
- throw new Exception('Could not create temporary files for attachments. Your tmp directory may be unwritable by PHP.');
- return false;
- }
- return $temp_fp;
- }
-
-
- /**
- * Decode the string depending on encoding type.
- * @return String the decoded string.
- * @param $encodedString The string in its original encoded state.
- * @param $encodingType The encoding type from the Content-Transfer-Encoding header of the part.
- */
- private function decode($encodedString, $encodingType) {
- if (strtolower($encodingType) == 'base64') {
- return base64_decode($encodedString);
- } else if (strtolower($encodingType) == 'quoted-printable') {
- return quoted_printable_decode($encodedString);
- } else {
- return $encodedString;
- }
- }
-
-}
-
-
-?>
diff --git a/src/ext/MimeMailParser_attachment.class.php b/src/ext/MimeMailParser_attachment.class.php deleted file mode 100644 index 6bd327c..0000000 --- a/src/ext/MimeMailParser_attachment.class.php +++ /dev/null @@ -1,136 +0,0 @@ -<?php
-
-/**
- * Model of an Attachment
- */
-class MimeMailParser_attachment {
-
- /**
- * @var $filename Filename
- */
- public $filename;
- /**
- * @var $content_type Mime Type
- */
- public $content_type;
- /**
- * @var $content File Content
- */
- private $content;
- /**
- * @var $extension Filename extension
- */
- private $extension;
- /**
- * @var $content_disposition Content-Disposition (attachment or inline)
- */
- public $content_disposition;
- /**
- * @var $headers An Array of the attachment headers
- */
- public $headers;
-
- private $stream;
-
- public function __construct($filename, $content_type, $stream, $content_disposition, $headers) {
- $this->filename = $filename;
- $this->content_type = $content_type;
- $this->stream = $stream;
- $this->content = null;
- $this->content_disposition = $content_disposition;
- $this->headers = $headers;
- }
-
- /**
- * retrieve the attachment filename
- * @return String
- */
- public function getFilename() {
- return $this->filename;
- }
-
- /**
- * Retrieve the Attachment Content-Type
- * @return String
- */
- public function getContentType() {
- return $this->content_type;
- }
-
- /**
- * Retrieve the Attachment Content-Disposition
- * @return String
- */
- public function getContentDisposition() {
- return $this->content_disposition;
- }
-
- /**
- * Retrieve the Attachment Headers
- * @return String
- */
- public function getHeaders() {
- return $this->headers;
- }
-
- /**
- * Retrieve the file extension
- * @return String
- */
- public function getFileExtension() {
- if (!$this->extension) {
- $ext = substr(strrchr($this->filename, '.'), 1);
- if ($ext == 'gz') {
- // special case, tar.gz
- // todo: other special cases?
- $ext = preg_match("/\.tar\.gz$/i", $ext) ? 'tar.gz' : 'gz';
- }
- $this->extension = $ext;
- }
- return $this->extension;
- }
-
- /**
- * Read the contents a few bytes at a time until completed
- * Once read to completion, it always returns false
- * @return String
- * @param $bytes Int[optional]
- */
- public function read($bytes = 2082) {
- return feof($this->stream) ? false : fread($this->stream, $bytes);
- }
-
- /**
- * Retrieve the file content in one go
- * Once you retreive the content you cannot use MimeMailParser_attachment::read()
- * @return String
- */
- public function getContent() {
- if ($this->content === null) {
- fseek($this->stream, 0);
- while(($buf = $this->read()) !== false) {
- $this->content .= $buf;
- }
- }
- return $this->content;
- }
-
- /**
- * Allow the properties
- * MimeMailParser_attachment::$name,
- * MimeMailParser_attachment::$extension
- * to be retrieved as public properties
- * @param $name Object
- */
- public function __get($name) {
- if ($name == 'content') {
- return $this->getContent();
- } else if ($name == 'extension') {
- return $this->getFileExtension();
- }
- return null;
- }
-
-}
-
-?>
\ No newline at end of file diff --git a/src/ext/README.txt b/src/ext/README.txt deleted file mode 100644 index e5cb94a..0000000 --- a/src/ext/README.txt +++ /dev/null @@ -1,17 +0,0 @@ -These are class files that I've gathered from around the internet. - -I've renamed the files to follow a standard scheme. -(Could we get a standard scheme, please?) - -This is where each file came from: - -My Name : Original Name : From -GoogleVoice.class.php : class.googlevoice.php : https://code.google.com/p/phpgooglevoice/ -Identica.class.php : identica.lib.php : https://code.google.com/p/identica-php/ -MimeMailParser.class.php : MimeMailParser.class.php : https://code.google.com/p/php-mime-mail-parser/ -MimeMailParser_attachment.class.php : attachment.php : https://code.google.com/p/php-mime-mail-parser/ -PasswordHash.class.php : PasswordHash.php : http://www.openwall.com/phpass/ -recaptchalib.php : recaptchalib.php : https://code.google.com/p/recaptcha/ - -~ Luke Shumaker <lukeshu.ath.cx> -Happy Hacking! 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); - } - } - } - } - -} diff --git a/src/views/pages/messages/401.html.php b/src/views/pages/messages/401.html.php deleted file mode 100644 index 0b24f80..0000000 --- a/src/views/pages/messages/401.html.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php global $VARS; -$t = $VARS['template']; - -$t->status('401 Unauthorized'); -$t->header('Unauthorized'); -$t->tag('h1', array(), "401: Unauthorized"); -if ($VARS['uid']===false) { - // Not logged in - $t->paragraph('You need to be logged in to view messages.'); -} else { - // Logged in, so the account must not activated - $t->paragraph('Your account needs to be activated by an administrator '. - 'to view messages.'); -} -$t->footer(); diff --git a/src/views/pages/messages/frame.html.php b/src/views/pages/messages/frame.html.php deleted file mode 100644 index e64bc2f..0000000 --- a/src/views/pages/messages/frame.html.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php global $VARS; -$t = $VARS['template']; -$msg_id = $VARS['msg_id']; -$parser = $VARS['parser']; -$msgdir = $VARS['msgdir']; - -function messageLink($id) { - if (is_array($id)) { $id = $id[1]; } - global $VARS; $t = $VARS['template']; $msgdir = $VARS['msgdir']; - $exists = is_file("$msgdir/$id"); - $class = - $id = htmlentities($id); - return sprintf('<<a href="%1$s"%2$s>%3$s</a>>', - $t->url("messages/$id/"), - ($exists?'':' class="http404"'), - $id); -} -function parseMessageIDs($string) { - $base = $_SERVER['REQUEST_URL']; - $html = preg_replace_callback( - '/<([^>]*)>/', - 'messageLink', - $string); - return $html; -} - -$t->header('View Message'); -$t->openTag('table'); -$t->row(array('To:' , htmlentities( $parser->getHeader('to' )))); -$t->row(array('From:' , htmlentities( $parser->getHeader('from' )))); -$t->row(array('Subject:' , htmlentities( $parser->getHeader('subject' )))); -$t->row(array('In-Reply-to:', parseMessageIDs($parser->getHeader('in-reply-to')))); -$t->row(array('References:' , parseMessageIDs($parser->getHeader('references' )))); -$t->closeTag('table'); - -$t->openTag('div', array('class'=>'message-body')); -if ($parser->getMessageBodyPart('html')!==false) { - $t->tag('h2', array(), 'HTML'); - $t->tag('iframe', array('src'=>$t->url("messages/$msg_id/body.html")), ''); -} -if ($parser->getMessageBodyPart('text')!==false) { - $t->tag('h2', array(), 'Plain Text'); - $t->tag('iframe', array('src'=>$t->url("messages/$msg_id/body.txt")), ''); -} -$t->closeTag('div'); -$t->tag('h2', array(), 'Attachments'); -$t->openTag('table'); -$attachments = $parser->getAttachments(); -foreach ($attachments as $id => $attachment) { - $t->row(array( - htmlentities($attachment->getContentType()), - $t->link($t->url("$msg_id/attachment/$id"), - htmlentities($attachment->getFilename())), - )); -} -$t->closeTag('table'); -$t->footer(); diff --git a/src/views/pages/messages/index.html.php b/src/views/pages/messages/index.html.php deleted file mode 100644 index 111b6c6..0000000 --- a/src/views/pages/messages/index.html.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php global $VARS; -$t = $VARS['template']; -$messages = $VARS['messages']; - -$t->header('Message Index'); -$t->tag('h1', array(), "Message Index"); - -$t->openTag('table'); -$t->row(array('From','Subject', 'Date')); -foreach ($messages as $date => $message_array) { - foreach ($message_array as $message) { - $url = $t->url('messages/'.$message['id'].'/'); - $subject = htmlentities($message['subject']); - $from = htmlentities($message['from']); - $date_str = str_replace(' ', ' ', date('Y-m-d H:i:s',$date)); - $t->row(array( - $t->link($url, $from , true), - $t->link($url, $subject , true), - $t->link($url, $date_str, true), - )); - } -} -$t->closeTag('table'); - -$t->footer(); |