Output intvals rather than booleans (saves space).
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 31 Mar 2009 00:18:58 +0000 (18:18 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 1 Apr 2009 19:12:34 +0000 (13:12 -0600)
Allows us to filter out empty entries since JS code should do the
necessary existence checking for us.

imp/lib/DIMP.php
imp/templates/javascript_defs.php

index 2b8d8fb..5b901b5 100644 (file)
@@ -149,7 +149,7 @@ class DIMP
         }
 
         /* Variables used in core javascript files. */
-        $code['conf'] = array(
+        $code['conf'] = array_filter(array(
             'URI_DIMP_INBOX' => Horde::applicationUrl('index-dimp.php', true, -1),
             'URI_IMP' => Horde::applicationUrl('ajax.php', true, -1),
             'URI_PREFS' => Horde::url($horde_webroot . '/services/prefs/', true, -1),
@@ -170,12 +170,12 @@ class DIMP
             'popup_height' => 610,
 
             'spam_folder' => IMP::folderPref($prefs->getValue('spam_folder'), true),
-            'spam_reporting' => (int) !empty($conf['spam']['reporting']),
-            'spam_spamfolder' => (int) !empty($conf['spam']['spamfolder']),
-            'ham_reporting' => (int) !empty($conf['notspam']['reporting']),
-            'ham_spamfolder' => (int) !empty($conf['notspam']['spamfolder']),
-            'refresh_time' => (int) $prefs->getValue('refresh_time'),
-            'search_all' => (int) !empty($conf['dimp']['search']['search_all']),
+            'spam_reporting' => intval(!empty($conf['spam']['reporting'])),
+            'spam_spamfolder' => intval(!empty($conf['spam']['spamfolder'])),
+            'ham_reporting' => intval(!empty($conf['notspam']['reporting'])),
+            'ham_spamfolder' => intval(!empty($conf['notspam']['spamfolder'])),
+            'refresh_time' => intval($prefs->getValue('refresh_time')),
+            'search_all' => intval(!empty($conf['dimp']['search']['search_all'])),
 
             'fixed_folders' => empty($conf['server']['fixed_folders'])
                 ? array()
@@ -185,23 +185,23 @@ class DIMP
 
             'name' => $registry->get('name', 'dimp'),
 
-            'preview_pref' => (bool)$prefs->getValue('dimp_show_preview'),
-            'toggle_pref' => (bool)$prefs->getValue('dimp_toggleheaders'),
+            'preview_pref' => intval($prefs->getValue('dimp_show_preview')),
+            'toggle_pref' => intval($prefs->getValue('dimp_toggleheaders')),
 
-            'is_ie6' => ($browser->isBrowser('msie') && ($browser->getMajor() < 7)),
+            'is_ie6' => intval($browser->isBrowser('msie') && ($browser->getMajor() < 7)),
 
             'buffer_pages' => intval($conf['dimp']['viewport']['buffer_pages']),
             'limit_factor' => intval($conf['dimp']['viewport']['limit_factor']),
             'viewport_wait' => intval($conf['dimp']['viewport']['viewport_wait']),
             'login_view' => $prefs->getValue('dimp_login_view'),
-            'background_inbox' => !empty($conf['dimp']['viewport']['background_inbox']),
+            'background_inbox' => intval(!empty($conf['dimp']['viewport']['background_inbox'])),
             'splitbar_pos' => $prefs->getValue('dimp_splitbar'),
 
             'atc_list' => IMP_UI_Mailbox::getAttachmentAltList(),
 
             // Turn debugging on?
-            'debug' => !empty($conf['dimp']['js']['debug']),
-        );
+            'debug' => intval(!empty($conf['dimp']['js']['debug'])),
+        ));
 
         /* Gettext strings used in core javascript files. */
         $code['text'] = array_map('addslashes', array(
@@ -252,15 +252,15 @@ class DIMP
         if ($compose_mode) {
             /* Variables used in compose page. */
             $compose_cursor = $GLOBALS['prefs']->getValue('compose_cursor');
-            $code['conf_compose'] = array(
-                'rte_avail' => $browser->hasFeature('rte'),
-                'cc' => (bool) $prefs->getValue('compose_cc'),
-                'bcc' => (bool) $prefs->getValue('compose_bcc'),
+            $code['conf_compose'] = array_filter(array(
+                'rte_avail' => intval($browser->hasFeature('rte')),
+                'cc' => intval($prefs->getValue('compose_cc')),
+                'bcc' => intval($prefs->getValue('compose_bcc')),
                 'attach_limit' => ($conf['compose']['attach_count_limit'] ? intval($conf['compose']['attach_count_limit']) : -1),
-                'close_draft' => $prefs->getValue('close_draft'),
+                'close_draft' => intval($prefs->getValue('close_draft')),
                 'compose_cursor' => ($compose_cursor ? $compose_cursor : 'top'),
                 'spellcheck' => intval($prefs->getValue('compose_spellcheck')),
-            );
+            ));
 
             if ($registry->hasMethod('contacts/search')) {
                 $code['conf_compose']['abook_url'] = Horde::applicationUrl('contacts.php');
index 3064c95..751aa79 100644 (file)
 
 $code = array(
 /* Variables used in core javascript files. */
-    'conf' =>  array(
+    'conf' => array(
         'IMP_ALL' => IMP::FLAG_ALL,
-        'isIE' => $GLOBALS['browser']->isBrowser('msie'),
-        'pop3' => (isset($_SESSION['imp']) && ($_SESSION['imp']['protocol'] == 'pop')),
+        'isIE' => intval($GLOBALS['browser']->isBrowser('msie')),
+        'pop3' => intval((isset($_SESSION['imp']) && ($_SESSION['imp']['protocol'] == 'pop'))),
         'fixed_folders' => empty($GLOBALS['conf']['server']['fixed_folders'])
             ? array()
             : $GLOBALS['conf']['server']['fixed_folders'],