Exemplo n.º 1
0
 public static function ajaxUrlDecode($string)
 {
     $rawStr = urldecode(rawurldecode($string));
     if (function_exists('html_entity_decode')) {
         return html_entity_decode($rawStr);
     } else {
         return DiscussStringHelper::unhtmlentities($rawStr);
     }
 }
Exemplo n.º 2
0
 public function ajaxSubmitEmail($data)
 {
     $my = JFactory::getUser();
     $djax = new Disjax();
     $post = DiscussStringHelper::ajaxPostToArray($data);
     if ($my->id == 0) {
         $djax->alert(JText::_('COM_EASYDISCUSS_YOU_DO_NOT_HAVE_PERMISION_TO_SUBMIT_REPORT'), JText::_('ERROR'), '450', 'auto');
         $djax->send();
         return;
     }
     // Load language files from front end.
     JFactory::getLanguage()->load('com_easydiscuss', JPATH_ROOT);
     if (empty($post['post_id'])) {
         $djax->alert(JText::_('COM_EASYDISCUSS_INVALID_POST_ID'), JText::_('ERROR'), '450', 'auto');
         $djax->send();
         return;
     }
     $postId = (int) $post['post_id'];
     $emailContent = $post['content'];
     // Prepare email data
     $postTbl = JTable::getInstance('posts', 'Discuss');
     $postTbl->load($postId);
     $moderator = DiscussHelper::getTable('Profile');
     $moderator->load($my->id);
     $creator = JFactory::getUser($postTbl->user_id);
     $date = DiscussHelper::getDate($postTbl->created);
     $emailData = array();
     $emailData['postAuthor'] = $moderator->getName();
     $emailData['postAuthorAvatar'] = $moderator->getAvatar();
     $emailData['postDate'] = $date->toFormat();
     $emailData['postLink'] = JURI::root() . 'index.php?option=com_easydiscuss&view=post&id=' . $postTbl->id;
     $emailData['postTitle'] = $postTbl->title;
     $emailData['messages'] = $emailContent;
     if (!empty($postTbl->parent_id)) {
         $parentTbl = JTable::getInstance('posts', 'Discuss');
         $parentTbl->load($postTbl->parent_id);
         $emailData['postTitle'] = $parentTbl->title;
         $emailData['postLink'] = JURI::root() . 'index.php?option=com_easydiscuss&view=post&id=' . $parentTbl->id;
     }
     $noti = DiscussHelper::getNotification();
     $noti->addQueue($creator->email, JText::sprintf('COM_EASYDISCUSS_REQUIRED_YOUR_ATTENTION', $emailData['postTitle']), '', 'email.report.attention.php', $emailData);
     $djax->assign('report-entry-msg-' . $postId, JText::_('COM_EASYDISCUSS_EMAIL_SENT_TO_AUTHOR'));
     $djax->script('admin.reports.revertEmailForm("' . $postId . '");');
     $djax->send();
     return;
 }
echo JText::_('COM_EASYDISCUSS_BUTTON_CANCEL');
?>
</a>
						</div>
						<div class="pull-right">
							<input type="submit" name="submit-reply" class="btn btn-primary btn-medium submit-reply" value="<?php 
echo JText::_('COM_EASYDISCUSS_BUTTON_SAVE');
?>
" />
						</div>

						<div class="pull-right reply-loading"></div>
					</div>

					<input type="hidden" name="title" value="Re: <?php 
echo DiscussStringHelper::escape($parent->title);
?>
" />
					<input type="hidden" name="post_id" value="<?php 
echo $post->id;
?>
" />
					<input type="hidden" name="parent_id" value="<?php 
echo $parent->id;
?>
" />
					<input type="hidden" name="parent_catid" value="<?php 
echo $parent->category_id;
?>
" />
					<input type="hidden" name="user_type" value="<?php 
Exemplo n.º 4
0
 public function tab()
 {
     // always reset the limitstart.
     JRequest::setVar('limitstart', 0);
     $type = JRequest::getVar('type');
     $profileId = JRequest::getVar('id');
     $ajax = DiscussHelper::getHelper('ajax');
     $model = DiscussHelper::getModel('Posts');
     $tagsModel = DiscussHelper::getModel('Tags');
     $config = DiscussHelper::getConfig();
     $template = new DiscussThemes();
     $html = '';
     $pagination = null;
     switch ($type) {
         case 'tags':
             $tags = $tagsModel->getTagCloud('', '', '', $profileId);
             $template->set('tags', $tags);
             $html = $template->fetch('profile.tags.php');
             break;
         case 'questions':
             $posts = $model->getPostsBy('user', $profileId);
             $posts = DiscussHelper::formatPost($posts);
             $pagination = $model->getPagination();
             $template->set('posts', $posts);
             $html = $template->fetch('profile.questions.php');
             break;
         case 'unresolved':
             $posts = $model->getUnresolvedFromUser($profileId);
             $posts = DiscussHelper::formatPost($posts);
             $pagination = $model->getPagination();
             $posts = Discusshelper::getPostStatusAndTypes($posts);
             $template->set('posts', $posts);
             $html = $template->fetch('profile.unresolved.php');
             break;
         case 'favourites':
             if (!$config->get('main_favorite')) {
                 return false;
             }
             $posts = $model->getData(true, 'latest', null, 'favourites', '', null, 'all', $profileId);
             $posts = DiscussHelper::formatPost($posts);
             $posts = Discusshelper::getPostStatusAndTypes($posts);
             $template->set('posts', $posts);
             $html = $template->fetch('profile.favourites.php');
             break;
         case 'replies':
             $posts = $model->getRepliesFromUser($profileId);
             $posts = DiscussHelper::formatPost($posts);
             $pagination = $model->getPagination();
             $posts = Discusshelper::getPostStatusAndTypes($posts);
             $template->set('posts', $posts);
             $html = $template->fetch('profile.replies.php');
             break;
         case 'tabEasyBlog':
             $helperFile = JPATH_ROOT . '/components/com_easyblog/helpers/helper.php';
             if (!JFile::exists($helperFile)) {
                 $html = JText::_('COM_EASYDISCUSS_EASYBLOG_DOES_NOT_EXIST');
             } else {
                 require_once $helperFile;
                 require_once JPATH_ROOT . '/components/com_easyblog/router.php';
                 $blogModel = EasyBlogHelper::getModel('Blog');
                 $blogs = $blogModel->getBlogsBy('blogger', $profileId);
                 $blogs = EasyBlogHelper::formatBlog($blogs);
                 $ebConfig = EasyBlogHelper::getConfig();
                 $user = JFactory::getUser($profileId);
                 $template->set('user', $user);
                 $template->set('ebConfig', $ebConfig);
                 $template->set('blogs', $blogs);
                 // Load EasyBlog's language file
                 JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
                 $html = $template->fetch('profile.blogs.php');
             }
             break;
         case 'tabKomento':
             $helperFile = JPATH_ROOT . '/components/com_komento/helpers/helper.php';
             if (!JFile::exists($helperFile)) {
                 $html = JText::_('COM_EASYDISCUSS_KOMENTO_DOES_NOT_EXIST');
             } else {
                 require_once $helperFile;
                 $commentsModel = Komento::getModel('comments');
                 $commentHelper = Komento::getHelper('comment');
                 $options = array('sort' => 'latest', 'userid' => $profileId, 'threaded' => 0);
                 $comments = $commentsModel->getComments('all', 'all', $options);
                 foreach ($comments as &$comment) {
                     $comment = $commentHelper->process($comment);
                 }
                 $feedUrl = Komento::getHelper('router')->getFeedUrl('all', 'all', $profileId);
                 JFactory::getLanguage()->load('com_komento', JPATH_ROOT);
                 $template->set('feedUrl', $feedUrl);
                 $template->set('comments', $comments);
                 $html = $template->fetch('profile.comments.php');
             }
             break;
         case 'subscriptions':
             $subModel = DiscussHelper::getModel('subscribe');
             $rows = $subModel->getSubscriptions();
             $subs = array();
             if ($rows) {
                 foreach ($rows as $row) {
                     $obj = new stdClass();
                     $obj->id = $row->id;
                     $obj->type = $row->type;
                     $obj->unsublink = Discusshelper::getUnsubscribeLink($row, false);
                     switch ($row->type) {
                         case 'site':
                             $obj->title = '';
                             $obj->link = '';
                             break;
                         case 'post':
                             $post = DiscussHelper::getTable('Post');
                             $post->load($row->cid);
                             $obj->title = $post->title;
                             $obj->link = DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id);
                             break;
                         case 'category':
                             $category = DiscussHelper::getTable('Category');
                             $category->load($row->cid);
                             $obj->title = $category->title;
                             $obj->link = DiscussRouter::getCategoryRoute($category->id);
                             break;
                         case 'user':
                             $profile = DiscussHelper::getTable('Profile');
                             $profile->load($row->cid);
                             $obj->title = $profile->getName();
                             $obj->link = $profile->getLink();
                             break;
                         default:
                             unset($obj);
                             break;
                     }
                     if (!empty($obj)) {
                         $obj->title = DiscussStringHelper::escape($obj->title);
                         $subs[$row->type][] = $obj;
                         unset($obj);
                     }
                 }
             }
             $template->set('subscriptions', $subs);
             $html = $template->fetch('profile.subscriptions.php');
             break;
         default:
             break;
     }
     if ($pagination) {
         $filterArr = array();
         $filterArr['viewtype'] = $type;
         $filterArr['id'] = $profileId;
         $pagination = $pagination->getPagesLinks('profile', $filterArr, true);
     }
     $ajax->success($html, $pagination);
     $ajax->send();
 }
Exemplo n.º 5
0
		<?php 
    }
    ?>
		<?php 
}
?>
	</aside>




	<article>
		<header>
			<h2 style="margin: 0 0 5px;">
				<?php 
echo DiscussStringHelper::escape($profile->getName());
?>
			</h2>

			<?php 
if ($system->config->get('layout_profile_roles') && $profile->getRole()) {
    ?>
			<span><?php 
    echo $this->escape($profile->getRole());
    ?>
</span>
			<?php 
}
?>

			
Exemplo n.º 6
0
$useAvatarResize = empty($avatarSize) ? '' : ' style="width: ' . $avatarSize . 'px;" ';
?>
<div class="discuss-mod recent-discussions<?php 
echo $params->get('moduleclass_sfx');
?>
">
<?php 
if ($posts) {
    ?>
	<div class="list-item">
		<?php 
    foreach ($posts as $post) {
        ?>

		<?php 
        $post_content = JString::substr(DiscussStringHelper::escape(strip_tags($post->content)), 0, $params->get('max_content')) . '...';
        $post_title = JString::strlen($post->title) > $params->get('max_title', 50) ? JString::substr($post->title, 0, $params->get('max_title', 50)) . '...' : $post->title;
        ?>
		<div class="item">
			<div class="story">
				<div class="item-user">

					<?php 
        if ($params->get('show_avatar', 1)) {
            ?>
					<a class="item-avatar float-l" href="<?php 
            echo $post->profile->getLink();
            ?>
">
						<img class="avatar" src="<?php 
            echo $post->profile->getAvatar();
Exemplo n.º 7
0
 public function bind($post, $isPost = false)
 {
     parent::bind($post);
     if ($isPost) {
         $date = DiscussHelper::getDate();
         jimport('joomla.filter.filterinput');
         $filter = JFilterInput::getInstance();
         //replace a url to link
         $comment = $filter->clean($post->comment);
         $comment = DiscussStringHelper::url2link($comment);
         $this->comment = $comment;
         $this->name = $filter->clean($post->name);
         $this->email = $filter->clean($post->email);
         $this->created = $date->toMySQL();
         $this->modified = $date->toMySQL();
         $this->published = '1';
     }
     return true;
 }
Exemplo n.º 8
0
			</a>
			<a href="javascript:void(0);" class="hide-item" data-id="<?php 
    echo $category->id;
    ?>
" data-hide-child>
				<i class="icon-sort-up"></i>
			</a>
			<?php 
}
?>

			<a class="item-title bold" href="<?php 
echo DiscussRouter::_('index.php?option=com_easydiscuss&view=categories&layout=listings&category_id=' . $category->id);
?>
"><?php 
echo DiscussStringHelper::escape($category->title);
?>
</a>

			<?php 
if ($params->get('showpostcnt', true)) {
    ?>
				<div class="item-meta small"><?php 
    echo JText::sprintf('MOD_DISCUSSIONSCATEGORIES_COUNT', (int) $category->discussioncount);
    ?>
</div>
			<?php 
}
?>
		</div>
		<div style="clear:both;"></div>
Exemplo n.º 9
0
?>
">
	<?php 
if (!empty($tagcloud)) {
    ?>
		<?php 
    foreach ($tagcloud as $tag) {
        ?>
		<a	style="font-size: <?php 
        echo floor($tag->fontsize);
        ?>
px;" class="tag-cloud" href="<?php 
        echo DiscussRouter::getTagRoute($tag->id);
        ?>
"><?php 
        echo DiscussStringHelper::escape($tag->title);
        ?>
</a>
		<?php 
    }
    ?>
	<?php 
} else {
    ?>
		<?php 
    echo JText::_('MOD_EASYDISCUSSTAGCLOUD_NO_TAG');
    ?>
	<?php 
}
?>
</div>