summaryrefslogtreecommitdiff
path: root/inc/mod
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/mod
parentab02a4272514410fc053ced9c17a26bc0c8f1cf4 (diff)
Cyclical threads ♺
Diffstat (limited to 'inc/mod')
-rw-r--r--inc/mod/pages.php22
1 files changed, 22 insertions, 0 deletions
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;