- Posts: 98
- Thank you received: 0
Kunena 7.0.4 Released
The Kunena team has announce the arrival of Kunena 7.0.4 [K 7.0.4] in stable which is now available for download as a native Joomla extension for J! 5.4.x/6.0.x. This version addresses most of the issues that were discovered in K 6.2 / K 6.3 / K 6.4 and issues discovered during the last development stages of K 7.0
Question kunena searchbot
17 years 3 months ago - 17 years 3 months ago #35
by aniphreak
kunena searchbot was created by aniphreak
I was able to make the Searchbot of fireboard by Miniola.com to work with kunena!
just install the old fireboard searchbot plugin and replace the php file with the atteched with this post.
*edit*
i cant upload files...
will just share the code.
acually i just replaced all the "com_kunena" to "com_kunena" on the plug_fbsearch.php
just install the old fireboard searchbot plugin and replace the php file with the atteched with this post.
*edit*
i cant upload files...
will just share the code.
acually i just replaced all the "com_kunena" to "com_kunena" on the plug_fbsearch.php
Code:
<?php
/*****************************************************************
************ Miniola Fireboard Search Plugin For Joomla 1.5 ************
* @version-- plug_fbsearch.php--- versrion Beta1.0--- June 6th, 2008
* @copyright (c) 2008 Miniola
* @license GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* @Author R.T. Nawaz
*@Author Email: [email protected]
*@Website http://Opensource.Miniola.com
******************************************************************/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
//Define registerEvents and language
$mainframe->registerEvent( 'onSearch', 'plgSearchplug_fbsearch' );
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchplug_fbsearchAreas' );
//Still Need to Make Language File for Backend
//JPlugin::loadLanguage( 'plg_search_plug_fbsearch' );
//Array of search area
function &plgSearchplug_fbsearchAreas()
{
static $areas = array(
'plug_fbsearch' => 'Forum'
);
return $areas;
}
//Data base conection has to be made
function plgSearchplug_fbsearch( $text, $phrase='', $ordering='', $areas=null )
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
//If the array is not correct, return it:
if (is_array( $areas )) {
if (!array_intersect( $areas, array_keys( plgSearchplug_fbsearchAreas() ) )) {
return array();
}
}
//Get the plugin
$plugin =& JPluginHelper::getPlugin('search', 'plug_fbsearch');
//load parameters
$pluginParams = new JParameter( $plugin->params );
//Define parameters
$forum_name = $pluginParams->def( 'forum_name', 'Forum' );
$search_limit = $pluginParams->def( 'search_limit', 50 );
$cat_search = $pluginParams->def( 'cat_search', 1 );
$allow_bbc = $pluginParams->def( 'allow_bbc', 1 );
$credit = $pluginParams->def( 'credit', 2 );
$c_result = $pluginParams->def( 'c_result', 0 );
$c_title = $pluginParams->def( 'c_title', 'Title' );
$c_section = $pluginParams->def( 'c_section', 'Section' );
$c_text = $pluginParams->def( 'c_text', 'This is where you will put the information to show at search results' );
$c_href = $pluginParams->def( 'c_href', 'http://www.anysite.com' );
$c_keywords = $pluginParams->def( 'c_keywords', 'Keyword1,Keword2,Keword3' );
$c_reset = $pluginParams->def( 'c_reset', 0 );
$c_browsernav = 1;
$c_created = "";
$a_title = "Miniola!";
$a_text = "We are proud to support Miniola! which is a small project to develop and revitalize Open Source and Free Software. Visit the Miniola! website to join and participate in the new opensource and free software community";
$a_section = "Free Open Source Software";
$a_href = "http://www.miniola.com/";
$a_created = "";
$a_keywords = "open source, free software, extension, plugin, joomla, software, mambots, template, module, ";
$a_browsernav = 1;
//Setup databases
if($c_reset == 1){
$db->setQuery('TRUNCATE TABLE #__fb_searchplgc');
$db->query();
}
//Have to do these for functions-- for now just use it here
if( $c_result > 0 ) {
$db->setQuery('CREATE TABLE IF NOT EXISTS `#__fb_searchplgc` ('
. ' `title` text NOT NULL,'
. ' `text` text NOT NULL,'
. ' `section` text NOT NULL,'
. ' `href` text NOT NULL,'
. ' `created` text NOT NULL,'
. ' `keywords` text NOT NULL,'
. ' `browsernav` tinyint(4) NOT NULL default \'0\','
. ' UNIQUE KEY `key` (`title`(10))'
. ' ) TYPE=MyISAM'
. ' ');
$db->query();
$db->setQuery( "INSERT IGNORE INTO `#__fb_searchplgc` ("
. "\n `title`,"
. "\n `text`,"
. "\n `section`,"
. "\n `href`,"
. "\n `created`,"
. "\n `keywords`,"
. "\n `browsernav`"
. "\n ) VALUES ("
. "\n '$c_title',"
. "\n '$c_text',"
. "\n '$c_section',"
. "\n '$c_href',"
. "\n '$c_created',"
. "\n '$c_keywords',"
. "\n '$c_browsernav'"
. "\n ) ");
$db->query();
}
if($credit > 0 ) {
$db->setQuery('CREATE TABLE IF NOT EXISTS `#__fb_searchplga` ('
. ' `title` text NOT NULL,'
. ' `text` text NOT NULL,'
. ' `section` text NOT NULL,'
. ' `href` text NOT NULL,'
. ' `created` text NOT NULL,'
. ' `keywords` text NOT NULL,'
. ' `browsernav` tinyint(4) NOT NULL default \'0\','
. ' UNIQUE KEY `key` (`title`(10))'
. ' ) TYPE=MyISAM'
. ' ');
$db->query();
$db->setQuery( "INSERT IGNORE INTO `#__fb_searchplga` ("
. "\n `title`,"
. "\n `text`,"
. "\n `section`,"
. "\n `href`,"
. "\n `created`,"
. "\n `keywords`,"
. "\n `browsernav`"
. "\n ) VALUES ("
. "\n '$a_title',"
. "\n '$a_text',"
. "\n '$a_section',"
. "\n '$a_href',"
. "\n '$a_created',"
. "\n '$a_keywords',"
. "\n '$a_browsernav'"
. "\n ) ");
$db->query();
}
//Use the function trim to delete spaces in front of or at the back of the searching terms
$text = trim( $text );
//Return Array when nothing was filled in
if ($text == '') {
return array();
}
//Datebase results
$whereAs = array();
$whereBs = array();
switch ($phrase) {
case 'exact':
$whereAs2 = array();
$whereAs2[] = "LOWER(c.name) LIKE '%$text%'";
$whereAs2[] = "LOWER(c.description) LIKE '%$text%'";
$whereA = '(' . implode( ") \n OR (", $whereAs2 ) . ')';
$whereBs2 = array();
$whereBs2[] = "LOWER(b.subject) LIKE '%$text%'";
$whereBs2[] = "LOWER(a.message) LIKE '%$text%'";
$whereBs2[] = "LOWER(b.name) LIKE '%$text%'";
$whereB = '(' . implode( ") \n OR (", $whereBs2 ) . ')';
break;
case 'all':
case 'any':
default:
$words = explode( ' ', $text );
$whereAs = array();
$whereBs = array();
foreach ($words as $word) {
$whereAs2 = array();
$whereAs2[] = "LOWER(c.name) LIKE '%$word%'";
$whereAs2[] = "LOWER(c.description) LIKE '%$word%'";
$whereAs[] = implode( ' OR ', $whereAs2 );
$whereBs2 = array();
$whereBs2[] = "LOWER(b.subject) LIKE '%$word%'";
$whereBs2[] = "LOWER(a.message) LIKE '%$word%'";
$whereBs2[] = "LOWER(b.name) LIKE '%$word%'";
$whereBs[] = implode( ' OR ', $whereBs2 );
}
$whereA = '(' . implode( ($phrase == 'all' ? ") \n AND (" : ") \n OR ("), $whereAs ) . ')';
$whereB = '(' . implode( ($phrase == 'all' ? ") \n AND (" : ") \n OR ("), $whereBs ) . ')';
break;
}
switch ( $ordering ) {
case 'alpha':
$orderA = 'c.name ASC';
$orderB = 'b.subject ASC';
break;
case 'category':
$orderA = 'c.name ASC';
$orderB = 'c.name ASC, b.subject ASC';
break;
case 'popular':
$orderA = 'c.hits DESC';
$orderB = 'b.hits DESC';
break;
case 'newest':
$orderA = 'created DESC';
$orderB = 'b.time DESC';
break;
case 'oldest':
$orderA = 'created ASC';
$orderB = 'b.time ASC';
break;
default:
$orderA = 'c.name DESC';
$orderB = 'b.subject DESC';
break;
}
$searchplug_fbsearch = JText::_( 'Plug_fbsearch' );
// Get FireBoard Item ID taken from previous searchbot
$query = "SELECT id AS ItemId"
. "\n FROM #__menu"
. "\n WHERE link = 'index.php?option=com_kunena'"
;
$db->setQuery( $query );
$com_id = $db->loadObjectList();
$Itemid = $com_id[0]->ItemId;
//Get lists for for results
if($c_result > 0){
if($c_result == 1){
$query = "SELECT a.title AS title,"
. "\n a.text AS text,"
. "\n a.created AS created,"
. "\n a.section AS section,"
. "\n a.browsernav AS browsernav,"
. "\n a.href AS href"
. "\n FROM #__fb_searchplgc AS a"
;
}
else{
$query = "SELECT a.title AS title,"
. "\n a.text AS text,"
. "\n a.created AS created,"
. "\n a.section AS section,"
. "\n a.browsernav AS browsernav,"
. "\n a.href AS href"
. "\n FROM #__fb_searchplgc AS a"
. "\n WHERE a.title LIKE '%$text%'"
. "\n OR a.text LIKE '%$text%'"
. "\n OR a.section LIKE '%$text%'"
. "\n OR a.keywords LIKE '%$text%'"
;
}
$db->setQuery( $query, 0, $search_limit );
$list1 = $db->loadObjectList();
}
if($credit > 0){
if($credit == 1){
$query = "SELECT a.title AS title,"
. "\n a.text AS text,"
. "\n a.created AS created,"
. "\n a.section AS section,"
. "\n a.browsernav AS browsernav,"
. "\n a.href AS href"
. "\n FROM #__fb_searchplga AS a"
;
}
else{
$query = "SELECT a.title AS title,"
. "\n a.text AS text,"
. "\n a.created AS created,"
. "\n a.section AS section,"
. "\n a.browsernav AS browsernav,"
. "\n a.href AS href"
. "\n FROM #__fb_searchplga AS a"
. "\n WHERE a.title LIKE '%$text%'"
. "\n OR a.text LIKE '%$text%'"
. "\n OR a.section LIKE '%$text%'"
. "\n OR a.keywords LIKE '%$text%'"
;
}
$db->setQuery( $query, 0, $search_limit );
$list2 = $db->loadObjectList();
}
//Forum Categories
$query = "SELECT c.name AS title,"
. "\n c.description AS text,"
. "\n c.hits,"
. "\n c.pub_access,"
. "\n c.published,"
. "\n '' AS created,"
. "\n '$forum_name' AS section,"
. "\n '2' AS browsernav,"
. "\n CONCAT('index.php?option=com_kunena&Itemid=', '$Itemid', '&func=showcat&catid=',c.id) AS href"
. "\n FROM #__fb_categories AS c"
. "\n WHERE ( $whereA )"
. "\n AND c.published = 1"
. "\n AND c.pub_access <= ". (int) $user->get( 'aid' )
. "\n ORDER BY $orderA"
;
$db->setQuery( $query, 0, $search_limit );
$list3 = $db->loadObjectList();
//Forum Posts Query
$query2 = "SELECT b.subject AS title,"
. "\n a.message AS text,"
. "\n b.hits,"
. "\n c.pub_access,"
. "\n c.published,"
. "\n c.description,"
. "\n FROM_UNIXTIME(b.time) AS created,"
. "\n CONCAT('$forum_name','/', c.name) AS section,"
. "\n '2' AS browsernav,"
. "\n CONCAT('index.php?option=com_kunena&Itemid=', '$Itemid', '&func=view&catid=',b.catid,'&id=',b.thread) AS href"
. "\n FROM #__fb_messages_text AS a"
. "\n INNER JOIN #__fb_messages AS b ON b.id = a.mesid"
. "\n INNER JOIN #__fb_categories AS c ON c.id = b.catid"
. "\n WHERE ( $whereB )"
. "\n AND c.published = 1"
. "\n AND c.pub_access <= ". (int) $user->get( 'aid' )
. "\n ORDER BY $orderB"
;
$db->setQuery( $query2, 0, $search_limit );
$list4 = $db->loadObjectList();
//Setting the Result Orders
if($credit > 0 and $c_result > 0){
switch ($cat_search) {
case 1:
$rows = array_merge($list1, $list2, $list3, $list4);
break;
case 2:
$rows = array_merge($list1, $list2, $list4, $list3);
break;
default:
$rows = array_merge($list1, $list2, $list4);
break;
}
}
elseif($credit == 0 and $c_result > 0){
switch ($cat_search) {
case 1:
$rows = array_merge($list1, $list3, $list4);
break;
case 2:
$rows = array_merge($list1, $list4, $list3);
break;
default:
$rows = array_merge($list1, $list4);
break;
}
}
elseif($c_result == 0 and $credit > 0){
switch ($cat_search) {
case 1:
$rows = array_merge($list2, $list3, $list4);
break;
case 2:
$rows = array_merge($list2, $list4, $list3);
break;
default:
$rows = array_merge($list2, $list4);
break;
}
}
elseif($c_result == 0 and $credit == 0){
switch ($cat_search) {
case 1:
$rows = array_merge($list3, $list4);
break;
case 2:
$rows = array_merge($list4, $list3);
break;
default:
$rows = $list4 ;
break;
}
}
// Remove BBC from the search results from old searchbot
if($allow_bbc == 0){
$BBC = '[:space:]';
$replace = ' ';
}
else{
$BBC = array( // - Convert to PLAIN TEXT
'@(\[url)([^\]]*?)(\])(.*?)(\[/url\])@si',
'@(\[img)([^\]]*?)(\])(.*?)(\[/img\])@si',
'@(\[code[^\]]*?\])(.*?)(\[/code\])@si',
'@(\[code:[0-9][^\]]*?\])(.*?)(\[/code:[0-9]\])@si',
'@(\[quote[^\]]*?\])(.*?)(\[/quote\])@si',
'@(\[b[^\]]*?\])(.*?)(\[/b\])@si',
'@(\[u[^\]]*?\])(.*?)(\[/u\])@si',
'@(\[i[^\]]*?\])(.*?)(\[/i\])@si',
'@(\[size[^\]]*?\])(.*?)(\[/size\])@si',
'@(\[color[^\]]*?\])(.*?)(\[/color\])@si',
'@(\[ol[^\]]*?\])(.*?)(\[/ol\])@si',
'@(\[ul[^\]]*?\])(.*?)(\[/ul\])@si',
'@(\[li[^\]]*?\])(.*?)(\[/li\])@si',
'@(\[video)([^\]]*?)(\])(.*?)(\[/video\])@si'
);
$replace = array(
'${4}', // URL
'[USER POSTED IMAGE]', //IMG
'${2}', // CODE
'${2}', // CODE
'${2}', // QUOTE
'${2}', // BOLD
'${2}', // UNDERLINE
'${2}', // ITALIC
'${2}', // SIZE
'${2}', // COLOR
'', // ORDERED LIST
'', // UNORDERED LIST
'${2}', // LIST ITEM
'[USER POSTED VIDEO]'//VIDEO
);
}
$rows_count = count($rows);
for($xi = 0; $xi <= $rows_count-1; $xi++){
$rows[$xi]->text = preg_replace($BBC, $replace, $rows[$xi]->text);
$rows[$xi]->text = stripslashes($rows[$xi]->text);
}
// Send the results in an array
return $rows;
}
Last edit: 17 years 3 months ago by aniphreak.
Please Log in or Create an account to join the conversation.
17 years 3 months ago #36
by Matias
Replied by Matias on topic Re:searchobot
For now, they may work.
BTW: My next task is to commit a lot better search functionality. It's still slow, but you can actually search something.
There will be many improvements to the search, but currently we are just trying to get a stable version out ASAP.
BTW: My next task is to commit a lot better search functionality. It's still slow, but you can actually search something.
There will be many improvements to the search, but currently we are just trying to get a stable version out ASAP.
Please Log in or Create an account to join the conversation.
17 years 3 months ago #37
by aniphreak
Replied by aniphreak on topic Re:searchbot
i will upgrade my livesite today with kunena!
i love your jomsocial integration!
are there changes in the table of the old firboard?
if it has not, 3rd party plugins of fireboard like searchbots will work out of the box on kunena!
i love your jomsocial integration!
are there changes in the table of the old firboard?
if it has not, 3rd party plugins of fireboard like searchbots will work out of the box on kunena!
Please Log in or Create an account to join the conversation.
17 years 3 months ago #39
by Matias
Replied by Matias on topic Re:searchbot
You should wait for the next build coming today (1.1.0b). It has some important fixes.
Currently integration should work if it uses fb tables. Not for long, though, because we're going to break compability in next few days..
If you update your site, there are some minor things you need to fix in your theme (css, add one gif), if your theme does not contain any (changed) php files. If it does, I just recommend to throw away the old files (after taking diff against unmodified version) and add the custom code to the new version.
Currently integration should work if it uses fb tables. Not for long, though, because we're going to break compability in next few days..
If you update your site, there are some minor things you need to fix in your theme (css, add one gif), if your theme does not contain any (changed) php files. If it does, I just recommend to throw away the old files (after taking diff against unmodified version) and add the custom code to the new version.
Please Log in or Create an account to join the conversation.
17 years 3 months ago #40
by aniphreak
Replied by aniphreak on topic Re:searchobot
i was able to make the 3rd party searchbot working by replacing all the "com_kunena" to "com_kunena"
my problem is the sh404sef compatibility.
the site does white screen of death when i do that.. :blush: :blush: :blush:
my problem is the sh404sef compatibility.
the site does white screen of death when i do that.. :blush: :blush: :blush:
Please Log in or Create an account to join the conversation.
17 years 3 months ago #41
by Matias
Replied by Matias on topic Re:searchobot
You should change sh404sef FireBoard module also. I have never used it, so I cannot answer how to do that. Shouldn't be that hard, though.
Would you like to share your changes with rest of us?
Would you like to share your changes with rest of us?
Please Log in or Create an account to join the conversation.
Time to create page: 0.286 seconds