Changeset 376 for trunk/dictionary.php
- Timestamp:
- Mar 11, 2010, 8:40:32 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dictionary.php
r366 r376 91 91 if(!isset($_SESSION['language'])) 92 92 { 93 if(Licence(LICENCE_USER)) 94 { 95 $DbResult = $Database->SQLCommand('SELECT `Language` FROM `User` WHERE `ID`='.$_SESSION['UserID']); 96 $User = mysql_fetch_assoc($DbResult); 97 $_SESSION['language'] = $User['Language']; 93 if($User->Licence(LICENCE_USER)) 94 { 95 $_SESSION['language'] = $User->Language; 98 96 } else $_SESSION['language'] = 1; 99 97 } … … 127 125 if(array_key_exists('action', $_GET)) 128 126 { 129 if(($_GET['action'] == 'insert') and Licence(LICENCE_USER))127 if(($_GET['action'] == 'insert') and $User->Licence(LICENCE_USER)) 130 128 { 131 129 echo('<form action="dictionary.php?action=save" method="post">'. … … 140 138 '</form>'); 141 139 } else 142 if(($_GET['action'] == 'save') and Licence(LICENCE_USER))140 if(($_GET['action'] == 'save') and $User->Licence(LICENCE_USER)) 143 141 { 144 142 if(array_key_exists('Original', $_POST) and array_key_exists('Translated', $_POST) and array_key_exists('Description', $_POST)) … … 157 155 } 158 156 159 $DbResult = $Database->SQLCommand('SELECT `Id` FROM `Dictionary` WHERE `Entry` = '.$Entry.' AND `Language`='.$_SESSION['language'].' AND `User`='.$ _SESSION['UserID']);157 $DbResult = $Database->SQLCommand('SELECT `Id` FROM `Dictionary` WHERE `Entry` = '.$Entry.' AND `Language`='.$_SESSION['language'].' AND `User`='.$User->Id); 160 158 if(mysql_num_rows($DbResult) > 0) 161 159 { … … 163 161 $Database->SQLCommand('UPDATE `Dictionary` SET `Text`="'.$_POST['Translated'].'", `Description` = "'.$_POST['Description'].'" WHERE Id='.$DbRow['Id']); 164 162 } else 165 $Database->SQLCommand('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , `User`, `Language` ) VALUES ("'.$_POST['Translated'].'", "'.$Entry.'", "'.$_POST['Description'].'", '.$ _SESSION['UserID'].', '.$_SESSION['language'].')');163 $Database->SQLCommand('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , `User`, `Language` ) VALUES ("'.$_POST['Translated'].'", "'.$Entry.'", "'.$_POST['Description'].'", '.$User->Id.', '.$_SESSION['language'].')'); 166 164 echo('Záznam byl uložen!'); 167 165 } else echo('Nebyly zaslány všechny položky formuláře.'); 168 166 } else 169 if(($_GET['action'] == 'remove') and Licence(LICENCE_USER))170 { 171 $Database->SQLCommand('DELETE FROM `Dictionary` WHERE `User`='.$ _SESSION['UserID'].' AND `Language`='.$_SESSION['language'].' AND `Entry`='.$_GET['entry']);167 if(($_GET['action'] == 'remove') and $User->Licence(LICENCE_USER)) 168 { 169 $Database->SQLCommand('DELETE FROM `Dictionary` WHERE `User`='.$User->Id.' AND `Language`='.$_SESSION['language'].' AND `Entry`='.$_GET['entry']); 172 170 } else 173 if(($_GET['action'] == 'modify') and Licence(LICENCE_USER))174 { 175 $DbResult = $Database->SQLCommand('SELECT * FROM `Dictionary` WHERE `User`='.$ _SESSION['UserID'].' AND `Entry`='.$_GET['entry'].' AND `Language`='.$_SESSION['language']);171 if(($_GET['action'] == 'modify') and $User->Licence(LICENCE_USER)) 172 { 173 $DbResult = $Database->SQLCommand('SELECT * FROM `Dictionary` WHERE `User`='.$User->Id.' AND `Entry`='.$_GET['entry'].' AND `Language`='.$_SESSION['language']); 176 174 $DbRow = mysql_fetch_assoc($DbResult); 177 175 $DbResult = $Database->SQLCommand('SELECT * FROM `Dictionary` WHERE `User`=0 AND `Entry`='.$_GET['entry'].' AND `Language`=0'); … … 199 197 <input type="text" value="'.$Search.'" name="search" size="30" /> 200 198 <input type="submit" value="Vyhledat" />'); 201 if( Licence(LICENCE_USER)) echo(' <a href="dictionary.php?action=insert">Vložit slovo</a>');199 if($User->Licence(LICENCE_USER)) echo(' <a href="dictionary.php?action=insert">Vložit slovo</a>'); 202 200 203 201 echo('</td></tr>'); … … 231 229 array('Name' => 'UserName', 'Title' => 'Překladatel'), 232 230 ); 233 if( Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => 'Akce');231 if($User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => 'Akce'); 234 232 $Order = GetOrderTableHeader($TableColumns, 'Original'); 235 233 echo('<table width="98%" class="BaseTable">'); … … 245 243 <td>'.$Line['Description'].'</td> 246 244 <td>'.$Line['UserName'].'</td>'); 247 if( Licence(LICENCE_USER))248 { 249 if($Line['UserID'] == $ _SESSION['UserID'])245 if($User->Licence(LICENCE_USER)) 246 { 247 if($Line['UserID'] == $User->Id) 250 248 echo('<td><a href="?action=remove&entry='.$Line['Entry'].'">Smazat</a> <a href="?action=modify&entry='.$Line['Entry'].'">Upravit</a></td>'); 251 249 else echo('<td></td>');
Note:
See TracChangeset
for help on using the changeset viewer.