From d602477cf80542e1564ee042a3f1070ee6a451bc Mon Sep 17 00:00:00 2001
From: Zach Bloomquist <zrbq@live.com>
Date: Mon, 16 Nov 2015 17:24:49 -0500
Subject: [PATCH] Moving $_GET['topicId'] code in to existing conditional

---
 include/client/open.inc.php | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/client/open.inc.php b/include/client/open.inc.php
index 53e0743e1..ea0a100e7 100644
--- a/include/client/open.inc.php
+++ b/include/client/open.inc.php
@@ -9,12 +9,13 @@ if($thisclient && $thisclient->isValid()) {
 
 $info=($_POST && $errors)?Format::htmlchars($_POST):$info;
 
-if(array_key_exists('topicId',$_GET) && preg_match('/^\d+$/',$_GET['topicId']))
-    $info['topicId'] = intval($_GET['topicId']);
-
 $form = null;
-if (!$info['topicId'])
-    $info['topicId'] = $cfg->getDefaultTopicId();
+if (!$info['topicId']) {
+    if (array_key_exists('topicId',$_GET) && preg_match('/^\d+$/',$_GET['topicId']) && Topic::lookup($_GET['topicId']))
+        $info['topicId'] = intval($_GET['topicId']);
+    else
+        $info['topicId'] = $cfg->getDefaultTopicId();
+}
 
 if ($info['topicId'] && ($topic=Topic::lookup($info['topicId']))) {
     $form = $topic->getForm();
-- 
GitLab