_binary From d880112f70528b837c6ee838b15cdca28bfafcaf Mon Sep 17 00:00:00 2001
From: epinapala <epinapala@ebay.com>
Date: Fri, 14 Nov 2014 13:55:12 -0800
Subject: [PATCH] Back button fixes that were broken due to redirectWithMessage
 changes.

Signed-off-by: epinapala <epinapala@ebay.com>
---
 controllers/components/social_component.php |  9 +++++----
 controllers/controller.php                  | 11 ++++++++++-
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/controllers/components/social_component.php b/controllers/components/social_component.php
index b94e7dc..e4043b0 100644
--- a/controllers/components/social_component.php
+++ b/controllers/components/social_component.php
@@ -1421,8 +1421,8 @@ EOD;
                             $read_address, $additional_substitutions);
                         $parent->redirectWithMessage(
                             tl("group_controller_page_saved"),
-                            array('arg', 'page_name', 'settings',
-                                    'caret', 'scroll_top'));
+                            array('page_name', 'settings',
+                                    'caret', 'scroll_top','back_params'));
                     } else if(!$missing_fields &&
                         isset($_FILES['page_resource']['name']) &&
                         $_FILES['page_resource']['name'] !="") {
@@ -1792,9 +1792,10 @@ EOD;
         */
         $data["OTHER_BACK_URL"] = "";
             if(isset($_REQUEST['back_params']) &&
-                isset($_REQUEST['arg']) && in_array(
+                ((isset($_REQUEST['arg']) && in_array(
                     $parent->clean($_REQUEST['arg'],"string"), array('edit',
-                    'read'))) {
+                    'read'))) || (isset($_REQUEST['page_name'])))
+                    ) {
                 $back_params_cleaned = $_REQUEST['back_params'];
                 array_walk($back_params_cleaned, array($parent, 'clean'));
                 foreach($back_params_cleaned as
diff --git a/controllers/controller.php b/controllers/controller.php
index 7a74ba5..47d93c1 100755
--- a/controllers/controller.php
+++ b/controllers/controller.php
@@ -283,8 +283,17 @@ abstract class Controller
         $location = "?c=$c&a=$a&". CSRF_TOKEN . "=$token";
         foreach($copy_fields as $field) {
             if(isset($_REQUEST[$field])) {
-                $location .= "&$field=".$this->clean($_REQUEST[$field],
+                if (is_array($_REQUEST[$field])){
+                    $array_params_cleaned = $_REQUEST[$field];
+                    foreach ($array_params_cleaned as $key => $value) {
+                        $location .= "&$field"."["
+                                . $this->clean($key,"string") ."]" . "="
+                                . $this->clean($value,"string") ;
+                    }
+                } else{
+                    $location .= "&$field=".$this->clean($_REQUEST[$field],
                     "string");
+                }
             }
         }
         header("Location: $location");
-- 
2.1.2

