mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-01-31 12:23:48 +01:00
Add ?/flags [NOT DONE] and $config[allow_delete] to ?/settings
This commit is contained in:
parent
ab3fd973ad
commit
ff225064a1
@ -86,6 +86,9 @@
|
||||
$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']['recent_reports'] = 65535;
|
||||
$config['mod']['ip_less_recentposts'] = 75;
|
||||
$config['ban_show_post'] = true;
|
||||
@ -93,10 +96,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 +143,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 +185,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 +333,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 +350,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 +358,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 +395,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 +406,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';
|
||||
|
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user