From 79ce40abd008b5cb7da2e06c3e43efdb4a7d4d3a Mon Sep 17 00:00:00 2001 From: Shish Date: Fri, 9 Mar 2012 18:14:14 +0000 Subject: [PATCH] less code --- core/util.inc.php | 3 +++ ext/view/main.php | 7 +------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/core/util.inc.php b/core/util.inc.php index 904b569d..a873bb1b 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -34,6 +34,9 @@ function int_escape($input) { * @retval string */ function url_escape($input) { + if(is_null($input)) { + return ""; + } $input = str_replace('^', '^^', $input); $input = str_replace('/', '^s', $input); $input = str_replace('\\', '^b', $input); diff --git a/ext/view/main.php b/ext/view/main.php index ef872288..2a1911c9 100644 --- a/ext/view/main.php +++ b/ext/view/main.php @@ -133,12 +133,7 @@ class ViewImage extends Extension { send_event(new ImageInfoSetEvent(Image::by_id($image_id))); $page->set_mode("redirect"); - if(isset($_POST['query'])) { - $page->set_redirect(make_link("post/view/$image_id", url_escape($_POST['query']))); - } - else { - $page->set_redirect(make_link("post/view/$image_id")); - } + $page->set_redirect(make_link("post/view/$image_id", url_escape(@$_POST['query']))); } }