* @version $Id$ * @license http://opensource.org/licenses/agpl-v3.html */ /** * img.pew.cc Image Hosting * Copyright (C) 2009-2010 Daniel Triendl * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ require_once('lib/init.php'); require_once('lib/class.browse.php'); if (!isset($_GET['i'])) { errorMsg('Image not found.'); } $id = urlnumber_decode($_GET['i']); $browse = new browse($pdo); try { $image = $browse->getImage($id); } catch (BrowseException $e) { errorMsg($e->getMessage()); } // Get tags $tags = $browse->getImageTags($id); $tags_text = ''; foreach ($tags as $tag) { $tags_text .= '' . htmlentities($tag->text, ENT_QUOTES, 'UTF-8') . ', '; } $tags_text = substr($tags_text, 0, -2); // Generate HTML and code snippets for inserting the image $output = '

' . htmlentities(one_wordwrap($image->original_name, 5, '­'), ENT_QUOTES, 'UTF-8', false) . '

Tags: ' . $tags_text . '

'; if ($show_local_path) { $output .= ' '; } $output .= '
  Plain HTML BB code
Preview
Full
Path
'; $header = ''; if(isLogin()) { if ($image->user == $_SESSION['openid_identity'] || isAdmin()) { $header = ''; $header .= ''; } } outputHTML($output, array('title' => 'Image: ' . htmlentities($image->original_name, ENT_QUOTES, 'UTF-8'), 'lightbox' => true, 'header' => $header)); ?>