- Timestamp:
- May 9, 2008, 2:04:07 PM (17 years ago)
- Location:
- branches/2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2/frontend.php
r8 r9 46 46 } 47 47 48 function ShowText($TranslationGroupId) 49 { 50 51 $TextList = $this->System->Modules['Translation']->GetMultipleText($TranslationGroupId, $_GET['Index']); 52 if(count($TextList) == 0) 48 function ShowText($TranslationGroupId, $Edit) 49 { 50 if($Edit) 53 51 { 54 52 // Edit new text … … 60 58 $Output .= '</table>'; 61 59 } 62 else if(count($TextList) == 1)60 else 63 61 { 64 62 // Show only one … … 69 67 } 70 68 $Output .= '</table>'; 71 } else 72 { 69 } 70 return($Output); 71 } 72 73 function ShowMultipleText($TranslationGroupId) 74 { 75 $TextList = $this->System->Modules['Translation']->GetMultipleText($TranslationGroupId, $_GET['Index']); 76 $EnglishText = array_shift($TextList); 77 if(count($TextList) == 0) $Output = $this->ShowText($EnglishText['Id'], 1); 78 else if(count($TextList) == 1) $Output = $this->ShowText($EnglishText['Id'], 0); 79 else { 73 80 // Show multiple possibilites 74 $Output = '<strong>Více překladů jednoho textu:</strong><table class="TranslationTable">'.81 $Output = '<strong>Více překladů jednoho textu:</strong><table>'. 75 82 '<tr><th>ID</th><th>Titulek</th></tr>'; 76 83 foreach($TextList as $Text) 77 84 { 78 $Output .= '<tr><td>'.$Text['Index'].'</td><td><a href="?Action=ShowText&GroupId='.$Text['Id'].' ">'.$Text['Text'].'</a></td></tr>';85 $Output .= '<tr><td>'.$Text['Index'].'</td><td><a href="?Action=ShowText&GroupId='.$Text['Id'].'&Edit=0">'.$Text['Text'].'</a></td></tr>'; 79 86 } 80 87 $Output .= '</table>'; … … 92 99 { 93 100 if(strlen($Translation['Text']) > 30) $Translation['Text'] = substr($Translation['Text'], 0, 30).'...'; 94 $Output .= '<tr><td>'.$Translation['Index'].'</td><td><a href="?Action=Show Text&GroupId='.$Translation['Id'].'&Index='.$Translation['Index'].'">'.$Translation['Text'].'</a></td><td>'.($Translation['TextCount'] - 1).'</td></tr>';101 $Output .= '<tr><td>'.$Translation['Index'].'</td><td><a href="?Action=ShowMultipleText&GroupId='.$Translation['Group'].'&Index='.$Translation['Index'].'">'.$Translation['Text'].'</a></td><td>'.($Translation['TextCount'] - 1).'</td></tr>'; 95 102 } 96 103 $Output .= '</table>'.$this->System->PagesList('?Action=TextGroupList&GroupId='.$GroupId.'&Page=', $Page, $this->System->Modules['Translation']->GetTextGroupListCount($GroupId, 1, 1), $ItemPerPage); … … 205 212 break; 206 213 case 'ShowText': 207 $Output = $this->ShowText($_GET['GroupId']); 214 $Output = $this->ShowText($_GET['GroupId'], $_GET['Edit']); 215 break; 216 case 'ShowMultipleText': 217 $Output = $this->ShowMultipleText($_GET['GroupId']); 208 218 break; 209 219 case 'TextGroupList': … … 229 239 break; 230 240 case 'ImportOldSystem': 231 $Output = $this->System->Modules['MangosImport']->ImportOld Mangos();241 $Output = $this->System->Modules['MangosImport']->ImportOldSystem(); 232 242 break; 233 243 } -
branches/2/mangos_import.php
r8 r9 6 6 { 7 7 $Output = ''; 8 $this->Database-> delete('Text', '`Text`.`TranslationGroup`=(SELECT `TextGroup`.`Id` FROM `TextGroup` WHERE `TextGroup`.`Language`=1)');8 $this->Database->query('DELETE FROM `Text` JOIN `TextGroup` ON `TextGroup`.`Language`=1 AND `TextGroup`.`Id` = `Text`.`TranslationGroup`'); 9 9 echo($this->Database->error); 10 $this->Database->delete('T ranslationGroup', '`Language`=1');10 $this->Database->delete('TextGroup', '`Language`=1'); 11 11 echo($this->Database->error); 12 12 … … 47 47 function ImportOldSystem() 48 48 { 49 $Output = ''; 50 51 // Import users 52 $this->Database->query('TRUNCATE TABLE `User`'); 53 $DbResult = $this->Database->query('SELECT * FROM `quests`.`user`'); 54 while($User = $DbResult->fetch_array()) 55 { 56 $Language = $User['Language'] + 1; 57 if($Language == 1) $Language = 2; 58 $Role = 2; 59 if($User['gm'] == 1) $Role = 3; 60 if($User['gm'] == 2) $Role = 4; 61 $this->Database->insert('User', array('Name' => $User['user'], 'Password' => $User['pass'], 'Email' => $User['Email'], 'TranslationLanguage' => $Language, 'LastLoginTime' => $User['LastLogin'], 'LastIpAddress' => $User['LastIP'], 'Role' => $Role, 'Id' => $User['ID'])); 62 } 63 $this->Database->insert('User', array('Name' => 'Anonym', 'Password' => '', 'Email' => '', 'TranslationLanguage' => 1, 'LastLoginTime' => '', 'LastIpAddress' => '', 'Role' => 1)); 64 $this->Database->insert('User', array('Name' => 'MaNGOS', 'Password' => '', 'Email' => '', 'TranslationLanguage' => 1, 'LastLoginTime' => '', 'LastIpAddress' => '', 'Role' => 1)); 65 $this->Database->insert('User', array('Name' => 'WoWEmu', 'Password' => '', 'Email' => '', 'TranslationLanguage' => 1, 'LastLoginTime' => '', 'LastIpAddress' => '', 'Role' => 1)); 66 $UnknownUserId = $this->Database->insert_id; 67 $Output .= 'Uživatelé převedeni<br>'; 68 69 // Import texts 70 $this->Database->query('CREATE TABLE Transition (OldIndex INT, NewIndex INT, INDEX OldIndex ) ENGINE=MEMORY'); 71 //$this->Database->query('TRUNCATE TABLE `User`'); 72 $DbResult = $this->Database->query('SELECT * FROM `quests`.`quests`'); 73 while($Quest = $DbResult->fetch_array()) 74 { 75 if($Quest['Language'] > 0) 76 { 77 if($Quest['User'] == 0) $Quest['User'] = $UnknownUserId; 78 if($Quest['Take'] > 0) 79 { 80 $DbResult2 = $this->Database->select('Transition', 'NewIndex', 'OldIndex='.$Quest['Take']); 81 $DbRow2 = $DbResult2->fetch_array(); 82 $Take = $DbRow2['NewIndex']; 83 } else $Take = 0; 84 85 $this->Database->insert('TextGroup', array('Index' => $Quest['entry'], 'Group' => 1, 'Time' => 'NOW()', 'Language' => $Quest['Language'] + 1, 'OldSystem' => 1, 'Complete' => $Quest['complete'], 'OriginalText' => $Take)); 86 //echo($this->Database->LastQuery); 87 $TextGroupId = $this->Database->insert_id; 88 $this->Database->insert('Transition', array('OldIndex' => $Quest['ID'], 'NewIndex' => $TextGroupId)); 89 if($Quest['Title'] != '') $this->Database->insert('Text', array('TranslationGroup' => $TextGroupId, 'GroupItem' => 1, 'Text' => $Quest['Title'])); 90 if($Quest['Details'] != '') $this->Database->insert('Text', array('TranslationGroup' => $TextGroupId, 'GroupItem' => 2, 'Text' => $Quest['Details'])); 91 if($Quest['Objectives'] != '') $this->Database->insert('Text', array('TranslationGroup' => $TextGroupId, 'GroupItem' => 3, 'Text' => $Quest['Objectives'])); 92 if($Quest['OfferRewardText'] != '') $this->Database->insert('Text', array('TranslationGroup' => $TextGroupId, 'GroupItem' => 4, 'Text' => $Quest['OfferRewardText'])); 93 if($Quest['RequestItemsText'] != '') $this->Database->insert('Text', array('TranslationGroup' => $TextGroupId, 'GroupItem' => 5, 'Text' => $Quest['RequestItemsText'])); 94 if($Quest['EndText'] != '') $this->Database->insert('Text', array('TranslationGroup' => $TextGroupId, 'GroupItem' => 6, 'Text' => $Quest['EndText'])); 95 if($Quest['ObjectiveText1'] != '') $this->Database->insert('Text', array('TranslationGroup' => $TextGroupId, 'GroupItem' => 7, 'Text' => $Quest['ObjectiveText1'])); 96 if($Quest['ObjectiveText2'] != '') $this->Database->insert('Text', array('TranslationGroup' => $TextGroupId, 'GroupItem' => 8, 'Text' => $Quest['ObjectiveText2'])); 97 if($Quest['ObjectiveText3'] != '') $this->Database->insert('Text', array('TranslationGroup' => $TextGroupId, 'GroupItem' => 9, 'Text' => $Quest['ObjectiveText3'])); 98 if($Quest['ObjectiveText4'] != '') $this->Database->insert('Text', array('TranslationGroup' => $TextGroupId, 'GroupItem' => 10, 'Text' => $Quest['ObjectiveText4'])); 99 } 100 } 101 $this->Database->query('DROP TABLE Transition'); 102 $Output .= 'Questy převedeny<br>'; 103 return($Output); 49 104 } 50 105 } -
branches/2/translation.php
r8 r9 44 44 { 45 45 $Result = array(); 46 $DbResult = $this->Database->query('SELECT `TextGroup`.*, (SELECT `Text` FROM `Text` WHERE `Text`.`TranslationGroup` = `TextGroup`.`Id` LIMIT 1) as `Text`, (SELECT COUNT(`TextGroup2`.`User`) FROM `TextGroup` AS `TextGroup2` WHERE `TextGroup2`.`I d` = `TextGroup`.`Id`) as `TextCount` FROM `TextGroup` WHERE `TextGroup`.`Group`='.$GroupId.' AND `TextGroup`.`User`='.$UserId.' AND `TextGroup`.`Language`='.$Language.' LIMIT '.($Page * $ItemPerPage).','.$ItemPerPage);46 $DbResult = $this->Database->query('SELECT `TextGroup`.*, (SELECT `Text` FROM `Text` WHERE `Text`.`TranslationGroup` = `TextGroup`.`Id` LIMIT 1) as `Text`, (SELECT COUNT(`TextGroup2`.`User`) FROM `TextGroup` AS `TextGroup2` WHERE `TextGroup2`.`Index` = `TextGroup`.`Index` AND `TextGroup2`.`Group` = `TextGroup`.`Group`) as `TextCount` FROM `TextGroup` WHERE `TextGroup`.`Group`='.$GroupId.' AND `TextGroup`.`User`='.$UserId.' AND `TextGroup`.`Language`='.$Language.' LIMIT '.($Page * $ItemPerPage).','.$ItemPerPage); 47 47 //echo($this->Database->LastQuery); 48 48 if($DbResult->num_rows > 0) … … 66 66 { 67 67 $Result = array(); 68 $DbResult = $this->Database->query('SELECT `TextGroup`.*, (SELECT `Text` FROM `Text` WHERE `Text`.`TranslationGroup` = `TextGroup`.`Id` LIMIT 1) as `Text` FROM `TextGroup` WHERE `TextGroup`.`Group`='.$GroupId.' AND `TextGroup`.`Index` = '.$Index.' AND `TextGroup`.`Language` != 1');68 $DbResult = $this->Database->query('SELECT `TextGroup`.*, (SELECT `Text` FROM `Text` WHERE `Text`.`TranslationGroup` = `TextGroup`.`Id` LIMIT 1) as `Text` FROM `TextGroup` WHERE `TextGroup`.`Group`='.$GroupId.' AND `TextGroup`.`Index` = '.$Index.''); 69 69 //echo($this->Database->LastQuery); 70 70 if($DbResult->num_rows > 0) -
branches/2/user.php
r8 r9 19 19 var $User = array(); 20 20 var $DefaultRole = 2; 21 var $AnonymousUserId = 1; 21 22 22 23 function Check() … … 30 31 // Refresh time of last access 31 32 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('Time' => 'NOW()')); 32 } else $this->Database->insert('UserOnline', array('SessionId' => $SID, 'User' => 1, 'Time' => 'NOW()', 'IpAddress' => (gethostbyaddr(GetRemoteAddress()).' '.GetRemoteAddress())));33 } else $this->Database->insert('UserOnline', array('SessionId' => $SID, 'User' => $AnonymousUserId, 'Time' => 'NOW()', 'IpAddress' => (gethostbyaddr(GetRemoteAddress()).' '.GetRemoteAddress()))); 33 34 34 35 // Odeber neaktivní uživatele … … 38 39 $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"'); 39 40 $Row = $Query->fetch_array(); 40 if($Row['User'] != 0)41 if($Row['User'] != $this->AnonymousUserId) 41 42 { 42 43 $Query = $this->Database->select('User', '*', "Id=".$Row['User'].""); … … 44 45 $Result = USER_LOGGED; 45 46 } else { 46 $Query = $this->Database->select('User', '*', "Id= 1");47 $Query = $this->Database->select('User', '*', "Id=".$this->AnonymousUserId); 47 48 $this->User = $Query->fetch_array(); 48 49 $Result = USER_NOT_LOGGED; … … 97 98 { 98 99 $SID = session_id(); 99 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => 1));100 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => $this->AnonymousUserId)); 100 101 return(USER_LOGGED_OUT); 101 102 }
Note:
See TracChangeset
for help on using the changeset viewer.