/components/com_jfusionplugins/smf/public.php
PHP | 1225 lines | 914 code | 163 blank | 148 comment | 146 complexity | 3ce498713b7f48d1dbf4aae85e5faa2d MD5 | raw file
Possible License(s): Apache-2.0
- <?php
-
- /**
- * @package JFusion_SMF
- * @author JFusion development team
- * @copyright Copyright (C) 2008 JFusion. All rights reserved.
- * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
- */
-
- // no direct access
- defined('_JEXEC' ) or die('Restricted access' );
-
- /**
- * JFusion Public Class for SMF 1.1.x
- * For detailed descriptions on these functions please check the model.abstractpublic.php
- * @package JFusion_SMF
- */
- class JFusionPublic_smf extends JFusionPublic{
-
- var $callbackdata = null;
- var $callbackbypass = null;
-
- function getJname()
- {
- return 'smf';
- }
-
- function getRegistrationURL()
- {
- return 'index.php?action=register';
- }
-
- function getLostPasswordURL()
- {
- return 'index.php?action=reminder';
- }
-
- function getLostUsernameURL()
- {
- return 'index.php?action=reminder';
- }
-
- function getViewNewMessagesURL()
- {
- return 'index.php?action=unread';
- }
-
- function getProfileURL($uid)
- {
- return 'index.php?action=profile&u='.$uid;
- }
-
- function getPrivateMessageURL()
- {
- return 'index.php?action=pm';
- }
-
- /**
- * Prepares text for various areas
- *
- * @param string &$text Text to be modified
- * @param string $for (optional) Determines how the text should be prepared.
- * Options for $for as passed in by JFusion's plugins and modules are:
- * joomla (to be displayed in an article; used by discussion bot)
- * forum (to be published in a thread or post; used by discussion bot)
- * activity (displayed in activity module; used by the activity module)
- * search (displayed as search results; used by search plugin)
- * @param object $params (optional) Joomla parameter object passed in by JFusion's module/plugin
- * @param object $object (optional) Object with information for the specific element the text is from
- *
- * @return array $status Information passed back to calling script such as limit_applied
- */
- function prepareText(&$text, $for = 'forum', $params = '', $object = '')
- {
- $status = array();
- if($for == 'forum') {
- static $bbcode;
-
- //first thing is to remove all joomla plugins
- preg_match_all('/\{(.*)\}/U',$text,$matches);
-
- //find each thread by the id
- foreach($matches[1] AS $plugin) {
- //replace plugin with nothing
- $text = str_replace('{'.$plugin.'}',"",$text);
- }
- if(!is_array($bbcode)) {
- $bbcode = array();
- //pattens to run in begening
- $bbcode[0][] = "#<a[^>]*href=['|\"](ftp://)(.*?)['|\"][^>]*>(.*?)</a>#si";
- $bbcode[1][] = "[ftp=$1$2]$3[/ftp]";
-
- //pattens to run in end
- $bbcode[2][] = '#<table[^>]*>(.*?)<\/table>#si';
- $bbcode[3][] = '[table]$1[/table]';
-
- $bbcode[2][] = '#<tr[^>]*>(.*?)<\/tr>#si';
- $bbcode[3][] = '[tr]$1[/tr]';
-
- $bbcode[2][] = '#<td[^>]*>(.*?)<\/td>#si';
- $bbcode[3][] = '[td]$1[/td]';
-
- $bbcode[2][] = '#<strong[^>]*>(.*?)<\/strong>#si';
- $bbcode[3][] = '[b]$1[/b]';
-
- $bbcode[2][] = '#<(strike|s)>(.*?)<\/\\1>#sim';
- $bbcode[3][] = '[s]$2[/s]';
- }
-
- $options = array();
- $options['bbcode_patterns'] = $bbcode;
- JFusionFunction::parseCode($text,'bbcode',$options);
- } elseif ($for == 'joomla' || ($for == 'activity' && $params->get('parse_text') == 'html')) {
- $options = array();
- //convert smilies so they show up in Joomla as images
- static $custom_smileys;
- if (!is_array($custom_smileys)) {
- $custom_smileys = array();
- $db =& JFusionFactory::getDatabase($this->getJname());
- $query = "SELECT value, variable FROM #__settings WHERE variable = 'smileys_url' OR variable = 'smiley_sets_default'";
- $db->setQuery($query);
- $settings = $db->loadObjectList('variable');
-
- $query = "SELECT code, filename FROM #__smileys ORDER BY smileyOrder";
- $db->setQuery($query);
- $smilies = $db->loadObjectList();
-
- if(!empty($smilies)) {
- foreach($smilies as $s) {
- $custom_smileys[$s->code] = "{$settings['smileys_url']->value}/{$settings['smiley_sets_default']->value}/{$s->filename}";
- }
- }
- }
- $options['custom_smileys'] = $custom_smileys;
- $options['parse_smileys'] = true;
- //parse bbcode to html
- if (!empty($params) && $params->get('character_limit', false)) {
- $status['limit_applied'] = 1;
- $options['character_limit'] = $params->get('character_limit');
- }
-
- //add smf bbcode rules
- $options['html_patterns'] = array();
- $options['html_patterns']['li'] = array('simple_start' => "<li>", 'simple_end' => "</li>\n", 'class' => 'listitem', 'allow_in' => array('list'), 'end_tag' => 0, 'before_tag' => "s", 'after_tag' => "s", 'before_endtag' => "sns", 'after_endtag' => "sns", 'plain_start' => "\n * ", 'plain_end' => "\n");
-
- $bbcodes = array('size', 'glow', 'shadow', 'move', 'pre', 'hr', 'flash', 'ftp', 'table', 'tr', 'td', 'tt', 'abbr', 'anchor', 'black', 'blue', 'green', 'iurl', 'html', 'ltr', 'me', 'nobbc', 'php', 'red', 'rtl', 'time', 'white', 'o', 'O', '0', '@', '*', '=', '@', '+', 'x', '#');
-
- foreach($bbcodes as $bb) {
- if (in_array($bb, array('ftp', 'iurl'))) {
- $class = 'link';
- } elseif (in_array($bb, array('o', 'O', '0', '@', '*', '=', '@', '+', 'x', '#'))) {
- $class = 'listitem';
- } elseif ($bb == 'table') {
- $class = 'table';
- } else {
- $class = 'inline';
- }
-
- if (in_array($bb, array('o', 'O', '0', '@', '*', '=', '@', '+', 'x', '#'))) {
- $allow_in = array('list');
- } elseif (in_array($bb, array('td', 'tr'))) {
- $allow_in = array('table');
- } else {
- $allow_in = array('listitem', 'block', 'columns', 'inline', 'link');
- }
-
- $options['html_patterns'][$bb] = array('mode' => 1, 'content' => 0, 'method' => array($this, 'parseCustomBBCode'), 'class' => $class, 'allow_in' => $allow_in);
- }
-
- JFusionFunction::parseCode($text,'html',$options);
- } elseif ($for == 'search') {
- JFusionFunction::parseCode($text, 'plaintext');
- } elseif ($for == 'activity') {
- if ($params->get('parse_text') == 'plaintext') {
- $options = array();
- $options['plaintext_line_breaks'] = 'space';
- if ($params->get('character_limit')) {
- $status['limit_applied'] = 1;
- $options['character_limit'] = $params->get('character_limit');
- }
- JFusionFunction::parseCode($text, 'plaintext', $options);
- }
- }
-
- return $status;
- }
-
- function getBuffer(&$data)
- {
- $action = JRequest::getVar('action');
- $params = JFusionFactory::getParams($this->getJname());
-
- if ($action=='logout') {
- $mainframe = &JFactory::getApplication();
-
- // logout any joomla users
- $mainframe->logout();
-
- // clean up session
- $session =& JFactory::getSession();
- $session->close();
-
- JFusionFunction::addCookie($params->get('cookie_name'), '',0,$params->get('cookie_path'),$params->get('cookie_domain'),$params->get('secure'),$params->get('httponly'));
-
- $mainframe->redirect(str_replace('&', '&', $data->baseURL));
- exit();
- }
-
- // We're going to want a few globals... these are all set later.
- global $time_start, $maintenance, $msubject, $mmessage, $mbname, $language;
- global $boardurl, $boarddir, $sourcedir, $webmaster_email, $cookiename;
- global $db_connection, $db_server, $db_name, $db_user, $db_prefix, $db_persist, $db_error_send, $db_last_error;
- global $modSettings, $context, $sc, $user_info, $topic, $board, $txt;
- global $scripturl, $ID_MEMBER, $func;
-
- global $settings, $options, $board_info, $attachments, $messages_request ,$memberContext, $db_character_set;
-
- // Required to avoid a warning about a license violation even though this is not the case
- global $forum_version;
-
- // require_once(JFUSION_PLUGIN_PATH.DS.$this->getJname().DS.'hooks.php');
-
- $source_path = $params->get('source_path');
-
- if (substr($source_path, -1) == DS) {
- $index_file = $source_path .'index.php';
- } else {
- $index_file = $source_path .DS.'index.php';
- }
-
- if ( ! is_file($index_file) ) {
- JError::raiseWarning(500, 'The path to the SMF index file set in the component preferences does not exist');
- return null;
- }
-
- //set the current directory to SMF
- chdir($source_path);
- $this->callbackdata = $data;
- $this->callbackbypass = false;
-
- // Get the output
- ob_start(array($this, 'callback'));
- $h = ob_list_handlers();
- $rs = include_once($index_file);
- // die if popup
- if ( $action == 'findmember' || $action == 'helpadmin' || $action == 'spellcheck' || $action == 'requestmembers' || strpos($action ,'xml') !== false ) {
- exit();
- } else {
- $this->callbackbypass = true;
- }
- while( in_array( get_class($this).'::callback' , $h) ) {
- $data->buffer .= ob_get_contents();
- ob_end_clean();
- $h = ob_list_handlers();
- }
-
- //change the current directory back to Joomla.
- chdir(JPATH_SITE);
-
- // Log an error if we could not include the file
- if (!$rs) {
- JError::raiseWarning(500, 'Could not find SMF in the specified directory');
- }
- $document = JFactory::getDocument();
- $document->addScript(JFusionFunction::getJoomlaURL().JFUSION_PLUGIN_DIR_URL.'smf/js/script.js');
- }
-
- function parseBody(&$data)
- {
- $regex_body = array();
- $replace_body = array();
-
- //fix for form actions
- $regex_body[] = '#action="'.$data->integratedURL.'index.php(.*?)"(.*?)>#me';
- $replace_body[] = '$this->fixAction("index.php$1","$2","' . $data->baseURL .'")';
-
- $regex_body[] = '#href="'.$data->integratedURL.'index.php(.*?)"#Sise';
- $replace_body[] = '\'href="\'.$this->fixUrl("index.php$1","'.$data->baseURL.'","'.$data->fullURL.'").\'"\'';
-
- $regex_body[] = '#href="\#(.*?)"#Sise';
- $replace_body[] = '\'href="\'.$this->fixUrl("#$1","'.$data->baseURL.'","'.$data->fullURL.'").\'"\'';
-
- //Jump Related fix
- $regex_body[] = '#<select name="jumpto" id="jumpto".*?">(.*?)</select>#mSsie';
- $replace_body[] = '$this->fixJump("$1")';
-
- $regex_body[] = '#<input (.*?) window.location.href = \'(.*?)\' \+ this.form.jumpto.options(.*?)>#mSsi';
- $replace_body[] = '<input $1 window.location.href = jf_scripturl + this.form.jumpto.options$3>';
-
- $regex_body[] = '#smf_scripturl \+ \"\?action#mSsi';
- $replace_body[] = 'jf_scripturl + "&action';
-
- $regex_body[] = '#<a (.*?) onclick="doQuote(.*?)>#mSsi';
- $replace_body[] = '<a $1 onclick="jfusion_doQuote$2>';
-
- $regex_body[] = '#<a (.*?) onclick="modify_msg(.*?)>#mSsi';
- $replace_body[] = '<a $1 onclick="jfusion_modify_msg$2>';
-
- $regex_body[] = '#modify_save\(#mSsi';
- $replace_body[] = 'jfusion_modify_save(';
-
- // Chaptcha fix
- $regex_body[] = '#\"'.$data->integratedURL.'(index.php\?)(action=verificationcode;rand=)(.*?)\"#sie';
- $replace_body[] = '\'"\'.$this->fixUrl("index.php?$2$3","'.$data->baseURL.'","'.$data->fullURL.'").\'"\'';
-
- //Fix auto member search
- $regex_body[] = '#toComplete\.source = \"'.$data->integratedURL.'(.*?)\"#sie';
- $replace_body[] = '\'toComplete.source = "\'.$this->fixUrlNoAmp("$1","'.$data->baseURL.'","'.$data->fullURL.'").\'"\'';
- $regex_body[] = '#bccComplete\.source = \"'.$data->integratedURL.'(.*?)\"#sie';
- $replace_body[] = '\'bccComplete.source = "\'.$this->fixUrlNoAmp("$1","'.$data->baseURL.'","'.$data->fullURL.'").\'"\'';
-
- $data->body = preg_replace($regex_body, $replace_body, $data->body);
- }
-
- function parseHeader(&$data)
- {
- static $regex_header, $replace_header;
- if ( ! $regex_header || ! $replace_header )
- {
- $params = JFusionFactory::getParams('joomla_int');
- $joomla_url = $params->get('source_url');
-
- $baseURLnoSef = 'index.php?option=com_jfusion&Itemid=' . JRequest::getInt('Itemid');
- if (substr($joomla_url, -1) == '/') $baseURLnoSef = $joomla_url . $baseURLnoSef;
- else $baseURLnoSef = $joomla_url . '/' . $baseURLnoSef;
-
- // Define our preg arrays
- $regex_header = array();
- $replace_header = array();
-
- //convert relative links into absolute links
- $regex_header[] = '#(href|src)=("./|"/)(.*?)"#mS';
- $replace_header[] = '$1="'.$data->integratedURL.'$3"';
-
- //$regex_header[] = '#(href|src)="(.*)"#mS';
- //$replace_header[] = 'href="'.$data->integratedURL.'$2"';
-
- //convert relative links into absolute links
- $regex_header[] = '#(href|src)=("./|"/)(.*?)"#mS';
- $replace_header[] = '$1="'.$data->integratedURL.'$3"';
-
- $regex_header[] = '#var smf_scripturl = ["|\'](.*?)["|\'];#mS';
- $replace_header[] = 'var smf_scripturl = "$1"; var jf_scripturl = "'.$baseURLnoSef.'";';
-
- //fix for URL redirects
- $regex_header[] = '#<meta http-equiv="refresh" content="(.*?)"(.*?)>#me';
- $replace_header[] = '$this->fixRedirect("$1","' . $data->baseURL . '")';
- }
- $data->header = preg_replace($regex_header, $replace_header, $data->header);
- }
-
- function fixUrl($q='',$baseURL,$fullURL)
- {
- //SMF uses semi-colons to seperate vars as well. Convert these to normal ampersands
- $q = str_replace(';','&',$q);
-
- if ( strpos($q,'#') === 0 ) return $fullURL.$q;
-
- if (substr($baseURL, -1) != '/'){
- //non sef URls
- $q = str_replace('?', '&', $q);
- $url = $baseURL . '&jfile=' .$q;
- } else {
- $params = JFusionFactory::getParams($this->getJname());
- $sefmode = $params->get('sefmode');
- if ($sefmode==1) {
- $url = JFusionFunction::routeURL($q, JRequest::getInt('Itemid'));
- } else {
- //we can just append both variables
- $url = $baseURL . $q;
- }
- }
- return $url;
- }
-
- /**
- * Fix url with no amps
- *
- * @param string $q start url
- * @param string $baseURL base url
- * @param string $fullURL full url
- *
- * @return string url
- */
- function fixUrlNoAmp($q, $baseURL, $fullURL)
- {
- $url = $this->fixUrl($q, $baseURL, $fullURL);
- $url = str_replace('&', '&', $url);
- return $url;
- }
-
- function fixAction($url, $extra, $baseURL)
- {
- //JError::raiseWarning(500, $url);
- $url = htmlspecialchars_decode($url);
- $Itemid = JRequest::getInt('Itemid');
-
- $extra = stripslashes( $extra );
- $url = str_replace(';','&',$url);
- if (substr($baseURL, -1) != '/'){
- //non-SEF mode
- $url_details = parse_url($url);
- $url_variables = array();
- $jfile = basename($url_details['path']);
- if ( isset($url_details['query']) ) {
- parse_str($url_details['query'], $url_variables);
- $baseURL .= '&'.$url_details['query'];
- }
- //set the correct action and close the form tag
- $replacement = 'action="'.$baseURL . '"' . $extra . '>';
- $replacement .= '<input type="hidden" name="jfile" value="'. $jfile . '"/>';
- $replacement .= '<input type="hidden" name="Itemid" value="'.$Itemid . '"/>';
- $replacement .= '<input type="hidden" name="option" value="com_jfusion"/>';
- } else {
- //check to see what SEF mode is selected
- $params = JFusionFactory::getParams($this->getJname());
- $sefmode = $params->get('sefmode');
- if ($sefmode==1) {
- //extensive SEF parsing was selected
- $url = JFusionFunction::routeURL($url, $Itemid);
- $replacement = 'action="'.$url . '"' . $extra . '>';
- return $replacement;
- } else {
- //simple SEF mode
- $url_details = parse_url($url);
- $url_variables = array();
- $jfile = basename($url_details['path']);
- if ( isset($url_details['query']) ) {
- parse_str($url_details['query'], $url_variables);
- $jfile .= '?'.$url_details['query'];
- }
- $replacement = 'action="'.$baseURL . $jfile.'"' . $extra . '>';
- }
- }
- unset($url_variables['option'],$url_variables['jfile'],$url_variables['Itemid']);
-
- //add any other variables
- /* Commented out because of problems with wrong variables being set
- if(is_array($url_variables)){
- foreach ($url_variables as $key => $value){
- $replacement .= '<input type="hidden" name="'. $key .'" value="'.$value . '"/>';
- }
- }
- */
- return $replacement;
- }
-
- function fixJump($content)
- {
- $find = '#<option value="[?](.*?)">(.*?)</option>#mSsi';
- $replace = '<option value="&$1">$2</option>';
-
- $content = preg_replace($find, $replace, $content);
-
- return '<select name="jumpto" id="jumpto" onchange="if (this.selectedIndex > 0 && this.options[this.selectedIndex].value && this.options[this.selectedIndex].value.length) window.location.href = jf_scripturl + this.options[this.selectedIndex].value;">'.$content.'</select>';
- }
-
- function fixRedirect($url, $baseURL) {
- //JError::raiseWarning(500, $url);
- //split up the timeout from url
- $parts = explode(';url=', $url);
- $timeout = $parts[0];
- $uri = new JURI($parts[1]);
- $jfile = $uri->getPath();
- $jfile = basename($jfile);
- $query = $uri->getQuery(false);
- $fragment = $uri->getFragment();
- if (substr($baseURL, -1) != '/') {
- //non-SEF mode
- $redirectURL = $baseURL . '&jfile=' . $jfile;
- if (!empty($query)) {
- $redirectURL.= '&' . $query;
- }
- } else {
- //check to see what SEF mode is selected
- $params = JFusionFactory::getParams($this->getJname());
- $sefmode = $params->get('sefmode');
- if ($sefmode == 1) {
- //extensive SEF parsing was selected
- $redirectURL = $jfile;
- if (!empty($query)) {
- $redirectURL.= '?' . $query;
- }
- $redirectURL = JFusionFunction::routeURL($redirectURL, JRequest::getInt('Itemid'));
- } else {
- //simple SEF mode, we can just combine both variables
- $redirectURL = $baseURL . $jfile;
- if (!empty($query)) {
- $redirectURL.= '?' . $query;
- }
- }
- }
- if (!empty($fragment)) {
- $redirectURL .= "#$fragment";
- }
- $return = '<meta http-equiv="refresh" content="' . $timeout . ';url=' . $redirectURL . '">';
- //JError::raiseWarning(500, htmlentities($return));
- return $return;
- }
-
- function getPathWay()
- {
- $db = JFusionFactory::getDatabase($this->getJname());
- $pathway = array();
-
- list ($board_id ) = split ( '.' , JRequest::getVar('board'),1 );
- list ($topic_id ) = split ( '.' , JRequest::getVar('topic'),1 );
- list ($action ) = split ( ';' , JRequest::getVar('action'),1 );
-
- $msg = JRequest::getVar('msg');
-
- $query = 'SELECT ID_TOPIC,ID_BOARD, subject '.
- 'FROM #__messages '.
- 'WHERE ID_TOPIC = ' . $db->Quote($topic_id);
- $db->setQuery($query );
- $topic = $db->loadObject();
-
- if ($topic) {
- $board_id = $topic->ID_BOARD;
- }
-
- if ($board_id) {
- $boards = array();
- // Loop while the parent is non-zero.
- while ($board_id != 0)
- {
- $query = 'SELECT b.ID_PARENT , b.ID_BOARD, b.ID_CAT, b.name , c.name as catname '.
- 'FROM #__boards AS b INNER JOIN #__categories AS c ON b.ID_CAT = c.ID_CAT '.
- 'WHERE ID_BOARD = ' . $db->Quote($board_id);
- $db->setQuery($query );
- $result = $db->loadObject();
-
- $board_id = 0;
- if ($result) {
- $board_id = $result->ID_PARENT;
- $boards[] = $result;
- }
- }
- $boards = array_reverse($boards);
- $cat_id = 0;
- foreach($boards as $board) {
- $path = new stdClass();
- if ( $board->ID_CAT != $cat_id ) {
- $cat_id = $board->ID_CAT;
- $path->title = $board->catname;
- $path->url = 'index.php#'.$board->ID_CAT;
- $pathway[] = $path;
-
- $path = new stdClass();
- $path->title = $board->name;
- $path->url = 'index.php?board='.$board->ID_BOARD.'.0';
- } else {
- $path->title = $board->name;
- $path->url = 'index.php?board='.$board->ID_BOARD.'.0';
- }
- $pathway[] = $path;
- }
- }
- switch ($action) {
- case 'post':
- $path = new stdClass();
- if ( JRequest::getVar('board') ) {
- $path->title = 'Modify Toppic ( Start new topic )';
- $path->url = 'index.php?action=post&board='.$board_id.'.0';;
- } else if ( $msg ) {
- $path->title = 'Modify Toppic ( '.$topic->subject.' )';
- $path->url = 'index.php?action=post&topic='.$topic_id.'.msg'.$msg.'#msg'.$msg;
- } else {
- $path->title = 'Post reply ( Re: '.$topic->subject.' )';
- $path->url = 'index.php?action=post&topic='.$topic_id;
- }
- $pathway[] = $path;
- break;
- case 'pm':
- $path = new stdClass();
- $path->title = 'Personal Messages';
- $path->url = 'index.php?action=pm';
- $pathway[] = $path;
-
- $path = new stdClass();
- if ( JRequest::getVar('sa')=='send' ) {
- $path->title = 'New Message';
- $path->url = 'index.php?action=pm&sa=send';
- $pathway[] = $path;
- } elseif ( JRequest::getVar('sa')=='search' ) {
- $path->title = 'Search Messages';
- $path->url = 'index.php?action=pm&sa=search';
- $pathway[] = $path;
- } elseif ( JRequest::getVar('sa')=='prune' ) {
- $path->title = 'Prune Messages';
- $path->url = 'index.php?action=pm&sa=prune';
- $pathway[] = $path;
- } elseif ( JRequest::getVar('sa')=='manlabels' ) {
- $path->title = 'Manage Labels';
- $path->url = 'index.php?action=pm&sa=manlabels';
- $pathway[] = $path;
- } elseif ( JRequest::getVar('f')=='outbox' ) {
- $path->title = 'Outbox';
- $path->url = 'index.php?action=pm&f=outbox';
- $pathway[] = $path;
- } else {
- $path->title = 'Inbox';
- $path->url = 'index.php?action=pm';
- $pathway[] = $path;
- }
- break;
- case 'search2':
- $path = new stdClass();
- $path->title = 'Search';
- $path->url = 'index.php?action=search';
- $pathway[] = $path;
- $path = new stdClass();
- $path->title = 'Search Results';
- $path->url = 'index.php?action=search';
- $pathway[] = $path;
- break;
- case 'search':
- $path = new stdClass();
- $path->title = 'Search';
- $path->url = 'index.php?action=search';
- $pathway[] = $path;
- break;
- case 'unread':
- $path = new stdClass();
- $path->title = 'Recent Unread Topics';
- $path->url = 'index.php?action=unread';
- $pathway[] = $path;
- break;
- case 'unreadreplies':
- $path = new stdClass();
- $path->title = 'Updated Topics';
- $path->url = 'index.php?action=unreadreplies';
- $pathway[] = $path;
- break;
- default:
- if ( $topic_id ) {
- $path = new stdClass();
- $path->title = $topic->subject;
- $path->url = 'index.php?topic='.$topic_id;
- $pathway[] = $path;
- }
- }
- return $pathway;
- }
-
- function getPrivateMessageCounts($userid)
- {
- if ($userid) {
-
- // initialise some objects
- $db = JFusionFactory::getDatabase($this->getJname());
-
- // read unread count
- $db->setQuery('SELECT unreadMessages FROM #__members WHERE ID_MEMBER = '.$userid);
- $unreadCount = $db->loadResult();
-
- // read total pm count
- $db->setQuery('SELECT instantMessages FROM #__members WHERE ID_MEMBER = '.$userid);
- $totalCount = $db->loadResult();
-
- return array('unread' => $unreadCount, 'total' => $totalCount);
- }
- return array('unread' => 0, 'total' => 0);
- }
-
- function getAvatar($puser_id)
- {
- if ($puser_id) {
- // Get SMF Params and get an instance of the database
- $params = JFusionFactory::getParams($this->getJname());
- $db = JFusionFactory::getDatabase($this->getJname());
- // Load member params from database "mainly to get the avatar"
- $db->setQuery('SELECT * FROM #__members WHERE ID_MEMBER='.$puser_id);
- $db->query();
- $result = $db->loadObject();
-
- if (!empty($result)) {
- $url = '';
- // SMF has a wierd way of holding attachments. Get instance of the attachments table
- $db->setQuery('SELECT * FROM #__attachments WHERE ID_MEMBER='.$puser_id);
- $db->query();
- $attachment = $db->loadObject();
- // See if the user has a specific attachment ment for an avatar
- if(!empty($attachment) && $attachment->ID_THUMB == 0 && $attachment->ID_MSG == 0 && empty($result->avatar)) {
- $url = $params->get('source_url').'index.php?action=dlattach;attach='.$attachment->ID_ATTACH.';type=avatar';
- // If user didnt, check to see if the avatar specified in the first query is a url. If so use it.
- } else if(preg_match("/http(s?):\/\//",$result->avatar)){
- $url = $result->avatar;
- } else if($result->avatar) {
- // If the avatar specified in the first query is not a url but is a file name. Make it one
- $db->setQuery('SELECT * FROM #__settings WHERE variable = "avatar_url"');
- $avatarurl = $db->loadObject();
- // Check for trailing slash. If there is one DONT ADD ONE!
- if(substr($avatarurl->value, -1) == DS){
- $url = $avatarurl->value.$result->avatar;
- // I like redundancy. Recheck to see if there isnt a trailing slash. If there isnt one, add one.
- } else if(substr($avatarurl->value, -1) !== DS){
- $url = $avatarurl->value."/".$result->avatar;
- }
- }
-
- return $url;
- }
- }
- }
-
- /************************************************
- * For JFusion Search Plugin
- ***********************************************/
- function getSearchQueryColumns()
- {
- $columns = new stdClass();
- $columns->title = "p.subject";
- $columns->text = "p.body";
- return $columns;
- }
-
- function getSearchQuery(&$pluginParam)
- {
- //need to return threadid, postid, title, text, created, section
- $query = 'SELECT p.ID_TOPIC, p.ID_MSG, p.ID_BOARD, CASE WHEN p.subject = "" THEN CONCAT("Re: ",fp.subject) ELSE p.subject END AS title, p.body AS text,
- FROM_UNIXTIME(p.posterTime, "%Y-%m-%d %h:%i:%s") AS created,
- CONCAT_WS( "/", f.name, fp.subject ) AS section,
- t.numViews AS hits
- FROM #__messages AS p
- INNER JOIN #__topics AS t ON t.ID_TOPIC = p.ID_TOPIC
- INNER JOIN #__messages AS fp ON fp.ID_MSG = t.ID_FIRST_MSG
- INNER JOIN #__boards AS f on f.ID_BOARD = p.ID_BOARD';
- return $query;
- }
-
- /**
- * Add on a plugin specific clause;
- * @param object &$pluginParam custom plugin parameters in search.xml
- * @param $where reference to where clause already generated by search bot; add on plugin specific criteria
- */
- function getSearchCriteria(&$where, &$pluginParam, $ordering)
- {
- $db = JFusionFactory::getDatabase($this->getJname());
-
- $userPlugin = JFusionFactory::getUser($this->getJname());
-
- $user =& JFactory::getUser();
- $userid = $user->get('id');
-
- if ($userid) {
- $userlookup = JFusionFunction::lookupUser($this->getJname(),$userid,true);
- $existinguser = $userPlugin->getUser($userlookup);
- $group_id = $existinguser->group_id;
- } else {
- $group_id = '-1';
- }
-
- if ($pluginParam->get('forum_mode', 0)) {
- $forumids = $pluginParam->get('selected_forums', array());
- $selected_boards = " WHERE ID_BOARD IN (" . implode(',', $forumids) . ")";
- } else {
- $selected_boards = '';
- }
-
- $query = 'SELECT memberGroups, ID_BOARD FROM #__boards' . $selected_boards;
- $db->setQuery($query);
- $boards = $db->loadObjectList();
-
- $list = array();
- foreach( $boards as $key => $value ) {
- $member_groups = explode( ',' , $value->memberGroups );
- if ( in_array($group_id, $member_groups) || $group_id == 1) {
- $list[] = $value->ID_BOARD;
- }
- }
-
- //determine how to sort the results which is required for accurate results when a limit is placed
- switch ($ordering) {
- case 'oldest':
- $sort = 'p.posterTime ASC';
- break;
- case 'category':
- $sort = 'section ASC';
- break;
- case 'popular':
- $sort = 't.numViews DESC, p.posterTime DESC';
- case 'alpha':
- $sort = 'title ASC';
- break;
- case 'newest':
- default:
- $sort = 'p.posterTime DESC';
- break;
- }
- $where .= ' AND p.ID_BOARD IN ('.implode(',',$list).') ORDER BY ' . $sort;
- }
-
- function filterSearchResults(&$results, &$pluginParam)
- {
- $db =& JFusionFactory::getDatabase($this->getJname());
- $query = "SELECT value FROM #__settings WHERE variable='censor_vulgar'";
- $db->setQuery($query);
- $vulgar = $db->loadResult();
-
- $db =& JFusionFactory::getDatabase($this->getJname());
- $query = "SELECT value FROM #__settings WHERE variable='censor_proper'";
- $db->setQuery($query);
- $proper = $db->loadResult();
-
- $vulgar = explode ( ',' , $vulgar );
- $proper = explode ( ',' , $proper );
-
- foreach($results as $rkey => $result) {
- foreach( $vulgar as $key => $value ) {
- $results[$rkey]->subject = preg_replace ( '#\b'.$value.'\b#is' , $proper[$key] , $result->subject );
- $results[$rkey]->body = preg_replace ( '#\b'.$value.'\b#is' , $proper[$key] , $result->body );
- }
- }
- }
-
- function getSearchResultLink($post)
- {
- $forum = JFusionFactory::getForum($this->getJname());
- return $forum->getPostURL($post->ID_TOPIC,$post->ID_MSG);
- }
-
- /************************************************
- * Functions For JFusion Who's Online Module
- ***********************************************/
-
- /**
- * Returns a query to find online users
- * Make sure columns are named as userid, username, username_clean (if applicable), name (of user), and email
- **/
- function getOnlineUserQuery($limit, $usergroups = '')
- {
- $usergroup_query = "";
- if($usergroups!='') {
- if(is_array($usergroups)) {
- $usergroups = implode(',',$usergroups);
- $usergroup_query .= "AND (u.ID_GROUP IN ($usergroups) OR u.ID_POST_GROUP IN ($usergroups)";
- foreach($usergroups AS $u) {
- $usergroup_query .= " OR FIND_IN_SET(" . intval($u) . ", u.additionalGroups)";
- }
- $usergroup_query .= ")";
- } else {
- $usergroup_query .= "AND (u.ID_GROUP = $usergroups OR u.ID_POST_GROUP = $usergroups OR FIND_IN_SET($usergroups, u.additionalGroups))";
- }
- }
- $limiter = (!empty($limit)) ? "LIMIT 0,$limit" : '';
-
- return "SELECT DISTINCT u.ID_MEMBER AS userid, u.memberName AS username, u.realName AS name, u.emailAddress as email FROM #__members AS u INNER JOIN #__log_online AS s ON u.ID_MEMBER = s.ID_MEMBER WHERE s.ID_MEMBER != 0 $usergroup_query $limiter";
- }
-
- /**
- * Returns number of guests
- * @return int
- */
- function getNumberOnlineGuests()
- {
- $db =& JFusionFactory::getDatabase($this->getJname());
- $query = "SELECT COUNT(DISTINCT(ip)) FROM #__log_online WHERE ID_MEMBER = 0";
- $db->setQuery($query);
- return $db->loadResult();
- }
-
- /**
- * Returns number of logged in users
- * @return int
- */
- function getNumberOnlineMembers($usergroups = '', $total = 1)
- {
- $db =& JFusionFactory::getDatabase($this->getJname());
-
- $usergroup_query = "";
- if($usergroups!='' && empty($total)) {
- if(is_array($usergroups)) {
- $usergroups = implode(',',$usergroups);
- $usergroup_query .= "AND (u.ID_GROUP IN ($usergroups) OR u.ID_POST_GROUP IN ($usergroups)";
- foreach($usergroups AS $u) {
- $usergroup_query .= " OR FIND_IN_SET(" . intval($u) . ", u.additionalGroups)";
- }
- $usergroup_query .= ")";
- } else {
- $usergroup_query .= "AND (u.ID_GROUP = $usergroups OR u.ID_POST_GROUP = $usergroups OR FIND_IN_SET($usergroups, u.additionalGroups))";
- }
- }
-
- $query = "SELECT COUNT(DISTINCT(l.ip)) FROM #__log_online AS l JOIN #__members AS u ON l.ID_MEMBER = u.ID_MEMBER WHERE l.ID_MEMBER != 0 $usergroup_query";
- $db->setQuery($query);
- return $db->loadResult();
- }
-
- /************************************************
- * Functions For JFusion Activity Module
- ***********************************************/
-
- /**
- * Returns the an array with SQL statements used by the activity module
- * @return array
- */
- function getActivityQuery($usedforums, $result_order, $result_limit)
- {
- $db = & JFusionFactory::getDatabase($this->getJname());
-
- $userPlugin = & JFusionFactory::getUser($this->getJname());
-
- $user =& JFactory::getUser();
- $userid = $user->get('id');
-
- if ($userid) {
- $userlookup = JFusionFunction::lookupUser($this->getJname(),$userid,true);
- $existinguser = $userPlugin->getUser($userlookup);
- $group_id = $existinguser->group_id;
- } else {
- $group_id = '-1';
- }
-
- $query = 'SELECT memberGroups, ID_BOARD FROM #__boards';
- $db->setQuery($query);
- $boards = $db->loadObjectList();
-
- $list = array();
- foreach( $boards as $key => $value ) {
- $member_groups = explode( ',' , $value->memberGroups );
- if ( in_array($group_id, $member_groups) || $group_id == 1) {
- $list[] = $value->ID_BOARD;
- }
- }
-
- $where = (!empty($usedforums)) ? ' WHERE b.ID_BOARD IN (' . $usedforums .') AND a.ID_BOARD IN ('.implode(',',$list).')' : ' WHERE a.ID_BOARD IN ('.implode(',',$list).')';
- $end = $result_order." LIMIT 0,".$result_limit;
-
- $numargs = func_num_args();
- if ($numargs > 3) {
- $filters = func_get_args();
- $i = 3;
- for ($i = 3; $i < $numargs; $i++) {
- if ($filters[$i][0] == 'userid') {
- $where.= ' HAVING userid = ' . $db->Quote($filters[$i][1]);
- }
- }
- }
-
- //setup the guest where clause to be used in union query
- $guest_where = (empty($where)) ? " WHERE b.ID_MEMBER = 0" : " AND b.ID_MEMBER = 0";
-
- $query = array(
- //LAT with first post info
- LAT . '0' =>
- "(SELECT a.ID_TOPIC AS threadid, a.ID_LAST_MSG AS postid, b.posterName AS username, d.realName AS name, b.ID_MEMBER AS userid, b.subject AS subject, b.posterTime AS dateline, a.ID_BOARD as forumid, c.posterTime as last_post_date
- FROM `#__topics` as a
- INNER JOIN `#__messages` as b ON a.ID_FIRST_MSG = b.ID_MSG
- INNER JOIN `#__messages` as c ON a.ID_LAST_MSG = c.ID_MSG
- INNER JOIN `#__members` as d ON b.ID_MEMBER = d.ID_MEMBER
- $where)
- UNION
- (SELECT a.ID_TOPIC AS threadid, a.ID_LAST_MSG AS postid, b.posterName AS username, b.posterName AS name, b.ID_MEMBER AS userid, b.subject AS subject, b.posterTime AS dateline, a.ID_BOARD as forumid, c.posterTime as last_post_date
- FROM `#__topics` as a
- INNER JOIN `#__messages` as b ON a.ID_FIRST_MSG = b.ID_MSG
- INNER JOIN `#__messages` as c ON a.ID_LAST_MSG = c.ID_MSG
- $where $guest_where)
- ORDER BY last_post_date $end",
- //LAT with latest post info
- LAT . '1' =>
- "(SELECT a.ID_TOPIC AS threadid, a.ID_LAST_MSG AS postid, b.posterName AS username, d.realName as name, b.ID_MEMBER AS userid, c.subject AS subject, b.posterTime AS dateline, a.ID_BOARD as forumid, b.posterTime as last_post_date
- FROM `#__topics` as a
- INNER JOIN `#__messages` as b ON a.ID_LAST_MSG = b.ID_MSG
- INNER JOIN `#__messages` as c ON a.ID_FIRST_MSG = c.ID_MSG
- INNER JOIN `#__members` as d ON b.ID_MEMBER = d.ID_MEMBER
- $where)
- UNION
- (SELECT a.ID_TOPIC AS threadid, a.ID_LAST_MSG AS postid, b.posterName AS username, b.posterName as name, b.ID_MEMBER AS userid, c.subject AS subject, b.posterTime AS dateline, a.ID_BOARD as forumid, b.posterTime as last_post_date
- FROM `#__topics` as a
- INNER JOIN `#__messages` as b ON a.ID_LAST_MSG = b.ID_MSG
- INNER JOIN `#__messages` as c ON a.ID_FIRST_MSG = c.ID_MSG
- $where $guest_where)
- ORDER BY last_post_date $end",
- //LCT
- LCT =>
- "(SELECT a.ID_TOPIC AS threadid, b.ID_MSG AS postid, b.posterName AS username, d.realName as name, b.ID_MEMBER AS userid, b.subject AS subject, b.body, b.posterTime AS dateline, a.ID_BOARD as forumid, b.posterTime as topic_date
- FROM `#__topics` as a
- INNER JOIN `#__messages` as b ON a.ID_FIRST_MSG = b.ID_MSG
- INNER JOIN `#__messages` as c ON a.ID_LAST_MSG = c.ID_MSG
- INNER JOIN `#__members` as d ON b.ID_MEMBER = d.ID_MEMBER
- $where)
- UNION
- (SELECT a.ID_TOPIC AS threadid, b.ID_MSG AS postid, b.posterName AS username, b.posterName as name, b.ID_MEMBER AS userid, b.subject AS subject, b.body, b.posterTime AS dateline, a.ID_BOARD as forumid, b.posterTime as topic_date
- FROM `#__topics` as a
- INNER JOIN `#__messages` as b ON a.ID_FIRST_MSG = b.ID_MSG
- INNER JOIN `#__messages` as c ON a.ID_LAST_MSG = c.ID_MSG
- $where $guest_where)
- ORDER BY topic_date $end",
- //LCP
- LCP => "
- (SELECT b.ID_TOPIC AS threadid, b.ID_MSG AS postid, b.posterName AS username, d.realName as name, b.ID_MEMBER AS userid, b.subject AS subject, b.body, b.posterTime AS dateline, b.ID_BOARD as forumid, b.posterTime as last_post_date
- FROM `#__messages` as b
- INNER JOIN `#__members` as d ON b.ID_MEMBER = d.ID_MEMBER
- $where)
- UNION
- (SELECT b.ID_TOPIC AS threadid, b.ID_MSG AS postid, b.posterName AS username, b.posterName as name, b.ID_MEMBER AS userid, b.subject AS subject, b.body, b.posterTime AS dateline, b.ID_BOARD as forumid, b.posterTime as last_post_date
- FROM `#__messages` as b
- $where $guest_where)
- ORDER BY last_post_date $end");
-
- return $query;
- }
-
- /**
- * Filter forums from a set of results sent in / useful if the plugin needs to restrict the forums visible to a user
- * @param $results set of results from query
- * @param $limit int limit results parameter as set in the module's params; used for plugins that cannot limit using a query limiter
- */
- function filterActivityResults(&$results, $limit=0)
- {
- $db =& JFusionFactory::getDatabase($this->getJname());
- $query = "SELECT value FROM #__settings WHERE variable='censor_vulgar'";
- $db->setQuery($query);
- $vulgar = $db->loadResult();
-
- $db =& JFusionFactory::getDatabase($this->getJname());
- $query = "SELECT value FROM #__settings WHERE variable='censor_proper'";
- $db->setQuery($query);
- $proper = $db->loadResult();
-
- $vulgar = explode ( ',' , $vulgar );
- $proper = explode ( ',' , $proper );
-
- foreach($results as $rkey => $result) {
- foreach( $vulgar as $key => $value ) {
- $results[$rkey]->subject = preg_replace ( '#\b'.$value.'\b#is' , $proper[$key] , $result->subject );
- if (isset($results[$rkey]->body)) {
- $results[$rkey]->body = preg_replace ( '#\b'.$value.'\b#is' , $proper[$key] , $result->body );
- }
- }
- }
- }
-
- /**
- * Function called by sh404sef for url building
- * @param array with titles for url
- * @param array global pointer to sh404sef remaning $_GET values from the url
- */
- function sh404sef(&$title,&$get)
- {
- if( isset($get['action'] ) ) {
- $title[] = $get['action'];
- shRemoveFromGETVarsList('action');
- }
-
- foreach( $get as $key => $value ) {
- $title[] = $key.$value;
- shRemoveFromGETVarsList($key);
- }
- }
-
- function callback($buffer) {
- $data = $this->callbackdata;
- $headers_list = headers_list();
- foreach($headers_list as $key => $value) {
- if(stripos($value,'location') === 0 ) {
- $regex_location[] = '#Location: '.$data->integratedURL.'index\.php\?(.*?)\z#Sise';
- $replace_location[] = '\'Location: \'.$this->fixUrlNoAmp("index.php?$1","'.$data->baseURL.'","'.$data->fullURL.'").\'\'';
- $regex_location[] = '#Location: '.$data->integratedURL.'index\.php\z#Sise';
- $replace_location[] = '\'Location: \'.$this->fixUrlNoAmp("index.php","'.$data->baseURL.'","'.$data->fullURL.'").\'\'';
- $value = preg_replace($regex_location, $replace_location, $value);
- header($value);
- return $buffer;
- } else if (stripos($value, 'Refresh') === 0) {
- $regex_location[] = '#Refresh: (.*?) URL=' . $data->integratedURL . 'index\.php\?(.*?)\z#Sise';
- $replace_location[] = '\'Refresh: $1 \'.$this->fixUrlNoAmp("index.php?$2","' . $data->baseURL . '","' . $data->fullURL . '").\'\'';
- $regex_location[] = '#Refresh: (.*?) URL=' . $data->integratedURL . 'index\.php\z#Sise';
- $replace_location[] = '\'Refresh: $1 \'.$this->fixUrlNoAmp("index.php","' . $data->baseURL . '","' . $data->fullURL . '").\'\'';
- $value = preg_replace($regex_location, $replace_location, $value);
- header($value);
- return $buffer;
- }
- }
- if ( $this->callbackbypass ) return $buffer;
- global $context;
-
- if ( isset($context['get_data']) ) {
- if ( $context['get_data'] && strpos( $context['get_data'] , 'jFusion_Route' ) ) {
- $buffer = str_replace ($context['get_data'],'?action=admin',$buffer);
- }
- }
-
- //fix for form actions
- $data->buffer = $buffer;
- ini_set('pcre.backtrack_limit',strlen($data->buffer)*2);
-
- $this->parseBuffer($data);
-
- if ( !strlen($data->header) || !strlen($data->body) ) {
- return $buffer;
- } else {
- $this->parseHeader($data);
- $this->parseBody($data);
- return '<html><head>'.$data->header.'</head><body>'.$data->body.'</body></html>';
- }
- }
-
- function getCalender( ) {
- $out = array();
- $db = JFusionFactory::getDatabase($this->getJname());
- $params = JFusionFactory::getParams($this->getJname());
-
- $calender_itemid = $params->get('calender_itemid',0);
- $show_calender = $params->get('show_calender',0);
- $show_calender_holiday = $params->get('show_calender_holiday',0);
- $show_birthday = $params->get('show_birthday',0);
- $show_joined = $params->get('show_joined',0);
-
- $baseURL = JFusionFunction::getPluginURL($calender_itemid);
-
- if ($show_calender) {
- $query = 'SELECT startDate, endDate, title, subject, c.ID_MEMBER as userid, body '.
- 'FROM #__calendar as c INNER JOIN #__topics as t ON c.ID_TOPIC = t.ID_TOPIC INNER JOIN #__messages as m ON t.ID_FIRST_MSG = m.ID_MSG';
-
- $db->setQuery($query);
- $result = $db->loadObjectList();
- if (is_array($result)) {
- foreach($result as $key => $event) {
- $start = strtotime($event->startDate);
- $end = strtotime($event->endDate)+(3600*24);
-
- $e = new vevent(); // initiate a new EVENT
- $e->setProperty( 'categories', 'CALENDER_'.$this->getJname() );
- $e->setProperty( 'dtstart', date("Y",$start), date("m",$start), date("d",$start), 00, 00, 00 );
- $e->setProperty( 'dtend', date("Y",$end), date("m",$end), date("d",$end), 00, 00, 00 );
- $e->setProperty( 'description' , $event->body );
- $e->setProperty( 'summary' , $event->title );
- $e->setProperty( 'status' , 'CONFIRMED' );
- $e->setProperty( 'transp' , 'TRANSPARENT' );
-
- $out[] = $e;
- }
- }
- }
- if ($show_calender_holiday) {
- $query = 'SELECT eventDate, title '.
- 'FROM #__calendar_holidays ';
-
- $db->setQuery($query);
- $result = $db->loadObjectList();
- if (is_array($result)) {
- foreach($result as $key => $event) {
- $yearly = false;
- if ( strpos($event->eventDate, '0004' ) !== FALSE ) {
- $yearly = true;
- $event->eventDate = str_replace('0004','1990',$event->eventDate);
- }
-
-
- $start = strtotime($event->eventDate);
- $end = $start+(3600*24);
- if ($yearly) {
- $end = $end-1;
- }
-
- $e = new vevent(); // initiate a new EVENT
- $e->setProperty( 'categories', 'CALENDER_HOLLIDAY_'.$this->getJname() );
- $e->setProperty( 'dtstart', date("Y",$start), date("m",$start), date("d",$start), 00, 00, 00 );
- $e->setProperty( 'dtend', date("Y",$end), date("m",$end), date("d",$end), 00, 00, 00 );
- $e->setProperty( 'summary' , $event->title );
- $e->setProperty( 'status' , 'CONFIRMED' );
- $e->setProperty( 'transp' , 'TRANSPARENT' );
- if ($yearly ) {
- $e->setProperty( 'rrule' , array( 'FREQ' => 'YEARLY' ));
- }
-
- $out[] = $e;
- }
- }
- }
-
- if ($show_birthday|| $show_joined) {
- $query = 'SELECT ID_MEMBER , birthdate, memberName, is_activated, dateRegistered '.
- 'FROM #__members '.
- 'WHERE is_activated=1 AND birthdate!='.$db->Quote('0001-01-01');
-
- $db->setQuery($query);
- $result = $db->loadObjectList();
- if (is_array($result)) {
- foreach($result as $key => $event) {
- if ($show_birthday) {
- $start = strtotime($event->birthdate);
- $end = $start+(3600*24)-1;
- $e = new vevent(); // initiate a new EVENT
- $e->setProperty( 'categories', 'CALENDER_BBIRTHDAY_'.$this->getJname() );
- $e->setProperty( 'dtstart', date("Y",$start), date("m",$start), date("d",$start), 00, 00, 00 );
- $e->setProperty( 'dtend', date("Y",$end), date("m",$end), date("d",$end), 00, 00, 00 );
- $e->setProperty( 'summary' , 'Birthday: '. $event->memberName );
-
- $url = $this->fixUrl($this->getProfileURL($event->ID_MEMBER),$baseURL,'');
-
- $e->setProperty( 'description' , 'Profile: <a href="'.$url.'">'.$event->memberName.'</a>' ); // describe the event
-
- $e->setProperty( 'status' , 'CONFIRMED' );
- $e->setProperty( 'transp' , 'TRANSPARENT' );
- $e->setProperty( 'rrule' , array( 'FREQ' => 'YEARLY' ));
-
- $out[] = $e;
- }
- if ($show_joined) {
- $start = $event->dateRegistered;
- $end = $event->dateRegistered+(3600*24);
-
- $e = new vevent(); // initiate a new EVENT
- $e->setProperty( 'categories', 'CALENDER_BBIRTHDAY_'.$this->getJname() );
- $e->setProperty( 'dtstart', date("Y",$start), date("m",$start), date("d",$start), 00, 00, 00 );
- $e->setProperty( 'dtend', date("Y",$end), date("m",$end), date("d",$end), 00, 00, 00 );
- $e->setProperty( 'summary' , 'Joined: '. $event->memberName );
-
- $url = $this->fixUrl($this->getProfileURL($event->ID_MEMBER),$baseURL,'');
-
- $e->setProperty( 'description' , 'Profile: <a href="'.$url.'">'.$event->memberName.'</a>' ); // describe the event
-
- $e->setProperty( 'status' , 'CONFIRMED' );
- $e->setProperty( 'transp' , 'TRANSPARENT' );
-
- $out[] = $e;
- }
- }
- }
- }
- return $out;
- }
- }