📄 main.php
字号:
<?php
// $Id: main.php,v 1.11 2004/12/26 19:12:03 onokazu Exp $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
// Copyright (c) 2000 XOOPS.org //
// <http://www.xoops.org/> //
// ------------------------------------------------------------------------ //
// 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, or //
// (at your option) any later version. //
// //
// 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. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //
// Author: Kazumi Ono (AKA onokazu) //
// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //
// Project: The XOOPS Project //
// ------------------------------------------------------------------------- //
if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
exit("Access Denied");
}
$op = "form";
if ( isset($_POST['op']) && $_POST['op'] == "submit" ) {
$op = "submit";
}
xoops_cp_header();
//OpenTable();
if ( $op == "form" ) {
$member_handler =& xoops_gethandler('member');
$acttotal = $member_handler->getUserCount(new Criteria('level', 0, '>'));
$inacttotal = $member_handler->getUserCount(new Criteria('level', 0));
include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";
$uname_text = new XoopsFormText("", "user_uname", 30, 60);
$uname_match = new XoopsFormSelectMatchOption("", "user_uname_match");
$uname_tray = new XoopsFormElementTray(_AM_UNAME, " ");
$uname_tray->addElement($uname_match);
$uname_tray->addElement($uname_text);
$name_text = new XoopsFormText("", "user_name", 30, 60);
$name_match = new XoopsFormSelectMatchOption("", "user_name_match");
$name_tray = new XoopsFormElementTray(_AM_REALNAME, " ");
$name_tray->addElement($name_match);
$name_tray->addElement($name_text);
$email_text = new XoopsFormText("", "user_email", 30, 60);
$email_match = new XoopsFormSelectMatchOption("", "user_email_match");
$email_tray = new XoopsFormElementTray(_AM_EMAIL, " ");
$email_tray->addElement($email_match);
$email_tray->addElement($email_text);
$url_text = new XoopsFormText(_AM_URLC, "user_url", 30, 100);
//$theme_select = new XoopsFormSelectTheme(_AM_THEME, "user_theme");
//$timezone_select = new XoopsFormSelectTimezone(_AM_TIMEZONE, "user_timezone_offset");
$icq_text = new XoopsFormText("", "user_icq", 30, 100);
$icq_match = new XoopsFormSelectMatchOption("", "user_icq_match");
$icq_tray = new XoopsFormElementTray(_AM_ICQ, " ");
$icq_tray->addElement($icq_match);
$icq_tray->addElement($icq_text);
$aim_text = new XoopsFormText("", "user_aim", 30, 100);
$aim_match = new XoopsFormSelectMatchOption("", "user_aim_match");
$aim_tray = new XoopsFormElementTray(_AM_AIM, " ");
$aim_tray->addElement($aim_match);
$aim_tray->addElement($aim_text);
$yim_text = new XoopsFormText("", "user_yim", 30, 100);
$yim_match = new XoopsFormSelectMatchOption("", "user_yim_match");
$yim_tray = new XoopsFormElementTray(_AM_YIM, " ");
$yim_tray->addElement($yim_match);
$yim_tray->addElement($yim_text);
$msnm_text = new XoopsFormText("", "user_msnm", 30, 100);
$msnm_match = new XoopsFormSelectMatchOption("", "user_msnm_match");
$msnm_tray = new XoopsFormElementTray(_AM_MSNM, " ");
$msnm_tray->addElement($msnm_match);
$msnm_tray->addElement($msnm_text);
$location_text = new XoopsFormText(_AM_LOCATION, "user_from", 30, 100);
$occupation_text = new XoopsFormText(_AM_OCCUPATION, "user_occ", 30, 100);
$interest_text = new XoopsFormText(_AM_INTEREST, "user_intrest", 30, 100);
//$bio_text = new XoopsFormText(_AM_EXTRAINFO, "user_bio", 30, 100);
$lastlog_more = new XoopsFormText(_AM_LASTLOGMORE, "user_lastlog_more", 10, 5);
$lastlog_less = new XoopsFormText(_AM_LASTLOGLESS, "user_lastlog_less", 10, 5);
$reg_more = new XoopsFormText(_AM_REGMORE, "user_reg_more", 10, 5);
$reg_less = new XoopsFormText(_AM_REGLESS, "user_reg_less", 10, 5);
$posts_more = new XoopsFormText(_AM_POSTSMORE, "user_posts_more", 10, 5);
$posts_less = new XoopsFormText(_AM_POSTSLESS, "user_posts_less", 10, 5);
$mailok_radio = new XoopsFormRadio(_AM_SHOWMAILOK, "user_mailok", "both");
$mailok_radio->addOptionArray(array("mailok"=>_AM_MAILOK, "mailng"=>_AM_MAILNG, "both"=>_AM_BOTH));
$type_radio = new XoopsFormRadio(_AM_SHOWTYPE, "user_type", "actv");
$type_radio->addOptionArray(array("actv"=>_AM_ACTIVE, "inactv"=>_AM_INACTIVE, "both"=>_AM_BOTH));
$sort_select = new XoopsFormSelect(_AM_SORT, "user_sort");
$sort_select->addOptionArray(array("uname"=>_AM_UNAME,"email"=>_AM_EMAIL,"last_login"=>_AM_LASTLOGIN,"user_regdate"=>_AM_REGDATE,"posts"=>_AM_POSTS));
$order_select = new XoopsFormSelect(_AM_ORDER, "user_order");
$order_select->addOptionArray(array("ASC"=>_AM_ASC,"DESC"=>_AM_DESC));
$limit_text = new XoopsFormText(_AM_LIMIT, "limit", 6, 2);
$fct_hidden = new XoopsFormHidden("fct", "findusers");
$op_hidden = new XoopsFormHidden("op", "submit");
$submit_button = new XoopsFormButton("", "user_submit", _SUBMIT, "submit");
$form = new XoopsThemeForm(_AM_FINDUS, "uesr_findform", "admin.php");
$form->addElement($uname_tray);
$form->addElement($name_tray);
$form->addElement($email_tray);
//$form->addElement($theme_select);
//$form->addElement($timezone_select);
$form->addElement($icq_tray);
$form->addElement($aim_tray);
$form->addElement($yim_tray);
$form->addElement($msnm_tray);
$form->addElement($url_text);
$form->addElement($location_text);
$form->addElement($occupation_text);
$form->addElement($interest_text);
//$form->addElement($bio_text);
$form->addElement($lastlog_more);
$form->addElement($lastlog_less);
$form->addElement($reg_more);
$form->addElement($reg_less);
$form->addElement($posts_more);
$form->addElement($posts_less);
$form->addElement($mailok_radio);
$form->addElement($type_radio);
$form->addElement($sort_select);
$form->addElement($order_select);
$form->addElement($fct_hidden);
$form->addElement($limit_text);
$form->addElement($op_hidden);
// if this is to find users for a specific group
if ( !empty($_GET['group']) && intval($_GET['group']) > 0 ) {
$group_hidden = new XoopsFormHidden("group", intval($_GET['group']));
$form->addElement($group_hidden);
}
$form->addElement($submit_button);
echo "<h4 style='text-align:left;'>"._AM_FINDUS."</h4>(".sprintf(_AM_ACTUS, "<span style='color:#ff0000;'>$acttotal</span>")." ".sprintf(_AM_INACTUS, "<span style='color:#ff0000;'>$inacttotal</span>").")";
$form->display();
}
if ( $op == "submit" ) {
$myts =& MyTextSanitizer::getInstance();
$criteria = new CriteriaCompo();
if ( !empty($_POST['user_uname']) ) {
$match = (!empty($_POST['user_uname_match'])) ? intval($_POST['user_uname_match']) : XOOPS_MATCH_START;
switch ($match) {
case XOOPS_MATCH_START:
$criteria->add(new Criteria('uname', $myts->addSlashes(trim($_POST['user_uname'])).'%', 'LIKE'));
break;
case XOOPS_MATCH_END:
$criteria->add(new Criteria('uname', '%'.$myts->addSlashes(trim($_POST['user_uname'])), 'LIKE'));
break;
case XOOPS_MATCH_EQUAL:
$criteria->add(new Criteria('uname', $myts->addSlashes(trim($_POST['user_uname']))));
break;
case XOOPS_MATCH_CONTAIN:
$criteria->add(new Criteria('uname', '%'.$myts->addSlashes(trim($_POST['user_uname'])).'%', 'LIKE'));
break;
}
}
if ( !empty($_POST['user_name']) ) {
$match = (!empty($_POST['user_name_match'])) ? intval($_POST['user_name_match']) : XOOPS_MATCH_START;
switch ($match) {
case XOOPS_MATCH_START:
$criteria->add(new Criteria('name', $myts->addSlashes(trim($_POST['user_name'])).'%', 'LIKE'));
break;
case XOOPS_MATCH_END:
$criteria->add(new Criteria('name', '%'.$myts->addSlashes(trim($_POST['user_name'])), 'LIKE'));
break;
case XOOPS_MATCH_EQUAL:
$criteria->add(new Criteria('name', $myts->addSlashes(trim($_POST['user_name']))));
break;
case XOOPS_MATCH_CONTAIN:
$criteria->add(new Criteria('name', '%'.$myts->addSlashes(trim($_POST['user_name'])).'%', 'LIKE'));
break;
}
}
if ( !empty($_POST['user_email']) ) {
$match = (!empty($_POST['user_email_match'])) ? intval($_POST['user_email_match']) : XOOPS_MATCH_START;
switch ($match) {
case XOOPS_MATCH_START:
$criteria->add(new Criteria('email', $myts->addSlashes(trim($_POST['user_email'])).'%', 'LIKE'));
break;
case XOOPS_MATCH_END:
$criteria->add(new Criteria('email', '%'.$myts->addSlashes(trim($_POST['user_email'])), 'LIKE'));
break;
case XOOPS_MATCH_EQUAL:
$criteria->add(new Criteria('email', $myts->addSlashes(trim($_POST['user_email']))));
break;
case XOOPS_MATCH_CONTAIN:
$criteria->add(new Criteria('email', '%'.$myts->addSlashes(trim($_POST['user_email'])).'%', 'LIKE'));
break;
}
}
if ( !empty($_POST['user_url']) ) {
$url = formatURL(trim($_POST['user_url']));
$criteria->add(new Criteria('url', $url.'%', 'LIKE'));
}
if ( !empty($_POST['user_icq']) ) {
$match = (!empty($_POST['user_icq_match'])) ? intval($_POST['user_icq_match']) : XOOPS_MATCH_START;
switch ($match) {
case XOOPS_MATCH_START:
$criteria->add(new Criteria('user_icq', $myts->addSlashes(trim($_POST['user_icq'])).'%', 'LIKE'));
break;
case XOOPS_MATCH_END:
$criteria->add(new Criteria('user_icq', '%'.$myts->addSlashes(trim($_POST['user_icq'])), 'LIKE'));
break;
case XOOPS_MATCH_EQUAL:
$criteria->add(new Criteria('user_icq', '%'.$myts->addSlashes(trim($_POST['user_icq']))));
break;
case XOOPS_MATCH_CONTAIN:
$criteria->add(new Criteria('user_icq', '%'.$myts->addSlashes(trim($_POST['user_icq'])).'%', 'LIKE'));
break;
}
}
if ( !empty($_POST['user_aim']) ) {
$match = (!empty($_POST['user_aim_match'])) ? intval($_POST['user_aim_match']) : XOOPS_MATCH_START;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -