First attempt at moving IMP to Horde_Url::
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 7 Dec 2009 07:05:14 +0000 (00:05 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 7 Dec 2009 07:05:14 +0000 (00:05 -0700)
30 files changed:
imp/attachment.php
imp/compose.php
imp/config/prefs.php.dist
imp/contacts.php
imp/folders-mimp.php
imp/folders.php
imp/lib/Auth.php
imp/lib/Block/summary.php
imp/lib/Block/tree_folders.php
imp/lib/Compose.php
imp/lib/Contents.php
imp/lib/IMP.php
imp/lib/Mime/Viewer/Images.php
imp/lib/Mime/Viewer/Pgp.php
imp/lib/Mime/Viewer/Smime.php
imp/lib/Mimp.php
imp/lib/Search.php
imp/lib/Ui/Folder.php
imp/lib/Ui/Message.php
imp/mailbox-mimp.php
imp/mailbox.php
imp/message-mimp.php
imp/message.php
imp/pgp.php
imp/search-basic.php
imp/search.php
imp/smime.php
imp/stationery.php
imp/templates/common-header.inc
imp/thread.php

index eb6062a..3dc4942 100644 (file)
@@ -96,7 +96,9 @@ if ($conf['compose']['link_attachments_notify']) {
                 $msg = new Horde_Mime_Part();
                 $msg->setType('text/plain');
                 $msg->setCharset(Horde_Nls::getCharset());
-                $msg->setContents(Horde_String::wrap(sprintf(_("Your linked attachment has been downloaded by at least one user.\n\nAttachment name: %s\nAttachment date: %s\n\nClick on the following link to permanently delete the attachment:\n%s"), $file_name, date('r', $time_stamp), Horde_Util::addParameter(Horde::selfUrl(true, false, true), 'd', $id))));
+
+                $d_url = new Horde_Url(Horde::selfUrl(true, false, true));
+                $msg->setContents(Horde_String::wrap(sprintf(_("Your linked attachment has been downloaded by at least one user.\n\nAttachment name: %s\nAttachment date: %s\n\nClick on the following link to permanently delete the attachment:\n%s"), $file_name, date('r', $time_stamp), $d_url->add('d', $id))));
 
                 $msg->send($mail_address, $msg_headers);
             }
index a04edaf..adaa85d 100644 (file)
  * @package IMP
  */
 
-function _mailboxReturnURL($encode, $url = null)
+function _mailboxReturnURL($url)
 {
-    if (empty($url)) {
-        $url = Horde::applicationUrl('mailbox.php');
+    if (!$url) {
+        $url = Horde::applicationUrl('mailbox.php')->setRaw(true);
     }
 
     foreach (array('start', 'page', 'mailbox', 'thismailbox') as $key) {
         if (($param = Horde_Util::getFormData($key))) {
-            $url = Horde_Util::addParameter($url, $key, $param, $encode);
+            $url->add($key, $param);
         }
     }
 
@@ -635,15 +635,23 @@ if ($isPopup) {
     /* If the attachments cache is not empty, we must reload this page
      * and delete the attachments. */
     if ($imp_compose->numberOfAttachments()) {
-        $cancel_url = Horde_Util::addParameter(Horde::selfUrl(), array('actionID' => 'cancel_compose', 'composeCache' => $composeCacheID, 'popup' => 1), null, false);
+        $cancel_url = new Horde_Url(Horde::selfUrl(), true);
+        $cancel_url->add(
+            'actionID' => 'cancel_compose',
+            'composeCache' => $composeCacheID,
+            'popup' => 1
+        );
     }
 } else {
     /* If the attachments cache is not empty, we must reload this page and
        delete the attachments. */
     if ($imp_compose->numberOfAttachments()) {
-        $cancel_url = Horde_Util::addParameter(_mailboxReturnURL(true, Horde::selfUrl()), array('actionID' => 'cancel_compose', 'composeCache' => $composeCacheID), null, false);
+        $cancel_url = _mailboxReturnURL(new Horde_Url(Horde::selfUrl(), true))->add(array(
+            'actionID' => 'cancel_compose',
+            'composeCache' => $composeCacheID
+        ));
     } else {
-        $cancel_url = _mailboxReturnURL(true);
+        $cancel_url = _mailboxReturnURL(true)->setRaw(false);
     }
     $showmenu = true;
 }
@@ -812,7 +820,7 @@ if (!$redirect) {
 /* Set up the base template now. */
 $t = new Horde_Template();
 $t->setOption('gettext', true);
-$t->set('post_action', Horde_Util::addParameter(Horde::applicationUrl('compose.php'), 'uniq', uniqid(mt_rand())));
+$t->set('post_action', Horde::applicationUrl('compose.php')->add('uniq', uniqid(mt_rand())));
 $t->set('allow_compose', !$compose_disable);
 
 if ($redirect) {
@@ -825,7 +833,7 @@ if ($redirect) {
 
     if ($registry->hasMethod('contacts/search')) {
         $t->set('has_search', true);
-        $t->set('abook', Horde::link('#', _("Address Book"), 'widget', null, 'window.open(\'' . Horde_Util::addParameter(Horde::applicationUrl('contacts.php'), array('formname' => 'redirect', 'to_only' => 1)) . '\', \'contacts\', \'toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,width=550,height=300,left=100,top=100\'); return false;') . Horde::img('addressbook_browse.png') . '<br />' . _("Address Book") . '</a>');
+        $t->set('abook', Horde::link('#', _("Address Book"), 'widget', null, 'window.open(\'' . Horde::applicationUrl('contacts.php')->add(array('formname' => 'redirect', 'to_only' => 1)) . '\', \'contacts\', \'toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,width=550,height=300,left=100,top=100\'); return false;') . Horde::img('addressbook_browse.png') . '<br />' . _("Address Book") . '</a>');
         if (!$has_js) {
             $t->set('expand', Horde::link('#', _("Expand Names"), 'widget', null, "$('actionID').value='redirect_expand_addr';ImpCompose.uniqSubmit();return false;") . Horde::img('expand.png') . '<br />' . _("Expand Names") . '</a>', true);
         }
@@ -1203,7 +1211,11 @@ if ($redirect) {
                 );
 
                 if ($type != 'application/octet-stream') {
-                    $preview_url = Horde_Util::addParameter(Horde::applicationUrl('view.php'), array('actionID' => 'compose_attach_preview', 'id' => $atc_num, 'composeCache' => $composeCacheID));
+                    $preview_url = Horde::applicationUrl('view.php')->add(array(
+                        'actionID' => 'compose_attach_preview',
+                        'composeCache' => $composeCacheID,
+                        'id' => $atc_num
+                    ));
                     $entry['name'] = Horde::link($preview_url, _("Preview") . ' ' . $entry['name'], 'link', 'compose_preview_window') . $entry['name'] . '</a>';
                 }
 
index 99ee9f4..545829a 100644 (file)
@@ -564,8 +564,7 @@ $_prefs['mailto_handler'] = array(
     'xurl' => 'javascript:if(typeof navigator.registerProtocolHandler==\'undefined\')alert(\''
         . addslashes(_("Your browser does not support this feature."))
         . '\');else navigator.registerProtocolHandler(\'mailto\',\''
-        . Horde_Util::addParameter(Horde::applicationUrl('compose.php', true),
-                             array('actionID' => 'mailto_link', 'to' => ''), false)
+        . Horde::applicationUrl('compose.php', true)->setRaw(true)->add(array('actionID' => 'mailto_link', 'to' => ''))
         . '%s\',\'' . $GLOBALS['registry']->get('name') . '\');',
     'desc' => sprintf(_("Click here to open all mailto: links in %s."), $GLOBALS['registry']->get('name')));
 
index 7faf9d4..5bb0e32 100644 (file)
@@ -65,7 +65,7 @@ foreach (explode('|', Horde_Util::getFormData('sa')) as $addr) {
 $template = new Horde_Template();
 $template->setOption('gettext', true);
 
-$template->set('action', Horde::url(Horde_Util::addParameter(Horde::applicationUrl('contacts.php'), array('uniq' => uniqid(mt_rand())))));
+$template->set('action', Horde::applicationUrl('contacts.php')->add(array('uniq' => uniqid(mt_rand()))));
 $template->set('formname', $formname);
 $template->set('formInput', Horde_Util::formInput());
 $template->set('search', htmlspecialchars($search));
index 73e9e57..fff1d53 100644 (file)
@@ -57,7 +57,7 @@ foreach ($tree_ob[0] as $val) {
 $selfurl = Horde::applicationUrl('folders-mimp.php');
 if ($subscribe) {
     $sub_text = $showAll ? _("Show Subscribed Folders") : _("Show All Folders");
-    $sub_link = Horde_Util::addParameter($selfurl, 'ts', 1);
+    $sub_link = $selfurl->cAdd('ts', 1);
 }
 
 $title = _("Folders");
index 65f9b1e..e4695f4 100644 (file)
@@ -328,7 +328,8 @@ case 'mbox_size':
 /* Token to use in requests */
 $folders_token = Horde::getRequestToken('imp.folders');
 
-$folders_url = Horde_Util::addParameter($folders_url, 'folders_token', $folders_token);
+$folders_url_ob = new Horde_Url($folders_url);
+$folders_url_ob->add('folders_token', $folders_token);
 
 if ($_SESSION['imp']['file_upload'] && ($actionID == 'import_mbox')) {
     $title = _("Folder Navigator");
@@ -341,7 +342,7 @@ if ($_SESSION['imp']['file_upload'] && ($actionID == 'import_mbox')) {
     /* Prepare import template. */
     $i_template = new Horde_Template();
     $i_template->setOption('gettext', true);
-    $i_template->set('folders_url', $folders_url);
+    $i_template->set('folders_url', $folders_url_ob);
     $i_template->set('import_folder', $folder_list[0]);
     $i_template->set('folder_name', htmlspecialchars(Horde_String::convertCharset($folder_list[0], 'UTF7-IMAP'), ENT_COMPAT, $charset));
     $i_template->set('folders_token', $folders_token);
@@ -375,13 +376,13 @@ $refresh_title = _("Reload View");
 $head_template = new Horde_Template();
 $head_template->setOption('gettext', true);
 $head_template->set('title', $refresh_title);
-$head_template->set('folders_url', $folders_url);
+$head_template->set('folders_url', $folders_url_ob);
 $refresh_ak = Horde::getAccessKey($refresh_title);
 $refresh_title = Horde::stripAccessKey($refresh_title);
 if (!empty($refresh_ak)) {
     $refresh_title .= sprintf(_(" (Accesskey %s)"), $refresh_ak);
 }
-$head_template->set('refresh', Horde::link($folders_url, $refresh_title, '', '', '', $refresh_title, $refresh_ak));
+$head_template->set('refresh', Horde::link($folders_url_ob, $refresh_title, '', '', '', $refresh_title, $refresh_ak));
 $head_template->set('folders_token', $folders_token);
 
 /* Prepare the actions template. */
@@ -400,14 +401,14 @@ $a_template->set('create_folder', !empty($GLOBALS['conf']['hooks']['permsdenied'
 if ($prefs->getValue('subscribe')) {
     $a_template->set('subscribe', true);
     $subToggleText = ($showAll) ? _("Hide Unsubscribed") : _("Show Unsubscribed");
-    $a_template->set('toggle_subscribe', Horde::widget(Horde_Util::addParameter($folders_url, array('actionID' => 'toggle_subscribed_view', 'folders_token' => $folders_token)), $subToggleText, 'widget', '', '', $subToggleText, true));
+    $a_template->set('toggle_subscribe', Horde::widget($folders_url_ob->cAdd(array('actionID' => 'toggle_subscribed_view', 'folders_token' => $folders_token)), $subToggleText, 'widget', '', '', $subToggleText, true));
 }
 $a_template->set('nav_poll', !$prefs->isLocked('nav_poll') && !$prefs->getValue('nav_poll_all'));
 $a_template->set('notrash', !$prefs->getValue('use_trash'));
 $a_template->set('file_upload', $_SESSION['imp']['file_upload']);
 $a_template->set('help', Horde_Help::link('imp', 'folder-options'));
-$a_template->set('expand_all', Horde::widget(Horde_Util::addParameter($folders_url, array('actionID' => 'expand_all_folders', 'folders_token' => $folders_token)), _("Expand All Folders"), 'widget', '', '', _("Expand All"), true));
-$a_template->set('collapse_all', Horde::widget(Horde_Util::addParameter($folders_url, array('actionID' => 'collapse_all_folders', 'folders_token' => $folders_token)), _("Collapse All Folders"), 'widget', '', '', _("Collapse All"), true));
+$a_template->set('expand_all', Horde::widget($folders_url_ob->cAdd(array('actionID' => 'expand_all_folders', 'folders_token' => $folders_token)), _("Expand All Folders"), 'widget', '', '', _("Expand All"), true));
+$a_template->set('collapse_all', Horde::widget($folders_url_ob->cAdd(array('actionID' => 'collapse_all_folders', 'folders_token' => $folders_token)), _("Collapse All Folders"), 'widget', '', '', _("Collapse All"), true));
 
 /* Check to see if user wants new mail notification */
 if (!empty($newmsgs)) {
@@ -430,11 +431,11 @@ if (!empty($newmsgs)) {
 
 /* Get the tree images. */
 $imp_ui_folder = new IMP_Ui_Folder();
-$tree_imgs = $imp_ui_folder->getTreeImages($raw_rows, array('expand_url' => $folders_url));
+$tree_imgs = $imp_ui_folder->getTreeImages($raw_rows, array('expand_url' => $folders_url_ob));
 
 /* Add some further information to the $raw_rows array. */
 $rows = array();
-$name_url = Horde_Util::addParameter(Horde::applicationUrl('mailbox.php'), 'no_newmail_popup', 1);
+$name_url = Horde::applicationUrl('mailbox.php')->add('no_newmail_popup', 1);
 $rowct = 0;
 
 foreach ($raw_rows as $key => $val) {
@@ -458,7 +459,7 @@ foreach ($raw_rows as $key => $val) {
         if (!empty($val['unseen'])) {
             $val['name'] = '<strong>' . $val['name'] . '</strong>';
         }
-        $val['name'] = Horde::link(Horde_Util::addParameter($name_url, 'mailbox', $val['value']), $val['vfolder'] ? $val['base_elt']['l'] : $val['display']) . $val['name'] . '</a>';
+        $val['name'] = Horde::link($name_url->cAdd('mailbox', $val['value']), $val['vfolder'] ? $val['base_elt']['l'] : $val['display']) . $val['name'] . '</a>';
     }
 
     $val['line'] = $tree_imgs[$key];
index 60f34d7..0f506b0 100644 (file)
@@ -378,7 +378,7 @@ class IMP_Auth
             default:
                 $page = 'mailbox.php';
                 if ($url) {
-                    return Horde_Util::addParameter(Horde::applicationUrl($page, true), array('mailbox' => $init_url));
+                    return Horde::applicationUrl($page, true)->add('mailbox', $init_url);
                 }
                 IMP::setCurrentMailboxInfo($init_url);
                 break;
index 7fc03a9..f9fa1e0 100644 (file)
@@ -59,8 +59,9 @@ class Horde_Block_imp_summary extends Horde_Block
             $html .= '<tr><td colspan="3">' . $quota_msg . '</td></tr>';
         }
 
-        $newmsgs = array();
         $anyUnseen = false;
+        $mbox_url = Horde::applicationUrl('mailbox.php', true);
+        $newmsgs = array();
 
         foreach ($folders as $folder) {
             if (($folder == 'INBOX') ||
@@ -72,7 +73,7 @@ class Horde_Block_imp_summary extends Horde_Block
                         if (!empty($info['recent'])) {
                             $newmsgs[$folder] = $info['recent'];
                         }
-                        $url = Horde_Util::addParameter(Horde::applicationUrl('mailbox.php', true), array('no_newmail_popup' => 1, 'mailbox' => $folder));
+                        $url = $mbox_url->cAdd(array('no_newmail_popup' => 1, 'mailbox' => $folder));
                         $html .= '<tr style="cursor:pointer" class="text" onclick="self.location=\'' . $url . '\'"><td>';
                         if (!empty($info['unseen'])) {
                             $html .= '<strong>';
index 687e080..944d423 100644 (file)
@@ -50,7 +50,7 @@ class Horde_Block_imp_tree_folders extends Horde_Block
             return;
         }
 
-        $name_url = Horde_Util::addParameter(Horde::applicationUrl('mailbox.php'), 'no_newmail_popup', 1);
+        $name_url = Horde::applicationUrl('mailbox.php')->add('no_newmail_popup', 1);
 
         /* Initialize the IMP_Tree object. */
         $imaptree = IMP_Imap_Tree::singleton();
@@ -80,7 +80,7 @@ class Horde_Block_imp_tree_folders extends Horde_Block
                 'icon' => $val['icon'],
                 'icondir' => $val['icondir'],
                 'iconopen' => $val['iconopen'],
-                'url' => ($val['container']) ? null : Horde_Util::addParameter($name_url, 'mailbox', $val['value']),
+                'url' => ($val['container']) ? null : $name_url->add('mailbox', $val['value']),
             );
             $tree->addNode($parent . $val['value'],
                            ($val['level']) ? $parent . $val['parent'] : $parent,
index 8db4bc8..178a1e6 100644 (file)
@@ -1079,7 +1079,7 @@ class IMP_Compose
             if (($this->_linkAttach &&
                  $GLOBALS['conf']['compose']['link_attachments']) ||
                 !empty($GLOBALS['conf']['compose']['link_all_attachments'])) {
-                $base = $this->linkAttachments(Horde::applicationUrl('attachment.php', true), $textpart, Horde_Auth::getAuth());
+                $base = $this->linkAttachments($textpart);
 
                 if ($this->_pgpAttachPubkey || $this->_attachVCard) {
                     $new_body = new Horde_Mime_Part();
@@ -2199,15 +2199,12 @@ class IMP_Compose
      * attachments to a new folder and remove the Horde_Mime_Parts for the
      * attachments.
      *
-     * @param string $baseurl        The base URL for creating the links.
      * @param Horde_Mime_Part $part  The body of the message.
-     * @param string $auth           The authorized user who owns the
-     *                               attachments.
      *
      * @return Horde_Mime_Part  Modified MIME part with links to attachments.
      * @throws IMP_Compose_Exception
      */
-    public function linkAttachments($baseurl, $part, $auth)
+    public function linkAttachments($part)
     {
         global $conf, $prefs;
 
@@ -2215,6 +2212,9 @@ class IMP_Compose
             throw new IMP_Compose_Exception(_("Linked attachments are forbidden."));
         }
 
+        $auth = Horde_Auth::getAuth();
+        $baseurl = Horde::applicationUrl('attachment.php', true)->setRaw(true);
+
         $vfs = VFS::singleton($conf['vfs']['type'], Horde::getDriverConfig('vfs', $conf['vfs']['type']));
 
         $ts = time();
@@ -2232,7 +2232,7 @@ class IMP_Compose
         }
 
         foreach ($this->getAttachments() as $att) {
-            $trailer .= "\n" . Horde_Util::addParameter($baseurl, array('u' => $auth, 't' => $ts, 'f' => $att->getName()), null, false);
+            $trailer .= "\n" . $baseurl->cAdd(array('u' => $auth, 't' => $ts, 'f' => $att->getName()));
             if ($conf['compose']['use_vfs']) {
                 $res = $vfs->rename(self::VFS_ATTACH_PATH, $att->getInformation('temp_filename'), $fullpath, escapeshellcmd($att->getName()));
             } else {
index 4484b63..d2f6359 100644 (file)
@@ -700,8 +700,8 @@ class IMP_Contents
             ($id != 0) &&
             (intval($id) != 1) &&
             (strpos($id, '.') === false)) {
-            $url = Horde_Util::removeParameter(Horde::selfUrl(true), array('actionID', 'imapid', 'uid'));
-            $url = Horde_Util::addParameter($url, array('actionID' => 'strip_attachment', 'imapid' => $id, 'uid' => $this->_uid, 'message_token' => Horde::getRequestToken('imp.impcontents')));
+            $url = new Horde_Url(Horde::selfUrl(true));
+            $url->remove(array('actionID', 'imapid', 'uid'))->add(array('actionID' => 'strip_attachment', 'imapid' => $id, 'uid' => $this->_uid, 'message_token' => Horde::getRequestToken('imp.impcontents')));
             $part['strip'] = Horde::link($url, _("Strip Attachment"), 'deleteImg', null, "return window.confirm('" . addslashes(_("Are you sure you wish to PERMANENTLY delete this attachment?")) . "');") . '</a>';
         }
 
@@ -717,7 +717,7 @@ class IMP_Contents
      * <pre>
      * 'dload' - (boolean) Should we generate a download link?
      * 'params' - (array) A list of any additional parameters that need to be
-     *            passed to view.php (key = name).
+     *            passed to view.php (key => name).
      * </pre>
      *
      * @return string  The URL to view.php.
@@ -727,7 +727,7 @@ class IMP_Contents
         $params = $this->_urlViewParams($mime_part, $actionID, isset($options['params']) ? $options['params'] : array());
 
         return empty($options['dload'])
-            ? Horde_Util::addParameter(Horde::applicationUrl('view.php', true), $params)
+            ? Horde::applicationUrl('view.php', true)->add($params)
             : Horde::downloadUrl($mime_part->getName(true), $params);
     }
 
index 4107d04..b4a3f11 100644 (file)
@@ -283,8 +283,7 @@ class IMP
         }
 
         $options += self::getComposeArgs();
-        $url = Horde_Util::addParameter(Horde::applicationUrl('compose.php', true), $options, null, false);
-        header('Location: ' . $url);
+        header('Location: ' . Horde::applicationUrl('compose.php', true)->setRaw(true)->add($options));
         return true;
     }
 
@@ -330,7 +329,7 @@ class IMP
      *                      compose.php.
      * @param string $view  The IMP view to create a link for.
      *
-     * @return string  The link to the message composition screen.
+     * @return string|Horde_Url  The link to the message composition screen.
      */
     static public function composeLink($args = array(), $extra = array(),
                                        $view = null)
@@ -351,7 +350,7 @@ class IMP
             foreach ($args as $k => $v) {
                 $encode_args[$k] = rawurlencode($v);
             }
-            return 'javascript:void(window.open(\'' . Horde_Util::addParameter(Horde::applicationUrl('compose-dimp.php'), $encode_args, null, false) . '\', \'\', \'width=820,height=610,status=1,scrollbars=yes,resizable=yes\'));';
+            return 'javascript:void(window.open(\'' . Horde::applicationUrl('compose-dimp.php')->setRaw(true)->add($encode_args) . '\', \'\', \'width=820,height=610,status=1,scrollbars=yes,resizable=yes\'));';
         }
 
         if (($view != 'mimp') &&
@@ -363,7 +362,7 @@ class IMP
             return "javascript:" . Horde::popupJs(Horde::applicationUrl('compose.php'), array('params' => $args, 'urlencode' => true));
         }
 
-        return Horde_Util::addParameter(Horde::applicationUrl(($view == 'mimp') ? 'compose-mimp.php' : 'compose.php'), $args);
+        return Horde::applicationUrl(($view == 'mimp') ? 'compose-mimp.php' : 'compose.php')->add($args);
     }
 
     /**
@@ -476,14 +475,14 @@ class IMP
                 }
 
                 if (!empty($mailbox) && !$GLOBALS['imp_imap']->isReadOnly($mailbox)) {
-                    $menu_trash_url = Horde_Util::addParameter(self::generateIMPUrl($menu_mailbox_url, $mailbox), array('actionID' => 'empty_mailbox', 'mailbox_token' => Horde::getRequestToken('imp.mailbox')));
+                    $menu_trash_url = self::generateIMPUrl($menu_mailbox_url, $mailbox)->add(array('actionID' => 'empty_mailbox', 'mailbox_token' => Horde::getRequestToken('imp.mailbox')));
                     $menu->add($menu_trash_url, _("Empty _Trash"), 'empty_trash.png', null, null, "return window.confirm('" . addslashes(_("Are you sure you wish to empty your trash folder?")) . "');", '__noselection');
                 }
             }
 
             if (!empty($spam_folder) &&
                 $prefs->getValue('empty_spam_menu')) {
-                $menu_spam_url = Horde_Util::addParameter(self::generateIMPUrl($menu_mailbox_url, $spam_folder), array('actionID' => 'empty_mailbox', 'mailbox_token' => Horde::getRequestToken('imp.mailbox')));
+                $menu_spam_url = self::generateIMPUrl($menu_mailbox_url, $spam_folder)->add(array('actionID' => 'empty_mailbox', 'mailbox_token' => Horde::getRequestToken('imp.mailbox')));
                 $menu->add($menu_spam_url, _("Empty _Spam"), 'empty_spam.png', null, null, "return window.confirm('" . addslashes(_("Are you sure you wish to empty your spam folder?")) . "');", '__noselection');
             }
         }
@@ -654,7 +653,7 @@ class IMP
             $folders = array();
             foreach ($var as $mb => $nm) {
                 $folders[] = array(
-                    'url' => Horde_Util::addParameter(self::generateIMPUrl('mailbox.php', $mb), 'no_newmail_popup', 1),
+                    'url' => self::generateIMPUrl('mailbox.php', $mb)->add('no_newmail_popup', 1),
                     'name' => htmlspecialchars(self::displayFolder($mb)),
                     'new' => (int)$nm,
                 );
@@ -664,7 +663,7 @@ class IMP
             if (($_SESSION['imp']['protocol'] != 'pop') &&
                 $GLOBALS['prefs']->getValue('use_vinbox') &&
                 ($vinbox_id = $GLOBALS['prefs']->getValue('vinbox_id'))) {
-                $t->set('vinbox', Horde::link(Horde_Util::addParameter(self::generateIMPUrl('mailbox.php', $GLOBALS['imp_search']->createSearchID($vinbox_id)), 'no_newmail_popup', 1)));
+                $t->set('vinbox', Horde::link(self::generateIMPUrl('mailbox.php', $GLOBALS['imp_search']->createSearchID($vinbox_id))->add('no_newmail_popup', 1)));
             }
         } else {
             $t->set('msg', ($var == 1) ? _("You have 1 new message.") : sprintf(_("You have %s new messages."), $var));
@@ -776,19 +775,24 @@ class IMP
     /**
      * Generates a URL with necessary mailbox/UID information.
      *
-     * @param string $page      Page name to link to.
-     * @param string $mailbox   The base mailbox to use on the linked page.
-     * @param string $uid       The UID to use on the linked page.
-     * @param string $tmailbox  The mailbox associated with $uid.
-     * @param boolean $encode   Encode the argument separator?
+     * @param string|Horde_Url $page  Page name to link to.
+     * @param string $mailbox         The base mailbox to use on the linked
+     *                                page.
+     * @param string $uid             The UID to use on the linked page.
+     * @param string $tmailbox        The mailbox associated with $uid.
+     * @param boolean $encode         Encode the argument separator?
      *
-     * @return string  URL to $page with any necessary mailbox information
-     *                 added to the parameter list of the URL.
+     * @return Horde_Url  URL to $page with any necessary mailbox information
+     *                    added to the parameter list of the URL.
      */
     static public function generateIMPUrl($page, $mailbox, $uid = null,
                                           $tmailbox = null, $encode = true)
     {
-        return Horde_Util::addParameter(Horde::applicationUrl($page), self::getIMPMboxParameters($mailbox, $uid, $tmailbox), null, $encode);
+        $url = ($page instanceof Horde_Url)
+            ? clone $page
+            : Horde::applicationUrl($page);
+
+        return $url->add(self::getIMPMboxParameters($mailbox, $uid, $tmailbox))->setRaw(!$encode);
     }
 
     /**
@@ -1152,11 +1156,13 @@ class IMP
      * removed/altered based on an action that has occurred on the present
      * page.
      *
-     * @return string  The self URL.
+     * @return Horde_Url  The self URL.
      */
     static public function selfUrl()
     {
-        return self::$newUrl ? self::$newUrl : Horde::selfUrl(true);
+        return self::$newUrl
+            ? clone self::$newUrl
+            : new Horde_Url(Horde::selfUrl(true));
     }
 
     /**
index 5444fe7..0e4db0f 100644 (file)
@@ -174,7 +174,7 @@ class IMP_Horde_Mime_Viewer_Images extends Horde_Mime_Viewer_Images
     protected function _popupImageWindow()
     {
         $loading = _("Loading...");
-        $self_url = Horde_Util::addParameter(IMP::selfUrl(), array('imp_img_view' => ((Horde_Util::getFormData('imp_img_view') == 'load_convert') ? 'view_convert' : 'data')));
+        $self_url = IMP::selfUrl()->add(array('imp_img_view' => ((Horde_Util::getFormData('imp_img_view') == 'load_convert') ? 'view_convert' : 'data')));
         $title = $this->_mimepart->getName(true);
 
         $str = <<<EOD
index bf85497..b2bca0d 100644 (file)
@@ -412,7 +412,7 @@ class IMP_Horde_Mime_Viewer_Pgp extends Horde_Mime_Viewer_Driver
         } else {
             switch ($_SESSION['imp']['view']) {
             case 'imp':
-                $status[] = Horde::link(Horde_Util::addParameter(IMP::selfUrl(), array('pgp_verify_msg' => 1))) . _("Click HERE to verify the message.") . '</a>';
+                $status[] = Horde::link(IMP::selfUrl()->add(array('pgp_verify_msg' => 1))) . _("Click HERE to verify the message.") . '</a>';
                 break;
 
             case 'dimp':
index 01df2d5..21ef7c2 100644 (file)
@@ -310,7 +310,7 @@ class IMP_Horde_Mime_Viewer_Smime extends Horde_Mime_Viewer_Driver
         } else {
             switch ($_SESSION['imp']['view']) {
             case 'imp':
-                $status[] = Horde::link(Horde_Util::addParameter(IMP::selfUrl(), 'smime_verify_msg', 1)) . _("Click HERE to verify the data.") . '</a>';
+                $status[] = Horde::link(IMP::selfUrl()->add('smime_verify_msg', 1)) . _("Click HERE to verify the data.") . '</a>';
                 break;
 
             case 'dimp':
index 58dc861..68a57c5 100644 (file)
@@ -28,21 +28,21 @@ class IMP_Mimp
 
         if (!in_array($page, array('mailbox', 'message')) ||
             ($GLOBALS['imp_mbox']['mailbox'] != 'INBOX')) {
-            $items[IMP::generateIMPUrl('mailbox-mimp.php', 'INBOX')] = _("Inbox");
+            $items[] = array(_("Inbox"), IMP::generateIMPUrl('mailbox-mimp.php', 'INBOX'));
         }
 
         if (!in_array($page, array('compose', 'search')) && IMP::canCompose()) {
-            $items[Horde_Util::addParameter(Horde::applicationUrl('compose-mimp.php'), 'u', uniqid(mt_rand()))] = _("New Message");
+            $items[] = array(_("New Message"), Horde::applicationUrl('compose-mimp.php')->add('u', uniqid(mt_rand())));
         }
 
         if (!in_array($page, array('folders', 'search'))) {
-            $items[Horde::applicationUrl('folders-mimp.php')] = _("Folders");
+            $items[] = array(_("Folders"), Horde::applicationUrl('folders-mimp.php'));
         }
 
-        $items[Horde::getServiceLink('logout', 'imp')] = _("Log out");
+        $items[] = array(_("Log out"), Horde::getServiceLink('logout', 'imp'));
 
-        foreach ($items as $link => $label) {
-            $menu->add(new Horde_Mobile_link($label, $link));
+        foreach ($items as $val) {
+            $menu->add(new Horde_Mobile_link($val[0], $val[1]));
         }
 
         $menu = new Horde_Menu();
index b163ef9..e527945 100644 (file)
@@ -760,11 +760,11 @@ class IMP_Search
      * @param string $id  The search query id to use (by default, will use
      *                    the current ID set in the object).
      *
-     * @return string  The URL to the search page.
+     * @return Horde_Url  The URL to the search page.
      */
     public function editUrl($id = null)
     {
-        return Horde_Util::addParameter(Horde::applicationUrl('search.php'), array('edit_query' => $this->createSearchID($this->_strip($id))));
+        return Horde::applicationUrl('search.php')->add(array('edit_query' => $this->createSearchID($this->_strip($id))));
     }
 
     /**
@@ -773,11 +773,11 @@ class IMP_Search
      * @param string $id  The search query id to use (by default, will use
      *                    the current ID set in the object).
      *
-     * @return string  The URL to allow deletion of the search query.
+     * @return Horde_Url  The URL to allow deletion of the search query.
      */
     public function deleteUrl($id = null)
     {
-        return Horde_Util::addParameter(Horde::applicationUrl('folders.php'), array(
+        return Horde::applicationUrl('folders.php')->add(array(
             'actionID' => 'delete_search_query',
             'folders_token' => Horde::getRequestToken('imp.folders'),
             'queryid' => $this->createSearchID($this->_strip($id))
index b726089..3bcea08 100644 (file)
@@ -26,7 +26,7 @@ class IMP_Ui_Folder
      * @var array $rows     Folder rows returned from IMP_Imap_Tree::build().
      * @var array $options  Additional options:
      * <pre>
-     * 'expand_url' - (string) The URL to use for expand/collapse links.
+     * 'expand_url' - (Horde_Url) The URL to use for expand/collapse links.
      * </pre>
      *
      * @return array  An array of tree image strings.
@@ -61,11 +61,11 @@ class IMP_Ui_Folder
         $imaptree = IMP_Imap_Tree::singleton();
 
         if ($elt['children'] && isset($options['expand_url'])) {
-            $dir = Horde_Util::addParameter($options['expand_url'], 'folder', $elt['value']);
+            $dir = $options['expand_url']->cAdd('folder', $elt['value']);
 
             if ($imaptree->isOpen($elt['base_elt'])) {
                 if (!is_null($dir)) {
-                    $dir = Horde_Util::addParameter($dir, 'actionID', 'collapse_folder');
+                    $dir->add('actionID', 'collapse_folder');
                     $alt = _("Collapse Folder");
                 }
 
@@ -80,7 +80,7 @@ class IMP_Ui_Folder
                 }
             } else {
                 if (!is_null($dir)) {
-                    $dir = Horde_Util::addParameter($dir, 'actionID', 'expand_folder');
+                    $dir->add('actionID', 'expand_folder');
                     $alt = _("Expand Folder");
                 }
 
index 7e73251..0c339ce 100644 (file)
@@ -282,10 +282,10 @@ class IMP_Ui_Message
     /**
      * Builds a string containing a list of addresses.
      *
-     * @param array $addrlist  The list of addresses from
-     *                         Horde_Mime_Address::parseAddressList().
-     * @param integer $addURL  The self URL.
-     * @param boolean $link    Link each address to the compose screen?
+     * @param array $addrlist    The list of addresses from
+     *                           Horde_Mime_Address::parseAddressList().
+     * @param Horde_Url $addURL  The self URL.
+     * @param boolean $link      Link each address to the compose screen?
      *
      * @return string  String containing the formatted address list.
      */
@@ -307,7 +307,7 @@ class IMP_Ui_Message
         if (!is_null($addURL) && $link && $prefs->getValue('add_source')) {
             try {
                 $add_link = $registry->hasMethod('contacts/import')
-                    ? Horde_Util::addParameter($addURL, 'actionID', 'add_address')
+                    ? $addURL->cAdd('actionID', 'add_address')
                     : null;
             } catch (Horde_Exception $e) {}
         }
@@ -331,7 +331,7 @@ class IMP_Ui_Message
                     /* Append the add address icon to every address if contact
                      * manager is available. */
                     if ($add_link) {
-                        $curr_link = Horde_Util::addParameter($add_link, array('name' => $ad['personal'], 'address' => $ad['inner']));
+                        $curr_link = $add_link->cAdd(array('name' => $ad['personal'], 'address' => $ad['inner']));
                         $ret .= Horde::link($curr_link, sprintf(_("Add %s to my Address Book"), $ad['inner'])) .
                             Horde::img('addressbook_add.png', sprintf(_("Add %s to my Address Book"), $ad['inner'])) . '</a>';
                     }
@@ -359,7 +359,7 @@ class IMP_Ui_Message
                     /* Append the add address icon to every address if contact
                      * manager is available. */
                     if ($add_link) {
-                        $curr_link = Horde_Util::addParameter($add_link, array('name' => $ob['personal'], 'address' => $ob['inner']));
+                        $curr_link = $add_link->cAdd(array('name' => $ob['personal'], 'address' => $ob['inner']));
                         $ret .= Horde::link($curr_link, sprintf(_("Add %s to my Address Book"), $ob['inner'])) .
                             Horde::img('addressbook_add.png', sprintf(_("Add %s to my Address Book"), $ob['inner'])) . '</a>';
                     }
index 7ba5d05..5baad4a 100644 (file)
@@ -31,7 +31,7 @@ $mimp_render = new Horde_Mobile();
 
 /* Create mailbox menu. */
 $menu = new Horde_Mobile_card('o', _("Menu"));
-$mset = &$menu->add(new Horde_Mobile_linkset());
+$mset = $menu->add(new Horde_Mobile_linkset());
 
 /* Run through the action handlers */
 $actionID = Horde_Util::getFormData('a');
@@ -88,12 +88,12 @@ $pageOb = $imp_mailbox->buildMailboxPage(Horde_Util::getFormData('p'), Horde_Uti
 /* Generate page links. */
 $pages_first = $pages_prev = $pages_last = $pages_next = null;
 if ($pageOb['page'] != 1) {
-    $pages_first = new Horde_Mobile_link(_("First Page"), Horde_Util::addParameter($mailbox_url, 'p', 1));
-    $pages_prev = new Horde_Mobile_link(_("Previous Page"), Horde_Util::addParameter($mailbox_url, 'p', $pageOb['page'] - 1));
+    $pages_first = new Horde_Mobile_link(_("First Page"), $mailbox_url->cAdd('p', 1));
+    $pages_prev = new Horde_Mobile_link(_("Previous Page"), $mailbox_url->cAdd('p', $pageOb['page'] - 1));
 }
 if ($pageOb['page'] != $pageOb['pagecount']) {
-    $pages_next = new Horde_Mobile_link(_("Next Page"), Horde_Util::addParameter($mailbox_url, 'p', $pageOb['page'] + 1));
-    $pages_last = new Horde_Mobile_link(_("Last Page"), Horde_Util::addParameter($mailbox_url, 'p', $pageOb['pagecount']));
+    $pages_next = new Horde_Mobile_link(_("Next Page"), $mailbox_url->cAdd('p', $pageOb['page'] + 1));
+    $pages_last = new Horde_Mobile_link(_("Last Page"), $mailbox_url->cAdd('p', $pageOb['pagecount']));
 }
 
 /* Generate mailbox summary string. */
@@ -174,15 +174,15 @@ while (list(,$ob) = each($mbox_info['overview'])) {
     $msgs[] = $msg;
 }
 
-$mailbox = Horde_Util::addParameter($mailbox_url, 'p', $pageOb['page']);
-$items = array($mailbox => _("Refresh"));
+$mailbox = $mailbox_url->cAdd('p', $pageOb['page']);
+$items = array(array(_("Refresh"), $mailbox));
 $search_mbox = $imp_search->isSearchMbox($imp_mbox['mailbox']);
 
 /* Determine if we are going to show the Purge Deleted link. */
 if (!$readonly &&
     !$prefs->getValue('use_trash') &&
     !$imp_search->isVINBOXFolder()) {
-    $items[Horde_Util::addParameter($mailbox, array('a' => 'e'))] = _("Purge Deleted");
+    $items[] = array(_("Purge Deleted"), $mailbox->cAdd('a', 'e'));
 }
 
 /* Create sorting links. */
@@ -202,28 +202,28 @@ foreach ($sort_list as $key => $val) {
             IMP::threadSortAvailable($mailbox) &&
             !$search_mbox) {
             if (is_null($imp_thread)) {
-                $items[Horde_Util::addParameter($mailbox, array('a' => 'c', 'sb' => Horde_Imap_Client::SORT_THREAD, 'sd' => $sortdir))] = _("Sort by Thread");
+                $items[] = array(_("Sort by Thread"), $mailbox->cAdd(array('a' => 'c', 'sb' => Horde_Imap_Client::SORT_THREAD, 'sd' => $sortdir)));
             } else {
                 $sortkey = Horde_Imap_Client::SORT_THREAD;
-                $items[Horde_Util::addParameter($mailbox, array('a' => 'c', 'sb' => Horde_Imap_Client::SORT_SUBJECT, 'sd' => $sortdir))] = _("Do Not Sort by Thread");
+                $items[] = array(_("Do Not Sort by Thread"), $mailbox->cAdd(array('a' => 'c', 'sb' => Horde_Imap_Client::SORT_SUBJECT, 'sd' => $sortdir)));
             }
         }
         if ($sortpref['by'] == $key) {
             $val = '*' . $val;
             $sortdir = !$sortdir;
         }
-        $sort[$key] = new Horde_Mobile_link($val, Horde_Util::addParameter($mailbox, array('a' => 'c', 'sb' => $sortkey, 'sd' => $sortdir)));
+        $sort[$key] = new Horde_Mobile_link($val, $mailbox->cAdd(array('a' => 'c', 'sb' => $sortkey, 'sd' => $sortdir)));
     }
 }
 
 /* Add search link. */
 if (!$search_mbox &&
     ($_SESSION['imp']['protocol'] == 'imap')) {
-    $items[Horde_Util::addParameter($mailbox_url, array('a' => 's'))] = _("Search");
+    $items[] = array(_("Search"), $mailbox_url->cAdd('a', 's'));
 }
 
-foreach ($items as $link => $label) {
-    $mset->add(new Horde_Mobile_link($label, $link));
+foreach ($items as $val) {
+    $mset->add(new Horde_Mobile_link($val[0], $val[1]));
 }
 
 $nav = array('pages_first', 'pages_prev', 'pages_next', 'pages_last');
index f377c1d..e27bf87 100644 (file)
@@ -195,7 +195,7 @@ case 'empty_mailbox':
     break;
 
 case 'view_messages':
-    $redirect = Horde_Util::addParameter(IMP::generateIMPUrl('thread.php', $imp_mbox['mailbox'], null, null, false), array('mode' => 'msgview', 'msglist' => $GLOBALS['imp_imap']->ob()->utils->toSequenceString(IMP::parseIndicesList($indices), array('mailbox' => true))), null, false);
+    $redirect = IMP::generateIMPUrl('thread.php', $imp_mbox['mailbox'], null, null, false)->setRaw(true)->add(array('mode' => 'msgview', 'msglist' => $GLOBALS['imp_imap']->ob()->utils->toSequenceString(IMP::parseIndicesList($indices), array('mailbox' => true))));
     header('Location: ' . $redirect);
     exit;
 }
@@ -211,7 +211,7 @@ if (!$readonly && !empty($_SESSION['imp']['filteravail'])) {
         $do_filter = true;
     } elseif (($imp_mbox['mailbox'] == 'INBOX') ||
               ($prefs->getValue('filter_any_mailbox') && !$search_mbox)) {
-        $filter_url = Horde_Util::addParameter($mailbox_imp_url, array('actionID' => 'filter', 'mailbox_token' => $mailbox_token));
+        $filter_url = $mailbox_imp_url->cAdd(array('actionID' => 'filter', 'mailbox_token' => $mailbox_token));
     }
 }
 
@@ -271,9 +271,9 @@ if ($pageOb['pagecount']) {
         $pages_first = Horde::img($rtl ? 'nav/last-grey.png' : 'nav/first-grey.png', null, null, $graphicsdir);
         $pages_prev = Horde::img($rtl ? 'nav/right-grey.png' : 'nav/left-grey.png', null, null, $graphicsdir);
     } else {
-        $first_url = Horde_Util::addParameter($mailbox_imp_url, 'page', 1);
+        $first_url = $mailbox_imp_url->cAdd('page', 1);
         $pages_first = Horde::link($first_url, _("First Page")) . Horde::img($rtl ? 'nav/last.png' : 'nav/first.png', $rtl ? '>>' : '<<', null, $graphicsdir) . '</a>';
-        $prev_url = Horde_Util::addParameter($mailbox_imp_url, 'page', $pageOb['page'] - 1);
+        $prev_url = $mailbox_imp_url->cAdd('page', $pageOb['page'] - 1);
         $pages_prev = Horde::link($prev_url, _("Previous Page")) . Horde::img($rtl ? 'nav/right.png' : 'nav/left.png', $rtl ? '>' : '<', null, $graphicsdir) . '</a>';
     }
 
@@ -281,9 +281,9 @@ if ($pageOb['pagecount']) {
         $pages_last = Horde::img($rtl ? 'nav/first-grey.png' : 'nav/last-grey.png', null, null, $graphicsdir);
         $pages_next = Horde::img($rtl ? 'nav/left-grey.png' : 'nav/right-grey.png', null, null, $graphicsdir);
     } else {
-        $next_url = Horde_Util::addParameter($mailbox_imp_url, 'page', $pageOb['page'] + 1);
+        $next_url = $mailbox_imp_url->cAdd('page', $pageOb['page'] + 1);
         $pages_next = Horde::link($next_url, _("Next Page")) . Horde::img($rtl ? 'nav/left.png' : 'nav/right.png', $rtl ? '<' : '>', null, $graphicsdir) . '</a>';
-        $last_url = Horde_Util::addParameter($mailbox_imp_url, 'page', $pageOb['pagecount']);
+        $last_url = $mailbox_imp_url->cAdd('page', $pageOb['pagecount']);
         $pages_last = Horde::link($last_url, _("Last Page")) . Horde::img($rtl ? 'nav/first.png' : 'nav/last.png', $rtl ? '<<' : '>>', null, $graphicsdir) . '</a>';
     }
 }
@@ -312,13 +312,13 @@ if (!is_null($rss_box)) {
 
 /* If user wants the mailbox to be refreshed, set time here. */
 $refresh_time = $prefs->getValue('refresh_time');
-$refresh_url = Horde_Util::addParameter($mailbox_imp_url, 'page', $pageOb['page']);
+$refresh_url = $mailbox_imp_url->cAdd('page', $pageOb['page']);
 if (isset($filter_url)) {
-    $filter_url = Horde_Util::addParameter($filter_url, 'page', $pageOb['page']);
+    $filter_url->add('page', $pageOb['page']);
 }
 
 /* Set the folder for the sort links. */
-$sort_url = Horde_Util::addParameter($mailbox_imp_url, 'sortdir', ($sortpref['dir']) ? 0 : 1);
+$sort_url = $mailbox_imp_url->cAdd('sortdir', ($sortpref['dir']) ? 0 : 1);
 
 /* Determine if we are showing previews. */
 $preview_tooltip = $show_preview
@@ -422,9 +422,9 @@ if (isset($filter_url)) {
 $hdr_template->set('search', false);
 if ($_SESSION['imp']['protocol'] != 'pop') {
     if (!$search_mbox) {
-        $hdr_template->set('search', Horde::link(Horde_Util::addParameter(Horde::applicationUrl('search-basic.php'), 'search_mailbox', $imp_mbox['mailbox']), sprintf(_("Search %s"), $rawtitle)) . Horde::img('search.png', _("Search")) . '</a>');
+        $hdr_template->set('search', Horde::link(Horde::applicationUrl('search-basic.php')->add('search_mailbox', $imp_mbox['mailbox']), sprintf(_("Search %s"), $rawtitle)) . Horde::img('search.png', _("Search")) . '</a>');
         if (!$readonly) {
-            $hdr_template->set('empty', Horde::link(Horde_Util::addParameter($mailbox_imp_url, array('actionID' => 'empty_mailbox', 'mailbox' => $imp_mbox['mailbox'], 'mailbox_token' => $mailbox_token)), _("Empty folder"), '', '', "ImpMailbox.confirmDialog(this.href, '" . addslashes(_("Are you sure you wish to delete all mail in this folder?")) . "'); return false;") . Horde::img('empty_spam.png', _("Empty folder")) . '</a>');
+            $hdr_template->set('empty', Horde::link($mailbox_imp_url->cAdd(array('actionID' => 'empty_mailbox', 'mailbox' => $imp_mbox['mailbox'], 'mailbox_token' => $mailbox_token)), _("Empty folder"), '', '', "ImpMailbox.confirmDialog(this.href, '" . addslashes(_("Are you sure you wish to delete all mail in this folder?")) . "'); return false;") . Horde::img('empty_spam.png', _("Empty folder")) . '</a>');
         }
     } else {
         if ($imp_search->isEditableVFolder()) {
@@ -433,7 +433,7 @@ if ($_SESSION['imp']['protocol'] != 'pop') {
         } elseif ($search_mbox && !isset($query_text)) {
             /* Mini search results. */
             $search_mailbox = reset($imp_search->getSearchFolders());
-            $hdr_template->set('search', Horde::link(Horde_Util::addParameter(Horde::applicationUrl('search-basic.php'), array('search_mailbox' => $search_mailbox)), sprintf(_("Search %s"), IMP::getLabel($search_mailbox))) . Horde::img('search.png', _("Search")) . '</a>');
+            $hdr_template->set('search', Horde::link(Horde::applicationUrl('search-basic.php')->add(array('search_mailbox' => $search_mailbox)), sprintf(_("Search %s"), IMP::getLabel($search_mailbox))) . Horde::img('search.png', _("Search")) . '</a>');
             $hdr_template->set('searchclose', Horde::link(IMP::generateIMPUrl('mailbox.php', $search_mailbox), _("Exit Search")));
         } elseif (!$vfolder) {
             $edit_search = _("Edit Search Query");
@@ -457,9 +457,9 @@ if (empty($pageOb['end'])) {
         /* Show 'Show Deleted' prompt if mailbox has no viewable message but
            has hidden, deleted messages. */
         $del_template = new Horde_Template();
-        $del_template->set('hide', Horde::widget(Horde_Util::addParameter($refresh_url, array('actionID' => 'hide_deleted', 'mailbox_token' => $mailbox_token)), $deleted_prompt, 'widget hideAction', '', '', $deleted_prompt));
+        $del_template->set('hide', Horde::widget($refresh_url->cAdd(array('actionID' => 'hide_deleted', 'mailbox_token' => $mailbox_token)), $deleted_prompt, 'widget hideAction', '', '', $deleted_prompt));
         if (!$readonly) {
-            $del_template->set('purge', Horde::widget(Horde_Util::addParameter($refresh_url, array('actionID' => 'expunge_mailbox', 'mailbox_token' => $mailbox_token)), _("Purge Deleted"), 'widget purgeAction', '', '', _("Pur_ge Deleted")));
+            $del_template->set('purge', Horde::widget($refresh_url->cAdd(array('actionID' => 'expunge_mailbox', 'mailbox_token' => $mailbox_token)), _("Purge Deleted"), 'widget purgeAction', '', '', _("Pur_ge Deleted")));
         }
         echo $del_template->fetch(IMP_TEMPLATES . '/mailbox/actions_deleted.html');
     }
@@ -525,11 +525,11 @@ if ($pageOb['msgcount']) {
     }
 
     if ($showdelete['purge']) {
-        $mailbox_link = Horde_Util::addParameter($mailbox_imp_url, 'page', $pageOb['page']);
+        $mailbox_link = $mailbox_imp_url->cAdd('page', $pageOb['page']);
         if (isset($deleted_prompt)) {
-            $a_template->set('hide_deleted', Horde::widget(Horde_Util::addParameter($mailbox_link, array('actionID' => 'hide_deleted', 'mailbox_token' => $mailbox_token)), $deleted_prompt, 'widget hideAction', '', '', $deleted_prompt));
+            $a_template->set('hide_deleted', Horde::widget($mailbox_link->cAdd(array('actionID' => 'hide_deleted', 'mailbox_token' => $mailbox_token)), $deleted_prompt, 'widget hideAction', '', '', $deleted_prompt));
         }
-        $a_template->set('purge_deleted', Horde::widget(Horde_Util::addParameter($mailbox_link, array('actionID' => 'expunge_mailbox', 'mailbox_token' => $mailbox_token)), _("Purge Deleted"), 'widget purgeAction', '', '', _("Pur_ge Deleted")));
+        $a_template->set('purge_deleted', Horde::widget($mailbox_link->cAdd(array('actionID' => 'expunge_mailbox', 'mailbox_token' => $mailbox_token)), _("Purge Deleted"), 'widget purgeAction', '', '', _("Pur_ge Deleted")));
     }
 
     if ($registry->hasMethod('mail/blacklistFrom')) {
@@ -634,7 +634,7 @@ if ($pageOb['msgcount']) {
             $extra = Horde_Imap_Client::SORT_SUBJECT;
             $standard = Horde_Imap_Client::SORT_THREAD;
         }
-        $headers[$standard]['extra'] = '&nbsp;<span style="toggleSubject">[' . Horde::widget(Horde_Util::addParameter($mailbox_imp_url, array('sortby' => $extra, 'actionID' => 'change_sort', 'mailbox_token' => $mailbox_token)), $headers[$extra]['stext'], 'widget', null, 'if (window.event) window.event.cancelBubble = true; else if (event) event.stopPropagation();', $headers[$extra]['text']) . ']</span>';
+        $headers[$standard]['extra'] = '&nbsp;<span style="toggleSubject">[' . Horde::widget($mailbox_imp_url->cAdd(array('sortby' => $extra, 'actionID' => 'change_sort', 'mailbox_token' => $mailbox_token)), $headers[$extra]['stext'], 'widget', null, 'if (window.event) window.event.cancelBubble = true; else if (event) event.stopPropagation();', $headers[$extra]['text']) . ']</span>';
         unset($headers[$extra]);
     }
 
@@ -642,15 +642,16 @@ if ($pageOb['msgcount']) {
         $ptr = &$headers[$key];
         $ptr['class'] = ($sortpref['by'] == $key) ? 'selected' : 'item';
         if ($sortpref['by'] == $key) {
-            $ptr['change_sort_link'] = Horde::link(Horde_Util::addParameter($sort_url, array('sortby' => $key, 'actionID' => 'change_sort', 'mailbox_token' => $mailbox_token)), $val['stext'], null, null, null, $val['stext']) . Horde::img($sortImg, $sortText, '', $graphicsdir) . '</a>';
+            $ptr['change_sort_link'] = Horde::link($sort_url->cAdd(array('sortby' => $key, 'actionID' => 'change_sort', 'mailbox_token' => $mailbox_token)), $val['stext'], null, null, null, $val['stext']) . Horde::img($sortImg, $sortText, '', $graphicsdir) . '</a>';
         } else {
             $ptr['change_sort_link'] = null;
         }
         if ($sortpref['limit']) {
             $ptr['sortlimit_text'] = Horde::stripAccessKey($val['text']);
         } else {
-            $ptr['change_sort'] = addslashes(Horde_Util::addParameter(($sortpref['by'] == $key) ? $sort_url : $mailbox_imp_url, array('sortby' => $key, 'actionID' => 'change_sort', 'mailbox_token' => $mailbox_token)));
-            $ptr['change_sort_widget'] = Horde::widget(Horde_Util::addParameter(($sortpref['by'] == $key) ? $sort_url : $mailbox_imp_url, array('sortby' => $key, 'actionID' => 'change_sort', 'mailbox_token' => $mailbox_token)), $val['stext'], 'widget', null, null, $val['text']);
+            $tmp = ($sortpref['by'] == $key) ? $sort_url : $mailbox_imp_url;
+            $ptr['change_sort'] = addslashes($tmp->cAdd(array('sortby' => $key, 'actionID' => 'change_sort', 'mailbox_token' => $mailbox_token)));
+            $ptr['change_sort_widget'] = Horde::widget($tmp->cAdd(array('sortby' => $key, 'actionID' => 'change_sort', 'mailbox_token' => $mailbox_token)), $val['stext'], 'widget', null, null, $val['text']);
             if (!isset($val['extra'])) {
                 $ptr['extra'] = null;
             }
@@ -689,7 +690,7 @@ while (list(,$ob) = each($mbox_info['overview'])) {
                 _outputSummaries($msgs);
                 $msgs = array();
             }
-            $folder_link = Horde::url(Horde_Util::addParameter('mailbox.php', 'mailbox', $ob['mailbox']));
+            $folder_link = Horde::applicationUrl('mailbox.php')->add('mailbox', $ob['mailbox']);
             $folder_link = Horde::link($folder_link, sprintf(_("View messages in %s"), IMP::displayFolder($ob['mailbox'])), 'smallheader') . IMP::displayFolder($ob['mailbox']) . '</a>';
             if (is_null($search_template)) {
                 $search_template = new Horde_Template();
index 7cf7efb..b00d694 100644 (file)
@@ -24,7 +24,7 @@ new IMP_Application(array('init' => true, 'tz' => true));
 /* Make sure we have a valid index. */
 $imp_mailbox = IMP_Mailbox::singleton($imp_mbox['mailbox'], $imp_mbox['uid']);
 if (!$imp_mailbox->isValidIndex(false)) {
-    header('Location: ' . Horde_Util::addParameter(IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox']), array('a' => 'm'), null, false));
+    header('Location: ' . IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox'])->setRaw(true)->add('a', 'm'));
     exit;
 }
 
@@ -87,7 +87,7 @@ if ($imp_ui->moveAfterAction()) {
  * case. */
 if (!$imp_mailbox->isValidIndex() ||
     ($msg_delete && $prefs->getValue('mailbox_return'))) {
-    header('Location: ' . Horde_Util::addParameter(IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox']), array('s' => $imp_mailbox->getMessageIndex()), null, false));
+    header('Location: ' . IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox'])->setRaw(true)->add('s', $imp_mailbox->getMessageIndex()));
     exit;
 }
 
@@ -109,7 +109,7 @@ try {
         Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => $readonly))
     ), array('ids' => array($uid)));
 } catch (Horde_Imap_Client_Exception $e) {
-    header('Location: ' . Horde_Util::addParameter(IMP::generateIMPUrl('mailbox-mimp.php', $mailbox_name), array('a' => 'm'), null, false));
+    header('Location: ' . IMP::generateIMPUrl('mailbox-mimp.php', $mailbox_name)->setRaw(true)->add('a', 'm'));
     exit;
 }
 
@@ -122,7 +122,7 @@ $use_pop = ($_SESSION['imp']['protocol'] == 'pop');
 try {
     $imp_contents = IMP_Contents::singleton($uid . IMP::IDX_SEP . $mailbox_name);
 } catch (Horde_Exception $e) {
-    header('Location: ' . Horde_Util::addParameter(IMP::generateIMPUrl('mailbox-mimp.php', $mailbox_name), array('a' => 'm'), null, false));
+    header('Location: ' . IMP::generateIMPUrl('mailbox-mimp.php', $mailbox_name)->setRaw(true)->add('a', 'm'));
     exit;
 }
 
@@ -131,7 +131,7 @@ $msgindex = $imp_mailbox->getMessageIndex();
 $msgcount = $imp_mailbox->getMessageCount();
 
 /* Generate the mailbox link. */
-$mailbox_link = Horde_Util::addParameter(IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox']), array('s' => $msgindex));
+$mailbox_link = IMP::generateIMPUrl('mailbox-mimp.php', $imp_mbox['mailbox'])->add('s', $msgindex));
 $self_link = IMP::generateIMPUrl('message-mimp.php', $imp_mbox['mailbox'], $uid, $mailbox_name);
 
 /* Init render object. */
@@ -145,14 +145,14 @@ if (($actionID == 'c') && !is_null($atc_id)) {
     $mimp_render->set('title', _("Verify Download"));
 
     $null = null;
-    $hb = &$mimp_render->add(new Horde_Mobile_block($null));
+    $hb = $mimp_render->add(new Horde_Mobile_block($null));
 
     $hb->add(new Horde_Mobile_text(_("Click to verify download of attachment") . ': '));
     $hb->add(new Horde_Mobile_link($summary['description'], $summary['download']));
-    $t = &$hb->add(new Horde_Mobile_text(sprintf(' [%s] %s', $summary['type'], $summary['size']) . "\n"));
+    $t = $hb->add(new Horde_Mobile_text(sprintf(' [%s] %s', $summary['type'], $summary['size']) . "\n"));
     $t->set('linebreaks', true);
 
-    $hb = &$mimp_render->add(new Horde_Mobile_block($null));
+    $hb = $mimp_render->add(new Horde_Mobile_block($null));
     $hb->add(new Horde_Mobile_link(_("Return to message view"), $self_link));
 
     $mimp_render->display();
@@ -295,20 +295,20 @@ if ($prefs->getValue('mimp_preview_msg') &&
     !Horde_Util::getFormData('fullmsg') &&
     (strlen($msg_text) > 250)) {
     $msg_text = Horde_String::substr(trim($msg_text), 0, 250) . " [...]\n";
-    $fullmsg_link = new Horde_Mobile_link(_("View Full Message"), Horde_Util::addParameter($self_link, array('fullmsg' => 1)));
+    $fullmsg_link = new Horde_Mobile_link(_("View Full Message"), $self_link->cAdd('fullmsg', 1));
 } else {
     $fullmsg_link = null;
 }
 
 /* Create message menu. */
 $menu = new Horde_Mobile_card('o', _("Menu"));
-$mset = &$menu->add(new Horde_Mobile_linkset());
+$mset = $menu->add(new Horde_Mobile_linkset());
 
 if (!$readonly) {
     if (in_array('\\deleted', $flags)) {
-        $mset->add(new Horde_Mobile_link(_("Undelete"), Horde_Util::addParameter($self_link, array('a' => 'u'))));
+        $mset->add(new Horde_Mobile_link(_("Undelete"), $self_link->cAdd('a', 'u')));
     } else {
-        $mset->add(new Horde_Mobile_link(_("Delete"), Horde_Util::addParameter($self_link, array('a' => 'd', 'mt' => Horde::getRequestToken('imp.message-mimp')))));
+        $mset->add(new Horde_Mobile_link(_("Delete"), $self_link->cAdd(array('a' => 'd', 'mt' => Horde::getRequestToken('imp.message-mimp')))));
     }
 }
 
@@ -350,27 +350,27 @@ $mset->add(new Horde_Mobile_link(sprintf(_("To %s"), IMP::getLabel($imp_mbox['ma
 if ($conf['spam']['reporting'] &&
     ($conf['spam']['spamfolder'] ||
      ($mailbox_name != IMP::folderPref($prefs->getValue('spam_folder'), true)))) {
-    $mset->add(new Horde_Mobile_link(_("Report as Spam"), Horde_Util::addParameter($self_link, array('a' => 'rs', 'mt' => Horde::getRequestToken('imp.message-mimp')))));
+    $mset->add(new Horde_Mobile_link(_("Report as Spam"), $self_link->cAdd(array('a' => 'rs', 'mt' => Horde::getRequestToken('imp.message-mimp')))));
 }
 
 if ($conf['notspam']['reporting'] &&
     (!$conf['notspam']['spamfolder'] ||
      ($mailbox_name == IMP::folderPref($prefs->getValue('spam_folder'), true)))) {
-    $mset->add(new Horde_Mobile_link(_("Report as Innocent"), Horde_Util::addParameter($self_link, array('a' => 'ri', 'mt' => Horde::getRequestToken('imp.message-mimp')))));
+    $mset->add(new Horde_Mobile_link(_("Report as Innocent"), $self_link->cAdd(array('a' => 'ri', 'mt' => Horde::getRequestToken('imp.message-mimp')))));
 }
 
 IMP_Mimp::addMIMPMenu($mset, 'message');
 
 $mimp_render->set('title', $display_headers['subject']);
 
-$c = &$mimp_render->add(new Horde_Mobile_card('m', ($status ? $status . ' | ' : '') . $display_headers['subject'] . ' ' . sprintf(_("(%d of %d)"), $msgindex, $msgcount)));
+$c = $mimp_render->add(new Horde_Mobile_card('m', ($status ? $status . ' | ' : '') . $display_headers['subject'] . ' ' . sprintf(_("(%d of %d)"), $msgindex, $msgcount)));
 $c->softkey('#o', _("Menu"));
 
 $imp_notify->setMobileObject($c);
 $notification->notify(array('listeners' => 'status'));
 
 $null = null;
-$hb = &$c->add(new Horde_Mobile_block($null));
+$hb = $c->add(new Horde_Mobile_block($null));
 
 $allto_param = Horde_Util::getFormData('allto');
 
@@ -383,10 +383,10 @@ foreach ($display_headers as $head => $val) {
         $val = Horde_String::substr($val, 0, strpos($val, ','));
         $all_to = true;
     }
-    $t = &$hb->add(new Horde_Mobile_text($val . (($all_to) ? ' ' : "\n")));
+    $t = $hb->add(new Horde_Mobile_text($val . (($all_to) ? ' ' : "\n")));
     if ($all_to) {
-        $hb->add(new Horde_Mobile_link('[' . _("Show All") . ']', Horde_Util::addParameter($self_link, array('allto' => 1))));
-        $t = &$hb->add(new Horde_Mobile_text("\n"));
+        $hb->add(new Horde_Mobile_link('[' . _("Show All") . ']', $self_link->cAdd('allto', 1)));
+        $t = $hb->add(new Horde_Mobile_text("\n"));
     }
     $t->set('linebreaks', true);
 }
@@ -400,15 +400,15 @@ foreach ($atc_parts as $key) {
         /* Preference: if set, only show download confirmation screen if
          * attachment over a certain size. */
         $download_link = ($summary['bytes'] > $prefs->getValue('mimp_download_confirm'))
-            ? Horde_Util::addParameter($self_link, array('a' => 'c', 'atc' => $key))
+            ? $self_link->cAdd(array('a' => 'c', 'atc' => $key))
             : $summary['download'];
         $hb->add(new Horde_Mobile_link($summary['description'], $download_link));
     }
-    $t = &$hb->add(new Horde_Mobile_text(sprintf(' [%s] %s', $summary['type'], $summary['size']) . "\n"));
+    $t = $hb->add(new Horde_Mobile_text(sprintf(' [%s] %s', $summary['type'], $summary['size']) . "\n"));
     $t->set('linebreaks', true);
 }
 
-$t = &$c->add(new Horde_Mobile_text($msg_text));
+$t = $c->add(new Horde_Mobile_text($msg_text));
 $t->set('linebreaks', true);
 
 if (!is_null($fullmsg_link)) {
index ec6560d..a20c02e 100644 (file)
@@ -222,7 +222,7 @@ $page_label = IMP::getLabel($imp_mbox['mailbox']);
 /* Generate the link to ourselves. */
 $msgindex = $imp_mailbox->getMessageIndex();
 $message_url = Horde::applicationUrl('message.php');
-$self_link = Horde_Util::addParameter(IMP::generateIMPUrl('message.php', $imp_mbox['mailbox'], $uid, $mailbox_name), array('start' => $msgindex, 'message_token' => $message_token));
+$self_link = IMP::generateIMPUrl('message.php', $imp_mbox['mailbox'], $uid, $mailbox_name)->add(array('start' => $msgindex, 'message_token' => $message_token));
 
 /* Develop the list of headers to display. */
 $basic_headers = $imp_ui->basicHeaders();
@@ -354,10 +354,9 @@ ksort($full_headers);
 /* For the self URL link, we can't trust the index in the query string as it
  * may have changed if we deleted/copied/moved messages. We may need other
  * stuff in the query string, so we need to do an add/remove of 'uid'. */
-$selfURL = Horde_Util::removeParameter(Horde::selfUrl(true), array('actionID', 'mailbox', 'thismailbox', 'uid'));
-$selfURL = IMP::generateIMPUrl($selfURL, $imp_mbox['mailbox'], $uid, $mailbox_name);
-IMP::$newUrl = $selfURL = html_entity_decode(Horde_Util::addParameter($selfURL, 'message_token', $message_token));
-$headersURL = htmlspecialchars(Horde_Util::removeParameter($selfURL, array('show_all_headers', 'show_list_headers')));
+$selfURL = new Horde_Url(true);
+IMP::$newUrl = $selfURL = IMP::generateIMPUrl($selfURL->remove(array('actionID', 'mailbox', 'thismailbox', 'uid')), $imp_mbox['mailbox'], $uid, $mailbox_name)->add('message_token', $message_token);
+$headersURL = $selfURL->cRemove(array('show_all_headers', 'show_list_headers'));
 
 /* Generate previous/next links. */
 $prev_msg = $imp_mailbox->getIMAPIndex(-1);
@@ -370,7 +369,7 @@ if ($next_msg) {
 }
 
 /* Generate the mailbox link. */
-$mailbox_url = Horde_Util::addParameter(IMP::generateIMPUrl('mailbox.php', $imp_mbox['mailbox']), 'start', $msgindex);
+$mailbox_url = IMP::generateIMPUrl('mailbox.php', $imp_mbox['mailbox'])->add('start', $msgindex);
 
 /* Everything below here is related to preparing the output. */
 
@@ -403,7 +402,7 @@ foreach ($flag_parse as $val) {
 $h_page_label = htmlspecialchars($page_label);
 $header_label = $h_page_label;
 if ($imp_search->isSearchMbox($imp_mbox['mailbox'])) {
-    $header_label .= ' [' . Horde::link(Horde_Util::addParameter(Horde::applicationUrl('mailbox.php'), 'mailbox', $mailbox_name)) . IMP::displayFolder($mailbox_name) . '</a>]';
+    $header_label .= ' [' . Horde::link(Horde::applicationUrl('mailbox.php')->add('mailbox', $mailbox_name)) . IMP::displayFolder($mailbox_name) . '</a>]';
 }
 
 /* Prepare the navbar top template. */
@@ -468,9 +467,9 @@ if (!$prefs->getValue('compose_popup')) {
 
 if (!$readonly) {
     if (in_array('\\deleted', $flags)) {
-        $a_template->set('delete', Horde::widget(Horde_Util::addParameter($self_link, 'actionID', 'undelete_message'), _("Undelete"), 'widget', '', '', _("Undelete"), true));
+        $a_template->set('delete', Horde::widget($self_link->cAdd('actionID', 'undelete_message'), _("Undelete"), 'widget', '', '', _("Undelete"), true));
     } else {
-        $a_template->set('delete', Horde::widget(Horde_Util::addParameter($self_link, 'actionID', 'delete_message'), _("Delete"), 'widget', '', ($use_pop) ? "return window.confirm('" . addslashes(_("Are you sure you wish to PERMANENTLY delete these messages?")) . "');" : '', _("_Delete"), true));
+        $a_template->set('delete', Horde::widget($self_link->cAdd('actionID', 'delete_message'), _("Delete"), 'widget', '', ($use_pop) ? "return window.confirm('" . addslashes(_("Are you sure you wish to PERMANENTLY delete these messages?")) . "');" : '', _("_Delete"), true));
     }
 }
 
@@ -494,15 +493,15 @@ if (!$disable_compose) {
 }
 
 if (IMP::threadSortAvailable($imp_mbox['mailbox'])) {
-    $a_template->set('show_thread', Horde::widget(Horde_Util::addParameter(IMP::generateIMPUrl('thread.php', $imp_mbox['mailbox'], $uid, $mailbox_name), array('start' => $msgindex)), _("View Thread"), 'widget', '', '', _("_View Thread"), true));
+    $a_template->set('show_thread', Horde::widget(IMP::generateIMPUrl('thread.php', $imp_mbox['mailbox'], $uid, $mailbox_name)->add(array('start' => $msgindex)), _("View Thread"), 'widget', '', '', _("_View Thread"), true));
 }
 
 if ($registry->hasMethod('mail/blacklistFrom')) {
-    $a_template->set('blacklist', Horde::widget(Horde_Util::addParameter($self_link, 'actionID', 'blacklist'), _("Blacklist"), 'widget', '', '', _("_Blacklist"), true));
+    $a_template->set('blacklist', Horde::widget($self_link->cAdd('actionID', 'blacklist'), _("Blacklist"), 'widget', '', '', _("_Blacklist"), true));
 }
 
 if ($registry->hasMethod('mail/whitelistFrom')) {
-    $a_template->set('whitelist', Horde::widget(Horde_Util::addParameter($self_link, 'actionID', 'whitelist'), _("Whitelist"), 'widget', '', '', _("_Whitelist"), true));
+    $a_template->set('whitelist', Horde::widget($self_link->cAdd('actionID', 'whitelist'), _("Whitelist"), 'widget', '', '', _("_Whitelist"), true));
 }
 
 if (!empty($conf['user']['allow_view_source'])) {
@@ -541,10 +540,10 @@ if ($all_headers || $list_headers) {
     $a_template->set('common_headers', Horde::widget($headersURL, _("Show Common Headers"), 'widget', '', '', _("Show Common Headers"), true));
 }
 if (!$all_headers) {
-    $a_template->set('all_headers', Horde::widget(Horde_Util::addParameter($headersURL, 'show_all_headers', 1), _("Show All Headers"), 'widget', '', '', _("Show All Headers"), true));
+    $a_template->set('all_headers', Horde::widget($headersURL->cAdd('show_all_headers', 1), _("Show All Headers"), 'widget', '', '', _("Show All Headers"), true));
 }
 if ($list_info['exists'] && !$list_headers) {
-    $a_template->set('list_headers', Horde::widget(Horde_Util::addParameter($headersURL, 'show_list_headers', 1), _("Show Mailing List Information"), 'widget', '', '', _("Show Mailing List Information"), true));
+    $a_template->set('list_headers', Horde::widget($headersURL->cAdd('show_list_headers', 1), _("Show Mailing List Information"), 'widget', '', '', _("Show Mailing List Information"), true));
 }
 
 $hdrs = array();
@@ -588,7 +587,7 @@ if (!$readonly && $strip_atc) {
 /* Do MDN processing now. */
 $mdntext = '';
 if ($imp_ui->MDNCheck($imp_mbox['mailbox'], $uid, $mime_headers, Horde_Util::getFormData('mdn_confirm'))) {
-    $mdntext .= $imp_ui->formatStatusMsg(array(array('text' => array(_("The sender of this message is requesting a Message Disposition Notification from you when you have read this message."), sprintf(_("Click %s to send the notification message."), Horde::link(htmlspecialchars(Horde_Util::addParameter($selfURL, 'mdn_confirm', 1))) . _("HERE") . '</a>')))));
+    $mdntext .= $imp_ui->formatStatusMsg(array(array('text' => array(_("The sender of this message is requesting a Message Disposition Notification from you when you have read this message."), sprintf(_("Click %s to send the notification message."), Horde::link(htmlspecialchars($selfURL->cAdd('mdn_confirm', 1))) . _("HERE") . '</a>')))));
 }
 
 /* Build body text. This needs to be done before we build the attachment list
@@ -598,15 +597,16 @@ $inlineout = $imp_ui->getInlineOutput($imp_contents, $contents_mask, $part_info_
 /* Build the Attachments menu. */
 $a_template->set('atc', Horde::widget('#', _("Attachments"), 'widget hasmenu', '', '', _("Attachments"), true));
 if ($show_parts == 'atc') {
-    $a_template->set('show_parts_all', Horde::widget(Horde_Util::addParameter($headersURL, array('show_parts' => 'all')), _("Show All Message Parts"), 'widget', '', '', _("Show All Message Parts"), true));
+    $a_template->set('show_parts_all', Horde::widget($headersURL->cAdd(array('show_parts' => 'all')), _("Show All Message Parts"), 'widget', '', '', _("Show All Message Parts"), true));
 }
 if ($show_parts == 'all') {
-    $a_template->set('show_parts_atc', Horde::widget(Horde_Util::addParameter($headersURL, array('show_parts' => 'atc')), _("Show Attachments Only"), 'widget', '', '', _("Show Attachments Only"), true));
+    $a_template->set('show_parts_atc', Horde::widget($headersURL->cAdd(array('show_parts' => 'atc')), _("Show Attachments Only"), 'widget', '', '', _("Show Attachments Only"), true));
 }
 if (count($inlineout['display_ids']) > 2) {
     $a_template->set('download_all', Horde::widget($imp_contents->urlView($imp_contents->getMIMEMessage(), 'download_all'), _("Download All Attachments (in .zip file)"), 'widget', '', '', _("Download All Attachments (in .zip file)"), true));
     if ($strip_atc) {
-        $a_template->set('strip_all', Horde::widget(htmlspecialchars(html_entity_decode(Horde_Util::addParameter(Horde_Util::removeParameter(Horde::selfUrl(true), array('actionID')), array('actionID' => 'strip_all', 'message_token' => $message_token)))), _("Strip All Attachments"), 'widget', '', "return window.confirm('" . addslashes(_("Are you sure you wish to PERMANENTLY delete all attachments?")) . "');", _("Strip All Attachments"), true));
+        $strip_url = new Horde_Url(Horde::selfUrl(true));
+        $a_template->set('strip_all', Horde::widget($strip_url->remove(array('actionID'))->add(array('actionID' => 'strip_all', 'message_token' => $message_token)), _("Strip All Attachments"), 'widget', '', "return window.confirm('" . addslashes(_("Are you sure you wish to PERMANENTLY delete all attachments?")) . "');", _("Strip All Attachments"), true));
     }
 }
 
index 9768cf8..68a5e78 100644 (file)
@@ -333,13 +333,13 @@ if ($prefs->getValue('use_pgp')) {
     if (!$t->get('empty_pubkey_list')) {
         $plist = array();
         foreach ($pubkey_list as $val) {
-            $linkurl = Horde_Util::addParameter($selfURL, 'email', $val['email']);
+            $linkurl = $selfURL->cAdd('email', $val['email']);
             $plist[] = array(
                 'name' => $val['name'],
                 'email' => $val['email'],
-                'view' => Horde::link(Horde_Util::addParameter($linkurl, 'actionID', 'view_public_key'), sprintf(_("View %s Public Key"), $val['name']), null, 'view_key'),
-                'info' => Horde::link(Horde_Util::addParameter($linkurl, 'actionID', 'info_public_key'), sprintf(_("Information on %s Public Key"), $val['name']), null, 'info_key'),
-                'delete' => Horde::link(Horde_Util::addParameter($linkurl, 'actionID', 'delete_public_key'), sprintf(_("Delete %s Public Key"), $val['name']), null, null, "if (confirm('" . addslashes(_("Are you sure you want to delete this public key?")) . "')) { return true; } else { return false; }")
+                'view' => Horde::link($linkurl->cAdd('actionID', 'view_public_key'), sprintf(_("View %s Public Key"), $val['name']), null, 'view_key'),
+                'info' => Horde::link($linkurl->cAdd('actionID', 'info_public_key'), sprintf(_("Information on %s Public Key"), $val['name']), null, 'info_key'),
+                'delete' => Horde::link($linkurl->cAdd('actionID', 'delete_public_key'), sprintf(_("Delete %s Public Key"), $val['name']), null, null, "if (confirm('" . addslashes(_("Are you sure you want to delete this public key?")) . "')) { return true; } else { return false; }")
             );
         }
         $t->set('pubkey_list', $plist);
@@ -360,14 +360,14 @@ if ($prefs->getValue('use_pgp')) {
     if ($secure_check) {
         $t->set('has_key', $prefs->getValue('pgp_public_key') && $prefs->getValue('pgp_private_key'));
         if ($t->get('has_key')) {
-            $t->set('viewpublic', Horde::link(Horde_Util::addParameter($selfURL, 'actionID', 'view_personal_public_key'), _("View Personal Public Key"), null, 'view_key'));
-            $t->set('infopublic', Horde::link(Horde_Util::addParameter($selfURL, 'actionID', 'info_personal_public_key'), _("Information on Personal Public Key"), null, 'info_key'));
-            $t->set('sendkey', Horde::link(Horde_Util::addParameter($selfURL, 'actionID', 'send_public_key'), _("Send Key to Public Keyserver")));
+            $t->set('viewpublic', Horde::link($selfURL->cAdd('actionID', 'view_personal_public_key'), _("View Personal Public Key"), null, 'view_key'));
+            $t->set('infopublic', Horde::link($selfURL->cAdd('actionID', 'info_personal_public_key'), _("Information on Personal Public Key"), null, 'info_key'));
+            $t->set('sendkey', Horde::link($selfURL->cAdd('actionID', 'send_public_key'), _("Send Key to Public Keyserver")));
             $t->set('personalkey-public-help', Horde_Help::link('imp', 'pgp-personalkey-public'));
             $passphrase = $imp_pgp->getPassphrase('personal');
-            $t->set('passphrase', (empty($passphrase)) ? Horde::link('#', _("Enter Passphrase"), null, null, IMP::passphraseDialogJS('PGPPersonal') . ';return false;') . _("Enter Passphrase") : Horde::link(Horde_Util::addParameter($selfURL, 'actionID', 'unset_passphrase'), _("Unload Passphrase")) . _("Unload Passphrase"));
-            $t->set('viewprivate', Horde::link(Horde_Util::addParameter($selfURL, 'actionID', 'view_personal_private_key'), _("View Personal Private Key"), null, 'view_key'));
-            $t->set('infoprivate', Horde::link(Horde_Util::addParameter($selfURL, 'actionID', 'info_personal_private_key'), _("Information on Personal Private Key"), null, 'info_key'));
+            $t->set('passphrase', (empty($passphrase)) ? Horde::link('#', _("Enter Passphrase"), null, null, IMP::passphraseDialogJS('PGPPersonal') . ';return false;') . _("Enter Passphrase") : Horde::link($selfURL->cAdd('actionID', 'unset_passphrase'), _("Unload Passphrase")) . _("Unload Passphrase"));
+            $t->set('viewprivate', Horde::link($selfURL->cAdd('actionID', 'view_personal_private_key'), _("View Personal Private Key"), null, 'view_key'));
+            $t->set('infoprivate', Horde::link($selfURL->cAdd('actionID', 'info_personal_private_key'), _("Information on Personal Private Key"), null, 'info_key'));
             $t->set('personalkey-private-help', Horde_Help::link('imp', 'pgp-personalkey-private'));
             $t->set('deletekeypair', addslashes(_("Are you sure you want to delete your keypair? (This is NOT recommended!)")));
             $t->set('personalkey-delete-help', Horde_Help::link('imp', 'pgp-personalkey-delete'));
index 343098e..b94699f 100644 (file)
@@ -31,7 +31,7 @@ if ($search_mailbox) {
     $id = $imp_ui_search->processBasicSearch($search_mailbox, Horde_Util::getFormData('search_criteria'), Horde_Util::getFormData('search_criteria_text'), Horde_Util::getFormData('search_criteria_not'), Horde_Util::getFormData('search_flags'));
 
     /* Redirect to the mailbox screen. */
-    header('Location: ' . Horde_Util::addParameter(Horde::applicationUrl('mailbox.php', true), 'mailbox', $GLOBALS['imp_search']->createSearchID($id), false));
+    header('Location: ' . Horde::applicationUrl('mailbox.php', true)->setRaw(true)->add('mailbox', $GLOBALS['imp_search']->createSearchID($id)));
     exit;
 }
 
@@ -71,7 +71,7 @@ IMP::menu();
 IMP::status();
 
 if ($browser->hasFeature('javascript')) {
-    $t->set('advsearch', Horde::link(Horde_Util::addParameter(Horde::applicationUrl('search.php'), array('search_mailbox' => $search_mailbox))));
+    $t->set('advsearch', Horde::link(Horde::applicationUrl('search.php')->add(array('search_mailbox' => $search_mailbox))));
 }
 
 echo $t->fetch(IMP_TEMPLATES . '/search/search-basic.html');
index e4ae7a1..f1e5c50 100644 (file)
@@ -80,7 +80,7 @@ if (!empty($criteria)) {
             Horde::wrapInlineScript(array('window.parent.DimpBase.go(' . Horde_Serialize::serialize('folder:' . $id, Horde_Serialize::JSON, $charset) . ')')) .
             '</head></html>';
     } else {
-        header('Location: ' . Horde_Util::addParameter(Horde::applicationUrl('mailbox.php', true), array('mailbox' => $id), null, false));
+        header('Location: ' . Horde::applicationUrl('mailbox.php', true)->setRaw(true)->add('mailbox', $id));
     }
     exit;
 }
index f9b8bd8..41c7549 100644 (file)
@@ -254,13 +254,13 @@ if ($openssl_check && $prefs->getValue('use_smime')) {
     if (!$t->get('empty_pubkey_list')) {
         $plist = array();
         foreach ($pubkey_list as $val) {
-            $linkurl = Horde_Util::addParameter($selfURL, 'email', $val['email']);
+            $linkurl = $selfURL->cAdd('email', $val['email']);
             $plist[] = array(
                 'name' => $val['name'],
                 'email' => $val['email'],
-                'view' => Horde::link(Horde_Util::addParameter($linkurl, 'actionID', 'view_public_key'), sprintf(_("View %s Public Key"), $val['name']), null, 'view_key'),
-                'info' => Horde::link(Horde_Util::addParameter($linkurl, 'actionID', 'info_public_key'), sprintf(_("Information on %s Public Key"), $val['name']), null, 'info_key'),
-                'delete' => Horde::link(Horde_Util::addParameter($linkurl, 'actionID', 'delete_public_key'), sprintf(_("Delete %s Public Key"), $val['name']), null, null, "if (confirm('" . addslashes(_("Are you sure you want to delete this public key?")) . "')) { return true; } else { return false; }")
+                'view' => Horde::link($linkurl->cAdd('actionID', 'view_public_key'), sprintf(_("View %s Public Key"), $val['name']), null, 'view_key'),
+                'info' => Horde::link($linkurl->cAdd('actionID', 'info_public_key'), sprintf(_("Information on %s Public Key"), $val['name']), null, 'info_key'),
+                'delete' => Horde::link($linkurl->cAdd('actionID', 'delete_public_key'), sprintf(_("Delete %s Public Key"), $val['name']), null, null, "if (confirm('" . addslashes(_("Are you sure you want to delete this public key?")) . "')) { return true; } else { return false; }")
             );
         }
         $t->set('pubkey_list', $plist);
@@ -281,11 +281,11 @@ if ($openssl_check && $prefs->getValue('use_smime')) {
     if (!$t->get('secure_check')) {
         $t->set('has_key', $prefs->getValue('smime_public_key') && $prefs->getValue('smime_private_key'));
         if ($t->get('has_key')) {
-            $t->set('viewpublic', Horde::link(Horde_Util::addParameter($selfURL, 'actionID', 'view_personal_public_key'), _("View Personal Public Key"), null, 'view_key'));
-            $t->set('infopublic', Horde::link(Horde_Util::addParameter($selfURL, 'actionID', 'info_personal_public_key'), _("Information on Personal Public Key"), null, 'info_key'));
+            $t->set('viewpublic', Horde::link($selfURL->cAdd('actionID', 'view_personal_public_key'), _("View Personal Public Key"), null, 'view_key'));
+            $t->set('infopublic', Horde::link($selfURL->cAdd('actionID', 'info_personal_public_key'), _("Information on Personal Public Key"), null, 'info_key'));
             $passphrase = $imp_smime->getPassphrase();
-            $t->set('passphrase', empty($passphrase) ? Horde::link('#', _("Enter Passphrase"), null, null, IMP::passphraseDialogJS('SMIMEPersonal') . ';return false;') . _("Enter Passphrase") : Horde::link(Horde_Util::addParameter($selfURL, 'actionID', 'unset_passphrase'), _("Unload Passphrase")) . _("Unload Passphrase"));
-            $t->set('viewprivate', Horde::link(Horde_Util::addParameter($selfURL, 'actionID', 'view_personal_private_key'), _("View Personal Private Key"), null, 'view_key'));
+            $t->set('passphrase', empty($passphrase) ? Horde::link('#', _("Enter Passphrase"), null, null, IMP::passphraseDialogJS('SMIMEPersonal') . ';return false;') . _("Enter Passphrase") : Horde::link($selfURL->cAdd('actionID', 'unset_passphrase'), _("Unload Passphrase")) . _("Unload Passphrase"));
+            $t->set('viewprivate', Horde::link($selfURL->cAdd('actionID', 'view_personal_private_key'), _("View Personal Private Key"), null, 'view_key'));
             $t->set('deletekeypair', addslashes(_("Are you sure you want to delete your keypair? (This is NOT recommended!)")));
             $t->set('personalkey-delete-help', Horde_Help::link('imp', 'smime-delete-personal-certs'));
         } else {
index a9df3aa..53d352e 100644 (file)
@@ -128,7 +128,7 @@ $t->set('plain', $stationery['t'] == 'plain');
 $t->set('html', $stationery['t'] == 'html');
 $t->set('content_label', Horde::label('content', _("Stationery:")));
 $t->set('content', $stationery['c']);
-$t->set('button_href', Horde_Util::addParameter($compose_url, array('group' => 'compose')));
+$t->set('button_href', $compose_url->cAdd('group', 'compose'));
 $t->set('button_val', htmlspecialchars(_("Return to Message Composition"), ENT_COMPAT, Horde_Nls::getCharset()));
 
 echo $t->fetch(IMP_TEMPLATES . '/stationery/stationery.html');
index 8283a04..4a398fc 100644 (file)
@@ -61,7 +61,7 @@ default:
 <?php if ($mailbox_url = Horde_Util::nonInputVar('mailbox_url')): ?>
 <link href="<?php echo $mailbox_url ?>" rel="Up" />
 <?php elseif (!Horde_Util::nonInputVar('login_page')): ?>
-<link href="<?php echo Horde_Util::addParameter(Horde::applicationUrl('mailbox.php'), 'mailbox', 'INBOX') ?>" rel="Top" />
+<link href="<?php echo Horde::applicationUrl('mailbox.php')->add('mailbox', 'INBOX') ?>" rel="Top" />
 <?php endif; ?>
 <?php if ($first_url = Horde_Util::nonInputVar('first_url')): ?>
 <link href="<?php echo $first_url ?>" rel="First" />
index ddf048d..db58096 100644 (file)
@@ -100,13 +100,15 @@ foreach ($loop_array as $mbox => $idxlist) {
         /* Get headers for the message. */
         $curr_msg['date'] = $imp_ui->getLocalTime($envelope['date']);
 
+        $selfurl = new Horde_Url(Horde::selfUrl(true));
+
         if (IMP::isSpecialFolder($mbox)) {
             $curr_msg['addr_to'] = true;
-            $curr_msg['addr'] = _("To:") . ' ' . $imp_ui->buildAddressLinks($envelope['to'], Horde::selfUrl(true));
+            $curr_msg['addr'] = _("To:") . ' ' . $imp_ui->buildAddressLinks($envelope['to'], $selfurl);
             $addr = _("To:") . ' ' . htmlspecialchars(Horde_Mime_Address::addrObject2String(reset($envelope['to'])), ENT_COMPAT, $charset);
         } else {
             $curr_msg['addr_to'] = false;
-            $curr_msg['addr'] = $imp_ui->buildAddressLinks($envelope['from'], Horde::selfUrl(true));
+            $curr_msg['addr'] = $imp_ui->buildAddressLinks($envelope['from'], $selfurl);
             $addr = htmlspecialchars(Horde_Mime_Address::addrObject2String(reset($envelope['from'])), ENT_COMPAT, $charset);
         }
 
@@ -125,7 +127,7 @@ foreach ($loop_array as $mbox => $idxlist) {
             $curr_msg['link'] = Horde::widget('#display', _("Back to Multiple Message View Index"), 'widget', '', '', _("Back to Multiple Message View Index"), true);
         }
         $curr_msg['link'] .= ' | ' . Horde::widget(IMP::generateIMPUrl('message.php', $imp_mbox['mailbox'], $idx, $mbox), _("Go to Message"), 'widget', '', '', _("Go to Message"), true);
-        $curr_msg['link'] .= ' | ' . Horde::widget(Horde_Util::addParameter(IMP::generateIMPUrl('mailbox.php', $mbox), array('start' => $imp_mailbox->getArrayIndex($idx))), sprintf(_("Back to %s"), $page_label), 'widget', '', '', sprintf(_("Bac_k to %s"), $page_label));
+        $curr_msg['link'] .= ' | ' . Horde::widget(IMP::generateIMPUrl('mailbox.php', $mbox)->add(array('start' => $imp_mailbox->getArrayIndex($idx))), sprintf(_("Back to %s"), $page_label), 'widget', '', '', sprintf(_("Bac_k to %s"), $page_label));
 
         $curr_tree['class'] = (++$rowct % 2) ? 'text' : 'item0';
         $curr_tree['subject'] = (($mode == 'thread') ? $threadtree[$idx] : null) . ' ' . Horde::link('#i' . $idx) . Horde_String::truncate($subject_header, 60) . '</a> (' . $addr . ')';
@@ -145,15 +147,13 @@ $template->set(
     'subject',
     $mode == 'thread' ? $subject : sprintf(_("%d Messages"), count($msgs)));
 if ($mode == 'thread') {
-    $delete_link = Horde_Util::addParameter(
-        IMP::generateIMPUrl('mailbox.php', $mbox),
-        array('start' => $imp_mailbox->getArrayIndex($idx),
-              'actionID' => 'delete_messages',
-              'mailbox_token' => Horde::getRequestToken('imp.mailbox')));
+    $delete_link = IMP::generateIMPUrl('mailbox.php', $mbox)->add(array(
+        'actionID' => 'delete_messages',
+        'mailbox_token' => Horde::getRequestToken('imp.mailbox'),
+        'start' => $imp_mailbox->getArrayIndex($idx)
+    ));
     foreach ($thread as $val) {
-        $delete_link = Horde_Util::addParameter(
-            $delete_link,
-            array('indices[]' => $val . IMP::IDX_SEP . $imp_mbox['mailbox']));
+        $delete_link->add(array('indices[]' => $val . IMP::IDX_SEP . $imp_mbox['mailbox']));
     }
     $template->set('delete', Horde::link('#', _("Delete Thread"), null, null, "if (confirm('" . addslashes(_("Are you sure you want to delete all messages in this thread?")) . "')) { window.location = '" . $delete_link . "'; } return false;") . Horde::img('delete.png', _("Delete Thread"), null, $registry->getImageDir('horde')) . '</a>');
 }