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

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Translation/Form.php

    r859 r880  
    1010    $this->Title = T('Translation');
    1111    $Action = '';
    12     if(array_key_exists('action', $_GET)) $Action = $_GET['action'];
    13 
    14     if($Action == 'delete') $Output = $this->Delete();
     12    if (array_key_exists('action', $_GET)) $Action = $_GET['action'];
     13
     14    if ($Action == 'delete') $Output = $this->Delete();
    1515      else $Output = $this->ShowForm();
    16     return($Output);
     16    return $Output;
    1717  }
    1818
     
    2626    $this->GroupId = $GroupId;
    2727    $Table = $TranslationTree[$GroupId]['TablePrefix'];
    28     if(array_key_exists('action', $_GET)) $Action = $_GET['action'];
     28    if (array_key_exists('action', $_GET)) $Action = $_GET['action'];
    2929    else $Action = '';
    3030
    31     if(array_key_exists('ID', $_GET))
     31    if (array_key_exists('ID', $_GET))
    3232    {
    3333      $TextID = $_GET['ID'] * 1;
     
    3636      $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$TextID);
    3737      $Line = $DbResult->fetch_assoc();
    38       if(!$Line)
     38      if (!$Line)
    3939      {
    4040        $Output .= ShowMessage('Překlad nenalezen.', MESSAGE_CRITICAL);
     
    4747          else $Language = '`Language` != '.$this->System->Config['OriginalLanguage'];
    4848          $Columns = '';
    49           foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
     49          foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
    5050            $Columns .= ' `Orig`.`'.$TextItem['Column'].'` as `Orig_'.$TextItem['Column'].'`, `Tran`.`'.$TextItem['Column'].'` as `'.$TextItem['Column'].'`,';
    5151
     
    5656          $DbResult = $this->Database->query($sql.$join.$where);
    5757          while ($LineSearch = $DbResult->fetch_assoc()) {
    58             foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
    59               if($TextItem['Visible'] == 1)
     58            foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
     59              if ($TextItem['Visible'] == 1)
    6060                if (($LineAJ[$TextItem['Column']] <> '') and
    6161                    ($LineSearch[$TextItem['Column']] <> '') and
     
    7474          $LineAJ = $DbResult->fetch_assoc();
    7575        }
    76         if(!$LineAJ)
     76        if (!$LineAJ)
    7777        {
    7878          $Output .= ShowMessage('Anglický originál k překladu nenalezen.', MESSAGE_CRITICAL);
     
    8080        {
    8181
    82           if($Line['User'] != '')
     82          if ($Line['User'] != '')
    8383          {
    8484            $IDUser = $this->Database->query('SELECT * FROM `User` WHERE `ID` = '.$Line['User']);
     
    8989          $Output .= T('Group').': <strong>'.$TranslationTree[$GroupId]['Name'].'</strong><br />';
    9090
    91           if(($Line['Language'] <> 0) and ($LineUser['Name'] <> ''))
     91          if (($Line['Language'] <> 0) and ($LineUser['Name'] <> ''))
    9292            $Output .= T('Translated by').': <a href="'.$this->System->Link('/user/?user='.$Line['User']).'"><strong>'.$LineUser['Name'].'</strong></a> dne '.HumanDate($Line['ModifyTime']).'<br />';
    93           if(($Line['Take'] <> 0) and ($Line['Take'] <> $Line['ID']))
     93          if (($Line['Take'] <> 0) and ($Line['Take'] <> $Line['ID']))
    9494          {
    9595            $DbResult = $this->Database->query('SELECT `Language`,`VersionStart`,`VersionEnd` FROM `'.$Table.'` WHERE `ID` = '.$Line['Take']);
     
    105105          }
    106106          $Output .= 'Text: ';
    107           if($Line['Language'] <> 0)
    108           {
    109             if($Line['Complete'] == 1) $Output .= ' <b>'.T('Completed').'</b>';
     107          if ($Line['Language'] <> 0)
     108          {
     109            if ($Line['Complete'] == 1) $Output .= ' <b>'.T('Completed').'</b>';
    110110            else $Output .= ' <b>'.T('Stored in unfinished').'</b> ';
    111111          } else $Output .= ' <b>'.T('Original version').'</b> ';
     
    120120          $Version = $DbResult->fetch_row();
    121121          $Version = $Version[0];
    122           if($Version > 0)
     122          if ($Version > 0)
    123123          {
    124124            $Output .= '<form action="comparison.php" method="get"><a href="'.$this->System->Link('/TranslationList.php?group='.
     
    128128            <input type="hidden" name="ID2" value="'.$TextID.'" />';
    129129
    130             if($this->System->User->Licence(LICENCE_USER)) { // allow to compare only to user
     130            if ($this->System->User->Licence(LICENCE_USER)) { // allow to compare only to user
    131131              $Output .= '<select onchange="this.form.submit();" name="ID1">
    132132              <option value="-1">'.T('Select text for comparison').'</option>
    133133              <option value="-1">'.T('Show/compare all').'</option>';
    134134              $DataID = $this->Database->query('SELECT *, (SELECT `User`.`Name` AS `UserName` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE (`Entry` = '.$Line['Entry'].') AND (`ID` <> '.$Line['ID'].')');
    135               while($Version = $DataID->fetch_array())
     135              while ($Version = $DataID->fetch_array())
    136136              {
    137                 if($Version['ID'] == $Line['Take']) $Output .= '<option value="'.
     137                if ($Version['ID'] == $Line['Take']) $Output .= '<option value="'.
    138138                 $Version['ID'].'">'.$Version['ID'].' - '.$Version['User'].' ('.T('taken over').')</option>';
    139139                else
    140140                {
    141                   if($Version['Language'] == 0) $Version['UserName'] = T('Original');
     141                  if ($Version['Language'] == 0) $Version['UserName'] = T('Original');
    142142                  $Output .= '<option value="'.$Version['ID'].'">'.$Version['ID'].' - '.
    143143                      $Version['UserName'].' ('.GetVersionWOW($Version['VersionStart']).' - '.
     
    155155
    156156          // Special characters: $B - New line, $N - Name, $C - profession
    157           if($this->System->User->Licence(LICENCE_USER))
     157          if ($this->System->User->Licence(LICENCE_USER))
    158158          {
    159159            $Output .= '<form action="'.$this->System->Link('/save.php?group='.$GroupId).'" method="post"><div>';
    160160            // TODO: Remove fixed group id condition
    161           //  if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11))
     161          //  if (($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11))
    162162            $Output .= '<a href="'.$this->System->Link('/dictionary/?action=group&amp;group='.
    163163              $GroupId.'&amp;ID='.$LineAJ['ID']).'" target="_blank"  title="Zobrazit přeložené názvy věci, postav, a herních objektů k tomuto překladu">'.T('Search in names').'</a>';
     
    169169          }
    170170
    171           if($TranslationTree[$GroupId]['WowheadName'] != '')
     171          if ($TranslationTree[$GroupId]['WowheadName'] != '')
    172172            $WowheadLink = '<a href="http://www.wowhead.com/?'.$TranslationTree[$GroupId]['WowheadName'].
    173173              '='.$LineAJ['Entry'].'">'.$LineAJ['Entry'].'</a>';
     
    187187          <td>'.T('Original').'</td>
    188188          <td>';
    189           if($Line['Language'] <> 0) $Language = $Line['Language'];
    190           else if($this->System->User->Id != 0)
     189          if ($Line['Language'] <> 0) $Language = $Line['Language'];
     190          else if ($this->System->User->Id != 0)
    191191          {
    192192            $Language = $this->System->User->Language;
    193193          } else $Language = 0;
    194           if($this->System->User->Licence(LICENCE_USER)) $Output .= WriteLanguages($Language);
     194          if ($this->System->User->Licence(LICENCE_USER)) $Output .= WriteLanguages($Language);
    195195            else {
    196196            $DbResult3 = $this->Database->select('Language', '`Id`, `Name`', '(`Enabled` = 1) AND (`Id`='.$Language.')');
    197             if($DbResult3->num_rows > 0)
     197            if ($DbResult3->num_rows > 0)
    198198            {
    199199              $Language = $DbResult3->fetch_assoc();
     
    209209             '<script>';
    210210          $Output .=    '$(document).ready(function() {';
    211           foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
     211          foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
    212212            $Output .=   '$("#'.$TextItem['Column'].'").load("'.$this->System->Link('/LoadNames.php?ID='.$LineAJ['ID'].'&Column='.$TextItem['Column'].'&GroupId='.$GroupId).'");';
    213213
     
    215215            '</script>';
    216216
    217           foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
    218             if($TextItem['Visible'] == 1)
     217          foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
     218            if ($TextItem['Visible'] == 1)
    219219            {
    220               if(($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> ''))
     220              if (($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> ''))
    221221              {
    222                 if(($TextItem['Name'] == 'Text') and (($Table == 'global_strings') or ($Table == 'glue_strings')))
     222                if (($TextItem['Name'] == 'Text') and (($Table == 'global_strings') or ($Table == 'glue_strings')))
    223223                  $Output .= '<tr><th>'.$LineAJ['ShortCut'].'</th>';
    224224                else $Output .= '<tr><th>'.T($TextItem['Name']).'</th>';
    225225                $Output .= '<td id="'.$TextItem['Column'].'">'.str_replace("\n", '<br/>', htmlspecialchars($LineAJ[$TextItem['Column']])).'</td>
    226226                <td>';
    227                 if($this->System->User->Licence(LICENCE_USER))
     227                if ($this->System->User->Licence(LICENCE_USER))
    228228                  $Output .= '<textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'">';
    229229                $Output .=  htmlspecialchars($Line[$TextItem['Column']]);
    230                 if($this->System->User->Licence(LICENCE_USER)) $Output .= '</textarea></td></tr>';
     230                if ($this->System->User->Licence(LICENCE_USER)) $Output .= '</textarea></td></tr>';
    231231              }
    232232            } else
     
    235235            }
    236236            $Output .= '</table></div>';
    237             if($this->System->User->Licence(LICENCE_USER)) {
     237            if ($this->System->User->Licence(LICENCE_USER)) {
    238238              $Output .= '</form>';
    239239
    240               if(isset($this->System->Config['Web']['EnableGoogleTranslate']) and
     240              if (isset($this->System->Config['Web']['EnableGoogleTranslate']) and
    241241                $this->System->Config['Web']['EnableGoogleTranslate'])
    242242              {
    243243              $Output .= '<br/><table class="BaseTable">'.
    244244              '<tr><th>'.T('Google translator').':</th><th>'.T('Not translated').'</th><th>'.T('Translated').'</th>';
    245               foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
    246                 if($TextItem['Visible'] == 1)
     245              foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
     246                if ($TextItem['Visible'] == 1)
    247247                  if ($LineAJ[$TextItem['Column']] <> '')
    248248                    $Output .= '<tr><td>'.$TextItem['Column'].'</td>'.
     
    256256      }
    257257    } else $Output = ShowMessage('Nebylo zadáno ID.', MESSAGE_CRITICAL);
    258     return($Output);
     258    return $Output;
    259259  }
    260260
     
    263263    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    264264
    265     if($this->System->User->Licence(LICENCE_MODERATOR))
     265    if ($this->System->User->Licence(LICENCE_MODERATOR))
    266266    {
    267267      $GroupId = LoadGroupIdParameter();
     
    273273      $this->System->ModuleManager->Modules['Log']->WriteLog('Překlad byl smazán! <a href="'.$this->System->Link('/form.php?group='.$this->GroupId.'&amp;ID='.$TextID).'">'.$TextID.'</a>', LOG_TYPE_MODERATOR);
    274274    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    275     return($Output);
     275    return $Output;
    276276  }
    277277}
Note: See TracChangeset for help on using the changeset viewer.