More fixes re: the new MIMP code.
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 25 Nov 2008 22:17:52 +0000 (15:17 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 26 Nov 2008 00:04:57 +0000 (17:04 -0700)
imp/lib/Mime/Viewer/itip.php
imp/lib/Mime/Viewer/pgp.php
imp/lib/Mime/Viewer/smime.php
imp/lib/api.php
imp/lib/base.php
imp/login.php
imp/templates/login/mobile.inc

index 8b12f8c..278e0ae 100644 (file)
@@ -462,7 +462,7 @@ class IMP_Horde_Mime_Viewer_itip extends Horde_Mime_Viewer_Driver
         if ($this->viewAsAttachment()) {
             $html .= Util::bufferOutput('require', $registry->get('templates', 'horde') . '/common-header.inc');
         }
-        if ($_SESSION['imp']['viewmode'] == 'imp') {
+        if ($_SESSION['imp']['view'] == 'imp') {
             $html .= '<form method="post" name="iCal" action="' . Horde::selfUrl(true) . '">';
         }
 
@@ -491,7 +491,7 @@ class IMP_Horde_Mime_Viewer_itip extends Horde_Mime_Viewer_Driver
         }
 
         // Need to work out if we are inline and actually need this.
-        if ($_SESSION['imp']['viewmode'] == 'imp') {
+        if ($_SESSION['imp']['view'] == 'imp') {
             $html .= '</form>';
         }
         if ($this->viewAsAttachment()) {
@@ -562,7 +562,7 @@ class IMP_Horde_Mime_Viewer_itip extends Horde_Mime_Viewer_Driver
             }
         }
 
-        if ($_SESSION['imp']['viewmode'] != 'imp') {
+        if ($_SESSION['imp']['view'] != 'imp') {
             return $html;
         }
 
@@ -799,7 +799,7 @@ class IMP_Horde_Mime_Viewer_itip extends Horde_Mime_Viewer_Driver
             $html .= '</tbody></table>';
         }
 
-        if ($_SESSION['imp']['viewmode'] != 'imp') {
+        if ($_SESSION['imp']['view'] != 'imp') {
             return $html;
         }
 
@@ -931,7 +931,7 @@ class IMP_Horde_Mime_Viewer_itip extends Horde_Mime_Viewer_Driver
             $html .= '</tbody></table>';
         }
 
-        if ($_SESSION['imp']['viewmode'] != 'imp') {
+        if ($_SESSION['imp']['view'] != 'imp') {
             return $html;
         }
 
index 459c8a2..c832a79 100644 (file)
@@ -163,8 +163,7 @@ class IMP_Horde_Mime_Viewer_pgp extends Horde_Mime_Viewer_Driver
         /* Check if this a symmetrically encrypted message. */
         $symmetric = $this->_imppgp->encryptedSymmetrically($encrypted_data);
         if ($symmetric && !$this->_imppgp->getSymmetricPassphrase()) {
-            if (isset($_SESSION['imp']['viewmode']) &&
-                ($_SESSION['imp']['viewmode'] == 'imp')) {
+            if ($_SESSION['imp']['view'] == 'imp') {
                 // TODO: Fix to work with DIMP
                 /* Ask for the correct passphrase if this is encrypted
                  * symmetrically. */
@@ -184,8 +183,7 @@ class IMP_Horde_Mime_Viewer_pgp extends Horde_Mime_Viewer_Driver
                 $status[] = _("The message below has been encrypted with PGP, however, no personal private key exists so the message cannot be decrypted.");
                 return null;
             } elseif (!$this->_imppgp->getPassphrase() &&
-                      ($_SESSION['imp']['viewmode']) &&
-                      ($_SESSION['imp']['viewmode'] == 'imp')) {
+                      ($_SESSION['imp']['view'] == 'imp')) {
                 // TODO: Fix to work with DIMP
                 /* Ask for the private key's passphrase if this is encrypted
                  * asymmetrically. */
@@ -310,8 +308,7 @@ class IMP_Horde_Mime_Viewer_pgp extends Horde_Mime_Viewer_Driver
                     Text_Filter::filter($sig_result, 'text2html', array('parselevel' => TEXT_HTML_NOHTML))
                 )
             );
-        } elseif (isset($_SESSION['imp']['viewmode']) &&
-                  ($_SESSION['imp']['viewmode'] == 'imp')) {
+        } elseif ($_SESSION['imp']['view'] == 'imp') {
             // TODO: Fix to work with DIMP
             $status[] = Horde::link(Util::addParameter(Horde::selfUrl(true), array('pgp_verify_msg' => 1))) . _("Click HERE to verify the message.") . '</a>';
         }
index 2057181..72a98a4 100644 (file)
@@ -115,7 +115,7 @@ class IMP_Horde_Mime_Viewer_smime extends Horde_Mime_Viewer_Driver
                 'status' => array(
                     array(
                         'icon' => Horde::img('mime/encryption.png', 'S/MIME'),
-                        'text' => array()
+                        'text' => array(_("This message has been encrypted via S/MIME."))
                     )
                 ),
                 'type' => 'text/html; charset=' . NLS::getCharset()
@@ -138,8 +138,7 @@ class IMP_Horde_Mime_Viewer_smime extends Horde_Mime_Viewer_Driver
         /* Make sure we have a passphrase. */
         $passphrase = $this->_impsmime->getPassphrase();
         if ($passphrase === false) {
-            if (isset($_SESSION['imp']['viewmode']) &&
-                ($_SESSION['imp']['viewmode'] == 'imp')) {
+            if ($_SESSION['imp']['view'] == 'imp') {
                 // TODO: Fix to work with DIMP
                 $status[] = Horde::link('#', _("You must enter the passphrase for your S/MIME private key to view this message"), null, null, $this->_impsmime->getJSOpenWinCode('open_passphrase_dialog') . 'return false;') . _("You must enter the passphrase for your S/MIME private key to view this message.") . '</a>';
             }
@@ -233,8 +232,7 @@ class IMP_Horde_Mime_Viewer_smime extends Horde_Mime_Viewer_Driver
         if ($GLOBALS['prefs']->getValue('smime_verify') ||
             Util::getFormData('smime_verify_msg')) {
             $sig_result = $this->_impsmime->verifySignature($raw_text);
-        } elseif (isset($_SESSION['imp']['viewmode']) &&
-                  ($_SESSION['imp']['viewmode'] == 'imp')) {
+        } elseif ($_SESSION['imp']['view'] == 'imp') {
             // TODO: Fix to work with DIMP
             $status[] = Horde::link(Util::addParameter(Horde::selfUrl(true), 'smime_verify_msg', 1)) . _("Click HERE to verify the message.") . '</a>';
             return $ret;
index a3292f9..51d45f4 100644 (file)
@@ -185,9 +185,10 @@ function _imp_compose($args = array(), $extra = array())
  */
 function _imp_batchCompose($args = array(), $extra = array())
 {
-    if (isset($_SESSION['imp']['viewmode']) &&
-        $_SESSION['imp']['viewmode'] != 'imp') {
-        return $GLOBALS['registry']->callByPackage($_SESSION['imp']['viewmode'], 'batchCompose', array($args, $extra));
+    // TODO: Fix
+    if (isset($_SESSION['imp']['view']) &&
+        $_SESSION['imp']['view'] != 'imp') {
+        return $GLOBALS['registry']->callByPackage($_SESSION['imp']['view'], 'batchCompose', array($args, $extra));
     }
 
     $GLOBALS['authentication'] = 'none';
index b5632a5..7469bd2 100644 (file)
@@ -10,6 +10,7 @@
  *                      'none'  - Do not authenticate
  *                      Default - Authenticate to IMAP/POP server
  *   $compose_page    - If true, we are on IMP's compose page
+ *   $login_page      - If true, we are on IMP's login page
  *   $mimp_debug      - If true, output text/plain version of page.
  *   $no_compress     - Controls whether the page should be compressed
  *   $session_control - Sets special session control limitations
@@ -136,7 +137,8 @@ if ($authentication !== 'none') {
 
 // Notification system.
 $notification = &Notification::singleton();
-if ($_SESSION['imp']['view'] == 'mimp') {
+if ((Util::nonInputVar('login_page') && $GLOBALS['browser']->isMobile()) ||
+    (isset($_SESSION['imp']['view']) && ($_SESSION['imp']['view'] == 'mimp'))) {
     require_once 'Horde/Notification/Listener/mobile.php';
     $GLOBALS['mimp_notify'] = &$notification->attach('status', null, 'Notification_Listener_mobile');
 } else {
@@ -165,7 +167,7 @@ if ((IMP::loginTasksFlag() === 2) &&
     IMP_Session::loginTasks();
 }
 
-if ($_SESSION['imp']['view'] == 'mimp') {
+if (isset($_SESSION['imp']['view']) && ($_SESSION['imp']['view'] == 'mimp')) {
     // Need to explicitly load MIMP.php
     require_once IMP_BASE . '/lib/MIMP.php';
 
index 99305fa..9b828b0 100644 (file)
@@ -13,6 +13,7 @@
 
 @define('AUTH_HANDLER', true);
 $authentication = 'none';
+$login_page = true;
 require_once dirname(__FILE__) . '/lib/base.php';
 
 /* Set the 'preferred' server. */
@@ -218,7 +219,6 @@ if (!empty($conf['user']['select_view'])) {
 /* Mobile login page. */
 if ($browser->isMobile()) {
     require_once 'Horde/Mobile.php';
-    require_once 'Horde/Notification/Listener/mobile.php';
 
     /* Build the <select> widget for the servers list. */
     if ($show_list) {
index 32a81eb..b8f025b 100644 (file)
@@ -4,9 +4,7 @@ $m = new Horde_Mobile(_("Log in"));
 
 $c = &$m->add(new Horde_Mobile_card());
 
-$notification = &new Notification();
-$l = &$notification->attach('status', null, 'Notification_Listener_mobile');
-$l->setMobileObject($c);
+$mimp_notify->setMobileObject($c);
 
 $c->add(new Horde_Mobile_text(sprintf(_("Welcome to %s"), ($imp_auth) ? $registry->get('name',' horde') : $registry->get('name'))));