function FixTextFields($text)
 {
     $text = SafeStripSlashes($text);
     $text = str_replace('\'', ''', $text);
     $text = str_replace('"', '"', $text);
     return $text;
 }
 function FixTextFields($text)
 {
     $text = SafeStripSlashes($text);
     $text = htmlentities($text, ENT_QUOTES);
     return $text;
 }
	<script type="text/javascript" src="javascript_api.js"></script>

<?php 
function SafeStripSlashes($string)
{
    return get_magic_quotes_gpc() ? stripslashes($string) : $string;
}
$additionalparameters = array();
foreach ($_GET as $key => $value) {
    if (is_array($value)) {
        foreach ($value as $key2 => $value2) {
            $additionalparameters[] = $key . '[]=' . SafeStripSlashes($value2);
        }
    } else {
        $additionalparameters[] = $key . '=' . SafeStripSlashes($value);
    }
}
$imagesrc = $phpThumbLocation . implode('&', $additionalparameters);
echo '<script type="text/javascript">';
echo 'var ns4;';
echo 'var op5;';
echo 'function setBrowserWindowSizeToImage() {';
echo 'if (!document.getElementById("imageimg")) { return false; }';
echo 'sniffBrowsers();';
echo 'var imageW = getImageWidth("imageimg");';
echo 'var imageH = getImageHeight("imageimg");';
// check for maximum dimensions to allow no-scrollbar window
echo 'if (((screen.width * 1.1) > imageW) || ((screen.height * 1.1) > imageH)) {' . "\n";
// screen is large enough to fit whole picture on screen with 10% margin
echo 'CrossBrowserResizeInnerWindowTo(imageW, imageH);' . "\n";
     $data['id3v2']['TYER']['encodingid'] = 0;
     $data['id3v2']['TYER']['data'] = (int) SafeStripSlashes($_POST['EditorYear']);
 }
 if ($_POST['EditorTrack']) {
     $data['id3v2']['TRCK']['encodingid'] = 0;
     $data['id3v2']['TRCK']['data'] = (int) SafeStripSlashes($_POST['EditorTrack']);
 }
 if ($_POST['EditorGenre']) {
     $data['id3v2']['TCON']['encodingid'] = 0;
     $data['id3v2']['TCON']['data'] = '(' . $_POST['EditorGenre'] . ')';
 }
 if ($_POST['EditorComment']) {
     $data['id3v2']['COMM'][0]['encodingid'] = 0;
     $data['id3v2']['COMM'][0]['language'] = 'eng';
     $data['id3v2']['COMM'][0]['description'] = '';
     $data['id3v2']['COMM'][0]['data'] = SafeStripSlashes($_POST['EditorComment']);
 }
 if (isset($_FILES['userfile']['tmp_name']) && $_FILES['userfile']['tmp_name']) {
     if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
         if ($fd = @fopen($_FILES['userfile']['tmp_name'], 'rb')) {
             $data['id3v2']['APIC'][0]['data'] = fread($fd, filesize($_FILES['userfile']['tmp_name']));
             fclose($fd);
             $data['id3v2']['APIC'][0]['encodingid'] = isset($EditorAPICencodingID) ? $EditorAPICencodingID : 0;
             $data['id3v2']['APIC'][0]['picturetypeid'] = isset($EditorAPICpictypeID) ? $EditorAPICpictypeID : 0;
             $data['id3v2']['APIC'][0]['description'] = isset($EditorAPICdescription) ? $EditorAPICdescription : '';
             require_once GETID3_INCLUDEPATH . 'getid3.getimagesize.php';
             $imageinfo = GetDataImageSize($data['id3v2']['APIC'][0]['data']);
             $imagetypes = array(1 => 'gif', 2 => 'jpeg', 3 => 'png');
             if (isset($imageinfo[2]) && $imageinfo[2] >= 1 && $imageinfo[2] <= 3) {
                 $data['id3v2']['APIC'][0]['mime'] = 'image/' . $imagetypes[$imageinfo[2]];
             } else {
 if ($_POST['EditorTrack']) {
     $data['id3v2']['TRCK']['encodingid'] = 0;
     $data['id3v2']['TRCK']['data'] = (int) SafeStripSlashes($_POST['EditorTrack']);
     $data['ape']['track'][] = SafeStripSlashes($_POST['EditorTrack']);
 }
 if ($_POST['EditorGenre']) {
     $data['id3v2']['TCON']['encodingid'] = 0;
     $data['id3v2']['TCON']['data'] = '(' . $_POST['EditorGenre'] . ')';
     $data['ape']['genre'][] = SafeStripSlashes($_POST['EditorGenre']);
 }
 if ($_POST['EditorComment']) {
     $data['id3v2']['COMM'][0]['encodingid'] = 0;
     $data['id3v2']['COMM'][0]['language'] = 'eng';
     $data['id3v2']['COMM'][0]['description'] = '';
     $data['id3v2']['COMM'][0]['data'] = SafeStripSlashes($_POST['EditorComment']);
     $data['ape']['comments'][] = SafeStripSlashes($_POST['EditorComment']);
 }
 if (isset($_FILES['userfile']['tmp_name']) && $_FILES['userfile']['tmp_name']) {
     if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
         if ($fd = @fopen($_FILES['userfile']['tmp_name'], 'rb')) {
             $data['id3v2']['APIC'][0]['data'] = fread($fd, filesize($_FILES['userfile']['tmp_name']));
             fclose($fd);
             $data['id3v2']['APIC'][0]['encodingid'] = isset($EditorAPICencodingID) ? $EditorAPICencodingID : 0;
             $data['id3v2']['APIC'][0]['picturetypeid'] = isset($EditorAPICpictypeID) ? $EditorAPICpictypeID : 0;
             $data['id3v2']['APIC'][0]['description'] = isset($EditorAPICdescription) ? $EditorAPICdescription : '';
             require_once GETID3_INCLUDEPATH . 'getid3.getimagesize.php';
             $imageinfo = GetDataImageSize($data['id3v2']['APIC'][0]['data']);
             $imagetypes = array(1 => 'gif', 2 => 'jpeg', 3 => 'png');
             if (isset($imageinfo[2]) && $imageinfo[2] >= 1 && $imageinfo[2] <= 3) {
                 $data['id3v2']['APIC'][0]['mime'] = 'image/' . $imagetypes[$imageinfo[2]];
             } else {
        if (isset($_REQUEST['assumeFormat']) && $_REQUEST['assumeFormat'] == $possibleFormat) {
            echo '<B>' . $possibleFormat . '</B> | ';
        } else {
            echo '<A HREF="' . $_SERVER['PHP_SELF'] . '?filename=' . urlencode($_REQUEST['filename']) . '&assumeFormat=' . $possibleFormat . '">' . $possibleFormat . '</A> | ';
        }
    }
    if (isset($_REQUEST['assumeFormat'])) {
        echo '<A HREF="' . $_SERVER['PHP_SELF'] . '?filename=' . urlencode($_REQUEST['filename']) . '">default</A><BR>';
    } else {
        echo '<B>default</B><BR>';
    }
    echo table_var_dump($ThisFileInfo);
    $endtime = getmicrotime();
    echo 'File parsed in ' . number_format($endtime - $starttime, 3) . ' seconds.<BR>';
} else {
    $listdirectory = isset($_REQUEST['listdirectory']) ? SafeStripSlashes($_REQUEST['listdirectory']) : '.';
    $listdirectory = realpath($listdirectory);
    // get rid of /../../ references
    $currentfulldir = $listdirectory . '/';
    if (substr(php_uname(), 0, 7) == 'Windows') {
        // this mostly just gives a consistant look to Windows and *nix filesystems
        // (windows uses \ as directory seperator, *nix uses /)
        $currentfulldir = str_replace('\\', '/', $listdirectory . '/');
    }
    if ($handle = @opendir($listdirectory)) {
        echo str_repeat(' ', 300);
        // IE buffers the first 300 or so chars, making this progressive display useless - fill the buffer with spaces
        echo 'Processing';
        $starttime = getmicrotime();
        while ($file = readdir($handle)) {
            set_time_limit(30);
     echo '<TH>MD5 File (File) (<A HREF="' . $_SERVER['PHP_SELF'] . '?listdirectory=' . rawurlencode(isset($_REQUEST['listdirectory']) ? $_REQUEST['listdirectory'] : '.') . '">disable</A>)</TH>';
     echo '<TH>MD5 Data (File) (<A HREF="' . $_SERVER['PHP_SELF'] . '?listdirectory=' . rawurlencode(isset($_REQUEST['listdirectory']) ? $_REQUEST['listdirectory'] : '.') . '">disable</A>)</TH>';
     echo '<TH>MD5 Data (Source) (<A HREF="' . $_SERVER['PHP_SELF'] . '?listdirectory=' . rawurlencode(isset($_REQUEST['listdirectory']) ? $_REQUEST['listdirectory'] : '.') . '">disable</A>)</TH>';
 } else {
     echo '<TH COLSPAN="3">MD5 Data (<A HREF="' . $_SERVER['PHP_SELF'] . '?listdirectory=' . rawurlencode(isset($_REQUEST['listdirectory']) ? $_REQUEST['listdirectory'] : '.') . '&ShowMD5=1">enable</A>)</TH>';
 }
 echo '<TH>Tags</TH>';
 echo '<TH>Errors</TH>';
 echo '<TH>Edit</TH>';
 echo '<TH>Delete</TH>';
 echo '</TR>';
 if (isset($DirectoryContents["{$dirname}"]['known']) && is_array($DirectoryContents["{$dirname}"]['known'])) {
     uksort($DirectoryContents["{$dirname}"]['known'], 'MoreNaturalSort');
     foreach ($DirectoryContents["{$dirname}"]['known'] as $filename => $fileinfo) {
         echo '<TR BGCOLOR="#' . ($rowcounter++ % 2 ? $getID3checkColor_FileDark : $getID3checkColor_FileLight) . '">';
         echo '<TD><A HREF="' . $_SERVER['PHP_SELF'] . '?filename=' . urlencode($dirname . $filename) . '" TITLE="View detailed analysis">' . SafeStripSlashes($filename) . '</A></TD>';
         echo '<TD ALIGN="RIGHT">&nbsp;' . number_format($fileinfo['filesize']) . '</TD>';
         echo '<TD ALIGN="RIGHT">&nbsp;' . NiceDisplayFiletypeFormat($fileinfo) . '</TD>';
         echo '<TD ALIGN="RIGHT">&nbsp;' . (isset($fileinfo['playtime_string']) ? $fileinfo['playtime_string'] : '-') . '</TD>';
         echo '<TD ALIGN="RIGHT">&nbsp;' . (isset($fileinfo['bitrate']) ? BitrateText($fileinfo['bitrate'] / 1000) : '-') . '</TD>';
         echo '<TD ALIGN="LEFT">&nbsp;' . (isset($fileinfo['comments']['artist']) ? implode("\n", $fileinfo['comments']['artist']) : '') . '</TD>';
         echo '<TD ALIGN="LEFT">&nbsp;' . (isset($fileinfo['comments']['title']) ? implode("\n", $fileinfo['comments']['title']) : '') . '</TD>';
         if (isset($_REQUEST['ShowMD5'])) {
             echo '<TD ALIGN="LEFT"><TT>' . (isset($fileinfo['md5_file']) ? $fileinfo['md5_file'] : '&nbsp;') . '</TT></TD>';
             echo '<TD ALIGN="LEFT"><TT>' . (isset($fileinfo['md5_data']) ? $fileinfo['md5_data'] : '&nbsp;') . '</TT></TD>';
             echo '<TD ALIGN="LEFT"><TT>' . (isset($fileinfo['md5_data_source']) ? $fileinfo['md5_data_source'] : '&nbsp;') . '</TT></TD>';
         } else {
             echo '<TD ALIGN="CENTER" COLSPAN="3">-</TD>';
         }
         echo '<TD ALIGN="LEFT">&nbsp;' . implode(', ', $fileinfo['tags']) . '</TD>';
         echo '<TD ALIGN="LEFT">&nbsp;';