/** * process the plugin, called when form is submitted * * @param object $params * @param object form */ function onBeforeStore( &$params, &$formModel ) { return; jimport('joomla.filesystem.file'); $files[] = COM_FABRIK_BASE.'administrator'.DS.'components'.DS.'com_kunena'.DS.'language'.DS.'kunena.english.php'; $files[] = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'class.kunena.php'; $define = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'lib'.DS.'kunena.defines.php'; $files[] = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'lib'.DS.'kunena.defines.php'; $files[] = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'lib'.DS.'kunena.session.class.php'; $files[] = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'lib'.DS.'kunena.link.class.php'; $files[] = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'lib'.DS.'kunena.link.class.php'; $files[] = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'template'.DS.'default'.DS.'smile.class.php'; if (!JFile::exists($define)) { return JError::raiseError(500, 'could not find the Kunena component'); } require_once($define); foreach ($files as $file) { require_once($file); } if (JFile::exists(KUNENA_ABSTMPLTPATH . '/post.php')) { $postfile = KUNENA_ABSTMPLTPATH . '/post.php'; } else { $postfile = KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'post.php'; } $w = new FabrikWorker(); $fbSession = CKunenaSession::getInstance(); $catid =$params->get('kunena_category', 0); $parentid = 0; $action = 'post'; $func = 'post'; $contentURL = 'empty'; JRequest::setVar('catid', $catid); $msg = $w->parseMessageForPlaceHolder($params->get('kunena_content'), $formModel->_fullFormData); $subject = $params->get('kunena_title'); JRequest::SetVar('message', $msg); $subject = $w->parseMessageForPlaceHolder($subject, $formModel->_fullFormData); $origId = JRequest::getVar('id'); JRequest::setVar('id', 0); ob_start(); include ($postfile); ob_end_clean(); JRequest::setVar('id', $origId); }
* @link http://www.kunena.com * * Based on FireBoard Component * @Copyright (C) 2006 - 2007 Best Of Joomla All rights reserved * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * @link http://www.bestofjoomla.com * * Based on Joomlaboard Component * @copyright (C) 2000 - 2004 TSMF / Jan de Graaff / All Rights Reserved * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * @author TSMF & Jan de Graaff **/ // Dont allow direct linking defined('_JEXEC') or die('Restricted access'); $fbConfig =& CKunenaConfig::getInstance(); $fbSession =& CKunenaSession::getInstance(); global $is_Moderator; $kunena_db =& JFactory::getDBO(); require_once KUNENA_PATH_LIB . DS . 'kunena.authentication.php'; //Security basics begin //Securing passed form elements: $catid = (int) $catid; // redundant //resetting some things: $moderatedForum = 0; $forumLocked = 0; $topicLocked = 0; $topicSticky = 0; unset($allow_forum); //get the allowed forums and turn it into an array $allow_forum = $fbSession->allowed != '' ? explode(',', $fbSession->allowed) : array();
function JJ_categoryArray($admin = 0) { global $aro_group; $kunena_db =& JFactory::getDBO(); // get a list of the menu items $query = "SELECT * FROM #__fb_categories"; if (!$admin) { $fbSession =& CKunenaSession::getInstance(); if ($fbSession && $fbSession->allowed != 'na') { $query .= " WHERE id IN ({$fbSession->allowed})"; } else { $query .= " WHERE pub_access='0' AND published='1'"; } } $query .= " ORDER BY ordering, name"; $kunena_db->setQuery($query); $items = $kunena_db->loadObjectList(); check_dberror("Unable to load categories."); // establish the hierarchy of the menu $children = array(); // first pass - collect children foreach ($items as $v) { $pt = $v->parent; $list = @$children[$pt] ? $children[$pt] : array(); array_push($list, $v); $children[$pt] = $list; } // second pass - get an indent list of the items $array = fbTreeRecurse(0, '', array(), $children, 10, 0, 1); return $array; }
function get_search_forums(&$catids, $childforums = 1) { $fbSession =& CKunenaSession::getInstance(); $kunena_db =& JFactory::getDBO(); $kunena_my =& JFactory::getUser(); /* get allowed forums */ $allowed_string = ''; if ($fbSession->allowed && $fbSession->allowed != 'na') { $allowed_string = "id IN ({$fbSession->allowed})"; } else { $allowed_string = "published='1' AND pub_access='0'"; } $kunena_db->setQuery("SELECT id, parent FROM #__fb_categories WHERE {$allowed_string}"); $allowed_forums = $kunena_db->loadAssocList('id'); check_dberror("Unable to get public categories."); $allow_list = array(); foreach ($allowed_forums as $forum) { // Children list: parent => array(child1, child2, ...) $allow_list[$forum['parent']][] = $forum['id']; } $catids = split(',', $catids); $result = array(); if (count($catids) > 0 && !in_array(0, $catids)) { // Algorithm: // Start with selected categories and pop them from the catlist one by one // Every popped item in the catlist will be added into result list // For every category: push all its children into the catlist while ($cur = array_pop($catids)) { $result[$cur] = $cur; if (array_key_exists($cur, $allow_list)) { foreach ($allow_list[$cur] as $forum) { if (!in_array($forum, $catids)) { array_push($catids, $forum); } } } } $search_forums = implode(",", $result); } else { $search_forums = implode(",", array_keys($allowed_forums)); } return $search_forums; }