public static function getButtonHTML($row, $position = 'vertical') { $config = DiscussHelper::getConfig(); if (!$config->get('integration_digg')) { return ''; } $dataURL = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $row->id, false, true); $dataURL = urlencode($dataURL); $html = ''; if ($position == 'horizontal') { $class = 'DiggCompact'; } else { $class = 'DiggMedium'; } $html = '<script type="text/javascript">(function() { var s = document.createElement(\'SCRIPT\'), s1 = document.getElementsByTagName(\'SCRIPT\')[0]; s.type = \'text/javascript\'; s.async = true; s.src = \'http://widgets.digg.com/buttons.js\'; s1.parentNode.insertBefore(s, s1); })(); </script> <!-- Wide Button --> <div class="social-button digg-share"><a class="DiggThisButton ' . $class . '" href="https://digg.com/submit?url=' . $dataURL . '&title=' . $row->title . '"></a></div>'; return $html; }
function process() { $view = new EasyDiscussView(); $date = DiscussHelper::getDate(); $now = $date->toMySQL(); $modelSubscribe = $view->getModel('Subscribe'); $subscribers = $modelSubscribe->getSiteSubscribers($this->interval, $now); $total = count($subscribers); if (empty($total)) { return false; } foreach ($subscribers as $subscriber) { $notify = DiscussHelper::getNotification(); $data = array(); $rows = $modelSubscribe->getCreatedPostByInterval($subscriber->sent_out, $now); $posts = array(); if ($rows) { foreach ($rows as $row) { $row['categorylink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=categorie&layout=listings&category_id=' . $row['category_id'], false, true); $row['link'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $row['id'], false, true); $row['userlink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=profile&id=' . $row['user_id'], false, true); $category = DiscussHelper::getTable('Category'); $creator = DiscussHelper::getTable('Profile'); $category->load($row['category_id']); $creator->load($row['user_id']); $row['category'] = $category->getTitle(); $row['avatar'] = $creator->getAvatar(); $row['name'] = $creator->getName(); $row['date'] = DiscussDateHelper::toFormat($row['created'], '%b %e, %Y'); $row['message'] = DiscussHelper::parseContent($row['content']); $posts[] = $row; } } $data['post'] = $posts; $data['total'] = count($data['post']); $data['unsubscribeLink'] = DiscussHelper::getUnsubscribeLink($subscriber, true, true); $subject = $date->toMySQL(); switch (strtoupper($this->interval)) { case 'DAILY': $subject = $date->toFormat('%F'); $data['interval'] = JText::_('today'); break; case 'WEEKLY': $subject = $date->toFormat('%V'); $data['interval'] = JText::_('this week'); break; case 'MONTHLY': $subject = $date->toFormat('%B'); $data['interval'] = JText::_('this month'); break; } if (!empty($data['post'])) { $notify->addQueue($subscriber->email, JText::sprintf('COM_EASYDISCUSS_YOUR_' . $this->interval . '_SUBSCRIPTION', $subject), '', 'email.subscription.site.interval.php', $data); } $subscribe = DiscussHelper::getTable('Subscribe'); $subscribe->load($subscriber->id); $subscribe->sent_out = $now; $subscribe->store(); } }
/** * 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); }
public function addOpenGraph(DiscussPost $post) { // Use facebook developer tools to check the result // https://developers.facebook.com/tools/debug/og $doc = JFactory::getDocument(); $config = DiscussHelper::getConfig(); // Search for an image in the content $image = self::searchImage($post->content); if ($image) { $doc->addCustomTag('<meta property="og:image" content="' . $image . '" />'); } if ($config->get('integration_facebook_like')) { $appId = $config->get('integration_facebook_like_appid'); if ($appId) { $doc->addCustomTag('<meta property="fb:app_id" content="' . $appId . '" />'); } $adminId = $config->get('integration_facebook_like_admin'); if ($adminId) { $doc->addCustomTag('<meta property="fb:admins" content="' . $adminId . '" />'); } } // Add post title info here. $doc->addCustomTag('<meta property="og:title" content="' . $post->title . '" />'); // Add post content. $maxContent = 350; // Remove bbcode tags from the content. $content = EasyDiscussParser::removeCodes($post->content); $content = strip_tags($post->content); if (JString::strlen($content) > $maxContent) { $content = JString::substr($content, 0, $maxContent) . '...'; } // Add content to description $doc->addCustomTag('<meta property="og:description" content="' . $content . '" />'); // Add the type of the og tag. $doc->addCustomTag('<meta property="og:type" content="article" />'); // Add the URL for this page. $url = DiscussRouter::getRoutedURL(DiscussRouter::getPostRoute($post->id, false, true)); $doc->addCustomTag('<meta property="og:url" content="' . $url . '" />'); $doc->setTitle($post->title); $doc->setDescription($content); return true; }
public static function getButtonHTML($row, $position = 'vertical') { $config = DiscussHelper::getConfig(); if (!$config->get('integration_linkedin')) { return ''; } $button = $config->get('integration_linkedin_button'); $dataURL = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $row->id, false, true); if ($position == 'horizontal') { $counter = ' data-counter="right"'; } else { $counter = ' data-counter="top"'; } $html = ''; $html = '<div class="social-button linkedin-share">'; $html .= '<script type="text/javascript" src="https://platform.linkedin.com/in.js"></script>'; $html .= '<script type="in/share" data-url="' . $dataURL . '"' . $counter . '></script>'; $html .= '</div>'; return $html; }
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'); }
public static function getReturnURL($params, $isLogged = false) { $type = empty($isLogged) ? 'login' : 'logout'; if ($itemid = $params->get($type)) { $menu = JFactory::getApplication()->getMenu(); $item = $menu->getItem($itemid); if ($item) { $url = JRoute::_($item->link . '&Itemid=' . $itemid, false); } else { // stay on the same page $uri = JFactory::getURI(); $url = $uri->toString(array('path', 'query', 'fragment')); } } else { // Proceeed to the front page of EasyDiscuss. $itemid = DiscussRouter::getItemId(); $url = JRoute::_('index.php?option=com_easydiscuss&Itemid=' . $itemid, false); } return base64_encode($url); }
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 static function getButtonHTML($row, $position = 'vertical') { $config = DiscussHelper::getConfig(); if (!$config->get('integration_twitter_button')) { return ''; } $html = ''; $style = $config->get('integration_twitter_button_style'); $dataURL = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $row->id, false, true); $width = '80px'; if ($position == 'horizontal') { $style = 'horizontal'; $width = '80px'; } else { $width = '55px'; $style = 'vertical'; } $html = '<div class="social-button retweet" style="width: ' . $width . '"><a href="http://twitter.com/share" class="twitter-share-button" data-url="' . $dataURL . '" data-counturl="' . $dataURL . '" data-count="' . $style . '">Tweet</a><script type="text/javascript" src="https://platform.twitter.com/widgets.js"></script></div>'; return $html; }
public static function getButtonHTML($row, $position = 'vertical') { $config = DiscussHelper::getConfig(); if (!$config->get('integration_googleshare')) { return ''; } $size = $config->get('integration_googleshare_layout'); $dataURL = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $row->id, false, true); $googleShare = ''; if ($position == 'horizontal') { $size = 'medium'; $width = '170px'; } else { $size = 'tall'; $width = '50px'; } $googleShare .= '<div class="social-button google-share" style="width:' . $width . '">'; $googleShare .= '<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>'; $googleShare .= '<g:plus action="share" size="' . $size . '" href="' . $dataURL . '"></g:plus>'; $googleShare .= '</div>'; return $googleShare; }
public static function getLikeHTML($row, $position = 'vertical') { $config = DiscussHelper::getConfig(); if (!$config->get('integration_facebook_like')) { return ''; } $document = JFactory::getDocument(); $language = $document->getLanguage(); $language = explode('-', $language); if (count($language) != 2) { $language = array('en', 'GB'); } $layout = $config->get('integration_facebook_like_layout'); $faces = $config->get('integration_facebook_like_faces') ? 'true' : 'false'; $width = $config->get('integration_facebook_like_width'); $verb = $config->get('integration_facebook_like_verb'); $theme = $config->get('integration_facebook_like_theme'); $send = $config->get('integration_facebook_like_send') ? 'true' : 'false'; $height = $faces == 'true' ? '70' : '30'; $locale = $language[0] . '_' . JString::strtoupper($language[1]); $fb = DiscussHelper::getHelper('Facebook'); $fb->addOpenGraph($row); $url = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $row->id, true, true); $html = ''; if ($position == 'horizontal') { $layout = 'button_count'; } else { $layout = 'box_count'; } $html = '<div class="social-button facebook-like">'; if ($config->get('integration_facebook_scripts')) { $html .= '<div id="fb-root"></div><script src="https://connect.facebook.net/' . $locale . '/all.js#xfbml=1"></script>'; } $html .= '<fb:like href="' . $url . '" send="' . $send . '" layout="' . $layout . '" action="' . $verb . '" '; $html .= 'locale="' . $locale . '" colorscheme="' . $theme . '" show_faces="' . $faces . '" style="height: ' . $height . ';" height="' . $height . '"></fb:like>'; $html .= '</div>'; return $html; }
?> <?php } else { ?> <?php echo $post->reply->poster_name; ?> <?php } ?> <?php $lastReply = DiscussHelper::getModel('Posts')->getLastReply($post->id); ?> <a class="ml-5" href="<?php echo DiscussRouter::getPostRoute($post->id) . '#' . JText::_('MOD_EASYDISCUSS_REPLY_PERMALINK') . '-' . $lastReply->id; ?> " title="<?php echo JText::_('MOD_EASYDISCUSS_VIEW_LAST_REPLY'); ?> "><?php echo JText::_('MOD_EASYDISCUSS_VIEW_LAST_REPLY'); ?> </a> <?php } ?> </div> </div><!-- ft -->
<?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>
?> "><?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) {
?> <?php if ($pagination) { ?> <div class="discuss-pagination"> <?php echo $pagination->getPagesLinks(); ?> </div> <?php } else { ?> <div> <a href="<?php echo DiscussRouter::getCategoryRoute($category->id); ?> "><?php echo JText::_('COM_EASYDISCUSS_SHOW_MORE_POSTS'); ?> <i class="icon-chevron-right"></i> </a> </div> <?php } ?> </div> <?php if ($system->config->get('layout_board_stats')) { echo DiscussHelper::getBoardStatistics(); }
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; }
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]; }
</li> </ul> <?php if (DiscussHelper::getJoomlaVersion() >= '1.6') { ?> <input type="hidden" value="com_users" name="option"> <input type="hidden" value="user.login" name="task"> <input type="hidden" name="return" value="<?php echo base64_encode(DiscussRouter::getPostRoute($post->id, false)); ?> " /> <?php } else { ?> <input type="hidden" value="com_user" name="option"> <input type="hidden" value="login" name="task"> <input type="hidden" name="return" value="<?php echo base64_encode(DiscussRouter::getPostRoute($post->id, false)); ?> " /> <?php } ?> <?php echo JHTML::_('form.token'); ?> </form> </div> </div> </div>
: </span> <ul class="unstyled nav-bar discuss-category-sublist"> <?php echo $category->nestedLink; ?> </ul> </div> <?php } ?> <?php if ($category->canPost() && !$category->container && $acl->allowed('add_question', 0)) { ?> <a class="btn btn-primary btn-new-post btn-small" href="<?php echo DiscussRouter::getAskRoute($category->id); ?> "><i class="icon-plus-sign"></i> <?php echo JText::_('COM_EASYDISCUSS_NEW_POST'); ?> </a> <?php } ?> </div> </div> <div class="tab-content"> <div class="tab-pane active discussPostsList" data-id="<?php echo $category->id;
} else { ?> <a class="attachment-image-link" <?php echo $system->config->get('attachment_image_title') ? 'title="' . $this->escape($attachment->title) . '"' : ''; ?> href="<?php echo DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&controller=attachment&task=displayFile&tmpl=component&id=' . $attachment->id, false, true); ?> "><img src="<?php echo JRoute::_('index.php?option=com_easydiscuss&controller=attachment&task=displayFile&tmpl=component&size=thumb&id=' . $attachment->id); ?> " title="<?php echo $this->escape($attachment->title); ?> " /></a> <div class="caption" style="text-align:center;"> <a class="attachment-image-link" title="<?php echo $this->escape($attachment->title); ?> " href="<?php echo DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&controller=attachment&task=displayFile&tmpl=component&id=' . $attachment->id, false, true); ?> "><?php echo $attachment->title; ?> </a> </div> <?php }
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; }
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');
/** * Sends an auto post request to social networks such as Facebook, Twitter etc. * * @since 3.0 * @access public * @param null * @return boolean True if success, false otherwise. */ public function autopost() { // Only allow post that are really published. if (!$this->published) { return false; } $category = DiscussHelper::getTable('Category'); $category->load($this->category_id); // Only allow post that are posted in a public category. if (!$category->canPublicAccess()) { return false; } $config = DiscussHelper::getConfig(); // Set generic callback URL. $callback = DiscussRouter::getRoutedUrl('index.php?option=com_easydiscuss&view=post&id=' . $this->id, false, true); // These are the default social sites which we need to ping. $sites = array('facebook', 'twitter'); foreach ($sites as $site) { if ($config->get('main_autopost_' . $site)) { $oauth = DiscussHelper::getTable('OAuth'); $state = $oauth->loadByType($site); // Determine if this discussion is already shared on the social site. $oauthPost = DiscussHelper::getTable('OauthPosts'); $shared = $oauthPost->exists($this->id, $oauth->id); if (!$shared && $state && !empty($oauth->access_token)) { $consumer = DiscussHelper::getHelper('OAuth')->getConsumer($site, $config->get('main_autopost_' . $site . '_id'), $config->get('main_autopost_' . $site . '_secret'), $callback); // Set access token for the social site. $consumer->setAccess($oauth->access_token); // Try to share the post to the site. $status = $consumer->share($this); // @TODO: Add error logging when something fail here. // When the psot is shared we need to keep a record of this to prevent from sending duplicate updates. $oauthPost->post_id = $this->id; $oauthPost->oauth_id = $oauth->id; $oauthPost->store(); } } } }
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'); }