return Horde_Data::IMPORT_FILE;
}
-require_once dirname(__FILE__) . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+Horde_Registry::appInit('nag');
if (!$conf['menu']['import_export']) {
require NAG_BASE . '/index.php';
*/
public function ajaxDefaults()
{
- require_once dirname(__FILE__) . '/base.php';
return array(
'default_tasklist' => Nag::getDefaultTasklist(Horde_Perms::EDIT),
);
$altsortby = null, $tasklists = null,
$completed = null, $json = false)
{
- require_once dirname(__FILE__) . '/base.php';
-
$completedArray = array('incomplete' => Nag::VIEW_INCOMPLETE,
'all' => Nag::VIEW_ALL,
'complete' => Nag::VIEW_COMPLETE,
*/
public function listTasklists($owneronly, $permission)
{
- require_once dirname(__FILE__) . '/base.php';
return Nag::listTasklists($owneronly, $permission);
}
*/
public function addTasklist($name, $description = '', $color = '')
{
- require_once dirname(__FILE__) . '/base.php';
$tasklist = Nag::addTasklist(array('name' => $name, 'description' => $description, 'color' => $color));
if (is_a($tasklist, 'PEAR_Error')) {
return $tasklist;
*/
public static function updateTasklist($id, $info)
{
- require_once dirname(__FILE__) . '/base.php';
$tasklist = $GLOBALS['nag_shares']->getShare($id);
if (is_a($tasklist, 'PEAR_Error')) {
return $tasklist;
*/
public function deleteTasklist($id)
{
- require_once dirname(__FILE__) . '/base.php';
$tasklist = $GLOBALS['nag_shares']->getShare($id);
if (is_a($tasklist, 'PEAR_Error')) {
return $tasklist;
*/
public function browse($path = '', $properties = array())
{
- require_once dirname(__FILE__) . '/base.php';
global $registry;
// Default properties.
*/
public function put($path, $content, $content_type)
{
- require_once dirname(__FILE__) . '/base.php';
-
if (substr($path, 0, 3) == 'nag') {
$path = substr($path, 3);
}
*/
public function path_delete($path)
{
- require_once dirname(__FILE__) . '/base.php';
-
if (substr($path, 0, 3) == 'nag') {
$path = substr($path, 3);
}
*/
public function listTaskUids($tasklist = null)
{
- require_once dirname(__FILE__) . '/base.php';
-
if (!isset($GLOBALS['conf']['storage']['driver'])) {
return PEAR::raiseError(_("Not configured"));
}
*/
public function listBy($action, $timestamp, $tasklist = null)
{
- require_once dirname(__FILE__) . '/base.php';
-
if ($tasklist === null) {
$tasklist = Nag::getDefaultTasklist(Horde_Perms::READ);
}
*/
public function getActionTimestamp($uid, $action, $tasklist = null)
{
- require_once dirname(__FILE__) . '/base.php';
-
if ($tasklist === null) {
$tasklist = Nag::getDefaultTasklist(Horde_Perms::READ);
}
*/
public function import($content, $contentType, $tasklist = null)
{
- require_once dirname(__FILE__) . '/base.php';
-
if ($tasklist === null) {
$tasklist = Nag::getDefaultTasklist(Horde_Perms::EDIT);
}
*/
public function addTask($task)
{
- require_once dirname(__FILE__) . '/base.php';
-
if (!Horde_Auth::isAdmin() &&
!array_key_exists($task['tasklist'],
Nag::listTasklists(false, Horde_Perms::EDIT))) {
*/
public function quickAdd($text, $tasklist = null)
{
- require_once dirname(__FILE__) . '/base.php';
-
if ($tasklist === null) {
$tasklist = Nag::getDefaultTasklist(Horde_Perms::EDIT);
}
*/
public function toggleCompletion($task_id, $tasklist_id)
{
- require_once dirname(__FILE__) . '/base.php';
-
if (!array_key_exists($tasklist_id,
Nag::listTasklists(false, Horde_Perms::EDIT))) {
return PEAR::raiseError(_("Permission Denied"));
*/
public function export($uid, $contentType)
{
- require_once dirname(__FILE__) . '/base.php';
-
$storage = Nag_Driver::singleton();
$task = $storage->getByUID($uid);
if (is_a($task, 'PEAR_Error')) {
*/
public function getTask($tasklist, $id)
{
- require_once dirname(__FILE__) . '/base.php';
-
if (!array_key_exists($tasklist,
Nag::listTasklists(false, Horde_Perms::READ))) {
return PEAR::raiseError(_("Permission Denied"));
*/
public function exportTasklist($tasklist, $contentType)
{
- require_once dirname(__FILE__) . '/base.php';
-
if (!array_key_exists($tasklist,
Nag::listTasklists(false, Horde_Perms::READ))) {
return PEAR::raiseError(_("Permission Denied"));
return true;
}
- require_once dirname(__FILE__) . '/base.php';
-
$storage = Nag_Driver::singleton();
$task = $storage->getByUID($uid);
if (is_a($task, 'PEAR_Error')) {
*/
public function deleteTask($tasklist, $id)
{
- require_once dirname(__FILE__) . '/base.php';
-
if (!Horde_Auth::isAdmin() &&
!array_key_exists($tasklist,
Nag::listTasklists(false, Horde_Perms::DELETE))) {
*/
public function replace($uid, $content, $contentType)
{
- require_once dirname(__FILE__) . '/base.php';
-
$storage = Nag_Driver::singleton();
$existing = $storage->getByUID($uid);
if (is_a($existing, 'PEAR_Error')) {
*/
public function updateTask($tasklist, $id, $task)
{
- require_once dirname(__FILE__) . '/base.php';
-
if (!Horde_Auth::isAdmin() &&
!array_key_exists($tasklist,
Nag::listTasklists(false, Horde_Perms::EDIT))) {
*/
public function listCostObjects($criteria)
{
- require_once dirname(__FILE__) . '/base.php';
-
$tasks = Nag::listTasks(null, null, null, null, 1);
$result = array();
$tasks->reset();
public function listTimeObjectCategories()
{
- require_once dirname(__FILE__) . '/base.php';
-
$categories = array();
$tasklists = Nag::listTasklists(false, Horde_Perms::SHOW | Horde_Perms::READ);
foreach ($tasklists as $tasklistId => $tasklist) {
*/
public function listTimeObjects($categories, $start, $end)
{
- require_once dirname(__FILE__) . '/base.php';
-
$allowed_tasklists = Nag::listTasklists(false, Horde_Perms::READ);
foreach ($categories as $tasklist) {
if (!array_key_exists($tasklist, $allowed_tasklists)) {
*/
public function listAlarms($time, $user = null)
{
- require_once dirname(__FILE__) . '/base.php';
require_once 'Horde/Group.php';
if ((empty($user) || $user != Horde_Auth::getAuth()) && !Horde_Auth::isAdmin()) {
/**
* Nag application API.
*
+ * This file defines Horde's core API interface. Other core Horde libraries
+ * can interact with Horde through this API.
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
* @package Nag
*/
+
+/* Determine the base directories. */
+if (!defined('NAG_BASE')) {
+ define('NAG_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(NAG_BASE . '/config/horde.local.php')) {
+ include NAG_BASE . '/config/horde.local.php';
+ } else {
+ define('HORDE_BASE', NAG_BASE . '/..');
+ }
+}
+
+/* Load the Horde Framework core (needed to autoload
+ * Horde_Registry_Application::). */
+require_once HORDE_BASE . '/lib/core.php';
+
class Nag_Application extends Horde_Registry_Application
{
/**
public $version = 'H4 (3.0-git)';
/**
+ * Initialization function.
+ *
+ * Global variables defined:
+ * $nag_shares - TODO
+ */
+ protected function _init()
+ {
+ // Set the timezone variable.
+ Horde_Nls::setTimeZone();
+
+ // Create a share instance.
+ $GLOBALS['nag_shares'] = Horde_Share::singleton($GLOBALS['registry']->getApp());
+
+ Nag::initialize();
+ }
+
+ /**
+ * Initialization for Notification system.
+ *
+ * Global variables defined:
+ * $kronolith_notify - A Horde_Notification_Listener object.
+ *
+ * @param Horde_Notification_Handler_Base $notify The notification
+ * object.
+ */
+ protected function _initNotification($notify)
+ {
+ $notify->attach('status', null, 'Nag_Notification_Listener_Status');
+ }
+
+ /**
* Returns a list of available permissions.
*
* @return array An array describing all available permissions.
*/
public function removeUserData($user)
{
- require_once dirname(__FILE__) . '/base.php';
-
if (!Horde_Auth::isAdmin() && $user != Horde_Auth::getAuth()) {
return PEAR::raiseError(_("You are not allowed to remove user data."));
}
function _params()
{
- require_once dirname(__FILE__) . '/../base.php';
$cManager = new Horde_Prefs_CategoryManager();
$categories = array();
foreach ($cManager->get() as $c) {
function _content()
{
global $registry, $prefs;
- require_once dirname(__FILE__) . '/../base.php';
$now = time();
$html = '';
function _buildTree(&$tree, $indent = 0, $parent = null)
{
- require_once dirname(__FILE__) . '/../base.php';
-
$horde_alarm = null;
if (!empty($GLOBALS['conf']['alarms']['driver'])) {
$horde_alarm = Horde_Alarm::factory();
{
global $registry;
- require_once dirname(__FILE__) . '/../base.php';
-
$add = Horde::applicationUrl('task.php?actionID=add_task');
$icondir = $registry->getImageDir();
+++ /dev/null
-<?php
-/**
- * Script to determine the correct *_BASE values.
- *
- * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * @package Nag
- */
-
-if (!defined('NAG_BASE')) {
- define('NAG_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(NAG_BASE . '/config/horde.local.php')) {
- include NAG_BASE . '/config/horde.local.php';
- } else {
- define('HORDE_BASE', NAG_BASE . '/..');
- }
-}
+++ /dev/null
-<?php
-/**
- * Nag base inclusion file.
- *
- * This file brings in all of the dependencies that every Nag
- * script will need and sets up objects that all scripts use.
- *
- * The following global variables are used:
- * $no_compress - Controls whether the page should be compressed
- */
-
-// Determine BASE directories.
-require_once dirname(__FILE__) . '/base.load.php';
-
-// Load the Horde Framework core, and set up inclusion paths.
-require_once HORDE_BASE . '/lib/core.php';
-
-// Registry.
-$s_ctrl = 0;
-switch (Horde_Util::nonInputVar('nag_session_control')) {
-case 'none':
- $s_ctrl = Horde_Registry::SESSION_NONE;
- break;
-
-case 'readonly':
- $s_ctrl = Horde_Registry::SESSION_READONLY;
- break;
-}
-$registry = Horde_Registry::singleton($s_ctrl);
-
-try {
- $registry->pushApp('nag', array('check_perms' => (Horde_Util::nonInputVar('nag_authentication') != 'none'), 'logintasks' => true));
-} catch (Horde_Exception $e) {
- Horde_Auth::authenticateFailure('nag', $e);
-}
-$conf = &$GLOBALS['conf'];
-@define('NAG_TEMPLATES', $registry->get('templates'));
-
-// Notification system.
-$notification = Horde_Notification::singleton();
-$notification->attach('status', null, 'Nag_Notification_Listener_Status');
-
-// Start compression.
-if (!Horde_Util::nonInputVar('no_compress')) {
- Horde::compressOutput();
-}
-
-// Set the timezone variable.
-Horde_Nls::setTimeZone();
-
-// Create a share instance.
-$GLOBALS['nag_shares'] = Horde_Share::singleton($registry->getApp());
-
-Nag::initialize();
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*/
-require_once dirname(__FILE__) . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+Horde_Registry::appInit('nag');
$vars = Horde_Variables::getDefaultVariables();
<?php
-require_once dirname(__FILE__) . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+Horde_Registry::appInit('nag');
if ($quickText = Horde_Util::getPost('quickText')) {
$result = $registry->tasks->quickAdd($quickText);
*/
// Do CLI checks and environment setup first.
-require_once dirname(__FILE__) . '/../lib/base.load.php';
-require_once HORDE_BASE . '/lib/core.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
// Make sure no one runs this from the web.
if (!Horde_Cli::runningFromCLI()) {
*/
// Do CLI checks and environment setup first.
-require_once dirname(__FILE__) . '/../../lib/base.load.php';
-require_once HORDE_BASE . '/lib/core.php';
+require_once dirname(__FILE__) . '/../../lib/Application.php';
// Make sure no one runs this from the web.
if (!Horde_Cli::runningFromCLI()) {
// variables, etc.
Horde_Cli::init();
-$nag_authentication = 'none';
-require_once NAG_BASE . '/lib/base.php';
+Horde_Registry::appInit('nag', array('authentication' => 'none'));
if ($conf['storage']['driver'] != 'sql') {
exit('No conversion for drivers other than SQL currently.');
*/
/* Set up the CLI environment */
-require_once dirname(__FILE__) . '/../../lib/base.load.php';
-require_once HORDE_BASE . '/lib/core.php';
+require_once dirname(__FILE__) . '/../../lib/Application.php';
if (!Horde_Cli::runningFromCli()) {
exit("Must be run from the command line\n");
}
*/
// Do CLI checks and environment setup first.
-require_once dirname(__FILE__) . '/../../lib/base.load.php';
-require_once HORDE_BASE . '/lib/core.php';
+require_once dirname(__FILE__) . '/../../lib/Application.php';
// Make sure no one runs this from the web.
if (!Horde_Cli::runningFromCLI()) {
$cli = Horde_Cli::singleton();
$cli->init();
-$nag_authentication = 'none';
-require_once NAG_BASE . '/lib/base.php';
+Horde_Registry::appInit('nag', array('authentication' => 'none'));
$history = Horde_History::singleton();
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*/
-require_once dirname(__FILE__) . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+Horde_Registry::appInit('nag');
$title = _("Search");
$notification->push('document.search.search_pattern.focus()', 'javascript');
exit;
}
-require_once dirname(__FILE__) . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+Horde_Registry::appInit('nag');
+
require_once NAG_BASE . '/lib/Forms/task.php';
$vars = Horde_Variables::getDefaultVariables();
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*/
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+Horde_Registry::appInit('nag');
+
require_once NAG_BASE . '/lib/Forms/CreateTaskList.php';
// Exit if this isn't an authenticated user or if the user can't
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*/
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+Horde_Registry::appInit('nag');
+
require_once NAG_BASE . '/lib/Forms/DeleteTaskList.php';
// Exit if this isn't an authenticated user.
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*/
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+Horde_Registry::appInit('nag');
+
require_once NAG_BASE . '/lib/Forms/EditTaskList.php';
// Exit if this isn't an authenticated user.
return $url;
}
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+Horde_Registry::appInit('nag');
/* Exit if this isn't an authenticated user. */
if (!Horde_Auth::getAuth()) {
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*/
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+Horde_Registry::appInit('nag');
// Exit if this isn't an authenticated user.
if (!Horde_Auth::getAuth()) {
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*/
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+Horde_Registry::appInit('nag');
$search = Horde_Util::getGet('q');
if (!$search) {
* @author Chuck Hagenbuch <chuck@horde.org>
*/
-@define('AUTH_HANDLER', true);
-@define('NAG_BASE', dirname(__FILE__) . '/..');
-require_once NAG_BASE . '/lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+Horde_Registry::appInit('nag');
header('Content-Type: text/css');
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*/
-require_once dirname(__FILE__) . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+Horde_Registry::appInit('nag');
/* We can either have a UID or a taskId and a tasklist. Check for
* UID first. */