function handleNzbAction($messageIds, array $currentSession, $action, Services_Providers_FullSpot $svcProvSpot, Services_Providers_Nzb $svcProvNzb) { if (!is_array($messageIds)) { $messageIds = array($messageIds); } # if # Make sure the user has the appropriate permissions $currentSession['security']->fatalPermCheck(SpotSecurity::spotsec_retrieve_nzb, ''); if ($action != 'display') { $currentSession['security']->fatalPermCheck(SpotSecurity::spotsec_download_integration, $action); } # if /* * Get all the full spots for all of the specified NZB files */ $nzbList = array(); $fullSpot = array(); foreach ($messageIds as $thisMsgId) { $fullSpot = $svcProvSpot->fetchFullSpot($thisMsgId, $currentSession['user']['userid']); if (!empty($fullSpot['nzb'])) { $nzbList[] = array('spot' => $fullSpot, 'nzb' => $svcProvNzb->fetchNzb($fullSpot)); } # if } # foreach /* * send nzblist to NzbHandler plugin */ $nzbHandlerFactory = new Services_NzbHandler_Factory(); $nzbHandler = $nzbHandlerFactory->build($this->_settings, $action, $currentSession['user']['prefs']['nzbhandling']); $nzbHandler->processNzb($fullSpot, $nzbList); /* * and mark the spot as downloaded */ if ($currentSession['user']['prefs']['keep_downloadlist']) { if ($currentSession['security']->allowed(SpotSecurity::spotsec_keep_own_downloadlist, '')) { $spotStateListDao = $this->_daoFactory->getSpotStateListDao(); foreach ($messageIds as $thisMsgId) { $spotStateListDao->addToDownloadList($thisMsgId, $currentSession['user']['userid']); } # foreach } # if } # if # and send notifications $spotsNotifications = new SpotNotifications($this->_daoFactory, $this->_settings, $currentSession); $spotsNotifications->sendNzbHandled($action, $fullSpot); }
function handleNzbAction($messageids, $userSession, $action, $hdr_spotnntp, $nzb_spotnntp) { if (!is_array($messageids)) { $messageids = array($messageids); } # if # Controleer de security $userSession['security']->fatalPermCheck(SpotSecurity::spotsec_retrieve_nzb, ''); if ($action != 'display') { $userSession['security']->fatalPermCheck(SpotSecurity::spotsec_download_integration, $action); } # if # Haal de volledige spot op en gebruik de informatie daarin om de NZB file op te halen $spotsOverview = new SpotsOverview($this->_db, $this->_settings); $nzbList = array(); foreach($messageids as $thisMsgId) { $fullSpot = $spotsOverview->getFullSpot($thisMsgId, $userSession['user']['userid'], $hdr_spotnntp); if (!empty($fullSpot['nzb'])) { $nzbList[] = array('spot' => $fullSpot, 'nzb' => $spotsOverview->getNzb($fullSpot['nzb'], $nzb_spotnntp)); } # if } # foreach # send nzblist to NzbHandler plugin $nzbHandlerFactory = new NzbHandler_Factory(); $nzbHandler = $nzbHandlerFactory->build($this->_settings, $action, $userSession['user']['prefs']['nzbhandling']); $nzbHandler->processNzb($fullSpot, $nzbList); # en voeg hem toe aan de lijst met downloads if ($userSession['user']['prefs']['keep_downloadlist']) { if ($userSession['security']->allowed(SpotSecurity::spotsec_keep_own_downloadlist, '')) { foreach($messageids as $thisMsgId) { $this->_db->addToSpotStateList(SpotDb::spotstate_Down, $thisMsgId, $userSession['user']['userid']); } # foreach } # if } # if # en verstuur een notificatie $spotsNotifications = new SpotNotifications($this->_db, $this->_settings, $userSession); $spotsNotifications->sendNzbHandled($action, $fullSpot); } # handleNzbAction