From c7ca2348f453fccadc7f8bc1c535bc58d124464b Mon Sep 17 00:00:00 2001
From: Graham Cole <chckens@sucs.org>
Date: Wed, 28 Jan 2009 21:38:12 +0000
Subject: [PATCH] Make blogs uris work better for developers

---
 lib/blog/admin.lib.php |  6 +++---
 lib/blog/blog.lib.php  | 12 +++++++-----
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/lib/blog/admin.lib.php b/lib/blog/admin.lib.php
index 4371cc5..31f20ce 100644
--- a/lib/blog/admin.lib.php
+++ b/lib/blog/admin.lib.php
@@ -33,7 +33,7 @@ class admin {
 	//Constructor - checks we've been given a valid username, and pulls in generic blog info
 	function admin() 
 	{
-		global $session, $BlogDB;
+		global $session, $BlogDB, $baseurl;
 
 		//set the error string first, so we dont wipe out any errors
 		$this->error = '';
@@ -49,9 +49,9 @@ class admin {
 
 		$this->shortDateFormat = "Y-m-d";
 		$this->longDateFormat = "r";
-		$this->httpPath = "/Blogs/";
+		$this->httpPath = $baseurl."/Blogs/";
 		$this->adminPath = $this->httpPath."Admin/";
-		$this->basePath = "/Blogs/";
+		$this->basePath = $baseurl."/Blogs/";
 		if($this->httpPath[strlen($this->httpPath)-1]!="/") {
 			$this->httpPath .= "/";
 		}
diff --git a/lib/blog/blog.lib.php b/lib/blog/blog.lib.php
index 8b2330d..c4ac8f5 100644
--- a/lib/blog/blog.lib.php
+++ b/lib/blog/blog.lib.php
@@ -71,7 +71,7 @@ class blogs {
 	
 	//Constructor - checks we've been given a valid username, and pulls in generic blog info
 	function blogs($user) {
-		global $BlogDB;
+		global $BlogDB, $baseurl;
 		//set the error string first, so we dont wipe out any errors
 		$this->error = null;
 		$this->errormsg = null;
@@ -100,13 +100,13 @@ class blogs {
 				$this->shortDateFormat = "%x %X";
 				$this->longDateFormat = "%c";
 				//set path for all http stuff.. ie images, css and so on
-				$this->httpPath = "/Blogs/";
+				$this->httpPath = $baseurl."/Blogs/";
 				//make the httpPath work nicely if we're not in a subdir
 				//if(substr($this->httpPath, -1)!="/") {
 				//	$this->httpPath .= "/";
 				//}
 				//path for the blog viewer with no user
-				$this->basePath = "/Blogs/";
+				$this->basePath = $baseurl."/Blogs/";
 				//path to this blog
 				$this->blogPath = $this->basePath.$this->userName."/";
 				//path to the admin bits
@@ -762,13 +762,15 @@ class bloglist {
 	// don't do anything apart from setting up default variables
 	function bloglist() 
 	{
+		global $baseurl;
+
 		$this->title = _("Blogs");
 		$this->description = _("Swansea University Computer Society member web logs");
-		$this->httpPath = "/Blogs/";
+		$this->httpPath = $baseurl."/Blogs/";
 		//if(substr($this->httpPath, -1)!="/") {
 		//	$this->httpPath .= "/";
 		//}
-		$this->basePath = "/Blogs/";
+		$this->basePath = $baseurl."/Blogs/";
 		$this->adminPath = $this->httpPath."Admin/";
 		$this->cssFile = "blog.css";
 		$this->svnRevision = getSVNRevision();
-- 
GitLab