updateList.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * ownCloud - bookmarks plugin
  4. *
  5. * @author Arthur Schiwon
  6. * @copyright 2011 Arthur Schiwon blizzz@arthur-schiwon.de
  7. * @copyright 2012 David Iwanowitsch <david at unclouded dot de>
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  11. * License as published by the Free Software Foundation; either
  12. * version 3 of the License, or any later version.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. //no apps or filesystem
  24. $RUNTIME_NOSETUPFS=true;
  25. // Check if we are a user
  26. OCP\JSON::checkLoggedIn();
  27. OCP\JSON::checkAppEnabled('bookmarks');
  28. //Filter for tag?
  29. $filterTag = isset($_GET['tag']) ? htmlspecialchars_decode($_GET['tag']) : false;
  30. $offset = isset($_GET['page']) ? intval($_GET['page']) * 10 : 0;
  31. $sort = isset($_GET['sort']) ? ($_GET['sort']) : 'bookmarks_sorting_recent';
  32. if($sort == 'bookmarks_sorting_clicks') {
  33. $sqlSortColumn = 'clickcount';
  34. } else {
  35. $sqlSortColumn = 'id';
  36. }
  37. $bookmarks = OC_Bookmarks_Bookmarks::findBookmarks($offset, $sqlSortColumn, $filterTag, true);
  38. OCP\JSON::success(array('data' => $bookmarks));