summaryrefslogtreecommitdiff
path: root/src/lib/MessageManager.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/MessageManager.class.php')
-rw-r--r--src/lib/MessageManager.class.php85
1 files changed, 0 insertions, 85 deletions
diff --git a/src/lib/MessageManager.class.php b/src/lib/MessageManager.class.php
deleted file mode 100644
index d327eb7..0000000
--- a/src/lib/MessageManager.class.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-
-class MessageManager {
- private $conf;
- private $base;
-
- private $users = array();
-
- private $database;
- private $pw_hasher;
- private $template;
- private $pluginManager;
-
- public function __construct($conf_file) {
- $this->conf = $conf_file;
- if (!file_exists($this->conf)) {
- $this->base = $_SERVER['REQUEST_URI'];
- $t = $this->template();
- $t->header('Message Manager');
- $t->paragraph(
- 'Awe shiz, dude, conf.php doesn\'t exist, you '.
- 'need to go through the '.
- '<a href="installer">installer</a>.');
- $t->footer();
- exit();
- }
- session_start();
- }
-
- // Load Things
-
- public function database() {
- if (!isset($this->database)) {
- require_once('Database.class.php');
- $this->database = new Database($this->conf);
- }
- return $this->database;
- }
-
- public function hasher() {
- if (!isset($this->pw_hasher)) {
- require_once('PasswordHash.class.php');
- $this->pw_hasher = new PasswordHash(8, false);
- }
- return $this->pw_hasher;
- }
-
- public function template() {
- if (!isset($this->template)) {
- require_once(VIEWPATH.'/Template.class.php');
- $this->template = new Template($this->baseUrl(), $this);
- }
- return $this->template;
- }
-
- public function pluginManager() {
- if (!isset($this->pluginManager)) {
- require_once('PluginManager.class.php');
- $this->pluginManager = new PluginManager();
- }
- return $this->pluginManager;
- }
-
- // Utility functions
-
- public function shortUrl($longUrl) {
- $ch = curl_init('http://ur1.ca');
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFILEDS,
- 'longurl='.urlencode($longUrl));
- $html = curl_exec();
- preg_match('/Your ur1 is: <a href="([^"]*)">/',$html,$matches);
- $shortUrl = $matches[1];
- curl_close($ch);
- return $shortUrl;
- }
-
- public function baseUrl() {
- if (!isset($this->base)) {
- $this->base = $this->database()->getSysConf('baseurl');
- }
- return $this->base;
- }
-}