Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Merged
merged 5 commits into from

1 participant

@mahagr
Owner

Fix #847: Duplicate entry '' for key 'alias'
Fix #844: Rank Manager changed image in backend not changed on frontend
Fix #848: After Thank You Page Reload Jumps to Top
Fix #846: Can only have single instance of custom content menu item
Implement #734: Highlight "my posts" on Recent Topics view

@mahagr mahagr merged commit 1af06b0 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 61 additions and 43 deletions.
  1. +1 −2  administrator/components/com_kunena/controllers/ranks.php
  2. +2 −2 administrator/components/com_kunena/install/data/sampledata.php
  3. +35 −24 administrator/components/com_kunena/libraries/route/route.php
  4. +1 −1  administrator/components/com_kunena/libraries/upload/helper.php
  5. 0  ...kunena/template/blue_eagle/images → administrator/components/com_kunena/media/kunena}/ranks/index.html
  6. 0  ..._kunena/template/blue_eagle/images → administrator/components/com_kunena/media/kunena}/ranks/rank0.gif
  7. 0  ..._kunena/template/blue_eagle/images → administrator/components/com_kunena/media/kunena}/ranks/rank1.gif
  8. 0  ..._kunena/template/blue_eagle/images → administrator/components/com_kunena/media/kunena}/ranks/rank2.gif
  9. 0  ..._kunena/template/blue_eagle/images → administrator/components/com_kunena/media/kunena}/ranks/rank3.gif
  10. 0  ..._kunena/template/blue_eagle/images → administrator/components/com_kunena/media/kunena}/ranks/rank4.gif
  11. 0  ..._kunena/template/blue_eagle/images → administrator/components/com_kunena/media/kunena}/ranks/rank5.gif
  12. 0  ..._kunena/template/blue_eagle/images → administrator/components/com_kunena/media/kunena}/ranks/rank6.gif
  13. 0  ...ena/template/blue_eagle/images → administrator/components/com_kunena/media/kunena}/ranks/rankadmin.gif
  14. 0  ...na/template/blue_eagle/images → administrator/components/com_kunena/media/kunena}/ranks/rankbanned.gif
  15. 0  ...unena/template/blue_eagle/images → administrator/components/com_kunena/media/kunena}/ranks/rankmod.gif
  16. 0  ...a/template/blue_eagle/images → administrator/components/com_kunena/media/kunena}/ranks/rankspammer.gif
  17. +2 −2 components/com_kunena/controllers/topic.php
  18. +1 −0  components/com_kunena/language/en-GB/en-GB.com_kunena.tpl_blue_eagle.ini
  19. +8 −1 components/com_kunena/template/blue_eagle/css/kunena.20.css
  20. +7 −7 components/com_kunena/template/blue_eagle/html/category/default_row.php
  21. +4 −4 components/com_kunena/template/blue_eagle/html/topics/default_row.php
  22. BIN  components/com_kunena/template/blue_eagle/images/icons/myflag.png
View
3  administrator/components/com_kunena/controllers/ranks.php
@@ -87,11 +87,10 @@ function rankupload() {
}
$file = JRequest::getVar( 'Filedata', '', 'files', 'array' );
- $uploadfolder = JRequest::getVar( 'folderranks', 'ranks', '', 'path' );
$format = JRequest::getVar( 'format', 'html', '', 'cmd');
$view = JRequest::getVar( 'view', '');
- $upload = KunenaUploadHelper::upload($file, $uploadfolder, $format, $view);
+ $upload = KunenaUploadHelper::upload($file, 'ranks', $format, $view);
if ( $upload ) {
$this->app->enqueueMessage ( JText::_('COM_KUNENA_A_RANKS_UPLOAD_SUCCESS') );
} else {
View
4 administrator/components/com_kunena/install/data/sampledata.php
@@ -148,8 +148,8 @@ function installSampleData()
$cat1_alias = KunenaRoute::stringURLSafe(KText::_('COM_KUNENA_SAMPLEDATA_CATEGORY1_TITLE'));
$cat2_alias = KunenaRoute::stringURLSafe(KText::_('COM_KUNENA_SAMPLEDATA_CATEGORY2_TITLE'));
if (!$section_alias) $section_alias = 'main-forum';
- if (!$cat1_alias) $section_alias = 'welcome-mat';
- if (!$cat2_alias) $section_alias = 'suggestion-box';
+ if (!$cat1_alias) $cat1_alias = 'welcome-mat';
+ if (!$cat2_alias) $cat2_alias = 'suggestion-box';
$aliasquery = "INSERT INTO `#__kunena_aliases` (`alias`, `type`, `item`, `state`) VALUES
({$db->quote($section_alias)}, 'catid', '1', 1),
View
59 administrator/components/com_kunena/libraries/route/route.php
@@ -298,7 +298,7 @@ protected static function prepare($uri = null) {
}
// Make sure that request URI is not broken
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') {
// Allow all values
} elseif (preg_match('/[^a-zA-Z0-9_ ]/i', $value)) {
@@ -307,12 +307,13 @@ protected static function prepare($uri = null) {
}
$get[$key] = $value;
}
- $current[$uri] = JURI::getInstance('index.php?'.http_build_query($get).$uri);
- $current[$uri]->delVar ( 'Itemid' );
- $current[$uri]->delVar ( 'defaultmenu' );
- $current[$uri]->delVar ( 'language' );
+ $uri = $current[$uri] = JURI::getInstance('index.php?'.http_build_query($get).$uri);
+ self::setItemID($uri);
+ $uri->delVar ( 'defaultmenu' );
+ $uri->delVar ( 'language' );
+ } else {
+ $uri = $current[$uri];
}
- $uri = $current[$uri];
} elseif (is_numeric($uri)) {
if (!isset(self::$menu[intval($uri)])) {
KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
@@ -438,6 +439,7 @@ protected static function setItemID($uri) {
$view = $uri->getVar('view');
$catid = (int) $uri->getVar('catid');
+ $Itemid = (int) $uri->getVar('Itemid');
$key = $view.$catid;
if (!isset($candidates[$key])) {
if (self::$search === false) self::build();
@@ -465,26 +467,15 @@ protected static function setItemID($uri) {
$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();
}
- $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) {
$item = self::$menu[$id];
- $authorise = version_compare(JVERSION, '1.6', '>') ? self::$menus->authorise($item->id) : !isset ( $item->access ) || $item->access <= JFactory::getUser()->aid;
- 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);
- }
+ $matchcount = self::checkItem($item, $uri);
if ($matchcount > $bestcount) {
// This is our best candidate this far
$bestid = $item->id;
@@ -496,6 +487,26 @@ protected static function setItemID($uri) {
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) {
static $cache = array();
if (!$catid) return true;
View
2  administrator/components/com_kunena/libraries/upload/helper.php
@@ -25,7 +25,7 @@ public static function upload($file, $uploadfolder, $format, $view) {
JPlugin::loadLanguage( 'com_media' );
$params = JComponentHelper::getParams('com_media');
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;
View
0  ...unena/template/blue_eagle/images/ranks/index.html → ...mponents/com_kunena/media/kunena/ranks/index.html
File renamed without changes
View
0  ...kunena/template/blue_eagle/images/ranks/rank0.gif → ...omponents/com_kunena/media/kunena/ranks/rank0.gif
File renamed without changes
View
0  ...kunena/template/blue_eagle/images/ranks/rank1.gif → ...omponents/com_kunena/media/kunena/ranks/rank1.gif
File renamed without changes
View
0  ...kunena/template/blue_eagle/images/ranks/rank2.gif → ...omponents/com_kunena/media/kunena/ranks/rank2.gif
File renamed without changes
View
0  ...kunena/template/blue_eagle/images/ranks/rank3.gif → ...omponents/com_kunena/media/kunena/ranks/rank3.gif
File renamed without changes
View
0  ...kunena/template/blue_eagle/images/ranks/rank4.gif → ...omponents/com_kunena/media/kunena/ranks/rank4.gif
File renamed without changes
View
0  ...kunena/template/blue_eagle/images/ranks/rank5.gif → ...omponents/com_kunena/media/kunena/ranks/rank5.gif
File renamed without changes
View
0  ...kunena/template/blue_eagle/images/ranks/rank6.gif → ...omponents/com_kunena/media/kunena/ranks/rank6.gif
File renamed without changes
View
0  ...na/template/blue_eagle/images/ranks/rankadmin.gif → ...nents/com_kunena/media/kunena/ranks/rankadmin.gif
File renamed without changes
View
0  ...a/template/blue_eagle/images/ranks/rankbanned.gif → ...ents/com_kunena/media/kunena/ranks/rankbanned.gif
File renamed without changes
View
0  ...nena/template/blue_eagle/images/ranks/rankmod.gif → ...ponents/com_kunena/media/kunena/ranks/rankmod.gif
File renamed without changes
View
0  .../template/blue_eagle/images/ranks/rankspammer.gif → ...nts/com_kunena/media/kunena/ranks/rankspammer.gif
File renamed without changes
View
4 components/com_kunena/controllers/topic.php
@@ -341,7 +341,6 @@ public function thankyou() {
$this->setThankyou($type);
$this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_THANKYOU_SUCCESS' ) );
- $this->redirectBack ();
}
public function unthankyou() {
@@ -349,7 +348,6 @@ public function unthankyou() {
$this->setThankyou($type);
$this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_THANKYOU_REMOVED_SUCCESS' ) );
- $this->redirectBack ();
}
protected function setThankyou($type){
@@ -364,6 +362,7 @@ protected function setThankyou($type){
$this->redirectBack ();
}
+ $category = KunenaForumCategoryHelper::get($this->catid);
$thankyou = KunenaForumMessageThankyouHelper::get($this->mesid);
$activityIntegration = KunenaFactory::getActivityIntegration();
if ( $type== 'thankyou') {
@@ -380,6 +379,7 @@ protected function setThankyou($type){
}
$activityIntegration->onAfterUnThankyou($userid, $this->me->userid, $message);
}
+ $this->setRedirect($message->getUrl($category->exists() ? $category->id : $message->catid, false));
}
public function subscribe() {
View
1  components/com_kunena/language/en-GB/en-GB.com_kunena.tpl_blue_eagle.ini
@@ -12,6 +12,7 @@ COM_KUNENA_MORE="More"
COM_KUNENA_TOPIC_STARTED_ON="Topic started"
COM_KUNENA_VIEW_NO_POSTS="There are no posts in this category."
COM_KUNENA_GEN_GOTOTOP="Go to top"
+COM_KUNENA_MYPOSTS="Contains my posts"
; JROOT/components/com_kunena/template/blue_eagle/html/category/default.php
View
9 components/com_kunena/template/blue_eagle/css/kunena.20.css
@@ -102,4 +102,11 @@
}
#Kunena .kspoiler-content {
margin: 10px 5px;
-}
+}
+
+#Kunena span.ktopicmy {
+ background-image: url("../images/icons/myflag.png");
+ width: 16px;
+ height: 16px;
+ margin-left: 2px;
+}
View
14 components/com_kunena/template/blue_eagle/html/category/default_row.php
@@ -35,24 +35,24 @@
<div class="ktopic-details">
<?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') ); ?>
-
+
<div class="ktopic-title-cover">
<?php
echo $this->getTopicLink ( $this->topic, null, null, KunenaHtmlParser::stripBBCode ( $this->topic->first_post_message, 500), 'ktopic-title km' );
if ($this->topic->getUserTopic()->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) {
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">
<?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; ?>
</div>
<div class="ktopic-details-kcategory">
@@ -61,7 +61,7 @@
</span>
<span class="ktopic-by ks"><?php echo JText::_('COM_KUNENA_BY') . ' ' . $this->topic->getFirstPostAuthor()->getLink() ?></span>
</div>
-
+
<div class="ktopic-details-kcategory" style="clear:both;">
<?php if ($this->topic->posts > $this->config->messages_per_page) : ?>
<ul class="kpagination">
View
8 components/com_kunena/template/blue_eagle/html/topics/default_row.php
@@ -34,19 +34,19 @@
<td class="kcol-mid kcol-ktopictitle">
<?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') ); ?>
-
+
<div class="ktopic-title-cover">
<?php
echo $this->getTopicLink ( $this->topic, null, null, KunenaHtmlParser::stripBBCode ( $this->topic->first_post_message, 500), 'ktopic-title km' );
if ($this->topic->getUserTopic()->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) {
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>
View
BIN  components/com_kunena/template/blue_eagle/images/icons/myflag.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Something went wrong with that request. Please try again.