*/
@define('JONAH_BASE', dirname(__FILE__) . '/..');
-require_once JONAH_BASE . '/lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+$jonah = Horde_Registry::appInit('jonah');
require_once JONAH_BASE . '/lib/News.php';
require_once 'Horde/Form.php';
require_once 'Horde/Form/Renderer.php';
*/
define('JONAH_BASE', dirname(__FILE__) . '/..');
-require_once JONAH_BASE . '/lib/base.php';
-require_once JONAH_BASE . '/lib/News.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+$jonah = Horde_Registry::appInit('jonah');
require_once 'Horde/Form.php';
require_once 'Horde/Form/Renderer.php';
*/
@define('JONAH_BASE', dirname(__FILE__) . '/..');
-require_once JONAH_BASE . '/lib/base.php';
-require_once JONAH_BASE . '/lib/News.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+$jonah = Horde_Registry::appInit('jonah');
require_once JONAH_BASE . '/lib/Forms/Feed.php';
require_once 'Horde/Form/Renderer.php';
* @author Marko Djukic <marko@oblo.com>
*/
-@define('JONAH_BASE', dirname(__FILE__) . '/..');
-require_once JONAH_BASE . '/lib/base.php';
-require_once JONAH_BASE . '/lib/News.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+$jonah = Horde_Registry::appInit('jonah');
if (!Jonah::checkPermissions('jonah:news', Horde_Perms::EDIT)) {
$notification->push(_("You are not authorised for this action."), 'horde.warning');
$session_control = 'readonly';
@define('AUTH_HANDLER', true);
-@define('JONAH_BASE', dirname(__FILE__) . '/..');
-require_once JONAH_BASE . '/lib/base.php';
-require_once JONAH_BASE . '/lib/News.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+$jonah = Horde_Registry::appInit('jonah');
require JONAH_BASE . '/config/templates.php';
// TODO - check if a user, have button to add channel to their
$parts = explode('/', Horde_Util::getPathInfo());
$lastpart = null;
-$deliverytype = null;
+$deliveryType = null;
$criteria = array();
foreach ($parts as $part) {
if (empty($part)) {
continue;
}
+ // Check for REST-style content type
+ if (strpos($part, '.') !== false) {
+ $deliveryType = substr($part, strrpos($part, '.') + 1);
+ $part = substr($part, 0, strrpos($part, '.'));
+
+ }
+
switch($part) {
case 'html':
case 'rss':
$session_control = 'readonly';
@define('AUTH_HANDLER', true);
-@define('JONAH_BASE', dirname(__FILE__) . '/..');
-require_once JONAH_BASE . '/lib/base.php';
-require_once JONAH_BASE . '/lib/News.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+$jonah = Horde_Registry::appInit('jonah');
require_once JONAH_BASE . '/lib/version.php';
$news = Jonah_News::factory();
<?php
/**
- * $Horde: jonah/dispatcher.php,v 1.9 2009/06/10 05:24:46 slusarz Exp $
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ * Copyright 2008-2010 The Horde Project (http://www.horde.org/)
*
* See the enclosed file LICENSE for license information (BSD). If you did
* did not receive this file, see http://cvs.horde.org/co.php/jonah/LICENSE.
*/
$session_control = 'readonly';
@define('AUTH_HANDLER', true);
-@define('JONAH_BASE', dirname(__FILE__));
-require_once JONAH_BASE . '/lib/base.php';
-require_once JONAH_BASE . '/lib/News.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+$jonah = Horde_Registry::appInit('jonah');
require JONAH_BASE . '/config/templates.php';
// Grab, and hopefully match, the URL
$session_control = 'readonly';
@define('AUTH_HANDLER', true);
-require_once dirname(__FILE__) . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+$jonah = Horde_Registry::appInit('jonah');
require JONAH_BASE . '/config/templates.php';
/* Get the id and format of the feed to display. */
*/
public function listFeeds($type = null)
{
- require_once dirname(__FILE__) . '/base.php';
- require_once JONAH_BASE . '/lib/News.php';
-
$news = Jonah_News::factory();
$channels = $news->getChannels($type);
public function stories($channel_id, $max_stories = 10, $start_at = 0,
$order = 0)
{
- require_once dirname(__FILE__) . '/base.php';
- require_once JONAH_BASE . '/lib/News.php';
$news = Jonah_News::factory();
$stories = $news->getStories($channel_id, $max_stories, $start_at, false,
time(), false, $order);
*/
public function story($channel_id, $story_id, $read = true)
{
- require_once dirname(__FILE__) . '/base.php';
- require_once JONAH_BASE . '/lib/News.php';
-
$news = Jonah_News::factory();
$story = $news->getStory($channel_id, $story_id, $read);
if (is_a($story, 'PEAR_Error')) {
return false;
}
- require_once dirname(__FILE__) . '/base.php';
- require_once JONAH_BASE . '/lib/News.php';
-
$news = Jonah_News::factory();
$story = $news->getStory(null, $story_id);
if (is_a($story, 'PEAR_Error')) {
*/
public function listTagInfo($tags = array(), $channel_id = null)
{
- require_once dirname(__FILE__) . '/base.php';
- require_once JONAH_BASE . '/lib/News.php';
-
$news = Jonah_News::factory();
return $news->listTagInfo($tags, $channel_id);
}
*/
public function getTagIds($names)
{
- require_once dirname(__FILE__) . '/base.php';
- require_once JONAH_BASE . '/lib/News.php';
-
$news = Jonah_News::factory();
return $news->getTagIds($names);
}
{
global $registry;
- require_once dirname(__FILE__) . '/base.php';
- require_once JONAH_BASE . '/lib/News.php';
-
$news = Jonah_News::factory();
$results = $news->searchTags($names, $max, $from, $channel_id, $order);
if (is_a($results, 'PEAR_Error')) {
{
global $registry;
- require_once dirname(__FILE__) . '/base.php';
-
$results = $GLOBALS['jonah_driver']->getStoryCount($channel_id);
if (is_a($results, 'PEAR_Error')) {
return 0;
/**
* Jonah application API.
*
- * @package Kronolith
+ * @package Jonah
*/
+if (!defined('JONAH_BASE')) {
+ define('JONAH_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(JONAH_BASE. '/config/horde.local.php')) {
+ include JONAH_BASE . '/config/horde.local.php';
+ } else {
+ define('HORDE_BASE', JONAH_BASE . '/..');
+ }
+}
+
+/* Load the Horde Framework core (needed to autoload
+ * Horde_Registry_Application::). */
+require_once HORDE_BASE . '/lib/core.php';
+
class Jonah_Application extends Horde_Registry_Application
{
- public $version = 'H4 (1.0-cvs)';
+ public $version = 'H4 (1.0-git)';
+
+ public $driver = null;
+
+ /**
+ * Initialization function.
+ *
+ * Global variables defined:
+ */
+ protected function _init()
+ {
+ $this->driver = Jonah_Driver::factory();
+ }
/**
* Returns a list of available permissions.
*/
public function perms()
{
- require_once dirname(__FILE__) . '/base.php';
-
$news = Jonah_News::factory();
$channels = $news->getChannels(JONAH_INTERNAL_CHANNEL);
function _content()
{
- require_once dirname(__FILE__) . '/../base.php';
- require_once JONAH_BASE . '/lib/News.php';
-
$news = Jonah_News::factory();
/* Get the tags */
function _content()
{
- require_once dirname(__FILE__) . '/../base.php';
- require_once JONAH_BASE . '/lib/Jonah.php';
- require_once JONAH_BASE . '/lib/News.php';
-
$news = Jonah_News::factory();
$channels = array();
*/
function _params()
{
- require_once dirname(__FILE__) . '/../base.php';
- require_once JONAH_BASE . '/lib/Jonah.php';
- require_once JONAH_BASE . '/lib/News.php';
-
$params['source'] = array('name' => _("News Source"),
'type' => 'enum',
'values' => array());
*/
function _title()
{
- require_once dirname(__FILE__) . '/../base.php';
- require_once JONAH_BASE . '/lib/Jonah.php';
- require_once JONAH_BASE . '/lib/News.php';
-
if (empty($this->_params['source'])) {
return _("Latest News");
}
*/
function _content()
{
- require_once dirname(__FILE__) . '/../base.php';
- require_once JONAH_BASE . '/lib/Jonah.php';
- require_once JONAH_BASE . '/lib/News.php';
-
if (empty($this->_params['source'])) {
return _("No channel specified.");
}
function _params()
{
- require_once dirname(__FILE__) . '/../base.php';
- require_once JONAH_BASE . '/lib/Jonah.php';
- require_once JONAH_BASE . '/lib/News.php';
require JONAH_BASE . '/config/templates.php';
$params['source'] = array('name' => _("Feed"),
function _title()
{
- require_once dirname(__FILE__) . '/../base.php';
- require_once JONAH_BASE . '/lib/Jonah.php';
- require_once JONAH_BASE . '/lib/News.php';
-
$news = Jonah_News::factory();
$channel = $news->getChannel($this->_params['source']);
if (is_a($channel, 'PEAR_Error')) {
function _content()
{
- require_once dirname(__FILE__) . '/../base.php';
- require_once JONAH_BASE . '/lib/Jonah.php';
- require_once JONAH_BASE . '/lib/News.php';
-
if (empty($this->_params['source'])) {
return _("No feed specified.");
}
function _params()
{
- require_once dirname(__FILE__) . '/../base.php';
- require_once JONAH_BASE . '/lib/Jonah.php';
- require_once JONAH_BASE . '/lib/News.php';
require JONAH_BASE . '/config/templates.php';
$params['source'] = array('name' => _("Feed"),
function _title()
{
- require_once dirname(__FILE__) . '/../base.php';
- require_once JONAH_BASE . '/lib/Jonah.php';
- require_once JONAH_BASE . '/lib/News.php';
-
$news = Jonah_News::factory();
$channel = $news->getChannel($this->_params['source']);
if (is_a($channel, 'PEAR_Error')) {
function _content()
{
- require_once dirname(__FILE__) . '/../base.php';
- require_once JONAH_BASE . '/lib/Jonah.php';
- require_once JONAH_BASE . '/lib/News.php';
-
if (empty($this->_params['source'])) {
return _("No feed specified.");
}
*/
function _params()
{
- require_once dirname(__FILE__) . '/../base.php';
- require_once JONAH_BASE . '/lib/Jonah.php';
- require_once JONAH_BASE . '/lib/News.php';
-
$news = Jonah_News::factory();
$channels = $news->getChannels(JONAH_INTERNAL_CHANNEL);
$channel_choices = array();
*/
function _title()
{
- require_once dirname(__FILE__) . '/../base.php';
- require_once JONAH_BASE . '/lib/Jonah.php';
- require_once JONAH_BASE . '/lib/News.php';
-
if (empty($this->_params['source']) ||
empty($this->_params['story'])) {
return _("Story");
*/
function _content()
{
- require_once dirname(__FILE__) . '/../base.php';
- require_once JONAH_BASE . '/lib/Jonah.php';
- require_once JONAH_BASE . '/lib/News.php';
-
if (empty($this->_params['source']) || empty($this->_params['story'])) {
return _("No story is selected.");
}
function _buildTree(&$tree, $indent = 0, $parent = null)
{
- require_once dirname(__FILE__) . '/../base.php';
- require_once JONAH_BASE . '/lib/News.php';
-
if (!Jonah::checkPermissions('jonah:news', Horde_Perms::EDIT) ||
!in_array('internal', $GLOBALS['conf']['news']['enable'])) {
return;
+++ /dev/null
-<?php
-/**
- * Jonah base inclusion file.
- *
- * $Horde: jonah/lib/base.php,v 1.63 2009/10/20 09:17:26 jan Exp $
- *
- * This file brings in all of the dependencies that every Jonah script
- * will need, and sets up objects that all scripts use.
- */
-
-// Check for a prior definition of HORDE_BASE (perhaps by an
-// auto_prepend_file definition for site customization).
-if (!defined('HORDE_BASE')) {
- define('HORDE_BASE', dirname(__FILE__) . '/../..');
-}
-
-// Load the Horde Framework core, and set up inclusion paths.
-require_once HORDE_BASE . '/lib/core.php';
-
-// Registry.
-if (Horde_Util::nonInputVar('session_control') == 'none') {
- $registry = Horde_Registry::singleton(Horde_Registry::SESSION_NONE);
-} elseif (Horde_Util::nonInputVar('session_control') == 'readonly') {
- $registry = Horde_Registry::singleton(Horde_Registry::SESSION_READONLY);
-} else {
- $registry = Horde_Registry::singleton();
-}
-
-try {
- $registry->pushApp('jonah', !defined('AUTH_HANDLER'));
-} catch (Horde_Exception $e) {
- if ($e->getCode() == 'permission_denied') {
- Horde::authenticationFailureRedirect();
- }
- Horde::fatal($e, __FILE__, __LINE__, false);
-}
-$conf = &$GLOBALS['conf'];
-define('JONAH_TEMPLATES', $registry->get('templates'));
-
-/* Notification system. */
-$notification = &Horde_Notification::singleton();
-$notification->attach('status');
-
-/* Find the base file path of Jonah. */
-if (!defined('JONAH_BASE')) {
- define('JONAH_BASE', dirname(__FILE__) . '/..');
-}
-
-/* Jonah base library. */
-require_once JONAH_BASE . '/lib/Jonah.php';
-
-/* Instantiate Jonah storage */
-require_once JONAH_BASE . '/lib/Driver.php';
-$GLOBALS['jonah_driver'] = Jonah_Driver::factory();
-
-// Start compression.
-if (!Horde_Util::nonInputVar('no_compress')) {
- Horde::compressOutput();
-}
* @author Marko Djukic <marko@oblo.com>
*/
-define('JONAH_BASE', dirname(__FILE__) . '/..');
-require_once JONAH_BASE . '/lib/base.php';
-require_once JONAH_BASE . '/lib/News.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+$jonah = Horde_Registry::appInit('jonah');
require_once 'Horde/Form.php';
require_once 'Horde/Form/Renderer.php';
* @author Marko Djukic <marko@oblo.com>
*/
-require_once dirname(__FILE__) . '/../lib/base.php';
-require_once JONAH_BASE . '/lib/News.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+$jonah = Horde_Registry::appInit('jonah');
require_once JONAH_BASE . '/lib/Forms/Story.php';
require_once 'Horde/Form/Action.php';
require_once 'Horde/Form/Renderer.php';
* @author Marko Djukic <marko@oblo.com>
*/
-@define('JONAH_BASE', dirname(__FILE__) . '/..');
-require_once JONAH_BASE . '/lib/base.php';
-require_once JONAH_BASE . '/lib/News.php';
-
+require_once dirname(__FILE__) . '/../lib/Application.php';
+$jonah = Horde_Registry::appInit('jonah');
$news = Jonah_News::factory();
/* Redirect to the news index if no channel_id is specified. */
$session_control = 'readonly';
@define('AUTH_HANDLER', true);
-@define('JONAH_BASE', dirname(__FILE__) . '/..');
-require_once JONAH_BASE . '/lib/base.php';
-require_once JONAH_BASE . '/lib/News.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+$jonah = Horde_Registry::appInit('jonah');
require_once 'File/PDF.php';
$news = Jonah_News::factory();
*
* $Horde: jonah/stories/results.php,v 1.5 2009/11/24 04:15:38 chuck Exp $
*/
-
-@define('JONAH_BASE', dirname(__FILE__) . '/..');
-require_once JONAH_BASE . '/lib/base.php';
-require_once JONAH_BASE . '/lib/News.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+$jonah = Horde_Registry::appInit('jonah');
$news = Jonah_News::factory();
$session_control = 'readonly';
@define('AUTH_HANDLER', true);
-@define('JONAH_BASE', dirname(__FILE__) . '/..');
-require_once JONAH_BASE . '/lib/base.php';
-require_once JONAH_BASE . '/lib/News.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+$jonah = Horde_Registry::appInit('jonah');
require_once 'Horde/Form.php';
require_once 'Horde/Form/Renderer.php';
@define('AUTH_HANDLER', true);
@define('JONAH_BASE', dirname(__FILE__) . '/..');
-require_once JONAH_BASE . '/lib/base.php';
-require_once JONAH_BASE . '/lib/News.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+$jonah = Horde_Registry::appInit('jonah');
$news = Jonah_News::factory();