Verfasst: Mi 18. Apr 2007, 16:13
PHP5
Das Diskussionsforum zum Open Source Content Management System
https://forum.contenido.org/
Code: Alles auswählen
/* VERSION FÜR PHP5 *********************************
class pfad {
function getPath($root,$level = 0) {
$content = $this->readDir($root);
foreach ($content as $file) {
if (is_dir($root.$file)) {
$verzeichnis = substr($root,$this->pathlen);
$returnvalue["{$verzeichnis}{$file}/"] = str_repeat(" ",$level * 5).$file;
//$returnvalue = array_merge($returnvalue,$this->getPath($root.$file."/",$level+1));
$subdirs=$this->getPath($root.$file."/",$level+1);
if ($subdirs != NULL) {
$returnvalue = $returnvalue + $subdirs;
}
}
}
return $returnvalue;
}
******************************************************/
/* Version für PHP4 **********************************/
class pfad {
function pfad($pfad) {
$this->pfad = $pfad;
$this->pathlen = strlen($this->pfad);
}
function getPath($root,$level = 0) {
$content = $this->readDir($root);
foreach ($content as $file) {
if (is_dir($root.$file)) {
$verzeichnis = substr($root,$this->pathlen);
$returnvalue["{$verzeichnis}{$file}/"] = str_repeat(" ",$level * 5).$file;
$returnvalue = array_merge($returnvalue,$this->getPath($root.$file."/",$level+1));
}
}
return $returnvalue;
}
function readDir($path) {
$handle = opendir($path);
while ($file = readdir ($handle)) {
if ($file != "." && $file != "..") $returnvalue[] = $file;
}
closedir($handle);
return $returnvalue;
}
/**********************************************************/
Code: Alles auswählen
/* VERSION FÜR PHP5 *********************************/
class pfad {
function getPath($root,$level = 0) {
$content = $this->readDir($root);
foreach ($content as $file) {
if (is_dir($root.$file)) {
$verzeichnis = substr($root,$this->pathlen);
$returnvalue["{$verzeichnis}{$file}/"] = str_repeat(" ",$level * 5).$file;
//$returnvalue = array_merge($returnvalue,$this->getPath($root.$file."/",$level+1));
$subdirs=$this->getPath($root.$file."/",$level+1);
if ($subdirs != NULL) {
$returnvalue = $returnvalue + $subdirs;
}
}
}
return $returnvalue;
}
/******************************************************/
/* Version für PHP4 **********************************
class pfad {
function pfad($pfad) {
$this->pfad = $pfad;
$this->pathlen = strlen($this->pfad);
}
function getPath($root,$level = 0) {
$content = $this->readDir($root);
foreach ($content as $file) {
if (is_dir($root.$file)) {
$verzeichnis = substr($root,$this->pathlen);
$returnvalue["{$verzeichnis}{$file}/"] = str_repeat(" ",$level * 5).$file;
$returnvalue = array_merge($returnvalue,$this->getPath($root.$file."/",$level+1));
}
}
return $returnvalue;
}
function readDir($path) {
$handle = opendir($path);
while ($file = readdir ($handle)) {
if ($file != "." && $file != "..") $returnvalue[] = $file;
}
closedir($handle);
return $returnvalue;
}
**********************************************************/
Warning: include_once(config.php) [function.include-once]: failed to open stream: No such file or directory in /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/contenido/external/backendedit/front_content.php on line 62
Warning: include_once() [function.include]: Failed opening 'config.php' for inclusion (include_path='.:/usr/share/pear') in /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/contenido/external/backendedit/front_content.php on line 62
Warning: chdir() [function.chdir]: Unable to access in /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/contenido/external/backendedit/front_content.php on line 63
Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/contenido/external/backendedit/front_content.php:62) in /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/conlib/session.inc on line 479
Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/contenido/external/backendedit/front_content.php:62) in /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/conlib/session.inc on line 484
Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/contenido/external/backendedit/front_content.php:62) in /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/conlib/session.inc on line 485
Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/contenido/external/backendedit/front_content.php:62) in /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/conlib/session.inc on line 486
Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/contenido/external/backendedit/front_content.php:62) in /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/conlib/session.inc on line 487
Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/contenido/external/backendedit/front_content.php:62) in /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/conlib/session.inc on line 488
Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/contenido/external/backendedit/front_content.php:62) in /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/conlib/session.inc on line 489
Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/contenido/external/backendedit/front_content.php:62) in /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/conlib/session.inc on line 128
Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/contenido/external/backendedit/front_content.php:62) in /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/contenido/external/backendedit/front_content.php on line 193
Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/contenido/external/backendedit/front_content.php:62) in /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/contenido/external/backendedit/front_content.php on line 412
Warning: Contenido_Frontend_Challenge_Crypt_Auth::include(front_crcloginform.inc.php) [function.Contenido-Frontend-Challenge-Crypt-Auth-include]: failed to open stream: No such file or directory in /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/conlib/local.php on line 644
Warning: Contenido_Frontend_Challenge_Crypt_Auth::include(front_crcloginform.inc.php) [function.Contenido-Frontend-Challenge-Crypt-Auth-include]: failed to open stream: No such file or directory in /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/conlib/local.php on line 644
Warning: Contenido_Frontend_Challenge_Crypt_Auth::include() [function.include]: Failed opening 'front_crcloginform.inc.php' for inclusion (include_path='.:/usr/share/pear') in /home/httpd/vhosts/joe-events.ch/httpdocs/eichlershuus/conlib/local.php on line 644
Code: Alles auswählen
if ($username==$deluser) {
echo "<td><form>
<input type=button onClick=\"window.location.href='$PHP_SELF?idcat=$idcat&step=delete&filename=$file_list[$count]'\" target='_self' value='Delete'>
</form></td>";
}
Hat jemand einen Tipp, woran das liegen kann?
Code: Alles auswählen
echo "<div><form name=\"uploadform\" method=\"post\" action=\"$PHP_SELF?idcat=$idcat\" enctype=\"multipart/form-data\">
Code: Alles auswählen
while ($file = readdir($handle)){
if ($file!='.' && $file!='..' && $file!='/') {
if (!@opendir($path.$file)==true) {
$file_list[] = $file;
}
}
}Code: Alles auswählen
while ($file = readdir($handle)){
if ($file!='.' && $file!='..' && $file!='/') {
if (!is_dir($path.$file)) {
$file_list[] = $file;
}
}
}Code: Alles auswählen
if (strip_tags($_GET[idcat])!="" || strip_tags($_GET[idcat])!=0) {
$idcat=strip_tags($_GET[idcat]);
$catpath="idcat=".$idcat;
}
if (strip_tags($_GET[idcatart])!="" || strip_tags($_GET[idcatart])!=0) {
$idcatart=strip_tags($_GET[idcatart]);
$catpath="idcatart=".$idcatart;
}
if (strip_tags($_GET[idart])!="" || strip_tags($_GET[idart])!=0) {
$idart=strip_tags($_GET[idart]);
$catpath="idart=".$idart;
}Code: Alles auswählen
if (isset($idcat)) {
$idcat=strip_tags($idcat);
$catpath="idcat=".$idcat;
}
if (isset($idcatart)) {
$idcat=strip_tags($idcatart);
$catpath="idcatart=".$idcatart;
}
if (isset($idart)) {
$idcat=strip_tags($idart);
$catpath="idart=".$idart;
}Code: Alles auswählen
<?
$buttonstyle1 = "width:250px;height:20px;"; // Button 1
$buttonstyle2 = "width:100px;height:20px;margin-left:10px;"; // Button 2
$headcolor = "background-color:#eeeeee;padding:2px;"; // Tabellenkopf
$username = "";
$adminname = "";
$deluser = "";
if (isset($idcat)) {
$idcat=strip_tags($idcat);
$catpath="idcat=".$idcat;
}
if (isset($idcatart)) {
$idcat=strip_tags($idcatart);
$catpath="idcatart=".$idcatart;
}
if (isset($idart)) {
$idcat=strip_tags($idart);
$catpath="idart=".$idart;
}
$foldererror="<br clear=\"all\"/>CMS_VALUE[9]";
$tablewidth="CMS_VALUE[10]";
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/CMS_VALUE[4]";
$username = $auth->auth['uname'];
$delpool = "CMS_VALUE[5]";
$treffer_del = substr_count($delpool, $username);
if ($treffer_del==1) {
$deluser=$username;
}
$adminpool = "CMS_VALUE[1]";
$treffer_admin = substr_count($adminpool, $username);
if ($treffer_admin==1) {
$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",0664);
echo "<font color=red><b>Die Datei wurde erfolgreich hochgeladen.</b></font><br>";
} else {
echo "$error";
}
}
$show_upload=CMS_VALUE[8];
if ($show_upload==1 || $username==$adminname) {
echo "<div><form name=\"uploadform\" method=\"post\" action=\"".$PHP_SELF."?$catpath\" enctype=\"multipart/form-data\">
<input type=\"hidden\" name=\"idcatart\" value=\"$idcatart\">
<div>Datei:<br /><input type=\"file\" name=\"myfile\" class=\"button\"><input type=\"submit\" name=\"uploadfile\" value=\"hochladen\" class=\"button\">
</form></div>
<div style=\"margin-bottom:5px;\">Dateien dürfen maximal <strong style=\"color:#ff0000;\">$max_filesize_mb MB</strong> groß sein!<br />
<strong>Bitte nur virengescannte Dateien hochladen!</strong></div></div>";
}
$show_list = CMS_VALUE[7];
if ($show_list==1 || $username==$adminname) {
$handle=opendir($path);
while ($file = readdir($handle)){
if ($file!='.' && $file!='..' && $file!='/') {
if (!is_dir($path.$file)) {
$file_list[] = $file;
}
}
}
closedir($handle);
@sort($file_list);
if ($file_list!="") {
echo "<div style='padding-top:20px;'><table align='left' width='".$tablewidth."' class='content' cellspacing='1' border='1' cellpadding='1' style='border-collapse: collapse; background:#bbbbbb;'>
<tr style='$headcolor'>
<td style='$headcolor'>Dateiname</td>
<td style='$headcolor'>Größe</td>";
if ($username==$deluser) echo "<td><span style=\"color:#ff0000;\">löschen</span></td>";
echo "</tr>";
for ($count=0;$file_list[$count]!="";$count++) {
echo '<tr style="background-color:#ffffff;" onmouseover="this.style.backgroundColor = #dddddd" onmouseout="this.style.backgroundColor = #ffffff">
<td style="padding:2px;"><a href="'.$path.$file_list[$count].'" target="_blank" title="Rechtsklick für Download">'.cut($file_list[$count],CMS_VALUE[6]).'</a></td>
<td style="padding:2px;">'.parseByteSize(@filesize($path.$file_list[$count]),2,false).'</td>';
if ($username==$deluser) {
echo "<td><a href='".$PHP_SELF."?$catpath&step=delete&filename=$file_list[$count]' target='_self'>löschen</a></td>";
}
echo "</tr>";
}
echo "</table></div><br clear=\"all\" />";
} else {
echo $foldererror;
}
}
?>Code: Alles auswählen
<?
if (isset($loadfile)) {
echo '<meta http-equiv="refresh" content="0; URL='.$file_path.'">';
}
$buttonstyle1 = "width:250px;height:20px;"; // Button 1
$buttonstyle2 = "width:100px;height:20px;margin-left:10px;"; // Button 2
$headcolor = "background-color:#eeeeee;padding:2px;"; // Tabellenkopf
$username="";
$adminname="";
$deluser="";
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/CMS_VALUE[4]";
$username=$auth->auth['uname'];
$delpool="CMS_VALUE[5]";
$treffer_del = substr_count($delpool, $username);
if ($treffer_del==1) {
$deluser=$username;
}
$adminpool="CMS_VALUE[1]";
$treffer_admin = substr_count($adminpool, $username);
if ($treffer_admin==1) {
$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']))
{
if ($username!=$adminname)
{
$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($filename !="")
{
if ($error == "")
{
$date = getdate();
$year = $date[year];
$month = $date[mon];
if(strlen($month) < 2){$month = "0".$month;}
$day = $date[mday];
if(strlen($day) < 2){$day = "0".$day;}
$hours = $date[hours];
if(strlen($hours) < 2){$hours= "0".$hours;}
$minutes = $date[minutes];
if(strlen($minutes) < 2){$minutes= "0".$minutes;}
$seconds = $date[seconds];
if(strlen($seconds) < 2){$seconds= "0".$seconds;}
$actualDate = $year.$month.$day."_".$hours.$minutes.$seconds;
move_uploaded_file($filetemp, $path.$username."_".$actualDate."_"."$filename");
chmod($path.$username."_".$actualDate."_"."$filename",0664);
echo "<font color=red><b>Die Datei wurde erfolgreich hochgeladen.</b></font><br>";
if($path == "upload/private upload/")
{
$header = 'From: support@xxx.com' . "\r\n" .
'Reply-To: support@xxx.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
// Die Nachricht
$nachricht = "Es wurde eine Datei auf http://www.xxx.com/de/service/upload/upload.html hochgeladen\r\nKunde: " . $username . "\r\nDateiname: " . $username . "_" . $actualDate . "_" . $filename;
// Falls eine Zeile der Nachricht mehr als 70 Zeichen enthälten könnte,
// sollte wordwrap() benutzt werden
$nachricht = wordwrap($nachricht, 70);
// Send
mail('support@xxx.com', 'www.xxx.com: Dateiupload', $nachricht, $header);
}
}
else
{
echo "$error";
}
}
else
{
echo "<font color=red><b>Bitte wählen Sie die hochzuladende Datei aus.</b></font><br>";
}
}
else
{
$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($filename !="")
{
if ($error == "")
{
if($path == "upload/download/Datenaustausch/")
{
$date = getdate();
$year = $date[year];
$month = $date[mon];
if(strlen($month) < 2){$month = "0".$month;}
$day = $date[mday];
if(strlen($day) < 2){$day = "0".$day;}
$hours = $date[hours];
if(strlen($hours) < 2){$hours= "0".$hours;}
$minutes = $date[minutes];
if(strlen($minutes) < 2){$minutes= "0".$minutes;}
$seconds = $date[seconds];
if(strlen($seconds) < 2){$seconds= "0".$seconds;}
$actualDate = $year.$month.$day."_".$hours.$minutes.$seconds;
move_uploaded_file($filetemp, $path.$actualDate."_"."$filename");
chmod($path.$actualDate."_"."$filename",0664);
echo "<font color=red><b>Die Datei wurde erfolgreich hochgeladen.</b></font><br>";
}
else
{
move_uploaded_file($filetemp, $path."$filename");
chmod($path."$filename",0664);
echo "<font color=red><b>Die Datei wurde erfolgreich hochgeladen.</b></font><br>";
}
}
else
{
echo "$error";
}
}
else
{
echo "<font color=red><b>Bitte wählen Sie die hochzuladende Datei aus.</b></font><br>";
}
}
}
$show_upload=CMS_VALUE[8];
if ($show_upload==1 || $username==$adminname)
{
echo "<div style=\"width:100%;\" id=\"upload\"><form name=\"uploadform\" method=\"post\" action=\"$PHP_SELF?idcat=$idcat\" enctype=\"multipart/form-data\">
<div>Datei:<br /><input type=\"file\" name=\"myfile\" class=\"button\"><input type=\"submit\" name=\"uploadfile\" value=\"hochladen\" class=\"button\">
</form></div>
<div style=\"margin-bottom:5px;\">Dateien dürfen maximal <strong style=\"color:#ff0000;\">$max_filesize_mb MB</strong> groß sein!<br />
<strong>Bitte nur virengescannte Dateien hochladen!</strong></div>";
}
else
{
echo "<br><div>";
}
$show_list=CMS_VALUE[7];
if ($show_list==1 || $username==$adminname) {
$handle=opendir($path);
while ($file = readdir($handle)){
if ($file!='.' && $file!='..' && $file!='/') {
if (!@opendir($path.$file)==true) {
$file_list[] = $file;
}
}
}
closedir($handle);
@sort($file_list);
echo "<table align=\"center\" width=\"100%\" class=\"content\" cellspacing=\"1\" border=\"1\" cellpadding=\"1\" style=\"border-collapse: collapse; background:#bbbbbb;\">
<tr style=\"$headcolor\">
<td style=\"$headcolor\">Dateiname</td>
<td style=\"$headcolor\">Größe</td>
<td style=\"$headcolor\">Aktion</td>";
if ($username==$deluser) echo "<td><span style=\"color:#ff0000;\">löschen</span></td>";
echo "</tr>";
for ($count=0;$file_list[$count]!="";$count++) {
echo "<tr style=\"background-color:#ffffff;\" onmouseover=\"this.style.backgroundColor = '#dddddd'\" onmouseout=\"this.style.backgroundColor = '#ffffff'\">
<td style=\"padding:2px;\"><font title='$file_list[$count]'>".cut($file_list[$count],CMS_VALUE[6])."</font></td>
<td style=\"padding:2px;\">".parseByteSize(@filesize($path.$file_list[$count]),2,false)."</td>
<!--<td style=\"padding:2px;\"><a href='".$path."$file_list[$count]' target='_blank'><nobr>öffnen | speichern</nobr></a></td>-->
<td style=\"padding:2px;\">
<form action='".$PHP_SELF."?idart=$idart' method='post' style='margin:0px;'>
<input type='hidden' value='".$path."$file_list[$count]' name='file_path'></input>
<input type='submit' name='loadfile' class='button' value='speichern'></input>
</form>
</td>";
if ($username==$deluser) {
echo "<td><a href='$PHP_SELF?idcat=$idcat&step=delete&filename=$file_list[$count]' target='_self'>löschen</a></td>";
}
echo "</tr>";
}
echo "</table></div><br clear=\"all\">";
} else {
echo "</div><br clear=\"all\">";
}
?>