Changeset 455 for trunk/dictionary.php
- Timestamp:
- Apr 13, 2010, 10:03:12 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dictionary.php
r393 r455 5 5 function WriteTranslatNames($Text,$mode) 6 6 { 7 7 8 8 if ($mode == 0) echo ('..Nalezené názvy jmen věcí, míst, postav'); 9 9 if ($mode == 1) echo ('..Všechny přeložené'); … … 26 26 $buff = GetTranslatNames($Text,$mode,$TablesColumn); 27 27 28 28 // $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']); 29 29 foreach($buff as $Line) { 30 30 if ($mode == 0) … … 73 73 '<a href="?mode=0&group='.$GroupId.'&ID='.$TextID.'" title="Zobrazit pouze přesné výsledky">Přesné</a> '. 74 74 '<a href="?mode=2&group='.$GroupId.'&ID='.$TextID.'" title="Zobrazit všechny nepřeložené">Nepřeložené</a> '); 75 $Line = mysql_fetch_assoc($Database->SQLCommand('SELECT * FROM '.$Table.' Where ID = '.$TextID)); 75 $DbResult = $System->Database->query('SELECT * FROM '.$Table.' Where ID = '.$TextID); 76 $Line = $DbResult->fetch_assoc(); 76 77 if(!$Line) die('Překlad nenalezen.'); 77 78 … … 102 103 if(array_key_exists('Original', $_POST) and array_key_exists('Translated', $_POST) and array_key_exists('Description', $_POST)) 103 104 { 104 $DbResult = $ Database->SQLCommand('SELECT * FROM `Dictionary` WHERE `Text` = "'.$_POST['Original'].'" AND `Language`=0');105 if( mysql_num_rows($DbResult)> 0)106 { 107 $DbRow = mysql_fetch_assoc($DbResult);105 $DbResult = $System->Database->query('SELECT * FROM `Dictionary` WHERE `Text` = "'.$_POST['Original'].'" AND `Language`=0'); 106 if($DbResult->num_rows > 0) 107 { 108 $DbRow = $DbResult->fetch_assoc(); 108 109 $Entry = $DbRow['Entry']; 109 110 } else 110 111 { 111 $DbResult = $ Database->SQLCommand('SELECT MAX(`Entry`) FROM `Dictionary`');112 $DbRow = mysql_fetch_row($DbResult);112 $DbResult = $System->Database->query('SELECT MAX(`Entry`) FROM `Dictionary`'); 113 $DbRow = $DbResult->fetch_row(); 113 114 $Entry = $DbRow[0] + 1; 114 $ Database->SQLCommand('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , `User`, `Language` ) VALUES ("'.$_POST['Original'].'", "'.$Entry.'", "", 0, 0);');115 $System->Database->query('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , `User`, `Language` ) VALUES ("'.$_POST['Original'].'", "'.$Entry.'", "", 0, 0);'); 115 116 } 116 117 117 $DbResult = $ Database->SQLCommand('SELECT `Id` FROM `Dictionary` WHERE `Entry` = '.$Entry.' AND `Language`='.$_SESSION['language'].' AND `User`='.$User->Id);118 $DbResult = $System->Database->query('SELECT `Id` FROM `Dictionary` WHERE `Entry` = '.$Entry.' AND `Language`='.$_SESSION['language'].' AND `User`='.$User->Id); 118 119 if(mysql_num_rows($DbResult) > 0) 119 120 { 120 121 $DbRow = mysql_fetch_assoc($DbResult); 121 $ Database->SQLCommand('UPDATE `Dictionary` SET `Text`="'.$_POST['Translated'].'", `Description` = "'.$_POST['Description'].'" WHERE Id='.$DbRow['Id']);122 $System->Database->query('UPDATE `Dictionary` SET `Text`="'.$_POST['Translated'].'", `Description` = "'.$_POST['Description'].'" WHERE Id='.$DbRow['Id']); 122 123 } else 123 $ Database->SQLCommand('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , `User`, `Language` ) VALUES ("'.$_POST['Translated'].'", "'.$Entry.'", "'.$_POST['Description'].'", '.$User->Id.', '.$_SESSION['language'].')');124 $System->Database->query('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , `User`, `Language` ) VALUES ("'.$_POST['Translated'].'", "'.$Entry.'", "'.$_POST['Description'].'", '.$User->Id.', '.$_SESSION['language'].')'); 124 125 echo('Záznam byl uložen!'); 125 126 } else echo('Nebyly zaslány všechny položky formuláře.'); … … 127 128 if(($_GET['action'] == 'remove') and $User->Licence(LICENCE_USER)) 128 129 { 129 $ Database->SQLCommand('DELETE FROM `Dictionary` WHERE `User`='.$User->Id.' AND `Language`='.$_SESSION['language'].' AND `Entry`='.$_GET['entry']);130 $System->Database->query('DELETE FROM `Dictionary` WHERE `User`='.$User->Id.' AND `Language`='.$_SESSION['language'].' AND `Entry`='.$_GET['entry']); 130 131 } else 131 132 if(($_GET['action'] == 'modify') and $User->Licence(LICENCE_USER)) 132 133 { 133 $DbResult = $ Database->SQLCommand('SELECT * FROM `Dictionary` WHERE `User`='.$User->Id.' AND `Entry`='.$_GET['entry'].' AND `Language`='.$_SESSION['language']);134 $DbRow = mysql_fetch_assoc($DbResult);135 $DbResult = $ Database->SQLCommand('SELECT * FROM `Dictionary` WHERE `User`=0 AND `Entry`='.$_GET['entry'].' AND `Language`=0');136 $DbRow2 = mysql_fetch_assoc($DbResult);134 $DbResult = $System->Database->query('SELECT * FROM `Dictionary` WHERE `User`='.$User->Id.' AND `Entry`='.$_GET['entry'].' AND `Language`='.$_SESSION['language']); 135 $DbRow = $DbResult->fetch_assoc(); 136 $DbResult = $System->Database->query('SELECT * FROM `Dictionary` WHERE `User`=0 AND `Entry`='.$_GET['entry'].' AND `Language`=0'); 137 $DbRow2 = $DbResult->fetch_assoc(); 137 138 echo('<form action="dictionary.php?action=save" method="post">'. 138 139 '<fieldset><legend>Upravení slova</legend>'. … … 177 178 } else $sql = 'SELECT `User`.`Name` AS `UserName`, `ID` AS `UserID`, `T3`.`Entry`, `T3`.`Original`, `T3`.`Translated`, `T3`.`Description` FROM (SELECT `T2`.`User`, `T1`.Language, `T1`.`Text` AS `Original`, `T2`.`Text` AS `Translated`, `T2`.`Description`, `T1`.`Entry` AS `Entry` FROM `Dictionary` AS `T1` JOIN `Dictionary` AS `T2` ON `T2`.`Entry` = `T1`.`Entry` AND `T2`.`Language` = '.$_SESSION['language'].') AS `T3` JOIN `User` ON `User`.`ID` = `T3`.`User` WHERE `T3`.`Language` = 0'; 178 179 179 $DbResult = $ Database->SQLCommand('SELECT COUNT(*) FROM ('.$sql.') AS `T1`');180 $DbRow = mysql_fetch_row($DbResult);180 $DbResult = $System->Database->query('SELECT COUNT(*) FROM ('.$sql.') AS `T1`'); 181 $DbRow = $DbResult->fetch_row(); 181 182 $PageList = GetPageList($DbRow[0]); 182 183 … … 195 196 196 197 $sql_page = $sql.$Order['SQL'].$PageList['SQLLimit']; 197 $ ID = $Database->SQLCommand($sql_page);198 while($Line = mysql_fetch_assoc($ID))198 $DbResult = $System->Database->query($sql_page); 199 while($Line = $DbResult->fetch_assoc()) 199 200 { 200 201 echo('<tr>
Note:
See TracChangeset
for help on using the changeset viewer.