This blob has been accessed 338 times via Git panel.
- <?php
- session_start();
- header("Cache-control: private");
- error_reporting(E_ERROR);
- if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
- header("Location: login.php");
- }
- if (get_magic_quotes_gpc()) {
- function stripslashes_array($data) {
- if (is_array($data)) {
- foreach ($data as $key => $value) {
- $data[$key] = stripslashes_array($value);
- }
- return $data;
- }
- else {
- return stripslashes($data);
- }
- }
- $_REQUEST = stripslashes_array($_REQUEST);
- }
- 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 (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");
- }
- }
- 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 {
- 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/{$_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=#cccccc>";
- echo "<tr bgcolor=#ffffff><td><p align=center><b>{$_REQUEST['show']}</b></p></td><td><p align=center>";
- $album_image_size = getimagesize("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}");
- $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 "</p></td><td><p align=center>$size_string</p></td><td><p 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 "</p></td></tr>";
- echo "<tr bgcolor=#ffffff><td colspan=4>";
- 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=edit value=delete>";
- echo "<tr bgcolor=#ffffff><td colspan=4><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=4><input type=text autocomplete=off class=input name=filename value={$_REQUEST['show']}></td></tr>";
- echo "<tr bgcolor=#ffffff><td colspan=4><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=4>";
- echo "<textarea class=input name=caption rows=3>";
- 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=4 width=$album_image_width><p>";
- $caption_get = file_get_contents("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt");
- echo $caption_get;
- echo "</p></td></tr>";
- }
- }
- echo "</table>";
- }
- echo "<p></p>";
- echo "<table cellspacing=1 cellpadding=2 border=0 bgcolor=#cccccc><tr bgcolor=#ffffff><td width={$album_image_width}><p><b>Album</b></p></td></tr><tr bgcolor=#ffffff><td width={$album_image_width}>";
- 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 (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);
- $count_album_entry = count($sort_album);
- 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);
- }
- 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>";
- ?>