本文整理汇总了PHP中KunenaRoute类的典型用法代码示例。如果您正苦于以下问题:PHP KunenaRoute类的具体用法?PHP KunenaRoute怎么用?PHP KunenaRoute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KunenaRoute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onSystemStart
function onSystemStart()
{
if (!self::kunenaInstalled()) {
return;
}
//initialize the toolbar object
$toolbar = CFactory::getToolbar();
// Kunena online check
if (!Kunena::enabled()) {
$toolbar->addGroup('KUNENAMENU', JText::_('PLG_COMMUNITY_KUNENAMENU_KUNENA_OFFLINE'), JRoute::_('index.php?option=com_kunena'));
return;
}
//adding new 'tab' 'Forum Settings' to JomSocial toolbar
$toolbar->addGroup('KUNENAMENU', JText::_('PLG_COMMUNITY_KUNENANENU_FORUM'), KunenaRoute::_('index.php?option=com_kunena&func=myprofile'));
if ($this->params->get('sh_editprofile')) {
$toolbar->addItem('KUNENAMENU', 'KUNENAMENU_EDITPROFILE', JText::_('PLG_COMMUNITY_KUNENAMENU_EDITPROFILE'), KunenaRoute::_('index.php?option=com_kunena&func=myprofile&task=edit'));
}
if ($this->params->get('sh_myprofile')) {
$toolbar->addItem('KUNENAMENU', 'KUNENAMENU_PROFILE', JText::_('PLG_COMMUNITY_KUNENAMENU_PROFILE'), KunenaRoute::_('index.php?option=com_kunena&func=myprofile'));
}
if ($this->params->get('sh_myposts')) {
$toolbar->addItem('KUNENAMENU', 'KUNENAMENU_POSTS', JText::_('PLG_COMMUNITY_KUNENAMENU_POSTS'), KunenaRoute::_('index.php?option=com_kunena&func=latest&do=userposts'));
}
if ($this->params->get('sh_mysubscriptions')) {
$toolbar->addItem('KUNENAMENU', 'KUNENAMENU_SUBSCRIBES', JText::_('PLG_COMMUNITY_KUNENAMENU_SUBSCRIBTIONS'), KunenaRoute::_('index.php?option=com_kunena&func=latest&do=subscriptions'));
}
if ($this->params->get('sh_myfavorites')) {
$toolbar->addItem('KUNENAMENU', 'KUNENAMENU_FAVORITES', JText::_('PLG_COMMUNITY_KUNENAMENU_FAVORITES'), KunenaRoute::_('index.php?option=com_kunena&func=latest&do=favorites'));
}
}
示例2: delete
/**
* @throws Exception
*/
public function delete()
{
if (!JSession::checkToken('post')) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
$this->setRedirect(KunenaRoute::_($this->baseurl, false));
return;
}
$cid = JFactory::getApplication()->input->get('cid', array(), 'post', 'array');
// Array of integers
Joomla\Utilities\ArrayHelper::toInteger($cid);
if (!$cid) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_NO_ATTACHMENTS_SELECTED'), 'error');
$this->setRedirect(KunenaRoute::_($this->baseurl, false));
return;
}
foreach ($cid as $id) {
$attachment = KunenaAttachmentHelper::get($id);
$message = $attachment->getMessage();
$attachments = array($attachment->id, 1);
$attach = array();
$removeList = array_keys(array_diff_key($attachments, $attach));
Joomla\Utilities\ArrayHelper::toInteger($removeList);
$message->removeAttachments($removeList);
$message->save();
$topic = $message->getTopic();
$attachment->delete();
if ($topic->attachments > 0) {
$topic->attachments = $topic->attachments - 1;
$topic->save(false);
}
}
$this->app->enqueueMessage(JText::_('COM_KUNENA_ATTACHMENTS_DELETED_SUCCESSFULLY'));
$this->setRedirect(KunenaRoute::_($this->baseurl, false));
}
示例3: getProfileURL
/**
* @param $user
* @param string $task
* @param bool $xhtml
*
* @return bool
*/
public function getProfileURL($user, $task = '', $xhtml = true)
{
if ($user == 0) {
return false;
}
if (!$user instanceof KunenaUser) {
$user = KunenaUserHelper::get($user);
}
if ($user === false) {
return false;
}
$userid = "&userid={$user->userid}";
if ($task && $task != 'edit') {
// TODO: remove in the future.
$do = $task ? '&do=' . $task : '';
return KunenaRoute::_("index.php?option=com_kunena&func=profile{$do}{$userid}", $xhtml);
} else {
$layout = $task ? '&layout=' . $task : '';
if ($layout) {
return KunenaRoute::_("index.php?option=com_kunena&view=user{$layout}{$userid}", $xhtml);
} else {
return KunenaRoute::getUserUrl($user, $xhtml);
}
}
}
示例4: delete
function delete() {
$app = JFactory::getApplication ();
$db = JFactory::getDBO ();
if (! JRequest::checkToken ()) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' );
$app->redirect ( KunenaRoute::_($this->baseurl, false) );
}
$cids = JRequest::getVar ( 'cid', array (), 'post', 'array' );
if (! $cids) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_NO_ATTACHMENTS_SELECTED' ), 'error' );
$app->redirect ( KunenaRoute::_($this->baseurl, false) );
}
foreach( $cids as $id ) {
kimport ('kunena.forum.message.attachment.helper');
$attachment = KunenaForumMessageAttachmentHelper::get($id);
$attachment->delete();
}
$app->enqueueMessage ( JText::_('COM_KUNENA_ATTACHMENTS_DELETED_SUCCESSFULLY') );
$app->redirect ( KunenaRoute::_($this->baseurl, false) );
}
示例5: ShowPosts
/**
* Generates HTML for posts in forum tab
*
* @param object $template
* @param object $forum
* @param object $model
* @return mixed
*/
function ShowPosts($template, $forum, $model)
{
$html = null;
$oneOrTwo = 1;
if ($template->posts) {
if ($template->showSearch) {
$html .= '<div style="width:95%;text-align:right;">' . $template->searchForm . '</div><div style="clear:both;"></div><br />';
}
$html .= '<table width="100%" cellspacing="0" cellpadding="3" border="0">' . '<thead>' . '<tr class="sectiontableheader">' . '<th colspan="4">' . $template->title . '</th>' . '</tr>' . '<tr class="sectiontableheader">' . '<th width="20%">' . $template->titles->date . '</th>' . '<th width="50%">' . $template->titles->subject . '</th>' . '<th width="25%">' . $template->titles->category . '</th>' . '<th width="5%">' . $template->titles->hits . '</th>' . '</tr>' . '</thead>' . '<tbody>';
foreach ($template->posts as $item) {
$version = substr($forum->version, 0, 3);
if ($forum->component == 'com_kunena' && strcasecmp($version, '1.6') >= 0) {
$postURL = KunenaRoute::_('index.php?option=' . $forum->component . '&func=view&catid=' . $item->catid . '&id=' . $item->id) . '#' . $item->id;
$catURL = KunenaRoute::_('index.php?option=' . $forum->component . '&func=showcat&catid=' . $item->catid);
} else {
$postURL = cbSef('index.php?option=' . $forum->component . $forum->itemid . '&func=view&catid=' . $item->catid . '&id=' . $item->id) . '#' . $item->id;
$catURL = cbSef('index.php?option=' . $forum->component . $forum->itemid . '&func=' . ($forum->component == 'com_kunena' ? 'showcat' : 'view') . '&catid=' . $item->catid);
}
$html .= '<tr class="sectiontableentry' . $oneOrTwo . '">' . '<td>' . getFieldValue('date', date('Y-m-d, H:i:s', $item->time)) . '</td>' . '<td><a href="' . $postURL . '">' . htmlspecialchars(stripslashes($item->subject)) . '</a></td>' . '<td><a href="' . $catURL . '">' . htmlspecialchars(stripslashes($item->catname)) . '</a></td>' . '<td>' . $item->threadhits . '</td>' . '</tr>';
$oneOrTwo = $oneOrTwo == 1 ? 2 : 1;
}
$html .= '</tbody>' . '</table>';
if ($template->showPaging) {
$html .= '<br /><div style="width:95%;text-align:center;">' . $template->paging . '</div>';
}
} else {
if ($template->noResults) {
$html .= '<div style="width:95%;text-align:right;">' . $template->searchForm . '</div><div style="clear:both;"></div><div>' . CBTxt::T('No matching forum posts found.') . '</div>';
} else {
$html .= '<div>' . CBTxt::T('This user has no forum posts.') . '</div>';
}
}
return $html;
}
示例6: getRSS
/**
* Method to get the RSS URL link with image
*
* @return string
*/
protected function getRSS()
{
$config = KunenaFactory::getConfig();
if ($config->enablerss)
{
$mode = $config->rss_type;
switch ($mode)
{
case 'topic' :
$rss_type = 'mode=topics';
break;
case 'recent' :
$rss_type = 'mode=replies';
break;
case 'post' :
$rss_type = 'layout=posts';
break;
}
return '<a href="' . KunenaRoute::_("index.php?option=com_kunena&view=topics&format=feed&layout=default&{$rss_type}", true) . '"><span class="icon-feed" title="' . JText::_('COM_KUNENA_CATEGORIES_LABEL_GETRSS') . '"></span></a>';
}
else
{
return null;
}
}
示例7: displayAll
public function displayAll()
{
if ($this->me->isAdmin()) {
if ($this->config->board_offline) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_FORUM_IS_OFFLINE'), 'notice');
}
if ($this->config->debug) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_WARNING_DEBUG'), 'notice');
}
}
if ($this->me->isBanned()) {
$banned = KunenaUserBan::getInstanceByUserid($this->me->userid, true);
if (!$banned->isLifetime()) {
$this->app->enqueueMessage(JText::sprintf('COM_KUNENA_POST_ERROR_USER_BANNED_NOACCESS_EXPIRY', KunenaDate::getInstance($banned->expiration)->toKunena('date_today')), 'notice');
} else {
$this->app->enqueueMessage(JText::_('COM_KUNENA_POST_ERROR_USER_BANNED_NOACCESS'), 'notice');
}
}
$this->state = $this->get('State');
require_once KPATH_SITE . '/lib/kunena.link.class.php';
$this->ktemplate->initialize();
if (JFactory::getApplication()->isAdmin()) {
$this->displayLayout();
} else {
$this->document->addHeadLink(KunenaRoute::_(), 'canonical', 'rel', '');
include $this->ktemplate->getFile('html/display.php');
echo $this->poweredBy();
}
}
示例8: before
/**
* Prepare menu display.
*
* @return bool
*/
protected function before()
{
parent::before();
$this->basemenu = $basemenu = KunenaRoute::getMenu();
if (!$basemenu)
{
return false;
}
$parameters = new JRegistry;
$template = KunenaFactory::getTemplate();
$parameters->set('showAllChildren', $template->params->get('menu_showall', 0));
$parameters->set('menutype', $basemenu->menutype);
$parameters->set('startLevel', $basemenu->level + 1);
$parameters->set('endLevel', $basemenu->level + $template->params->get('menu_levels', 1));
$this->list = KunenaMenuHelper::getList($parameters);
$this->menu = $this->app->getMenu();
$this->active = $this->menu->getActive();
$this->active_id = isset($this->active) ? $this->active->id : $this->menu->getDefault()->id;
$this->path = isset($this->active) ? $this->active->tree : array();
$this->showAll = $parameters->get('showAllChildren');
$this->class_sfx = htmlspecialchars($parameters->get('pageclass_sfx'), ENT_COMPAT, 'UTF-8');
return true;
}
示例9: sync
function sync() {
// FIXME: remove option:
$usercache = JRequest::getBool ( 'usercache', 0 );
$useradd = JRequest::getBool ( 'useradd', 0 );
$userdel = JRequest::getBool ( 'userdel', 0 );
$userrename = JRequest::getBool ( 'userrename', 0 );
$app = JFactory::getApplication ();
$db = JFactory::getDBO ();
if (!JRequest::checkToken()) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' );
$this->setRedirect(KunenaRoute::_($this->baseurl, false));
return;
}
if ($useradd) {
$db->setQuery ( "INSERT INTO #__kunena_users (userid) SELECT a.id FROM #__users AS a LEFT JOIN #__kunena_users AS b ON b.userid=a.id WHERE b.userid IS NULL" );
$db->query ();
if (KunenaError::checkDatabaseError()) return;
$app->enqueueMessage ( JText::_('COM_KUNENA_SYNC_USERS_DO_ADD') . ' ' . $db->getAffectedRows () );
}
if ($userdel) {
$db->setQuery ( "DELETE a FROM #__kunena_users AS a LEFT JOIN #__users AS b ON a.userid=b.id WHERE b.username IS NULL" );
$db->query ();
if (KunenaError::checkDatabaseError()) return;
$app->enqueueMessage ( JText::_('COM_KUNENA_SYNC_USERS_DO_DEL') . ' ' . $db->getAffectedRows () );
}
if ($userrename) {
$model = $this->getModel('Syncusers');
$cnt = $model->KupdateNameInfo ();
$app->enqueueMessage ( JText::_('COM_KUNENA_SYNC_USERS_DO_RENAME') . " $cnt" );
}
$this->setRedirect(KunenaRoute::_($this->baseurl, false));
}
示例10: onSystemStart
function onSystemStart()
{
if (!self::kunenaInstalled()) {
return;
}
//initialize the toolbar object
$toolbar = CFactory::getToolbar();
$user = JFactory::getUser();
// Kunena online check
if (!KunenaForum::enabled()) {
$toolbar->addGroup('KUNENAMENU', JText::_('PLG_COMMUNITY_KUNENAMENU_KUNENA_OFFLINE'), KunenaRoute::_('index.php?option=com_kunena'));
return;
}
//adding new 'tab' 'Forum Settings' to JomSocial toolbar
$toolbar->addGroup('KUNENAMENU', JText::_('PLG_COMMUNITY_KUNENANENU_FORUM'), 'index.php?option=com_kunena&view=user&layout=default&Itemid=' . KunenaRoute::getItemid('index.php?option=com_kunena&view=user&layout=default'));
if ($this->params->get('sh_editprofile', 1)) {
$toolbar->addItem('KUNENAMENU', 'KUNENAMENU_EDITPROFILE', JText::_('PLG_COMMUNITY_KUNENAMENU_EDITPROFILE'), 'index.php?option=com_kunena&view=user&layout=edit&Itemid=' . KunenaRoute::getItemid('index.php?option=com_kunena&view=user&layout=edit'));
}
if ($this->params->get('sh_myprofile', 1)) {
$toolbar->addItem('KUNENAMENU', 'KUNENAMENU_PROFILE', JText::_('PLG_COMMUNITY_KUNENAMENU_PROFILE'), 'index.php?option=com_kunena&view=user&layout=default&Itemid=' . KunenaRoute::getItemid('index.php?option=com_kunena&view=user&layout=default'));
}
if ($this->params->get('sh_myposts', 1)) {
$toolbar->addItem('KUNENAMENU', 'KUNENAMENU_POSTS', JText::_('PLG_COMMUNITY_KUNENAMENU_POSTS'), 'index.php?option=com_kunena&view=topics&layout=posts&mode=recent&userid=' . $user->id . '&sel=-1&Itemid=' . KunenaRoute::getItemid('index.php?option=com_kunena&view=topics&layout=posts&mode=recent&userid=' . $user->id . '&sel=-1'));
}
if ($this->params->get('sh_mysubscriptions', 1)) {
$toolbar->addItem('KUNENAMENU', 'KUNENAMENU_SUBSCRIBES', JText::_('PLG_COMMUNITY_KUNENAMENU_SUBSCRIBTIONS'), 'index.php?option=com_kunena&view=topics&layout=user&mode=subscriptions&sel=-1&Itemid=' . KunenaRoute::getItemid('index.php?option=com_kunena&view=topics&layout=user&mode=subscriptions&sel=-1'));
}
if ($this->params->get('sh_myfavorites', 1)) {
$toolbar->addItem('KUNENAMENU', 'KUNENAMENU_FAVORITES', JText::_('PLG_COMMUNITY_KUNENAMENU_FAVORITES'), 'index.php?option=com_kunena&view=topics&layout=user&mode=favorites&sel=-1&Itemid=' . KunenaRoute::getItemid('index.php?option=com_kunena&view=topics&layout=user&mode=favorite&sel=-1s'));
}
}
示例11: logoutUser
public function logoutUser()
{
cbimport('cb.authentication');
$cbAuthenticate = new CBAuthentication();
$redirect_url = KunenaRoute::current();
$resultError = $cbAuthenticate->logout($redirect_url);
return $resultError ? $resultError : null;
}
示例12: getStatisticsURL
public function getStatisticsURL($action = '', $xhtml = true)
{
$config = KunenaFactory::getConfig();
$my = JFactory::getUser();
if ($config->statslink_allowed == 0 && $my->id == 0) {
return false;
}
return KunenaRoute::_('index.php?option=com_kunena&view=statistics' . $action, $xhtml);
}
示例13: getUserListURL
public function getUserListURL($action = '', $xhtml = true)
{
$config = KunenaFactory::getConfig();
$my = JFactory::getUser();
if ($config->userlist_allowed == 1 && $my->id == 0) {
return false;
}
return KunenaRoute::_('index.php?option=com_kunena&view=user&layout=list' . $action, $xhtml);
}
示例14: jump
function jump()
{
$catid = JRequest::getInt('catid', 0);
if (!$catid) {
$this->setRedirect(KunenaRoute::_('index.php?option=com_kunena&view=category&layout=list'));
} else {
$this->setRedirect(KunenaRoute::_("index.php?option=com_kunena&view=category&catid={$catid}"));
}
}
示例15: jump
/**
* @throws Exception
*/
function jump()
{
$catid = JFactory::getApplication()->input->getInt('catid', 0);
if (!$catid) {
$this->setRedirect(KunenaRoute::_('index.php?option=com_kunena&view=category&layout=list', false));
} else {
$this->setRedirect(KunenaRoute::_("index.php?option=com_kunena&view=category&catid={$catid}", false));
}
}