1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-02-20 12:41:17 +01:00
Conflicts:
	inc/8chan-mod-pages.php
	templates/mod/settings.html
This commit is contained in:
8chan 2015-02-17 00:43:00 +00:00
commit 027687acc0
8 changed files with 69 additions and 14 deletions

View File

@ -9,17 +9,50 @@ Most things (other than installation) that apply to upstream vichan also apply t
If you are not interested in letting your users make their own boards, install vichan instead of infinity.
Because I cannot be bothered to maintain `install.php`, the install process is as such:
Installation
------------
Basic requirements:
A computer running a Unix or Unix-like OS(infinity has been specifically tested with and is known to work under Ubuntu 14.x), Apache, MySQL, and PHP
* Make sure Apache has read/write access to the directory infinity resides in.
* `install.php` is not maintained. Don't use it.
Step 1. Create infinity's database from the included install.sql file. Enter mysql and create an empty database named 'infinity'. Then cd into the infinity base directory and run:
```
mysql -uroot infinity < install.sql
mysql -uroot -p infinity < install.sql
echo 'infinity' > .installed
```
Here's my install script as of 11/14/2014 for the 8chan servers which run Ubuntu 14.04:
Step 2. /inc/secrets.php does not exist by default, but infinity needs it in order to function. To fix this, cd into /inc/ and run:
```
sudo cp secrets.example.php secrets.php
```
Now open secrets.php and edit the $config['db'] settings to point to the 'infinity' MySQL database you created in Step 1. 'user' and 'password' refer to your MySQL login credentials. It should look something like this when you're finished:
```
$config['db']['server'] = 'localhost';
$config['db']['database'] = 'infinity';
$config['db']['prefix'] = '';
$config['db']['user'] = 'root';
$config['db']['password'] = 'password';
$config['timezone'] = 'UTC';
$config['cache']['enabled'] = 'apc';
```
Step 3.(Optional) By default, infinity will ignore any changes you make to the template files until you log into mod.php, go to Rebuild, and select Flush Cache. You may find this inconvenient. To make infinity automatically accept your changes to the template files, open /inc/template.php and add:
```
'auto_reload' => true
```
To the array of settings passed to Twig_Environment().
Step 4. Infinity can function in a very barebones fashion after the first two steps, but you should probably install these additional packages if you want to seriously run it and/or contribute to it. ffmpeg may fail to install under certain versions of Ubuntu. If it does, remove it from this script and install it via an alternate method. Make sure to run the below as root:
```
apt-get install graphicsmagick gifsicle php5-fpm mysql-client php5-mysql php5-cli php-pear php5-apcu; add-apt-repository ppa:jon-severinsson/ffmpeg; add-apt-repository ppa:nginx/stable; apt-get update; apt-get install nginx ffmpeg; pear install Net_DNS2
```
Step 5. The current captcha provider listed inc/config.php is dead. You may want to work around this.
Have fun!

View File

@ -433,6 +433,7 @@ FLAGS;
$captcha = isset($_POST['captcha']) ? 'true' : 'false';
$force_subject_op = isset($_POST['force_subject_op']) ? 'true' : 'false';
$tor_posting = isset($_POST['tor_posting']) ? 'true' : 'false';
$new_thread_capt = isset($_POST['new_thread_capt']) ? 'true' : 'false';
@ -531,6 +532,7 @@ OEKAKI;
\$config['captcha']['enabled'] = $captcha;
\$config['force_subject_op'] = $force_subject_op;
\$config['tor_posting'] = $tor_posting;
\$config['new_thread_capt'] = $new_thread_capt;
\$config['hour_max_threads'] = $hour_max_threads;
$code_tags $katex $oekaki $replace $multiimage $allow_flash $allow_pdf $user_flags
if (\$config['disable_images'])
@ -600,6 +602,7 @@ EOT;
// be smarter about rebuilds...only some changes really require us to rebuild all threads
if ($_config['captcha']['enabled'] != $config['captcha']['enabled']
|| $_config['new_thread_capt'] != $config['new_thread_capt'] /*New thread captcha - if toggling "enable captcha" requires this, toggling new thread capt does too, I guess.*/
|| $_config['captcha']['extra'] != $config['captcha']['extra']
|| $_config['blotter'] != $config['blotter']
|| $_config['field_disable_name'] != $config['field_disable_name']
@ -620,7 +623,7 @@ EOT;
$query->bindValue(':board', $b);
$query->execute() or error(db_error($query));
$board = $query->fetchAll()[0];
$rules = @file_get_contents($board['uri'] . '/rules.txt');
$css = @file_get_contents('stylesheets/board/' . $board['uri'] . '.css');

View File

@ -445,6 +445,11 @@
* ====================
*/
//New thread captcha
//Require solving a captcha to post a thread.
//Default off.
$config['new_thread_capt'] = false;
// Do you need a body for your reply posts?
$config['force_body'] = false;
// Do you need a body for new threads?

View File

@ -41,15 +41,15 @@ function handle_boards(data) {
return $('<span class="favorite-boards"></span>').append(' [ '+boards.join(" / ")+' ] ');
} else {
return $('<span class="favorite-boards"></span>');
}
}
}
function add_favorites() {
$('.favorite-boards').remove();
$('.favorite-boards').empty();
var boards = handle_boards(localStorage.favorites);
$('.boardlist').append(boards);
$('.favorite-boards').append(boards);
};
if (active_page == 'thread' || active_page == 'index' || active_page == 'catalog') {

View File

@ -115,7 +115,7 @@
#quick-reply td.recaptcha-response {\
padding: 0 0 1px 0;\
}\
@media screen and (max-width: 800px) {\
@media screen and (max-width: 600px) {\
#quick-reply {\
display: none !important;\
}\
@ -369,7 +369,7 @@
$(window).ready(function() {
if (settings.get('hide_at_top', true)) {
$(window).scroll(function() {
if ($(this).width() <= 800)
if ($(this).width() <= 600)
return;
if ($(this).scrollTop() < $origPostForm.offset().top + $origPostForm.height() - 100)
$postForm.fadeOut(100);
@ -391,7 +391,7 @@
};
$(window).on('cite', function(e, id, with_link) {
if ($(this).width() <= 800)
if ($(this).width() <= 600)
return;
show_quick_reply();
if (with_link) {
@ -446,7 +446,7 @@
$('.quick-reply-btn').hide();
$(window).scroll(function() {
if ($(this).width() <= 800)
if ($(this).width() <= 600)
return;
if ($(this).scrollTop() < $('form[name="post"]:first').offset().top + $('form[name="post"]:first').height() - 100)
$('.quick-reply-btn').fadeOut(100);

View File

@ -236,7 +236,9 @@ elseif (isset($_POST['post'])) {
}
// Same, but now with our custom captcha provider
if ($config['captcha']['enabled']) {
//if ($config['captcha']['enabled']) {
//New thread captcha
if (($config['captcha']['enabled']) || (($post['op']) && ($config['new_thread_capt'])) ) {
$resp = file_get_contents($config['captcha']['provider_check'] . "?" . http_build_query([
'mode' => 'check',
'text' => $_POST['captcha_text'],

View File

@ -46,7 +46,8 @@
<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 %}Allow posters to post via the Tor onion router{% endtrans %}<br/><span class="unimportant">Disabling this is evil, but if you really care about "ban evasion", here you go.</span></th><td><input type="checkbox" name="tor_posting" {% if config.tor_posting %}checked{% endif %}></td></tr>
<tr><th>{% trans %}Enable CAPTCHA{% endtrans %}<br/><span class="unimportant">This is not ReCAPTCHA, it is custom to 8chan</span></th><td><input type="checkbox" name="captcha" {% if config.captcha.enabled %}checked{% endif %}></td></tr>
<tr><th>{% trans %}Enable CAPTCHA{% endtrans %}<br/><span class="unimportant">Users must solve a CAPTCHA in order to post.<br> This is not ReCAPTCHA, it is custom to 8chan.</span></th><td><input type="checkbox" name="captcha" {% if config.captcha.enabled %}checked{% endif %}></td></tr>
<tr><th>{% trans %}Enable CAPTCHA for thread creation only{% endtrans %}<br/><span class="unimportant">Users must solve a CAPTCHA in order to create new threads,<br>but do not have to solve a CAPTCHA in order to post replies.</span></th><td><input type="checkbox" name="new_thread_capt" {% if config.new_thread_capt %}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>

View File

@ -89,6 +89,17 @@
<script>load_captcha("{{ config.captcha.provider_get }}", "{{ config.captcha.extra }}");</script>
</td>
</tr>
{% elseif config.new_thread_capt %}
{% if not id %}
<tr class='captcha'>
<th>
{% trans %}Verification{% endtrans %}
</th>
<td>
<script>load_captcha("{{ config.captcha.provider_get }}", "{{ config.captcha.extra }}");</script>
</td>
</tr>
{% endif %}
{% endif %}
{% if config.user_flag %}