Esempio n. 1
0
    }
    if (isset($_GET['strPoster']) and $_GET['strPoster'] != '') {
        $arrNew["poster"] = htmlspecialchars($_GET['strPoster']);
    }
    if (isset($_GET['strExclude']) and $_GET['strExclude'] != '') {
        $arrNew["excludekeywords"] = htmlspecialchars($_GET['strExclude']);
    }
    if (isset($_GET['strNZBFile']) and $_GET['strNZBFile'] != '') {
        $strFixedNZBName = htmlspecialchars($_GET['strNZBFile']);
        if (strpos($strFixedNZBName, ".nzb") === false) {
            $strFixedNZBName .= ".nzb";
        }
        $arrNew["fixednzbname"] = $strFixedNZBName;
    }
    $arrNew["hits"] = 0;
    $objDownload->add_download($arrNew);
    $appConfig = new nzbg_conf("config");
    $objNZBLog = new nzbg_log($appConfig);
    $objNZBLog->writeLine("Saved entry \"{$strDLTitle}\" to the download list.");
} elseif (isset($_GET['type']) and $_GET['type'] == "edit") {
    $intID = $_GET['intID'];
    $strDLOldTitle = $_GET['strOldTitle'];
    $strDLTitle = htmlspecialchars($_GET['strDLTitle']);
    $strDLMatch = htmlspecialchars($_GET['strDLMatch']);
    $strDLHow = $_GET['strDLHow'];
    $arrDownloadList = $objDownload->get_xml_as_array();
    $appConfig = new nzbg_conf("config");
    $objNZBLog = new nzbg_log($appConfig);
    if ($arrDownloadList[$intID]['title'] == $strDLOldTitle) {
        # Update Queue record
        $arrUpdate = array('title' => $strDLTitle, 'findstring' => $strDLMatch, 'downloadtype' => $strDLHow);
Esempio n. 2
0
     # Using cURL (preferred over the wget shell_exec method)
     $objCurl = new nzbg_curl_download();
     $objCurl->setFrom($current_nzb['enclosure']['properties']['url']);
     $objCurl->setTo($nzbFolder . $strFileNZB . '.nzb');
     $objCurl->download();
     unset($objCurl);
 } else {
     @shell_exec($appConfig->wgetpath . ' -O ' . $nzbFolder . $strFileNZB . '.nzb ' . $current_nzb['enclosure']['properties']['url']);
 }
 # Check if filesize matched, otherwise it's not good
 $nzb_valid = @simplexml_load_string(@file_get_contents($nzbFolder . $strFileNZB . '.nzb')) ? true : false;
 if ($nzb_valid) {
     if ($isQueue) {
         # Add to queue
         $arrQueue = array('matchtitle' => $downloadentry['title'], 'nzb' => $strFileNZB . '.nzb', 'datefound' => date("d-m-o G:i:s"));
         $objQueue->add_download($arrQueue);
     }
     # Filename needs to be a fixed one?
     if (!$isQueue and isset($downloadentry['fixednzbname']) and $downloadentry['fixednzbname'] != '') {
         $strNZBRenamed = $downloadentry['fixednzbname'];
         @rename($nzbFolder . $strFileNZB . '.nzb', $nzbFolder . $strNZBRenamed);
     }
     # Write the dummy file
     @touch($dummy);
     # Tweet ?
     if ($twitter_enabled == true and $isQueue == false) {
         $strTweetFinal = str_replace('%download', $current_nzb['description']['value'], $strTweet);
         $objTwitter->updateStatus($strTweetFinal);
         # Logging tweet event
         $_msg = "Tweeting download " . $current_nzb['description']['value'];
         $objNZBLog->writeLine($_msg);