本文整理汇总了PHP中KunenaController类的典型用法代码示例。如果您正苦于以下问题:PHP KunenaController类的具体用法?PHP KunenaController怎么用?PHP KunenaController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KunenaController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例2: KunenaControllerInstall
// Safety check to prevent fatal error if 'System - Kunena Forum' plug-in has been disabled.
if ($app->input->getCmd('view') == 'install' || !class_exists('KunenaForum') || !KunenaForum::isCompatible('4.0')) {
// Run installer instead..
require_once __DIR__ . '/install/controller.php';
$controller = new KunenaControllerInstall();
// TODO: execute special task that checks what's wrong
$controller->execute($app->input->getCmd('task'));
$controller->redirect();
return;
}
if ($app->input->getCmd('view') == 'uninstall') {
$allowed = $app->getUserState('com_kunena.uninstall.allowed');
if ($allowed) {
require_once __DIR__ . '/install/controller.php';
$controller = new KunenaControllerInstall();
$controller->execute('uninstall');
$controller->redirect();
$app->setUserState('com_kunena.uninstall.allowed', null);
return;
}
}
// Initialize Kunena Framework.
KunenaForum::setup();
// Initialize custom error handlers.
KunenaError::initialize();
// Kunena has been successfully installed: Load our main controller.
$controller = KunenaController::getInstance();
$controller->execute($app->input->getCmd('task'));
$controller->redirect();
// Remove custom error handlers.
KunenaError::cleanup();
示例3: 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());
}
}
示例4: display
public function display($cachable = false, $urlparams = false)
{
// Redirect profile to integrated component if profile integration is turned on
$redirect = 1;
$active = $this->app->getMenu()->getActive();
if (!empty($active)) {
$params = $active->params;
$redirect = $params->get('integration', 1);
}
if ($redirect && JRequest::getCmd('format', 'html') == 'html') {
$profileIntegration = KunenaFactory::getProfile();
$layout = JRequest::getCmd('layout', 'default');
if ($profileIntegration instanceof KunenaProfileKunena) {
// Continue
} elseif ($layout == 'default') {
$url = $this->me->getUrl(false);
} elseif ($layout == 'list') {
$url = $profileIntegration->getUserListURL('', false);
}
if (!empty($url)) {
$this->setRedirect($url);
return;
}
}
$layout = JRequest::getCmd('layout', 'default');
if ($layout == 'list') {
if (KunenaFactory::getConfig()->userlist_allowed && JFactory::getUser()->guest) {
$this->redirectBack();
}
}
parent::display();
}
示例5: display
public function display($cachable = false, $urlparams = false)
{
// Redirect profile to integrated component if profile integration is turned on
$redirect = 1;
$active = $this->app->getMenu()->getActive();
if (!empty($active)) {
if (version_compare(JVERSION, '1.6', '>')) {
// Joomla 1.6+
$params = $active->params;
} else {
// Joomla 1.5
$params = new JParameter($active->params);
}
$redirect = $params->get('integration', 1);
}
if ($redirect && JRequest::getCmd('format') == 'html') {
$profileIntegration = KunenaFactory::getProfile();
if ($profileIntegration instanceof KunenaProfileKunena) {
// Continue
} elseif (JRequest::getCmd('layout', 'default') == 'default') {
$url = $this->me->getUrl(false);
} elseif (JRequest::getCmd('layout') == 'list') {
$url = $profileIntegration->getUserListURL('', false);
}
if (!empty($url)) {
$this->setRedirect($url);
return;
}
}
parent::display();
}
示例6: getModel
public function getModel($name = '', $prefix = '', $config = array())
{
if (empty($name)) {
$name = 'plugin';
}
return parent::getModel($name, $prefix, $config);
}
示例7: __construct
public function __construct($config = array()) {
parent::__construct($config);
$this->catid = JRequest::getInt('catid', 0);
$this->return = JRequest::getInt('return', $this->catid);
$this->id = JRequest::getInt('id', 0);
$this->mesid = JRequest::getInt('mesid', 0);
}
示例8: __construct
/**
* @param array $config
*
* @throws Exception
*/
public function __construct($config = array())
{
parent::__construct($config);
$this->catid = JFactory::getApplication()->input->getInt('catid', 0);
$this->return = JFactory::getApplication()->input->getInt('return', $this->catid);
$this->id = JFactory::getApplication()->input->getInt('id', 0);
$this->mesid = JFactory::getApplication()->input->getInt('mesid', 0);
}
示例9: __construct
public function __construct($config = array()) {
parent::__construct($config);
$this->catid = JRequest::getInt('catid', 0);
$this->return = JRequest::getInt('return', $this->catid);
$this->id = JRequest::getInt('id', 0);
$this->mesid = JRequest::getInt('mesid', 0);
$this->config = KunenaFactory::getConfig();
$this->me = KunenaUserHelper::getMyself();
}
示例10: display
public function display($cachable = false, $urlparams = false)
{
$db = JFactory::getDbo();
// Enable Kunena updates if they were disabled (but only every 6 hours or logout/login).
$now = time();
$timestamp = $this->app->getUserState('pkg_kunena.updateCheck', 0);
if ($timestamp < $now) {
$query = $db->getQuery(true)->update($db->quoteName('#__update_sites'))->set($db->quoteName('enabled') . '=1')->where($db->quoteName('location') . ' LIKE ' . $db->quote('http://update.kunena.org/%'));
$db->setQuery($query);
$db->execute();
$this->app->setUserState('pkg_kunena.updateCheck', $now + 60 * 60 * 6);
}
parent::display($cachable, $urlparams);
}
示例11: __construct
public function __construct($config = array()) {
parent::__construct($config);
$app = JFactory::getApplication ();
$lang = JFactory::getLanguage();
// 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, null, true);
require_once(KPATH_ADMIN . '/install/model.php');
$installer = new KunenaModelInstall();
$installer->deleteMenu();
$installer->createMenu();
$app->enqueueMessage ( JText::_('COM_KUNENA_MENU_CREATED') );
$this->redirectBack ();
}
示例12: display
public function display() {
// Redirect profile to integrated component if profile integration is turned on
$redirect = 1;
$active = JFactory::getApplication ()->getMenu ()->getActive ();
if (!empty($active)) {
$params = new JParameter($active->params);
$redirect = $params->get('integration');
}
if ($redirect) {
$profileIntegration = KunenaFactory::getProfile();
if (!($profileIntegration instanceof KunenaProfileKunena)) {
$url = CKunenaLink::GetProfileURL(KunenaFactory::getUser()->userid, false);
if ($url) {
$this->setRedirect($url);
return;
}
}
}
parent::display();
}
示例13: __construct
public function __construct($config = array())
{
parent::__construct($config);
}
示例14: __construct
public function __construct($config = array()) {
parent::__construct($config);
$this->baseurl = 'index.php?option=com_kunena&view=topicicons';
}
示例15: __construct
public function __construct($config = array()) {
$this->db = JFactory::getDBO ();
parent::__construct($config);
}