Use Horde_Url.
authorJan Schneider <jan@horde.org>
Tue, 8 Dec 2009 23:46:11 +0000 (00:46 +0100)
committerJan Schneider <jan@horde.org>
Tue, 8 Dec 2009 23:46:27 +0000 (00:46 +0100)
28 files changed:
kronolith/add.php
kronolith/attendees.php
kronolith/delete.php
kronolith/edit.php
kronolith/event.php
kronolith/feed/index.php
kronolith/lib/Block/month.php
kronolith/lib/Block/prevmonthlist.php
kronolith/lib/Block/summary.php
kronolith/lib/Event.php
kronolith/lib/FreeBusy/View.php
kronolith/lib/Kronolith.php
kronolith/lib/View/Day.php
kronolith/lib/View/EditEvent.php
kronolith/lib/View/Month.php
kronolith/lib/View/Week.php
kronolith/lib/View/Year.php
kronolith/new.php
kronolith/resources/groups/index.php
kronolith/resources/index.php
kronolith/templates/calendar_list.php
kronolith/templates/delete/delete.inc
kronolith/templates/delete/one.inc
kronolith/templates/panel.inc
kronolith/templates/prefs/fb_cals_select.inc
kronolith/templates/search/search.inc
kronolith/templates/search/search_advanced.inc
kronolith/templates/week/head.inc

index e7d1a10..f9be6ff 100644 (file)
@@ -52,11 +52,13 @@ if (!Horde_Util::getFormData('cancel')) {
     }
 }
 
-if ($url = Horde_Util::getFormData('url')) {
-    header('Location: ' . $url);
+if (!empty($url = Horde_Util::getFormData('url'))) {
+    $url = new Horde_Url($url, true);
 } else {
-    $url = Horde_Util::addParameter($prefs->getValue('defaultview') . '.php',
-                              array('month' => Horde_Util::getFormData('month'),
-                                    'year' => Horde_Util::getFormData('year')));
-    header('Location: ' . Horde::applicationUrl($url, true));
+    $url = Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)
+        ->add(array('month' => Horde_Util::getFormData('month'),
+                    'year' => Horde_Util::getFormData('year')));
 }
+
+// Make sure URL is unique.
+header('Location: ' . $url->add('unique', hash('md5', microtime())));
index b248056..aba3fb5 100644 (file)
@@ -142,18 +142,16 @@ case 'dismiss':
         exit;
     }
 
-    $url = Horde_Util::getFormData('url');
-    if (!empty($url)) {
-        $location = Horde::applicationUrl($url, true);
+    if (!empty($url = Horde_Util::getFormData('url'))) {
+        $url = new Horde_Url($url, true);
     } else {
         $date = new Horde_Date(Horde_Util::getFormData('date'));
-        $url = Horde_Util::addParameter($prefs->getValue('defaultview') . '.php', 'date',  $date->dateString());
-        $location = Horde::applicationUrl($url, true);
+        $url = Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)
+            ->add('date', $date->dateString());
     }
 
     // Make sure URL is unique.
-    $location = Horde_Util::addParameter($location, 'unique', hash('md5', microtime()));
-    header('Location: ' . $location);
+    header('Location: ' . $url->add('unique', hash('md5', microtime())));
     exit;
 
 case 'clear':
index dbc6ec9..ec8284c 100644 (file)
@@ -85,12 +85,13 @@ if ($eventID = Horde_Util::getFormData('eventID')) {
     }
 }
 
-if ($url = Horde_Util::getFormData('url')) {
-    $location = $url;
+if (!empty($url = Horde_Util::getFormData('url'))) {
+    $url = new Horde_Url($url, true);
 } else {
-    $url = Horde_Util::addParameter($prefs->getValue('defaultview') . '.php',
-                              'date', Horde_Util::getFormData('date', date('Ymd')));
-    $location = Horde::applicationUrl($url, true);
+    $date = new Horde_Date(Horde_Util::getFormData('date'));
+    $url = Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)
+        ->add('date', Horde_Util::getFormData('date', date('Ymd')));
 }
 
-header('Location: ' . $location);
+// Make sure URL is unique.
+header('Location: ' . $url->add('unique', hash('md5', microtime())));
index 9c4327a..340dac7 100644 (file)
@@ -39,7 +39,6 @@ function _check_max()
 
 require_once dirname(__FILE__) . '/lib/base.php';
 
-$url = Horde_Util::getFormData('url');
 $kronolith_driver = Kronolith::getDriver();
 
 if ($exception = Horde_Util::getFormData('del_exception')) {
@@ -173,15 +172,13 @@ if ($exception = Horde_Util::getFormData('del_exception')) {
     }
 }
 
-if (!empty($url)) {
-    $location = $url;
+if (!empty($url = Horde_Util::getFormData('url'))) {
+    $url = new Horde_Url($url, true);
 } else {
-    $url = Horde_Util::addParameter($prefs->getValue('defaultview') . '.php',
-                              array('month' => Horde_Util::getFormData('month'),
-                                    'year' => Horde_Util::getFormData('year')));
-    $location = Horde::applicationUrl($url, true);
+    $url = Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)
+        ->add(array('month' => Horde_Util::getFormData('month'),
+                    'year' => Horde_Util::getFormData('year')));
 }
 
 // Make sure URL is unique.
-$location = Horde_Util::addParameter($location, 'unique', hash('md5', microtime()), false);
-header('Location: ' . $location);
+header('Location: ' . $url->add('unique', hash('md5', microtime())));
index 7dc6fe4..a5eecad 100644 (file)
@@ -33,11 +33,12 @@ case 'DeleteEvent':
 case 'EditEvent':
     if ($view->event->isPrivate() &&
         $view->event->getCreatorId() != Horde_Auth::getAuth()) {
-        $url = Horde_Util::getFormData('url');
-        if (empty($url)) {
+        if (!empty($url = Horde_Util::getFormData('url'))) {
+            $url = new Horde_Url($url, true);
+        } else {
             $url = Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true);
         }
-        header('Location: ' . Horde_Util::addParameter($url, 'unique', hash('md5', microtime()), false));
+        header('Location: ' . $url->add('unique', hash('md5', microtime())));
         exit;
     }
     break;
index 4d3c818..62b70ae 100644 (file)
@@ -78,11 +78,11 @@ if (is_a($events, 'PEAR_Error')) {
 }
 
 if (isset($conf['urls']['pretty']) && $conf['urls']['pretty'] == 'rewrite') {
-    $self_url = 'feed/' . $calendar;
+    $self_url = Horde::applicationUrl('feed/' . $calendar, true, -1);
 } else {
-    $self_url = Horde_Util::addParameter('feed/index.php', 'c', $calendar);
+    $self_url = Horde::applicationUrl('feed/index.php', true, -1)
+        ->add('c', $calendar);
 }
-$self_url = Horde::applicationUrl($self_url, true, -1);
 
 $owner = $share->get('owner');
 $identity = Horde_Prefs_Identity::factory('none', $owner);
index 7239d22..f443b31 100644 (file)
@@ -35,21 +35,21 @@ class Horde_Block_Kronolith_month extends Horde_Block {
      */
     function _title()
     {
-        global $registry;
         require_once dirname(__FILE__) . '/../base.php';
 
         $title = _("All Calendars");
-        $url_params = array();
-        if (isset($this->_params['calendar']) && $this->_params['calendar'] != '__all') {
-            $this->_share = &$GLOBALS['kronolith_shares']->getShare($this->_params['calendar']);
+        $url = Horde::url($GLOBALS['registry']->getInitialPage(), true);
+        if (isset($this->_params['calendar']) &&
+            $this->_params['calendar'] != '__all') {
+            $this->_share = $GLOBALS['kronolith_shares']->getShare($this->_params['calendar']);
             if (!is_a($this->_share, 'PEAR_Error')) {
-                $url_params = array('display_cal' => $this->_params['calendar']);
+                $url->add('display_cal', $this->_params['calendar']);
                 $title = htmlspecialchars($this->_share->get('name'));
             }
         }
         $date = new Horde_Date(time());
 
-        return $title . ', ' . Horde::link(Horde::url(Horde_Util::addParameter($registry->getInitialPage(), $url_params), true)) . $date->strftime('%B, %Y') . '</a>';
+        return $title . ', ' . $url->link() . $date->strftime('%B, %Y') . '</a>';
     }
 
     /**
@@ -168,14 +168,13 @@ class Horde_Block_Kronolith_month extends Horde_Block {
             }
             $html .= '<td align="center" class="' . $td_class . '">';
 
-            $url_params = array('date' => $date_ob->dateString());
+            /* Set up the link to the day view. */
+            $url = Horde::applicationUrl('day.php', true)
+                ->add('date', $date_ob->dateString());
             if (isset($this->_params['calendar']) &&
                 $this->_params['calendar'] != '__all') {
-                $url_params['display_cal'] = $this->_params['calendar'];
+                $url->add('display_cal', $this->_params['calendar']);
             }
-            /* Set up the link to the day view. */
-            $url = Horde_Util::addParameter(Horde::applicationUrl('day.php', true),
-                                      $url_params);
 
             $date_stamp = $date_ob->dateString();
             if (empty($all_events[$date_stamp])) {
index ece26dd..1693554 100644 (file)
@@ -40,12 +40,12 @@ class Horde_Block_Kronolith_prevmonthlist extends Horde_Block {
      */
     function _title()
     {
-        if (isset($this->_params['calendar']) && $this->_params['calendar'] != '__all') {
-            $url_params = array('display_cal' => $this->_params['calendar']);
-        } else {
-            $url_params = array();
+        $url = Horde::url($GLOBALS['registry']->getInitialPage(), true);
+        if (isset($this->_params['calendar']) &&
+            $this->_params['calendar'] != '__all') {
+            $url->add('display_cal', $this->_params['calendar']);
         }
-        return Horde::link(Horde::url(Horde_Util::addParameter($GLOBALS['registry']->getInitialPage(), $url_params), true)) . _("Prior Events") . '</a>';
+        return $url->link() . _("Prior Events") . '</a>';
     }
 
     /**
index 0bbe8fd..3245c52 100644 (file)
@@ -63,14 +63,12 @@ class Horde_Block_Kronolith_summary extends Horde_Block {
      */
     function _title()
     {
-        global $registry;
-
-        if (isset($this->_params['calendar']) && $this->_params['calendar'] != '__all') {
-            $url_params = array('display_cal' => $this->_params['calendar']);
-        } else {
-            $url_params = array();
+        $url = Horde::url($GLOBALS['registry']->getInitialPage(), true);
+        if (isset($this->_params['calendar']) &&
+            $this->_params['calendar'] != '__all') {
+            $url->add('display_cal', $this->_params['calendar']);
         }
-        return Horde::link(Horde::url(Horde_Util::addParameter($registry->getInitialPage(), $url_params), true)) . htmlspecialchars($registry->get('name')) . '</a>';
+        return $url->link() . htmlspecialchars($registry->get('name')) . '</a>';
     }
 
     /**
@@ -164,16 +162,14 @@ class Horde_Block_Kronolith_summary extends Horde_Block {
                     } else {
                         $dayname = $day->strftime($prefs->getValue('date_format'));
                     }
-                    $url_params = array('date' => $day->dateString());
+                    $url = Horde::applicationUrl('day.php', true)
+                        ->add('date', $day->dateString());
                     if (isset($this->_params['calendar']) &&
                         $this->_params['calendar'] != '__all') {
-                        $url_params['display_cal'] = $this->_params['calendar'];
+                        $url->add('display_cal', $this->_params['calendar']);
                     }
-                    $daylink = Horde::applicationUrl('day.php', true);
-                    $daylink = Horde_Util::addParameter($daylink, $url_params);
-                    $html .= Horde::link($daylink, sprintf(_("Goto %s"),
-                                                           $dayname));
-                    $html .= $dayname . '</a></strong></td></tr>';
+                    $html .= $url->link(array('title' => sprintf(_("Goto %s"), $dayname)))
+                        . $dayname . '</a></strong></td></tr>';
                     $firstevent = false;
                     $firstday = false;
                 }
index 2fb2d1f..9ba48e4 100644 (file)
@@ -1315,7 +1315,12 @@ abstract class Kronolith_Event
                                            'mday' => $match[3]));
         $formatted = $horde_date->strftime($GLOBALS['prefs']->getValue('date_format'));
         return $formatted
-            . Horde::link(Horde_Util::addParameter(Horde::applicationUrl('edit.php'), array('calendar' => $this->getCalendar(), 'eventID' => $this->eventID, 'del_exception' => $date, 'url' => Horde_Util::getFormData('url'))), sprintf(_("Delete exception on %s"), $formatted))
+            . Horde::applicationUrl('edit.php')
+            ->add(array('calendar' => $this->getCalendar(),
+                        'eventID' => $this->eventID,
+                        'del_exception' => $date,
+                        'url' => Horde_Util::getFormData('url')))
+            ->link(array('title' => sprintf(_("Delete exception on %s"), $formatted)))
             . Horde::img('delete-small.png', _("Delete"), '', $GLOBALS['registry']->getImageDir('horde'))
             . '</a>';
     }
index 015ca4f..78b2641 100644 (file)
@@ -80,10 +80,10 @@ class Kronolith_FreeBusy_View {
         $optimal->merge($required, false);
         $optimal->merge($optional);
 
-        $base_url = Horde::selfUrl();
-        $base_url = Horde_Util::removeParameter($base_url, 'date');
-        $base_url = Horde_Util::removeParameter($base_url, 'fbview');
-        $base_url = Horde_Util::addParameter($base_url, 'fbview', $this->view);
+        $base_url = Horde::selfUrl()
+            ->remove('date')
+            ->remove('fbview')
+            ->add('fbview', $this->view);
 
         $template = new Horde_Template();
         $template->set('title', $this->_title());
index 8547443..e09ac4f 100644 (file)
@@ -1519,11 +1519,10 @@ class Kronolith
     {
         if (isset($GLOBALS['conf']['urls']['pretty']) &&
             $GLOBALS['conf']['urls']['pretty'] == 'rewrite') {
-            $feed_url = 'feed/' . $calendar;
-        } else {
-            $feed_url = Horde_Util::addParameter('feed/index.php', 'c', $calendar);
+            return Horde::applicationUrl('feed/' . $calendar, true, -1);
         }
-        return Horde::applicationUrl($feed_url, true, -1);
+        return Horde::applicationUrl('feed/index.php', true, -1)
+            ->add('c', $calendar);
     }
 
     /**
@@ -1687,7 +1686,7 @@ class Kronolith
 
         $myemail = $ident->getValue('from_addr');
         if (!$myemail) {
-            $notification->push(sprintf(_("You do not have an email address configured in your Personal Information Options. You must set one %shere%s before event notifications can be sent."), Horde::link(Horde_Util::addParameter(Horde::getServiceLink('options', 'kronolith'), array('app' => 'horde', 'group' => 'identities'))), '</a>'), 'horde.error', array('content.raw'));
+            $notification->push(sprintf(_("You do not have an email address configured in your Personal Information Options. You must set one %shere%s before event notifications can be sent."), Horde::getServiceLink('options', 'kronolith')->add(array('app' => 'horde', 'group' => 'identities'))->link(), '</a>'), 'horde.error', array('content.raw'));
             return;
         }
 
@@ -1753,8 +1752,11 @@ class Kronolith
             $message .= _("Attached is an iCalendar file with more information about the event. If your mail client supports iTip requests you can use this file to easily update your local copy of the event.");
 
             if ($action == self::ITIP_REQUEST) {
-                $attend_link = Horde_Util::addParameter(Horde::applicationUrl('attend.php', true, -1), array('c' => $event->getCalendar(), 'e' => $event->getId(), 'u' => $email), null, false);
-                $message .= "\n\n" . sprintf(_("If your email client doesn't support iTip requests you can use one of the following links to accept or decline the event.\n\nTo accept the event:\n%s\n\nTo accept the event tentatively:\n%s\n\nTo decline the event:\n%s\n"), Horde_Util::addParameter($attend_link, 'a', 'accept', false), Horde_Util::addParameter($attend_link, 'a', 'tentative', false), Horde_Util::addParameter($attend_link, 'a', 'decline', false));
+                $attend_link = Horde::applicationUrl('attend.php', true, -1)
+                    ->add(array('c' => $event->getCalendar(),
+                                'e' => $event->getId(),
+                                'u' => $email));
+                $message .= "\n\n" . sprintf(_("If your email client doesn't support iTip requests you can use one of the following links to accept or decline the event.\n\nTo accept the event:\n%s\n\nTo accept the event tentatively:\n%s\n\nTo decline the event:\n%s\n"), $attend_link->add('a', 'accept'), $attend_link->add('a', 'tentative'), $attend_link->add('a', 'decline'));
             }
 
             /* Build the iCalendar data */
@@ -2370,7 +2372,7 @@ class Kronolith
             (!empty($conf['hooks']['permsdenied']) ||
              $GLOBALS['perms']->hasAppPermission('max_events') === true ||
              $GLOBALS['perms']->hasAppPermission('max_events') > self::countEvents())) {
-            $menu->add(Horde_Util::addParameter(Horde::applicationUrl('new.php'), 'url', Horde::selfUrl(true, false, true)), _("_New Event"), 'new.png');
+            $menu->add(Horde::applicationUrl('new.php')->add('url', Horde::selfUrl(true, false, true)), _("_New Event"), 'new.png');
         }
         if ($browser->hasFeature('dom')) {
             Horde::addScriptFile('goto.js', 'kronolith', array('direct' => false));
index b5d9a02..4f112e4 100644 (file)
@@ -90,14 +90,17 @@ class Kronolith_View_Day extends Kronolith_Day {
         echo '<tbody>';
 
         if ($addLinks) {
-            $newEventUrl = Horde_Util::addParameter(
-                'new.php',
-                array('datetime' => sprintf($this->dateString() . '%02d%02d00',
-                                            $this->slots[0]['hour'], $this->slots[0]['min']),
-                      'allday' => 1,
-                      'url' => $this->link(0, true)));
-            $newEventUrl = Horde::link(Horde::applicationUrl($newEventUrl), _("Create a New Event"), 'hour') . _("All day") .
-                Horde::img('new_small.png', '+', array('class' => 'iconAdd')) . '</a>';
+            $newEventUrl = Horde::applicationUrl('new.php')
+                ->add(array('datetime' => sprintf($this->dateString() . '%02d%02d00',
+                                                  $this->slots[0]['hour'], $this->slots[0]['min']),
+                            'allday' => 1,
+                            'url' => $this->link(0, true)))
+                ->link(array('title' => _("Create a New Event"), 'class' =>
+            'hour'))
+                . _("All day")
+                . Horde::img('new_small.png', '+', array('class' =>
+            'iconAdd'))
+                . '</a>';
         } else {
             $newEventUrl = '<span class="hour">' . _("All day") . '</span>';
         }
@@ -255,13 +258,14 @@ class Kronolith_View_Day extends Kronolith_Day {
             }
 
             if ($addLinks) {
-                $newEventUrl = Horde_Util::addParameter(
-                    'new.php',
-                    array('datetime' => sprintf($this->dateString() . '%02d%02d00',
-                                                $this->slots[$i]['hour'], $this->slots[$i]['min']),
-                          'url' => $this->link(0, true)));
-                $newEventUrl = Horde::link(Horde::applicationUrl($newEventUrl), _("Create a New Event"), $hourclass) .
-                    $time . Horde::img('new_small.png', '+', array('class' => 'iconAdd')) . '</a>';
+                $newEventUrl = Horde::applicationUrl('new.php')
+                    ->add(array('datetime' => sprintf($this->dateString() . '%02d%02d00',
+                                                      $this->slots[$i]['hour'], $this->slots[$i]['min']),
+                                'url' => $this->link(0, true)))
+                    ->link(array('title' =>_("Create a New Event"), 'class' => $hourclass))
+                    . $time
+                    . Horde::img('new_small.png', '+', array('class' => 'iconAdd'))
+                    . '</a>';
             } else {
                 $newEventUrl = '<span class="' . $hourclass . '">' . $time . '</span>';
             }
@@ -454,9 +458,8 @@ class Kronolith_View_Day extends Kronolith_Day {
 
     function link($offset = 0, $full = false)
     {
-        return Horde::applicationUrl(
-            Horde_Util::addParameter('day.php', 'date', $this->getTime('%Y%m%d', $offset)),
-            $full);
+        return Horde::applicationUrl('day.php', $full)
+            ->add('date', $this->getTime('%Y%m%d', $offset));
     }
 
     function getName()
index a877dba..2e27827 100644 (file)
@@ -90,9 +90,8 @@ class Kronolith_View_EditEvent {
         if (isset($url)) {
             $cancelurl = $url;
         } else {
-            $cancelurl = Horde_Util::addParameter('month.php', array('month' => $month,
-                                                               'year', $year));
-            $cancelurl = Horde::applicationUrl($cancelurl, true);
+            $cancelurl = Horde::applicationUrl('month.php', true)
+                ->add(array('month' => $month, 'year' => $year));
         }
 
         $event = &$this->event;
index 24a32a4..929a8d8 100644 (file)
@@ -137,7 +137,7 @@ class Kronolith_View_Month {
         $showTime = Kronolith::viewShowTime();
         $day_url = Horde::applicationUrl('day.php');
         $this_link = $this->link(0, true);
-        $new_url = Horde_Util::addParameter(Horde::applicationUrl('new.php'), 'url', $this_link);
+        $new_url = Horde::applicationUrl('new.php')->add('url', $this_link);
         $new_img = Horde::img('new_small.png', '+');
 
         foreach ($this->_currentCalendars as $id => $cal) {
@@ -170,21 +170,24 @@ class Kronolith_View_Month {
 
                 $html .= '<td class="' . $style . '" height="70" width="14%" valign="top"><div>';
 
-                $url = Horde_Util::addParameter($day_url, 'date', $date->dateString());
-                $html .= '<a class="day" href="' . $url . '">' . $date->mday . '</a>';
+                $html .= $day_url->add('date', $date->dateString())
+                    ->link(array('class' => 'day'))
+                    . $date->mday . '</a>';
 
                 if ($addLinks) {
-                    $url = Horde_Util::addParameter($new_url, 'date', $date->dateString());
+                    $new_url->add('date', $date->dateString());
                     if ($sidebyside) {
-                        $url = Horde_Util::addParameter($url, 'calendar', $id);
+                        $new_url->add('calendar', $id);
                     }
-                    $html .= Horde::link($url, _("Create a New Event"), 'newEvent') .
-                        $new_img . '</a>';
+                    $html .= $new_url->link(array('title' => _("Create a New Event"), 'class' => 'newEvent'))
+                        $new_img . '</a>';
                 }
 
                 if ($date->dayOfWeek() == Horde_Date::DATE_MONDAY) {
-                    $url = Horde_Util::addParameter('week.php', 'date', $date->dateString());
-                    $html .= Horde::link(Horde::applicationUrl($url), '', 'week') . sprintf(_("Week %d"), $week) . '</a>';
+                    $html .= Horde::applicationUrl('week.php')
+                        ->add('date', $date->dateString())
+                        ->link(array('class' => 'week'))
+                        . sprintf(_("Week %d"), $week) . '</a>';
                 }
 
                 $html .= '</div><div class="clear">&nbsp;</div>';
@@ -231,7 +234,8 @@ class Kronolith_View_Month {
     function link($offset = 0, $full = false)
     {
         $month = $this->getMonth($offset);
-        return Horde::applicationUrl(Horde_Util::addParameter('month.php', 'date', $month->dateString()), $full);
+        return Horde::applicationUrl('month.php', $full)
+            ->add('date', $month->dateString());
     }
 
     function getName()
index 8ce8c48..d3a551a 100644 (file)
@@ -361,10 +361,8 @@ class Kronolith_View_Week {
     function link($offset = 0, $full = false)
     {
         $week = $this->getWeek($offset);
-        return Horde::applicationUrl(Horde_Util::addParameter($this->_controller,
-                                                        'date',
-                                                        $week->dateString()),
-                                     $full);
+        return Horde::applicationUrl($this->_controller, $full)
+            ->add('date', $week->dateString());
     }
 
     function getName()
index fba4ffa..f2f89ee 100644 (file)
@@ -44,9 +44,11 @@ class Kronolith_View_Year {
             // Heading for each month.
             $date = new Horde_Date(sprintf('%04d%02d01010101', $this->year, $month));
             $mtitle = $date->strftime('%B');
-            $url = Horde_Util::addParameter(Horde::applicationUrl('month.php'), array('date' => $date->dateString()));
-            $html .= '<h2 class="smallheader"><a class="smallheader" href="' . $url . '">' . $mtitle . '</a></h2>' .
-                '<table class="nopadding monthgrid" cellspacing="0" width="100%"><thead><tr class="item">';
+            $html .= '<h2 class="smallheader"><a class="smallheader" href="'
+                . Horde::applicationUrl('month.php')
+                ->add('date', $date->dateString())
+                . '">' . $mtitle . '</a></h2>'
+                . '<table class="nopadding monthgrid" cellspacing="0" width="100%"><thead><tr class="item">';
             if (!$prefs->getValue('week_start_monday')) {
                 $html .= '<th>' . _("Su"). '</th>';
             }
@@ -110,8 +112,8 @@ class Kronolith_View_Year {
                     }
 
                     /* Set up the link to the day view. */
-                    $url = Horde::applicationUrl('day.php', true);
-                    $url = Horde_Util::addParameter($url, 'date', $date->dateString());
+                    $url = Horde::applicationUrl('day.php', true)
+                        ->add('date', $date->dateString());
 
                     if ($date->month != $month) {
                         $cellday = '&nbsp;';
@@ -161,7 +163,8 @@ class Kronolith_View_Year {
 
     function link($offset = 0, $full = false)
     {
-        return Horde::applicationUrl(Horde_Util::addParameter('year.php', 'date', $this->year + $offset) . '0101', $full);
+        return Horde::applicationUrl('year.php', $full)
+            ->add('date', ($this->year + $offset) . '0101');
     }
 
     function getName()
index fd15353..eb2c756 100644 (file)
@@ -11,6 +11,9 @@
 require dirname(__FILE__) . '/lib/base.php';
 
 /* Check permissions. */
+$url = Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)
+      ->add(array('month' => Horde_Util::getFormData('month'),
+                  'year' => Horde_Util::getFormData('year')));
 if ($GLOBALS['perms']->hasAppPermission('max_events') !== true &&
     $GLOBALS['perms']->hasAppPermission('max_events') <= Kronolith::countEvents()) {
     try {
@@ -19,17 +22,13 @@ if ($GLOBALS['perms']->hasAppPermission('max_events') !== true &&
         $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $GLOBALS['perms']->hasAppPermission('max_events')), ENT_COMPAT, Horde_Nls::getCharset());
     }
     $notification->push($message, 'horde.error', array('content.raw'));
-    $url = Horde_Util::addParameter($prefs->getValue('defaultview') . '.php', array('month' => Horde_Util::getFormData('month'),
-                                                                              'year' => Horde_Util::getFormData('year')));
-    header('Location: ' . Horde::applicationUrl($url, true));
+    header('Location: ' . $url);
     exit;
 }
 
 $calendar_id = Horde_Util::getFormData('calendar', Kronolith::getDefaultCalendar(Horde_Perms::EDIT));
 if (!$calendar_id) {
-    $url = Horde_Util::addParameter($prefs->getValue('defaultview') . '.php', array('month' => Horde_Util::getFormData('month'),
-                                                                              'year' => Horde_Util::getFormData('year')));
-    header('Location: ' . Horde::applicationUrl($url, true));
+    header('Location: ' . $url);
 }
 
 $event = Kronolith::getDriver()->getEvent();
@@ -59,9 +58,7 @@ $url = Horde_Util::getFormData('url');
 if (isset($url)) {
     $cancelurl = $url;
 } else {
-    $cancelurl = Horde_Util::addParameter('month.php', array('month' => $month,
-                                                       'year' => $year));
-    $cancelurl = Horde::applicationUrl($cancelurl, true);
+    $cancelurl = Horde::applicationUrl('month.php', true)->add('month', $month);
 }
 
 $title = _("Add a new event");
index c745e76..f5fbd9e 100644 (file)
@@ -58,8 +58,8 @@ function performAction(action, rid)
  <tr>
   <?php if ($isAdmin):?>
   <td>
-       <?php echo Horde::link(Horde_Util::addParameter($delete_url_base, 'c', $resource->getId()), _("Delete")) . $delete_img . '</a>' ?>
-       <?php echo Horde::link(Horde_Util::addParameter($edit_url_base, 'c', $resource->getId()), _("Edit")) . $edit_img . '</a>' ?>
+    <?php echo $delete_url_base->add('c', $resource->getId())->link(array('title' => _("Delete"))) . $delete_img . '</a>' ?>
+    <?php echo $edit_url_base->add('c', $resource->getId())->link(array('title' => _("Edit"))) . $edit_img . '</a>' ?>
   <?php else:?>
   <td>&nbsp;</td>
   <?php endif;?>
index 9eb4ecd..53d3171 100644 (file)
@@ -57,13 +57,13 @@ function performAction(action, rid)
  <tr>
   <?php if ($isAdmin):?>
   <td>
-       <?php echo Horde::link(Horde_Util::addParameter($delete_url_base, 'c', $resource->getId()), _("Delete")) . $delete_img . '</a>' ?>
-       <?php echo Horde::link(Horde_Util::addParameter($edit_url_base, 'c', $resource->getId()), _("Edit")) . $edit_img . '</a>' ?>
+   <?php echo $delete_url_base->add('c', $resource->getId())->link(array('title' => _("Delete"))) . $delete_img . '</a>' ?>
+   <?php echo $edit_url_base->add('c', $resource->getId())->link(array('title' => _("Edit"))) . $edit_img . '</a>' ?>
   <?php else:?>
   <td>&nbsp;</td>
   <?php endif;?>
   <td><?php echo htmlspecialchars($resource->get('name')) ?></td>
-  <td><?php $url = Horde_Util::addParameter($display_url_base, 'display_cal', $resource->get('calendar'), false); echo Horde::link($url, _("Click or copy this URL to display this calendar")) . htmlspecialchars(shorten_url($url)) . '</a>' ?></td>
+  <td><?php echo $display_url_base->add('display_cal', $resource->get('calendar'), false)->link(array('title' => _("Click or copy this URL to display this calendar"))) . htmlspecialchars(shorten_url($url)) . '</a>' ?></td>
  </tr>
 <?php endforeach; ?>
 </tbody>
index a7d71e8..7214571 100644 (file)
 <?php $calendar = $calendars[$calendar_id]; if (is_array($calendar)): ?>
    <td><?php echo htmlspecialchars($calendar['name']) ?></td>
    <td><?php echo _("Remote") ?></td>
-   <td><?php $url = Horde_Util::addParameter($display_url_base, 'display_cal', 'remote_' . $calendar['url'], false); echo Horde::link($url, _("Click or copy this URL to display this calendar"), '', '_blank') . htmlspecialchars(shorten_url($url)) . '</a>' ?></td>
+   <td><?php $url = $display_url_base->add('display_cal', 'remote_' . $calendar['url']); echo $url->link(array('title' => _("Click or copy this URL to display this calendar"), 'target' => '_blank')) . htmlspecialchars(shorten_url($url)) . '</a>' ?></td>
    <td><?php echo Horde::link($calendar['url'], _("Click or copy this URL to display this calendar"), '', '_blank') . htmlspecialchars(shorten_url($calendar['url'])) . '</a>' ?></td>
-   <td><?php echo Horde::link(Horde_Util::addParameter($remote_edit_url_base, 'url', $calendar['url']), _("Edit")) . $edit_img . '</a>' ?></td>
+   <td><?php echo $remote_edit_url_base->add('url', $calendar['url'])->link(array('title' => _("Edit"))) . $edit_img . '</a>' ?></td>
 <?php if (empty($conf['share']['no_sharing'])): ?>
    <td>&nbsp;</td>
 <?php endif; ?>
-   <td><?php echo Horde::link(Horde_Util::addParameter($remote_unsubscribe_url_base, 'url', $calendar['url']), _("Unsubscribe")) . $delete_img . '</a>' ?></td>
+   <td><?php echo $remote_unsubscribe_url_base->add('url', $calendar['url'])->link(array('title' => _("Unsubscribe"))) . $delete_img . '</a>' ?></td>
 <?php else: ?>
    <td><?php echo htmlspecialchars($calendar->get('name')) ?></td>
    <td><?php echo _("Local") ?></td>
-   <td><?php $url = Horde_Util::addParameter($display_url_base, 'display_cal', $calendar->getName(), false); echo Horde::link($url, _("Click or copy this URL to display this calendar")) . htmlspecialchars(shorten_url($url)) . '</a>' ?></td>
+   <td><?php $url = $display_url_base->add('display_cal', $calendar->getName()); echo $url->link(array('title' => _("Click or copy this URL to display this calendar"))) . htmlspecialchars(shorten_url($url)) . '</a>' ?></td>
    <td><?php $url = $subscribe_url_base . ($calendar->get('owner') ? $calendar->get('owner') : '-system-') . '/' . $calendar->getName() . '.ics'; echo Horde::link($url, _("Click or copy this URL to display this calendar"), '', '_blank') . htmlspecialchars(shorten_url($url)) . '</a>' ?></td>
-   <td><?php echo Horde::link(Horde_Util::addParameter($edit_url_base, 'c', $calendar->getName()), _("Edit")) . $edit_img . '</a>' ?></td>
+   <td><?php echo $edit_url_base->add('c', $calendar->getName())->link(array('title' => _("Edit"))) . $edit_img . '</a>' ?></td>
 <?php if (empty($conf['share']['no_sharing'])): ?>
-   <td><?php echo Horde::link(Horde_Util::addParameter($perms_url_base, 'share', $calendar->getName()), _("Change Permissions"), '', '_blank', Horde::popupJs($perms_url_base, array('params' => array('share' => $calendar->getName()), 'urlencode' => true)) . 'return false;') . $perms_img . '</a>' ?></td>
+   <td><?php echo $perms_url_base->add('share', $calendar->getName())->link(array('title' => _("Change Permissions"), 'target' => '_blank', 'onclick' => Horde::popupJs($perms_url_base, array('params' => array('share' => $calendar->getName()), 'urlencode' => true)) . 'return false;')) . $perms_img . '</a>' ?></td>
 <?php endif; ?>
-   <td><?php echo Horde::link(Horde_Util::addParameter($delete_url_base, 'c', $calendar->getName()), _("Delete")) . $delete_img . '</a>' ?></td>
+   <td><?php echo $delete_url_base->add('c', $calendar->getName())->link(array('title' => _("Delete"))) . $delete_img . '</a>' ?></td>
 <?php endif; ?>
   </tr>
 <?php endforeach; ?>
index a973f7d..bc40c0a 100644 (file)
@@ -1,8 +1,7 @@
 <?php
 if (empty($url)) {
-    $url = Horde_Util::addParameter('month.php', array('month' => $month,
-                                                 'year' => $year));
-    $url = Horde::applicationUrl($url, true);
+    $url = Horde::applicationUrl('month.php', true)
+        ->add(array('month' => $month, 'year' => $year));
 }
 ?>
 <form action="delete.php" method="post" id="deleteform" name="delete">
index cb96503..8dde294 100644 (file)
@@ -1,8 +1,7 @@
 <?php
 if (empty($url)) {
-    $url = Horde_Util::addParameter('month.php', array('month' => $month,
-                                                 'year' => $year));
-    $url = Horde::applicationUrl($url, true);
+    $url = Horde::applicationUrl('month.php', true)
+        ->add(array('month' => $month, 'year' => $year));
 }
 ?>
 <form action="delete.php" method="post" name="delete">
index 2a2b87e..110ebb4 100644 (file)
@@ -30,7 +30,7 @@ $tagger = Kronolith::getTagger();
  <a id="sbarShow" href="#" onclick="sbarToggle(); return false;"><?php echo _("Calendars") ?></a>
  <a id="sbarHide" href="#" onclick="sbarToggle(); return false;"><?php echo _("Calendars") ?></a>
  <?php if (!empty($_SESSION['kronolith']['display_cal'])): ?>
-   <a id="sbarClose" href="<?php echo Horde_Util::addParameter(Horde::selfUrl(true), 'display_cal', '') ?>"><?php echo Horde_Auth::getAuth() ? _("Return to my calendars") : _("Return to calendars") ?></a>
+   <a id="sbarClose" href="<?php echo Horde::selfUrl(true)->add('display_cal', '') ?>"><?php echo Horde_Auth::getAuth() ? _("Return to my calendars") : _("Return to calendars") ?></a>
  <?php endif; ?>
 <div id="pageControlsInner">
 <?php if (!empty($_SESSION['kronolith']['display_cal'])): ?>
index 5579a72..6c2a4a1 100644 (file)
@@ -6,7 +6,7 @@
   <?php echo _("Copy this URL for use wherever you need your Free/Busy URL:") ?>
  </div>
  <p class="text">
-  <?php echo Horde_Util::addParameter(Horde::applicationUrl('fb.php', true, -1), 'u', Horde_Auth::getAuth()) ?>
+  <?php echo Horde::applicationUrl('fb.php', true, -1)->add('u', Horde_Auth::getAuth()) ?>
  </p>
 </div>
 
index c0fb532..27d2a07 100644 (file)
@@ -6,7 +6,7 @@
 <br /><br />
 <h1 class="header">
  <span class="smallheader rightFloat">
-  <?php echo Horde::widget(Horde_Util::addParameter(Horde::applicationUrl('search.php'), 'search_mode', 'advanced'), _("Advanced Search"), 'smallheader', '', '', _("Ad_vanced Search")) ?>
+  <?php echo Horde::widget(Horde::applicationUrl('search.php')->add('search_mode', 'advanced'), _("Advanced Search"), 'smallheader', '', '', _("Ad_vanced Search")) ?>
  </span>
  <?php echo _("Basic Search") ?>
 </h1>
index c91df96..03c7f43 100644 (file)
@@ -10,7 +10,7 @@ require KRONOLITH_TEMPLATES . '/edit/javascript.inc';
 <br /><br />
 <h1 class="header">
  <span class="smallheader rightFloat">
-  <?php echo Horde::widget(Horde_Util::addParameter(Horde::applicationUrl('search.php'), 'search_mode', 'basic'), _("Basic Search"), 'smallheader', '', '', _("_Basic Search")) ?>
+  <?php echo Horde::widget(Horde::applicationUrl('search.php')->add('search_mode', 'basic'), _("Basic Search"), 'smallheader', '', '', _("_Basic Search")) ?>
  </span>
  <?php echo _("Advanced Search") ?>
 </h1>
index a5070e5..503c96b 100644 (file)
@@ -22,12 +22,13 @@ if (Kronolith::getDefaultCalendar(Horde_Perms::EDIT) &&
     (!empty($conf['hooks']['permsdenied']) ||
      $GLOBALS['perms']->hasAppPermission('max_events') === true ||
      $GLOBALS['perms']->hasAppPermission('max_events') > Kronolith::countEvents())) {
-    $addurl = Horde_Util::addParameter('new.php',
-                                 array('date' => $day->dateString(),
-                                       'url' => $this->link(0, true)));
-    echo Horde::link(Horde::applicationUrl($addurl), _("Create a New Event"), 'iconAdd')
-    . Horde::img('new_small.png', '+')
-    . '</a>';
+    echo Horde::applicationUrl('new.php')
+        ->add(array('date' => $day->dateString(),
+                    'url' => $this->link(0, true)))
+        ->link(array('title' => _("Create a New Event"),
+                     'class' => 'iconAdd'))
+        . Horde::img('new_small.png', '+')
+        . '</a>';
 }
 ?>
    <strong><?php echo Horde::link($day->link(), '', 'widget') . $day->getTime('%A, %d.') ?></a></strong>