Changeset 349
- Timestamp:
- Mar 3, 2010, 10:37:40 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin.php
r295 r349 2 2 3 3 include('includes/global.php'); 4 include_once('img_level.php'); 4 5 5 6 ShowPage(); 6 7 7 echo('<h3>Volby pro správu</h3>'); 8 if(Licence(LICENCE_ADMIN)) 8 function ShowMenu() 9 9 { 10 global $Config; 11 12 echo('<h3>Volby pro správu</h3>'); 10 13 echo('<a href="https://wowpreklad.zdechov.net/mysql/">Správa databáze</a><br/>'. 11 14 '<small>Rozhraní phpMyAdmin pro přímou správu databáze</small><br/><br/>'); … … 16 19 echo('<a href="'.$Config['Web']['BaseURL'].'log.php">Záznamy událostí</a><br/>'. 17 20 '<small>Procházení všech systémových záznamů akcí a událostí</small><br/><br/>'); 18 echo('<a href="'.$Config['Web']['BaseURL'].'img_level.php?nothide">Generování obrázků úrovní překladatelů</a><br/>'. 19 '<small>Ihned provede přegenerování všech obrázků úrovní překladatelů</small><br/><br/>'); 20 21 21 echo('<a href="'.$Config['Web']['BaseURL'].'admin.php?action=img_level">Generování obrázků úrovní překladatelů</a><br/>'. 22 '<small>Ihned provede přegenerování všech obrázků úrovní překladatelů</small><br/><br/>'); 23 } 24 25 if(Licence(LICENCE_ADMIN)) 26 { 27 if(array_key_exists('action', $_GET)) 28 { 29 if($_GET['action'] == 'img_level') 30 { 31 ImgLevelShow(); 32 } else ShowMenu(); 33 } else ShowMenu(); 22 34 } else echo('Nemáte oprávnění'); 23 35 -
trunk/export/export.php
r300 r349 23 23 function LoadFilters() 24 24 { 25 $DbResult = $this->Database->query('SELECT * FROM `Export` WHERE Id='.$this->Id);25 $DbResult = $this->Database->query('SELECT * FROM `Export` WHERE `Id`='.$this->Id); 26 26 $this->Export = $DbResult->fetch_assoc(); 27 27 28 28 // Filter selected languages 29 29 $this->WhereLang = ''; 30 $DbResult = $this->Database->query('SELECT * FROM `ExportLanguage` WHERE Export='.$this->Id.' ORDER BY Sequence');30 $DbResult = $this->Database->query('SELECT * FROM `ExportLanguage` WHERE `Export`='.$this->Id.' ORDER BY `Sequence`'); 31 31 while($Language = $DbResult->fetch_assoc()) 32 $this->WhereLang .= ' OR ( Language= '.$Language['Language'].')';32 $this->WhereLang .= ' OR (`Language` = '.$Language['Language'].')'; 33 33 if($this->WhereLang == '') $this->WhereLang = 1; 34 34 else $this->WhereLang = '('.substr($this->WhereLang, 4).')'; … … 37 37 $this->SelectedUsers = ''; 38 38 $this->UserNames = ''; 39 $DbResult = $this->Database->query('SELECT ExportUser.*, user.user FROM `ExportUser` LEFT JOIN user ON user.ID=ExportUser.User WHERE ExportUser.Export='.$this->Id.' ORDER BY ExportUser.Sequence');39 $DbResult = $this->Database->query('SELECT `ExportUser`.*, `user`.`user` FROM `ExportUser` LEFT JOIN `user` ON `user`.`ID`=`ExportUser`.`User` WHERE `ExportUser`.`Export`='.$this->Id.' ORDER BY `ExportUser`.`Sequence`'); 40 40 while($User = $DbResult->fetch_assoc()) 41 41 { … … 52 52 } else 53 53 { 54 $this->WhereUsers = '( UserIN ('.$this->SelectedUsers.'))';55 $this->OrderByUserList = ' ORDER BY FIELD( User, '.$this->SelectedUsers.')';54 $this->WhereUsers = '(`User` IN ('.$this->SelectedUsers.'))'; 55 $this->OrderByUserList = ' ORDER BY FIELD(`User`, '.$this->SelectedUsers.')'; 56 56 } 57 57 … … 59 59 if(isset($_SESSION) and ($_SESSION['UserID'] != '')) 60 60 { 61 $DbResult = $this->Database->query('SELECT user FROM `user` WHERE ID='.$_SESSION['UserID']);61 $DbResult = $this->Database->query('SELECT `user` FROM `user` WHERE `ID`='.$_SESSION['UserID']); 62 62 $this->User = $DbResult->fetch_assoc(); 63 63 } else $this->User = array('user' => 'Neznámý'); … … 141 141 $Buffer .= '--'.$AoWoWTable.', '; 142 142 $Buffer .= "\n\n"; 143 $Query = 'SELECT name,'.$IndexColum.' FROM '.$AoWoWTable;143 $Query = 'SELECT `name`,`'.$IndexColum.'` FROM `'.$AoWoWTable.'`'; 144 144 $DbResult = $Database2->query($Query); 145 145 while($Line = $DbResult->fetch_assoc()) … … 147 147 $Ori_text = $Line['name']; 148 148 $DbResult2 = $Database2->query('SELECT text as en, 149 (SELECT text FROM '.$Config['Database']['Database'].'.global_strings as tabletran 150 WHERE tableen.entry = tabletran.entry AND (Complete = 1) AND '.$this->WhereLang.' 151 AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) as tran 152 FROM '.$Config['Database']['Database'].'.global_strings as tableen WHERE 153 text = "'.addslashes($Ori_text).'" LIMIT 1'); 149 (SELECT `text` FROM `'.$Config['Database']['Database'].'`.`global_strings` AS `tabletran` 150 WHERE `tableen`.`entry` = `tabletran`.`entry` AND (`Complete` = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) AS `tran` 151 FROM `'.$Config['Database']['Database'].'`.`global_strings` AS `tableen` WHERE 152 `text` = "'.addslashes($Ori_text).'" LIMIT 1'); 154 153 $Tran = $DbResult2->fetch_assoc(); 155 154 //echo ($Line['name'].'='.$Tran['tran']); 156 155 if($Tran['tran'] == '') 157 156 { 158 $DbResult2 = $Database2->query('SELECT OptionText as en,159 (SELECT OptionText FROM '.$this->Config['Database']['Database'].'.npc_option as tabletran160 WHERE tableen.entry = tabletran.entry AND (Complete= 1) AND '.$this->WhereLang.'161 AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) as tran162 FROM '.$this->Config['Database']['Database'].'.npc_option as tableenWHERE163 OptionText= "'.addslashes($Ori_text).'" LIMIT 1');157 $DbResult2 = $Database2->query('SELECT `OptionText` AS `en`, 158 (SELECT `OptionText` FROM `'.$this->Config['Database']['Database'].'`.`npc_option` AS `tabletran` 159 WHERE `tableen`.`entry` = `tabletran`.`entry` AND (`Complete` = 1) AND '.$this->WhereLang.' 160 AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) AS `tran` 161 FROM `'.$this->Config['Database']['Database'].'`.`npc_option` AS `tableen` WHERE 162 `OptionText` = "'.addslashes($Ori_text).'" LIMIT 1'); 164 163 $Tran = $DbResult2->fetch_assoc(); 165 164 } 166 165 167 166 if($Tran['tran'] <> '') 168 $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET name= "'.addslashes($Tran['tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n";167 $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET `name` = "'.addslashes($Tran['tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n"; 169 168 } 170 169 $Buffer .= "\n\n"; … … 204 203 $Group['MangosTableIndex'] = 'entry'; 205 204 } 206 $Query = 'SELECT *,(SELECT user FROM user WHERE user.ID=T.User) as UserName FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND (VersionStart <= '.$this->ClientVersion['BuildNumber'].') AND (VersionEnd >= '.$this->ClientVersion['BuildNumber'].') AND '.$this->WhereLang.' AND '.$this->WhereUsers.$this->OrderByUserList.') AS T GROUP BY T.entry';205 $Query = 'SELECT *,(SELECT `user` FROM `user` WHERE `user`.`ID`=`T`.`User`) AS `UserName` FROM (SELECT * FROM `'.$Group['TablePrefix'].'` WHERE (`Complete` = 1) AND (`VersionStart` <= '.$this->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$this->ClientVersion['BuildNumber'].') AND '.$this->WhereLang.' AND '.$this->WhereUsers.$this->OrderByUserList.') AS `T` GROUP BY `T`.`entry`'; 207 206 //echo($Query); 208 207 $Buffer .= ' <group id="'.$Group['Id'].'" name="'.$Group['TablePrefix'].'">'."\n"; -
trunk/export/process_aowow_export.php
r319 r349 46 46 { 47 47 //echo($Line."\n"); 48 $Database2->query($Line);48 if(trim($Line) != '') $Database2->query($Line); 49 49 } 50 50 -
trunk/img_level.php
r302 r349 2 2 3 3 require_once('includes/global.php'); 4 5 if (array_key_exists('nothide', $_GET)) $nothide = true;6 else $nothide = false;7 if($nothide) ShowPage();8 9 $FontFile = 'images/FRIZQT__.ttf';10 4 11 5 // Nastavení … … 13 7 $index_level = 100; 14 8 $from_diakrit = 3; //zvýšené xp za slovo s diakritikou 9 $FontFile = 'images/FRIZQT__.ttf'; 15 10 16 11 function CheckDiakrit($word) … … 26 21 } 27 22 } 28 return $result;23 return($result); 29 24 } 30 25 31 26 function CreateImg($prefix, $user, $xp) 32 27 { 33 global $index_level, $FontFile; 34 28 global $index_level, $FontFile; 29 35 30 if($xp > 0) 36 31 { 37 $level = sqrt 32 $level = sqrt($xp / $index_level); 38 33 $level = substr($level, 0, strpos($level, '.')); 39 34 } else $level = 0; … … 106 101 } 107 102 108 // Hlavní kod pro uživatele 109 if($nothide) $ID = $Database->SQLCommand('SELECT ID,user FROM user'); 110 else $ID = $Database->SQLCommand('SELECT ID,user FROM user WHERE NeedUpdate = 1'); 111 while($LineUser = mysql_fetch_array($ID)) 112 { 113 $xp = GetXPFromTranslation($LineUser['ID']); // Načítání XP 114 $Database->SQLCommand('UPDATE user SET XP = '.$xp.' WHERE ID = '.$LineUser['ID']); // Ukládání XP pro řazení 115 CreateImg('user', $LineUser['user'], $xp); // Vytváření obrázku 116 if($nothide) echo('<img src="tmp/user/'.$LineUser['user'].'/level.png" /><br />'); 103 function ImgLevelUpdate() 104 { 105 global $Database; 106 107 // Hlavní kod pro uživatele 108 $ID = $Database->SQLCommand('SELECT ID,user FROM user WHERE NeedUpdate = 1'); 109 while($LineUser = mysql_fetch_array($ID)) 110 { 111 $xp = GetXPFromTranslation($LineUser['ID']); // Načítání XP 112 $Database->SQLCommand('UPDATE user SET XP = '.$xp.' WHERE ID = '.$LineUser['ID']); // Ukládání XP pro řazení 113 CreateImg('user', $LineUser['user'], $xp); // Vytváření obrázku 114 } 115 116 // Hlavní kod pro překladatelské týmy 117 $ID = $Database->SQLCommand('SELECT ID,name,(SELECT avg(XP) FROM user WHERE team = Team.Id) as average FROM Team WHERE ID IN (SELECT Team FROM user WHERE NeedUpdate = 1)'); 118 while($LineTeam = mysql_fetch_array($ID)) 119 { 120 CreateImg('team', $LineTeam['name'], substr($LineTeam['average'], 0, strpos($LineTeam['average'],'.'))); //vytváření obrázku 121 } 122 $Database->SQLCommand('UPDATE user SET NeedUpdate = 0'); 117 123 } 118 124 119 // Hlavní kod pro překladatelské týmy 120 if($nothide) $ID = $Database->SQLCommand('SELECT ID,name,(SELECT avg(XP) FROM user WHERE team = Team.Id) as average FROM Team'); 121 else $ID = $Database->SQLCommand('SELECT ID,name,(SELECT avg(XP) FROM user WHERE team = Team.Id) as average FROM Team WHERE ID IN (SELECT Team FROM user WHERE NeedUpdate = 1)'); 122 while($LineTeam = mysql_fetch_array($ID)) 125 function ImgLevelShow() 123 126 { 124 CreateImg('team', $LineTeam['name'], substr($LineTeam['average'], 0, strpos($LineTeam['average'],'.'))); //vytváření obrázku 125 if($nothide) echo('<img src="tmp/team/'.$LineTeam['name'].'/level.png" /><br />'); 127 global $Database; 128 129 // Hlavní kod pro uživatele 130 $ID = $Database->SQLCommand('SELECT ID,user FROM user'); 131 while($LineUser = mysql_fetch_array($ID)) 132 { 133 $xp = GetXPFromTranslation($LineUser['ID']); // Načítání XP 134 $Database->SQLCommand('UPDATE user SET XP = '.$xp.' WHERE ID = '.$LineUser['ID']); // Ukládání XP pro řazení 135 CreateImg('user', $LineUser['user'], $xp); // Vytváření obrázku 136 echo('<img src="tmp/user/'.$LineUser['user'].'/level.png" /><br />'); 137 } 138 139 // Hlavní kod pro překladatelské týmy 140 $ID = $Database->SQLCommand('SELECT ID,name,(SELECT avg(XP) FROM user WHERE team = Team.Id) as average FROM Team'); 141 while($LineTeam = mysql_fetch_array($ID)) 142 { 143 CreateImg('team', $LineTeam['name'], substr($LineTeam['average'], 0, strpos($LineTeam['average'],'.'))); // Vytváření obrázku 144 echo('<img src="tmp/team/'.$LineTeam['name'].'/level.png" /><br />'); 145 } 146 $Database->SQLCommand('UPDATE user SET NeedUpdate = 0'); 126 147 } 127 $Database->SQLCommand('UPDATE user SET NeedUpdate = 0');128 129 if($nothide) ShowFooter();130 148 131 149 ?> -
trunk/img_statistic.php
r328 r349 15 15 if(array_key_exists('language', $_GET)) 16 16 { 17 $language = ' AND `Language` = '.$_GET['language'].'';17 $language = ' AND (`Language` = '.$_GET['language'].')'; 18 18 } else $language = ''; 19 19 20 20 21 $ID = mysql_fetch_row($Database->SQLCommand('SELECT MAX(`VersionEnd`) FROM '.$Group['TablePrefix'])); 21 $DbResult = $Database->SQLCommand('SELECT MAX(`VersionEnd`) FROM '.$Group['TablePrefix']); 22 $ID = mysql_fetch_row($DbResult); 22 23 $BuildNumber_max = $ID[0]; 23 24 24 25 $where = 'VersionEnd = '.$BuildNumber_max.' AND (`Language` <> 0) AND (`Complete` = 1) '.$team.$language; 25 $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(distinct(`entry`)) FROM '.$Group['TablePrefix'].'WHERE '.$where));26 $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(distinct(`entry`)) FROM `'.$Group['TablePrefix'].'` WHERE '.$where)); 26 27 $NumberTranslate = $ID[0]; 27 28 28 $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(distinct(`entry`)) FROM '.$Group['TablePrefix'].'WHERE `VersionEnd` = '.$BuildNumber_max.' AND (`Language` = 0)'));29 $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(distinct(`entry`)) FROM `'.$Group['TablePrefix'].'` WHERE `VersionEnd` = '.$BuildNumber_max.' AND (`Language` = 0)')); 29 30 $NumberAJ = $ID[0]; 30 31 31 $ ID = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `log` WHERE `Type` = 1 AND `date` >= CURRENT_DATE - INTERVAL '.$Days.' DAY32 AND `text` LIKE "%'.$Group['Name'].'%"'));32 $DbResult = $Database->SQLCommand('SELECT count(*) FROM `log` WHERE (`Type` = 1) AND (`date` >= CURRENT_DATE - INTERVAL '.$Days.' DAY) AND (`text` LIKE "%'.$Group['Name'].'%")'); 33 $ID = mysql_fetch_row($DbResult); 33 34 $NumberPerDay = $ID[0]; //date ("Y-m-d H:i:s") 34 35 -
trunk/save.php
r321 r349 19 19 else $complete = 0; 20 20 21 $DbResult = $Database->SQLCommand('SELECT * FROM '.$Table.' WHERE Language = 0 AND entry = '.$entry);21 $DbResult = $Database->SQLCommand('SELECT * FROM `'.$Table.'` WHERE (`Language` = 0) AND (`entry` = '.$entry.')'); 22 22 if(mysql_num_rows($DbResult) == 0) ErrorMessage('Neznámé Id položky'); 23 23 $LineAJ = mysql_fetch_array($DbResult); 24 $LineTake = mysql_fetch_array($Database->SQLCommand('SELECT VersionEnd,VersionStart FROM '.$Table.' WHERE ID= '.$TextID));24 $LineTake = mysql_fetch_array($Database->SQLCommand('SELECT `VersionEnd`, `VersionStart` FROM `'.$Table.'` WHERE `ID` = '.$TextID)); 25 25 if(mysql_num_rows($DbResult) == 0) ErrorMessage('Neznámé Id položky'); 26 $DbResult = $Database->SQLCommand('SELECT * FROM '.$Table.' WHERE user='.$UserID.' AND entry = '.$entry.' AND VersionStart = '.$LineTake['VersionStart'].' AND VersionEnd = '.$LineTake['VersionEnd']);26 $DbResult = $Database->SQLCommand('SELECT * FROM `'.$Table.'` WHERE (`user`='.$UserID.') AND (`entry` = '.$entry.') AND (`VersionStart` = '.$LineTake['VersionStart'].') AND (`VersionEnd` = '.$LineTake['VersionEnd'].')'); 27 27 $Line = mysql_fetch_array($DbResult); 28 28 if(!$Line) … … 69 69 while($SameTranLine = mysql_fetch_assoc($SameTranID)) 70 70 { 71 $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM '.$Table.' WHERE user='.$UserID.' AND entry = '.$SameTranLine['entry'].' AND VersionStart = '.$LineTake['VersionStart'].' AND VersionEnd = '.$LineTake['VersionEnd']));71 $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM `'.$Table.'` WHERE (`user`='.$UserID.') AND (`entry` = '.$SameTranLine['entry'].') AND (`VersionStart` = '.$LineTake['VersionStart'].') AND (`VersionEnd` = '.$LineTake['VersionEnd'].')')); 72 72 if(!$Line) 73 73 { … … 93 93 94 94 // Konec kontrolování stejných textů 95 95 96 96 echo('Překlad <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a> ('.$entry.') uložen!<br />'); 97 97 foreach($LastIDs as $LastID) 98 98 { 99 99 if(count($LastIDs) > 1) echo('Nalezen stejný překlad, systémově přeložen: <a href="form.php?group='.$GroupId.'&ID='.$LastID.'">'.$LastID.'</a> Převzat z: <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a><br />'); 100 WriteLog('Text <a href="form.php?group='.$GroupId.'&ID='.$LastID.'">'.$LastID.'</a> ze skupiny <a href=" ?group='.$GroupId.'&action=filter">'.$TranslationTree[$GroupId]['Name'].'</a> uložen! Převzat z <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a>.', 1);100 WriteLog('Text <a href="form.php?group='.$GroupId.'&ID='.$LastID.'">'.$LastID.'</a> ze skupiny <a href="TranslationList.php?group='.$GroupId.'&action=filter">'.$TranslationTree[$GroupId]['Name'].'</a> uložen! Převzat z <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a>.', 1); 101 101 } 102 102 } else … … 106 106 if(array_key_exists($GroupItem['Column'], $_POST)) 107 107 $sql .= ', `'.$GroupItem['Column'].'`="'.$_POST[$GroupItem['Column']].'"'; 108 $sql .= ', `Language` = '.$Language.' WHERE `ID` = '.$TextID.' AND `Language` 108 $sql .= ', `Language` = '.$Language.' WHERE `ID` = '.$TextID.' AND `Language` <> 0'; 109 109 //echo($sql); 110 110 $Database->SQLCommand($sql); … … 116 116 echo('<br />Překládat: <a href="TranslationList.php?group='.$GroupId.'&action=notran">Nepřeložené</a> '); 117 117 118 $prev = FollowingTran($TextID, $Table,$GroupId, True);119 $next = FollowingTran($TextID, $Table,$GroupId);118 $prev = FollowingTran($TextID, $Table, $GroupId, True); 119 $next = FollowingTran($TextID, $Table, $GroupId); 120 120 echo('<br /><br />'); 121 121 $redirecting = mysql_fetch_assoc($Database->SQLCommand('SELECT `redirecting` FROM `user` WHERE `ID`='.$UserID)); -
trunk/team.php
r316 r349 2 2 3 3 include('includes/global.php'); 4 include_once('img_level.php'); 4 5 5 6 ShowPage(); … … 192 193 if(array_key_exists('id', $_GET)) 193 194 { 194 include('img_level.php');195 ImgLevelUpdate(); 195 196 $Columns = ''; 196 197 $Joins = ''; -
trunk/userlist.php
r292 r349 2 2 3 3 include('includes/global.php'); 4 include_once('img_level.php'); 4 5 5 6 ShowPage(); 6 7 include('img_level.php'); 7 ImgLevelUpdate(); 8 8 9 9 echo('<h3>Seznam uživatelů</h3>');
Note:
See TracChangeset
for help on using the changeset viewer.