This blob has been accessed 334 times via Git panel.
- <?php
- session_start();
- header("Cache-control: private");
- error_reporting(E_ERROR);
- require("core.php");
- if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
- header("Location: login.php");
- }
- if (!isset($_REQUEST['entry']) or empty($_REQUEST['entry'])) {
- }
- if (!isset($_REQUEST['show']) or empty($_REQUEST['show'])) {
- }
- if (!file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
- }
- $login_username = file_get_contents("data/username.txt");
- //if (file_exists("data/items/{$_REQUEST['entry']}/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
- // exit();
- //}
- if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username) and isset($_POST['edit']) and ($_POST['edit'] == "delete")) {
- unlink("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}");
- if (file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt")) {
- unlink("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt");
- }
- if (file_exists("data/items/{$_REQUEST['entry']}/album/views/{$_REQUEST['show']}.txt")) {
- unlink("data/items/{$_REQUEST['entry']}/album/views/{$_REQUEST['show']}.txt");
- }
- if (count(glob("images/{$_REQUEST['entry']}/album/*")) < 1) {
- header("Location: index.php?entry={$_REQUEST['entry']}");
- }
- header("Location: album.php?entry={$_REQUEST['entry']}&show={$_REQUEST['next']}");
- }
- if (isset($_POST['filename']) and !empty($_POST['filename']) and isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username) and isset($_POST['edit']) and ($_POST['edit'] == "rename") and !file_exists("images/{$_REQUEST['entry']}/album/{$_POST['filename']}")) {
- $filename = strtolower($_POST['filename']);
- $filename = str_replace(" ","_",$filename);
- $filename = trim($filename);
- rename("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}","images/{$_REQUEST['entry']}/album/{$filename}");
- if (file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt")) {
- rename("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt","data/items/{$_REQUEST['entry']}/album/captions/{$filename}.txt");
- }
- if (file_exists("data/items/{$_REQUEST['entry']}/album/views/{$_REQUEST['show']}.txt")) {
- rename("data/items/{$_REQUEST['entry']}/album/views/{$_REQUEST['show']}.txt","data/items/{$_REQUEST['entry']}/album/views/{$filename}.txt");
- }
- header("Location: album.php?entry={$_REQUEST['entry']}&show=$filename");
- }
- if ((!isset($_POST['caption']) or empty($_POST['caption'])) and isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username) and isset($_POST['edit']) and ($_POST['edit'] == "caption")) {
- if (file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt")) {
- unlink("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt");
- }
- }
- if (isset($_POST['caption']) and !empty($_POST['caption']) and isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username) and isset($_POST['edit']) and ($_POST['edit'] == "caption")) {
- $caption_put = ucfirst($_POST['caption']);
- $caption_put = str_replace(':((', '<img src="images/smileys/crying.png" border="0">', $caption_put);
- $caption_put = str_replace(':(', '<img src="images/smileys/frown.png" border="0">', $caption_put);
- $caption_put = str_replace(':|', '<img src="images/smileys/indifferent.png" border="0">', $caption_put);
- $caption_put = str_replace(':D', '<img src="images/smileys/laughing.png" border="0">', $caption_put);
- $caption_put = str_replace(':P', '<img src="images/smileys/lick.png" border="0">', $caption_put);
- $caption_put = str_replace(':O', '<img src="images/smileys/ohno.png" border="0">', $caption_put);
- $caption_put = str_replace(':)', '<img src="images/smileys/smile.png" border="0">', $caption_put);
- $caption_put = str_replace('=)', '<img src="images/smileys/surprised.png" border="0">', $caption_put);
- $caption_put = str_replace(':\\', '<img src="images/smileys/undecided.png" border="0">', $caption_put);
- $caption_put = str_replace(';)', '<img src="images/smileys/wink.png" border="0">', $caption_put);
- $caption_put = str_replace('[code]', '<code>', $caption_put);
- $caption_put = str_replace('[/code]', '</code>', $caption_put);
- $caption_put = str_replace("\n", '<br />', $caption_put);
- $caption_put = str_replace('[b]', '<b>', $caption_put);
- $caption_put = str_replace('[/b]', '</b>', $caption_put);
- $caption_put = str_replace('[i]', '<i>', $caption_put);
- $caption_put = str_replace('[/i]', '</i>', $caption_put);
- $caption_put = str_replace('[u]', '<u>', $caption_put);
- $caption_put = str_replace('[/u]', '</u>', $caption_put);
- $caption_put = str_replace('[strike]', '<strike>', $caption_put);
- $caption_put = str_replace('[/strike]', '</strike>', $caption_put);
- $caption_put = str_replace('[sup]', '<sup>', $caption_put);
- $caption_put = str_replace('[/sup]', '</sup>', $caption_put);
- $caption_put = str_replace('[sub]', '<sub>', $caption_put);
- $caption_put = str_replace('[/sub]', '</sub>', $caption_put);
- $caption_put = str_replace('[highlight]', '<highlight>', $caption_put);
- $caption_put = str_replace('[/highlight]', '</highlight>', $caption_put);
- $caption_put = str_replace('<highlight>', '<span style="background-color: #ffff00;">', $caption_put);
- $caption_put = str_replace('</highlight>', '</span>', $caption_put);
- if (!file_exists("data/items/{$_REQUEST['entry']}/album")) {
- mkdir("data/items/{$_REQUEST['entry']}/album");
- }
- if (!file_exists("data/items/{$_REQUEST['entry']}/album/captions")) {
- mkdir("data/items/{$_REQUEST['entry']}/album/captions");
- }
- $open_caption_txt_file = fopen("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt","w");
- }
- echo "<title>{$_REQUEST['show']}</title>";
- ?>
- <style>
- body {
- color: #666666;
- margin: 10px;
- padding: 0px;
- text-align: left;
- font-family: <?php
- if (file_exists("data/fonts/body.txt")) {
- $font_body = file_get_contents("data/fonts/body.txt");
- echo "{$font_body},";
- }
- ?> arial, helvetica, sans-serif;
- background-color: #FFFFFF;
- }
- p,td {
- font-size: 11px;
- }
- a {
- font-weight: bold;
- text-decoration: none;
- }
- a:link, a:visited {
- color: #666666;
- }
- a:hover {
- color: #336699;
- }
- a:active {
- color: #336699;
- }
- .input {
- color: #666666;
- background: #FFFFFF;
- border: #999999 solid 1px;
- width: 100%;
- font-family: <?php
- if (file_exists("data/fonts/input.txt")) {
- $font_input = file_get_contents("data/fonts/input.txt");
- echo "{$font_input},";
- }
- ?> arial, helvetica, sans-serif;
- font-size: 11px;
- }
- </style>
- <?php
- if (file_exists("images/{$_REQUEST['entry']}/album")) {
- if ($dh_album = opendir("images/{$_REQUEST['entry']}/album")) {
- while (($entry_album = readdir($dh_album)) !== false) {
- if ($entry_album != "." && $entry_album != ".." && fnmatch("*", $entry_album)) {
- $sort_album[] = $entry_album;
- }
- }
- closedir($dh_album);
- }
- sort($sort_album);
- reset($sort_album);
- }
- $key_view = array_search($_REQUEST['show'],$sort_album);
- $key_prev = $key_view - 1;
- $key_next = $key_view + 1;
- $show_prev = $sort_album[$key_prev];
- $show_next = $sort_album[$key_next];
- $count_album_entry = count($sort_album);
- $album_image_colspan = 4;
- // echo "$count_album_entry -> $key_prev | $key_view | $key_next";
- if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
- if (!file_exists("data/items/{$_REQUEST['entry']}/album/views")) {
- mkdir("data/items/{$_REQUEST['entry']}/album/views");
- }
- if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
- $fp_image_views_txt = fopen("data/items/{$_REQUEST['entry']}/album/views/{$_REQUEST['show']}.txt","r");
- $image_views_value = fread($fp_image_views_txt,filesize("data/items/{$_REQUEST['entry']}/album/views/{$_REQUEST['show']}.txt"));
- $image_views_value = $image_views_value + 1;
- $fp_image_views_txt = fopen("data/items/{$_REQUEST['entry']}/album/views/{$_REQUEST['show']}.txt","w");
- }
- echo "<table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" bgcolor=\"#ffffff\"><tr><td valign=\"top\">";
- echo "<table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" bgcolor=\"#cccccc\"><tr bgcolor=\"#ffffff\">";
- if ($key_prev >= 0) {
- $album_image_colspan = $album_image_colspan + 1;
- echo "<td align=\"left\" width=\"11\"><a href=\"album.php?entry={$_REQUEST['entry']}&show=$show_prev\"><img src=\"images/widget.back.png\" border=\"0\" width=\"11\" height=\"11\"></a></td>";
- }
- echo "<td align=\"center\"><b>{$_REQUEST['show']}</b></td><td align=\"center\">";
- $album_image_size = getimagesize("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}",$album_image_info);
- $album_image_width = $album_image_size[0];
- $album_image_height = $album_image_size[1];
- echo "$album_image_width x $album_image_height pixels";
- $size = filesize("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}");
- echo "</td><td align=\"center\">$size_string</td><td align=\"center\">";
- $album_image_views = file_get_contents("data/items/{$_REQUEST['entry']}/album/views/{$_REQUEST['show']}.txt");
- echo "$album_image_views view";
- if ($album_image_views > 1) {
- echo "s";
- }
- echo "</td>";
- if ($key_next < $count_album_entry) {
- $album_image_colspan = $album_image_colspan + 1;
- echo "<td align=\"right\" width=\"11\"><a href=\"album.php?entry={$_REQUEST['entry']}&show=$show_next\"><img src=\"images/widget.move.png\" border=\"0\" width=\"11\" height=\"11\"></a></td>";
- }
- echo "</tr>";
- echo "<tr bgcolor=\"#ffffff\"><td colspan=\"$album_image_colspan\" align=\"center\">";
- echo "<img src=images/{$_REQUEST['entry']}/album/{$_REQUEST['show']} width=$album_image_width height=$album_image_height border=0>";
- echo "</td></tr>";
- if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
- echo "<form enctype=\"multipart\/form-data\" action=\"{$_SERVER['PHP_SELF']}\" method=\"post\">";
- echo "<input type=hidden name=entry value={$_REQUEST['entry']}>";
- echo "<input type=hidden name=show value={$_REQUEST['show']}>";
- echo "<input type=hidden name=next value=$show_next>";
- echo "<input type=hidden name=edit value=delete>";
- echo "<tr bgcolor=#ffffff><td colspan=\"$album_image_colspan\"><input type=submit class=input value=\"click here to delete image\"></td></tr>";
- echo "</form>";
- echo "<form enctype=\"multipart\/form-data\" action=\"{$_SERVER['PHP_SELF']}\" method=\"post\">";
- echo "<input type=hidden name=entry value={$_REQUEST['entry']}>";
- echo "<input type=hidden name=show value={$_REQUEST['show']}>";
- echo "<input type=hidden name=edit value=rename>";
- echo "<tr bgcolor=#ffffff><td colspan=\"$album_image_colspan\"><input type=text autocomplete=off class=input name=filename value={$_REQUEST['show']}></td></tr>";
- echo "<tr bgcolor=#ffffff><td colspan=\"$album_image_colspan\"><input type=submit class=input value=\"click here to rename image\"></td></tr>";
- echo "</form>";
- echo "<form enctype=\"multipart\/form-data\" action=\"{$_SERVER['PHP_SELF']}\" method=\"post\">";
- echo "<input type=hidden name=entry value={$_REQUEST['entry']}>";
- echo "<input type=hidden name=show value={$_REQUEST['show']}>";
- echo "<input type=hidden name=edit value=caption>";
- echo "<tr bgcolor=#ffffff><td colspan=\"$album_image_colspan\">";
- echo "<textarea class=input name=caption rows=3 autofocus required>";
- if (file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt")) {
- $caption_get = file_get_contents("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt");
- $caption_get = str_replace('<br />', "\n", $caption_get);
- $caption_get = str_replace('<img src="images/smileys/crying.png" border="0">', ':((', $caption_get);
- $caption_get = str_replace('<img src="images/smileys/frown.png" border="0">', ':(', $caption_get);
- $caption_get = str_replace('<img src="images/smileys/indifferent.png" border="0">', ':|', $caption_get);
- $caption_get = str_replace('<img src="images/smileys/laughing.png" border="0">', ':D', $caption_get);
- $caption_get = str_replace('<img src="images/smileys/lick.png" border="0">', ':P', $caption_get);
- $caption_get = str_replace('<img src="images/smileys/ohno.png" border="0">', ':O', $caption_get);
- $caption_get = str_replace('<img src="images/smileys/smile.png" border="0">', ':)', $caption_get);
- $caption_get = str_replace('<img src="images/smileys/surprised.png" border="0">', '=)', $caption_get);
- $caption_get = str_replace('<img src="images/smileys/undecided.png" border="0">', ':\\', $caption_get);
- $caption_get = str_replace('<img src="images/smileys/wink.png" border="0">', ';)', $caption_get);
- $caption_get = str_replace('<span style="background-color: #ffff00;">', '<highlight>', $caption_get);
- $caption_get = str_replace('</span>', '</highlight>', $caption_get);
- echo $caption_get;
- }
- echo "</textarea>";
- echo "<input type=submit class=input value=\"click here to update caption\">";
- echo "</td></tr></form>";
- }
- if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
- if (file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt")) {
- echo "<tr bgcolor=\"#ffffff\"><td colspan=\"$album_image_colspan\" width=\"$album_image_width\">";
- $caption_get = file_get_contents("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt");
- echo $caption_get;
- echo "</td></tr>";
- }
- }
- echo "</table>";
- echo "</td><td width=\"10\"></td><td valign=\"top\">";
- //if(isset($album_image_info['APP13'])) {
- //
- // $album_image_iptc = iptcparse($album_image_info['APP13']);
- //
- // foreach (array_keys($album_image_iptc) as $album_image_iptc_array) {
- //
- // $c = count($album_image_iptc[$album_image_iptc_array]);
- //
- // for ($i=0; $i <$c; $i++) {
- // echo $album_image_iptc_array . ' = ' . $album_image_iptc[$album_image_iptc_array][$i] .'<br>';
- // }
- // }
- //}
- $album_image_exif = exif_read_data("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}", 0, true);
- foreach ($album_image_exif as $album_image_exif_key => $album_image_exif_section) {
- foreach ($album_image_exif_section as $album_image_exif_name => $album_image_exif_value) {
- $album_image_exif_value = strip_tags($album_image_exif_value);
- if ((($album_image_exif_key == "EXIF") or ($album_image_exif_key == "IFD0")) and !empty($album_image_exif_value) and ($album_image_exif_name != "MakerNote") and ($album_image_exif_name != "ComponentsConfiguration") and ($album_image_exif_name != "FileSource") and ($album_image_exif_name != "SceneType") and ($album_image_exif_name != "CFAPattern") and !preg_match("/UndefinedTag/",$album_image_exif_name)) {
- echo "<nobr>$album_image_exif_name: $album_image_exif_value</nobr><br>";
- }
- }
- }
- echo "</td></tr></table>";
- if (file_exists("data/fb.txt") and file_exists("data/items/{$_REQUEST['entry']}/fb.txt")) {
- if (isset($_SERVER['HTTPS'])) {
- $entry_url = "https://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), "/\\") . "/album.php?entry={$_REQUEST['entry']}&show={$_REQUEST['show']}";
- }
- else {
- $entry_url = "http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), "/\\") . "/album.php?entry={$_REQUEST['entry']}&show={$_REQUEST['show']}";
- }
- echo "<div style=\"margin: 4px;\"><div id=\"fb-root\"></div><script src=\"http://connect.facebook.net/en_US/all.js#xfbml=1\"></script><fb:like href=\"$entry_url\" send=\"false\" width=\"$album_image_width\" show_faces=\"true\" font=\"\"></fb:like></div>";
- }
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\"><tr><td valign=\"top\" colspan=\"3\">";
- echo "<table cellspacing=1 cellpadding=2 border=0 bgcolor=#cccccc><tr bgcolor=#ffffff><td width=100%><p><b>Album</b></p></td></tr><tr bgcolor=#ffffff><td width=100%>";
- if (file_exists("images/{$_REQUEST['entry']}/thumbnails")) {
- if ($dh_album = opendir("images/{$_REQUEST['entry']}/thumbnails")) {
- while (($thumbnail_album = readdir($dh_album)) !== false) {
- if ($thumbnail_album != "." && $thumbnail_album != ".." && fnmatch("*",$thumbnail_album)) {
- $current_thumbnail = "images/{$_REQUEST['entry']}/thumbnails/$thumbnail_album";
- $parent_image = str_replace("-thumbnail.jpg","",$thumbnail_album);
- $parent_image = "images/{$_REQUEST['entry']}/album/$parent_image";
- if (file_exists($current_thumbnail) and !file_exists($parent_image)) {
- unlink($current_thumbnail);
- }
- }
- }
- }
- }
- if ($count_album_entry < 1) {
- rmdirr("images/{$_REQUEST['entry']}/album");
- rmdirr("images/{$_REQUEST['entry']}/thumbnails");
- }
- else {
- foreach($sort_album as $album_entry) {
- $current_image = "images/{$_REQUEST['entry']}/album/$album_entry";
- $current_image_size = getimagesize($current_image);
- $current_width = $current_image_size[0];
- $current_height = $current_image_size[1];
- $max_width = 98;
- $max_height = 73;
- if (($current_width > $max_width) || ($current_height > $max_height)) {
- if ($current_height > $current_width) {
- $sizefactor = (double) ($max_height / $current_height);
- }
- else {
- $sizefactor = (double) ($max_width / $current_width) ;
- }
- $new_width = (int) ($current_width * $sizefactor);
- $new_height = (int) ($current_height * $sizefactor);
- }
- else {
- $new_width = $current_width;
- $new_height = $current_height;
- }
- if (!file_exists("images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg")) {
- $work_thumb = imagecreatetruecolor($new_width,$new_height);
- $get_mimetype = image_type_to_mime_type(exif_imagetype($current_image));
- switch($get_mimetype) {
- case "image/jpg":
- case "image/jpeg":
- $work_image = imagecreatefromjpeg($current_image);
- break;
- case "image/gif":
- $work_image = imagecreatefromgif($current_image);
- break;
- case "image/png":
- $work_image = imagecreatefrompng($current_image);
- break;
- }
- imagecopyresampled($work_thumb,$work_image,0,0,0,0,$new_width,$new_height,$current_width,$current_height);
- if (!file_exists("images/{$_REQUEST['entry']}/thumbnails")) {
- mkdir("images/{$_REQUEST['entry']}/thumbnails");
- }
- imagejpeg($work_thumb,"images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg",80);
- imagedestroy($work_thumb);
- imagedestroy($work_image);
- }
- echo "<a href=\"album.php?entry={$_REQUEST['entry']}&show=$album_entry\">";
- if (!file_exists("images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg")) {
- echo "<img src=\"images/{$_REQUEST['entry']}/album/$album_entry\" width=$new_width height=$new_height border=0 hspace=2 vspace=2";
- }
- else {
- echo "<img src=\"images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg\" width=$new_width height=$new_height border=0 hspace=2 vspace=2";
- }
- if (file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$album_entry}.txt")) {
- echo ' alt="';
- $img_alt = file_get_contents("data/items/{$_REQUEST['entry']}/album/captions/{$album_entry}.txt");
- $img_alt = strip_tags($img_alt);
- echo $img_alt;
- echo '"';
- }
- echo "></a>";
- }
- }
- echo "</td></tr><form method=post action=index.php?entry={$_REQUEST['entry']}&show=album><tr bgcolor=#ffffff><td><input class=input type=submit value=\"click here to go to the main entry\"></td></tr></form><form method=post action=index.php><tr bgcolor=#ffffff><td><input class=input type=submit value=\"click here to go to the index page\"></td></tr></form></table>";
- echo "</td></tr></table>";
- }
- if ($key_prev >= 0) {
- echo "\n\n<script>\n\tvar img_prev = new Image();\n\timg_prev.src = \"images/{$_REQUEST['entry']}/album/$show_prev\";\n</script>";
- }
- if ($key_next < $count_album_entry) {
- echo "\n\n<script>\n\tvar img_next = new Image();\n\timg_next.src = \"images/{$_REQUEST['entry']}/album/$show_next\";\n</script>";
- }
- ?>