summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-rw-r--r--inc/config.php21
-rw-r--r--inc/display.php8
-rw-r--r--inc/instance-config.php12
3 files changed, 29 insertions, 12 deletions
diff --git a/inc/config.php b/inc/config.php
index 7115c2dc..397257fe 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -51,6 +51,7 @@
define('ERR_INVALIDIMG','Invalid image.', true);
define('ERR_FILESIZE', 'Maximum file size: %maxsz% bytes<br>Your file\'s size: %filesz% bytes', true);
define('ERR_MAXSIZE', 'The file was too big.', true);
+ define('ERR_INVALIDZIP', 'Invalid archive!', true);
// For resizing, max values
define('THUMB_WIDTH', 200, true);
@@ -62,7 +63,11 @@
define('MAX_WIDTH', 10000, true);
define('MAX_HEIGHT', MAX_WIDTH, true);
- define('ALLOW_ZIP', true, true);
+ /* When you upload a ZIP as a file, all the images inside the archive
+ * get dumped into the thread as replies.
+ * Extremely beta and not recommended yet.
+ */
+ define('ALLOW_ZIP', false, true);
define('ZIP_IMAGE', 'src/zip.png', true);
@@ -85,6 +90,11 @@
// The root directory, including the trailing slash, for Tinyboard.
// examples: '/', '/board/', '/chan/'
define('ROOT', '/', true);
+
+ // 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.
+ define('ROOT_FILE', false);
+
define('POST_URL', ROOT . 'post.php', true);
define('FILE_INDEX', 'index.html', true);
define('FILE_PAGE', '%d.html', true);
@@ -100,11 +110,14 @@
define('BUTTON_NEWTOPIC', 'New Topic', true);
define('BUTTON_REPLY', 'New Reply', true);
-
+
define('ALWAYS_NOKO', false, true);
-
+
define('URL_MATCH', '/^' . (@$_SERVER['HTTPS']?'https':'http').':\/\/'.$_SERVER['HTTP_HOST'] . '(' . preg_quote(ROOT, '/') . '|' . preg_quote(ROOT, '/') . '' . preg_quote(FILE_INDEX, '/') . '|' . preg_quote(ROOT, '/') . '' . str_replace('%d', '\d+', preg_quote(FILE_PAGE, '/')) . ')$/', true);
-
+
+ if(ROOT_FILE) {
+ chdir(ROOT_FILE);
+ }
if(!defined('IS_INSTALLATION')) {
if(!file_exists(DIR_IMG)) @mkdir(DIR_IMG) or error("Couldn't create " . DIR_IMG . ". Install manually.", true);
if(!file_exists(DIR_THUMB)) @mkdir(DIR_THUMB) or error("Couldn't create " . DIR_IMG . ". Install manually.", true);
diff --git a/inc/display.php b/inc/display.php
index 132dcac5..71ecface 100644
--- a/inc/display.php
+++ b/inc/display.php
@@ -81,7 +81,7 @@
// File info
if(!empty($this->file)) {
- $built .= '<p class="fileinfo">File: <a href="' . ROOT . $this->file .'">' . basename($this->file) . '</a> <span class="unimportant">(' .
+ $built .= '<p class="fileinfo">File: <a href="' . ROOT . DIR_IMG . $this->file .'">' . $this->file . '</a> <span class="unimportant">(' .
// Filesize
format_bytes($this->filesize) . ', ' .
// File dimensions
@@ -94,7 +94,7 @@
// Filename
$built .= ', ' . $this->filename . ')</span></p>' .
// Thumbnail
- '<a href="' . ROOT . $this->file.'"><img src="' . ROOT . $this->thumb.'" style="width:'.$this->thumbx.'px;height:'.$this->thumby.'px;" /></a>';
+ '<a href="' . ROOT . DIR_IMG . $this->file.'"><img src="' . ROOT . DIR_THUMB . $this->thumb.'" style="width:'.$this->thumbx.'px;height:'.$this->thumby.'px;" /></a>';
}
// Body
@@ -131,7 +131,7 @@
public function build($index=false) {
- $built = '<p class="fileinfo">File: <a href="' . ROOT . $this->file .'">' . basename($this->file) . '</a> <span class="unimportant">(' .
+ $built = '<p class="fileinfo">File: <a href="' . ROOT . DIR_IMG . $this->file .'">' . $this->file . '</a> <span class="unimportant">(' .
// Filesize
format_bytes($this->filesize) . ', ' .
// File dimensions
@@ -144,7 +144,7 @@
// Filename
$built .= ', ' . $this->filename . ')</span></p>' .
// Thumbnail
- '<a href="' . ROOT . $this->file.'"><img src="' . ROOT . $this->thumb.'" style="width:'.$this->thumbx.'px;height:'.$this->thumby.'px;" /></a>';
+ '<a href="' . ROOT . DIR_IMG . $this->file.'"><img src="' . ROOT . DIR_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/instance-config.php b/inc/instance-config.php
index 7655d344..1ae82a3f 100644
--- a/inc/instance-config.php
+++ b/inc/instance-config.php
@@ -1,4 +1,5 @@
<?php
+
/*
* Instance Configuration
* ----------------------
@@ -9,10 +10,13 @@
/*
- define('MY_SERVER', 'localhost', true);
- define('MY_USER', '', true);
- define('MY_PASSWORD', '', true);
- define('MY_DATABASE', '', true);
+ // Database stuff
+ define('MY_SERVER', 'localhost');
+ define('MY_USER', '');
+ define('MY_PASSWORD', '');
+ define('MY_DATABASE', '');
+
+ define('ROOT', '/');
// define('FOO', 'bar');
*/