function changeWikis2 ($directory,$count) {
   $directory_handle  = opendir($directory);
   while ( false !== ($entry = readdir($directory_handle)) ) {
      if ($entry != '.' and $entry != '..' and is_dir($directory.'/'.$entry)) {
         changeWikis2($directory.'/'.$entry,$count);
      } elseif (is_file($directory.'/'.$entry) and $entry == 'commsy_config.php') {
         $str = file_get_contents($directory.'/'.$entry);
         if ( mb_stristr($str,'$COMMSY_ROOM_ID') and !mb_stristr($str,'session_name') ) {
            $str = str_replace(array("\r\n", "\r"), "\n", $str);
            $str_array = explode("\n",$str);
            $str_out = '';
            foreach ( $str_array as $value ) {
               $str_out .= $value.LF;
               if ( mb_stristr($value, '$COMMSY_ROOM_ID = "') ) {
                  $str_out .= 'session_name(\'SESSID-\'.$COMMSY_ROOM_ID);'.LF;
               }
            }
            if ( !empty($str_out) ) {
               file_put_contents($directory.'/'.$entry,trim($str_out));
            }
         }
         update_progress_bar($count);
      }
   }
}
Beispiel #2
0
function changeWikis2 ($directory,$count) {
   $directory_handle  = opendir($directory);
   while ( false !== ($entry = readdir($directory_handle)) ) {
      if ( $entry != '.'
           and $entry != '..'
           and is_dir($directory.'/'.$entry)
           and !mb_stristr($entry, 'uploads')
           and !is_link($directory.'/'.$entry)
         ) {
         changeWikis2($directory.'/'.$entry,$count);
      } elseif ( is_file($directory.'/'.$entry)
                 and !stristr($entry,'.jpg')
                 and !stristr($entry,'.jpeg')
                 and !stristr($entry,'.gif')
                 and !stristr($entry,'.png')
                 and !stristr($entry,'.ico')
               ) {
         $file_contents = file_get_contents($directory.'/'.$entry);
         $file_contents = iconv('ISO-8859-1', 'UTF-8', $file_contents);
         file_put_contents($directory . '/' . $entry, $file_contents);
      }
   }
}