Location: PHPKode > projects > ProNuke. Postnuke To Oracle > postnuke/html/includes/search/comments.php
<?php // $Id: comments.php,v 1.5 2001/12/04 00:50:23 gregorrothfuss Exp $ $Name:  $
/************************************************************************/
/* Post-Nuke: Content Management System                                 */
/* ====================================                                 */
/* Module: Search/comments plugin                                       */
/*                                                                      */
/* Copyright (c) 2001 by the Post Nuke development team                 */
/* http://www.postnuke.com                                              */
/************************************************************************/
/************************/
/* Modified version of: */
/************************************************************************/
/* Search Module                                                        */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2001 by Patrick Kellum (hide@address.com)     */
/* http://www.ctarl-ctarl.com                                           */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/************************************************************************/
/* Filename: modules/Search/users.php                                   */
/* Original Author: Patrick Kellum                                      */
/* Purpose: Search comments                                             */
/************************************************************************/

$search_modules[] = array(
    'title' => 'Comments',
    'func_search' => 'search_comments',
    'func_opt' => 'search_comments_opt'
);
function search_comments_opt($vars) {
    global
        $bgcolor1,
        $bgcolor2,
        $bgcolor3,
        $textcolor1,
        $textcolor2
    ;
    print "<table border=\"0\" width=\"100%\"><tr bgcolor=\"$bgcolor2\"><td><font class=\"pn-normal\" style=\"$text-color:$textcolor1\"><input type=\"checkbox\" name=\"active_comments\" id=\"active_comments\" value=\"1\" checked>&nbsp;"._SEARCH_COMMENTS."</font></td></tr></table>";
}
function search_comments($vars) {
    if(!$vars['active_comments']) {
        return;
    }
    global
        $bgcolor1,
        $bgcolor2,
        $bgcolor3,
        $bgcolor4,
        $textcolor1,
        $textcolor2,
        $pntable,
        $dbconn
    ;
    $w = search_split_query($vars[q]);
    $flag = false;
    $column = &$pntable['comments_column'];
    $query = "SELECT $column[subject] as subject, $column[tid] as tid, ";
    $query .= "$column[sid] as sid, $column[pid] as pid FROM $pntable[comments] WHERE ";
    foreach($w as $word) {
        if($flag) {
            switch($vars['bool']) {
                case 'AND' :
                    $query .= ' AND ';
                    break;
                case 'OR' :
                default :
                    $query .= ' OR ';
                    break;
            }
        }
        $query .= '(';
        $query .= "$column[subject] LIKE '$word' OR ";
        $query .= "$column[comment] LIKE '$word'";
        $query .= ')';
        $flag = true;
    }
    $query .= " ORDER BY $column[subject]";

    $result = $dbconn->Execute($query);

//FTO Record count not supported by Oracle
//    $total_rows = $result->PO_Record Count();

    if($vars['overview']) {
        $result->Close();
        $result = $dbconn->SelectLimit($query,3);
    }

//FTO changed because rec count
    $total_rows=0;
    if(!$result->EOF) {
        print "<font class=\"pn-normal\">"._COMMENTS.":</font>";

        $output="";
        while(!$result->EOF) {
            $total_rows++;
            $row = $result->GetRowAssoc(false);
            $output .= "<li><a class=\"pn-normal\" href=\"modules.php?op=modload&name=NS-Comments&file=index&req=showeply&tid=$row[tid]&sid=$row[sid]&pid=$row[pid]\">$row[subject]</a>"
                ."</li>\n"
            ;
            $result->MoveNext();
        }


        if($total_rows > 3 && $vars['overview']) {
            print " <a class=\"pn-normal\" href=\"modules.php?op=modload&amp;name=Search&amp;file=index&amp;action=search&amp;active_comments=1&amp;bool=$vars[bool]&amp;q=$vars[q]\">"._SEEALL." $total_rows "._RESULTS."...</a>";
        }
        print "<ul>";
        print $output;
        print "</ul>\n";
    }
    else {
        print '<font class=\"pn-normal\">'._SEARCH_NO_COMMENTS.'</font>';
    }
    print "<br>";
}
?>
Return current item: ProNuke. Postnuke To Oracle