diff options
| -rw-r--r-- | inc/display.php | 8 | ||||
| -rw-r--r-- | post.php | 9 |
2 files changed, 12 insertions, 5 deletions
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 . '"':'') . '>'; @@ -180,6 +180,10 @@ $post['thumbheight'] = $thumb['height'];
}
+ // Remove DIR_* before inserting them into the database.
+ $post['file'] = substr_replace($post['file'], '', 0, strlen(DIR_IMG));
+ $post['thumb'] = substr_replace($post['thumb'], '', 0, strlen(DIR_THUMB));
+
// Todo: Validate some more, remove messy code, allow more specific configuration
// MySQLify
@@ -266,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);
}
@@ -303,7 +311,6 @@ } else {
if(!file_exists(FILE_INDEX)) {
buildIndex();
- sql_close();
}
header('Location: ' . ROOT . FILE_INDEX, true, 302);
|
