<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) PHP-Fusion Inc
| https://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: images.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../maincore.php";
if (!checkrights
("IM") || !defined("iAUTH") || !isset($_GET['aid']) || $_GET['aid'] != iAUTH
) { redirect
("../index.php"); }
require_once THEMES."templates/admin_header.php";
include LOCALE.LOCALESET."admin/image_uploads.php";
if (isset($_GET['action']) && $_GET['action'] = "update") include INCLUDES
."buildlist.php";
$a_id = dbquery("SELECT album_id FROM ".DB_PHOTO_ALBUMS."");
while ($id = dbarray($a_id)) {
$folders[] = PHOTOS."album_".$id['album_id']."/";
}
for ($j = 0; $j < count($folders); $j++){ $image_array[] = makefilelist($folders[$j], ".|..", true, "files", "php|js|ico|DS_Store|SVN");
}
for ($a=0; $a < count($image_array); $a++) { $image_list = $image_array[$a];
$afolder = $folders[$a];
$image_count = count($image_list);
if (isset($_GET['status'])) { if ($_GET['status'] == "del") {
$title = $locale['400'];
$message = "<strong>".$locale['401']."</strong>";
} elseif ($_GET['status'] == "upn") {
$title = $locale['420'];
$message = "<strong>".$locale['425']."</strong>";
} elseif ($_GET['status'] == "upy") {
$title = $locale['420'];
$message = "<img src='".$afolder.stripinput($_GET['img'])."' alt='".stripinput($_GET['img'])."' /><br /><br />\n<strong>".$locale['426']."</strong>";
}
opentable($title);
echo "<div style='text-align:center'>".$message."</div>\n";
closetable();
}
if (isset($_GET['del']) && in_array($_GET['del'], $image_list)) { unlink($afolder.stripinput
($_GET['del'])); if ($settings['tinymce_enabled'] == 1) { include INCLUDES."buildlist.php"; }
redirect(FUSION_SELF.$aidlink."&status=del&ifolder=".$afolder);
} elseif (isset($_POST['uploadimage'])) { $error = "";
".gif",
".GIF",
".jpeg",
".JPEG",
".jpg",
".JPG",
".png",
".PNG"
);
$imgname = stripfilename
(strtolower(substr($_FILES['myfile']['name'], 0, strrpos($_FILES['myfile']['name'], ".")))); $imgsize = $_FILES['myfile']['size'];
$imgtemp = $_FILES['myfile']['tmp_name'];
redirect(FUSION_SELF.$aidlink."&status=upn&ifolder=".$afolder);
@chmod($afolder.$imgname.$imgext, 0644); if ($settings['tinymce_enabled'] == 1) { include INCLUDES."buildlist.php"; }
redirect(FUSION_SELF.$aidlink."&status=upy&ifolder=".$afolder."&img=".$imgname.$imgext);
}
} else {
opentable($locale['420']);
echo "<form name='uploadform' method='post' action='".FUSION_SELF.$aidlink."&ifolder=".$afolder."' enctype='multipart/form-data'>\n";
echo "<table cellpadding='0' cellspacing='0' width='350'>\n<tr>\n";
echo "<td width='80'>".$locale['421']."</td>\n";
echo "<td><input type='file' name='myfile' class='textbox' style='width:250px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td align='center' colspan='2'>\n";
echo "<input type='submit' name='uploadimage' value='".$locale['420']."' class='button' /></td>\n";
echo "</tr>\n</table>\n</form>\n";
closetable();
if (isset($_GET['view']) && in_array($_GET['view'], $image_list)) { opentable($locale['440']);
echo "<div style='text-align:center'><br />\n";
$image_ext = strrchr($afolder.stripinput
($_GET['view']),"."); if (in_array($image_ext, array(".gif",".GIF",".ico",".jpg",".JPG",".jpeg",".JPEG",".png",".PNG"))) { echo "<img src='".$afolder.stripinput($_GET['view'])."' alt='".stripinput($_GET['view'])."' /><br /><br />\n";
} else {
echo $locale['441']."<br /><br />\n";
}
echo "<a href='".FUSION_SELF.$aidlink."&ifolder=".$afolder."&del=".stripinput($_GET['view'])."' onclick=\"return confirm('".$locale['470']."');\">".$locale['442']."</a>";
echo "<br /><br />\n<a href='".FUSION_SELF.$aidlink."'>".$locale['402']."</a><br /><br />\n</div>\n";
closetable();
} else {
$a_id = dbquery("SELECT album_id FROM ".DB_PHOTO_ALBUMS."");
opentable($locale['460']);
echo "<table cellpadding='0' cellspacing='1' width='450'>\n<tr>\n";
echo "<td align='center' colspan='2'>\n";
echo "<span style='font-weight:".($afolder ? "bold" : "normal")."'><a href='".FUSION_SELF.$aidlink."&ifolder=".$afolder."'>".$locale['423']."</a></span> |\n";
echo "</td>\n</tr>\n";
if ($image_list) {
for ($i=0; $i < $image_count; $i++) {
echo "<tr>\n<td>".$image_list[$i]."</td>\n";
echo "<td width='1%' style='white-space:nowrap'>\n";
echo "<a href='".FUSION_SELF.$aidlink."&ifolder=".$afolder."&view=".$image_list[$i]."'>".$locale['461']."</a> -\n";
echo "<a href='".FUSION_SELF.$aidlink."&ifolder=".$afolder."&del=".$image_list[$i]."' onclick=\"return confirm('".$locale['470']."');\">".$locale['462']."</a></td>\n";
echo "</tr>\n";
}
if ($settings['tinymce_enabled'] == 1) echo "<tr>\n<td align='center' colspan='2' class='tbl1'><a href='".FUSION_SELF.$aidlink."&ifolder=".$afolder."&action=update'>".$locale['464']."</a></td>\n</tr>\n";
} else {
echo "<tr>\n<td align='center' class='tbl1'>".$locale['463']."</td>\n</tr>\n";
}
echo "</table>\n";
closetable();
}
}
}
require_once THEMES."templates/footer.php";
?>