summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorFredrick Brennan <admin@8chan.co>2015-04-03 14:56:28 +0800
committerczaks <marcin@6irc.net>2016-05-06 16:39:20 +0200
commit505adffcdca1c1141b7b46f862b7939f2f4acf45 (patch)
tree114147c8a811183561a227cce875140bc4ac364e /inc
parentab02a4272514410fc053ced9c17a26bc0c8f1cf4 (diff)
Cyclical threads ♺
Diffstat (limited to 'inc')
-rw-r--r--inc/api.php1
-rw-r--r--inc/config.php5
-rwxr-xr-xinc/functions.php8
-rw-r--r--inc/mod/pages.php22
4 files changed, 35 insertions, 1 deletions
diff --git a/inc/api.php b/inc/api.php
index b2d8adec..b280c25b 100644
--- a/inc/api.php
+++ b/inc/api.php
@@ -32,6 +32,7 @@ class Api {
'images' => 'images',
'sticky' => 'sticky',
'locked' => 'locked',
+ 'cycle' => 'cyclical',
'bump' => 'last_modified',
'embed' => 'embed',
);
diff --git a/inc/config.php b/inc/config.php
index 3fdb8d2f..82fdc882 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -1245,6 +1245,8 @@
$config['mod']['link_bumpunlock'] = '[-Sage]';
$config['mod']['link_editpost'] = '[Edit]';
$config['mod']['link_move'] = '[Move]';
+ $config['mod']['link_cycle'] = '[Cycle]';
+ $config['mod']['link_uncycle'] = '[-Cycle]';
// Moderator capcodes.
$config['capcode'] = ' <span class="capcode">## %s</span>';
@@ -1388,6 +1390,9 @@
$config['mod']['deletebyip_global'] = ADMIN;
// Sticky a thread
$config['mod']['sticky'] = MOD;
+ // Cycle a thread
+ $config['mod']['cycle'] = MOD;
+ $config['cycle_limit'] = &$config['reply_limit'];
// Lock a thread
$config['mod']['lock'] = MOD;
// Post in a locked thread
diff --git a/inc/functions.php b/inc/functions.php
index e9692d56..1bd1f32f 100755
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -1021,7 +1021,7 @@ function insertFloodPost(array $post) {
function post(array $post) {
global $pdo, $board;
- $query = prepare(sprintf("INSERT INTO ``posts_%s`` VALUES ( NULL, :thread, :subject, :email, :name, :trip, :capcode, :body, :body_nomarkup, :time, :time, :files, :num_files, :filehash, :password, :ip, :sticky, :locked, 0, :embed, :slug)", $board['uri']));
+ $query = prepare(sprintf("INSERT INTO ``posts_%s`` VALUES ( NULL, :thread, :subject, :email, :name, :trip, :capcode, :body, :body_nomarkup, :time, :time, :files, :num_files, :filehash, :password, :ip, :sticky, :locked, :cycle, 0, :embed, :slug)", $board['uri']));
// Basic stuff
if (!empty($post['subject'])) {
@@ -1061,6 +1061,12 @@ function post(array $post) {
$query->bindValue(':locked', false, PDO::PARAM_INT);
}
+ if ($post['op'] && $post['mod'] && isset($post['cycle']) && $post['cycle']) {
+ $query->bindValue(':cycle', true, PDO::PARAM_INT);
+ } else {
+ $query->bindValue(':cycle', false, PDO::PARAM_INT);
+ }
+
if ($post['mod'] && isset($post['capcode']) && $post['capcode']) {
$query->bindValue(':capcode', $post['capcode'], PDO::PARAM_INT);
} else {
diff --git a/inc/mod/pages.php b/inc/mod/pages.php
index 6d1e20b4..303fa3dd 100644
--- a/inc/mod/pages.php
+++ b/inc/mod/pages.php
@@ -1089,6 +1089,28 @@ function mod_sticky($board, $unsticky, $post) {
header('Location: ?/' . sprintf($config['board_path'], $board) . $config['file_index'], true, $config['redirect_http']);
}
+function mod_cycle($board, $uncycle, $post) {
+ global $config;
+
+ if (!openBoard($board))
+ error($config['error']['noboard']);
+
+ if (!hasPermission($config['mod']['cycle'], $board))
+ error($config['error']['noaccess']);
+
+ $query = prepare(sprintf('UPDATE ``posts_%s`` SET `cycle` = :cycle WHERE `id` = :id AND `thread` IS NULL', $board));
+ $query->bindValue(':id', $post);
+ $query->bindValue(':cycle', $uncycle ? 0 : 1);
+ $query->execute() or error(db_error($query));
+ if ($query->rowCount()) {
+ modLog(($uncycle ? 'Made not cyclical' : 'Made cyclical') . " thread #{$post}");
+ buildThread($post);
+ buildIndex();
+ }
+
+ header('Location: ?/' . sprintf($config['board_path'], $board) . $config['file_index'], true, $config['redirect_http']);
+}
+
function mod_bumplock($board, $unbumplock, $post) {
global $config;