From 5d41ee10fc09e17174437661e0748c3f99f4ae20 Mon Sep 17 00:00:00 2001
From: alvaro <alvaro@alia.(none)>
Date: Mon, 6 Feb 2012 10:06:26 -0800
Subject: [PATCH] Fixed error in Endpoint class

---
 classes/Endpoint.php | 105 +++++++++++++++++++++----------------------
 1 file changed, 52 insertions(+), 53 deletions(-)

diff --git a/classes/Endpoint.php b/classes/Endpoint.php
index 1bd8f34b..b9d7b6fb 100644
--- a/classes/Endpoint.php
+++ b/classes/Endpoint.php
@@ -9,59 +9,58 @@ class Endpoint{
   	$this->params = $params;
   }
   
-   public function query($q, $output = 'json'){
-        global $conf;
-        $auxoutput = $this->params['output'];
-        $accept = 'application/sparql-results+json';
-        if($output != null){
-          $this->params['output'] = $output;
-        }
-
-        if($output == 'xml'){
-          $accept = 'application/sparql-results+xml';
-        }elseif($output == 'rdf'){
-          $accept = 'application/rdf+xml';
-        }
-        $c = curl_init();
-        $context = array();
-        $context[0] = 'Connection: close';
-        $context[1] = 'Accept: '.$accept;
-        $params = $this->params;
-        $params['query'] = $q;
-        $url = $this->sparqlUrl.'?'.http_build_query($params, '', '&');
-        curl_setopt($c, CURLOPT_URL, $url);
-        curl_setopt($c, CURLOPT_HTTPHEADER, $context);
-        curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
-        $aux = curl_exec($c); // execute the curl command 
-        if($conf['debug']){
-          if($aux == false){
-          	trigger_error("Error executing SPARQL query: ".curl_error($c), E_USER_ERROR);
-          	echo("Error executing SPARQL query: ".curl_error($c));
-          }
-        }
-        curl_close($c);
-        $this->params['output'] = $auxoutput;
-        if(preg_match("/select/i", $q)){
-          $r = json_decode($aux, true);
-          if($conf['debug']){
-          	if($r == false){
-          	  trigger_error("Warning: Results from a SELECT sparql query couldn't get parsed", E_USER_WARNING);
-          	  echo("Warning: Results from a SELECT sparql query couldn't get parsed");
-          	}
-          }
-        }
-          return $r;
-        }
-        if(preg_match("/describe/i", $q)){
-          return $aux;
-        }
-        if(preg_match("/construct/i", $q)){
-          return $aux;
-        }
-        if(preg_match("/ask/i", $q)){
-          $r = json_decode($aux, true);
-          return $r;
-        }
+  public function query($q, $output = 'json'){
+  	global $conf;
+  	$auxoutput = $this->params['output'];
+  	$accept = 'application/sparql-results+json';
+  	if($output != null){
+  	  $this->params['output'] = $output;
+  	}
+  	
+  	if($output == 'xml'){
+  	  $accept = 'application/sparql-results+xml';
+  	}elseif($output == 'rdf'){
+  	  $accept = 'application/rdf+xml';
+  	}
+  	$c = curl_init();
+  	$context = array();
+  	$context[0] = 'Connection: close';
+  	$context[1] = 'Accept: '.$accept;
+  	$params = $this->params;
+  	$params['query'] = $q;
+  	$url = $this->sparqlUrl.'?'.http_build_query($params, '', '&');
+  	curl_setopt($c, CURLOPT_URL, $url);
+  	curl_setopt($c, CURLOPT_HTTPHEADER, $context);
+  	curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
+  	$aux = curl_exec($c); // execute the curl command 
+  	if($conf['debug']){
+  	  if($aux == false){
+  	  	trigger_error("Error executing SPARQL query: ".curl_error($c), E_USER_ERROR);
+  	  	echo("Error executing SPARQL query: ".curl_error($c));
+  	  }
+  	}
+  	curl_close($c);
+  	$this->params['output'] = $auxoutput;
+  	if(preg_match("/select/i", $q)){
+  	  $r = json_decode($aux, true);
+  	  if($conf['debug']){
+  	  	if($r == false){
+  	  	  trigger_error("Warning: Results from a SELECT sparql query couldn't get parsed", E_USER_WARNING);
+  	  	  echo("Warning: Results from a SELECT sparql query couldn't get parsed");
+  	  	}
+  	  }
+  	  return $r;
+  	}
+  	if(preg_match("/describe/i", $q)){
+  	  return $aux;
+  	}
+  	if(preg_match("/construct/i", $q)){
+  	  return $aux;
+  	}
+  	if(preg_match("/ask/i", $q)){
+  	  $r = json_decode($aux, true);
+  	  return $r;
+  	}
   }
   
   public function queryPost($q){
-- 
GitLab