From 20ca4e9e509a111f8de0069feeac54e3b31098ee Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Fri, 19 Apr 2013 13:28:19 +0100 Subject: Allow usage in a subdir of a host. --- src/phorkie/File.php | 6 +++--- src/phorkie/Html/Pager.php | 2 +- src/phorkie/HtmlHelper.php | 4 ++-- src/phorkie/Repository.php | 14 +++++++------- src/phorkie/Search/Result.php | 2 +- src/phorkie/Tools.php | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/phorkie/File.php b/src/phorkie/File.php index db773df..63d23e6 100644 --- a/src/phorkie/File.php +++ b/src/phorkie/File.php @@ -106,13 +106,13 @@ class File { if ($type == 'raw') { if ($this->repo->hash === null) { - return '/' . $this->repo->id . '/raw/' . $this->getFilename(); + return $this->repo->id . '/raw/' . $this->getFilename(); } else { - return '/' . $this->repo->id . '/rev-raw/' . $this->repo->hash + return $this->repo->id . '/rev-raw/' . $this->repo->hash . '/' . $this->getFilename(); } } else if ($type == 'tool') { - return '/' . $this->repo->id + return $this->repo->id . '/tool/' . $option . '/' . $this->getFilename(); } diff --git a/src/phorkie/Html/Pager.php b/src/phorkie/Html/Pager.php index e58ccc6..3ccf209 100644 --- a/src/phorkie/Html/Pager.php +++ b/src/phorkie/Html/Pager.php @@ -30,7 +30,7 @@ class Html_Pager 'currentPage' => $currentPage, 'urlVar' => 'page', 'append' => $append, - 'path' => '/', + 'path' => '', 'fileName' => $filename, 'separator' => '###', 'spacesBeforeSeparator' => 0, diff --git a/src/phorkie/HtmlHelper.php b/src/phorkie/HtmlHelper.php index fd04d83..945c7ea 100644 --- a/src/phorkie/HtmlHelper.php +++ b/src/phorkie/HtmlHelper.php @@ -6,7 +6,7 @@ class HtmlHelper public function getIconUrl($email, $size = 32) { if ($email == 'anonymous@phorkie') { - return '/phorkie/anonymous.png'; + return 'phorkie/anonymous.png'; } $s = new \Services_Libravatar(); @@ -14,7 +14,7 @@ class HtmlHelper $email, array( 'size' => $size, - 'default' => Tools::fullUrl('/phorkie/anonymous.png') + 'default' => Tools::fullUrl('phorkie/anonymous.png') ) ); } diff --git a/src/phorkie/Repository.php b/src/phorkie/Repository.php index 6b7435c..815ef5e 100644 --- a/src/phorkie/Repository.php +++ b/src/phorkie/Repository.php @@ -274,19 +274,19 @@ class Repository public function getLink($type, $option = null, $full = false) { if ($type == 'edit') { - $link = '/' . $this->id . '/edit'; + $link = $this->id . '/edit'; } else if ($type == 'display') { - $link = '/' . $this->id; + $link = $this->id; } else if ($type == 'fork') { - $link = '/' . $this->id . '/fork'; + $link = $this->id . '/fork'; } else if ($type == 'doap') { - $link = '/' . $this->id . '/doap'; + $link = $this->id . '/doap'; } else if ($type == 'delete') { - $link = '/' . $this->id . '/delete'; + $link = $this->id . '/delete'; } else if ($type == 'delete-confirm') { - $link = '/' . $this->id . '/delete/confirm'; + $link = $this->id . '/delete/confirm'; } else if ($type == 'revision') { - $link = '/' . $this->id . '/rev/' . $option; + $link = $this->id . '/rev/' . $option; } else { throw new Exception('Unknown link type'); } diff --git a/src/phorkie/Search/Result.php b/src/phorkie/Search/Result.php index 00bb1ec..62e7bb8 100644 --- a/src/phorkie/Search/Result.php +++ b/src/phorkie/Search/Result.php @@ -45,7 +45,7 @@ class Search_Result public function getLink($query) { - return '/search?q=' . urlencode($query); + return 'search?q=' . urlencode($query); } } diff --git a/src/phorkie/Tools.php b/src/phorkie/Tools.php index 1d3d226..fc815cc 100644 --- a/src/phorkie/Tools.php +++ b/src/phorkie/Tools.php @@ -38,14 +38,14 @@ class Tools * * @return string Full URL */ - public static function fullUrl($path) + public static function fullUrl($path = '') { if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']) { $prot = 'https'; } else { $prot = 'http'; } - return $prot . '://' . $_SERVER['HTTP_HOST'] . $path; + return $prot . '://' . $_SERVER['HTTP_HOST'] . $GLOBALS['phorkie']['cfg']['baseurl'] . $path; } /** -- cgit v1.2.3