4892: PHP Undefined warnings: include/classes/Utility.class.php
authorTJ <acontent@iam.tj>
Tue, 11 Oct 2011 09:18:16 +0000 (10:18 +0100)
committerTJ <acontent@iam.tj>
Wed, 19 Oct 2011 19:56:17 +0000 (20:56 +0100)
  * tidy up code to append QueryString to URI
  variables $url_param

include/classes/Utility.class.php

index 5c451fb..8de59ff 100644 (file)
@@ -303,7 +303,8 @@ class Utility {
        public static function getRefererURLAndParams() {\r
                $caller_url_parts = explode('/', $_SERVER['PHP_SELF']); \r
                $caller_script = $caller_url_parts[count($caller_url_parts)-1];\r
-               \r
+               $url_param = '';\r
+\r
                if (count($_GET) > 0)\r
                {\r
                        foreach ($_GET as $param => $value)\r
@@ -311,14 +312,13 @@ class Utility {
                                if ($param == 'action' || $param == 'cid') \r
                                        continue;\r
                                else\r
-                                       $url_param .= $param.'='.urlencode($value).'&';\r
+                                       $url_param .= ($url_param != '' ? '&' : '').$param.'='.urlencode($value);\r
                        }\r
                }\r
                \r
-               $caller_url = $caller_script. '?'.(isset($url_param) ? $url_param : '');\r
-               $url_param = substr($url_param, 0, -1);\r
+               $caller_url = $caller_script. '?'.$url_param;\r
                \r
                return array($caller_url, $url_param);\r
        }\r
 }\r
-?>
\ No newline at end of file
+?>\r