<?php
// ------------------------------------------------------------------------- //
//                XOOPS - PHP Content Management System                      //
//                       <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.                                      //
//                                                                           //
//  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 //
// ------------------------------------------------------------------------- //

$xoopsOption['pagetype'] = "admin";
include("mainfile.php");
include(XOOPS_ROOT_PATH."/include/cp_functions.php");
include_once(XOOPS_ROOT_PATH."/class/xoopsmodule.php");

/*********************************************************/
/* Admin Authentication                                  */
/*********************************************************/
$admintest = 0;

if ( $xoopsUser ) {
	if ( !$xoopsUser->isAdmin() ) {
		redirect_header("index.php",2,_AD_NORIGHT);
		exit();
	}
	$admintest=1;
} else {
	redirect_header("index.php",2,_AD_NORIGHT);
	exit();
}
$op = "list";


if ( !empty($HTTP_GET_VARS['op']) ) {
	$op = $HTTP_GET_VARS['op'];
}

if ( !empty($HTTP_POST_VARS['op']) ) {
	$op = $HTTP_POST_VARS['op'];
}

if ( $admintest ) {
	switch ($op) {
	    	case "list":
		xoops_cp_header();
		OpenTable();
		// ###### Output warn messages for security ######
		if ( file_exists(XOOPS_ROOT_PATH."/install.php" ) ) {
			echo "<h3 style='color:#ff0000;'>".sprintf(_WARNINSTALL2,XOOPS_ROOT_PATH."/install.php")."</h3>";
		}
		if ( is_writable(XOOPS_ROOT_PATH."/mainfile.php" ) ) {
			echo "<h3 style='color:#ff0000;'>".sprintf(_WARNINWRITEABLE,XOOPS_ROOT_PATH."/mainfile.php")."</h3>";
		}
$sql = "SELECT * FROM ".$xoopsDB->prefix("users")." WHERE level>0 ORDER BY uid DESC";
		$result = $xoopsDB->query($sql,10,0);
		echo "<h4>"._AD_LASTTENUSERS."</h4>";
		echo "<table border='0' cellpadding='0' cellspacing='0' valign='top' width='100%'><tr><td class='bg2'><table width='100%' border='0' cellpadding='4' cellspacing='1'>
		<tr class='bg3' align='center'><td><b>"._AD_NICKNAME."</b></td><td><b>"._AD_EMAIL."</b></td><td><b>"._AD_AVATAR."</b></td><td><b>"._AD_REGISTERED."</b></td><td><b>"._AD_ACTION."</b></td></tr>\n";
		while ( $myrow = $xoopsDB->fetchArray($result) ) {
			$myuser = new XoopsUser($myrow);
			echo "<tr class='bg1'><td><a href='userinfo.php?uid=".$myuser->getVar("uid")."' target='_blank'>".$myuser->getVar("uname")."</a></td><td><a href='mailto:".$myuser->getVar("email")."'>".$myuser->getVar("email")."</a></td><td align='center'><img src='images/avatar/".$myuser->getVar("user_avatar", "E")."' alt='' /></td><td align='center'>".formatTimestamp($myuser->getVar("user_regdate"))."</td><td align='right'><a href='modules/system/admin.php?fct=users&amp;op=modifyUser&amp;uid=".$myuser->getVar("uid")."'>"._AD_EDIT."</a>&nbsp;<a href='modules/system/admin.php?fct=users&amp;op=delUser&amp;uid=".$myuser->getVar("uid")."'>"._AD_DELETE."</a></td></tr>\n";
		}
		echo "</table></td></tr></table><br />";
		echo "<h4>XOOPS Developers and Contributors</h4><table border='0' cellpadding='0' cellspacing='0' valign='top' width='100%'><tr><td class='bg2'><table width='100%' border='0' cellpadding='4' cellspacing='1'><tr><td class='bg3'>Lead Developer</td><td class='bg1'><a href='http://www.xoops.org/userinfo.php?uid=3' target='_blank'>K. Ono (onokazu)</a></td></tr><tr><td class='bg3'>Co-Developer</td><td class='bg1'><a href='http://www.xoops.org/userinfo.php?uid=4' target='_blank'>G. Cheng (goghs)</a></td></tr><tr><td class='bg3'>Security</td><td class='bg1'><a href='http://www.xoops.org/userinfo.php?uid=100' target='_blank'>J. Moriya (JM2)</a></td></tr><tr><td class='bg3'>Themes and Graphics</td><td class='bg1'><a href='http://www.xoops.org/userinfo.php?uid=6' target='_blank'>J. I. Pettersen (Xend)</a></td></tr><tr><td class='bg3'>Quality Assurance</td><td class='bg1'><a href='http://www.xoops.org/userinfo.php?uid=5' target='_blank'>Xiumu (wanderer)</a>, <a href='http://www.xoops.org/userinfo.php?uid=2' target='_blank'>S. Kohl (w4z004)</a>,</td></tr><tr><td class='bg3'>Documentation</td><td class='bg1'><a href='http://www.xoops.org/userinfo.php?uid=33' target='_blank'>M. Alexandria (malexandria)</a>, <a href='http://www.xoops.org/userinfo.php?uid=32' target='_blank'>E. Caldwell (Boobtoob)</a></td></tr></table></td></tr></table>";
		CloseTable();
    		xoops_cp_footer();
		break;
	    default:
		break;
	}
}
?>