From 6c9fe3d894bd065df3e4cd16ff9f661ad7194856 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Sun, 02 Sep 2012 13:34:32 -0400 Subject: [PATCH] Fix possible PHP Warning: in_array() expects parameter 2 to be array --- program/steps/settings/folders.inc | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc index 6fc72d9..1739c27 100644 --- a/program/steps/settings/folders.inc +++ b/program/steps/settings/folders.inc @@ -47,8 +47,8 @@ if ($result) { // Handle subscription of protected folder (#1487656) - if ($CONFIG['protect_default_folders'] == true - && in_array($mbox, $CONFIG['default_folders']) + if ($RCMAIL->config->get('protect_default_folders') + && in_array($mbox, (array)$RCMAIL->config->get('default_folders')) ) { $OUTPUT->command('disable_subscription', $mbox); } @@ -186,7 +186,7 @@ // build table with all folders listed by server function rcube_subscription_form($attrib) { - global $RCMAIL, $CONFIG, $OUTPUT; + global $RCMAIL, $OUTPUT; list($form_start, $form_end) = get_form_tags($attrib, 'folders'); unset($attrib['form']); @@ -214,6 +214,9 @@ $a_js_folders = array(); $seen = array(); $list_folders = array(); + + $default_folders = (array) $RCMAIL->config->get('default_folders'); + $protect_default = $RCMAIL->config->get('protect_default_folders'); // pre-process folders list foreach ($a_unsubscribed as $i => $folder) { @@ -274,7 +277,7 @@ $idx = $i + 1; $sub_key = array_search($folder['id'], $a_subscribed); $subscribed = $sub_key !== false; - $protected = ($CONFIG['protect_default_folders'] == true && in_array($folder['id'], $CONFIG['default_folders'])); + $protected = $protect_default && in_array($folder['id'], $default_folders); $noselect = false; $classes = array($i%2 ? 'even' : 'odd'); @@ -321,8 +324,8 @@ } } } - // check if the folder is shared, then disable subscription option on it - if (!$disabled && $folder['virtual'] && !empty($namespace)) { + // check if the folder is shared, then disable subscription option on it (if not subscribed already) + if (!$disabled && !$subscribed && $folder['virtual'] && !empty($namespace)) { $tmp_ns = array_merge((array)$namespace['other'], (array)$namespace['shared']); foreach ($tmp_ns as $item) { if (strpos($folder['id'], $item[0]) === 0) { @@ -347,7 +350,7 @@ $OUTPUT->add_gui_object('subscriptionlist', $attrib['id']); $OUTPUT->set_env('subscriptionrows', $a_js_folders); - $OUTPUT->set_env('defaultfolders', $CONFIG['default_folders']); + $OUTPUT->set_env('defaultfolders', $default_folders); $OUTPUT->set_env('delimiter', $delimiter); return $form_start . $table->show($attrib) . $form_end; @@ -411,7 +414,10 @@ $OUTPUT->set_pagetitle(rcube_label('folders')); $OUTPUT->include_script('list.js'); -$OUTPUT->set_env('quota', $STORAGE->get_capability('QUOTA')); +$OUTPUT->set_env('prefix_ns', $STORAGE->get_namespace('prefix')); +if ($STORAGE->get_capability('QUOTA')) { + $OUTPUT->set_env('quota', true); +} // add some labels to client $OUTPUT->add_label('deletefolderconfirm', 'purgefolderconfirm', 'folderdeleting', -- Gitblit v1.9.1