summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2009-06-22 10:56:02 -0700
committerZach Copley <zach@controlyourself.ca>2009-06-22 10:56:02 -0700
commite6559e3bea1881710094c06c778bbfe41dd72824 (patch)
treefd0c706f8f57213bdfa0dd98524a42ccee938e27 /lib
parent9014a0a90d9ab5ee408aded51f379fd084fcd82c (diff)
parent7b269a6712ac740c961634b0c165e6f74f420236 (diff)
Merge branch '0.8.x' of git@gitorious.org:laconica/dev into 0.8.x
* '0.8.x' of git@gitorious.org:laconica/dev: Layout fix for IE6 theme dir, path configurable
Diffstat (limited to 'lib')
-rw-r--r--lib/common.php4
-rw-r--r--lib/theme.php36
2 files changed, 32 insertions, 8 deletions
diff --git a/lib/common.php b/lib/common.php
index 14f5c7a7f..0333030e1 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -140,7 +140,9 @@ $config =
'blacklist' => array(),
'autosource' => array()),
'theme' =>
- array('server' => null),
+ array('server' => null,
+ 'dir' => null,
+ 'path'=> null),
'throttle' =>
array('enabled' => false, // whether to throttle edits; false by default
'count' => 20, // number of allowed messages in timespan
diff --git a/lib/theme.php b/lib/theme.php
index 0d8824822..2fe6ab69b 100644
--- a/lib/theme.php
+++ b/lib/theme.php
@@ -43,10 +43,14 @@ if (!defined('LACONICA')) {
function theme_file($relative, $theme=null)
{
- if (!$theme) {
+ if (empty($theme)) {
$theme = common_config('site', 'theme');
}
- return INSTALLDIR.'/theme/'.$theme.'/'.$relative;
+ $dir = common_config('theme', 'dir');
+ if (empty($dir)) {
+ $dir = INSTALLDIR.'/theme';
+ }
+ return $dir.'/'.$theme.'/'.$relative;
}
/**
@@ -60,13 +64,31 @@ function theme_file($relative, $theme=null)
function theme_path($relative, $theme=null)
{
- if (!$theme) {
+ if (empty($theme)) {
$theme = common_config('site', 'theme');
}
+
+ $path = common_config('theme', 'path');
+
+ if (empty($path)) {
+ $path = common_config('site', 'path') . '/theme/';
+ }
+
+ if ($path[strlen($path)-1] != '/') {
+ $path .= '/';
+ }
+
+ if ($path[0] != '/') {
+ $path = '/'.$path;
+ }
+
$server = common_config('theme', 'server');
- if ($server) {
- return 'http://'.$server.'/'.$theme.'/'.$relative;
- } else {
- return common_path('theme/'.$theme.'/'.$relative);
+
+ if (empty($server)) {
+ $server = common_config('site', 'server');
}
+
+ // XXX: protocol
+
+ return 'http://'.$server.$path.$theme.'/'.$relative;
}