diff options
Diffstat (limited to 'api')
-rw-r--r-- | api/export_csv.php | 47 | ||||
-rw-r--r-- | api/export_gcs.php | 66 | ||||
-rw-r--r-- | api/export_html.php | 54 | ||||
-rw-r--r-- | api/export_sioc.php | 90 | ||||
-rw-r--r-- | api/httpauth.inc.php | 33 | ||||
-rw-r--r-- | api/opensearch.php | 18 | ||||
-rw-r--r-- | api/posts_add.php | 83 | ||||
-rw-r--r-- | api/posts_all.php | 48 | ||||
-rw-r--r-- | api/posts_dates.php | 40 | ||||
-rw-r--r-- | api/posts_delete.php | 34 | ||||
-rw-r--r-- | api/posts_get.php | 61 | ||||
-rw-r--r-- | api/posts_public.php | 48 | ||||
-rw-r--r-- | api/posts_recent.php | 62 | ||||
-rw-r--r-- | api/posts_update.php | 25 | ||||
-rw-r--r-- | api/tags_get.php | 26 | ||||
-rw-r--r-- | api/tags_rename.php | 37 |
16 files changed, 0 insertions, 772 deletions
diff --git a/api/export_csv.php b/api/export_csv.php deleted file mode 100644 index 2389642..0000000 --- a/api/export_csv.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php
-// 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('../header.inc.php');
- -/* Service creation: only useful services are created */
-$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
-
-// Check to see if a tag was specified.
-if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != ''))
- $tag = trim($_REQUEST['tag']);
-else
- $tag = NULL;
-
-// 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";
-
-foreach($bookmarks['bookmarks'] as $row) {
- if (is_null($row['bDescription']) || (trim($row['bDescription']) == ''))
- $description = '';
- else
- $description = filter(str_replace(array("\r\n", "\n", "\r"),"", $row['bDescription']), 'xml');
-
- $taglist = '';
- if (count($row['tags']) > 0) {
- foreach($row['tags'] as $tag)
- $taglist .= convertTag($tag) .',';
- $taglist = substr($taglist, 0, -1);
- } else {
- $taglist = 'system:unfiled';
- }
-
- echo '"'.filter($row['bAddress'], 'xml') .'";"'. filter($row['bTitle'], 'xml') .'";"'. filter($taglist, 'xml') .'";"'. $description .'"'; - echo "\n";
-}
-
-
-?>
diff --git a/api/export_gcs.php b/api/export_gcs.php deleted file mode 100644 index 6f1f4c2..0000000 --- a/api/export_gcs.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -/* - Export for Google Custom Search - */ - -// Force HTTP authentication first! -//require_once('httpauth.inc.php'); -require_once('../header.inc.php'); - -if($GLOBALS['enableGoogleCustomSearch'] == false) { - echo "Google Custom Search disabled. You can enable it into the config.inc.php file."; - die; -} - -/* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); - - -/* - // Restrict to admins? - if(!$userservice->isAdmin($userservice->getCurrentUserId())) { - die(T_('You are not allowed to do this action (admin access)')); - }*/ - -// Check if queried format is xml -if (isset($_REQUEST['xml']) && (trim($_REQUEST['xml']) == 1)) -$xml = true; -else -$xml = false; - -// Check to see if a tag was specified. -if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) -$tag = trim($_REQUEST['tag']); -else -$tag = NULL; - -// 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) { - header('Content-Type: text/plain'); - foreach($bookmarks['bookmarks'] as $row) { - if(checkUrl($row['bAddress'], false)) { - echo $row['bAddress']."\n"; - } - } -} else { - 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"; - } - } - echo ' </Annotations>'."\n"; - echo '</GoogleCustomizations>'."\n"; -} - -?> diff --git a/api/export_html.php b/api/export_html.php deleted file mode 100644 index 55553c2..0000000 --- a/api/export_html.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php
-// Implements the del.icio.us API request for all a user's posts, optionally filtered by tag.
-
-// del.icio.us behavior:
-// - 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('../header.inc.php');
- -/* Service creation: only useful services are created */
-$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
-
-// Check to see if a tag was specified.
-if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != ''))
- $tag = trim($_REQUEST['tag']);
-else
- $tag = NULL;
-
-// Get the posts relevant to the passed-in variables.
-$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag, NULL, getSortOrder());
-
-
-// Set up the XML file and output all the posts.
-echo '<!DOCTYPE NETSCAPE-Bookmark-file-1>'."\r\n"; -echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">';
-echo '<!-- This is an automatically generated file. -->'."\r\n";
-echo '<TITLE>Bookmarks</TITLE>'."\r\n";
-echo '<H1 LAST_MODIFIED="'. date('U') .'">Bookmarks for '. htmlspecialchars($currentUser->getUsername()) .''. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') ." from " . $sitename ."</H1>\r\n";
-echo '<DL><p>'."\r\n";
-
-
-
-foreach($bookmarks['bookmarks'] as $row) {
- if (is_null($row['bDescription']) || (trim($row['bDescription']) == ''))
- $description = '';
- else
- $description = 'description="'. filter($row['bDescription'], 'xml') .'" ';
-
- $taglist = '';
- if (count($row['tags']) > 0) {
- foreach($row['tags'] as $tag)
- $taglist .= convertTag($tag) .',';
- $taglist = substr($taglist, 0, -1);
- } else {
- $taglist = 'system:unfiled';
- }
-
- echo "\t<dt><a href=\"". filter($row['bAddress'], 'xml') .'" '. $description .' hash="'. md5($row['bAddress']) .'" tags="'. filter($taglist, 'xml') .'" ADD_DATE="'. date('U', strtotime($row['bDatetime'])) ."\" >" . filter($row['bTitle'], 'xml') ."</a>\r\n";
-}
-
-
-echo '</DL><p>';
-?>
diff --git a/api/export_sioc.php b/api/export_sioc.php deleted file mode 100644 index 746d0ea..0000000 --- a/api/export_sioc.php +++ /dev/null @@ -1,90 +0,0 @@ -<?php -/* Export data with semantic format (SIOC: http://sioc-project.org/, FOAF, SKOS, Annotea Ontology) */
-
-require_once('../header.inc.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 =& ServiceFactory::getServiceInstance('UserService'); -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); - -?> -<?php echo "<?xml version=\"1.0\" encoding=\"utf-8\"\n?>"; ?> -<rdf:RDF - xmlns="http://xmlns.com/foaf/0.1/" - xmlns:foaf="http://xmlns.com/foaf/0.1/" - xmlns:rss="http://purl.org/rss/1.0/" - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:dcterms="http://purl.org/dc/terms/" - xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:sioc="http://rdfs.org/sioc/ns#" - xmlns:sioc_t="http://rdfs.org/sioc/types#" - xmlns:bm="http://www.w3.org/2002/01/bookmark#" - xmlns:skos="http://www.w3.org/2004/02/skos/core#"> - -<?php -//site and community are described using FOAF and SIOC ontology -?> -<sioc:Site rdf:about="<?php echo ROOT?>" > - <rdf:label><?php echo $GLOBALS['sitename']?></rdf:label> -</sioc:Site> - -<?php //<sioc_t:BookmarkFolder />?> - -<?php -//users are described using FOAF and SIOC ontology -$users = $userservice->getObjectUsers(); - -$usersArray = array(); // useful for bookmarks display -foreach($users as $user) { - $usersArray[$user->getId()] = $user->getUserName(); -} -?> - -<?php foreach($users as $user) :?> -<sioc:User rdf:about="<?php echo createUrl('profile', $user->getUserName())?>"> - <sioc:name><?php echo $user->getUserName() ?></sioc:name> - <sioc:member_of rdf:resource="<?php echo ROOT?>" /> -</sioc:User> -<?php endforeach; ?> - -<?php -/* -No page for usergroup (users/admin) for the moment - <sioc:Usergroup rdf:ID="authors"> - <sioc:name>Authors at PlanetRDF.com</sioc:name> - <sioc:has_member rdf:nodeID="sioc-id2245901" /> - </sioc:Usergroup> -*/ -?> - -<?php -//bookmarks are described using Annotea ontology -$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, NULL, NULL); -?> - -<?php foreach($bookmarks['bookmarks'] as $bookmark): ?> -<bm:Bookmark rdf:about="<?php echo createUrl('history', $bookmark['bHash']) ?>"> - <dc:title><?php echo filter($bookmark['bTitle']) ?></dc:title> - <dc:created><?php echo filter($bookmark['bCreated']) ?></dc:created> - <dc:description><?php echo filter(strip_tags($bookmark['bDescription'])) ?></dc:description> - <dc:date><?php echo $bookmark['bDateTime'] ?></dc:date> - <bm:recalls rdf:resource="<?php echo filter($bookmark['bAddress']) ?>"/> - <sioc:owner_of rdf:resource="<?php echo createUrl('profile', $usersArray[$bookmark['uId']]) ?>"/> - <?php foreach($bookmark['tags'] as $tag): ?> - <sioc:topic> - <skos:concept rdf:about="<?php echo createUrl('bookmarks', $usersArray[$bookmark['uId']].'/'.$tag) ?>" /> - </sioc:topic> - <?php endforeach; ?> -</bm:Bookmark> - -<?php endforeach; ?> - -<?php -// tags and concepts are described using SKOS ontology -//concept for user/admins, preflabel, definition, top concept -?> - -</rdf:RDF> - diff --git a/api/httpauth.inc.php b/api/httpauth.inc.php deleted file mode 100644 index 5dd7444..0000000 --- a/api/httpauth.inc.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php -require_once('../header.inc.php'); - -// Provides HTTP Basic authentication of a user, and sets two variables, sId and username, -// with the user's info. - -function authenticate() { - header('WWW-Authenticate: Basic realm="SemanticScuttle API"'); - header('HTTP/1.0 401 Unauthorized'); - - die(T_("Use of the API calls requires authentication.")); -} - -if(!$userservice->isLoggedOn()) { - /* Maybe we have caught authentication data in $_SERVER['REMOTE_USER'] - ( Inspired by http://www.yetanothercommunitysystem.com/article-321-regle-comment-utiliser-l-authentification-http-en-php-chez-ovh ) */ - if((!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) - && preg_match('/Basic\s+(.*)$/i', $_SERVER['REMOTE_USER'], $matches)) { - list($name, $password) = explode(':', base64_decode($matches[1])); - $_SERVER['PHP_AUTH_USER'] = strip_tags($name); - $_SERVER['PHP_AUTH_PW'] = strip_tags($password); - } - - if (!isset($_SERVER['PHP_AUTH_USER'])) { - authenticate(); - } else { - $login = $userservice->login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']); - if (!$login) { - authenticate(); - } - } -} -?> diff --git a/api/opensearch.php b/api/opensearch.php deleted file mode 100644 index a6f79f8..0000000 --- a/api/opensearch.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php -require_once('../header.inc.php'); -header("Content-type: text/xml"); -?> - -<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
- xmlns:moz="http://www.mozilla.org/2006/browser/search/">
- <ShortName><?php echo $GLOBALS['sitename']?></ShortName>
- <LongName></LongName>
- <Description><?php echo $GLOBALS['welcomeMessage']?></Description>
- <InputEncoding>UTF-8</InputEncoding>
- <Contact><?php echo $GLOBALS['adminemail']?></Contact>
- <Developer>Jan Seifert "jan.seifert@uid.com"</Developer>
- <Tags>semanticscuttle bookmark web</Tags>
- <Image width="16" height="16">data:image/gif;base64,R0lGODlhEAAQAMZ9ANaPE9mREteTHtSXLdmXIdiXJtaYKdiYJ9iYKNeaLtKdP9CdRd2dLNWfQuWiFMqjX9+hNMykXt6jPOCkPM2oaM+paeCpQuGoR+OqOeKpR+GqS9+uWeSwU+ayS+uzOeWxVeWxWOSyWOu0POazXOS0YOm8Zee8cOy+WOm9a/jBLum+bPbCNurAbe7BYuvBc/LDV/LEV+zEdv/KKf/KLP/KLf/LLuzHe//MNP/NN/nMTv/OOf/OPP/OP/jNW//PPvnOVv/QQv7QRv/QRP/RR/HOhP/SSf/STPnRav/TT//TUPfScf/UUvzUXP/UVP/VV/bTfv/WWf/WW//WXP7XYf/XX//XYP/YZPPVmf/ZZv/ZZ/vYeP/aaf/aa//abP/abf/abvvaef/bb//bcfzbfP/ccv/cc//cdP/cdf/dd//deP/def3egP/ee//efP/efv/ffv/ggf/gg//ghP/ghfrfmv/hif/ii//ijP/jkfzjm//kkv7klv/lmP///////////yH5BAEKAH8ALAAAAAAQABAAAAergH+Cg38hhIeHIFcmiIgDLnt0Go2EE1pyd0QbjQMQDC9bZGprKBcjA4IfAQMrQUhOVFlhaGNPMRl/Aw4yMzc7QkZNUlZdZmASqAJKcW1WPDpARUtQUx0RgyR5fHpzUTU4PkMiqIMVNnh2c25lSTQpAIgqdXJvaWReXz0JiCxwbWhiuGCp8uMAohJszhw5AYMJlBwFEHFoYQHBAwUEMHgwgKjBA0QLKFAaKSgQADs=</Image>
- <Url type="text/html" template="<?php echo $GLOBALS['root']?>search.php/all/{searchTerms}"/>
- <moz:SearchForm><?php echo $GLOBALS['root']?></moz:SearchForm>
-</OpenSearchDescription> diff --git a/api/posts_add.php b/api/posts_add.php deleted file mode 100644 index ba3e02c..0000000 --- a/api/posts_add.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php -// Implements the del.icio.us API request to add a new post. - -// del.icio.us behavior: -// - tags can't have spaces -// - address and description are mandatory - -// Scuttle behavior: -// - Additional 'status' variable for privacy -// - No support for 'replace' variable - -// Force HTTP authentication -require_once('httpauth.inc.php'); -require_once('../header.inc.php'); - -/* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); - -// Get all the bookmark's passed-in information -if (isset($_REQUEST['url']) && (trim($_REQUEST['url']) != '')) - $url = trim(urldecode($_REQUEST['url'])); -else - $url = NULL; - -if (isset($_REQUEST['description']) && (trim($_REQUEST['description']) != '')) - $description = trim($_REQUEST['description']); -else - $description = NULL; - -if (isset($_REQUEST['extended']) && (trim($_REQUEST['extended']) != "")) - $extended = trim($_REQUEST['extended']); -else - $extended = NULL; - -if (isset($_REQUEST['tags']) && (trim($_REQUEST['tags']) != '') && (trim($_REQUEST['tags']) != ',')) - $tags = trim($_REQUEST['tags']); -else - $tags = NULL; - -if (isset($_REQUEST['dt']) && (trim($_REQUEST['dt']) != '')) - $dt = trim($_REQUEST['dt']); -else - $dt = NULL; - -$status = 0; -if (isset($_REQUEST['status'])) { - $status_str = trim($_REQUEST['status']); - if (is_numeric($status_str)) { - $status = intval($status_str); - if($status < 0 || $status > 2) { - $status = 0; - } - } else { - switch ($status_str) { - case 'private': - $status = 2; - break; - case 'shared': - $status = 1; - break; - default: - $status = 0; - break; - } - } -} - -// Error out if there's no address or description -if (is_null($url) || is_null($description)) { - $added = false; -} else { -// We're good with info; now insert it! - if ($bookmarkservice->bookmarkExists($url, $userservice->getCurrentUserId())) - $added = false; - else - $added = $bookmarkservice->addBookmark($url, $description, $extended, '', $status, $tags, $dt, true); -} - -// 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/api/posts_all.php b/api/posts_all.php deleted file mode 100644 index 4ecbd7e..0000000 --- a/api/posts_all.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -// Implements the del.icio.us API request for all a user's posts, optionally filtered by tag. - -// del.icio.us behavior: -// - 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('../header.inc.php'); - -/* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); - - -// Check to see if a tag was specified. -if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) - $tag = trim($_REQUEST['tag']); -else - $tag = NULL; - -// Get the posts relevant to the passed-in variables. -$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"; - -foreach($bookmarks['bookmarks'] as $row) { - if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) - $description = ''; - else - $description = 'extended="'. filter($row['bDescription'], 'xml') .'" '; - - $taglist = ''; - if (count($row['tags']) > 0) { - foreach($row['tags'] as $tag) - $taglist .= convertTag($tag) .' '; - $taglist = substr($taglist, 0, -1); - } else { - $taglist = 'system:unfiled'; - } - - echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. md5($row['bAddress']) .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n"; -} - -echo '</posts>'; -?>
\ No newline at end of file diff --git a/api/posts_dates.php b/api/posts_dates.php deleted file mode 100644 index d4962ff..0000000 --- a/api/posts_dates.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php -// Implements the del.icio.us API request for a user's post counts by date (and optionally -// by tag). - -// Force HTTP authentication first! -require_once('httpauth.inc.php'); -require_once('../header.inc.php'); - -/* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); - - -// Check to see if a tag was specified. -if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) - $tag = trim($_REQUEST['tag']); -else - $tag = NULL; - -// Get the posts relevant to the passed-in variables. -$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag); - -// 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"; - -$lastdate = NULL; -foreach($bookmarks['bookmarks'] as $row) { - $thisdate = gmdate('Y-m-d', strtotime($row['bDatetime'])); - if ($thisdate != $lastdate && $lastdate != NULL) { - echo "\t<date count=\"". $count .'" date="'. $lastdate ."\" />\r\n"; - $count = 1; - } else { - $count = $count + 1; - } - $lastdate = $thisdate; -} - -echo "</dates>"; -?>
\ No newline at end of file diff --git a/api/posts_delete.php b/api/posts_delete.php deleted file mode 100644 index d24ba59..0000000 --- a/api/posts_delete.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php -// Implements the del.icio.us API request to delete a post. - -// del.icio.us behavior: -// - returns "done" even if the bookmark doesn't exist; -// - does NOT allow the hash for the url parameter; -// - doesn't set the Content-Type to text/xml (we do). - -// Force HTTP authentication first! -require_once('httpauth.inc.php'); -require_once('../header.inc.php'); - -/* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); - - -// Note that del.icio.us only errors out if no URL was passed in; there's no error on attempting -// to delete a bookmark you don't have. - -// Error out if there's no address -if (is_null($_REQUEST['url'])) { - $deleted = false; -} else { - $bookmark = $bookmarkservice->getBookmarkByAddress($_REQUEST['url']); - $bid = $bookmark['bId']; - $delete = $bookmarkservice->deleteBookmark($bid); - $deleted = true; -} - -// 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/api/posts_get.php b/api/posts_get.php deleted file mode 100644 index 34d192e..0000000 --- a/api/posts_get.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php -// Implements the del.icio.us API request for a user's posts, optionally filtered by tag and/or -// date. Note that when using a date to select the posts returned, del.icio.us uses GMT dates -- -// so we do too. - -// del.icio.us behavior: -// - includes an empty tag attribute on the root element when it hasn't been specified - -// Scuttle behavior: -// - Uses today, instead of the last bookmarked date, if no date is specified - -// Force HTTP authentication first! -require_once('httpauth.inc.php'); -require_once('../header.inc.php'); - -/* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); - - -// Check to see if a tag was specified. -if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) - $tag = trim($_REQUEST['tag']); -else - $tag = NULL; - -// Check to see if a date was specified; the format should be YYYY-MM-DD -if (isset($_REQUEST['dt']) && (trim($_REQUEST['dt']) != "")) - $dtstart = trim($_REQUEST['dt']); -else - $dtstart = date('Y-m-d H:i:s'); -$dtend = date('Y-m-d H:i:s', strtotime($dtstart .'+1 day')); - -// Get the posts relevant to the passed-in variables. -$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag, NULL, NULL, NULL, $dtstart, $dtend); - - -// 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"; - -foreach($bookmarks['bookmarks'] as $row) { - if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) - $description = ''; - else - $description = 'extended="'. filter($row['bDescription'], 'xml') .'" '; - - $taglist = ''; - if (count($row['tags']) > 0) { - foreach($row['tags'] as $tag) - $taglist .= convertTag($tag) .' '; - $taglist = substr($taglist, 0, -1); - } else { - $taglist = 'system:unfiled'; - } - - echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. $row['bHash'] .'" others="'. $bookmarkservice->countOthers($row['bAddress']) .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n"; -} - -echo '</posts>'; -?>
\ No newline at end of file diff --git a/api/posts_public.php b/api/posts_public.php deleted file mode 100644 index f7aa955..0000000 --- a/api/posts_public.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -// Implements the del.icio.us API request for all a user's posts, optionally filtered by tag. - -// del.icio.us behavior: -// - 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('../header.inc.php'); - -/* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); - - -// Check to see if a tag was specified. -if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) - $tag = trim($_REQUEST['tag']); -else - $tag = NULL; - -// Get the posts relevant to the passed-in variables. -$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"; - -foreach($bookmarks['bookmarks'] as $row) { - if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) - $description = ''; - else - $description = 'extended="'. filter($row['bDescription'], 'xml') .'" '; - - $taglist = ''; - if (count($row['tags']) > 0) { - foreach($row['tags'] as $tag) - $taglist .= convertTag($tag) .' '; - $taglist = substr($taglist, 0, -1); - } else { - $taglist = 'system:unfiled'; - } - - echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. md5($row['bAddress']) .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n"; -} - -echo '</posts>'; -?> diff --git a/api/posts_recent.php b/api/posts_recent.php deleted file mode 100644 index daa9d39..0000000 --- a/api/posts_recent.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php -// Implements the del.icio.us API request for a user's recent posts, optionally filtered by -// tag and/or number of posts (default 15, max 100, just like del.icio.us). - -// Set default and max number of posts -$countDefault = 15; -$countMax = 100; - -// Force HTTP authentication first! -require_once('httpauth.inc.php'); -require_once('../header.inc.php'); - -/* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); - - -// Check to see if a tag was specified. -if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) - $tag = trim($_REQUEST['tag']); -else - $tag = NULL; - -// Check to see if the number of items was specified. -if (isset($_REQUEST['count']) && (intval($_REQUEST['count']) != 0)) { - $count = intval($_REQUEST['count']); - if ($count > $countMax) - $count = $countMax; - elseif ($count < 0) - $count = 0; -} else { - $count = $countDefault; -} - -// Get the posts relevant to the passed-in variables. -$bookmarks =& $bookmarkservice->getBookmarks(0, $count, $userservice->getCurrentUserId(), $tag); - - -// 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"; - -foreach($bookmarks['bookmarks'] as $row) { - if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) - $description = ''; - else - $description = 'extended="'. filter($row['bDescription'], 'xml') .'" '; - - $taglist = ''; - if (count($row['tags']) > 0) { - foreach($row['tags'] as $tag) - $taglist .= convertTag($tag) .' '; - $taglist = substr($taglist, 0, -1); - } else { - $taglist = 'system:unfiled'; - } - - echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. $row['bHash'] .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n"; -} - -echo '</posts>'; -?>
\ No newline at end of file diff --git a/api/posts_update.php b/api/posts_update.php deleted file mode 100644 index 6ea50e2..0000000 --- a/api/posts_update.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php -// Implements the del.icio.us API request for a user's last update time and date. - -// del.icio.us behavior: -// - doesn't set the Content-Type to text/xml (we do). - -// Force HTTP authentication first! -require_once('httpauth.inc.php'); -require_once('../header.inc.php'); - -/* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); - - -// Get the posts relevant to the passed-in variables. -$bookmarks =& $bookmarkservice->getBookmarks(0, 1, $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"; -foreach($bookmarks['bookmarks'] as $row) { - echo '<update time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) .'" />'; -} -?>
\ No newline at end of file diff --git a/api/tags_get.php b/api/tags_get.php deleted file mode 100644 index cee36ee..0000000 --- a/api/tags_get.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -// Implements the del.icio.us API request for all a user's tags. - -// del.icio.us behavior: -// - tags can't have spaces - -// Force HTTP authentication first! -require_once('httpauth.inc.php'); -require_once('../header.inc.php'); - -/* Service creation: only useful services are created */ -$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); - - -// Get the tags relevant to the passed-in variables. -$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) { - echo "\t<tag count=\"". $row['bCount'] .'" tag="'. filter(convertTag($row['tag'], 'out'), 'xml') ."\" />\r\n"; -} -echo "</tags>"; -?> diff --git a/api/tags_rename.php b/api/tags_rename.php deleted file mode 100644 index dd16339..0000000 --- a/api/tags_rename.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -// Implements the del.icio.us API request to rename a user's tag. - -// del.icio.us behavior: -// - oddly, returns an entirely different result (<result></result>) than the other API calls. - -// Force HTTP authentication first! -require_once('httpauth.inc.php'); -require_once('../header.inc.php'); - -/* Service creation: only useful services are created */ -$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); - -// Get the tag info. -if (isset($_REQUEST['old']) && (trim($_REQUEST['old']) != '')) - $old = trim($_REQUEST['old']); -else - $old = NULL; - -if (isset($_REQUEST['new']) && (trim($_REQUEST['new']) != '')) - $new = trim($_REQUEST['new']); -else - $new = NULL; - -if (is_null($old) || is_null($new)) { - $renamed = false; -} else { - // Rename the tag. - $result = $b2tservice->renameTag($userservice->getCurrentUserId(), $old, $new, true); - $renamed = $result; -} - -// 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>'; -?> |