Horde::selfUrl() cleanups
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 8 Jan 2010 21:01:14 +0000 (14:01 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 11 Jan 2010 00:14:41 +0000 (17:14 -0700)
framework/Core/lib/Horde.php
imp/attachment.php
imp/compose.php
imp/lib/Contents.php
imp/lib/IMP.php
imp/message.php
imp/thread.php

index bca8e1b..dacd3fc 100644 (file)
@@ -1359,7 +1359,7 @@ HTML;
      * @param boolean $force_ssl     Ignore $conf['use_ssl'] and force creation
      *                               of a SSL URL?
      *
-     * @return string  The requested URI.
+     * @return Horde_Url  The requested URL.
      */
     static public function selfUrl($script_params = false, $nocache = true,
                                    $full = false, $force_ssl = false)
index e5e8636..921ae58 100644 (file)
@@ -19,8 +19,6 @@
 require_once dirname(__FILE__) . '/lib/Application.php';
 new IMP_Application(array('init' => array('authentication' => 'none', 'session_control' => 'none')));
 
-$self_url = Horde::selfUrl(false, true, true);
-
 // Lets see if we are even able to send the user an attachment.
 if (!$conf['compose']['link_attachments']) {
     throw new IMP_Exception(_("Linked attachments are forbidden."));
index 7e07d7b..229a844 100644 (file)
@@ -602,8 +602,7 @@ if ($isPopup) {
     /* If the attachments cache is not empty, we must reload this page
      * and delete the attachments. */
     if ($imp_compose->numberOfAttachments()) {
-        $cancel_url = new Horde_Url(Horde::selfUrl(), true);
-        $cancel_url->add(array(
+        $cancel_url = Horde::selfUrl()->setRaw(true)->add(array(
             'actionID' => 'cancel_compose',
             'composeCache' => $composeCacheID,
             'popup' => 1
@@ -613,7 +612,7 @@ if ($isPopup) {
     /* If the attachments cache is not empty, we must reload this page and
        delete the attachments. */
     if ($imp_compose->numberOfAttachments()) {
-        $cancel_url = _mailboxReturnURL(new Horde_Url(Horde::selfUrl(), true))->add(array(
+        $cancel_url = _mailboxReturnURL(Horde::selfUrl()->setRaw(true))->add(array(
             'actionID' => 'cancel_compose',
             'composeCache' => $composeCacheID
         ));
index 57792b6..0a24fe6 100644 (file)
@@ -702,8 +702,7 @@ class IMP_Contents
             ($id != 0) &&
             (intval($id) != 1) &&
             (strpos($id, '.') === false)) {
-            $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')));
+            $url = Horde::selfUrl(true)->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>';
         }
 
index 1707745..d347a0c 100644 (file)
@@ -1120,8 +1120,8 @@ class IMP
     static public function selfUrl()
     {
         return self::$newUrl
-            ? clone self::$newUrl
-            : new Horde_Url(Horde::selfUrl(true));
+            ? self::$newUrl->copy()
+            : Horde::selfUrl(true);
     }
 
     /**
index 4548121..9709699 100644 (file)
@@ -605,8 +605,7 @@ if ($show_parts == 'all') {
 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) {
-        $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));
+        $a_template->set('strip_all', Horde::widget(Horde::selfUrl(true)->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 8b7a6db..8ec9c4f 100644 (file)
@@ -100,15 +100,13 @@ 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'], $selfurl);
+            $curr_msg['addr'] = _("To:") . ' ' . $imp_ui->buildAddressLinks($envelope['to'], Horde::selfUrl(true));
             $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'], $selfurl);
+            $curr_msg['addr'] = $imp_ui->buildAddressLinks($envelope['from'], Horde::selfUrl(true));
             $addr = htmlspecialchars(Horde_Mime_Address::addrObject2String(reset($envelope['from'])), ENT_COMPAT, $charset);
         }