Ignore:
Timestamp:
Mar 3, 2023, 11:36:26 PM (22 months ago)
Author:
chronos
Message:
  • Fixed: User profile and options in case of incorrectly set null user info.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/User/Options.php

    r888 r892  
    1515    <tr><td>'.T('After save translation redirect to').': </td><td>';
    1616    $Output .= '<select name="redirecting">'.
    17         '<option value="0">'.T('Nowhere').'</option>'.
    18         '<option value="1"';
     17      '<option value="0">'.T('Nowhere').'</option>'.
     18      '<option value="1"';
    1919    if ($this->System->User->Redirecting == '1') $Output .= ' selected="selected"';
    2020    $Output .= '>'.T('To untranslated').'</option>';
     
    3636    $DbResult = $this->Database->query($Query);
    3737    $Output .= T('User obey selected rules').':</td><td>';
    38     while ($UserTag = $DbResult->fetch_array()) {
    39      $Query = 'SELECT * FROM `UserTag` '.
    40      //'LEFT JOIN `UserTagType` ON `UserTagType`.`ID` = `UserTag`.`UserTagType` '.
    41      'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($this->System->User->Id * 1);
     38    while ($UserTag = $DbResult->fetch_array())
     39    {
     40      $Query = 'SELECT * FROM `UserTag` '.
     41      //'LEFT JOIN `UserTagType` ON `UserTagType`.`ID` = `UserTag`.`UserTagType` '.
     42      'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($this->System->User->Id * 1);
    4243      $DbResult2 = $this->Database->query($Query);
    4344      if ($DbResult2->num_rows != 0) $checked = true;
    44       else $checked = false;
     45        else $checked = false;
    4546
    4647      $Output .= CheckBox('Tag'.$UserTag['ID'], $checked, 'CheckBox');
     
    5051
    5152    $Output .= '<tr><td colspan="2"><input type="submit" value="'.T('Save').'" /></td></tr>'.
    52         '</table></fieldset>'.
    53         '</form>';
     53      '</table></fieldset>'.
     54      '</form>';
    5455
    5556    $Output .= '<fieldset><legend>'.T('Translation team').'</legend>';
    5657    $DbResult = $this->Database->query('SELECT `Id`, `Name` FROM `Team`');
    5758    $Output .= '<a href="'.$this->System->Link('/team/?action=create').'">'.T('Create team').'</a><br />'.
    58         '<a href="'.$this->System->Link('/team/?action=leave').'">'.T('Leave team').'</a><br />'.
    59         '<br /><form action="'.$this->System->Link('/team/').'" method="get">'.
    60         '<input type="hidden" name="action" value="gointeam"/>'.
    61         '<select name="id">';
     59      '<a href="'.$this->System->Link('/team/?action=leave').'">'.T('Leave team').'</a><br />'.
     60      '<br /><form action="'.$this->System->Link('/team/').'" method="get">'.
     61      '<input type="hidden" name="action" value="gointeam"/>'.
     62      '<select name="id">';
    6263    while ($LineTeam = $DbResult->fetch_assoc())
    6364    {
     
    107108      $Query = 'SELECT * FROM UserTagType';
    108109      $DbResult = $this->Database->query($Query);
    109       while ($UserTag = $DbResult->fetch_array()) {
    110        if (array_key_exists('Tag'.$UserTag['ID'], $_POST)) {
    111          $Query = 'SELECT * FROM `UserTag` '.
    112          'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($this->System->User->Id * 1);
    113          $DbResult2 = $this->Database->query($Query);
    114          if ($DbResult2->num_rows == 0) {
    115            $Query = 'INSERT INTO `UserTag` (`ID` ,`UserTagType`,`User` ) '.
    116            'VALUES (NULL, '.$UserTag['ID'].' , '.($this->System->User->Id * 1).')';
    117            $DbResult2 = $this->Database->query($Query);
    118          }
    119        } else {
    120          $Query = 'DELETE FROM `UserTag` '.
    121          'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($this->System->User->Id * 1);
    122          $DbResult2 = $this->Database->query($Query);
    123        }
     110      while ($UserTag = $DbResult->fetch_array())
     111      {
     112        if (array_key_exists('Tag'.$UserTag['ID'], $_POST))
     113        {
     114          $Query = 'SELECT * FROM `UserTag` '.
     115            'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($this->System->User->Id * 1);
     116          $DbResult2 = $this->Database->query($Query);
     117          if ($DbResult2->num_rows == 0)
     118          {
     119            $Query = 'INSERT INTO `UserTag` (`ID` ,`UserTagType`,`User` ) '.
     120              'VALUES (NULL, '.$UserTag['ID'].' , '.($this->System->User->Id * 1).')';
     121            $DbResult2 = $this->Database->query($Query);
     122          }
     123        } else
     124        {
     125          $Query = 'DELETE FROM `UserTag` '.
     126            'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($this->System->User->Id * 1);
     127          $DbResult2 = $this->Database->query($Query);
     128        }
    124129      }
    125130
Note: See TracChangeset for help on using the changeset viewer.