Note: this list is kept only as a demonstration for CVSNotice. For the latest CVS notices, see the Xaraya and Postnuke sites
View Statistics - Next Notice - Previous NoticeDirectory filter : [ all ] / postnuke_modules / htmlpages / search [ view in CVS ]
| Date | Directory [filter] | File(s) [view] | Author [filter] |
| 24 Jul 2002 20:46:47 | postnuke_modules/htmlpages/search | htmlpages.php,NONE,1.1 | Andrea M. |
| search added | |||
Update of /home/cvsroot/postnuke_modules/htmlpages/search
In directory ns7.hostnuke.net:/tmp/cvs-serv11901/search
Added Files:
htmlpages.php
Log Message:
search added
--- NEW FILE: htmlpages.php ---
<?php // $Id: htmlpages.php,v 1.1 2002/07/24 20:46:45 andrea.m Exp $ $Name: $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the Post-Nuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Search Module
// ===========================
//
// Copyright (c) 2001 by Patrick Kellum (webmaster@ctarl-ctarl.com)
// http://www.ctarl-ctarl.com
//
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// 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. See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// adam_baum: faq.php based on Patrick Kellum's reviews.php search plugin
// purpose: search the faq database.
// Kevin McCann: adapting this for htmlpages module ...
//
$search_modules[] = array(
'title' => 'HTMLPAGES',
'func_search' => 'search_htmlpages',
'func_opt' => 'search_htmlpages_opt'
);
function search_htmlpages_opt() {
global
$bgcolor2,
$textcolor1;
$output = new pnHTML();
$output->SetInputMode(_PNH_VERBATIMINPUT);
// lousy language hack ....
define('_SEARCH_HTMLPAGES','Search HTML Pages');
if (pnSecAuthAction(0, 'htmlpages::', '::', ACCESS_READ)) {
$output->Text("<table border=\"0\" width=\"100%\"><tr bgcolor=\"$bgcolor2\"><td><font class=\"pn-normal\" style=\"text-color:$textcolor1\"><input type=\"checkbox\" name=\"active_htmlpages\" id=\"active_htmlpages\" value=\"1\" checked> <label for=\"active_htmlpages\">"._SEARCH_HTMLPAGES."</label></font></td></tr></table>");
}
return $output->GetOutput();
}
function search_htmlpages() {
list($q,
$bool,
$startnum,
$total,
$active_htmlpages) = pnVarCleanFromInput('q',
'bool',
'startnum',
'total',
'active_htmlpages');
if (empty($active_htmlpages)) {
return;
}
// lousy language hack ....
define('_HTMLPAGES','HTML Pages');
define('_SEARCH_NO_HTMLPAGES','HTML Pages: No results matched your search.');
$modname="htmlpages";
$directory="";
pnModDBInfoLoad($modname,$directory);
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$output = new pnHTML();
$output->SetInputMode(_PNH_VERBATIMINPUT);
if (!isset($startnum)) {
$startnum = 1;
}
$w = search_split_query($q);
$flag = false;
$column = &$pntable['htmlpages_column'];
$query = "SELECT $column[pid] as pid, $column[uid] as uid, $column[title] as title, $column[content] as content, $column[timest] as timest
FROM $pntable[htmlpages]
WHERE \n";
foreach($w as $word) {
if($flag) {
switch($bool) {
case 'AND' :
$query .= ' AND ';
break;
case 'OR' :
default :
$query .= ' OR ';
break;
}
}
$query .= '(';
// faqs
$query .= "$column[title] LIKE '$word' OR \n";
$query .= "$column[content] LIKE '$word'\n";
$query .= ')';
$flag = true;
}
$query .= " ORDER BY $column[pid]";
if (empty($total)) {
$countres = $dbconn->Execute($query);
$total = $countres->PO_RecordCount();
$countres->Close();
}
$result = $dbconn->SelectLimit($query, 10, $startnum-1);
if (!$result->EOF) {
$output->Text('<font class="pn-normal">'. _HTMLPAGES . ': ' . $total . ' ' . _SEARCHRESULTS . '</font>');
$url = "modules.php?op=modload&name=Search&file=index&action=search&active_htmlpages=1&bool=$bool&q=$q";
$output->Text("<ul>");
while(!$result->EOF) {
$row = $result->GetRowAssoc(false);
$output->Text("<li><a class=\"pn-normal\" href=\"index.php?module=htmlpages&func=display&pid=$row[pid]\">$row[title]</a></li>");
$result->MoveNext();
}
$output->Text('</ul>');
$output->Linebreak(4);
// Munge URL for template
$urltemplate = $url . "&startnum=%%&total=$total";
$output->Pager($startnum,
$total,
$urltemplate,
10);
} else {
$output->SetInputMode(_PNH_VERBATIMINPUT);
$output->Text('<font class="pn-normal">'._SEARCH_NO_HTMLPAGES.'</font>');
$output->SetInputMode(_PNH_PARSEINPUT);
}
$output->Linebreak();
return $output->GetOutput();
}
?>
View Statistics - Next Notice - Previous Notice
| Visit Developer Site - Browse CVS Repository |
Syndicate via backend.rss (max. once per hour please) | Powered by CVSNotice 0.1.3 |