[Svn] r2329 - in branches/devel-api: plugins/subscriptions_option program/include program/steps/settings

trac at roundcube.net trac at roundcube.net
Thu Mar 5 19:48:56 CET 2009


Author: thomasb
Date: 2009-03-05 12:48:56 -0600 (Thu, 05 Mar 2009)
New Revision: 2329

Modified:
   branches/devel-api/plugins/subscriptions_option/subscriptions_option.php
   branches/devel-api/program/include/rcube_imap.php
   branches/devel-api/program/steps/settings/save_prefs.inc
Log:
Use simpler field names + don't use rcube_config::all() too much + some minor codestyle changes

Modified: branches/devel-api/plugins/subscriptions_option/subscriptions_option.php
===================================================================
--- branches/devel-api/plugins/subscriptions_option/subscriptions_option.php	2009-03-04 10:02:55 UTC (rev 2328)
+++ branches/devel-api/plugins/subscriptions_option/subscriptions_option.php	2009-03-05 18:48:56 UTC (rev 2329)
@@ -28,8 +28,8 @@
     function init()
     {
         $this->add_texts('localization/', false);
-        $config = rcmail::get_instance()->config->all();
-        if (!in_array('use_subscriptions',$config['dont_override'])){
+        $dont_override = rcmail::get_instance()->config->get('dont_override', array());
+        if (!in_array('use_subscriptions', $dont_override)){
             $this->add_hook('user_preferences_server_settings', array($this, 'settings_table'));
             $this->add_hook('save_preferences', array($this, 'save_prefs'));
         }
@@ -39,24 +39,24 @@
 
     function settings_table($args)
     {
-        $config = rcmail::get_instance()->config->all();
+        $use_subscriptions = rcmail::get_instance()->config->get('use_subscriptions');
         $field_id = 'rcmfd_use_subscriptions';
         $use_subscriptions = new html_checkbox(array('name' => '_use_subscriptions', 'id' => $field_id, 'value' => 1));
 
         $args['table']->add('title', html::label($field_id, Q($this->gettext('useimapsubscriptions'))));
-        $args['table']->add(null, $use_subscriptions->show($config['use_subscriptions']?1:0));
+        $args['table']->add(null, $use_subscriptions->show($use_subscriptions?1:0));
 
         return $args;
     }
 
     function save_prefs($args){
         $rcmail = rcmail::get_instance();
-        $config = $rcmail->config->all();
+        $use_subscriptions = $rcmail->config->get('use_subscriptions');
 
-        $args['a_user_prefs']['use_subscriptions'] = isset($_POST['_use_subscriptions']) ? TRUE : FALSE;
+        $args['prefs']['use_subscriptions'] = isset($_POST['_use_subscriptions']) ? true : false;
         // if the use_subscriptions preference changes, flush the folder cache
-        if (($config['use_subscriptions'] && !isset($_POST['_use_subscriptions'])) ||
-            (!$config['use_subscriptions'] && isset($_POST['_use_subscriptions']))) {
+        if (($use_subscriptions && !isset($_POST['_use_subscriptions'])) ||
+            (!$use_subscriptions && isset($_POST['_use_subscriptions']))) {
                 $rcmail->imap_init(true);
                 $rcmail->imap->clear_cache('mailboxes');
             }
@@ -66,15 +66,15 @@
 
     function list_mailboxes($args){
         $rcmail = rcmail::get_instance();
-        if ($rcmail->config->get('use_subscriptions', TRUE) == FALSE) {
-            $args['a_folders'] = iil_C_ListMailboxes($rcmail->imap->conn, $rcmail->imap->_mod_mailbox($args['root']), $args['filter']);
+        if (!$rcmail->config->get('use_subscriptions', true)) {
+            $args['folders'] = iil_C_ListMailboxes($rcmail->imap->conn, $rcmail->imap->_mod_mailbox($args['root']), $args['filter']);
         }
         return $args;
     }
 
     function manage_folders($args){
-        $rcmail =rcmail::get_instance();
-        if ($rcmail->config->get('use_subscriptions', TRUE) == FALSE) {
+        $rcmail = rcmail::get_instance();
+        if (!$rcmail->config->get('use_subscriptions', true)) {
             $args['table']->remove_column('subscribed');
         }
         return $args;

Modified: branches/devel-api/program/include/rcube_imap.php
===================================================================
--- branches/devel-api/program/include/rcube_imap.php	2009-03-04 10:02:55 UTC (rev 2328)
+++ branches/devel-api/program/include/rcube_imap.php	2009-03-05 18:48:56 UTC (rev 2329)
@@ -428,8 +428,8 @@
 
     // Give plugins a chance to provide a list of mailboxes
     $data = rcmail::get_instance()->plugins->exec_hook('list_mailboxes',array('root'=>$root,'filter'=>$filter));
-    if(isset($data['a_folders'])){
-        $a_folders = $data['a_folders'];
+    if (isset($data['folders'])) {
+        $a_folders = $data['folders'];
     }
     else{
         // retrieve list of folders from IMAP server

Modified: branches/devel-api/program/steps/settings/save_prefs.inc
===================================================================
--- branches/devel-api/program/steps/settings/save_prefs.inc	2009-03-04 10:02:55 UTC (rev 2328)
+++ branches/devel-api/program/steps/settings/save_prefs.inc	2009-03-05 18:48:56 UTC (rev 2329)
@@ -48,8 +48,8 @@
   'trash_mbox' => get_input_value('_trash_mbox', RCUBE_INPUT_POST),
   );
 
-$data  =  rcmail::get_instance()->plugins->exec_hook('save_preferences', array('a_user_prefs'=>$a_user_prefs));
-$a_user_prefs = $data['a_user_prefs'];
+$data  =  rcmail::get_instance()->plugins->exec_hook('save_preferences', array('prefs' => $a_user_prefs));
+$a_user_prefs = $data['prefs'];
 
 // don't override these parameters
 foreach ((array)$CONFIG['dont_override'] as $p)

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list