From: <ma...@us...> - 2012-12-16 20:10:17
|
Revision: 10420 http://sourceforge.net/p/xoops/svn/10420 Author: mageg Date: 2012-12-16 20:10:15 +0000 (Sun, 16 Dec 2012) Log Message: ----------- change search to use search module. Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/xoops_version.php Added Paths: ----------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/search.php Removed Paths: ------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/include/search.php Copied: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/index.html (from rev 10417, XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/index.html) =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/index.html (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/index.html 2012-12-16 20:10:15 UTC (rev 10420) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/search.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/search.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/search.php 2012-12-16 20:10:15 UTC (rev 10420) @@ -0,0 +1,62 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/** + * XXX + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @since 2.6.0 + * @author Mage Grégory (AKA Mage) + * @version $Id: $ + */ + +defined("XOOPS_ROOT_PATH") or die("XOOPS root path not defined"); + +class PageSearchPlugin extends Xoops_Plugin_Abstract implements SearchPluginInterface +{ + public function search($queries, $andor, $limit, $start, $uid) + { + $xoops = Xoops::getInstance(); + $sql = "SELECT content_id, content_title, content_shorttext, content_text, content_author, content_create FROM " . $xoops->db()->prefix("page_content") . " WHERE content_status != 0"; + + if ( $uid != 0 ) { + $sql .= " AND content_author=" . intval($uid); + } + + if ( is_array($queries) && $count = count($queries) ) + { + $sql .= " AND ((content_title LIKE '%$queries[0]%' OR content_text LIKE '%$queries[0]%' OR content_shorttext LIKE '%$queries[0]%')"; + + for ($i=1; $i < $count; $i++) { + $sql .= " $andor "; + $sql .= "(content_title LIKE '%$queries[$i]%' OR content_text LIKE '%$queries[$i]%' OR content_shorttext LIKE '%$queries[$i]%')"; + } + $sql .= ")"; + } + $sql .= " ORDER BY content_create DESC"; + $result = $xoops->db()->queryF($sql, $limit, $start); + + $ret = array(); + $i = 0; + while($myrow = $xoops->db()->fetchArray($result)) { + $ret[$i]["image"] = "images/logo_small.png"; + $ret[$i]["link"] = "viewpage.php?id=" . $myrow["content_id"]; + $ret[$i]["title"] = $myrow["content_title"]; + $ret[$i]["time"] = $myrow["content_create"]; + $ret[$i]["content"] = $myrow["content_text"] . $myrow["content_shorttext"]; + $ret[$i]["uid"] = $myrow["content_author"]; + $i++; + } + return $ret; + return $res; + } +} \ No newline at end of file Deleted: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/include/search.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/include/search.php 2012-12-16 19:57:47 UTC (rev 10419) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/include/search.php 2012-12-16 20:10:15 UTC (rev 10420) @@ -1,57 +0,0 @@ -<?php -/* - You may not change or alter any portion of this comment or credits - of supporting developers from this source code or any supporting source code - which is considered copyrighted (c) material of the original comment or credit authors. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -*/ - -/** - * page module - * - * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) - * @package page - * @since 2.6.0 - * @author Mage Gr\xE9gory (AKA Mage) - * @version $Id$ - */ - -function page_search($queryarray, $andor, $limit, $offset, $userid) -{ - $xoops = Xoops::getInstance(); - $sql = "SELECT content_id, content_title, content_shorttext, content_text, content_author, content_create FROM " . $xoops->db()->prefix("page_content") . " WHERE content_status != 0"; - - if ( $userid != 0 ) { - $sql .= " AND content_author=" . intval($userid); - } - - if ( is_array($queryarray) && $count = count($queryarray) ) - { - $sql .= " AND ((content_title LIKE '%$queryarray[0]%' OR content_text LIKE '%$queryarray[0]%' OR content_shorttext LIKE '%$queryarray[0]%')"; - - for ($i=1; $i < $count; $i++) { - $sql .= " $andor "; - $sql .= "(content_title LIKE '%$queryarray[$i]%' OR content_text LIKE '%$queryarray[$i]%' OR content_shorttext LIKE '%$queryarray[$i]%')"; - } - $sql .= ")"; - } - $sql .= " ORDER BY content_create DESC"; - $result = $xoops->db()->queryF($sql, $limit, $offset); - - $ret = array(); - $i = 0; - while($myrow = $xoops->db()->fetchArray($result)) { - $ret[$i]["image"] = "images/logo_small.png"; - $ret[$i]["link"] = "viewpage.php?id=" . $myrow["content_id"]; - $ret[$i]["title"] = $myrow["content_title"]; - $ret[$i]["time"] = $myrow["content_create"]; - $ret[$i]["content"] = $myrow["content_text"] . $myrow["content_shorttext"]; - $ret[$i]["uid"] = $myrow["content_author"]; - $i++; - } - return $ret; -} \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/xoops_version.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/xoops_version.php 2012-12-16 19:57:47 UTC (rev 10419) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/xoops_version.php 2012-12-16 20:10:15 UTC (rev 10420) @@ -16,7 +16,7 @@ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package page * @since 2.6.0 - * @author Mage Gr\xE9gory (AKA Mage) + * @author Mage Gr�gory (AKA Mage) * @version $Id$ */ $modversion = array(); @@ -57,21 +57,16 @@ $modversion['hasAdmin'] = 1; $modversion['adminindex'] = 'admin/index.php'; $modversion['adminmenu'] = 'admin/menu.php'; - + // Scripts to run upon installation or update $modversion['onInstall'] = 'include/install.php'; // JQuery $modversion['jquery'] = 1; - -// Menu + +// Menu $modversion['hasMain'] = 1; -// Search -$modversion['hasSearch'] = 1; -$modversion['search']['file'] = 'include/search.php'; -$modversion['search']['func'] = 'page_search'; - // Mysql file $modversion['sqlfile']['mysql'] = "sql/mysql.sql"; @@ -84,6 +79,7 @@ $modversion['templates'][] = array( 'file' => 'page_index.html', 'description' => '' ); $modversion['templates'][] = array( 'file' => 'page_viewpage.html', 'description' => '' ); $modversion['templates'][] = array( 'file' => 'page_print.html', 'description' => '' ); +$modversion['templates'][] = array( 'file' => 'page_pdf.html', 'description' => '' ); // blocks $i = 0; @@ -93,7 +89,7 @@ $modversion['blocks'][$i]['show_func'] = 'page_blocks_show'; $modversion['blocks'][$i]['edit_func'] = 'page_blocks_edit'; $modversion['blocks'][$i]['options'] = 'random|5|19|0'; -$modversion['blocks'][$i]['template'] = 'page_blocks_random.html'; +$modversion['blocks'][$i]['template'] = 'page_blocks_random.html'; $i++; /*$modversion['blocks'][$i]['file'] = 'page_blocks.php'; $modversion['blocks'][$i]['name'] = _MI_PAGE_BLOCKS_ID; @@ -137,7 +133,6 @@ $modversion['config'][$i]['valuetype'] = 'text'; $modversion['config'][$i]['default'] = 'dhtmltextarea'; $modversion['config'][$i]['options'] = $editors; -$modversion['config'][$i]['category'] = 'global'; $i++; $modversion['config'][$i]['name'] = 'page_adminpager'; $modversion['config'][$i]['title'] = '_MI_PAGE_PREFERENCE_ADMINPAGER'; |