mirror of
https://github.com/ithrts/ImoutoIB.git
synced 2025-04-21 04:22:03 +02:00
sticky threads, lock, autosage, new icons
new thread status icons sticky threads now show up before the other threads, threads can now be set to sticky/locked/autosage and function as such, just missing mod panel to enable disable them.
This commit is contained in:
parent
406443ba79
commit
07ed52625d
26
LICENSE.md
26
LICENSE.md
@ -6,4 +6,28 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
All copyright notices and permission notices (including this file) shall be included and remain unedited in all copies or substantial portions of the Software. This explicitly includes but is not limited to the vichan copyright notices found in the footers of some template files.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
### Included Licenses:
|
||||
|
||||
#### Pin Icon:
|
||||
|
||||
Fugue icon set
|
||||
|
||||
Author: Yusuke Kamiyamane
|
||||
|
||||
https://creativecommons.org/licenses/by/3.0/
|
||||
|
||||
|
||||
Colors have been edited.
|
||||
|
||||
#### Lock and Anchor Icon:
|
||||
|
||||
Silk icon set
|
||||
|
||||
Author: Mark James
|
||||
|
||||
https://creativecommons.org/licenses/by/2.5/
|
||||
|
||||
Colors on Lock icon have been edited. Anchor is untouched.
|
@ -21,7 +21,7 @@ html[data-stylesheet="Kareha"] div#boardlist a, html[data-stylesheet="Kareha"] a
|
||||
color: blue;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Kareha"] div.post img {
|
||||
html[data-stylesheet="Kareha"] div.post .post-image img {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ html[data-stylesheet="Sankarea"] .link.name {
|
||||
color: #2e2eff;
|
||||
}
|
||||
|
||||
html[data-stylesheet="Sankarea"] div.post img {
|
||||
html[data-stylesheet="Sankarea"] div.post .post-image img {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
BIN
assets/img/anchor.png
Normal file
BIN
assets/img/anchor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 523 B |
BIN
assets/img/lock.png
Normal file
BIN
assets/img/lock.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 810 B |
BIN
assets/img/pin.png
Normal file
BIN
assets/img/pin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 496 B |
@ -26,7 +26,16 @@ $config['boards']['test'] = array(
|
||||
'title' => 'test',
|
||||
'description' => 'QA? I\'m not getting paid!!',
|
||||
'locked' => 0,
|
||||
'hidden' => 1,
|
||||
'hidden' => 0,
|
||||
'type' => 'img'
|
||||
);
|
||||
|
||||
$config['boards']['fresh'] = array(
|
||||
'url' => 'fresh',
|
||||
'title' => 'fresh',
|
||||
'description' => 'Checking board creation.',
|
||||
'locked' => 1,
|
||||
'hidden' => 0,
|
||||
'type' => 'img'
|
||||
);
|
||||
|
||||
|
@ -42,6 +42,10 @@ $thumb_download = 'download.png';
|
||||
$thumb_deleted = 'deleted.png';
|
||||
$spoiler_enabled = true;
|
||||
|
||||
$icon_locked = 'lock.png';
|
||||
$icon_autosage = 'anchor.png';
|
||||
$icon_sticky = 'pin.png';
|
||||
|
||||
$thumbnail_bg_red = 255; //rgb - yotsuba default, 238,242,255 for yotsuba b.
|
||||
$thumbnail_bg_green = 255; //can probably make a toggle for transparent png thumbnails
|
||||
$thumbnail_bg_blue = 238; //for those who dont mind bandwidth
|
||||
|
@ -157,12 +157,15 @@ function PostSuccess($redirect = false, $auto = true) {
|
||||
exit();
|
||||
}
|
||||
|
||||
function UpdateOP($database_folder, $board, $thread, $page, $replies, $bumped, $uniqueids) {
|
||||
function UpdateOP($database_folder, $board, $thread, $page, $replies, $bumped, $uniqueids, $sticky = false, $locked = false, $autosage = false) {
|
||||
$info_ = '<?php ';
|
||||
$info_ .= '$info_page' . '=' . '""' . ';';
|
||||
$info_ .= '$info_replies' . '=' . $replies . ';';
|
||||
$info_ .= '$info_bumped' . '=' . $bumped . ';';
|
||||
$info_ .= '$info_uniqueids' . '=' . $uniqueids . ';';
|
||||
$info_ .= '$info_sticky' . '=' . $sticky . ';';
|
||||
$info_ .= '$info_locked' . '=' . $locked . ';';
|
||||
$info_ .= '$info_autosage' . '=' . $autosage . ';';
|
||||
$info_ .= '?>';
|
||||
|
||||
file_put_contents(__dir__ . '/../' . $database_folder . '/boards/' . $board . '/' . $thread . '/' . 'info.php', $info_);
|
||||
@ -223,9 +226,13 @@ function UpdateThreads($database_folder, $board, $thread) {
|
||||
if (file_exists(__dir__ . '/../' . $database_folder . '/boards/' . $board . '/' . basename($thread_) . '/bumped.php')) {
|
||||
$bumped = file_get_contents(__dir__ . '/../' . $database_folder . '/boards/' . $board . '/' . basename($thread_) . '/bumped.php');
|
||||
}
|
||||
$sticky = file_get_contents(__dir__ . '/../' . $database_folder . '/boards/' . $board . '/' . basename($thread_) . '/info.php');
|
||||
$sticky = preg_match('/^.+info_sticky=1/i', $sticky);
|
||||
|
||||
$threads[$key] = [];
|
||||
$threads[$key]['id'] = $threadz;
|
||||
$threads[$key]['bumped'] = $bumped;
|
||||
$threads[$key]['sticky'] = $sticky;
|
||||
}
|
||||
$keys_ = array_column($threads, 'bumped');
|
||||
array_multisort($keys_, SORT_DESC, $threads);
|
||||
@ -236,6 +243,7 @@ function UpdateThreads($database_folder, $board, $thread) {
|
||||
foreach ($threads as $key => $value) {
|
||||
$threads_ .= '$threads["'.$key.'"]["id"] = "' . $threads[$key]['id'] . '";';
|
||||
$threads_ .= '$threads["'.$key.'"]["bumped"] = "' . $threads[$key]['bumped'] . '";';
|
||||
$threads_ .= '$threads["'.$key.'"]["sticky"] = "' . $threads[$key]['sticky'] . '";';
|
||||
}
|
||||
$threads_ .= ' ?>';
|
||||
|
||||
|
@ -25,12 +25,15 @@ $op_file = '';
|
||||
$new_thumbname = '';
|
||||
$thmb_res = '';
|
||||
|
||||
$info_locked = '';
|
||||
$info_sticky = '';
|
||||
$info_locked = 0;
|
||||
$info_sticky = 0;
|
||||
$info_autosage = 0;
|
||||
|
||||
$frontpage_uniqueids = 0;
|
||||
$frontpage_active = 0;
|
||||
|
||||
$pages = '';
|
||||
|
||||
if ($config['generated_in'] === true) {
|
||||
$start_time = microtime(true);
|
||||
}
|
||||
|
23
main.php
23
main.php
@ -88,10 +88,27 @@ if (in_Array(htmlspecialchars($_GET["board"]), $config['boardlist'])) {
|
||||
}
|
||||
|
||||
include __dir__ . '/' . $database_folder . '/boards/' . $current_board . '/threads.php';
|
||||
|
||||
//put stickies up front (not doing this in the saved list, if wanna have frontpage with recent threads)
|
||||
|
||||
//show max threads only
|
||||
//if page = 1
|
||||
$pages = '';
|
||||
$original_list = $threads;
|
||||
$filter = "1";
|
||||
$stick_ = array_filter($threads, function($var) use ($filter){ //get all sticky threads
|
||||
return ($var['sticky'] == $filter);
|
||||
});
|
||||
|
||||
$count_stickied_threads = count($stick_);
|
||||
|
||||
if ($count_stickied_threads > 0) {
|
||||
$keys_ = array_column($original_list, 'sticky');
|
||||
array_multisort($keys_, SORT_DESC, $original_list); //sort by sticky
|
||||
$stickied_threads = array_slice($original_list, 0, $count_stickied_threads); //this can be sorted again by oldest vs newest? i think is fine like this tho
|
||||
|
||||
$not_sticky_threads = array_slice($original_list, $count_stickied_threads); //get non stickies, then we sort them by bumped
|
||||
$keys_ = array_column($not_sticky_threads, 'bumped');
|
||||
array_multisort($keys_, SORT_DESC, $not_sticky_threads); //sort by bumped
|
||||
$threads = array_merge($stickied_threads, $not_sticky_threads);
|
||||
}
|
||||
|
||||
if (count($threads) > $threads_page) {
|
||||
$total_threads = count($threads);
|
||||
|
7
post.php
7
post.php
@ -191,7 +191,7 @@ if ((isset($post_board)) && (isset($_POST['index']))) {
|
||||
|
||||
//
|
||||
|
||||
UpdateOP($database_folder, $post_board, $current_count, 1, 0, $current_count, 1); //information about thread and replies
|
||||
UpdateOP($database_folder, $post_board, $current_count, 1, 0, $current_count, 1, $info_sticky, $info_locked, $info_autosage); //information about thread and replies
|
||||
UpdateThreads($database_folder, $post_board, $current_count); //update recents.php and board bumps.
|
||||
UpdateRecents($database_folder, $post_board, $current_count, $recent_replies);
|
||||
include __dir__ . '/includes/update-frontpage.php';
|
||||
@ -217,7 +217,7 @@ if ((isset($post_board)) && (isset($_POST['thread']))) {
|
||||
include __dir__ . '/includes/filehandler.php';
|
||||
$newcount = $counter + 1;
|
||||
//save it as last bumped if not sage tho
|
||||
if (!isset($_POST['sage'])) {
|
||||
if (!isset($_POST['sage']) && $info_autosage == 0) {
|
||||
file_put_contents(__dir__ . '/' . $database_folder . '/boards/' . $post_board . '/' . $post_thread_number . '/bumped.php', $counter);
|
||||
}
|
||||
//save it as last post number
|
||||
@ -267,7 +267,8 @@ if ((isset($post_board)) && (isset($_POST['thread']))) {
|
||||
$ip_counter = count(array_unique($ips_));
|
||||
|
||||
|
||||
UpdateOP($database_folder, $post_board, $post_thread_number, 0, $reply_counter, $current_count, $ip_counter);
|
||||
UpdateOP($database_folder, $post_board, $post_thread_number, 0, $reply_counter, $current_count, $ip_counter, $info_sticky, $info_locked, $info_autosage);
|
||||
UpdateThreads($database_folder, $post_board, $current_count); //update recents.php and board bumps.
|
||||
UpdateRecents($database_folder, $post_board, $post_thread_number, $recent_replies); //update recents.php and board bumps.
|
||||
include __dir__ . '/includes/update-frontpage.php';
|
||||
PostSuccess($prefix_folder . $main_file . '/?board=' . $post_board . '&thread=' . $post_thread_number . '#' . $current_count, true);
|
||||
|
@ -103,11 +103,14 @@
|
||||
<span class="post-number"><a name="<?php echo $post_number_op; ?>" href="<?php echo $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_op; ?>">No.</a><a href="<?php echo $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_op; ?>"><?php echo $post_number_op; ?></a></span>
|
||||
|
||||
<?php
|
||||
if ($info_locked == 1) {
|
||||
echo '<span title="Locked." class="icon"><img src="'. $prefix_folder .'/assets/img/locked.gif"/></span>';
|
||||
}
|
||||
if ($info_sticky == 1) {
|
||||
echo '<span title="Pinned." class="icon"><img src="'. $prefix_folder .'/assets/img/sticky.gif"/></span>';
|
||||
echo '<span title="Sticky" class="icon"><img src="'. $prefix_folder .'/assets/img/' . $icon_sticky . '"/></span>';
|
||||
}
|
||||
if ($info_locked == 1) {
|
||||
echo '<span title="Locked" class="icon"><img src="'. $prefix_folder .'/assets/img/' . $icon_locked . '"/></span>';
|
||||
}
|
||||
if ($info_autosage == 1) {
|
||||
echo '<span title="Autosage" class="icon"><img src="'. $prefix_folder .'/assets/img/' . $icon_autosage . '"/></span>';
|
||||
}
|
||||
?>
|
||||
|
||||
@ -160,6 +163,7 @@
|
||||
|
||||
<?php
|
||||
//reset stuff
|
||||
$info_locked = false;
|
||||
$info_sticky = false;
|
||||
$info_locked = 0;
|
||||
$info_sticky = 0;
|
||||
$info_autosage = 0;
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user