Example #1
0
 // child2 = album id
 if (!$this->child || !$this->child2) {
     die('XXX wrong album params');
 }
 $user = User::get($this->child);
 if (!$user) {
     die('XXX NO SUCH USER');
 }
 $album = PhotoAlbum::get($this->child2);
 if ($album->owner != 0 && $album->owner != $this->child) {
     throw new \Exception('epic HACK attempt');
 }
 echo '<h1>Photo album ' . $album->name . ' by ' . UserLink::render($this->child) . '</h1>';
 echo 'Created ' . ago($album->time_created) . '<br/>';
 // shows album content
 $images = File::getByCategory(USER, $this->child2, $this->child);
 if (!$images && $album->owner) {
     echo '&raquo; ' . ahref('u/album/delete/' . $this->child2, 'Delete empty album') . '<br/>';
 }
 if ($session->id == $this->child) {
     echo '&raquo; ' . ahref('u/album/upload/' . $this->child2, 'Add photos') . '<br/>';
 }
 foreach ($images as $im) {
     $a = new XhtmlComponentA();
     $a->href = getThumbUrl($im->id, 0, 0);
     $a->rel = 'lightbox[album]';
     $a->content = showThumb($im->id, $im->name, 150, 150);
     echo $a->render();
     echo ahref('u/photo/show/' . $im->id, 'Details');
     echo '<br/><br/>';
 }