Redirect to ajax interface when trying to access a tradtional page directly.
authorJan Schneider <jan@horde.org>
Tue, 20 Jul 2010 22:07:08 +0000 (00:07 +0200)
committerJan Schneider <jan@horde.org>
Mon, 26 Jul 2010 21:34:08 +0000 (23:34 +0200)
27 files changed:
kronolith/add.php
kronolith/attendees.php
kronolith/calendars/create.php
kronolith/calendars/delete.php
kronolith/calendars/edit.php
kronolith/calendars/index.php
kronolith/calendars/remote_edit.php
kronolith/calendars/remote_subscribe.php
kronolith/calendars/remote_unsubscribe.php
kronolith/contacts.php
kronolith/data.php
kronolith/day.php
kronolith/delete.php
kronolith/edit.php
kronolith/event.php
kronolith/month.php
kronolith/new.php
kronolith/perms.php
kronolith/resources/create.php
kronolith/resources/delete.php
kronolith/resources/edit.php
kronolith/resources/index.php
kronolith/search.php
kronolith/view.php
kronolith/week.php
kronolith/workweek.php
kronolith/year.php

index fa69eac..8baa25b 100644 (file)
@@ -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, ':')) {
index be23be6..18b56ee 100644 (file)
 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']))
index a637faf..4255fc2 100644 (file)
 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
index ddc7dd8..4756347 100644 (file)
@@ -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) {
index a3cebd5..5b3252f 100644 (file)
 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) {
index 6e939de..341b59f 100644 (file)
@@ -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'));
index 06ea750..fdedbb9 100644 (file)
 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) {
index 0f5dcd8..b16bd52 100644 (file)
 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');
     }
index c8dd328..fe52eff 100644 (file)
 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;
     }
index ce401b6..5d0d5df 100644 (file)
@@ -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;
index 78750e9..dd28ed0 100644 (file)
@@ -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;
index 91b286c..a74b14c 100644 (file)
 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'));
 
index 0d52176..1aafd8f 100644 (file)
 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 {
index d68e194..f320118 100644 (file)
@@ -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')) {
index fac4fc5..675bf0d 100644 (file)
@@ -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. */
index 036fe96..7957617 100644 (file)
 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');
 
index 157cc31..2b86c91 100644 (file)
 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'),
index 0402251..154836f 100644 (file)
 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.');
index 557775e..859f462 100644 (file)
 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));
index 26dac08..f258547 100644 (file)
 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.
index 849ac9d..4c546f7 100644 (file)
 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.
index 717de86..0fc6bd8 100644 (file)
@@ -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';
index 53b3b27..1e71aa6 100644 (file)
 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);
index 87be97b..d36db6b 100644 (file)
 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)))));
index c07cc9f..11d460c 100644 (file)
 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);
 
index c5a51c2..cfcf4f0 100644 (file)
 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);
 
index 5db8cde..a729de8 100644 (file)
 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;