aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorColin Guthrie <colin.guthrie@tribalogic.net>2013-04-19 13:28:19 +0100
committerColin Guthrie <colin.guthrie@tribalogic.net>2013-04-21 19:57:43 +0100
commit20ca4e9e509a111f8de0069feeac54e3b31098ee (patch)
treecd1a27410c2fc470d270cf79cab021781d1931aa /src
parentba158e3ed03dec10e6654b0b0dd3710504bdf04d (diff)
downloadphorkie-20ca4e9e509a111f8de0069feeac54e3b31098ee.tar.gz
phorkie-20ca4e9e509a111f8de0069feeac54e3b31098ee.zip
Allow usage in a subdir of a host.
Diffstat (limited to 'src')
-rw-r--r--src/phorkie/File.php6
-rw-r--r--src/phorkie/Html/Pager.php2
-rw-r--r--src/phorkie/HtmlHelper.php4
-rw-r--r--src/phorkie/Repository.php14
-rw-r--r--src/phorkie/Search/Result.php2
-rw-r--r--src/phorkie/Tools.php4
6 files changed, 16 insertions, 16 deletions
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;
}
/**