function batchadd()
{
    global $xoopsModuleConfig, $xoopsDB, $genre, $genretitle, $myts, $xoopsModule;
    $dir = opendir(XOOPS_ROOT_PATH . "/modules/debaser/batchload/");
    $efetuouUpload = false;
    while ($filename = readdir($dir)) {
        if ($filename != "." && $filename != "..") {
            $efetuouUpload = true;
            $added = time();
            $sorce = XOOPS_ROOT_PATH . "/modules/debaser/batchload/{$filename}";
            $taget = XOOPS_ROOT_PATH . "/modules/debaser/upload/{$filename}";
            rename($sorce, $taget);
            $filepath = XOOPS_ROOT_PATH . "/modules/debaser/upload/{$filename}";
            require_once XOOPS_ROOT_PATH . '/modules/debaser/class/getid3/getid3.php';
            $getID3 = new getID3();
            $ThisFileInfo = $getID3->analyze($filepath);
            getid3_lib::CopyTagsToComments($ThisFileInfo);
            include XOOPS_ROOT_PATH . '/modules/debaser/include/readinfo.php';
            $link = '';
            $weight = '0';
            if ($xoopsModuleConfig['autogenrebatch'] == 1) {
                $genre = $myts->htmlSpecialChars(!empty($ThisFileInfo['comments_html']['genre']) ? implode($ThisFileInfo['comments_html']['genre']) : '');
                if ($genre == '') {
                    $genre = noGenreTitle($genretitle);
                }
                genreExist($genre);
            } else {
                $genre = noGenreTitle($genretitle);
            }
            $mimesql = "SELECT mime_ext FROM " . $xoopsDB->prefix('debaser_mimetypes') . " WHERE mime_types LIKE '%" . $mimetyplink . "%'";
            $mimeresult = $xoopsDB->query($mimesql);
            list($mimetyp) = $xoopsDB->fetchRow($mimeresult);
            /* insert file into database and show sucess or not */
            if ($xoopsModuleConfig['autobatchapprove'] == 1) {
                $approved = 1;
                if ($mimetyp == '') {
                    $approved = 0;
                }
            } else {
                $approved = 0;
            }
            if ($title == '') {
                $ext = strrchr($filename, ".");
                $title = substr($filename, 0, -strlen($ext));
            }
            $sql = "\r\n\t\t\t\tINSERT INTO " . $xoopsDB->prefix('debaser_files') . " (\r\n\t\t\t\t\tfilename, added, title, artist, album, year, addinfo, track, genre, length, bitrate, link, frequence, approved, fileext, weight) \r\n\t\t\t\tVALUES (\r\n\t\t\t\t\t" . $xoopsDB->quoteString($filename) . ", \r\n\t\t\t\t\t" . intval($added) . ", \r\n\t\t\t\t\t" . $xoopsDB->quoteString($title) . ", \r\n\t\t\t\t\t" . $xoopsDB->quoteString($artist) . ",\r\n\t\t\t\t\t" . $xoopsDB->quoteString($album) . ", \r\n\t\t\t\t\t" . intval($year) . ", \r\n\t\t\t\t\t" . $xoopsDB->quoteString($addinfo) . ", \r\n\t\t\t\t\t" . intval($track) . ", \r\n\t\t\t\t\t" . $xoopsDB->quoteString($genre) . ", \r\n\t\t\t\t\t" . $xoopsDB->quoteString($length) . ", \r\n\t\t\t\t\t" . intval($bitrate) . ", \r\n\t\t\t\t\t" . $xoopsDB->quoteString($link) . ", \r\n\t\t\t\t\t" . intval($frequence) . ", \r\n\t\t\t\t\t" . intval($approved) . ",\r\n\t\t\t\t\t" . $xoopsDB->quoteString($mimetyp) . ",\r\n\t\t\t\t\t" . intval($weight) . ")";
            $result = $xoopsDB->queryF($sql);
        }
    }
    closedir($dir);
    if ($efetuouUpload) {
        redirect_header('index.php', 1, _AM_DEBASER_ALLUP);
    } else {
        redirect_header('index.php', 1, _AM_DEBASER_NO_ALLUP);
    }
}
         }
     }
 }
 /* -- */
 /* checking if file alread exists, if yes page will be redirected */
 mpegExist($artist, $title);
 /* -- */
 if ($xoopsModuleConfig['autogenresingle'] == 1) {
     $genre = $myts->htmlSpecialChars(!empty($ThisFileInfo['comments_html']['genre']) ? implode($ThisFileInfo['comments_html']['genre']) : '');
     if ($genre == '') {
         $genre = noGenreTitle();
     }
     genreExist($genre);
 } else {
     if ($_POST['genrefrom'] == '0') {
         $genre = noGenreTitle();
     } else {
         $sqlb = "\r\n\t\t\t\tSELECT genretitle\r\n\t\t\t\tFROM " . $xoopsDB->prefix('debaser_genre') . "\r\n\t\t\t\tWHERE genreid = " . intval($_POST['genrefrom']) . "";
         $resultb = $xoopsDB->query($sqlb);
         list($genrelist) = $xoopsDB->fetchRow($resultb);
         $genre = $genrelist;
     }
 }
 /* setting values for files wether they have to be approved or not */
 if ($xoopsModuleConfig['autofileapprove'] == 1) {
     $approved = 1;
 } else {
     $approved = 0;
 }
 /* -- */
 if ($_POST['link'] != '') {