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
This commit is contained in:
parent
db7a46b235
commit
4d3d00ade2
27 changed files with 43 additions and 44 deletions
|
@ -107,6 +107,12 @@ $tplVars['userservice'] = $userservice;
|
|||
|
||||
// 6 // Force UTF-8 behaviour for server (cannot be moved into top.inc.php which is not included into every file)
|
||||
if (!defined('UNIT_TEST_MODE')) {
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
//API files define that, so we need a way to support both of them
|
||||
if (!isset($httpContentType)) {
|
||||
$httpContentType = 'text/html';
|
||||
}
|
||||
if ($httpContentType !== false) {
|
||||
header('Content-Type: ' . $httpContentType . '; charset=utf-8');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
***************************************************************************/
|
||||
|
||||
/* Return a json file with list of linked tags */
|
||||
|
||||
$httpContentType = 'application/json';
|
||||
require_once '../www-header.php';
|
||||
|
||||
/* Service creation: only useful services are created */
|
||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
***************************************************************************/
|
||||
|
||||
/* Return a json file with list of tags according to current user and sort by popularity*/
|
||||
|
||||
$httpContentType = 'application/json';
|
||||
require_once '../www-header.php';
|
||||
|
||||
/* Service creation: only useful services are created */
|
||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
***************************************************************************/
|
||||
|
||||
/* Return a json file with list of tags according to current user and sort by popularity*/
|
||||
|
||||
$httpContentType = 'application/json';
|
||||
require_once '../www-header.php';
|
||||
|
||||
/* Service creation: only useful services are created */
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
***************************************************************************/
|
||||
|
||||
/* Return a json file with list of linked tags */
|
||||
|
||||
$httpContentType = 'application/json';
|
||||
require_once '../www-header.php';
|
||||
|
||||
/* Service creation: only useful services are created */
|
||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
***************************************************************************/
|
||||
|
||||
/* Return a json file with list of tags according to current user and sort by popularity*/
|
||||
|
||||
$httpContentType = 'application/json';
|
||||
require_once '../www-header.php';
|
||||
|
||||
/* Service creation: only useful services are created */
|
||||
|
|
|
@ -19,9 +19,9 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
***************************************************************************/
|
||||
|
||||
header('Content-Type: text/xml; charset=UTF-8');
|
||||
header('Last-Modified: '. gmdate("D, d M Y H:i:s") .' GMT');
|
||||
header('Cache-Control: no-cache, must-revalidate');
|
||||
$httpContentType = 'text/xml';
|
||||
require_once 'www-header.php';
|
||||
|
||||
/* Service creation: only useful services are created */
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
***************************************************************************/
|
||||
|
||||
header('Content-Type: text/xml; charset=UTF-8');
|
||||
header("Last-Modified: ". gmdate("D, d M Y H:i:s") ." GMT");
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
|
||||
$httpContentType = 'text/xml';
|
||||
require_once 'www-header.php';
|
||||
|
||||
/* Managing all possible inputs */
|
||||
|
|
|
@ -19,10 +19,10 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
***************************************************************************/
|
||||
|
||||
header('Content-Type: text/xml; charset=UTF-8');
|
||||
header("Last-Modified: ". gmdate("D, d M Y H:i:s") ." GMT");
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
|
||||
$httpContentType = 'text/xml';
|
||||
require_once 'www-header.php';
|
||||
|
||||
/* Service creation: only useful services are created */
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
/**
|
||||
* We re-use vote.php but set the ajax flag
|
||||
*/
|
||||
$httpContentType = 'text/xml';
|
||||
$GLOBALS['ajaxRequest'] = true;
|
||||
require 'vote.php';
|
||||
|
||||
|
@ -17,7 +18,6 @@ default:
|
|||
$template = 'bookmarks-vote.inc.tpl.php';
|
||||
}
|
||||
|
||||
header('Content-Type: text/xml; charset=utf-8');
|
||||
echo '<voteresult><bookmark>' . $bookmark . '</bookmark>'
|
||||
. '<html xmlns="http://www.w3.org/1999/xhtml">';
|
||||
$ts->loadTemplate(
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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/">
|
||||
|
|
|
@ -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') .'" />';
|
||||
?>
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -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') .'" />';
|
||||
?>
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -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'])) .'" />';
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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>';
|
||||
?>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
* @license GPL http://www.gnu.org/licenses/gpl.html
|
||||
* @link http://sourceforge.net/projects/semanticscuttle
|
||||
*/
|
||||
$httpContentType = false;
|
||||
require_once 'www-header.php';
|
||||
|
||||
if (!$GLOBALS['shorturl']) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
header('Content-Type: text/javascript');
|
||||
$GLOBALS['saveInLastUrl'] = false;
|
||||
$httpContentType = 'text/javascript';
|
||||
require_once 'www-header.php';
|
||||
require_once 'SemanticScuttle/functions.php';
|
||||
$player_root = ROOT .'includes/player/';
|
||||
|
|
|
@ -19,14 +19,13 @@
|
|||
* @link http://sourceforge.net/projects/semanticscuttle
|
||||
*/
|
||||
|
||||
$httpContentType = 'application/rss+xml';
|
||||
require_once 'www-header.php';
|
||||
|
||||
/* Service creation: only useful services are created */
|
||||
$bookmarkservice = SemanticScuttle_Service_Factory::get('Bookmark');
|
||||
$cacheservice = SemanticScuttle_Service_Factory::get('Cache');
|
||||
|
||||
header('Content-Type: application/rss+xml; charset=utf-8');
|
||||
|
||||
if (isset($_SERVER['PATH_INFO']) && strlen($_SERVER['PATH_INFO']) >1) {
|
||||
list($url, $user, $cat) = explode('/', $_SERVER['PATH_INFO']);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue