diff options
| author | David Glenck <pascal.free@gmail.com> | 2014-03-26 22:15:09 +0100 | 
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2014-03-26 22:15:09 +0100 | 
| commit | 0a5eed2dd36d1a47673d7ca3105a86a8de99b649 (patch) | |
| tree | d9b0bb15398e7ed50fd5c84a75218c3dab3464cd /www/api/posts_update.php | |
| parent | 49f1259c420b6f13e2e76164b6950c23b9ba395c (diff) | |
| download | semanticscuttle-0a5eed2dd36d1a47673d7ca3105a86a8de99b649.tar.gz semanticscuttle-0a5eed2dd36d1a47673d7ca3105a86a8de99b649.tar.bz2 | |
add option to get last modified date instead of creation date
Diffstat (limited to 'www/api/posts_update.php')
| -rw-r--r-- | www/api/posts_update.php | 20 | 
1 files changed, 17 insertions, 3 deletions
| diff --git a/www/api/posts_update.php b/www/api/posts_update.php index 4b080e2..0e08ee7 100644 --- a/www/api/posts_update.php +++ b/www/api/posts_update.php @@ -9,6 +9,11 @@   * that too, so we are as close at the API as possible,   * not breaking delicious clients.   * + * SemanticScuttle supports an extra parameter: + * - ?datemode=modified + *   - sorts by modified date and returns modification time + *     instead of creation time + *   * SemanticScuttle - your social bookmark manager.   *   * PHP version 5. @@ -27,18 +32,27 @@  $httpContentType = 'text/xml';  require_once 'httpauth.inc.php'; +// parameter "datemode=modified" will get last modified date +// instead of last created date +$orderby   = null; +$timeField = 'bDatetime'; +if (isset($_GET['datemode']) && $_GET['datemode'] == 'modified') { +    $orderby = 'modified_desc'; +    $timeField = 'bModified'; +} +  $bs = SemanticScuttle_Service_Factory::get('Bookmark'); -$bookmarks = $bs->getBookmarks(0, 1, $userservice->getCurrentUserId()); +$bookmarks = $bs->getBookmarks(0, 1, $userservice->getCurrentUserId(), null, null, $orderby);  // Set up the XML file and output all the tags.  echo '<?xml version="1.0" standalone="yes" ?' . ">\r\n";  //foreach is used in case there are no bookmarks  foreach ($bookmarks['bookmarks'] as $row) {      echo '<update time="' -        . gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) +        . gmdate('Y-m-d\TH:i:s\Z', strtotime($row[$timeField]))          . '"'          . ' inboxnew="0"'          . ' />';  } -?>
\ No newline at end of file +?> | 
