summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrick Brennan <admin@8chan.co>2014-04-30 17:18:44 -0400
committerFredrick Brennan <admin@8chan.co>2014-04-30 17:18:44 -0400
commitb1912ba86f933f40ef16d041621ef46b8a231e23 (patch)
tree2382d38431b9b5c44a942ef6968e4ae1bb5507c1
parent042e7b9c598975f876d8a86c8e4242dbf17f7bdf (diff)
parent0a53fdb3a248f5ddac58569a4400f5e2385287b7 (diff)
Merge branch 'staging' of https://github.com/vichan-devel/vichan into staging
-rw-r--r--inc/config.php17
-rw-r--r--post.php2
-rw-r--r--templates/themes/ukko/info.php19
-rw-r--r--templates/themes/ukko/theme.php15
-rw-r--r--templates/themes/ukko/ukko.js2
5 files changed, 37 insertions, 18 deletions
diff --git a/inc/config.php b/inc/config.php
index 9a1dd706..88db1db0 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -1526,6 +1526,23 @@
// // ...
// };
+ // You can also enable themes (like ukko) in mod panel like this:
+ // require_once("templates/themes/ukko/theme.php");
+ //
+ // $config['mod']['custom_pages']['/\*/'] = function() {
+ // global $mod;
+ //
+ // $ukko = new ukko();
+ // $ukko->settings = array();
+ // $ukko->settings['uri'] = '*';
+ // $ukko->settings['title'] = 'derp';
+ // $ukko->settings['subtitle'] = 'derpity';
+ // $ukko->settings['thread_limit'] = 15;
+ // $ukko->settings['exclude'] = '';
+ //
+ // echo $ukko->build($mod);
+ // };
+
// Example: Add links to dashboard (will all be in a new "Other" category).
// $config['mod']['dashboard_links']['Something'] = '?/something';
diff --git a/post.php b/post.php
index 48973b11..8ff99e31 100644
--- a/post.php
+++ b/post.php
@@ -222,7 +222,7 @@ if (isset($_POST['delete'])) {
}
if (!$post['mod']) {
- $post['antispam_hash'] = checkSpam(array($board['uri'], isset($post['thread']) && !($config['quick_reply'] && isset($_POST['quick-reply'])) ? $post['thread'] : ($config['try_smarter'] && isset($_POST['page']) ? 0 - (int)$_POST['page'] : null)));
+ $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']);
}
diff --git a/templates/themes/ukko/info.php b/templates/themes/ukko/info.php
index 34d59d4e..45a687fc 100644
--- a/templates/themes/ukko/info.php
+++ b/templates/themes/ukko/info.php
@@ -1,40 +1,41 @@
<?php
- $theme = Array();
+ $theme = array();
// Theme name
- $theme['name'] = 'Ukko';
+ $theme['name'] = 'Overboard (Ukko)';
// Description (you can use Tinyboard markup here)
$theme['description'] = 'Board with threads and messages from all boards';
- $theme['version'] = 'v0.1';
+ $theme['version'] = 'v0.2';
// Theme configuration
- $theme['config'] = Array();
+ $theme['config'] = array();
- $theme['config'][] = Array(
+ $theme['config'][] = array(
'title' => 'Board name',
'name' => 'title',
'type' => 'text',
'default' => 'Ukko'
);
- $theme['config'][] = Array(
+ $theme['config'][] = array(
'title' => 'Board URI',
'name' => 'uri',
'type' => 'text',
+ 'default' => '*',
'comment' => '(ukko for example)'
);
- $theme['config'][] = Array(
+ $theme['config'][] = array(
'title' => 'Subtitle',
'name' => 'subtitle',
'type' => 'text',
'comment' => '(%s = thread limit. for example "%s freshly bumped threads")'
);
- $theme['config'][] = Array(
+ $theme['config'][] = array(
'title' => 'Excluded boards',
'name' => 'exclude',
'type' => 'text',
'comment' => '(space seperated)'
);
- $theme['config'][] = Array(
+ $theme['config'][] = array(
'title' => 'Number of threads',
'name' => 'thread_limit',
'type' => 'text',
diff --git a/templates/themes/ukko/theme.php b/templates/themes/ukko/theme.php
index 88b0c4a4..b2624ed7 100644
--- a/templates/themes/ukko/theme.php
+++ b/templates/themes/ukko/theme.php
@@ -4,7 +4,9 @@
function ukko_build($action, $settings) {
$ukko = new ukko();
$ukko->settings = $settings;
- $ukko->build();
+
+ file_write($settings['uri'] . '/index.html', $ukko->build());
+ file_write($settings['uri'] . '/ukko.js', Element('themes/ukko/ukko.js', array()));
}
class ukko {
@@ -85,17 +87,16 @@
}
$body .= '<script> var overflow = ' . json_encode($overflow) . '</script>';
- $body .= '<script type="text/javascript" src="ukko.js"></script>';
+ $body .= '<script type="text/javascript" src="/'.$this->settings['uri'].'/ukko.js"></script>';
- file_write($this->settings['uri'] . '/index.html', Element('index.html', array(
+ return Element('index.html', array(
'config' => $config,
'board' => $board,
'no_post_form' => true,
'body' => $body,
- 'boardlist' => createBoardlist($mod)
- )));
-
- file_write($this->settings['uri'] . '/ukko.js', Element('themes/ukko/ukko.js', array()));
+ 'mod' => $mod,
+ 'boardlist' => createBoardlist($mod),
+ ));
}
};
diff --git a/templates/themes/ukko/ukko.js b/templates/themes/ukko/ukko.js
index 490f67f0..b2668e0b 100644
--- a/templates/themes/ukko/ukko.js
+++ b/templates/themes/ukko/ukko.js
@@ -58,7 +58,7 @@ $(document).ready(function() {
$('.pages').show().html(_("No more threads to display"));
}
while($(window).scrollTop() + $(window).height() + 1000 > $(document).height() && !loading && overflow.length > 0) {
- var page = '../' + overflow[0].board + '/' + overflow[0].page;
+ var page = modRoot + overflow[0].board + '/' + overflow[0].page;
thread = $('div#thread_' + overflow[0].id + '[data-board="' + overflow[0].board + '"]');
if (thread.length > 0 && thread.attr("data-cached") !== 'yes') { // already present
overflow.shift();