From: Michael M Slusarz Date: Wed, 20 Jan 2010 16:45:50 +0000 (-0700) Subject: Fully convert agora to Horde_Registry_Application X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=9ee10e5ccece8d846040d1de7e898f1a8578c78f;p=horde.git Fully convert agora to Horde_Registry_Application Remove extra ws; fix some mode issues; autoloading. --- diff --git a/agora/README b/agora/README old mode 100755 new mode 100644 diff --git a/agora/ban.php b/agora/ban.php index 94098955c..ecb9e2b84 100644 --- a/agora/ban.php +++ b/agora/ban.php @@ -8,10 +8,8 @@ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. */ -define('AGORA_BASE', dirname(__FILE__)); -require_once AGORA_BASE . '/lib/base.php'; -require_once AGORA_BASE . '/lib/Messages.php'; - +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('agora'); /* Make sure we have a forum id. */ list($forum_id, , $scope) = Agora::getAgoraId(); diff --git a/agora/config/.htaccess b/agora/config/.htaccess old mode 100755 new mode 100644 diff --git a/agora/config/conf.xml b/agora/config/conf.xml old mode 100755 new mode 100644 diff --git a/agora/config/menu.php.dist b/agora/config/menu.php.dist old mode 100755 new mode 100644 diff --git a/agora/config/prefs.php.dist b/agora/config/prefs.php.dist old mode 100755 new mode 100644 diff --git a/agora/deleteforum.php b/agora/deleteforum.php index 88c98dc3d..e796b116b 100644 --- a/agora/deleteforum.php +++ b/agora/deleteforum.php @@ -11,8 +11,8 @@ * @author Marko Djukic */ -define('AGORA_BASE', dirname(__FILE__)); -require_once AGORA_BASE . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('agora'); /* Set up the forums object. */ $scope = Horde_Util::getFormData('scope', 'agora'); diff --git a/agora/docs/CREDITS b/agora/docs/CREDITS old mode 100755 new mode 100644 diff --git a/agora/docs/INSTALL b/agora/docs/INSTALL old mode 100755 new mode 100644 diff --git a/agora/docs/TODO b/agora/docs/TODO old mode 100755 new mode 100644 diff --git a/agora/editforum.php b/agora/editforum.php index 65c0408bd..7ee0e2081 100644 --- a/agora/editforum.php +++ b/agora/editforum.php @@ -10,10 +10,8 @@ * @author Marko Djukic */ -define('AGORA_BASE', dirname(__FILE__)); -require_once AGORA_BASE . '/lib/base.php'; -require_once AGORA_BASE . '/lib/Forms/Forum.php'; - +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('agora'); /* Set up the forums object. */ $forums = &Agora_Messages::singleton(); diff --git a/agora/forums.php b/agora/forums.php index 9d62ef55b..f9113fa90 100644 --- a/agora/forums.php +++ b/agora/forums.php @@ -11,7 +11,8 @@ * @author Marko Djukic */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('agora'); /* Set up the forums object. */ $scope = Horde_Util::getGet('scope', 'agora'); diff --git a/agora/index.php b/agora/index.php old mode 100755 new mode 100644 diff --git a/agora/lib/.htaccess b/agora/lib/.htaccess old mode 100755 new mode 100644 diff --git a/agora/lib/Agora.php b/agora/lib/Agora.php index d3c36a800..abc315347 100644 --- a/agora/lib/Agora.php +++ b/agora/lib/Agora.php @@ -226,7 +226,6 @@ class Agora { return PEAR::raiseError(_("The VFS backend needs to be configured to enable attachment uploads.")); } - require_once 'VFS.php'; return VFS::singleton($conf['vfs']['type'], Horde::getDriverConfig('vfs')); } @@ -377,7 +376,7 @@ class Agora { * * @param int $message_id Identifier of message to be distributed * - * @return mixed Boolean true on success; PEAR_Error on failure + * @throws Horde_Mime_Exception */ function distribute($message_id) { @@ -388,15 +387,10 @@ class Agora { $forum = $storage->getForum($message['forum_id']); if (empty($forum['forum_distribution_address'])) { - return false; + return; } - require_once 'Mail.php'; - require_once 'Horde/MIME.php'; - require_once 'Horde/MIME/Headers.php'; - require_once 'Horde/MIME/Message.php'; - - $msg_headers = new MIME_Headers(); + $msg_headers = new Horde_Mime_Headers(); $msg_headers->addMessageIdHeader(); $msg_headers->addAgentHeader(); $msg_headers->addHeader('Date', date('r')); @@ -406,14 +400,11 @@ class Agora { $msg_headers->addHeader('From', $message['message_author']); $msg_headers->addHeader('Subject', '[' . $forum['forum_name'] . '] ' . $message['message_subject']); - $mime = new MIME_Message(); - $body = new MIME_Part('text/plain', $message['body'], - Horde_Nls::getCharset()); - $mime->addPart($body); - $msg_headers->addMIMEHeaders($mime); - $result = $mime->send($forum['forum_distribution_address'], $msg_headers, $conf['mailer']['type'], $conf['mailer']['params']); - if (is_a($result, 'PEAR_Error')) { - Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR); - } + $body = new Horde_Mime_Part(); + $body->setType('text/plain'); + $body->setCharset(Horde_Nls::getCharset()); + $body->setContents($message['body']); + + $body->send($forum['forum_distribution_address'], $msg_headers, $conf['mailer']['type'], $conf['mailer']['params']); } } diff --git a/agora/lib/Api.php b/agora/lib/Api.php index 6b35e2cf2..88070cbef 100644 --- a/agora/lib/Api.php +++ b/agora/lib/Api.php @@ -28,8 +28,6 @@ class Agora_Api extends Horde_Registry_Api */ public function listForums($forum_id = 0, $scope = null) { - require_once dirname(__FILE__) . '/base.php'; - $forums = &Agora_Messages::singleton($scope); return $forums->getForums($forum_id, true, 'forum_name', 0, isset($scope)); } @@ -44,8 +42,6 @@ class Agora_Api extends Horde_Registry_Api */ public function getForumName($scope, $forum_id) { - require_once dirname(__FILE__) . '/base.php'; - $forums = &Agora_Messages::singleton($scope); $forum = $forums->getForum($forum_id); if ($forum instanceof PEAR_Error) { @@ -67,8 +63,6 @@ class Agora_Api extends Horde_Registry_Api */ public function saveForum($scope, $parent, $info) { - require_once dirname(__FILE__) . '/base.php'; - $forums = &Agora_Messages::singleton($scope); $forum_info = $this->prepareFormData($scope, $parent, $info); if ($forum_info instanceof PEAR_Error) { @@ -89,8 +83,6 @@ class Agora_Api extends Horde_Registry_Api */ public function deleteForum($scope, $forum_name) { - require_once dirname(__FILE__) . '/base.php'; - $forums = &Agora_Messages::singleton($scope); $id = $forums->getForumId($forum_name); if ($id instanceof PEAR_Error) { @@ -128,8 +120,6 @@ class Agora_Api extends Horde_Registry_Api public function getThreads($forum_name, $sort_by = 'message_timestamp', $sort_dir = 0, $bodies = false, $scope = 'agora', $base_url = null, $from = 0, $count = 0) { - require_once dirname(__FILE__) . '/base.php'; - $forums = &Agora_Messages::singleton($scope); if (empty($forum_name)) { return $forums->getThreads(0, false, $sort_by, $sort_dir, true, '', $base_url, $from, $count); @@ -168,8 +158,6 @@ class Agora_Api extends Horde_Registry_Api public function getThreadsBatch($forum_names, $sort_by = 'message_timestamp', $sort_dir = 0, $bodies = false, $scope = 'agora', $base_url = null, $from = 0, $count = 0) { - require_once dirname(__FILE__) . '/base.php'; - $results = array(); $forums = &Agora_Messages::singleton($scope); $results = array(); @@ -207,8 +195,6 @@ class Agora_Api extends Horde_Registry_Api public function getThreadsByForumOwner($owner, $sort_by = 'message_timestamp', $sort_dir = 0, $bodies = false, $scope = 'agora', $from = 0, $count = 0) { - require_once dirname(__FILE__) . '/base.php'; - $forums = &Agora_Messages::singleton($scope); return $forums->getThreadsByForumOwner($owner, 0, true, $sort_by, $sort_dir, true, $from, $count); @@ -227,8 +213,6 @@ class Agora_Api extends Horde_Registry_Api */ public function numMessages($forum_name, $scope = 'agora', $thread_id = null) { - require_once dirname(__FILE__) . '/base.php'; - $forums = &Agora_Messages::singleton($scope); if (($forum_id = $forums->getForumId($forum_name)) instanceof PEAR_Error) { @@ -259,8 +243,6 @@ class Agora_Api extends Horde_Registry_Api */ public function numMessagesBatch($forum_name, $scope = 'agora', $thread_id = null) { - require_once dirname(__FILE__) . '/base.php'; - $forums = &Agora_Messages::singleton($scope); if ($forums instanceof PEAR_Error) { return $forums; @@ -367,8 +349,6 @@ class Agora_Api extends Horde_Registry_Api return ''; } - require_once dirname(__FILE__) . '/base.php'; - /* Check if the forum exists and fetch the ID, or create a new one. */ $forums = &Agora_Messages::singleton($scope); if (($params['forum_id'] = $forums->getForumId($forum_name)) instanceof PEAR_Error) { @@ -435,8 +415,6 @@ class Agora_Api extends Horde_Registry_Api return ''; } - require_once dirname(__FILE__) . '/base.php'; - /* Create a separate notification queue. */ $queue = Horde_Notification::singleton('agoraPostMessage'); $queue->attach('status'); @@ -582,8 +560,6 @@ class Agora_Api extends Horde_Registry_Api return ''; } - require_once dirname(__FILE__) . '/base.php'; - /* Create a separate notification queue. */ $queue = Horde_Notification::singleton('agoraRemoveMessage'); $queue->attach('status'); @@ -673,8 +649,6 @@ class Agora_Api extends Horde_Registry_Api $base_url = null, $url = null, $variables = null, $template_file = false) { - require_once dirname(__FILE__) . '/base.php'; - if (is_null($base_url)) { $base_url = Horde::selfUrl(true); } @@ -738,8 +712,6 @@ class Agora_Api extends Horde_Registry_Api */ public function prepareFormData($scope, $parent = false, $info = array(), $callback = null) { - require_once dirname(__FILE__) . '/base.php'; - $forums = &Agora_Messages::singleton($scope); if ($parent) { @@ -810,8 +782,6 @@ class Agora_Api extends Horde_Registry_Api { global $notification, $prefs, $registry; - require_once dirname(__FILE__) . '/base.php'; - $api_call = true; return require AGORA_BASE . '/moderate.php'; diff --git a/agora/lib/Application.php b/agora/lib/Application.php index 58cf5f55f..92dbf8485 100644 --- a/agora/lib/Application.php +++ b/agora/lib/Application.php @@ -2,8 +2,8 @@ /** * Agora external API interface. * - * This file defines Agora's external API interface. Other - * applications can interact with Agora through this API. + * This file defines Horde's core API interface. Other core Horde libraries + * can interact with Agora through this API. * * Copyright 2003-2010 The Horde Project (http://www.horde.org/) * @@ -15,31 +15,57 @@ * @package Agora */ +/* Determine the base directories. */ +if (!defined('AGORA_BASE')) { + define('AGORA_BASE', dirname(__FILE__) . '/..'); +} + +if (!defined('HORDE_BASE')) { + /* If Horde does not live directly under the app directory, the HORDE_BASE + * constant should be defined in config/horde.local.php. */ + if (file_exists(AGORA_BASE . '/config/horde.local.php')) { + include AGORA_BASE . '/config/horde.local.php'; + } else { + define('HORDE_BASE', AGORA_BASE . '/..'); + } +} + +/* Load the Horde Framework core (needed to autoload + * Horde_Registry_Application::). */ +require_once HORDE_BASE . '/lib/core.php'; + class Agora_Application extends Horde_Registry_Application { + /** + * The application's version. + * + * @var string + */ public $version = 'H4 (1.0-git)'; /** + * TODO + */ + static protected $_perms = array(); + + /** * Returns a list of available permissions. * * @return array An array describing all available permissions. */ public function perms() { - static $perms = array(); - if (!empty($perms)) { - return $perms; + if (!empty(self::$_perms)) { + return self::$_perms; } - require_once dirname(__FILE__) . '/base.php'; - - $perms['tree']['agora']['admin'] = true; - $perms['title']['agora:admin'] = _("Admin"); - $perms['title']['agora:forums'] = _("Forums"); + self::$_perms['tree']['agora']['admin'] = true; + self::$_perms['title']['agora:admin'] = _("Admin"); + self::$_perms['title']['agora:forums'] = _("Forums"); foreach ($GLOBALS['registry']->listApps() as $scope) { - $perms['title']['agora:forums:' . $scope] = $GLOBALS['registry']->get('name', $scope); - $perms['tree']['agora']['forums'][$scope] = false; + self::$_perms['title']['agora:forums:' . $scope] = $GLOBALS['registry']->get('name', $scope); + self::$_perms['tree']['agora']['forums'][$scope] = false; $forums = &Agora_Messages::singleton($scope); $forums_list = $forums->getBareForums(); @@ -48,13 +74,13 @@ class Agora_Application extends Horde_Registry_Application } foreach ($forums_list as $id => $title) { - $perms['tree']['agora']['forums'][$scope][$id] = false; - $perms['title']['agora:forums:' . $scope . ':' . $id] = $title; + self::$_perms['tree']['agora']['forums'][$scope][$id] = false; + self::$_perms['title']['agora:forums:' . $scope . ':' . $id] = $title; } } - return $perms; + return self::$_perms; } /** @@ -66,4 +92,5 @@ class Agora_Application extends Horde_Registry_Application { return Agora::getMenu(); } + } diff --git a/agora/lib/Block/forums.php b/agora/lib/Block/forums.php index cab5c02a5..e6b1caa18 100644 --- a/agora/lib/Block/forums.php +++ b/agora/lib/Block/forums.php @@ -42,8 +42,6 @@ class Horde_Block_agora_forums extends Horde_Block { { global $registry; - require_once dirname(__FILE__) . '/../base.php'; - /* Set up the forums object. */ $forums = array(Agora_Messages::singleton()); if (Horde_Auth::isAdmin()) { diff --git a/agora/lib/Block/thread.php b/agora/lib/Block/thread.php index 0e982ac43..52d5e8912 100644 --- a/agora/lib/Block/thread.php +++ b/agora/lib/Block/thread.php @@ -22,8 +22,6 @@ class Horde_Block_agora_thread extends Horde_Block { function _params() { - require_once dirname(__FILE__) . '/../base.php'; - $forumOb = &Agora_Messages::singleton(); $forums_list = $forumOb->getForums(0, true, 'forum_name', 0, true); @@ -57,8 +55,6 @@ class Horde_Block_agora_thread extends Horde_Block { return ''; } - require_once dirname(__FILE__) . '/../base.php'; - /* Set up the message object. */ list($forum_id, $message_id) = explode('.', $this->_params['thread_id']); $messages = &Agora_Messages::singleton('agora', $forum_id); diff --git a/agora/lib/Block/threads.php b/agora/lib/Block/threads.php index 94e892130..2c8b168c2 100644 --- a/agora/lib/Block/threads.php +++ b/agora/lib/Block/threads.php @@ -34,8 +34,6 @@ class Horde_Block_agora_threads extends Horde_Block { */ function _params() { - require_once dirname(__FILE__) . '/../base.php'; - $forums = Agora_Messages::singleton(); /* Get the list of forums to display. */ @@ -62,8 +60,6 @@ class Horde_Block_agora_threads extends Horde_Block { */ function _title() { - require_once dirname(__FILE__) . '/../base.php'; - if (!isset($this->_params['forum_id'])) { return _("Threads"); } @@ -89,8 +85,6 @@ class Horde_Block_agora_threads extends Horde_Block { */ function _content() { - require_once dirname(__FILE__) . '/../base.php'; - if (!isset($this->_params['forum_id'])) { return _("No forum selected"); } diff --git a/agora/lib/Messages.php b/agora/lib/Messages.php index 88fa2b3a8..0f23255e3 100644 --- a/agora/lib/Messages.php +++ b/agora/lib/Messages.php @@ -1644,14 +1644,6 @@ class Agora_Messages { return $files; } - global $mime_drivers, $mime_drivers_map; - $result = Horde::loadConfiguration('mime_drivers.php', array('mime_drivers', 'mime_drivers_map'), 'horde'); - extract($result); - require_once 'Horde/MIME/Part.php'; - require_once 'Horde/MIME/Viewer.php'; - require_once 'Horde/MIME/Magic.php'; - require_once 'Horde/MIME/Contents.php'; - /* Make sure we have the tooltips javascript. */ Horde::addScriptFile('tooltips.js', 'horde', true); @@ -1659,7 +1651,7 @@ class Agora_Messages { $html = '
'; $view_url = Horde::applicationUrl('view.php'); foreach ($files as $file_id => $file) { - $mime_icon = MIME_Viewer::getIcon($file['file_type']); + $mime_icon = Horde_Mime_Viewer::getIcon($file['file_type']); $title = _("download") . ': ' . $file['file_name']; $tooltip = $title . "\n" . sprintf(_("size: %s"), $this->formatSize($file['file_size'])) . "\n" . sprintf(_("type: %s"), $file['file_type']); $url = Horde_Util::addParameter($view_url, array('forum_id' => $this->_forum_id, @@ -2236,8 +2228,6 @@ class Agora_Messages { */ private function _connect() { - require_once 'MDB2.php'; - $this->_params = Horde::getDriverConfig('storage', 'sql'); Horde::assertDriverConfig($this->_params, 'storage', array('phptype', 'charset')); diff --git a/agora/lib/base.php b/agora/lib/base.php deleted file mode 100644 index 7cd01da37..000000000 --- a/agora/lib/base.php +++ /dev/null @@ -1,46 +0,0 @@ -pushApp('agora'); -} catch (Horde_Exception $e) { - Horde_Auth::authenticateFailure('agora', $e); -} -$conf = &$GLOBALS['conf']; -define('AGORA_TEMPLATES', $registry->get('templates')); - -// Notification system. -$notification = Horde_Notification::singleton(); -$notification->attach('status'); - -/* Agora base library. */ -if (!defined('AGORA_BASE')) { - define('AGORA_BASE', dirname(__FILE__) . '/..'); -} - -require_once AGORA_BASE . '/lib/Agora.php'; -require_once AGORA_BASE . '/lib/Messages.php'; -require_once AGORA_BASE . '/lib/View.php'; - -// Start compression. -if (!Horde_Util::nonInputVar('no_compress')) { - Horde::compressOutput(); -} diff --git a/agora/messages/abuse.php b/agora/messages/abuse.php index 4d93765eb..111527e96 100644 --- a/agora/messages/abuse.php +++ b/agora/messages/abuse.php @@ -8,9 +8,8 @@ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. */ -define('AGORA_BASE', dirname(__FILE__) . '/..'); -require_once AGORA_BASE . '/lib/base.php'; -require_once AGORA_BASE . '/lib/Messages.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('agora'); /* Set up the messages object. */ list($forum_id, $message_id, $scope) = Agora::getAgoraId(); @@ -56,10 +55,9 @@ if ($form->validate()) { } /* Collect moderators emails, and send them the notify */ - require_once 'Horde/Identity.php'; $emails = array(); foreach ($forum['moderators'] as $moderator) { - $identity = &Identity::singleton('none', $moderator); + $identity = Horde_Prefs_Identity::singleton('none', $moderator); $address = $identity->getValue('from_addr'); if (!empty($address)) { $emails[] = $address; diff --git a/agora/messages/delete.php b/agora/messages/delete.php index 5e8dbfed7..9985b5900 100644 --- a/agora/messages/delete.php +++ b/agora/messages/delete.php @@ -10,9 +10,8 @@ * @author Marko Djukic */ -define('AGORA_BASE', dirname(__FILE__) . '/..'); -require_once AGORA_BASE . '/lib/base.php'; -require_once AGORA_BASE . '/lib/Messages.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('agora'); /* Set up the messages object. */ list($forum_id, $message_id, $scope) = Agora::getAgoraId(); diff --git a/agora/messages/edit.php b/agora/messages/edit.php index 3b6278174..39bc68099 100644 --- a/agora/messages/edit.php +++ b/agora/messages/edit.php @@ -11,9 +11,8 @@ * @author Marko Djukic */ -define('AGORA_BASE', dirname(__FILE__) . '/..'); -require_once AGORA_BASE . '/lib/base.php'; -require_once AGORA_BASE . '/lib/Messages.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('agora'); list($forum_id, $message_id, $scope) = Agora::getAgoraId(); $message_parent_id = Horde_Util::getFormData('message_parent_id'); diff --git a/agora/messages/index.php b/agora/messages/index.php index 24c4218b3..16d63bba6 100644 --- a/agora/messages/index.php +++ b/agora/messages/index.php @@ -10,10 +10,8 @@ * @author Marko Djukic */ -define('AGORA_BASE', dirname(__FILE__) . '/..'); -require_once AGORA_BASE . '/lib/base.php'; -require_once AGORA_BASE . '/lib/Messages.php'; -require_once 'Horde/Identity.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('agora'); /* Set up the messages object. */ list($forum_id, $message_id, $scope) = Agora::getAgoraId(); @@ -79,7 +77,7 @@ $view = new Agora_View(); if (!$view_bodies) { /* Get the author's avatar. */ if ($conf['avatar']['allow_avatars']) { - $identity = &Identity::singleton('none', $message['message_author']); + $identity = Horde_Prefs_Identity::singleton('none', $message['message_author']); $avatar_path = $identity->getValue('avatar_path'); $message_author_avatar = Agora::validateAvatar($avatar_path) ? Agora::getAvatarUrl($avatar_path) : false; $view->message_author_avatar = $message_author_avatar; diff --git a/agora/messages/lock.php b/agora/messages/lock.php index cd07aee68..9cc818d5a 100644 --- a/agora/messages/lock.php +++ b/agora/messages/lock.php @@ -10,9 +10,8 @@ * @author Marko Djukic */ -define('AGORA_BASE', dirname(__FILE__) . '/..'); -require_once AGORA_BASE . '/lib/base.php'; -require_once AGORA_BASE . '/lib/Messages.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('agora'); /* Set up the messages object. */ list($forum_id, $message_id, $scope) = Agora::getAgoraId(); diff --git a/agora/messages/merge.php b/agora/messages/merge.php index 0e0e96366..4cf98d3f1 100644 --- a/agora/messages/merge.php +++ b/agora/messages/merge.php @@ -8,9 +8,8 @@ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. */ -define('AGORA_BASE', dirname(__FILE__) . '/..'); -require_once AGORA_BASE . '/lib/base.php'; -require_once AGORA_BASE . '/lib/Messages.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('agora'); /* Set up the messages object. */ list($forum_id, $message_id, $scope) = Agora::getAgoraId(); diff --git a/agora/messages/move.php b/agora/messages/move.php index f69a7a14f..12427c8f9 100644 --- a/agora/messages/move.php +++ b/agora/messages/move.php @@ -8,9 +8,8 @@ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. */ -define('AGORA_BASE', dirname(__FILE__) . '/..'); -require_once AGORA_BASE . '/lib/base.php'; -require_once AGORA_BASE . '/lib/Messages.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('agora'); /* Set up the messages object. */ list($forum_id, $message_id, $scope) = Agora::getAgoraId(); diff --git a/agora/messages/split.php b/agora/messages/split.php index 3803953d9..9fc0457df 100644 --- a/agora/messages/split.php +++ b/agora/messages/split.php @@ -8,9 +8,8 @@ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. */ -define('AGORA_BASE', dirname(__FILE__) . '/..'); -require_once AGORA_BASE . '/lib/base.php'; -require_once AGORA_BASE . '/lib/Messages.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('agora'); /* Set up the messages object. */ list($forum_id, $message_id, $scope) = Agora::getAgoraId(); diff --git a/agora/moderate.php b/agora/moderate.php index 8c58bb3fe..8344c1f0e 100644 --- a/agora/moderate.php +++ b/agora/moderate.php @@ -8,9 +8,8 @@ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. */ -define('AGORA_BASE', dirname(__FILE__)); -require_once AGORA_BASE . '/lib/base.php'; -require_once AGORA_BASE . '/lib/Messages.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('agora'); /* Set up the messages object. */ $scope = Horde_Util::getGet('scope', 'agora'); @@ -79,7 +78,7 @@ if (isset($api_call)) { $title = _("Messages Awaiting Moderation"); $view->menu = Agora::getMenu('string'); Horde::addScriptFile('stripe.js', 'horde', true); - require_once AGORA_TEMPLATES . '/common-header.inc'; + require AGORA_TEMPLATES . '/common-header.inc'; echo $view->render('moderate.html.php'); - require_once $registry->get('templates', 'horde') . '/common-footer.inc'; + require $registry->get('templates', 'horde') . '/common-footer.inc'; } diff --git a/agora/moderators.php b/agora/moderators.php index ce9b639a3..ef753eeee 100644 --- a/agora/moderators.php +++ b/agora/moderators.php @@ -11,8 +11,8 @@ * @author Marko Djukic */ -define('AGORA_BASE', dirname(__FILE__)); -require_once AGORA_BASE . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('agora'); if (!Horde_Auth::isAdmin()) { header('Location: ' . Horde::applicationUrl('forums.php')); diff --git a/agora/owner.php b/agora/owner.php index 41e6f324b..043e0f826 100644 --- a/agora/owner.php +++ b/agora/owner.php @@ -10,7 +10,8 @@ * @author Duck */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('agora'); /* Only authenticated users should be using this. */ if (!Horde_Auth::isAuthenticated()) { diff --git a/agora/rss/index.php b/agora/rss/index.php index 1280e58a1..12e47fd11 100644 --- a/agora/rss/index.php +++ b/agora/rss/index.php @@ -8,17 +8,16 @@ * @author Duck */ -define('AUTH_HANDLER', true); -define('AGORA_BASE', dirname(__FILE__) . '/../'); -require_once AGORA_BASE . '/lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('agora', array('authentication' => 'none')); // Show a specific scope? $scope = Horde_Util::getGet('scope', 'agora'); $cache_key = 'agora_rss_' . $scope; /* Initialize the Cache object. */ -$cache = &Horde_Cache::singleton($GLOBALS['conf']['cache']['driver'], - Horde::getDriverConfig('cache', $GLOBALS['conf']['cache']['driver'])); +$cache = Horde_Cache::singleton($GLOBALS['conf']['cache']['driver'], + Horde::getDriverConfig('cache', $GLOBALS['conf']['cache']['driver'])); $rss = $cache->get($cache_key, $conf['cache']['default_lifetime']); if (!$rss) { diff --git a/agora/rss/messages.php b/agora/rss/messages.php index 33f40a985..bd31ebdf5 100644 --- a/agora/rss/messages.php +++ b/agora/rss/messages.php @@ -8,9 +8,8 @@ * @author Duck */ -define('AUTH_HANDLER', true); -define('AGORA_BASE', dirname(__FILE__) . '/../'); -require_once AGORA_BASE . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('agora', array('authentication' => 'none')); // Show a specific scope? list($forum_id, $message_id, $scope) = Agora::getAgoraId(); diff --git a/agora/rss/threads.php b/agora/rss/threads.php index dca8fa093..bfc348448 100644 --- a/agora/rss/threads.php +++ b/agora/rss/threads.php @@ -8,9 +8,8 @@ * @author Duck */ -define('AUTH_HANDLER', true); -define('AGORA_BASE', dirname(__FILE__) . '/../'); -require_once AGORA_BASE . '/lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('agora', array('authentication' => 'none')); // Detect forum id $scope = Horde_Util::getGet('scope', 'agora'); diff --git a/agora/scripts/phorum2agora.php b/agora/scripts/phorum2agora.php index 76a14130c..f96eb971e 100755 --- a/agora/scripts/phorum2agora.php +++ b/agora/scripts/phorum2agora.php @@ -15,28 +15,9 @@ * TODO: Moderation, attachments, ID swaping */ -// No need for auth. -define('AUTH_HANDLER', true); - -// Find the base file paths. -define('AGORA_BASE', dirname(dirname(__FILE__))); -define('HORDE_BASE', dirname(AGORA_BASE)); - -// Do CLI checks and environment setup first. -require_once HORDE_BASE . '/lib/core.php'; -require_once 'Horde/CLI.php'; - -// Make sure no one runs this from the web. -if (!Horde_Cli::runningFromCLI()) { - exit("Must be run from the command line\n"); -} - -// Load the CLI environment. -Horde_Cli::init(); -$cli = &Horde_Cli::singleton(); - -require_once 'DB.php'; -require_once HORDE_BASE . '/lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('agora', array('authentication' => 'none', 'cli' => true)); +$cli = Horde_Cli::singleton(); /* Open Agora database. */ $db_agora = &DB::connect($conf['sql']); @@ -53,7 +34,6 @@ if ($db_phorum instanceof PEAR_Error) { } // We accept the user name on the command-line. -require_once 'Console/Getopt.php'; $ret = Console_Getopt::getopt(Console_Getopt::readPHPArgv(), 'h:p:a:t:f:c:', array('help', 'phorum_id=', 'agora_id=', 'phorum_table=', 'from=', 'count=')); diff --git a/agora/scripts/upgrades/2006-10-26_forums_table.php b/agora/scripts/upgrades/2006-10-26_forums_table.php index e402ed9b4..eba570208 100755 --- a/agora/scripts/upgrades/2006-10-26_forums_table.php +++ b/agora/scripts/upgrades/2006-10-26_forums_table.php @@ -4,28 +4,8 @@ * Script to migrate forums from datatree agora_forms table */ -// No need for auth. -define('AUTH_HANDLER', true); - -// Find the base file paths. -define('HORDE_BASE', dirname(__FILE__) . '/../../..'); -define('AGORA_BASE', dirname(__FILE__) . '/../..'); - -// Do CLI checks and environment setup first. -require_once HORDE_BASE . '/lib/core.php'; -require_once 'Horde/Cli.php'; - -// Make sure no one runs this from the web. -if (!Horde_Cli::runningFromCLI()) { - exit("Must be run from the command line\n"); -} - -// Load the CLI environment - make sure there's no time limit, init -// some variables, etc. -Horde_Cli::init(); - -require_once 'DB.php'; -require_once HORDE_BASE . '/lib/base.php'; +require_once dirname(__FILE__) . '/../../lib/Application.php'; +Horde_Registry::appInit('agora', array('authentication' => 'none', 'cli' => true)); /* Open the database. */ $db = DB::connect($conf['sql']); diff --git a/agora/scripts/upgrades/2006-10-26_messages_table.php b/agora/scripts/upgrades/2006-10-26_messages_table.php index 254a1d7cd..f3b00a476 100755 --- a/agora/scripts/upgrades/2006-10-26_messages_table.php +++ b/agora/scripts/upgrades/2006-10-26_messages_table.php @@ -6,27 +6,8 @@ * Script to migrate forums from datatree agora_forms table */ -// No need for auth. -define('AUTH_HANDLER', true); - -// Find the base file paths. -define('HORDE_BASE', dirname(__FILE__) . '/../../..'); -define('AGORA_BASE', dirname(__FILE__) . '/../..'); - -// Do CLI checks and environment setup first. -require_once HORDE_BASE . '/lib/core.php'; - -// Make sure no one runs this from the web. -if (!Horde_Cli::runningFromCLI()) { - exit("Must be run from the command line\n"); -} - -// Load the CLI environment - make sure there's no time limit, init -// some variables, etc. -Horde_Cli::init(); - -require_once 'DB.php'; -require_once HORDE_BASE . '/lib/base.php'; +require_once dirname(__FILE__) . '/../../lib/Application.php'; +Horde_Registry::appInit('agora', array('authentication' => 'none', 'cli' => true)); /* Open the database. */ $db = &DB::connect($conf['sql']); diff --git a/agora/scripts/upgrades/2006-10-28_update_counts.php b/agora/scripts/upgrades/2006-10-28_update_counts.php index 4198f7e37..61d3061aa 100755 --- a/agora/scripts/upgrades/2006-10-28_update_counts.php +++ b/agora/scripts/upgrades/2006-10-28_update_counts.php @@ -6,28 +6,8 @@ * TODO Get rid of moderation */ -// No need for auth. -define('AUTH_HANDLER', true); - -// Find the base file paths. -define('AGORA_BASE', dirname(dirname(dirname(__FILE__)))); -define('HORDE_BASE', dirname(AGORA_BASE)); - -// Do CLI checks and environment setup first. -require_once HORDE_BASE . '/lib/core.php'; - -// Make sure no one runs this from the web. -if (!Horde_Cli::runningFromCLI()) { - exit("Must be run from the command line\n"); -} - -// Load the CLI environment - make sure there's no time limit, init -// some variables, etc. -Horde_Cli::init(); - -require_once 'DB.php'; -require_once HORDE_BASE . '/lib/base.php'; -require_once AGORA_BASE . '/lib/Messages.php'; +require_once dirname(__FILE__) . '/../../lib/Application.php'; +Horde_Registry::appInit('agora', array('authentication' => 'none', 'cli' => true)); /* Open the database. */ $db = &DB::connect($conf['sql']); diff --git a/agora/scripts/upgrades/2007-09-23_last_message.php b/agora/scripts/upgrades/2007-09-23_last_message.php index 638411a8a..b4f002f85 100644 --- a/agora/scripts/upgrades/2007-09-23_last_message.php +++ b/agora/scripts/upgrades/2007-09-23_last_message.php @@ -4,28 +4,9 @@ * Upgrades last messages */ -// No need for auth. -define('AUTH_HANDLER', true); - -// Find the base file paths. -define('AGORA_BASE', dirname(dirname(dirname(__FILE__)))); -define('HORDE_BASE', dirname(AGORA_BASE)); - -// Do CLI checks and environment setup first. -require_once HORDE_BASE . '/lib/core.php'; - -// Make sure no one runs this from the web. -if (!Horde_Cli::runningFromCLI()) { - exit("Must be run from the command line\n"); -} - -// Load the CLI environment. -Horde_Cli::init(); -$cli = &Horde_Cli::singleton(); - -require_once 'MDB2.php'; -require_once HORDE_BASE . '/lib/base.php'; -require_once AGORA_BASE . '/lib/Messages.php'; +require_once dirname(__FILE__) . '/../../lib/Application.php'; +Horde_Registry::appInit('agora', array('authentication' => 'none', 'cli' => true)); +$cli = Horde_Cli::singleton(); /* Open the database. */ $params = Horde::getDriverConfig('storage', 'sql'); diff --git a/agora/search.php b/agora/search.php index a92f399c4..18f84397b 100644 --- a/agora/search.php +++ b/agora/search.php @@ -10,8 +10,9 @@ * @author Jason Felice */ -define('AGORA_BASE', dirname(__FILE__)); -require_once AGORA_BASE . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('agora'); + require_once AGORA_BASE . '/lib/Forms/Search.php'; /* Set up the forums object. */ diff --git a/agora/templates/.htaccess b/agora/templates/.htaccess old mode 100755 new mode 100644 diff --git a/agora/templates/ban.html.php b/agora/templates/ban.html.php old mode 100755 new mode 100644 index fb98d0a94..0b85372bf --- a/agora/templates/ban.html.php +++ b/agora/templates/ban.html.php @@ -10,10 +10,10 @@

    banned as $k1 => $v1): ?> -
  • banned)) { echo $this->banned; } ?>
  • +
  • banned)) { echo $this->banned; } ?>

-formbox; ?> \ No newline at end of file +formbox; ?> diff --git a/agora/templates/block/forums.html.php b/agora/templates/block/forums.html.php old mode 100755 new mode 100644 diff --git a/agora/templates/block/thread.html.php b/agora/templates/block/thread.html.php old mode 100755 new mode 100644 diff --git a/agora/templates/block/threads.html.php b/agora/templates/block/threads.html.php old mode 100755 new mode 100644 diff --git a/agora/templates/forums.html.php b/agora/templates/forums.html.php old mode 100755 new mode 100644 index 7ffe4046e..adf392b55 --- a/agora/templates/forums.html.php +++ b/agora/templates/forums.html.php @@ -2,42 +2,42 @@ notify; ?>

- actions)): ?> - - actions); foreach ($this->actions as $k1 => $v1): ?>actions)) { echo $this->actions; } ?> - - -

-forums_list) || !empty($this->forums_list)): ?> - - + actions)): ?> + + actions); foreach ($this->actions as $k1 => $v1): ?>actions)) { echo $this->actions; } ?> + + + +forums_list) || !empty($this->forums_list)): ?> +
+ + + - forums_list as $k2 => $v2): ?> + forums_list as $k2 => $v2): ?> - - + + + +
col_headers['forum_name_class']; ?>> col_headers['forum_name']; ?> col_headers['message_count_class']; ?>> col_headers['message_count']; ?> - col_headers['thread_count_class']; ?>> col_headers['thread_count']; ?> - col_headers['message_timestamp_class']; ?>> col_headers['message_timestamp']; ?>

: - $v3): ?> - + $v3): ?> +
: - $v4): ?> + $v4): ?>
@@ -50,12 +50,12 @@
- -
pager_link;?>

- + diff --git a/agora/templates/main.html.php b/agora/templates/main.html.php old mode 100755 new mode 100644 index 9cc078851..f46a0cb77 --- a/agora/templates/main.html.php +++ b/agora/templates/main.html.php @@ -1,3 +1,3 @@ -notify; ?> +notify; ?> main; ?> diff --git a/agora/templates/messages/edit.html.php b/agora/templates/messages/edit.html.php old mode 100755 new mode 100644 index cd81b1498..40f96fb72 --- a/agora/templates/messages/edit.html.php +++ b/agora/templates/messages/edit.html.php @@ -3,16 +3,16 @@ formbox; ?> -replying)): ?> +replying)): ?>

message_subject; ?>

- +
- - messages as $k1 => $v1): ?> + messages as $k1 => $v1): ?> diff --git a/agora/templates/moderators.html.php b/agora/templates/moderators.html.php old mode 100755 new mode 100644 index 3cca586b4..09944503b --- a/agora/templates/moderators.html.php +++ b/agora/templates/moderators.html.php @@ -1,33 +1,33 @@ notify; ?> - -

-forums)): ?> -
+ message_author_avatar)): ?> <?php echo $this->message_author; ?>
diff --git a/agora/templates/messages/flat.html.php b/agora/templates/messages/flat.html.php index 5e805f058..137a3a49e 100644 --- a/agora/templates/messages/flat.html.php +++ b/agora/templates/messages/flat.html.php @@ -6,7 +6,7 @@ diff --git a/agora/templates/messages/flat_thread.html.php b/agora/templates/messages/flat_thread.html.php old mode 100755 new mode 100644 index edd032f0b..471e10723 --- a/agora/templates/messages/flat_thread.html.php +++ b/agora/templates/messages/flat_thread.html.php @@ -1,8 +1,8 @@ threads_list as $k1 => $v1): ?> - +
-
+


@@ -14,7 +14,7 @@ $v2): ?> ] - +
@@ -26,4 +26,4 @@
- + diff --git a/agora/templates/messages/form.html.php b/agora/templates/messages/form.html.php old mode 100755 new mode 100644 index f746ccb51..945b5c7c3 --- a/agora/templates/messages/form.html.php +++ b/agora/templates/messages/form.html.php @@ -1,24 +1,24 @@ notify; ?> - + formbox; ?> - -
-

+ +
+

message_subject; ?> -

- - - - + +
+ + + + + - + - -
message_author_avatar)): ?> <?php echo $this->message_author; ?> -
- +
+ message_author; ?> -
+ message_body; ?> -
+
diff --git a/agora/templates/messages/index.html.php b/agora/templates/messages/index.html.php old mode 100755 new mode 100644 diff --git a/agora/templates/messages/message.html.php b/agora/templates/messages/message.html.php old mode 100755 new mode 100644 index 261e94b5b..227b11743 --- a/agora/templates/messages/message.html.php +++ b/agora/templates/messages/message.html.php @@ -1,40 +1,40 @@ notify; ?> -
- actions)): ?> +
+ actions)): ?> - actions); foreach ($this->actions as $k1 => $v1): ?>actions)) { echo $this->actions; } ?> - - + actions); foreach ($this->actions as $k1 => $v1): ?>actions)) { echo $this->actions; } ?> + + message_subject)): ?>message_subject; ?> 
-
-
+
+
message_author_avatar)): ?> <?php echo $this->message_author; ?> -
- +
+ message_author; ?> message_author_moderator)): ?>
-

+

message_body; ?> message_attachment)): ?>
message_attachment; ?> -

-
+

+

-

- +

+

-
+
threads; ?>
diff --git a/agora/templates/messages/threads.html.php b/agora/templates/messages/threads.html.php old mode 100755 new mode 100644 index 91dfcb597..89b87bd2c --- a/agora/templates/messages/threads.html.php +++ b/agora/templates/messages/threads.html.php @@ -1,12 +1,12 @@ - - -
+ + + - + - + @@ -46,5 +46,5 @@ - -
col_headers['message_thread']; ?> - + col_headers['message_author']; ?> - + col_headers['message_timestamp']; ?>
+ +
diff --git a/agora/templates/moderate.html.php b/agora/templates/moderate.html.php old mode 100755 new mode 100644 index 901591ce8..05dadc287 --- a/agora/templates/moderate.html.php +++ b/agora/templates/moderate.html.php @@ -32,7 +32,7 @@
- - - - - -forums as $k1 => $v1): ?> - - + +

+forums)): ?> +
forums)) { echo $this->forums; } ?>
+ + + + + +forums as $k1 => $v1): ?> + + - - - -
forums)) { echo $this->forums; } ?> - - $v2): ?> -
- - -
- -

- - - -
- -formbox; ?> \ No newline at end of file + + + $v2): ?> +
+ + + + + + + +

+ + + +
+ +formbox; ?> diff --git a/agora/templates/search.html.php b/agora/templates/search.html.php old mode 100755 new mode 100644 index 808c2c2b8..b77618ee4 --- a/agora/templates/search.html.php +++ b/agora/templates/search.html.php @@ -1,36 +1,36 @@ notify; ?> - -searchResults)): ?> + +searchResults)): ?>

(searchTotal; ?>)

- -searchResults as $k1 => $v1): ?> - - + + +
+ +searchResults as $k1 => $v1): ?> + + - - $v2): ?> - - - + $v2): ?> + + + - + - + - - - -
-
  + +
  - + - + -
- + +
+ pager_link; ?> - -
- - - + +
+ + + searchForm; ?> diff --git a/agora/templates/threads.html.php b/agora/templates/threads.html.php old mode 100755 new mode 100644 index 9da20e63c..9eea3d9dd --- a/agora/templates/threads.html.php +++ b/agora/templates/threads.html.php @@ -2,20 +2,20 @@ notify; ?> -
- actions)): ?> - +
+ actions)): ?> + actions); foreach ($this->actions as $k1 => $v1): ?> forum_name; ?>
-
+
forum_description; ?>
threads)): ?> - +
+ - - - threads as $k2 => $v2): ?> + + + + threads as $k2 => $v2): ?> - + + - + - + - + @@ -65,7 +65,7 @@
col_headers['message_subject_class']; ?>> col_headers['message_subject']; ?> @@ -28,36 +28,36 @@ col_headers['message_author_class']; ?>> col_headers['message_author']; ?> - col_headers['message_modifystamp_class']; ?>> col_headers['message_modifystamp']; ?> -
+ - +
[ $v3): ?> ]
[ $v4): ?> ] -
-
- + - + - +
- +
pager_link; ?> - -

- - + +

+ + diff --git a/agora/themes/bluewhite/graphics/comment_box.png b/agora/themes/bluewhite/graphics/comment_box.png old mode 100755 new mode 100644 diff --git a/agora/themes/bluewhite/screen.css b/agora/themes/bluewhite/screen.css old mode 100755 new mode 100644 diff --git a/agora/themes/screen.css b/agora/themes/screen.css old mode 100755 new mode 100644 diff --git a/agora/threads.php b/agora/threads.php index 5b470ae53..d760dea47 100644 --- a/agora/threads.php +++ b/agora/threads.php @@ -11,9 +11,8 @@ * @author Marko Djukic */ -define('AGORA_BASE', dirname(__FILE__)); -require_once AGORA_BASE . '/lib/base.php'; -require_once AGORA_BASE . '/lib/Messages.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('agora', array('authentication' => 'none', 'cli' => true)); /* Make sure we have a forum id. */ list($forum_id, , $scope) = Agora::getAgoraId(); diff --git a/agora/view.php b/agora/view.php index 1a1b368f7..3ef6c56c8 100644 --- a/agora/view.php +++ b/agora/view.php @@ -10,8 +10,8 @@ * @author Marko Djukic */ -define('AGORA_BASE', dirname(__FILE__)); -require_once AGORA_BASE . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('agora', array('authentication' => 'none', 'cli' => true)); $action_id = Horde_Util::getFormData('action_id', 'download'); $file_id = Horde_Util::getFormData('file_id');