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