From f28c061efccd78f15413be1e9eb6c59a5eac2a21 Mon Sep 17 00:00:00 2001 From: Neil Townsend Date: Thu, 14 May 2015 11:16:29 +0100 Subject: [PATCH] See comments in #248 --- Superfecta.class.php | 12 ++++++++---- includes/superfecta_base.php | 8 ++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) mode change 100644 => 100755 Superfecta.class.php mode change 100644 => 100755 includes/superfecta_base.php diff --git a/Superfecta.class.php b/Superfecta.class.php old mode 100644 new mode 100755 index c8d9dc8c..9363a889 --- a/Superfecta.class.php +++ b/Superfecta.class.php @@ -88,9 +88,11 @@ public function execute($scheme='ALL', $request, $debug=0, $keepGoing=false) { include __DIR__ . '/includes/processors/superfecta_multi.php'; include __DIR__ . '/includes/processors/superfecta_single.php'; + + global $db, $amp_conf, $astman; $options = array( - 'db' => $db, + 'db' => $this->db, 'amp_conf' => $amp_conf, 'astman' => $astman, 'debug' => 0, @@ -453,10 +455,12 @@ public function ajaxHandler() { $scheme = $_REQUEST['scheme']; $source = $_REQUEST['source']; + $sql = "REPLACE INTO superfectaconfig (source,field,value) VALUES (?, ?, ?)"; + $sth = $this->db->prepare($sql); foreach($params as $key => $data) { - $sql = "REPLACE INTO superfectaconfig (source,field,value) VALUES (?, ?, ?)"; - $sth = $this->db->prepare($sql); - $sth->execute(array($scheme . "_" . $source, $key, $_POST[$key])); + if (strcmp($data['type'], 'internal') != 0) { + $sth->execute(array($scheme . "_" . $source, $key, $_POST[$key])); + } } return array("status" => true); break; diff --git a/includes/superfecta_base.php b/includes/superfecta_base.php old mode 100644 new mode 100755 index dcb6786f..2cb0290f --- a/includes/superfecta_base.php +++ b/includes/superfecta_base.php @@ -158,6 +158,14 @@ function settings() { return($settings); } + function updateParameter($param_name, $new_value) { + $source = str_replace("base_", "", $_REQUEST['scheme']) . "_" . get_class($this); + $sql = "REPLACE INTO superfectaconfig (source,field,value) VALUES (?, ?, ?)"; + $sth = $this->db->prepare($sql); + $sth->execute(array($source, $param_name, $new_value)); + return true; + } + function out($message) { if ($this->isDebug()) { if (!$this->cli) {