Gå til innhold

Forandre str på bilde i dette scriptet.


Anbefalte innlegg

Fant dette scriptet som jeg hadde tenkt til å bruke som et fotoalbum på siden min. Jeg ønsker å legge ut "store" bilder og dette scriptet har en "mouse over" funksjon som gjør at man får en forhåndsvisning av bilde. Det jeg søker, er noe som lager et mindre bilde automatisk slik at dette vises som forhåndsvisning og ikke orginalbilde med en oppløsning på 1600x1200.

 

Noen som kan hjelpe?

 

Scriptet er hentet fra www.the-nemesis.net som dere ser.

 

På forhånd tusen takk.

 

E.

 

Slik ser scriptet ut:

 

<?php

/*******************************

Directory Listing © by Nemesis

      www.the-nemesis.net

  DirTree Addon by Renatus

      [email protected]

  sortWithUmlauts() by MelloPie

*/ $v="1.21 build 20031230"; /*

    leave this copyright in

*******************************/

//Configpart

$startdir = './';  // Dir where listing starts ('./' is this dir)

$indexes= Array('index.html', 'index.php', 'index.htm');

$dontshow= Array('dontshow.fe', 'test.fe', '*.example');

$gfxdir  = 'source/'; // Folder with file-pics

$vorschausize  = 60000; // max. File Size for Picture Preview in byte

$usechmod  = 1; // Only need on some Unixservers for creating/editing/deleting files

$maxlengthdir  = 29; // maximal name length of folders which are completely displayed

$maxlengthdirtree = 17; // maximal name length of folders which are displayed in the dirtree

$maxlengthfile  = 27; // maximal name length of files which are completely displayed

$allow['delete'] = 0; // delete files

$allow['deletedir'] = 0; // delete empty directories

$allow['rename'] = 0; // rename files

$allow['upload']  = 1; // upload new files

$allow['edit']  = 0; // edit files

$allow['hiding'] = 1; // Files/dirs with a "." in front won't be displayed

$allow['createdir'] = 0; // create new directory

$allow['dirtree'] = 1; // shows directory tree on the left

$allow['filesize'] = 1; // shows filesize in kB/MB/GB, if 0 only in Bytes

$allow['diskspace'] = 1; // shows free and complete space of hdd

 

// text messages:

$msg['deactivated'] = 'Function deactivated';

$msg['preview']  = 'Picture Preview';

$msg['yes']  = 'OK';

$msg['no']  = 'Cancel';

// Rename function -->

$msg['emptyfilename'] = 'You must type in a name for the file';

$msg['renameerror'] = 'File could not be renamed';

$msg['renamesuccess'] = 'File renamed successfully';

// Delete function -->

$msg['askdelete'] = 'Really delete: ';

$msg['deleteerror'] = 'File was not deleted';

$msg['deletesuccess'] = 'File deleted successfully';

// Delete function for directories -->

$msg['deletedirerror'] = 'Directory was not deleted, maybe it is not empty';

$msg['deletedirsuccess']= 'Directory successfully deleted';

// Upload function -->

$msg['uploadempty'] = 'Choose a file to upload';

$msg['uploadexists'] = 'File allready exists';

$msg['uploadsuccsess'] = 'File uploaded successfully';

// Edit function -->

$msg['edit_saved'] = 'File saved';

// Dir functions -->

$msg['emptydirname']='Enter a name for the new dir';

$msg['direxists']='Directory allready exists';

$msg['dirsuccess']='Directory successfully created';

$msg['direrror']='Directory could not be created';

 

//Systempart

$PHP_SELF=$_SERVER['PHP_SELF'];

if(isset($_GET['dir']))$dir=$_GET['dir'];

else if(isset($_POST['dir']))$dir=$_POST['dir'];

else $dir=$startdir;

if($dir[strlen($dir)-1]!="/")$dir.="/";

if(strlen(realpath($dir)) < strlen(realpath($startdir)) || !strstr(realpath($dir), realpath($startdir)))$dir=$startdir;

if(isset($_GET['action']))$action=$_GET['action'];

else if(isset($_POST['action']))$action=$_POST['action'];

else $action='';

?>

<html>

<head>

<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">

<title><?php echo realpath($dir) ?></title>

<style type="text/css">

HTML

{scrollbar-face-color:#F0F0F0;

scrollbar-shadow-color:#C1C1BB;

scrollbar-highlight-color:#C1C1BB;

scrollbar-3dlight-color:#FFFFFF;

scrollbar-darkshadow-color: #FFFFFF;

scrollbar-track-color:#FFFFFF;

scrollbar-arrow-color:#000000;}

.clDescription{left:0px;top:0px;padding-top:0px;overflow:visible;;padding:0px;border:solid #5297F9 1px; background-color:#FFFFFF;}

.clDescriptionCont{position:absolute;visibility:hidden;z-index:200;}

input{font-family:MS Sans Serif;font-size: 8pt;}

.button{border: 1px solid #5297F9;background-color:#FFFFFF;}

input.text{border-top:none;border-left:none;border-right:none;border-bottom: 1px dashed #888888;font-family:MS Sans Serif;font-size: 8pt;background-color:#FAFAFA}

textarea{border: 1px solid #5297F9;font-family:FixedSys;color:#333333;background-color:#FFFFFF;overflow:auto;}

a{text-decoration:none;color:#000000;}

a.dir{text-decoration:none;font-weight:bold;color:#444444;}

a.dir:visited{color: #586079}

a.file{text-decoration:none;color:#000000}

a.file:visited{color: #586079}

body{font-family:MS Sans Serif;font-size: 8pt;background-color:#FFFFFF;cursor:default}

td{font-family:MS Sans Serif;font-size: 8pt;cursor:default;}

td.normal{border-bottom: 1px solid #EAEAEA;word-break:break-all;word-wrap:break-word}

.full{background-color: #FFFFFF;border: 2px solid #5297F9;}

.full2{border-left: 1px solid #7DB1FB;border-top: 1px solid #7DB1FB;border-right: 1px solid #4B8AE6;border-bottom: 1px solid #4B8AE6;}

.borderright{width:170px;border-right: 2px solid #5297F9;padding:0px;}

div.dirtree{overflow:auto;padding:2px;white-space:nowrap;width:170px;}

.titletext{filter:DropShadow(color=#2C60B2, offx=1, offy=1);font-size:10px;color: #FFFFFF;font-weight:bold;width:100%}

td.title{background-color: #5297F9;cursor:default;border-bottom: 1px solid #4B8AE6;}

.xpbut{background-color: #EFEFF3;border: 1px solid #E3E3E3;color: #5C5C5C;}

</style>

<script language="JavaScript">

function inCell(cell)

{if(!cell.contains(event.fromElement))cell.bgColor = "#E0ECFC";}

 

function outCell(cell){

if(!cell.contains(event.toElement))cell.bgColor = "#FFFFFF";}

function sysinfo(){

alrt='PHP:    <?php echo phpversion()?>\n';

alrt+='Server: <?php echo getenv("SERVER_SOFTWARE")?>\n';

alrt+='System: <?php echo php_uname()?>\n';

alrt+='Admin: <?php echo getenv("SERVER_ADMIN")?>\n';

alrt+='Script:    <?php echo $v?>\nscript by www.the-nemesis.net';

alert(alrt);}

 

function lib_bwcheck(){

this.ver=navigator.appVersion

this.agent=navigator.userAgent

this.dom=document.getElementById?1:0

this.opera5=this.agent.indexOf("Opera 5")>-1

this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;

this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;

this.ie4=(document.all && !this.dom && !this.opera5)?1:0;

this.ie=this.ie4||this.ie5||this.ie6

this.mac=this.agent.indexOf("Mac")>-1

this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;

this.ns4=(document.layers && !this.dom)?1:0;

this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)

return this}

var bw=new lib_bwcheck()

//Einstellungen für Vorschau

fromX = 10

fromY = 10

 

function makeObj(obj){

this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;

if(!this.evnt) return false

this.css=bw.dom||bw.ie4?this.evnt.style:bw.ns4?this.evnt:0;

this.wref=bw.dom||bw.ie4?this.evnt:bw.ns4?this.css.document:0;

this.writeIt=b_writeIt;

return this}

var px = bw.ns4||window.opera?"":"px";

function b_writeIt(text){

if (bw.ns4){

this.wref.write(text);this.wref.close()

}

else this.wref.innerHTML = text}

var descx=0

var descy=0

function popmousemove(e){descx=bw.ns4||bw.ns6?e.pageX:event.x; descy=bw.ns4||bw.ns6?e.pageY:event.y}

var oDesc;

function info(text){

if(document.vorschau.bildvorschau.checked == true){

if(oDesc){

oDesc.writeIt('<div class="clDescription">'+text+'</div>')

if(bw.ie5||bw.ie6) descy = descy+document.body.scrollTop

oDesc.css.left = (descx+fromX)+px

oDesc.css.top = (descy+fromY)+px

oDesc.css.visibility = "visible"}}}

function infoout(){

if(oDesc) oDesc.css.visibility = "hidden"}

function setPopup(){

if(bw.ns4)document.captureEvents(Event.MOUSEMOVE)

document.onmousemove = popmousemove;

oDesc = new makeObj('divDescription')}

 

function setstatus(string){

if(string=="clearme")window.status='';

else window.status=string;}

 

function bglow(button){

button.style.backgroundColor='#E0ECFC';

button.style.borderColor='#A0A7C0';}

 

function bback(button){

button.style.backgroundColor='#EFEFF3';

button.style.borderColor='#E3E3E3';}

</script>

</head>

<body>

<div id="divDescription" class="clDescriptionCont"></div>

<div align="center">

<table cellspacing="0" cellpadding="0" border="0" class="full2">

<tr><td>

<table class="full" cellspacing="0" cellpadding="2">

<tr><td class="title" align="center" onselectstart="return false" <? if($allow['dirtree'] == 1)echo 'colspan="2"'; ?>><span class="titletext">Directory Listing</span></td></tr>

<tr><?php if($allow['dirtree'] == 1)echo '<td class="borderright" valign="top"><div class="dirtree">'.dirtree($dir).'</div></td>'; ?><td valign="top">

<?php

if(!empty($action))

{

echo'<font color="#FF0000"><b>';

switch($action)

{

case 'delete': loeschen();break;

case 'upload': doupload();break;

case 'rename': renamefile();break;

case 'edit': edit();break;

case 'createdir': createdir();break;

case 'deletedir': deletedir();break;

}

echo '</b></font>';

}

echo'<table border="0" cellspacing="0" cellpadding="0">';

$dh = opendir($dir);

$files=Array();

$dirs=Array();

while ( gettype( $datei = readdir( $dh ))!='boolean' )

{

if($datei!='.' && $datei!='..' && !is_dir($dir.$datei) && dontshow(basename($datei)))

{

if($datei[0]!='.')array_push($files,$datei);

if($datei[0]=='.' && $allow['hiding']==0)array_push($files,$datei);

}

if($datei!='.' && $datei!='..' && is_dir($dir.$datei))

{

if($datei[0]!='.')array_push($dirs,$datei);

if($datei[0]=='.' && $allow['hiding']==0)array_push($dirs,$datei);

}

}

closedir($dh);

$dirs=sortWithUmlauts($dirs);

$files=sortWithUmlauts($files);

echo '<tr><td><table cellspacing="0" boder="0" cellpadding="0" width="100%">

<tr><form name="vorschau"><td class="normal"><input type="checkbox" name="bildvorschau" value="1" style="vertical-align:middle"> '.$msg['preview'].'</td></form>

<td class="normal" align="right">';

if($allow['diskspace']==1)echo formatfilesize(diskfreespace(realpath($dir)),1).' of '.formatfilesize(disk_total_space(realpath($dir)),1).' free';

echo '</td></tr></table></td></tr>

<tr><td><table cellspacing="0" cellpadding="1" border="0">

<tr>

<td class="normal" width="15"> </a></td>

<td class="normal" align="left" width="140"><b>Name</b></td>

<td align="right" class="normal" width="70"><b>Size</b></td>

<td class="normal" align="center" width="70"><b>Date</b></td>

<td class="normal" align="center" width="50"><b>Time</b></td>

<td class="normal" align="center" width="90"><b>Option</b></td>

</tr>

</table></td></tr>';

dirup();

for($x=0;$x<count($dirs);$x++)

{

$opendir=' ';

foreach($indexes as $index)

{

if(file_exists($dir.$dirs[$x].'/'.$index))$opendir='<a href="'.$dir.$dirs[$x].'">[index]</a> <a href="'.$dir.$dirs[$x].'" target="_blank">[win]</a> ';

}

if($allow['deletedir']==1)$opendir.='<a href="'.$PHP_SELF.'?dir='.rawurlencode($dir).'&action=deletedir&ddir='.rawurlencode($dirs[$x]).'">[del]</a>';

if(!isset($opendir))$opendir=' ';

echo '<tr><td onmouseover="inCell(this);" onmouseout="outCell(this);">

<table cellspacing="0" cellpadding="1" border="0">

<tr>

<td valign="top" class="normal" width="15"><a href="'.$PHP_SELF.'?dir='.rawurlencode($dir.$dirs[$x]).'/"><img src="'.$gfxdir.'dir.gif" border="0" width="15" heigth="15"></a></td>

<td valign="top" class="normal" align="left" width="182"><a href="'.$PHP_SELF.'?dir='.rawurlencode($dir.$dirs[$x]).'/" class="dir"  onmouseover="setstatus(\''.addslashes($dirs[$x]).'\');return true" onmouseout="setstatus(\'clearme\')">'.checklength($dirs[$x]).'</a></td>

<td valign="top" align="right" class="normal" width="28">[DIR]</td>

<td valign="top" class="normal" align="right" width="70">'.date("d.m.Y", filectime($dir.$dirs[$x])).'</td>

<td valign="top" class="normal" align="right" width="50">'.date("H:i:s", filectime($dir.$dirs[$x])).'</td>

<td valign="top" class="normal" align="right" width="90">'.$opendir.'</td>

</tr>

</table>

</td>

</tr>';

}

$filessize = 0;

for($x=0;$x<count($files);$x++)

{

$filesize= formatfilesize(filesize($dir.$files[$x]));

$filessize+= filesize($dir.$files[$x]);

if(file2gfx($files[$x])=='gfx.gif' && filesize($dir.$files[$x])<=$vorschausize)$info = ' onmouseover="info(\'<img src=\\\''.$dir.str_replace("'", "%27", $files[$x]).'\\\'>\');setstatus(\''.addslashes($files[$x]).'\');return true" onmouseout="infoout();setstatus(\'clearme\')"';

else $info=' onmouseover="setstatus(\''.addslashes($files[$x]).'\');return true" onmouseout="setstatus(\'clearme\')"';

$option='';

if($allow['edit']==1)$option.='<a href="'.$PHP_SELF.'?dir='.rawurlencode($dir).'&action=edit&file='.rawurlencode($files[$x]).'">[edit]</a> ';

if($allow['rename']==1)$option.='<a href="'.$PHP_SELF.'?dir='.rawurlencode($dir).'&action=rename&file='.rawurlencode($files[$x]).'">[name]</a> ';

if($allow['delete']==1)$option.='<a href="'.$PHP_SELF.'?dir='.rawurlencode($dir).'&action=delete&file='.rawurlencode($files[$x]).'">[del]</a>';

if(empty($option))$option=' ';

echo '<tr><td onmouseover="inCell(this);" onmouseout="outCell(this);">

<table cellspacing="0" cellpadding="1" width="100%" border="0">

<tr>

<td valign="top" class="normal" width="15"><a href="'.$dir.$files[$x].'"><img src="'.$gfxdir.file2gfx($files[$x]).'" border="0" width="15" heigth="15"></a></td>

<td valign="top" class="normal" align="left" width="155"><a href="'.$dir.$files[$x].'" class="file"'.$info.'>'.checklength($files[$x]).'</a></td>

<td valign="top" align="right" class="normal" width="55">'.$filesize.'</td>

<td valign="top" class="normal" align="right" width="70">'.date("d.m.Y", filectime($dir.$files[$x])).'</td>

<td valign="top" class="normal" align="right" width="50">'.date("H:i:s", filectime($dir.$files[$x])).'</td>

<td valign="top" class="normal" align="right" width="90">'.$option.'</td>

</tr>

</table>

</td>

</tr>';

}

echo'<tr><td align="right">'.formatfilesize($filessize,1).' in '.count($files).' files</td></tr>';

if($allow['upload'] == 1)echo'<tr><td align="center"><form enctype="multipart/form-data" action="'.$PHP_SELF.'" method="post">

<input name="action" type="hidden" value="upload">

<input type="hidden" name="dir" value="'.$dir.'">

<input name="file" type="file" size="24">

<input type="submit" value="upload" class="xpbut" onmouseover="bglow(this);" onmouseout="bback(this);" onblur="bback(this);" onfocus="bglow(this);">

</form></td></tr>';

if($allow['createdir'] == 1)echo'<tr><td align="center"><form action="'.$PHP_SELF.'" method="post">

<input name="action" type="hidden" value="createdir">

<input type="hidden" name="dir" value="'.$dir.'">

<input name="newdir" type="text" size="18" class="text">

<input type="submit" value="create dir" class="xpbut" onmouseover="bglow(this);" onmouseout="bback(this);" onblur="bback(this);" onfocus="bglow(this);">

</form></td></tr>';

?>

<tr><td align="center">script by <a href="http://www.the-nemesis.net" target="_blank">nemesis</a> | <a href="javascript:sysinfo();">SystemInfo</a></td></tr>

</table></td></tr></table></td></tr></table>

</div><script language="JavaScript">setPopup();</script>

</body>

</html>

 

<?php

//---FUNKTIONEN

function dirup()

{

global $dir, $startdir, $gfxdir, $PHP_SELF;

$explodedir = explode("/", $dir);

$newdir='';

for($i=0; $i<count($explodedir)-2; $i++)$newdir.=$explodedir[$i].'/';

$newdir=rawurlencode($newdir);

if($startdir!=$dir)echo'<tr><td onmouseover="inCell(this);" onmouseout="outCell(this);">

<table cellspacing="0" cellpadding="1" width="100%">

<tr>

<td class="normal" width="15"><a href="'.$PHP_SELF.'?dir='.$newdir.'"><img src="'.$gfxdir.'dirup.gif" border="0" width="15" heigth="15"></a></td>

<td class="normal" align="left"><a href="'.$PHP_SELF.'?dir='.$newdir.'" class="dir" onmouseover="setstatus(\'Dir up\');return true" onmouseout="setstatus(\'clearme\')">Parent Directory</a></td>

</tr>

</table>

</td>

</tr>';

}

 

function renamefile()

{

global $_POST, $_GET, $dir, $PHP_SELF, $allow, $msg, $usechmod;

if($allow['rename']==1)

{

if(!empty($_GET['file']))echo'<form action="'.$PHP_SELF.'" method="post" name="rename">

<br><input name="action" type="hidden" value="rename">

<input type="hidden" name="dir" value="'.$dir.'">

<input type="hidden" name="oldfile" value="'.$_GET['file'].'">

'.$_GET['file'].' rename to <input name="file" type="text" size="25" value="'.$_GET['file'].'" class="text"> <input type="submit" value="OK" class="xpbut" onmouseover="bglow(this);" onmouseout="bback(this);" onblur="bback(this);" onfocus="bglow(this);">

</form>';

else if(!empty($_POST['file']))

{

  if($usechmod==1)@chmod($dir.$_POST['oldfile'], 0777);

  if(rename($dir.$_POST['oldfile'], $dir.$_POST['file']))echo $msg['renamesuccess'];

  else echo $msg['renameerror'];

}

else echo $msg['emptyfilename'];

}

else echo $msg['deactivated'];

}

function file2gfx($datei)

{

$datei = basename($datei);

$endung =  strtolower(end(explode(".",$datei)));

$filetypes = Array(

"exe" => "exe",

"bat" => "exe",

"png" => "gfx",

"bmp" => "gfx",

"gif" => "gfx",

"jpg" => "gfx",

"jpeg" => "gfx",

"php" => "php",

"php3" => "php",

"php4" => "php",

"phtml" => "php",

"html" => "web",

"htm" => "web",

"txt" => "text",

"js" => "text",

"css" => "text",

"doc" => "text",

"zip" => "compressed",

"uha" => "compressed",

"rar" => "compressed",

"ace" => "compressed",

"mp3" => "music",

"wav" => "music",

"wma" => "music",

"ogg" => "music",

"mpg" => "video",

"mpeg" => "video",

"avi" => "video",

"wmv" => "video",

"rm" => "video");

if(isset($filetypes[$endung]))return $filetypes[$endung].'.gif';

else return "file.gif";

}

 

function loeschen()

{

global $dir, $_GET, $allow, $msg, $usechmod, $PHP_SELF;

if($allow['delete']==1 && empty($_GET['del']))

{

  echo $msg['askdelete'].'"'.$_GET['file'].'"   <a href="'.$PHP_SELF.'?action=delete&dir='.rawurlencode($dir).'&file='.rawurlencode($_GET['file']).'&del=1">'.$msg['yes'].'</a> <a href="javascript:history.back();">'.$msg['no'].'</a>';

}

elseif($allow['delete']==1 && $_GET['del']==1)

{

  $file = $dir.$_GET['file'];

  if($usechmod==1)@chmod($file, 0777);

  if(@unlink($file))echo $msg['deletesuccess'];

  else echo $msg['deleteerror'];

}

else echo $msg['deactivated'];

}

 

function deletedir()

{

global $dir, $_GET, $allow, $msg, $usechmod, $PHP_SELF;

if($allow['deletedir']==1 && empty($_GET['del']))

{

  echo $msg['askdelete'].'"'.$_GET['ddir'].'"   <a href="'.$PHP_SELF.'?action=deletedir&dir='.rawurlencode($dir).'&ddir='.rawurlencode($_GET['ddir']).'&del=1">'.$msg['yes'].'</a> <a href="javascript:history.back();">'.$msg['no'].'</a>';

}

elseif($allow['deletedir']==1 && $_GET['del']==1)

{

  $deldir = $dir.$_GET['ddir'];

  if($usechmod==1)@chmod($usechmod, 0777);

  if(@rmdir($deldir))echo $msg['deletedirsuccess'];

  else echo $msg['deletedirerror'];

}

else echo $msg['deactivated'];

}

 

function createdir()

{

global $dir, $_POST, $allow, $msg, $usechmod;

if($allow['createdir']==1)

{

  if($usechmod==1)@chmod($dir, 0777);

  if(empty($_POST['newdir']))echo $msg['emptydirname'];

  elseif(is_dir($dir.$_POST['newdir']))echo $msg['direxists'];

  else{

  if(@mkdir($dir.$_POST['newdir']))echo $msg['dirsuccess'];

  else echo $msg['direrror'];

  }

}

else echo $msg['deactivated'];

}

 

function doupload()

{

global $dir, $allow, $_FILES, $msg, $usechmod;

if($allow['upload']!=1)echo $msg['deactivated'];else{

if($usechmod==1)@chmod($dir, 0777);

$tempname = $_FILES['file']['tmp_name'];

$name = $_FILES['file']['name'];

$type = $_FILES['file']['type'];

$size = $_FILES['file']['size'];

if(empty($_FILES['file']['name']))echo $msg['uploadempty'];

elseif(file_exists($dir.$name))echo $msg['uploadexists'];

else

{

  if(copy($tempname, $dir.$name))echo $msg['uploadsuccsess'];

}

}

}

 

function edit()

{

global $dir, $allow, $msg, $PHP_SELF, $_POST, $_GET, $usechmod;

if($allow['edit']!=1)echo $msg['deactivated'];else{

if(!isset($_POST['source']))

{

  $file = $_GET['file'];

  if(file_exists($dir.$file))echo '<form method="post" action="'.$PHP_SELF.'">

  <input type="hidden" name="sfile" value="'.$dir.$file.'">

  <input type="hidden" name="dir" value="'.$dir.'">

  <input type="hidden" name="action" value="edit">

  <textarea name="source" rows="10" cols="54" wrap="off">'.htmlentities(implode("", file($dir.$file))).'</textarea><br>

  <div align="right"><input type="submit" value="save" class="xpbut" onmouseover="bglow(this);" onmouseout="bback(this);" onblur="bback(this);" onfocus="bglow(this);" style="width:50px"><input type="reset" value="reset" class="xpbut" onmouseover="bglow(this);" onmouseout="bback(this);" onblur="bback(this);" onfocus="bglow(this);" style="width:50px"></form></div>';

}

else

{

  if($usechmod==1)@chmod($_POST['sfile'], 0777);

  $fp = fopen ($_POST['sfile'],"w+");

  fwrite($fp,$_POST['source']);

  fclose($fp);

  echo $msg['edit_saved'];

}

}

}

 

function checklength($name, $dt="")

{

global $maxlengthfile,$maxlengthdir, $dir, $maxlengthdirtree;

if((is_dir($dir.$name) && strlen($name)>$maxlengthdir) || ($dt=="dt" && strlen($name)>$maxlengthdirtree) || (is_file($dir.$name) && strlen($name)>$maxlengthfile))

{

  if(is_dir($dir.$name) && empty($dt))

  {

  $newname=substr($name, 0, $maxlengthdir).'..';

  return $newname;

  }

  else if($dt=="dt")

  {

  $newname=substr($name, 0, $maxlengthdirtree).'..';

  return $newname;

  }

  else

  {

  $end=end(explode(".", $name));

  $endl=strlen($end);

  $newname=substr($name, 0, $maxlengthfile-$endl).'..'.$end;

  return $newname;

  }

}

else return $name;

 

}

 

function dontshow($file)

{

global $dontshow;

foreach($dontshow as $nofile)

{

  if($file==$nofile)return false;

  elseif($nofile=="*.".end(explode(".",$file)))return false;

}

return true;

}

 

//DIRtree by Renatus

function dirtree($dir){

global $gfxdir, $startdir, $PHP_SELF;

$dis = explode('/',$dir);

$dirs = Array();

$z = 0;

$iplusplus = 0;

for($i = 0;$i < count($dis);$i++){

  $j = 0;

  $d = '';

  while($j <= $i){

  $d.= $dis[$j].'/';

  $j++;

  }

  if($d == $startdir || $z == 1){

  $z = 1;

  $dirs[] = $d;

  }

  else $iplusplus++;

}

array_pop($dirs);

$end = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><a href="'.$PHP_SELF.'" class="dir" onmouseover="setstatus(\'root\');return true" onmouseout="setstatus(\'clearme\')"><img src="'.$gfxdir.'diropen.gif" border="0"> root</a><td></tr>%%platz%%</table>';

$i = 0;

while(stristr($end,'%%platz%%')){

  $d = readdirs($dirs[$i]);

  $tmp = '';

  foreach($d as $di){

  $platz = '';

  $x = 0;

  while($x <= $i){

    $platz.= '  ';

    $x++;

  }

  $iplus = $i + 1 + $iplusplus;

  $cont = $di;

  if(count($dirs) > 1 && $di == $dis[$iplus])$tmp.= '<tr><td><nobr>'.$platz.'<a href="'.$PHP_SELF.'?dir='.rawurlencode($dirs[$i].$di).'/" class="dir" onmouseover="setstatus(\''.addslashes($di).'\');return true" onmouseout="setstatus(\'clearme\')"><img src="'.$gfxdir.'diropen.gif" border="0"> '.checklength($cont, "dt").'</nobr></td></tr>%%platz%%';

  else $tmp.= '<tr><td><nobr>'.$platz.'<a href="'.$PHP_SELF.'?dir='.rawurlencode($dirs[$i].$di).'/" class="dir" onmouseover="setstatus(\''.addslashes($di).'\');return true" onmouseout="setstatus(\'clearme\')"><img src="'.$gfxdir.'dir.gif" border="0"> '.checklength($cont, "dt").'</a></nobr></td></tr>';

  }

  $end = str_replace('%%platz%%',$tmp,$end);

  $i++;

}

return $end;

}

function readdirs($dir){

global $allow;

$dh = opendir($dir);

$dirs = Array();

while(gettype($datei = readdir($dh)) != 'boolean'){

  if($datei != '.' && $datei != '..' && is_dir($dir.$datei)){

  if($datei[0] != '.')$dirs[] = $datei;

  if($datei[0] == '.' && $allow['hiding'] == 0)$dirs[] = $datei;

  }

}

$dirs=sortWithUmlauts($dirs);

return $dirs;

}

 

function formatfilesize($size, $end=0)

{

global $allow;

doubleval($size);

 

if($allow['filesize']==1)$ext="B";else $ext='';

$ex=Array("kB","MB","GB");

for($i=0;$allow['filesize']==1 && $size>1024 && isset($ex[$i]); $i++)

{

  $ext=$ex[$i];

  $size/=1024;

}

if(empty($ext) && $end==1)$ext=" Bytes";

elseif(!empty($ext))$ext=' '.$ext;

round($size, 2);

return str_replace(",00","",number_format($size,2,',', '.').$ext);

}

 

function sortWithUmlauts($array){

    $dblValues = array();

    $sortedArray = array();

    foreach($array as $string){

        $orig = $string;

        $string = ereg_replace( 'ä|Ä', 'ae', $string);

        $string = ereg_replace( 'ö|Ö', 'oe', $string);

        $string = ereg_replace( 'ü|Ü', 'ue', $string);

        $string = ereg_replace( 'ß|ß','ss', $string);

        $string = strtoupper($string);

        $in = array($string, $orig);

        array_push($dblValues, $in);

    }

    sort($dblValues);

    foreach($dblValues as $a){

        array_push($sortedArray,$a[1]);

    }

    return $sortedArray;

}

?>

Lenke til kommentar

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
×
×
  • Opprett ny...