Changeset 577 for trunk/Modules/User/Options.php
- Timestamp:
- Sep 11, 2013, 10:37:54 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/User/Options.php
r569 r577 5 5 function UserOptionsFrom() 6 6 { 7 global $User;8 9 7 $Output = '<form action="Options.php?action=save" method="post"> 10 8 <fieldset><legend>Nastavení uživatele</legend> 11 9 <table> 12 <tr><td>Email:</td><td><input type="text" name="Email" value="'.$ User->Email.'" /></td></tr>10 <tr><td>Email:</td><td><input type="text" name="Email" value="'.$this->System->User->Email.'" /></td></tr> 13 11 <tr><td>Původní heslo:</td><td><input type="password" name="OldPass" /></td></tr> 14 12 <tr><td>Nové heslo:</td><td><input type="password" name="NewPass" /></td></tr> 15 13 <tr><td>Nové heslo pro potvrzení: </td><td><input type="password" name="NewPass2" /></td></tr> 16 <tr><td>Normálně budu překládat do: </td><td>'.WriteLanguages($ User->Language).'</td></tr>14 <tr><td>Normálně budu překládat do: </td><td>'.WriteLanguages($this->System->User->Language).'</td></tr> 17 15 <tr><td>Po uložení překladu přesměrovat: </td><td>'; 18 16 $Output .= '<select name="redirecting">'. 19 17 '<option value="0">Nikam</option>'. 20 18 '<option value="1"'; 21 if($ User->Redirecting == '1') $Output .= ' selected="selected"';19 if($this->System->User->Redirecting == '1') $Output .= ' selected="selected"'; 22 20 $Output .= '>Na nepřeložené</option>'; 23 21 $Output .= '<option value="2"'; 24 if($ User->Redirecting == '2') $Output .= ' selected="selected"';22 if($this->System->User->Redirecting == '2') $Output .= ' selected="selected"'; 25 23 $Output .= '>Na další překlad</option>'; 26 24 $Output .= '<option value="3"'; 27 if($ User->Redirecting == '3') $Output .= ' selected="selected"';25 if($this->System->User->Redirecting == '3') $Output .= ' selected="selected"'; 28 26 $Output .= '>Na předchozí překlad</option>'; 29 27 $Output .= '</select>'; 30 28 31 29 $Output .= '</td></tr>'. 32 '<tr><td>Upřednostněná verze klienta: </td><td>'.ClientVersionSelection($ User->PreferredVersion).'</td></tr>'.30 '<tr><td>Upřednostněná verze klienta: </td><td>'.ClientVersionSelection($this->System->User->PreferredVersion).'</td></tr>'. 33 31 '<tr><td>Veřejný text profilu:</td><td>'. 34 '<textarea name="info" cols="60" rows="10">'.$ User->Info.'</textarea></td></tr>'.32 '<textarea name="info" cols="60" rows="10">'.$this->System->User->Info.'</textarea></td></tr>'. 35 33 '<tr><td colspan="2"><input type="submit" value="Uložit" /></td></tr>'. 36 34 '</table></fieldset>'. … … 47 45 { 48 46 $Output .= '<option value="'.$LineTeam['Id'].'"'; 49 if ($LineTeam['Id'] == $ User->Team) $Output .= ' selected="selected"';47 if ($LineTeam['Id'] == $this->System->User->Team) $Output .= ' selected="selected"'; 50 48 $Output .= '>'.$LineTeam['Name'].'</option>'; 51 49 } … … 58 56 function UserOptionsSave() 59 57 { 60 global $User;61 62 58 $Output = ''; 63 59 if(array_key_exists('Email', $_POST)) … … 78 74 if($NewPass == $NewPass2) 79 75 { 80 $DbResult = $System->Database->query('SELECT `Pass`, '.$ User->CryptPasswordSQL('"'.$OldPass.'"', '`Salt`').' AS `Hash` FROM `User` WHERE `ID`= '.$User->Id);76 $DbResult = $System->Database->query('SELECT `Pass`, '.$this->System->User->CryptPasswordSQL('"'.$OldPass.'"', '`Salt`').' AS `Hash` FROM `User` WHERE `ID`= '.$this->System->User->Id); 81 77 $DbRow = $DbResult->fetch_assoc(); 82 78 if($DbRow['Hash'] == $DbRow['Pass']) 83 79 { 84 80 // Update password 85 $Salt = $ User->GetPasswordSalt();86 $this->Database->query('UPDATE `User` SET `Pass` = '.$ User->CryptPasswordSQL('"'.$NewPass.'"', '"'.$Salt.'"').', `Salt`="'.$Salt.'" WHERE `ID` = '.$User->Id);81 $Salt = $this->System->User->GetPasswordSalt(); 82 $this->Database->query('UPDATE `User` SET `Pass` = '.$this->System->User->CryptPasswordSQL('"'.$NewPass.'"', '"'.$Salt.'"').', `Salt`="'.$Salt.'" WHERE `ID` = '.$this->System->User->Id); 87 83 $Output .= ShowMessage('Heslo změněno.'); 88 84 } else $Output .= ShowMessage('Staré heslo neodpovídá.', MESSAGE_CRITICAL); 89 85 } else $Output .= ShowMessage('Hesla se neshodují.', MESSAGE_CRITICAL); 90 86 } 91 $this->Database->update('User', '`ID` = '.$ User->Id, array('Email' => $Email,92 93 94 $Output .= ShowMessage('Úprava nastavení proběhla v pořádku, Email: <b>'.$Email.'</b> Uživatel: <b>'.$ User->Name.'</b>');87 $this->Database->update('User', '`ID` = '.$this->System->User->Id, array('Email' => $Email, 88 'Language' => $Language, 'Redirecting' => $Redirecting, 'Info' => $Info, 89 'PreferredVersion' => $PreferredVersion)); 90 $Output .= ShowMessage('Úprava nastavení proběhla v pořádku, Email: <b>'.$Email.'</b> Uživatel: <b>'.$this->System->User->Name.'</b>'); 95 91 WriteLog('Úprava nastavení!', LOG_TYPE_USER); 96 $ User->Load();92 $this->System->User->Load(); 97 93 } else $Output .= ShowMessage('Nezadány údaje.', MESSAGE_CRITICAL); 98 94 return($Output);
Note:
See TracChangeset
for help on using the changeset viewer.