File: /home/httpd/html/seekya.com/DEAD/manage/image.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Image</title>
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
input {
border-left: 1px outset #F6F6F6;
border-top: 1px outset #F6F6F6;
border-right: 1px outset #EEEEEE;
border-bottom: 1px outset #EEEEEE;
height: 14px;
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
}
select {
height: 14px;
border-left: 1px outset #F6F6F6;
border-top: 1px outset #F6F6F6;
border-right: 1px outset #EEEEEE;
border-bottom: 1px outset #EEEEEE;
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
}
.none {
height: 18px;
font-weight: 600;
font-size: 10px;
cursor: hand;
color: #000000;
font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
}
select{height: 22px; top:2; font:8pt verdana,arial,sans-serif}
body {border:lightgrey 0px solid;background: #ece9d8;filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=white, endColorstr=#e3e3e3);}
.bar{padding-left: 5px;border-top: #99ccff 1px solid; background: #004684;filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#004684, endColorstr=#7189b7); border-bottom: #004684 1px solid;height: 20px}
.bar2{border-top: #99ccff 1px solid; background: #004684;filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#004684, endColorstr=#7189b7); border-bottom: #004684 1px solid;height: 20px}
td { font:8pt verdana,arial,sans-serif}
div { font:10pt tahoma,arial,sans-serif }
-->
</style></head>
<script language="javascript" type="text/javascript">
function InsertImage() {
var frm = document.frm;
if (frm.s.value != '') {
oName=window.opener.oUtil.oName;
eval("window.opener."+oName).InsertImage('http://www.communityresourcelocator.org/admin/'+frm.s.value,frm.a.value,frm.al.value,frm.b.value,frm.w.value,frm.h.value,frm.hs.value,frm.vs.value);
} else
alert('Image source is blank');
}
</script>
<body marginheight="0" marginwidth="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<?php
$root = "images";
$ext = ",.jpg,jpeg,.jpe,.gif,.bmp,tiff,.ico,";
if (!empty($_POST["d"])) {
$od = filterdir(trim($_POST["d"]));
$d = $root . "/" . $od;
}
else
$d = $root;
if ($_FILES["fl"]["size"]) {
$uflname = $_FILES["fl"]["name"];
if (strpos($ext, ',' . strtolower(substr($uflname, strlen($uflname)-4, 4)) . ',')>-1)
if (!move_uploaded_file($_FILES["fl"]["tmp_name"], $d . '/' . $uflname))
echo "<script>alert('Error while uploading file. Please check permissions. File not uploaded');</script>";
else
echo "<script>alert('File uploaded');</script>";
else
echo "<script>alert('File extension not allowed. File not uploaded');</script>";
}
$rd = realpath($d);
if (!file_exists($rd)) {
die("couldn't locate directory");
$d = $root;
$rd = ($d);
$od = "";
}
$dir = opendir($rd);
$files = array();
sort($files);
?>
<center>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<form name="frm" method="post" enctype="multipart/form-data">
<input type="hidden" name="d" value="<?=$od?>">
<tr>
<td class="bar" align="left" style="color:#FFFFFF;font-weight:bold"> INSERT/UPLOAD IMAGES </td>
</tr>
<tr><td>
<table width="392" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="5"></td>
</tr>
<tr>
<td align="left">Change directory:
<?php
echo '<a href="javascript:changedir1(\'\');"><strong>' . $root . '/</strong></a>';
$r = split("/", $d);
$rs = '';
for ($i=1; $i<count($r); $i++) {
$rs .= $r[$i];
echo '<a href="javascript:changedir1(\'' . $rs . '\');"><strong>' . $r[$i] . '/</strong></a>';
$rs .= '/';
}
?>
</td>
</tr>
<tr>
<td height="5"></td>
</tr>
</table>
<table width="392" border="0" align="center" cellpadding="0" cellspacing="0" class="bar2">
<tr>
<td width="200" align="left" style="color:#FFFFFF;font-weight:bold" nowrap> Name</td>
<td width="85" align="left" style="color:#FFFFFF;font-weight:bold" nowrap>Filesize(b)</td>
<td width="50" align="left" style="color:#FFFFFF;font-weight:bold" nowrap>Type</td>
</tr>
</table>
<div style="overflow:auto;height:247px;width:390px;border:dotted 1px #000000">
<table width="350" border="0" align="center" cellpadding="0" cellspacing="0">
<?php
while (($file = readdir($dir)) !== false) {
if ((!empty($file)) && trim(substr($file, 0, strlen($file)))!='' && $file != "." && $file != "..") {
?>
<tr>
<td width="230" align="left" nowrap>
<?php
if (is_dir($d . "/" . $file)) {
?>
<a href="javascript:changedir('<?=$file?>');"><strong><?=$file?>/ --></strong></a>
<?php
} else {
if (strpos($ext, ',' . strtolower(substr($file, strlen($file)-4, 4)) . ',')>-1) {
?>
<a href="#" onClick="setimage('<?=$file?>');"><?=$file?></a>
<?php
} else
continue;
}
?>
<td width="100" align="left" nowrap><?=filesize($d."/".$file)?></td>
<td width="20" align="left" nowrap><?=filetype($d."/".$file)?></td>
</tr>
<?php
}
}
?>
</table>
</div>
<table width="350" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td height="5"></td></tr>
<tr>
<td width="100%"><table width="101%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="29%"><img name="main" width="100" height="100"></td>
<td width="71%"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="21%" align="left" nowrap> width </td>
<td width="35%" align="left"><input name="w" type="text" id="w" size="4"></td>
<td width="18%" align="left" nowrap> height </td>
<td width="26%" align="left"><input name="h" type="text" id="h" size="4"></td>
</tr>
<tr>
<td align="left" nowrap> align </td>
<td align="left"><select name="al">
<option value="absbottom">absbottom</option>
<option value="absmiddle">absmiddle</option>
<option value="baseline">baseline</option>
<option value="bottom">bottom</option>
<option value="left">left</option>
<option value="middle">middle</option>
<option value="right">right</option>
<option value="texttop">texttop</option>
<option value="top">top</option>
</select></td>
<td align="left" nowrap> border </td>
<td align="left"><input name="b" type="text" id="b" size="4"></td>
</tr>
<tr>
<td align="left" nowrap> hspace </td>
<td align="left"><input name="hs" type="text" id="hs" size="4"></td>
<td align="left" nowrap> vspace </td>
<td align="left"><input name="vs" type="text" id="vs" size="4"></td>
</tr>
<tr>
<td align="left" nowrap> alt </td>
<td colspan="3" align="left"><input name="a" type="text" id="a" size="37"></td>
</tr>
<tr>
<td align="left" nowrap> source </td>
<td colspan="3" align="left"><input name="s" type="text" id="s" size="37"></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr><td height="5"></td></tr>
</table>
<table width="350" border="0" align="center">
<tr>
<td align="center"><input type="button" class="none" value="CANCEL" onClick="window.close();">
<input type="button" class="none" onClick="InsertImage();" value="INSERT"></td>
</tr>
<tr>
<td>File Upload:
<input name="fl" type="file" class="none"> <input name="Submit" type="submit" class="none" value="Upload"></td>
</tr>
</table>
</td></tr>
</form>
</table>
</center>
<img name="hid" style="visibility:hidden">
</body>
</html>
<?
//close the directory
closedir($dir);
?>
<script>
function setimage(img) {
try {
document.images.main.src = "<?=$root?>/<?=$od?>/" + img;
document.images.hid.src = "<?=$root?>/<?=$od?>/" + img;
document.frm.s.value = "<?=$root?>/<?=$od?>/" + img;
document.frm.w.value = document.images.hid.width;
document.frm.h.value = document.images.hid.height;
} catch(e) {alert(e);}
}
function changedir(d) {
var frm = document.frm;
if (d == "") {
frm.d.value="";
} else
frm.d.value = "<?=$od."/"?>" + d;
frm.submit();
}
function changedir1(d) {
var frm = document.frm;
frm.d.value = d;
frm.submit();
}
</script>
<?php
function filterdir($d) {
$d = str_replace("\\", "/", $d);
while (strpos($d, "//"))
$d = str_replace("//", "/", $d);
if (substr($d, 0, 1) == "/")
$d = substr($d, 1, strlen($d));
if (substr($d, strlen($d)-1, 1) == "/")
$d = substr($d, 0, strlen($d)-1);
return $d;
}
?>