2008-04-11 08:56:09 +02:00
|
|
|
<?php
|
|
|
|
/*
|
2008-12-04 16:08:09 +01:00
|
|
|
Export for Google Custom Search
|
|
|
|
*/
|
2008-06-01 15:17:54 +02:00
|
|
|
|
2008-04-11 08:56:09 +02:00
|
|
|
// Force HTTP authentication first!
|
2008-06-01 15:17:54 +02:00
|
|
|
//require_once('httpauth.inc.php');
|
2010-03-17 21:11:21 +01:00
|
|
|
$httpContentType = false;
|
2010-02-08 08:32:34 +01:00
|
|
|
require_once '../www-header.php';
|
2008-06-01 15:17:54 +02:00
|
|
|
|
2008-12-04 16:30:59 +01:00
|
|
|
if($GLOBALS['enableGoogleCustomSearch'] == false) {
|
2009-10-26 07:39:23 +01:00
|
|
|
echo "Google Custom Search disabled. You can enable it into the config.php file.";
|
2008-12-04 16:30:59 +01:00
|
|
|
die;
|
|
|
|
}
|
|
|
|
|
2008-12-05 08:25:04 +01:00
|
|
|
/* Service creation: only useful services are created */
|
2009-10-23 19:13:16 +02:00
|
|
|
$bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
|
2008-12-05 08:25:04 +01:00
|
|
|
|
2008-04-11 08:56:09 +02:00
|
|
|
|
|
|
|
/*
|
2008-12-04 16:08:09 +01:00
|
|
|
// Restrict to admins?
|
|
|
|
if(!$userservice->isAdmin($userservice->getCurrentUserId())) {
|
|
|
|
die(T_('You are not allowed to do this action (admin access)'));
|
|
|
|
}*/
|
2008-04-11 08:56:09 +02:00
|
|
|
|
2008-06-01 15:17:54 +02:00
|
|
|
// Check if queried format is xml
|
|
|
|
if (isset($_REQUEST['xml']) && (trim($_REQUEST['xml']) == 1))
|
2008-12-04 16:08:09 +01:00
|
|
|
$xml = true;
|
2008-06-01 15:17:54 +02:00
|
|
|
else
|
2008-12-04 16:08:09 +01:00
|
|
|
$xml = false;
|
2008-06-01 15:17:54 +02:00
|
|
|
|
|
|
|
// Check to see if a tag was specified.
|
|
|
|
if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != ''))
|
2008-12-04 16:08:09 +01:00
|
|
|
$tag = trim($_REQUEST['tag']);
|
2008-06-01 15:17:54 +02:00
|
|
|
else
|
2008-12-04 16:08:09 +01:00
|
|
|
$tag = NULL;
|
2008-06-01 15:17:54 +02:00
|
|
|
|
|
|
|
// Get the posts relevant to the passed-in variables.
|
2013-03-20 20:00:25 +01:00
|
|
|
$bookmarks = $bookmarkservice->getBookmarks(0, NULL, NULL, $tag, NULL, getSortOrder());
|
2008-06-01 15:17:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
// Set up the plain file and output all the posts.
|
2010-03-17 21:11:21 +01:00
|
|
|
header('Content-Type: text/plain; charset=utf-8');
|
2008-06-01 15:17:54 +02:00
|
|
|
if(!$xml) {
|
2008-12-04 16:08:09 +01:00
|
|
|
header('Content-Type: text/plain');
|
|
|
|
foreach($bookmarks['bookmarks'] as $row) {
|
|
|
|
if(checkUrl($row['bAddress'], false)) {
|
|
|
|
echo $row['bAddress']."\n";
|
|
|
|
}
|
|
|
|
}
|
2008-06-01 15:17:54 +02:00
|
|
|
} else {
|
2010-03-17 21:11:21 +01:00
|
|
|
header('Content-Type: text/xml');
|
2008-12-04 16:08:09 +01:00
|
|
|
echo '<GoogleCustomizations>'."\n";
|
|
|
|
echo ' <Annotations>'."\n";
|
|
|
|
foreach($bookmarks['bookmarks'] as $row) {
|
|
|
|
//if(substr($row['bAddress'], 0, 7) == "http://") {
|
|
|
|
if(checkUrl($row['bAddress'], false)) {
|
|
|
|
echo ' <Annotation about="'.filter($row['bAddress']).'">'."\n";
|
|
|
|
echo ' <Label name="include"/>'."\n";
|
|
|
|
echo ' </Annotation>'."\n";
|
|
|
|
}
|
2008-06-01 15:17:54 +02:00
|
|
|
}
|
2008-12-04 16:08:09 +01:00
|
|
|
echo ' </Annotations>'."\n";
|
|
|
|
echo '</GoogleCustomizations>'."\n";
|
2008-06-01 15:17:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|