mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-03-02 16:33:49 +01:00
This commit is contained in:
commit
2d0309ba48
@ -109,7 +109,7 @@ class Api {
|
||||
if (isset($post->files) && $post->files && !$threadsPage) {
|
||||
$file = $post->files[0];
|
||||
$this->translateFields($this->fileFields, $file, $apiPost);
|
||||
$apiPost['filename'] = substr($file->name, 0, strrpos($file->name, '.'));
|
||||
$apiPost['filename'] = @substr($file->name, 0, strrpos($file->name, '.'));
|
||||
$dotPos = strrpos($file->file, '.');
|
||||
$apiPost['ext'] = substr($file->file, $dotPos);
|
||||
$apiPost['tim'] = substr($file->file, 0, $dotPos);
|
||||
|
@ -1223,21 +1223,21 @@
|
||||
$config['capcode'] = ' <span class="capcode">## %s</span>';
|
||||
|
||||
// "## Custom" becomes lightgreen, italic and bold:
|
||||
$config['custom_capcode']['Custom'] ='<span class="capcode" style="color:lightgreen;font-style:italic;font-weight:bold"> ## %s</span>';
|
||||
//$config['custom_capcode']['Custom'] ='<span class="capcode" style="color:lightgreen;font-style:italic;font-weight:bold"> ## %s</span>';
|
||||
|
||||
// "## Mod" makes everything purple, including the name and tripcode:
|
||||
$config['custom_capcode']['Mod'] = array(
|
||||
'<span class="capcode" style="color:purple"> ## %s</span>',
|
||||
'color:purple', // Change name style; optional
|
||||
'color:purple' // Change tripcode style; optional
|
||||
);
|
||||
//$config['custom_capcode']['Mod'] = array(
|
||||
// '<span class="capcode" style="color:purple"> ## %s</span>',
|
||||
// 'color:purple', // Change name style; optional
|
||||
// 'color:purple' // Change tripcode style; optional
|
||||
//);
|
||||
|
||||
// "## Admin" makes everything red and bold, including the name and tripcode:
|
||||
$config['custom_capcode']['Admin'] = array(
|
||||
'<span class="capcode" style="color:red;font-weight:bold"> ## %s</span>',
|
||||
'color:red;font-weight:bold', // Change name style; optional
|
||||
'color:red;font-weight:bold' // Change tripcode style; optional
|
||||
);
|
||||
//$config['custom_capcode']['Admin'] = array(
|
||||
// '<span class="capcode" style="color:red;font-weight:bold"> ## %s</span>',
|
||||
// 'color:red;font-weight:bold', // Change name style; optional
|
||||
// 'color:red;font-weight:bold' // Change tripcode style; optional
|
||||
//);
|
||||
|
||||
// Enable the moving of single replies
|
||||
$config['move_replies'] = false;
|
||||
|
@ -831,7 +831,7 @@ function checkBan($board = false) {
|
||||
return;
|
||||
}
|
||||
|
||||
Bans::purge();
|
||||
//Bans::purge();
|
||||
|
||||
if ($config['cache']['enabled'])
|
||||
cache::set('purged_bans_last', time());
|
||||
@ -1546,7 +1546,7 @@ function buildJavascript() {
|
||||
}
|
||||
|
||||
if ($config['additional_javascript_compile']) {
|
||||
foreach ($config['additional_javascript'] as $file) {
|
||||
foreach (array_unique($config['additional_javascript']) as $file) {
|
||||
$script .= file_get_contents($file);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
$config['db']['user'] = 'root';
|
||||
$config['db']['password'] = '';
|
||||
$config['timezone'] = 'UTC';
|
||||
$config['cache']['enabled'] = false;
|
||||
$config['cache']['enabled'] = 'apc';
|
||||
|
||||
|
||||
$config['cookies']['mod'] = 'mod';
|
||||
@ -82,10 +82,15 @@
|
||||
$config['mod']['manageusers'] = SUPERMOD;
|
||||
$config['mod']['noticeboard_post'] = SUPERMOD;
|
||||
$config['mod']['search'] = SUPERMOD;
|
||||
$config['mod']['clean_global'] = SUPERMOD;
|
||||
$config['mod']['debug_recent'] = ADMIN;
|
||||
$config['mod']['debug_antispam'] = ADMIN;
|
||||
$config['mod']['modlog'] = SUPERMOD;
|
||||
$config['mod']['editpost'] = MOD;
|
||||
$config['mod']['edit_banners'] = MOD;
|
||||
$config['mod']['edit_flags'] = MOD;
|
||||
$config['mod']['edit_settings'] = MOD;
|
||||
$config['mod']['clean'] = MOD;
|
||||
$config['mod']['recent_reports'] = 65535;
|
||||
$config['mod']['ip_less_recentposts'] = 75;
|
||||
$config['ban_show_post'] = true;
|
||||
@ -93,10 +98,14 @@
|
||||
// Board shit
|
||||
$config['max_links'] = 40;
|
||||
$config['poster_id_length'] = 6;
|
||||
$config['ayah_enabled'] = true;
|
||||
$config['ayah_enabled'] = false;
|
||||
$config['cbRecaptcha'] = true;
|
||||
$config['url_banner'] = '/banners.php';
|
||||
$config['additional_javascript_compile'] = true;
|
||||
//$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/catalog.js';
|
||||
$config['additional_javascript'][] = 'js/jquery.tablesorter.min.js';
|
||||
$config['additional_javascript'][] = 'js/options.js';
|
||||
$config['additional_javascript'][] = 'js/style-select.js';
|
||||
@ -136,6 +145,8 @@
|
||||
$config['additional_javascript'][] = 'js/infinite-scroll.js';
|
||||
$config['additional_javascript'][] = 'js/download-original.js';
|
||||
$config['additional_javascript'][] = 'js/thread-watcher.js';
|
||||
$config['additional_javascript'][] = 'js/ajax.js';
|
||||
$config['additional_javascript'][] = 'js/show-own-posts.js';
|
||||
|
||||
//$config['font_awesome_css'] = '/netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css';
|
||||
|
||||
@ -176,11 +187,72 @@
|
||||
}
|
||||
}
|
||||
|
||||
$config['mod']['custom_pages']['/flags/(\%b)'] = function($b) {
|
||||
global $config, $mod, $board;
|
||||
require_once 'inc/image.php';
|
||||
|
||||
if (!hasPermission($config['mod']['edit_flags'], $b))
|
||||
error($config['mod']['noaccess']);
|
||||
|
||||
if (!openBoard($b))
|
||||
error("Could not open board!");
|
||||
|
||||
$dir = 'static/custom-flags/'.$b;
|
||||
|
||||
if (!is_dir($dir)){
|
||||
mkdir($dir, 0777, true);
|
||||
}
|
||||
|
||||
if (isset($_FILES['file'])){
|
||||
$upload = $_FILES['file']['tmp_name'];
|
||||
$banners = array_diff(scandir($dir), array('..', '.'));
|
||||
|
||||
if (!is_readable($upload))
|
||||
error($config['error']['nomove']);
|
||||
|
||||
$id = time() . substr(microtime(), 2, 3);
|
||||
$extension = strtolower(mb_substr($_FILES['file']['name'], mb_strrpos($_FILES['file']['name'], '.') + 1));
|
||||
|
||||
if ($extension != 'png') {
|
||||
error(_('Flags must be in PNG format.'));
|
||||
}
|
||||
|
||||
if (filesize($upload) > 48000){
|
||||
error(_('File too large!'));
|
||||
}
|
||||
|
||||
if (!$size = @getimagesize($upload)) {
|
||||
error($config['error']['invalidimg']);
|
||||
}
|
||||
|
||||
if ($size[0] != 16 or $size[1] != 11){
|
||||
error(_('Image wrong size!'));
|
||||
}
|
||||
if (sizeof($banners) >= 100) {
|
||||
error(_('Too many flags.'));
|
||||
}
|
||||
|
||||
copy($upload, "$dir/$id.$extension");
|
||||
}
|
||||
|
||||
if (isset($_POST['delete'])){
|
||||
foreach ($_POST['delete'] as $i => $d){
|
||||
if (!preg_match('/[0-9+]\.(png|jpeg|jpg|gif)/', $d)){
|
||||
error('Nice try.');
|
||||
}
|
||||
unlink("$dir/$d");
|
||||
}
|
||||
}
|
||||
|
||||
$banners = array_diff(scandir($dir), array('..', '.'));
|
||||
mod_page(_('Edit banners'), 'mod/banners.html', array('board'=>$board,'banners'=>$banners,'token'=>make_secure_link_token('banners/'.$board['uri'])));
|
||||
};
|
||||
|
||||
$config['mod']['custom_pages']['/banners/(\%b)'] = function($b) {
|
||||
global $config, $mod, $board;
|
||||
require_once 'inc/image.php';
|
||||
|
||||
if (!in_array($b, $mod['boards']) and $mod['boards'][0] != '*')
|
||||
if (!hasPermission($config['mod']['edit_banners'], $b))
|
||||
error($config['error']['noaccess']);
|
||||
|
||||
if (!openBoard($b))
|
||||
@ -263,12 +335,12 @@
|
||||
$auto_unicode = isset($_POST['auto_unicode']) ? 'true' : 'false';
|
||||
$allow_roll = isset($_POST['allow_roll']) ? 'true' : 'false';
|
||||
$image_reject_repost = isset($_POST['image_reject_repost']) ? 'true' : 'false';
|
||||
$allow_delete = isset($_POST['allow_delete']) ? 'true' : 'false';
|
||||
$allow_flash = isset($_POST['allow_flash']) ? '$config[\'allowed_ext_files\'][] = \'swf\';' : '';
|
||||
$code_tags = isset($_POST['code_tags']) ? '$config[\'additional_javascript\'][] = \'js/code_tags/run_prettify.js\';$config[\'markup\'][] = array("/\[code\](.+?)\[\/code\]/ms", "<code><pre class=\'prettyprint\' style=\'display:inline-block\'>\$1</pre></code>");' : '';
|
||||
$katex = isset($_POST['katex']) ? '$config[\'katex\'] = true;$config[\'additional_javascript\'][] = \'js/katex/katex.min.js\'; $config[\'markup\'][] = array("/\[tex\](.+?)\[\/tex\]/ms", "<span class=\'tex\'>\$1</span>"); $config[\'additional_javascript\'][] = \'js/katex-enable.js\';' : '';
|
||||
$oekaki_js = <<<OEKAKI
|
||||
\$config['additional_javascript'][] = 'js/jquery-ui.custom.min.js';
|
||||
\$config['additional_javascript'][] = 'js/ajax.js';
|
||||
\$config['additional_javascript'][] = 'js/wPaint/lib/wColorPicker.min.js';
|
||||
\$config['additional_javascript'][] = 'js/wPaint/wPaint.min.js';
|
||||
\$config['additional_javascript'][] = 'js/wPaint/plugins/main/wPaint.menu.main.min.js';
|
||||
@ -280,8 +352,7 @@ $oekaki_js = <<<OEKAKI
|
||||
OEKAKI;
|
||||
$oekaki = isset($_POST['oekaki']) ? $oekaki_js : '';
|
||||
if ($_POST['locale'] !== 'en' && in_array($_POST['locale'], $possible_languages)) {
|
||||
$locale = "\$config['locale'] = '{$_POST['locale']}.UTF-8';
|
||||
\$config['file_script'] = '$b/main.js';";
|
||||
$locale = "\$config['locale'] = '{$_POST['locale']}.UTF-8';";
|
||||
} else {
|
||||
$locale = '';
|
||||
}
|
||||
@ -289,7 +360,6 @@ OEKAKI;
|
||||
if (isset($_POST['max_images']) && (int)$_POST['max_images'] && (int)$_POST['max_images'] <= 5) {
|
||||
$_POST['max_images'] = (int)$_POST['max_images'];
|
||||
$multiimage = "\$config['max_images'] = {$_POST['max_images']};
|
||||
\$config['file_script'] = '$b/main.js';
|
||||
\$config['additional_javascript'][] = 'js/multi-image.js';";
|
||||
} else {
|
||||
$multiimage = '';
|
||||
@ -327,6 +397,7 @@ OEKAKI;
|
||||
|
||||
$config_file = <<<EOT
|
||||
<?php
|
||||
\$config['file_script'] = '$b/main.js';
|
||||
\$config['country_flags'] = $country_flags;
|
||||
\$config['field_disable_name'] = $field_disable_name;
|
||||
\$config['enable_embedding'] = $enable_embedding;
|
||||
@ -337,6 +408,7 @@ OEKAKI;
|
||||
\$config['auto_unicode'] = $auto_unicode;
|
||||
\$config['allow_roll'] = $allow_roll;
|
||||
\$config['image_reject_repost'] = $image_reject_repost;
|
||||
\$config['allow_delete'] = $allow_delete;
|
||||
\$config['anonymous'] = base64_decode('$anonymous');
|
||||
\$config['blotter'] = base64_decode('$blotter');
|
||||
\$config['stylesheets']['Custom'] = 'board/$b.css';
|
||||
|
@ -102,7 +102,7 @@ function mod_dashboard() {
|
||||
|
||||
$query = prepare('SELECT COUNT(*) AS `total_reports` FROM ``reports``' . ($mod["type"] == "20" ? " WHERE board = :board" : ""));
|
||||
|
||||
if ($mod['type'] == '20') {
|
||||
if ($mod['type'] == MOD) {
|
||||
$query->bindValue(':board', $mod['boards'][0]);
|
||||
} else {
|
||||
$query = prepare('SELECT (SELECT COUNT(id) FROM reports WHERE global = 0) AS total_reports, (SELECT COUNT(id) FROM reports WHERE global = 1) AS global_reports');
|
||||
@ -1032,7 +1032,7 @@ function mod_bans_json() {
|
||||
error($config['error']['noaccess']);
|
||||
|
||||
// Compress the json for faster loads
|
||||
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler");
|
||||
if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler");
|
||||
|
||||
Bans::stream_json(false, !hasPermission($config['mod']['show_ip']), !hasPermission($config['mod']['view_banstaff']), $mod['boards']);
|
||||
}
|
||||
@ -2298,7 +2298,7 @@ function mod_reports() {
|
||||
error($config['error']['noaccess']);
|
||||
}
|
||||
|
||||
if( $mod['type'] == '20' and $global ) {
|
||||
if( $mod['type'] == MOD and $global) {
|
||||
error($config['error']['noaccess']);
|
||||
}
|
||||
|
||||
@ -2306,10 +2306,10 @@ function mod_reports() {
|
||||
$report_scope = $global ? "global" : "local";
|
||||
|
||||
// Get REPORTS.
|
||||
$query = prepare("SELECT * FROM ``reports`` " . ($mod["type"] == "20" ? "WHERE board = :board" : "") . " WHERE ``".($global ? "global" : "local")."`` = TRUE LIMIT :limit");
|
||||
$query = prepare("SELECT * FROM ``reports`` WHERE " . ($mod["type"] == MOD ? "board = :board AND" : "") . " ``".($global ? "global" : "local")."`` = TRUE LIMIT :limit");
|
||||
|
||||
// Limit reports by board if the moderator is local.
|
||||
if( $mod['type'] == '20' ) {
|
||||
if( $mod['type'] == MOD ) {
|
||||
$query->bindValue(':board', $mod['boards'][0]);
|
||||
}
|
||||
|
||||
@ -2527,7 +2527,7 @@ function mod_report_dismiss() {
|
||||
$global = in_array( "global", $arguments );
|
||||
$content = in_array( "content", $arguments );
|
||||
|
||||
if( $mod['type'] == '20' and $global ) {
|
||||
if( $mod['type'] == MOD and $global ) {
|
||||
error($config['error']['noaccess']);
|
||||
}
|
||||
|
||||
@ -2649,7 +2649,7 @@ function mod_report_dismiss() {
|
||||
function mod_report_demote() {
|
||||
global $config, $mod;
|
||||
|
||||
if( $mod['type'] == '20' ) {
|
||||
if( $mod['type'] == MOD ) {
|
||||
error($config['error']['noaccess']);
|
||||
}
|
||||
|
||||
|
@ -301,6 +301,10 @@ div.post_modified div.content-status:first-child {
|
||||
margin-top: 1.3em;
|
||||
}
|
||||
|
||||
div.post_modified div.content-status:first-child {
|
||||
margin-top: 1.3em;
|
||||
}
|
||||
|
||||
span.trip {
|
||||
color: #228854;
|
||||
}
|
||||
|
@ -236,7 +236,7 @@
|
||||
<em>{% trans %}Welcome to ∞chan, the infinitely expanding imageboard.{% endtrans %}</em>
|
||||
<br>
|
||||
<strong>{% trans %}Featured boards:{% endtrans %}</strong>
|
||||
<span class="favorite-boards"></span>
|
||||
<span class="sub" data-description="2"></span>
|
||||
<br>
|
||||
<strong>
|
||||
{% trans %}Boards of the week:{% endtrans %} [
|
||||
|
@ -41,6 +41,7 @@
|
||||
<tr><th>{% trans %}Allow SWF uploading{% endtrans %}</th><td><input type="checkbox" name="allow_flash" {% if 'swf' in config.allowed_ext_files %}checked{% endif %}></td></tr>
|
||||
<tr><th>{% trans %}Enable dice rolling{% endtrans %}</th><td><input type="checkbox" name="allow_roll" {% if config.allow_roll %}checked{% endif %}></td></tr>
|
||||
<tr><th>{% trans %}Don't allow users to repost images{% endtrans %}</th><td><input type="checkbox" name="image_reject_repost" {% if config.image_reject_repost %}checked{% endif %}></td></tr>
|
||||
<tr><th>{% trans %}Allow a poster to delete his own posts{% endtrans %}</th><td><input type="checkbox" name="allow_delete" {% if config.allow_delete %}checked{% endif %}></td></tr>
|
||||
<tr><th>{% trans %}Language{% endtrans %}<br/><span class="unimportant">{% trans %}To contribute translations, register at <a href="https://www.transifex.com/projects/p/tinyboard-vichan-devel/">Transifex</a>{% endtrans %}</span></th><td>
|
||||
<select name="locale">
|
||||
<option value="en" {% if "en" == config.locale %}selected{% endif %}>en</option>
|
||||
|
@ -2,10 +2,10 @@
|
||||
{% if post.edited_at %}
|
||||
<div class="content-status edited">{% trans 'Post last edited at' %} <em class="edited-time">{{ post.edited_at }}</em></div>
|
||||
{% endif %}
|
||||
{% if clean.clean_local == '1' %}
|
||||
{% if post.clean.clean_local == '1' %}
|
||||
<div class="content-status clean-local">{% trans 'Board rules permit this content' %}</div>
|
||||
{% endif %}
|
||||
{% if clean.clean_global == '1' %}
|
||||
{% if post.clean.clean_global == '1' %}
|
||||
<div class="content-status clean-global">{% trans 'Global rules permit this content' %}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user