From 1b4067a552476330b13d6613356f7fd21685c7a8 Mon Sep 17 00:00:00 2001 From: Stikki Date: Fri, 29 May 2015 14:23:12 -0500 Subject: [PATCH] Using API input array instead of PHP native to grab template ID from request --- Pages2JSON.module | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Pages2JSON.module b/Pages2JSON.module index ce67fbb..06461c0 100755 --- a/Pages2JSON.module +++ b/Pages2JSON.module @@ -149,16 +149,14 @@ class Pages2JSON extends WireData implements Module, ConfigurableModule protected function JSONTabActions($event) { - $id = -1; - if(isset($_POST['id'])) { - $id = (int)$_POST['id']; - } else { - $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; - } + // Grab current tempalte id + $id = $this->input->id ? $this->input->id : -1; + // Load template or fatal $template = $this->templates->get($id); if(!$template) throw new WireException("Unknown template"); + // Set data $var = $this->input->post('json_fields'); $template->set('jsonFields', $var); }