app.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * ownCloud - gallery application
  4. *
  5. * @author Bartek Przybylski
  6. * @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  10. * License as published by the Free Software Foundation; either
  11. * version 3 of the License, or any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. OC::$CLASSPATH['OC_Gallery_Album'] = 'apps/gallery/lib/album.php';
  23. OC::$CLASSPATH['OC_Gallery_Photo'] = 'apps/gallery/lib/photo.php';
  24. OC::$CLASSPATH['OC_Gallery_Scanner'] = 'apps/gallery/lib/scanner.php';
  25. OC::$CLASSPATH['OC_Gallery_Sharing'] = 'apps/gallery/lib/sharing.php';
  26. OC::$CLASSPATH['OC_Gallery_Hooks_Handlers'] = 'apps/gallery/lib/hooks_handlers.php';
  27. $l = OC_L10N::get('gallery');
  28. OCP\App::register(array(
  29. 'order' => 20,
  30. 'id' => 'gallery',
  31. 'name' => 'Pictures'));
  32. OCP\App::addNavigationEntry( array(
  33. 'id' => 'gallery_index',
  34. 'order' => 20,
  35. 'href' => OCP\Util::linkTo('gallery', 'index.php'),
  36. 'icon' => OCP\Util::imagePath('core', 'places/picture.svg'),
  37. 'name' => $l->t('Pictures')));
  38. class OC_GallerySearchProvider extends OC_Search_Provider{
  39. function search($query){
  40. $stmt = OCP\DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE uid_owner = ? AND album_name LIKE ?');
  41. $result = $stmt->execute(array(OCP\USER::getUser(),'%'.$query.'%'));
  42. $results=array();
  43. while($row=$result->fetchRow()){
  44. $results[]=new OC_Search_Result($row['album_name'],'',OCP\Util::linkTo('gallery', 'index.php').'?view='.$row['album_name'],'Galleries');
  45. }
  46. return $results;
  47. }
  48. }
  49. OC_Search::registerProvider('OC_GallerySearchProvider');
  50. require_once('apps/gallery/lib/hooks_handlers.php');
  51. OCP\CONFIG::setAppValue('core', 'public_gallery', '/apps/gallery/sharing.php');
  52. ?>