<?php
// $Id: admin.php,v 1.1 2004/07/11 10:27:16 Farsus Exp $
// -------------------------------------------------------------------------//
//			       RUNCMS                                                   //
//                                                                          //
//	 reliable - Unique - Nocost &  Simplicity & ease off use                //
//                       < http://www.runcms.org >                          //
// -------------------------------------------------------------------------//
// Original Author: The Xoops Project
// Author Website : http://www.xoops.org
// License Type   : GPL: See /manual/LICENSES/GPL.txt
// ------------------------------------------------------------------------- //

$xoopsOption['pagetype'] = "admin";

include_once("mainfile.php");
include_once(XOOPS_ROOT_PATH."/include/cp_functions.php");

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

if ($xoopsUser) {
	if ( !$xoopsUser->isAdmin() ) {
		redirect_header("index.php", 2, _NOPERM);
		exit();
	}
	$admintest = 1;
	} else {
		redirect_header("index.php", 2, _NOPERM);
		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 == 1) {

switch ($op) {

case "list":
	xoops_cp_header();
	OpenTable();
	if ( @is_writable(XOOPS_ROOT_PATH."/mainfile.php" ) ) {
		echo "<img src='".XOOPS_URL."/images/editor/info.gif' /> ".sprintf(_FILEWARN, XOOPS_ROOT_PATH."/mainfile.php")."<br /><br />";
	}
	if ( @is_dir(XOOPS_ROOT_PATH."/_install" ) ) {
		echo "<img src='".XOOPS_URL."/images/editor/info.gif' /> ".sprintf(_INSTALLWARN, XOOPS_ROOT_PATH."/_install/")."";
	}
	$sql = "SELECT * FROM ".$db->prefix("users")." WHERE level>0 ORDER BY uid DESC";
	$result = $db->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>";
	while ( $myrow = $db->fetch_array($result) ) {
		$myuser     = new XoopsUser($myrow);
		$user_image = $myuser->getVar("user_avatar") ? "<img src='images/avatar/".$myuser->getVar("user_avatar")."' alt='' />" : '&nbsp;';
		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'>".$user_image."</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")."'>"._EDIT."</a>&nbsp;<a href='modules/system/admin.php?fct=users&amp;op=delUser&amp;uid=".$myuser->getVar("uid")."'>"._DELETE."</a></td>
		</tr>";
	}
	echo "</table></td></tr></table><br />";

	?>
	<h4>Contribute to, or support RUNCMS</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">
	We are always looking for partners, sponsors, or donations to help support further development.
	</td></tr><tr><td class="bg1">
	If you would like to help or work something out with us (partnership, sponsoring, donations, etc), then please <a href="http://www.runcms.org/public/modules/contact/index.php?op=contact">contact us</a> via our main site.<br> Help and/or proposals are always welcome.
	<br /><br />
	Best Regards, RUNCMS Team.
	</td></tr></table></td></tr></table>
	<br />
	<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
	<div align="center">
	<input type="hidden" value="_xclick" name="cmd">
	<input type="hidden" value="support@farsus.dk" name="business">
	<input type="hidden" value="RUNCMS Developer Help" name="item_name">
	<input type="hidden" value="1" name="item_number">
	<input type="hidden" value="<?php echo XOOPS_URL;?>" name="custom">
	<input type="hidden" name="currency_code" value="EUR">
	<input type="image" alt="Make a small donation to say thank's" src="<?php echo XOOPS_URL;?>/images/donate.gif" border="0" name="submit">
	</div><br />
	</form>
	<?php

	CloseTable();
	xoops_cp_footer();
	break;

default:
	break;
}

}
?>
