1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-30 18:24:29 +01:00

increased board uri/title/subtitle character limits

This commit is contained in:
Michael Save 2012-02-19 19:37:39 +11:00
parent 3e9e51b1e7
commit 3b17f32047
4 changed files with 15 additions and 10 deletions

View File

@ -213,17 +213,17 @@
'<table>' . '<table>' .
'<tr>' . '<tr>' .
'<th><label for="board">URI</label></th>' . '<th><label for="board">URI</label></th>' .
'<td><input type="text" name="uri" id="board" size="3" maxlength="8" />' . '<td><input type="text" name="uri" id="board" size="10" maxlength="15" />' .
' <span class="unimportant">(eg. "b"; "mu")</span></td>' . ' <span class="unimportant">(eg. "b"; "mu")</span></td>' .
'</tr>' . '</tr>' .
'<tr>' . '<tr>' .
'<th><label for="title">Title</label></th>' . '<th><label for="title">Title</label></th>' .
'<td><input type="text" name="title" id="title" size="15" maxlength="20" />' . '<td><input type="text" name="title" id="title" size="25" maxlength="40" />' .
' <span class="unimportant">(eg. "Random")</span></td>' . ' <span class="unimportant">(eg. "Random")</span></td>' .
'</tr>' . '</tr>' .
'<tr>' . '<tr>' .
'<th><label for="subtitle">Subtitle</label></th>' . '<th><label for="subtitle">Subtitle</label></th>' .
'<td><input type="text" name="subtitle" id="subtitle" size="20" maxlength="40" />' . '<td><input type="text" name="subtitle" id="subtitle" size="25" maxlength="120" />' .
' <span class="unimportant">(optional)</span></td>' . ' <span class="unimportant">(optional)</span></td>' .
'</tr>' . '</tr>' .
'<tr>' . '<tr>' .

View File

@ -1,6 +1,6 @@
<?php <?php
// Installation/upgrade file // Installation/upgrade file
define('VERSION', 'v0.9.5-dev-2'); define('VERSION', 'v0.9.5-dev-3');
require 'inc/functions.php'; require 'inc/functions.php';
require 'inc/display.php'; require 'inc/display.php';
@ -164,6 +164,11 @@
query(sprintf("ALTER TABLE `posts_%s` ADD `body_nomarkup` TEXT NULL AFTER `body`", $board['uri'])) or error(db_error()); query(sprintf("ALTER TABLE `posts_%s` ADD `body_nomarkup` TEXT NULL AFTER `body`", $board['uri'])) or error(db_error());
} }
query("CREATE TABLE IF NOT EXISTS `cites` ( `board` varchar(8) NOT NULL, `post` int(11) NOT NULL, `target_board` varchar(8) NOT NULL, `target` int(11) NOT NULL, KEY `target` (`target_board`,`target`), KEY `post` (`board`,`post`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;") or error(db_error()); query("CREATE TABLE IF NOT EXISTS `cites` ( `board` varchar(8) NOT NULL, `post` int(11) NOT NULL, `target_board` varchar(8) NOT NULL, `target` int(11) NOT NULL, KEY `target` (`target_board`,`target`), KEY `post` (`board`,`post`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;") or error(db_error());
case 'v0.9.5-dev-2':
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");
case false: case false:
// Update version number // Update version number
file_write($config['has_installed'], VERSION); file_write($config['has_installed'], VERSION);

View File

@ -46,9 +46,9 @@ CREATE TABLE IF NOT EXISTS `bans` (
CREATE TABLE IF NOT EXISTS `boards` ( CREATE TABLE IF NOT EXISTS `boards` (
`id` smallint(6) NOT NULL AUTO_INCREMENT, `id` smallint(6) NOT NULL AUTO_INCREMENT,
`uri` varchar(8) NOT NULL, `uri` varchar(15) NOT NULL,
`title` varchar(20) NOT NULL, `title` varchar(40) NOT NULL,
`subtitle` varchar(40) DEFAULT NULL, `subtitle` varchar(120) DEFAULT NULL,
PRIMARY KEY (`uri`), PRIMARY KEY (`uri`),
UNIQUE KEY `id` (`id`) UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

View File

@ -2024,11 +2024,11 @@
error(sprintf($config['error']['required'], 'title')); error(sprintf($config['error']['required'], 'title'));
// Check string lengths // Check string lengths
if(mb_strlen($b['uri']) > 8) if(mb_strlen($b['uri']) > 15)
error(sprintf($config['error']['toolong'], 'URI')); error(sprintf($config['error']['toolong'], 'URI'));
if(mb_strlen($b['title']) > 20) if(strlen($b['title']) > 40)
error(sprintf($config['error']['toolong'], 'title')); error(sprintf($config['error']['toolong'], 'title'));
if(mb_strlen($b['subtitle']) > 40) if(strlen($b['subtitle']) > 120)
error(sprintf($config['error']['toolong'], 'subtitle')); error(sprintf($config['error']['toolong'], 'subtitle'));
if(!preg_match('/^\w+$/', $b['uri'])) if(!preg_match('/^\w+$/', $b['uri']))