From 47b096159b3e276031ec058b687398a9c131dcc4 Mon Sep 17 00:00:00 2001 From: 8n-tech <8n-tech@users.noreply.github.com> Date: Mon, 20 Apr 2015 21:19:08 +1000 Subject: [PATCH 1/2] Dead file. --- inc/countries.php | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 inc/countries.php diff --git a/inc/countries.php b/inc/countries.php deleted file mode 100644 index 1e732f06..00000000 --- a/inc/countries.php +++ /dev/null @@ -1,31 +0,0 @@ - Date: Tue, 21 Apr 2015 01:39:44 +1000 Subject: [PATCH 2/2] Javascript ammendments, dio_ on Windows. #475 - Fixed both issues. Signed-off-by: 8n-tech <8n-tech@users.noreply.github.com> --- inc/functions.php | 70 +++++++++++++++++--------- js/fix-report-delete-submit.js | 12 +++-- js/infinite-scroll.js | 89 +++++++++++++++++----------------- js/post-filter.js | 9 +++- js/post-menu.js | 6 ++- stylesheets/style.css | 13 ++--- 6 files changed, 120 insertions(+), 79 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 242e9610..7116b168 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -640,29 +640,55 @@ function file_write($path, $data, $simple = false, $skip_purge = false) { error('Invalid remote server: ' . $m[1]); } } - - if (!$fp = dio_open($path, O_WRONLY | O_CREAT, 0644)) - error('Unable to open file for writing: ' . $path); - - // File locking - if (dio_fcntl($fp, F_SETLKW, array('type' => F_WRLCK)) === -1) { - error('Unable to lock file: ' . $path); + + if (!function_exists("dio_truncate")) { + if (!$fp = fopen($path, $simple ? 'w' : 'c')) + error('Unable to open file for writing: ' . $path); + + // File locking + if (!$simple && !flock($fp, LOCK_EX)) + error('Unable to lock file: ' . $path); + + // Truncate file + if (!$simple && !ftruncate($fp, 0)) + error('Unable to truncate file: ' . $path); + + // Write data + if (($bytes = fwrite($fp, $data)) === false) + error('Unable to write to file: ' . $path); + + // Unlock + if (!$simple) + flock($fp, LOCK_UN); + + // Close + if (!fclose($fp)) + error('Unable to close file: ' . $path); } - - // Truncate file - if (!dio_truncate($fp, 0)) - error('Unable to truncate file: ' . $path); - - // Write data - if (($bytes = dio_write($fp, $data)) === false) - error('Unable to write to file: ' . $path); - - // Unlock - dio_fcntl($fp, F_SETLK, array('type' => F_UNLCK)); - - // Close - dio_close($fp); - + else { + if (!$fp = dio_open($path, O_WRONLY | O_CREAT, 0644)) + error('Unable to open file for writing: ' . $path); + + // File locking + if (dio_fcntl($fp, F_SETLKW, array('type' => F_WRLCK)) === -1) { + error('Unable to lock file: ' . $path); + } + + // Truncate file + if (!dio_truncate($fp, 0)) + error('Unable to truncate file: ' . $path); + + // Write data + if (($bytes = dio_write($fp, $data)) === false) + error('Unable to write to file: ' . $path); + + // Unlock + dio_fcntl($fp, F_SETLK, array('type' => F_UNLCK)); + + // Close + dio_close($fp); + } + /** * Create gzipped file. * diff --git a/js/fix-report-delete-submit.js b/js/fix-report-delete-submit.js index 47a04f16..01785974 100644 --- a/js/fix-report-delete-submit.js +++ b/js/fix-report-delete-submit.js @@ -9,9 +9,10 @@ */ if (active_page == 'thread' || active_page == 'index') { -$(document).ready(function(){ - +$(document).on('menu_ready', function(){ + if ($('#delete-fields #password').length) { + var Menu = window.Menu; Menu.add_item("delete_post_menu", _("Delete post")); Menu.add_item("delete_file_menu", _("Delete file")); Menu.onclick(function(e, $buf) { @@ -57,4 +58,9 @@ $(document).on('new_post', function(){ }); $('input.delete').hide(); $('#post-moderation-fields').hide(); -})} +}); + +if (typeof window.Menu !== "undefined") { + $(document).trigger('menu_ready'); +} +} diff --git a/js/infinite-scroll.js b/js/infinite-scroll.js index e212f9d6..b3c5c7ae 100644 --- a/js/infinite-scroll.js +++ b/js/infinite-scroll.js @@ -21,7 +21,7 @@ var activate = function() { if (document.location.hash != '#all') return false; $(window).on("scroll", function() { - scrolltest(); + scrolltest(); }); scrolltest(); @@ -30,53 +30,54 @@ var activate = function() { var scrolltest = function() { if ($(window).scrollTop() + $(window).height() + 1000 > $(document).height() && !loading) { - load_next_page(); + load_next_page(); } }; var load_next_page = function() { - if (loading) return; - loading = true; - - var this_page = $(".pages a.selected:last"); - var next_page = this_page.next(); - - var href = next_page.prop("href"); - if (!href) return; - - var boardheader = $('