]> saetta.ns0.it Git - joomla/jmnogosearch/commitdiff
Renaming files to jmnogosearch.
authorAndrea Zagli <azagli@libero.it>
Sat, 12 Dec 2009 15:25:25 +0000 (16:25 +0100)
committerAndrea Zagli <azagli@libero.it>
Sat, 12 Dec 2009 15:25:25 +0000 (16:25 +0100)
80 files changed:
com_jmnogosearch/admin/admin.jmnogosearch.php [new file with mode: 0644]
com_jmnogosearch/admin/config.xml [new file with mode: 0644]
com_jmnogosearch/admin/controller.php [new file with mode: 0644]
com_jmnogosearch/admin/helpers/index.html [new file with mode: 0644]
com_jmnogosearch/admin/helpers/jmnogosearch.php [new file with mode: 0644]
com_jmnogosearch/admin/helpers/site.php [new file with mode: 0644]
com_jmnogosearch/admin/index.html [new file with mode: 0644]
com_jmnogosearch/admin/models/index.html [new file with mode: 0644]
com_jmnogosearch/admin/models/jmnogosearch.php [new file with mode: 0644]
com_jmnogosearch/admin/sql/index.html [new file with mode: 0644]
com_jmnogosearch/admin/sql/install.sql [new file with mode: 0644]
com_jmnogosearch/admin/sql/uninstall.sql [new file with mode: 0644]
com_jmnogosearch/admin/views/index.html [new file with mode: 0644]
com_jmnogosearch/admin/views/jmnogosearch/index.html [new file with mode: 0644]
com_jmnogosearch/admin/views/jmnogosearch/tmpl/default.php [new file with mode: 0644]
com_jmnogosearch/admin/views/jmnogosearch/tmpl/index.html [new file with mode: 0644]
com_jmnogosearch/admin/views/jmnogosearch/view.php [new file with mode: 0644]
com_jmnogosearch/jmnogosearch.xml [new file with mode: 0644]
com_jmnogosearch/site/controller.php [new file with mode: 0644]
com_jmnogosearch/site/index.html [new file with mode: 0644]
com_jmnogosearch/site/jmnogosearch.php [new file with mode: 0644]
com_jmnogosearch/site/models/index.html [new file with mode: 0644]
com_jmnogosearch/site/models/jmnogosearch.php [new file with mode: 0644]
com_jmnogosearch/site/router.php [new file with mode: 0644]
com_jmnogosearch/site/views/index.html [new file with mode: 0644]
com_jmnogosearch/site/views/jmnogosearch/index.html [new file with mode: 0644]
com_jmnogosearch/site/views/jmnogosearch/metadata.xml [new file with mode: 0644]
com_jmnogosearch/site/views/jmnogosearch/tmpl/default.php [new file with mode: 0644]
com_jmnogosearch/site/views/jmnogosearch/tmpl/default.xml [new file with mode: 0644]
com_jmnogosearch/site/views/jmnogosearch/tmpl/default_error.php [new file with mode: 0644]
com_jmnogosearch/site/views/jmnogosearch/tmpl/default_form.php [new file with mode: 0644]
com_jmnogosearch/site/views/jmnogosearch/tmpl/default_results.php [new file with mode: 0644]
com_jmnogosearch/site/views/jmnogosearch/tmpl/index.html [new file with mode: 0644]
com_jmnogosearch/site/views/jmnogosearch/view.html.php [new file with mode: 0644]
com_mnogosearch/admin/admin.mnogosearch.php [deleted file]
com_mnogosearch/admin/config.xml [deleted file]
com_mnogosearch/admin/controller.php [deleted file]
com_mnogosearch/admin/helpers/index.html [deleted file]
com_mnogosearch/admin/helpers/mnogosearch.php [deleted file]
com_mnogosearch/admin/helpers/site.php [deleted file]
com_mnogosearch/admin/index.html [deleted file]
com_mnogosearch/admin/models/index.html [deleted file]
com_mnogosearch/admin/models/mnogosearch.php [deleted file]
com_mnogosearch/admin/sql/index.html [deleted file]
com_mnogosearch/admin/sql/install.sql [deleted file]
com_mnogosearch/admin/sql/uninstall.sql [deleted file]
com_mnogosearch/admin/views/index.html [deleted file]
com_mnogosearch/admin/views/mnogosearch/index.html [deleted file]
com_mnogosearch/admin/views/mnogosearch/tmpl/default.php [deleted file]
com_mnogosearch/admin/views/mnogosearch/tmpl/index.html [deleted file]
com_mnogosearch/admin/views/mnogosearch/view.php [deleted file]
com_mnogosearch/mnogosearch.xml [deleted file]
com_mnogosearch/site/controller.php [deleted file]
com_mnogosearch/site/index.html [deleted file]
com_mnogosearch/site/mnogosearch.php [deleted file]
com_mnogosearch/site/models/index.html [deleted file]
com_mnogosearch/site/models/mnogosearch.php [deleted file]
com_mnogosearch/site/router.php [deleted file]
com_mnogosearch/site/views/index.html [deleted file]
com_mnogosearch/site/views/search/index.html [deleted file]
com_mnogosearch/site/views/search/metadata.xml [deleted file]
com_mnogosearch/site/views/search/tmpl/default.php [deleted file]
com_mnogosearch/site/views/search/tmpl/default.xml [deleted file]
com_mnogosearch/site/views/search/tmpl/default_error.php [deleted file]
com_mnogosearch/site/views/search/tmpl/default_form.php [deleted file]
com_mnogosearch/site/views/search/tmpl/default_results.php [deleted file]
com_mnogosearch/site/views/search/tmpl/index.html [deleted file]
com_mnogosearch/site/views/search/view.html.php [deleted file]
mod_jmnogosearch/helper.php [new file with mode: 0644]
mod_jmnogosearch/index.html [new file with mode: 0644]
mod_jmnogosearch/mod_jmnogosearch.php [new file with mode: 0644]
mod_jmnogosearch/mod_jmnogosearch.xml [new file with mode: 0644]
mod_jmnogosearch/tmpl/default.php [new file with mode: 0644]
mod_jmnogosearch/tmpl/index.html [new file with mode: 0644]
mod_mnogosearch/helper.php [deleted file]
mod_mnogosearch/index.html [deleted file]
mod_mnogosearch/mod_mnogosearch.php [deleted file]
mod_mnogosearch/mod_mnogosearch.xml [deleted file]
mod_mnogosearch/tmpl/default.php [deleted file]
mod_mnogosearch/tmpl/index.html [deleted file]

diff --git a/com_jmnogosearch/admin/admin.jmnogosearch.php b/com_jmnogosearch/admin/admin.jmnogosearch.php
new file mode 100644 (file)
index 0000000..4c507a4
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+/**
+* @version             $Id: com_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
+* @package             com_mnoGoSearch
+* @copyright   Copyright (C) 2009 Andrea Zagli. All rights reserved.
+* @license             GNU/GPL, see LICENSE.php
+* com_mnoGoSearch is free software. This version may have been modified pursuant
+* to the GNU General Public License, and as distributed it includes or
+* is derivative of works licensed under the GNU General Public License or
+* other free or open source software licenses.
+* See COPYRIGHT.php for copyright notices and details.
+*/
+
+// no direct access
+defined( '_JEXEC' ) or die( 'Restricted access' );
+
+require_once( JPATH_COMPONENT.DS.'controller.php' );
+
+$controller = new mnoGoSearchController();
+$controller->execute( JRequest::getCmd( 'task' ) );
+$controller->redirect();
diff --git a/com_jmnogosearch/admin/config.xml b/com_jmnogosearch/admin/config.xml
new file mode 100644 (file)
index 0000000..c98eba5
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<config>
+       <params>
+               <param name="enabled" type="radio" default="0" label="Gather Search Statistics" description="TIPSEARCHSTATISTICS">
+                       <option value="0">No</option>
+                       <option value="1">Yes</option>
+               </param>
+               <param name="show_date" type="radio" default="1" label="Show Created Date" description="TIPIFSETTOSHOWDATETIMECREATED">
+                       <option value="0">Hide</option>
+                       <option value="1">Show</option>
+               </param>
+       </params>
+</config>
diff --git a/com_jmnogosearch/admin/controller.php b/com_jmnogosearch/admin/controller.php
new file mode 100644 (file)
index 0000000..c684b0d
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+/**
+ * @version            $Id: com_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
+ * @package            com_mnoGoSearch
+ * @copyright  Copyright (C) 2009 Andrea Zagli. All rights reserved.
+ * @license            GNU/GPL, see LICENSE.php
+ * com_mnoGoSearch is free software. This version may have been modified pursuant
+ * GNU General Public License, and as distributed it includes or is derivative
+ * of works licensed under the GNU General Public License or other free or open
+ * source software licenses. See COPYRIGHT.php for copyright notices and
+ * details.
+ */
+
+// Check to ensure this file is included in Joomla!
+defined('_JEXEC') or die( 'Restricted access' );
+
+jimport('joomla.application.component.controller');
+
+/**
+ * @package            mnoGoSearch
+ * @subpackage mnoGoSearch
+ */
+class mnoGoSearchController extends JController
+{
+       /**
+        * Show Search Statistics
+        */
+       function display()
+       {
+               $model  =& $this->getModel( 'Search' );
+               $view   =& $this->getView( 'Search' );
+               $view->setModel( $model, true );
+               $view->display();
+       }
+
+       /**
+        * Reset Statistics
+        */
+       function reset()
+       {
+               $model  =& $this->getModel( 'Search' );
+               $model->reset();
+               $this->setRedirect('index.php?option=com_mnogosearch');
+       }
+}
diff --git a/com_jmnogosearch/admin/helpers/index.html b/com_jmnogosearch/admin/helpers/index.html
new file mode 100644 (file)
index 0000000..fa6d84e
--- /dev/null
@@ -0,0 +1 @@
+<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_jmnogosearch/admin/helpers/jmnogosearch.php b/com_jmnogosearch/admin/helpers/jmnogosearch.php
new file mode 100644 (file)
index 0000000..b2b5cdf
--- /dev/null
@@ -0,0 +1,204 @@
+<?php
+/**
+ * @version            $Id: search.php 12389 2009-07-01 00:34:45Z ian $
+ * @package  Joomla
+ * @subpackage Search
+ * @copyright  Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
+ * @license            GNU/GPL, see LICENSE.php
+ * Joomla! is free software. This version may have been modified pursuant to the
+ * GNU General Public License, and as distributed it includes or is derivative
+ * of works licensed under the GNU General Public License or other free or open
+ * source software licenses. See COPYRIGHT.php for copyright notices and
+ * details.
+ */
+
+// Check to ensure this file is included in Joomla!
+defined('_JEXEC') or die( 'Restricted access' );
+
+/**
+ * @package            Joomla
+ * @subpackage Search
+ */
+class SearchHelper
+{
+       function santiseSearchWord(&$searchword, $searchphrase)
+       {
+               $ignored = false;
+
+               $lang =& JFactory::getLanguage();
+
+               $search_ignore  = array();
+               $tag                    = $lang->getTag();
+               $ignoreFile             = $lang->getLanguagePath().DS.$tag.DS.$tag.'.ignore.php';
+               if (file_exists($ignoreFile)) {
+                       include $ignoreFile;
+               }
+
+               // check for words to ignore
+               $aterms = explode( ' ', JString::strtolower( $searchword ) );
+
+               // first case is single ignored word
+               if ( count( $aterms ) == 1 && in_array( JString::strtolower( $searchword ), $search_ignore ) ) {
+                       $ignored = true;
+               }
+
+               // filter out search terms that are too small
+               foreach( $aterms AS $aterm ) {
+                       if (JString::strlen( $aterm ) < 3) {
+                               $search_ignore[] = $aterm;
+                       }
+               }
+
+               // next is to remove ignored words from type 'all' or 'any' (not exact) searches with multiple words
+               if ( count( $aterms ) > 1 && $searchphrase != 'exact' ) {
+                       $pruned = array_diff( $aterms, $search_ignore );
+                       $searchword = implode( ' ', $pruned );
+               }
+
+               return $ignored;
+       }
+
+       function limitSearchWord(&$searchword)
+       {
+               $restriction = false;
+
+               // limit searchword to 20 characters
+               if ( JString::strlen( $searchword ) > 20 ) {
+                       $searchword     = JString::substr( $searchword, 0, 19 );
+                       $restriction    = true;
+               }
+
+               // searchword must contain a minimum of 3 characters
+               if ( $searchword && JString::strlen( $searchword ) < 3 ) {
+                       $searchword     = '';
+                       $restriction    = true;
+               }
+
+               return $restriction;
+       }
+
+       function logSearch( $search_term )
+       {
+               global $mainframe;
+
+               $db =& JFactory::getDBO();
+
+               $params = &JComponentHelper::getParams( 'com_search' );
+               $enable_log_searches = $params->get('enabled');
+
+               $search_term = $db->getEscaped( trim( $search_term) );
+
+               if ( @$enable_log_searches )
+               {
+                       $db =& JFactory::getDBO();
+                       $query = 'SELECT hits'
+                       . ' FROM #__core_log_searches'
+                       . ' WHERE LOWER( search_term ) = "'.$search_term.'"'
+                       ;
+                       $db->setQuery( $query );
+                       $hits = intval( $db->loadResult() );
+                       if ( $hits ) {
+                               $query = 'UPDATE #__core_log_searches'
+                               . ' SET hits = ( hits + 1 )'
+                               . ' WHERE LOWER( search_term ) = "'.$search_term.'"'
+                               ;
+                               $db->setQuery( $query );
+                               $db->query();
+                       } else {
+                               $query = 'INSERT INTO #__core_log_searches VALUES ( "'.$search_term.'", 1 )';
+                               $db->setQuery( $query );
+                               $db->query();
+                       }
+               }
+       }
+
+       /**
+        * Prepares results from search for display
+        *
+        * @param string The source string
+        * @param int Number of chars to trim
+        * @param string The searchword to select around
+        * @return string
+        */
+       function prepareSearchContent( $text, $length = 200, $searchword )
+       {
+               // strips tags won't remove the actual jscript
+               $text = preg_replace( "'<script[^>]*>.*?</script>'si", "", $text );
+               $text = preg_replace( '/{.+?}/', '', $text);
+               //$text = preg_replace( '/<a\s+.*?href="([^"]+)"[^>]*>([^<]+)<\/a>/is','\2', $text );
+               // replace line breaking tags with whitespace
+               $text = preg_replace( "'<(br[^/>]*?/|hr[^/>]*?/|/(div|h[1-6]|li|p|td))>'si", ' ', $text );
+
+               return SearchHelper::_smartSubstr( strip_tags( $text ), $length, $searchword );
+       }
+
+       /**
+        * Checks an object for search terms (after stripping fields of HTML)
+        *
+        * @param object The object to check
+        * @param string Search words to check for
+        * @param array List of object variables to check against
+        * @returns boolean True if searchTerm is in object, false otherwise
+        */
+       function checkNoHtml($object, $searchTerm, $fields) {
+               $searchRegex = array(
+                               '#<script[^>]*>.*?</script>#si',
+                               '#<style[^>]*>.*?</style>#si',
+                               '#<!.*?(--|]])>#si',
+                               '#<[^>]*>#i'
+                               );
+               $terms = explode(' ', $searchTerm);
+               if(empty($fields)) return false;
+               foreach($fields AS $field) {
+                       if(!isset($object->$field)) continue;
+                       $text = $object->$field;
+                       foreach($searchRegex As $regex) {
+                               $text = preg_replace($regex, '', $text);
+                       }
+                       foreach($terms AS $term) {
+                               if(JString::stristr($text, $term) !== false) {
+                                       return true;
+                               }
+                       }
+               }
+               return false;
+       }
+
+       /**
+        * returns substring of characters around a searchword
+        *
+        * @param string The source string
+        * @param int Number of chars to return
+        * @param string The searchword to select around
+        * @return string
+        */
+       function _smartSubstr($text, $length = 200, $searchword)
+       {
+               $textlen = JString::strlen($text);
+               $lsearchword = JString::strtolower($searchword);
+               $wordfound = false;
+               $pos = 0;
+               while ($wordfound === false && $pos < $textlen) {
+                       if (($wordpos = @JString::strpos($text, ' ', $pos + $length)) !== false) {
+                               $chunk_size = $wordpos - $pos;
+                       } else {
+                               $chunk_size = $length;
+                       }
+                       $chunk = JString::substr($text, $pos, $chunk_size);
+                       $wordfound = JString::strpos(JString::strtolower($chunk), $lsearchword);
+                       if ($wordfound === false) {
+                               $pos += $chunk_size + 1;
+                       }
+               }
+
+               if ($wordfound !== false) {
+                       return (($pos > 0) ? '...&nbsp;' : '') . $chunk . '&nbsp;...';
+               } else {
+                       if (($wordpos = @JString::strpos($text, ' ', $length)) !== false) {
+                               return JString::substr($text, 0, $wordpos) . '&nbsp;...';
+                       } else {
+                               return JString::substr($text, 0, $length);
+                       }
+               }
+       }
+}
diff --git a/com_jmnogosearch/admin/helpers/site.php b/com_jmnogosearch/admin/helpers/site.php
new file mode 100644 (file)
index 0000000..6368a03
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+/**
+ * @version            $Id: site.php 12389 2009-07-01 00:34:45Z ian $
+ * @package  Joomla
+ * @subpackage Search
+ * @copyright  Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
+ * @license            GNU/GPL, see LICENSE.php
+ * Joomla! is free software. This version may have been modified pursuant to the
+ * GNU General Public License, and as distributed it includes or is derivative
+ * of works licensed under the GNU General Public License or other free or open
+ * source software licenses. See COPYRIGHT.php for copyright notices and details.
+ */
+
+// Check to ensure this file is included in Joomla!
+defined('_JEXEC') or die( 'Restricted access' );
+
+/**
+ * False JSite class used to fool the frontend search plugins because they route the results
+ */
+class JSite extends JObject
+{
+       /**
+        * False method to fool the frontend search plugins
+        */
+       function getMenu()
+       {
+               $result = new JSite;
+               return $result;
+       }
+
+       /**
+        * False method to fool the frontend search plugins
+        */
+       function getItems()
+       {
+               return array();
+       }
+}
\ No newline at end of file
diff --git a/com_jmnogosearch/admin/index.html b/com_jmnogosearch/admin/index.html
new file mode 100644 (file)
index 0000000..fa6d84e
--- /dev/null
@@ -0,0 +1 @@
+<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_jmnogosearch/admin/models/index.html b/com_jmnogosearch/admin/models/index.html
new file mode 100644 (file)
index 0000000..fa6d84e
--- /dev/null
@@ -0,0 +1 @@
+<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_jmnogosearch/admin/models/jmnogosearch.php b/com_jmnogosearch/admin/models/jmnogosearch.php
new file mode 100644 (file)
index 0000000..c22bc10
--- /dev/null
@@ -0,0 +1,121 @@
+<?php
+/**
+ * @version            $Id: com_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
+ * @package            com_mnoGoSearch
+ * @copyright  Copyright (C) 2009 Andrea Zagli. All rights reserved.
+ * @license            GNU/GPL, see LICENSE.php
+ * com_mnoGoSearch is free software. This version may have been modified pursuant
+ * GNU General Public License, and as distributed it includes or is derivative
+ * of works licensed under the GNU General Public License or other free or open
+ * source software licenses. See COPYRIGHT.php for copyright notices and
+ * details.
+ */
+
+// Check to ensure this file is included in Joomla!
+defined('_JEXEC') or die( 'Restricted access' );
+
+jimport( 'joomla.application.component.model' );
+
+/**
+ * @package            mnoGoSearch
+ * @subpackage mnoGoSearch
+ */
+class mnoGoSearchModelSearch extends JModel
+{
+
+       var $lists = '';
+
+       /**
+        * Overridden constructor
+        * @access      protected
+        */
+       function __construct()
+       {
+               parent::__construct();
+       }
+
+       function reset()
+       {
+               $db =& JFactory::getDBO();
+               $db->setQuery( 'DELETE FROM #__mnogosearch_log_searches' );
+               $db->query();
+       }
+
+       function getItems( )
+       {
+               global $mainframe, $option;
+               $db     =& JFactory::getDBO();
+
+               $filter_order           = $mainframe->getUserStateFromRequest( 'com_mnogosearch.filter_order',          'filter_order',         'hits', 'cmd' );
+               $filter_order_Dir       = $mainframe->getUserStateFromRequest( 'com_mnogosearch.filter_order_Dir',      'filter_order_Dir',     '',             'word' );
+               $limit                          = $mainframe->getUserStateFromRequest( 'global.list.limit',                             'limit',                        $mainframe->getCfg('list_limit'), 'int' );
+               $limitstart                     = $mainframe->getUserStateFromRequest( 'com_mnogosearch.limitstart',                    'limitstart',           0,              'int' );
+               $search                         = $mainframe->getUserStateFromRequest( 'com_mnogosearch.search',                                'search',                       '',             'string' );
+               $search                         = JString::strtolower( $search );
+               $showResults            = JRequest::getInt('search_results');
+
+               // table ordering
+               if ( $filter_order_Dir == 'ASC' ) {
+                       $this->lists['order_Dir'] = 'ASC';
+               } else {
+                       $this->lists['order_Dir'] = 'DESC';
+               }
+               $this->lists['order'] = $filter_order;
+
+               // search filter
+               $this->lists['search']= $search;
+
+               $where = array();
+               if ($search) {
+                       $where[] = 'LOWER( search_term ) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false );
+               }
+
+               $where          = ( count( $where ) ? ' WHERE ' . implode( ' AND ', $where ) : '' );
+               $orderby        = ' ORDER BY '. $filter_order .' '. $filter_order_Dir .', hits DESC';
+
+               // get the total number of records
+               $query = 'SELECT COUNT(*)'
+               . ' FROM #__mnogosearch_log_searches'
+               . $where;
+               $db->setQuery( $query );
+               $total = $db->loadResult();
+
+               jimport( 'joomla.html.pagination' );
+               $pageNav = new JPagination( $total, $limitstart, $limit );
+
+               $query = ' SELECT * '
+               . ' FROM #__mnogosearch_log_searches '
+               . $where
+               . $orderby;
+               $db->setQuery( $query, $pageNav->limitstart, $pageNav->limit );
+
+               $rows = $db->loadObjectList();
+
+               JPluginHelper::importPlugin( 'search' );
+
+               if (!class_exists( 'JSite' ))
+               {
+                       // This fools the routers in the search plugins into thinking it's in the frontend
+                       require_once( JPATH_COMPONENT.DS.'helpers'.DS.'site.php' );
+               }
+
+               for ($i=0, $n = count($rows); $i < $n; $i++) {
+                       // determine if number of results for search item should be calculated
+                       // by default it is `off` as it is highly query intensive
+                       if ( $showResults ) {
+                               $results = $mainframe->triggerEvent( 'onSearch', array( $rows[$i]->search_term ) );
+
+                               $count = 0;
+                               for ($j = 0, $n2 = count( $results ); $j < $n2; $j++) {
+                                       $count += count( $results[$j] );
+                               }
+
+                               $rows[$i]->returns = $count;
+                       } else {
+                               $rows[$i]->returns = null;
+                       }
+               }
+
+               return $rows;
+       }
+}
diff --git a/com_jmnogosearch/admin/sql/index.html b/com_jmnogosearch/admin/sql/index.html
new file mode 100644 (file)
index 0000000..fa6d84e
--- /dev/null
@@ -0,0 +1 @@
+<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_jmnogosearch/admin/sql/install.sql b/com_jmnogosearch/admin/sql/install.sql
new file mode 100644 (file)
index 0000000..e20d243
--- /dev/null
@@ -0,0 +1,6 @@
+DROP TABLE IF EXISTS `#__jmnogosearch_log_searches`;
+
+CREATE TABLE `#_jmnogosearch_log_searches` (
+       `search_term` varchar(128) NOT NULL default '',
+       `hits` int(11) unsigned NOT NULL default '0'
+) DEFAULT CHARSET=utf8
diff --git a/com_jmnogosearch/admin/sql/uninstall.sql b/com_jmnogosearch/admin/sql/uninstall.sql
new file mode 100644 (file)
index 0000000..a5b3236
--- /dev/null
@@ -0,0 +1 @@
+DROP TABLE IF EXISTS `#__jmnogosearch_log_searches`;
diff --git a/com_jmnogosearch/admin/views/index.html b/com_jmnogosearch/admin/views/index.html
new file mode 100644 (file)
index 0000000..fa6d84e
--- /dev/null
@@ -0,0 +1 @@
+<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_jmnogosearch/admin/views/jmnogosearch/index.html b/com_jmnogosearch/admin/views/jmnogosearch/index.html
new file mode 100644 (file)
index 0000000..fa6d84e
--- /dev/null
@@ -0,0 +1 @@
+<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_jmnogosearch/admin/views/jmnogosearch/tmpl/default.php b/com_jmnogosearch/admin/views/jmnogosearch/tmpl/default.php
new file mode 100644 (file)
index 0000000..cb86877
--- /dev/null
@@ -0,0 +1,89 @@
+<?php defined('_JEXEC') or die('Restricted access'); ?>
+
+<form action="index.php" method="post" name="adminForm">
+       <table>
+               <tr>
+                       <td align="left" width="100%">
+                               <?php echo JText::_( 'Filter' ); ?>:
+                               <input type="text" name="search" id="search" value="<?php echo $this->escape($this->search); ?>" class="text_area" onchange="document.adminForm.submit();" />
+                               <button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
+                               <button onclick="document.getElementById('search').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
+                       </td>
+                       <td nowrap="nowrap">
+                               <span class="componentheading"><?php echo JText::_( 'Search Logging' ); ?> :
+                               <?php echo $this->enabled ? '<b><font color="green">'. JText::_( 'Enabled' ) .'</font></b>' : '<b><font color="red">'. JText::_( 'Disabled' ) .'</font></b>' ?>
+                               </span>
+                       </td>
+                       <td nowrap="nowrap" align="right">
+                       <?php if ( $this->showResults ) : ?>
+                               <a href="index.php?option=com_search&amp;search_results=0"><?php echo JText::_( 'Hide Search Results' ); ?></a>
+                       <?php else : ?>
+                               <a href="index.php?option=com_search&amp;search_results=1"><?php echo JText::_( 'Show Search Results' ); ?></a>
+                       <?php endif; ?>
+                       </td>
+               </tr>
+       </table>
+
+       <div id="tablecell">
+               <table class="adminlist">
+                       <thead>
+                               <tr>
+                                       <th width="10">
+                                               <?php echo JText::_( 'NUM' ); ?>
+                                       </th>
+                                       <th class="title">
+                                               <?php echo JHTML::_('grid.sort',   'Search Text', 'search_term', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
+                                       </th>
+                                       <th nowrap="nowrap" width="20%">
+                                               <?php echo JHTML::_('grid.sort',   'Times Requested', 'hits', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
+                                       </th>
+                                       <?php
+                                       if ( $this->showResults ) : ?>
+                                               <th nowrap="nowrap" width="20%">
+                                                       <?php echo JText::_( 'Results Returned' ); ?>
+                                               </th>
+                                       <?php endif; ?>
+                               </tr>
+                       </thead>
+                       <tfoot>
+                               <tr>
+                                       <td colspan="4">
+                                               <?php echo $this->pageNav->getListFooter(); ?>
+                                       </td>
+                               </tr>
+                       </tfoot>
+                       <tbody>
+                       <?php
+                       $k = 0;
+                       for ($i=0, $n = count($this->items); $i < $n; $i++) {
+                               $row =& $this->items[$i];
+                               ?>
+                               <tr class="row<?php echo $k;?>">
+                                       <td align="right">
+                                               <?php echo $i+1+$this->pageNav->limitstart; ?>
+                                       </td>
+                                       <td>
+                                               <?php echo htmlspecialchars($row->search_term, ENT_QUOTES, 'UTF-8'); ?>
+                                       </td>
+                                       <td align="center">
+                                               <?php echo $row->hits; ?>
+                                       </td>
+                                       <?php if ( $this->showResults ) : ?>
+                                       <td align="center">
+                                               <?php echo $row->returns; ?>
+                                       </td>
+                                       <?php endif; ?>
+                               </tr>
+                               <?php
+                               $k = 1 - $k;
+                       }
+                       ?>
+                       </tbody>
+               </table>
+       </div>
+
+       <input type="hidden" name="option" value="com_mnogosearch" />
+       <input type="hidden" name="task" value="" />
+       <input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
+       <input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
+</form>
diff --git a/com_jmnogosearch/admin/views/jmnogosearch/tmpl/index.html b/com_jmnogosearch/admin/views/jmnogosearch/tmpl/index.html
new file mode 100644 (file)
index 0000000..fa6d84e
--- /dev/null
@@ -0,0 +1 @@
+<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_jmnogosearch/admin/views/jmnogosearch/view.php b/com_jmnogosearch/admin/views/jmnogosearch/view.php
new file mode 100644 (file)
index 0000000..223b68b
--- /dev/null
@@ -0,0 +1,63 @@
+<?php
+/**
+* @version             $Id: mod_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
+* @package             com_mnoGoSearch
+* @copyright   Copyright (C) 2009 Andrea Zagli. All rights reserved.
+* @license             GNU/GPL, see LICENSE.php
+* com_mnoGoSearch is free software. This version may have been modified pursuant
+* to the GNU General Public License, and as distributed it includes or
+* is derivative of works licensed under the GNU General Public License or
+* other free or open source software licenses.
+* See COPYRIGHT.php for copyright notices and details.
+*/
+
+// no direct access
+defined( '_JEXEC' ) or die( 'Restricted access' );
+
+jimport('joomla.application.component.view');
+
+/**
+ * @package            Joomla
+ * @subpackage Search
+ * @since 1.5
+ */
+class mnoGoSearchViewSearch extends JView
+{
+       function display($tpl=null)
+       {
+               global $mainframe;
+
+               JToolBarHelper::title( JText::_( 'Search Statistics' ), 'searchtext.png' );
+               JToolBarHelper::custom( 'reset', 'delete.png', 'delete_f2.png', 'Reset', false );
+               JToolBarHelper::preferences( 'com_mnogosearch', '150' );
+               JToolBarHelper::help( 'screen.stats.searches' );
+
+               $document = & JFactory::getDocument();
+               $document->setTitle(JText::_('Search Statistics'));
+
+               $limit          = $mainframe->getUserStateFromRequest( 'global.list.limit',     'limit', $mainframe->getCfg('list_limit'), 'int' );
+               $limitstart     = $mainframe->getUserStateFromRequest( 'com_mnogosearch.limitstart', 'limitstart', 0, 'int' );
+
+               $model = $this->getModel();
+               $items = $model->getItems();
+               $params = &JComponentHelper::getParams( 'com_mnogosearch' );
+               $enabled = $params->get('enabled');
+               JHTML::_('behavior.tooltip');
+               jimport('joomla.html.pagination');
+               $pageNav = new JPagination( count($items), $limitstart, $limit );
+
+               $showResults    = JRequest::getInt('search_results');
+
+               $search                 = $mainframe->getUserStateFromRequest( 'com_mnosearch.search', 'search', '', 'string' );
+
+               $this->assignRef('items',       $items);
+               $this->assignRef('enabled', $enabled);
+               $this->assignRef('pageNav', $pageNav);
+               $this->assignRef('search',      $search );
+               $this->assignRef('lists',       $model->lists );
+
+               $this->assignRef('showResults', $showResults);
+
+               parent::display($tpl);
+       }
+}
diff --git a/com_jmnogosearch/jmnogosearch.xml b/com_jmnogosearch/jmnogosearch.xml
new file mode 100644 (file)
index 0000000..c6f3c93
--- /dev/null
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE install SYSTEM "http://dev.joomla.org/xml/1.5/component-install.dtd">\r
+<install type="component" version="1.5.0">
+\r
+       <name>JMnoGoSearch</name>\r
+       <author>Andrea Zagli</author>\r
+       <creationDate>December 2009</creationDate>\r
+       <copyright>Copyright (C) 2009 Andrea Zagli. All rights reserved.</copyright>\r
+       <license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL</license>\r
+       <authorEmail>azagli@libero.it</authorEmail>\r
+       <authorUrl>http://saetta.homelinux.org/</authorUrl>\r
+       <version>1.0.0</version>\r
+       <description>A component to display search results from mnoGoSearch (http://www.mnogosearch.org/) web search engine.</description>
+
+       <install>
+               <sql>
+                       <file charset="utf8" driver="mysql">sql/install.sql</file>
+               </sql>
+       </install>
+       <uninstall>
+               <sql>
+                       <file charset="utf8" driver="mysql">sql/uninstall.sql</file>
+               </sql>
+       </uninstall>
+
+       <files folder="site">
+               <filename>index.html</filename>
+       </files>
+
+       <administration>
+               <menu>JMnoGoSearch</menu>
+               <files folder="admin">
+                       <filename>admin.mnogosearch.php</filename>
+                       <filename>config.xml</filename>
+                       <filename>controller.php</filename>
+                       <filename>index.html</filename>
+                       <filename>helpers/index.html</filename>
+                       <filename>helpers/mnogosearch.php</filename>
+                       <filename>helpers/site.php</filename>
+                       <filename>models/index.html</filename>
+                       <filename>models/mnogosearch.php</filename>
+                       <filename>sql/index.html</filename>
+                       <filename>sql/install.sql</filename>
+                       <filename>sql/uninstall.sql</filename>
+                       <filename>views/index.html</filename>
+                       <filename>views/mnogosearch/index.html</filename>
+                       <filename>views/mnogosearch/view.php</filename>
+                       <filename>views/mnogosearch/tmpl/index.html</filename>
+                       <filename>views/mnogosearch/tmpl/default.php</filename>
+               </files>
+       </administration>
+\r
+</install>
diff --git a/com_jmnogosearch/site/controller.php b/com_jmnogosearch/site/controller.php
new file mode 100644 (file)
index 0000000..e2de408
--- /dev/null
@@ -0,0 +1,86 @@
+<?php
+/**
+ * @version            $Id: com_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
+ * @package            com_mnoGoSearch
+ * @copyright  Copyright (C) 2009 Andrea Zagli. All rights reserved.
+ * @license            GNU/GPL, see LICENSE.php
+ * com_mnoGoSearch is free software. This version may have been modified pursuant
+ * GNU General Public License, and as distributed it includes or is derivative
+ * of works licensed under the GNU General Public License or other free or open
+ * source software licenses. See COPYRIGHT.php for copyright notices and
+ * details.
+ */
+
+// Check to ensure this file is included in Joomla!
+defined('_JEXEC') or die( 'Restricted access' );
+
+jimport('joomla.application.component.controller');
+
+/**
+ * Search Component Controller
+ *
+ * @package            mnoGoSearch
+ * @subpackage mnoGoSearch
+ * @since 1.5
+ */
+class mnoGoSearchController extends JController
+{
+       /**
+        * Method to show the search view
+        *
+        * @access      public
+        * @since       1.5
+        */
+       function display()
+       {
+               JRequest::setVar('view','search'); // force it to be the polls view
+               parent::display();
+       }
+
+       function search()
+       {
+               // slashes cause errors, <> get stripped anyway later on. # causes problems.
+               $badchars = array('#','>','<','\\'); 
+               $searchword = trim(str_replace($badchars, '', JRequest::getString('searchword', null, 'post')));
+               // if searchword enclosed in double quotes, strip quotes and do exact match
+               if (substr($searchword,0,1) == '"' && substr($searchword, -1) == '"') { 
+                       $post['searchword'] = substr($searchword,1,-1);
+                       JRequest::setVar('searchphrase', 'exact');
+               }
+               else {
+                       $post['searchword'] = $searchword;
+               }
+               $post['ordering']       = JRequest::getWord('ordering', null, 'post');
+               $post['searchphrase']   = JRequest::getWord('searchphrase', 'all', 'post');
+               $post['limit']  = JRequest::getInt('limit', null, 'post');
+               if($post['limit'] === null) unset($post['limit']);
+
+               $areas = JRequest::getVar('areas', null, 'post', 'array');
+               if ($areas) {
+                       foreach($areas as $area)
+                       {
+                               $post['areas'][] = JFilterInput::clean($area, 'cmd');
+                       }
+               }
+               
+               // set Itemid id for links from menu
+               $menu = &JSite::getMenu();
+               $items  = $menu->getItems('link', 'index.php?option=com_mnogosearch&view=search');
+
+               if(isset($items[0])) {
+                       $post['Itemid'] = $items[0]->id;
+               } else if (JRequest::getInt('Itemid') > 0) { //use Itemid from requesting page only if there is no existing menu
+                       $post['Itemid'] = JRequest::getInt('Itemid');
+               } 
+               
+               unset($post['task']);
+               unset($post['submit']);
+
+               $uri = JURI::getInstance();
+               $uri->setQuery($post);
+               $uri->setVar('option', 'com_mnogosearch');
+
+
+               $this->setRedirect(JRoute::_('index.php'.$uri->toString(array('query', 'fragment')), false));
+       }
+}
diff --git a/com_jmnogosearch/site/index.html b/com_jmnogosearch/site/index.html
new file mode 100644 (file)
index 0000000..fa6d84e
--- /dev/null
@@ -0,0 +1 @@
+<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_jmnogosearch/site/jmnogosearch.php b/com_jmnogosearch/site/jmnogosearch.php
new file mode 100644 (file)
index 0000000..d7541fb
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+ * @version            $Id: com_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
+ * @package            com_mnoGoSearch
+ * @copyright  Copyright (C) 2009 Andrea Zagli. All rights reserved.
+ * @license            GNU/GPL, see LICENSE.php
+ * com_mnoGoSearch is free software. This version may have been modified pursuant
+ * to the GNU General Public License, and as distributed it includes or
+ * is derivative of works licensed under the GNU General Public License or
+ * other free or open source software licenses.
+ * See COPYRIGHT.php for copyright notices and details.
+ */
+
+// no direct access
+defined( '_JEXEC' ) or die( 'Restricted access' );
+
+// Require the com_content helper library
+require_once (JPATH_COMPONENT.DS.'controller.php');
+
+// Create the controller
+$controller = new mnoGoSearchController( );
+
+// Perform the Request task
+$controller->execute(JRequest::getCmd('task'));
+
+// Redirect if set by the controller
+$controller->redirect();
diff --git a/com_jmnogosearch/site/models/index.html b/com_jmnogosearch/site/models/index.html
new file mode 100644 (file)
index 0000000..fa6d84e
--- /dev/null
@@ -0,0 +1 @@
+<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_jmnogosearch/site/models/jmnogosearch.php b/com_jmnogosearch/site/models/jmnogosearch.php
new file mode 100644 (file)
index 0000000..a29b56e
--- /dev/null
@@ -0,0 +1,214 @@
+<?php
+/**
+ * @version            $Id: com_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
+ * @package            com_mnoGoSearch
+ * @copyright  Copyright (C) 2009 Andrea Zagli. All rights reserved.
+ * @license            GNU/GPL, see LICENSE.php
+ * com_mnoGoSearch is free software. This version may have been modified pursuant
+ * GNU General Public License, and as distributed it includes or is derivative
+ * of works licensed under the GNU General Public License or other free or open
+ * source software licenses. See COPYRIGHT.php for copyright notices and
+ * details.
+ */
+
+// Check to ensure this file is included in Joomla!
+defined( '_JEXEC' ) or die( 'Restricted access' );
+
+jimport('joomla.application.component.model');
+
+/**
+ * Search Component Search Model
+ *
+ * @package            Joomla
+ * @subpackage Search
+ * @since 1.5
+ */
+class mnoGoSearchModelSearch extends JModel
+{
+       /**
+        * Sezrch data array
+        *
+        * @var array
+        */
+       var $_data = null;
+
+       /**
+        * Search total
+        *
+        * @var integer
+        */
+       var $_total = null;
+
+       /**
+        * Search areas
+        *
+        * @var integer
+        */
+       var $_areas = null;
+
+       /**
+        * Pagination object
+        *
+        * @var object
+        */
+       var $_pagination = null;
+
+       /**
+        * Constructor
+        *
+        * @since 1.5
+        */
+       function __construct()
+       {
+               parent::__construct();
+
+               global $mainframe;
+
+               //Get configuration
+               $config = JFactory::getConfig();
+
+               // Get the pagination request variables
+               $this->setState('limit', $mainframe->getUserStateFromRequest('com_mnogosearch.limit', 'limit', $config->getValue('config.list_limit'), 'int'));
+               $this->setState('limitstart', JRequest::getVar('limitstart', 0, '', 'int'));
+
+               // Set the search parameters
+               $keyword                = urldecode(JRequest::getString('searchword'));
+               $match                  = JRequest::getWord('searchphrase', 'all');
+               $ordering               = JRequest::getWord('ordering', 'newest');
+               $this->setSearch($keyword, $match, $ordering);
+
+               //Set the search areas
+               $areas = JRequest::getVar('areas');
+               $this->setAreas($areas);
+       }
+
+       /**
+        * Method to set the search parameters
+        *
+        * @access      public
+        * @param string search string
+        * @param string mathcing option, exact|any|all
+        * @param string ordering option, newest|oldest|popular|alpha|category
+        */
+       function setSearch($keyword, $match = 'all', $ordering = 'newest')
+       {
+               if(isset($keyword)) {
+                       $this->setState('keyword', $keyword);
+               }
+
+               if(isset($match)) {
+                       $this->setState('match', $match);
+               }
+
+               if(isset($ordering)) {
+                       $this->setState('ordering', $ordering);
+               }
+       }
+
+       /**
+        * Method to set the search areas
+        *
+        * @access      public
+        * @param       array   Active areas
+        * @param       array   Search areas
+        */
+       function setAreas($active = array(), $search = array())
+       {
+               $this->_areas['active'] = $active;
+               $this->_areas['search'] = $search;
+       }
+
+       /**
+        * Method to get weblink item data for the category
+        *
+        * @access public
+        * @return array
+        */
+       function getData()
+       {
+               // Lets load the content if it doesn't already exist
+               if (empty($this->_data))
+               {
+                       $areas = $this->getAreas();
+
+                       JPluginHelper::importPlugin( 'search');
+                       $dispatcher =& JDispatcher::getInstance();
+                       $results = $dispatcher->trigger( 'onSearch', array(
+                       $this->getState('keyword'),
+                       $this->getState('match'),
+                       $this->getState('ordering'),
+                       $areas['active']) );
+
+                       $rows = array();
+                       foreach($results AS $result) {
+                               $rows = array_merge( (array) $rows, (array) $result);
+                       }
+
+                       $this->_total   = count($rows);
+                       if($this->getState('limit') > 0) {
+                               $this->_data    = array_splice($rows, $this->getState('limitstart'), $this->getState('limit'));
+                       } else {
+                               $this->_data = $rows;
+                       }
+               }
+
+               return $this->_data;
+       }
+
+       /**
+        * Method to get the total number of weblink items for the category
+        *
+        * @access public
+        * @return integer
+        */
+       function getTotal()
+       {
+               return $this->_total;
+       }
+
+       /**
+        * Method to get a pagination object of the weblink items for the category
+        *
+        * @access public
+        * @return integer
+        */
+       function getPagination()
+       {
+               // Lets load the content if it doesn't already exist
+               if (empty($this->_pagination))
+               {
+                       jimport('joomla.html.pagination');
+                       $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') );
+               }
+
+               return $this->_pagination;
+       }
+
+       /**
+        * Method to get the search areas
+        *
+        * @since 1.5
+        */
+       function getAreas()
+       {
+               global $mainframe;
+
+               // Load the Category data
+               if (empty($this->_areas['search']))
+               {
+                       $areas = array();
+
+                       JPluginHelper::importPlugin( 'search');
+                       $dispatcher =& JDispatcher::getInstance();
+                       $searchareas = $dispatcher->trigger( 'onSearchAreas' );
+
+                       foreach ($searchareas as $area) {
+                               $areas = array_merge( $areas, $area );
+                       }
+
+                       $this->_areas['search'] = $areas;
+               }
+
+               return $this->_areas;
+       }
+}
diff --git a/com_jmnogosearch/site/router.php b/com_jmnogosearch/site/router.php
new file mode 100644 (file)
index 0000000..aed9b53
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+/**
+ * @version            $Id: router.php 11002 2008-10-07 01:12:20Z ian $
+ * @package            Joomla
+ * @copyright  Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
+ * @license            GNU/GPL, see LICENSE.php
+ * Joomla! is free software. This version may have been modified pursuant
+ * to the GNU General Public License, and as distributed it includes or
+ * is derivative of works licensed under the GNU General Public License or
+ * other free or open source software licenses.
+ * See COPYRIGHT.php for copyright notices and details.
+ */
+
+/**
+ * @param      array
+ * @return     array
+ */
+function SearchBuildRoute( &$query )
+{
+       $segments = array();
+
+       if (isset($query['searchword'])) {
+               $segments[] = $query['searchword'];
+               unset($query['searchword']);
+       }
+
+       // Retrieve configuration options - needed to know which SEF URLs are used
+       $app =& JFactory::getApplication();
+       // Allows for searching on strings that include ".xxx" that appear to Apache as an extension
+       if (($app->getCfg('sef')) && ($app->getCfg('sef_rewrite')) && !($app->getCfg('sef_suffix'))) {
+               $segments[] .= '/';
+       }
+
+       if (isset($query['view'])) {
+               unset($query['view']);
+       }
+       return $segments;
+}
+
+/**
+ * @param      array
+ * @return     array
+ */
+function SearchParseRoute( $segments )
+{
+       $vars = array();
+
+       $searchword     = array_shift($segments);
+       $vars['searchword'] = $searchword;
+       $vars['view'] = 'search';
+
+       return $vars;
+}
\ No newline at end of file
diff --git a/com_jmnogosearch/site/views/index.html b/com_jmnogosearch/site/views/index.html
new file mode 100644 (file)
index 0000000..fa6d84e
--- /dev/null
@@ -0,0 +1 @@
+<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_jmnogosearch/site/views/jmnogosearch/index.html b/com_jmnogosearch/site/views/jmnogosearch/index.html
new file mode 100644 (file)
index 0000000..fa6d84e
--- /dev/null
@@ -0,0 +1 @@
+<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_jmnogosearch/site/views/jmnogosearch/metadata.xml b/com_jmnogosearch/site/views/jmnogosearch/metadata.xml
new file mode 100644 (file)
index 0000000..1d0748d
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<metadata>\r
+       <view title="Search">\r
+               <message><![CDATA[TYPESEARCHDESC]]></message>\r
+       </view>\r
+</metadata>
\ No newline at end of file
diff --git a/com_jmnogosearch/site/views/jmnogosearch/tmpl/default.php b/com_jmnogosearch/site/views/jmnogosearch/tmpl/default.php
new file mode 100644 (file)
index 0000000..94f3b1b
--- /dev/null
@@ -0,0 +1,14 @@
+<?php defined('_JEXEC') or die('Restricted access'); ?>
+
+<?php if ( $this->params->get( 'show_page_title', 1 ) ) : ?>
+<div class="componentheading<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
+       <?php echo $this->params->get( 'page_title' ); ?>
+</div>
+<?php endif; ?>
+
+<?php echo $this->loadTemplate('form'); ?>
+<?php if(!$this->error && count($this->results) > 0) :
+       echo $this->loadTemplate('results');
+else :
+       echo $this->loadTemplate('error');
+endif; ?>
diff --git a/com_jmnogosearch/site/views/jmnogosearch/tmpl/default.xml b/com_jmnogosearch/site/views/jmnogosearch/tmpl/default.xml
new file mode 100644 (file)
index 0000000..372f1e2
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<metadata>
+       <layout title="Search">
+               <message>
+                       <![CDATA[STANDARD SEARCH LAYOUT DESC]]>
+               </message>
+       </layout>
+       <state>
+               <name>Search</name>
+               <description>STANDARD SEARCH LAYOUT DESC</description>
+               <params>
+                       <param name="search_areas" type="radio" default="1" label="Use Search Areas" description="Show the search areas checkboxes">
+                               <option value="0">No</option>
+                               <option value="1">Yes</option>
+                       </param>
+                       <param name="show_date" type="radio" default="1" label="Show Created Date" description="TIPIFSETTOSHOWDATETIMECREATED">
+                               <option value="0">Hide</option>
+                               <option value="1">Show</option>
+                       </param>
+               </params>
+       </state>
+</metadata>
\ No newline at end of file
diff --git a/com_jmnogosearch/site/views/jmnogosearch/tmpl/default_error.php b/com_jmnogosearch/site/views/jmnogosearch/tmpl/default_error.php
new file mode 100644 (file)
index 0000000..3f9cd4c
--- /dev/null
@@ -0,0 +1,9 @@
+<?php defined('_JEXEC') or die('Restricted access'); ?>
+
+<table class="searchintro<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
+       <tr>
+               <td colspan="3" >
+                       <?php echo $this->escape($this->error); ?>
+               </td>
+       </tr>
+</table>
diff --git a/com_jmnogosearch/site/views/jmnogosearch/tmpl/default_form.php b/com_jmnogosearch/site/views/jmnogosearch/tmpl/default_form.php
new file mode 100644 (file)
index 0000000..9659ede
--- /dev/null
@@ -0,0 +1,76 @@
+<?php defined('_JEXEC') or die('Restricted access'); ?>
+
+<form id="searchForm" action="<?php echo JRoute::_( 'index.php?option=com_mnogosearch' );?>" method="post" name="searchForm">
+       <table class="contentpaneopen<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
+               <tr>
+                       <td nowrap="nowrap">
+                               <label for="search_searchword">
+                                       <?php echo JText::_( 'Search Keyword' ); ?>:
+                               </label>
+                       </td>
+                       <td nowrap="nowrap">
+                               <input type="text" name="searchword" id="search_searchword" size="30" maxlength="20" value="<?php echo $this->escape($this->searchword); ?>" class="inputbox" />
+                       </td>
+                       <td width="100%" nowrap="nowrap">
+                               <button name="Search" onclick="this.form.submit()" class="button"><?php echo JText::_( 'Search' );?></button>
+                       </td>
+               </tr>
+               <tr>
+                       <td colspan="3">
+                               <?php echo $this->lists['searchphrase']; ?>
+                       </td>
+               </tr>
+               <tr>
+                       <td colspan="3">
+                               <label for="ordering">
+                                       <?php echo JText::_( 'Ordering' );?>:
+                               </label>
+                               <?php echo $this->lists['ordering'];?>
+                       </td>
+               </tr>
+       </table>
+       <?php if ($this->params->get( 'search_areas', 1 )) : ?>
+               <?php echo JText::_( 'Search Only' );?>:
+               <?php foreach ($this->searchareas['search'] as $val => $txt) :
+                       $checked = is_array( $this->searchareas['active'] ) && in_array( $val, $this->searchareas['active'] ) ? 'checked="checked"' : '';
+               ?>
+               <input type="checkbox" name="areas[]" value="<?php echo $val;?>" id="area_<?php echo $val;?>" <?php echo $checked;?> />
+                       <label for="area_<?php echo $val;?>">
+                               <?php echo JText::_($txt); ?>
+                       </label>
+               <?php endforeach; ?>
+       <?php endif; ?>
+
+
+       <table class="searchintro<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
+       <tr>
+               <td colspan="3" >
+                       <br />
+                       <?php echo JText::_( 'Search Keyword' ) .' <b>'. $this->escape($this->searchword) .'</b>'; ?>
+               </td>
+       </tr>
+       <tr>
+               <td>
+                       <br />
+                       <?php echo $this->result; ?>
+               </td>
+       </tr>
+</table>
+
+<br />
+<?php if($this->total > 0) : ?>
+<div align="center">
+       <div style="float: right;">
+               <label for="limit">
+                       <?php echo JText::_( 'Display Num' ); ?>
+               </label>
+               <?php echo $this->pagination->getLimitBox( ); ?>
+       </div>
+       <div>
+               <?php echo $this->pagination->getPagesCounter(); ?>
+       </div>
+</div>
+<?php endif; ?>
+
+<input type="hidden" name="task"   value="search" />
+</form>
diff --git a/com_jmnogosearch/site/views/jmnogosearch/tmpl/default_results.php b/com_jmnogosearch/site/views/jmnogosearch/tmpl/default_results.php
new file mode 100644 (file)
index 0000000..7c9635c
--- /dev/null
@@ -0,0 +1,53 @@
+<?php defined('_JEXEC') or die('Restricted access'); ?>
+
+<table class="contentpaneopen<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
+       <tr>
+               <td>
+               <?php
+               foreach( $this->results as $result ) : ?>
+                       <fieldset>
+                               <div>
+                                       <span class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
+                                               <?php echo $this->pagination->limitstart + $result->count.'. ';?>
+                                       </span>
+                                       <?php if ( $result->href ) :
+                                               if ($result->browsernav == 1 ) : ?>
+                                                       <a href="<?php echo JRoute::_($result->href); ?>" target="_blank">
+                                               <?php else : ?>
+                                                       <a href="<?php echo JRoute::_($result->href); ?>">
+                                               <?php endif;
+
+                                               echo $this->escape($result->title);
+
+                                               if ( $result->href ) : ?>
+                                                       </a>
+                                               <?php endif;
+                                               if ( $result->section ) : ?>
+                                                       <br />
+                                                       <span class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
+                                                               (<?php echo $this->escape($result->section); ?>)
+                                                       </span>
+                                               <?php endif; ?>
+                                       <?php endif; ?>
+                               </div>
+                               <div>
+                                       <?php echo $result->text; ?>
+                               </div>
+                               <?php
+                                       if ( $this->params->get( 'show_date' )) : ?>
+                               <div class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
+                                       <?php echo $result->created; ?>
+                               </div>
+                               <?php endif; ?>
+                       </fieldset>
+               <?php endforeach; ?>
+               </td>
+       </tr>
+       <tr>
+               <td colspan="3">
+                       <div align="center">
+                               <?php echo $this->pagination->getPagesLinks( ); ?>
+                       </div>
+               </td>
+       </tr>
+</table>
diff --git a/com_jmnogosearch/site/views/jmnogosearch/tmpl/index.html b/com_jmnogosearch/site/views/jmnogosearch/tmpl/index.html
new file mode 100644 (file)
index 0000000..fa6d84e
--- /dev/null
@@ -0,0 +1 @@
+<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_jmnogosearch/site/views/jmnogosearch/view.html.php b/com_jmnogosearch/site/views/jmnogosearch/view.html.php
new file mode 100644 (file)
index 0000000..cb721c6
--- /dev/null
@@ -0,0 +1,177 @@
+<?php
+/**
+ * @version            $Id: com_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
+ * @package            com_mnoGoSearch
+ * @copyright  Copyright (C) 2009 Andrea Zagli. All rights reserved.
+ * @license            GNU/GPL, see LICENSE.php
+ * com_mnoGoSearch is free software. This version may have been modified pursuant
+ * to the GNU General Public License, and as distributed it includes or
+ * is derivative of works licensed under the GNU General Public License or
+ * other free or open source software licenses.
+ * See COPYRIGHT.php for copyright notices and details.
+ */
+
+// Check to ensure this file is included in Joomla!
+defined('_JEXEC') or die( 'Restricted access' );
+
+jimport( 'joomla.application.component.view');
+
+/**
+ * HTML View class for the WebLinks component
+ *
+ * @static
+ * @package            Joomla
+ * @subpackage Weblinks
+ * @since 1.0
+ */
+class mnoGoSearchViewSearch extends JView
+{
+       function display($tpl = null)
+       {
+               global $mainframe;
+
+               require_once(JPATH_COMPONENT_ADMINISTRATOR.DS.'helpers'.DS.'mnogosearch.php' );
+
+               // Initialize some variables
+               $pathway  =& $mainframe->getPathway();
+               $uri      =& JFactory::getURI();
+
+               $error  = '';
+               $rows   = null;
+               $total  = 0;
+
+               // Get some data from the model
+               $areas      = &$this->get('areas');
+               $state          = &$this->get('state');
+               $searchword = $state->get('keyword');
+
+               $params = &$mainframe->getParams();
+
+               $menus  = &JSite::getMenu();
+               $menu   = $menus->getActive();
+
+               // because the application sets a default page title, we need to get it
+               // right from the menu item itself
+               if (is_object( $menu )) {
+                       $menu_params = new JParameter( $menu->params );
+                       if (!$menu_params->get( 'page_title')) {
+                               $params->set('page_title',      JText::_( 'Search' ));
+                       }
+               } else {
+                       $params->set('page_title',      JText::_( 'Search' ));
+               }
+
+               $document       = &JFactory::getDocument();
+               $document->setTitle( $params->get( 'page_title' ) );
+
+               // Get the parameters of the active menu item
+               $params = &$mainframe->getParams();
+
+               // built select lists
+               $orders = array();
+               $orders[] = JHTML::_('select.option',  'newest', JText::_( 'Newest first' ) );
+               $orders[] = JHTML::_('select.option',  'oldest', JText::_( 'Oldest first' ) );
+               $orders[] = JHTML::_('select.option',  'popular', JText::_( 'Most popular' ) );
+               $orders[] = JHTML::_('select.option',  'alpha', JText::_( 'Alphabetical' ) );
+               $orders[] = JHTML::_('select.option',  'category', JText::_( 'Section/Category' ) );
+
+               $lists = array();
+               $lists['ordering'] = JHTML::_('select.genericlist',   $orders, 'ordering', 'class="inputbox"', 'value', 'text', $state->get('ordering') );
+
+               $searchphrases          = array();
+               $searchphrases[]        = JHTML::_('select.option',  'all', JText::_( 'All words' ) );
+               $searchphrases[]        = JHTML::_('select.option',  'any', JText::_( 'Any words' ) );
+               $searchphrases[]        = JHTML::_('select.option',  'exact', JText::_( 'Exact phrase' ) );
+               $lists['searchphrase' ]= JHTML::_('select.radiolist',  $searchphrases, 'searchphrase', '', 'value', 'text', $state->get('match') );
+
+               // log the search
+               SearchHelper::logSearch( $searchword);
+
+               //limit searchword
+
+               if(SearchHelper::limitSearchWord($searchword)) {
+                       $error = JText::_( 'SEARCH_MESSAGE' );
+               }
+
+               //sanatise searchword
+               if(SearchHelper::santiseSearchWord($searchword, $state->get('match'))) {
+                       $error = JText::_( 'IGNOREKEYWORD' );
+               }
+
+               if (!$searchword && count( JRequest::get('post') ) ) {
+                       //$error = JText::_( 'Enter a search keyword' );
+               }
+
+               // put the filtered results back into the model
+               // for next release, the checks should be done in the model perhaps...
+               $state->set('keyword', $searchword);
+
+               if(!$error)
+               {
+                       $results        = &$this->get('data' );
+                       $total          = &$this->get('total');
+                       $pagination     = &$this->get('pagination');
+
+                       require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
+
+                       for ($i=0; $i < count($results); $i++)
+                       {
+                               $row = &$results[$i]->text;
+
+                               if ($state->get('match') == 'exact')
+                               {
+                                       $searchwords = array($searchword);
+                                       $needle = $searchword;
+                               }
+                               else
+                               {
+                                       $searchwords = preg_split("/\s+/u", $searchword);
+                                       $needle = $searchwords[0];
+                               }
+
+                               $row = SearchHelper::prepareSearchContent( $row, 200, $needle );
+                               $searchwords = array_unique( $searchwords );
+                               $searchRegex = '#(';
+                               $x = 0;
+                               foreach ($searchwords as $k => $hlword)
+                               {
+                                       $searchRegex .= ($x == 0 ? '' : '|');
+                                       $searchRegex .= preg_quote($hlword, '#');
+                                       $x++;
+                               }
+                               $searchRegex .= ')#iu';
+
+                               $row = preg_replace($searchRegex, '<span class="highlight">\0</span>', $row );
+
+                               $result =& $results[$i];
+                           if ($result->created) {
+                                   $created = JHTML::Date ( $result->created );
+                           }
+                           else {
+                                   $created = '';
+                           }
+
+                           $result->created    = $created;
+                           $result->count              = $i + 1;
+                       }
+               }
+
+               $this->result   = JText::sprintf( 'TOTALRESULTSFOUND', $total );
+
+               $this->assignRef('pagination',  $pagination);
+               $this->assignRef('results',             $results);
+               $this->assignRef('lists',               $lists);
+               $this->assignRef('params',              $params);
+
+               $this->assign('ordering',               $state->get('ordering'));
+               $this->assign('searchword',             $searchword);
+               $this->assign('searchphrase',   $state->get('match'));
+               $this->assign('searchareas',    $areas);
+
+               $this->assign('total',                  $total);
+               $this->assign('error',                  $error);
+               $this->assign('action',             $uri->toString());
+
+               parent::display($tpl);
+       }
+}
diff --git a/com_mnogosearch/admin/admin.mnogosearch.php b/com_mnogosearch/admin/admin.mnogosearch.php
deleted file mode 100644 (file)
index 4c507a4..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-/**
-* @version             $Id: com_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
-* @package             com_mnoGoSearch
-* @copyright   Copyright (C) 2009 Andrea Zagli. All rights reserved.
-* @license             GNU/GPL, see LICENSE.php
-* com_mnoGoSearch is free software. This version may have been modified pursuant
-* to the GNU General Public License, and as distributed it includes or
-* is derivative of works licensed under the GNU General Public License or
-* other free or open source software licenses.
-* See COPYRIGHT.php for copyright notices and details.
-*/
-
-// no direct access
-defined( '_JEXEC' ) or die( 'Restricted access' );
-
-require_once( JPATH_COMPONENT.DS.'controller.php' );
-
-$controller = new mnoGoSearchController();
-$controller->execute( JRequest::getCmd( 'task' ) );
-$controller->redirect();
diff --git a/com_mnogosearch/admin/config.xml b/com_mnogosearch/admin/config.xml
deleted file mode 100644 (file)
index c98eba5..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<config>
-       <params>
-               <param name="enabled" type="radio" default="0" label="Gather Search Statistics" description="TIPSEARCHSTATISTICS">
-                       <option value="0">No</option>
-                       <option value="1">Yes</option>
-               </param>
-               <param name="show_date" type="radio" default="1" label="Show Created Date" description="TIPIFSETTOSHOWDATETIMECREATED">
-                       <option value="0">Hide</option>
-                       <option value="1">Show</option>
-               </param>
-       </params>
-</config>
diff --git a/com_mnogosearch/admin/controller.php b/com_mnogosearch/admin/controller.php
deleted file mode 100644 (file)
index c684b0d..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/**
- * @version            $Id: com_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
- * @package            com_mnoGoSearch
- * @copyright  Copyright (C) 2009 Andrea Zagli. All rights reserved.
- * @license            GNU/GPL, see LICENSE.php
- * com_mnoGoSearch is free software. This version may have been modified pursuant
- * GNU General Public License, and as distributed it includes or is derivative
- * of works licensed under the GNU General Public License or other free or open
- * source software licenses. See COPYRIGHT.php for copyright notices and
- * details.
- */
-
-// Check to ensure this file is included in Joomla!
-defined('_JEXEC') or die( 'Restricted access' );
-
-jimport('joomla.application.component.controller');
-
-/**
- * @package            mnoGoSearch
- * @subpackage mnoGoSearch
- */
-class mnoGoSearchController extends JController
-{
-       /**
-        * Show Search Statistics
-        */
-       function display()
-       {
-               $model  =& $this->getModel( 'Search' );
-               $view   =& $this->getView( 'Search' );
-               $view->setModel( $model, true );
-               $view->display();
-       }
-
-       /**
-        * Reset Statistics
-        */
-       function reset()
-       {
-               $model  =& $this->getModel( 'Search' );
-               $model->reset();
-               $this->setRedirect('index.php?option=com_mnogosearch');
-       }
-}
diff --git a/com_mnogosearch/admin/helpers/index.html b/com_mnogosearch/admin/helpers/index.html
deleted file mode 100644 (file)
index fa6d84e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_mnogosearch/admin/helpers/mnogosearch.php b/com_mnogosearch/admin/helpers/mnogosearch.php
deleted file mode 100644 (file)
index b2b5cdf..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-<?php
-/**
- * @version            $Id: search.php 12389 2009-07-01 00:34:45Z ian $
- * @package  Joomla
- * @subpackage Search
- * @copyright  Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
- * @license            GNU/GPL, see LICENSE.php
- * Joomla! is free software. This version may have been modified pursuant to the
- * GNU General Public License, and as distributed it includes or is derivative
- * of works licensed under the GNU General Public License or other free or open
- * source software licenses. See COPYRIGHT.php for copyright notices and
- * details.
- */
-
-// Check to ensure this file is included in Joomla!
-defined('_JEXEC') or die( 'Restricted access' );
-
-/**
- * @package            Joomla
- * @subpackage Search
- */
-class SearchHelper
-{
-       function santiseSearchWord(&$searchword, $searchphrase)
-       {
-               $ignored = false;
-
-               $lang =& JFactory::getLanguage();
-
-               $search_ignore  = array();
-               $tag                    = $lang->getTag();
-               $ignoreFile             = $lang->getLanguagePath().DS.$tag.DS.$tag.'.ignore.php';
-               if (file_exists($ignoreFile)) {
-                       include $ignoreFile;
-               }
-
-               // check for words to ignore
-               $aterms = explode( ' ', JString::strtolower( $searchword ) );
-
-               // first case is single ignored word
-               if ( count( $aterms ) == 1 && in_array( JString::strtolower( $searchword ), $search_ignore ) ) {
-                       $ignored = true;
-               }
-
-               // filter out search terms that are too small
-               foreach( $aterms AS $aterm ) {
-                       if (JString::strlen( $aterm ) < 3) {
-                               $search_ignore[] = $aterm;
-                       }
-               }
-
-               // next is to remove ignored words from type 'all' or 'any' (not exact) searches with multiple words
-               if ( count( $aterms ) > 1 && $searchphrase != 'exact' ) {
-                       $pruned = array_diff( $aterms, $search_ignore );
-                       $searchword = implode( ' ', $pruned );
-               }
-
-               return $ignored;
-       }
-
-       function limitSearchWord(&$searchword)
-       {
-               $restriction = false;
-
-               // limit searchword to 20 characters
-               if ( JString::strlen( $searchword ) > 20 ) {
-                       $searchword     = JString::substr( $searchword, 0, 19 );
-                       $restriction    = true;
-               }
-
-               // searchword must contain a minimum of 3 characters
-               if ( $searchword && JString::strlen( $searchword ) < 3 ) {
-                       $searchword     = '';
-                       $restriction    = true;
-               }
-
-               return $restriction;
-       }
-
-       function logSearch( $search_term )
-       {
-               global $mainframe;
-
-               $db =& JFactory::getDBO();
-
-               $params = &JComponentHelper::getParams( 'com_search' );
-               $enable_log_searches = $params->get('enabled');
-
-               $search_term = $db->getEscaped( trim( $search_term) );
-
-               if ( @$enable_log_searches )
-               {
-                       $db =& JFactory::getDBO();
-                       $query = 'SELECT hits'
-                       . ' FROM #__core_log_searches'
-                       . ' WHERE LOWER( search_term ) = "'.$search_term.'"'
-                       ;
-                       $db->setQuery( $query );
-                       $hits = intval( $db->loadResult() );
-                       if ( $hits ) {
-                               $query = 'UPDATE #__core_log_searches'
-                               . ' SET hits = ( hits + 1 )'
-                               . ' WHERE LOWER( search_term ) = "'.$search_term.'"'
-                               ;
-                               $db->setQuery( $query );
-                               $db->query();
-                       } else {
-                               $query = 'INSERT INTO #__core_log_searches VALUES ( "'.$search_term.'", 1 )';
-                               $db->setQuery( $query );
-                               $db->query();
-                       }
-               }
-       }
-
-       /**
-        * Prepares results from search for display
-        *
-        * @param string The source string
-        * @param int Number of chars to trim
-        * @param string The searchword to select around
-        * @return string
-        */
-       function prepareSearchContent( $text, $length = 200, $searchword )
-       {
-               // strips tags won't remove the actual jscript
-               $text = preg_replace( "'<script[^>]*>.*?</script>'si", "", $text );
-               $text = preg_replace( '/{.+?}/', '', $text);
-               //$text = preg_replace( '/<a\s+.*?href="([^"]+)"[^>]*>([^<]+)<\/a>/is','\2', $text );
-               // replace line breaking tags with whitespace
-               $text = preg_replace( "'<(br[^/>]*?/|hr[^/>]*?/|/(div|h[1-6]|li|p|td))>'si", ' ', $text );
-
-               return SearchHelper::_smartSubstr( strip_tags( $text ), $length, $searchword );
-       }
-
-       /**
-        * Checks an object for search terms (after stripping fields of HTML)
-        *
-        * @param object The object to check
-        * @param string Search words to check for
-        * @param array List of object variables to check against
-        * @returns boolean True if searchTerm is in object, false otherwise
-        */
-       function checkNoHtml($object, $searchTerm, $fields) {
-               $searchRegex = array(
-                               '#<script[^>]*>.*?</script>#si',
-                               '#<style[^>]*>.*?</style>#si',
-                               '#<!.*?(--|]])>#si',
-                               '#<[^>]*>#i'
-                               );
-               $terms = explode(' ', $searchTerm);
-               if(empty($fields)) return false;
-               foreach($fields AS $field) {
-                       if(!isset($object->$field)) continue;
-                       $text = $object->$field;
-                       foreach($searchRegex As $regex) {
-                               $text = preg_replace($regex, '', $text);
-                       }
-                       foreach($terms AS $term) {
-                               if(JString::stristr($text, $term) !== false) {
-                                       return true;
-                               }
-                       }
-               }
-               return false;
-       }
-
-       /**
-        * returns substring of characters around a searchword
-        *
-        * @param string The source string
-        * @param int Number of chars to return
-        * @param string The searchword to select around
-        * @return string
-        */
-       function _smartSubstr($text, $length = 200, $searchword)
-       {
-               $textlen = JString::strlen($text);
-               $lsearchword = JString::strtolower($searchword);
-               $wordfound = false;
-               $pos = 0;
-               while ($wordfound === false && $pos < $textlen) {
-                       if (($wordpos = @JString::strpos($text, ' ', $pos + $length)) !== false) {
-                               $chunk_size = $wordpos - $pos;
-                       } else {
-                               $chunk_size = $length;
-                       }
-                       $chunk = JString::substr($text, $pos, $chunk_size);
-                       $wordfound = JString::strpos(JString::strtolower($chunk), $lsearchword);
-                       if ($wordfound === false) {
-                               $pos += $chunk_size + 1;
-                       }
-               }
-
-               if ($wordfound !== false) {
-                       return (($pos > 0) ? '...&nbsp;' : '') . $chunk . '&nbsp;...';
-               } else {
-                       if (($wordpos = @JString::strpos($text, ' ', $length)) !== false) {
-                               return JString::substr($text, 0, $wordpos) . '&nbsp;...';
-                       } else {
-                               return JString::substr($text, 0, $length);
-                       }
-               }
-       }
-}
diff --git a/com_mnogosearch/admin/helpers/site.php b/com_mnogosearch/admin/helpers/site.php
deleted file mode 100644 (file)
index 6368a03..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/**
- * @version            $Id: site.php 12389 2009-07-01 00:34:45Z ian $
- * @package  Joomla
- * @subpackage Search
- * @copyright  Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
- * @license            GNU/GPL, see LICENSE.php
- * Joomla! is free software. This version may have been modified pursuant to the
- * GNU General Public License, and as distributed it includes or is derivative
- * of works licensed under the GNU General Public License or other free or open
- * source software licenses. See COPYRIGHT.php for copyright notices and details.
- */
-
-// Check to ensure this file is included in Joomla!
-defined('_JEXEC') or die( 'Restricted access' );
-
-/**
- * False JSite class used to fool the frontend search plugins because they route the results
- */
-class JSite extends JObject
-{
-       /**
-        * False method to fool the frontend search plugins
-        */
-       function getMenu()
-       {
-               $result = new JSite;
-               return $result;
-       }
-
-       /**
-        * False method to fool the frontend search plugins
-        */
-       function getItems()
-       {
-               return array();
-       }
-}
\ No newline at end of file
diff --git a/com_mnogosearch/admin/index.html b/com_mnogosearch/admin/index.html
deleted file mode 100644 (file)
index fa6d84e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_mnogosearch/admin/models/index.html b/com_mnogosearch/admin/models/index.html
deleted file mode 100644 (file)
index fa6d84e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_mnogosearch/admin/models/mnogosearch.php b/com_mnogosearch/admin/models/mnogosearch.php
deleted file mode 100644 (file)
index c22bc10..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-<?php
-/**
- * @version            $Id: com_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
- * @package            com_mnoGoSearch
- * @copyright  Copyright (C) 2009 Andrea Zagli. All rights reserved.
- * @license            GNU/GPL, see LICENSE.php
- * com_mnoGoSearch is free software. This version may have been modified pursuant
- * GNU General Public License, and as distributed it includes or is derivative
- * of works licensed under the GNU General Public License or other free or open
- * source software licenses. See COPYRIGHT.php for copyright notices and
- * details.
- */
-
-// Check to ensure this file is included in Joomla!
-defined('_JEXEC') or die( 'Restricted access' );
-
-jimport( 'joomla.application.component.model' );
-
-/**
- * @package            mnoGoSearch
- * @subpackage mnoGoSearch
- */
-class mnoGoSearchModelSearch extends JModel
-{
-
-       var $lists = '';
-
-       /**
-        * Overridden constructor
-        * @access      protected
-        */
-       function __construct()
-       {
-               parent::__construct();
-       }
-
-       function reset()
-       {
-               $db =& JFactory::getDBO();
-               $db->setQuery( 'DELETE FROM #__mnogosearch_log_searches' );
-               $db->query();
-       }
-
-       function getItems( )
-       {
-               global $mainframe, $option;
-               $db     =& JFactory::getDBO();
-
-               $filter_order           = $mainframe->getUserStateFromRequest( 'com_mnogosearch.filter_order',          'filter_order',         'hits', 'cmd' );
-               $filter_order_Dir       = $mainframe->getUserStateFromRequest( 'com_mnogosearch.filter_order_Dir',      'filter_order_Dir',     '',             'word' );
-               $limit                          = $mainframe->getUserStateFromRequest( 'global.list.limit',                             'limit',                        $mainframe->getCfg('list_limit'), 'int' );
-               $limitstart                     = $mainframe->getUserStateFromRequest( 'com_mnogosearch.limitstart',                    'limitstart',           0,              'int' );
-               $search                         = $mainframe->getUserStateFromRequest( 'com_mnogosearch.search',                                'search',                       '',             'string' );
-               $search                         = JString::strtolower( $search );
-               $showResults            = JRequest::getInt('search_results');
-
-               // table ordering
-               if ( $filter_order_Dir == 'ASC' ) {
-                       $this->lists['order_Dir'] = 'ASC';
-               } else {
-                       $this->lists['order_Dir'] = 'DESC';
-               }
-               $this->lists['order'] = $filter_order;
-
-               // search filter
-               $this->lists['search']= $search;
-
-               $where = array();
-               if ($search) {
-                       $where[] = 'LOWER( search_term ) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false );
-               }
-
-               $where          = ( count( $where ) ? ' WHERE ' . implode( ' AND ', $where ) : '' );
-               $orderby        = ' ORDER BY '. $filter_order .' '. $filter_order_Dir .', hits DESC';
-
-               // get the total number of records
-               $query = 'SELECT COUNT(*)'
-               . ' FROM #__mnogosearch_log_searches'
-               . $where;
-               $db->setQuery( $query );
-               $total = $db->loadResult();
-
-               jimport( 'joomla.html.pagination' );
-               $pageNav = new JPagination( $total, $limitstart, $limit );
-
-               $query = ' SELECT * '
-               . ' FROM #__mnogosearch_log_searches '
-               . $where
-               . $orderby;
-               $db->setQuery( $query, $pageNav->limitstart, $pageNav->limit );
-
-               $rows = $db->loadObjectList();
-
-               JPluginHelper::importPlugin( 'search' );
-
-               if (!class_exists( 'JSite' ))
-               {
-                       // This fools the routers in the search plugins into thinking it's in the frontend
-                       require_once( JPATH_COMPONENT.DS.'helpers'.DS.'site.php' );
-               }
-
-               for ($i=0, $n = count($rows); $i < $n; $i++) {
-                       // determine if number of results for search item should be calculated
-                       // by default it is `off` as it is highly query intensive
-                       if ( $showResults ) {
-                               $results = $mainframe->triggerEvent( 'onSearch', array( $rows[$i]->search_term ) );
-
-                               $count = 0;
-                               for ($j = 0, $n2 = count( $results ); $j < $n2; $j++) {
-                                       $count += count( $results[$j] );
-                               }
-
-                               $rows[$i]->returns = $count;
-                       } else {
-                               $rows[$i]->returns = null;
-                       }
-               }
-
-               return $rows;
-       }
-}
diff --git a/com_mnogosearch/admin/sql/index.html b/com_mnogosearch/admin/sql/index.html
deleted file mode 100644 (file)
index fa6d84e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_mnogosearch/admin/sql/install.sql b/com_mnogosearch/admin/sql/install.sql
deleted file mode 100644 (file)
index e20d243..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-DROP TABLE IF EXISTS `#__jmnogosearch_log_searches`;
-
-CREATE TABLE `#_jmnogosearch_log_searches` (
-       `search_term` varchar(128) NOT NULL default '',
-       `hits` int(11) unsigned NOT NULL default '0'
-) DEFAULT CHARSET=utf8
diff --git a/com_mnogosearch/admin/sql/uninstall.sql b/com_mnogosearch/admin/sql/uninstall.sql
deleted file mode 100644 (file)
index a5b3236..0000000
+++ /dev/null
@@ -1 +0,0 @@
-DROP TABLE IF EXISTS `#__jmnogosearch_log_searches`;
diff --git a/com_mnogosearch/admin/views/index.html b/com_mnogosearch/admin/views/index.html
deleted file mode 100644 (file)
index fa6d84e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_mnogosearch/admin/views/mnogosearch/index.html b/com_mnogosearch/admin/views/mnogosearch/index.html
deleted file mode 100644 (file)
index fa6d84e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_mnogosearch/admin/views/mnogosearch/tmpl/default.php b/com_mnogosearch/admin/views/mnogosearch/tmpl/default.php
deleted file mode 100644 (file)
index cb86877..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php defined('_JEXEC') or die('Restricted access'); ?>
-
-<form action="index.php" method="post" name="adminForm">
-       <table>
-               <tr>
-                       <td align="left" width="100%">
-                               <?php echo JText::_( 'Filter' ); ?>:
-                               <input type="text" name="search" id="search" value="<?php echo $this->escape($this->search); ?>" class="text_area" onchange="document.adminForm.submit();" />
-                               <button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
-                               <button onclick="document.getElementById('search').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
-                       </td>
-                       <td nowrap="nowrap">
-                               <span class="componentheading"><?php echo JText::_( 'Search Logging' ); ?> :
-                               <?php echo $this->enabled ? '<b><font color="green">'. JText::_( 'Enabled' ) .'</font></b>' : '<b><font color="red">'. JText::_( 'Disabled' ) .'</font></b>' ?>
-                               </span>
-                       </td>
-                       <td nowrap="nowrap" align="right">
-                       <?php if ( $this->showResults ) : ?>
-                               <a href="index.php?option=com_search&amp;search_results=0"><?php echo JText::_( 'Hide Search Results' ); ?></a>
-                       <?php else : ?>
-                               <a href="index.php?option=com_search&amp;search_results=1"><?php echo JText::_( 'Show Search Results' ); ?></a>
-                       <?php endif; ?>
-                       </td>
-               </tr>
-       </table>
-
-       <div id="tablecell">
-               <table class="adminlist">
-                       <thead>
-                               <tr>
-                                       <th width="10">
-                                               <?php echo JText::_( 'NUM' ); ?>
-                                       </th>
-                                       <th class="title">
-                                               <?php echo JHTML::_('grid.sort',   'Search Text', 'search_term', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
-                                       </th>
-                                       <th nowrap="nowrap" width="20%">
-                                               <?php echo JHTML::_('grid.sort',   'Times Requested', 'hits', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
-                                       </th>
-                                       <?php
-                                       if ( $this->showResults ) : ?>
-                                               <th nowrap="nowrap" width="20%">
-                                                       <?php echo JText::_( 'Results Returned' ); ?>
-                                               </th>
-                                       <?php endif; ?>
-                               </tr>
-                       </thead>
-                       <tfoot>
-                               <tr>
-                                       <td colspan="4">
-                                               <?php echo $this->pageNav->getListFooter(); ?>
-                                       </td>
-                               </tr>
-                       </tfoot>
-                       <tbody>
-                       <?php
-                       $k = 0;
-                       for ($i=0, $n = count($this->items); $i < $n; $i++) {
-                               $row =& $this->items[$i];
-                               ?>
-                               <tr class="row<?php echo $k;?>">
-                                       <td align="right">
-                                               <?php echo $i+1+$this->pageNav->limitstart; ?>
-                                       </td>
-                                       <td>
-                                               <?php echo htmlspecialchars($row->search_term, ENT_QUOTES, 'UTF-8'); ?>
-                                       </td>
-                                       <td align="center">
-                                               <?php echo $row->hits; ?>
-                                       </td>
-                                       <?php if ( $this->showResults ) : ?>
-                                       <td align="center">
-                                               <?php echo $row->returns; ?>
-                                       </td>
-                                       <?php endif; ?>
-                               </tr>
-                               <?php
-                               $k = 1 - $k;
-                       }
-                       ?>
-                       </tbody>
-               </table>
-       </div>
-
-       <input type="hidden" name="option" value="com_mnogosearch" />
-       <input type="hidden" name="task" value="" />
-       <input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
-       <input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
-</form>
diff --git a/com_mnogosearch/admin/views/mnogosearch/tmpl/index.html b/com_mnogosearch/admin/views/mnogosearch/tmpl/index.html
deleted file mode 100644 (file)
index fa6d84e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_mnogosearch/admin/views/mnogosearch/view.php b/com_mnogosearch/admin/views/mnogosearch/view.php
deleted file mode 100644 (file)
index 223b68b..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-/**
-* @version             $Id: mod_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
-* @package             com_mnoGoSearch
-* @copyright   Copyright (C) 2009 Andrea Zagli. All rights reserved.
-* @license             GNU/GPL, see LICENSE.php
-* com_mnoGoSearch is free software. This version may have been modified pursuant
-* to the GNU General Public License, and as distributed it includes or
-* is derivative of works licensed under the GNU General Public License or
-* other free or open source software licenses.
-* See COPYRIGHT.php for copyright notices and details.
-*/
-
-// no direct access
-defined( '_JEXEC' ) or die( 'Restricted access' );
-
-jimport('joomla.application.component.view');
-
-/**
- * @package            Joomla
- * @subpackage Search
- * @since 1.5
- */
-class mnoGoSearchViewSearch extends JView
-{
-       function display($tpl=null)
-       {
-               global $mainframe;
-
-               JToolBarHelper::title( JText::_( 'Search Statistics' ), 'searchtext.png' );
-               JToolBarHelper::custom( 'reset', 'delete.png', 'delete_f2.png', 'Reset', false );
-               JToolBarHelper::preferences( 'com_mnogosearch', '150' );
-               JToolBarHelper::help( 'screen.stats.searches' );
-
-               $document = & JFactory::getDocument();
-               $document->setTitle(JText::_('Search Statistics'));
-
-               $limit          = $mainframe->getUserStateFromRequest( 'global.list.limit',     'limit', $mainframe->getCfg('list_limit'), 'int' );
-               $limitstart     = $mainframe->getUserStateFromRequest( 'com_mnogosearch.limitstart', 'limitstart', 0, 'int' );
-
-               $model = $this->getModel();
-               $items = $model->getItems();
-               $params = &JComponentHelper::getParams( 'com_mnogosearch' );
-               $enabled = $params->get('enabled');
-               JHTML::_('behavior.tooltip');
-               jimport('joomla.html.pagination');
-               $pageNav = new JPagination( count($items), $limitstart, $limit );
-
-               $showResults    = JRequest::getInt('search_results');
-
-               $search                 = $mainframe->getUserStateFromRequest( 'com_mnosearch.search', 'search', '', 'string' );
-
-               $this->assignRef('items',       $items);
-               $this->assignRef('enabled', $enabled);
-               $this->assignRef('pageNav', $pageNav);
-               $this->assignRef('search',      $search );
-               $this->assignRef('lists',       $model->lists );
-
-               $this->assignRef('showResults', $showResults);
-
-               parent::display($tpl);
-       }
-}
diff --git a/com_mnogosearch/mnogosearch.xml b/com_mnogosearch/mnogosearch.xml
deleted file mode 100644 (file)
index 02dfc84..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE install SYSTEM "http://dev.joomla.org/xml/1.5/component-install.dtd">\r
-<install type="component" version="1.5.0">\r
-       <name>JMnoGoSearch</name>\r
-       <author>Andrea Zagli</author>\r
-       <creationDate>December 2009</creationDate>\r
-       <copyright>Copyright (C) 2009 Andrea Zagli. All rights reserved.</copyright>\r
-       <license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL</license>\r
-       <authorEmail>azagli@libero.it</authorEmail>\r
-       <authorUrl>http://saetta.homelinux.org/</authorUrl>\r
-       <version>1.0.0</version>\r
-       <description>A component to display search results from mnoGoSearch (http://www.mnogosearch.org/) web search engine.</description>
-
-       <install>
-               <sql>
-                       <file charset="utf8" driver="mysql">sql/install.sql</file>
-               </sql>
-       </install>
-       <uninstall>
-               <sql>
-                       <file charset="utf8" driver="mysql">sql/uninstall.sql</file>
-               </sql>
-       </uninstall>
-
-       <files folder="site">
-               <filename></filename>
-       </files>
-
-       <administration>
-               <menu>JMnoGoSearch</menu>
-               <files folder="admin">
-                       <filename>admin.mnogosearch.php</filename>
-                       <filename>config.xml</filename>
-                       <filename>controller.php</filename>
-                       <filename>index.html</filename>
-                       <filename>helpers/index.html</filename>
-                       <filename>helpers/mnogosearch.php</filename>
-                       <filename>helpers/site.php</filename>
-                       <filename>models/index.html</filename>
-                       <filename>models/mnogosearch.php</filename>
-                       <filename>sql/index.html</filename>
-                       <filename>sql/indstall.sql</filename>
-                       <filename>sql/uninstall.sql</filename>
-                       <filename>helpers/index.html</filename>
-                       <filename>views/index.html</filename>
-                       <filename>views/mnogosearch/index.html</filename>
-                       <filename>views/mnogosearch/view.php</filename>
-                       <filename>views/mnogosearch/tmpl/index.html</filename>
-                       <filename>views/mnogosearch/tmpl/default.php</filename>
-               </files>
-       </administration>
-\r
-</install>
diff --git a/com_mnogosearch/site/controller.php b/com_mnogosearch/site/controller.php
deleted file mode 100644 (file)
index e2de408..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-/**
- * @version            $Id: com_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
- * @package            com_mnoGoSearch
- * @copyright  Copyright (C) 2009 Andrea Zagli. All rights reserved.
- * @license            GNU/GPL, see LICENSE.php
- * com_mnoGoSearch is free software. This version may have been modified pursuant
- * GNU General Public License, and as distributed it includes or is derivative
- * of works licensed under the GNU General Public License or other free or open
- * source software licenses. See COPYRIGHT.php for copyright notices and
- * details.
- */
-
-// Check to ensure this file is included in Joomla!
-defined('_JEXEC') or die( 'Restricted access' );
-
-jimport('joomla.application.component.controller');
-
-/**
- * Search Component Controller
- *
- * @package            mnoGoSearch
- * @subpackage mnoGoSearch
- * @since 1.5
- */
-class mnoGoSearchController extends JController
-{
-       /**
-        * Method to show the search view
-        *
-        * @access      public
-        * @since       1.5
-        */
-       function display()
-       {
-               JRequest::setVar('view','search'); // force it to be the polls view
-               parent::display();
-       }
-
-       function search()
-       {
-               // slashes cause errors, <> get stripped anyway later on. # causes problems.
-               $badchars = array('#','>','<','\\'); 
-               $searchword = trim(str_replace($badchars, '', JRequest::getString('searchword', null, 'post')));
-               // if searchword enclosed in double quotes, strip quotes and do exact match
-               if (substr($searchword,0,1) == '"' && substr($searchword, -1) == '"') { 
-                       $post['searchword'] = substr($searchword,1,-1);
-                       JRequest::setVar('searchphrase', 'exact');
-               }
-               else {
-                       $post['searchword'] = $searchword;
-               }
-               $post['ordering']       = JRequest::getWord('ordering', null, 'post');
-               $post['searchphrase']   = JRequest::getWord('searchphrase', 'all', 'post');
-               $post['limit']  = JRequest::getInt('limit', null, 'post');
-               if($post['limit'] === null) unset($post['limit']);
-
-               $areas = JRequest::getVar('areas', null, 'post', 'array');
-               if ($areas) {
-                       foreach($areas as $area)
-                       {
-                               $post['areas'][] = JFilterInput::clean($area, 'cmd');
-                       }
-               }
-               
-               // set Itemid id for links from menu
-               $menu = &JSite::getMenu();
-               $items  = $menu->getItems('link', 'index.php?option=com_mnogosearch&view=search');
-
-               if(isset($items[0])) {
-                       $post['Itemid'] = $items[0]->id;
-               } else if (JRequest::getInt('Itemid') > 0) { //use Itemid from requesting page only if there is no existing menu
-                       $post['Itemid'] = JRequest::getInt('Itemid');
-               } 
-               
-               unset($post['task']);
-               unset($post['submit']);
-
-               $uri = JURI::getInstance();
-               $uri->setQuery($post);
-               $uri->setVar('option', 'com_mnogosearch');
-
-
-               $this->setRedirect(JRoute::_('index.php'.$uri->toString(array('query', 'fragment')), false));
-       }
-}
diff --git a/com_mnogosearch/site/index.html b/com_mnogosearch/site/index.html
deleted file mode 100644 (file)
index fa6d84e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_mnogosearch/site/mnogosearch.php b/com_mnogosearch/site/mnogosearch.php
deleted file mode 100644 (file)
index d7541fb..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-/**
- * @version            $Id: com_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
- * @package            com_mnoGoSearch
- * @copyright  Copyright (C) 2009 Andrea Zagli. All rights reserved.
- * @license            GNU/GPL, see LICENSE.php
- * com_mnoGoSearch is free software. This version may have been modified pursuant
- * to the GNU General Public License, and as distributed it includes or
- * is derivative of works licensed under the GNU General Public License or
- * other free or open source software licenses.
- * See COPYRIGHT.php for copyright notices and details.
- */
-
-// no direct access
-defined( '_JEXEC' ) or die( 'Restricted access' );
-
-// Require the com_content helper library
-require_once (JPATH_COMPONENT.DS.'controller.php');
-
-// Create the controller
-$controller = new mnoGoSearchController( );
-
-// Perform the Request task
-$controller->execute(JRequest::getCmd('task'));
-
-// Redirect if set by the controller
-$controller->redirect();
diff --git a/com_mnogosearch/site/models/index.html b/com_mnogosearch/site/models/index.html
deleted file mode 100644 (file)
index fa6d84e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_mnogosearch/site/models/mnogosearch.php b/com_mnogosearch/site/models/mnogosearch.php
deleted file mode 100644 (file)
index a29b56e..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-<?php
-/**
- * @version            $Id: com_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
- * @package            com_mnoGoSearch
- * @copyright  Copyright (C) 2009 Andrea Zagli. All rights reserved.
- * @license            GNU/GPL, see LICENSE.php
- * com_mnoGoSearch is free software. This version may have been modified pursuant
- * GNU General Public License, and as distributed it includes or is derivative
- * of works licensed under the GNU General Public License or other free or open
- * source software licenses. See COPYRIGHT.php for copyright notices and
- * details.
- */
-
-// Check to ensure this file is included in Joomla!
-defined( '_JEXEC' ) or die( 'Restricted access' );
-
-jimport('joomla.application.component.model');
-
-/**
- * Search Component Search Model
- *
- * @package            Joomla
- * @subpackage Search
- * @since 1.5
- */
-class mnoGoSearchModelSearch extends JModel
-{
-       /**
-        * Sezrch data array
-        *
-        * @var array
-        */
-       var $_data = null;
-
-       /**
-        * Search total
-        *
-        * @var integer
-        */
-       var $_total = null;
-
-       /**
-        * Search areas
-        *
-        * @var integer
-        */
-       var $_areas = null;
-
-       /**
-        * Pagination object
-        *
-        * @var object
-        */
-       var $_pagination = null;
-
-       /**
-        * Constructor
-        *
-        * @since 1.5
-        */
-       function __construct()
-       {
-               parent::__construct();
-
-               global $mainframe;
-
-               //Get configuration
-               $config = JFactory::getConfig();
-
-               // Get the pagination request variables
-               $this->setState('limit', $mainframe->getUserStateFromRequest('com_mnogosearch.limit', 'limit', $config->getValue('config.list_limit'), 'int'));
-               $this->setState('limitstart', JRequest::getVar('limitstart', 0, '', 'int'));
-
-               // Set the search parameters
-               $keyword                = urldecode(JRequest::getString('searchword'));
-               $match                  = JRequest::getWord('searchphrase', 'all');
-               $ordering               = JRequest::getWord('ordering', 'newest');
-               $this->setSearch($keyword, $match, $ordering);
-
-               //Set the search areas
-               $areas = JRequest::getVar('areas');
-               $this->setAreas($areas);
-       }
-
-       /**
-        * Method to set the search parameters
-        *
-        * @access      public
-        * @param string search string
-        * @param string mathcing option, exact|any|all
-        * @param string ordering option, newest|oldest|popular|alpha|category
-        */
-       function setSearch($keyword, $match = 'all', $ordering = 'newest')
-       {
-               if(isset($keyword)) {
-                       $this->setState('keyword', $keyword);
-               }
-
-               if(isset($match)) {
-                       $this->setState('match', $match);
-               }
-
-               if(isset($ordering)) {
-                       $this->setState('ordering', $ordering);
-               }
-       }
-
-       /**
-        * Method to set the search areas
-        *
-        * @access      public
-        * @param       array   Active areas
-        * @param       array   Search areas
-        */
-       function setAreas($active = array(), $search = array())
-       {
-               $this->_areas['active'] = $active;
-               $this->_areas['search'] = $search;
-       }
-
-       /**
-        * Method to get weblink item data for the category
-        *
-        * @access public
-        * @return array
-        */
-       function getData()
-       {
-               // Lets load the content if it doesn't already exist
-               if (empty($this->_data))
-               {
-                       $areas = $this->getAreas();
-
-                       JPluginHelper::importPlugin( 'search');
-                       $dispatcher =& JDispatcher::getInstance();
-                       $results = $dispatcher->trigger( 'onSearch', array(
-                       $this->getState('keyword'),
-                       $this->getState('match'),
-                       $this->getState('ordering'),
-                       $areas['active']) );
-
-                       $rows = array();
-                       foreach($results AS $result) {
-                               $rows = array_merge( (array) $rows, (array) $result);
-                       }
-
-                       $this->_total   = count($rows);
-                       if($this->getState('limit') > 0) {
-                               $this->_data    = array_splice($rows, $this->getState('limitstart'), $this->getState('limit'));
-                       } else {
-                               $this->_data = $rows;
-                       }
-               }
-
-               return $this->_data;
-       }
-
-       /**
-        * Method to get the total number of weblink items for the category
-        *
-        * @access public
-        * @return integer
-        */
-       function getTotal()
-       {
-               return $this->_total;
-       }
-
-       /**
-        * Method to get a pagination object of the weblink items for the category
-        *
-        * @access public
-        * @return integer
-        */
-       function getPagination()
-       {
-               // Lets load the content if it doesn't already exist
-               if (empty($this->_pagination))
-               {
-                       jimport('joomla.html.pagination');
-                       $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') );
-               }
-
-               return $this->_pagination;
-       }
-
-       /**
-        * Method to get the search areas
-        *
-        * @since 1.5
-        */
-       function getAreas()
-       {
-               global $mainframe;
-
-               // Load the Category data
-               if (empty($this->_areas['search']))
-               {
-                       $areas = array();
-
-                       JPluginHelper::importPlugin( 'search');
-                       $dispatcher =& JDispatcher::getInstance();
-                       $searchareas = $dispatcher->trigger( 'onSearchAreas' );
-
-                       foreach ($searchareas as $area) {
-                               $areas = array_merge( $areas, $area );
-                       }
-
-                       $this->_areas['search'] = $areas;
-               }
-
-               return $this->_areas;
-       }
-}
diff --git a/com_mnogosearch/site/router.php b/com_mnogosearch/site/router.php
deleted file mode 100644 (file)
index aed9b53..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- * @version            $Id: router.php 11002 2008-10-07 01:12:20Z ian $
- * @package            Joomla
- * @copyright  Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
- * @license            GNU/GPL, see LICENSE.php
- * Joomla! is free software. This version may have been modified pursuant
- * to the GNU General Public License, and as distributed it includes or
- * is derivative of works licensed under the GNU General Public License or
- * other free or open source software licenses.
- * See COPYRIGHT.php for copyright notices and details.
- */
-
-/**
- * @param      array
- * @return     array
- */
-function SearchBuildRoute( &$query )
-{
-       $segments = array();
-
-       if (isset($query['searchword'])) {
-               $segments[] = $query['searchword'];
-               unset($query['searchword']);
-       }
-
-       // Retrieve configuration options - needed to know which SEF URLs are used
-       $app =& JFactory::getApplication();
-       // Allows for searching on strings that include ".xxx" that appear to Apache as an extension
-       if (($app->getCfg('sef')) && ($app->getCfg('sef_rewrite')) && !($app->getCfg('sef_suffix'))) {
-               $segments[] .= '/';
-       }
-
-       if (isset($query['view'])) {
-               unset($query['view']);
-       }
-       return $segments;
-}
-
-/**
- * @param      array
- * @return     array
- */
-function SearchParseRoute( $segments )
-{
-       $vars = array();
-
-       $searchword     = array_shift($segments);
-       $vars['searchword'] = $searchword;
-       $vars['view'] = 'search';
-
-       return $vars;
-}
\ No newline at end of file
diff --git a/com_mnogosearch/site/views/index.html b/com_mnogosearch/site/views/index.html
deleted file mode 100644 (file)
index fa6d84e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_mnogosearch/site/views/search/index.html b/com_mnogosearch/site/views/search/index.html
deleted file mode 100644 (file)
index fa6d84e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_mnogosearch/site/views/search/metadata.xml b/com_mnogosearch/site/views/search/metadata.xml
deleted file mode 100644 (file)
index 1d0748d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<metadata>\r
-       <view title="Search">\r
-               <message><![CDATA[TYPESEARCHDESC]]></message>\r
-       </view>\r
-</metadata>
\ No newline at end of file
diff --git a/com_mnogosearch/site/views/search/tmpl/default.php b/com_mnogosearch/site/views/search/tmpl/default.php
deleted file mode 100644 (file)
index 94f3b1b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php defined('_JEXEC') or die('Restricted access'); ?>
-
-<?php if ( $this->params->get( 'show_page_title', 1 ) ) : ?>
-<div class="componentheading<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
-       <?php echo $this->params->get( 'page_title' ); ?>
-</div>
-<?php endif; ?>
-
-<?php echo $this->loadTemplate('form'); ?>
-<?php if(!$this->error && count($this->results) > 0) :
-       echo $this->loadTemplate('results');
-else :
-       echo $this->loadTemplate('error');
-endif; ?>
diff --git a/com_mnogosearch/site/views/search/tmpl/default.xml b/com_mnogosearch/site/views/search/tmpl/default.xml
deleted file mode 100644 (file)
index 372f1e2..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metadata>
-       <layout title="Search">
-               <message>
-                       <![CDATA[STANDARD SEARCH LAYOUT DESC]]>
-               </message>
-       </layout>
-       <state>
-               <name>Search</name>
-               <description>STANDARD SEARCH LAYOUT DESC</description>
-               <params>
-                       <param name="search_areas" type="radio" default="1" label="Use Search Areas" description="Show the search areas checkboxes">
-                               <option value="0">No</option>
-                               <option value="1">Yes</option>
-                       </param>
-                       <param name="show_date" type="radio" default="1" label="Show Created Date" description="TIPIFSETTOSHOWDATETIMECREATED">
-                               <option value="0">Hide</option>
-                               <option value="1">Show</option>
-                       </param>
-               </params>
-       </state>
-</metadata>
\ No newline at end of file
diff --git a/com_mnogosearch/site/views/search/tmpl/default_error.php b/com_mnogosearch/site/views/search/tmpl/default_error.php
deleted file mode 100644 (file)
index 3f9cd4c..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php defined('_JEXEC') or die('Restricted access'); ?>
-
-<table class="searchintro<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
-       <tr>
-               <td colspan="3" >
-                       <?php echo $this->escape($this->error); ?>
-               </td>
-       </tr>
-</table>
diff --git a/com_mnogosearch/site/views/search/tmpl/default_form.php b/com_mnogosearch/site/views/search/tmpl/default_form.php
deleted file mode 100644 (file)
index 9659ede..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php defined('_JEXEC') or die('Restricted access'); ?>
-
-<form id="searchForm" action="<?php echo JRoute::_( 'index.php?option=com_mnogosearch' );?>" method="post" name="searchForm">
-       <table class="contentpaneopen<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
-               <tr>
-                       <td nowrap="nowrap">
-                               <label for="search_searchword">
-                                       <?php echo JText::_( 'Search Keyword' ); ?>:
-                               </label>
-                       </td>
-                       <td nowrap="nowrap">
-                               <input type="text" name="searchword" id="search_searchword" size="30" maxlength="20" value="<?php echo $this->escape($this->searchword); ?>" class="inputbox" />
-                       </td>
-                       <td width="100%" nowrap="nowrap">
-                               <button name="Search" onclick="this.form.submit()" class="button"><?php echo JText::_( 'Search' );?></button>
-                       </td>
-               </tr>
-               <tr>
-                       <td colspan="3">
-                               <?php echo $this->lists['searchphrase']; ?>
-                       </td>
-               </tr>
-               <tr>
-                       <td colspan="3">
-                               <label for="ordering">
-                                       <?php echo JText::_( 'Ordering' );?>:
-                               </label>
-                               <?php echo $this->lists['ordering'];?>
-                       </td>
-               </tr>
-       </table>
-       <?php if ($this->params->get( 'search_areas', 1 )) : ?>
-               <?php echo JText::_( 'Search Only' );?>:
-               <?php foreach ($this->searchareas['search'] as $val => $txt) :
-                       $checked = is_array( $this->searchareas['active'] ) && in_array( $val, $this->searchareas['active'] ) ? 'checked="checked"' : '';
-               ?>
-               <input type="checkbox" name="areas[]" value="<?php echo $val;?>" id="area_<?php echo $val;?>" <?php echo $checked;?> />
-                       <label for="area_<?php echo $val;?>">
-                               <?php echo JText::_($txt); ?>
-                       </label>
-               <?php endforeach; ?>
-       <?php endif; ?>
-
-
-       <table class="searchintro<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
-       <tr>
-               <td colspan="3" >
-                       <br />
-                       <?php echo JText::_( 'Search Keyword' ) .' <b>'. $this->escape($this->searchword) .'</b>'; ?>
-               </td>
-       </tr>
-       <tr>
-               <td>
-                       <br />
-                       <?php echo $this->result; ?>
-               </td>
-       </tr>
-</table>
-
-<br />
-<?php if($this->total > 0) : ?>
-<div align="center">
-       <div style="float: right;">
-               <label for="limit">
-                       <?php echo JText::_( 'Display Num' ); ?>
-               </label>
-               <?php echo $this->pagination->getLimitBox( ); ?>
-       </div>
-       <div>
-               <?php echo $this->pagination->getPagesCounter(); ?>
-       </div>
-</div>
-<?php endif; ?>
-
-<input type="hidden" name="task"   value="search" />
-</form>
diff --git a/com_mnogosearch/site/views/search/tmpl/default_results.php b/com_mnogosearch/site/views/search/tmpl/default_results.php
deleted file mode 100644 (file)
index 7c9635c..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php defined('_JEXEC') or die('Restricted access'); ?>
-
-<table class="contentpaneopen<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
-       <tr>
-               <td>
-               <?php
-               foreach( $this->results as $result ) : ?>
-                       <fieldset>
-                               <div>
-                                       <span class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
-                                               <?php echo $this->pagination->limitstart + $result->count.'. ';?>
-                                       </span>
-                                       <?php if ( $result->href ) :
-                                               if ($result->browsernav == 1 ) : ?>
-                                                       <a href="<?php echo JRoute::_($result->href); ?>" target="_blank">
-                                               <?php else : ?>
-                                                       <a href="<?php echo JRoute::_($result->href); ?>">
-                                               <?php endif;
-
-                                               echo $this->escape($result->title);
-
-                                               if ( $result->href ) : ?>
-                                                       </a>
-                                               <?php endif;
-                                               if ( $result->section ) : ?>
-                                                       <br />
-                                                       <span class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
-                                                               (<?php echo $this->escape($result->section); ?>)
-                                                       </span>
-                                               <?php endif; ?>
-                                       <?php endif; ?>
-                               </div>
-                               <div>
-                                       <?php echo $result->text; ?>
-                               </div>
-                               <?php
-                                       if ( $this->params->get( 'show_date' )) : ?>
-                               <div class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
-                                       <?php echo $result->created; ?>
-                               </div>
-                               <?php endif; ?>
-                       </fieldset>
-               <?php endforeach; ?>
-               </td>
-       </tr>
-       <tr>
-               <td colspan="3">
-                       <div align="center">
-                               <?php echo $this->pagination->getPagesLinks( ); ?>
-                       </div>
-               </td>
-       </tr>
-</table>
diff --git a/com_mnogosearch/site/views/search/tmpl/index.html b/com_mnogosearch/site/views/search/tmpl/index.html
deleted file mode 100644 (file)
index fa6d84e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/com_mnogosearch/site/views/search/view.html.php b/com_mnogosearch/site/views/search/view.html.php
deleted file mode 100644 (file)
index cb721c6..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-<?php
-/**
- * @version            $Id: com_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
- * @package            com_mnoGoSearch
- * @copyright  Copyright (C) 2009 Andrea Zagli. All rights reserved.
- * @license            GNU/GPL, see LICENSE.php
- * com_mnoGoSearch is free software. This version may have been modified pursuant
- * to the GNU General Public License, and as distributed it includes or
- * is derivative of works licensed under the GNU General Public License or
- * other free or open source software licenses.
- * See COPYRIGHT.php for copyright notices and details.
- */
-
-// Check to ensure this file is included in Joomla!
-defined('_JEXEC') or die( 'Restricted access' );
-
-jimport( 'joomla.application.component.view');
-
-/**
- * HTML View class for the WebLinks component
- *
- * @static
- * @package            Joomla
- * @subpackage Weblinks
- * @since 1.0
- */
-class mnoGoSearchViewSearch extends JView
-{
-       function display($tpl = null)
-       {
-               global $mainframe;
-
-               require_once(JPATH_COMPONENT_ADMINISTRATOR.DS.'helpers'.DS.'mnogosearch.php' );
-
-               // Initialize some variables
-               $pathway  =& $mainframe->getPathway();
-               $uri      =& JFactory::getURI();
-
-               $error  = '';
-               $rows   = null;
-               $total  = 0;
-
-               // Get some data from the model
-               $areas      = &$this->get('areas');
-               $state          = &$this->get('state');
-               $searchword = $state->get('keyword');
-
-               $params = &$mainframe->getParams();
-
-               $menus  = &JSite::getMenu();
-               $menu   = $menus->getActive();
-
-               // because the application sets a default page title, we need to get it
-               // right from the menu item itself
-               if (is_object( $menu )) {
-                       $menu_params = new JParameter( $menu->params );
-                       if (!$menu_params->get( 'page_title')) {
-                               $params->set('page_title',      JText::_( 'Search' ));
-                       }
-               } else {
-                       $params->set('page_title',      JText::_( 'Search' ));
-               }
-
-               $document       = &JFactory::getDocument();
-               $document->setTitle( $params->get( 'page_title' ) );
-
-               // Get the parameters of the active menu item
-               $params = &$mainframe->getParams();
-
-               // built select lists
-               $orders = array();
-               $orders[] = JHTML::_('select.option',  'newest', JText::_( 'Newest first' ) );
-               $orders[] = JHTML::_('select.option',  'oldest', JText::_( 'Oldest first' ) );
-               $orders[] = JHTML::_('select.option',  'popular', JText::_( 'Most popular' ) );
-               $orders[] = JHTML::_('select.option',  'alpha', JText::_( 'Alphabetical' ) );
-               $orders[] = JHTML::_('select.option',  'category', JText::_( 'Section/Category' ) );
-
-               $lists = array();
-               $lists['ordering'] = JHTML::_('select.genericlist',   $orders, 'ordering', 'class="inputbox"', 'value', 'text', $state->get('ordering') );
-
-               $searchphrases          = array();
-               $searchphrases[]        = JHTML::_('select.option',  'all', JText::_( 'All words' ) );
-               $searchphrases[]        = JHTML::_('select.option',  'any', JText::_( 'Any words' ) );
-               $searchphrases[]        = JHTML::_('select.option',  'exact', JText::_( 'Exact phrase' ) );
-               $lists['searchphrase' ]= JHTML::_('select.radiolist',  $searchphrases, 'searchphrase', '', 'value', 'text', $state->get('match') );
-
-               // log the search
-               SearchHelper::logSearch( $searchword);
-
-               //limit searchword
-
-               if(SearchHelper::limitSearchWord($searchword)) {
-                       $error = JText::_( 'SEARCH_MESSAGE' );
-               }
-
-               //sanatise searchword
-               if(SearchHelper::santiseSearchWord($searchword, $state->get('match'))) {
-                       $error = JText::_( 'IGNOREKEYWORD' );
-               }
-
-               if (!$searchword && count( JRequest::get('post') ) ) {
-                       //$error = JText::_( 'Enter a search keyword' );
-               }
-
-               // put the filtered results back into the model
-               // for next release, the checks should be done in the model perhaps...
-               $state->set('keyword', $searchword);
-
-               if(!$error)
-               {
-                       $results        = &$this->get('data' );
-                       $total          = &$this->get('total');
-                       $pagination     = &$this->get('pagination');
-
-                       require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
-
-                       for ($i=0; $i < count($results); $i++)
-                       {
-                               $row = &$results[$i]->text;
-
-                               if ($state->get('match') == 'exact')
-                               {
-                                       $searchwords = array($searchword);
-                                       $needle = $searchword;
-                               }
-                               else
-                               {
-                                       $searchwords = preg_split("/\s+/u", $searchword);
-                                       $needle = $searchwords[0];
-                               }
-
-                               $row = SearchHelper::prepareSearchContent( $row, 200, $needle );
-                               $searchwords = array_unique( $searchwords );
-                               $searchRegex = '#(';
-                               $x = 0;
-                               foreach ($searchwords as $k => $hlword)
-                               {
-                                       $searchRegex .= ($x == 0 ? '' : '|');
-                                       $searchRegex .= preg_quote($hlword, '#');
-                                       $x++;
-                               }
-                               $searchRegex .= ')#iu';
-
-                               $row = preg_replace($searchRegex, '<span class="highlight">\0</span>', $row );
-
-                               $result =& $results[$i];
-                           if ($result->created) {
-                                   $created = JHTML::Date ( $result->created );
-                           }
-                           else {
-                                   $created = '';
-                           }
-
-                           $result->created    = $created;
-                           $result->count              = $i + 1;
-                       }
-               }
-
-               $this->result   = JText::sprintf( 'TOTALRESULTSFOUND', $total );
-
-               $this->assignRef('pagination',  $pagination);
-               $this->assignRef('results',             $results);
-               $this->assignRef('lists',               $lists);
-               $this->assignRef('params',              $params);
-
-               $this->assign('ordering',               $state->get('ordering'));
-               $this->assign('searchword',             $searchword);
-               $this->assign('searchphrase',   $state->get('match'));
-               $this->assign('searchareas',    $areas);
-
-               $this->assign('total',                  $total);
-               $this->assign('error',                  $error);
-               $this->assign('action',             $uri->toString());
-
-               parent::display($tpl);
-       }
-}
diff --git a/mod_jmnogosearch/helper.php b/mod_jmnogosearch/helper.php
new file mode 100644 (file)
index 0000000..7a0c9f4
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+/**
+* @version             $Id: mod_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
+* @package             mod_mnoGoSearch
+* @copyright   Copyright (C) 2009 Andrea Zagli. All rights reserved.
+* @license             GNU/GPL, see LICENSE.php
+* mno_mnoGoSearch is free software. This version may have been modified pursuant
+* to the GNU General Public License, and as distributed it includes or
+* is derivative of works licensed under the GNU General Public License or
+* other free or open source software licenses.
+* See COPYRIGHT.php for copyright notices and details.
+*/
+
+// no direct access
+defined('_JEXEC') or die('Restricted access');
+
+class modMnoGoSearchHelper {
+    function getSearchImage($button_text) {
+           $img = JHTML::_('image.site', 'searchButton.gif', '/images/M_images/', NULL, NULL, $button_text, null, 0);
+               return $img;
+       }
+}
diff --git a/mod_jmnogosearch/index.html b/mod_jmnogosearch/index.html
new file mode 100644 (file)
index 0000000..fa6d84e
--- /dev/null
@@ -0,0 +1 @@
+<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/mod_jmnogosearch/mod_jmnogosearch.php b/mod_jmnogosearch/mod_jmnogosearch.php
new file mode 100644 (file)
index 0000000..d26d9b2
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+/**
+* @version             $Id: mod_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
+* @package             mod_mnoGoSearch
+* @copyright   Copyright (C) 2009 Andrea Zagli. All rights reserved.
+* @license             GNU/GPL, see LICENSE.php
+* mod_mnoGoSearch is free software. This version may have been modified pursuant
+* to the GNU General Public License, and as distributed it includes or
+* is derivative of works licensed under the GNU General Public License or
+* other free or open source software licenses.
+* See COPYRIGHT.php for copyright notices and details.
+*/
+
+// no direct access
+defined('_JEXEC') or die('Restricted access');
+
+// Include the syndicate functions only once
+require_once( dirname(__FILE__).DS.'helper.php' );
+
+$button                         = $params->get('button', '');
+$imagebutton    = $params->get('imagebutton', '');
+$button_pos             = $params->get('button_pos', 'left');
+$button_text    = $params->get('button_text', JText::_('Search'));
+$width                  = intval($params->get('width', 20));
+$maxlength              = $width > 20 ? $width : 20;
+$text                   = $params->get('text', JText::_('search...'));
+$set_Itemid             = intval($params->get('set_itemid', 0));
+$moduleclass_sfx = $params->get('moduleclass_sfx', '');
+
+if ($imagebutton) {
+    $img = modMnoGoSearchHelper::getSearchImage( $button_text );
+}
+$mitemid = $set_Itemid > 0 ? $set_Itemid : JRequest::getInt('Itemid');
+require(JModuleHelper::getLayoutPath('mod_mnogosearch'));
diff --git a/mod_jmnogosearch/mod_jmnogosearch.xml b/mod_jmnogosearch/mod_jmnogosearch.xml
new file mode 100644 (file)
index 0000000..560fe13
--- /dev/null
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<install type="module" version="1.5.0">
+
+       <name>JMnoGoSearch</name>
+       <author>Andrea Zagli</author>
+       <creationDate>December 2009</creationDate>
+       <copyright>Copyright (C) 2000 Andrea Zagli. All rights reserved.</copyright>
+       <license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL</license>
+       <authorEmail>azagli@libero.it</authorEmail>
+       <authorUrl>http://saetta.homelinux.org/</authorUrl>
+       <version>1.0.0</version>
+       <description>This module will display a search box that is linked with the mnoGoSearch web search engine.</description>
+
+       <files>
+               <filename>helper.php</filename>
+               <filename>index.html</filename>
+               <filename module="mod_jmnogosearch">mod_jmnogosearch.php</filename>
+               <filename>mod_jmnogosearch.xml</filename>
+               <filename>tmpl/index.html</filename>
+               <filename>tmpl/default.php</filename>
+       </files>
+
+       <params>
+               <param name="moduleclass_sfx" type="text" default="" label="Module Class Suffix" description="PARAMMODULECLASSSUFFIX" />
+               <param name="@spacer" type="spacer" default="" label="" description="" />
+               <param name="width" type="text" default="20" label="Box Width" description="Size of the search text box in characters" />
+               <param name="text" type="text" default="" label="Text" description="PARAMTEXT" />
+               <param name="@spacer" type="spacer" default="" label="" description="" />
+               <param name="button" type="radio" default="" label="Search Button" description="Display a Search Button">
+                       <option value="">No</option>
+                       <option value="1">Yes</option>
+               </param>
+               <param name="button_pos" type="list" default="right" label="Button Position" description="Position of the button relative to the search box">
+                       <option value="right">Right</option>
+                       <option value="left">Left</option>
+                       <option value="top">Top</option>
+                       <option value="bottom">Bottom</option>
+               </param>
+               <param name="imagebutton" type="radio" default="" label="Search button as image" description="Use an image as button">
+                       <option value="">No</option>
+                       <option value="1">Yes</option>
+               </param>
+               <param name="button_text" type="text" default="" label="Button Text" description="PARAMBUTTONTEXT" />
+               <param name="@spacer" type="spacer" default="" label="" description="" />
+               <param name="set_itemid" type="text" default="" label="Set Itemid" description="PARAMSETITEMID" />
+       </params>
+
+</install>
diff --git a/mod_jmnogosearch/tmpl/default.php b/mod_jmnogosearch/tmpl/default.php
new file mode 100644 (file)
index 0000000..12cc23a
--- /dev/null
@@ -0,0 +1,44 @@
+<?php // no direct access
+defined('_JEXEC') or die('Restricted access'); ?>
+<form action="index.php" method="post">
+       <div class="search<?php echo $params->get('moduleclass_sfx') ?>">
+               <?php
+                   $output = '<input name="searchword" id="mod_mnogosearch_searchword" maxlength="'.$maxlength.'" alt="'.$button_text.'" class="inputbox'.$moduleclass_sfx.'" type="text" size="'.$width.'" value="'.$text.'"  onblur="if(this.value==\'\') this.value=\''.$text.'\';" onfocus="if(this.value==\''.$text.'\') this.value=\'\';" />';
+
+                       if ($button) :
+                           if ($imagebutton) :
+                               $button = '<input type="image" value="'.$button_text.'" class="button'.$moduleclass_sfx.'" src="'.$img.'" onclick="this.form.searchword.focus();"/>';
+                           else :
+                               $button = '<input type="submit" value="'.$button_text.'" class="button'.$moduleclass_sfx.'" onclick="this.form.searchword.focus();"/>';
+                           endif;
+                       endif;
+
+                       switch ($button_pos) :
+                           case 'top' :
+                                   $button = $button.'<br />';
+                                   $output = $button.$output;
+                                   break;
+
+                           case 'bottom' :
+                                   $button = '<br />'.$button;
+                                   $output = $output.$button;
+                                   break;
+
+                           case 'right' :
+                                   $output = $output.$button;
+                                   break;
+
+                           case 'left' :
+                           default :
+                                   $output = $button.$output;
+                                   break;
+                       endswitch;
+
+                       echo $output;
+               ?>
+
+       <input type="hidden" name="task"   value="search" />
+       <input type="hidden" name="option" value="com_mnogosearch" />
+       <input type="hidden" name="Itemid" value=<?php echo $mitemid; ?> />
+       </div>
+</form>
diff --git a/mod_jmnogosearch/tmpl/index.html b/mod_jmnogosearch/tmpl/index.html
new file mode 100644 (file)
index 0000000..fa6d84e
--- /dev/null
@@ -0,0 +1 @@
+<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/mod_mnogosearch/helper.php b/mod_mnogosearch/helper.php
deleted file mode 100644 (file)
index 7a0c9f4..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-/**
-* @version             $Id: mod_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
-* @package             mod_mnoGoSearch
-* @copyright   Copyright (C) 2009 Andrea Zagli. All rights reserved.
-* @license             GNU/GPL, see LICENSE.php
-* mno_mnoGoSearch is free software. This version may have been modified pursuant
-* to the GNU General Public License, and as distributed it includes or
-* is derivative of works licensed under the GNU General Public License or
-* other free or open source software licenses.
-* See COPYRIGHT.php for copyright notices and details.
-*/
-
-// no direct access
-defined('_JEXEC') or die('Restricted access');
-
-class modMnoGoSearchHelper {
-    function getSearchImage($button_text) {
-           $img = JHTML::_('image.site', 'searchButton.gif', '/images/M_images/', NULL, NULL, $button_text, null, 0);
-               return $img;
-       }
-}
diff --git a/mod_mnogosearch/index.html b/mod_mnogosearch/index.html
deleted file mode 100644 (file)
index fa6d84e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
diff --git a/mod_mnogosearch/mod_mnogosearch.php b/mod_mnogosearch/mod_mnogosearch.php
deleted file mode 100644 (file)
index d26d9b2..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-/**
-* @version             $Id: mod_mnogosearch.php 1 2009-12-12 02:15:55Z andreaz $
-* @package             mod_mnoGoSearch
-* @copyright   Copyright (C) 2009 Andrea Zagli. All rights reserved.
-* @license             GNU/GPL, see LICENSE.php
-* mod_mnoGoSearch is free software. This version may have been modified pursuant
-* to the GNU General Public License, and as distributed it includes or
-* is derivative of works licensed under the GNU General Public License or
-* other free or open source software licenses.
-* See COPYRIGHT.php for copyright notices and details.
-*/
-
-// no direct access
-defined('_JEXEC') or die('Restricted access');
-
-// Include the syndicate functions only once
-require_once( dirname(__FILE__).DS.'helper.php' );
-
-$button                         = $params->get('button', '');
-$imagebutton    = $params->get('imagebutton', '');
-$button_pos             = $params->get('button_pos', 'left');
-$button_text    = $params->get('button_text', JText::_('Search'));
-$width                  = intval($params->get('width', 20));
-$maxlength              = $width > 20 ? $width : 20;
-$text                   = $params->get('text', JText::_('search...'));
-$set_Itemid             = intval($params->get('set_itemid', 0));
-$moduleclass_sfx = $params->get('moduleclass_sfx', '');
-
-if ($imagebutton) {
-    $img = modMnoGoSearchHelper::getSearchImage( $button_text );
-}
-$mitemid = $set_Itemid > 0 ? $set_Itemid : JRequest::getInt('Itemid');
-require(JModuleHelper::getLayoutPath('mod_mnogosearch'));
diff --git a/mod_mnogosearch/mod_mnogosearch.xml b/mod_mnogosearch/mod_mnogosearch.xml
deleted file mode 100644 (file)
index a12795b..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<install type="module" version="1.5.0">
-
-       <name>mnoGoSearch</name>
-       <author>Andrea Zagli</author>
-       <creationDate>December 2009</creationDate>
-       <copyright>Copyright (C) 2000 Andrea Zagli. All rights reserved.</copyright>
-       <license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL</license>
-       <authorEmail>azagli@libero.it</authorEmail>
-       <authorUrl>http://saetta.homelinux.org/</authorUrl>
-       <version>1.0.0</version>
-       <description>This module will display a search box that is linked with the mnoGoSearch web search engine.</description>
-
-       <files>
-               <filename>helper.php</filename>
-               <filename>index.html</filename>
-               <filename module="mod_mnogosearch">mod_mnogosearch.php</filename>
-               <filename>mod_mnogosearch.xml</filename>
-               <filename>tmpl/index.html</filename>
-               <filename>tmpl/default.php</filename>
-       </files>
-
-       <params>
-               <param name="moduleclass_sfx" type="text" default="" label="Module Class Suffix" description="PARAMMODULECLASSSUFFIX" />
-               <param name="@spacer" type="spacer" default="" label="" description="" />
-               <param name="width" type="text" default="20" label="Box Width" description="Size of the search text box in characters" />
-               <param name="text" type="text" default="" label="Text" description="PARAMTEXT" />
-               <param name="@spacer" type="spacer" default="" label="" description="" />
-               <param name="button" type="radio" default="" label="Search Button" description="Display a Search Button">
-                       <option value="">No</option>
-                       <option value="1">Yes</option>
-               </param>
-               <param name="button_pos" type="list" default="right" label="Button Position" description="Position of the button relative to the search box">
-                       <option value="right">Right</option>
-                       <option value="left">Left</option>
-                       <option value="top">Top</option>
-                       <option value="bottom">Bottom</option>
-               </param>
-               <param name="imagebutton" type="radio" default="" label="Search button as image" description="Use an image as button">
-                       <option value="">No</option>
-                       <option value="1">Yes</option>
-               </param>
-               <param name="button_text" type="text" default="" label="Button Text" description="PARAMBUTTONTEXT" />
-               <param name="@spacer" type="spacer" default="" label="" description="" />
-               <param name="set_itemid" type="text" default="" label="Set Itemid" description="PARAMSETITEMID" />
-       </params>
-
-</install>
diff --git a/mod_mnogosearch/tmpl/default.php b/mod_mnogosearch/tmpl/default.php
deleted file mode 100644 (file)
index 12cc23a..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php // no direct access
-defined('_JEXEC') or die('Restricted access'); ?>
-<form action="index.php" method="post">
-       <div class="search<?php echo $params->get('moduleclass_sfx') ?>">
-               <?php
-                   $output = '<input name="searchword" id="mod_mnogosearch_searchword" maxlength="'.$maxlength.'" alt="'.$button_text.'" class="inputbox'.$moduleclass_sfx.'" type="text" size="'.$width.'" value="'.$text.'"  onblur="if(this.value==\'\') this.value=\''.$text.'\';" onfocus="if(this.value==\''.$text.'\') this.value=\'\';" />';
-
-                       if ($button) :
-                           if ($imagebutton) :
-                               $button = '<input type="image" value="'.$button_text.'" class="button'.$moduleclass_sfx.'" src="'.$img.'" onclick="this.form.searchword.focus();"/>';
-                           else :
-                               $button = '<input type="submit" value="'.$button_text.'" class="button'.$moduleclass_sfx.'" onclick="this.form.searchword.focus();"/>';
-                           endif;
-                       endif;
-
-                       switch ($button_pos) :
-                           case 'top' :
-                                   $button = $button.'<br />';
-                                   $output = $button.$output;
-                                   break;
-
-                           case 'bottom' :
-                                   $button = '<br />'.$button;
-                                   $output = $output.$button;
-                                   break;
-
-                           case 'right' :
-                                   $output = $output.$button;
-                                   break;
-
-                           case 'left' :
-                           default :
-                                   $output = $button.$output;
-                                   break;
-                       endswitch;
-
-                       echo $output;
-               ?>
-
-       <input type="hidden" name="task"   value="search" />
-       <input type="hidden" name="option" value="com_mnogosearch" />
-       <input type="hidden" name="Itemid" value=<?php echo $mitemid; ?> />
-       </div>
-</form>
diff --git a/mod_mnogosearch/tmpl/index.html b/mod_mnogosearch/tmpl/index.html
deleted file mode 100644 (file)
index fa6d84e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file