forked from GithubBackups/vichan
Allow + in board names, add some new config vars (news+)
This commit is contained in:
parent
57619d766f
commit
9db6895c98
@ -8,7 +8,7 @@ header("Expires: 0");
|
||||
|
||||
function get_custom_banner(&$b) {
|
||||
# Validate the board name
|
||||
if (!(isset($b) && preg_match('/^[a-z0-9]{1,30}$/', $b)))
|
||||
if (!(isset($b) && preg_match('/^[a-z0-9+]{1,30}$/', $b)))
|
||||
return null;
|
||||
|
||||
# Check if directory exists
|
||||
|
@ -1083,6 +1083,7 @@
|
||||
$config['error']['youaremuted'] = _('You are muted! Expires in %d seconds.');
|
||||
$config['error']['dnsbl'] = _('Your IP address is listed in %s.');
|
||||
$config['error']['toomanylinks'] = _('Too many links; flood detected.');
|
||||
$config['error']['notenoughlinks'] = _('OPs are required to have at least %d links on this board.');
|
||||
$config['error']['toomanycites'] = _('Too many cites; post discarded.');
|
||||
$config['error']['toomanycross'] = _('Too many cross-board links; post discarded.');
|
||||
$config['error']['nodelete'] = _('You didn\'t select anything to delete.');
|
||||
@ -1680,7 +1681,7 @@
|
||||
|
||||
// Regex for board URIs. Don't add "`" character or any Unicode that MySQL can't handle. 58 characters
|
||||
// is the absolute maximum, because MySQL cannot handle table names greater than 64 characters.
|
||||
$config['board_regex'] = '[0-9a-zA-Z$_\x{0080}-\x{FFFF}]{1,58}';
|
||||
$config['board_regex'] = '[0-9a-zA-Z\+$_\x{0080}-\x{FFFF}]{1,58}';
|
||||
|
||||
// Youtube.js embed HTML code
|
||||
$config['youtube_js_html'] = '<div class="video-container" data-video="$1" data-params="&$2&$3">'.
|
||||
|
@ -1703,7 +1703,7 @@ function extract_modifiers($body) {
|
||||
return $modifiers;
|
||||
}
|
||||
|
||||
function markup(&$body, $track_cites = false) {
|
||||
function markup(&$body, $track_cites = false, $op = false) {
|
||||
global $board, $config, $markup_urls;
|
||||
|
||||
$modifiers = extract_modifiers($body);
|
||||
@ -1741,6 +1741,9 @@ function markup(&$body, $track_cites = false) {
|
||||
|
||||
if ($num_links > $config['max_links'])
|
||||
error($config['error']['toomanylinks']);
|
||||
|
||||
if ($num_links < $config['min_links'] && $op)
|
||||
error(sprintf($config['error']['notenoughlinks'], $config['min_links']));
|
||||
}
|
||||
|
||||
if ($config['markup_repair_tidy'])
|
||||
|
@ -74,7 +74,7 @@
|
||||
$config['mod']['capcode'][MOD] = array('Board Owner');
|
||||
$config['mod']['capcode'][GLOBALVOLUNTEER] = array('Global Volunteer');
|
||||
$config['custom_capcode']['Admin'] = array(
|
||||
'<span class="capcode" style="color:blue;font-weight:bold"> <i class="fa fa-wheelchair"></i> %s</span>',
|
||||
'<span class="capcode" title="This post is written by the global 8chan.co administrator."> <i class="fa fa-wheelchair" style="color:blue;"></i> <span style="color:red">8chan.co Administrator</span></span>',
|
||||
);
|
||||
//$config['mod']['view_banlist'] = GLOBALVOLUNTEER;
|
||||
$config['mod']['recent_reports'] = 65535;
|
||||
@ -91,6 +91,7 @@
|
||||
//$config['default_stylesheet'] = array('Notsuba', 'notsuba.css');
|
||||
$config['additional_javascript'][] = 'js/jquery.min.js';
|
||||
$config['additional_javascript'][] = 'js/jquery.mixitup.min.js';
|
||||
$config['additional_javascript'][] = 'js/jquery-ui.custom.min.js';
|
||||
$config['additional_javascript'][] = 'js/catalog.js';
|
||||
$config['additional_javascript'][] = 'js/captcha.js';
|
||||
$config['additional_javascript'][] = 'js/jquery.tablesorter.min.js';
|
||||
@ -150,8 +151,9 @@
|
||||
$config['markup'][] = array("/\[spoiler\](.+?)\[\/spoiler\]/", "<span class=\"spoiler\">\$1</span>");
|
||||
$config['markup'][] = array("/~~(.+?)~~/", "<s>\$1</s>");
|
||||
$config['markup'][] = array("/__(.+?)__/", "<u>\$1</u>");
|
||||
$config['markup'][] = array("/###([^\s']+)###/", "<a href='/boards.html#\$1'>###\$1###</a>");
|
||||
|
||||
$config['boards'] = array(array('<i class="fa fa-home" title="Home"></i>' => '/', '<i class="fa fa-tags" title="Boards"></i>' => '/boards.html', '<i class="fa fa-question" title="FAQ"></i>' => '/faq.html', '<i class="fa fa-random" title="Random"></i>' => '/random.php', '<i class="fa fa-plus" title="New board"></i>' => '/create.php', '<i class="fa fa-ban" title="Public ban list"></i>' => '/bans.html', '<i class="fa fa-search" title="Search"></i>' => '/search.php', '<i class="fa fa-cog" title="Manage board"></i>' => '/mod.php', '<i class="fa fa-quote-right" title="Chat"></i>' => 'https://qchat.rizon.net/?channels=#8chan'), array('b', 'meta'), array('<i class="fa fa-twitter" title="Twitter"></i>'=>'https://twitter.com/infinitechan'));
|
||||
$config['boards'] = array(array('<i class="fa fa-home" title="Home"></i>' => '/', '<i class="fa fa-tags" title="Boards"></i>' => '/boards.html', '<i class="fa fa-question" title="FAQ"></i>' => '/faq.html', '<i class="fa fa-random" title="Random"></i>' => '/random.php', '<i class="fa fa-plus" title="New board"></i>' => '/create.php', '<i class="fa fa-ban" title="Public ban list"></i>' => '/bans.html', '<i class="fa fa-search" title="Search"></i>' => '/search.php', '<i class="fa fa-cog" title="Manage board"></i>' => '/mod.php', '<i class="fa fa-quote-right" title="Chat"></i>' => 'https://qchat.rizon.net/?channels=#8chan'), array('b', 'meta', 'news+'), array('<i class="fa fa-twitter" title="Twitter"></i>'=>'https://twitter.com/infinitechan'));
|
||||
//$config['boards'] = array(array('<i class="fa fa-home" title="Home"></i>' => '/', '<i class="fa fa-tags" title="Boards"></i>' => '/boards.html', '<i class="fa fa-question" title="FAQ"></i>' => '/faq.html', '<i class="fa fa-random" title="Random"></i>' => '/random.php', '<i class="fa fa-plus" title="New board"></i>' => '/create.php', '<i class="fa fa-search" title="Search"></i>' => '/search.php', '<i class="fa fa-cog" title="Manage board"></i>' => '/mod.php', '<i class="fa fa-quote-right" title="Chat"></i>' => 'https://qchat.rizon.net/?channels=#8chan'), array('b', 'meta', 'int'), array('v', 'a', 'tg', 'fit', 'pol', 'tech', 'mu', 'co', 'sp', 'boards'), array('<i class="fa fa-twitter" title="Twitter"></i>'=>'https://twitter.com/infinitechan'));
|
||||
|
||||
$config['footer'][] = 'All posts on 8chan.co are the responsibility of the individual poster and not the administration of 8chan.co, pursuant to 47 U.S.C. § 230.';
|
||||
@ -195,6 +197,9 @@
|
||||
|
||||
$config['gzip_static'] = false;
|
||||
$config['hash_masked_ip'] = true;
|
||||
$config['force_subject_op'] = false;
|
||||
$config['min_links'] = 0;
|
||||
$config['min_body'] = 0;
|
||||
// 8chan specific mod pages
|
||||
require '8chan-mod-pages.php';
|
||||
|
||||
|
11
post.php
11
post.php
@ -400,6 +400,13 @@ elseif (isset($_POST['post'])) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($config['force_subject_op'] && $post['op']) {
|
||||
$stripped_whitespace = preg_replace('/^[\pZ\pC]+|[\pZ\pC]+$/u', '', $post['subject']);
|
||||
if ($stripped_whitespace == '') {
|
||||
error(_('It is required to enter a subject when starting a new thread on this board.'));
|
||||
}
|
||||
}
|
||||
|
||||
if (!$post['op']) {
|
||||
// Check if thread is locked
|
||||
// but allow mods to post
|
||||
@ -523,6 +530,8 @@ elseif (isset($_POST['post'])) {
|
||||
error(sprintf($config['error']['toolong'], 'subject'));
|
||||
if (!$mod && mb_strlen($post['body']) > $config['max_body'])
|
||||
error($config['error']['toolong_body']);
|
||||
if (mb_strlen($post['body']) < $config['min_body'] && $post['op'])
|
||||
error(_(sprintf('OP must be at least %d chars on this board.', $config['min_body'])));
|
||||
if (mb_strlen($post['password']) > 20)
|
||||
error(sprintf($config['error']['toolong'], 'password'));
|
||||
|
||||
@ -588,7 +597,7 @@ elseif (isset($_POST['post'])) {
|
||||
}
|
||||
}
|
||||
|
||||
$post['tracked_cites'] = markup($post['body'], true);
|
||||
$post['tracked_cites'] = markup($post['body'], true, $post['op']);
|
||||
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
{{ boardlist.top }}
|
||||
|
||||
{% if pm %}<div class="top_notice">You have <a href="?/PM/{{ pm.id }}">an unread PM</a>{% if pm.waiting > 0 %}, plus {{ pm.waiting }} more waiting{% endif %}.</div><hr />{% endif %}
|
||||
{% if config.url_banner %}<img class="board_image" src="{{ config.url_banner }}?board={{ board.uri }}" {% if config.banner_width or config.banner_height %}style="{% if config.banner_width %}width:{{ config.banner_width }}px{% endif %};{% if config.banner_width %}height:{{ config.banner_height }}px{% endif %}" {% endif %}alt="" />{% endif %}
|
||||
{% if config.url_banner %}<img class="board_image" src="{{ config.url_banner }}?board={{ board.uri|url_encode }}" {% if config.banner_width or config.banner_height %}style="{% if config.banner_width %}width:{{ config.banner_width }}px{% endif %};{% if config.banner_width %}height:{{ config.banner_height }}px{% endif %}" {% endif %}alt="" />{% endif %}
|
||||
|
||||
<header>
|
||||
<h1>{{ board.url }} - {{ board.title|e }}</h1>
|
||||
|
@ -188,7 +188,7 @@ function changeStyle(styleName, link) {
|
||||
{% endraw %}
|
||||
|
||||
function init_stylechooser() {
|
||||
var matches = document.URL.match(/\/(\w+)\/($|{{ config.dir.res|replace({'/': '\\/'}) }}{{ config.file_page|replace({'%d': '\\d+', '.': '\\.'}) }}|{{ config.file_index|replace({'.': '\\.'}) }}|{{ config.dir.res|replace({'/': '\\/'}) }}{{ config.file_page50|replace({'+': '\\+', '%d': '\\d+', '.': '\\.'}) }}|{{ config.file_page|replace({'%d': '\\d+', '.': '\\.'}) }}|{{ config.catalog_link|replace({'.': '\\.'}) }})/);
|
||||
var matches = document.URL.match(/\/([0-9a-zA-Z\+$_\u0080-\uFFFF]{1,58})\/($|{{ config.dir.res|replace({'/': '\\/'}) }}{{ config.file_page|replace({'%d': '\\d+', '.': '\\.'}) }}|{{ config.file_index|replace({'.': '\\.'}) }}|{{ config.dir.res|replace({'/': '\\/'}) }}{{ config.file_page50|replace({'+': '\\+', '%d': '\\d+', '.': '\\.'}) }}|{{ config.file_page|replace({'%d': '\\d+', '.': '\\.'}) }}|{{ config.catalog_link|replace({'.': '\\.'}) }})/);
|
||||
var newElement = document.createElement('div');
|
||||
newElement.className = 'styles';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user