diff --git a/README.md b/README.md index 5b3401a5..82d78944 100644 --- a/README.md +++ b/README.md @@ -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! diff --git a/inc/8chan-mod-pages.php b/inc/8chan-mod-pages.php index b87a97ae..92a1f2e0 100644 --- a/inc/8chan-mod-pages.php +++ b/inc/8chan-mod-pages.php @@ -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'); diff --git a/inc/config.php b/inc/config.php index 956395c9..42b40336 100644 --- a/inc/config.php +++ b/inc/config.php @@ -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? diff --git a/js/expand-video.js b/js/expand-video.js index 56fc3654..f268d550 100644 --- a/js/expand-video.js +++ b/js/expand-video.js @@ -356,4 +356,8 @@ onready(function(){ }); observer.observe(document.body, {childList: true, subtree: true}); } -}); \ No newline at end of file +<<<<<<< HEAD +}); +======= +}); +>>>>>>> 02708219d3aea65bffe40f6bc893e08dda1290ec diff --git a/js/quick-reply.js b/js/quick-reply.js index 48d7864e..c5738eec 100644 --- a/js/quick-reply.js +++ b/js/quick-reply.js @@ -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); diff --git a/post.php b/post.php index bb690b85..84736567 100644 --- a/post.php +++ b/post.php @@ -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'], diff --git a/templates/mod/settings.html b/templates/mod/settings.html index ce68ec41..47eb365b 100644 --- a/templates/mod/settings.html +++ b/templates/mod/settings.html @@ -45,7 +45,10 @@ {% trans %}Enable dice rolling{% endtrans %} {% trans %}Don't allow users to repost images{% endtrans %} {% trans %}Allow a poster to delete his own posts{% endtrans %} - {% trans %}Enable CAPTCHA{% endtrans %}
This is not ReCAPTCHA, it is custom to 8chan + + {% trans %}Enable CAPTCHA{% endtrans %}
Users must solve a CAPTCHA in order to post.
This is not ReCAPTCHA, it is custom to 8chan.
+ + {% trans %}Enable CAPTCHA for thread creation only{% endtrans %}
Users must solve a CAPTCHA in order to create new threads,
but do not have to solve a CAPTCHA in order to post replies.
{% trans %}Language{% endtrans %}
{% trans %}To contribute translations, register at Transifex{% endtrans %}