33 lines
929 B
PHP
33 lines
929 B
PHP
<?php
|
|
/*****************************************************************************
|
|
* ViewPhoto.php
|
|
* Contains the view photo controller
|
|
*
|
|
* Kabuki CMS (C) 2013-2016, Aaron van Geffen
|
|
*****************************************************************************/
|
|
|
|
class ViewPhoto extends HTMLController
|
|
{
|
|
public function __construct()
|
|
{
|
|
$photo = Asset::fromSlug($_GET['slug']);
|
|
if (empty($photo))
|
|
throw new NotFoundException();
|
|
|
|
parent::__construct($photo->getTitle() . ' - ' . SITE_TITLE);
|
|
$page = new PhotoPage($photo->getImage());
|
|
|
|
// Exif data?
|
|
$exif = EXIF::fromFile($photo->getFullPath());
|
|
if ($exif)
|
|
$page->setExif($exif);
|
|
|
|
$this->page->adopt($page);
|
|
$this->page->setCanonicalUrl($photo->getPageUrl());
|
|
|
|
// Add an edit button to the admin bar.
|
|
if (Registry::get('user')->isAdmin())
|
|
$this->admin_bar->appendItem(BASEURL . '/editasset/?id=' . $photo->getId(), 'Edit this photo');
|
|
}
|
|
}
|