summaryrefslogtreecommitdiff
path: root/src/controllers
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2011-10-27 19:51:48 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2011-10-27 19:51:48 -0400
commit2d7a47a99be783c1933af0b24978dc2bbdfe9350 (patch)
tree8eefffd8cf1f3db2ce6efcb8e50846c943e6df61 /src/controllers
parentdb4376c0c1d5d2ea72696e6d73b469cb2dc30b91 (diff)
parent29a3ffb99435827d5a7ea6886ac22bd2ee18d593 (diff)
Merge branch 'master' into multiuser-viewmultiuser-view
Conflicts: src/controllers/Users.class.php
Diffstat (limited to 'src/controllers')
-rw-r--r--src/controllers/AuthPage.class.php4
-rw-r--r--src/controllers/Config.class.php2
-rw-r--r--src/controllers/Messages.class.php3
-rw-r--r--src/controllers/Plugins.class.php9
-rw-r--r--src/controllers/Users.class.php33
5 files changed, 26 insertions, 25 deletions
diff --git a/src/controllers/AuthPage.class.php b/src/controllers/AuthPage.class.php
index b31d938..1f46f72 100644
--- a/src/controllers/AuthPage.class.php
+++ b/src/controllers/AuthPage.class.php
@@ -1,5 +1,6 @@
<?php
require_once('Login.class.php');
+require_once('Auth.class.php');
Router::register('auth', 'AuthPage');
@@ -41,12 +42,11 @@ class AuthPage extends Controller {
$this->showView('auth/logout');
}
private function maybe_login() {
- global $mm;
$uid = Login::isLoggedIn();
if ($uid===false) {
$this->login();
} else {
- $username = $mm->database()->getUsername($uid);
+ $username = Auth::getInstance($uid)->getName();
$this->showView('auth/index',
array('username'=>$username));
}
diff --git a/src/controllers/Config.class.php b/src/controllers/Config.class.php
index 37d1f09..dc6a884 100644
--- a/src/controllers/Config.class.php
+++ b/src/controllers/Config.class.php
@@ -6,7 +6,7 @@ Router::register('config', 'Config', 'index');
class Config extends Controller {
public function index($routed, $remainder) {
$uid = Login::isLoggedIn();
- if ($uid===false || !Auth::getObj($uid)->isAdmin()) {
+ if ($uid===false || !Auth::getInstance($uid)->isAdmin()) {
$this->http401($routed, $remainder);
return;
}
diff --git a/src/controllers/Messages.class.php b/src/controllers/Messages.class.php
index d28d968..717e18e 100644
--- a/src/controllers/Messages.class.php
+++ b/src/controllers/Messages.class.php
@@ -1,5 +1,6 @@
<?php
require_once('Login.class.php');
+require_once('Auth.class.php');
Router::register('messages', 'Messages', 'index');
Router::register('messages/index', 'Messages', 'index');
@@ -41,7 +42,7 @@ class Messages extends Controller {
public function message($routed, $remainder) {
$uid = Login::isLoggedIn();
- if ($uid===false || !Auth::getObj($uid)->isUser()) {
+ if ($uid===false || !Auth::getInstance($uid)->isUser()) {
$this->http401($routed, $remainder);
return;
}
diff --git a/src/controllers/Plugins.class.php b/src/controllers/Plugins.class.php
index e2b500c..2ed6e7a 100644
--- a/src/controllers/Plugins.class.php
+++ b/src/controllers/Plugins.class.php
@@ -2,13 +2,15 @@
require_once('Login.class.php');
require_once('Plugin.class.php');
require_once('PluginManager.class.php');
+require_once('Auth.class.php');
+require_once('Database.class.php');
Router::register('plugins', 'Plugins');
class Plugins extends Controller {
public function index($routed, $remainder) {
$uid = Login::isLoggedIn();
- if ($uid===false || !Auth::getObj($uid)->isAdmin()) {
+ if ($uid===false || !Auth::getInstance($uid)->isAdmin()) {
$this->http401($routed, $remainder);
return;
}
@@ -25,8 +27,7 @@ class Plugins extends Controller {
}
private function update() {
- global $mm;
- $db = $mm->database();
+ $db = Database::getInstance();
if (isset($_POST['plugins'])) {
$string = $db->arrayToValue($_POST['plugins']);
@@ -45,7 +46,7 @@ class Plugins extends Controller {
}
private function show_index() {
- global $mm; $pm = $mm->pluginManager();
+ $pm = PluginManager::getInstance();
$all_plugins = $pm->listPlugins();
$enabled_plugins = $pm->getActivePlugins();
diff --git a/src/controllers/Users.class.php b/src/controllers/Users.class.php
index a1ad2fe..b75848f 100644
--- a/src/controllers/Users.class.php
+++ b/src/controllers/Users.class.php
@@ -2,6 +2,8 @@
require_once('Login.class.php');
require_once('Auth.class.php');
require_once('DB.class.php');
+require_once('PluginManager.class.php');
+require_once('Database.class.php');
Router::register('users/new' , 'Users', 'new_user');
Router::register('users/index', 'Users', 'index_file');
@@ -73,9 +75,8 @@ class Users extends Controller {
}
if (!isset($vars['errors'])) $vars['errors'] = array();
- global $mm;
- $pm = $mm->pluginManager();
- $db = $mm->database();
+ $db = Database::getInstance();
+ $pm = PluginManager::getInstance();
$vars['antispam_html'] = $pm->callHook('antispam_html');
$vars['userlist'] = $db->getSysConf('anon_userlist');
@@ -83,9 +84,8 @@ class Users extends Controller {
}
public function individual($routed, $remainder) {
- global $mm; // also used for pluginmanager
- $db = $mm->database();
- $pm = $mm->pluginManager();
+ $db = Database::getInstance();
+ $pm = PluginManager::getInstance();
$usernames = implode('/', $remainder);
$uids = array();
@@ -100,7 +100,7 @@ class Users extends Controller {
$vars = array();
if (count($uids)<2) {
- $user = Auth::getObj($uids[0]);
+ $user = Auth::getInstance($uids[0]);
if ($user->isGroup()) $uid = false; // ignore groups.
@@ -130,7 +130,7 @@ class Users extends Controller {
$vars['users'] = array();
foreach ($uids as $uid) {
- $vars['users'][] = Auth::getObj($uid);
+ $vars['users'][] = Auth::getInstance($uid);
}
$vars['usernames'] = $usernames;
$vars['config_options'] = $config_options;
@@ -158,9 +158,8 @@ class Users extends Controller {
* explained.
*/
private function create_user() {
- global $mm;
- $db = $mm->database();
- $pm = $mm->pluginManager();
+ $db = Database::getInstance();
+ $pm = PluginManager::getInstance();
$vars = array();
@$vars['username' ] = $_POST['auth_name'];
@@ -241,8 +240,8 @@ class Users extends Controller {
// Change information //////////////////////////////////////////
$config_options = array();
- global $mm;
- $mm->pluginManager()->callHook('userConfig', &$config_options);
+ $pm = PluginManager::getInstance();
+ $pm->callHook('userConfig', &$config_options);
foreach ($config_options as $group=>$options) {
foreach ($options as $option) {
@@ -314,9 +313,9 @@ class Users extends Controller {
* This will show the user index.
*/
private function show_index($routed, $remainder) {
- global $mm; $db = $mm->database();
+ $db = Database::getInstance();
- $logged_in_user = Auth::getObj(Login::isLoggedIn());
+ $logged_in_user = Auth::getInstance(Login::isLoggedIn());
$anon_userlist = $db->getSysConf('anon_userlist')=='true';
if (!$anon_userlist && !$logged_in_user->isUser()) {
$this->http401($routed, $remainder);
@@ -342,7 +341,7 @@ class Users extends Controller {
return array('key'=>$key, 'name'=>$name, 'type'=>$type);
}
private function getIndexAttribs() {
- $user = Auth::getObj(Login::isLoggedIn());
+ $user = Auth::getInstance(Login::isLoggedIn());
$attribs = array();
$attribs[] = $this->attrib('auth_uid', 'UID');
@@ -364,7 +363,7 @@ class Users extends Controller {
}
private function registrationOpen() {
- global $mm; $db = $mm->database();
+ $db = Database::getInstance();
$val = $db->getSysConf('registration_open');
switch ($val) {
case 'true': return true;