<?
////@Software:////////////////////////////////////////////////////////
//                                                                  //
// This software is the property from board.bt-technik.com          //
// and may not be released on other forums to the download.         //
// Even if a modification is carried out in this software           //
// it is still prohibited to be released then this software         //
// for the download. This software is held by the Staff             //
// board.bt-technik.com                                             //
// UpToDate these become no modifications of this software          //
// except modules on board.bt-technik.com.                          //
// The modules on board.bt-technik.com will become to before        //
// from staff checked and therefore released solely the Staff       //
// from board.bt-technik.com an extension vision may offer          //
// to the download.                                                 //
//                                                                  //
////@Info's://////////////////////////////////////////////////////////
//                                                                  //
// http://board.bt-technik.com                                      //
//                                                                  //
////@Copyright:///////////////////////////////////////////////////////
//                                                                  //
// Ralphie 2008 | ralphie@arcor.de | http://board.bt-technik.com    //
//                                                                  //
////@Modification:////////////////////////////////////////////////////
//                                                                  //
// If a modification was carried out in this software it is         //
// not permited to remove the copyright from footer as well as      //
// the PHP. It is only allowed to put modificated by XYZ behind     //
// the copyright.                                                   //
// If this dont hold to this kind it is pursued under civil         //
// law and criminal.                                                //
//                                                                  //
//////////////////////////////////////////////////////////////////////

require_once("include/bittorrent.php");
dbconn(true);
loggedinorreturn();
if (get_user_class() < UC_SYSOP){
stderr("Fehler","Zugriff erst ab Sysop!!!");
}

stdhead("Verwarnte User");
$action = htmlentities($_GET["action"]);

if(empty($action) OR $action == "list") {

$get_warned = mysql_query("SELECT id, username, class, last_access, warneduntil, added, avatar, uploaded, downloaded, webseed, enabled, warned, donor FROM users WHERE enabled = 'yes' AND warned = 'yes' ORDER BY id DESC");
begin_frame("Verwarnte User");
?>
<table width="100%" border="0" cellspacing="1" cellpadding="4" class="tableinborder">
  <tr>
    <td class="tableb" width="100%"><div align="center"><font color="#008000">Verwarnte User Gesamt:</font>&nbsp;<font color="#FF0000"><?php echo mysql_num_rows($get_warned); ?></font></div></td>
  </tr>
</table>
<br />
<table width="100%" border="0" cellspacing="1" cellpadding="4" class="tableinborder">
  <tr>
    <td class="tableb" width="100%">Alle(n) Verwarnten Usern-&nbsp;<div align="center"><a href="<?php $_SERVER["PHP_SELF"]; ?>?action=sendpm" onclick="return confirm('Bist du dir sicher das du allen Verwarnten Usern eine PM schicken möchtest ?');"><font color="#FF0000">PM schicken</font></a>&nbsp;|&nbsp;<a href="<?php $_SERVER["PHP_SELF"]; ?>?action=dewarn_all" onclick="return confirm('Bist du dir sicher das du allen Verwarnten Usern die Verwarnung zurücknehmen möchtest ?');"><font color="#FF0000">Entwarnen</font></a>&nbsp;|&nbsp;<a href="<?php $_SERVER["PHP_SELF"]; ?>?action=deak_all" onclick="return confirm('Bist du dir sicher das du alle Verwarnten User Deaktivieren möchtest ?');"><font color="#FF0000">Deaktivieren</font></a>&nbsp;|&nbsp;<a href="<?php $_SERVER["PHP_SELF"]; ?>?action=akt_all" onclick="return confirm('Bist du dir sicher das du alle Verwarnten User Aktivieren möchtest ?');"><font color="#FF0000">Aktivieren</font></a></div></td>
  </tr>
</table>
<br />
<table width="100%" border="0" cellspacing="1" cellpadding="4" class="tableinborder">
  <tr>
    <td class="tabletitle">Username</td>
    <td class="tabletitle">Regestriert</td>
    <td class="tabletitle">Letzter Zugriff</td>
    <td class="tabletitle">Verwarnungs Ende</td>
    <td class="tabletitle">PM</td>
    <td class="tabletitle">Deaktivierung</td>
    <td class="tabletitle">Verwarnen</td>
  </tr>
<?
while($data_warned = mysql_fetch_array($get_warned)) {

$added = substr($data_warned['added'],0,10);
$last_access = substr($data_warned['last_access'],0,10);

if ($data_warned[added] == "0000-00-00 00:00:00")
$joindate = 'N/A';
else
$joindate = "Reg.: " . get_elapsed_time(sql_timestamp_to_unix_timestamp($data_warned["added"])) . "";

if ($data_warned["avatar"])
$avatarover = $data_warned["avatar"];
elseif (!$data_warned["avatar"])
$avatarover = $GLOBALS["PIC_BASE_URL"] . "default_avatarr.gif";

$uploaded = mksize($data_warned["uploaded"]);
$downloaded = mksize($data_warned["downloaded"]);


if ($data_warned["webseed"] == "yes")  {
$webs="<font color=red>[Webseeder]</font>";
}

$icons = array("enabled" => $data_warned["enabled"], "warned" => $data_warned["warned"], "atwork" => $data_warned["atwork"], "donor" => $data_warned["donor"]);
$name = "<a href=userdetails.php?id=".htmlentities($data_warned["id"]). " onmouseover=\"return overlib('<table cellpadding=4 cellspacing=1 width=100% height=80><tr><td class=tablea align=left ><br><center><img align=center src=$avatarover height=90 width=80></center><br> <font color=green>UP: $uploaded</font><br> <font color=darkred>DL: $downloaded</font><br>$joindate<br><font color=red>$webs </font></div>', CAPTION, '');\" onmouseout=\"return nd();\"><font class=".get_class_color($data_warned["class"]).">".htmlentities($data_warned["username"])."</a>&nbsp;" .get_user_icons($icons). "";
?>
  <tr>
    <td class="tablea"><?php echo "$name"; ?></td>
    <td class="tablea"><?php echo htmlentities($added); ?></td>
    <td class="tablea"><?php echo htmlentities($last_access); ?></td>
    <td class="tablea"><?php echo htmlentities($data_warned["warneduntil"]); ?></td>
    <td class="tablea"><center><?php echo "<a href=messages.php?action=send&receiver=" .htmlentities($data_warned["id"]). "><img src=pic/button_pm2.gif border=0></a>"; ?></center></td>
    <td class="tablea"><center><a href="<?php $_SERVER["PHP_SELF"]; ?>?action=user_ban&id=<?php echo htmlentities($data_warned["id"]); ?>"><font color="#FF0000">Deaktiv.</font></a>&nbsp;-&nbsp;<a href="<?php $_SERVER["PHP_SELF"]; ?>?action=user_entban&id=<?php echo htmlentities($data_warned["id"]); ?>"><font color="#008000">Aktiv.</font></a></center></td>
    <td class="tablea"><center><a href="<?php $_SERVER["PHP_SELF"]; ?>?action=user_verwarnen&id=<?php echo htmlentities($data_warned["id"]); ?>"><font color="#FF0000">Warnen</font></a>&nbsp;-&nbsp;<a href="<?php $_SERVER["PHP_SELF"]; ?>?action=user_entwarnen&id=<?php echo htmlentities($data_warned["id"]); ?>"><font color="#008000">Entwarnen</font></a></center></td>
   </tr>
<? } ?>
</table>
<?
end_frame();
?><center class="tabletitle">Verwarnte User Liste - modify by Ralphie &copy; - for <a href="http://board.bt-technik.com" targert="_blank">BT-Technik</a></center>
<?
}
///////////////////////PN Einstellung Anfang///////////////////////////
if ($_SERVER["REQUEST_METHOD"] == "POST"){
$dt = sqlesc(get_date_time());
$msg = $_POST['msg'];
if (!$msg)
stderr("Error","Bitte einen Text eingeben");

$query = mysql_query("SELECT id FROM users WHERE enabled='yes' AND warned='yes'") or sqlerr();
while($dat=mysql_fetch_assoc($query)){
mysql_query("INSERT INTO messages (sender, receiver, added, msg, folder_in, subject) VALUES (0,$dat[id] , '" . get_date_time() . "', " . sqlesc($msg) .", -3, 'Deine Verwarnung')") or sqlerr(__FILE__,__LINE__);
write_modcomment(htmlentities($dat[id]), 0, "PM bekommen weil er Verwarnt ist.");
}
header("Refresh: 0; url=$_SERVER[PHP_SELF]?action=pmsend");
}

if (htmlentities($action) == "sendpm") {
begin_frame ("Massen PM an alle User die Verwarnt sind");
?>
<center>
<table class=main width=400 border=0 cellspacing=0 cellpadding=0><tr><td>
<form method=post name=message action=<?php $_SERVER["PHP_SELF"]; ?>>
<?
if (htmlentities($_GET["returnto"]) || $_SERVER["HTTP_REFERER"]) {
?>
<input type=hidden name=returnto value=<?=htmlentities($_GET["returnto"]) ? htmlentities($_GET["returnto"]) : $_SERVER["HTTP_REFERER"]?>>
<?
}
//default message
$body = "
Bitte gebe den Text ein um den User zu mitteilen Den Grund dieser PN sendung

Das Team!";
?>
<table cellpadding="4" cellspacing="1" border="0" style="width:70%" class="tableinborder">
<tr class="tabletitle" width="50%">
<td colspan="10" width="50%"><span class="normalfont"><center><b> Nachricht </b></center></span></td>
</tr>
<tr>
<td class="tableb" valign="top"><b>Nachricht:</b></td>
<td class=tablea align=left input type=text style='padding: 0px'><? textbbcode("message","msg","$body","support")?></td>
</tr>
<tr>
<td class="tablea" style="text-align:center;" colspan="2">
<input type="submit" name="send" value="Nachricht senden">
</td></tr></table>
<input type=hidden name=receiver value=<?=$receiver?>>
</form>
</div></td></tr></table></center>
<?
end_frame();
}
///////////////////////PN Einstellung Ende///////////////////////////

///////////////////////Bann Einstellung Anfang///////////////////////
if($action == "user_ban") {

$id = $_GET["id"];

begin_frame("User Ban");
mysql_query("UPDATE users SET enabled = 'no' WHERE id = '$id'") or sqlerr(__FILE__,__LINE__);
write_modcomment(htmlentities($id), 0, "Wurde von $CURUSER[username] deaktiviert weil er Verwarnt war.");
?>
<table width="100%" border="0" cellspacing="1" cellpadding="4" class="tableinborder">
  <tr>
    <td class="tableb"><font color="#FF0000">User erfolgreich Deaktiviert.....</font> [<a href="<?php $_SERVER["PHP_SELF"]; ?>?action=list">Weiter</a>]</td>
  </tr>
</table>
<?
end_frame();
}

if($action == "user_entban") {

$id = $_GET["id"];

begin_frame("User Entbannen");
mysql_query("UPDATE users SET enabled = 'yes' WHERE id = '$id'") or sqlerr(__FILE__,__LINE__);
write_modcomment(htmlentities($id), 0, "Wurde von $CURUSER[username] aktiviert.");
?>
<table width="100%" border="0" cellspacing="1" cellpadding="4" class="tableinborder">
  <tr>
    <td class="tableb"><font color="#008000">User erfolgreich Aktiviert.....</font> [<a href="<?php $_SERVER["PHP_SELF"]; ?>?action=list">Weiter</a>]</td>
  </tr>
</table>
<?
end_frame();
}
///////////////////////Bann Einstellung Ende///////////////////////

///////////////////////Verwarnung Einstellung Anfang///////////////////////
if($action == "user_verwarnen") {

$id = $_GET["id"];

begin_frame("User Verwarnen");
mysql_query("UPDATE users SET warned = 'yes' WHERE id = '$id'") or sqlerr(__FILE__,__LINE__);
$betreff = "Verwarnung";
$msg = "Du wurdest Verwarnt!";
sendPersonalMessage(0, $userid, $betreff, $msg, PM_FOLDERID_INBOX, 0);
write_modcomment(htmlentities($id), 0, "Wurde von $CURUSER[username] Verwarnt.");
?>
<table width="100%" border="0" cellspacing="1" cellpadding="4" class="tableinborder">
  <tr>
    <td class="tableb"><font color="#FF0000">User erfolgreich Verwarnt.....</font> [<a href="<?php $_SERVER["PHP_SELF"]; ?>?action=list">Weiter</a>]</td>
  </tr>
</table>
<?
end_frame();
}

if($action == "user_entwarnen") {

$id = $_GET["id"];

begin_frame("User Entwarnen");
mysql_query("UPDATE users SET warned = 'no' WHERE id = '$id'") or sqlerr(__FILE__,__LINE__);
$betreff = "Verwarnung";
$msg = "Deine Verwarnung wurde zurückgenommen!";
sendPersonalMessage(0, $userid, $betreff, $msg, PM_FOLDERID_INBOX, 0);
write_modcomment(htmlentities($id), 0, "Die Verwarnung wurde von $CURUSER[username] zurückgenommen.");
?>
<table width="100%" border="0" cellspacing="1" cellpadding="4" class="tableinborder">
  <tr>
    <td class="tableb"><font color="#008000">Verwarnung erfolgreich zurückgenommen.....</font> [<a href="<?php $_SERVER["PHP_SELF"]; ?>?action=list">Weiter</a>]</td>
  </tr>
</table>
<?
end_frame();
}

$data_useridwarned = mysql_query("SELECT id FROM users WHERE enabled = 'yes' AND warned = 'yes'");

if($action == "dewarn_all") {

begin_frame("Alle entwarnen");
while($data_userid=mysql_fetch_assoc($data_useridwarned)){
mysql_query("UPDATE users SET warned = 'no' WHERE id = '$data_userid[id]'") or sqlerr(__FILE__,__LINE__);
write_modcomment(htmlentities($data_userid[id]), 0, "Wurde von $CURUSER[username] die Verwarnung entfernt.");
}
?>
<table width="100%" border="0" cellspacing="1" cellpadding="4" class="tableinborder">
  <tr>
    <td class="tableb"><font color="#008000">Alle User erfolgreich entwarnt.....</font> [<a href="<?php $_SERVER["PHP_SELF"]; ?>?action=list">Weiter</a>]</td>
  </tr>
</table>
<?
end_frame();
}
///////////////////////Verwarnung Einstellung Ende///////////////////////

///////////////////////Aktivierung Einstellung Anfang///////////////////////
if($action == "deak_all") {

begin_frame("Alle Deaktivieren");
while($data_userid=mysql_fetch_assoc($data_useridwarned)){
mysql_query("UPDATE users SET enabled = 'no' WHERE id = '$data_userid[id]'") or sqlerr(__FILE__,__LINE__);
write_modcomment(htmlentities($data_userid[id]), 0, "Wurde von $CURUSER[username] Deaktiviert weil er Verwarnt ist");
}
?>
<table width="100%" border="0" cellspacing="1" cellpadding="4" class="tableinborder">
  <tr>
    <td class="tableb"><font color="#008000">Alle User erfolgreich deaktiviert.....</font> [<a href="<?php $_SERVER["PHP_SELF"]; ?>?action=list">Weiter</a>]</td>
  </tr>
</table>
<?
end_frame();
}

if($action == "akt_all") {

$data_useridakt = mysql_query("SELECT id FROM users WHERE enabled = 'no' AND warned = 'yes'");

begin_frame("Alle Aktivieren");
while($data_userid=mysql_fetch_assoc($data_useridakt)){
mysql_query("UPDATE users SET enabled = 'yes' WHERE id = '$data_userid[id]'") or sqlerr(__FILE__,__LINE__);
write_modcomment(htmlentities($data_userid[id]), 0, "Wurde von $CURUSER[username] Aktiviert.");
}
?>
<table width="100%" border="0" cellspacing="1" cellpadding="4" class="tableinborder">
  <tr>
    <td class="tableb"><font color="#008000">Alle User erfolgreich aktiviert.....</font> [<a href="<?php $_SERVER["PHP_SELF"]; ?>?action=list">Weiter</a>]</td>
  </tr>
</table>
<?
end_frame();
}
///////////////////////Aktivierung Einstellung Ende///////////////////////

if($action == "pmsend") {

begin_frame("Nachricht verschickt");
?>
<table width="100%" border="0" cellspacing="1" cellpadding="4" class="tableinborder">
  <tr>
    <td class="tableb"><font color="#008000">Nachricht wurde erfolgreich verschickt.....</font> [<a href="<?php $_SERVER["PHP_SELF"]; ?>?action=list">Weiter</a>]</td>
  </tr>
</table>
<?
end_frame();
}

stdfoot();
?> 