Skip to content
This repository

Crypsis fixes #1975

Merged
merged 8 commits into from 6 months ago

1 participant

Matias Griese
This page is out of date. Refresh to see the latest.

Showing 33 changed files with 124 additions and 171 deletions. Show diff stats Hide diff stats

  1. 9  components/com_kunena/site/controller/topic/moderate/display.php
  2. 5  components/com_kunena/site/controller/topic/poll/display.php
  3. 6  components/com_kunena/site/controllers/topic.php
  4. 2  components/com_kunena/site/template/crypsis/language/en-GB/en-GB.kunena_tmpl_crypsis.ini
  5. 5  components/com_kunena/site/template/crypsis/layouts/topic/item/default.php
  6. 4  components/com_kunena/site/template/crypsis/layouts/topic/item/indented.php
  7. 50  components/com_kunena/site/template/crypsis/layouts/topic/item/list/default.php
  8. 4  components/com_kunena/site/template/crypsis/layouts/topic/item/threaded.php
  9. 50  components/com_kunena/site/template/crypsis/layouts/topic/item/vote/default.php
  10. 5  components/com_kunena/site/template/crypsis/layouts/topic/moderate/default.php
  11. 10  components/com_kunena/site/template/crypsis/layouts/topic/poll/results/default.php
  12. 4  components/com_kunena/site/template/crypsis/layouts/topic/poll/vote/default.php
  13. 2  components/com_kunena/site/template/crypsis/pages/announcement/default/default.php
  14. 2  components/com_kunena/site/template/crypsis/pages/announcement/edit/default.php
  15. 2  components/com_kunena/site/template/crypsis/pages/announcement/list/default.php
  16. 2  components/com_kunena/site/template/crypsis/pages/category/default/default.php
  17. 2  components/com_kunena/site/template/crypsis/pages/category/list/default.php
  18. 2  components/com_kunena/site/template/crypsis/pages/category/user/default.php
  19. 2  components/com_kunena/site/template/crypsis/pages/misc/default/default.php
  20. 2  components/com_kunena/site/template/crypsis/pages/statistics/default/default.php
  21. 9  .../com_kunena/site/template/crypsis/{layouts/topic/item/poll → pages/statistics/whoisonline}/default.php
  22. 2  components/com_kunena/site/template/crypsis/pages/topic/moderate/default.php
  23. 2  components/com_kunena/site/template/crypsis/pages/topic/report/default.php
  24. 0  components/com_kunena/site/template/crypsis/pages/topic/{poll → vote}/default.php
  25. 2  components/com_kunena/site/template/crypsis/pages/topics/unread/default.php
  26. 2  components/com_kunena/site/template/crypsis/pages/user/list/default.php
  27. 28  libraries/kunena/controller.php
  28. 36  libraries/kunena/forum/topic/topic.php
  29. 16  libraries/kunena/layout/base.php
  30. 6  libraries/kunena/layout/layout.php
  31. 2  libraries/kunena/layout/page.php
  32. 18  libraries/kunena/user/helper.php
  33. 2  libraries/kunena/user/user.php
9  components/com_kunena/site/controller/topic/moderate/display.php
@@ -28,6 +28,7 @@ class ComponentKunenaControllerTopicModerateDisplay extends KunenaControllerDisp
28 28
 	public $uri;
29 29
 	public $title;
30 30
 	public $topicIcons;
  31
+	public $userLink;
31 32
 
32 33
 	protected function before()
33 34
 	{
@@ -58,9 +59,11 @@ protected function before()
58 59
 
59 60
 		// Have a link to moderate user as well.
60 61
 		if (isset($this->message)) {
61  
-			$this->user = KunenaFactory::getUser($this->message->userid);
62  
-			$username = $this->message->getAuthor()->getName();
63  
-			$this->userLink = $this->message->userid ? JHtml::_('kunenaforum.link', 'index.php?option=com_kunena&view=user&layout=moderate&userid='.$this->message->userid, $username.' ('.$this->message->userid.')' ,$username.' ('.$this->message->userid.')' ) : null;
  62
+			$user = $this->message->getAuthor();
  63
+			if ($user->exists()) {
  64
+				$username = $user->getName();
  65
+				$this->userLink = $this->message->userid ? JHtml::_('kunenaforum.link', 'index.php?option=com_kunena&view=user&layout=moderate&userid='.$this->message->userid, $username.' ('.$this->message->userid.')' ,$username.' ('.$this->message->userid.')' ) : null;
  66
+			}
64 67
 		}
65 68
 
66 69
 		if ($this->message) {
5  components/com_kunena/site/controller/topic/poll/display.php
@@ -69,4 +69,9 @@ protected function before()
69 69
 
70 70
 		return true;
71 71
 	}
  72
+
  73
+	protected function prepareDocument()
  74
+	{
  75
+		$this->setTitle(JText::_('COM_KUNENA_POLL_NAME').' '.KunenaHtmlParser::parseText ($this->poll->title));
  76
+	}
72 77
 }
6  components/com_kunena/site/controllers/topic.php
@@ -900,6 +900,7 @@ public function vote() {
900 900
 
901 901
 		$vote = JRequest::getInt('kpollradio', '');
902 902
 		$id = JRequest::getInt ( 'id', 0 );
  903
+		$catid = JRequest::getInt ( 'catid', 0 );
903 904
 
904 905
 		$topic = KunenaForumTopicHelper::get($id);
905 906
 		$poll = $topic->getPoll();
@@ -922,6 +923,7 @@ public function vote() {
922 923
 				$this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_TOPIC_VOTE_CHANGED_SUCCESS' ) );
923 924
 			}
924 925
 		}
  926
+		print_r($this->return); die();
925 927
 		$this->setRedirect($topic->getUrl($this->return, false));
926 928
 	}
927 929
 
@@ -932,10 +934,8 @@ public function resetvotes() {
932 934
 			return;
933 935
 		}
934 936
 
935  
-		$pollid = JRequest::getInt ( 'pollid', 0 );
936  
-
937 937
 		$topic = KunenaForumTopicHelper::get($this->id);
938  
-		$result = $topic->resetvotes($pollid);
  938
+		$topic->resetvotes();
939 939
 
940 940
 		$this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_TOPIC_VOTE_RESET_SUCCESS' ) );
941 941
 		$this->setRedirect($topic->getUrl($this->return, false));
2  components/com_kunena/site/template/crypsis/language/en-GB/en-GB.kunena_tmpl_crypsis.ini
@@ -82,7 +82,7 @@ COM_KUNENA_THANKYOU="The following user(s) said Thank You"
82 82
 
83 83
 ; JROOT/components/com_kunena/template/crypsis/html/topic/default_pollresults.php
84 84
 
85  
-COM_KUNENA_TOPIC_VOTE_RESET="Reset votes"
  85
+COM_KUNENA_TOPIC_VOTE_RESET="Reset Votes"
86 86
 
87 87
 ; JROOT/components/com_kunena/template/crypsis/html/topic/edit.php
88 88
 
5  components/com_kunena/site/template/crypsis/layouts/topic/item/default.php
@@ -22,7 +22,10 @@
22 22
 	<div class="pull-right">
23 23
 		<?php echo $this->subLayout('Pagination/List')->set('pagination', $pagination); ?>
24 24
 	</div>
25  
-	<h3><?php echo JText::_('COM_KUNENA_TOPIC') ?> <?php echo $this->escape($this->topic->subject) ?></h3>
  25
+	<h3>
  26
+		<?php echo $this->topic->getIcon(); ?>
  27
+		<?php echo JText::_('COM_KUNENA_TOPIC') ?> <?php echo $this->escape($this->topic->subject) ?>
  28
+	</h3>
26 29
 	<?php echo $this->subLayout('Page/Module')->set('position', 'kunena_topictitle'); ?>
27 30
 </div>
28 31
 <div class="clearfix"></div>
4  components/com_kunena/site/template/crypsis/layouts/topic/item/indented.php
@@ -24,7 +24,9 @@
24 24
 <?php $this->displayTopicActions(); ?>
25 25
 <div>
26 26
   <div>
27  
-    <h3><span><?php echo JText::_('COM_KUNENA_TOPIC') ?> <?php echo $this->escape($this->topic->subject) ?></span></h3>
  27
+    <h3>
  28
+	    <?php echo $this->topic->getIcon(); ?>
  29
+	    <span><?php echo JText::_('COM_KUNENA_TOPIC') ?> <?php echo $this->escape($this->topic->subject) ?></span></h3>
28 30
     <?php if (!empty($this->keywords)) : ?>
29 31
     <div><?php echo JText::sprintf('COM_KUNENA_TOPIC_TAGS', $this->escape($this->keywords)) ?></div>
30 32
     <?php endif ?>
50  components/com_kunena/site/template/crypsis/layouts/topic/item/list/default.php
... ...
@@ -1,50 +0,0 @@
1  
-<?php
2  
-/**
3  
- * Kunena Component
4  
- * @package Kunena.Template.Crypsis
5  
- * @subpackage Topic
6  
- *
7  
- * @copyright (C) 2008 - 2013 Kunena Team. All rights reserved.
8  
- * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
9  
- * @link http://www.kunena.org
10  
- **/
11  
-defined ( '_JEXEC' ) or die ();
12  
-
13  
-$pagination = $this->getPaginationObject(4);
14  
-?>
15  
-
16  
-<div>
17  
-  <div>
18  
-    <div>
19  
-      <div>
20  
-        <div> <a href="#" title="Topic RSS Feed"><span class="krss-icon">Topic RSS Feed</span></a> <a href="#" title="View Subscribers of this Topic" class="ktopic-subsc">4 Subscribers</a>
21  
-          <h2><?php echo JText::_('COM_KUNENA_TOPIC') ?> <a class="section" rel="topic-detailsbox"><?php echo $this->displayTopicField('subject') ?></a></h2>
22  
-          <?php if ( $this->config->keywords ) : ?>
23  
-          <ul class="list-unstyled topic-taglist">
24  
-            <?php if (!empty($this->keywords)) : ?>
25  
-            <li class="topic-taglist-title"><?php echo JText::sprintf('COM_KUNENA_TOPIC_TAGS', $this->keywords) ?></li>
26  
-            <?php else: ?>
27  
-            <li class="topic-taglist-title"><?php echo JText::_('COM_KUNENA_TOPIC_NO_TAGS') ?></li>
28  
-            <?php endif ?>
29  
-            <?php if ( $this->me->userid == $this->topic->first_post_userid || $this->me->isModerator($this->topic->getCategory()) ): ?>
30  
-            <li class="topic-taglist-edit"><a id="edit_keywords" class="link"><?php echo JText::_('COM_KUNENA_TOPIC_TAGS_ADD_EDIT') ?></a></li>
31  
-            <?php endif ?>
32  
-          </ul>
33  
-          <?php endif ?>
34  
-        </div>
35  
-		</div>
36  
-		<?php echo $this->subLayout('Topic/Actions')->set('id', $this->topic->id)->set('layout',
37  
-			$this->layout); ?>
38  
-      <?php if ($this->total >1) : ?>
39  
-      <div class="pagination"> <?php echo $this->subLayout('Pagination/List')->set('pagination', $pagination); ?> </div>
40  
-      <?php endif; ?>
41  
-      <div>
42  
-        <div>
43  
-          <ul>
44  
-            <?php $this->displayMessages() ?>
45  
-          </ul>
46  
-        </div>
47  
-      </div>
48  
-    </div>
49  
-  </div>
50  
-</div>
4  components/com_kunena/site/template/crypsis/layouts/topic/item/threaded.php
@@ -26,7 +26,9 @@
26 26
 ?>
27 27
 <div>
28 28
   <div>
29  
-    <h3><span><?php echo JText::_('COM_KUNENA_TOPIC') ?> <?php echo $this->escape($this->topic->subject) ?></span></h3>
  29
+    <h3>
  30
+	    <?php echo $this->topic->getIcon(); ?>
  31
+	    <span><?php echo JText::_('COM_KUNENA_TOPIC') ?> <?php echo $this->escape($this->topic->subject) ?></span></h3>
30 32
     <?php if (!empty($this->keywords)) : ?>
31 33
     <div><?php echo JText::sprintf('COM_KUNENA_TOPIC_TAGS', $this->escape($this->keywords)) ?></div>
32 34
     <?php endif ?>
50  components/com_kunena/site/template/crypsis/layouts/topic/item/vote/default.php
... ...
@@ -1,50 +0,0 @@
1  
-<?php
2  
-/**
3  
- * Kunena Component
4  
- * @package Kunena.Template.Crypsis
5  
- * @subpackage Topic
6  
- *
7  
- * @copyright (C) 2008 - 2013 Kunena Team. All rights reserved.
8  
- * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
9  
- * @link http://www.kunena.org
10  
- **/
11  
-defined ( '_JEXEC' ) or die ();
12  
-?>
13  
-
14  
-<div>
15  
-  <div> <span><a class="ktoggler close" title="<?php echo JText::_('COM_KUNENA_TOGGLER_COLLAPSE') ?>" rel="kpolls_tbody"></a></span>
16  
-    <h3><span><?php echo JText::_('COM_KUNENA_POLL_NAME') .' '. KunenaHtmlParser::parseText ($this->poll->title); ?></span></h3>
17  
-  </div>
18  
-  <div id="kpolls_tbody">
19  
-    <div>
20  
-      <table id="kpoll">
21  
-        <tr class="krow2">
22  
-          <td>
23  
-            <div>
24  
-              <form action="<?php echo KunenaRoute::_('index.php?option=com_kunena') ?>" id="kpoll-form-vote" method="post">
25  
-                <input type="hidden" name="view" value="topic" />
26  
-                <input type="hidden" name="task" value="vote" />
27  
-                <input type="hidden" name="catid" value="<?php echo $this->topic->category_id ?>" />
28  
-                <input type="hidden" name="id" value="<?php echo $this->topic->id ?>" />
29  
-                <?php echo JHtml::_( 'form.token' ); ?>
30  
-                <fieldset>
31  
-                  <ul>
32  
-                    <?php foreach ($this->poll->getOptions() as $key=>$poll_option) : ?>
33  
-                    <li>
34  
-                      <input class="kpoll-boxvote" type="radio" name="kpollradio" id="radio_name<?php echo intval($key) ?>" value="<?php echo intval($poll_option->id) ?>" <?php if ($this->voted && $this->voted->lastvote == $poll_option->id) echo 'checked="checked"' ?> />
35  
-                      <?php echo KunenaHtmlParser::parseText ($poll_option->text ) ?> </li>
36  
-                    <?php endforeach; ?>
37  
-                  </ul>
38  
-                </fieldset>
39  
-                <div id="kpoll-btns">
40  
-                  <input id="kpoll-button-vote" class="btn btn-success" type="submit" value="<?php echo $this->voted && $this->config->pollallowvoteone ? JText::_('COM_KUNENA_POLL_BUTTON_CHANGEVOTE') : JText::_('COM_KUNENA_POLL_BUTTON_VOTE'); ?>" />
41  
-                </div>
42  
-                <br/>
43  
-              </form>
44  
-            </div>
45  
-          </td>
46  
-        </tr>
47  
-      </table>
48  
-    </div>
49  
-  </div>
50  
-</div>
5  components/com_kunena/site/template/crypsis/layouts/topic/moderate/default.php
@@ -20,8 +20,7 @@
20 20
 	<?php echo !isset($this->message) ? JText::_('COM_KUNENA_TITLE_MODERATE_TOPIC') : JText::_('COM_KUNENA_TITLE_MODERATE_MESSAGE'); ?>
21 21
 </h2>
22 22
 
23  
-<form action="<?php echo KunenaRoute::_('index.php?option=com_kunena') ?>" method="post" name="myform" id="myform" class="form-horizontal">
24  
-	<input type="hidden" name="view" value="topic" />
  23
+<form action="<?php echo KunenaRoute::_('index.php?option=com_kunena&view=topic') ?>" method="post" name="myform" id="myform" class="form-horizontal">
25 24
 	<input type="hidden" name="task" value="move" />
26 25
 	<input type="hidden" name="catid" value="<?php echo $this->category->id; ?>" />
27 26
 	<input type="hidden" name="id" value="<?php echo $this->topic->id; ?>" />
@@ -59,7 +58,7 @@
59 58
 		<hr />
60 59
 		<h3>
61 60
 			<div class="pull-left thumbnail">
62  
-				<?php echo $this->user->getAvatarImage('', 'list'); ?>
  61
+				<?php echo $this->message->getAuthor()->getAvatarImage('', 'list'); ?>
63 62
 			</div>
64 63
 			<?php echo $this->escape($this->message->subject); ?>
65 64
 			<br />
10  components/com_kunena/site/template/crypsis/layouts/topic/poll/results/default.php
@@ -17,7 +17,8 @@
17 17
 	<?php echo JText::_('COM_KUNENA_POLL_NAME'); ?> <?php echo KunenaHtmlParser::parseText ($this->poll->title); ?>
18 18
 </h2>
19 19
 
20  
-<table class="table table-striped table-bordered table-condensed" id="poll-results">
  20
+<div class="collapse in" id="poll-results">
  21
+<table class="table table-striped table-bordered table-condensed">
21 22
 	<?php foreach ( $this->poll->getOptions() as $option ) : ?>
22 23
 	<tr>
23 24
 		<td><?php echo KunenaHtmlParser::parseText ($option->text); ?></td>
@@ -53,8 +54,8 @@
53 54
 			<td colspan="4">
54 55
 				<?php if (!$this->me->exists()) : ?>
55 56
 					<?php echo JText::_('COM_KUNENA_POLL_NOT_LOGGED'); ?>
56  
-				<?php elseif ($this->voted && $this->topic->isAuthorised('poll.vote')) : ?>
57  
-					<a href="<?php echo $this->getPollURL('vote', $this->topic->id, $this->category->id);?>">
  57
+				<?php elseif ($this->topic->isAuthorised('poll.vote')) : ?>
  58
+					<a href="<?php echo KunenaRoute::_("index.php?option=com_kunena&view=topic&layout=vote&catid={$this->category->id}&id={$this->topic->id}"); ?>>">
58 59
 						<?php echo JText::_('COM_KUNENA_POLL_BUTTON_VOTE'); ?>
59 60
 					</a>
60 61
 				<?php endif; ?>
@@ -72,7 +73,7 @@
72 73
 						</div>
73 74
 						<div class="modal-footer">
74 75
 							<a data-dismiss="modal" aria-hidden="true" class="btn"><?php echo JText::_('COM_KUNENA_TOPIC_MODAL_LABEL_CLOSE_RESETVOTE'); ?></a>
75  
-							<a href="<?php echo KunenaRoute::_("index.php?option=com_kunena&view=topic&id={$this->topic->id}&catid={$this->category->id}&pollid={$this->poll->id}&task=resetvotes&".JSession::getFormToken() .'=1') ?>" class="btn btn-primary"><?php echo JText::_('COM_KUNENA_TOPIC_MODAL_LABEL_CONFIRM_RESETVOTE'); ?></a>
  76
+							<a href="<?php echo KunenaRoute::_("index.php?option=com_kunena&view=topic&catid={$this->category->id}&id={$this->topic->id}&pollid={$this->poll->id}&task=resetvotes&".JSession::getFormToken() .'=1') ?>" class="btn btn-primary"><?php echo JText::_('COM_KUNENA_TOPIC_MODAL_LABEL_CONFIRM_RESETVOTE'); ?></a>
76 77
 						</div>
77 78
 					</div>
78 79
 				<?php endif; ?>
@@ -80,3 +81,4 @@
80 81
 		</tr>
81 82
 	</tfoot>
82 83
 </table>
  84
+</div>
4  components/com_kunena/site/template/crypsis/layouts/topic/poll/vote/default.php
@@ -15,7 +15,8 @@
15 15
 	<?php echo JText::_('COM_KUNENA_POLL_NAME') .' '. KunenaHtmlParser::parseText($this->poll->title); ?>
16 16
 </h2>
17 17
 
18  
-<form action="<?php echo KunenaRoute::_('index.php?option=com_kunena&view=topic') ?>" id="poll-vote" method="post">
  18
+<div class="collapse in" id="poll-vote">
  19
+<form action="<?php echo KunenaRoute::_('index.php?option=com_kunena&view=topic') ?>" method="post">
19 20
 	<input type="hidden" name="task" value="vote" />
20 21
 	<input type="hidden" name="catid" value="<?php echo $this->topic->category_id ?>" />
21 22
 	<input type="hidden" name="id" value="<?php echo $this->topic->id ?>" />
@@ -34,3 +35,4 @@
34 35
 		<input id="kpoll-button-vote" class="btn btn-success" type="submit" value="<?php echo $this->voted && $this->config->pollallowvoteone ? JText::_('COM_KUNENA_POLL_BUTTON_CHANGEVOTE') : JText::_('COM_KUNENA_POLL_BUTTON_VOTE'); ?>" />
35 36
 	</div>
36 37
 </form>
  38
+</div>
2  components/com_kunena/site/template/crypsis/pages/announcement/default/default.php
@@ -2,7 +2,7 @@
2 2
 /**
3 3
  * Kunena Component
4 4
  * @package Kunena.Template.Crypsis
5  
- * @subpackage Pages.Search
  5
+ * @subpackage Pages.Announcement
6 6
  *
7 7
  * @copyright (C) 2008 - 2013 Kunena Team. All rights reserved.
8 8
  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
2  components/com_kunena/site/template/crypsis/pages/announcement/edit/default.php
@@ -2,7 +2,7 @@
2 2
 /**
3 3
  * Kunena Component
4 4
  * @package Kunena.Template.Crypsis
5  
- * @subpackage Pages.Search
  5
+ * @subpackage Pages.Announcement
6 6
  *
7 7
  * @copyright (C) 2008 - 2013 Kunena Team. All rights reserved.
8 8
  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
2  components/com_kunena/site/template/crypsis/pages/announcement/list/default.php
@@ -2,7 +2,7 @@
2 2
 /**
3 3
  * Kunena Component
4 4
  * @package Kunena.Template.Crypsis
5  
- * @subpackage Pages.Search
  5
+ * @subpackage Pages.Announcement
6 6
  *
7 7
  * @copyright (C) 2008 - 2013 Kunena Team. All rights reserved.
8 8
  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
2  components/com_kunena/site/template/crypsis/pages/category/default/default.php
@@ -2,7 +2,7 @@
2 2
 /**
3 3
  * Kunena Component
4 4
  * @package Kunena.Template.Crypsis
5  
- * @subpackage Pages.Search
  5
+ * @subpackage Pages.Category
6 6
  *
7 7
  * @copyright (C) 2008 - 2013 Kunena Team. All rights reserved.
8 8
  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
2  components/com_kunena/site/template/crypsis/pages/category/list/default.php
@@ -2,7 +2,7 @@
2 2
 /**
3 3
  * Kunena Component
4 4
  * @package Kunena.Template.Crypsis
5  
- * @subpackage Pages.Search
  5
+ * @subpackage Pages.Category
6 6
  *
7 7
  * @copyright (C) 2008 - 2013 Kunena Team. All rights reserved.
8 8
  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
2  components/com_kunena/site/template/crypsis/pages/category/user/default.php
@@ -2,7 +2,7 @@
2 2
 /**
3 3
  * Kunena Component
4 4
  * @package Kunena.Template.Crypsis
5  
- * @subpackage Pages.Search
  5
+ * @subpackage Pages.Category
6 6
  *
7 7
  * @copyright (C) 2008 - 2013 Kunena Team. All rights reserved.
8 8
  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
2  components/com_kunena/site/template/crypsis/pages/misc/default/default.php
@@ -2,7 +2,7 @@
2 2
 /**
3 3
  * Kunena Component
4 4
  * @package Kunena.Template.Crypsis
5  
- * @subpackage Pages.Search
  5
+ * @subpackage Pages.Topic
6 6
  *
7 7
  * @copyright (C) 2008 - 2013 Kunena Team. All rights reserved.
8 8
  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
2  components/com_kunena/site/template/crypsis/pages/statistics/default/default.php
@@ -2,7 +2,7 @@
2 2
 /**
3 3
  * Kunena Component
4 4
  * @package Kunena.Template.Crypsis
5  
- * @subpackage Pages.Search
  5
+ * @subpackage Pages.Statistics
6 6
  *
7 7
  * @copyright (C) 2008 - 2013 Kunena Team. All rights reserved.
8 8
  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
9  ...plate/crypsis/layouts/topic/item/poll/default.php → .../crypsis/pages/statistics/whoisonline/default.php
@@ -2,7 +2,7 @@
2 2
 /**
3 3
  * Kunena Component
4 4
  * @package Kunena.Template.Crypsis
5  
- * @subpackage Topic
  5
+ * @subpackage Pages.Statistics
6 6
  *
7 7
  * @copyright (C) 2008 - 2013 Kunena Team. All rights reserved.
8 8
  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
@@ -10,4 +10,9 @@
10 10
  **/
11 11
 defined ( '_JEXEC' ) or die ();
12 12
 
13  
-include dirname(__FILE__) . '/vote_embed.php';
  13
+$content = $this->execute('Statistics/WhoIsOnline');
  14
+
  15
+$this->addBreadcrumb(JText::_('COM_KUNENA_MENU_STATISTICS_WHOSONLINE'),
  16
+	'index.php?option=com_kunena&view=statistics&layout=whoisonline');
  17
+
  18
+echo $content;
2  components/com_kunena/site/template/crypsis/pages/topic/moderate/default.php
@@ -2,7 +2,7 @@
2 2
 /**
3 3
  * Kunena Component
4 4
  * @package Kunena.Template.Crypsis
5  
- * @subpackage Pages.Search
  5
+ * @subpackage Pages.Topic
6 6
  *
7 7
  * @copyright (C) 2008 - 2013 Kunena Team. All rights reserved.
8 8
  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
2  components/com_kunena/site/template/crypsis/pages/topic/report/default.php
@@ -2,7 +2,7 @@
2 2
 /**
3 3
  * Kunena Component
4 4
  * @package Kunena.Template.Crypsis
5  
- * @subpackage Pages.Search
  5
+ * @subpackage Pages.Topic
6 6
  *
7 7
  * @copyright (C) 2008 - 2013 Kunena Team. All rights reserved.
8 8
  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
0  ...ite/template/crypsis/pages/topic/poll/default.php → ...ite/template/crypsis/pages/topic/vote/default.php
File renamed without changes
2  components/com_kunena/site/template/crypsis/pages/topics/unread/default.php
@@ -2,7 +2,7 @@
2 2
 /**
3 3
  * Kunena Component
4 4
  * @package Kunena.Template.Crypsis
5  
- * @subpackage Pages.Search
  5
+ * @subpackage Pages.Topics
6 6
  *
7 7
  * @copyright (C) 2008 - 2013 Kunena Team. All rights reserved.
8 8
  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
2  components/com_kunena/site/template/crypsis/pages/user/list/default.php
@@ -2,7 +2,7 @@
2 2
 /**
3 3
  * Kunena Component
4 4
  * @package Kunena.Template.Crypsis
5  
- * @subpackage Pages.Search
  5
+ * @subpackage Pages.User
6 6
  *
7 7
  * @copyright (C) 2008 - 2013 Kunena Team. All rights reserved.
8 8
  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
28  libraries/kunena/controller.php
@@ -290,15 +290,33 @@ public function getMessageType() {
290 290
 	}
291 291
 
292 292
 	/**
  293
+	 * Redirect back to the referrer page.
  294
+	 *
  295
+	 * If there's no referrer or it's external, Kunena will return to forum home page.
  296
+	 * Also redirects back to tasks are prevented.
  297
+	 *
293 298
 	 * @param string $anchor
294 299
 	 */
295 300
 	protected function redirectBack($anchor = '') {
296  
-		$default = $this->app->isSite() ? KunenaRoute::_() : JUri::base(true);
297  
-		$uri = JUri::getInstance($this->input->server->getString('HTTP_REFERER', $default));
298  
-		if (!JUri::isInternal($uri->toString())) $uri = JUri::getInstance($default);
  301
+		$default = JUri::base() . ($this->app->isSite() ? ltrim(KunenaRoute::_('index.php?option=com_kunena'), '/') : '');
  302
+		$referer = $this->input->server->getString('HTTP_REFERER');
  303
+
  304
+		$uri = JUri::getInstance($referer ? $referer : $default);
  305
+		if (JUri::isInternal($uri->toString())) {
  306
+			// Parse route.
  307
+			$vars = $this->app->getRouter()->parse($uri);
  308
+			$uri = new JUri('index.php');
  309
+			$uri->setQuery($vars);
  310
+
  311
+			// Make sure we do not return into a task.
  312
+			$uri->delVar('task');
  313
+			$uri->delVar(JSession::getFormToken());
  314
+		} else {
  315
+			$uri = JUri::getInstance($default);
  316
+		}
  317
+
299 318
 		if ($anchor) $uri->setFragment($anchor);
300 319
 
301  
-		JFactory::getApplication()->redirect($uri->toString());
  320
+		JFactory::getApplication()->redirect(JRoute::_($uri->toString()));
302 321
 	}
303  
-
304 322
 }
36  libraries/kunena/forum/topic/topic.php
@@ -68,11 +68,11 @@ class KunenaForumTopic extends KunenaDatabaseObject {
68 68
 			'subscribe'=>array('Read'),
69 69
 			'sticky'=>array('Read'),
70 70
 			'lock'=>array('Read'),
71  
-			'poll.read'=>array('Read'),
  71
+			'poll.read'=>array('Read', 'Poll'),
72 72
 			'poll.create'=>array('Own'),
73 73
 			'poll.edit'=>array('Read','Own','NoVotes'),
74  
-			'poll.delete'=>array('Read','Own'),
75  
-			'poll.vote'=>array('Read', 'Vote'),
  74
+			'poll.delete'=>array('Read','Own', 'Poll'),
  75
+			'poll.vote'=>array('Read', 'Poll', 'Vote'),
76 76
 			'post.read'=>array('Read'),
77 77
 			'post.thankyou'=>array('Read','NotMoved'),
78 78
 			'post.unthankyou'=>array('Read'),
@@ -438,7 +438,8 @@ public function getReplies($hold=null) {
438 438
 	 * @return string
439 439
 	 */
440 440
 	public function getUrl($category = null, $xhtml = true, $action = null) {
441  
-		return KunenaRoute::getTopicUrl($this, $xhtml, $action, $category ? $category : $this->getCategory());
  441
+		return KunenaRoute::getTopicUrl($this, $xhtml, $action,
  442
+			$category ? KunenaForumCategoryHelper::get($category) : $this->getCategory());
442 443
 	}
443 444
 
444 445
 	/**
@@ -1260,20 +1261,18 @@ public function recount() {
1260 1261
 	}
1261 1262
 
1262 1263
 	/**
1263  
-	 * @param $mesid
1264  
-	 *
1265 1264
 	 * @return bool
1266 1265
 	 */
1267  
-	public function resetvotes($mesid) {
1268  
-		if( !isset($mesid) ) return false;
  1266
+	public function resetvotes() {
  1267
+		if(!$this->poll_id) return false;
1269 1268
 
1270  
-		$query ="UPDATE #__kunena_polls_options SET votes=0 WHERE pollid={$this->_db->quote($mesid)}";
  1269
+		$query ="UPDATE #__kunena_polls_options SET votes=0 WHERE pollid={$this->_db->quote($this->poll_id)}";
1271 1270
 			$this->_db->setQuery($query);
1272 1271
 			$this->_db->Query();
1273 1272
 		if (KunenaError::checkDatabaseError ())
1274 1273
 		return false;
1275 1274
 
1276  
-		$query ="DELETE FROM #__kunena_polls_users WHERE pollid={$this->_db->quote($mesid)}";
  1275
+		$query ="DELETE FROM #__kunena_polls_users WHERE pollid={$this->_db->quote($this->poll_id)}";
1277 1276
 			$this->_db->setQuery($query);
1278 1277
 			$this->_db->Query();
1279 1278
 		if (KunenaError::checkDatabaseError ())
@@ -1379,6 +1378,20 @@ protected function authoriseOwn(KunenaUser $user) {
1379 1378
 		return null;
1380 1379
 	}
1381 1380
 
  1381
+		/**
  1382
+	 * @param KunenaUser $user
  1383
+	 *
  1384
+	 * @return null|string
  1385
+	 */
  1386
+	protected function authorisePoll(KunenaUser $user) {
  1387
+		// Check that user can vote
  1388
+		$poll = $this->getPoll();
  1389
+		if (!$poll->exists()) {
  1390
+			return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_LIB_TOPIC_AUTHORISE_FAILED_NO_POLL'), 404);
  1391
+		}
  1392
+		return null;
  1393
+	}
  1394
+
1382 1395
 	/**
1383 1396
 	 * @param KunenaUser $user
1384 1397
 	 *
@@ -1389,9 +1402,6 @@ protected function authoriseVote(KunenaUser $user) {
1389 1402
 		$config = KunenaFactory::getConfig();
1390 1403
 		$poll = $this->getPoll();
1391 1404
 		$votes = $poll->getMyVotes($user);
1392  
-		if (!$poll->exists()) {
1393  
-			return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_LIB_TOPIC_AUTHORISE_FAILED_NO_POLL'), 404);
1394  
-		}
1395 1405
 		if ($votes && $config->pollallowvoteone) {
1396 1406
 			return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_LIB_TOPIC_AUTHORISE_FAILED_VOTE_ONLY_ONCE'), 403);
1397 1407
 		}
16  libraries/kunena/layout/base.php
@@ -40,7 +40,7 @@ class KunenaLayoutBase extends KunenaCompatLayoutBase
40 40
 	 * Layout name.
41 41
 	 * @var string
42 42
 	 */
43  
-	protected $name = '';
  43
+	protected $_name = '';
44 44
 
45 45
 	/**
46 46
 	 * The view layout.
@@ -72,7 +72,7 @@ class KunenaLayoutBase extends KunenaCompatLayoutBase
72 72
 	public function __construct($name, array $paths = null)
73 73
 	{
74 74
 		// Setup dependencies.
75  
-		$this->name = $name;
  75
+		$this->_name = $name;
76 76
 		$this->includePaths = isset($paths) ? $paths : $this->loadPaths();
77 77
 	}
78 78
 
@@ -96,10 +96,10 @@ public function __toString()
96 96
 	 * @return  string
97 97
 	 */
98 98
 	public function debugInfo() {
99  
-		$rawPath  = strtolower(str_replace('.', '/', $this->name)) .'/'. $this->layout . '.php';
  99
+		$rawPath  = strtolower(str_replace('.', '/', $this->_name)) .'/'. $this->layout . '.php';
100 100
 
101 101
 		$html = "<pre>";
102  
-		$html .= '<strong>Layout:</strong> ' . $this->name . '<br />';
  102
+		$html .= '<strong>Layout:</strong> ' . $this->_name . '<br />';
103 103
 		$html .= '<strong>Template:</strong> ' . $this->layout . '.php<br />';
104 104
 		$html .= '<strong>RAW Layout path:</strong> ' . $rawPath . '<br>';
105 105
 		$html .= '<strong>includePaths:</strong> ';
@@ -152,7 +152,7 @@ public function render($layout = null)
152 152
 
153 153
 		// Check if the layout path was found.
154 154
 		if (!$path) {
155  
-			throw new RuntimeException("Layout '{$this->name}:{$layout}' Not Found");
  155
+			throw new RuntimeException("Layout '{$this->_name}:{$layout}' Not Found");
156 156
 		}
157 157
 
158 158
 		try {
@@ -193,12 +193,12 @@ public function renderError(Exception $e) {
193 193
 		if (!$location) $location = reset($trace);
194 194
 		if (isset($caller['file']) && strstr($caller['file'], '/libraries/')) $caller = next($trace);
195 195
 
196  
-		$error  = "Rendering Error in layout {$this->name}: {$e->getMessage()}";
  196
+		$error  = "Rendering Error in layout {$this->_name}: {$e->getMessage()}";
197 197
 		$error .= " in {$location['file']} on line {$location['line']}";
198 198
 		if (isset($caller['file'])) $error .= " called from {$caller['file']} on line {$caller['line']}";
199 199
 		JLog::add($error, JLog::CRITICAL, 'kunena');
200 200
 
201  
-		$error = "<b>Rendering Error</b> in layout <b>{$this->name}</b>: {$e->getMessage()}";
  201
+		$error = "<b>Rendering Error</b> in layout <b>{$this->_name}</b>: {$e->getMessage()}";
202 202
 		if (JDEBUG) {
203 203
 			$error .= " in <b>{$location['file']}</b> on line {$location['line']}<br />";
204 204
 			if (isset($caller['file'])) $error .= "Layout was rendered in <b>{$caller['file']}</b> on line {$caller['line']}";
@@ -219,7 +219,7 @@ public function renderError(Exception $e) {
219 219
 	 */
220 220
 	public function loadTemplate($tpl = null)
221 221
 	{
222  
-		return $this->render("{$this->name}_{$tpl}");
  222
+		return $this->render("{$this->_name}_{$tpl}");
223 223
 	}
224 224
 
225 225
 	/**
6  libraries/kunena/layout/layout.php
@@ -46,7 +46,7 @@ public function appendAfter($content) {
46 46
 	 */
47 47
 	public function render($layout = null)
48 48
 	{
49  
-		KUNENA_PROFILER ? KunenaProfiler::instance()->start("render layout '{$this->name}'") : null;
  49
+		KUNENA_PROFILER ? KunenaProfiler::instance()->start("render layout '{$this->_name}'") : null;
50 50
 
51 51
 		try {
52 52
 			$output = parent::render($layout);
@@ -54,11 +54,11 @@ public function render($layout = null)
54 54
 				$output .= (string) $content;
55 55
 			}
56 56
 		} catch (Exception $e) {
57  
-			KUNENA_PROFILER ? KunenaProfiler::instance()->stop("render layout '{$this->name}'") : null;
  57
+			KUNENA_PROFILER ? KunenaProfiler::instance()->stop("render layout '{$this->_name}'") : null;
58 58
 			throw $e;
59 59
 		}
60 60
 
61  
-		KUNENA_PROFILER ? KunenaProfiler::instance()->stop("render layout '{$this->name}'") : null;
  61
+		KUNENA_PROFILER ? KunenaProfiler::instance()->stop("render layout '{$this->_name}'") : null;
62 62
 		return $output;
63 63
 	}
64 64
 
2  libraries/kunena/layout/page.php
@@ -55,7 +55,7 @@ public function addBreadcrumb($text, $uri, $ignore = true)
55 55
 			$layout = isset($active->query['layout']) ? $active->query['layout'] : 'default';
56 56
 
57 57
 			if ($active && $active->component == 'com_kunena'
58  
-				&& strtolower("{$view}/{$layout}") == strtolower($this->name)) return $this;
  58
+				&& strtolower("{$view}/{$layout}") == strtolower($this->_name)) return $this;
59 59
 		}
60 60
 		$this->breadcrumb->addItem($text, KunenaRoute::normalize($uri));
61 61
 
18  libraries/kunena/user/helper.php
@@ -55,12 +55,13 @@ public static function get($identifier = null, $reload = false) {
55 55
 		}
56 56
 		// Find the user id
57 57
 		if ($identifier instanceof JUser) {
58  
-			$id = intval ( $identifier->id );
59  
-		} else if (is_numeric ( $identifier )) {
60  
-			$id = intval ( $identifier );
  58
+			$id = (int) $identifier->id;
  59
+		} elseif (((string)(int) $identifier) === ((string) $identifier)) {
  60
+			// Ignore imported users, which haven't been mapped to Joomla (id<0).
  61
+			$id = (int) max($identifier, 0);
61 62
 		} else {
62  
-			jimport ( 'joomla.user.helper' );
63  
-			$id = intval ( JUserHelper::getUserId ( ( string ) $identifier ) );
  63
+			// Slow, don't use usernames!
  64
+			$id = (int) JUserHelper::getUserId((string) $identifier);
64 65
 		}
65 66
 
66 67
 		// Always return fresh user if id is anonymous/not found
@@ -115,9 +116,10 @@ public static function loadUsers(array $userids = array()) {
115 116
 
116 117
 		// Make sure that userids are unique and that indexes are correct
117 118
 		$e_userids = array();
118  
-		foreach($userids as $userid){
119  
-			if (intval($userid) && empty ( self::$_instances [$userid] )) {
120  
-				$e_userids[$userid] = $userid;
  119
+		foreach($userids as $userid) {
  120
+			// Ignore guests and imported users, which haven't been mapped to Joomla (id<0).
  121
+			if ($userid > 0 && empty(self::$_instances[$userid])) {
  122
+				$e_userids[(int) $userid] = (int) $userid;
121 123
 			}
122 124
 		}
123 125
 
2  libraries/kunena/user/user.php
@@ -159,7 +159,7 @@ public function load($id) {
159 159
 		$table = $this->getTable ();
160 160
 
161 161
 		// Load the KunenaTableUser object based on the user id
162  
-		$this->_exists = $table->load ( $id );
  162
+		if ($id > 0) $this->_exists = $table->load($id);
163 163
 
164 164
 		// Assuming all is well at this point lets bind the data
165 165
 		$this->setProperties ( $table->getProperties () );
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.