Example #1
0
 function render()
 {
     $result = new Dto_FormResult('notsubmitted');
     # check the users' permissions
     $this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_view_spotdetail, '');
     $this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_edit_spotdetail, '');
     # and actually retrieve the spot
     $fullSpot = '';
     try {
         $svcActn_GetSpot = new Services_Actions_GetSpot($this->_settings, $this->_daoFactory, $this->_spotSec);
         $fullSpot = $svcActn_GetSpot->getFullSpot($this->_currentSession, $this->_messageId, true);
         $fullSpot = str_replace("[br]", "\n", $fullSpot);
     } catch (Exception $ex) {
         $result->addError($ex->getMessage());
     }
     # catch
     # and create a nice and shiny page title
     $this->_pageTitle = "spot: edit spot";
     /*
      * bring the forms' action into the local scope for
      * easier access
      */
     $formAction = $this->_spotForm['action'];
     # Only perform certain validations when the form is actually submitted
     if (!empty($formAction)) {
         switch ($formAction) {
             case 'delete':
                 # check permissions
                 $this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_delete_spot, '');
                 # assume success
                 $result->setResult('success');
                 # remove the spot from the database
                 $svcSpotEditor = new Services_Posting_Editor($this->_daoFactory, $this->_currentSession);
                 $svcSpotEditor->deleteSpot($this->_messageId);
                 break;
                 # case 'delete'
             # case 'delete'
             case 'edit':
                 # create a fullspot xml from the data entered by the user and the original fullspot
                 $svcSpotEditor = new Services_Posting_Editor($this->_daoFactory, $this->_currentSession);
                 $result = $svcSpotEditor->updateSpotXml($fullSpot, $this->_spotForm);
                 if ($result->isSuccess()) {
                     # update the spot in the database
                     $svcSpotEditor->updateSpot($this->_messageId, $result->getData('spotxml'));
                 }
                 # if
                 break;
                 # case 'edit'
         }
         # switch
     }
     # if
     #- display stuff -#
     $this->template('editspot', array('editspotform' => $fullSpot, 'result' => $result));
 }
Example #2
0
 function render()
 {
     # Make sure user has access to the spot
     $this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_view_spotdetail, '');
     # and actually retrieve the spot
     $svcActn_GetSpot = new Services_Actions_GetSpot($this->_settings, $this->_daoFactory, $this->_spotSec);
     $fullSpot = $svcActn_GetSpot->getFullSpot($this->_currentSession, $this->_messageid, true);
     # set page title
     $this->_pageTitle = "spot: " . $fullSpot['title'];
     #- display stuff -#
     $this->template('spotinfo', array('spot' => $fullSpot));
 }
Example #3
0
 function getFullSpot($messageId)
 {
     # and actually retrieve the spot
     $svcActn_GetSpot = new Services_Actions_GetSpot($this->_settings, $this->_daoFactory, $this->_spotSec);
     $fullSpot = $svcActn_GetSpot->getFullSpot($this->_currentSession, $messageId, true);
     return $fullSpot;
 }
Example #4
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'];
 }