Changeset 539
- Timestamp:
- May 15, 2013, 12:44:32 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/UpdateTrace.php
r537 r539 2542 2542 } 2543 2543 2544 function UpdateTo539($Manager) 2545 { 2546 $Manager->Execute("CREATE TABLE IF NOT EXISTS `UserTrace` ( 2547 `Id` int(11) NOT NULL AUTO_INCREMENT, 2548 `User` int(11) NOT NULL, 2549 `LastLogin` datetime NOT NULL, 2550 `LastLogout` datetime NOT NULL, 2551 `LastIP` varchar(16) NOT NULL, 2552 `UserAgent` varchar(255) NOT NULL, 2553 PRIMARY KEY (`Id`), 2554 KEY `User` (`User`) 2555 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;"); 2556 $Manager->Execute("ALTER TABLE `UserTrace` 2557 ADD CONSTRAINT `UserTrace_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`ID`);"); 2558 $Manager->Execute("INSERT INTO `UserTrace` (". 2559 "SELECT NULL AS `Id` , `User`.`Id` AS `User` , `User`.`LastLogin` AS `LastLogin` , `User`.`LastLogout` AS `LastLogout` , `User`.`LastIP` AS `LastIP` , '' AS `UserAgent` ". 2560 "FROM `User` WHERE 1 ) "); 2561 $Manager->Execute("ALTER TABLE `User` DROP `LastIP`, DROP `LastLogin`, DROP `LastLogout`;"); 2562 } 2563 2544 2564 $Updates = array( 2545 2565 498 => array('Revision' => 506, 'Function' => 'UpdateTo506'), … … 2547 2567 510 => array('Revision' => 524, 'Function' => 'UpdateTo524'), 2548 2568 524 => array('Revision' => 537, 'Function' => 'UpdateTo537'), 2569 537 => array('Revision' => 539, 'Function' => 'UpdateTo539'), 2549 2570 ); 2550 2571 -
trunk/admin/index.php
r538 r539 85 85 } 86 86 87 function ShowPHPInfo() 88 { 89 return(phpinfo()); 90 } 91 87 92 function Testing() 88 93 { 89 94 global $System; 90 95 91 $Output = '<a href="'.$System->Link('/admin/?action=error').'">Testovací chyba</a><br/>'. 96 $Output = '<a href="'.$System->Link('/admin/?action=phpinfo').'">PHP info</a><br/>'. 97 '<small>PHP informace</small><br/><br/>'. 98 '<a href="'.$System->Link('/admin/?action=error').'">Testovací chyba</a><br/>'. 92 99 '<small>Vyvolá testovací chybu</small><br/><br/>'. 93 100 '<a href="'.$System->Link('/admin/?action=exception').'">Testovací výjimka</a><br/>'. … … 109 116 else if($_GET['action'] == 'sqlerror') $Output .= TestSQLError('SELECT dads FROM sdas'); 110 117 else if($_GET['action'] == 'testing') $Output .= Testing(); 118 else if($_GET['action'] == 'phpinfo') $Output .= ShowPHPInfo(); 111 119 else if($_GET['action'] == 'addnew') 112 120 { -
trunk/export/index.php
r526 r539 49 49 $Action = '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=0">Zobrazit</a> <a href="?Action=View&ExportId='.$Export['Id'].'&Tab=7">Exportovat</a>'; 50 50 if($Export['User'] == $User->Id) $Action .= ' <a href="?Action=Delete&ExportId='.$Export['Id'].'" onclick="return confirmAction(\'Opravdu smazat položku?\');">Smazat</a>'; 51 $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td><td>'.$Export['UserName'].'</td><td>'.$Export['Title'].'</td><td>'.$Export['OutputType'].'</td><td>'.$Export['ClientVersion'].'</td><td>'.$Export['UsedCount'].'</td><td>'.$Action.'</td></tr>'; 51 $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'. 52 '<td><a href="'.$System->Link('/user.php?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'. 53 '<td>'.$Export['Title'].'</td>'. 54 '<td>'.$Export['OutputType'].'</td>'. 55 '<td>'.$Export['ClientVersion'].'</td>'. 56 '<td>'.$Export['UsedCount'].'</td>'. 57 '<td>'.$Action.'</td></tr>'; 52 58 } 53 59 $Output .= '</table>'. -
trunk/includes/Page.php
r538 r539 259 259 260 260 $Output = 'Online překladatelé:<br />'; 261 $DbResult = $System->Database->query('SELECT `Name`, `GM`, `ID` FROM `User` WHERE `LastLogin` >= NOW() - 300 AND ((`LastLogout` < `LastLogin`) OR (ISNULL(`LastLogout`)))'); 261 $DbResult = $System->Database->query('SELECT `Name`, `GM`, `User`.`ID` AS `ID` FROM `User` '. 262 'LEFT JOIN `UserTrace` ON `UserTrace`.`User` = `User`.`Id` '. 263 'WHERE (`LastLogin` >= NOW() - 300) AND ((`LastLogout` < `LastLogin`) OR (ISNULL(`LastLogout`)))'); 262 264 while($DbUser = $DbResult->fetch_assoc()) 263 265 { -
trunk/includes/Version.php
r538 r539 1 1 <?php 2 2 3 $Revision = 53 8; // Subversion revision4 $DatabaseRevision = 53 7; // Database structure revision3 $Revision = 539; // Subversion revision 4 $DatabaseRevision = 539; // Database structure revision 5 5 $ReleaseTime = '2013-05-14'; 6 6 -
trunk/includes/user.php
r524 r539 46 46 { 47 47 if($this->Role != LICENCE_ANONYMOUS) 48 $this->System->Database->query('UPDATE `User` SET `LastLogout` = NOW() WHERE `ID` = '.$this->Id); 48 $this->System->Database->query('UPDATE `UserTrace` SET '. 49 '`LastLogout` = NOW() WHERE `User` = '.$this->Id); 49 50 $this->SetAnonymous(); 50 51 } … … 53 54 { 54 55 $DbResult = $this->System->Database->query('SELECT * FROM `User` WHERE `ID` = '.$this->Id); 55 $User = $DbResult->fetch_assoc(); 56 // Security: Password and Salt hash should not be loaded to variables 57 $this->Id = $User['ID']; 58 $this->Team = $User['Team']; 59 $this->Redirecting = $User['Redirecting']; 60 $this->Language = $User['Language']; 61 $this->Name = $User['Name']; 62 $this->Role = $User['GM']; 63 $this->Email = $User['Email']; 64 $this->Info = $User['Info']; 65 $this->PreferredVersion = $User['PreferredVersion']; 56 if($DbResult->num_rows > 0) 57 { 58 $User = $DbResult->fetch_assoc(); 59 // Security: Password and Salt hash should not be loaded to variables 60 $this->Id = $User['ID']; 61 $this->Team = $User['Team']; 62 $this->Redirecting = $User['Redirecting']; 63 $this->Language = $User['Language']; 64 $this->Name = $User['Name']; 65 $this->Role = $User['GM']; 66 $this->Email = $User['Email']; 67 $this->Info = $User['Info']; 68 $this->PreferredVersion = $User['PreferredVersion']; 69 } else $this->SetAnonymous(); 66 70 } 67 71 … … 113 117 function UpdateState() 114 118 { 115 if(array_key_exists('REMOTE_ADDR', $_SERVER)) 116 $this->System->Database->query('UPDATE `User` SET `LastIP` = "'.$_SERVER['REMOTE_ADDR'].'", `LastLogin` = NOW() WHERE `ID` = '.$this->Id); 119 if(array_key_exists('REMOTE_ADDR', $_SERVER) and ($this->Role != LICENCE_ANONYMOUS)) 120 $this->System->Database->query('UPDATE `UserTrace` SET '. 121 '`LastIP` = "'.$_SERVER['REMOTE_ADDR'].'", '. 122 '`LastLogin` = NOW(), '. 123 '`UserAgent` = "'.$this->System->Database->real_escape_string($_SERVER['HTTP_USER_AGENT']).'" '. 124 'WHERE `User` = '.$this->Id); 125 } 126 127 function Register($UserName, $Password, $Email, $Language, $Team, $PreferredVersion) 128 { 129 $Salt = $this->GetPasswordSalt(); 130 $this->System->Database->query('INSERT INTO `User` '. 131 '(`Name` , `Pass` , `Salt`, `Email` , `Language` , `Team` , `NeedUpdate`, `RegistrationTime`, `PreferredVersion` ) '. 132 'VALUES ("'.$UserName.'", '.$this->CryptPasswordSQL('"'.$Password.'"', '"'.$Salt.'"'). 133 ', "'.$Salt.'", "'.$Email.'", '.$Language.', '.$Team.', 1, NOW(), '.$PreferredVersion.')'); 134 $UserId = $this->System->Database->insert_id; 135 $this->System->Database->query('INSERT INTO `UserTrace` (`User`, `LastIP`, `UserAgent`) '. 136 'VALUES ('.$UserId.', "'.$_SERVER['REMOTE_ADDR'].'", '. 137 '"'.$this->System->Database->real_escape_string($_SERVER['HTTP_USER_AGENT']).'")'); 117 138 } 118 139 } -
trunk/registrace.php
r524 r539 101 101 if(!$Line) 102 102 { 103 $Salt = $User->GetPasswordSalt();104 103 if($Team == 0) $Team = 'NULL'; 105 $System->Database->query('INSERT INTO `User` (`Name` , `Pass` , `Salt`, `LastIP` , `LastLogin` , `Email` , `Language` , `Team` , `NeedUpdate`, `RegistrationTime`, `PreferredVersion` ) '. 106 'VALUES ("'.$UserName.'", '.$User->CryptPasswordSQL('"'.$Pass.'"', '"'.$Salt.'"').', "'.$Salt.'", "'.$_SERVER['REMOTE_ADDR'].'", NOW(), "'.$Email.'", '.$Language.', '.$Team.', 1, NOW(), '.$PreferredVersion.')'); 104 $User->Register($UserName, $Pass, $Email, $Language, $Team, $PreferredVersion); 107 105 $Output .= ShowMessage('Registrace proběhla úspěšně.'); 108 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.'; -
trunk/statistic.php
r536 r539 42 42 { 43 43 $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 44 ' SELECT `T`.`Id`, `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T`'. 45 ' WHERE (`Complete` = 1) '.$LanguageFilter.' AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'. 44 'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '. 45 'WHERE (`Complete` = 1) '.$LanguageFilter.' '. 46 'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'. 46 47 ') AS `C1`) AS `Translated`, '. 47 48 '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 48 ' SELECT `T`.`Id`, `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T`'. 49 ' WHERE (`Language` = '.$Config['OriginalLanguage'].') AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'. 49 'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '. 50 'WHERE (`Language` = '.$Config['OriginalLanguage'].') '. 51 'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'. 50 52 ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name` UNION '; 51 53 } -
trunk/team.php
r525 r539 39 39 '<td><a href="?action=team&id='.$Team['Id'].'">'.$Team['Name'].'</a></td>'. 40 40 '<td><a href="http://'.$Team['URL'].'">'.$Team['URL'].'</a></td>'. 41 '<td> '.$Team['LeaderName'].'</td>'.41 '<td><a href="'.$System->Link('/user.php?user='.$Team['Leader']).'">'.$Team['LeaderName'].'</a></td>'. 42 42 '<td><a href="userlist.php?team='.$Team['Id'].'" title="Zobrazit členy týmu">'.$Team['NumberUser'].'</a></td>'. 43 43 '<td>'.HumanDate($Team['TimeCreate']).'</td>'; … … 193 193 ImgLevelUpdate(); 194 194 195 $DbResult = $System->Database->query('SELECT *, (SELECT COUNT(*) FROM `User` WHERE `Team` = `Team`.`Id`) AS `NumberUser`, (SELECT SUM(`TranslatedCount`) FROM `User` WHERE `team` = `Team`.`Id`) AS `NumberTranslate` FROM `Team` WHERE `Id`='.$_GET['id']); 195 $DbResult = $System->Database->query('SELECT `Id`, `Name`, `Description`, `URL`, `Leader`, '. 196 '(SELECT COUNT(*) FROM `User` WHERE '. 197 '`Team` = `Team`.`Id`) AS `NumberUser`, (SELECT SUM(`TranslatedCount`) FROM `User` WHERE '. 198 '`Team` = `Team`.`Id`) AS `NumberTranslate` FROM '. 199 '`Team` WHERE `Id`='.($_GET['id'] * 1)); 196 200 if($DbResult->num_rows > 0) 197 201 { 198 202 $Team = $DbResult->fetch_assoc(); 199 $DbResult2 = $System->Database->query('SELECT `Name` FROM `User` WHERE `ID`='.$Team['Leader']);203 $DbResult2 = $System->Database->query('SELECT `Name`, `Id` FROM `User` WHERE `ID`='.$Team['Leader']); 200 204 if($DbResult2->num_rows > 0) 201 205 { 202 206 $Leader = $DbResult2->fetch_assoc(); 203 $Leader = $Leader['Name']; 204 } else $Leader = ''; 207 } else $Leader = array('Name' => '', 'Id' => 0); 205 208 206 209 $Output .='<strong>Překladatelský tým '.$Team['Name'].'</strong><br />'. 207 210 'Webové stránky: <a href="http://'.$Team['URL'].'">'.$Team['URL'].'</a><br/>'. 208 'Vedoucí: < strong>'.$Leader.'</strong><br/>'.211 'Vedoucí: <a href="'.$System->Link('/user.php?user='.$Leader['Id']).'">'.$Leader['Name'].'</a><br/>'. 209 212 'Popis: '.$Team['Description'].'<br /><br />'; 210 213 //$Output .= '<a href="export/?team='.$Team['Id'].'">Exportovat překlad týmu</a> '; … … 227 230 { 228 231 $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 229 ' SELECT `T`.*FROM `'.$DbRow['TablePrefix'].'` AS `T` '.232 'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '. 230 233 'WHERE (`User` IN (SELECT `ID` FROM `User` WHERE `Team` = '.$Team['Id'].')) '. 231 234 'AND (`Complete` = 1) AND (`T`.`Language`!='.$Config['OriginalLanguage'].') '. … … 233 236 ') AS `C1`) AS `Translated`, '. 234 237 '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 235 ' SELECT `T`.* FROM `'.$DbRow['TablePrefix'].'` AS `T`'. 236 ' WHERE (`Language` = '.$Config['OriginalLanguage'].') AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'. 238 'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '. 239 'WHERE (`Language` = '.$Config['OriginalLanguage'].') '. 240 'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'. 237 241 ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name` UNION '; 238 242 } -
trunk/user.php
r524 r539 25 25 26 26 $Output = ''; 27 $Query = 'SELECT `User`.`Name`, `User`.`LastLogin`, `User`.`LastIP`, `User`.`Email`, '. 27 $Query = 'SELECT `User`.`Name`, `UserTrace`.`LastLogin`, `UserTrace`.`LastIP`, '. 28 '`User`.`Email`, `UserTrace`.`UserAgent`, '. 28 29 '`User`.`TranslatedCount`, `User`.`Team`, `User`.`ID`, `User`.`Info`, '. 29 30 '`Team`.`Name` AS `TeamName`, `Language`.`Name` AS `LanguageName`, '. 30 31 '`ClientVersion`.`Version` AS `Version` FROM `User` '. 32 'LEFT JOIN `UserTrace` ON `UserTrace`.`User` = `User`.`Id` '. 31 33 'LEFT JOIN `Language` ON `Language`.`Id` = `User`.`Language` '. 32 34 'LEFT JOIN `Team` ON `Team`.`Id` = `User`.`Team` '. … … 50 52 $Output .= '<fieldset><legend>Moderování</legend>'; 51 53 $Output .= 'Poslední IP: <strong>'.$UserLine['LastIP'].'</strong><br />'. 54 'Prohlížeč: <strong>'.$UserLine['UserAgent'].'</strong><br />'. 52 55 'Email: <strong>'.$UserLine['Email'].'</strong><br />'; 53 56 $Output .= '<br/><form action="user.php" method="post"><div>'. -
trunk/userlist.php
r524 r539 56 56 57 57 58 $Query = 'SELECT `ID`, `User`.`Name`, `LastLogin`, `GM`, `XP`, `TranslatedCount`, `RegistrationTime` FROM `User` '.$_SESSION['Where'].$Order['SQL'].$PageList['SQLLimit']; 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']; 59 62 60 63 $DbResult = $System->Database->query($Query);
Note:
See TracChangeset
for help on using the changeset viewer.