db =& JFactory :: getDBO(); $this -> log =& JLog :: getInstance(); } public function getServiceUrl($key) { $this -> db -> setQuery('SELECT `value` FROM `#__openaire` WHERE `key` = \'' . $key . '\''); $serviceUrl = $this -> db -> loadResult(); if ($serviceUrl === NULL) $this -> log -> addEntry(array('level' => 'error', 'comment' => "Error retrieving service URL for $key:" . $this -> db -> getErrorMsg() . ' (' . $this -> db -> getErrorNum() . ')')); else $this -> log -> addEntry(array('level' => 'info', 'comment' => "Service URL for $key is $serviceUrl")); return $serviceUrl; } public function setServiceUrl($serviceUrl, $key) { $this -> db -> setQuery('UPDATE `#__openaire` SET `value` = ' . $this -> db -> quote($serviceUrl) . ' WHERE `key` = \'' . $key . '\''); if ($this -> db -> query() === FALSE) $this -> log -> addEntry(array('level' => 'error', 'comment' => "Error setting service URL for $key to $serviceUrl: " . $this -> db -> getErrorMsg() . ' (' . $this -> db -> getErrorNum() . ')')); else $this -> log -> addEntry(array('level' => 'info', 'comment' => "Set service URL for $key to $serviceUrl")); } } ?>