} else { $groupID = -1; foreach ($nzbInfo->groups as $group) { $group = (string) $group; if (array_key_exists($group, $siteGroups)) { $groupID = $siteGroups[$group]; $groupName = $group; break; } } if ($groupID == -1) { $retval .= "Missing Group for NZB : " . $browserpostednames[$nzbFile] . " - " . join(", ", $nzbInfo->groups) . "<br/>"; continue; } $relguid = md5(uniqid()); $name = $releases->cleanReleaseName(str_replace(".nzb", "", $browserpostednames[$nzbFile])); $catId = $cat->determineCategory($groupName, $name); $relid = $releases->insertRelease($name, $nzbInfo->filecount, $groupID, $relguid, $catId, "", date("Y-m-d H:i:s", $nzbInfo->postedlast), $nzbInfo->poster, "", $page->site); $db->exec(sprintf("update releases set totalpart = %d, size = %s, completion = %d, GID=%s where ID = %d", $nzbInfo->filecount, $nzbInfo->filesize, $nzbInfo->completion, $db->escapeString($nzbInfo->gid), $relid)); $nzbfilename = $nzb->getNZBPath($relguid, $page->site->nzbpath, true); $fp = _gzopen($nzbfilename, "w"); if ($fp) { gzwrite($fp, $nzbInfo->toNzb()); gzclose($fp); $retval .= sprintf(" Imported %s<br/>", $name); } } } } } $page->smarty->assign('output', $retval);
if ($groupID == -1) { echo sprintf("%0" . $digits . "d %.2f%% Error : Missing group %s - Group(%s)\n", $items - $num, $num / $items * 100, $nzbFile, str_replace("alt.binaries.", "a.b.", implode(",", $nzbInfo->groups))); if ($movefiles) { if (!file_exists($nogrouppath)) { mkdir($nogrouppath); } if (!file_exists($nogrouppath . basename($nzbFile))) { rename($nzbFile, $nogrouppath . basename($nzbFile)); } $missinggroups = array_merge($missinggroups, $nzbInfo->groups); } continue; } else { if ($usefilename) { $relguid = md5(uniqid()); $name = $releases->cleanReleaseName(str_replace(".nzb", "", basename($nzbFile))); $catId = $cat->determineCategory($groupName, $name); $relid = $releases->insertRelease($name, $nzbInfo->filecount, $groupID, $relguid, $catId, "", date("Y-m-d H:i:s", $nzbInfo->postedlast), $nzbInfo->poster, "", $page->settings); $db->queryExec(sprintf("update releases set totalpart = %d, size = %s, completion = %d, GID=%s where id = %d", $nzbInfo->filecount, $nzbInfo->filesize, $nzbInfo->completion, $db->escapeString($nzbInfo->gid), $relid)); $nzbfilename = $nzb->getNZBPath($relguid, $page->settings->getSetting('nzbpath'), true); $fp = gzopen($nzbfilename, "w"); if ($fp) { gzwrite($fp, $nzbInfo->toNzb()); gzclose($fp); echo sprintf("%0" . $digits . "d %.2f%% Imported %s\n", $items - $num, $num / $items * 100, $name); if ($movefiles) { if (!file_exists($importedpath)) { mkdir($importedpath); } if (!file_exists($importedpath . basename($nzbFile))) { rename($nzbFile, $importedpath . basename($nzbFile));