summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@n0v4.com>2011-03-17 18:56:18 +1100
committerSavetheinternet <savetheinternet@n0v4.com>2011-03-17 18:56:18 +1100
commit0156daaf553f382a32c6e36287dbbfea868fc52b (patch)
treeb9596b6093db6629efb982f37ff804c2cc968cce
parent9c9ead2b082c82a28febfdd409551bc647c50ab3 (diff)
Ability to move images and thumbnails to a seperate domain/URL
-rw-r--r--inc/config.php13
-rw-r--r--inc/display.php8
-rw-r--r--inc/functions.php11
3 files changed, 27 insertions, 5 deletions
diff --git a/inc/config.php b/inc/config.php
index d56e4344..66c9c00f 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -66,7 +66,7 @@
// Same as above but different IP address
$config['flood_time_same'] = 30;
// Do you need a body for your non-OP posts?
- $config['force_body'] = true;
+ $config['force_body'] = false;
// Reject blank posts? (just whitespace, etc)?
$config['reject_blank'] = true;
@@ -186,6 +186,15 @@
//$config['image_deleted'] = $config['dir']['static'] . 'deleted.png';
//$config['image_zip'] = $config['dir']['static'] . 'zip.png';
+
+ // If you want to put images and other dynamic-static stuff on another (preferably cookieless) domain, you can use this:
+ // This will override $config['root'] and $config['dir']['...'] directives
+
+ // "%s" will get replaced with $board['dir'], which usually includes a trailing slash. To avoid double slashes, you don't need
+ // to put a slash after %s
+ // $config['uri_thumb'] = 'http://images.example.org/%sthumb/';
+ // $config['uri_img'] = 'http://images.example.org/%ssrc/';
+
// If for some reason the folders and static HTML index files aren't in the current working direcotry,
// enter the directory path here. Otherwise, keep it false.
$config['root_file'] = false;
@@ -314,6 +323,8 @@
$config['mod']['createusers'] = ADMIN;
// View the moderation log
$config['mod']['modlog'] = ADMIN;
+ // Create a PM (viewing mod usernames)
+ $config['mod']['create_pm'] = JANITOR;
// Mod links (full HTML)
// Correspond to above permission directives
diff --git a/inc/display.php b/inc/display.php
index 41b99461..cc890ee6 100644
--- a/inc/display.php
+++ b/inc/display.php
@@ -194,7 +194,7 @@
// File info
if(!empty($this->file) && $this->file != 'deleted') {
- $built .= '<p class="fileinfo">File: <a href="' . $config['root'] . $board['dir'] . $config['dir']['img'] . $this->file .'">' . $this->file . '</a> <span class="unimportant">(' .
+ $built .= '<p class="fileinfo">File: <a href="' . $config['uri_img'] . $this->file .'">' . $this->file . '</a> <span class="unimportant">(' .
// Filesize
format_bytes($this->filesize) . ', ' .
// File dimensions
@@ -208,7 +208,7 @@
$built .= ', ' . $this->filename . ')</span></p>' .
// Thumbnail
- '<a href="' . $config['root'] . $board['dir'] . $config['dir']['img'] . $this->file.'"><img src="' . $config['root'] . $board['dir'] . $config['dir']['thumb'] . $this->thumb.'" style="width:'.$this->thumbx.'px;height:'.$this->thumby.'px;" /></a>';
+ '<a href="' . $config['uri_img'] . $this->file.'"><img src="' . $config['uri_thumb'] . $this->thumb.'" style="width:'.$this->thumbx.'px;height:'.$this->thumby.'px;" /></a>';
} elseif($this->file == 'deleted') {
$built .= '<img src="' . $config['image_deleted'] . '" />';
}
@@ -311,7 +311,7 @@
public function build($index=false) {
global $board, $config;
- $built = '<p class="fileinfo">File: <a href="' . $config['root'] . $board['dir'] . $config['dir']['img'] . $this->file .'">' . $this->file . '</a> <span class="unimportant">(' .
+ $built = '<p class="fileinfo">File: <a href="' . $config['uri_img'] . $this->file .'">' . $this->file . '</a> <span class="unimportant">(' .
// Filesize
format_bytes($this->filesize) . ', ' .
// File dimensions
@@ -324,7 +324,7 @@
// Filename
$built .= ', ' . $this->filename . ')</span></p>' .
// Thumbnail
- '<a href="' . $config['root'] . $board['dir'] . $config['dir']['img'] . $this->file.'"><img src="' . $config['root'] . $board['dir'] . $config['dir']['thumb'] . $this->thumb.'" style="width:'.$this->thumbx.'px;height:'.$this->thumby.'px;" /></a>';
+ '<a href="' . $config['uri_img'] . $this->file.'"><img src="' . $config['uri_thumb'] . $this->thumb.'" style="width:'.$this->thumbx.'px;height:'.$this->thumby.'px;" /></a>';
$built .= '<div class="post op"><p class="intro"' . (!$index?' id="' . $this->id . '"':'') . '>';
diff --git a/inc/functions.php b/inc/functions.php
index ba8a1ad0..69cd8444 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -46,6 +46,17 @@
if(!isset($config['image_zip']))
$config['image_zip'] = $config['dir']['static'] . 'zip.png';
+ if(!isset($config['uri_thumb']))
+ $config['uri_thumb'] = $config['root'] . $board['dir'] . $config['dir']['thumb'];
+ else
+ $config['uri_thumb'] = sprintf($config['uri_thumb'], $board['dir']);
+
+ if(!isset($config['uri_img']))
+ $config['uri_img'] = $config['root'] . $board['dir'] . $config['dir']['img'];
+ else
+ $config['uri_img'] = sprintf($config['uri_img'], $board['dir']);
+
+
if($config['root_file']) {
chdir($config['root_file']);
}