/** * Retrieves the profile link * * @since 5.0 * @access public * @param string * @return */ public function getLink() { if (!EB::easydiscuss()->exists()) { return parent::getLink(); } $link = DiscussRouter::_('index.php?option=com_easydiscuss&view=profile&id=' . $this->profile->id, false); return $link; }
public function getFeedURL($url, $atom = false) { require_once DISCUSS_HELPERS . '/router.php'; $sef = DiscussRouter::isSefEnabled(); $join = $sef ? '?' : '&'; $url = DiscussRouter::_($url) . $join . 'format=feed'; $url .= $atom ? '&type=atom' : '&type=rss'; return $url; }
/** * Converts a comment into a discussion reply * * @since 1.0 * @access public * @param string * @return */ public function convert() { JRequest::checkToken('request') or jexit('Invalid Token'); // Get the Joomla app $app = JFactory::getApplication(); // Get the comment id from the request. $id = JRequest::getInt('id'); // Load the comment $comment = DiscussHelper::getTable('Comment'); $comment->load($id); if (!$id || !$comment->id) { // Throw error here. DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_INVALID_COMMENT_ID_PROVIDED'), DISCUSS_QUEUE_ERROR); $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false)); $app->close(); } // Get the post id from the request. $postId = JRequest::getInt('postId'); $post = DiscussHelper::getTable('Post'); $post->load($postId); if (!$postId || !$post->id) { // Throw error here. DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_INVALID_POST_ID_PROVIDED'), DISCUSS_QUEUE_ERROR); $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false)); $app->close(); } if (!$comment->canConvert()) { // Throw error here. DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_NOT_ALLOWED_TO_CONVERT'), DISCUSS_QUEUE_ERROR); $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false)); $app->close(); } // Create a new reply. $reply = DiscussHelper::getTable('Post'); $reply->title = $post->title; $reply->content = $comment->comment; $reply->published = 1; $reply->created = $comment->created; $reply->parent_id = $post->id; $reply->user_id = $comment->user_id; $reply->user_type = 'member'; $reply->category_id = $post->category_id; $state = $reply->store(); if (!$state) { // Throw error here. DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_ERROR_SAVING_REPLY'), DISCUSS_QUEUE_ERROR); $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false)); $app->close(); } // Once the reply is stored, delete the comment $comment->delete(); DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_SUCCESS_CONVERTED_COMMENT_TO_REPLY'), DISCUSS_QUEUE_SUCCESS); $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false)); $app->close(); }
/** * Allows user to mark all their notification items as read **/ public function markreadall() { $my = JFactory::getUser(); if (!$my->id) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_PLEASE_LOGIN_FIRST'), 'error'); JFactory::getApplication()->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false)); } $db = DiscussHelper::getDBO(); $query = 'UPDATE ' . $db->nameQuote('#__discuss_notifications') . ' ' . 'SET ' . $db->nameQuote('state') . '=' . $db->Quote(0) . ' ' . 'WHERE ' . $db->nameQuote('target') . '=' . $db->Quote($my->id); $db->setQuery($query); $db->Query(); DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_ALL_NOTIFICATIONS_MARKED_AS_READ')); JFactory::getApplication()->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=notifications', false)); }
function display($tmpl = null) { $config = DiscussHelper::getConfig(); if (!$config->get('main_rss')) { return; } $userid = JRequest::getInt('id', null); $user = JFactory::getUser($userid); $document = JFactory::getDocument(); $document->link = DiscussRouter::_('index.php?option=com_easydiscuss&view=profile&id=' . $user->id); $profile = DiscussHelper::getTable('Profile'); $profile->load($user->id); $document->setTitle($profile->getName()); $document->setDescription($profile->getDescription()); $jConfig = DiscussHelper::getJConfig(); $model = $this->getModel('Posts'); $posts = $model->getPostsBy('user', $profile->id); $posts = DiscussHelper::formatPost($posts); foreach ($posts as $row) { // Assign to feed item $title = $this->escape($row->title); $title = html_entity_decode($title); // load individual item creator class $item = new JFeedItem(); $item->title = $title; $item->link = JRoute::_('index.php?option=com_easydiscuss&view=post&id=' . $row->id); $item->description = $row->content; $item->date = DiscussHelper::getDate($row->created)->toMySQL(); if (!empty($row->tags)) { $tagData = array(); foreach ($row->tags as $tag) { $tagData[] = '<a href="' . JRoute::_('index.php?option=com_easydiscuss&view=tags&id=' . $tag->id) . '">' . $tag->title . '</a>'; } $row->tags = implode(', ', $tagData); } else { $row->tags = ''; } $item->category = $row->tags; $item->author = $row->user->getName(); if ($jConfig->get('feed_email') != 'none') { if ($jConfig->get('feed_email') == 'author') { $item->authorEmail = $row->user->email; } else { $item->authorEmail = $jConfig->get('mailfrom'); } } $document->addItem($item); } }
public function display($tpl = null) { $my = JFactory::getUser(); if (!$my->id) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_PLEASE_LOGIN_FIRST'), 'error'); JFactory::getApplication()->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false)); } $model = $this->getModel('Notification'); $this->setPathway(JText::_('COM_EASYDISCUSS_BREADCRUMBS_NOTIFICATIONS')); // Make this configurable? $limit = 100; $notifications = $model->getNotifications($my->id, false, $limit); DiscussHelper::getHelper('Notifications')->format($notifications, true); $theme = new DiscussThemes(); $theme->set('notifications', $notifications); echo $theme->fetch('notifications.php'); }
function removeAccess() { $mainframe = JFactory::getApplication(); $user = JFactory::getUser(); $return = DiscussRouter::_('index.php?option=com_easydiscuss&view=profile', false); if ($user->id == 0) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_TWITTER_USER_NOT_FOUND'), 'error'); $this->setRedirect($return); } $twitter = DiscussHelper::getTable('Twitter'); if (!$twitter->load($user->id)) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_TWITTER_OAUTH_DOESNT_EXIST'), 'error'); $this->setRedirect($return); } $twitter->delete(); DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_TWITTER_REQUIRE_AUTHENTICATION')); $this->setRedirect($return); }
function display($tpl = null) { $config = DiscussHelper::getConfig(); $app = JFactory::getApplication(); if (!$config->get('main_favorite')) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_FEATURE_IS_DISABLED'), DISCUSS_QUEUE_ERROR); $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false)); $app->close(); } DiscussHelper::setPageTitle(JText::_('COM_EASYDISCUSS_FAVOURITES_TITLE')); // @task: Add view $this->logView(); DiscussHelper::setMeta(); $postModel = DiscussHelper::getModel('Posts'); $posts = $postModel->getData(true, 'latest', null, 'favourites'); $posts = DiscussHelper::formatPost($posts); $theme = new DiscussThemes(); $theme->set('posts', $posts); echo $theme->fetch('favourites.php'); }
public function listings() { $app = JFactory::getApplication(); $config = DiscussHelper::getConfig(); $id = JRequest::getInt('id'); if (empty($id)) { $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=badges', false), JText::_('COM_EASYDISCUSS_INVALID_BADGE')); $app->close(); } $badge = DiscussHelper::getTable('Badges'); $badge->load($id); $this->setPathway(JText::_('COM_EASYDISCUSS_BADGES'), DiscussRouter::_('index.php?option=com_easydiscuss&view=badges')); $this->setPathway(JText::_($badge->get('title'))); DiscussHelper::setPageTitle(JText::sprintf('COM_EASYDISCUSS_VIEWING_BADGE_TITLE', $this->escape($badge->title))); $users = $badge->getUsers(); $theme = new DiscussThemes(); $theme->set('badge', $badge); $theme->set('users', $users); echo $theme->fetch('badge.php'); }
* to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ defined('_JEXEC') or die('Restricted access'); ?> <div class="fd-cf"> <h2 class="discuss-component-title pull-left"><?php echo JText::_('COM_EASYDISCUSS_MEMBERS'); ?> </h2> <div class="discuss-users-search-wrap pull-right"> <div class="input-append"> <form name="discuss-users-search" method="GET" action="<?php echo DiscussRouter::_('index.php?option=com_easydiscuss&view=users'); ?> " style="margin:0;"> <input type="text" class="input-large" placeholder="<?php echo JText::_('COM_EASYDISCUSS_USERS_SEARCH_PLACEHOLDER'); ?> " name="userQuery" value="<?php echo DiscussHelper::getHelper('String')->escape($userQuery) ? DiscussHelper::getHelper('String')->escape($userQuery) : ''; ?> " /> <input type="hidden" name="option" value="com_easydiscuss" /> <input type="hidden" name="view" value="users" /> <button class="btn btn-searchbar"><?php echo JText::_('COM_EASYDISCUSS_SEARCH_BUTTON'); ?> </button>
public function getURL($raw = false, $xhtml = false) { $url = 'index.php?option=com_easydiscuss&view=profile&id=' . $this->id; $url = $raw ? $url : DiscussRouter::_($url, $xhtml); return $url; }
<a class="btn-small" href="<?php echo DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id . '&sort=latest'); ?> #filter-sort"> <?php echo JText::_('COM_EASYDISCUSS_SORT_LATEST'); ?> </a> </li> <li class="<?php echo $sort == 'oldest' || $sort == 'replylatest' ? 'active' : ''; ?> sortItem secondary-nav"> <a class="btn-small" href="<?php echo DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id . '&sort=oldest'); ?> #filter-sort"> <?php echo JText::_('COM_EASYDISCUSS_SORT_OLDEST'); ?> </a> </li> </ul> </div> <?php echo DiscussHelper::renderModule('easydiscuss-before-replies'); ?> <ul class="unstyled discuss-list clearfix discussionReplies"> <?php
?> "><?php echo JText::_('COM_EASYDISCUSS_SEE_ALL'); ?> </a> </div> </div> </li> </ul> <?php } else { ?> <a class="messageLink" href="<?php echo DiscussRouter::_('index.php?option=com_easydiscuss&view=conversation'); ?> "> <i class="icon-envelope-alt"></i> <span class="label label-notification" id="conversation-count" style="display: <?php echo $totalMessages > 0 ? 'inline-block' : 'none'; ?> "><?php echo $totalMessages; ?> </span> </a> <?php } ?>
public function edit($tpl = null) { $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $my = JFactory::getUser(); $acl = DiscussHelper::getHelper('ACL'); $config = DiscussHelper::getConfig(); // Load post item $id = JRequest::getInt('id', 0); if (empty($id)) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_INVALID_POST_ID')); return; } $post = DiscussHelper::getTable('Post'); $post->load($id); $post->content_raw = $post->content; $editing = (bool) $post->id; if (!$editing) { // try to get from session if there are any. $this->getSessionData($post); } $categoryId = JRequest::getInt('category', $post->category_id); // Load category item. $category = DiscussHelper::getTable('Category'); $category->load($categoryId); // Check if user is allowed to post a discussion, we also need to check against the category acl if (empty($my->id) && !$acl->allowed('add_question', 0)) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_PLEASE_KINDLY_LOGIN_TO_CREATE_A_POST')); $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=index', false)); $app->close(); return; } if ($my->id != 0 && !$acl->allowed('add_question', '0') && !$category->canPost()) { $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=index', false), JText::_('COM_EASYDISCUSS_SYSTEM_INSUFFICIENT_PERMISSIONS')); $app->close(); return; } // Set the breadcrumbs. $this->setPathway(JText::_('COM_EASYDISCUSS_BREADCRUMBS_ASK')); // Set the page title. $title = JText::_('COM_EASYDISCUSS_TITLE_ASK'); if ($id && $post->id) { $title = JText::sprintf('COM_EASYDISCUSS_TITLE_EDIT_QUESTION', $post->getTitle()); } // Set the page title DiscussHelper::setPageTitle($title); if ($editing) { $isModerator = DiscussHelper::getHelper('Moderator')->isModerator($post->category_id); if (!DiscussHelper::isMine($post->user_id) && !DiscussHelper::isSiteAdmin() && !$acl->allowed('edit_question') && !$isModerator) { $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $postid, false), JText::_('COM_EASYDISCUSS_SYSTEM_INSUFFICIENT_PERMISSIONS')); $app->close(); } $tagsModel = DiscussHelper::getModel('PostsTags'); $post->tags = $tagsModel->getPostTags($post->id); } else { if ($categoryId) { // set the default category $post->category_id = $categoryId; } } $attachments = $post->getAttachments(); if (isset($post->sessiondata)) { $attachments = ''; } $model = DiscussHelper::getModel('Posts'); $postCount = count($model->getPostsBy('user', $my->id)); $onlyPublished = empty($post->id) ? true : false; // @rule: If there is a category id passed through the query, respect it first. $showPrivateCat = empty($post->id) && $my->id == 0 ? false : true; // [model:category] $categoryModel = $this->getModel('Category'); $defaultCategory = $categoryModel->getDefaultCategory(); if ($categoryId == 0 && $defaultCategory !== false) { $categoryId = $defaultCategory->id; } $nestedCategories = ''; $categories = ''; if ($config->get('layout_category_selection') == 'multitier') { $categoriesModel = $this->getModel('Categories'); $categories = $categoriesModel->getCategories(array('acl_type' => DISCUSS_CATEGORY_ACL_ACTION_SELECT)); } else { $nestedCategories = DiscussHelper::populateCategories('', '', 'select', 'category_id', $categoryId, true, $onlyPublished, $showPrivateCat, true); } if ($config->get('layout_reply_editor') == 'bbcode') { // Legacy fix when switching from WYSIWYG editor to bbcode. $post->content = EasyDiscussParser::html2bbcode($post->content); } $editor = ''; if ($config->get('layout_editor') != 'bbcode') { $editor = JFactory::getEditor($config->get('layout_editor')); } // Get list of moderators from the site. $moderatorList = array(); if ($config->get('main_assign_user')) { $moderatorList = DiscussHelper::getHelper('Moderator')->getSelectOptions($post->category_id); } $composer = new DiscussComposer("editing", $post); // Set the discussion object. $access = $post->getAccess($category); $theme = new DiscussThemes(); // Test if reference is passed in query string. $reference = JRequest::getWord('reference'); $referenceId = JRequest::getInt('reference_id', 0); $redirect = JRequest::getVar('redirect', ''); $theme->set('redirect', $redirect); $theme->set('reference', $reference); $theme->set('referenceId', $referenceId); $theme->set('isEditMode', $editing); $theme->set('post', $post); $theme->set('composer', $composer); $theme->set('parent', $composer->parent); $theme->set('nestedCategories', $nestedCategories); $theme->set('attachments', $attachments); $theme->set('editor', $editor); $theme->set('moderatorList', $moderatorList); $theme->set('categories', $categories); $theme->set('access', $access); // Deprecated since 3.0. Will be removed in 4.0 $theme->set('config', $config); echo $theme->fetch('form.reply.wysiwyg.php'); }
data-editortype="<?php echo $composer->editorType; ?> " data-operation="<?php echo $composer->operation; ?> " > <div class="alert replyNotification" style="display: none;"></div> <div class="discuss-story"> <div class="discuss-content"> <form name="dc_submit" autocomplete="off" class="form-horizontal" action="<?php echo DiscussRouter::_('index.php?option=com_easydiscuss&controller=posts&task=reply'); ?> " method="post"> <div class="discuss-form"> <?php if (!$system->my->id) { ?> <div class="control-group control-group-guest"> <input type="text" name="poster_name" class="input-xlarge" placeholder="<?php echo JText::_('COM_EASYDISCUSS_GUEST_NAME'); ?> "> <input type="text" name="poster_email" class="input-xlarge" placeholder="<?php echo JText::_('COM_EASYDISCUSS_GUEST_EMAIL');
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(); }
*/ defined('_JEXEC') or die('Restricted access'); if ($notifications) { ?> <?php foreach ($notifications as $notification) { ?> <li class="item type-<?php echo $notification->type; ?> new notificationItem"> <?php if (!$notification->component || $notification->component == 'com_easydiscuss' || empty($notification->component)) { ?> <a href="<?php echo DiscussRouter::_($notification->permalink, false); ?> #<?php echo $notification->type; ?> -<?php echo $notification->cid; ?> " class="media"> <?php } else { ?> <a href="<?php echo $notification->permalink; ?> " class="media">
<li> <a href="<?php echo DiscussRouter::_('index.php?option=com_easydiscuss&view=profile'); ?> #Subscriptions"> <i class="icon-inbox"></i> <?php echo JText::_('COM_EASYDISCUSS_VIEW_MY_SUBSCRIPTIONS'); ?> </a> </li> <?php if (DiscussHelper::isModerator()) { ?> <li> <a href="<?php echo DiscussRouter::_('index.php?option=com_easydiscuss&view=assigned'); ?> "> <i class="icon-check"></i> <?php echo JText::_('COM_EASYDISCUSS_VIEW_MY_TICKETS'); ?> </a> </li> <?php } ?> </ul> </div> </div> <?php
</div> </a> </div> <div class="item-story"> <a href="<?php echo DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->parent_id); ?> " class="item-title bold"><?php echo DiscussStringHelper::escape($post->title); ?> </a> <?php if (!empty($post->user_id)) { $creator = DiscussHelper::getTable('Profile'); $creator->load($post->user_id); $creatorLink = '<a href="' . DiscussRouter::_('index.php?option=com_easydiscuss&view=profile&id=' . $post->user_id) . '">' . $creator->getName() . '</a>'; } else { $creatorLink = $post->poster_name . ' (' . JText::_('MOD_MOSTVOTED_GUEST') . ')'; } ?> <div class="item-meta small"><?php echo JText::sprintf('MOD_MOSTVOTED_REPLIED_BY', $creatorLink); ?> </div> </div> <div class="clear"></div> </div> <?php } ?> </div>
<?php echo JText::_('COM_EASYDISCUSS_UPDATE_BUTTON'); ?> </button> <button class="stopCropButton butt butt-default" type="button"> <?php echo JText::_('COM_EASYDISCUSS_CANCEL'); ?> </button> </span> <?php if ($croppable) { ?> <a href="<?php echo DiscussRouter::_('index.php?option=com_easydiscuss&controller=profile&task=removePicture'); ?> " class="butt butt-default"> <i class="i i-times muted"></i> <?php echo JText::_('COM_EASYDISCUSS_REMOVE_PICTURE'); ?> </a> <?php } ?> </p> <div class="avatarContainer"> <img src="<?php echo $originalAvatar;
public function display($tpl = null) { // Initialise variables $doc = JFactory::getDocument(); $my = JFactory::getUser(); $config = DiscussHelper::getConfig(); $app = JFactory::getApplication(); $registry = DiscussHelper::getRegistry(); $categoryId = JRequest::getInt('category_id', 0); // Perform redirection if there is a category_id in the index view. if (!empty($categoryId)) { $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=categories&layout=listings&category_id=' . $categoryId, false)); $app->close(); } // Try to detect if there's any category id being set in the menu parameter. $activeMenu = $app->getMenu()->getActive(); if ($activeMenu && !$categoryId) { // Load menu params to the registry. $registry->loadString($activeMenu->params); if ($registry->get('category_id')) { $categoryId = $registry->get('category_id'); } } // Get the current logged in user's access. $acl = DiscussHelper::getHelper('ACL'); // Todo: Perhaps we should fix the confused naming of filter and sort to type and sort $filter = JRequest::getString('filter', $registry->get('filter')); $sort = JRequest::getString('sort', $registry->get('sort')); // Get the pagination limit $limit = $registry->get('limit'); $limit = $limit == '-2' ? DiscussHelper::getListLimit() : $limit; $limit = $limit == '-1' ? DiscussHelper::getJConfig()->get('list_limit') : $limit; // Add view to this page. $this->logView(); // set page title. DiscussHelper::setPageTitle(); // Set the meta of the page. DiscussHelper::setMeta(); // Add rss feed into headers DiscussHelper::getHelper('Feeds')->addHeaders('index.php?option=com_easydiscuss&view=index'); // Get list of categories on the site. $catModel = $this->getModel('Categories'); // Pagination is by default disabled. $pagination = false; // Get the model. $postModel = DiscussHelper::getModel('Posts'); // Get a list of accessible categories $cats = $this->getAccessibleCategories($categoryId); // Get featured posts from this particular category. $featured = array(); if ($config->get('layout_featuredpost_frontpage')) { $options = array('pagination' => false, 'category' => $cats, 'sort' => $sort, 'filter' => $filter, 'limit' => $config->get('layout_featuredpost_limit', $limit), 'featured' => true); $featured = $postModel->getDiscussions($options); if (is_null($featured)) { $featured = array(); } } // Get normal discussion posts. $options = array('sort' => $sort, 'category' => $cats, 'filter' => $filter, 'limit' => $limit, 'featured' => false); $posts = $postModel->getDiscussions($options); if (is_null($posts)) { $posts = array(); } $authorIds = array(); $topicIds = array(); $tmpPostsArr = array_merge($featured, $posts); if (count($tmpPostsArr) > 0) { foreach ($tmpPostsArr as $tmpArr) { $authorIds[] = $tmpArr->user_id; $topicIds[] = $tmpArr->id; } } $pagination = $postModel->getPagination(0, 'latest', '', $cats, false); $postLoader = EDC::getTable('Posts'); $postLoader->loadBatch($topicIds); $postTagsModel = EDC::getModel('PostsTags'); $postTagsModel->setPostTagsBatch($topicIds); $model = EDC::getModel('Posts'); $lastReplyUser = $model->setLastReplyBatch($topicIds); // Reduce SQL queries by pre-loading all author object. $authorIds = array_merge($lastReplyUser, $authorIds); $authorIds = array_unique($authorIds); // Initialize the list of user's so we run lesser sql queries. $profile = EDC::getTable('Profile'); $profile->init($authorIds); // Format featured entries. $featured = EDC::formatPost($featured, false, true); // Format normal entries $posts = EDC::formatPost($posts, false, true); // Get unread count $unreadCount = $model->getUnreadCount($cats, false); // Get unresolved count // Change the "all" to TRUE or FALSE to include/exclude featured post count $unresolvedCount = $model->getUnresolvedCount('', $cats, '', 'all'); // Get resolved count $resolvedCount = $model->getTotalResolved(); // Get unanswered count $unansweredCount = EDC::getUnansweredCount($cats, true); // Get assigned post count that isn't answered yet. $assignedCount = 0; if (EDC::isSiteAdmin() || EDC::isModerator()) { $assignedModel = EDC::getModel('Assigned'); $assignedCount = $assignedModel->getTotalUnresolved(); } $activeFilter = $config->get('layout_frontpage_sorting'); // Let's render the layout now. $theme = new DiscussThemes(); $theme->set('assignedCount', $assignedCount); $theme->set('activeFilter', $activeFilter); $theme->set('activeSort', $sort); $theme->set('categories', $categoryId); $theme->set('unreadCount', $unreadCount); $theme->set('unansweredCount', $unansweredCount); $theme->set('resolvedCount', $resolvedCount); $theme->set('unresolvedCount', $unresolvedCount); $theme->set('posts', $posts); $theme->set('featured', $featured); $theme->set('pagination', $pagination); echo $theme->fetch('frontpage.index.php'); }
public function getProfileLink($defaultItemId = '') { static $instance = array(); static $phpbbDB = null; static $phpbbpath = null; static $isBlogger = array(); // since it's for avatar, we'll follow the avatar's integration $config = EasyBlogHelper::getConfig(); $source = $config->get('layout_avatarIntegration'); if (!$config->get('main_nonblogger_profile')) { // 1st check if this user a blogger or not. $showLink = false; if (isset($isBlogger[$this->id])) { $showLink = $isBlogger[$this->id]; } else { $showLink = EasyBlogHelper::isBlogger($this->id); $isBlogger[$this->id] = $showLink; } if (!$showLink) { return 'javascript: void(0);'; } } // phpbb case if ($source == 'phpbb' && $phpbbDB === null) { $phpbbpath = $config->get('layout_phpbb_path'); $file = JPATH_ROOT . DIRECTORY_SEPARATOR . $phpbbpath . DIRECTORY_SEPARATOR . 'config.php'; if (JFile::exists($file)) { require $file; $host = $dbhost; $user = $dbuser; $password = $dbpasswd; $database = $dbname; $prefix = $table_prefix; $driver = $dbms; $debug = 0; $options = array('driver' => $driver, 'host' => $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix); $phpbbDB = JDatabase::getInstance($options); } else { $phpbbDB = false; } } if ($phpbbDB === false) { // can't get phpbb's config file, fallback to default profile link $source = 'default'; } // Always use the core linking if user does not wants this. if (!$config->get('layout_avatar_link_name')) { $source = 'default'; } // to ensure the passed in value is only a number $defaultItemId = str_replace('&Itemid=', '', $defaultItemId); // to ensure the uniqueness of the key $key = $source . '-' . $defaultItemId; // this is where the magic starts if (!isset($instance[$this->id][$key])) { $defaultItemId = !empty($defaultItemId) ? '&Itemid=' . $defaultItemId : ''; $defaultLink = EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $this->id . $defaultItemId); switch ($source) { case 'k2': $file1 = JPATH_ROOT . '/components/com_k2/helpers/route.php'; $file2 = JPATH_ROOT . '/components/com_k2/helpers/utilities.php'; jimport('joomla.filesystem.file'); if (JFile::exists($file1) && JFile::exists($file2)) { require_once $file1; require_once $file2; $ret = K2HelperRoute::getUserRoute($this->id); } else { $ret = $defaultLink; } break; case 'mightyregistration': $ret = JRoute::_('index.php?option=com_community&view=profile&user_id=' . $this->id, false); break; case 'communitybuilder': $ret = JRoute::_('index.php?option=com_comprofiler&task=userProfile&user='******'easysocial': $easysocial = EasyBlogHelper::getHelper('EasySocial'); $ret = ''; if ($easysocial->exists()) { $easysocial->init(); $user = Foundry::user($this->id); $ret = $user->getPermalink(); } break; case 'jomsocial': $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php'; $ret = JFile::exists($file) && (require_once $file) ? CRoute::_('index.php?option=com_community&view=profile&userid=' . $this->id) : ''; break; case 'kunena': $ret = JRoute::_('index.php?option=com_kunena&func=fbprofile&userid=' . $this->id, false); break; case 'phpbb': $juser = JFactory::getUser($this->id); $query = 'SELECT ' . $phpbbDB->nameQuote('user_id') . ' ' . 'FROM ' . $phpbbDB->nameQuote('#__users') . ' WHERE LOWER(' . $phpbbDB->nameQuote('username') . ') = LOWER(' . $phpbbDB->quote($juser->username) . ') '; $phpbbDB->setQuery($query, 0, 1); $phpbbuserid = $phpbbDB->loadResult(); $ret = $phpbbuserid ? JURI::root() . rtrim($phpbbpath, '/') . '/memberlist.php?mode=viewprofile&u=' . $phpbbuserid : ''; break; case 'anahita': $person = KFactory::get('lib.anahita.se.person.helper')->getPerson($this->id); $ret = $person->getURL(); break; case 'easydiscuss': $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easydiscuss' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'router.php'; $ret = JFile::exists($file) && (require_once $file) ? DiscussRouter::_('index.php?option=com_easydiscuss&view=profile&id=' . $this->id, false) : ''; break; case 'gravatar': case 'default': default: $ret = ''; break; } $instance[$this->id][$key] = $ret ? $ret : $defaultLink; } return $instance[$this->id][$key]; }
function unsubscribe() { $my = JFactory::getUser(); $redirectLInk = 'index.php?option=com_easydiscuss&view=profile#Subscriptions'; if ($my->id == 0) { $redirectLInk = 'index.php?option=com_easydiscuss&view=index'; } //type=site - subscription type //sid=1 - subscription id //uid=42 - user id //token=0fd690b25dd9e4d2dc47a252d025dff4 - md5 subid.subdate $data = base64_decode(JRequest::getVar('data', '')); $param = DiscussHelper::getRegistry($data); $param->type = $param->get('type', ''); $param->sid = $param->get('sid', ''); $param->uid = $param->get('uid', ''); $param->token = $param->get('token', ''); $subtable = DiscussHelper::getTable('Subscribe'); $subtable->load($param->sid); $token = md5($subtable->id . $subtable->created); $paramToken = md5($param->sid . $subtable->created); if (empty($subtable->id)) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_SUBSCRIPTION_NOT_FOUND'), 'error'); $this->setRedirect(DiscussRouter::_($redirectLInk, false)); return false; } if ($token != $paramToken) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_SUBSCRIPTION_UNSUBSCRIBE_FAILED'), 'error'); $this->setRedirect(DiscussRouter::_($redirectLInk, false)); return false; } if (!$subtable->delete($param->sid)) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_SUBSCRIPTION_UNSUBSCRIBE_FAILED_ERROR_DELETING_RECORDS'), 'error'); $this->setRedirect(DiscussRouter::_($redirectLInk, false)); return false; } DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_SUBSCRIPTION_UNSUBSCRIBE_SUCCESS')); $this->setRedirect(DiscussRouter::_($redirectLInk, false)); return true; }
<?php } else { if (DiscussHelper::getHelper('Captcha')->showCaptcha()) { ?> <?php echo DiscussHelper::getHelper('Captcha')->getHTML(); ?> <?php } } ?> <div class="fd-cf"> <div class="pull-left"> <a href="<?php echo DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->parent_id); ?> " class="btn btn-medium btn-danger"><?php 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>
public static function getLoginLink($returnURL = '') { $config = DiscussHelper::getConfig(); if (!empty($returnURL)) { $returnURL = '&return=' . $returnURL; } if (DiscussHelper::getJoomlaVersion() >= '1.6') { $link = DiscussRouter::_('index.php?option=com_users&view=login' . $returnURL); } else { $link = DiscussRouter::_('index.php?option=com_user&view=login' . $returnURL); } return $link; }
* @copyright Copyright (C) 2010 Stack Ideas Private Limited. All rights reserved. * @license GNU/GPL, see LICENSE.php * * EasyDiscuss is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ defined('_JEXEC') or die('Restricted access'); foreach ($tagCloud as $tag) { ?> <li> <div> <a href="<?php echo DiscussRouter::_('index.php?option=com_easydiscuss&view=tags&id=' . $tag->id); ?> "> <!-- <i class="icon-tag"></i> --> <b><?php echo JText::_($tag->title); ?> </b> </a> <?php if ($system->config->get('main_rss')) { ?> <a href="<?php echo DiscussHelper::getHelper('Feeds')->getFeedURL('index.php?option=com_easydiscuss&view=tags&id=' . $tag->id); ?>
?> "><?php echo JText::_('COM_EASYDISCUSS_VIEW_ALL_PREVIOUS_MESSAGES'); ?> </a> <?php } ?> </div> <div style="text-align: center;"> <?php if (JRequest::getVar('show') != 'all') { ?> <a href="<?php echo DiscussRouter::_('index.php?option=com_easydiscuss&view=conversation&layout=read&id=' . $conversation->id . '&show=previous&count=' . $count); ?> "><?php echo JText::_('COM_EASYDISCUSS_VIEW_PREVIOUS_MESSAGES'); ?> </a> <?php } ?> </div> <ul class="unstyled discuss-list discuss-conversation-list mt-0 replyList"> <?php foreach ($replies as $reply) {
public function getLink() { if ($this->komentoprofile) { return JRoute::_('index.php?option=com_komento&view=profile&id=' . $this->profile->id); } return DiscussRouter::_('index.php?option=com_easydiscuss&view=profile&id=' . $this->profile->id, false); }
public function getPermalink($external = false) { if (!isset($this->_data['permalink'])) { $this->_data['permalink'] = DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $this->id); } return $this->_data['permalink']; }
private static function gravatar($profile) { $user = JFactory::getUser($profile->id); if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { $avatarLink = 'https://secure.gravatar.com/avatar.php?gravatar_id='; } else { $avatarLink = 'http://www.gravatar.com/avatar.php?gravatar_id='; } $avatarLink = $avatarLink . md5($user->email) . '?s=160'; $avatarLink = $avatarLink . '&d=wavatar'; $profileLink = DiscussRouter::_('index.php?option=com_easydiscuss&view=profile&id=' . $profile->id, false); return array($avatarLink, $profileLink); }