aboutsummaryrefslogtreecommitdiff
path: root/www/api
diff options
context:
space:
mode:
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2010-03-17 20:11:21 +0000
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2010-03-17 20:11:21 +0000
commit4d3d00ade282e27b765a64c86f6607f1a92af2c0 (patch)
tree8d2bcb843c408552a870db4116fd7986db5ebb43 /www/api
parentdb7a46b23530724cf1a8d356de3ac4f1fe0d5ac7 (diff)
downloadsemanticscuttle-4d3d00ade282e27b765a64c86f6607f1a92af2c0.tar.gz
semanticscuttle-4d3d00ade282e27b765a64c86f6607f1a92af2c0.tar.bz2
Fix bug #2960663: do not send content-type headers twice for ajax/api scripts
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@690 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'www/api')
-rw-r--r--www/api/export_csv.php8
-rw-r--r--www/api/export_gcs.php5
-rw-r--r--www/api/export_sioc.php2
-rw-r--r--www/api/opensearch.php2
-rw-r--r--www/api/posts_add.php5
-rw-r--r--www/api/posts_all.php5
-rw-r--r--www/api/posts_dates.php2
-rw-r--r--www/api/posts_delete.php5
-rw-r--r--www/api/posts_get.php2
-rw-r--r--www/api/posts_public.php2
-rw-r--r--www/api/posts_recent.php2
-rw-r--r--www/api/posts_update.php5
-rw-r--r--www/api/tags_get.php5
-rw-r--r--www/api/tags_rename.php5
14 files changed, 24 insertions, 31 deletions
diff --git a/www/api/export_csv.php b/www/api/export_csv.php
index 3f63692..b9cf497 100644
--- a/www/api/export_csv.php
+++ b/www/api/export_csv.php
@@ -2,8 +2,9 @@
// Export in CSV format in order to allow the import into a spreadsheet tool like Excel
// Force HTTP authentication first!
-require_once('httpauth.inc.php');
-require_once '../www-header.php';
+$httpContentType = 'application/csv-tab-delimited-table';
+require_once 'httpauth.inc.php';
+header("Content-disposition: filename=exportBookmarks.csv");
/* Service creation: only useful services are created */
$bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
@@ -17,9 +18,6 @@ else
// Get the posts relevant to the passed-in variables.
$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag, NULL, getSortOrder());
-header("Content-Type: application/csv-tab-delimited-table;charset=UTF-8");
-header("Content-disposition: filename=exportBookmarks.csv");
-
//columns titles
echo 'url;title;tags;description';
echo "\n";
diff --git a/www/api/export_gcs.php b/www/api/export_gcs.php
index 07bc726..9c0d85c 100644
--- a/www/api/export_gcs.php
+++ b/www/api/export_gcs.php
@@ -5,6 +5,7 @@
// Force HTTP authentication first!
//require_once('httpauth.inc.php');
+$httpContentType = false;
require_once '../www-header.php';
if($GLOBALS['enableGoogleCustomSearch'] == false) {
@@ -39,7 +40,7 @@ $bookmarks =& $bookmarkservice->getBookmarks(0, NULL, NULL, $tag, NULL, getSortO
// Set up the plain file and output all the posts.
-header('Content-Type: text/plain');
+header('Content-Type: text/plain; charset=utf-8');
if(!$xml) {
header('Content-Type: text/plain');
foreach($bookmarks['bookmarks'] as $row) {
@@ -48,7 +49,7 @@ if(!$xml) {
}
}
} else {
- header('Content-Type: application/xml');
+ header('Content-Type: text/xml');
echo '<GoogleCustomizations>'."\n";
echo ' <Annotations>'."\n";
foreach($bookmarks['bookmarks'] as $row) {
diff --git a/www/api/export_sioc.php b/www/api/export_sioc.php
index ff1d1c0..8bdfd70 100644
--- a/www/api/export_sioc.php
+++ b/www/api/export_sioc.php
@@ -1,8 +1,8 @@
<?php
/* Export data with semantic format (SIOC: http://sioc-project.org/, FOAF, SKOS, Annotea Ontology) */
+$httpContentType = 'text/xml';
require_once '../www-header.php';
-header('Content-Type: text/xml; charset=utf-8'); //we change headers html defined in headers.inc.php
/* Service creation: only useful services are created */
$userservice =SemanticScuttle_Service_Factory::get('User');
diff --git a/www/api/opensearch.php b/www/api/opensearch.php
index 68d094c..db95639 100644
--- a/www/api/opensearch.php
+++ b/www/api/opensearch.php
@@ -1,6 +1,6 @@
<?php
+$httpContentType = 'text/xml';
require_once '../www-header.php';
-header("Content-type: text/xml");
?>
<?xml version="1.0" encoding="utf-8" ?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
diff --git a/www/api/posts_add.php b/www/api/posts_add.php
index c919ee7..59f7dce 100644
--- a/www/api/posts_add.php
+++ b/www/api/posts_add.php
@@ -11,8 +11,8 @@
// - No support for 'replace' variable
// Force HTTP authentication
-require_once('httpauth.inc.php');
-require_once '../www-header.php';
+$httpContentType = 'text/xml';
+require_once 'httpauth.inc.php';
/* Service creation: only useful services are created */
$bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
@@ -82,7 +82,6 @@ if (is_null($url) || is_null($description)) {
}
// Set up the XML file and output the result.
-header('Content-Type: text/xml');
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
echo '<result code="'. ($added ? 'done' : 'something went wrong') .'" />';
?> \ No newline at end of file
diff --git a/www/api/posts_all.php b/www/api/posts_all.php
index f53f363..2d274f4 100644
--- a/www/api/posts_all.php
+++ b/www/api/posts_all.php
@@ -5,8 +5,8 @@
// - doesn't include the filtered tag as an attribute on the root element (we do)
// Force HTTP authentication first!
-require_once('httpauth.inc.php');
-require_once '../www-header.php';
+$httpContentType = 'text/xml';
+require_once 'httpauth.inc.php';
/* Service creation: only useful services are created */
$bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
@@ -22,7 +22,6 @@ else
$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag);
// Set up the XML file and output all the posts.
-header('Content-Type: text/xml');
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
echo '<posts update="'. gmdate('Y-m-d\TH:i:s\Z') .'" user="'. htmlspecialchars($currentUser->getUsername()) .'"'. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') .">\r\n";
diff --git a/www/api/posts_dates.php b/www/api/posts_dates.php
index 7b1240f..508c46a 100644
--- a/www/api/posts_dates.php
+++ b/www/api/posts_dates.php
@@ -17,6 +17,7 @@
*/
// Force HTTP authentication first!
+$httpContentType = 'text/xml';
require_once 'httpauth.inc.php';
/* Service creation: only useful services are created */
@@ -36,7 +37,6 @@ $bookmarks = $bookmarkservice->getBookmarks(
);
// Set up the XML file and output all the tags.
-header('Content-Type: text/xml');
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
echo '<dates tag="'. (is_null($tag) ? '' : filter($tag, 'xml')) .'" user="'. filter($currentUser->getUsername(), 'xml') ."\">\r\n";
diff --git a/www/api/posts_delete.php b/www/api/posts_delete.php
index 88e2584..a63cc62 100644
--- a/www/api/posts_delete.php
+++ b/www/api/posts_delete.php
@@ -7,8 +7,8 @@
// - doesn't set the Content-Type to text/xml (we do).
// Force HTTP authentication first!
-require_once('httpauth.inc.php');
-require_once '../www-header.php';
+$httpContentType = 'text/xml';
+require_once 'httpauth.inc.php';
/* Service creation: only useful services are created */
$bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
@@ -28,7 +28,6 @@ if (is_null($_REQUEST['url'])) {
}
// Set up the XML file and output the result.
-header('Content-Type: text/xml');
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
echo '<result code="'. ($deleted ? 'done' : 'something went wrong') .'" />';
?> \ No newline at end of file
diff --git a/www/api/posts_get.php b/www/api/posts_get.php
index b020f51..c20f904 100644
--- a/www/api/posts_get.php
+++ b/www/api/posts_get.php
@@ -25,6 +25,7 @@
*/
// Force HTTP authentication first!
+$httpContentType = 'text/xml';
require_once 'httpauth.inc.php';
/* Service creation: only useful services are created */
@@ -54,7 +55,6 @@ $bookmarks = $bookmarkservice->getBookmarks(
// Set up the XML file and output all the tags.
-header('Content-Type: text/xml');
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
echo '<posts'. (is_null($dtstart) ? '' : ' dt="'. $dtstart .'"') .' tag="'. (is_null($tag) ? '' : filter($tag, 'xml')) .'" user="'. filter($currentUser->getUsername(), 'xml') ."\">\r\n";
diff --git a/www/api/posts_public.php b/www/api/posts_public.php
index 0c93ca2..4258550 100644
--- a/www/api/posts_public.php
+++ b/www/api/posts_public.php
@@ -6,6 +6,7 @@
// Force HTTP authentication first!
//require_once('httpauth.inc.php');
+$httpContentType = 'text/xml';
require_once '../www-header.php';
/* Service creation: only useful services are created */
@@ -22,7 +23,6 @@ else
$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, NULL, $tag);
// Set up the XML file and output all the posts.
-header('Content-Type: text/xml');
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
echo '<posts update="'. gmdate('Y-m-d\TH:i:s\Z') .'" '. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') .">\r\n";
diff --git a/www/api/posts_recent.php b/www/api/posts_recent.php
index 46e46f1..6c71e22 100644
--- a/www/api/posts_recent.php
+++ b/www/api/posts_recent.php
@@ -22,6 +22,7 @@ $countDefault = 15;
$countMax = 100;
// Force HTTP authentication first!
+$httpContentType = 'text/xml';
require_once 'httpauth.inc.php';
/* Service creation: only useful services are created */
@@ -54,7 +55,6 @@ $bookmarks = $bookmarkservice->getBookmarks(
// Set up the XML file and output all the tags.
-header('Content-Type: text/xml');
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
echo '<posts tag="'. (is_null($tag) ? '' : filter($tag, 'xml')) .'" user="'. filter($currentUser->getUsername(), 'xml') ."\">\r\n";
diff --git a/www/api/posts_update.php b/www/api/posts_update.php
index 9152f26..4aeedc3 100644
--- a/www/api/posts_update.php
+++ b/www/api/posts_update.php
@@ -5,8 +5,8 @@
// - doesn't set the Content-Type to text/xml (we do).
// Force HTTP authentication first!
-require_once('httpauth.inc.php');
-require_once '../www-header.php';
+$httpContentType = 'text/xml';
+require_once 'httpauth.inc.php';
/* Service creation: only useful services are created */
$bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
@@ -17,7 +17,6 @@ $bookmarks =& $bookmarkservice->getBookmarks(0, 1, $userservice->getCurrentUserI
// Set up the XML file and output all the tags.
-header('Content-Type: text/xml');
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
foreach($bookmarks['bookmarks'] as $row) {
echo '<update time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) .'" />';
diff --git a/www/api/tags_get.php b/www/api/tags_get.php
index 85684d4..06a40d9 100644
--- a/www/api/tags_get.php
+++ b/www/api/tags_get.php
@@ -5,8 +5,8 @@
// - tags can't have spaces
// Force HTTP authentication first!
-require_once('httpauth.inc.php');
-require_once '../www-header.php';
+$httpContentType = 'text/xml';
+require_once 'httpauth.inc.php';
/* Service creation: only useful services are created */
$b2tservice =SemanticScuttle_Service_Factory::get('Bookmark2Tag');
@@ -16,7 +16,6 @@ $b2tservice =SemanticScuttle_Service_Factory::get('Bookmark2Tag');
$tags =& $b2tservice->getTags($userservice->getCurrentUserId());
// Set up the XML file and output all the tags.
-header('Content-Type: text/xml');
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
echo "<tags>\r\n";
foreach($tags as $row) {
diff --git a/www/api/tags_rename.php b/www/api/tags_rename.php
index 59ba8a4..cf56c83 100644
--- a/www/api/tags_rename.php
+++ b/www/api/tags_rename.php
@@ -5,8 +5,8 @@
// - oddly, returns an entirely different result (<result></result>) than the other API calls.
// Force HTTP authentication first!
-require_once('httpauth.inc.php');
-require_once '../www-header.php';
+$httpContentType = 'text/xml';
+require_once 'httpauth.inc.php';
/* Service creation: only useful services are created */
$b2tservice =SemanticScuttle_Service_Factory::get('Bookmark2Tag');
@@ -31,7 +31,6 @@ if (is_null($old) || is_null($new)) {
}
// Set up the XML file and output the result.
-header('Content-Type: text/xml');
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
echo '<result>'. ($renamed ? 'done' : 'something went wrong') .'</result>';
?>