public function addMap($address)
 {
     $mapid = 'kgooglemap' . $this->_mapid;
     $this->_document->addScriptDeclaration("\n   \t\t// <![CDATA[\n   \t\t  \tvar geocoder;\n  \t\t\tvar {$mapid};\n\n   \t\t\twindow.addEvent('domready', function() {\n   \t\t\t    geocoder = new google.maps.Geocoder();\n\t\t\t\tvar latlng = new google.maps.LatLng(37.333586,-121.894684);\n\t\t\t\tvar myOptions = {\n\t\t\t\t\tzoom: 10,\n      \t\t\t\tcenter: latlng,\n\t\t\t\t\tmapTypeId: google.maps.MapTypeId.ROADMAP\n\t\t\t\t};\n\t\t\t\t{$mapid} = new google.maps.Map(document.id('" . $mapid . "'), myOptions);\n   \t\t\t});\n\n   \t\t\twindow.addEvent('domready', function() {\n\t\t\t    var address = '{$address}';\n\t\t\t    if (geocoder) {\n\t\t\t      geocoder.geocode( { 'address': address}, function(results, status) {\n\t\t\t        if (status == google.maps.GeocoderStatus.OK) {\n\t\t\t          {$mapid}.setCenter(results[0].geometry.location);\n\t\t\t          var marker = new google.maps.Marker({\n\t\t\t              map: {$mapid},\n\t\t\t              position: results[0].geometry.location\n\t\t\t          });\n\t\t\t        } else {\n\t\t\t        \tvar contentString = '<p><strong>" . KunenaParser::JSText('COM_KUNENA_GOOGLE_MAP_NO_GEOCODE') . " <i>{$address}</i></strong></p>';\n\t\t\t        \tvar infowindow{$mapid} = new google.maps.InfoWindow({ content: contentString });\n  \t\t\t\t\t\tinfowindow{$mapid}.open({$mapid});\n\t\t\t        }\n\t\t\t      });\n\t\t\t    }\n      \t\t});\n\n   \t\t\t// ]]>");
     $html = '<div id="' . $mapid . '" class="kgooglemap">' . KunenaParser::JSText('COM_KUNENA_GOOGLE_MAP_NOT_VISIBLE') . '</div>';
     $this->_mapid++;
     return $html;
 }
Example #2
0
 function stripBBCode($txt, $len = 0)
 {
     if (!$txt) {
         return;
     }
     if (!self::$emoticons) {
         self::$emoticons = smile::getEmoticons(0);
     }
     $txt = smile::purify($txt);
     if ($len && JString::strlen($txt) > $len) {
         $txt = JString::substr($txt, 0, $len) . '...';
     }
     $txt = self::escape($txt);
     $txt = self::prepareContent($txt);
     return $txt;
 }
Example #3
0
        ?>
				<?php 
        if (is_array($userban->comments)) {
            foreach ($userban->comments as $comment) {
                ?>
				<tr class="krow2">
					<td colspan="2" class="kcol-first kcommentby-label"><b><?php 
                echo JText::sprintf('COM_KUNENA_BAN_COMMENT_BY', CKunenaLink::GetProfileLink(intval($comment->userid)));
                ?>
</b> :</td>
					<td colspan="1" class="kcol-mid kcommenttime-field"><?php 
                echo CKunenaTimeFormat::showDate($comment->time);
                ?>
</td>
					<td colspan="3" class="kcol-mid kcomment-field"><?php 
                echo KunenaParser::parseText($comment->comment);
                ?>
</td>
				</tr>
				<?php 
            }
        }
        ?>
				<?php 
    }
    ?>
				<?php 
} else {
    ?>
				<tr class="krow1">
					<td colspan="6" class="kcol-first"><?php 
 protected function _getPreview($data)
 {
     $result = array();
     $config = KunenaFactory::getConfig();
     $this->msg->userid = JFactory::getUser()->id;
     $msgbody = KunenaParser::parseBBCode($data, $this);
     $result['preview'] = $msgbody;
     return $result;
 }
Example #5
0
    ?>
</p>
							<p><?php 
    $profile = KunenaFactory::getUser(intval($mes->userid));
    $useravatar = $profile->getAvatarLink('', '', 'profile');
    if ($useravatar) {
        echo CKunenaLink::GetProfileLink(intval($mes->userid), $useravatar);
    }
    ?>
</p>
						</td>
						<td class="kmessage-left khistorymsg">
							<div class="kmsgbody">
								<div class="kmsgtext">
									<?php 
    echo KunenaParser::parseBBCode($mes->message, $this);
    ?>
								</div>
							</div>
							<?php 
    if (!empty($this->attachmentslist[$mes->id])) {
        $this->displayAttachments($this->attachmentslist[$mes->id]);
    }
    ?>
						</td>
					</tr>
				</tbody>
			</table>
			<?php 
}
?>
Example #6
0
 /**
  * Pulls together data and options and outputs the build feed.
  * Header and mime is automaticly set.
  *
  * @access private
  * @param array $items
  */
 private function buildFeed($items = array())
 {
     // Build items for feed
     foreach ($items as $data) {
         $item = new JFeedItem();
         // Calcution to define the last page of the topic
         $threadPages = ceil($data->msgcount / $this->config->messages_per_page);
         // Build unique direct linking url for each item (htmlspecialchars_decode because FeedCreator uses htmlspecialchars on input)
         $url = CKunenaLink::GetThreadPageURL('view', $data->catid, $data->thread, $threadPages, $this->config->messages_per_page, $data->id);
         // Extract the data, we want to present and store it in $tmp
         $tmp = array();
         $tmp['title'] = $data->subject;
         // Remove confidential information from message
         $data->message = preg_replace('/\\[confidential\\](.*?)\\[\\/confidential\\]/s', '', $data->message);
         $data->message = preg_replace('/\\[hide\\](.*?)\\[\\/hide\\]/s', '', $data->message);
         $data->message = preg_replace('/\\[spoiler\\]/s', '[spoilerlight]', $data->message);
         $data->message = preg_replace('/\\[\\/spoiler\\]/s', '[/spoilerlight]', $data->message);
         $data->message = preg_replace('/\\[code\\](.*?)\\[\\/code]/s', '', $data->message);
         $tmp['text'] = $data->message;
         $tmp['date'] = $data->time;
         $tmp['email'] = $data->email;
         $tmp['name'] = $data->name;
         $tmp['cat_name'] = $data->catname;
         // Link and source is always the same
         $tmp['link'] = $this->uri->toString(array('scheme', 'host', 'port')) . $url;
         $tmp['source'] = $this->uri->toString(array('scheme', 'host', 'port')) . $url;
         // Determine title format
         if ($this->old_titles) {
             $tmp['title'] = JText::_('COM_KUNENA_GEN_SUBJECT') . ': ' . $tmp['title'];
         }
         // Determine author format
         switch ($this->author_format) {
             case 'both':
                 $tmp['author'] = $tmp['email'] . ' (' . $tmp['name'] . ')';
                 break;
             case 'email':
                 $tmp['author'] = $tmp['email'];
                 break;
             case 'name':
             default:
                 $tmp['author'] = $tmp['name'];
         }
         // Do we want author in item titles?
         if ($this->author_in_title) {
             $tmp['title'] .= ' - ' . JText::_('COM_KUNENA_GEN_BY') . ': ' . $tmp['name'];
         }
         // Limit number of words
         if ($this->word_count) {
             $Newmessage = '';
             $t_newString = explode(" ", $tmp['text']);
             foreach ($t_newString as $key => $word) {
                 if ($key < $this->word_count) {
                     $Newmessage .= $word . ' ';
                 }
             }
             // Append userfriendly '...' string
             if (strlen($tmp['text']) != strlen($Newmessage)) {
                 $Newmessage .= ' ...';
             }
             $tmp['text'] = $Newmessage;
         }
         if ($this->allow_html) {
             // Not nessecary to convert specialchars or use parsetext.
             // ParseBBCode does it for us
             $tmp['text'] = KunenaParser::parseBBCode($tmp['text']);
         } else {
             // Not nessecary to convert specialchars.
             // FeedCreator does it for us
             $tmp['text'] = KunenaParser::parseText($tmp['text']);
         }
         // Assign values to feed item
         $item->title = $tmp['title'];
         $item->link = $tmp['link'];
         $item->description = $tmp['text'];
         $item->date = $tmp['date'];
         $item->source = $tmp['source'];
         $item->author = $tmp['author'];
         $item->category = $tmp['cat_name'];
         // Finally add item to feed
         $this->document->addItem($item);
     }
 }
Example #7
0
    echo JHTML::_('form.token');
    ?>
						</form>
						<?php 
} else {
    ?>
						<table>
							<?php 
    foreach ($dataspollresult as $row) {
        ?>
							<tr class="krow<?php 
        echo ($i ^= 1) + 1;
        ?>
">
								<td class="kcol-option"><?php 
        echo KunenaParser::parseText($row->text);
        ?>
</td>
								<td class="kcol-bar"><img class = "jr-forum-stat-bar" src = "<?php 
        echo KUNENA_JLIVEURL . "components/com_kunena/template/default/images/bar.png";
        ?>
" height = "10" width = "<?php 
        echo isset($row->votes) ? $row->votes * 25 / 5 : "0";
        ?>
" /></td>
								<td class="kcol-number"><?php 
        if (isset($row->votes) && $row->votes > 0) {
            echo $row->votes;
        } else {
            echo JText::_('COM_KUNENA_POLL_NO_VOTE');
        }
Example #8
0
 public function onAfterReply($message)
 {
     CFactory::load('libraries', 'userpoints');
     CUserPoints::assignPoint('com_kunena.thread.reply');
     // Check for permisions of the current category - activity only if public or registered
     if (!empty($message->parent)) {
         //activity stream - reply post
         require_once KPATH_SITE . '/lib/kunena.link.class.php';
         $JSPostLink = CKunenaLink::GetThreadPageURL('view', $message->get('catid'), $message->get('thread'), 1);
         $content = $message->get('message');
         // Strip content not allowed for guests
         $content = preg_replace('/\\[hide\\](.*?)\\[\\/hide\\]/s', '', $content);
         $content = preg_replace('/\\[confidential\\](.*?)\\[\\/confidential\\]/s', '', $content);
         $content = preg_replace('/\\[spoiler\\]/s', '[spoilerlight]', $content);
         $content = preg_replace('/\\[\\/spoiler\\]/s', '[/spoilerlight]', $content);
         $content = preg_replace('/\\[attachment(.*?)\\](.*?)\\[\\/attachment\\]/s', '', $content);
         $content = preg_replace('/\\[code\\](.*?)\\[\\/code]/s', '', $content);
         // limit activity stream output if limit is set
         $content = KunenaParser::parseBBCode($content, null, intval($this->_config->activity_limit));
         // Add readmore link
         $content .= '<br /><a href="' . CKunenaLink::GetMessageURL($message->get('id')) . '" class="small profile-newsfeed-item-action">' . JText::_('COM_KUNENA_READMORE') . '</a>';
         $act = new stdClass();
         $act->cmd = 'wall.write';
         $act->actor = $message->get('userid');
         $act->target = 0;
         // no target
         $act->title = JText::_('{single}{actor}{/single}{multiple}{actors}{/multiple} ' . JText::_('COM_KUNENA_JS_ACTIVITYSTREAM_REPLY_MSG1') . ' <a href="' . $JSPostLink . '">' . $message->get('subject') . '</a> ' . JText::_('COM_KUNENA_JS_ACTIVITYSTREAM_REPLY_MSG2'));
         $act->content = $content;
         $act->app = 'kunena.post';
         $act->cid = $message->get('thread');
         $act->access = $this->getAccess($message);
         CFactory::load('libraries', 'activities');
         CActivityStream::add($act);
     }
 }
Example #9
0
 function Encode(&$text_new, &$task, $text_old, $context)
 {
     /*
     # Encode strings for output
     # Regard interpreter mode if needed
     # context: 'text'
     # context: 'tagremove'
     # RET:
     # TAGPARSER_RET_NOTHING: No Escaping done
     # TAGPARSER_RET_REPLACED: Escaping done
     */
     // special states are liable for encoding (Extended Tag hit)
     if ($task->in_code) {
         // everything inside [code] is getting converted/encoded by tag delegation
         return TAGPARSER_RET_NOTHING;
     }
     if ($task->in_noparse) {
         // noparse is also needed to get encoded
         $text_new = kunena_htmlspecialchars($text_old, ENT_QUOTES);
         return TAGPARSER_RET_REPLACED;
     }
     // generally
     $text_new = $text_old;
     // pasting " " allows regexp to apply on \s at end
     // HTMLize from plaintext
     $text_new = KunenaParser::escape($text_new);
     if ($context == 'text' && $task->autolink_disable == 0) {
         // Build links HTML2HTML
         $text_new = KunenaBBCodeInterpreter::hyperlink($text_new);
         // Calculate smilies HTML2HTML
         $text_new = smile::smileParserCallback($text_new, $task->history, $task->emoticons, $task->iconList);
     }
     return TAGPARSER_RET_REPLACED;
 }
Example #10
0
                    echo '<img class="favoritestar-grey" src="' . $this->ktemplate->getImagePath('icons/favoritestar-grey.png') . '"  alt="' . JText::_('MOD_KUNENALATEST_FAVORITE') . '" title="' . JText::_('MOD_KUNENALATEST_FAVORITE') . '" />';
                }
            }
        }
        if ($this->params->get('sh_locked')) {
            if ($item->locked) {
                echo '<img src="' . $this->ktemplate->getImagePath('icons/lock_sm.png') . '"  alt="' . JText::_('MOD_KUNENALATEST_LOCKED_TOPIC') . '" title="' . JText::_('MOD_KUNENALATEST_LOCKED_TOPIC') . '" />';
            }
        }
        ?>
		</li>
		<?php 
        if ($this->params->get('sh_firstcontentcharacter')) {
            ?>
			<li class="klatest-preview-content"><?php 
            echo JString::substr(KunenaParser::stripBBCode($item->message), '0', $this->params->get('lengthcontentcharacters'));
            ?>
</li>
		<?php 
        }
        ?>
		<?php 
        if ($this->params->get('sh_category')) {
            ?>
			<li class="klatest-cat"><?php 
            echo JText::_('MOD_KUNENALATEST_IN_CATEGORY') . ' ' . CKunenaLink::GetCategoryLink('showcat', $item->catid, $item->catname);
            ?>
</li>
		<?php 
        }
        ?>
Example #11
0
            ?>
</li>
										<?php 
        }
    } else {
        ?>
									<li>
										<input class="kpoll-boxvote" type="radio" name="kpollradio" id="radio_name<?php 
        echo $i;
        ?>
"
											value="<?php 
        echo intval($result->id);
        ?>
" /><?php 
        echo KunenaParser::parseText($result->text);
        ?>
</li>
									<?php 
    }
}
?>
								</ul>
								<input type="hidden" name="kpoll-id" value="<?php 
echo intval($this->id);
?>
">
								<?php 
echo JHTML::_('form.token');
?>
							</fieldset>
Example #12
0
                    if ($useravatar) {
                        ?>
					<span class="klatest-avatar"> <?php 
                        echo CKunenaLink::GetProfileLink(intval($category->userid), $useravatar);
                        ?>
</span>
				<?php 
                    }
                    ?>
			<!-- /Avatar -->
			<?php 
                }
                ?>
			<div class="klatest-subject ks">
				<?php 
                echo JText::_('COM_KUNENA_GEN_LAST_POST') . ': ' . CKunenaLink::GetThreadPageLink('view', intval($category->catid), intval($category->thread), intval($category->page), intval($this->config->messages_per_page), KunenaParser::parseText($category->subject, 30), intval($category->id_last_msg));
                ?>
			</div>

			<div class="klatest-subject-by ks">
			<?php 
                echo JText::_('COM_KUNENA_BY') . ' ';
                if (!empty($category->userid)) {
                    echo CKunenaLink::GetProfileLink(intval($category->userid), $this->escape($this->config->username ? $category->username : $category->uname));
                } else {
                    echo CKunenaLink::GetProfileLink(intval($category->userid), $this->escape($category->mname));
                }
                echo '<br /><span class="nowrap" title="' . CKunenaTimeformat::showDate($category->time_last_msg, 'config_post_dateformat_hover') . '">' . CKunenaTimeformat::showDate($category->time_last_msg, 'config_post_dateformat') . '</span>';
                ?>
			</div>
			</td>
Example #13
0
				<?php 
if ($this->announcement->showdate) {
    ?>
				<div class="anncreated"><?php 
    echo CKunenaTimeformat::showDate($this->announcement->created, 'date_today');
    ?>
</div>
				<?php 
}
?>
				<?php 
if (!empty($this->announcement->sdescription)) {
    ?>
					<div class="anndesc">
						<?php 
    echo KunenaParser::parseBBCode($this->announcement->sdescription);
    ?>
						<?php 
    if (!empty($this->announcement->description)) {
        ?>
						...<br /><?php 
        echo CKunenaLink::GetAnnouncementLink('read', $this->id, JText::_('COM_KUNENA_ANN_READMORE'), JText::_('COM_KUNENA_ANN_READMORE'), 'follow');
        ?>
						<?php 
    }
    ?>
					</div>
				<?php 
}
?>
			</div>
Example #14
0
    echo JText::_('COM_KUNENA_POSTED_AT');
    ?>
 <?php 
    echo CKunenaTimeformat::showDate($this->message->time, 'config_post_dateformat');
    ?>
</span>
		<span class="kmessage-by"><?php 
    echo JText::_('COM_KUNENA_GEN_BY') . ' ' . CKunenaLink::GetProfileLink(intval($this->message->userid), $this->escape($this->message->name));
    ?>
</span></div>
		<div class="kmessage-avatar"><?php 
    echo $this->user->getAvatarLink('', 'list');
    ?>
</div>
		<div class="kmessage-msgtext"><?php 
    echo KunenaParser::stripBBCode($this->message->message, 300);
    ?>
</div>
	</div>
	<div>
		<?php 
    echo JText::_('COM_KUNENA_MODERATE_THIS_USER');
    if ($this->message->userid != 0) {
        ?>
:
		<strong><?php 
        echo CKunenaLink::GetModerateUserLink(intval($this->message->userid), $this->escape($this->message->name) . ' (' . intval($this->message->userid) . ')');
        ?>
</strong>
		<?php 
    } else {
Example #15
0
					if ($item->myfavorite) {
						echo '<img class="favoritestar" src="'.$this->ktemplate->getImagePath('icons/favoritestar.png').'"  alt="' . JText::_ ( 'MOD_KUNENALATEST_FAVORITE' ) . '" title="' . JText::_ ( 'MOD_KUNENALATEST_FAVORITE' ) . '" />';
					} else {
						echo '<img class="favoritestar-grey" src="'.$this->ktemplate->getImagePath('icons/favoritestar-grey.png').'"  alt="' . JText::_ ( 'MOD_KUNENALATEST_FAVORITE' ) . '" title="' . JText::_ ( 'MOD_KUNENALATEST_FAVORITE' ) . '" />';
					}
				}
			}
			if ($this->params->get ( 'sh_locked' )) {
				if ($item->locked) {
					echo '<img src="'.$this->ktemplate->getImagePath('icons/lock_sm.png').'"  alt="' . JText::_ ( 'MOD_KUNENALATEST_LOCKED_TOPIC' ) . '" title="' . JText::_ ( 'MOD_KUNENALATEST_LOCKED_TOPIC' ) . '" />';
				}
			}
			?>
		</li>
		<?php if ($this->params->get ( 'sh_firstcontentcharacter' )) : ?>
			<li class="klatest-preview-content"><?php echo JString::substr(KunenaParser::stripBBCode($item->message), '0', $this->params->get ( 'lengthcontentcharacters' )); ?></li>
		<?php endif; ?>
		<?php if ($this->params->get ( 'sh_category' )) : ?>
			<li class="klatest-cat"><?php echo JText::_ ( 'MOD_KUNENALATEST_IN_CATEGORY' ).' '.CKunenaLink::GetCategoryLink ( 'showcat', $item->catid, $item->catname ); ?></li>
		<?php endif; ?>
		<?php if ($this->params->get ( 'sh_author' )) : ?>
			<li class="klatest-author"><?php echo JText::_ ( 'MOD_KUNENALATEST_LAST_POST_BY' ) .' '. CKunenaLink::GetProfileLink ( $item->userid, $item->name ); ?></li>
		<?php endif; ?>
		<?php if ($this->params->get ( 'sh_time' )) : ?>
			<li class="klatest-posttime"><?php $override = $this->params->get ( 'dateformat' ); echo CKunenaTimeformat::showDate($this->params->get( 'choosemodel' ) == 'latestposts' ? $item->time : $item->lasttime, $override ? $override : 'config_post_dateformat');?></li>
		<?php endif; ?>
	</ul>
</li>
<?php
	} //end foreach
?>
Example #16
0
    echo JText::_('COM_KUNENA_EDITOR_VIDEO_URL');
    ?>
<input id="kvideourl" name="videourl"
				type="text" size="30" maxlength="250" value="http://"
				onmouseover="javascript:document.id('helpbox').set('value', '<?php 
    echo KunenaParser::JSText('COM_KUNENA_EDITOR_HELPLINE_VIDEOURL');
    ?>
')" />
			<input id="kbutton_addvideo2" type="button" name="Video" accesskey="p"
				onclick="kInsertVideo2()"
				value="<?php 
    echo JText::_('COM_KUNENA_EDITOR_VIDEO_INSERT');
    ?>
"
				onmouseover="javascript:document.id('helpbox').set('value', '<?php 
    echo KunenaParser::JSText('COM_KUNENA_EDITOR_HELPLINE_VIDEOAPPLY2');
    ?>
')" />
			</div>
			</td>
		</tr>
		<?php 
}
if (!$this->config->disemoticons) {
    ?>
		<tr>
			<td class="kpostbuttons">
			<div id="smilie"><?php 
    $emoticons = smile::getEmoticons(0, 1);
    foreach ($emoticons as $emo_code => $emo_url) {
        echo '<img class="btnImage" src="' . $emo_url . '" border="0" alt="' . $emo_code . ' " title="' . $emo_code . ' " onclick="kbbcode.insert(\' ' . $emo_code . ' \', \'after\', true);" style="cursor:pointer"/> ';
Example #17
0
 function getView()
 {
     // Is user allowed to read category from the URL?
     if ($this->catid && !$this->session->canRead($this->catid)) {
         return;
     }
     $this->allow = 1;
     $where[] = "a.hold IN ({$this->hold})";
     $where = implode(' AND ', $where);
     $query = "SELECT a.*, b.*, p.id AS poll_id, modified.name AS modified_name, modified.username AS modified_username\n\t\t\tFROM #__kunena_messages AS a\n\t\t\tLEFT JOIN #__kunena_messages_text AS b ON a.id=b.mesid\n\t\t\tLEFT JOIN #__users AS modified ON a.modified_by = modified.id\n\t\t\tLEFT JOIN #__kunena_polls AS p ON a.id=p.threadid\n\t\t\tWHERE a.id={$this->db->Quote($this->id)} AND {$where}";
     $this->db->setQuery($query);
     $this->first_message = $this->db->loadObject();
     // Invalid message id (deleted, on hold?)
     if (KunenaError::checkDatabaseError() || !$this->first_message) {
         return;
     }
     // Is user allowed to see the forum specified in the message?
     if (!$this->session->canRead($this->first_message->catid)) {
         $this->allow = 0;
         return;
     }
     $this->thread = $this->first_message->thread;
     // Test if this is a valid URL. If not, redirect browser to the right location
     if ($this->first_message->moved || $this->thread != $this->id || $this->catid != $this->first_message->catid) {
         $this->catid = $this->first_message->catid;
         if ($this->first_message->moved) {
             $newurl = array();
             parse_str($this->first_message->message, $newloc);
             $this->id = $newloc['id'];
             $query = "SELECT catid, thread FROM #__kunena_messages AS a WHERE a.id='{$this->id}'";
             $this->db->setQuery($query);
             $newpos = $this->db->loadObject();
             if (!$newpos) {
                 $this->allow = 0;
                 return;
             }
             if (KunenaError::checkDatabaseError()) {
                 return;
             }
             $this->thread = $newpos->thread;
             $this->catid = $newpos->catid;
         }
         // This query to calculate the page this reply is sitting on within this thread
         $query = "SELECT COUNT(*) FROM #__kunena_messages AS a WHERE a.thread={$this->db->Quote($this->thread)} AND {$where} AND a.id<={$this->db->Quote($this->id)}";
         $this->db->setQuery($query);
         $replyCount = $this->db->loadResult();
         if (KunenaError::checkDatabaseError()) {
             return;
         }
         $replyPage = $replyCount > $this->config->messages_per_page ? ceil($replyCount / $this->config->messages_per_page) : 1;
         $this->redirect = CKunenaLink::GetThreadPageURL('view', $this->catid, $this->thread, $replyPage, $this->config->messages_per_page, $this->first_message->id, false);
     }
     //Get the category name for breadcrumb
     $this->db->setQuery("SELECT * FROM #__kunena_categories WHERE id={$this->db->Quote($this->catid)}");
     $this->catinfo = $this->db->loadObject();
     if (KunenaError::checkDatabaseError()) {
         return;
     }
     //Get Parent's cat.name for breadcrumb
     $this->db->setQuery("SELECT id, name FROM #__kunena_categories WHERE id={$this->db->Quote($this->catinfo->parent)}");
     $objCatParentInfo = $this->db->loadObject();
     if (KunenaError::checkDatabaseError()) {
         return;
     }
     // START
     $this->emoticons = smile::getEmoticons(0);
     $this->prevCheck = $this->session->lasttime;
     $this->read_topics = explode(',', $this->session->readtopics);
     $showedEdit = 0;
     $this->kunena_forum_locked = $this->catinfo->locked;
     //check if topic is locked
     $this->topicLocked = $this->first_message->locked;
     if (!$this->topicLocked) {
         //topic not locked; check if forum is locked
         $this->topicLocked = $this->catinfo->locked;
     }
     $this->topicSticky = $this->first_message->ordering;
     CKunenaTools::markTopicRead($this->thread, $this->my->id);
     //update the hits counter for this topic & exclude the owner
     if ($this->my->id == 0 || $this->first_message->userid != $this->my->id) {
         $this->db->setQuery("UPDATE #__kunena_messages SET hits=hits+1 WHERE id={$this->db->Quote($this->thread)} AND parent='0'");
         $this->db->query();
         KunenaError::checkDatabaseError();
     }
     $query = "SELECT COUNT(*) FROM #__kunena_messages AS a WHERE a.thread={$this->db->Quote($this->thread)} AND {$where}";
     $this->db->setQuery($query);
     $this->total_messages = $this->db->loadResult();
     KunenaError::checkDatabaseError();
     // If page does not exist, redirect to the last page
     if ($this->total_messages <= $this->limitstart) {
         $page = ceil($this->total_messages / $this->limit);
         $this->redirect = CKunenaLink::GetThreadPageURL('view', $this->catid, $this->id, $page, $this->limit, '', false);
     }
     $maxpages = 7 - 2;
     // odd number here (show - 2)
     $totalpages = ceil($this->total_messages / $this->limit);
     $page = floor($this->limitstart / $this->limit) + 1;
     $firstpage = 1;
     if ($this->ordering == 'desc') {
         $firstpage = $totalpages;
     }
     // Get replies of current thread
     $query = "SELECT a.*, b.*, modified.name AS modified_name, modified.username AS modified_username\n\t\t\t\t\tFROM #__kunena_messages AS a\n\t\t\t\t\tLEFT JOIN #__kunena_messages_text AS b ON a.id=b.mesid\n\t\t\t\t\tLEFT JOIN #__users AS modified ON a.modified_by = modified.id\n\t\t\t\t\tWHERE a.thread={$this->db->Quote($this->thread)} AND {$where}\n\t\t\t\t\tORDER BY id {$this->ordering}";
     $this->db->setQuery($query, $this->limitstart, $this->limit);
     $this->messages = (array) $this->db->loadObjectList('id');
     KunenaError::checkDatabaseError();
     // First collect the message ids of the first message and all replies
     $messageids = array();
     $this->threaded = array();
     $userlist = array();
     foreach ($this->messages as $message) {
         $messageids[] = $message->id;
         // Threaded ordering
         if (isset($this->messages[$message->parent])) {
             $this->threaded[$message->parent][] = $message->id;
         } else {
             $this->threaded[0][] = $message->id;
         }
         $userlist[intval($message->userid)] = intval($message->userid);
         $userlist[intval($message->modified_by)] = intval($message->modified_by);
     }
     if (!isset($this->messages[$this->mesid])) {
         $this->mesid = reset($messageids);
     }
     if ($this->layout != 'view') {
         if (!isset($this->messages[$this->id])) {
             $this->messages = $this->getThreadedOrdering(0, array('edge'));
         } else {
             $this->messages = $this->getThreadedOrdering();
         }
     }
     // create a list of ids we can use for our sql
     $idstr = @join(",", $messageids);
     // Load attachments
     require_once KUNENA_PATH_LIB . '/kunena.attachments.class.php';
     $attachments = CKunenaAttachments::getInstance();
     if (is_a($attachments, 'CKunenaAttachments')) {
         $message_attachments = $attachments->get($idstr);
         // Now that we have all relevant messages in messages, asign any matching attachments
         foreach ($this->messages as $message) {
             // Mark as new
             if ($this->my->id && $this->prevCheck < $message->time && !in_array($message->thread, $this->read_topics)) {
                 $message->new = true;
             } else {
                 $message->new = false;
             }
             // Assign attachments
             if (isset($message_attachments[$message->id])) {
                 $message->attachments = $message_attachments[$message->id];
             }
         }
         // Done with attachments
     }
     $this->pagination = $this->getPagination($this->catid, $this->thread, $page, $totalpages, $maxpages);
     //meta description and keywords
     $metaKeys = kunena_htmlspecialchars("{$this->first_message->subject}, {$objCatParentInfo->name}, {$this->config->board_title}, " . JText::_('COM_KUNENA_GEN_FORUM') . ', ' . $this->app->getCfg('sitename'));
     // Create Meta Description form the content of the first message
     // better for search results display but NOT for search ranking!
     $metaDesc = KunenaParser::stripBBCode($this->first_message->message);
     $metaDesc = strip_tags($metaDesc);
     // Now remove all tags
     $metaDesc = preg_replace('/\\s+/', ' ', $metaDesc);
     // remove newlines
     $metaDesc = preg_replace('/^[^\\w0-9]+/', '', $metaDesc);
     // remove characters at the beginning that are not letters or numbers
     $metaDesc = trim($metaDesc);
     // Remove trailing spaces and beginning
     // remove multiple spaces
     while (strpos($metaDesc, '  ') !== false) {
         $metaDesc = str_replace('  ', ' ', $metaDesc);
     }
     // limit to 185 characters - google will cut off at ~150
     if (strlen($metaDesc) > 185) {
         $metaDesc = rtrim(JString::substr($metaDesc, 0, 182)) . '...';
     }
     $metaDesc = htmlspecialchars($metaDesc);
     $document =& JFactory::getDocument();
     $document->setMetadata('keywords', $metaKeys);
     $document->setDescription($metaDesc);
     $this->layout_buttons = array();
     if ($this->config->enable_threaded_layouts) {
         if ($this->layout != 'view') {
             $this->layout_buttons[] = CKunenaLink::GetThreadLayoutLink('flat', $this->catid, $this->thread, $this->mesid, CKunenaTools::showButton('layout-flat', JText::_('COM_KUNENA_BUTTON_LAYOUT_FLAT')), $this->limitstart, $this->limit, JText::_('COM_KUNENA_BUTTON_LAYOUT_FLAT_LONG'), 'nofollow', 'kicon-button kbuttonuser btn-left');
         }
         if ($this->layout != 'threaded') {
             $this->layout_buttons[] = CKunenaLink::GetThreadLayoutLink('threaded', $this->catid, $this->thread, $this->mesid, CKunenaTools::showButton('layout-threaded', JText::_('COM_KUNENA_BUTTON_LAYOUT_THREADED')), $this->limitstart, $this->limit, JText::_('COM_KUNENA_BUTTON_LAYOUT_THREADED_LONG'), 'nofollow', 'kicon-button kbuttonuser btn-left');
         }
         if ($this->layout != 'indented') {
             $this->layout_buttons[] = CKunenaLink::GetThreadLayoutLink('indented', $this->catid, $this->thread, $this->mesid, CKunenaTools::showButton('layout-indented', JText::_('COM_KUNENA_BUTTON_LAYOUT_INDENTED')), $this->limitstart, $this->limit, JText::_('COM_KUNENA_BUTTON_LAYOUT_INDENTED_LONG'), 'nofollow', 'kicon-button kbuttonuser btn-left');
         }
     }
     //Perform subscriptions check only once
     $this->cansubscribe = 0;
     if ($this->config->allowsubscriptions && $this->config->topic_subscriptions != 'disabled' && $this->my->id) {
         $this->db->setQuery("SELECT thread, future1 FROM #__kunena_subscriptions WHERE userid={$this->db->Quote($this->my->id)} AND thread={$this->db->Quote($this->thread)}");
         $fb_subscribed = $this->db->loadObject();
         KunenaError::checkDatabaseError();
         if (!$fb_subscribed) {
             $this->cansubscribe = 1;
         } elseif ($fb_subscribed->future1 == 1) {
             $query_thread = "UPDATE #__kunena_subscriptions\n\t\t\t\t\tSET future1=0 WHERE thread={$this->db->Quote($this->thread)} AND userid={$this->db->Quote($this->my->id)}";
             $this->db->setQuery($query_thread);
             $this->db->query();
         }
     }
     //Perform favorites check only once
     $fb_canfavorite = 0;
     $this->db->setQuery("SELECT MAX(userid={$this->db->Quote($this->my->id)}) AS favorited, COUNT(*) AS totalfavorited FROM #__kunena_favorites WHERE thread={$this->db->Quote($this->thread)}");
     list($this->favorited, $this->totalfavorited) = $this->db->loadRow();
     KunenaError::checkDatabaseError();
     if ($this->config->allowfavorites && $this->my->id) {
         if (!$this->favorited) {
             $fb_canfavorite = 1;
         }
     }
     //get the Moderator list for display
     $this->db->setQuery("SELECT m.*, u.* FROM #__kunena_moderation AS m INNER JOIN #__users AS u ON u.id=m.userid WHERE m.catid={$this->db->Quote($this->catid)} AND u.block=0");
     $this->modslist = $this->db->loadObjectList();
     KunenaError::checkDatabaseError();
     $this->catModerators = array();
     foreach ($this->modslist as $mod) {
         $this->catModerators[] = $mod->userid;
         $userlist[intval($mod->userid)] = intval($mod->userid);
     }
     // Prefetch all users/avatars to avoid user by user queries during template iterations
     KunenaUser::loadUsers($userlist);
     //data ready display now
     if (CKunenaTools::isModerator($this->my->id, $this->catid) || $this->topicLocked == 0) {
         //this user is allowed to reply to this topic
         $this->thread_reply = CKunenaLink::GetTopicPostReplyLink('reply', $this->catid, $this->thread, CKunenaTools::showButton('reply', JText::_('COM_KUNENA_BUTTON_REPLY_TOPIC')), 'nofollow', 'kicon-button kbuttoncomm btn-left', JText::_('COM_KUNENA_BUTTON_REPLY_TOPIC_LONG'));
     }
     // Thread Subscription
     if ($this->cansubscribe == 1) {
         // this user is allowed to subscribe - check performed further up to eliminate duplicate checks
         // for top and bottom navigation
         $this->thread_subscribe = CKunenaLink::GetTopicPostLink('subscribe', $this->catid, $this->id, CKunenaTools::showButton('subscribe', JText::_('COM_KUNENA_BUTTON_SUBSCRIBE_TOPIC')), 'nofollow', 'kicon-button kbuttonuser btn-left', JText::_('COM_KUNENA_BUTTON_SUBSCRIBE_TOPIC_LONG'));
     }
     if ($this->my->id != 0 && $this->config->allowsubscriptions && $this->config->topic_subscriptions != 'disabled' && $this->cansubscribe == 0) {
         // this user is allowed to unsubscribe
         $this->thread_subscribe = CKunenaLink::GetTopicPostLink('unsubscribe', $this->catid, $this->id, CKunenaTools::showButton('subscribe', JText::_('COM_KUNENA_BUTTON_UNSUBSCRIBE_TOPIC')), 'nofollow', 'kicon-button kbuttonuser btn-left', JText::_('COM_KUNENA_BUTTON_UNSUBSCRIBE_TOPIC_LONG'));
     }
     //START: FAVORITES
     if ($fb_canfavorite == 1) {
         // this user is allowed to add a favorite - check performed further up to eliminate duplicate checks
         // for top and bottom navigation
         $this->thread_favorite = CKunenaLink::GetTopicPostLink('favorite', $this->catid, $this->id, CKunenaTools::showButton('favorite', JText::_('COM_KUNENA_BUTTON_FAVORITE_TOPIC')), 'nofollow', 'kicon-button kbuttonuser btn-left', JText::_('COM_KUNENA_BUTTON_FAVORITE_TOPIC_LONG'));
     }
     if ($this->my->id != 0 && $this->config->allowfavorites && $fb_canfavorite == 0) {
         // this user is allowed to unfavorite
         $this->thread_favorite = CKunenaLink::GetTopicPostLink('unfavorite', $this->catid, $this->id, CKunenaTools::showButton('favorite', JText::_('COM_KUNENA_BUTTON_UNFAVORITE_TOPIC')), 'nofollow', 'kicon-button kbuttonuser btn-left', JText::_('COM_KUNENA_BUTTON_UNFAVORITE_TOPIC_LONG'));
     }
     // FINISH: FAVORITES
     if (CKunenaTools::isModerator($this->my->id, $this->catid) || !$this->kunena_forum_locked) {
         //this user is allowed to post a new topic
         $this->thread_new = CKunenaLink::GetPostNewTopicLink($this->catid, CKunenaTools::showButton('newtopic', JText::_('COM_KUNENA_BUTTON_NEW_TOPIC')), 'nofollow', 'kicon-button kbuttoncomm btn-left', JText::_('COM_KUNENA_BUTTON_NEW_TOPIC_LONG'));
     }
     if (CKunenaTools::isModerator($this->my->id, $this->catid)) {
         // offer the moderator always the move link to relocate a topic to another forum
         // and the (un)sticky bit links
         // and the (un)lock links
         if ($this->topicSticky == 0) {
             $this->thread_sticky = CKunenaLink::GetTopicPostLink('sticky', $this->catid, $this->id, CKunenaTools::showButton('sticky', JText::_('COM_KUNENA_BUTTON_STICKY_TOPIC')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_STICKY_TOPIC_LONG'));
         } else {
             $this->thread_sticky = CKunenaLink::GetTopicPostLink('unsticky', $this->catid, $this->id, CKunenaTools::showButton('sticky', JText::_('COM_KUNENA_BUTTON_UNSTICKY_TOPIC')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_UNSTICKY_TOPIC_LONG'));
         }
         if ($this->topicLocked == 0) {
             $this->thread_lock = CKunenaLink::GetTopicPostLink('lock', $this->catid, $this->id, CKunenaTools::showButton('lock', JText::_('COM_KUNENA_BUTTON_LOCK_TOPIC')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_LOCK_TOPIC_LONG'));
         } else {
             $this->thread_lock = CKunenaLink::GetTopicPostLink('unlock', $this->catid, $this->id, CKunenaTools::showButton('lock', JText::_('COM_KUNENA_BUTTON_UNLOCK_TOPIC')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_UNLOCK_TOPIC_LONG'));
         }
         $this->thread_delete = CKunenaLink::GetTopicPostLink('deletethread', $this->catid, $this->id, CKunenaTools::showButton('delete', JText::_('COM_KUNENA_BUTTON_DELETE_TOPIC')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_DELETE_TOPIC_LONG'));
         $this->thread_moderate = CKunenaLink::GetTopicPostReplyLink('moderatethread', $this->catid, $this->id, CKunenaTools::showButton('moderate', JText::_('COM_KUNENA_BUTTON_MODERATE_TOPIC')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_MODERATE'));
     }
     $this->headerdesc = nl2br(smile::smileReplace($this->catinfo->headerdesc, 0, $this->config->disemoticons, $this->emoticons));
     $tabclass = array("row1", "row2");
     $this->mmm = 0;
     $this->replydir = $this->ordering == 'DESC' ? -1 : 1;
     if ($this->replydir < 0) {
         $this->replynum = $this->total_messages - $this->limitstart + 1;
     } else {
         $this->replynum = $this->limitstart;
     }
     $this->myname = $this->config->username ? $this->my->username : $this->my->name;
     $this->allow_anonymous = !empty($this->catinfo->allow_anonymous) && $this->my->id;
     $this->anonymous = $this->allow_anonymous && !empty($this->catinfo->post_anonymous);
 }
Example #18
0
			<?php 
    echo CKunenaLink::GetAnnouncementLink('show', NULL, JText::_('COM_KUNENA_ANN_CPANEL'), JText::_('COM_KUNENA_ANN_CPANEL'));
    ?>
		</div>
		<?php 
}
?>
		<div class="kbody">
			<div class="kanndesc">
				<?php 
if ($this->announcement->showdate > 0) {
    ?>
				<div class="anncreated" title="<?php 
    echo CKunenaTimeformat::showDate($this->announcement->created, 'ago');
    ?>
">
					<?php 
    echo CKunenaTimeformat::showDate($this->announcement->created, 'date_today');
    ?>
				</div>
				<?php 
}
?>
				<div class="anndesc"><?php 
echo !empty($this->announcement->description) ? KunenaParser::parseBBCode($this->announcement->description) : KunenaParser::parseBBCode($this->announcement->sdescription);
?>
</div>
			</div>
		</div>
	</div>
</div>
Example #19
0
            echo CKunenaLink::GetProfileLink(intval($leaf->userid), $useravatar);
            ?>
</span>
					<?php 
        }
        ?>
					<?php 
    }
    ?>
					<!-- /Avatar -->
					<!-- Latest Post -->
					<span class="ktopic-latest-post">
						<?php 
    if ($this->topic_ordering == 'ASC') {
        $threadPages = ceil($leaf->msgcount / $this->config->messages_per_page);
        echo JText::_('COM_KUNENA_GEN_LAST_POST') . ': ' . CKunenaLink::GetThreadPageLink('view', intval($leaf->catid), intval($leaf->thread), $threadPages, intval($this->config->messages_per_page), KunenaParser::parseText($leaf->subject), intval($leaf->msgid));
    } else {
        echo CKunenaLink::GetThreadPageLink('view', intval($leaf->catid), intval($leaf->thread), 1, intval($this->config->messages_per_page), JText::_('COM_KUNENA_GEN_LAST_POST'), intval($leaf->msgid));
    }
    if ($leaf->uname) {
        echo ' ' . JText::_('COM_KUNENA_GEN_BY') . ' ' . CKunenaLink::GetProfileLink(intval($leaf->userid), $this->escape($leaf->uname), '', 'nofollow');
    }
    ?>
					</span>
					<!-- /Latest Post -->
					<br />
					<!-- Latest Post Date -->
					<span class="ktopic-date" title="<?php 
    echo CKunenaTimeformat::showDate($leaf->time, 'config_post_dateformat_hover');
    ?>
">
 /**
  * Display results
  * @param string actionstring
  */
 function show()
 {
     extract($this->params);
     $this->quser = $this->get_searchusername();
     $this->selected = ' selected="selected"';
     $this->checked = ' checked="checked"';
     $this->advsearch_hide = 1;
     if ($this->int_kunena_errornr) {
         $this->advsearch_hide = 0;
     }
     $this->tabclass = array("row1", "row2");
     $searchdatelist = array();
     $searchdatelist[] = JHTML::_('select.option', 'lastvisit', JText::_('COM_KUNENA_SEARCH_DATE_LASTVISIT'));
     $searchdatelist[] = JHTML::_('select.option', '1', JText::_('COM_KUNENA_SEARCH_DATE_YESTERDAY'));
     $searchdatelist[] = JHTML::_('select.option', '7', JText::_('COM_KUNENA_SEARCH_DATE_WEEK'));
     $searchdatelist[] = JHTML::_('select.option', '14', JText::_('COM_KUNENA_SEARCH_DATE_2WEEKS'));
     $searchdatelist[] = JHTML::_('select.option', '30', JText::_('COM_KUNENA_SEARCH_DATE_MONTH'));
     $searchdatelist[] = JHTML::_('select.option', '90', JText::_('COM_KUNENA_SEARCH_DATE_3MONTHS'));
     $searchdatelist[] = JHTML::_('select.option', '180', JText::_('COM_KUNENA_SEARCH_DATE_6MONTHS'));
     $searchdatelist[] = JHTML::_('select.option', '365', JText::_('COM_KUNENA_SEARCH_DATE_YEAR'));
     $searchdatelist[] = JHTML::_('select.option', 'all', JText::_('COM_KUNENA_SEARCH_DATE_ANY'));
     $this->searchdatelist = JHTML::_('select.genericlist', $searchdatelist, 'searchdate', 'class="ks"', 'value', 'text', $this->params['searchdate']);
     $beforeafterlist = array();
     $beforeafterlist[] = JHTML::_('select.option', 'after', JText::_('COM_KUNENA_SEARCH_DATE_NEWER'));
     $beforeafterlist[] = JHTML::_('select.option', 'before', JText::_('COM_KUNENA_SEARCH_DATE_OLDER'));
     $this->beforeafterlist = JHTML::_('select.genericlist', $beforeafterlist, 'beforeafter', 'class="ks"', 'value', 'text', $this->params['beforeafter']);
     $sortbylist = array();
     $sortbylist[] = JHTML::_('select.option', 'title', JText::_('COM_KUNENA_SEARCH_SORTBY_TITLE'));
     //$sortbylist[] 	= JHTML::_('select.option',  'replycount', JText::_('COM_KUNENA_SEARCH_SORTBY_POSTS') );
     $sortbylist[] = JHTML::_('select.option', 'views', JText::_('COM_KUNENA_SEARCH_SORTBY_VIEWS'));
     //$sortbylist[] 	= JHTML::_('select.option',  'threadstart', JText::_('COM_KUNENA_SEARCH_SORTBY_START') );
     $sortbylist[] = JHTML::_('select.option', 'lastpost', JText::_('COM_KUNENA_SEARCH_SORTBY_POST'));
     //$sortbylist[] 	= JHTML::_('select.option',  'postusername', JText::_('COM_KUNENA_SEARCH_SORTBY_USER') );
     $sortbylist[] = JHTML::_('select.option', 'forum', JText::_('COM_KUNENA_SEARCH_SORTBY_FORUM'));
     $this->sortbylist = JHTML::_('select.genericlist', $sortbylist, 'sortby', 'class="ks"', 'value', 'text', $this->params['sortby']);
     $limitlist = array();
     $limitlist[] = JHTML::_('select.option', '5', JText::_('COM_KUNENA_SEARCH_LIMIT5'));
     $limitlist[] = JHTML::_('select.option', '10', JText::_('COM_KUNENA_SEARCH_LIMIT10'));
     $limitlist[] = JHTML::_('select.option', '15', JText::_('COM_KUNENA_SEARCH_LIMIT15'));
     $limitlist[] = JHTML::_('select.option', '20', JText::_('COM_KUNENA_SEARCH_LIMIT20'));
     $this->limitlist = JHTML::_('select.genericlist', $limitlist, 'limit', 'class="ks"', 'value', 'text', $this->limit);
     //category select list
     $options = array();
     $options[] = JHTML::_('select.option', '0', JText::_('COM_KUNENA_SEARCH_SEARCHIN_ALLCATS'));
     $this->categorylist = CKunenaTools::forumSelectList('searchlist', explode(',', $this->params['catids']), $options, 'class="inputbox" size="8" multiple="multiple"', true);
     CKunenaTools::loadTemplate('/search/advsearch.php');
     $this->results = $this->get_results();
     $this->pagination = $this->getPagination($this->func, $this->q, $this->getUrlParams(), floor($this->limitstart / $this->limit) + 1, $this->limit, floor($this->total / $this->limit) + 1, 7);
     if (defined('KUNENA_DEBUG')) {
         echo '<p style="background-color:#FFFFCC;border:1px solid red;">' . $this->str_kunena_errormsg . '</p>';
     }
     $searchlist = $this->get_searchstrings();
     foreach ($this->results as $i => $result) {
         // Clean up subject
         $ressubject = KunenaParser::parseText($result->subject);
         // Strip smiles and bbcode out of search results; they look ugly
         $resmessage = KunenaParser::parseBBCode($result->message);
         foreach ($searchlist as $searchword) {
             if (empty($searchword)) {
                 continue;
             }
             $ressubject = preg_replace("/" . preg_quote($searchword, '/') . "/iu", '<span  class="searchword" >' . $searchword . '</span>', $ressubject);
             // FIXME: enable highlighting, but only after we can be sure that we do not break html
             //$resmessage = preg_replace ( "/" . preg_quote ( $searchword, '/' ) . "/iu", '<span  class="searchword" >' . $searchword . '</span>', $resmessage );
         }
         $this->results[$i]->htmlsubject = $ressubject;
         $this->results[$i]->htmlmessage = $resmessage;
     }
     CKunenaTools::loadTemplate('/search/search.php');
 }
Example #21
0
function decodeHTML($string)
{
    require_once JPATH_ADMINISTRATOR . '/components/com_kunena/libraries/html/parser.php';
    $string = KunenaParser::parseBBCode($string);
    return $string;
}
Example #22
0
<div class="kblock">
	<div class="kheader">
		<span class="ktoggler"><a class="ktoggler close" title="<?php 
    echo JText::_('COM_KUNENA_TOGGLER_COLLAPSE');
    ?>
" rel="frontstats_tbody"></a></span>
		<h2><span><?php 
    echo JText::_('COM_KUNENA_FORUM_HEADER');
    ?>
</span></h2>
	</div>
	<div class="kcontainer" id="frontstats_tbody">
		<div class="kbody">
			<div class="kfheadercontent">
				<?php 
    echo KunenaParser::parseBBCode($this->headerdesc);
    ?>
			</div>
		</div>
	</div>
</div>
<?php 
}
?>

<!-- B: List Actions -->
<table class="klist-actions">
	<tr>
		<td class="klist-actions-goto">
			<a name="forumtop"> </a>
			<?php 
Example #23
0
 function stripBBCode($txt, $len = 0)
 {
     user_error(__CLASS__ . '::' . __FUNCTION__ . '(): Deprecated', E_USER_NOTICE);
     kimport('html.parser');
     return KunenaParser::stripBBCode($txt, $len);
 }
Example #24
0
        ?>
		<tr class="krow<?php 
        echo $k;
        ?>
">
			<td class="kcol-first kcol-annid"><?php 
        echo intval($ann->id);
        ?>
</td>
			<td class="kcol-mid kcol-anndate"><?php 
        echo CKunenaTimeformat::showDate($ann->created, 'date_today');
        ?>
</td>
			<td class="kcol-mid kcol-anntitle">
				<div class="overflow"><?php 
        echo CKunenaLink::GetAnnouncementLink('read', intval($ann->id), KunenaParser::parseText($ann->title), KunenaParser::parseText($ann->title), 'follow');
        ?>
</div>
			</td>
			<?php 
        if ($this->canEdit) {
            ?>
			<td class="kcol-mid kcol-annpublish">
				<?php 
            if ($ann->published > 0) {
                echo JText::_('COM_KUNENA_ANN_PUBLISHED');
            } else {
                echo JText::_('COM_KUNENA_ANN_UNPUBLISHED');
            }
            ?>
			</td>
 public function emailToSubscribers($LastPostUrl = false, $mailsubs = false, $mailmods = false, $mailadmins = false)
 {
     if ($LastPostUrl === false) {
         jimport('joomla.environment.uri');
         $uri = JURI::getInstance(JURI::base());
         $LastPostUrl = $uri->toString(array('scheme', 'host', 'port')) . CKunenaLink::GetMessageURL($this->get('id'), $this->get('catid'), 0, false);
     }
     $once = false;
     if ($mailsubs) {
         if (!$this->get('parent')) {
             // New topic: Send email only to category subscribers
             $mailsubs = $this->_config->category_subscriptions != 'disabled' ? 3 : 0;
             $once = $this->_config->category_subscriptions == 'topic';
         } elseif ($this->_config->category_subscriptions != 'post') {
             // Existing topic: Send email only to topic subscribers
             $mailsubs = $this->_config->topic_subscriptions != 'disabled' ? 2 : 0;
             $once = $this->_config->topic_subscriptions == 'first';
         } else {
             // Existing topic: Send email to both category and topic subscribers
             $mailsubs = $this->_config->topic_subscriptions == 'disabled' ? 3 : 1;
             // FIXME: category subcription can override topic
             $once = $this->_config->topic_subscriptions == 'first';
         }
     }
     // Fetch all subscribers, moderators and admins who will get the email
     $emailToList = CKunenaTools::getEMailToList($this->get('catid'), $this->get('thread'), $mailsubs, $mailmods, $mailadmins, $this->_my->id);
     if (count($emailToList)) {
         jimport('joomla.mail.helper');
         kimport('html.parser');
         if (!$this->_config->email) {
             KunenaError::warning(JText::_('COM_KUNENA_EMAIL_DISABLED'));
             return false;
         } else {
             if (!JMailHelper::isEmailAddress($this->_config->email)) {
                 KunenaError::warning(JText::_('COM_KUNENA_EMAIL_INVALID'));
                 return false;
             }
         }
         // clean up the message for review
         $authorname = $this->get('name');
         $message = KunenaParser::stripBBCode($this->get('message'), 0, false);
         $subject = $this->get('subject');
         $topicsubject = $this->parent->subject ? $this->parent->subject : $subject;
         $mailsender = JMailHelper::cleanAddress($this->_config->board_title);
         $mailsubject = JMailHelper::cleanSubject("[" . $this->_config->board_title . "] " . $topicsubject . " (" . $this->parent->catname . ")");
         // Make a list from all receivers
         $sentusers = array();
         $receivers = array(0 => array(), 1 => array());
         foreach ($emailToList as $emailTo) {
             if (!$emailTo->email || !JMailHelper::isEmailAddress($emailTo->email)) {
                 continue;
             }
             $receivers[$emailTo->subscription][] = $emailTo->email;
             $sentusers[] = $emailTo->id;
         }
         // Create email
         $mail = JFactory::getMailer();
         $mail->setSubject($mailsubject);
         $mail->setSender(array($this->_config->email, $mailsender));
         // Send email to all subscribers
         $mail->setBody($this->createEmailBody(1, $subject, $authorname, $LastPostUrl, $message, $once));
         $this->sendEmail($mail, $receivers[1]);
         // Send email to all moderators
         $mail->setBody($this->createEmailBody(0, $subject, $authorname, $LastPostUrl, $message, $once));
         $this->sendEmail($mail, $receivers[0]);
         // Update subscriptions
         if ($once && $sentusers) {
             $sentusers = implode(',', $sentusers);
             $db = JFactory::getDBO();
             $query = "UPDATE #__kunena_subscriptions\n\t\t\t\t\tSET future1=1 WHERE thread={$this->get('thread')} AND userid IN ({$sentusers})";
             $db->setQuery($query);
             $db->query();
             KunenaError::checkDatabaseError();
         }
     }
 }
Example #26
0
<a href="http://<?php 
echo $this->escape($this->profile->websiteurl);
?>
" target="_blank"><?php 
echo KunenaParser::parseText($this->profile->websitename);
?>
</a></li>
		</ul>
	</div>
	<div class="kprofile-rightcol1">
		<h4><?php 
echo JText::_('COM_KUNENA_MYPROFILE_SIGNATURE');
?>
</h4>
		<div class="kmsgsignature"><div><?php 
echo KunenaParser::parseBBCode($this->signature);
?>
</div></div>
	</div>

</div>

<div class="clrline"></div>

<div id="kprofile-tabs">
	<dl class="tabs">
		<?php 
if (CKunenaTools::isModerator($this->my->id)) {
    ?>
		<dt class="open" title="<?php 
    echo JText::_('COM_KUNENA_MESSAGE_ADMINISTRATION');
Example #27
0
        $threadPages = ceil($message->msgcount / $this->config->messages_per_page);
        $unreadPage = ceil($curMessageNo / $this->config->messages_per_page);
        if ($message->attachments) {
            echo CKunenaTools::showIcon('ktopicattach', JText::_('COM_KUNENA_ATTACH'));
        }
        ?>
				<div class="ktopic-title-cover">
					<?php 
        echo CKunenaLink::GetThreadLink('view', intval($message->catid), intval($message->id), KunenaParser::parseText($message->subject, 30), KunenaParser::stripBBCode($message->message), 'follow', 'ktopic-title km');
        ?>
				</div>
			</td>

			<td class="kcol-mid ktopictittle">
				<?php 
        echo CKunenaLink::GetThreadLink('view', intval($firstpost->catid), intval($firstpost->id), KunenaParser::parseText($firstpost->subject, 20), KunenaParser::stripBBCode($firstpost->message), 'follow', 'ktopic-title km');
        ?>
				<?php 
        if ($message->favcount) {
            if ($message->myfavorite) {
                echo CKunenaTools::showIcon('kfavoritestar', JText::_('COM_KUNENA_FAVORITE'));
            } else {
                echo CKunenaTools::showIcon('kfavoritestar-grey', JText::_('COM_KUNENA_FAVORITE'));
            }
        }
        ?>
				<?php 
        if ($message->unread) {
            echo CKunenaLink::GetThreadPageLink('view', intval($message->catid), intval($message->id), $unreadPage, intval($this->config->messages_per_page), '<sup class="knewchar">&nbsp;(' . intval($message->unread) . ' ' . JText::_('COM_KUNENA_A_GEN_NEWCHAR') . ')</sup>', intval($message->lastread));
        }
        if ($message->locked != 0) {
        ?>
				<span class="kpost-userposts"><?php 
        echo JText::_('COM_KUNENA_AUP_POINTS') . intval($this->userpoints);
        ?>
</span>
			<?php 
    }
    ?>
			</div>
		</li>
		<?php 
    if ($this->personaltext) {
        ?>
		<li class="kpost-personal">
			<?php 
        echo KunenaParser::parseText($this->personaltext);
        ?>
		</li>
		<?php 
    }
    ?>
		<?php 
}
?>
		<?php 
if ($this->avatar) {
    ?>
		<li class="kpost-avatar">
		<?php 
    echo CKunenaLink::GetProfileLink(intval($this->profile->userid), $this->avatar);
    ?>
 function getAnnouncement($id = 0, $mode = 0)
 {
     if ($mode) {
         $published = "AND published='1'";
     } else {
         $published = "";
     }
     if (!$id) {
         $query = "SELECT * FROM #__kunena_announcement WHERE published='1' ORDER BY created DESC";
     } else {
         $query = "SELECT * FROM #__kunena_announcement WHERE id={$this->db->Quote($id)} {$published}";
     }
     $this->db->setQuery($query, 0, 1);
     $announcement = $this->db->loadObject();
     if (KunenaError::checkDatabaseError()) {
         return;
     }
     if (!$announcement) {
         return;
     }
     // TODO: deprecated
     $this->id = $announcement->id;
     $this->title = KunenaParser::parseText($announcement->title);
     $this->sdescription = KunenaParser::parseBBCode($announcement->sdescription);
     $this->description = KunenaParser::parseBBCode($announcement->description);
     $this->created = $announcement->created;
     $this->published = $announcement->published;
     $this->showdate = $announcement->showdate;
     // end deprecated
     $this->announcement = $announcement;
 }
Example #30
0
					<?php 
        foreach ($this->toptitles as $toptitle) {
            $k = 1 - $k;
            if ($toptitle->hits == $this->toptitlehits) {
                $barwidth = 100;
            } else {
                $barwidth = round($toptitle->hits * 100 / $this->toptitlehits);
            }
            ?>
					<tr class = "k<?php 
            echo $this->escape($tabclass[$k]);
            ?>
">
						<td class="kcol-first">
							<?php 
            echo CKunenaLink::GetThreadLink('view', intval($toptitle->catid), intval($toptitle->id), KunenaParser::parseText($toptitle->subject), '');
            ?>
						</td>
						<td class="kcol-mid">
							<img class = "kstats-bar" src = "<?php 
            echo KUNENA_TMPLTMAINIMGURL . 'images/bar.png';
            ?>
" alt = "" height = "10" width = "<?php 
            echo intval($barwidth);
            ?>
%" />
						</td>
						<td class="kcol-last">
							<?php 
            echo intval($toptitle->hits);
            ?>