Permalink
Browse files

refactoring how RDF content is stored on the server, or not

  • Loading branch information...
robstewart57 committed Nov 24, 2012
1 parent 740ff0b commit 61bcc761912f43244e9dcabe775a3230c951aa7a
Showing with 20 additions and 28 deletions.
  1. +1 −1 download-me.php
  2. +10 −0 downloadFile.php
  3. +5 −10 downloadRDF.php → downloadRDF-ToBrowserMemory.php
  4. +1 −8 publish-me.php
  5. +3 −9 visualize.php
View
@@ -56,7 +56,7 @@
<h3>Step 1 - Download the RDF file</h3>
<div class="centerButton">
- <form name="input" target="_blank" action="downloadRDF.php" method="post" >
+ <form name="input" target="_blank" action="downloadRDF-ToBrowserMemory.php" method="post" >
<input type="hidden" name="fileName" id="fileName" value="<?php echo $_POST['fileName']; ?>">
<input type="hidden" name="fileLoc" id="fileLoc" value="<?php echo $_POST['fileLoc']; ?>">
View
@@ -0,0 +1,10 @@
+<?php
+
+function saveToFile($rawRDF, $fileName) {
+ $myFile = "./rdf/" . $fileName;
+ $fh = fopen($myFile, 'w') or die("can't open file");
+ fwrite($fh, urldecode($rawRDF));
+ fclose($fh);
+}
+
+?>
@@ -1,8 +1,12 @@
<?php
+/* This file stores the specified RDF content temporarily
+ on the server, to be served to the browser, and is then
+ immediately removed from the server. Typical usage: "Download my RDF file" button */
error_reporting(E_ALL);
ini_set('display_errors', '1');
+include("downloadFile.php");
include("include/Serializer.php");
define("RDFAPI_INCLUDE_DIR", "include/rdfapi-php/api/");
include(RDFAPI_INCLUDE_DIR . "RdfAPI.php");
@@ -14,17 +18,8 @@
header("Content-Type: application/rdf+xml");
header("Content-Disposition: attachment; filename=" . $_POST['fileName']);
-function saveToFile($rawRDF, $fileName) {
-
- $myFile = "rdf/" . $fileName;
- $fh = fopen($myFile, 'w') or die("can't open file");
- fwrite($fh, urldecode($rawRDF));
- fclose($fh);
-}
-
saveToFile($_POST['rawRDF'], $_POST['fileName']);
-
readfile($_POST['fileLoc']);
-
unlink("rdf/" . $_POST['fileName']);
+
?>
View
@@ -47,18 +47,11 @@
<?php
+include("downloadFile.php");
include("readConf.php");
error_reporting(E_ALL);
$domain=getDomain("config.ini");
-function saveToFile($rawRDF, $fileName) {
-
- $myFile = "rdf/" . $fileName;
- $fh = fopen($myFile, 'w') or die("can't open file");
- fwrite($fh, urldecode($rawRDF));
- fclose($fh);
-}
-
saveToFile($_POST['rawRDF'], $_POST['fileName']);
$uri = $_POST['fileLoc'];
View
@@ -23,23 +23,17 @@
ini_set('display_errors', '1');
include("include/Serializer.php");
+include("downloadFile.php");
define("RDFAPI_INCLUDE_DIR", "include/rdfapi-php/api/");
include(RDFAPI_INCLUDE_DIR . "RdfAPI.php");
include(RDFAPI_INCLUDE_DIR . "syntax/RdfSerializer.php");
include( RDFAPI_INCLUDE_DIR . 'vocabulary/RDFS_C.php');
include( RDFAPI_INCLUDE_DIR . 'vocabulary/DC_C.php');
include( RDFAPI_INCLUDE_DIR . 'vocabulary/FOAF_C.php');
-
-function saveToFile($rawRDF,$fileName)
-{
- $myFile = "rdf/".$fileName;
- $fh = fopen($myFile, 'w') or die("can't open file");
- fwrite($fh, urldecode($rawRDF));
- fclose($fh);
-}
-
+/* From downloadFile.php */
saveToFile($_POST['rawRDF'],$_POST['fileName']);
+
$rdfURI=$_POST['fileLoc'];
$lodLiveURI="http://lodlive.it/en/?".$rdfURI;
header ("Location: ".$lodLiveURI);

0 comments on commit 61bcc76

Please sign in to comment.