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');
|
|
|
|
require_once('../header.inc.php');
|
|
|
|
|
2008-12-04 16:30:59 +01:00
|
|
|
if($GLOBALS['enableGoogleCustomSearch'] == false) {
|
|
|
|
echo "Google Custom Search disabled. You can enable it into the config.inc.php file.";
|
|
|
|
die;
|
|
|
|
}
|
|
|
|
|
2008-12-05 08:25:04 +01:00
|
|
|
/* Service creation: only useful services are created */
|
2008-06-01 15:17:54 +02:00
|
|
|
$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
|
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.
|
|
|
|
$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, NULL, $tag, NULL, getSortOrder());
|
|
|
|
|
|
|
|
|
|
|
|
// Set up the plain file and output all the posts.
|
|
|
|
header('Content-Type: text/plain');
|
|
|
|
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 {
|
2008-12-04 16:08:09 +01:00
|
|
|
header('Content-Type: application/xml');
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
?>
|