Browse Source

Show full filename on mouseover.

pull/40/head
Savetheinternet 13 years ago
parent
commit
339853e5de
  1. 4
      inc/config.php
  2. 18
      inc/display.php
  3. 9
      install.php
  4. 2
      install.sql
  5. 4
      post.php
  6. 2
      templates/posts.sql

4
inc/config.php

@ -120,6 +120,10 @@
$config['body_truncate'] = 15;
// Amount of characters to show on the index page
$config['body_truncate_char'] = 2500;
// Maximum filename length (will be truncated)
$config['max_filename_len'] = 255;
// Maximum filename length to display (the rest can be viewed upon mouseover)
$config['max_filename_display'] = 30;
$config['threads_per_page'] = 10;
$config['max_pages'] = 10;

18
inc/display.php

@ -352,7 +352,14 @@
}
if($config['show_filename']) {
// Filename
$built .= ', ' . $this->filename;
$built .= ', ' .
(strlen($this->filename) > $config['max_filename_display'] ?
'<span title="' . $this->filename . '">' .
substr($this->filename, 0, $config['max_filename_display']) . '&hellip;' .
'</span>'
:
$this->filename
);
}
$built .= ')</span></p>' .
@ -511,7 +518,14 @@
}
if($config['show_filename']) {
// Filename
$built .= ', ' . $this->filename;
$built .= ', ' .
(strlen($this->filename) > $config['max_filename_display'] ?
'<span title="' . $this->filename . '">' .
substr($this->filename, 0, $config['max_filename_display']) . '&hellip;' .
'</span>'
:
$this->filename
);
}
$built .= ')</span></p>' .

9
install.php

@ -1,6 +1,6 @@
<?php
// Installation/upgrade file
define('VERSION', 'v0.9.3-dev-7');
define('VERSION', 'v0.9.3-dev-8');
require 'inc/functions.php';
require 'inc/display.php';
@ -102,7 +102,12 @@
}
foreach($tables as &$table) {
query("ALTER TABLE `{$table}` ENGINE = MYISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci");
query("ALTER TABLE `{$table}` ENGINE = MYISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci") or error(db_error());
}
case 'v0.9.3-dev-7':
$boards = listBoards();
foreach($boards as &$board) {
query(sprintf("ALTER TABLE `posts_%s` CHANGE `filename` `filename` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL", $board['uri'])) or error(db_error());
}
case false:
// Update version number

2
install.sql

@ -202,7 +202,7 @@ CREATE TABLE IF NOT EXISTS `posts_b` (
`filewidth` int(11) DEFAULT NULL,
`fileheight` int(11) DEFAULT NULL,
`filesize` int(11) DEFAULT NULL,
`filename` varchar(30) DEFAULT NULL,
`filename` text DEFAULT NULL,
`filehash` text DEFAULT NULL,
`password` varchar(20) DEFAULT NULL,
`ip` varchar(45) NOT NULL,

4
post.php

@ -413,8 +413,8 @@
$is_an_image = !in_array($post['extension'], $config['allowed_ext_files']);
// Just trim the filename if it's too long
if(strlen($post['filename']) > 30) $post['filename'] = substr($post['filename'], 0, 27).'…';
// Truncate filename if it is too long
$post['filename'] = substr($post['filename'], 0, $config['max_filename_len']);
// Move the uploaded file
if(!@move_uploaded_file($_FILES['file']['tmp_name'], $post['file'])) error($config['error']['nomove']);

2
templates/posts.sql

@ -16,7 +16,7 @@ CREATE TABLE IF NOT EXISTS `posts_{board}` (
`filewidth` int(11) DEFAULT NULL,
`fileheight` int(11) DEFAULT NULL,
`filesize` int(11) DEFAULT NULL,
`filename` varchar(30) DEFAULT NULL,
`filename` text DEFAULT NULL,
`filehash` text DEFAULT NULL,
`password` varchar(20) DEFAULT NULL,
`ip` varchar(45) NOT NULL,

Loading…
Cancel
Save