tidy up some ancient base_href / data_href messes; base_href as a config variable is no longer used

This commit is contained in:
Shish 2012-01-20 03:29:29 +00:00
parent 18e36f9b31
commit 49e7bfa1b2
9 changed files with 13 additions and 16 deletions

View File

@ -36,7 +36,6 @@ class BrowserSearch implements Extension {
// First, we need to build all the variables we'll need // First, we need to build all the variables we'll need
$search_title = $config->get_string('title'); $search_title = $config->get_string('title');
//$search_form_url = $config->get_string('base_href'); //make_link('post/list');
$search_form_url = make_link('post/list/{searchTerms}'); $search_form_url = make_link('post/list/{searchTerms}');
$suggenton_url = make_link('browser_search/')."{searchTerms}"; $suggenton_url = make_link('browser_search/')."{searchTerms}";
$icon_b64 = base64_encode(file_get_contents("favicon.ico")); $icon_b64 = base64_encode(file_get_contents("favicon.ico"));

View File

@ -83,8 +83,6 @@ class ForumTheme extends Themelet {
global $config, $page/*, $user*/; global $config, $page/*, $user*/;
$theme_name = $config->get_string('theme'); $theme_name = $config->get_string('theme');
$data_href = $config->get_string('base_href');
$base_href = $config->get_string('base_href');
$html = ""; $html = "";
$n = 0; $n = 0;

View File

@ -28,14 +28,13 @@ class Home extends SimpleExtension {
public function onPageRequest(PageRequestEvent $event) { public function onPageRequest(PageRequestEvent $event) {
global $config, $page; global $config, $page;
if($event->page_matches("home")) { if($event->page_matches("home")) {
$base_href = $config->get_string('base_href'); $base_href = get_base_href();
$data_href = get_base_href();
$sitename = $config->get_string('title'); $sitename = $config->get_string('title');
$theme_name = $config->get_string('theme'); $theme_name = $config->get_string('theme');
$body = $this->get_body(); $body = $this->get_body();
$this->theme->display_page($page, $sitename, $data_href, $theme_name, $body); $this->theme->display_page($page, $sitename, $base_href, $theme_name, $body);
} }
} }
@ -58,8 +57,7 @@ class Home extends SimpleExtension {
// returns just the contents of the body // returns just the contents of the body
global $database; global $database;
global $config; global $config;
$base_href = $config->get_string('base_href'); $base_href = get_base_href();
$data_href = get_base_href();
$sitename = $config->get_string('title'); $sitename = $config->get_string('title');
$contact_link = $config->get_string('contact_link'); $contact_link = $config->get_string('contact_link');
$counter_dir = $config->get_string('home_counter', 'default'); $counter_dir = $config->get_string('home_counter', 'default');
@ -71,7 +69,7 @@ class Home extends SimpleExtension {
$counter_text = ""; $counter_text = "";
for($n=0; $n<strlen($strtotal); $n++) { for($n=0; $n<strlen($strtotal); $n++) {
$cur = $strtotal[$n]; $cur = $strtotal[$n];
$counter_text .= " <img alt='$cur' src='$data_href/ext/home/counters/$counter_dir/$cur.gif' /> "; $counter_text .= " <img alt='$cur' src='$base_href/ext/home/counters/$counter_dir/$cur.gif' /> ";
} }
// get the homelinks and process them // get the homelinks and process them

View File

@ -1,14 +1,14 @@
<?php <?php
class HomeTheme extends Themelet { class HomeTheme extends Themelet {
public function display_page(Page $page, $sitename, $data_href, $theme_name, $body) { public function display_page(Page $page, $sitename, $base_href, $theme_name, $body) {
$page->set_mode("data"); $page->set_mode("data");
$page->set_data(<<<EOD $page->set_data(<<<EOD
<html> <html>
<head> <head>
<title>$sitename</title> <title>$sitename</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<link rel='stylesheet' href='$data_href/themes/$theme_name/style.css' type='text/css'> <link rel='stylesheet' href='$base_href/themes/$theme_name/style.css' type='text/css'>
</head> </head>
<style> <style>
div#front-page h1 {font-size: 4em; margin-top: 2em; margin-bottom: 0px; text-align: center; border: none; background: none; box-shadow: none; -webkit-box-shadow: none; -moz-box-shadow: none;} div#front-page h1 {font-size: 4em; margin-top: 2em; margin-bottom: 0px; text-align: center; border: none; background: none; box-shadow: none; -webkit-box-shadow: none; -moz-box-shadow: none;}

View File

@ -55,7 +55,7 @@ class RSS_Comments extends SimpleExtension {
} }
$title = $config->get_string('title'); $title = $config->get_string('title');
$base_href = make_http($config->get_string('base_href')); $base_href = make_http(get_base_href());
$version = $config->get_string('version'); $version = $config->get_string('version');
$xml = <<<EOD $xml = <<<EOD
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>

View File

@ -66,7 +66,7 @@ class RSS_Images extends SimpleExtension {
} }
$title = $config->get_string('title'); $title = $config->get_string('title');
$base_href = make_http($config->get_string('base_href')); $base_href = make_http(get_base_href());
$search = ""; $search = "";
if(count($search_terms) > 0) { if(count($search_terms) > 0) {
$search = url_escape(implode(" ", $search_terms)) . "/"; $search = url_escape(implode(" ", $search_terms)) . "/";

View File

@ -9,7 +9,7 @@ class taggerTheme extends Themelet {
public function build_tagger (Page $page, $event) { public function build_tagger (Page $page, $event) {
global $config; global $config;
// Initialization code // Initialization code
$base_href = $config->get_string('base_href'); $base_href = get_base_href();
// TODO: AJAX test and fallback. // TODO: AJAX test and fallback.
$page->add_html_header("<script src='$base_href/ext/tagger/webtoolkit.drag.js' type='text/javascript'></script>"); $page->add_html_header("<script src='$base_href/ext/tagger/webtoolkit.drag.js' type='text/javascript'></script>");
$page->add_block(new Block(null, $page->add_block(new Block(null,

View File

@ -539,7 +539,10 @@ function set_prefixed_cookie($name, $value, $time, $path) {
} }
/** /**
* Figure out the path to the shimmie install root. * Figure out the path to the shimmie install directory.
*
* eg if shimmie is visible at http://foo.com/gallery, this
* function should return /gallery
* *
* PHP really, really sucks. * PHP really, really sucks.
* *

View File

@ -167,7 +167,6 @@ class Setup extends SimpleExtension {
$config->set_default_string("title", "Shimmie"); $config->set_default_string("title", "Shimmie");
$config->set_default_string("front_page", "post/list"); $config->set_default_string("front_page", "post/list");
$config->set_default_string("main_page", "post/list"); $config->set_default_string("main_page", "post/list");
$config->set_default_string("base_href", "./index.php?q=");
$config->set_default_string("theme", "default"); $config->set_default_string("theme", "default");
$config->set_default_bool("word_wrap", true); $config->set_default_bool("word_wrap", true);
$config->set_default_bool("comment_captcha", false); $config->set_default_bool("comment_captcha", false);