當前位置: 首頁>>代碼示例>>PHP>>正文


PHP KunenaRoute::getItemID方法代碼示例

本文整理匯總了PHP中KunenaRoute::getItemID方法的典型用法代碼示例。如果您正苦於以下問題:PHP KunenaRoute::getItemID方法的具體用法?PHP KunenaRoute::getItemID怎麽用?PHP KunenaRoute::getItemID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在KunenaRoute的用法示例。


在下文中一共展示了KunenaRoute::getItemID方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: display

	public function display($cachable = false, $urlparams = false) {
		$menu = $this->app->getMenu ();
		$home = $menu->getActive ();
		if (!$home) {
			JRequest::setVar ( 'view', 'category' );
			JRequest::setVar ( 'layout', 'list' );
			//JError::raiseError ( 500, JText::_ ( 'COM_KUNENA_NO_ACCESS' ) );

		} else {
			// Find default menu item
			$default = $this->_getDefaultMenuItem($menu, $home);
			if (!$default || $default->id == $home->id) {
				// There is no default menu item, use category view instead

				$default = $menu->getItem ( KunenaRoute::getItemID("index.php?option=com_kunena&view=category&layout=list") );
				if ($default) {
					$default = clone $default;
					$defhome = KunenaRoute::getHome($default);
					if (!$defhome || $defhome->id != $home->id) $default = clone $home;
					$default->query['view'] = 'category';
					$default->query['layout'] = 'list';
				}
			}
			if (!$default) {
				JError::raiseError ( 500, JText::_ ( 'COM_KUNENA_NO_ACCESS' ) );
			}

			// Add query variables from shown menu item
			foreach ( $default->query as $var => $value ) {
				JRequest::setVar ( $var, $value );
			}

			// Remove query variables coming from the home menu item
			JRequest::setVar ( 'defaultmenu', null );

			// Set active menu item to point the real page
			$menu->setActive ( $default->id );
		}

		// Reset our router
		KunenaRoute::initialize();

		// Run display task from our new controller
		$controller = KunenaController::getInstance();
		$controller->execute ('display');

		// Set redirect and message
		$this->setRedirect ($controller->getRedirect(), $controller->getMessage(), $controller->getMessageType());
	}
開發者ID:kosmosby,項目名稱:medicine-prof,代碼行數:49,代碼來源:home.php

示例2: execute

 /**
  * Redirect to home page.
  *
  * @return KunenaLayout
  *
  * @throws KunenaExceptionAuthorise
  */
 public function execute()
 {
     $menu = $this->app->getMenu();
     $home = $menu->getActive();
     if (!$home) {
         $this->input->set('view', 'category');
         $this->input->set('layout', 'list');
         // throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 500);
     } else {
         // Find default menu item.
         $default = $this->getDefaultMenuItem($menu, $home);
         if (!$default || $default->id == $home->id) {
             // There is no default menu item, use category view instead.
             $default = $menu->getItem(KunenaRoute::getItemID('index.php?option=com_kunena&view=category&layout=list'));
             if ($default) {
                 $default = clone $default;
                 $defhome = KunenaRoute::getHome($default);
                 if (!$defhome || $defhome->id != $home->id) {
                     $default = clone $home;
                 }
                 $default->query['view'] = 'category';
                 $default->query['layout'] = 'list';
             }
         }
         if (!$default) {
             throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 500);
         }
         // Add query variables from shown menu item.
         foreach ($default->query as $var => $value) {
             $this->input->set($var, $value);
         }
         // Remove query variables coming from the home menu item.
         $this->input->set('defaultmenu', null);
         // Set active menu item to point the real page.
         $this->input->set('Itemid', $default->id);
         $menu->setActive($default->id);
     }
     // Reset our router.
     KunenaRoute::initialize();
     // Get HMVC controller for the current page.
     $controller = KunenaControllerApplication::getInstance($this->input->getCmd('view'), $this->input->getCmd('layout', 'default'), $this->input->getCmd('task', 'display'), $this->input, $this->app);
     if (!$controller) {
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 404);
     }
     return $controller->execute();
 }
開發者ID:Ruud68,項目名稱:Kunena-Forum,代碼行數:53,代碼來源:display.php

示例3:

    ?>
						</label>
					<?php 
}
?>
					<a href="index.php?option=com_kunena&view=topic&layout=reply&catid=<?php 
echo $message->catid;
?>
&id=<?php 
echo $message->thread;
?>
&mesid=<?php 
echo $message->id;
?>
&Itemid=<?php 
echo KunenaRoute::getItemID();
?>
" role="button" class="btn btn-default btn-small btn-link pull-right" rel="nofollow"><?php 
echo JText::_('COM_KUNENA_GO_TO_EDITOR');
?>
</a>
				</div>
				<?php 
if (!empty($this->captchaEnabled)) {
    ?>
					<div class="control-group">
						<label class="control-label"><?php 
    echo JText::_('COM_KUNENA_CAPDESC');
    ?>
</label>
							<div class="controls"> <div id="dynamic_recaptcha_<?php 
開發者ID:Ruud68,項目名稱:Kunena-Forum,代碼行數:31,代碼來源:quickreply.php

示例4: before

 /**
  * Prepare category list display.
  *
  * @return void
  */
 protected function before()
 {
     parent::before();
     require_once KPATH_SITE . '/models/topics.php';
     $this->model = new KunenaModelTopics(array(), $this->input);
     $this->model->initialize($this->getOptions(), $this->getOptions()->get('embedded', false));
     $this->state = $this->model->getState();
     $this->me = KunenaUserHelper::getMyself();
     $this->moreUri = null;
     $this->embedded = $this->getOptions()->get('embedded', false);
     if ($this->embedded) {
         $this->moreUri = new JUri('index.php?option=com_kunena&view=topics&layout=posts&mode=' . $this->state->get('list.mode') . '&userid=' . $this->state->get('user') . '&sel=' . $this->state->get('list.time') . '&limit=' . $this->state->get('list.limit'));
         $this->moreUri->setVar('Itemid', KunenaRoute::getItemID($this->moreUri));
     }
     $start = $this->state->get('list.start');
     $limit = $this->state->get('list.limit');
     // Handle &sel=x parameter.
     $time = $this->state->get('list.time');
     if ($time < 0) {
         $time = null;
     } elseif ($time == 0) {
         $time = new JDate(KunenaFactory::getSession()->lasttime);
     } else {
         $time = new JDate(JFactory::getDate()->toUnix() - $time * 3600);
     }
     $userid = $this->state->get('user');
     $user = is_numeric($userid) ? KunenaUserHelper::get($userid) : null;
     // Get categories for the filter.
     $categoryIds = $this->state->get('list.categories');
     $reverse = !$this->state->get('list.categories.in');
     $authorise = 'read';
     $order = 'time';
     $finder = new KunenaForumMessageFinder();
     $finder->filterByTime($time);
     switch ($this->state->get('list.mode')) {
         case 'unapproved':
             $authorise = 'topic.post.approve';
             $finder->filterByUser(null, 'author')->filterByHold(array(1));
             break;
         case 'deleted':
             $authorise = 'topic.post.undelete';
             $finder->filterByUser($user, 'author')->filterByHold(array(2, 3));
             break;
         case 'mythanks':
             $finder->filterByUser($user, 'thanker')->filterByHold(array(0));
             break;
         case 'thankyou':
             $finder->filterByUser($user, 'thankee')->filterByHold(array(0));
             break;
         default:
             $finder->filterByUser($user, 'author')->filterByHold(array(0));
             break;
     }
     $categories = KunenaForumCategoryHelper::getCategories($categoryIds, $reverse, $authorise);
     $finder->filterByCategories($categories);
     $this->pagination = new KunenaPagination($finder->count(), $start, $limit);
     if ($this->moreUri) {
         $this->pagination->setUri($this->moreUri);
     }
     $this->messages = $finder->order($order, -1)->start($this->pagination->limitstart)->limit($this->pagination->limit)->find();
     // Load topics...
     $topicIds = array();
     foreach ($this->messages as $message) {
         $topicIds[(int) $message->thread] = (int) $message->thread;
     }
     $this->topics = KunenaForumTopicHelper::getTopics($topicIds, 'none');
     $userIds = $mesIds = array();
     foreach ($this->messages as $message) {
         $userIds[(int) $message->userid] = (int) $message->userid;
         $mesIds[(int) $message->id] = (int) $message->id;
     }
     if ($this->topics) {
         $this->prepareTopics($userIds, $mesIds);
     }
     switch ($this->state->get('list.mode')) {
         case 'unapproved':
             $this->headerText = JText::_('COM_KUNENA_VIEW_TOPICS_POSTS_MODE_UNAPPROVED');
             $actions = array('approve', 'delete', 'permdelete');
             break;
         case 'deleted':
             $this->headerText = JText::_('COM_KUNENA_VIEW_TOPICS_POSTS_MODE_DELETED');
             $actions = array('undelete', 'delete', 'permdelete');
             break;
         case 'mythanks':
             $this->headerText = JText::_('COM_KUNENA_VIEW_TOPICS_POSTS_MODE_MYTHANKS');
             $actions = array('approve', 'delete', 'permdelete');
             break;
         case 'thankyou':
             $this->headerText = JText::_('COM_KUNENA_VIEW_TOPICS_POSTS_MODE_THANKYOU');
             $actions = array('approve', 'delete', 'permdelete');
             break;
         case 'recent':
         default:
             $this->headerText = JText::_('COM_KUNENA_VIEW_TOPICS_POSTS_MODE_DEFAULT');
             $actions = array('delete', 'permdelete');
//.........這裏部分代碼省略.........
開發者ID:giabmf11,項目名稱:Kunena-Forum,代碼行數:101,代碼來源:display.php

示例5: display

 /**
  * Method to display a view.
  *
  * @param   boolean    $cachable   If true, the view output will be cached
  * @param   array|bool $urlparams  An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return  JControllerLegacy  A JControllerLegacy object to support chaining.
  */
 public function display($cachable = false, $urlparams = false)
 {
     KUNENA_PROFILER ? $this->profiler->mark('beforeDisplay') : null;
     KUNENA_PROFILER ? KunenaProfiler::instance()->start('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
     // Get the document object.
     $document = JFactory::getDocument();
     // Set the default view name and format from the Request.
     $vName = JRequest::getWord('view', $this->app->isAdmin() ? 'cpanel' : 'home');
     $lName = JRequest::getWord('layout', 'default');
     $vFormat = $document->getType();
     if ($this->app->isAdmin()) {
         // Load admin language files
         KunenaFactory::loadLanguage('com_kunena.install', 'admin');
         KunenaFactory::loadLanguage('com_kunena.views', 'admin');
         // Load last to get deprecated language files to work
         KunenaFactory::loadLanguage('com_kunena', 'admin');
         // Version warning
         require_once KPATH_ADMIN . '/install/version.php';
         $version = new KunenaVersion();
         $version_warning = $version->getVersionWarning();
         if (!empty($version_warning)) {
             $this->app->enqueueMessage($version_warning, 'notice');
         }
     } else {
         // Load site language files
         KunenaFactory::loadLanguage('com_kunena.views');
         KunenaFactory::loadLanguage('com_kunena.templates');
         // Load last to get deprecated language files to work
         KunenaFactory::loadLanguage('com_kunena');
         $menu = $this->app->getMenu();
         $active = $menu->getActive();
         // Check if menu item was correctly routed
         $routed = $menu->getItem(KunenaRoute::getItemID());
         if ($vFormat == 'html' && !empty($routed->id) && (empty($active->id) || $active->id != $routed->id)) {
             // Routing has been changed, redirect
             // FIXME: check possible redirect loops!
             $route = KunenaRoute::_(null, false);
             $activeId = !empty($active->id) ? $active->id : 0;
             JLog::add("Redirect from " . JUri::getInstance()->toString(array('path', 'query')) . " ({$activeId}) to {$route} ({$routed->id})", JLog::DEBUG, 'kunena');
             $this->app->redirect($route);
         }
         // Joomla 2.5+ multi-language support
         /* // FIXME:
         			if (isset($active->language) && $active->language != '*') {
         				$language = JFactory::getDocument()->getLanguage();
         				if (strtolower($active->language) != strtolower($language)) {
         					$route = KunenaRoute::_(null, false);
         					JLog::add("Language redirect from ".JUri::getInstance()->toString(array('path', 'query'))." to {$route}", JLog::DEBUG, 'kunena');
         					$this->redirect ($route);
         				}
         			}
         			*/
     }
     $view = $this->getView($vName, $vFormat);
     if ($view) {
         if ($this->app->isSite() && $vFormat == 'html') {
             $common = $this->getView('common', $vFormat);
             $model = $this->getModel('common');
             $common->setModel($model, true);
             $view->ktemplate = $common->ktemplate = KunenaFactory::getTemplate();
             $view->common = $common;
         }
         // Set the view layout.
         $view->setLayout($lName);
         // Get the appropriate model for the view.
         $model = $this->getModel($vName);
         // Push the model into the view (as default).
         $view->setModel($model, true);
         // Push document object into the view.
         $view->document = $document;
         // Render the view.
         if ($vFormat == 'html') {
             JPluginHelper::importPlugin('kunena');
             $dispatcher = JDispatcher::getInstance();
             $dispatcher->trigger('onKunenaDisplay', array('start', $view));
             $view->displayAll();
             $dispatcher->trigger('onKunenaDisplay', array('end', $view));
         } else {
             $view->displayLayout();
         }
     }
     KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
     return $this;
 }
開發者ID:giabmf11,項目名稱:Kunena-Forum,代碼行數:92,代碼來源:controller.php

示例6: getCategoryItemid

	public static function getCategoryItemid(KunenaForumCategory $category)
	{
		return KunenaRoute::getItemID("index.php?option=com_kunena&view=category&catid={$category->id}");
	}
開發者ID:BillVGN,項目名稱:PortalPRP,代碼行數:4,代碼來源:route.php

示例7: before

	/**
	 * Prepare user's topic list.
	 *
	 * @return void
	 */
	protected function before()
	{
		parent::before();

		require_once KPATH_SITE . '/models/topics.php';
		$this->model = new KunenaModelTopics(array(), $this->input);
		$this->model->initialize($this->getOptions(), $this->getOptions()->get('embedded', false));
		$this->state = $this->model->getState();
		$this->me = KunenaUserHelper::getMyself();
		$this->moreUri = null;

		$this->embedded = $this->getOptions()->get('embedded', false);

		if ($this->embedded)
		{
			$this->moreUri = new JUri('index.php?option=com_kunena&view=topics&layout=user&mode=' . $this->state->get('list.mode') . '&userid=' . $this->state->get('user') . '&sel=' . $this->state->get('list.time') . '&limit=' . $this->state->get('list.limit'));
			$this->moreUri->setVar('Itemid', KunenaRoute::getItemID($this->moreUri));
		}

		$start = $this->state->get('list.start');
		$limit = $this->state->get('list.limit');

		// Handle &sel=x parameter.
		$time = $this->state->get('list.time');

		if ($time < 0)
		{
			$time = null;
		}
		elseif ($time == 0)
		{
			$time = new JDate(KunenaFactory::getSession()->lasttime);
		}
		else
		{
			$time = new JDate(JFactory::getDate()->toUnix() - ($time * 3600));
		}

		$user = KunenaUserHelper::get($this->state->get('user'));

		// Get categories for the filter.
		$categoryIds = $this->state->get('list.categories');
		$reverse = !$this->state->get('list.categories.in');
		$authorise = 'read';
		$order = 'last_post_time';

		$finder = new KunenaForumTopicFinder;
		$finder
			->filterByMoved(false)
			->filterByHold(array(0))
			->filterByTime($time);

		switch ($this->state->get('list.mode'))
		{
			case 'posted' :
				$finder
					->filterByUser($user, 'posted')
					->order('last_post_id', -1, 'ut');
				break;

			case 'started' :
				$finder->filterByUser($user, 'owner');
				break;

			case 'favorites' :
				$finder->filterByUser($user, 'favorited');
				break;

			case 'subscriptions' :
				$finder->filterByUser($user, 'subscribed');
				break;

			default :
				$finder
					->filterByUser($user, 'involved')
					->order('favorite', -1, 'ut');
				break;
		}

		$categories = KunenaForumCategoryHelper::getCategories($categoryIds, $reverse, $authorise);
		$finder->filterByCategories($categories);

		$this->pagination = new KunenaPagination($finder->count(), $start, $limit);

		if ($this->moreUri)
		{
			$this->pagination->setUri($this->moreUri);
		}

		$this->topics = $finder
			->order($order, -1)
			->start($this->pagination->limitstart)
			->limit($this->pagination->limit)
			->find();

//.........這裏部分代碼省略.........
開發者ID:BillVGN,項目名稱:PortalPRP,代碼行數:101,代碼來源:display.php

示例8: display

 /**
  * Method to display a view.
  *
  * @return	void
  * @since	1.6
  */
 public function display($cachable = false, $urlparams = false)
 {
     KUNENA_PROFILER ? $this->profiler->mark('beforeDisplay') : null;
     KUNENA_PROFILER ? KunenaProfiler::instance()->start('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         // Version warning
         require_once KPATH_ADMIN . '/install/version.php';
         $version = new KunenaVersion();
         $version_warning = $version->getVersionWarning();
         if (!empty($version_warning)) {
             $app->enqueueMessage($version_warning, 'notice');
         }
     } else {
         $menu = $app->getMenu();
         $active = $menu->getActive();
         // Check if menu item was correctly routed
         $routed = $menu->getItem(KunenaRoute::getItemID());
         /*
         			if (!$active) {
         				// FIXME: we may want to resctrict access only to menu items
         				JError::raiseError ( 500, JText::_ ( 'COM_KUNENA_NO_ACCESS' ) );
         			}
         */
         if ($active->id != $routed->id) {
             // Routing has been changed, redirect
             // FIXME: check possible redirect loops!
             $app->redirect(KunenaRoute::_(null, false));
         }
         // Joomla 1.6+ multi-language support
         /* // FIXME:
         			if (isset($active->language) && $active->language != '*') {
         				$language = JFactory::getDocument()->getLanguage();
         				if (strtolower($active->language) != strtolower($language)) {
         					$this->redirect (KunenaRoute::_(null, false));
         				}
         			}
         			*/
     }
     // Get the document object.
     $document = JFactory::getDocument();
     // Set the default view name and format from the Request.
     $vName = JRequest::getWord('view', 'none');
     $lName = JRequest::getWord('layout', 'default');
     $vFormat = $document->getType();
     $view = $this->getView($vName, $vFormat);
     if ($view) {
         if ($app->isSite() && $vFormat == 'html') {
             $common = $this->getView('common', $vFormat);
             $model = $this->getModel('common');
             $common->setModel($model, true);
             $view->ktemplate = $common->ktemplate = KunenaFactory::getTemplate();
             $view->common = $common;
         }
         // Get the appropriate model for the view.
         $model = $this->getModel($vName);
         // Push the model into the view (as default).
         $view->setModel($model, true);
         // Set the view layout.
         $view->setLayout($lName);
         // Push document object into the view.
         $view->document = $document;
         // Render the view.
         if ($vFormat == 'html') {
             JPluginHelper::importPlugin('kunena');
             $dispatcher = JDispatcher::getInstance();
             $dispatcher->trigger('onKunenaDisplay', array('start', $view));
             $view->displayAll();
             $dispatcher->trigger('onKunenaDisplay', array('end', $view));
         } else {
             $view->displayLayout();
         }
     }
     KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
 }
開發者ID:laiello,項目名稱:senluonirvana,代碼行數:81,代碼來源:controller.php

示例9: if

						echo 'checked="checked"';
					} ?> />
					<label class="string optional" for="subscribeMe"><?php echo JText::_('COM_KUNENA_POST_NOTIFIED'); ?></label>
				</div>
				<?php if ($me->exists() && $category->allow_anonymous) : ?>
				<div class="controls">
					<input type="checkbox" id="kanonymous<?php echo $message->displayField('id'); ?>" name="anonymous"
							value="1" class="kinputbox postinput" <?php if ($category->post_anonymous) echo 'checked="checked"'; ?> />
					<label for="kanonymous<?php echo intval($message->id); ?>">
						<?php echo JText::_('COM_KUNENA_POST_AS_ANONYMOUS_DESC'); ?>
					</label>
				</div>
				<?php endif; ?>
			</div>
			<?php endif; ?>
			<a href="index.php?option=com_kunena&view=topic&layout=reply&catid=<?php echo $message->catid;?>&id=<?php echo $message->thread;?>&mesid=<?php echo $message->id;?>&Itemid=<?php echo KunenaRoute::getItemID();?>" role="button" class="btn btn-small btn-link pull-right" rel="nofollow"><?php echo JText::_('COM_KUNENA_GO_TO_EDITOR'); ?></a>
		</div>
		<?php if (!empty($this->captchaEnabled) && version_compare(JVERSION, '3.5', '<')) : ?>
			<div class="control-group">
				<div id="dynamic_recaptcha_<?php echo $this->message->id; ?>"> </div>
			</div>
		<?php else : ?>
			<?php // Fixme: can't get the controller working on this
				if ($me->canDoCaptcha() )
				{
					if (JPluginHelper::isEnabled('captcha'))
					{
						$plugin = JPluginHelper::getPlugin('captcha');
						$params = new JRegistry($plugin[0]->params);

						$captcha_pubkey = $params->get('public_key');
開發者ID:BillVGN,項目名稱:PortalPRP,代碼行數:31,代碼來源:quickreply.php

示例10: getItemid

	static private function getItemid( $htmlspecialchars = false ) {
		static $Itemid	=	null;

		if ( ! isset( $Itemid ) ) {
			$Itemid		=	KunenaRoute::getItemID();
		}

		if ( $Itemid ) {
			if ( is_bool( $htmlspecialchars ) ) {
				return ( $htmlspecialchars ? '&amp;' : '&' ) . 'Itemid=' . $Itemid;
			} else {
				return $Itemid;
			}
		}
	}
開發者ID:kosmosby,項目名稱:medicine-prof,代碼行數:15,代碼來源:kunena17.php

示例11: __construct

    function __construct()
    {
        ob_start();
        // Display time it took to create the entire page in the footer
        jimport('joomla.error.profiler');
        $__kstarttime = JProfiler::getmicrotime();
        $kunena_config = KunenaFactory::getConfig();
        kimport('error');
        KunenaError::initialize();
        // First of all take a profiling information snapshot for JFirePHP
        if (JDEBUG) {
            require_once JPATH_COMPONENT . '/lib/kunena.profiler.php';
            $__profiler = KProfiler::GetInstance();
            $__profiler->mark('Start');
        }
        $func = JString::strtolower(JRequest::getCmd('func', JRequest::getCmd('view', '')));
        $do = JRequest::getCmd('do', '');
        $task = JRequest::getCmd('task', '');
        $format = JRequest::getCmd('format', 'html');
        JRequest::setVar('func', $func);
        // Workaround for Joomla 1.7.3 login bug, see: https://github.com/joomla/joomla-platform/pull/740
        if ($func == 'profile' && ($task == 'login' || $task == 'logout')) {
            require_once KUNENA_PATH_FUNCS . '/profile.php';
            $page = new CKunenaProfile(JFactory::getUser()->id, $task);
        }
        require_once KUNENA_PATH . '/router.php';
        if ($func && !isset(KunenaRouter::$functions[$func])) {
            // If func is not legal, raise joomla error
            return JError::raiseError(404, 'Kunena function "' . $func . '" not found');
        }
        $kunena_app = JFactory::getApplication();
        if (empty($_POST) && $format == 'html') {
            $me = KunenaFactory::getUser();
            $menu = JSite::getMenu();
            $active = $menu->getActive();
            // Joomla 1.6+ multi-language support
            if (isset($active->language) && $active->language != '*') {
                $language = JFactory::getDocument()->getLanguage();
                if (strtolower($active->language) != strtolower($language)) {
                    $this->redirect(KunenaRoute::_(null, false));
                }
            }
            // Legacy menu item and Itemid=0 support with redirect and notice
            if (empty($active->query['view'])) {
                $new = $menu->getItem(KunenaRoute::getItemID());
                if ($new) {
                    if ($active) {
                        if ($active->route == $new->route) {
                            KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_CONFLICT', $active->route, $active->id, $new->id), 'menu');
                            $menu->setActive($new->id);
                            $active = $new;
                        } else {
                            KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_LEGACY', $active->route, $active->id, $new->route, $new->id), 'menu');
                            $this->redirect(KunenaRoute::_(null, false));
                        }
                    } else {
                        KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NO_ITEM_REDIRECT', $new->route, $new->id));
                        $this->redirect(KunenaRoute::_(null, false));
                    }
                } elseif (!$active) {
                    KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NO_ITEM'));
                }
            }
            if (!$func || $func == 'entrypage') {
                // If we are currently in entry page, we need to show and highlight default menu item
                if (!empty($active->query['defaultmenu'])) {
                    $defaultitem = $active->query['defaultmenu'];
                    if ($defaultitem > 0) {
                        $newitem = $menu->getItem($defaultitem);
                        if (!$newitem) {
                            KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NOT_EXISTS'), 'menu');
                        } elseif (empty($newitem->component) || $newitem->component != 'com_kunena') {
                            KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NOT_KUNENA'), 'menu');
                        } elseif ($active->route == $newitem->route) {
                            // Special case: we are using Entry Page instead of menu alias and we have identical menu alias
                            if ($active->id != $newitem->id) {
                                $defaultitem = !empty($newitem->query['defaultmenu']) ? $newitem->query['defaultmenu'] : $newitem->id;
                                $newitem2 = $menu->getItem($defaultitem);
                                if (empty($newitem2->component) || $newitem2->component != 'com_kunena') {
                                    $defaultitem = $newitem->id;
                                }
                                if ($defaultitem) {
                                    $menu->setActive($defaultitem);
                                    $active = $menu->getActive();
                                }
                            }
                        } else {
                            $oldlocation = KunenaRoute::getCurrentMenu();
                            $menu->setActive($defaultitem);
                            $active = $menu->getActive();
                            $newlocation = KunenaRoute::getCurrentMenu();
                            if (!$oldlocation || $oldlocation->id != $newlocation->id) {
                                // Follow Default Menu Item if it's not in the same menu
                                $this->redirect(KunenaRoute::_($defaultitem, false));
                            }
                        }
                        if (is_object($active)) {
                            foreach ($active->query as $var => $value) {
                                if ($var == 'view') {
                                    $var = 'func';
//.........這裏部分代碼省略.........
開發者ID:redigy,項目名稱:Kunena-1.6,代碼行數:101,代碼來源:kunena.php

示例12: display

	public function display() {
		global $Itemid;
		$menu = JFactory::getApplication ()->getMenu ();
		$home = $menu->getActive ();
		// TODO: maybe add error
		if (!$home) return;

		// Find default menu item
		$default = $this->_getDefaultMenuItem($menu, $home);
		if (!$default) {
			// There is no default menu item, use category view instead
			$default = clone $menu->getItem ( KunenaRoute::getItemID("index.php?option=com_kunena&view=category&layout=index") );
			$default->query['view'] = 'category';
			$default->query['layout'] = 'index';
		}
		if (!$default) {
			JError::raiseError ( 500, JText::_ ( 'COM_KUNENA_NO_ACCESS' ) );
		}

		// Check if menu item was correctly routed
		$active = $menu->getItem ( KunenaRoute::getItemID() );
		if (!$active || ($active->id != $home->id && $active->id != $default->id)) {
			// Routing has been changed, redirect or fail
			if ($active) {
				JRequest::setVar ( 'defaultmenu', null );
				// FIXME: chack possible redirect loops!
				$this->setRedirect (KunenaRoute::_(null, false));
			}
			return;
		}

		// Check if we are using default menu item
		if (!isset($default->query['layout'])) $default->query['layout'] = 'default';
		foreach ( $default->query as $var => $value ) {
			$cmp = JRequest::getVar($var, null);
			if ($var == 'defaultmenu') continue;
			if ($var == 'view' && $cmp == 'home') continue;
			if ($cmp !== null && $value != $cmp) {
				$default = $home;
				break;
			}
		}
		// Add query variables from shown menu item
		if ($default != $home) {
			foreach ( $default->query as $var => $value ) {
				JRequest::setVar ( $var, $value );
			}
		}
		// Set active menu item to point the real page
		$menu->setActive ( $default->id );

		// Joomla 1.5 hack:
		$Itemid = $default->id;
		KunenaRoute::initialize();

		if (JRequest::getVar ( 'view' ) != 'home') {
			// Run display task from our new controller
			$controller = KunenaController::getInstance(true);
			$controller->execute ('display');
			// Set redirect and message
			$this->setRedirect ($controller->getRedirect(), $controller->getMessage(), $controller->getMessageType());
		}
	}
開發者ID:GoremanX,項目名稱:Kunena-2.0,代碼行數:63,代碼來源:home.php

示例13: getItemid

 /**
  * Get item id for forum
  *
  * @param  boolean      $htmlspecialchars
  * @return string|null
  */
 public static function getItemid($htmlspecialchars = false)
 {
     if (!class_exists('KunenaRoute')) {
         return null;
     }
     static $Itemid = null;
     if (!isset($Itemid)) {
         $Itemid = KunenaRoute::getItemID();
     }
     if ($Itemid) {
         if (is_bool($htmlspecialchars)) {
             return ($htmlspecialchars ? '&amp;' : '&') . 'Itemid=' . (int) $Itemid;
         } else {
             return $Itemid;
         }
     }
     return null;
 }
開發者ID:bobozhangshao,項目名稱:HeartCare,代碼行數:24,代碼來源:kunena20.php


注:本文中的KunenaRoute::getItemID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。