2017-12-25 44 views
0

ohanah_event_id이 설정되지 않은 경우이 파일에 대한 액세스를 차단해야합니다. 어떻게해야합니까?이벤트가 비어있는 경우 URL에 대한 액세스를 차단하는 방법은 무엇입니까?

<?php 

/** 
* @package  Ohanah 
* @copyright Copyright (C) 2012 - 2016 Beyounic SA. All rights reserved. 
* @license  GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> 
* @link  http://www.beyounic.com 
*/ 

class ComOhanahViewTicketHtml extends ComOhanahViewHtml 
{ 
    protected function _fetchData(KViewContext $context) 
    { 
     parent::_fetchData($context); 

     if ($context->data->ticket->ohanah_event_id) { 
      $doc = JFactory::getDocument(); 
      $translator = $this->getObject('translator'); 

      $doc->setTitle($translator->translate('COM_OHANAH_TICKET') . ' - ' . $context->data->ticket->event->title); 
     } 
    } 
} 
+0

당신이 경우 내부에 또 다른 조건을 시도 함수에 false를 반환? 와 함께 if (empty ($ context)) {header (location ....)} else {your function continue} – Robin

+0

@Robin no, 왜냐하면 슬프게도 PHP에 대한 많은 지식을 가지고 있지 않기 때문이다. – YoKoGFX

답변

0

<?php 
 
class ComOhanahViewTicketHtml extends ComOhanahViewHtml 
 
{ 
 
    protected function _fetchData(KViewContext $context) 
 
    { 
 
     parent::_fetchData($context); 
 
     if(!empty($context->data->ticket->ohanah_event_id)){ 
 
     $context->data->ticket->ohanah_event_id; 
 
      $doc = JFactory::getDocument(); 
 
      $translator = $this->getObject('translator'); 
 

 
      $doc->setTitle($translator->translate('COM_OHANAH_TICKET') . ' - ' . $context->data->ticket->event->title); 
 
     } 
 
     else { 
 
     return false;} 
 
    } 
 
} 
 
?>

당신은 조건이 같은 시도 할 수와! 빈, 그리고 비어 있다면 당신은