Changeset 365 for trunk/dictionary.php
- Timestamp:
- Mar 9, 2010, 11:29:05 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dictionary.php
r288 r365 93 93 if(Licence(LICENCE_USER)) 94 94 { 95 $DbResult = $Database->SQLCommand('SELECT `Language` FROM ` user` WHERE `ID`='.$_SESSION['UserID']);95 $DbResult = $Database->SQLCommand('SELECT `Language` FROM `User` WHERE `ID`='.$_SESSION['UserID']); 96 96 $User = mysql_fetch_assoc($DbResult); 97 97 $_SESSION['language'] = $User['Language']; … … 144 144 if(array_key_exists('Original', $_POST) and array_key_exists('Translated', $_POST) and array_key_exists('Description', $_POST)) 145 145 { 146 $DbResult = $Database->SQLCommand('SELECT * FROM ` dictionary` WHERE `Text` = "'.$_POST['Original'].'" AND Language=0');146 $DbResult = $Database->SQLCommand('SELECT * FROM `Dictionary` WHERE `Text` = "'.$_POST['Original'].'" AND `Language`=0'); 147 147 if(mysql_num_rows($DbResult) > 0) 148 148 { … … 151 151 } else 152 152 { 153 $DbResult = $Database->SQLCommand('SELECT MAX( Entry) FROM dictionary');153 $DbResult = $Database->SQLCommand('SELECT MAX(`Entry`) FROM `Dictionary`'); 154 154 $DbRow = mysql_fetch_row($DbResult); 155 155 $Entry = $DbRow[0] + 1; 156 $Database->SQLCommand('INSERT INTO ` dictionary` ( `Text` , `Entry` , `Description` , `User`, `Language` ) VALUES ("'.$_POST['Original'].'", "'.$Entry.'", "", 0, 0);');156 $Database->SQLCommand('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , `User`, `Language` ) VALUES ("'.$_POST['Original'].'", "'.$Entry.'", "", 0, 0);'); 157 157 } 158 158 159 $DbResult = $Database->SQLCommand('SELECT Id FROM `dictionary` WHERE `Entry` = '.$Entry.' AND Language='.$_SESSION['language'].' AND User='.$_SESSION['UserID']);159 $DbResult = $Database->SQLCommand('SELECT `Id` FROM `Dictionary` WHERE `Entry` = '.$Entry.' AND `Language`='.$_SESSION['language'].' AND `User`='.$_SESSION['UserID']); 160 160 if(mysql_num_rows($DbResult) > 0) 161 161 { 162 162 $DbRow = mysql_fetch_assoc($DbResult); 163 $Database->SQLCommand('UPDATE ` dictionary` SET `Text`="'.$_POST['Translated'].'", `Description` = "'.$_POST['Description'].'" WHERE Id='.$DbRow['Id']);163 $Database->SQLCommand('UPDATE `Dictionary` SET `Text`="'.$_POST['Translated'].'", `Description` = "'.$_POST['Description'].'" WHERE Id='.$DbRow['Id']); 164 164 } else 165 $Database->SQLCommand('INSERT INTO ` dictionary` ( `Text` , `Entry` , `Description` , `User`, `Language` ) VALUES ("'.$_POST['Translated'].'", "'.$Entry.'", "'.$_POST['Description'].'", '.$_SESSION['UserID'].', '.$_SESSION['language'].')');165 $Database->SQLCommand('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , `User`, `Language` ) VALUES ("'.$_POST['Translated'].'", "'.$Entry.'", "'.$_POST['Description'].'", '.$_SESSION['UserID'].', '.$_SESSION['language'].')'); 166 166 echo('Záznam byl uložen!'); 167 167 } else echo('Nebyly zaslány všechny položky formuláře.'); … … 169 169 if(($_GET['action'] == 'remove') and Licence(LICENCE_USER)) 170 170 { 171 $Database->SQLCommand('DELETE FROM dictionary WHERE User='.$_SESSION['UserID'].' AND Language='.$_SESSION['language'].' AND Entry='.$_GET['entry']);171 $Database->SQLCommand('DELETE FROM `Dictionary` WHERE `User`='.$_SESSION['UserID'].' AND `Language`='.$_SESSION['language'].' AND `Entry`='.$_GET['entry']); 172 172 } else 173 173 if(($_GET['action'] == 'modify') and Licence(LICENCE_USER)) 174 174 { 175 $DbResult = $Database->SQLCommand('SELECT * FROM dictionary WHERE User='.$_SESSION['UserID'].' AND Entry='.$_GET['entry'].' AND Language='.$_SESSION['language']);175 $DbResult = $Database->SQLCommand('SELECT * FROM `Dictionary` WHERE `User`='.$_SESSION['UserID'].' AND `Entry`='.$_GET['entry'].' AND `Language`='.$_SESSION['language']); 176 176 $DbRow = mysql_fetch_assoc($DbResult); 177 $DbResult = $Database->SQLCommand('SELECT * FROM dictionary WHERE User=0 AND Entry='.$_GET['entry'].' AND Language=0');177 $DbResult = $Database->SQLCommand('SELECT * FROM `Dictionary` WHERE `User`=0 AND `Entry`='.$_GET['entry'].' AND `Language`=0'); 178 178 $DbRow2 = mysql_fetch_assoc($DbResult); 179 179 echo('<form action="dictionary.php?action=save" method="post">'. … … 216 216 if($Search <> '') 217 217 { 218 $sql = 'SELECT ` user`.`user` AS `UserName`, `user`. `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'].' WHERE LOWER(T1.Text) LIKE LOWER("%'.$Search.'%") OR LOWER(T1.Description) LIKE LOWER("%'.$Search.'%") ) AS T3 JOIN `user` ON `user`.`ID` = `T3`.`User` WHERE `T3`.`Language` = 0';219 } else $sql = 'SELECT ` user`.`user` 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';220 221 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$sql.') AS T1');218 $sql = 'SELECT `User`.`Name` AS `UserName`, `User`. `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'].' WHERE LOWER(`T1`.`Text`) LIKE LOWER("%'.$Search.'%") OR LOWER(`T1`.`Description`) LIKE LOWER("%'.$Search.'%") ) AS `T3` JOIN `User` ON `User`.`ID` = `T3`.`User` WHERE `T3`.`Language` = 0'; 219 } 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'; 220 221 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$sql.') AS `T1`'); 222 222 $DbRow = mysql_fetch_row($DbResult); 223 223 $PageList = GetPageList($DbRow[0]);
Note:
See TracChangeset
for help on using the changeset viewer.