public static function replace($tmp, $text) { $config = DiscussHelper::getConfig(); $pattern = '@(?i)\\b((?:https?://|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}/)(?:[^\\s()<>]+|\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\))+(?:\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\\[\\]{};:\'".,<>?«»“”‘’]))@'; preg_match_all($pattern, $tmp, $matches); $targetBlank = $config->get('main_link_new_window') ? ' target="_blank"' : ''; if (!isset($matches[0]) || !is_array($matches[0])) { return; } // to avoid infinite loop, unique the matches $links = $matches[0]; foreach ($links as &$link) { $link = JString::strtolower($link); } $uniques = array_unique($links); foreach ($uniques as $match) { $matchProtocol = $match; if (stristr($matchProtocol, 'http://') === false && stristr($matchProtocol, 'https://') === false && stristr($matchProtocol, 'ftp://') === false) { $matchProtocol = 'http://' . $matchProtocol; } $text = JString::str_ireplace($match, '<a href="' . $matchProtocol . '"' . $targetBlank . '>' . $match . '</a>', $text); } $text = JString::str_ireplace('"', '"', $text); return $text; }
function display($tmpl = null) { $document = JFactory::getDocument(); $config = DiscussHelper::getConfig(); $doc = JFactory::getDocument(); DiscussHelper::setPageTitle(JText::_('COM_EASYDISCUSS_MEMBERS_TITLE')); $this->setPathway(JText::_('COM_EASYDISCUSS_BREADCRUMBS_MEMBERS')); $model = $this->getModel('Users'); $userQuery = JRequest::getString('userQuery', ''); $result = $model->getData($userQuery); $pagination = $model->getPagination(); $sort = JRequest::getString('sort', 'latest'); $filteractive = JRequest::getString('filter', 'allposts'); $users = DiscussHelper::formatUsers($result); $sort = JRequest::getCmd('sort', 'name'); $uids = $config->get('main_exclude_members'); if (!empty($uids)) { // Remove white space $uids = str_replace(' ', '', $uids); $excludeId = explode(',', $uids); $temp = array(); foreach ($users as $user) { if (!in_array($user->id, $excludeId)) { $temp[] = $user; } } $users = $temp; } $theme = new DiscussThemes(); $theme->set('users', $users); $theme->set('pagination', $pagination); $theme->set('sort', $sort); $theme->set('userQuery', $userQuery); echo $theme->fetch('users.php'); }
public static function toMinimizePost($count) { $config = DiscussHelper::getConfig(); $breakPoint = $config->get('layout_autominimisepost'); $minimize = $count <= $breakPoint && $breakPoint != 0 ? true : false; return $minimize; }
public function display($tpl = null) { // @rule: Test for user access if on 1.6 and above if (DiscussHelper::getJoomlaVersion() >= '1.6') { if (!JFactory::getUser()->authorise('discuss.manage.settings', 'com_easydiscuss')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); JFactory::getApplication()->close(); } } // Initialise variables $config = DiscussHelper::getConfig(); $jconfig = DiscussHelper::getJConfig(); $defaultSAId = DiscussHelper::getDefaultSAIds(); $joomlaVersion = DiscussHelper::getJoomlaVersion(); $joomlaGroups = DiscussHelper::getJoomlaUserGroups(); $this->assignRef('config', $config); $this->assignRef('jconfig', $jconfig); $this->assignRef('defaultSAId', $defaultSAId); $this->assignRef('defaultLength', $defaultLength); $this->assignRef('joomlaversion', $joomlaVersion); $this->assignRef('joomlaGroups', $joomlaGroups); if ($this->getLayout() == 'default') { $app = JFactory::getApplication(); $app->redirect('index.php?option=com_easydiscuss&view=settings&layout=default_main_workflow&child=general'); } parent::display($tpl); }
/** * Open an IMAP stream to a mailbox. * Return true on success, return false on error. */ public function connect($username = '', $password = '') { $config = DiscussHelper::getConfig(); if (!$this->initiated) { $this->init(); } if (!$this->enabled || !function_exists('imap_open') || !function_exists('imap_fetchheader') || !function_exists('imap_body')) { $this->setError('PHP IMAP not available.'); return false; } /* * Connect to mailbox */ // if( !empty($username) && !empty($password) ) // { echo JText::sprintf('COM_EASYDISCUSS_CONNECTING_TO', $username); $this->stream = imap_open($this->mailbox_params, $username, $password); // } // else // { // $this->stream = imap_open( $this->mailbox_params, $this->username, $this->password ); // } if ($this->stream === false) { $this->setError(imap_errors()); return false; } return true; }
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; }
public function compile() { $config = DiscussHelper::getConfig(); $less = DiscussHelper::getHelper('less'); // Force compile $less->compileMode = 'force'; $name = JRequest::getCmd('name', null, 'GET'); $type = JRequest::getCmd('type', null, 'GET'); $result = new stdClass(); if (isset($name) && isset($type)) { switch ($type) { case "admin": $result = $less->compileAdminStylesheet($name); break; case "site": $result = $less->compileSiteStylesheet($name); break; case "module": $result = $less->compileModuleStylesheet($name); break; default: $result->failed = true; $result->message = "Stylesheet type is invalid."; } } else { $result->failed = true; $result->message = "Insufficient parameters provided."; } header('Content-type: text/javascript; UTF-8'); echo json_encode($result); exit; }
public function __construct() { $lang = JFactory::getLanguage(); $lang->load('com_easydiscuss', JPATH_ROOT); self::$file = JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php'; $this->exists = $this->exists(); $this->config = DiscussHelper::getConfig(); }
public function display($tmpl = null) { $config = DiscussHelper::getConfig(); $jConfig = DiscussHelper::getJConfig(); if (!$config->get('main_rss')) { return; } $filteractive = JRequest::getString('filter', 'allposts'); $sort = JRequest::getString('sort', 'latest'); if ($filteractive == 'unanswered' && ($sort == 'active' || $sort == 'popular')) { //reset the active to latest. $sort = 'latest'; } $doc = JFactory::getDocument(); $doc->link = JRoute::_('index.php?option=com_easydiscuss&view=index'); // Load up the tag $tag = JRequest::getInt('id', 0); $table = DiscussHelper::getTable('Tags'); $table->load($tag); // Set the title of the document $doc->setTitle($table->title); $doc->setDescription(JText::sprintf('COM_EASYDISCUSS_DISCUSSIONS_TAGGED_IN', $table->title)); $postModel = $this->getModel('Posts'); $posts = $postModel->getTaggedPost($tag, $sort, $filteractive); $pagination = $postModel->getPagination('0', $sort, $filteractive); $jConfig = DiscussHelper::getJConfig(); $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'); } } $doc->addItem($item); } }
public function getEmbedHTML($url) { $code = $this->getCode($url); $config = DiscussHelper::getConfig(); $width = $config->get('bbcode_video_width'); $height = $config->get('bbcode_video_height'); if ($code) { return '<iframe src="http://player.vimeo.com/video/' . $code . '" width="' . $width . '" height="' . $height . '" frameborder="0"></iframe>'; } return false; }
public function getEmbedHTML($url) { $code = $this->getCode($url); $config = DiscussHelper::getConfig(); $width = $config->get('bbcode_video_width'); $height = $config->get('bbcode_video_height'); if ($code) { return '<script src="http://flash.revver.com/player/1.0/player.js?mediaId:' . $code . ';width:' . $width . ';height:' . $height . ';" type="text/javascript"></script>'; } return false; }
public function getEmbedHTML($url) { $code = $this->getCode($url); $config = DiscussHelper::getConfig(); $width = $config->get('bbcode_video_width'); $height = $config->get('bbcode_video_height'); if ($code) { return '<embed id=VideoPlayback src=http://video.google.com/googleplayer.swf?docid=' . $code . '&hl=en&fs=true style=width:' . $width . 'px;height:' . $height . 'px allowFullScreen=true allowScriptAccess=always type=application/x-shockwave-flash> </embed>'; } return false; }
public function getEmbedHTML($url) { $code = $this->getCode($url); $config = DiscussHelper::getConfig(); $width = $config->get('bbcode_video_width'); $height = $config->get('bbcode_video_height'); if ($code) { return '<embed flashVars="playerVars=showStats=yes|autoPlay=no" src="http://www.metacafe.com/fplayer/' . $code . '/easyblog.swf" width="' . $width . '" height="' . $height . '" wmode="transparent" allowFullScreen="true" allowScriptAccess="always" name="Metacafe_' . $code . '" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>'; } return false; }
public function getEmbedHTML($url) { $code = $this->getCode($url); $config = DiscussHelper::getConfig(); $width = $config->get('bbcode_video_width'); $height = $config->get('bbcode_video_height'); if ($code) { return '<script src="http://ext.nicovideo.jp/thumb_watch/' . $code . '?w=' . $width . '&h=' . $height . '&n=1" type="text/javascript"></script><noscript>Javascript is required to load the player</noscript>'; } return false; }
public function getEmbedHTML($url) { $code = $this->getCode($url); $config = DiscussHelper::getConfig(); $width = $config->get('bbcode_video_width'); $height = $config->get('bbcode_video_height'); if ($code) { return '<embed src="http://media.mtvnservices.com/mgid:uma:video:mtv.com:' . $code . '" width="' . $width . '" height="' . $height . '" type="application/x-shockwave-flash" flashVars="configParams=id%3D' . $code . '%26vid%3D' . $code . '%26uri%3Dmgid%3Auma%3Avideo%3Amtv.com%3A' . $code . '" allowFullScreen="true" allowScriptAccess="always" base="."></embed>'; } return false; }
public function getEmbedHTML($url) { $code = $this->getCode($url); $config = DiscussHelper::getConfig(); $width = $config->get('bbcode_video_width'); $height = $config->get('bbcode_video_height'); if ($code) { return '<object width="' . $width . '" height="' . $height . '"><param name="movie" value="http://www.liveleak.com/e/' . $code . '"></param><param name="wmode" value="transparent"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.liveleak.com/e/' . $code . '" type="application/x-shockwave-flash" wmode="transparent" allowscriptaccess="always" width="' . $width . '" height="' . $height . '"></embed></object>'; } return false; }
public function __construct() { $config = DiscussHelper::getConfig(); $this->fullName = "EasyDiscuss"; $this->shortName = "ed"; $this->environment = $config->get('easydiscuss_environment'); $this->mode = $config->get('easydiscuss_mode'); $this->version = DiscussHelper::getLocalVersion(); $this->baseUrl = DiscussHelper::getAjaxURL(); $this->token = DiscussHelper::getToken(); parent::__construct(); }
public function getEmbedHTML($url) { $code = $this->getCode($url); $config = DiscussHelper::getConfig(); $width = $config->get('bbcode_video_width'); $height = $config->get('bbcode_video_height'); if ($code) { $html = '<iframe frameborder="0" width="' . $width . '" height="' . $height . '" src="http://www.dailymotion.com/embed/video/' . $code . '"></iframe>'; return $html; } return false; }
public function getEmbedHTML($url) { $code = $this->getCode($url); $config = DiscussHelper::getConfig(); $width = $config->get('bbcode_video_width'); $height = $config->get('bbcode_video_height'); if ($code) { $html = '<object width="' . $width . '" height="' . $height . '">' . '<param name="movie" value="http://d.yimg.com/nl/cbe/butterfinger/player.swf"></param>' . '<param name="flashVars" value="browseCarouselUI=hide&shareUrl=http%3A//comedy.video.yahoo.com/%3Fv%3D' . $code . '&repeat=0&vid=' . $code . '"></param>' . '<param name="allowfullscreen" value="true"></param>' . '<param name="wmode" value="transparent"></param>' . '<embed width="' . $width . '" height="' . $height . '" allowFullScreen="true" src="http://d.yimg.com/nl/cbe/butterfinger/player.swf" type="application/x-shockwave-flash" flashvars="browseCarouselUI=hide&shareUrl=http%3A//comedy.video.yahoo.com/%3Fv%3D' . $code . '&repeat=0&vid=' . $code . '&"></embed>' . '</object>'; return $html; } return false; }
function deleteFile($id) { $config = DiscussHelper::getConfig(); if (empty($id)) { return false; } $attachment = DiscussHelper::getTable('Attachments'); if (!$attachment->load($id)) { return false; } return $attachment->delete(); }
public static function getChildCategories($parentId, $isPublishedOnly = false, $includePrivate = true) { static $categories = array(); $sig = $parentId . '-' . (int) $isPublishedOnly . '-' . (int) $includePrivate; if (!array_key_exists($sig, $categories)) { $db = DiscussHelper::getDBO(); $my = JFactory::getUser(); $config = DiscussHelper::getConfig(); $mainframe = JFactory::getApplication(); $sortConfig = $config->get('layout_ordering_category', 'latest'); $query = 'SELECT a.`id`, a.`title`, a.`alias`, a.`private`,a.`default`, a.`container`'; $query .= ' FROM `#__discuss_category` as a'; $query .= ' WHERE a.parent_id = ' . $db->Quote($parentId); if ($isPublishedOnly) { $query .= ' AND a.`published` = ' . $db->Quote('1'); } if (!$mainframe->isAdmin()) { if (!$includePrivate) { //check categories acl here. $catIds = DiscussHelper::getAclCategories(DISCUSS_CATEGORY_ACL_ACTION_VIEW, $my->id, $parentId); if (count($catIds) > 0) { $strIds = ''; foreach ($catIds as $cat) { $strIds = empty($strIds) ? $cat->id : $strIds . ', ' . $cat->id; } $query .= ' AND a.id NOT IN ('; $query .= $strIds; $query .= ')'; } } } switch ($sortConfig) { case 'alphabet': $orderBy = ' ORDER BY a.`title` '; break; case 'ordering': $orderBy = ' ORDER BY a.`lft` '; break; case 'latest': $orderBy = ' ORDER BY a.`created` '; break; default: $orderBy = ' ORDER BY a.`lft` '; break; } $sort = $config->get('layout_sort_category', 'asc'); $query .= $orderBy . $sort; $db->setQuery($query); $result = $db->loadObjectList(); $categories[$sig] = $result; } return $categories[$sig]; }
public function locations($uri = false) { static $locations = array(); $type = $uri ? 'uri' : 'path'; if (isset($locations[$type])) { return $locations[$type]; } $config = DiscussHelper::getConfig(); $URI = $uri ? '_URI' : ''; $DS = $uri ? '/' : DIRECTORY_SEPARATOR; $locations[$type] = array('site' => constant("DISCUSS_SITE_THEMES" . $URI) . $DS . strtolower($config->get('layout_site_theme')), 'site_base' => constant("DISCUSS_SITE_THEMES" . $URI) . $DS . strtolower($config->get('layout_site_theme_base')), 'site_override' => constant("DISCUSS_JOOMLA_SITE_TEMPLATES" . $URI) . $DS . self::getJoomlaTemplate('site') . $DS . "html" . $DS . "com_easydiscuss", 'admin' => constant("DISCUSS_ADMIN_THEMES" . $URI) . $DS . strtolower($config->get('layout_admin_theme')), 'admin_base' => constant("DISCUSS_ADMIN_THEMES" . $URI) . $DS . strtolower($config->get('layout_admin_theme_base')), 'admin_override' => constant("DISCUSS_JOOMLA_ADMIN_TEMPLATES" . $URI) . $DS . self::getJoomlaTemplate('admin') . $DS . "html" . $DS . "com_easydiscuss", 'module' => constant("DISCUSS_JOOMLA_MODULES" . $URI), 'module_override' => constant("DISCUSS_JOOMLA_SITE_TEMPLATES" . $URI) . $DS . self::getJoomlaTemplate('site') . $DS . "html", 'media' => constant("DISCUSS_MEDIA" . $URI), 'foundry' => constant("DISCUSS_FOUNDRY" . $URI), 'root' => constant("DISCUSS_JOOMLA_ROOT" . $URI)); return $locations[$type]; }
function display($tmpl = null) { $config = DiscussHelper::getConfig(); if (!$config->get('main_rss')) { return; } $document = JFactory::getDocument(); $document->link = JRoute::_('index.php?option=com_easydiscuss&view=index'); $document->setTitle($this->escape($document->getTitle())); $sort = JRequest::getString('sort', 'latest'); $filter = JRequest::getString('filter', 'allposts'); $category = JRequest::getInt('category_id', 0); $postModel = $this->getModel('Posts'); $posts = $postModel->getData(true, $sort, null, $filter, $category); $pagination = $postModel->getPagination('0', $sort, $filter, $category); $jConfig = DiscussHelper::getJConfig(); $posts = DiscussHelper::formatPost($posts); require_once DISCUSS_HELPERS . '/parser.php'; foreach ($posts as $row) { // Assign to feed item $title = $this->escape($row->title); $title = html_entity_decode($title); $category = DiscussHelper::getTable('Category'); $category->load($row->category_id); // load individual item creator class $item = new JFeedItem(); //Problems with other language //$item->title = htmlentities( $title ); $item->title = $row->title; $item->link = JRoute::_('index.php?option=com_easydiscuss&view=post&id=' . $row->id); //$row->content = DiscussHelper::parseContent( $row->content ); if ($row->content_type == 'bbcode') { $row->content = DiscussHelper::parseContent($row->content); $row->content = html_entity_decode($row->content); } // Problems with other language //$item->description = htmlentities( $row->content ); $item->description = $row->content; $item->date = DiscussHelper::getDate($row->created)->toMySQL(); $item->author = $row->user->getName(); $item->category = $category->getTitle(); if ($jConfig->get('feed_email') != 'none') { if ($jConfig->get('feed_email') == 'author') { $item->authorEmail = $row->user->user->email; } else { $item->authorEmail = $jConfig->get('mailfrom'); } } $document->addItem($item); } }
function _getnewOwnerShip($curUserId) { $econfig = DiscussHelper::getConfig(); // this should get from backend. If backend not defined, get the default superadmin. $defaultSAid = DiscussHelper::getDefaultSAIds(); $newOwnerShipId = $econfig->get('main_orphanitem_ownership', $defaultSAid); /** * we check if the tobe deleted user is the same user id as the saved user id in config. * if yes, we try to get a next SA id. */ if ($curUserId == $newOwnerShipId) { // this is no no a big no! try to get the next admin. if (DiscussHelper::getJoomlaVersion() >= '1.6') { $saUsersId = DiscussHelper::getSAUsersIds(); if (count($saUsersId) > 0) { for ($i = 0; $i < count($saUsersId); $i++) { if ($saUsersId[$i] != $curUserId) { $newOwnerShip = $saUsersId[$i]; break; } } } } else { $newOwnerShip = $this->_getSuperAdminId($curUserId); } } $newOwnerShipId = $this->_verifyOnwerShip($newOwnerShipId); $db = DiscussHelper::getDBO(); $query = 'SELECT a.`id`, a.`name`, a.`username`, b.`nickname`, a.`email` ' . ' FROM ' . $db->nameQuote('#__users') . ' as a ' . ' INNER JOIN ' . $db->nameQuote('#__discuss_users') . ' as b on a.`id` = b.`id` ' . ' WHERE a.`id` = ' . $db->Quote($newOwnerShipId); $db->setQuery($query); $result = $db->loadAssoc(); $displayFormat = $econfig->get('layout_nameformat', 'name'); $displayName = ''; switch ($displayFormat) { case "name": $displayName = $result['name']; break; case "username": $displayName = $result['username']; break; case "nickname": default: $displayName = empty($result['nickname']) ? $result['name'] : $result['nickname']; break; } $newOwnerShip = new stdClass(); $newOwnerShip->id = $result['id']; $newOwnerShip->name = $displayName; $newOwnerShip->email = $result['email']; return $newOwnerShip; }
/** * Stores a private message composed by the user. * * @since 3.0 * @access public * @param null */ public function save() { JRequest::checkToken('request') or jexit('Invalid Token'); $config = DiscussHelper::getConfig(); $recipientId = JRequest::getInt('recipient', 0); $app = JFactory::getApplication(); $my = JFactory::getUser(); // Test for valid recipients. if (!$recipientId) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_MESSAGING_INVALID_RECIPIENT')); $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=conversation&layout=compose', false)); $app->close(); } // Do not allow user to send a message to himself, it's crazy. if ($recipientId == $my->id) { DiscussHelper::setMessageQueue(JText::_('You should not start a conversation with your self.')); $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=conversation&layout=compose', false)); $app->close(); } // Initialize conversation table. $conversation = DiscussHelper::getTable('Conversation'); // Check if this conversation already exist in the system. $state = $conversation->loadByRelation($my->id, $recipientId); if (!$state) { $date = DiscussHelper::getDate()->toMySQL(); $conversation->created = $date; $conversation->created_by = $my->id; $conversation->lastreplied = $date; $conversation->store(); } // Get message from query. $content = JRequest::getVar('message'); // Initialize message table. $message = DiscussHelper::getTable('ConversationMessage'); $message->message = $content; $message->conversation_id = $conversation->id; $message->created = DiscussHelper::getDate()->toMySQL(); $message->created_by = $my->id; $message->store(); // Add participant to this conversation. $model = DiscussHelper::getModel('Conversation'); $model->addParticipant($conversation->id, $recipientId, $my->id); // Add message map so that recipient can view the message. $model->addMessageMap($conversation->id, $message->id, $recipientId, $my->id); // @TODO: Add notification for recipient to let them know they received a message. // @TODO: Add points for user. // @TODO: Add badge for user. // Set message queue. DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_MESSAGE_SENT')); $app->redirect(DiscussRouter::getMessageRoute($conversation->id, false)); }
public function getEmbedHTML($url) { $code = $this->getCode($url); $config = DiscussHelper::getConfig(); $width = $config->get('bbcode_video_width'); $height = $config->get('bbcode_video_height'); if ($code) { return '<div class="video-container"><iframe title="YouTube video player" width="' . $width . '" height="' . $height . '" src="//www.youtube.com/embed/' . $code . '?wmode=transparent" frameborder="0" allowfullscreen></iframe></div>'; } else { // this video do not have a code. so include the url directly. return '<div class="video-container"><iframe title="YouTube video player" width="' . $width . '" height="' . $height . '" src="' . $url . '&wmode=transparent" frameborder="0" allowfullscreen></iframe></div>'; } return false; }
public function exists() { jimport('joomla.filesystem.file'); $config = DiscussHelper::getConfig(); $path = JPATH_ROOT . '/components/com_alphauserpoints/helper.php'; if (!$config->get('integration_aup')) { return false; } if (JFile::exists($path)) { require_once $path; return true; } return false; }
public static function getHTML() { $config = DiscussHelper::getConfig(); $adsenseObj = new stdClass(); $adsenseObj->header = ''; $adsenseObj->beforereplies = ''; $adsenseObj->footer = ''; $defaultCode = ''; $defaultDisplay = ''; $my = JFactory::getUser(); if (!$config->get('integration_google_adsense_enable')) { return $adsenseObj; } if ($config->get('integration_google_adsense_display_access') == 'members' && $my->id == 0) { return $adsenseObj; } if ($config->get('integration_google_adsense_display_access') == 'guests' && $my->id > 0) { return $adsenseObj; } $adminAdsenseCode = $config->get('integration_google_adsense_code'); $adminAdsenseDisplay = $config->get('integration_google_adsense_display'); if (!empty($adminAdsenseCode)) { $defaultCode = $adminAdsenseCode; $defaultDisplay = $adminAdsenseDisplay; } if (!empty($defaultCode)) { $adTheme = new DiscussThemes(); $adTheme->set('adsense', $defaultCode); $adsenseHTML = $adTheme->fetch('adsense.php'); switch ($defaultDisplay) { case 'beforereplies': $adsenseObj->beforereplies = $adsenseHTML; break; case 'header': $adsenseObj->header = $adsenseHTML; break; case 'footer': $adsenseObj->footer = $adsenseHTML; break; case 'both': default: $adsenseObj->header = $adsenseHTML; $adsenseObj->footer = $adsenseHTML; break; } } //end if return $adsenseObj; }
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); } }
function requestAccess() { $session = JFactory::getSession(); if ($session->has('twitter_oauth_request_token', 'discuss')) { $session->clear('twitter_oauth_request_token', 'discuss'); } $config = DiscussHelper::getConfig(); $consumerKey = $config->get('integration_twitter_consumer_key'); $consumerSecretKey = $config->get('integration_twitter_consumer_secret_key'); $consumer = new DiscussTwitterOAuth($consumerKey, $consumerSecretKey); $callback = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&controller=twitter&task=authorizeAccess', false, true); $request_token = $consumer->getRequestToken($callback); $session->set('twitter_oauth_request_token', "oauth_token=" . $request_token['oauth_token'] . ",oauth_token_secret=" . $request_token['oauth_token_secret'], 'discuss'); $this->setRedirect($consumer->getAuthorizeURL($request_token['oauth_token'], FALSE)); }