Entities schreiben

Ausschlusspfade Dateiendungen


















Also gut - hier noch einmal eine kurze Erklärung:

Die Datei "gen_entities.php" - oder wie auch immer Sie diese nennen wollen - sollte in dasjenige Verzeichnis kopiert werden, in welchem Sie samt allen Unterordnern Änderungen vornehmen wollen. Unter "Ausschlusspfade" können Sie eingeben, wo genau in diesem Ordner die Prozessroutine aus "gen_entities.php" nichts(!) zu suchen hat (also immer ganze Ordner samt Unterordnern ausschließen).

Desweiteren können Sie unter "Dateiendungen" bestimmen, welche Endungen eine Datei haben muss, damit diese in die Prozessroutine aufgenommen wird. Groß- bzw. Kleinschreibung bleiben unberücksichtigt. Damit haben Sie ein "Werkzeug an der Hand", welches sehr tief und nachhaltig in Ihre Serverstruktur eingreift - also bitte Vorsichtig damit umgehen!



Ich hasse Ausrufe-Zeichen aber das die in der Tabelle oben habt seinen Grund.

Dateien zuerst sichern >>> eine Kopie zum Test anlegen >>> zuerst testen >>> Ergebnisse prüfen und erst danach übertragen.


Bevor Sie nun den Quellcode kopieren können noch ein paar kurze Überlegungen:

  • Wenn Sie die Umlaute von Datei-Inhalten durch eine ganze Ordnerstruktur ändern können, dann können Sie auch beliebige Inhalte ersetzen

  • Sollten Sie also einmal durchgehend in Ihrer gesamten Web-Seite einen "Fehler-String" haben => ersetzen

  • Sollten Sie eine Ergänzung einfügen wollen... => ersetzen


  • Sie haben nun wirklich ein "mächtiges Werkzeug" in Ihrer Hand - und hier der komplette Code:

    <?php
    
    if(isset($_REQUEST['dont_show_1'])){
      $dont_show_1  = $_REQUEST['dont_show_1'];
      if($dont_show_1=="")$dont_show_1="aaaa";
      $dont_show_2  = $_REQUEST['dont_show_2'];
      if($dont_show_2=="")$dont_show_2="aaaa";
      $dont_show_3  = $_REQUEST['dont_show_3'];
      if($dont_show_3=="")$dont_show_3="aaaa";
      $dont_show_4  = $_REQUEST['dont_show_4'];
      if($dont_show_4=="")$dont_show_4="aaaa";
      $dont_show_5  = $_REQUEST['dont_show_5'];
      if($dont_show_5=="")$dont_show_5="aaaa";
      $dont_show_6  = $_REQUEST['dont_show_6'];
      if($dont_show_6=="")$dont_show_6="aaaa";
      $dont_show_7  = $_REQUEST['dont_show_7'];
      if($dont_show_7=="")$dont_show_7="aaaa";
      $dont_show_8  = $_REQUEST['dont_show_8'];
      if($dont_show_8=="")$dont_show_8="aaaa";
      $dont_show_9  = $_REQUEST['dont_show_9'];
      if($dont_show_9=="")$dont_show_9="aaaa";
      $dont_show_10 = $_REQUEST['dont_show_10'];
      if($dont_show_10=="")$dont_show_10="aaaa";
      $filespec_1 = $_REQUEST['filespec_1'];
      if($filespec_1=="")$filespec_1="HTML";
      $filespec_2 = $_REQUEST['filespec_2'];
      if($filespec_2=="")$filespec_2="aaaa";
      $filespec_3 = $_REQUEST['filespec_3'];
      if($filespec_3=="")$filespec_3="aaaa";
      $filespec_4 = $_REQUEST['filespec_4'];
      if($filespec_4=="")$filespec_4="aaaa";
      $filespec_5 = $_REQUEST['filespec_5'];
      if($filespec_5=="")$filespec_5="aaaa";
      $filespec_6 = $_REQUEST['filespec_6'];
      if($filespec_6=="")$filespec_6="aaaa";
      $all_files = array();
      function show_all_files($ordner, $sub = FALSE) {
        global $all_files;
        global $dont_show_1;
        global $dont_show_2;
        global $dont_show_3;
        global $dont_show_4;
        global $dont_show_5;
        global $dont_show_6;
        global $dont_show_7;
        global $dont_show_8;
        global $dont_show_9;
        global $dont_show_10;
        global $filespec_1;
        global $filespec_2;
        global $filespec_3;
        global $filespec_4;
        global $filespec_5;
        global $filespec_6;
        global $act_path;
        $handle = opendir($ordner);
        while ($file = readdir ($handle)) {
          if($file != "." && $file != "..") {
            if(is_dir($ordner . "/" . $file)) {
              show_all_files($ordner . "/" . $file, TRUE);
            } else {
              if(strpos(strtoupper($file), strtoupper($filespec_1))>0
                || strpos(strtoupper($file), strtoupper($filespec_2))>0
                || strpos(strtoupper($file), strtoupper($filespec_3))>0
                || strpos(strtoupper($file), strtoupper($filespec_4))>0
                || strpos(strtoupper($file), strtoupper($filespec_6))>0
                || strpos(strtoupper($file), strtoupper($filespec_6))>0
                ){
                if(!strpos(strtoupper($ordner),strtoupper($dont_show_1))
                  && !strpos(strtoupper($ordner),strtoupper($dont_show_2))
                  && !strpos(strtoupper($ordner),strtoupper($dont_show_3))
                  && !strpos(strtoupper($ordner),strtoupper($dont_show_4))
                  && !strpos(strtoupper($ordner),strtoupper($dont_show_5))
                  && !strpos(strtoupper($ordner),strtoupper($dont_show_6))
                  && !strpos(strtoupper($ordner),strtoupper($dont_show_7))
                  && !strpos(strtoupper($ordner),strtoupper($dont_show_8))
                  && !strpos(strtoupper($ordner),strtoupper($dont_show_9))
                  && !strpos(strtoupper($ordner),strtoupper($dont_show_10))
                  ){
                  $replace      = array ('./' => '');
                  $new_file     =  $ordner . '/' . $file;
                  $new_file     = strtr($new_file, $replace);
                  $new_file     =  getcwd() . '/' . $new_file;
                  $all_files[]  = $new_file;
                }
              }
            }
          }
        }
        closedir($handle);
        return $all_files;
      }
      show_all_files('.');
    
      $replace_all    = array ('ä' => 'ä', 'ö' => 'ö', 'ü' => 'ü',
      'Ä' => 'Ä', 'Ö' => 'Ö', 'Ü' => 'Ü', 'ß' => 'ß','§' =>
      '§', '€' => '€');
    
      foreach( $all_files as $key => $value){
    
        $file         = $value;
        $act_file     = $file;
        $file         = fopen($file,'r');
        $inhalt       = fread($file,filesize($act_file));
    
        if(!strpos($act_file, getcwd() . '\gen_entities.php')){
          $inhalt       = strtr($inhalt, $replace_all);
        }
        fclose($file);
        $datei_name   = $act_file;
        $fp           = fopen($datei_name, "w");
        fwrite($fp, $inhalt);
        fclose($fp);
    
      }
    
    }else{
    
    ?>
    
    <style type="text/css">
    <!--
    body{
      font-family:Arial;
      color:Navy;
      }
    table{
      font-family:Arial;
      font-size:12px;
      color:Navy;
      }
    td{
      padding-left:20px;
      padding-right:20px;
      padding-top:10px;
      padding-bottom:10px;
      border:1px;
      border-style:solid;
      border-color:Navy;
      }
    select{
      width:80px;
      font-family:Arial;
      font-size:12px;
      color:Navy;
      border:1px;
      border-style:solid;
      border-color:Navy;
      }
    input{
      font-family:Arial;
      font-size:12px;
      color:Navy;
      border:1px;
      border-style:solid;
      border-color:Navy;
      cursor:pointer;
      }
    -->
    </style>
    <center><h4>Entities schreiben</h4></center>
    <form name="gen_sitemap" method="post" action="<?php echo $PHP_SELF; ?>">
    <table align="center">
      <tr>
        <td valign="top" align="center">Ausschlusspfade</td>
        <td valign="top" align="center">Dateiendungen</td>
      </tr>
      <tr>
        <td valign="top" align="center">
    <input type="text" name="dont_show_1"></input><br>
    <input type="text" name="dont_show_2"></input><br>
    <input type="text" name="dont_show_3"></input><br>
    <input type="text" name="dont_show_4"></input><br>
    <input type="text" name="dont_show_5"></input><br>
    <input type="text" name="dont_show_6"></input><br>
    <input type="text" name="dont_show_7"></input><br>
    <input type="text" name="dont_show_8"></input><br>
    <input type="text" name="dont_show_9"></input><br>
    <input type="text" name="dont_show_10"></input><br>
        </td>
        <td valign="top" align="center">
    <input type="text" name="filespec_1"></input><br>
    <input type="text" name="filespec_2"></input><br>
    <input type="text" name="filespec_3"></input><br>
    <input type="text" name="filespec_4"></input><br>
    <input type="text" name="filespec_5"></input><br>
    <input type="text" name="filespec_6"></input><br>
        </td>
      </tr>
      <tr>
        <td colspan=4 align="center">
    <input type="submit"></input>
        </td>
      </tr>
      <tr>
        <td colspan=4>
        </td>
      </tr>
    </table>
    </form>
    
    <?php } ?>
    




    <<< Zurück zur letzten Seite