summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Save <savetheinternet@tinyboard.org>2012-04-09 21:13:44 +1000
committerMichael Save <savetheinternet@tinyboard.org>2012-04-09 21:13:44 +1000
commit033491f84f9e58308954b049d3574e8791c6c3c2 (patch)
treef5311fb408ba0191c65377697a539e1fa90d5a82
parent874b8cbf002e9d8bf0ff39671e1501165016320a (diff)
increase character limit on board URI, title and subtitle
-rw-r--r--inc/display.php2
-rw-r--r--inc/mod.php6
-rw-r--r--install.php9
-rw-r--r--install.sql6
-rw-r--r--mod.php12
-rw-r--r--post.php15
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 ;
diff --git a/mod.php b/mod.php
index 2d871aff..01e8cd2d 100644
--- a/mod.php
+++ b/mod.php
@@ -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'));
diff --git a/post.php b/post.php
index 140ae62e..267d006f 100644
--- a/post.php
+++ b/post.php
@@ -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'];