Seite 12 von 14

Verfasst: Mi 18. Apr 2007, 16:13
von Moudi
PHP5

Verfasst: Mi 18. Apr 2007, 17:30
von Dinkel
dann mach mal im Modul Input uas dem:

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;
   }
/**********************************************************/
das:

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;
   }
**********************************************************/

Verfasst: Do 19. Apr 2007, 08:13
von Moudi
Das Backend sieht jetzt völlig Anders aus... Ich habe noch andere Module im selben Template und die kann ich jetzt nicht mehr konfigurieren, sie sind einfach weg, obwohl sie dann im Editor wieder auftauchen... Ich kann Sie in der Templatebearbeitung auch nicht mehr vorkonfigurieren...

Auf jedenfall ist das Dropdown für die Zielordnerauswahl immer noch leer... und beim Versuch etwas hochzuladen, kommen jetzt folgende Fehlermeldungen:

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

Verfasst: Mo 28. Mai 2007, 16:51
von JumBuck
Ich habe mir während dem Test des Moduls ebenfalls ein Problem eingehandelt, bin mir aber nicht wirklich sicher ob´s am Modul liegt oder nicht. Deshalb hab ich mein Problem hier beschrieben.

UPDATE: Der Fehler lag offensichtlich in der Tabelle con_mod . Genaueres weiss ich noch nicht, ausser das der Fehler zusammen mit dem Up/Downloadmodul aufgetreten ist.

Trotzdem, vielen Dank für das Modul - mir gefällts und wird vermutlich auch bei mir eingesetzt :P

UPDATE2: Mein Problem war eine Modifikation des Login-Moduls, das Up/Download Modul funktioniert für mich perfekt - dankeschön dafür :-)

Ich fand das der Delete-Link als Button besser aussieht, spricht etwas gegen eine solche Lösung?

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>";
	                  }
funktionieren tuts.

Verfasst: Mo 6. Aug 2007, 09:51
von rethus
Was dem Modul fehlt ist eine kleine Textdatei die sich da "Installation.txt" nennt...

Einfach mal kurz zusammenfassen, worauf man achten muss, und wie man das Teil ans laufen bekommt.

Ist es übrigens richtig, das nachdem ich das Modul einem Template hinzugefügt habe, in der Konfiguration folgende Werte stehen:
Bild

Was muss in die jeweiligen Felder eingetragen werden?

Verfasst: Mo 6. Aug 2007, 10:28
von rethus
Hab es jetzt mal eingebunden. Leider funzt es nicht wirklich.
Es werden keine Dateien hochgeladen, aber auch keine Fehlermeldungen ausgegeben.

Zudem springt er nach dem mißlungenen upöoad immer wieder auf die Basisseite zurück, weil scheinbar eine ID übergeben wird.

In der Adress leiste steht dann nur
Hat jemand einen Tipp, woran das liegen kann?

Direktlink: http://www.unser-horrem.de/stadtportrai ... album.html

Ebenso wenn ich als Admin eingeloggt bin, kann ich keine Dateien löschen. Gleiches Phänomen

Verfasst: Mo 6. Aug 2007, 10:46
von tinof
Hi,

sehe ich das richtig, dass du mod rewrite nutzt ?

Dann könnte es Probleme im Output z.B. bei

Code: Alles auswählen

echo "<div><form name=\"uploadform\" method=\"post\" action=\"$PHP_SELF?idcat=$idcat\" enctype=\"multipart/form-data\">
geben, weil offensichtlich $idcat nicht gesetzt ist. Da muss Dir bitte ein Mod - Rewriter helfen: Im Ergebnis sollte die Seite sich selbst wieder aufrufen

Grüße
Tino

Verfasst: Mo 6. Aug 2007, 10:58
von rethus
Habe noch eine Lösung für eine unsauber programmierte Stelle gefunden:

Die while-Schleife beginnend ab Zeile 112:

Code: Alles auswählen

         while ($file = readdir($handle)){
	        if ($file!='.' && $file!='..' && $file!='/') {
	                if (!@opendir($path.$file)==true) {
		        	$file_list[] = $file;
	                }
	        }
         }
dieses opendir Konstrukt ist eine selbstgebastelte Anfrage, ob es sich bei der Datei um ein Verzeichnis handelt, und diese produziert massig Fehelrmeldungen.

Den Fehler zieht man raus, indem man die is_dir()-Funktion nutzt:

Code: Alles auswählen

         while ($file = readdir($handle)){
	        if ($file!='.' && $file!='..' && $file!='/') {
	                if (!is_dir($path.$file)) {
		        	$file_list[] = $file;
	                }
	        }
         }
PS: Ich habe mir angewöhnen Fehler NICHT zu kaschieren (mit @), das führt im nachhinein zu unmengen an Problemen.

Verfasst: Mo 6. Aug 2007, 12:03
von rethus
Hab jetzt auch ne Lösung für Modrewrite.

Nach längerem Rumtüfteln habe ich folgende Lösung gefunden:

Zeile 16 - 29 erstellen den $catpath :

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;
}
Beim modrewrite werden die Variablen idcat, idcatart und idart aber nicht per GET übergeben.

Daher hab ich das folgendermaßen abgeändert, so das es jetzt funktioniert:

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;
}
PS: Das geht auch ohne mod_rewrite, weil diese Variablen immer intern mit übergeben werden, und nicht auf $_GET angewiesen sind.

Ach und noch etwas, was bei der Fehleranalyse und der Installation zu kurz gekommen ist:
@Dinkel: Hast ein super Modul hier abgeliefert! Danke.

Verfasst: Mo 6. Aug 2007, 12:10
von Dinkel
Danke für den Fix, das werde ich schnellstens einbinden wenn ich zu Hause bin und hier dann aktualisieren... Vielen Dank für die Unterstützung ;)

Verfasst: Mo 6. Aug 2007, 12:33
von rethus
Also ich hab es jetzt so gemacht - da ich bei dem Button Herunterladen immer Fehler hatte, das ich den komplett rausgeschmissen habe.
Denn vorne bei der Dateibezeichnung führt mich ja ein Klick auf die Grafikdatei, und da kann man die Easy runterladen mit Rechtsklick > Ziel speichern unter.

Hier mal mein gesamten Quellcode für den Output:

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;
         }
}
?>

Verfasst: Mo 6. Aug 2007, 14:20
von Dinkel
Das kann man machen, Sinn unz Zweck ist es egtl. dass ich später (irgendwann) das Modul so erweitere, dass der Pfad, in dem eine Datei liegt, nicht bekannt ist, so dass kein unberechtigter Zugriff per URL (z.B. über Mailverkehr) stattfinden kann. Aber bleibt jedem selbst überlassen.

Verfasst: Di 22. Jan 2008, 08:38
von rene04
hi,

ich habe da ein kleines problem mit der bedienung des moduls. wenn man bei einer pdf-, txt-, doc-, usw- auf speichern klickt, wird die datei geöffnet. das ist unschön. gibt es hierfür eine lösung?

ich nutze version 2.0

anbei noch meine Version mit dem Uploadordner und einer mail.benachrichtigung bei upload (achtung: stand 2.0):

output:

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\">";
}
?>
gruesse

Verfasst: Sa 26. Jan 2008, 13:27
von Dinkel
Hm, versuch mal die Version 2.1, da hab ich das meine ich umgestellt.

Auswahlbox

Verfasst: Di 4. Mär 2008, 10:53
von MakD
Super Modul ersteinmal .... danke noch mal!

Wollte mal nachfragen (weil ich es nicht programiern kann) ob es eine Möglichkeit gibt, hochgeladene Dateien erst durch den Admin frei zu geben. Die Besucher können zwar ihre z.B. Bilder/Berichte hochladen, aber erst wenn der Moderator/ADMIN den Bericht gelesen hat, macht er z.B. einen Hacken an die Datei und erst jetzt steht der Artikel zum download zur Verfügung.