diff --git a/core/image.class.php b/core/image.class.php index 2127f708..915d4364 100644 --- a/core/image.class.php +++ b/core/image.class.php @@ -148,7 +148,16 @@ class Image { } public function get_image_link() { - return $this->parse_link_template($this->config->get_string('image_ilink')); + $c = $this->config; + if(strlen($c->get_string('image_ilink')) > 0) { + return $this->parse_link_template($c->get_string('image_ilink')); + } + else if($c->get_bool('nice_urls', false)) { + return $this->parse_link_template('$base/_images/$hash/$id - $tags.$ext'); + } + else { + return $this->parse_link_template('image/$id.$ext'); + } } public function get_short_link() { @@ -156,7 +165,16 @@ class Image { } public function get_thumb_link() { - return $this->parse_link_template($this->config->get_string('image_tlink')); + $c = $this->config; + if(strlen($c->get_string('image_tlink')) > 0) { + return $this->parse_link_template($c->get_string('image_tlink')); + } + else if($c->get_bool('nice_urls', false)) { + return $this->parse_link_template('$base/_thumbs/$hash/$id.jpg'); + } + else { + return $this->parse_link_template('image/$id.$ext'); + } } public function get_tooltip() { diff --git a/core/util.inc.php b/core/util.inc.php index 3e262087..98d8bf1e 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -97,7 +97,13 @@ function make_link($page=null, $query=null) { if(is_null($page)) $page = $config->get_string('main_page'); - $base = $config->get_string('base_href'); + if($config->get_bool('nice_urls', false)) { + $full = "http://" . $_SERVER["SERVER_NAME"] . $_SERVER["PHP_SELF"]; + $base = str_replace("/index.php", "", $full); + } + else { + $base = "./index.php?q="; + } if(is_null($query)) { return "$base/$page"; diff --git a/ext/image/main.php b/ext/image/main.php index 08ffa86a..507073b3 100644 --- a/ext/image/main.php +++ b/ext/image/main.php @@ -11,10 +11,10 @@ class ImageIO implements Extension { $config->set_default_int('thumb_width', 192); $config->set_default_int('thumb_height', 192); $config->set_default_int('thumb_quality', 75); - $config->set_default_int('thumb_mem_limit', '8MB'); + $config->set_default_int('thumb_mem_limit', parse_shorthand_int('8MB')); - $config->set_default_string('image_ilink', '$base/image/$id.$ext'); - $config->set_default_string('image_tlink', '$base/thumb/$id.jpg'); + $config->set_default_string('image_ilink', ''); + $config->set_default_string('image_tlink', ''); $config->set_default_string('image_tip', '$tags // $size // $filesize'); $config->set_default_string('upload_collision_handler', 'error'); } @@ -46,9 +46,10 @@ class ImageIO implements Extension { if($event instanceof SetupBuildingEvent) { $sb = new SetupBlock("Image Options"); $sb->position = 30; - $sb->add_text_option("image_ilink", "Image link: "); - $sb->add_text_option("image_tlink", "
Thumbnail link: "); - $sb->add_text_option("image_tip", "
Image tooltip: "); + // advanced only + //$sb->add_text_option("image_ilink", "Image link: "); + //$sb->add_text_option("image_tlink", "
Thumbnail link: "); + $sb->add_text_option("image_tip", "Image tooltip: "); $sb->add_choice_option("upload_collision_handler", array('Error'=>'error', 'Merge'=>'merge'), "
Upload collision handler: "); $event->panel->add_block($sb); diff --git a/ext/setup/main.php b/ext/setup/main.php index dfe75e61..5085f49b 100644 --- a/ext/setup/main.php +++ b/ext/setup/main.php @@ -137,6 +137,11 @@ class Setup implements Extension { $config->set_default_string("theme", "default"); } + if(($event instanceof PageRequestEvent) && $event->page_matches("nicetest")) { + $event->page->set_mode("data"); + $event->page->set_data("ok"); + } + if(($event instanceof PageRequestEvent) && $event->page_matches("setup")) { global $user; if(!$user->is_admin()) { @@ -171,14 +176,47 @@ class Setup implements Extension { $themes[ucfirst($name)] = $name; } + $full = "http://" . $_SERVER["SERVER_NAME"] . $_SERVER["PHP_SELF"]; + $test_url = str_replace("/index.php", "/nicetest", $full); + + $nicescript = ""; $sb = new SetupBlock("General"); $sb->position = 0; $sb->add_text_option("title", "Site title: "); $sb->add_text_option("front_page", "
Front page: "); $sb->add_text_option("main_page", "
Main page: "); - $sb->add_text_option("base_href", "
Base URL: "); $sb->add_text_option("contact_link", "
Contact URL: "); $sb->add_choice_option("theme", $themes, "
Theme: "); + $sb->add_bool_option("nice_urls", "
Nice URLs: "); + $sb->add_label("(Javascript inactive, can't test!)$nicescript"); $event->panel->add_block($sb); }