Ejemplo n.º 1
0
 /**
  * Method to display the view.
  *
  * @param	string	A template file to load.
  * @return	mixed	JError object on failure, void on success.
  * @throws	object	JError
  * @since	1.6
  */
 public function display($tpl = null)
 {
     if ($this->getLayout() == 'schema') {
         parent::display($tpl);
         return;
     }
     // Initialize variables.
     $user = JFactory::getUser();
     // Load the view data.
     $this->model = $this->get('Model');
     $this->state = $this->get('State');
     $this->step = $this->get('Step');
     $this->steps = $this->get('Steps');
     $this->status = $this->get('Status');
     $this->error = $this->get('Error');
     $this->requirements = $this->get('Requirements');
     $this->versions = $this->get('DetectVersions');
     require_once KPATH_ADMIN . '/install/version.php';
     $version = new KunenaVersion();
     $this->versionWarning = $version->getVersionWarning('COM_KUNENA_INSTALL_WARNING');
     // Render the layout.
     $app = JFactory::getApplication();
     if (!empty($this->requirements->fail) || !empty($this->error)) {
         $app->enqueueMessage(JText::_('COM_KUNENA_INSTALL_FAILED'), 'error');
     } else {
         if ($this->step && isset($this->steps[$this->step + 1])) {
             $app->enqueueMessage(JText::_('COM_KUNENA_INSTALL_DO_NOT_INTERRUPT'), 'notice');
         } else {
             if (!isset($this->steps[$this->step + 1])) {
                 $app->enqueueMessage(JText::_('COM_KUNENA_INSTALL_SUCCESS'));
             } else {
                 if (!empty($this->versionWarning)) {
                     $app->enqueueMessage($this->versionWarning, 'notice');
                 }
             }
         }
     }
     JRequest::setVar('hidemainmenu', 1);
     $this->go = JRequest::getCmd('go', '');
     $session = JFactory::getSession();
     $this->cnt = $session->get('kunena.reload', 1);
     if ($this->step) {
         // Output enqueued messages from previous reloads (to show Joomla warnings)
         $queue = (array) $session->get('kunena.queue');
         foreach ($queue as $item) {
             if (is_array($item) && $item['type'] != 'message') {
                 $app->enqueueMessage($item['message'], $item['type']);
             }
         }
     }
     parent::display($tpl);
 }
Ejemplo n.º 2
0
        // Start by loading English strings and override them by current locale
        $lang->load('com_kunena.install', JPATH_ADMINISTRATOR, 'en-GB');
        $lang->load('com_kunena.install', JPATH_ADMINISTRATOR);
        require_once KPATH_ADMIN . '/install/model.php';
        $installer = new KunenaModelInstall();
        $installer->deleteMenu();
        $installer->createMenu();
        $kunena_app->enqueueMessage(JText::_('COM_KUNENA_MENU_CREATED'));
        // No break! Need to display the control panel
    // No break! Need to display the control panel
    case 'cpanel':
    default:
        html_Kunena::controlPanel();
        break;
}
$kn_version_warning = $kn_version->getVersionWarning('COM_KUNENA_VERSION_INSTALLED');
if (!empty($kn_version_warning)) {
    $kunena_app->enqueueMessage($kn_version_warning, 'notice');
}
if (!$kn_version->checkVersion()) {
    $kunena_app->enqueueMessage(sprintf(JText::_('COM_KUNENA_ERROR_UPGRADE'), Kunena::version()), 'notice');
    $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_UPGRADE_WARN'));
    $kunena_app->enqueueMessage(sprintf(JText::_('COM_KUNENA_ERROR_UPGRADE_AGAIN'), Kunena::version()));
    $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_INCOMPLETE_SUPPORT') . ' <a href="http://www.kunena.org">www.kunena.org</a>');
}
// Detect errors in CB integration
// TODO: do we need to enable this?
/*
if (is_object ( $kunenaProfile )) {
	$kunenaProfile->enqueueErrors ();
}
Ejemplo n.º 3
0
 /**
  * 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;
 }
Ejemplo n.º 4
0
 /**
  * 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;
 }
Ejemplo n.º 5
0
	/**
	 * Method to display a view.
	 *
	 * @return	void
	 * @since	1.6
	 */
	public function display() {
		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('COM_KUNENA_VERSION_INSTALLED');
			if (! empty ( $version_warning )) {
				$app->enqueueMessage ( $version_warning, 'notice' );
			}
		} else {
			// Initialize profile integration
			$integration = KunenaFactory::getProfile();
			$integration->open();

			/*if (!$app->getMenu ()->getActive ()) {
				// FIXME:
				JError::raiseError ( 500, JText::_ ( 'COM_KUNENA_NO_ACCESS' ) );
			}*/
		}

		// 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') {
				$view->template = KunenaFactory::getTemplate();
				$common = $this->getView ( 'common', $vFormat );
				$common->setModel ( $this->getModel ( 'common' ), true );
				$view->common = $common;
				$templatepath = KPATH_SITE."/{$view->template->getPath()}/html/";
				$view->addTemplatePath($templatepath.$vName);
				$view->common->addTemplatePath($templatepath.'common');
			}

			// Do any specific processing for the view.
			switch ($vName) {
				default :
					// Get the appropriate model for the view.
					$model = $this->getModel ( $vName );
					break;
			}

			// 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->assignRef ( 'document', $document );

			// Render the view.
			if ($vFormat=='html') {
				$view->displayAll ();
			} else {
				$view->displayLayout ();
			}
		}

		if ($app->isSite()) {
			// Close profile integration
			$integration = KunenaFactory::getProfile();
			$integration->close();
		}
		KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
	}