OSDN Git Service

BugTrack/2213 Set Absolute URI or Root relative path
authorumorigu <umorigu@gmail.com>
Sat, 2 Sep 2017 09:25:49 +0000 (18:25 +0900)
committerumorigu <umorigu@gmail.com>
Sat, 2 Sep 2017 09:25:49 +0000 (18:25 +0900)
* Absolute URI: URI for Offline USE
* Root relative URI: Location header in HTTP redirection

13 files changed:
lib/auth.php
lib/file.php
lib/func.php
plugin/amazon.inc.php
plugin/attach.inc.php
plugin/bugtrack.inc.php
plugin/edit.inc.php
plugin/newpage.inc.php
plugin/pcomment.inc.php
plugin/rename.inc.php
plugin/rss.inc.php
plugin/rss10.inc.php
plugin/tracker.inc.php

index 139af6c..890aec3 100644 (file)
@@ -315,7 +315,7 @@ function basic_auth($page, $auth_enabled, $exit_on_fail, $auth_pages, $title_can
                                header('Location: ' . $loginurl);
                        } elseif (AUTH_TYPE_EXTERNAL === $auth_type ||
                                AUTH_TYPE_SAML === $auth_type) {
-                               $url_after_login = get_script_uri() . '?' . $g_query_string;
+                               $url_after_login = get_base_uri(PKWK_URI_ABSOLUTE) . '?' . $g_query_string;
                                $loginurl = get_auth_external_login_url($page, $url_after_login);
                                header('HTTP/1.0 302 Found');
                                header('Location: ' . $loginurl);
@@ -629,7 +629,7 @@ function form_auth_redirect($location, $page)
        if ($location) {
                header('Location: ' . $location);
        } else {
-               $url = get_script_uri() . '?' . $page;
+               $url = get_page_uri($page, PKWK_URI_ROOT);
                header('Location: ' . $url);
        }
 }
index 79b2d61..34a2f3e 100644 (file)
@@ -320,7 +320,7 @@ function file_write($dir, $page, $str, $notimestamp = FALSE, $is_delete = FALSE)
                if ($notify_diff_only) $str = preg_replace('/^[^-+].*\n/m', '', $str);
                $footer['ACTION'] = 'Page update';
                $footer['PAGE']   = $page;
-               $footer['URI']    = get_script_uri() . '?' . pagename_urlencode($page);
+               $footer['URI']    = get_page_uri($page, PKWK_URI_ABSOLUTE);
                $footer['USER_AGENT']  = TRUE;
                $footer['REMOTE_ADDR'] = TRUE;
                pkwk_mail_notify($notify_subject, $str, $footer) or
index 4ac9eb3..2e33ce8 100644 (file)
@@ -928,8 +928,7 @@ function manage_page_redirect() {
        }
        $new_page = get_pagename_on_redirect($page);
        if ($new_page != false) {
-               header('Location: ' . get_script_uri() . '?' .
-                       pagename_urlencode($new_page));
+               header('Location: ' . get_page_uri($new_page, PKWK_URI_ROOT));
                return TRUE;
        }
        return FALSE;
index 636edfc..82f2064 100644 (file)
@@ -4,8 +4,8 @@
 //
 // Amazon plugin: Book-review maker via amazon.com/amazon.jp
 //
-// Copyright:
-//     2004-2016 PukiWiki Development Team
+// Copyright
+//     2004-2017 PukiWiki Development Team
 //     2003 閑舎 <raku@rakunet.org> (Original author)
 //
 // License: GNU/GPL
@@ -211,17 +211,17 @@ function plugin_amazon_action()
                if ($edit_auth && ($auth_user == '' || ! isset($edit_auth_users[$auth_user]) ||
                    $edit_auth_users[$auth_user] != $_SERVER['PHP_AUTH_PW'])) {
                        // Edit-auth failed. Just look the page
-                       header('Location: ' . get_script_uri() . '?' . $r_page_url);
+                       header('Location: ' . get_page_uri($r_page, PKWK_URI_ROOT));
                } else {
                        $title = plugin_amazon_get_asin_title();
                        if ($title == '' || preg_match('#^/#', $s_page)) {
                                // Invalid page name
-                               header('Location: ' . get_script_uri() . '?' . pagename_urlencode($s_page));
+                               header('Location: ' . get_page_uri($s_page, PKWK_URI_ROOT));
                        } else {
                                $body = '#amazon(' . $asin_all . ',,image)' . "\n" .
                                        '*' . $title . "\n" . $amazon_body;
                                plugin_amazon_review_save($r_page, $body);
-                               header('Location: ' . get_script_uri() .
+                               header('Location: ' . get_base_uri(PKWK_URI_ROOT) .
                                        '?cmd=edit&page=' . $r_page_url);
                        }
                }
index d0ccb43..84012e3 100644 (file)
@@ -203,13 +203,11 @@ function attach_upload($file, $page, $pass = NULL)
 
        if ($notify) {
                $footer['ACTION']   = 'File attached';
-               $footer['FILENAME'] = & $file['name'];
-               $footer['FILESIZE'] = & $file['size'];
-               $footer['PAGE']     = & $page;
-
-               $footer['URI']      = get_script_uri() .
-                       //'?' . pagename_urlencode($page);
+               $footer['FILENAME'] = $file['name'];
+               $footer['FILESIZE'] = $file['size'];
+               $footer['PAGE']     = $page;
 
+               $footer['URI']      = get_base_uri(PKWK_URI_ABSOLUTE) .
                        // MD5 may heavy
                        '?plugin=attach' .
                                '&refer=' . rawurlencode($page) .
@@ -642,10 +640,9 @@ EOD;
 
                if ($notify) {
                        $footer['ACTION']   = 'File deleted';
-                       $footer['FILENAME'] = & $this->file;
-                       $footer['PAGE']     = & $this->page;
-                       $footer['URI']      = get_script_uri() .
-                               '?' . pagename_urlencode($this->page);
+                       $footer['FILENAME'] = $this->file;
+                       $footer['PAGE']     = $this->page;
+                       $footer['URI']      = get_page_uri($this->page, PKWK_URI_ABSOLUTE);
                        $footer['USER_AGENT']  = TRUE;
                        $footer['REMOTE_ADDR'] = TRUE;
                        pkwk_mail_notify($notify_subject, "\n", $footer) or
index 8d5b4fb..17a682f 100644 (file)
@@ -177,7 +177,7 @@ function plugin_bugtrack_action()
                $post['version'], $post['body']);
 
        pkwk_headers_sent();
-       header('Location: ' . get_script_uri() . '?' . pagename_urlencode($page));
+       header('Location: ' . get_page_uri($page, PKWK_URI_ROOT));
        exit;
 }
 
@@ -284,7 +284,7 @@ function plugin_bugtrack_get_page_list($page, $needs_filetime) {
  */
 function plugin_bugtrack_list_convert()
 {
-       global $script, $vars, $_plugin_bugtrack, $_title_cannotread;
+       global $vars, $_plugin_bugtrack, $_title_cannotread;
        $cache_format_version = 1;
        $cache_expire_time = 60 * 60 * 24;
        $cache_refresh_time_prev;
index bc9dabe..89b41f9 100644 (file)
@@ -254,7 +254,7 @@ function plugin_edit_write()
 
        page_write($page, $postdata, $notimeupdate != 0 && $notimestamp);
        pkwk_headers_sent();
-       header('Location: ' . get_script_uri() . '?' . pagename_urlencode($page));
+       header('Location: ' . get_page_uri($page, PKWK_URI_ROOT));
        exit;
 }
 
@@ -263,6 +263,6 @@ function plugin_edit_cancel()
 {
        global $vars;
        pkwk_headers_sent();
-       header('Location: ' . get_script_uri() . '?' . pagename_urlencode($vars['page']));
+       header('Location: ' . get_page_uri($vars['page'], PKWK_URI_ROOT));
        exit;
 }
index d1229fb..6830de8 100644 (file)
@@ -1,5 +1,8 @@
 <?php
-// $Id: newpage.inc.php,v 1.16 2011/01/25 15:01:01 henoheno Exp $
+// PukiWiki - Yet another WikiWikiWeb clone.
+// newpage.inc.php
+// Copyright 2002-2017 PukiWiki Development Team
+// License: GPL v2 or (at your option) any later version
 //
 // Newpage plugin
 
@@ -50,9 +53,8 @@ function plugin_newpage_action()
                $r_refer = rawurlencode($vars['refer']);
 
                pkwk_headers_sent();
-               header('Location: ' . get_script_uri() .
+               header('Location: ' . get_base_uri(PKWK_URI_ROOT) .
                        '?cmd=read&page=' . $r_page . '&refer=' . $r_refer);
                exit;
        }
 }
-?>
index ac6931c..4130774 100644 (file)
@@ -1,9 +1,11 @@
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone
-// $Id: pcomment.inc.php,v 1.48 2011/01/25 15:01:01 henoheno Exp $
+// pcomment.inc.php
+// Copyright 2002-2017 PukiWiki Development Team
+// License: GPL v2 or (at your option) any later version
 //
 // pcomment plugin - Show/Insert comments into specified (another) page
-//
+
 // Usage: #pcomment([page][,max][,options])
 //
 //   page -- An another page-name that holds comments
@@ -56,7 +58,7 @@ function plugin_pcomment_action()
        }
 
        pkwk_headers_sent();
-       header('Location: ' . get_script_uri() . '?' . pagename_urlencode($refer));
+       header('Location: ' . get_page_uri($refer, PKWK_URI_ROOT));
        exit;
 }
 
@@ -379,4 +381,3 @@ function plugin_pcomment_get_comments($page, $count, $dir, $reply)
 
        return array($comments, $digest);
 }
-
index a31b704..32043c9 100644 (file)
@@ -395,7 +395,7 @@ function plugin_rename_proceed($pages, $files, $exists)
        if ($page == '') $page = PLUGIN_RENAME_LOGPAGE;
 
        pkwk_headers_sent();
-       header('Location: ' . get_script_uri() . '?' . pagename_urlencode($page));
+       header('Location: ' . get_page_uri($page, PKWK_URI_ROOT));
        exit;
 }
 
index 19faf42..1f76202 100644 (file)
@@ -1,9 +1,11 @@
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone
-// $Id: rss.inc.php,v 1.21 2007/02/11 05:53:31 henoheno Exp $
+// rss.inc.php
+// Copyright 2003-2017 PukiWiki Development Team
+// License: GPL v2 or (at your option) any later version
 //
 // RSS plugin: Publishing RSS of RecentChanges
-//
+
 // Usage: plugin=rss[&ver=[0.91|1.0|2.0]] (Default: 0.91)
 //
 // NOTE for acronyms
@@ -31,7 +33,7 @@ function plugin_rss_action()
 
        $lang = LANG;
        $page_title_utf8 = mb_convert_encoding($page_title, 'UTF-8', SOURCE_ENCODING);
-       $self = get_script_uri();
+       $self = get_base_uri(PKWK_URI_ABSOLUTE);
 
        // Creating <item>
        $items = $rdf_li = '';
@@ -129,4 +131,3 @@ EOD;
        }
        exit;
 }
-
index 0b7cf4a..ce07a45 100644 (file)
@@ -1,12 +1,14 @@
 <?php
+// PukiWiki - Yet another WikiWikiWeb clone
+// rss10.inc.php
+// Copyright 2003-2017 PukiWiki Development Team
+//
 // RSS 1.0 plugin - had been merged into rss plugin
-// $Id: rss10.inc.php,v 1.17 2005/09/24 01:16:43 henoheno Exp $
 
 function plugin_rss10_action()
 {
        pkwk_headers_sent();
        header('Status: 301 Moved Permanently');
-       header('Location: ' . get_script_uri() . '?cmd=rss&ver=1.0'); // HTTP
+       header('Location: ' . get_base_uri(PKWK_URI_ROOT) . '?cmd=rss&ver=1.0'); // HTTP
        exit;
 }
-?>
index d7f6320..bd5d646 100644 (file)
@@ -184,11 +184,8 @@ function plugin_tracker_action()
 
        // Writing page data, without touch
        page_write($page, join('', $postdata));
-
-       $r_page = pagename_urlencode($page);
-
        pkwk_headers_sent();
-       header('Location: ' . get_script_uri() . '?' . $r_page);
+       header('Location: ' . get_page_uri($page, PKWK_URI_ROOT));
        exit;
 }