diff options
| -rw-r--r-- | inc/display.php | 2 | ||||
| -rw-r--r-- | inc/mod.php | 6 | ||||
| -rw-r--r-- | install.php | 9 | ||||
| -rw-r--r-- | install.sql | 6 | ||||
| -rw-r--r-- | mod.php | 12 | ||||
| -rw-r--r-- | post.php | 15 |
6 files changed, 20 insertions, 30 deletions
diff --git a/inc/display.php b/inc/display.php index 8be431aa..ef6d1efc 100644 --- a/inc/display.php +++ b/inc/display.php @@ -122,7 +122,7 @@ $body = html_entity_decode($body, ENT_COMPAT, 'UTF-8'); // calculate strlen() so we can add "..." after if needed - $strlen = strlen($body); + $strlen = mb_strlen($body); $body = substr($body, 0, $len); diff --git a/inc/mod.php b/inc/mod.php index f2e52b21..43ed760d 100644 --- a/inc/mod.php +++ b/inc/mod.php @@ -213,17 +213,17 @@ '<table>' . '<tr>' . '<th><label for="board">URI</label></th>' . - '<td><input type="text" name="uri" id="board" size="10" maxlength="15" />' . + '<td><input type="text" name="uri" id="board" size="10" />' . ' <span class="unimportant">(eg. "b"; "mu")</span></td>' . '</tr>' . '<tr>' . '<th><label for="title">Title</label></th>' . - '<td><input type="text" name="title" id="title" size="25" maxlength="40" />' . + '<td><input type="text" name="title" id="title" size="25" />' . ' <span class="unimportant">(eg. "Random")</span></td>' . '</tr>' . '<tr>' . '<th><label for="subtitle">Subtitle</label></th>' . - '<td><input type="text" name="subtitle" id="subtitle" size="25" maxlength="120" />' . + '<td><input type="text" name="subtitle" id="subtitle" size="25" />' . ' <span class="unimportant">(optional)</span></td>' . '</tr>' . '<tr>' . diff --git a/install.php b/install.php index 679a771f..4e21a4ef 100644 --- a/install.php +++ b/install.php @@ -1,6 +1,6 @@ <?php // Installation/upgrade file - define('VERSION', 'v0.9.5'); + define('VERSION', 'v0.9.6-dev-1'); require 'inc/functions.php'; require 'inc/display.php'; @@ -168,9 +168,14 @@ query("ALTER TABLE `boards` CHANGE `uri` `uri` VARCHAR( 15 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, CHANGE `title` `title` VARCHAR( 40 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - CHANGE `subtitle` `subtitle` VARCHAR( 120 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL"); + CHANGE `subtitle` `subtitle` VARCHAR( 120 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL") or error(db_error()); case 'v0.9.5-dev-3': // v0.9.5 + case 'v0.9.5': + query("ALTER TABLE `boards` + CHANGE `uri` `uri` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + CHANGE `title` `title` TINYTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + CHANGE `subtitle` `subtitle` TINYTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL") or error(db_error()); case false: // Update version number file_write($config['has_installed'], VERSION); diff --git a/install.sql b/install.sql index a2650dde..deae2c4c 100644 --- a/install.sql +++ b/install.sql @@ -46,9 +46,9 @@ CREATE TABLE IF NOT EXISTS `bans` ( CREATE TABLE IF NOT EXISTS `boards` ( `id` smallint(6) NOT NULL AUTO_INCREMENT, - `uri` varchar(15) NOT NULL, - `title` varchar(40) NOT NULL, - `subtitle` varchar(120) DEFAULT NULL, + `uri` varchar(50) NOT NULL, + `title` TINYTEXT NOT NULL, + `subtitle` TINYTEXT DEFAULT NULL, PRIMARY KEY (`uri`), UNIQUE KEY `id` (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; @@ -1743,8 +1743,8 @@ '<table>' . '<tr><th>URI</th><td>' . $board['uri'] . '</td>' . - '<tr><th>Title</th><td><input size="20" maxlength="20" type="text" name="title" value="' . $board['name'] . '" /></td></tr>' . - '<tr><th>Subtitle</th><td><input size="20" maxlength="40" type="text" name="subtitle" value="' . + '<tr><th>Title</th><td><input size="20" type="text" name="title" value="' . $board['name'] . '" /></td></tr>' . + '<tr><th>Subtitle</th><td><input size="20" type="text" name="subtitle" value="' . (isset($board['title']) ? $board['title'] : '') . '" /></td></tr>' . '</table>' . @@ -2140,14 +2140,6 @@ if(empty($b['title'])) error(sprintf($config['error']['required'], 'title')); - // Check string lengths - if(mb_strlen($b['uri']) > 15) - error(sprintf($config['error']['toolong'], 'URI')); - if(strlen($b['title']) > 40) - error(sprintf($config['error']['toolong'], 'title')); - if(strlen($b['subtitle']) > 120) - error(sprintf($config['error']['toolong'], 'subtitle')); - if(!preg_match('/^\w+$/', $b['uri'])) error(sprintf($config['error']['invalidfield'], 'URI')); @@ -18,9 +18,7 @@ if(isset($_POST['delete'])) { // Delete - if( !isset($_POST['board']) || - !isset($_POST['password']) - ) + if(!isset($_POST['board'], $_POST['password'])) error($config['error']['bot']); $password = &$_POST['password']; @@ -82,10 +80,7 @@ header('Location: ' . $root . $board['dir'] . $config['file_index'], true, $config['redirect_http']); } elseif(isset($_POST['report'])) { - if( !isset($_POST['board']) || - !isset($_POST['password']) || - !isset($_POST['reason']) - ) + if(!isset($_POST['board'], $_POST['password'], $_POST['reason'])) error($config['error']['bot']); $report = Array(); @@ -142,10 +137,8 @@ header('Location: ' . $root . $board['dir'] . $config['file_index'], true, $config['redirect_http']); } elseif(isset($_POST['post'])) { - if( !isset($_POST['subject']) || - !isset($_POST['body']) || - !isset($_POST['board']) - ) error($config['error']['bot']); + if(!isset($_POST['subject'], $_POST['body'], $_POST['board'])) + error($config['error']['bot']); if(!isset($_POST['name'])) $_POST['name'] = $config['anonymous']; |
