diff --git a/boards.php b/boards.php index 22a76816..ce6ac945 100644 --- a/boards.php +++ b/boards.php @@ -2,6 +2,8 @@ include "inc/functions.php"; include "inc/mod/auth.php"; +include "inc/countries.php"; + $admin = isset($mod["type"]) && $mod["type"]<=30; if (php_sapi_name() == 'fpm-fcgi' && !$admin) { @@ -9,31 +11,6 @@ if (php_sapi_name() == 'fpm-fcgi' && !$admin) { } $boards = listBoards(); -$body = << -th.header { - background-image: url(/static/bg.gif); - cursor: pointer; - background-repeat: no-repeat; - background-position: center right; - padding-left: 20px; - margin-left: -1px; -} -th.headerSortUp { - background-image: url(/static/asc.gif); -} -th.headerSortDown { - background-image: url(/static/desc.gif); -} -.flag-eo { - background-image: url(/static/eo.png); -} -.flag-en { - background-image: url(/static/en.png); -} - -CSS; -$body .= ''; $total_posts_hour = 0; $total_posts = 0; @@ -69,6 +46,7 @@ function ($a, $b) { }); $hidden_boards_total = 0; +$rows = array(); foreach ($boards as $i => &$board) { $board_config = @file_get_contents($board['uri'].'/config.php'); $boardCONFIG = array(); @@ -84,9 +62,10 @@ foreach ($boards as $i => &$board) { $locale_arr = explode('_', $locale); $locale_short = isset($locale_arr[1]) ? strtolower($locale_arr[1]) : strtolower($locale_arr[0]); $locale_short = str_replace('.utf-8', '', $locale_short); - if ($board['uri'] === 'int') {$locale_short = 'eo'; $locale = 'eo';} + $country = get_country($locale_short); + if ($board['uri'] === 'int') {$locale_short = 'eo'; $locale = 'eo'; $country = 'Esperanto';} - $img = "\"$locale\""; + $board['img'] = "\"$country\""; if ($showboard || $admin) { if (!$showboard) { @@ -95,58 +74,18 @@ foreach ($boards as $i => &$board) { $lock = ''; } $board['ago'] = human_time_diff(strtotime($board['time'])); - $body .= ""; - $body .= ""; - $body .= ""; - $body .= ""; - $body .= ""; - $body .= ""; - $body .= ""; } else { unset($boards[$i]); $hidden_boards_total += 1; } } -$body .= <<
LBoardBoard titlePosts in last hourTotal postsCreated
$img/{$board['uri']}/$lock{$board['title']}{$board['pph']}{$board['max']}{$board['time']} ({$board['ago']} ago)
-FOOTER; - $n_boards = sizeof($boards); $t_boards = $hidden_boards_total + $n_boards; -$body = "

There are currently {$n_boards} boards + $hidden_boards_total unindexed boards = $t_boards total boards. Site-wide, {$total_posts_hour} posts have been made in the last hour, with {$total_posts} being made on all active boards since October 23, 2013.

" . $body; - -//date_default_timezone_set('UTC'); -$body .= "

Page last updated: ".date('r')."

"; -$body .= "

".shell_exec('uptime -p')." without interruption

"; - $config['additional_javascript'] = array('js/jquery.min.js', 'js/jquery.tablesorter.min.js'); +$body = Element("8chan/boards.html", array("config" => $config, "n_boards" => $n_boards, "t_boards" => $t_boards, "hidden_boards_total" => $hidden_boards_total, "total_posts" => $total_posts, "total_posts_hour" => $total_posts_hour, "boards" => $boards, "last_update" => date('r'), "uptime_p" => shell_exec('uptime -p'))); + $html = Element("page.html", array("config" => $config, "body" => $body, "title" => "Boards on ∞chan")); if ($admin) { echo $html; diff --git a/create.php b/create.php index 41efa666..88f3952e 100644 --- a/create.php +++ b/create.php @@ -20,7 +20,7 @@ if (!isset($_POST['uri'], $_POST['title'], $_POST['subtitle'], $_POST['username' if (!$ayah){ $game_html = ''; } else { - $game_html = 'Game' . $ayah->getPublisherHTML() . ''; + $game_html = ''._('Game').'' . $ayah->getPublisherHTML() . ''; } if (!$cbRecaptcha){ @@ -32,25 +32,9 @@ if (!$cbRecaptcha){ $password = base64_encode(openssl_random_pseudo_bytes(9)); -$body = << - - - - - - - -{$game_html} -{$recapcha_html} - -
URI// (must be all lowercase or numbers and < 10 chars)
Title (must be < 40 chars)
Subtitle (must be < 200 chars)
Username (must contain only alphanumeric, periods and underscores)
Password (write this down)
- - +$body = Element("8chan/create.html", array("config" => $config, "password" => $password, "game_html" => $game_html, "recapcha_html" => $recapcha_html)); -EOT; - -echo Element("page.html", array("config" => $config, "body" => $body, "title" => "Create your board", "subtitle" => "before someone else does")); +echo Element("page.html", array("config" => $config, "body" => $body, "title" => _("Create your board"), "subtitle" => _("before someone else does"))); } else { @@ -77,30 +61,30 @@ $score = true; $score = $ayah->scoreResult(); } if (!$score) - error('You failed the game'); + error(_('You failed the game')); if (!$passedCaptcha) - error('You failed to enter the reCaptcha correctly'); + error(_('You failed to enter the reCaptcha correctly')); if (!preg_match('/^[a-z0-9]{1,10}$/', $uri)) - error('Invalid URI'); + error(_('Invalid URI')); if (!(strlen($title) < 40)) - error('Invalid title'); + error(_('Invalid title')); if (!(strlen($subtitle) < 200)) - error('Invalid subtitle'); + error(_('Invalid subtitle')); if (!preg_match('/^[a-zA-Z0-9._]{1,30}$/', $username)) - error('Invalid username'); + error(_('Invalid username')); foreach (listBoards() as $i => $board) { if ($board['uri'] == $uri) - error('Board already exists!'); + error(_('Board already exists!')); } foreach ($bannedWords as $i => $w) { if ($w[0] !== '/') { if (strpos($uri,$w) !== false) - error("Cannot create board with banned word $w"); + error(_("Cannot create board with banned word $w")); } else { if (preg_match($w,$uri)) - error("Cannot create board matching banned pattern $w"); + error(_("Cannot create board matching banned pattern $w")); } } $query = prepare('SELECT ``username`` FROM ``mods`` WHERE ``username`` = :username'); @@ -109,7 +93,7 @@ $query->execute() or error(db_error($query)); $users = $query->fetchAll(PDO::FETCH_ASSOC); if (sizeof($users) > 0){ -error('The username you\'ve tried to enter already exists!'); +error(_('The username you\'ve tried to enter already exists!')); } $salt = generate_salt(); @@ -142,20 +126,14 @@ buildIndex(); rebuildThemes('boards'); -query("INSERT INTO ``board_create``(uri) VALUES('$uri')") or error(db_error()); +$query = prepare("INSERT INTO ``board_create``(uri) VALUES(:uri)"); +$query->bindValue(':uri', $uri); +$query->execute() or error(db_error()); _syslog(LOG_NOTICE, "New board: $uri"); -$body = << $config, "password" => $_POST['password'], "uri" => $uri)); -

Your new board is created and is live at /{$uri}/.

- -

Make sure you don't forget your password, {$_POST['password']}!

- -

You can manage your board at http://8chan.co/mod.php?/.

- -EOT; - -echo Element("page.html", array("config" => $config, "body" => $body, "title" => "Success", "subtitle" => "This was a triumph")); +echo Element("page.html", array("config" => $config, "body" => $body, "title" => _("Success"), "subtitle" => _("This was a triumph"))); } ?> diff --git a/inc/config.php b/inc/config.php index 3905f198..0d66f72d 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1136,6 +1136,8 @@ // This is a particularly advanced feature - contact ctrlcctrlv or rails unless you // really know what you're doing $config['dir']['img_root'] = ''; + // DO NOT COMMENT OUT, LEAVE BLANK AND OVERRIDE IN INSTANCE CONFIG + // Though, you shouldnt be editing this file, so what do I know? // For load balancing, having a seperate server (and domain/subdomain) for serving static content is diff --git a/inc/countries.php b/inc/countries.php new file mode 100644 index 00000000..e9e0fd60 --- /dev/null +++ b/inc/countries.php @@ -0,0 +1,29 @@ +fetchColumn()) { + while (true) { + $board = $query->fetchColumn(); + if ($board === FALSE) break; $boards[] = $board; } } diff --git a/inc/instance-config.php b/inc/instance-config.php index 1f12d16c..7ab9dfdc 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -22,6 +22,9 @@ $config['cookies']['mod'] = 'mod'; $config['cookies']['salt'] = ''; + $config['spam']['hidden_inputs_max_pass'] = 128; + $config['spam']['hidden_inputs_expire'] = 60 * 60 * 4; // three hours + $config['flood_time'] = 5; $config['flood_time_ip'] = 2; $config['flood_time_same'] = 2; @@ -41,6 +44,8 @@ $config['allow_no_country'] = true; $config['thread_subject_in_title'] = true; $config['spam']['hidden_inputs_max_pass'] = 128; + $config['ayah_enabled'] = true; + $config['dnsbl'] = array(); include "secrets.php"; @@ -92,17 +97,14 @@ $config['additional_javascript'][] = 'js/favorites.js'; $config['additional_javascript'][] = 'js/show-op.js'; $config['additional_javascript'][] = 'js/hide-threads.js'; - $config['additional_javascript'][] = 'js/mobile-style.js'; $config['additional_javascript'][] = 'js/smartphone-spoiler.js'; $config['additional_javascript'][] = 'js/inline-expanding.js'; $config['additional_javascript'][] = 'js/show-backlinks.js'; - $config['additional_javascript'][] = 'js/catalog-link.js'; $config['additional_javascript'][] = 'js/webm-settings.js'; $config['additional_javascript'][] = 'js/expand-video.js'; $config['additional_javascript'][] = 'js/treeview.js'; $config['additional_javascript'][] = 'js/quick-post-controls.js'; $config['additional_javascript'][] = 'js/expand-too-long.js'; - //$config['additional_javascript'][] = 'js/auto-reload.js'; $config['additional_javascript'][] = 'js/settings.js'; $config['additional_javascript'][] = 'js/fix-report-delete-submit.js'; $config['additional_javascript'][] = 'js/hide-images.js'; @@ -118,7 +120,7 @@ $config['additional_javascript'][] = 'js/forced-anon.js'; $config['additional_javascript'][] = 'js/toggle-locked-threads.js'; $config['additional_javascript'][] = 'js/toggle-images.js'; - $config['additional_javascript'][] = 'js/threadscroll.js'; + $config['additional_javascript'][] = 'js/mobile-style.js'; $config['font_awesome_css'] = '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css'; @@ -388,3 +390,5 @@ EOT; ); $config['gzip_static'] = false; + +require_once "dnsbls.php"; diff --git a/inc/secrets.php b/inc/secrets.php deleted file mode 100644 index b5d51a7c..00000000 --- a/inc/secrets.php +++ /dev/null @@ -1,4 +0,0 @@ - +include 'inc/functions.php'; - - - - - ∞chan - - - - - -
- -
- - - -
- Welcome to ∞chan, the infinitely expanding imageboard. -
- Featured boards: - [ v / a / tg / fit / pol / tech / mu / co / sp / boards ] -
-
- - - -
- - - -
-
-

On ∞chan, you can create your own imageboard for free with no experience or programming knowledge needed. As long as the admin logs in once per week and it gets one new post every 72 hours, the board will be hosted forever.

- -
- - - -
-
- -
- - - - -
- - - - - +echo Element("8chan/index.html", array("config" => $config)); diff --git a/js/image-hover.js b/js/image-hover.js index c752a2cf..18662c0a 100644 --- a/js/image-hover.js +++ b/js/image-hover.js @@ -24,12 +24,22 @@ $(document).ready(function(){ imageHover = !imageHover; var imageEnter = function(){ + if (!imageHover) return; + //don't hover-image if image expanded + if ($(this).parent().attr("data-expanded") == "true") + return; + mouseexitedImage = false; mouseisOnImage = false; - + //remove hover-image if user clicks on image to expand it + $(this).click(function(){ + mouseexitedImage = false; + mouseisOnImage = false; + $("#hover-image").remove(); + }); isVideo = (($(this).prop("tagName") == "VIDEO") ? true:($(this).parent().attr("href").indexOf("player.php?v=") > -1) ? true:false); maxWidth = document.body.offsetWidth-(document.body.offsetWidth * 0.25); maxHeight = document.documentElement.clientHeight; @@ -78,7 +88,7 @@ $(document).ready(function(){ $mrCheckie = $('
'); - $(".options_tab").append($mrCheckie); + $(".options_tab:first").append($mrCheckie); $("#toggle-hover").prop("checked", imageHover); $("#toggle-hover").on("click", function(){ if ($(this).prop("checked")){ @@ -90,7 +100,7 @@ $(document).ready(function(){ } }); - $(".options_tab").append(); + $(document).on("new_post", function(e, post) { $(post).hover(imageEnter(),imageLeave()); diff --git a/post.php b/post.php index 87b53fc6..b8996fac 100644 --- a/post.php +++ b/post.php @@ -239,11 +239,11 @@ if (isset($_POST['delete'])) { error($config['error']['noaccess']); } - if (!$post['mod']) { + /*if (!$post['mod']) { $post['antispam_hash'] = checkSpam(array($board['uri'], isset($post['thread']) ? $post['thread'] : ($config['try_smarter'] && isset($_POST['page']) ? 0 - (int)$_POST['page'] : null))); if ($post['antispam_hash'] === true) error($config['error']['spam']); - } + }*/ if ($config['robot_enable'] && $config['robot_mute']) { checkMute(); diff --git a/random.php b/random.php index f930d073..08102b02 100644 --- a/random.php +++ b/random.php @@ -2,9 +2,7 @@ include "inc/functions.php"; -$boards = listBoards(true); +$boards = listBoards(TRUE); $board = array_rand($boards); - header('Location: /'.$boards[$board]); - ?> diff --git a/templates/8chan/boards.html b/templates/8chan/boards.html new file mode 100644 index 00000000..3e7c402d --- /dev/null +++ b/templates/8chan/boards.html @@ -0,0 +1,55 @@ + + +

{% trans %}There are currently {{n_boards}} boards + {{hidden_boards_total}} unindexed boards = {{t_boards}} total boards. Site-wide, {{total_posts_hour}} posts have been made in the last hour, with {{total_posts}} being made on all active boards since October 23, 2013.{% endtrans %}

+ + +{% for board in boards %} + + + + + + + +{% endfor %} +
L{% trans %}Board{% endtrans %}{% trans %}Board title{% endtrans %}{% trans %}Posts in last hour{% endtrans %}{% trans %}Total posts{% endtrans %}{% trans %}Created{% endtrans %}
{{ board.img|raw }}/{{board['uri']}}/{{lock|raw}}{{ board['title'] }}{{board['pph']}}{{board['max']}}{{board['time']}} ({{board['ago']}} ago)
+

Page last updated: {{last_update}}

+

{{uptime_p}} without interruption

+ + diff --git a/templates/8chan/create.html b/templates/8chan/create.html new file mode 100644 index 00000000..668d165a --- /dev/null +++ b/templates/8chan/create.html @@ -0,0 +1,15 @@ +
+ + + + + + + +{{ game_html }} +{{ recapcha_html }} + +
URI// {% trans %}(must be all lowercase or numbers and < 10 chars){% endtrans %}
Title {% trans %}(must be < 40 chars){% endtrans %}
Subtitle {% trans %}(must be < 200 chars){% endtrans %}
{% trans %}Username{% endtrans %} {% trans %}(must contain only alphanumeric, periods and underscores){% endtrans %}
{% trans %}Password{% endtrans %} {% trans %}(write this down){% endtrans %}
+
+
+ diff --git a/templates/8chan/create_success.html b/templates/8chan/create_success.html new file mode 100644 index 00000000..b129787c --- /dev/null +++ b/templates/8chan/create_success.html @@ -0,0 +1,5 @@ +

{% trans %}Your new board is created and is live at{% endtrans %} /{{ uri }}/.

+ +

{% trans %}Make sure you don't forget your password, {{ password }}!{% endtrans %}

+ +

{% trans %}You can manage your board at http://8chan.co/mod.php?/.{% endtrans %}

diff --git a/templates/8chan/index.html b/templates/8chan/index.html new file mode 100644 index 00000000..54ceae28 --- /dev/null +++ b/templates/8chan/index.html @@ -0,0 +1,311 @@ + + + + + ∞chan + + + + + +
+ +
+ + + +
+ {% trans %}Welcome to ∞chan, the infinitely expanding imageboard.{% endtrans %} +
+ {% trans %}Featured boards:{% endtrans %} + [ v / a / tg / fit / pol / tech / mu / co / sp / boards ] +
+
+ + + +
+ + + +
+
+

{% trans %}On ∞chan, you can create your own imageboard for free with no experience or programming knowledge needed. As long as the admin logs in once per week and it gets one new post every 72 hours, the board will be hosted forever.{% endtrans %}

+ +
+ + + +
+
+ +
+ + + + diff --git a/templates/index.html b/templates/index.html index 178c1ed0..be3c8711 100644 --- a/templates/index.html +++ b/templates/index.html @@ -31,6 +31,7 @@ {% endif %} {% endif %} {% if mod %}

{% trans %}Return to dashboard{% endtrans %}

{% endif %} +

Catalog