1 | <?php
|
---|
2 |
|
---|
3 | class PageUserProfile extends Page
|
---|
4 | {
|
---|
5 | function SendMail()
|
---|
6 | {
|
---|
7 | global $Config, $User;
|
---|
8 |
|
---|
9 | $Output = '';
|
---|
10 | if(array_key_exists('text', $_POST))
|
---|
11 | if($User->Licence(LICENCE_ADMIN))
|
---|
12 | {
|
---|
13 | $Text = $_POST['text'];
|
---|
14 | $Email = $_POST['email'];
|
---|
15 | $Subject = $_POST['subject'];
|
---|
16 | $Output = 'Email: <strong>'.$Email.'</strong><br />'.
|
---|
17 | 'Předmět: <strong>'.$Subject.'</strong><br />'.
|
---|
18 | 'Text: <strong>'.$Text.'</strong><br />';
|
---|
19 |
|
---|
20 | if(@mail($Email, $Subject, $Text, 'From: '.$Config['Web']['AdminEmail'].'\nReply-To: '.$Config['Web']['AdminEmail'].'\nX-Mailer: PHP/'))
|
---|
21 | {
|
---|
22 | $Output .= ShowMessage('Zpráva byla odeslána.');
|
---|
23 | }
|
---|
24 | else $Output .= ShowMessage('Nepodařilo se odesat E-mail.', MESSAGE_CRITICAL);
|
---|
25 | } else $Output .= ShowMessage('Nemáte oprávnění', MESSAGE_CRITICAL);
|
---|
26 | return($Output);
|
---|
27 | }
|
---|
28 |
|
---|
29 | function ShowProfile()
|
---|
30 | {
|
---|
31 | global $User, $Config;
|
---|
32 |
|
---|
33 | $Output = '';
|
---|
34 | $Query = 'SELECT `User`.`Name`, `UserTrace`.`LastLogin`, `UserTrace`.`LastIP`, '.
|
---|
35 | '`User`.`Email`, `UserTrace`.`UserAgent`, '.
|
---|
36 | '`User`.`TranslatedCount`, `User`.`Team`, `User`.`ID`, `User`.`Info`, '.
|
---|
37 | '`Team`.`Name` AS `TeamName`, `Language`.`Name` AS `LanguageName`, '.
|
---|
38 | '`ClientVersion`.`Version` AS `Version` FROM `User` '.
|
---|
39 | 'LEFT JOIN `UserTrace` ON `UserTrace`.`User` = `User`.`Id` '.
|
---|
40 | 'LEFT JOIN `Language` ON `Language`.`Id` = `User`.`Language` '.
|
---|
41 | 'LEFT JOIN `Team` ON `Team`.`Id` = `User`.`Team` '.
|
---|
42 | 'LEFT JOIN `ClientVersion` ON `ClientVersion`.`Id` = `User`.`PreferredVersion` '.
|
---|
43 | 'WHERE `User`.`Id` = '.($_GET['user'] * 1);
|
---|
44 | $DbResult = $this->Database->query($Query);
|
---|
45 | if($DbResult->num_rows > 0)
|
---|
46 | {
|
---|
47 | $UserLine = $DbResult->fetch_array();
|
---|
48 |
|
---|
49 | $Output .=
|
---|
50 | '<h3>Překladatel '.$UserLine['Name'].'</h3>'.
|
---|
51 | 'Výchozí jazyk: <strong>'.$UserLine['LanguageName'].'</strong><br />'.
|
---|
52 | 'Výchozí verze klienta: <strong>'.$UserLine['Version'].'</strong><br />'.
|
---|
53 | 'Poslední připojení: <strong>'.$UserLine['LastLogin'].'</strong><br />'.
|
---|
54 | 'Počet přeložených: <a href="TranslationList.php?user='.$UserLine['ID'].'&state=2&group=0" title="Zobrazit Všechny jeho přeložené texty"><strong>'.$UserLine['TranslatedCount'].'</strong></a><br />';
|
---|
55 | if($UserLine['TeamName'] != '')
|
---|
56 | $Output .= 'Člen týmu: <a href="team.php?action=team&id='.$UserLine['Team'].'"><strong>'.$UserLine['TeamName'].'</strong></a><br />';
|
---|
57 | $Output .= '<fieldset><legend>Text profilu:</legend>'.str_replace("\n", '<br/>', $UserLine['Info']).'</fieldset><br/>';
|
---|
58 |
|
---|
59 | if($User->Licence(LICENCE_MODERATOR))
|
---|
60 | {
|
---|
61 | $Output .= '<fieldset><legend>Moderování</legend>';
|
---|
62 | $Output .= 'Poslední IP: <strong>'.$UserLine['LastIP'].'</strong><br />'.
|
---|
63 | 'Prohlížeč: <strong>'.$UserLine['UserAgent'].'</strong><br />'.
|
---|
64 | 'Email: <strong>'.$UserLine['Email'].'</strong><br />';
|
---|
65 | $Output .= '<br/><form action="user.php" method="post"><div>'.
|
---|
66 | 'Napsat E-mail:'.
|
---|
67 | '<input type="text" name="email" value="'.$UserLine['Email'].'" /><br/>'.
|
---|
68 | 'Předmět:'.
|
---|
69 | '<input type="text" name="subject" value="'.$Config['Web']['Title'].'" />'.
|
---|
70 | '<br />'.
|
---|
71 | '<textarea name="text" rows="20" cols="62">'.
|
---|
72 | ''."\n".
|
---|
73 | 'S pozdravem '.$User->Name."\n".
|
---|
74 | '--------------------------------------------------------'."\n".
|
---|
75 | $Config['Web']['Title'].' '.$Config['Web']['Host'].$this->System->Link('/')."\n".
|
---|
76 | '</textarea><br/>'.
|
---|
77 | '<input type="submit" value="Odeslat" />'.
|
---|
78 | '</div></form></fieldset>';
|
---|
79 | }
|
---|
80 | } else $Output .= ShowMessage('Uživatel nenalezen', MESSAGE_CRITICAL);
|
---|
81 | return($Output);
|
---|
82 | }
|
---|
83 |
|
---|
84 | function Show()
|
---|
85 | {
|
---|
86 | global $Config, $User;
|
---|
87 |
|
---|
88 | $Output = $this->SendMail();
|
---|
89 | if(array_key_exists('user', $_GET))
|
---|
90 | {
|
---|
91 | $Output .= $this->ShowProfile();
|
---|
92 | } else $Output .= ShowMessage('Nevybrán uživatel', MESSAGE_CRITICAL);
|
---|
93 | return($Output);
|
---|
94 | }
|
---|
95 | }
|
---|