Allow usage in a subdir of a host.
authorColin Guthrie <colin.guthrie@tribalogic.net>
Fri, 19 Apr 2013 12:28:19 +0000 (13:28 +0100)
committerColin Guthrie <colin.guthrie@tribalogic.net>
Sun, 21 Apr 2013 18:57:43 +0000 (19:57 +0100)
31 files changed:
README.rst
data/config.default.php
data/config.php.dist
data/templates/base.htm
data/templates/display-sidebar-history.htm
data/templates/exception.htm
data/templates/forbidden.htm
data/templates/fork-remote-multiple.htm
data/templates/fork-remote-new.htm
data/templates/login.htm
data/templates/new.htm
src/phorkie/File.php
src/phorkie/Html/Pager.php
src/phorkie/HtmlHelper.php
src/phorkie/Repository.php
src/phorkie/Search/Result.php
src/phorkie/Tools.php
www/.htaccess
www/css/openid.css
www/delete.php
www/edit.php
www/feed-new.php
www/feed-updated.php
www/fork-remote.php
www/fork.php
www/index.php
www/list.php
www/login.php
www/new.php
www/search.php
www/www-header.php

index ede03d0ba3ba1f824cec3d6321de983380ac9722..0e8cadf90f2192effb7ef725de70178e8b6c72b5 100644 (file)
@@ -61,6 +61,12 @@ Installation
    Look at ``config.default.php`` for values that you may adjust.
 
 5. Set your web server's document root to ``/path/to/phorkie/www/``
+   Alternatively, you can add a symlink to the ``www`` folder into your
+   web server's existing document root tree (being careful to keep
+   main phorkie folder outside the document root for security purposes)
+   and ensure you set the ``baseurl`` config option appropriately. You
+   must also set the ``RewriteBase`` in the ``.htaccess`` file or adjust
+   the nginx configuration accordingly.
 
 6. Open phorkie in your web browser
 
index a589924ef10f7dd2210197009833bb9508195e68..56ddc43faa2dc7a4a0dd02b3114adad20f56b466 100644 (file)
@@ -4,6 +4,7 @@ $GLOBALS['phorkie']['cfg'] = array(
     'gitdir'        => __DIR__ . '/../repos/git/',
     'workdir'       => __DIR__ . '/../repos/work/',
     'tpl'           => __DIR__ . '/templates/',
+    'baseurl'       => '/',
     'css'           => '',
     'title'         => 'phorkie',
     'topbar'        => '',
index ced993f508afe4e654b5d8c337358e874c9b4e04..77d20059abc1016a192ffebe110ebf4f13b570d0 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+//$GLOBALS['phorkie']['cfg']['baseurl']  = '/';
 //$GLOBALS['phorkie']['cfg']['gitdir']  = '/var/cache/git/paste/git/';
 //$GLOBALS['phorkie']['cfg']['workdir'] = '/var/cache/git/paste/work/';
 //$GLOBALS['phorkie']['cfg']['git']['public'] = 'git://bogo/git/paste/';
index 8738bb061f510c60fde60185bb8724afcead6cc0..8074938fa52d5552167b3a41b9bb3c5f54f14169 100644 (file)
@@ -1,18 +1,19 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html>
 <html>
- <head>
+  <head>
+  <base href="{{baseurl}}" />
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-  <link rel="stylesheet" href="/css/bootstrap.min.css"/>
-  <link rel="stylesheet" href="/css/font-awesome.css"/>
-  <link rel="stylesheet" href="/css/phorkie.css"/>
+  <link rel="stylesheet" href="css/bootstrap.min.css"/>
+  <link rel="stylesheet" href="css/font-awesome.css"/>
+  <link rel="stylesheet" href="css/phorkie.css"/>
   {% if css %}
   <link rel="stylesheet" href="{{css}}"/>
   {% endif %}
   <title>{% block title %}{% endblock %} - {{title}}</title>
-  <script src="/js/jquery.js"></script>
-  <script src="/js/bootstrap.min.js"></script>
-  <script src="/js/phorkie.js"></script>
+  <script src="js/jquery.js"></script>
+  <script src="js/bootstrap.min.js"></script>
+  <script src="js/phorkie.js"></script>
   {% block meta %}{% endblock %}
  </head>
  <body>
     <div class="container">
      <ul class="nav">
       <li>
-       <a class="brand" href="/">{{title}}</a>
+       <a class="brand" href="{{baseurl}}">{{title}}</a>
       </li>
       <li>
-       <a href="/new">New paste</a>
+       <a href="new">New paste</a>
       </li>
       <li>
-       <a href="/list">List all</a>
+       <a href="list">List all</a>
       </li>
       {% if db.adapter %}
       <li class="nav-collapse">
-       <form class="span4 pull-right navbar-form" action="/search" method="get">
+       <form class="span4 pull-right navbar-form" action="search" method="get">
         <input type="text" class="search-query" name="q" placeholder="Search" value="{{query}}"/>
        </form>
       </li>
@@ -41,7 +42,7 @@
      <ul class="nav pull-right">
       {% if identity %}
       <li>
-       <a href="/user">{{name}}</a>
+       <a href="user">{{name}}</a>
       </li>
       {% endif %}
       {% if db.adapter %}
       {% endif %}
       {% if identity %}
       <li>
-       <a href="/login?logout">Logout</a>
+       <a href="login?logout">Logout</a>
       </li>
       {% else %}
       <li>
-       <a href="/login">Login</a>
+       <a href="login">Login</a>
       </li>
       {% endif %}
      </ul>
index eb844e42ca59d367fbb536c667dec0303573d313..6dda7e0f0ae5b3fb86aff66396f398c300b30d62 100644 (file)
@@ -5,7 +5,7 @@
  <li class="row-fluid {% if commit.hash == repo.hash or (repo.hash == '' and loop.first) %}active{%endif%}">
   {% spaceless %}
   {% for dot in commit.getDots %}
-  <img src="/phorkie/dot-{{dot}}.png" alt="" style="padding-left:1px" width="4" height="4"/>
+  <img src="phorkie/dot-{{dot}}.png" alt="" style="padding-left:1px" width="4" height="4"/>
   {% endfor %}
   {% endspaceless %}
   <a class="hash" href="{{repo.getLink('revision', commit.hash)}}">{{commit.hash|slice(0, 6)}}</a>
index 91120f4712380b1fda513edec34eb4b01e94a041..f4f5d324226856add893a13c37adac2e7da822a0 100644 (file)
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html>
- <head>
-  <link rel="stylesheet" href="/css/phorkie.css" />
+  <head>
+  <base href="{{baseurl}}" />
+  <link rel="stylesheet" href="css/phorkie.css" />
   <title>Error - phorkie</title>
   <meta name="robots" content="noindex"/>
  </head>
index 76e728c82d6f1731c265e6c4718192d06c12b9f6..b32962c869d2777d9e9414ab541eff2a0ca99283 100644 (file)
@@ -21,7 +21,7 @@
 </p>
 {% else %}
 <p>
- We're sorry; but you have to <a href="/login">log in</a> to access this page.
+ We're sorry; but you have to <a href="login">log in</a> to access this page.
 </p>
 {% endif %}
 {% endblock %}
index 8709f11902e06d40088b5ecc3bf345cb328e710a..f00ef2dad78f07fa439472bf93da4ebb6c8726af 100644 (file)
@@ -1,4 +1,4 @@
-<form method="post" action="/fork-remote" enctype="multipart/form-data" class="well form-inline form-horizontal">
+<form method="post" action="fork-remote" enctype="multipart/form-data" class="well form-inline form-horizontal">
  <input type="hidden" name="orig_url" value="{{remote_url}}" />
  <div class="control-group">
   <p>
index 4dc329794cfb1752d7ff33e3eacc7c0b3ef6564e..debafff09b8e246f479f62edfe507b5443055f1c 100644 (file)
@@ -1,4 +1,4 @@
-<form method="post" action="/fork-remote" enctype="multipart/form-data" class="well form-horizontal">
+<form method="post" action="fork-remote" enctype="multipart/form-data" class="well form-horizontal">
  <p>
   <strong>Copy a paste from a remote server:</strong>
   Just paste the website or git clone URL.
index 70a1b6936b75db427449f4d58073392cb04f9eb0..c3ac9fd95a7598c6dc1bed261fd986d2810036a9 100644 (file)
@@ -9,15 +9,15 @@
 
 <link rel="stylesheet" href="css/openid.css" />
 
-<form method="post" action="/login" id="openid_form">
+<form method="post" action="login" id="openid_form">
 
 <fieldset>
   <legend>Sign-in</legend>
   <div id="openid_choice" style="display: block; ">
     <p>Please choose your account provider</p>
     <div id="openid_btns">
-      <a title="Google" href="/login?openid_url=https://www.google.com/accounts/o8/id" class="google openid_large_btn"></a>
-      <a title="Yahoo" href="/login?openid_url=http://yahoo.com/" class="yahoo openid_large_btn"></a>
+      <a title="Google" href="login?openid_url=https://www.google.com/accounts/o8/id" class="google openid_large_btn"></a>
+      <a title="Yahoo" href="login?openid_url=http://yahoo.com/" class="yahoo openid_large_btn"></a>
     </div>
     <div id="openid_input_area">
       <p>or enter your OpenID URL.</p>
index 88dade3c41f9a26a2d206016f336dd6436f250e9..163b5a3106aa7f6df27626129e3eda46fa9c47a9 100644 (file)
@@ -3,7 +3,7 @@
 
 {% block content %}
 <div class="content-padding-fix"></div>
-<form method="post" action="/new" enctype="multipart/form-data" class="form-horizontal">
+<form method="post" action="new" enctype="multipart/form-data" class="form-horizontal">
  <div class="control-group">
   <label class="control-label" for="description">Description</label>
   <div class="controls">
index db773df070a936ad793f49fc1fdb3c341549c08c..63d23e6d69878b9a304bb3344075cc1edcef91cf 100644 (file)
@@ -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();
         }
index e58ccc6d6f6831e18658f5affdcd8c930bb6f4d1..3ccf20974a7d6598df82b23db5cdc9d607a240cb 100644 (file)
@@ -30,7 +30,7 @@ class Html_Pager
                 'currentPage' => $currentPage,
                 'urlVar'      => 'page',
                 'append'      => $append,
-                'path'        => '/',
+                'path'        => '',
                 'fileName'    => $filename,
                 'separator'   => '###',
                 'spacesBeforeSeparator' => 0,
index fd04d831e217cb74f931e97f1ffacfff98a27104..945c7ea25bd134cfbebb723675908780201bad51 100644 (file)
@@ -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')
             )
         );
     }
index 6b7435ce183fe27a68e836af15b7fb7eba30b294..815ef5e4e56ac6a73ba440a86f85947dcb470377 100644 (file)
@@ -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');
         }
index 00bb1ec960e5cefcb3195a2b711fed252bbe87b2..62e7bb80fc922c4b0c091612b04e8b251eb4a47f 100644 (file)
@@ -45,7 +45,7 @@ class Search_Result
 
     public function getLink($query)
     {
-        return '/search?q=' . urlencode($query);
+        return 'search?q=' . urlencode($query);
     }
 }
 
index 1d3d2260ebc8aaa27af0ac06aa753f68977f3d45..fc815cc5679085c139028f35fab58ea1531f819b 100644 (file)
@@ -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;
     }
 
     /**
index f3dc26742963a7d0f6fe86b8970845c2e50de5b0..60419bb2f9deebe018170b457fa3d9969150df22 100644 (file)
@@ -2,28 +2,28 @@ RewriteEngine On
 RewriteBase /
 #RewriteCond %{REQUEST_FILENAME} -f
 
-RewriteRule ^([0-9]+)$ /display.php?id=$1
-RewriteRule ^([0-9]+)/delete$ /delete.php?id=$1
-RewriteRule ^([0-9]+)/delete/confirm$ /delete.php?id=$1&confirm=1
-RewriteRule ^([0-9]+)/doap$ /doap.php?id=$1
-RewriteRule ^([0-9]+)/edit$ /edit.php?id=$1
-RewriteRule ^([0-9]+)/fork$ /fork.php?id=$1
-RewriteRule ^([0-9]+)/raw/(.+)$ /raw.php?id=$1&file=$2
-RewriteRule ^([0-9]+)/rev/(.+)$ /revision.php?id=$1&rev=$2
-RewriteRule ^([0-9]+)/rev-raw/(.+)/(.+)$ /raw.php?id=$1&rev=$2&file=$3
-RewriteRule ^([0-9]+)/tool/([^/]+)/(.+)$ /tool.php?id=$1&tool=$2&file=$3
+RewriteRule ^([0-9]+)$ display.php?id=$1
+RewriteRule ^([0-9]+)/delete$ delete.php?id=$1
+RewriteRule ^([0-9]+)/delete/confirm$ delete.php?id=$1&confirm=1
+RewriteRule ^([0-9]+)/doap$ doap.php?id=$1
+RewriteRule ^([0-9]+)/edit$ edit.php?id=$1
+RewriteRule ^([0-9]+)/fork$ fork.php?id=$1
+RewriteRule ^([0-9]+)/raw/(.+)$ raw.php?id=$1&file=$2
+RewriteRule ^([0-9]+)/rev/(.+)$ revision.php?id=$1&rev=$2
+RewriteRule ^([0-9]+)/rev-raw/(.+)/(.+)$ raw.php?id=$1&rev=$2&file=$3
+RewriteRule ^([0-9]+)/tool/([^/]+)/(.+)$ tool.php?id=$1&tool=$2&file=$3
 
-RewriteRule ^fork-remote$ /fork-remote.php
-RewriteRule ^new$ /new.php
+RewriteRule ^fork-remote$ fork-remote.php
+RewriteRule ^new$ new.php
 
-RewriteRule ^feed/new$ /feed-new.php
-RewriteRule ^feed/updated$ /feed-updated.php
+RewriteRule ^feed/new$ feed-new.php
+RewriteRule ^feed/updated$ feed-updated.php
 
-RewriteRule ^list$ /list.php
-RewriteRule ^list/([0-9]+)$ /list.php?page=$1
+RewriteRule ^list$ list.php
+RewriteRule ^list/([0-9]+)$ list.php?page=$1
 
-RewriteRule ^search$ /search.php
-RewriteRule ^search/([0-9]+)$ /search.php?page=$1
+RewriteRule ^search$ search.php
+RewriteRule ^search/([0-9]+)$ search.php?page=$1
 
-RewriteRule ^login$ /login.php
-RewriteRule ^user$ /user.php
+RewriteRule ^login$ login.php
+RewriteRule ^user$ user.php
index 296618bbea26f7f624fa8fc9b7c71519541e2a8c..4b2acbcf253e945fe91414b8b52d80a3c8ce356d 100644 (file)
@@ -28,7 +28,7 @@ body {
 #openid_url {
   margin: 0px !important;
   width: 250px;
-  background: #FFF url(/images/openid-inputicon.gif) no-repeat scroll 0 50%;
+  background: #FFF url(../images/openid-inputicon.gif) no-repeat scroll 0 50%;
   padding-left:18px;
 }
 .openid_large_btn {
@@ -46,10 +46,10 @@ body {
   float: left;
 }
 .google {
-  background: #FFF url(/images/google.gif) no-repeat center center;
+  background: #FFF url(../images/google.gif) no-repeat center center;
 }
 .yahoo {
-  background: #FFF url(/images/yahoo.gif) no-repeat center center;
+  background: #FFF url(../images/yahoo.gif) no-repeat center center;
 }
 
 a.openid_large_btn:hover {
index 43ec9d5be24a9ad7162dbfac9854fa05e81a7200..e0e8d9fcba4b6b4a9020721a5988ec0dc13f2917 100644 (file)
@@ -14,7 +14,7 @@ if (isset($_GET['confirm']) && $_GET['confirm'] == 1) {
         throw new Exception_Input('Deleting only possible via POST');
     }
     $repo->delete();
-    redirect('/');
+    redirect(Tools::fullUrl());
 }
 
 render(
index 4199c3496ed44ee0f9228c0936b02317a813e559..d1853d246ce5c456b3d6c4884a72bd5f2bacddf4 100644 (file)
@@ -11,7 +11,7 @@ $repo->loadFromRequest();
 
 $repopo = new Repository_Post($repo);
 if ($repopo->process($_POST, $_SESSION)) {
-    redirect($repo->getLink('display'));
+    redirect($repo->getLink('display', null, true));
 }
 
 render(
index a462808999cec0a981237466536e6b05649a60f0..9d21d5a5906bcbacd73cf444c1dfbfaeb930c4eb 100644 (file)
@@ -12,8 +12,8 @@ render(
     'feed-new',
     array(
         'pastes'  => $db->getSearch()->listAll(0, 10, 'crdate', 'desc'),
-        'url'     => Tools::fullUrl('/'),
-        'feedurl' => Tools::fullUrl('/feed/new'),
+        'url'     => Tools::fullUrl(),
+        'feedurl' => Tools::fullUrl('feed/new'),
     )
 );
 ?>
index 679a5d727508e73b3d36a80933510620b5100e10..8dfe7b43590b93edfcfd226d99656a4d046a5f41 100644 (file)
@@ -12,8 +12,8 @@ render(
     'feed-updated',
     array(
         'pastes'  => $db->getSearch()->listAll(0, 10, 'modate', 'desc'),
-        'url'     => Tools::fullUrl('/'),
-        'feedurl' => Tools::fullUrl('/feed/updated'),
+        'url'     => Tools::fullUrl(),
+        'feedurl' => Tools::fullUrl('feed/updated'),
     )
 );
 ?>
index 5d4a4ee23329c78685936412c0e864dd4e85ebf0..f34a232ce8a5a0ec53ade08683b91c9d950edb16 100644 (file)
@@ -19,7 +19,7 @@ if (isset($_POST['remote_url'])) {
         }
         $forker = new Forker();
         $new    = $forker->forkRemote($gitUrl, $fr->getUrl());
-        redirect($new->getLink('display'));
+        redirect($new->getLink('display', null, true));
     } else {
         //multiple urls found
         $urls = $fr->getGitUrls();
index d8a24a2ad91551edcf46ee981b58bbcf2440533e..352f8bc28352dfe881272f8f2e5e5fb66fdf1a71 100644 (file)
@@ -17,5 +17,5 @@ $forker = new Forker();
 $new    = $forker->forkLocal($repo);
 
 //FIXME: where to put fork source link?
-redirect($new->getLink('display'));
+redirect($new->getLink('display', null, true));
 ?>
index 0ee9211679cbe1aa1e79c936af4117b372015271..5b5e4f64288e2b326d11a90908dcdcf1787d2544 100644 (file)
@@ -8,6 +8,6 @@ require_once 'www-header.php';
 
 header(
     'Location: '
-    . Tools::fullUrl('/' . $GLOBALS['phorkie']['cfg']['index'])
+    . Tools::fullUrl($GLOBALS['phorkie']['cfg']['index'])
 );
 ?>
index d4934bd271ad9a3e2e70c0fb5e023697142a8b08..1ff8a87d68f462a7eca8f28a67bae0d9c6f05622 100644 (file)
@@ -19,7 +19,7 @@ $perPage = 10;
 list($repos, $repoCount) = $rs->getList($page, $perPage);
 
 $pager = new Html_Pager(
-    $repoCount, $perPage, $page + 1, '/list/%d'
+    $repoCount, $perPage, $page + 1, 'list/%d'
 );
 
 $db = new Database();
index fb396b9a8b1a2f496a75de6cb0818d481a68f42f..e141b65b4e8eeeff0bd667cd48d7a5a505cfb86b 100644 (file)
@@ -6,7 +6,7 @@ require_once 'www-header.php';
 if (isset($_REQUEST['logout'])) {
     unset($_SESSION);
     session_destroy();
-    header('Location: ' . Tools::fullUrl('/'));
+    header('Location: ' . Tools::fullUrl());
     exit();
 }
 
@@ -34,8 +34,8 @@ if (isset($_POST['openid_url'])) {
     $openid_url = null;
 }
 
-$realm    = Tools::fullUrl('/');
-$returnTo = Tools::fullUrl('/login');
+$realm    = Tools::fullUrl();
+$returnTo = Tools::fullUrl('login');
 
 try {
     $o = new \OpenID_RelyingParty($returnTo, $realm, $openid_url);
@@ -158,11 +158,11 @@ $_SESSION['identity'] = $openid['openid.identity'];
 
 setcookie('lastopenid', $_SESSION['identity'], time() + 84600 * 60, '/login');
 
+$url = '';
 if (isset($_SESSION['REQUEST_URI'])) {
-    $redirect = Tools::fullUrl($_SESSION['REQUEST_URI']);
-} else {
-    $redirect = Tools::fullUrl('/');
+    $url = substr($_SESSION['REQUEST_URI'], 1);
 }
+$redirect = Tools::fullUrl($url);
 header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
 exit;
 ?>
index 965f5340e421f5eda836367bf0b27e6847502427..6ec746b421fc8a646ed13583671643acc8fd6885 100644 (file)
@@ -15,7 +15,7 @@ require_once 'www-header.php';
 
 $repopo = new Repository_Post();
 if ($repopo->process($_POST, $_SESSION)) {
-    redirect($repopo->repo->getLink('display'));
+    redirect($repopo->repo->getLink('display', null, true));
 }
 
 $phork = array(
index 9c7ff6e5c77a2cb9ac549b15eb736c66f9842403..2f2de2e6465e6eaa8514f1f222759c40d58ed818 100644 (file)
@@ -7,7 +7,7 @@ $reqWritePermissions = false;
 require_once 'www-header.php';
 
 if (!isset($_GET['q']) || $_GET['q'] == '') {
-    header('Location: ' . Tools::fullUrl('/list'));
+    header('Location: ' . Tools::fullUrl('list'));
     exit();
 }
 $query = $_GET['q'];
index 41b5e4731889961080f511e2a5474473ea4bb49e..cda7047b9b94d01cb4018e0006b9158e5101878b 100644 (file)
@@ -84,6 +84,10 @@ if (!isset($noSecurityCheck) || $noSecurityCheck !== true) {
 
 function render($tplname, $vars = array())
 {
+    $vars['baseurl'] = '/';
+    if (!empty($GLOBALS['phorkie']['cfg']['baseurl'])) {
+        $vars['baseurl'] = $GLOBALS['phorkie']['cfg']['baseurl'];
+    }
     $vars['css'] = $GLOBALS['phorkie']['cfg']['css'];
     $vars['title'] = $GLOBALS['phorkie']['cfg']['title'];
     $vars['topbar'] = $GLOBALS['phorkie']['cfg']['topbar'];