<?php

include('includes/global.php');

ShowPage();

if(array_key_exists('text', $_POST) and Licence(LICENCE_ADMIN)) 
{
  $text = $_POST['text'];
  $email = $_POST['email'];
  $subject = $_POST['subject'];
  echo('email: <strong>'.$email.'</strong><br />');
  echo('předmět: <strong>'.$subject.'</strong><br />');
  echo('text: <strong>'.$text.'</strong><br />');
    
  if(@mail($email, $subject, $text, 'From: '.$Config['Web']['AdminEmail'].'\nReply-To: '.$Config['Web']['AdminEmail'].'\nX-Mailer: PHP/'))
  {
    echo('Zpráva byla odeslána.<br /><br />');
  }
  else
  {
    echo('Nepodařilo se odesat E-mail.<br /><br />'); 
  }
}
  
if(array_key_exists('user', $_GET) and Licence(LICENCE_MODERATOR)) 
{
  
  $Query = 'SELECT *, (';
  foreach($TranslationTree as $Group)
    if($Group['TablePrefix'] != '')
	  $Query .= '(SELECT count(*) FROM `'.$Group['TablePrefix'].'` WHERE User = '.$_GET['user'].' AND User <> 0 AND Complete = 1) + ';
  $Query .= '0) as NumberTranslate FROM `user` WHERE ID = '.$_GET['user'];
  $LineUser = mysql_fetch_array($Database->SQLCommand($Query));
   
  echo('ID: <strong>'.$_GET['user'].'</strong><br />');
  echo('Jméno: <strong>'.$LineUser['user'].'</strong><br />');
  echo('Výchozí jazyk: <strong>'.$LineUser['Language'].'</strong><br />');
  echo('Poslední připojení: <strong>'.$LineUser['LastLogin'].'</strong><br />');
  echo('Poslední IP: <strong>'.$LineUser['LastIP'].'</strong><br />');
  echo('Počet přeložených: <a href="TranslationList.php?user='.$_GET['user'].'&amp;action=userall" title="Zobrazit Všechny jeho přeložené texty"><strong>'.$LineUser['NumberTranslate'].'</strong></a><br />');
  echo('Email: <strong>'.$LineUser['Email'].'</strong><br />');
  echo('<br />

<form action="user.php" method="post"><div>
Napsat E-mail: 
<input type="text" name="email" value="'.$LineUser['Email'].'" />
Předmět: 
<input type="text" name="subject" value="Projekt překládání textů WoW" />
<input type="submit" value="Odeslat" />
<br />
<textarea name="text" rows="20" cols="62">

S pozdravem '.$_SESSION['User'].'
--------------------------------------------------------
Projekt překládání textů WoW '.$Config['Web']['BaseURL'].'
</textarea>
</div></form>');
}

ShowFooter();      

?>

