Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #847, #844, #848, #846 and implement #734 #855

Merged
merged 5 commits into from
Jun 15, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions administrator/components/com_kunena/controllers/ranks.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -87,11 +87,10 @@ function rankupload() {
} }


$file = JRequest::getVar( 'Filedata', '', 'files', 'array' ); $file = JRequest::getVar( 'Filedata', '', 'files', 'array' );
$uploadfolder = JRequest::getVar( 'folderranks', 'ranks', '', 'path' );
$format = JRequest::getVar( 'format', 'html', '', 'cmd'); $format = JRequest::getVar( 'format', 'html', '', 'cmd');
$view = JRequest::getVar( 'view', ''); $view = JRequest::getVar( 'view', '');


$upload = KunenaUploadHelper::upload($file, $uploadfolder, $format, $view); $upload = KunenaUploadHelper::upload($file, 'ranks', $format, $view);
if ( $upload ) { if ( $upload ) {
$this->app->enqueueMessage ( JText::_('COM_KUNENA_A_RANKS_UPLOAD_SUCCESS') ); $this->app->enqueueMessage ( JText::_('COM_KUNENA_A_RANKS_UPLOAD_SUCCESS') );
} else { } else {
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ function installSampleData()
$cat1_alias = KunenaRoute::stringURLSafe(KText::_('COM_KUNENA_SAMPLEDATA_CATEGORY1_TITLE')); $cat1_alias = KunenaRoute::stringURLSafe(KText::_('COM_KUNENA_SAMPLEDATA_CATEGORY1_TITLE'));
$cat2_alias = KunenaRoute::stringURLSafe(KText::_('COM_KUNENA_SAMPLEDATA_CATEGORY2_TITLE')); $cat2_alias = KunenaRoute::stringURLSafe(KText::_('COM_KUNENA_SAMPLEDATA_CATEGORY2_TITLE'));
if (!$section_alias) $section_alias = 'main-forum'; if (!$section_alias) $section_alias = 'main-forum';
if (!$cat1_alias) $section_alias = 'welcome-mat'; if (!$cat1_alias) $cat1_alias = 'welcome-mat';
if (!$cat2_alias) $section_alias = 'suggestion-box'; if (!$cat2_alias) $cat2_alias = 'suggestion-box';


$aliasquery = "INSERT INTO `#__kunena_aliases` (`alias`, `type`, `item`, `state`) VALUES $aliasquery = "INSERT INTO `#__kunena_aliases` (`alias`, `type`, `item`, `state`) VALUES
({$db->quote($section_alias)}, 'catid', '1', 1), ({$db->quote($section_alias)}, 'catid', '1', 1),
Expand Down
59 changes: 35 additions & 24 deletions administrator/components/com_kunena/libraries/route/route.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ protected static function prepare($uri = null) {
} }
// Make sure that request URI is not broken // Make sure that request URI is not broken
foreach (JRequest::get( 'get' ) as $key=>$value) { foreach (JRequest::get( 'get' ) as $key=>$value) {
if (preg_match('/[^a-z]/', $key)) continue; if (preg_match('/[^a-zA-Z]/', $key)) continue;
if ($key == 'q' || $key == 'searchuser') { if ($key == 'q' || $key == 'searchuser') {
// Allow all values // Allow all values
} elseif (preg_match('/[^a-zA-Z0-9_ ]/i', $value)) { } elseif (preg_match('/[^a-zA-Z0-9_ ]/i', $value)) {
Expand All @@ -307,12 +307,13 @@ protected static function prepare($uri = null) {
} }
$get[$key] = $value; $get[$key] = $value;
} }
$current[$uri] = JURI::getInstance('index.php?'.http_build_query($get).$uri); $uri = $current[$uri] = JURI::getInstance('index.php?'.http_build_query($get).$uri);
$current[$uri]->delVar ( 'Itemid' ); self::setItemID($uri);
$current[$uri]->delVar ( 'defaultmenu' ); $uri->delVar ( 'defaultmenu' );
$current[$uri]->delVar ( 'language' ); $uri->delVar ( 'language' );
} else {
$uri = $current[$uri];
} }
$uri = $current[$uri];
} elseif (is_numeric($uri)) { } elseif (is_numeric($uri)) {
if (!isset(self::$menu[intval($uri)])) { if (!isset(self::$menu[intval($uri)])) {
KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function '.__CLASS__.'::'.__FUNCTION__.'()') : null; KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
Expand Down Expand Up @@ -438,6 +439,7 @@ protected static function setItemID($uri) {


$view = $uri->getVar('view'); $view = $uri->getVar('view');
$catid = (int) $uri->getVar('catid'); $catid = (int) $uri->getVar('catid');
$Itemid = (int) $uri->getVar('Itemid');
$key = $view.$catid; $key = $view.$catid;
if (!isset($candidates[$key])) { if (!isset($candidates[$key])) {
if (self::$search === false) self::build(); if (self::$search === false) self::build();
Expand Down Expand Up @@ -465,26 +467,15 @@ protected static function setItemID($uri) {
$candidates[$key] += !empty(self::$search[$view][0]) ? self::$search[$view][0] : array(); $candidates[$key] += !empty(self::$search[$view][0]) ? self::$search[$view][0] : array();
if ($view == 'topic') $candidates[$key] += !empty(self::$search['category'][0]) ? self::$search['category'][0] : array(); if ($view == 'topic') $candidates[$key] += !empty(self::$search['category'][0]) ? self::$search['category'][0] : array();
} }
$bestid = $bestcount = 0;
// echo "$key "; print_r($candidates[$key]); // Check current menu item first
$bestcount = ($Itemid && isset(self::$menu[$Itemid])) ? self::checkItem(self::$menu[$Itemid], $uri) : 0;
$bestid = $bestcount ? $Itemid : 0;

// Then go through all candidates
foreach ($candidates[$key] as $id) { foreach ($candidates[$key] as $id) {
$item = self::$menu[$id]; $item = self::$menu[$id];
$authorise = version_compare(JVERSION, '1.6', '>') ? self::$menus->authorise($item->id) : !isset ( $item->access ) || $item->access <= JFactory::getUser()->aid; $matchcount = self::checkItem($item, $uri);
if (!$authorise) {
continue;
}

switch ($item->query['view']) {
case 'home':
$matchcount = self::checkHome($item, $catid);
break;
case 'category':
case 'topic':
$matchcount = self::checkCategory($item, $uri);
break;
default:
$matchcount = self::check($item, $uri);
}
if ($matchcount > $bestcount) { if ($matchcount > $bestcount) {
// This is our best candidate this far // This is our best candidate this far
$bestid = $item->id; $bestid = $item->id;
Expand All @@ -496,6 +487,26 @@ protected static function setItemID($uri) {
return $bestid; return $bestid;
} }


protected static function checkItem($item, $uri) {
$authorise = version_compare(JVERSION, '1.6', '>') ? self::$menus->authorise($item->id) : !isset ( $item->access ) || $item->access <= JFactory::getUser()->aid;
if (!$authorise) {
return 0;
}
$catid = (int) $uri->getVar('catid');
switch ($item->query['view']) {
case 'home':
$matchcount = self::checkHome($item, $catid);
break;
case 'category':
case 'topic':
$matchcount = self::checkCategory($item, $uri);
break;
default:
$matchcount = self::check($item, $uri);
}
return $matchcount;
}

protected static function checkHome($item, $catid) { protected static function checkHome($item, $catid) {
static $cache = array(); static $cache = array();
if (!$catid) return true; if (!$catid) return true;
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static function upload($file, $uploadfolder, $format, $view) {
JPlugin::loadLanguage( 'com_media' ); JPlugin::loadLanguage( 'com_media' );
$params = JComponentHelper::getParams('com_media'); $params = JComponentHelper::getParams('com_media');
require_once( JPATH_ADMINISTRATOR.'/components/com_media/helpers/media.php' ); require_once( JPATH_ADMINISTRATOR.'/components/com_media/helpers/media.php' );
$path = JPATH_ROOT."/components/com_kunena/template/{$config->template}/images"; $path = KPATH_MEDIA;


$err = null; $err = null;


Expand Down
4 changes: 2 additions & 2 deletions components/com_kunena/controllers/topic.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -341,15 +341,13 @@ public function thankyou() {
$this->setThankyou($type); $this->setThankyou($type);


$this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_THANKYOU_SUCCESS' ) ); $this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_THANKYOU_SUCCESS' ) );
$this->redirectBack ();
} }


public function unthankyou() { public function unthankyou() {
$type = JRequest::getString('task'); $type = JRequest::getString('task');
$this->setThankyou($type); $this->setThankyou($type);


$this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_THANKYOU_REMOVED_SUCCESS' ) ); $this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_THANKYOU_REMOVED_SUCCESS' ) );
$this->redirectBack ();
} }


protected function setThankyou($type){ protected function setThankyou($type){
Expand All @@ -364,6 +362,7 @@ protected function setThankyou($type){
$this->redirectBack (); $this->redirectBack ();
} }


$category = KunenaForumCategoryHelper::get($this->catid);
$thankyou = KunenaForumMessageThankyouHelper::get($this->mesid); $thankyou = KunenaForumMessageThankyouHelper::get($this->mesid);
$activityIntegration = KunenaFactory::getActivityIntegration(); $activityIntegration = KunenaFactory::getActivityIntegration();
if ( $type== 'thankyou') { if ( $type== 'thankyou') {
Expand All @@ -380,6 +379,7 @@ protected function setThankyou($type){
} }
$activityIntegration->onAfterUnThankyou($userid, $this->me->userid, $message); $activityIntegration->onAfterUnThankyou($userid, $this->me->userid, $message);
} }
$this->setRedirect($message->getUrl($category->exists() ? $category->id : $message->catid, false));
} }


public function subscribe() { public function subscribe() {
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ COM_KUNENA_MORE="More"
COM_KUNENA_TOPIC_STARTED_ON="Topic started" COM_KUNENA_TOPIC_STARTED_ON="Topic started"
COM_KUNENA_VIEW_NO_POSTS="There are no posts in this category." COM_KUNENA_VIEW_NO_POSTS="There are no posts in this category."
COM_KUNENA_GEN_GOTOTOP="Go to top" COM_KUNENA_GEN_GOTOTOP="Go to top"
COM_KUNENA_MYPOSTS="Contains my posts"


; JROOT/components/com_kunena/template/blue_eagle/html/category/default.php ; JROOT/components/com_kunena/template/blue_eagle/html/category/default.php


Expand Down
9 changes: 8 additions & 1 deletion components/com_kunena/template/blue_eagle/css/kunena.20.css
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -102,4 +102,11 @@
} }
#Kunena .kspoiler-content { #Kunena .kspoiler-content {
margin: 10px 5px; margin: 10px 5px;
} }

#Kunena span.ktopicmy {
background-image: url("../images/icons/myflag.png");
width: 16px;
height: 16px;
margin-left: 2px;
}
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -35,24 +35,24 @@
<div class="ktopic-details"> <div class="ktopic-details">
<?php if ($this->topic->attachments) echo $this->getIcon ( 'ktopicattach', JText::_('COM_KUNENA_ATTACH') ); ?> <?php if ($this->topic->attachments) echo $this->getIcon ( 'ktopicattach', JText::_('COM_KUNENA_ATTACH') ); ?>
<?php if ($this->topic->poll_id) echo $this->getIcon ( 'ktopicpoll', JText::_('COM_KUNENA_ADMIN_POLLS') ); ?> <?php if ($this->topic->poll_id) echo $this->getIcon ( 'ktopicpoll', JText::_('COM_KUNENA_ADMIN_POLLS') ); ?>

<div class="ktopic-title-cover"> <div class="ktopic-title-cover">
<?php <?php
echo $this->getTopicLink ( $this->topic, null, null, KunenaHtmlParser::stripBBCode ( $this->topic->first_post_message, 500), 'ktopic-title km' ); echo $this->getTopicLink ( $this->topic, null, null, KunenaHtmlParser::stripBBCode ( $this->topic->first_post_message, 500), 'ktopic-title km' );
if ($this->topic->getUserTopic()->favorite) { if ($this->topic->getUserTopic()->favorite) {
echo $this->getIcon ( 'kfavoritestar', JText::_('COM_KUNENA_FAVORITE') ); echo $this->getIcon ( 'kfavoritestar', JText::_('COM_KUNENA_FAVORITE') );
} }
if ($this->me->exists() && $this->topic->getUserTopic()->posts) {
echo $this->getIcon ( 'ktopicmy', JText::_('COM_KUNENA_MYPOSTS') );
}
if ($this->topic->unread) { if ($this->topic->unread) {
echo $this->getTopicLink ( $this->topic, 'unread', '<sup dir="ltr" class="knewchar">(' . $this->topic->unread . ' ' . JText::_('COM_KUNENA_A_GEN_NEWCHAR') . ')</sup>' ); echo $this->getTopicLink ( $this->topic, 'unread', '<sup dir="ltr" class="knewchar">(' . $this->topic->unread . ' ' . JText::_('COM_KUNENA_A_GEN_NEWCHAR') . ')</sup>' );
} }
if ($this->topic->locked != 0) {
echo $this->getIcon ( 'ktopiclocked', JText::_('COM_KUNENA_LOCKED_TOPIC') );
}
?> ?>
</div> </div>
<div class="ktopic-details-kcategory"> <div class="ktopic-details-kcategory">
<?php if (!isset($this->category) || $this->category->id != $this->topic->getCategory()->id) : ?> <?php if (!isset($this->category) || $this->category->id != $this->topic->getCategory()->id) : ?>
<span class="ktopic-category"> <?php echo JText::sprintf('COM_KUNENA_CATEGORY_X', $this->getCategoryLink ( $this->topic->getCategory() ) ) ?></span> <span class="ktopic-category"> <?php echo JText::sprintf('COM_KUNENA_CATEGORY_X', $this->getCategoryLink ( $this->topic->getCategory() ) ) ?></span>
<?php endif; ?> <?php endif; ?>
</div> </div>
<div class="ktopic-details-kcategory"> <div class="ktopic-details-kcategory">
Expand All @@ -61,7 +61,7 @@
</span> </span>
<span class="ktopic-by ks"><?php echo JText::_('COM_KUNENA_BY') . ' ' . $this->topic->getFirstPostAuthor()->getLink() ?></span> <span class="ktopic-by ks"><?php echo JText::_('COM_KUNENA_BY') . ' ' . $this->topic->getFirstPostAuthor()->getLink() ?></span>
</div> </div>

<div class="ktopic-details-kcategory" style="clear:both;"> <div class="ktopic-details-kcategory" style="clear:both;">
<?php if ($this->topic->posts > $this->config->messages_per_page) : ?> <?php if ($this->topic->posts > $this->config->messages_per_page) : ?>
<ul class="kpagination"> <ul class="kpagination">
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@
<td class="kcol-mid kcol-ktopictitle"> <td class="kcol-mid kcol-ktopictitle">
<?php if ($this->topic->attachments) echo $this->getIcon ( 'ktopicattach', JText::_('COM_KUNENA_ATTACH') ); ?> <?php if ($this->topic->attachments) echo $this->getIcon ( 'ktopicattach', JText::_('COM_KUNENA_ATTACH') ); ?>
<?php if ($this->topic->poll_id) echo $this->getIcon ( 'ktopicpoll', JText::_('COM_KUNENA_ADMIN_POLLS') ); ?> <?php if ($this->topic->poll_id) echo $this->getIcon ( 'ktopicpoll', JText::_('COM_KUNENA_ADMIN_POLLS') ); ?>

<div class="ktopic-title-cover"> <div class="ktopic-title-cover">
<?php <?php
echo $this->getTopicLink ( $this->topic, null, null, KunenaHtmlParser::stripBBCode ( $this->topic->first_post_message, 500), 'ktopic-title km' ); echo $this->getTopicLink ( $this->topic, null, null, KunenaHtmlParser::stripBBCode ( $this->topic->first_post_message, 500), 'ktopic-title km' );
if ($this->topic->getUserTopic()->favorite) { if ($this->topic->getUserTopic()->favorite) {
echo $this->getIcon ( 'kfavoritestar', JText::_('COM_KUNENA_FAVORITE') ); echo $this->getIcon ( 'kfavoritestar', JText::_('COM_KUNENA_FAVORITE') );
} }
if ($this->me->exists() && $this->topic->getUserTopic()->posts) {
echo $this->getIcon ( 'ktopicmy', JText::_('COM_KUNENA_MYPOSTS') );
}
if ($this->topic->unread) { if ($this->topic->unread) {
echo $this->getTopicLink ( $this->topic, 'unread', '<sup dir="ltr" class="knewchar">(' . $this->topic->unread . ' ' . JText::_('COM_KUNENA_A_GEN_NEWCHAR') . ')</sup>' ); echo $this->getTopicLink ( $this->topic, 'unread', '<sup dir="ltr" class="knewchar">(' . $this->topic->unread . ' ' . JText::_('COM_KUNENA_A_GEN_NEWCHAR') . ')</sup>' );
} }
if ($this->topic->locked != 0) {
echo $this->getIcon ( 'ktopiclocked', JText::_('COM_KUNENA_LOCKED_TOPIC') );
}
?> ?>
</div> </div>


Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.