From ebfcf9389eda93590c049fe6c6d9da471e0799de Mon Sep 17 00:00:00 2001 From: Daku Date: Mon, 10 Aug 2015 00:45:06 +0100 Subject: [PATCH 1/5] using links as block title doesn't play nice with .js, so specify ID blocks use title as ID, which will break if the title is a link --- ext/pools/theme.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/pools/theme.php b/ext/pools/theme.php index 9d43a070..2decb2df 100644 --- a/ext/pools/theme.php +++ b/ext/pools/theme.php @@ -143,7 +143,7 @@ class PoolsTheme extends Themelet {
Pool Changes '; - $page->add_block(new Block($nav_html, null, "left", 5)); + $page->add_block(new Block($nav_html, null, "left", 5, "indexnavleft")); $page->add_block(new Block("Pool Navigation", $poolnav_html, "left", 10)); if(count($pools) == 1) { From ef6a7289bb778aa79c9cc7908b3f5310e70a608c Mon Sep 17 00:00:00 2001 From: Daku Date: Wed, 12 Aug 2015 06:11:21 +0100 Subject: [PATCH 2/5] if alias is negative and has multiple tags, make sure each tag becomes negative --- core/imageboard.pack.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index b07c2f3c..3bee9ef3 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -1168,6 +1168,7 @@ class Tag { */ public static function resolve_alias($tag) { assert('is_string($tag)'); + global $database; $negative = false; if(!empty($tag) && ($tag[0] == '-')) { @@ -1175,14 +1176,18 @@ class Tag { $tag = substr($tag, 1); } - global $database; + $newtag = $database->get_one( $database->scoreql_to_sql("SELECT newtag FROM aliases WHERE SCORE_STRNORM(oldtag)=SCORE_STRNORM(:tag)"), - array("tag"=>$tag)); + array("tag"=>$tag) + ); + if(empty($newtag)) { + //tag has no alias, use old tag $newtag = $tag; } - return $negative ? "-$newtag" : $newtag; + + return !$negative ? $newtag : preg_replace("/(\S+)/", "-$1", $newtag); } /** From b2d8b4138866fcd0f93278ea51fe40504b3df414 Mon Sep 17 00:00:00 2001 From: Daku Date: Wed, 12 Aug 2015 06:12:53 +0100 Subject: [PATCH 3/5] spaces > tabs --- core/util.inc.php | 56 +++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/core/util.inc.php b/core/util.inc.php index b05cc5d0..ec291222 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -1257,39 +1257,39 @@ function full_copy($source, $target) { * @return array file list */ function list_files(/*string*/ $base, $_sub_dir="") { - assert(is_dir($base)); + assert(is_dir($base)); - $file_list = array(); + $file_list = array(); - $files = array(); - $dir = opendir("$base/$_sub_dir"); - while($f = readdir($dir)) { - $files[] = $f; - } - closedir($dir); - sort($files); + $files = array(); + $dir = opendir("$base/$_sub_dir"); + while($f = readdir($dir)) { + $files[] = $f; + } + closedir($dir); + sort($files); - foreach($files as $filename) { - $full_path = "$base/$_sub_dir/$filename"; + foreach($files as $filename) { + $full_path = "$base/$_sub_dir/$filename"; - if(is_link($full_path)) { - // ignore - } - else if(is_dir($full_path)) { - if($filename == "." || $filename == "..") { - $file_list = array_merge( - $file_list, - list_files($base, "$_sub_dir/$filename") - ); - } - } - else { - $full_path = str_replace("//", "/", $full_path); - $file_list[] = $full_path; - } - } + if(is_link($full_path)) { + // ignore + } + else if(is_dir($full_path)) { + if($filename == "." || $filename == "..") { + $file_list = array_merge( + $file_list, + list_files($base, "$_sub_dir/$filename") + ); + } + } + else { + $full_path = str_replace("//", "/", $full_path); + $file_list[] = $full_path; + } + } - return $file_list; + return $file_list; } From 9490e4aae2db793437cd4ba887543a00bff60e9b Mon Sep 17 00:00:00 2001 From: Daku Date: Wed, 12 Aug 2015 06:43:38 +0100 Subject: [PATCH 4/5] fix endless loop when checking for subdirectory is there any reason why this was only checking for "." & ".." ? --- core/util.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/util.inc.php b/core/util.inc.php index ec291222..f30b6ff8 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -1276,7 +1276,8 @@ function list_files(/*string*/ $base, $_sub_dir="") { // ignore } else if(is_dir($full_path)) { - if($filename == "." || $filename == "..") { + if(!($filename == "." || $filename == "..")) { + //subdirectory found $file_list = array_merge( $file_list, list_files($base, "$_sub_dir/$filename") From a55306f4bee92d9be3927a0f997d510ae82d1cc1 Mon Sep 17 00:00:00 2001 From: Daku Date: Wed, 12 Aug 2015 06:58:44 +0100 Subject: [PATCH 5/5] don't throw no handler error if empty directory / directory doesn't exist --- ext/bulk_add/main.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/bulk_add/main.php b/ext/bulk_add/main.php index 5af9051b..c0c0a50c 100644 --- a/ext/bulk_add/main.php +++ b/ext/bulk_add/main.php @@ -24,6 +24,12 @@ class BulkAdd extends Extension { $list = add_dir($_POST['dir']); if(strlen($list) > 0) { $this->theme->add_status("Adding files", $list); + } else { + if(is_dir($_POST['dir'])) { + $this->theme->add_status("No files in directory", "No files exists in specified directory ({$_POST['dir']})."); + } else { + $this->theme->add_status("Directory does not exist", "Specified directory does not exist ({$_POST['dir']})."); + } } $this->theme->display_upload_results($page); }