From: Jan Schneider Date: Tue, 20 Jul 2010 22:07:08 +0000 (+0200) Subject: Redirect to ajax interface when trying to access a tradtional page directly. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=00a3d252c7f0b694fdb6599ad22728465d6cf6c5;p=horde.git Redirect to ajax interface when trying to access a tradtional page directly. --- diff --git a/kronolith/add.php b/kronolith/add.php index fa69eac74..8baa25b9a 100644 --- a/kronolith/add.php +++ b/kronolith/add.php @@ -9,6 +9,11 @@ require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)); + exit; +} + if (!Horde_Util::getFormData('cancel')) { $targetcalendar = Horde_Util::getFormData('targetcalendar'); if (strpos($targetcalendar, ':')) { diff --git a/kronolith/attendees.php b/kronolith/attendees.php index be23be6d2..18b56ee0d 100644 --- a/kronolith/attendees.php +++ b/kronolith/attendees.php @@ -10,6 +10,11 @@ require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)); + exit; +} + // Get the current attendees array from the session cache. $attendees = (isset($_SESSION['kronolith']['attendees']) && is_array($_SESSION['kronolith']['attendees'])) diff --git a/kronolith/calendars/create.php b/kronolith/calendars/create.php index a637faf15..4255fc2a3 100644 --- a/kronolith/calendars/create.php +++ b/kronolith/calendars/create.php @@ -11,6 +11,11 @@ require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)->addAnchor('calendar:internal')); + exit; +} + require_once KRONOLITH_BASE . '/lib/Forms/CreateCalendar.php'; // Exit if this isn't an authenticated user or if the user can't diff --git a/kronolith/calendars/delete.php b/kronolith/calendars/delete.php index ddc7dd8d4..47563470c 100644 --- a/kronolith/calendars/delete.php +++ b/kronolith/calendars/delete.php @@ -26,6 +26,12 @@ if ($calendar_id == $GLOBALS['registry']->getAuth()) { header('Location: ' . Horde::applicationUrl('calendars/', true)); exit; } + +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)->addAnchor('calendar:internal|' . $calendar_id)); + exit; +} + try { $calendar = $kronolith_shares->getShare($calendar_id); } catch (Exception $e) { diff --git a/kronolith/calendars/edit.php b/kronolith/calendars/edit.php index a3cebd597..5b3252f49 100644 --- a/kronolith/calendars/edit.php +++ b/kronolith/calendars/edit.php @@ -11,6 +11,13 @@ require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('kronolith'); +$vars = Horde_Variables::getDefaultVariables(); + +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)->addAnchor('calendar:internal|' . $vars->get('c'))); + exit; +} + require_once KRONOLITH_BASE . '/lib/Forms/EditCalendar.php'; // Exit if this isn't an authenticated user. @@ -19,7 +26,6 @@ if (!$GLOBALS['registry']->getAuth()) { exit; } -$vars = Horde_Variables::getDefaultVariables(); try { $calendar = $kronolith_shares->getShare($vars->get('c')); } catch (Exception $e) { diff --git a/kronolith/calendars/index.php b/kronolith/calendars/index.php index 6e939de6e..341b59fd7 100644 --- a/kronolith/calendars/index.php +++ b/kronolith/calendars/index.php @@ -24,6 +24,11 @@ function shorten_url($url, $separator = '...', $first_chunk_length = 35, $last_c require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)); + exit; +} + // Exit if this isn't an authenticated user. if (!$GLOBALS['registry']->getAuth()) { header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php')); diff --git a/kronolith/calendars/remote_edit.php b/kronolith/calendars/remote_edit.php index 06ea750d8..fdedbb995 100644 --- a/kronolith/calendars/remote_edit.php +++ b/kronolith/calendars/remote_edit.php @@ -11,6 +11,14 @@ require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('kronolith'); +$vars = Horde_Variables::getDefaultVariables(); +$url = $vars->get('url'); + +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)->addAnchor('calendar:remote|' . rawurlencode($url))); + exit; +} + require_once KRONOLITH_BASE . '/lib/Forms/EditRemoteCalendar.php'; // Exit if this isn't an authenticated user or if the user can't @@ -20,9 +28,6 @@ if (!$GLOBALS['registry']->getAuth() || $prefs->isLocked('remote_cals')) { exit; } -$vars = Horde_Variables::getDefaultVariables(); -$url = $vars->get('url'); - $remote_calendar = null; $remote_calendars = unserialize($GLOBALS['prefs']->getValue('remote_cals')); foreach ($remote_calendars as $key => $calendar) { diff --git a/kronolith/calendars/remote_subscribe.php b/kronolith/calendars/remote_subscribe.php index 0f5dcd899..b16bd524b 100644 --- a/kronolith/calendars/remote_subscribe.php +++ b/kronolith/calendars/remote_subscribe.php @@ -11,6 +11,14 @@ require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('kronolith'); +$vars = Horde_Variables::getDefaultVariables(); +$url = $vars->get('url'); + +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)->addAnchor('calendar:remote|' . rawurlencode($url))); + exit; +} + require_once KRONOLITH_BASE . '/lib/Forms/SubscribeRemoteCalendar.php'; // Exit if this isn't an authenticated user or if the user can't @@ -20,14 +28,13 @@ if (!$GLOBALS['registry']->getAuth() || $prefs->isLocked('remote_cals')) { exit; } -$vars = Horde_Variables::getDefaultVariables(); $form = new Kronolith_SubscribeRemoteCalendarForm($vars); // Execute if the form is valid. if ($form->validate($vars)) { try { $form->execute(); - $notification->push(sprintf(_("You have been subscribed to \"%s\" (%s)."), $vars->get('name'), $vars->get('url')), 'horde.success'); + $notification->push(sprintf(_("You have been subscribed to \"%s\" (%s)."), $vars->get('name'), $url), 'horde.success'); } catch (Exception $e) { $notification->push($e, 'horde.error'); } diff --git a/kronolith/calendars/remote_unsubscribe.php b/kronolith/calendars/remote_unsubscribe.php index c8dd3288e..fe52eff7c 100644 --- a/kronolith/calendars/remote_unsubscribe.php +++ b/kronolith/calendars/remote_unsubscribe.php @@ -11,6 +11,14 @@ require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('kronolith'); +$vars = Horde_Variables::getDefaultVariables(); +$url = $vars->get('url'); + +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)->addAnchor('calendar:remote|' . rawurlencode($url))); + exit; +} + require_once KRONOLITH_BASE . '/lib/Forms/UnsubscribeRemoteCalendar.php'; // Exit if this isn't an authenticated user or if the user can't @@ -20,12 +28,11 @@ if (!$GLOBALS['registry']->getAuth() || $prefs->isLocked('remote_cals')) { exit; } -$vars = Horde_Variables::getDefaultVariables(); $remote_calendar = null; $remote_calendars = unserialize($GLOBALS['prefs']->getValue('remote_cals')); foreach ($remote_calendars as $key => $calendar) { - if ($calendar['url'] == $vars->get('url')) { + if ($calendar['url'] == $url) { $remote_calendar = $calendar; break; } diff --git a/kronolith/contacts.php b/kronolith/contacts.php index ce401b67f..5d0d5df33 100644 --- a/kronolith/contacts.php +++ b/kronolith/contacts.php @@ -9,6 +9,11 @@ require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)); + exit; +} + if (!$GLOBALS['registry']->getAuth()) { echo Horde::wrapInlineScript(array('window.close();')); exit; diff --git a/kronolith/data.php b/kronolith/data.php index 78750e9ae..dd28ed04d 100644 --- a/kronolith/data.php +++ b/kronolith/data.php @@ -18,6 +18,11 @@ function _cleanupData() require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)); + exit; +} + if (!$conf['menu']['import_export']) { require KRONOLITH_BASE . '/index.php'; exit; diff --git a/kronolith/day.php b/kronolith/day.php index 91b286caf..a74b14c8c 100644 --- a/kronolith/day.php +++ b/kronolith/day.php @@ -12,6 +12,11 @@ require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)->addAnchor('day:' . Kronolith::currentDate()->dateString())); + exit; +} + $view = Kronolith::getView('Day'); $title = $view->getTime($prefs->getValue('date_format')); diff --git a/kronolith/delete.php b/kronolith/delete.php index 0d521760f..1aafd8f5b 100644 --- a/kronolith/delete.php +++ b/kronolith/delete.php @@ -12,6 +12,11 @@ require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)); + exit; +} + if (Kronolith_Resource::isResourceCalendar($c = Horde_Util::getFormData('calendar'))) { $driver = 'Resource'; } else { diff --git a/kronolith/edit.php b/kronolith/edit.php index d68e194f9..f3201186a 100644 --- a/kronolith/edit.php +++ b/kronolith/edit.php @@ -42,6 +42,11 @@ function _check_max() require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)); + exit; +} + $kronolith_driver = Kronolith::getDriver(); if ($exception = Horde_Util::getFormData('del_exception')) { diff --git a/kronolith/event.php b/kronolith/event.php index fac4fc522..675bf0d88 100644 --- a/kronolith/event.php +++ b/kronolith/event.php @@ -20,6 +20,11 @@ if (is_string($view->event)) { exit; } +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)->addAnchor('event:' . $view->event->calendarType . '|' . $view->event->calendar . ':' . $view->event->id . ':' . Horde_Util::getFormData('datetime', Kronolith::currentDate()->dateString()))); + exit; +} + switch ($viewName) { case 'DeleteEvent': /* Shortcut when we're deleting events and don't want confirmation. */ diff --git a/kronolith/month.php b/kronolith/month.php index 036fe96c3..7957617cc 100644 --- a/kronolith/month.php +++ b/kronolith/month.php @@ -11,6 +11,11 @@ require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)->addAnchor('month:' . Kronolith::currentDate()->dateString())); + exit; +} + $view = Kronolith::getView('Month'); $title = $view->date->strftime('%B %Y'); diff --git a/kronolith/new.php b/kronolith/new.php index 157cc3121..2b86c91c8 100644 --- a/kronolith/new.php +++ b/kronolith/new.php @@ -11,6 +11,11 @@ require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)->addAnchor('event')); + exit; +} + /* Check permissions. */ $url = Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true) ->add(array('month' => Horde_Util::getFormData('month'), diff --git a/kronolith/perms.php b/kronolith/perms.php index 0402251d2..154836fe1 100644 --- a/kronolith/perms.php +++ b/kronolith/perms.php @@ -12,6 +12,11 @@ require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)); + exit; +} + // Exit if the user shouldn't be able to change share permissions. if (!empty($conf['share']['no_sharing'])) { throw new Horde_Exception('Permission denied.'); diff --git a/kronolith/resources/create.php b/kronolith/resources/create.php index 557775ea0..859f462ce 100644 --- a/kronolith/resources/create.php +++ b/kronolith/resources/create.php @@ -11,6 +11,11 @@ require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)); + exit; +} + // Exit if this isn't an authenticated, administrative user if (!$registry->isAdmin()) { header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)); diff --git a/kronolith/resources/delete.php b/kronolith/resources/delete.php index 26dac0846..f25854719 100644 --- a/kronolith/resources/delete.php +++ b/kronolith/resources/delete.php @@ -11,6 +11,11 @@ require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)); + exit; +} + require_once KRONOLITH_BASE . '/lib/Forms/DeleteResource.php'; // Exit if this isn't an authenticated administrative user. diff --git a/kronolith/resources/edit.php b/kronolith/resources/edit.php index 849ac9da1..4c546f760 100644 --- a/kronolith/resources/edit.php +++ b/kronolith/resources/edit.php @@ -11,6 +11,11 @@ require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)); + exit; +} + require_once KRONOLITH_BASE . '/lib/Forms/EditResource.php'; // Exit if this isn't an authenticated administrative user. diff --git a/kronolith/resources/index.php b/kronolith/resources/index.php index 717de8605..0fc6bd8e2 100644 --- a/kronolith/resources/index.php +++ b/kronolith/resources/index.php @@ -7,6 +7,11 @@ require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)); + exit; +} + $title = _("Edit resources"); require KRONOLITH_TEMPLATES . '/common-header.inc'; diff --git a/kronolith/search.php b/kronolith/search.php index 53b3b2740..1e71aa630 100644 --- a/kronolith/search.php +++ b/kronolith/search.php @@ -11,6 +11,11 @@ require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)); + exit; +} + /* Get search parameters. */ $search_mode = Horde_Util::getFormData('search_mode', 'basic'); $search_calendar = explode('|', Horde_Util::getFormData('calendar', '|__any'), 2); diff --git a/kronolith/view.php b/kronolith/view.php index 87be97b62..d36db6b13 100644 --- a/kronolith/view.php +++ b/kronolith/view.php @@ -11,6 +11,11 @@ require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)); + exit; +} + $view = Kronolith::getView(Horde_Util::getFormData('view')); if ($view) { Kronolith::tabs(strtolower(str_replace('kronolith_view_', '', Horde_String::lower(get_class($view))))); diff --git a/kronolith/week.php b/kronolith/week.php index c07cc9f3f..11d460c51 100644 --- a/kronolith/week.php +++ b/kronolith/week.php @@ -12,6 +12,11 @@ require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)->addAnchor('week:' . Kronolith::currentDate()->dateString())); + exit; +} + $view = Kronolith::getView('Week'); $title = sprintf(_("Week %d"), $view->week); diff --git a/kronolith/workweek.php b/kronolith/workweek.php index c5a51c288..cfcf4f011 100644 --- a/kronolith/workweek.php +++ b/kronolith/workweek.php @@ -12,6 +12,11 @@ require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)->addAnchor('week:' . Kronolith::currentDate()->dateString())); + exit; +} + $view = Kronolith::getView('WorkWeek'); $title = sprintf(_("Week %d"), $view->week); diff --git a/kronolith/year.php b/kronolith/year.php index 5db8cde3b..a729de80f 100644 --- a/kronolith/year.php +++ b/kronolith/year.php @@ -12,6 +12,11 @@ require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('kronolith'); +if (Kronolith::showAjaxView()) { + header('Location: ' . Horde::applicationUrl('', true)->addAnchor('year:' . Kronolith::currentDate()->dateString())); + exit; +} + $view = Kronolith::getView('Year'); $title = $view->year;