Code: Alles auswählen
$dec = array("\"", "'", "\\", '\"', "\'", "<", ">");
$enc = array(""", "'", "\", """, "'", "<", ">");
Code: Alles auswählen
$dec = array("\"", "'", "\\", '\"', "\'", "<", ">");
$enc = array(""", "'", "\", """, "'", "<", ">");
Hab das mal reingemacht was Du wolltest, nimm einfach die XML aus meiner SIG, die ist aktuell.mreif hat geschrieben:mir ist da noch eine kleine Ergänzung für das Modul eingefallen.
Prima wäre, wenn man das Modul vom Input (und natürlich auch vom Output) so gestalten würde, dass man zusätzlich auswählen kann, ob der Besucher überhaupt Uploaden darf oder nur die Dateiliste für den Download sehen darf.
Code: Alles auswählen
Fehler in Module. Fehlerquelle: eval()'d code on line 8<br />
Code: Alles auswählen
<?
$username="";
$adminname="";
function cut($text, $length) {
$dec = array("\"", "'", "\\", '\"', "\'", "<", ">");
$enc = array(""", "'", "\", """, "'", "<", ">");
$text = str_replace($enc, $dec, $text);
if (strlen($text) > $length) {
$text = substr($text, 0, ($length-3))."...";
}
$text = str_replace($dec, $enc, $text);
return $text;
}
$path="upload/download/";
$username=$auth->auth['uname'];
$delpool=array(CMS_VALUE[5]);
if (in_array($username,$delpool)) {
$deluser=$username;
}
$adminpool=array(CMS_VALUE[1]);
if (in_array($username,$adminpool)) {
$adminname=$username;
}
if ($username==$adminname) {
$max_filesize_mb=CMS_VALUE[3];
} else {
$max_filesize_mb=CMS_VALUE[2];
}
$max_filesize=bcmul($max_filesize_mb,1000000);
function parseByteSize($size,$digits=2,$dir=false){
$kb=1024; $mb=1024*$kb; $gb=1024*$mb; $tb=1024*$gb;
if(($size==0)&&($dir)){return "Empty";}
else if($size<$kb){return $size." Bytes";}
else if($size<$mb){return round($size/$kb,$digits)." KB";}
else if($size<$gb){return round($size/$mb,$digits)." MB";}
else if($size<$tb){return round($size/$gb,$digits)." GB";}
else{return round($size/$tb,$digits)." TB";}
}
if ($step=="delete" && $username=="$adminname") {
unlink($path.$filename);
}
if (isset($_POST['uploadfile'])) {
$fileext = $_FILES['myfile']['type'];
$filename = $_FILES['myfile']['name'];
$filesize = $_FILES['myfile']['size'];
$filetemp = $_FILES['myfile']['tmp_name'];
if ($filesize > $max_filesize) {
$error = "<b>Die Datei ist mit $filesize Bytes größer als $max_filesize_mb MB.</b>";
}
if ($error == "") {
move_uploaded_file($filetemp, $path."$filename");
chmod($path."$filename",0644);
echo "<font color=red><b>Die Datei wurde erfolgreich hochgeladen.</b></font><br>";
} else {
echo "$error";
}
}
if (CMS_VALUE[8]==1 || ($username!="" && $username!="nobody")) {
echo "<div><form name='uploadform' method='post' action='$PHP_SELF?idcat=$idcat' enctype='multipart/form-data'>
<table align='left' width='500' cellspacing='0' cellpadding='0' class='tbl'>
<tr>
<td width='80'>Datei:</td>
<td><input type='file' name='myfile' class='textbox' style='width:250px;'> <input type='submit' name='uploadfile' value='hochladen' class='button' style='width:100px;'></td>
</tr>
</table>
</form><br clear='all'>
Dateien dürfen maximal <b><font color=red>$max_filesize_mb MB</font></b> groß sein!</font><br>
<b><font size='-2'>Bitte nur virengescannte Dateien hochladen!</font></b></div>";
}
$show_list=CMS_VALUE[7];
if ($show_list==1 || $username==$adminname) {
$handle=opendir($path);
while ($file = readdir($handle)){
if ($file != "." && $file != ".." && $file != "/") {
$file_list[] = $file;
}
}
closedir($handle);
@sort($file_list);
echo "<br><br><div><table align='left' width='690' cellspacing='0' cellpadding='0' style='border-collapse: collapse; background:#FFFFFF; border:1px solid #bbbbbb;'>
<tr bgcolor='#bbbbbb'>
<td></td>
<td align='center'> <font color='#333333'>Dateiname</font></td>
<td width='1' bgcolor='#ffffff'></td>
<td align='center'><font color='#333333'>Größe</font> </td>
<td width='1' bgcolor='#ffffff'></td>
<td align='center'><font color='#333333'>Aktion</font></td>";
if ($username==$deluser) echo "<td width='1' bgcolor='#ffffff'></td><td align='center' ><font color='#333333'>löschen</font></td>";
echo "</tr>
<tr bgcolor='#FFFFFF'>
<td height='5' colspan='6'></td></tr>\n";
for ($count=0;$file_list[$count]!="";$count++) {
echo "<tr onmouseover=\"this.style.backgroundColor = '#dddddd'\" onmouseout=\"this.style.backgroundColor = ''\" bgcolor='#ffffff'>
<td align='center' bgcolor='#FFFFFF'>$fileimg</td>
<td><font title='$file_list[$count]'>".cut($file_list[$count],CMS_VALUE[6])."</font></td>
<td width='1' bgcolor='#ffffff'></td>
<td align=right>".parseByteSize(@filesize($path.$file_list[$count]),2,false)." </td>
<td width='1' bgcolor='#ffffff'></td>
<td width='150' align=center><a href='".$path."$file_list[$count]' target='_blank'><nobr>öffnen | speichern</nobr></a></td>";
if ($username==$deluser) echo "<td width='1' bgcolor='#4A6FA6'></td><td align='center'><a href='$PHP_SELF?idcat=$idcat&step=delete&filename=$file_list[$count]' target='_self'>löschen</a></td>";
echo "</tr>
<tr bgcolor='#FFFFFF'><td height='6' colspan='4'></td></tr>";
}
echo "</table>\n";
echo '</div>';
}
?>
Ich habe den Download aus dem ersten Post benutzt !Dinkel hat geschrieben:hast Du die aktuelle verison aus meiner SIG schon probiert?
Code: Alles auswählen
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in C:\Programme\XAMPP\xampp\htdocs\cms\cms\front_content.php(771) : eval()'d code on line 2602
der ist der gleiche wie in meiner SIGrezeptionist hat geschrieben:Ich habe den Download aus dem ersten Thread benutzt !Dinkel hat geschrieben:hast Du die aktuelle verison aus meiner SIG schon probiert?
Code: Alles auswählen
<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td style="background-color:rgb(210,210,210);"><img src="images/grey.gif" width="1" height="1" border="0" alt="" title=""/></td></tr></table>
Code: Alles auswählen
<?php
Code: Alles auswählen
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td style="background-color:rgb(210,210,210);"><img src="images/grey.gif" width="1" height="1" border="0" alt="" title=""/></td></tr></table>';