1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-02-20 20:51:50 +01:00
This commit is contained in:
anonish 2015-02-08 21:37:18 -06:00
commit b7a6f6419f
8 changed files with 74 additions and 11 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

@ -408,6 +408,8 @@ FLAGS;
$user_flags = isset($_POST['user_flags']) ? "if (file_exists('$b/flags.php')) { include 'flags.php'; }\n" : '';
$captcha = isset($_POST['captcha']) ? 'true' : 'false';
$force_subject_op = isset($_POST['force_subject_op']) ? 'true' : 'false';
/*New thread captcha*/
$new_thread_capt = isset($_POST['new_thread_capt']) ? 'true' : 'false';
@ -502,6 +504,8 @@ OEKAKI;
\$config['default_stylesheet'] = array('Custom', \$config['stylesheets']['Custom']);
\$config['captcha']['enabled'] = $captcha;
\$config['force_subject_op'] = $force_subject_op;
/*New thread captcha*/
\$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'])
@ -573,6 +577,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']
@ -593,7 +598,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

@ -356,4 +356,8 @@ onready(function(){
});
observer.observe(document.body, {childList: true, subtree: true});
}
});
<<<<<<< HEAD
});
=======
});
>>>>>>> 02708219d3aea65bffe40f6bc893e08dda1290ec

View File

@ -115,7 +115,7 @@
#quick-reply td.recaptcha-response {\
padding: 0 0 1px 0;\
}\
@media screen and (max-width: 600px) {\
@media screen and (max-width: 400px) {\
#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() <= 600)
if ($(this).width() <= 400)
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() <= 600)
if ($(this).width() <= 400)
return;
show_quick_reply();
if (with_link) {
@ -446,7 +446,7 @@
$('.quick-reply-btn').hide();
$(window).scroll(function() {
if ($(this).width() <= 600)
if ($(this).width() <= 400)
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

@ -45,7 +45,10 @@
<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 %}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>
<!--Added explanation to clarify purpose of "Enable CAPTCHA" now that "Enable CAPTCHA for new thread creation only" also exists-->
<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>
<!--New thread captcha start-->
<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 %}