--- triplify-0.7/index.php 2009-10-30 19:30:48.000000000 +0100
+++ triplify-0.7.new/index.php 2009-11-19 18:17:06.000000000 +0100
@@ -17,8 +17,7 @@
if($_SERVER['REQUEST_URI']) {
$serverURI='http://'.$_SERVER['SERVER_NAME'].($_SERVER['SERVER_PORT']!=80?':'.$_SERVER['SERVER_PORT']:'');
- $baseURI=$serverURI.substr($_SERVER['REQUEST_URI'],0,strpos($_SERVER['REQUEST_URI'],'/triplify')+9).'/'.
- (in_array('mod_rewrite',apache_get_modules())?'':'index.php/');
+ $baseURI=$serverURI.substr($_SERVER['REQUEST_URI'],0,strpos($_SERVER['REQUEST_URI'],'/triplify')+9).'/';
$path=str_replace($baseURI,'',$serverURI.$_SERVER['REQUEST_URI'].(substr($_SERVER['REQUEST_URI'],-1,1)!='/'?'/':''));
} else {
ob_end_flush();
@@ -27,14 +28,16 @@
include($argv[1]);
$_SERVER['REQUEST_URI']=$baseURI=$triplify['namespaces']['base'];
$triplify['LinkedDataDepth']=0;
- $triplify['db']->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
+# $triplify['db']->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
}
+//print_r($path);
if($path) {
$r=array_filter(explode('/',$path));
$class=array_shift($r);
if($class!='update' && count($r)==1)
$instance=array_pop($r);
+ $exists=false;
foreach($triplify['queries'] as $key=>$val)
if(substr($key,0,1)=='/' && preg_match($key,$path))
$exists=true;
@@ -45,9 +47,9 @@
}
}
-if($_REQUEST['t-output']=='json')
- header('Content-Type: text/javascript');
-else #if(0)
+#if($_REQUEST['t-output']=='json')
+# header('Content-Type: text/javascript');
+#else #if(0)
header('Content-Type: text/rdf+n3');
$cacheFile=$triplify['cachedir'].md5($_SERVER['REQUEST_URI']);
@@ -68,7 +70,7 @@
ob_start();
$t->tripleize($triplify['queries'],$class,$instance);
-if($_REQUEST['t-output']=='json')
+if(isset($_REQUEST['t-output']) && $_REQUEST['t-output']=='json')
echo json_encode($t->json);
if($triplify['TTL'])
@@ -90,7 +92,7 @@
function tripleizer($config=array()) {
if(is_object($config['db'])) {
$this->pdo=$config['db'];
- $this->pdo->setAttribute(eval('return PDO::MYSQL_ATTR_USE_BUFFERED_QUERY;'),false);
+# $this->pdo->setAttribute(eval('return PDO::MYSQL_ATTR_USE_BUFFERED_QUERY;'),false);
}
$this->config=$config;
$this->ns=$config['namespaces'];
@@ -255,7 +257,7 @@
else
$written[$hash]=true;
}
- if($_REQUEST['t-output']=='json') {
+ if(isset($_REQUEST['t-output']) && ($_REQUEST['t-output']=='json')) {
$oa=array('value'=>$object,'type'=>($isLiteral?'literal':'uri'));
if($isLiteral && $dtype)
$oa['datatype']=$dtype;
|