index.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. require_once('../../lib/base.php');
  3. OC_Util::checkLoggedIn();
  4. OC_Util::checkAppEnabled('gallery');
  5. OC_App::setActiveNavigationEntry( 'gallery_index' );
  6. if (!isset($_GET['view'])) {
  7. $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE uid_owner = ?');
  8. $result = $stmt->execute(array(OC_User::getUser()));
  9. $r = array();
  10. while ($row = $result->fetchRow())
  11. $r[] = $row;
  12. $tmpl = new OC_Template( 'gallery', 'index', 'user' );
  13. $tmpl->assign('r', $r);
  14. $tmpl->printPage();
  15. } else {
  16. $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_photos, *PREFIX*gallery_albums WHERE uid_owner = ? AND album_name = ? AND *PREFIX*gallery_albums.album_id = *PREFIX*gallery_photos.album_id');
  17. $result = $stmt->execute(array(OC_User::getUser(), $_GET['view']));
  18. $photos = array();
  19. while ($p = $result->fetchRow())
  20. $photos[] = $p['file_path'];
  21. $tmpl = new OC_Template( 'gallery', 'view_album', 'user' );
  22. $tmpl->assign('photos', $photos);
  23. $tmpl->assign('albumName', $_GET['view']);
  24. $tmpl->printPage();
  25. }
  26. ?>