Permalink
Browse files

added support for passing request queries through a query string vari…

…able of choice rather than the default PATH_INFO. This is a feature wanted by Nginx users.
  • Loading branch information...
rsms committed Nov 21, 2009
1 parent 1a380a1 commit 3885d37f3c8ff87da7e0244344d0438cbff1a0ba
Showing with 11 additions and 2 deletions.
  1. +11 −2 gitblog.php
View
@@ -35,7 +35,10 @@ class gb {
static public $posts_fuzzy_lookup = true;
/** URL to gitblog index _relative_ to gb::$site_url */
- static public $index_prefix = 'index.php/';
+ static public $index_prefix = 'index.php';
+
+ /** 'PATH_INFO' or any other string which will then be matched in $_GET[string] */
+ static public $request_query = 'PATH_INFO';
/**
* When this query string key is set and the client is authorized,
@@ -886,6 +889,9 @@ static function verify() {
gb::$dir = dirname(__FILE__);
ini_set('include_path', ini_get('include_path') . ':' . gb::$dir . '/lib');
+if (gb::$request_query === 'PATH_INFO')
+ gb::$index_prefix = rtrim(gb::$index_prefix, '/').'/';
+
$u = dirname($_SERVER['SCRIPT_NAME']);
$s = dirname($_SERVER['SCRIPT_FILENAME']);
if (substr($_SERVER['SCRIPT_FILENAME'], -20) === '/gitblog/gitblog.php')
@@ -3544,7 +3550,10 @@ function sentenceize($collection, $applyfunc=null, $nglue=', ', $endglue=' and '
* a chance to initialize.
*/
if (isset($gb_handle_request) && $gb_handle_request === true) {
- $gb_request_uri = isset($_SERVER['PATH_INFO']) ? trim($_SERVER['PATH_INFO'], '/') : '';
+ if (gb::$request_query === 'PATH_INFO')
+ $gb_request_uri = isset($_SERVER['PATH_INFO']) ? trim($_SERVER['PATH_INFO'], '/') : '';
+ else
+ $gb_request_uri = isset($_GET[gb::$request_query]) ? trim($_GET[gb::$request_query], '/') : '';
# temporary, non-exported variables
$version = null;

0 comments on commit 3885d37

Please sign in to comment.