Changeset 577 for trunk/Modules/Dictionary/Dictionary.php
- Timestamp:
- Sep 11, 2013, 10:37:54 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Dictionary/Dictionary.php
r569 r577 76 76 function DictionaryInsert() 77 77 { 78 global $User;79 80 78 $Output = ''; 81 if($ User->Licence(LICENCE_USER))79 if($this->System->User->Licence(LICENCE_USER)) 82 80 { 83 81 $Output .= '<form action="?action=save" method="post">'. … … 98 96 function DictionarySave() 99 97 { 100 global $User, $Config; 101 102 if($User->Licence(LICENCE_USER)) 98 if($this->System->User->Licence(LICENCE_USER)) 103 99 { 104 100 if(array_key_exists('Original', $_POST) and array_key_exists('Translated', $_POST) and array_key_exists('Description', $_POST)) … … 106 102 // Check if original text exists and determine entry id 107 103 $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE '. 108 '`Text` = "'.$_POST['Original'].'" AND `Language`= '.$ Config['OriginalLanguage']);104 '`Text` = "'.$_POST['Original'].'" AND `Language`= '.$this->System->Config['OriginalLanguage']); 109 105 if($DbResult->num_rows > 0) 110 106 { … … 117 113 $Entry = $DbRow[0] + 1; 118 114 $this->Database->query('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , '. 119 '`User`, `Language` ) VALUES ("'.$_POST['Original'].'", "'.$Entry.'", "", NULL, '.$ Config['OriginalLanguage'].');');115 '`User`, `Language` ) VALUES ("'.$_POST['Original'].'", "'.$Entry.'", "", NULL, '.$this->System->Config['OriginalLanguage'].');'); 120 116 } 121 117 122 118 $DbResult = $this->Database->query('SELECT `Id` FROM `Dictionary` WHERE '. 123 '`Entry` = '.$Entry.' AND `Language`='.$_POST['Language'].' AND `User`='.$ User->Id);119 '`Entry` = '.$Entry.' AND `Language`='.$_POST['Language'].' AND `User`='.$this->System->User->Id); 124 120 if($DbResult->num_rows > 0) 125 121 { … … 129 125 } else 130 126 $this->Database->query('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , '. 131 '`User`, `Language` ) VALUES ("'.$_POST['Translated'].'", "'.$Entry.'", "'.$_POST['Description'].'", '.$User->Id.', '.$_POST['Language'].')'); 127 '`User`, `Language` ) VALUES ("'.$_POST['Translated'].'", "'.$Entry.'", "'. 128 $_POST['Description'].'", '.$this->System->User->Id.', '.$_POST['Language'].')'); 132 129 $Output = ShowMessage('Záznam byl uložen!'); 133 130 } else $Output = ShowMessage('Nebyly zaslány všechny položky formuláře.', MESSAGE_CRITICAL); … … 138 135 function DictionaryRemove() 139 136 { 140 global $User; 141 142 if($User->Licence(LICENCE_USER)) 143 { 144 $this->Database->query('DELETE FROM `Dictionary` WHERE (`User`='.$User->Id.') AND (`Id`='.($_GET['id'] * 1).')'); 137 if($this->System->User->Licence(LICENCE_USER)) 138 { 139 $this->Database->query('DELETE FROM `Dictionary` WHERE (`User`='.$this->System->User->Id.') AND (`Id`='.($_GET['id'] * 1).')'); 145 140 $Output = ShowMessage('Záznam odstraněn.'); 146 141 } else $Output = ShowMessage('Nemáte oprávnění', MESSAGE_CRITICAL); … … 150 145 function DictionaryModify() 151 146 { 152 global $User, $Config; 153 154 if($User->Licence(LICENCE_USER)) 147 if($this->System->User->Licence(LICENCE_USER)) 155 148 { 156 149 $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE `Id`='.($_GET['id'] * 1)); … … 159 152 $DbRow = $DbResult->fetch_assoc(); 160 153 $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE (`User` IS NULL) '. 161 'AND (`Entry`='.$DbRow['Entry'].') AND (`Language`= '.$ Config['OriginalLanguage'].')');154 'AND (`Entry`='.$DbRow['Entry'].') AND (`Language`= '.$this->System->Config['OriginalLanguage'].')'); 162 155 $DbRow2 = $DbResult->fetch_assoc(); 163 156 $Output = '<form action="?action=save" method="post">'. … … 180 173 function DictionaryGroup() 181 174 { 182 global $ User, $TranslationTree;175 global $TranslationTree; 183 176 184 177 $Output = ''; … … 211 204 function DictionaryShow() 212 205 { 213 global $ User, $LanguageList, $Config;206 global $LanguageList; 214 207 215 208 $Output = '<form action="?" method="get" style="margin: 0px; padding: 0px;">'. … … 222 215 <input type="text" value="'.$Search.'" name="search" size="30" /> 223 216 <input type="submit" value="Vyhledat" />'; 224 if($User->Licence(LICENCE_USER)) $Output .= ' <a href="?action=insert">Vložit slovo</a>'; 217 if($this->System->User->Licence(LICENCE_USER)) 218 $Output .= ' <a href="?action=insert">Vložit slovo</a>'; 225 219 226 220 $Output .= '</td></tr>'. … … 252 246 '`T1`.`Entry`, `T2`.`Text` AS `Original`, `T1`.`Text` AS `Translated`, `T1`.`Description` '. 253 247 'FROM `Dictionary` AS `T1` JOIN `Dictionary` AS `T2` '. 254 'ON (`T2`.`Entry` = `T1`.`Entry`) AND (`T2`.`Language` = '.$ Config['OriginalLanguage'].') '.248 'ON (`T2`.`Entry` = `T1`.`Entry`) AND (`T2`.`Language` = '.$this->System->Config['OriginalLanguage'].') '. 255 249 'JOIN `Language` ON `Language`.`Id` = `T1`.`Language` '. 256 250 'JOIN `User` ON `User`.`ID` = `T1`.`User` '. … … 273 267 $TableColumns[] = array('Name' => 'Description', 'Title' => 'Popis'); 274 268 $TableColumns[] = array('Name' => 'UserName', 'Title' => 'Překladatel'); 275 if($ User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => 'Akce');269 if($this->System->User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => 'Akce'); 276 270 $Order = GetOrderTableHeader($TableColumns, 'Original'); 277 271 $Output .= '<table class="BaseTable">'.$Order['Output']; … … 287 281 $Output .= '<td>'.$Line['Description'].'</td>'. 288 282 '<td><a href="user.php?user='.$Line['UserId'].'">'.$Line['UserName'].'</a></td>'; 289 if($ User->Licence(LICENCE_USER))290 { 291 if($Line['UserId'] == $ User->Id)283 if($this->System->User->Licence(LICENCE_USER)) 284 { 285 if($Line['UserId'] == $this->System->User->Id) 292 286 $Output .= '<td><a href="?action=remove&id='.$Line['Id'].'" onclick="return confirmAction(\'Opravdu smazat položku?\');">Smazat</a>'. 293 287 ' <a href="?action=modify&id='.$Line['Id'].'">Upravit</a></td>'; … … 305 299 function Show() 306 300 { 307 global $LanguageList , $User;301 global $LanguageList; 308 302 309 303 $LanguageList = GetLanguageList(); … … 311 305 if(!isset($_SESSION['language'])) 312 306 { 313 if($ User->Licence(LICENCE_USER))307 if($this->System->User->Licence(LICENCE_USER)) 314 308 { 315 $_SESSION['language'] = $ User->Language;309 $_SESSION['language'] = $this->System->User->Language; 316 310 } else $_SESSION['language'] = ''; 317 311 }
Note:
See TracChangeset
for help on using the changeset viewer.