Ignore:
Timestamp:
Apr 7, 2020, 10:15:48 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
File:
1 edited

Legend:

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

    r861 r880  
    55  function ShowForm()
    66  {
    7     if(array_key_exists('sc', $_POST)) $Human = true;
     7    if (array_key_exists('sc', $_POST)) $Human = true;
    88      else $Human = false;
    9     if(array_key_exists('user', $_POST)) $UserName = $_POST['user'];
     9    if (array_key_exists('user', $_POST)) $UserName = $_POST['user'];
    1010      else $UserName = '';
    11     if(array_key_exists('Email', $_POST)) $Email = $_POST['Email'];
     11    if (array_key_exists('Email', $_POST)) $Email = $_POST['Email'];
    1212      else $Email = '';
    13     if(array_key_exists('Team', $_POST)) $Team = $_POST['Team'];
     13    if (array_key_exists('Team', $_POST)) $Team = $_POST['Team'];
    1414      else $Team = '';
    15     if(array_key_exists('Language', $_POST)) $Language = $_POST['Language'];
     15    if (array_key_exists('Language', $_POST)) $Language = $_POST['Language'];
    1616      else $Language = 1;
    1717
     
    2424    <tr>
    2525    <th class="Left">'.T('Are you human?').'</th>';
    26     if($Human) $Checked = ' checked="checked"';
     26    if ($Human) $Checked = ' checked="checked"';
    2727      else $Checked = '';
    2828    $Output .= '<td><input type="checkbox" name="sc" '.$Checked.'/></td>
     
    5050    <tr>
    5151    <th class="Left">'.T('I belong to team').':</th>';
    52     if($Team == '') $Selected = ' selected="selected"';
     52    if ($Team == '') $Selected = ' selected="selected"';
    5353      else $Selected = '';
    5454    $Output .= '<td><select name="Team"><option value="0"'.$Selected.'>'.T('none').'</option>';
    5555    $DbResult = $this->Database->query('SELECT `Name`, `Id` FROM `Team`');
    56     while($Line = $DbResult->fetch_assoc())
     56    while ($Line = $DbResult->fetch_assoc())
    5757    {
    58       if($Team == $Line['Id']) $Selected = ' selected="selected"';
     58      if ($Team == $Line['Id']) $Selected = ' selected="selected"';
    5959      else $Selected = '';
    6060      $Output .= '<option value="0'.$Line['Id'].'"'.$Selected.'>'.htmlspecialchars($Line['Name']).'</option>';
     
    8181    </tr>
    8282    </table></fieldset></form>';
    83     return($Output);
     83    return $Output;
    8484  }
    8585
     
    9191    $ShowForm = true;
    9292
    93       if(array_key_exists('user', $_POST)) $UserName = $_POST['user'];
     93      if (array_key_exists('user', $_POST)) $UserName = $_POST['user'];
    9494        else $UserName = '';
    95       if(array_key_exists('pass', $_POST)) $Pass = $_POST['pass'];
     95      if (array_key_exists('pass', $_POST)) $Pass = $_POST['pass'];
    9696        else $Pass = '';
    97       if(array_key_exists('pass2', $_POST)) $Pass2 = $_POST['pass2'];
     97      if (array_key_exists('pass2', $_POST)) $Pass2 = $_POST['pass2'];
    9898        else $Pass2 = '';
    99       if(array_key_exists('Email', $_POST)) $Email = $_POST['Email'];
     99      if (array_key_exists('Email', $_POST)) $Email = $_POST['Email'];
    100100        else $Email = '';
    101       if(array_key_exists('Team', $_POST)) $Team = $_POST['Team'] * 1;
     101      if (array_key_exists('Team', $_POST)) $Team = $_POST['Team'] * 1;
    102102        else $Team = '';
    103       if(array_key_exists('Language', $_POST)) $Language = $_POST['Language'] * 1;
     103      if (array_key_exists('Language', $_POST)) $Language = $_POST['Language'] * 1;
    104104        else $Language = '';
    105       if(array_key_exists('ClientVersion', $_POST)) $PreferredVersion = $_POST['ClientVersion'] * 1;
     105      if (array_key_exists('ClientVersion', $_POST)) $PreferredVersion = $_POST['ClientVersion'] * 1;
    106106        else $PreferredVersion = '';
    107       if($PreferredVersion == '') $PreferredVersion = 'NULL';
    108       if(array_key_exists('sc', $_POST)) $SpamCheck = $_POST['sc'];
     107      if ($PreferredVersion == '') $PreferredVersion = 'NULL';
     108      if (array_key_exists('sc', $_POST)) $SpamCheck = $_POST['sc'];
    109109        else $SpamCheck = '';
    110110
    111       if($SpamCheck != '')
     111      if ($SpamCheck != '')
    112112      {
    113         if(($UserName != '') and ($Pass != '') and ($Pass2 != ''))
     113        if (($UserName != '') and ($Pass != '') and ($Pass2 != ''))
    114114        {
    115           if(!in_array(strtolower($UserName), $Config['ForbiddedUserNames']))
     115          if (!in_array(strtolower($UserName), $Config['ForbiddedUserNames']))
    116116          {
    117             if($Pass == $Pass2)
     117            if ($Pass == $Pass2)
    118118            {
    119119              $DbResult = $this->Database->query('SELECT * FROM `User` WHERE LOWER(`Name`) = LOWER("'.$UserName.'")');
    120120              $Line = $DbResult->fetch_row();
    121               if(!$Line)
     121              if (!$Line)
    122122              {
    123                 if($Team == 0) $Team = 'NULL';
     123                if ($Team == 0) $Team = 'NULL';
    124124                $this->System->User->Register($UserName, $Pass, $Email, $Language, $Team, $PreferredVersion);
    125125                $Output .= ShowMessage(T('Registration was successful'));
     
    154154      } else $Output = ShowMessage('Nejsi člověk. Strojům není dovoleno se registrovat.', MESSAGE_CRITICAL);
    155155
    156       if($ShowForm) $Output .= $this->ShowForm();
    157       return($Output);
     156      if ($ShowForm) $Output .= $this->ShowForm();
     157      return $Output;
    158158  }
    159159
     
    162162    $this->Title = T('User registration');
    163163    $Output = '';
    164     if(array_key_exists('user', $_POST))
     164    if (array_key_exists('user', $_POST))
    165165    {
    166166      $Output .= $this->CheckRegistration();
    167167    } else $Output .= $this->ShowForm();
    168     return($Output);
     168    return $Output;
    169169  }
    170170}
Note: See TracChangeset for help on using the changeset viewer.