Exemplo n.º 1
0
 function render()
 {
     # Check users' permissions
     $this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_view_spotimage, '');
     $settings_nntp_hdr = $this->_settings->get('nntp_hdr');
     # Did the user request an SpeedDial image?
     if (isset($this->_image['type']) && $this->_image['type'] == 'speeddial') {
         $svcActn_SpeedDial = new Services_Actions_SpeedDial($this->_daoFactory, $this->_spotSec, $this->_tplHelper);
         $data = $svcActn_SpeedDial->createSpeedDialImage($this->_currentSession['user']['userid'], $settings_nntp_hdr['host']);
     } elseif (isset($this->_image['type']) && $this->_image['type'] == 'statistics') {
         /* Check whether the user has view statistics permissions */
         $this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_view_statistics, '');
         $graph = isset($this->_image['graph']) ? $this->_image['graph'] : false;
         $limit = isset($this->_image['limit']) ? $this->_image['limit'] : false;
         # init
         $svcPrv_Stats = new Services_Providers_Statistics($this->_daoFactory->getSpotDao(), $this->_daoFactory->getCacheDao(), $this->_daoFactory->getUsenetStateDao()->getLastUpdate(Dao_UsenetState::State_Spots));
         $data = $svcPrv_Stats->renderStatImage($graph, $limit);
     } elseif (isset($this->_image['type']) && $this->_image['type'] == 'avatar') {
         # Check users' permissions
         $this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_view_spotimage, 'avatar');
         $providerSpotImage = new Services_Providers_CommentImage(new Services_Providers_Http($this->_daoFactory->getCacheDao()));
         $data = $providerSpotImage->fetchGravatarImage($this->_image);
     } else {
         $svc_nntpnzb_engine = Services_Nntp_EnginePool::pool($this->_settings, 'bin');
         /*
          * Retrieve the full spot, we need it to be able to retrieve the image
          */
         $svcActn_GetSpot = new Services_Actions_GetSpot($this->_settings, $this->_daoFactory, $this->_spotSec);
         $fullSpot = $svcActn_GetSpot->getFullSpot($this->_currentSession, $this->_messageid, false);
         /*
          * Actually retrieve the image 
          */
         $providerSpotImage = new Services_Providers_SpotImage(new Services_Providers_Http($this->_daoFactory->getCacheDao()), new Services_Nntp_SpotReading($svc_nntpnzb_engine), $this->_daoFactory->getCacheDao());
         $data = $providerSpotImage->fetchSpotImage($fullSpot);
     }
     # else
     # Images are allowed to be cached on the client unless the provider explicitly told us not to
     if (isset($data['ttl']) && $data['ttl'] > 0) {
         $this->sendExpireHeaders(true);
     } else {
         $this->sendExpireHeaders(false);
     }
     # else
     header("Content-Type: " . image_type_to_mime_type($data['metadata']['imagetype']));
     header("Content-Length: " . strlen($data['content']));
     echo $data['content'];
 }
Exemplo n.º 2
0
 function getValidStatisticsLimits()
 {
     $svcPrv_Stats = new Services_Providers_Statistics($this->_daoFactory->getSpotDao(), $this->_daoFactory->getCacheDao(), 0);
     return $svcPrv_Stats->getValidStatisticsLimits();
 }
Exemplo n.º 3
0
         }
         # else
     }
     # if
 } catch (CorruptBWListException $e) {
     echo PHP_EOL . "Non-fatal: Updating black/whitelist failed, most likely unreachable!";
 }
 ## Remove expired debuglogs
 echo "Expiring debuglog entries, if any, ";
 $daoFactory->getDebugLogDao()->expire();
 echo "done. " . PHP_EOL;
 ## Statistics
 if ($settings->get('prepare_statistics') && $newSpotCount > 0) {
     if (extension_loaded('gd') || extension_loaded('gd2')) {
         $settings_nntp_hdr = $settings->get('nntp_hdr');
         $svcPrv_Stats = new Services_Providers_Statistics($daoFactory->getSpotDao(), $daoFactory->getCachedao(), $daoFactory->getUsenetStateDao()->getLastUpdate(Dao_UsenetState::State_Spots));
         echo "Starting to create statistics " . PHP_EOL;
         $svcPrv_Stats->createAllStatistics();
         echo "Finished creating statistics " . PHP_EOL;
         echo PHP_EOL;
     } else {
         echo "GD extension not loaded, not creating statistics" . PHP_EOL;
     }
     # else
 }
 # if
 # Verstuur notificaties
 $spotsNotifications = new SpotNotifications($daoFactory, $settings, $userSession);
 if (!empty($notifyNewArray)) {
     foreach ($notifyNewArray as $userId => $newSpotInfo) {
         foreach ($newSpotInfo as $filterInfo) {