Location: PHPKode > projects > ProNuke. Postnuke To Oracle > postnuke/html/includes/search/users.php
<?php // $Id: users.php,v 1.17 2001/12/04 00:50:23 gregorrothfuss Exp $ $Name:  $
/************************************************************************/
/* Post-Nuke: Content Management System                                 */
/* ====================================                                 */
/* Module: Search/users 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 users                                    */
/************************************************************************/

$search_modules[] = array(
    'title' => 'Users',
    'func_search' => 'search_users',
    'func_opt' => 'search_users_opt'
);
function search_users_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_users\" id=\"active_users\" value=\"1\" checked>&nbsp;<label for=\"active_users\">"._SEARCH_MEMBERS."</label></font></td></tr></table>";
}
function search_users($vars) {
    if(!$vars['active_users']) {
        return;
    }
    global
        $bgcolor1,
        $bgcolor2,
        $bgcolor3,
        $bgcolor4,
        $textcolor1,
        $textcolor2,
        $pntable,
        $dbconn
    ;
    $w = search_split_query($vars[q]);
    $flag = false;
    $column = &$pntable['users_column'];
    $query = "SELECT $column[name] as name, $column[uname] as uname FROM $pntable[users] WHERE ";
    foreach($w as $word) {
        if($flag) {
            switch($vars['bool']) {
                case 'AND' :
                    $query .= ' AND ';
                    break;
                case 'OR' :
                default :
                    $query .= ' OR ';
                    break;
            }
        }
        $query .= '(';
        $query .= "$column[uname] LIKE '$word' OR ";
        $query .= "$column[name] LIKE '$word'";
        $query .= ')';
        $flag = true;
    }
    $query .= " ORDER BY $column[uname]";

    $result = $dbconn->Execute($query);
//FTO replace record count by a counter
//    $total_rows = $result->PO_Record Count();

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

    if(!$result->EOF) {
        print "<font class=\"pn-normal\">"._S_MEMBERS.":</font>";

        $output="";
        while(!$result->EOF) {
            $total_rows++;
            $row = $result->GetRowAssoc(false);
            $output .= "<li><a class=\"pn-normal\" href=\"user.php?op=userinfo&amp;uname=$row[uname]&amp;module=NS-User\">$row[uname]</a><br>"
                ."$row[name]</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_users=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_MEMBERS.'</font>';
    }
    print "<br>";
}
?>
Return current item: ProNuke. Postnuke To Oracle