http://atutor.ca/atutor/mantis/view.php?id=4660
authorharris wong <hwong@ocad.ca>
Fri, 17 Dec 2010 22:09:46 +0000 (22:09 -0000)
committerharris wong <hwong@ocad.ca>
Fri, 17 Dec 2010 22:09:46 +0000 (22:09 -0000)
docs/go.php
docs/mods/_standard/blogs/index.php
docs/mods/_standard/blogs/sublinks.php
docs/mods/_standard/file_storage/sublinks.php

index b7ba645..058d5b0 100644 (file)
@@ -73,23 +73,34 @@ if (!$obj->isEmpty()){
  * @param      array   consist of all the pathinfo variables in querystring format
  */
 function save2Get($var_query){
-       if (empty($var_query) || !is_array($var_query))
-               return;
-       foreach($var_query as $k=>$v){
-               if ($k=='page_to_load'){
-                       continue;
-               }
+    if (empty($var_query) || !is_array($var_query))
+        return;
 
-               //If mod_rewrite is on, the page# will be shown as <page#>.html.
-               //in this case, parse the page number out.
-               if ($k=='page'){
-                       if (preg_match('/(.*)\.html$/', $v, $matches)==1){
-                               $v = $matches[1];
-                       }
-               }
-               $_GET[$k] = $v;
-               $_REQUEST[$k] = $v;
-       }
+    //recreate URL querystring so we can use the PHP function - parse_str() later on
+    foreach($var_query as $k=>$v){
+        if ($k=='page_to_load'){
+            continue;
+        }
+
+        //If mod_rewrite is on, the page# will be shown as <page#>.html.
+        //in this case, parse the page number out.
+        if ($k=='page'){
+            if (preg_match('/(.*)\.html$/', $v, $matches)==1){
+                $v = $matches[1];
+            }
+        }
+        $temp[] = $k . '=' . $v;
+    }
+    $var_query = implode(SEP, $temp);
+    parse_str($var_query, $output); //convert querystring to php array
+
+    //saves it to both GET and REQUEST
+    //TODO: Would overwrite POST value that has the same GET name within REQUEST. Fix this.
+    //Avoid the use of REQUEST in the code.
+    foreach($output as $k=>$v){
+        $_GET[$k] = $v;
+        $_REQUEST[$k] = $v;
+    }
 }
 
 /**
index cdb9b34..59eceed 100644 (file)
@@ -47,13 +47,13 @@ while ($row = mysql_fetch_assoc($result)) {
                        $last_updated = '';\r
                }\r
 \r
-               echo '<li class="top-tool" style="position:relative;"><a href="'.url_rewrite('mods/_standard/blogs/view.php?ot='.BLOGS_GROUP.htmlentities(SEP).'oid='.$row['group_id']).'">'.$row['title'].$last_updated.'</a>';\r
+               echo '<li class="top-tool" style="position:relative;"><a href="'.url_rewrite('mods/_standard/blogs/view.php?ot='.BLOGS_GROUP. SEP .'oid='.$row['group_id']).'">'.$row['title'].$last_updated.'</a>';\r
                \r
                // Check if subscribed and make appropriate button\r
                if ($sub->is_subscribed('blog',$_SESSION['member_id'],$row['group_id'])){\r
-                       echo '<a style="float:right;clear:right;padding-right:20px;" href="'.$_SERVER['PHP_SELF'].'?group_id='.$row['group_id'].htmlentities(SEP).'subscribe=unset"><img border="0" src="'.AT_BASE_HREF.'images/unsubscribe-envelope.png" alt="" /> '._AT('blog_unsubscribe').'</a>';\r
+                       echo '<a style="float:right;clear:right;padding-right:20px;" href="'.$_SERVER['PHP_SELF'].'?group_id='.$row['group_id']. SEP .'subscribe=unset"><img border="0" src="'.AT_BASE_HREF.'images/unsubscribe-envelope.png" alt="" /> '._AT('blog_unsubscribe').'</a>';\r
                } else {\r
-                       echo '<a style="float:right;clear:right;padding-right:20px;" href="'.$_SERVER['PHP_SELF'].'?group_id='.$row['group_id'].htmlentities(SEP).'subscribe=set"><img border="0" src="'.AT_BASE_HREF.'images/subscribe-envelope.png" alt="" /> '._AT('blog_subscribe').'</a>';\r
+                       echo '<a style="float:right;clear:right;padding-right:20px;" href="'.$_SERVER['PHP_SELF'].'?group_id='.$row['group_id']. SEP .'subscribe=set"><img border="0" src="'.AT_BASE_HREF.'images/subscribe-envelope.png" alt="" /> '._AT('blog_subscribe').'</a>';\r
                }\r
                echo '</li>';\r
                $blogs = true;\r
index ba18427..9ee8e4f 100644 (file)
@@ -32,7 +32,7 @@ if (mysql_num_rows($result) > 0) {
                        }
        
                        $link_title = $row['title'].$last_updated;
-                       $list[] = '<a href="'.url_rewrite('mods/_standard/blogs/view.php?ot='.BLOGS_GROUP.htmlentities(SEP).'oid='.$row['group_id'], AT_PRETTY_URL_IS_HEADER).'"'.
+                       $list[] = '<a href="'.url_rewrite('mods/_standard/blogs/view.php?ot='.BLOGS_GROUP. SEP .'oid='.$row['group_id'], AT_PRETTY_URL_IS_HEADER).'"'.
                                  (strlen($link_title) > SUBLINK_TEXT_LEN ? ' title="'.$link_title.'"' : '') .'>'. 
                                  validate_length($link_title, SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) .'</a>'; 
                }
index 064d335..e07c65a 100644 (file)
@@ -17,7 +17,7 @@ if (mysql_num_rows($result) > 0) {
                        $filetext = $row['file_name'];
                }
 
-               $list[] = '<a href="'.url_rewrite('mods/_standard/file_storage/index.php?download=1'.htmlentities(SEP).'files[]='. $row['file_id'], AT_PRETTY_URL_IS_HEADER).'"'.
+               $list[] = '<a href="'.url_rewrite('mods/_standard/file_storage/index.php?download=1'.SEP.'files[]='. $row['file_id'], AT_PRETTY_URL_IS_HEADER).'"'.
                          (strlen($filetext) > SUBLINK_TEXT_LEN ? ' title="'.$filetext.'"' : '') .'>'. 
                          validate_length($filetext, SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) .'</a>';
        }