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
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 .= '

File: ' . basename($this->file) . ' (' . + $built .= '

File: ' . $this->file . ' (' . // Filesize format_bytes($this->filesize) . ', ' . // File dimensions @@ -94,7 +94,7 @@ // Filename $built .= ', ' . $this->filename . ')

' . // Thumbnail - ''; + ''; } // Body @@ -131,7 +131,7 @@ public function build($index=false) { - $built = '

File: ' . basename($this->file) . ' (' . + $built = '

File: ' . $this->file . ' (' . // Filesize format_bytes($this->filesize) . ', ' . // File dimensions @@ -144,7 +144,7 @@ // Filename $built .= ', ' . $this->filename . ')

' . // Thumbnail - ''; + ''; $built .= '

'; 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 @@ $post['subject'], @@ -260,6 +270,10 @@ $dump_post['thumbwidth'] = $thumb['width']; $dump_post['thumbheight'] = $thumb['height']; + // Remove DIR_* before inserting them into the database. + $dump_post['file'] = substr_replace($dump_post['file'], '', 0, strlen(DIR_IMG)); + $dump_post['thumb'] = substr_replace($dump_post['thumb'], '', 0, strlen(DIR_THUMB)); + // Create the post post($dump_post, false); } @@ -297,7 +311,6 @@ } else { if(!file_exists(FILE_INDEX)) { buildIndex(); - sql_close(); } header('Location: ' . ROOT . FILE_INDEX, true, 302); diff --git a/templates/index.html b/templates/index.html index 2921e7f0..bc946db1 100644 --- a/templates/index.html +++ b/templates/index.html @@ -4,6 +4,7 @@ {board[url]} - {board[name]} + diff --git a/templates/page.html b/templates/page.html index 37259173..d9968b1e 100644 --- a/templates/page.html +++ b/templates/page.html @@ -3,6 +3,8 @@ {title} + +

{title}

diff --git a/templates/thread.html b/templates/thread.html index 79a9bcf5..bd1fca57 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -4,6 +4,7 @@ {board[url]} - {board[name]} +