From 77b5d7ee304a688a2eb115ce04b460b43c0dd700 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 22 May 2016 08:43:54 -0400
Subject: [PATCH] Fix priority icon(s) position

---
 program/steps/utils/save_pref.inc |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/program/steps/utils/save_pref.inc b/program/steps/utils/save_pref.inc
index 7def873..35ece10 100644
--- a/program/steps/utils/save_pref.inc
+++ b/program/steps/utils/save_pref.inc
@@ -1,11 +1,11 @@
 <?php
 
-/*
+/**
  +-----------------------------------------------------------------------+
  | program/steps/utils/save_pref.inc                                     |
  |                                                                       |
  | This file is part of the Roundcube Webmail client                     |
- | Copyright (C) 2005-2010, The Roundcube Dev Team                       |
+ | Copyright (C) 2005-2013, The Roundcube Dev Team                       |
  |                                                                       |
  | Licensed under the GNU General Public License version 3 or            |
  | any later version with exceptions for skins & plugins.                |
@@ -19,17 +19,27 @@
  +-----------------------------------------------------------------------+
 */
 
-$name = get_input_value('_name', RCUBE_INPUT_POST);
-$value = get_input_value('_value', RCUBE_INPUT_POST);
+$name     = rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST);
+$value    = rcube_utils::get_input_value('_value', rcube_utils::INPUT_POST);
+$sessname = rcube_utils::get_input_value('_session', rcube_utils::INPUT_POST);
+
+// Whitelisted preferences and session variables, others
+// can be added by plugins
 $whitelist = array(
     'preview_pane',
     'list_cols',
     'collapsed_folders',
     'collapsed_abooks',
 );
+$whitelist_sess = array(
+    'list_attrib/columns',
+);
 
-if (!in_array($name, array_merge($whitelist, $RCMAIL->plugins->allowed_prefs))) {
-    raise_error(array('code' => 500, 'type' => 'php',
+$whitelist      = array_merge($whitelist, $RCMAIL->plugins->allowed_prefs);
+$whitelist_sess = array_merge($whitelist_sess, $RCMAIL->plugins->allowed_session_prefs);
+
+if (!in_array($name, $whitelist) || ($sessname && !in_array($sessname, $whitelist_sess))) {
+    rcube::raise_error(array('code' => 500, 'type' => 'php',
         'file' => __FILE__, 'line' => __LINE__,
         'message' => sprintf("Hack attempt detected (user: %s)", $RCMAIL->get_user_name())),
         true, false);
@@ -42,7 +52,7 @@
 $RCMAIL->user->save_prefs(array($name => $value));
 
 // update also session if requested
-if ($sessname = get_input_value('_session', RCUBE_INPUT_POST)) {
+if ($sessname) {
     // Support multidimensional arrays...
     $vars = explode('/', $sessname);
 
@@ -57,5 +67,3 @@
 
 $OUTPUT->reset();
 $OUTPUT->send();
-
-

--
Gitblit v1.9.1