diff --git a/core/imageboard/image.php b/core/imageboard/image.php index 2aafc217..49457c4f 100644 --- a/core/imageboard/image.php +++ b/core/imageboard/image.php @@ -405,7 +405,7 @@ class Image implements \ArrayAccess $image_link = make_link($image_link); } $chosen = $image_link; - } elseif ($config->get_bool('nice_urls', false)) { + } elseif ($config->get_bool(SetupConfig::NICE_URLS, false)) { $chosen = make_link($nice); } else { $chosen = make_link($plain); diff --git a/core/tests/UrlsTest.php b/core/tests/UrlsTest.php index bc92e987..59853363 100644 --- a/core/tests/UrlsTest.php +++ b/core/tests/UrlsTest.php @@ -33,7 +33,7 @@ class UrlsTest extends TestCase global $config; foreach([true, false] as $nice_urls) { - $config->set_bool('nice_urls', $nice_urls); + $config->set_bool(SetupConfig::NICE_URLS, $nice_urls); $this->assertEquals( ["bar", "foo"], @@ -55,7 +55,7 @@ class UrlsTest extends TestCase { global $config; foreach([true, false] as $nice_urls) { - $config->set_bool('nice_urls', $nice_urls); + $config->set_bool(SetupConfig::NICE_URLS, $nice_urls); // basic $this->assertEquals( @@ -94,7 +94,7 @@ class UrlsTest extends TestCase { global $config; foreach([true, false] as $nice_urls) { - $config->set_bool('nice_urls', $nice_urls); + $config->set_bool(SetupConfig::NICE_URLS, $nice_urls); $this->assertEquals( $nice_urls ? "/test/post/list/bar%20foo/1" : "/test/index.php?q=post/list/bar%20foo/1", @@ -267,7 +267,7 @@ class UrlsTest extends TestCase public function tearDown(): void { global $config; - $config->set_bool('nice_urls', true); + $config->set_bool(SetupConfig::NICE_URLS, true); parent::tearDown(); } } diff --git a/core/urls.php b/core/urls.php index f43e08fa..b6ecca4d 100644 --- a/core/urls.php +++ b/core/urls.php @@ -55,7 +55,7 @@ function make_link(?string $page = null, ?string $query = null, ?string $fragmen $parts = []; $install_dir = get_base_href(); - if (SPEED_HAX || $config->get_bool('nice_urls', false)) { + if (SPEED_HAX || $config->get_bool(SetupConfig::NICE_URLS, false)) { $parts['path'] = "$install_dir/$page"; } else { $parts['path'] = "$install_dir/index.php"; diff --git a/ext/setup/config.php b/ext/setup/config.php index b9439f48..bcf0b580 100644 --- a/ext/setup/config.php +++ b/ext/setup/config.php @@ -12,4 +12,5 @@ class SetupConfig public const THEME = "theme"; public const WORD_WRAP = "word_wrap"; public const COMMENT_CAPTCHA = "comment_captcha"; + public const NICE_URLS = "nice_urls"; } diff --git a/ext/setup/main.php b/ext/setup/main.php index 04410707..bb8d2f37 100644 --- a/ext/setup/main.php +++ b/ext/setup/main.php @@ -369,7 +369,7 @@ class Setup extends Extension $sb->add_text_option("contact_link", "
Contact URL: "); $sb->add_choice_option(SetupConfig::THEME, $themes, "
Theme: "); //$sb->add_multichoice_option("testarray", array("a" => "b", "c" => "d"), "
Test Array: "); - $sb->add_bool_option("nice_urls", "
Nice URLs: "); + $sb->add_bool_option(SetupConfig::NICE_URLS, "
Nice URLs: "); $sb->add_label("(Javascript inactive, can't test!)"); $sb = $event->panel->create_new_block("Remote API Integration"); diff --git a/ext/upload/theme.php b/ext/upload/theme.php index 9ffb6c74..aa2710e3 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -161,7 +161,7 @@ class UploadTheme extends Themelet $title = $config->get_string(SetupConfig::TITLE); $max_size = $config->get_int(UploadConfig::SIZE); $max_kb = to_shorthand_int($max_size); - $delimiter = $config->get_bool('nice_urls') ? '?' : '&'; + $delimiter = $config->get_bool(SetupConfig::NICE_URLS) ? '?' : '&'; $js = 'javascript:( function() {