<?php
/*
CREATIVE COMMONS - Attribution-No Derivative Works 3.0 Germany:
- You may not alter, transform, or build upon this work.
- Dieses Werk darf nicht bearbeitet oder in anderer Weise verändert werden.
*/
$_SESSION['MenuReminderWebsite'] = $page;
if ( !IsUserAdmin() ) echo $L_015;
else
{
// Inhalt hier einfügen
$CurrentPage = 'content';
// Dateien umbenennen
if ( isset($_POST['gesendet']) )
{
$i = 1;
$handle=opendir ($ContentPath);
while ($file = readdir ($handle))
{
if ($file != "." && $file != "..")
{
$AlterDateiName = $file;
$NeuerDateiName = str_replace(" ", "_", $AlterDateiName );
$NeuerDateiName = strtolower( $NeuerDateiName );
$NeuerDateiName = str_replace("&","",$NeuerDateiName );
$NeuerDateiName = str_replace("Ã","ss",$NeuerDateiName );
$NeuerDateiName = str_replace("ä","ae",$NeuerDateiName );
$NeuerDateiName = str_replace("ö","oe",$NeuerDateiName );
$NeuerDateiName = str_replace("ü","ue",$NeuerDateiName );
$NeuerDateiName = str_replace("/", "",$NeuerDateiName );
$NeuerDateiName = str_replace(":", "",$NeuerDateiName );
$NeuerDateiName = str_replace("'", "",$NeuerDateiName );
$NeuerDateiName = str_replace("{", "",$NeuerDateiName );
$NeuerDateiName = str_replace("}", "",$NeuerDateiName );
$NeuerDateiName = str_replace("(", "",$NeuerDateiName );
$NeuerDateiName = str_replace(")", "",$NeuerDateiName );
$NeuerDateiName = str_replace("&", "",$NeuerDateiName );
$NeuerDateiName = str_replace("+", "",$NeuerDateiName );
$NeuerDateiName = str_replace("=", "",$NeuerDateiName );
$NeuerDateiName = str_replace("[", "",$NeuerDateiName );
$NeuerDateiName = str_replace("]", "",$NeuerDateiName );
// echo $i.' '.$AlterDateiName.' '.$NeuerDateiName.' ';
while ( file_exists ( $ContentPath.$NeuerDateiName ) )
{
$FileType = strrchr ( $NeuerDateiName, '.' );
$NeuerDateiName = str_replace( $FileType, "",$NeuerDateiName );
$NeuerDateiName = $NeuerDateiName.'_'.$i++;
$NeuerDateiName = $NeuerDateiName.$FileType;
// echo $NeuerDateiName.' ';
}
if ( !rename( $ContentPath.$AlterDateiName, $ContentPath.$NeuerDateiName) )
{
echo '<span class="ERROR">'.$L_195.' '.$file.' ->'.$NeuerDateiName.'</span><br />';
}
// echo '<br />';
$i=1;
}
}
closedir($handle);
}
// Dateinamen in Array schreiben
if (!is_dir ( $ContentPath )) mkdir ( $ContentPath );
$handle=opendir ($ContentPath);
$files = array();
while ($file = readdir ($handle))
if ($file != "." && $file != "..") $files[] = $file;
sort ( $files );
//Dateien zählen
$AnzahlDateien = count($files);
// Falsche Zeichen in Dateinamen feststellen
$AnzahlFehler = 0;
for ( $i=0; $i<$AnzahlDateien; $i++)
{
$AnzahlFehler = substr_count( $files[$i], ' ' );
if ( $AnzahlFehler>0 )
{
echo '<span class="ERROR">'.$L_196.' '.$files[$i].'</span><br />';
break;
}
}
for ( $i=0; $i<$AnzahlDateien; $i++)
{
if ( preg_match( '([A-Z])', $files[$i] ) )
{
echo '<span class="ERROR">'.$L_197.' '.$files[$i].'</span><br />';
$AnzahlFehler++;
break;
}
}
for ( $i=0; $i<$AnzahlDateien; $i++)
{
if ( preg_match( '([/:\'{}()&+=])', $files[$i] ) )
{
echo '<span class="ERROR">'.$L_198.' '.$files[$i].'</span><br />';
$AnzahlFehler++;
break;
}
}
for ( $i=0; $i<$AnzahlDateien; $i++)
{
if ( preg_match( '([äöüÃÃÃÃ])', $files[$i] ) )
{
echo '<span class="ERROR">'.$L_199.' '.$files[$i].'</span><br />';
$AnzahlFehler++;
break;
}
}
if ( $AnzahlFehler )
{
if ( IsUserAdmin())
{
echo '<form method="post" action="index.php?submenu=filesharing&page='.$CurrentPage.'">
<fieldset>
<input type="hidden" name="gesendet" value="1" />
<input style="width:8em;" class="SmallButton" type="submit" value="'.$L_Rename.'" onclick="javascript:allAttributes()" />
</fieldset>
</form><br />';
}
}
if ( $AnzahlDateien == 0) echo $L_036;
else
{
echo '<table summary="FileSharing">
<tr>
<th class="GigStatus"></th>
<th>'.$AnzahlDateien.' '.$L_034.'</th>
<th>'.$L_035.'</th>
</tr>';
$handle=opendir ($ContentPath);
for ( $i=0; $i<$AnzahlDateien; $i++)
{
$filesize =filesize($ContentPath.$files[$i]);
$filesize = ceil($filesize/1024).' KB';
if ($filesize >= 1024) {$filesize = round($filesize/1024,3).' MB';}
echo '<tr>
<td><a href="index.php?submenu=cms&page=addPage&file='.$files[$i].'"><img src="images/edit.png" alt="'.$L_010.'" title="'.$L_010.'" /></a></a></td>
<td>'.$files[$i].'</td>
<td class="TabellenSpalte_Rechts">'.$filesize.'</td>
</tr>';
}
closedir($handle);
echo '</table>';
}
// Inhalt zuende
}
?>