Changeset 547
- Timestamp:
- Jun 18, 2013, 6:58:22 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
- 5 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/AoWoW/AoWoW.php
r545 r547 1 1 <?php 2 2 3 class AoWoW extends AppModule3 class ModuleAoWoW extends AppModule 4 4 { 5 5 function __construct($System) -
trunk/Modules/FrontPage/FrontPage.php
r545 r547 1 1 <?php 2 2 3 class FrontPage extends AppModule3 class ModuleFrontPage extends AppModule 4 4 { 5 5 function __construct($System) … … 36 36 function ShowShoutbox() 37 37 { 38 global $ System, $Config, $User, $System;38 global $Config; 39 39 40 $Output = '<strong><a href="'.$System->Link('/action.php?action=ShoutBoxView').'">Kecátko:</a></strong>'; 41 if($User->Licence(LICENCE_USER)) 42 $Output .= ' <a href="'.$System->Link('/action.php?action=shoutbox').'">Vložit</a>'; 40 $Output = '<strong><a href="'.$this->System->Link('/action.php?action=ShoutBoxView').'">Kecátko:</a></strong>'; 41 42 if($this->System->User->Licence(LICENCE_USER)) 43 $Output .= ' <a href="'.$this->System->Link('/action.php?action=shoutbox').'">Vložit</a>'; 43 44 $Output .= '<div class="box"><table>'; 44 $DbResult = $ System->Database->query('SELECT * FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 30');45 $DbResult = $this->Database->query('SELECT * FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 30'); 45 46 while($Line = $DbResult->fetch_assoc()) 46 47 $Output .= '<tr><td><strong>'.$Line['UserName'].'</strong>: '.MakeActiveLinks($Line['Text']).'</td></tr>'; -
trunk/Modules/Referrer/Referrer.php
r545 r547 1 1 <?php 2 2 3 class Referrer extends AppModule3 class ModuleReferrer extends AppModule 4 4 { 5 5 var $Excludes; -
trunk/Modules/Team/Team.php
r546 r547 1 1 <?php 2 2 3 class Team extends AppModule3 class ModuleTeam extends AppModule 4 4 { 5 5 function __construct($System) -
trunk/Modules/User/Options.php
r544 r547 1 1 <?php 2 include('includes/global.php');3 2 4 function UserOptionsFrom() 3 class PageUserOptions extends Page 5 4 { 6 global $User, $System; 7 8 $Output = '<form action="Options.php?action=save" method="post"> 9 <fieldset><legend>Nastavení uživatele</legend> 10 <table> 11 <tr><td>Email:</td><td><input type="text" name="Email" value="'.$User->Email.'" /></td></tr> 12 <tr><td>Původní heslo:</td><td><input type="password" name="OldPass" /></td></tr> 13 <tr><td>Nové heslo:</td><td><input type="password" name="NewPass" /></td></tr> 14 <tr><td>Nové heslo pro potvrzení: </td><td><input type="password" name="NewPass2" /></td></tr> 15 <tr><td>Normálně budu překládat do: </td><td>'.WriteLanguages($User->Language).'</td></tr> 16 <tr><td>Po uložení překladu přesměrovat: </td><td>'; 17 $Output .= '<select name="redirecting">'. 18 '<option value="0">Nikam</option>'. 19 '<option value="1"'; 20 if($User->Redirecting == '1') $Output .= ' selected="selected"'; 21 $Output .= '>Na nepřeložené</option>'; 22 $Output .= '<option value="2"'; 23 if($User->Redirecting == '2') $Output .= ' selected="selected"'; 24 $Output .= '>Na další překlad</option>'; 25 $Output .= '<option value="3"'; 26 if($User->Redirecting == '3') $Output .= ' selected="selected"'; 27 $Output .= '>Na předchozí překlad</option>'; 28 $Output .= '</select>'; 29 30 $Output .= '</td></tr>'. 31 '<tr><td>Upřednostněná verze klienta: </td><td>'.ClientVersionSelection($User->PreferredVersion).'</td></tr>'. 32 '<tr><td>Veřejný text profilu:</td><td>'. 33 '<textarea name="info" cols="60" rows="10">'.$User->Info.'</textarea></td></tr>'. 34 '<tr><td colspan="2"><input type="submit" value="Uložit" /></td></tr>'. 35 '</table></fieldset>'. 36 '</form>'; 37 38 $Output .= ' <fieldset><legend>Překladatelský tým</legend>'; 39 $DbResult = $System->Database->query('SELECT `Id`, `Name` FROM `Team`'); 40 $Output .= '<a href="team.php?action=create">Vytvořit tým</a><br />'. 41 '<a href="team.php?action=leave">Opustit tým</a><br />'. 42 '<br /><form action="team.php" method="get">'. 43 '<input type="hidden" name="action" value="gointeam"/>'. 44 '<select name="id">'; 45 while($LineTeam = $DbResult->fetch_assoc()) 46 { 47 $Output .= '<option value="'.$LineTeam['Id'].'"'; 48 if ($LineTeam['Id'] == $User->Team) $Output .= ' selected="selected"'; 49 $Output .= '>'.$LineTeam['Name'].'</option>'; 50 } 51 $Output .= '</select> <input type="submit" value="Vstoupit" /> 52 </form>'; 53 $Output .= '</fieldset>'; 54 return($Output); 55 } 56 57 function UserOptionsSave() 58 { 59 global $System, $User; 5 function UserOptionsFrom() 6 { 7 global $User; 60 8 61 $Output = ''; 62 if(array_key_exists('Email', $_POST)) 9 $Output = '<form action="Options.php?action=save" method="post"> 10 <fieldset><legend>Nastavení uživatele</legend> 11 <table> 12 <tr><td>Email:</td><td><input type="text" name="Email" value="'.$User->Email.'" /></td></tr> 13 <tr><td>Původní heslo:</td><td><input type="password" name="OldPass" /></td></tr> 14 <tr><td>Nové heslo:</td><td><input type="password" name="NewPass" /></td></tr> 15 <tr><td>Nové heslo pro potvrzení: </td><td><input type="password" name="NewPass2" /></td></tr> 16 <tr><td>Normálně budu překládat do: </td><td>'.WriteLanguages($User->Language).'</td></tr> 17 <tr><td>Po uložení překladu přesměrovat: </td><td>'; 18 $Output .= '<select name="redirecting">'. 19 '<option value="0">Nikam</option>'. 20 '<option value="1"'; 21 if($User->Redirecting == '1') $Output .= ' selected="selected"'; 22 $Output .= '>Na nepřeložené</option>'; 23 $Output .= '<option value="2"'; 24 if($User->Redirecting == '2') $Output .= ' selected="selected"'; 25 $Output .= '>Na další překlad</option>'; 26 $Output .= '<option value="3"'; 27 if($User->Redirecting == '3') $Output .= ' selected="selected"'; 28 $Output .= '>Na předchozí překlad</option>'; 29 $Output .= '</select>'; 30 31 $Output .= '</td></tr>'. 32 '<tr><td>Upřednostněná verze klienta: </td><td>'.ClientVersionSelection($User->PreferredVersion).'</td></tr>'. 33 '<tr><td>Veřejný text profilu:</td><td>'. 34 '<textarea name="info" cols="60" rows="10">'.$User->Info.'</textarea></td></tr>'. 35 '<tr><td colspan="2"><input type="submit" value="Uložit" /></td></tr>'. 36 '</table></fieldset>'. 37 '</form>'; 38 39 $Output .= ' <fieldset><legend>Překladatelský tým</legend>'; 40 $DbResult = $this->Database->query('SELECT `Id`, `Name` FROM `Team`'); 41 $Output .= '<a href="team.php?action=create">Vytvořit tým</a><br />'. 42 '<a href="team.php?action=leave">Opustit tým</a><br />'. 43 '<br /><form action="team.php" method="get">'. 44 '<input type="hidden" name="action" value="gointeam"/>'. 45 '<select name="id">'; 46 while($LineTeam = $DbResult->fetch_assoc()) 47 { 48 $Output .= '<option value="'.$LineTeam['Id'].'"'; 49 if ($LineTeam['Id'] == $User->Team) $Output .= ' selected="selected"'; 50 $Output .= '>'.$LineTeam['Name'].'</option>'; 51 } 52 $Output .= '</select> <input type="submit" value="Vstoupit" /> 53 </form>'; 54 $Output .= '</fieldset>'; 55 return($Output); 56 } 57 58 function UserOptionsSave() 63 59 { 64 $Email = $_POST['Email']; 65 $OldPass = $_POST['OldPass']; 66 $NewPass = $_POST['NewPass']; 67 $NewPass2 = $_POST['NewPass2']; 68 $Language = $_POST['Language']; 69 $Redirecting = $_POST['redirecting']; 70 $PreferredVersion = $_POST['ClientVersion']; 71 if($PreferredVersion == '') $PreferredVersion = null; 72 $Info = $_POST['info']; 60 global $User; 73 61 74 // Do user want to change password? 75 if(($OldPass != '') or ($NewPass != '') or ($NewPass2 != '')) 76 { 77 if($NewPass == $NewPass2) 78 { 79 $DbResult = $System->Database->query('SELECT `Pass`, '.$User->CryptPasswordSQL('"'.$OldPass.'"', '`Salt`').' AS `Hash` FROM `User` WHERE `ID`= '.$User->Id); 80 $DbRow = $DbResult->fetch_assoc(); 81 if($DbRow['Hash'] == $DbRow['Pass']) 82 { 83 // Update password 84 $Salt = $User->GetPasswordSalt(); 85 $System->Database->query('UPDATE `User` SET `Pass` = '.$User->CryptPasswordSQL('"'.$NewPass.'"', '"'.$Salt.'"').', `Salt`="'.$Salt.'" WHERE `ID` = '.$User->Id); 86 $Output .= ShowMessage('Heslo změněno.'); 87 } else $Output .= ShowMessage('Staré heslo neodpovídá.', MESSAGE_CRITICAL); 88 } else $Output .= ShowMessage('Hesla se neshodují.', MESSAGE_CRITICAL); 89 } 90 $System->Database->update('User', '`ID` = '.$User->Id, array('Email' => $Email, 91 'Language' => $Language, 'Redirecting' => $Redirecting, 'Info' => $Info, 92 'PreferredVersion' => $PreferredVersion)); 93 $Output .= ShowMessage('Úprava nastavení proběhla v pořádku, Email: <b>'.$Email.'</b> Uživatel: <b>'.$User->Name.'</b>'); 94 WriteLog('Úprava nastavení!', LOG_TYPE_USER); 95 $User->Load(); 96 } else $Output .= ShowMessage('Nezadány údaje.', MESSAGE_CRITICAL); 97 return($Output); 98 } 99 100 $Output = ''; 101 if($User->Licence(LICENCE_USER)) 102 { 103 if(array_key_exists('action', $_GET) and ($_GET['action'] == 'save')) 104 { 105 $Output .= UserOptionsSave(); 106 } 107 $Output .= UserOptionsFrom(); 108 } else $Output .= ShowMessage('Nejste přihlášený.', MESSAGE_CRITICAL); 109 ShowPage($Output); 110 111 ?> 112 62 $Output = ''; 63 if(array_key_exists('Email', $_POST)) 64 { 65 $Email = $_POST['Email']; 66 $OldPass = $_POST['OldPass']; 67 $NewPass = $_POST['NewPass']; 68 $NewPass2 = $_POST['NewPass2']; 69 $Language = $_POST['Language']; 70 $Redirecting = $_POST['redirecting']; 71 $PreferredVersion = $_POST['ClientVersion']; 72 if($PreferredVersion == '') $PreferredVersion = null; 73 $Info = $_POST['info']; 74 75 // Do user want to change password? 76 if(($OldPass != '') or ($NewPass != '') or ($NewPass2 != '')) 77 { 78 if($NewPass == $NewPass2) 79 { 80 $DbResult = $System->Database->query('SELECT `Pass`, '.$User->CryptPasswordSQL('"'.$OldPass.'"', '`Salt`').' AS `Hash` FROM `User` WHERE `ID`= '.$User->Id); 81 $DbRow = $DbResult->fetch_assoc(); 82 if($DbRow['Hash'] == $DbRow['Pass']) 83 { 84 // Update password 85 $Salt = $User->GetPasswordSalt(); 86 $this->Database->query('UPDATE `User` SET `Pass` = '.$User->CryptPasswordSQL('"'.$NewPass.'"', '"'.$Salt.'"').', `Salt`="'.$Salt.'" WHERE `ID` = '.$User->Id); 87 $Output .= ShowMessage('Heslo změněno.'); 88 } else $Output .= ShowMessage('Staré heslo neodpovídá.', MESSAGE_CRITICAL); 89 } else $Output .= ShowMessage('Hesla se neshodují.', MESSAGE_CRITICAL); 90 } 91 $this->Database->update('User', '`ID` = '.$User->Id, array('Email' => $Email, 92 'Language' => $Language, 'Redirecting' => $Redirecting, 'Info' => $Info, 93 'PreferredVersion' => $PreferredVersion)); 94 $Output .= ShowMessage('Úprava nastavení proběhla v pořádku, Email: <b>'.$Email.'</b> Uživatel: <b>'.$User->Name.'</b>'); 95 WriteLog('Úprava nastavení!', LOG_TYPE_USER); 96 $User->Load(); 97 } else $Output .= ShowMessage('Nezadány údaje.', MESSAGE_CRITICAL); 98 return($Output); 99 } 100 101 function Show() 102 { 103 $Output = ''; 104 if($this->System->User->Licence(LICENCE_USER)) 105 { 106 if(array_key_exists('action', $_GET) and ($_GET['action'] == 'save')) 107 { 108 $Output .= $this->UserOptionsSave(); 109 } 110 $Output .= $this->UserOptionsFrom(); 111 } else $Output .= ShowMessage('Nejste přihlášený.', MESSAGE_CRITICAL); 112 return($Output); 113 } 114 } -
trunk/Modules/User/Profile.php
r544 r547 1 1 <?php 2 2 3 include('includes/global.php'); 4 5 $Output = ''; 6 if(array_key_exists('text', $_POST) and $User->Licence(LICENCE_ADMIN)) 3 class PageUserProfile extends Page 7 4 { 8 $Text = $_POST['text']; 9 $Email = $_POST['email']; 10 $Subject = $_POST['subject']; 11 $Output = 'Email: <strong>'.$Email.'</strong><br />'. 12 'Předmět: <strong>'.$Subject.'</strong><br />'. 13 'Text: <strong>'.$Text.'</strong><br />'; 14 15 if(@mail($Email, $Subject, $Text, 'From: '.$Config['Web']['AdminEmail'].'\nReply-To: '.$Config['Web']['AdminEmail'].'\nX-Mailer: PHP/')) 16 { 17 $Output .= ShowMessage('Zpráva byla odeslána.'); 18 } 19 else $Output .= ShowMessage('Nepodařilo se odesat E-mail.', MESSAGE_CRITICAL); 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']; 44 $DbResult = $this->Database->query($Query); 45 $UserLine = $DbResult->fetch_array(); 46 47 $Output .= 48 '<h3>Překladatel '.$UserLine['Name'].'</h3>'. 49 'Výchozí jazyk: <strong>'.$UserLine['LanguageName'].'</strong><br />'. 50 'Výchozí verze klienta: <strong>'.$UserLine['Version'].'</strong><br />'. 51 'Poslední připojení: <strong>'.$UserLine['LastLogin'].'</strong><br />'. 52 '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 />'; 53 if($UserLine['TeamName'] != '') 54 $Output .= 'Člen týmu: <a href="team.php?action=team&id='.$UserLine['Team'].'"><strong>'.$UserLine['TeamName'].'</strong></a><br />'; 55 $Output .= '<fieldset><legend>Text profilu:</legend>'.str_replace("\n", '<br/>', $UserLine['Info']).'</fieldset><br/>'; 56 57 if($User->Licence(LICENCE_MODERATOR)) 58 { 59 $Output .= '<fieldset><legend>Moderování</legend>'; 60 $Output .= 'Poslední IP: <strong>'.$UserLine['LastIP'].'</strong><br />'. 61 'Prohlížeč: <strong>'.$UserLine['UserAgent'].'</strong><br />'. 62 'Email: <strong>'.$UserLine['Email'].'</strong><br />'; 63 $Output .= '<br/><form action="user.php" method="post"><div>'. 64 'Napsat E-mail:'. 65 '<input type="text" name="email" value="'.$UserLine['Email'].'" /><br/>'. 66 'Předmět:'. 67 '<input type="text" name="subject" value="'.$Config['Web']['Title'].'" />'. 68 '<br />'. 69 '<textarea name="text" rows="20" cols="62">'. 70 ''."\n". 71 'S pozdravem '.$User->Name."\n". 72 '--------------------------------------------------------'."\n". 73 $Config['Web']['Title'].' '.$Config['Web']['Host'].$this->System->Link('/')."\n". 74 '</textarea><br/>'. 75 '<input type="submit" value="Odeslat" />'. 76 '</div></form></fieldset>'; 77 } 78 return($Output); 79 } 80 81 function Show() 82 { 83 global $Config, $User; 84 85 $Output = $this->SendMail(); 86 if(array_key_exists('user', $_GET)) 87 { 88 $Output .= $this->ShowProfile(); 89 } else $Output .= ShowMessage('Nevybrán uživatel', MESSAGE_CRITICAL); 90 return($Output); 91 } 20 92 } 21 22 function ShowProfile()23 {24 global $System, $User, $Config;25 26 $Output = '';27 $Query = 'SELECT `User`.`Name`, `UserTrace`.`LastLogin`, `UserTrace`.`LastIP`, '.28 '`User`.`Email`, `UserTrace`.`UserAgent`, '.29 '`User`.`TranslatedCount`, `User`.`Team`, `User`.`ID`, `User`.`Info`, '.30 '`Team`.`Name` AS `TeamName`, `Language`.`Name` AS `LanguageName`, '.31 '`ClientVersion`.`Version` AS `Version` FROM `User` '.32 'LEFT JOIN `UserTrace` ON `UserTrace`.`User` = `User`.`Id` '.33 'LEFT JOIN `Language` ON `Language`.`Id` = `User`.`Language` '.34 'LEFT JOIN `Team` ON `Team`.`Id` = `User`.`Team` '.35 'LEFT JOIN `ClientVersion` ON `ClientVersion`.`Id` = `User`.`PreferredVersion` '.36 'WHERE `User`.`Id` = '.$_GET['user'];37 $DbResult = $System->Database->query($Query);38 $UserLine = $DbResult->fetch_array();39 40 $Output .=41 '<h3>Překladatel '.$UserLine['Name'].'</h3>'.42 'Výchozí jazyk: <strong>'.$UserLine['LanguageName'].'</strong><br />'.43 'Výchozí verze klienta: <strong>'.$UserLine['Version'].'</strong><br />'.44 'Poslední připojení: <strong>'.$UserLine['LastLogin'].'</strong><br />'.45 '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 />';46 if($UserLine['TeamName'] != '')47 $Output .= 'Člen týmu: <a href="team.php?action=team&id='.$UserLine['Team'].'"><strong>'.$UserLine['TeamName'].'</strong></a><br />';48 $Output .= '<fieldset><legend>Text profilu:</legend>'.str_replace("\n", '<br/>', $UserLine['Info']).'</fieldset><br/>';49 50 if($User->Licence(LICENCE_MODERATOR))51 {52 $Output .= '<fieldset><legend>Moderování</legend>';53 $Output .= 'Poslední IP: <strong>'.$UserLine['LastIP'].'</strong><br />'.54 'Prohlížeč: <strong>'.$UserLine['UserAgent'].'</strong><br />'.55 'Email: <strong>'.$UserLine['Email'].'</strong><br />';56 $Output .= '<br/><form action="user.php" method="post"><div>'.57 'Napsat E-mail:'.58 '<input type="text" name="email" value="'.$UserLine['Email'].'" /><br/>'.59 'Předmět:'.60 '<input type="text" name="subject" value="'.$Config['Web']['Title'].'" />'.61 '<br />'.62 '<textarea name="text" rows="20" cols="62">'.63 ''."\n".64 'S pozdravem '.$User->Name."\n".65 '--------------------------------------------------------'."\n".66 $Config['Web']['Title'].' '.$Config['Web']['Host'].$System->Link('/')."\n".67 '</textarea><br/>'.68 '<input type="submit" value="Odeslat" />'.69 '</div></form></fieldset>';70 }71 return($Output);72 }73 74 if(array_key_exists('user', $_GET))75 {76 $Output .= ShowProfile();77 } else $Output .= ShowMessage('Nevybrán uživatel', MESSAGE_CRITICAL);78 79 ShowPage($Output);80 81 ?> -
trunk/Modules/User/Registration.php
r544 r547 1 1 <?php 2 2 3 include('includes/global.php'); 4 5 function ShowForm() 3 class PageUserRegistration extends Page 6 4 { 7 global $System; 8 9 if(array_key_exists('sc', $_POST)) $Human = true; 10 else $Human = false; 11 if(array_key_exists('user', $_POST)) $UserName = $_POST['user']; 12 else $UserName = ''; 13 if(array_key_exists('Email', $_POST)) $Email = $_POST['Email']; 14 else $Email = ''; 15 if(array_key_exists('Team', $_POST)) $Team = $_POST['Team']; 16 else $Team = ''; 17 if(array_key_exists('Language', $_POST)) $Language = $_POST['Language']; 18 else $Language = 1; 19 20 $Output = '<form action="?" method="post"> 21 <fieldset><legend>Registrace nového uživatele</legend> 22 <table> 23 <tr><td colspan="2">Pozorně si přečtěte <a href="info.php">pokyny k překladu</a> a řiďte se jimi. Překládat je nutno včetně háčků a čárek!<br/><br/></td></tr> 24 <tr> 25 <td>Jsi člověk? </td>'; 26 if($Human) $Checked = ' checked="checked"'; 27 else $Checked = ''; 28 $Output .= '<td><input type="checkbox" name="sc" '.$Checked.'/></td> 29 </tr> 30 <tr> 31 <td>Jméno:</td> 32 <td><input type="text" name="user" value="'.$UserName.'"/></td> 33 </tr> 34 <tr> 35 <td>Heslo:</td> 36 <td><input type="password" name="pass" /></td> 37 </tr> 38 <tr> 39 <td>Potvrzení Hesla: </td> 40 <td><input type="password" name="pass2" /></td> 41 </tr> 42 <tr> 43 <td>Email: </td> 44 <td><input type="text" name="Email" value="'.$Email.'"/></td> 45 </tr> 46 <tr> 47 <td>Normálně budu překládat do: </td> 48 <td>'.WriteLanguages($Language).'</td> 49 </tr> 50 <tr> 51 <td>Patřím do týmu: </td>'; 52 if($Team == '') $Selected = ' selected="selected"'; 53 else $Selected = ''; 54 $Output .= '<td><select name="Team"><option value="0"'.$Selected.'>Žádného</option> 55 '; 56 $DbResult = $System->Database->query('SELECT `Name`, `Id` FROM `Team`'); 57 while($Line = $DbResult->fetch_assoc()) 58 { 59 if($Team == $Line['Id']) $Selected = ' selected="selected"'; 60 else $Selected = ''; 61 $Output .= '<option value="0'.$Line['Id'].'"'.$Selected.'>'.$Line['Name'].'</option>'; 62 } 63 $Output .= '</select></td> 64 </tr>'; 65 $Output .= '</td></tr>'. 66 '<tr><td>Upřednostněná verze klienta: </td><td>'.ClientVersionSelection('').'</td></tr>'; 67 $Output .= '<tr> 68 <th><input type="submit" value="Registrovat" /></th> 69 </tr> 70 </table></fieldset></form>'; 71 return($Output); 72 } 73 74 75 $Output = ''; 76 if(array_key_exists('user', $_POST)) 77 { 78 $ShowForm = true; 79 80 $UserName = $_POST['user']; 81 $Pass = $_POST['pass']; 82 $Pass2 = $_POST['pass2']; 83 $Email = $_POST['Email']; 84 $Team = $_POST['Team']; 85 $Language = $_POST['Language']; 86 $PreferredVersion = $_POST['ClientVersion']; 87 if($PreferredVersion == '') $PreferredVersion = 'NULL'; 88 if(array_key_exists('sc', $_POST)) $SpamCheck = $_POST['sc']; 89 else $SpamCheck = ''; 90 91 if($SpamCheck != '') 92 { 93 if(($UserName != '') and ($Pass != '') and ($Pass2 != '')) 94 { 95 if(!in_array(strtolower($UserName), $Config['ForbiddedUserNames'])) 96 { 97 if($Pass == $Pass2) 98 { 99 $DbResult = $System->Database->query('SELECT * FROM `User` WHERE LOWER(`Name`) = LOWER("'.$UserName.'")'); 100 $Line = $DbResult->fetch_row(); 101 if(!$Line) 102 { 103 if($Team == 0) $Team = 'NULL'; 104 $User->Register($UserName, $Pass, $Email, $Language, $Team, $PreferredVersion); 105 $Output .= ShowMessage('Registrace proběhla úspěšně.'); 106 $Output .= 'Přečtěte si pozorně <a href="'.$System->Link('/info.php').'">pokyny pro překladání</a> a můžete pak hned začít překládat.'; 107 $User->Login($UserName, $Pass); 108 WriteLog('Uživatel se zaregistroval: '.$UserName, LOG_TYPE_USER); 109 $ShowForm = false; 110 } else $Output = ShowMessage('Uživatel se zadanou přezdívkou již existuje.', MESSAGE_CRITICAL); 111 } else $Output = ShowMessage('Hesla se neshodují.', MESSAGE_CRITICAL); 112 } else $Output = ShowMessage('To jméno uživatele nemůžete použít.', MESSAGE_CRITICAL); 113 } else $Output = ShowMessage('Nelze použít prázdné jméno nebo heslo.', MESSAGE_CRITICAL); 114 } else $Output = ShowMessage('Nejsi člověk. Strojům není dovoleno se registrovat.', MESSAGE_CRITICAL); 115 116 if($ShowForm) $Output .= ShowForm(); 117 } else $Output .= ShowForm(); 118 119 ShowPage($Output); 120 121 ?> 5 function ShowForm() 6 { 7 global $System; 8 9 if(array_key_exists('sc', $_POST)) $Human = true; 10 else $Human = false; 11 if(array_key_exists('user', $_POST)) $UserName = $_POST['user']; 12 else $UserName = ''; 13 if(array_key_exists('Email', $_POST)) $Email = $_POST['Email']; 14 else $Email = ''; 15 if(array_key_exists('Team', $_POST)) $Team = $_POST['Team']; 16 else $Team = ''; 17 if(array_key_exists('Language', $_POST)) $Language = $_POST['Language']; 18 else $Language = 1; 19 20 $Output = '<form action="?" method="post"> 21 <fieldset><legend>Registrace nového uživatele</legend> 22 <table> 23 <tr><td colspan="2">Pozorně si přečtěte <a href="info.php">pokyny k překladu</a> a řiďte se jimi. Překládat je nutno včetně háčků a čárek!<br/><br/></td></tr> 24 <tr> 25 <td>Jsi člověk? </td>'; 26 if($Human) $Checked = ' checked="checked"'; 27 else $Checked = ''; 28 $Output .= '<td><input type="checkbox" name="sc" '.$Checked.'/></td> 29 </tr> 30 <tr> 31 <td>Jméno:</td> 32 <td><input type="text" name="user" value="'.$UserName.'"/></td> 33 </tr> 34 <tr> 35 <td>Heslo:</td> 36 <td><input type="password" name="pass" /></td> 37 </tr> 38 <tr> 39 <td>Potvrzení Hesla: </td> 40 <td><input type="password" name="pass2" /></td> 41 </tr> 42 <tr> 43 <td>Email: </td> 44 <td><input type="text" name="Email" value="'.$Email.'"/></td> 45 </tr> 46 <tr> 47 <td>Normálně budu překládat do: </td> 48 <td>'.WriteLanguages($Language).'</td> 49 </tr> 50 <tr> 51 <td>Patřím do týmu: </td>'; 52 if($Team == '') $Selected = ' selected="selected"'; 53 else $Selected = ''; 54 $Output .= '<td><select name="Team"><option value="0"'.$Selected.'>Žádného</option> 55 '; 56 $DbResult = $this->Database->query('SELECT `Name`, `Id` FROM `Team`'); 57 while($Line = $DbResult->fetch_assoc()) 58 { 59 if($Team == $Line['Id']) $Selected = ' selected="selected"'; 60 else $Selected = ''; 61 $Output .= '<option value="0'.$Line['Id'].'"'.$Selected.'>'.$Line['Name'].'</option>'; 62 } 63 $Output .= '</select></td> 64 </tr>'; 65 $Output .= '</td></tr>'. 66 '<tr><td>Upřednostněná verze klienta: </td><td>'.ClientVersionSelection('').'</td></tr>'; 67 $Output .= '<tr> 68 <th><input type="submit" value="Registrovat" /></th> 69 </tr> 70 </table></fieldset></form>'; 71 return($Output); 72 } 73 74 function Show() 75 { 76 global $User, $Config; 77 78 $Output = ''; 79 if(array_key_exists('user', $_POST)) 80 { 81 $ShowForm = true; 82 83 $UserName = $_POST['user']; 84 $Pass = $_POST['pass']; 85 $Pass2 = $_POST['pass2']; 86 $Email = $_POST['Email']; 87 $Team = $_POST['Team']; 88 $Language = $_POST['Language']; 89 $PreferredVersion = $_POST['ClientVersion']; 90 if($PreferredVersion == '') $PreferredVersion = 'NULL'; 91 if(array_key_exists('sc', $_POST)) $SpamCheck = $_POST['sc']; 92 else $SpamCheck = ''; 93 94 if($SpamCheck != '') 95 { 96 if(($UserName != '') and ($Pass != '') and ($Pass2 != '')) 97 { 98 if(!in_array(strtolower($UserName), $Config['ForbiddedUserNames'])) 99 { 100 if($Pass == $Pass2) 101 { 102 $DbResult = $this->Database->query('SELECT * FROM `User` WHERE LOWER(`Name`) = LOWER("'.$UserName.'")'); 103 $Line = $DbResult->fetch_row(); 104 if(!$Line) 105 { 106 if($Team == 0) $Team = 'NULL'; 107 $User->Register($UserName, $Pass, $Email, $Language, $Team, $PreferredVersion); 108 $Output .= ShowMessage('Registrace proběhla úspěšně.'); 109 $Output .= 'Přečtěte si pozorně <a href="'.$this->System->Link('/info.php').'">pokyny pro překladání</a> a můžete pak hned začít překládat.'; 110 $User->Login($UserName, $Pass); 111 WriteLog('Uživatel se zaregistroval: '.$UserName, LOG_TYPE_USER); 112 $ShowForm = false; 113 } else $Output = ShowMessage('Uživatel se zadanou přezdívkou již existuje.', MESSAGE_CRITICAL); 114 } else $Output = ShowMessage('Hesla se neshodují.', MESSAGE_CRITICAL); 115 } else $Output = ShowMessage('To jméno uživatele nemůžete použít.', MESSAGE_CRITICAL); 116 } else $Output = ShowMessage('Nelze použít prázdné jméno nebo heslo.', MESSAGE_CRITICAL); 117 } else $Output = ShowMessage('Nejsi člověk. Strojům není dovoleno se registrovat.', MESSAGE_CRITICAL); 118 119 if($ShowForm) $Output .= $this->ShowForm(); 120 } else $Output .= $this->ShowForm(); 121 return($Output); 122 } 123 } -
trunk/Modules/User/User.php
r544 r547 1 1 <?php 2 3 include_once(dirname(__FILE__).'/UserList.php'); 4 include_once(dirname(__FILE__).'/Options.php'); 5 include_once(dirname(__FILE__).'/Registration.php'); 6 include_once(dirname(__FILE__).'/Profile.php'); 7 8 class ModuleUser extends AppModule 9 { 10 function __construct($System) 11 { 12 parent::__construct($System); 13 $this->Name = 'User'; 14 $this->Version = '1.0'; 15 $this->Creator = 'Chronos'; 16 $this->License = 'GNU/GPL'; 17 $this->Description = 'User and permission management'; 18 $this->Dependencies = array(); 19 } 20 21 function Start() 22 { 23 $this->System->User = new User($this->System); 24 $this->System->RegisterPage('userlist.php', 'PageUserList'); 25 $this->System->RegisterPage('Options.php', 'PageUserOptions'); 26 $this->System->RegisterPage('registrace.php', 'PageUserRegistration'); 27 $this->System->RegisterPage('user.php', 'PageUserProfile'); 28 } 29 } 2 30 3 31 // User licence levels … … 138 166 } 139 167 } 140 141 ?> -
trunk/Modules/User/UserList.php
r544 r547 1 1 <?php 2 2 3 include('includes/global.php'); 3 4 4 include_once('img_level.php'); 5 5 6 ImgLevelUpdate(); 7 8 $Output = ''; 9 if(array_key_exists('search', $_GET)) 6 class PageUserList extends Page 10 7 { 11 $_SESSION['Where'] = ' WHERE `User`.`Name` LIKE "%'.$_GET['search'].'%"'; 8 function Show() 9 { 10 ImgLevelUpdate(); 11 12 $Output = ''; 13 if(array_key_exists('search', $_GET)) 14 { 15 $_SESSION['Where'] = ' WHERE `User`.`Name` LIKE "%'.$_GET['search'].'%"'; 16 } 17 if(array_key_exists('team', $_GET)) 18 { 19 $DbResult = $this->Database->select('Team', 'Name', 'Id='.$_GET['team']); 20 if($DbResult->num_rows > 0) 21 { 22 $Team = $DbResult->fetch_assoc(); 23 $Output .= '<h3>Seznam uživatelů v týmu '.$Team['Name'].'</h3>'; 24 $_SESSION['Where'] = ' WHERE `Team`='.$_GET['team']; 25 if($_GET['team'] == '') $_SESSION['Where'] = ''; 26 } else { 27 $Output .= ShowMessage('Tým '.$_GET['team'].' nenalezen', MESSAGE_CRITICAL); 28 $_SESSION['Where'] = ' WHERE FALSE'; 29 } 30 } else 31 { 32 $Output .= '<h3>Seznam uživatelů</h3>'; 33 if(!array_key_exists('Where', $_SESSION)) $_SESSION['Where'] = ''; 34 } 35 36 if(array_key_exists('action', $_GET)) 37 { 38 if($_GET['action'] == 'nofilter') $_SESSION['Where'] = ''; 39 } 40 //if($_SESSION['Where'] <> '') $Output .= ' <a href="?action=nofilter">Zrušit filtr uživatelů</a><br />'; 41 42 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `User`'.$_SESSION['Where']); 43 $DbRow = $DbResult->fetch_row(); 44 $PageList = GetPageList($DbRow[0]); 45 46 $Output .= $PageList['Output']. 47 '<table class="BaseTable">'; 48 49 $TableColumns = array( 50 array('Name' => 'Name', 'Title' => 'Jméno'), 51 array('Name' => 'TranslatedCount', 'Title' => 'Překladů'), 52 array('Name' => 'XP', 'Title' => 'Úroveň'), 53 array('Name' => 'XP', 'Title' => 'Zkušenost'), 54 //array('Name' => 'GM', 'Title' => 'Oprávnění'), 55 array('Name' => 'LastLogin', 'Title' => 'Naposledy přítomen'), 56 array('Name' => 'RegistrationTime', 'Title' => 'Čas registrace'), 57 ); 58 $Order = GetOrderTableHeader($TableColumns, 'TranslatedCount', 1); 59 $Output .= $Order['Output']; 60 61 62 $Query = 'SELECT `User`.`ID`, `User`.`Name`, `LastLogin`, `GM`, `XP`, `TranslatedCount`, `RegistrationTime` '. 63 'FROM `User` '. 64 'LEFT JOIN `UserTrace` ON `UserTrace`.`User` = `User`.`Id` '. 65 $_SESSION['Where'].$Order['SQL'].$PageList['SQLLimit']; 66 67 $DbResult = $this->Database->query($Query); 68 while($Line = $DbResult->fetch_assoc()) 69 { 70 $XP = GetLevelMinMax($Line['XP']); 71 $Output .= '<tr><td><a href="user.php?user='.$Line['ID'].'">'.$Line['Name'].'</a></td>'. 72 '<td style="text-align: center;"><a href="TranslationList.php?user='.$Line['ID'].'&group=0&state=2" title="Zobrazit Všechny jeho přeložené texty">'.$Line['TranslatedCount'].'</a></td>'. 73 '<td>'.$XP['Level'].'</td>'. 74 '<td>'.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'</td>'. 75 //<td>'.$Moderators[$Line['GM']].'</td> 76 '<td>'.HumanDate($Line['LastLogin']).'</td>'. 77 '<td>'.HumanDate($Line['RegistrationTime']).'</td></tr>'; 78 } 79 $Output .= '</table>'. 80 $PageList['Output']; 81 82 return($Output); 83 } 12 84 } 13 if(array_key_exists('team', $_GET))14 {15 $DbResult = $System->Database->select('Team', 'Name', 'Id='.$_GET['team']);16 if($DbResult->num_rows > 0)17 {18 $Team = $DbResult->fetch_assoc();19 $Output .= '<h3>Seznam uživatelů v týmu '.$Team['Name'].'</h3>';20 $_SESSION['Where'] = ' WHERE `Team`='.$_GET['team'];21 if($_GET['team'] == '') $_SESSION['Where'] = '';22 } else {23 $Output .= ShowMessage('Tým '.$_GET['team'].' nenalezen', MESSAGE_CRITICAL);24 $_SESSION['Where'] = ' WHERE FALSE';25 }26 } else27 {28 $Output .= '<h3>Seznam uživatelů</h3>';29 if(!array_key_exists('Where', $_SESSION)) $_SESSION['Where'] = '';30 }31 32 if(array_key_exists('action', $_GET))33 {34 if($_GET['action'] == 'nofilter') $_SESSION['Where'] = '';35 }36 //if($_SESSION['Where'] <> '') $Output .= ' <a href="?action=nofilter">Zrušit filtr uživatelů</a><br />';37 38 $DbResult = $System->Database->query('SELECT COUNT(*) FROM `User`'.$_SESSION['Where']);39 $DbRow = $DbResult->fetch_row();40 $PageList = GetPageList($DbRow[0]);41 42 $Output .= $PageList['Output'].43 '<table class="BaseTable">';44 45 $TableColumns = array(46 array('Name' => 'Name', 'Title' => 'Jméno'),47 array('Name' => 'TranslatedCount', 'Title' => 'Překladů'),48 array('Name' => 'XP', 'Title' => 'Úroveň'),49 array('Name' => 'XP', 'Title' => 'Zkušenost'),50 //array('Name' => 'GM', 'Title' => 'Oprávnění'),51 array('Name' => 'LastLogin', 'Title' => 'Naposledy přítomen'),52 array('Name' => 'RegistrationTime', 'Title' => 'Čas registrace'),53 );54 $Order = GetOrderTableHeader($TableColumns, 'TranslatedCount', 1);55 $Output .= $Order['Output'];56 57 58 $Query = 'SELECT `User`.`ID`, `User`.`Name`, `LastLogin`, `GM`, `XP`, `TranslatedCount`, `RegistrationTime` '.59 'FROM `User` '.60 'LEFT JOIN `UserTrace` ON `UserTrace`.`User` = `User`.`Id` '.61 $_SESSION['Where'].$Order['SQL'].$PageList['SQLLimit'];62 63 $DbResult = $System->Database->query($Query);64 while($Line = $DbResult->fetch_assoc())65 {66 $XP = GetLevelMinMax($Line['XP']);67 $Output .= '<tr><td><a href="user.php?user='.$Line['ID'].'">'.$Line['Name'].'</a></td>'.68 '<td style="text-align: center;"><a href="TranslationList.php?user='.$Line['ID'].'&group=0&state=2" title="Zobrazit Všechny jeho přeložené texty">'.$Line['TranslatedCount'].'</a></td>'.69 '<td>'.$XP['Level'].'</td>'.70 '<td>'.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'</td>'.71 //<td>'.$Moderators[$Line['GM']].'</td>72 '<td>'.HumanDate($Line['LastLogin']).'</td>'.73 '<td>'.HumanDate($Line['RegistrationTime']).'</td></tr>';74 }75 $Output .= '</table>'.76 $PageList['Output'];77 78 ShowPage($Output);79 80 ?> -
trunk/includes/Page.php
r545 r547 325 325 } 326 326 327 function FormatOutput($s) 328 { 329 $out = ''; 330 $nn = 0; 331 $n = 0; 332 while($s != '') 333 { 334 $start = strpos($s, '<'); 335 $end = strpos($s, '>'); 336 if($start != 0) 337 { 338 $end = $start - 1; 339 $start = 0; 340 } 341 $line = trim(substr($s, $start, $end + 1)); 342 if(strlen($line) > 0) 343 if($line[0] == '<') 344 { 345 if($s[$start + 1] == '/') 346 { 347 $n = $n - 2; 348 $nn = $n; 349 } else 350 { 351 if(strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1); 352 else $cmd = substr($line, 1, strlen($line) - 2); 353 //echo('['.$cmd.']'); 354 if(strpos($s, '</'.$cmd.'>')) $n = $n + 2; 355 } 356 }// else $line = '['.$line.']'; 357 //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n")); 358 if($line != '') $out .= (str_repeat(' ', $nn).$line."\n"); 359 $s = substr($s, $end + 1, strlen($s)); 360 $nn = $n; 361 } 362 return($out); 363 } 364 327 365 class Page 328 366 { -
trunk/includes/Version.php
r546 r547 1 1 <?php 2 2 3 $Revision = 54 6; // Subversion revision3 $Revision = 547; // Subversion revision 4 4 $DatabaseRevision = 543; // Database structure revision 5 5 $ReleaseTime = '2013-06-18'; -
trunk/includes/global.php
r546 r547 5 5 include_once(dirname(__FILE__).'/Update.php'); 6 6 include_once(dirname(__FILE__).'/rss.php'); 7 include_once(dirname(__FILE__).'/user.php');8 7 include_once(dirname(__FILE__).'/Page.php'); 9 8 include_once(dirname(__FILE__).'/error.php'); … … 19 18 include_once(dirname(__FILE__).'/../Modules/FrontPage/FrontPage.php'); 20 19 include_once(dirname(__FILE__).'/../Modules/Team/Team.php'); 20 include_once(dirname(__FILE__).'/../Modules/User/User.php'); 21 21 22 22 GlobalInit(); 23 $User = &$System->User; // Back compatibility 23 24 24 25 function GlobalInit() … … 53 54 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]); 54 55 55 $User = new User($System);56 57 56 set_error_handler('ErrorHandler'); 58 57 set_exception_handler('ExceptionHandler'); … … 62 61 63 62 // Initialize application modules 64 $System->ModuleManager->RegisterModule(new AoWoW($System)); 65 $System->ModuleManager->RegisterModule(new Referrer($System)); 63 $System->ModuleManager->RegisterModule(new ModuleUser($System)); 64 $System->ModuleManager->RegisterModule(new ModuleAoWoW($System)); 65 $System->ModuleManager->RegisterModule(new ModuleReferrer($System)); 66 66 $System->ModuleManager->Modules['Referrer']->Excluded[] = $System->Config['Web']['Host']; 67 $System->ModuleManager->RegisterModule(new FrontPage($System));68 $System->ModuleManager->RegisterModule(new Team($System));67 $System->ModuleManager->RegisterModule(new ModuleFrontPage($System)); 68 $System->ModuleManager->RegisterModule(new ModuleTeam($System)); 69 69 $System->ModuleManager->StartAll(); 70 70 } … … 265 265 'Direction' => $_SESSION['OrderDir'], 266 266 )); 267 }268 269 function FormatOutput($s)270 {271 $out = '';272 $nn = 0;273 $n = 0;274 while($s != '')275 {276 $start = strpos($s, '<');277 $end = strpos($s, '>');278 if($start != 0)279 {280 $end = $start - 1;281 $start = 0;282 }283 $line = trim(substr($s, $start, $end + 1));284 if(strlen($line) > 0)285 if($line[0] == '<')286 {287 if($s[$start + 1] == '/')288 {289 $n = $n - 2;290 $nn = $n;291 } else292 {293 if(strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1);294 else $cmd = substr($line, 1, strlen($line) - 2);295 //echo('['.$cmd.']');296 if(strpos($s, '</'.$cmd.'>')) $n = $n + 2;297 }298 }// else $line = '['.$line.']';299 //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n"));300 if($line != '') $out .= (str_repeat(' ', $nn).$line."\n");301 $s = substr($s, $end + 1, strlen($s));302 $nn = $n;303 }304 return($out);305 }306 307 function WriteLanguages($Selected)308 {309 global $System;310 311 $Output = '<select name="Language">';312 $DbResult = $System->Database->select('Language', '`Id`, `Name`', '`Enabled` = 1');313 while($Language = $DbResult->fetch_assoc())314 {315 $Output .= '<option value="'.$Language['Id'].'"';316 if($Selected == $Language['Id'])317 $Output .= ' selected="selected"';318 $Output .= '>'.$Language['Name'].'</option>';319 }320 $Output .= '</select>';321 return($Output);322 267 } 323 268 … … 751 696 } 752 697 698 function WriteLanguages($Selected) 699 { 700 global $System; 701 702 $Output = '<select name="Language">'; 703 $DbResult = $System->Database->select('Language', '`Id`, `Name`', '`Enabled` = 1'); 704 while($Language = $DbResult->fetch_assoc()) 705 { 706 $Output .= '<option value="'.$Language['Id'].'"'; 707 if($Selected == $Language['Id']) 708 $Output .= ' selected="selected"'; 709 $Output .= '>'.$Language['Name'].'</option>'; 710 } 711 $Output .= '</select>'; 712 return($Output); 713 } 714 715 753 716 ?>
Note:
See TracChangeset
for help on using the changeset viewer.