Ignore:
Timestamp:
Apr 7, 2020, 10:15:48 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
Location:
trunk/Modules/Translation
Files:
8 edited

Legend:

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

    r859 r880  
    1212    $ArrStr2 = explode(' ', $String2);
    1313
    14     for($i = 0; $i < count($ArrStr1); $i++)
     14    for ($i = 0; $i < count($ArrStr1); $i++)
    1515    {
    16       if(isset($ArrStr2[$i]))
     16      if (isset($ArrStr2[$i]))
    1717      {
    18         if($ArrStr1[$i] == $ArrStr2[$i])
     18        if ($ArrStr1[$i] == $ArrStr2[$i])
    1919        {
    2020          $Result .= $ArrStr1[$i].' ';
     
    2222        {
    2323          $find = false;
    24           for($j = 0; $j < count($ArrStr2); $j++)
     24          for ($j = 0; $j < count($ArrStr2); $j++)
    2525          {
    26             if(($ArrStr1[$i] == $ArrStr2[$j]) and ($find == false))
     26            if (($ArrStr1[$i] == $ArrStr2[$j]) and ($find == false))
    2727            {
    2828              $Result .= $ArrStr1[$i].' ';
     
    3030            }
    3131          }
    32           if($find == false)
     32          if ($find == false)
    3333          $Result .= '<span class="edit">'.$ArrStr1[$i].' </span>';
    3434        }
    3535      } else $Result .= '<span class="edit">'.$ArrStr1[$i].' </span>';
    3636    }
    37     return($Result);
     37    return $Result;
    3838  }
    3939
     
    4444    $Output = '';
    4545
    46     if($this->System->User->Licence(LICENCE_USER))
     46    if ($this->System->User->Licence(LICENCE_USER))
    4747    {
    4848    $Output = 'Text je porovnáván vždy ku předešlému (vlevo). Změny jsou zvýrazněny <span class="edit">barvou.</span><br /><br />';
     
    5151    $Table = $TranslationTree[$GroupId]['TablePrefix'];
    5252
    53     if(array_key_exists('entry', $_GET))
     53    if (array_key_exists('entry', $_GET))
    5454    {
    5555      $Textentry = $_GET['entry'];
    56       if((array_key_exists('ID1', $_GET)) and ($_GET['ID1'] <> -1))  //porovnání pouze 2 textů
     56      if ((array_key_exists('ID1', $_GET)) and ($_GET['ID1'] <> -1))  //porovnání pouze 2 textů
    5757      {
    5858        $TextID1 = $_GET['ID1'];
     
    6666          ' LEFT JOIN `Language` ON `Language`.`Id` = `'.$Table.'`.`Language` '.
    6767          'WHERE `Entry` = '.$Textentry.' '.$WhereID.' ORDER BY `Language`');
    68       while($Line[] = $DataID->fetch_assoc());
     68      while ($Line[] = $DataID->fetch_assoc());
    6969      array_pop($Line);
    7070
     
    7474          '<table class="BaseTable">'.
    7575          '<tr><th>Přeložil</th>';
    76       foreach($Line as $Index => $LineItem)
     76      foreach ($Line as $Index => $LineItem)
    7777        $Output .= '<th>'.$LineItem['UserName'].'</th>';
    7878      $Output .= '</tr>'.
    7979          '<tr>'.
    8080          '<th>ID textu</th>';
    81       foreach($Line as $Index => $LineItem)
     81      foreach ($Line as $Index => $LineItem)
    8282        $Output .= '<td><a href="form.php?group='.$GroupId.'&amp;ID='.$LineItem['ID'].'">'.$LineItem['ID'].'</a></td>';
    8383      $Output .= '</tr>'.
    8484          '<tr><th>Převzato</th>';
    85       foreach($Line as $Index => $LineItem)
     85      foreach ($Line as $Index => $LineItem)
    8686        $Output .= '<td><a href="form.php?group='.$GroupId.'&amp;ID='.$LineItem['Take'].'">'.$LineItem['Take'].'</a></td>';
    8787      $Output .= '</tr>'.
    8888          '<tr><th>'.T('Language').'</th>';
    89       foreach($Line as $Index => $LineItem)
     89      foreach ($Line as $Index => $LineItem)
    9090        $Output .= '<td>'.T($LineItem['LanguageName']).'</td>';
    9191      $Output .= '</tr>'.
    9292          '<tr><th>'.T('Version').'</th>';
    93       foreach($Line as $Index => $LineItem)
     93      foreach ($Line as $Index => $LineItem)
    9494        $Output .= '<td>'.GetVersionWOW($LineItem['VersionStart']).' - '.GetVersionWOW($LineItem['VersionEnd']).'</td>';
    9595      $Output .= '</tr>';
    96       foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
     96      foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
    9797      {
    9898        $writethis = false;
    99         for($i = 0; $i < count($Line); $i++)
     99        for ($i = 0; $i < count($Line); $i++)
    100100        {
    101           if($Line[$i][$TextItem['Column']] <> '') $writethis = true;
     101          if ($Line[$i][$TextItem['Column']] <> '') $writethis = true;
    102102        }
    103         if($writethis)
     103        if ($writethis)
    104104        {
    105105          $Output .= '<tr><th>'.$TextItem['Name'].'</th>';
    106           for($i = 0; $i < count($Line); $i++)
     106          for ($i = 0; $i < count($Line); $i++)
    107107          {
    108             if($i > 0)
     108            if ($i > 0)
    109109            {
    110110              $Output .= '<td>';
     
    120120  } else $Output .= ShowMessage('Porovnávat můžou pouze překladatelé!', MESSAGE_CRITICAL);
    121121
    122     return($Output);
     122    return $Output;
    123123  }
    124124}
  • 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}
  • trunk/Modules/Translation/LoadNames.php

    r859 r880  
    1818    }
    1919  //   }
    20     return ($Text);
     20    return $Text;
    2121  }
    2222  function ReplaceNotTranslated($orig,$tran,$Text,$ID,$Group)
     
    2626    $Text = str_replace(' '.$orig,' <span title="Kliknutím přeložíš" class="needtran"><a class="needtran" target="_NEW2" href="'.
    2727      $this->System->Link('/form.php?group='.$Group.'&amp;ID='.$ID).'">'.$orig_replace.'</a></span>',$Text);
    28     return ($Text);
     28    return $Text;
    2929  }
    3030
     
    4444    $Text = str_replace('$r','<span Title="Znamená rasu hráče, překladu zachovej na stejné pozici." class="edit">$R</span>',$Text);
    4545    $Text = str_replace('$g','<span Title="Vybere oslovení podle pohlaví hráče, překladu zachovej na stejné pozici." class="edit">$G</span>',$Text);
    46     foreach($names as $Line) {
     46    foreach ($names as $Line) {
    4747     if (($_GET['ID'] <> $Line[0]) or ($Line[1] <> $_GET['GroupId']))
    4848      if ($Line[3] <> '')  {
     
    6161
    6262    $Output = '';
    63     if(array_key_exists('GroupId', $_GET)) $GroupId = $_GET['GroupId'];
    64       else return(ShowMessage(T('GroupId not specified'), MESSAGE_CRITICAL));
    65     if(!array_key_exists('ID', $_GET)) return(ShowMessage(T('ID not specified'), MESSAGE_CRITICAL));
    66     if(!array_key_exists('Column', $_GET)) return(ShowMessage(T('Column not specified'), MESSAGE_CRITICAL));
     63    if (array_key_exists('GroupId', $_GET)) $GroupId = $_GET['GroupId'];
     64      else return ShowMessage(T('GroupId not specified'), MESSAGE_CRITICAL);
     65    if (!array_key_exists('ID', $_GET)) return ShowMessage(T('ID not specified'), MESSAGE_CRITICAL);
     66    if (!array_key_exists('Column', $_GET)) return ShowMessage(T('Column not specified'), MESSAGE_CRITICAL);
    6767    $Table = $TranslationTree[$GroupId]['TablePrefix'];
    6868    $DbResult = $this->System->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$_GET['ID'].' LIMIT 1');
     
    7373          $names = array();
    7474          if ($this->System->User->Licence(LICENCE_USER))
    75           if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11))
     75          if (($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11))
    7676          {
    7777            //<span class="edit">barvou.</span>
    7878            $names = GetTranslatNames($Text, 0, GetTranslatNamesArray());
    7979          } else {
    80             if(($GroupId == 13)) {
     80            if (($GroupId == 13)) {
    8181              $names = GetTranslatNames($Text, 0, array('Dictionary' => 'Text',
    8282                'TextGlobalString' => 'Text', 'TextArea' => 'Name',
     
    8787          }
    8888                                   //$LineAJ[$Column]
    89           return ($this->ColorNames(htmlspecialchars($Text),$names));
     89          return $this->ColorNames(htmlspecialchars($Text),$names);
    9090    }
    9191
     
    9393  {
    9494    $this->RawPage = true;
    95     return(str_replace("\n", '<br/>', $this->LoadNames()));
     95    return str_replace("\n", '<br/>', $this->LoadNames());
    9696  }
    9797}
  • trunk/Modules/Translation/Progress.php

    r847 r880  
    88
    99    $BuildNumber = GetBuildNumber($_SESSION['StatVersion']);
    10     if(is_numeric($_SESSION['language'])) $LanguageFilter = 'AND (`Language`='.$_SESSION['language'].')';
     10    if (is_numeric($_SESSION['language'])) $LanguageFilter = 'AND (`Language`='.$_SESSION['language'].')';
    1111    else $LanguageFilter = ' AND (`Language`!='.$this->System->Config['OriginalLanguage'].')';
    1212
     
    1414    $Query = '';
    1515    $DbResult = $this->Database->query($GroupListQuery);
    16     if($DbResult->num_rows > 0)
     16    if ($DbResult->num_rows > 0)
    1717    {
    18       while($DbRow = $DbResult->fetch_assoc())
     18      while ($DbRow = $DbResult->fetch_assoc())
    1919      {
    2020        $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
     
    5050      $Total = 0;
    5151      $DbResult = $this->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.$Query.') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']);
    52       while($Group = $DbResult->fetch_assoc())
     52      while ($Group = $DbResult->fetch_assoc())
    5353      {
    5454        $Output .= '<tr><td>'.T($Group['Name']).'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>';
     
    5656        $Total += $Group['Total'];
    5757      }
    58       if($Total <> 0) $TotalCount = round($Translated / $Total * 100, 2);
     58      if ($Total <> 0) $TotalCount = round($Translated / $Total * 100, 2);
    5959      else $TotalCount = 0;
    6060      $Output .= '<tr><td><strong>'.T('Total').'</strong></td><td><strong>'.$Translated.'</strong></td><td><strong>'.$Total.'</strong></td><td><strong>'.ProgressBar(150, $TotalCount).'</strong></td></tr>'.
    6161          '</table>';
    6262    }
    63     return($Output);
     63    return $Output;
    6464  }
    6565
     
    6969    $LanguageList = GetLanguageList();
    7070
    71     if(array_key_exists('Version', $_GET)) $_SESSION['StatVersion'] = $_GET['Version'];
    72     if(!array_key_exists('StatVersion', $_SESSION))
     71    if (array_key_exists('Version', $_GET)) $_SESSION['StatVersion'] = $_GET['Version'];
     72    if (!array_key_exists('StatVersion', $_SESSION))
    7373    {
    74       if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->PreferredVersionGame != ''))
     74      if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->PreferredVersionGame != ''))
    7575      {
    7676        $_SESSION['StatVersion'] = $this->System->User->PreferredVersionGame;
     
    8080    }
    8181
    82     if(!isset($_SESSION['language']))
     82    if (!isset($_SESSION['language']))
    8383    {
    84       if($this->System->User->Licence(LICENCE_USER))
     84      if ($this->System->User->Licence(LICENCE_USER))
    8585      {
    8686        $_SESSION['language'] = $this->System->User->Language;
     
    8989      }
    9090    }
    91     if(array_key_exists('language', $_GET))
     91    if (array_key_exists('language', $_GET))
    9292    {
    93       if($_GET['language'] == '') {
     93      if ($_GET['language'] == '') {
    9494        $_SESSION['language'] = '';
    9595      } else {
     
    9797      }
    9898    }
    99     if(!array_key_exists($_SESSION['language'], $LanguageList)) $_SESSION['language'] = '';
     99    if (!array_key_exists($_SESSION['language'], $LanguageList)) $_SESSION['language'] = '';
    100100
    101101    // Show client version selection
    102102    $Output = T('Client version:').' ';
    103103    $DbResult = $this->Database->query('SELECT `Version`, `Title` FROM `ClientVersion` WHERE `Imported`=1 ORDER BY `Version`');
    104     while($DbRow = $DbResult->fetch_assoc())
     104    while ($DbRow = $DbResult->fetch_assoc())
    105105      $Output .= '<a href="?Version='.$DbRow['Version'].'" title="'.$DbRow['Title'].'">'.$DbRow['Version'].'</a> ';
    106106    $Output .= '<br/>';
     
    109109    $Output .= T('Language:').' ';
    110110    $Lang = '<a href="?language=">'.T('All').'</a>';
    111     if($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> ';
     111    if ($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> ';
    112112      else $Output .= $Lang;
    113     foreach($LanguageList as $Language)
    114     if($Language['Enabled'] == 1)
     113    foreach ($LanguageList as $Language)
     114    if ($Language['Enabled'] == 1)
    115115    {
    116116      $Lang = ' <a href="?language='.$Language['Id'].'">'.T($Language['Name']).'</a>';
    117       if($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> ';
     117      if ($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> ';
    118118        else $Output .= $Lang;
    119119    }
    120120
    121     if(is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name'];
     121    if (is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name'];
    122122      else $LanguageName = T('All');
    123123    $Output .= '<br/><br/><h3>'.sprintf(T('Statistics of translation completion of language %s for version %s'), T($LanguageName), $_SESSION['StatVersion']).'</h3><br/>';
    124124    $Output .= $this->ShowStatTable();
    125125
    126     return($Output);
     126    return $Output;
    127127  }
    128128}
  • trunk/Modules/Translation/Save.php

    r859 r880  
    1111    // Get source text record from database by ID
    1212    $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID`='.$TextID);
    13     if($DbResult->num_rows > 0)
     13    if ($DbResult->num_rows > 0)
    1414    {
    1515      $SourceText = $DbResult->fetch_assoc();
     
    1919          'AND (`Language` = '.$this->System->Config['OriginalLanguage'].') AND (`VersionStart` = '.$SourceText['VersionStart'].') '.
    2020          'AND (`VersionEnd` = '.$SourceText['VersionEnd'].')');
    21       if($DbResult->num_rows > 0)
     21      if ($DbResult->num_rows > 0)
    2222      {
    2323        $EnglishText = $DbResult->fetch_assoc();
     
    2525        // Get all similar english texts
    2626        $Filter = array();
    27         foreach($Group['Items'] as $GroupItem)
     27        foreach ($Group['Items'] as $GroupItem)
    2828        {
    29           if(($GroupItem['Visible'] == 1) and ($EnglishText[$GroupItem['Column']] != ''))
     29          if (($GroupItem['Visible'] == 1) and ($EnglishText[$GroupItem['Column']] != ''))
    3030            $Filter[] = '(`'.$GroupItem['Column'].'` = "'.addslashes($EnglishText[$GroupItem['Column']]).'")';
    3131        }
    32         if(count($Filter) > 0) $Filter = ' AND ('.implode(' OR ', $Filter).')';
     32        if (count($Filter) > 0) $Filter = ' AND ('.implode(' OR ', $Filter).')';
    3333          else $Filter = ' AND 0';
    3434
    3535          $Query = 'SELECT * FROM `'.$Table.'` WHERE (`Language` = '.$this->System->Config['OriginalLanguage'].')'.$Filter;
    3636          $DbResult = $this->Database->query($Query);
    37           while($EnglishFound = $DbResult->fetch_assoc())
     37          while ($EnglishFound = $DbResult->fetch_assoc())
    3838          {
    3939            // Get user translation paired to found english item entry
     
    4141              ') AND (`Entry` = '.$EnglishFound['Entry'].') AND (`VersionStart` = '.$EnglishFound['VersionStart'].
    4242              ') AND (`VersionEnd` = '.$EnglishFound['VersionEnd'].')');
    43             if($DbResult2->num_rows > 0)
     43            if ($DbResult2->num_rows > 0)
    4444            {
    4545              // Update existed user translation
     
    4747              $Modified = false;
    4848              $Values = '`Language` = '.$Language;
    49               if($Language != $ExistedText['Language']) $Modified = true;
     49              if ($Language != $ExistedText['Language']) $Modified = true;
    5050
    5151              $Completable = true;
    5252              $CompleteParts = $ExistedText['CompleteParts'];
    53               foreach($Group['Items'] as $GroupItem)
    54               {
    55                 if($GroupItem['Visible'] == 1)
    56                 {
    57                   if($EnglishFound[$GroupItem['Column']] == $EnglishText[$GroupItem['Column']])
     53              foreach ($Group['Items'] as $GroupItem)
     54              {
     55                if ($GroupItem['Visible'] == 1)
     56                {
     57                  if ($EnglishFound[$GroupItem['Column']] == $EnglishText[$GroupItem['Column']])
    5858                  {
    59                     if(array_key_exists($GroupItem['Column'], $_POST))
     59                    if (array_key_exists($GroupItem['Column'], $_POST))
    6060                    {
    61                       if($_POST[$GroupItem['Column']] != $ExistedText[$GroupItem['Column']])
     61                      if ($_POST[$GroupItem['Column']] != $ExistedText[$GroupItem['Column']])
    6262                        $Modified = true;
    6363
     
    6666                    }
    6767                  }
    68                   if((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and
     68                  if ((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and
    6969                      ($EnglishFound[$GroupItem['Column']] != '')) $Completable = false;
    7070                }
    7171              }
    72               if($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed
     72              if ($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed
    7373                else $NewComplete = 0;
    7474
    7575              // Update completion status for edited translation item
    76               if($SourceText['ID'] == $ExistedText['ID'])
     76              if ($SourceText['ID'] == $ExistedText['ID'])
    7777              {
    7878                $NewComplete = $Complete; // Our original user text, set complete according user choice
    79                 if($Complete == 1)
    80                 {
    81                   foreach($Group['Items'] as $GroupItem)
    82                     if($GroupItem['Visible'] == 1) $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1));
     79                if ($Complete == 1)
     80                {
     81                  foreach ($Group['Items'] as $GroupItem)
     82                    if ($GroupItem['Visible'] == 1) $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1));
    8383                }
    8484              }
    8585              $Values .= ', `Complete`='.$NewComplete.', `CompleteParts` = '.$CompleteParts;
    86               if(($NewComplete != $ExistedText['Complete']) or ($CompleteParts != $ExistedText['CompleteParts']))
     86              if (($NewComplete != $ExistedText['Complete']) or ($CompleteParts != $ExistedText['CompleteParts']))
    8787                $Modified = true;
    8888
    8989              $Values .= ', `ModifyTime` = NOW()';
    90               if($Modified)
     90              if ($Modified)
    9191              {
    9292                // Update user translation
     
    114114              $CompleteParts = 0;
    115115              $Completable = true;
    116               foreach($Group['Items'] as $GroupItem)
     116              foreach ($Group['Items'] as $GroupItem)
    117117              {
    118118                $Columns .= ', `'.$GroupItem['Column'].'`';
    119                 if($GroupItem['Visible'] == 1)
    120                 {
    121                   if($EnglishFound[$GroupItem['Column']] == $EnglishText[$GroupItem['Column']])
     119                if ($GroupItem['Visible'] == 1)
     120                {
     121                  if ($EnglishFound[$GroupItem['Column']] == $EnglishText[$GroupItem['Column']])
    122122                  {
    123123                    // Read form user data
    124                     if(array_key_exists($GroupItem['Column'], $_POST))
     124                    if (array_key_exists($GroupItem['Column'], $_POST))
    125125                    {
    126126                      $Values .= ', "'.$_POST[$GroupItem['Column']].'"';
     
    128128                    } else $Values .= ', "'.addslashes($EnglishFound[$GroupItem['Column']]).'"';
    129129                  } else $Values .= ', "'.addslashes($EnglishFound[$GroupItem['Column']]).'"';
    130                   if((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and ($EnglishFound[$GroupItem['Column']] != '')) $Completable = false;
     130                  if ((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and ($EnglishFound[$GroupItem['Column']] != '')) $Completable = false;
    131131                } else
    132132                {
     
    135135                }
    136136              }
    137               if($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed
     137              if ($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed
    138138                else $NewComplete = 0;
    139139              // Update completion status for edited translation item
    140               if($SourceText['ID'] == $EnglishFound['ID'])
     140              if ($SourceText['ID'] == $EnglishFound['ID'])
    141141              {
    142142                $TakeID = $TextID;
    143143                $NewComplete = $Complete; // Our original user text, set complete according user choice
    144                 if($Complete == 1)
    145                 {
    146                   foreach($Group['Items'] as $GroupItem)
    147                     if($GroupItem['Visible'] == 1) $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1));
     144                if ($Complete == 1)
     145                {
     146                  foreach ($Group['Items'] as $GroupItem)
     147                    if ($GroupItem['Visible'] == 1) $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1));
    148148                }
    149149              }
     
    171171      } else $Output .= ShowMessage('Anglický originál k překladu nenalezen.', MESSAGE_CRITICAL);
    172172    } else $Output .= ShowMessage('Zadaná položka nenalezena.', MESSAGE_CRITICAL);
    173     return($Output);
     173    return $Output;
    174174  }
    175175
     
    183183    unset($Message);
    184184    $this->System->ModuleManager->Modules['FrontPage']->HandleLoginForm();
    185     if(isset($Message)) $Output .= ShowMessage($Message, $MessageType);
     185    if (isset($Message)) $Output .= ShowMessage($Message, $MessageType);
    186186
    187187    $GroupId = LoadGroupIdParameter();
    188188    $Group = $TranslationTree[$GroupId];
    189189    $Table = $Group['TablePrefix'];
    190     if($this->System->User->Licence(LICENCE_USER))
    191     {
    192       if(array_key_exists('ID', $_POST) and is_numeric($_POST['ID']))
     190    if ($this->System->User->Licence(LICENCE_USER))
     191    {
     192      if (array_key_exists('ID', $_POST) and is_numeric($_POST['ID']))
    193193      {
    194194        $Entry = $_POST['entry'] * 1;
    195195        $TextID = $_POST['ID'] * 1;
    196196        $Language = $_POST['Language'] * 1;
    197         if(array_key_exists('End', $_POST)) $Complete = 1;
     197        if (array_key_exists('End', $_POST)) $Complete = 1;
    198198          else $Complete = 0;
    199199
     
    207207    {
    208208      // User automatically logged out. Show login dialog and allow to save retry.
    209       if(array_key_exists('ID', $_POST) and array_key_exists('entry', $_POST) and array_key_exists('Language', $_POST) and array_key_exists('user', $_POST))
     209      if (array_key_exists('ID', $_POST) and array_key_exists('entry', $_POST) and array_key_exists('Language', $_POST) and array_key_exists('user', $_POST))
    210210      {
    211211        $Output .= 'Byli jste automaticky odhlášeni. Pro <strong>Uložení překladu</strong> se musíte přihlásit zde:<br /><br />'.
     
    216216          '<input type="hidden" name="Language" value="'.$_POST['Language'].'" />';
    217217
    218         foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
     218        foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
    219219        {
    220           if(array_key_exists($TextItem['Column'], $_POST)) $Value = $_POST[$TextItem['Column']]; else $Value = '';
     220          if (array_key_exists($TextItem['Column'], $_POST)) $Value = $_POST[$TextItem['Column']]; else $Value = '';
    221221          $Output .= '<input id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'" type="hidden" value="'.htmlspecialchars($Value).'" />';
    222222        }
     
    232232      } else $Output = ShowMessage('Nezadány požadované údaje.', MESSAGE_CRITICAL);
    233233    }
    234     return($Output);
     234    return $Output;
    235235  }
    236236
     
    246246    $redirecting = $DbResult->fetch_assoc();
    247247
    248     switch($redirecting['Redirecting'])
     248    switch ($redirecting['Redirecting'])
    249249    {
    250250      case 1:
     
    254254        break;
    255255      case 2:
    256         if($next <> '')
     256        if ($next <> '')
    257257          $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'.
    258258            'setTimeout("parent.location.href=\''.htmlspecialchars_decode($next).'\'", 1500)'.
     
    260260          break;
    261261      case 3:
    262         if($prev <> '')
     262        if ($prev <> '')
    263263          $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'.
    264264            'setTimeout("parent.location.href=\''.htmlspecialchars_decode($prev).'\'", 1500)'.
     
    269269    $Output .= sprintf(T('You can be redirected automatically from this page. You can set where you want to be transfered here: %s'), '<a href="'.
    270270      $this->System->Link('/options/').'" title="'.T('User settings').'">'.T('Options').'</a>');
    271     return($Output);
     271    return $Output;
    272272  }
    273273}
  • trunk/Modules/Translation/Translation.php

    r861 r880  
    4747      'Icon' => '',
    4848    ));
    49     if(array_key_exists('Search', $this->System->ModuleManager->Modules))
     49    if (array_key_exists('Search', $this->System->ModuleManager->Modules))
    5050    {
    5151      $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    52       foreach($TranslationTree as $Group)
     52      foreach ($TranslationTree as $Group)
    5353      {
    5454        $Table = $Group['TablePrefix'];
    5555
    5656        $Columns = array('ID', 'Entry');
    57         foreach($Group['Items'] as $Item)
     57        foreach ($Group['Items'] as $Item)
    5858        {
    59           if($Item['Column'] != '') $Columns[] = $Item['Column'];
     59          if ($Item['Column'] != '') $Columns[] = $Item['Column'];
    6060        }
    6161
     
    7474    $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `Date`, `User`.`Name` AS `UserName`, `Text` FROM `Log` '.
    7575    'JOIN `User` ON `User`.`ID` = `Log`.`User` WHERE `Type` = 1 ORDER BY `Date` DESC LIMIT 100');
    76     while($DbRow = $DbResult->fetch_assoc())
     76    while ($DbRow = $DbResult->fetch_assoc())
    7777    {
    7878      $Items[] = array
     
    9292      'Items' => $Items,
    9393    ));
    94     return($Output);
     94    return $Output;
    9595  }
    9696
     
    105105    $UnionItems = array();
    106106    $DbResult = $this->Database->query($GroupListQuery);
    107     if($DbResult->num_rows > 0)
    108     {
    109       while($DbRow = $DbResult->fetch_assoc())
     107    if ($DbResult->num_rows > 0)
     108    {
     109      while ($DbRow = $DbResult->fetch_assoc())
    110110      {
    111111        $UnionItems[] = 'SELECT `T`.`ID`, `T`.`Take`, `T`.`User`, `T`.`ModifyTime`, `T`.`Group`, `T`.`GroupName` '.
     
    122122      $DbResult = $this->Database->query($Query);
    123123      $Output .= '<table class="MiniTable"><tr><th>'.T('Date').'</th><th>'.T('Who').'</th><th>'.T('New').'</th><th>'.T('Source').'</th><th>'.T('Group').'</th></tr>';
    124       while($DbRow = $DbResult->fetch_assoc())
     124      while ($DbRow = $DbResult->fetch_assoc())
    125125      {
    126126        $Output .= '<tr><td>'.HumanDate($DbRow['ModifyTime']).'</td>'.
     
    133133    }
    134134    $Output .= '</div>';
    135     return($Output);
     135    return $Output;
    136136  }
    137137
    138138  function GetTranslationTree()
    139139  {
    140     if(isset($this->TranslationTree)) return($this->TranslationTree);
     140    if (isset($this->TranslationTree)) return $this->TranslationTree;
    141141    else {
    142142      $Result = array();
    143143      $Groups = array();
    144144      $DbResult = $this->System->Database->query('SELECT *, UNIX_TIMESTAMP(`LastImport`) AS `LastImportTime` FROM `Group`');
    145       while($DbRow = $DbResult->fetch_assoc())
     145      while ($DbRow = $DbResult->fetch_assoc())
    146146        $Groups[T($DbRow['Name'])] = $DbRow;
    147147      ksort($Groups);
    148       foreach($Groups as $Group)
     148      foreach ($Groups as $Group)
    149149      {
    150150        $Group['Items'] = array();
     
    153153      }
    154154      $DbResult = $this->System->Database->query('SELECT * FROM `GroupItem` ORDER BY `Group`, `Sequence`');
    155       while($DbRow = $DbResult->fetch_assoc())
     155      while ($DbRow = $DbResult->fetch_assoc())
    156156      {
    157157        $Result[$DbRow['Group']]['Items'][] = $DbRow;
    158158      }
    159159      $this->TranslationTree = $Result;
    160       return($Result);
     160      return $Result;
    161161    }
    162162  }
     
    168168    $Output = '<strong>'.T('Translate groups').':</strong><br /><div id="TranslationMenu">';
    169169    $DbResult = $this->System->Database->select('Group', '`Id`, `Name`', '1 ORDER BY `Name`');
    170     while($Group = $DbResult->fetch_assoc())
     170    while ($Group = $DbResult->fetch_assoc())
    171171    {
    172172      $Groups[T($Group['Name'])] = $Group;
    173173    }
    174174    ksort($Groups);
    175     foreach($Groups as $Group)
     175    foreach ($Groups as $Group)
    176176    {
    177177      $Output .= '<div id="menuitem-group'.$Group['Id'].'" onmouseover="show(\'group'.$Group['Id'].'\')" onmouseout="hide(\'group'.$Group['Id'].'\')">'.
     
    183183        '&nbsp;<a title="Přeložené texty, můžete zde hlasovat, nebo opravovat překlady" href="'.
    184184        $this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;state=2&amp;user=0&amp;entry=&amp;text=').'">'.T('Translated').'</a><br />';
    185       if(isset($this->System->User) and $this->System->User->Licence(LICENCE_USER))
     185      if (isset($this->System->User) and $this->System->User->Licence(LICENCE_USER))
    186186      {
    187187        $Output .= '&nbsp;<a title="'.T('Unfinished translations').'" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;state=3').'">'.T('Unfinished').'</a><br />'.
     
    196196    }
    197197    $Output .= '</div>';
    198     return($Output);
     198    return $Output;
    199199  }
    200200}
  • trunk/Modules/Translation/TranslationList.php

    r859 r880  
    4747    );
    4848    foreach ($StateTypes as $index => $StateType) {
    49       if($Filter['State'] == $index) $Selected = ' selected="selected"';
     49      if ($Filter['State'] == $index) $Selected = ' selected="selected"';
    5050      else $Selected = '';
    5151      $Output .= '<option value="'.$index.'"'.$Selected.'>'.$StateType.'</option>';
     
    5454
    5555    // Translation group
    56     if($GroupId == 0)
     56    if ($GroupId == 0)
    5757    {
    5858      $Filter['Group'] = GetParameter('group', 0, true, true);
    59       if($Filter['Group'] != 0)
     59      if ($Filter['Group'] != 0)
    6060      {
    61         if(isset($TranslationTree[$Filter['Group']]) == false)
     61        if (isset($TranslationTree[$Filter['Group']]) == false)
    6262          ErrorMessage('Překladová skupina dle zadaného Id neexistuje.');
    6363        $Table = $TranslationTree[$Filter['Group']]['TablePrefix'];
     
    7070
    7171    $Output .= '<td><select name="group" style="width: 80px">';
    72     if($Filter['Group'] == 0) $Selected = ' selected="selected"';
     72    if ($Filter['Group'] == 0) $Selected = ' selected="selected"';
    7373    else $Selected = '';
    7474    $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>';
    7575    $DbResult = $this->Database->query('SELECT `Id`,`Name` FROM `Group`');
    76     while($Group = $DbResult->fetch_assoc())
     76    while ($Group = $DbResult->fetch_assoc())
    7777      $Groups[T($Group['Name'])] = $Group;
    7878    ksort($Groups);
    79     foreach($Groups as $Group)
    80     {
    81       if($Group['Id'] == $Filter['Group']) $Selected = ' selected="selected"';
     79    foreach ($Groups as $Group)
     80    {
     81      if ($Group['Id'] == $Filter['Group']) $Selected = ' selected="selected"';
    8282      else $Selected = '';
    8383      $Output .= '<option value="'.$Group['Id'].'"'.$Selected.'>'.T($Group['Name']).'</option>';
     
    8989    else
    9090      $Filter['Version'] = GetParameter('version', 0, true, true);
    91     if($Filter['Version'] != 0)
     91    if ($Filter['Version'] != 0)
    9292    {
    9393      $DbResult = $this->Database->query('SELECT `Id`, `BuildNumber`,`Version` FROM `ClientVersion` WHERE (`Imported` = 1) AND (`Id` ='.$Filter['Version'].')');
    94       if($DbResult->num_rows > 0)
     94      if ($DbResult->num_rows > 0)
    9595      {
    9696        $DbRow = $DbResult->fetch_assoc();
     
    9999    }
    100100    $Output .= '<td><select name="version">';
    101     if($Filter['Version'] == 0) $Selected = ' selected="selected"';
     101    if ($Filter['Version'] == 0) $Selected = ' selected="selected"';
    102102    else $Selected = '';
    103103    $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>';
    104104    $DbResult = $this->Database->query('SELECT `Id`, `BuildNumber`,`Version` FROM `ClientVersion` WHERE `Imported` = 1 ORDER BY `BuildNumber` DESC');
    105     while($Version = $DbResult->fetch_assoc())
    106     {
    107       if($Version['Id'] == $Filter['Version']) $Selected = ' selected="selected"';
     105    while ($Version = $DbResult->fetch_assoc())
     106    {
     107      if ($Version['Id'] == $Filter['Version']) $Selected = ' selected="selected"';
    108108      else $Selected = '';
    109109      $Output .= '<option value="'.$Version['Id'].'"'.$Selected.'>'.$Version['Version'].'</option>';
    110110    }
    111111    $Output .= '</select></td>';
    112     if($Filter['Version'] != 0) $VersionFilter = ' AND (`VersionStart` <= '.$Filter['BuildNumber'].') AND (`VersionEnd` >= '.$Filter['BuildNumber'].')';
     112    if ($Filter['Version'] != 0) $VersionFilter = ' AND (`VersionStart` <= '.$Filter['BuildNumber'].') AND (`VersionEnd` >= '.$Filter['BuildNumber'].')';
    113113    else $VersionFilter = '';
    114114    //else $Filter['SQL'] .= ' AND '; DISTINCT(Entry)
     
    117117    $Filter['Language'] = GetParameter('lang', 0, true, true);
    118118    $Output .= '<td><select name="lang">';
    119     if($Filter['Language'] == 0) $Selected = ' selected="selected"';
     119    if ($Filter['Language'] == 0) $Selected = ' selected="selected"';
    120120    else $Selected = '';
    121121    $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>';
    122122    $DbResult = $this->Database->query('SELECT `Id`, `Name` FROM `Language` WHERE `Enabled` = 1 ORDER BY `Name`');
    123     while($Language = $DbResult->fetch_assoc())
    124     {
    125       if($Language['Id'] == $Filter['Language']) $Selected = ' selected="selected"';
     123    while ($Language = $DbResult->fetch_assoc())
     124    {
     125      if ($Language['Id'] == $Filter['Language']) $Selected = ' selected="selected"';
    126126      else $Selected = '';
    127127      $Output .= '<option value="'.$Language['Id'].'"'.$Selected.'>'.T($Language['Name']).'</option>';
     
    130130    $LanguageFilter = '';
    131131    $LanguageFilterSub = '';
    132     if($Filter['Language'] != 0) {
     132    if ($Filter['Language'] != 0) {
    133133      $LanguageFilter = ' AND (`T`.`Language` = '.$Filter['Language'].')';
    134134      $LanguageFilterSub = ' AND (`Sub`.`Language` = '.$Filter['Language'].')';
     
    138138    $Filter['User'] = GetParameter('user', 0, true, true);
    139139    $Output .= '<td><select name="user" style="width: 80px">';
    140     if($Filter['User'] == 0) $Selected = ' selected="selected"';
     140    if ($Filter['User'] == 0) $Selected = ' selected="selected"';
    141141    else $Selected = '';
    142142    $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>';
    143143    $DbResult = $this->Database->query('SELECT `Id`, `Name` FROM `User` ORDER BY `Name`');
    144     while($User = $DbResult->fetch_assoc())
    145     {
    146       if($User['Id'] == $Filter['User']) $Selected = ' selected="selected"';
     144    while ($User = $DbResult->fetch_assoc())
     145    {
     146      if ($User['Id'] == $Filter['User']) $Selected = ' selected="selected"';
    147147      else $Selected = '';
    148148      $Output .= '<option value="'.$User['Id'].'"'.$Selected.'>'.$User['Name'].'</option>';
    149149    }
    150150    $Output .= '</select></td>';
    151     if($Filter['User'] != 0) $UserFilter = ' AND (`User` = '.$Filter['User'].')';
     151    if ($Filter['User'] != 0) $UserFilter = ' AND (`User` = '.$Filter['User'].')';
    152152    else $UserFilter = '';
    153153
     
    155155    $Filter['Text'] = GetParameter('text', '', false, true);
    156156    $Output .= '<td><input name="text" type="text" style="width: 60px;" value="'.htmlentities($Filter['Text']).'"></td>';
    157     if($Filter['Text'] != '')
     157    if ($Filter['Text'] != '')
    158158    {
    159159      $Items = array('(`T`.`ID` LIKE "%'.$Filter['Text'].'%")', '(`T`.`Entry` LIKE "%'.$Filter['Text'].'%")');
    160       if($Filter['Group'] != 0)
    161         foreach($TranslationTree[$Filter['Group']]['Items'] as $GroupItem)
    162         if($GroupItem['Visible'] == 1)
     160      if ($Filter['Group'] != 0)
     161        foreach ($TranslationTree[$Filter['Group']]['Items'] as $GroupItem)
     162        if ($GroupItem['Visible'] == 1)
    163163        $Items[] = '(`T`.`'.$GroupItem['Column'].'` LIKE "%'.$Filter['Text'].'%")';
    164164      $Filter['SQL'] .= ' AND ('.implode(' OR ', $Items).')';
     
    168168    $Filter['Entry'] = GetParameter('entry', '', false, true);
    169169    $Output .= '<td><input name="entry" type="text" style="width: 60px;" value="'.htmlentities($Filter['Entry']).'"></td>';
    170     if($Filter['Entry'] != '')
     170    if ($Filter['Entry'] != '')
    171171    {
    172172      $Filter['SQL'] .= ' AND (`Entry` = "'.$Filter['Entry'].'")';
    173173    }
    174174
    175     if($Filter['Group'] != 0)
     175    if ($Filter['Group'] != 0)
    176176    {
    177177        $WithoutAlter =       ' AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '.
     
    179179          ' AND (`Sub`.`Entry` = `T`.`Entry`) AND (`Sub`.`ID` != `T`.`ID`) AND (`Sub`.`Complete` = 1) AND '.
    180180          '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`) LIMIT 1 ) ';
    181         foreach($TranslationTree[$Filter['Group']]['Items'] as $GroupItem)
    182           if($GroupItem['Visible'] == 1) {
     181        foreach ($TranslationTree[$Filter['Group']]['Items'] as $GroupItem)
     182          if ($GroupItem['Visible'] == 1) {
    183183            $ItemsVar[] =    'LENGTH(`T`.`'.$GroupItem['Column'].'`) - LENGTH( REPLACE( `T`.`'.$GroupItem['Column'].'`,  \'$\',  \'\' ) ) '.
    184184                           ' < ('.
     
    188188                              ')';
    189189          }
    190       if($Filter['State'] == CompletionState::All) {
     190      if ($Filter['State'] == CompletionState::All) {
    191191        $Filter['SQL'] .= $UserFilter.$VersionFilter;
    192192      } else
    193       if($Filter['State'] == CompletionState::NotTranslated) {
     193      if ($Filter['State'] == CompletionState::NotTranslated) {
    194194        $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].') '.
    195195          'AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '.
     
    198198          '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`))';
    199199      } else
    200       if($Filter['State'] == CompletionState::Translated) {
     200      if ($Filter['State'] == CompletionState::Translated) {
    201201        $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Complete` = 1)';
    202202      } else
    203       if($Filter['State'] == CompletionState::NotFinished) {
     203      if ($Filter['State'] == CompletionState::NotFinished) {
    204204        $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage'].
    205205      ') AND (`T`.`Complete` = 0)';
    206206      } else
    207       if($Filter['State'] == CompletionState::Original) {
     207      if ($Filter['State'] == CompletionState::Original) {
    208208        $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].')';
    209209      } else
    210       if($Filter['State'] == CompletionState::NotFinishedNotTranslated) {
     210      if ($Filter['State'] == CompletionState::NotFinishedNotTranslated) {
    211211        $Filter['SQL'] .= $UserFilter.$VersionFilter.$WithoutAlter.
    212212      ' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage'].
    213213      ') AND (`T`.`Complete` = 0)';
    214214      } else
    215       if($Filter['State'] == CompletionState::Missing1) {
     215      if ($Filter['State'] == CompletionState::Missing1) {
    216216        $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage'];
    217217        $Filter['SQL'] .= ' AND ('.implode(' OR ', $ItemsVar).') ';
    218218      } else
    219       if($Filter['State'] == CompletionState::Missing2) {
     219      if ($Filter['State'] == CompletionState::Missing2) {
    220220        $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage'];
    221221        $Filter['SQL'] .= ' '. $WithoutAlter;
     
    226226    /*
    227227     // Ownership
    228     if(array_key_exists('owner', $_GET) and is_numeric($_GET['owner'])) $Filter['Owner'] = $_GET['owner'];
     228    if (array_key_exists('owner', $_GET) and is_numeric($_GET['owner'])) $Filter['Owner'] = $_GET['owner'];
    229229    else $Filter['Owner'] = 0;
    230230    $Output .= ' <td><select name="owner">';
    231     if($Filter['Owner'] == 0) $Selected = ' selected="selected"';
     231    if ($Filter['Owner'] == 0) $Selected = ' selected="selected"';
    232232    else $Selected = '';
    233233    $Output .= '<option value="0"'.$Selected.'>Všech</option>';
    234     if($Filter['Owner'] == 1) $Selected = ' selected="selected"';
     234    if ($Filter['Owner'] == 1) $Selected = ' selected="selected"';
    235235    else $Selected = '';
    236236    $Output .= '<option value="1"'.$Selected.'>Překladatelův tým</option>';
    237     if($Filter['Owner'] == 2) $Selected = ' selected="selected"';
     237    if ($Filter['Owner'] == 2) $Selected = ' selected="selected"';
    238238    else $Selected = '';
    239239    $Output .= '<option value="2"'.$Selected.'>Překladatele</option>';
    240240    $Output .= '</select></td>';
    241     if(($Filter['Owner'] == 2) AND ($Filter['User'] != 0)) $Filter['SQL'] .= ' AND (`User` = '.$Filter['User'].')';
     241    if (($Filter['Owner'] == 2) AND ($Filter['User'] != 0)) $Filter['SQL'] .= ' AND (`User` = '.$Filter['User'].')';
    242242    */
    243243
     
    246246    $Output .= '</form><br/>';
    247247    $Filter['Output'] = $Output;
    248     return($Filter);
     248    return $Filter;
    249249  }
    250250
     
    289289
    290290    $DbResult = $this->Database->query($Query.' '.$Order['SQL'].' '.$PageList['SQLLimit']);
    291     while($Line = $DbResult->fetch_assoc())
     291    while ($Line = $DbResult->fetch_assoc())
    292292    {
    293293      $Output .= '<tr><td><a href="'.$this->System->Link('/form.php?group='.$Filter['Group'].'&amp;ID='.$Line['ID']).'">'.$Line['ID'].'</a></td>'.
     
    305305    $Output .= '</table>'.
    306306        $PageList['Output'];
    307     return($Output);
     307    return $Output;
    308308  }
    309309
     
    316316    $Output .= '<table class="BaseTable"><tr><th>'.T('Group').'</th><th>'.T('Count').'</th></tr>';
    317317    $Total = 0;
    318     foreach($TranslationTree as $Group)
    319       if($Group['TablePrefix'] != '')
     318    foreach ($TranslationTree as $Group)
     319      if ($Group['TablePrefix'] != '')
    320320      {
    321321        $Filter = $this->ShowFilter($Group['Id']);
     
    328328      $Output .= '<tr><td><strong>'.T('Total').'</strong></td><td><strong>'.$Total.'</strong></td></tr>'.
    329329          '</table>';
    330       return($Output);
     330      return $Output;
    331331  }
    332332
     
    336336
    337337    $GroupId = GetParameter('group', 0, true);
    338     if($GroupId == 0) $Output = ShowMessage('Skupina nenalezena', MESSAGE_CRITICAL);
     338    if ($GroupId == 0) $Output = ShowMessage('Skupina nenalezena', MESSAGE_CRITICAL);
    339339    else {
    340340      $Table = $TranslationTree[$GroupId]['TablePrefix'];
     
    351351          '<td>'.T('Texts marked as unfinished').'</td></tr>';
    352352
    353       if($this->System->User->Licence(LICENCE_USER))
     353      if ($this->System->User->Licence(LICENCE_USER))
    354354      {
    355355        $Output .= '<tr><td><a title="'.T('Unfinished texts').'" href="?group='.$GroupId.'&amp;state=3&amp;user='.$this->System->User->Id.'">'.T('My unfinished').'</a></td>
     
    373373      $Output .= '</table>';
    374374    }
    375     return($Output);
     375    return $Output;
    376376  }
    377377
     
    380380    $this->Title = T('Translation groups');
    381381    $Action = GetParameter('action', '');
    382     if($Action == 'filter') $Output = $this->ShowMenu();
     382    if ($Action == 'filter') $Output = $this->ShowMenu();
    383383    else
    384384    {
    385385      $Filter = $this->ShowFilter();
    386       if($Filter['Group'] > 0) $Output = $this->ShowTranslationList($Filter);
     386      if ($Filter['Group'] > 0) $Output = $this->ShowTranslationList($Filter);
    387387        else $Output = $this->ShowGroupList($Filter);
    388388    }
    389     return($Output);
     389    return $Output;
    390390  }
    391391}
     
    409409      array('Name' => 'LastVersion', 'Title' => T('Version of last import')),
    410410   );
    411    if($this->System->User->Licence(LICENCE_ADMIN))
     411   if ($this->System->User->Licence(LICENCE_ADMIN))
    412412   $TableColumns[] = array('Name' => '', 'Title' => T('Actions'));
    413413
     
    416416
    417417   $DbResult = $this->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']);
    418    while($Group = $DbResult->fetch_assoc())
     418   while ($Group = $DbResult->fetch_assoc())
    419419   {
    420420     $Output .= '<tr><td><a href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;action=filter').'">'.T($Group['Name']).'</a></td>'.
    421421       '<td>'.$Group['SourceType'].'</td><td>';
    422      if($Group['MangosTable'] != '') $Output .= $Group['MangosTable'].'.sql ';
    423      if($Group['DBCFileName'] != '') $Output .= $Group['DBCFileName'].'.dbc ';
    424      if($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua ';
     422     if ($Group['MangosTable'] != '') $Output .= $Group['MangosTable'].'.sql ';
     423     if ($Group['DBCFileName'] != '') $Output .= $Group['DBCFileName'].'.dbc ';
     424     if ($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua ';
    425425     $Output .= '</td>';
    426      if($this->System->User->Licence(LICENCE_ADMIN))
     426     if ($this->System->User->Licence(LICENCE_ADMIN))
    427427       $Output .= '<td><a title="Změny po posledním importu u vybrané překladové skupiny" href="'.$this->System->Link('/log/?group='.
    428428     $Group['Id'].'&amp;type=11').'">'.HumanDate($Group['LastImport']).'</a></td>';
     
    430430     $Output .= '<td><a href="'.$this->System->Link('/client-version/?action=item&amp;id='.
    431431       GetVersionWOWId($Group['LastVersion'])).'">'.GetVersionWOW($Group['LastVersion']).'</a></td>';
    432      if($this->System->User->Licence(LICENCE_ADMIN))
     432     if ($this->System->User->Licence(LICENCE_ADMIN))
    433433       $Output .= '<td><a href="?action=groupdelete&amp;id='.$Group['Id'].'">'.T('Remove').'</a></td>';
    434434     $Output .= '</tr>';
     
    436436    $Output .= '</table>'.
    437437      '<br /><a title="'.T('Changelog of changes after import').'" href="'.$this->System->Link('/log/?type=11').'">'.T('Changelog of text modification during import').'</a><br/>';
    438     if($this->System->User->Licence(LICENCE_ADMIN)) $Output .= '<a href="?action=groupadd">'.T('Add translation group').'</a>';
    439     return($Output);
     438    if ($this->System->User->Licence(LICENCE_ADMIN)) $Output .= '<a href="?action=groupadd">'.T('Add translation group').'</a>';
     439    return $Output;
    440440  }
    441441
    442442  function ShowGroupAdd()
    443443  {
    444     if($this->System->User->Licence(LICENCE_ADMIN))
     444    if ($this->System->User->Licence(LICENCE_ADMIN))
    445445    {
    446446      $Output = '<h3>Vložení nové překladové skupiny</h3>'.
     
    452452          '</table></form>';
    453453    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    454     return($Output);
     454    return $Output;
    455455  }
    456456
    457457  function ShowGroupAddFinish()
    458458  {
    459     if($this->System->User->Licence(LICENCE_ADMIN))
     459    if ($this->System->User->Licence(LICENCE_ADMIN))
    460460    {
    461461      $TableName = 'Text'.$_POST['TablePrefix'];
    462462      $DbResult = $this->System->Database->select('Group', 'Id', 'TablePrefix="'.$TableName.'"');
    463       if($DbResult->num_rows == 0)
     463      if ($DbResult->num_rows == 0)
    464464      {
    465465
     
    500500      $Output .= $this->ShowList();
    501501    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    502     return($Output);
     502    return $Output;
    503503  }
    504504
    505505  function ShowGroupDelete()
    506506  {
    507     if($this->System->User->Licence(LICENCE_ADMIN))
     507    if ($this->System->User->Licence(LICENCE_ADMIN))
    508508    {
    509509      $DbResult = $this->System->Database->select('Group', '*', '`Id`='.$_GET['id']);
    510       if($DbResult->num_rows == 1)
     510      if ($DbResult->num_rows == 1)
    511511      {
    512512        $Group = $DbResult->fetch_assoc();
     
    518518    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    519519    $Output .= $this->ShowList();
    520     return($Output);
     520    return $Output;
    521521  }
    522522
     
    525525    $this->Title = T('Translation groups');
    526526    $Action = GetParameter('action', '');
    527     if($Action == 'groupadd') $Output = $this->ShowGroupAdd();
    528     else if($Action == 'groupdelete') $Output = $this->ShowGroupDelete();
    529     else if($Action == 'groupaddfinish') $Output = $this->ShowGroupAddFinish();
     527    if ($Action == 'groupadd') $Output = $this->ShowGroupAdd();
     528    else if ($Action == 'groupdelete') $Output = $this->ShowGroupDelete();
     529    else if ($Action == 'groupaddfinish') $Output = $this->ShowGroupAddFinish();
    530530    else $Output = $this->ShowList();
    531     return($Output);
     531    return $Output;
    532532  }
    533533}
  • trunk/Modules/Translation/UserLevel.php

    r859 r880  
    1111  $Diakrit = array("á","č","ď","é","ě","í","ľ","ň","ó","ř","š","ť","ú",
    1212  "ů","ý","ž","Á","Č","Ď","É","Ě","Í","Ľ","Ň","Ó","Ř","Š","Ť","Ú","Ů","Ý","Ž");
    13   for($i = 0; $i < count($Diakrit); $i = $i + 1)
     13  for ($i = 0; $i < count($Diakrit); $i = $i + 1)
    1414  {
    15     if(strpos($Word, $Diakrit[$i]) <> false)
     15    if (strpos($Word, $Diakrit[$i]) <> false)
    1616      $Result = true;
    1717  }
    18   return($Result);
     18  return $Result;
    1919}
    2020
     
    2626
    2727  $xp = 0;
    28   foreach($TranslationTree as $Group)
     28  foreach ($TranslationTree as $Group)
    2929  {
    30     if($Group['TablePrefix'] != '')
     30    if ($Group['TablePrefix'] != '')
    3131    {
    3232      $GroupBy = 'GROUP BY ';
    3333      $TakeColumns = '';
    34       foreach($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem)
     34      foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem)
    3535      {
    3636        $GroupBy .= '`T`.`'.$TextItem['Column'].'`, ';
     
    4242        'LEFT JOIN `'.$Group['TablePrefix'].'` AS `T2` ON `T2`.`ID` = `T`.`Take` '.
    4343        'WHERE (`T`.`User` = '.$UserId.') AND (`T`.`Complete` = 1) AND (`T`.`Take` IS NOT NULL) '.$GroupBy);
    44       while($Line = $IDtran->fetch_array())
     44      while ($Line = $IDtran->fetch_array())
    4545      {
    4646        $xp_translation = 0;
    4747        $translated = true;
    48         foreach($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem)
     48        foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem)
    4949        {
    50           if(($Line[$TextItem['Column']] <> $Line[$TextItem['Column'].'_Take']) and
     50          if (($Line[$TextItem['Column']] <> $Line[$TextItem['Column'].'_Take']) and
    5151            (strlen($Line[$TextItem['Column']]) > (strlen($Line[$TextItem['Column'].'_Take']) * 0.5)))
    5252          {
    5353            $TextArr = explode(' ', $Line[$TextItem['Column']]);
    54             foreach($TextArr as $Word)
     54            foreach ($TextArr as $Word)
    5555            {
    56               if(CheckDiakrit($Word)) $indikator = $from_diakrit;
     56              if (CheckDiakrit($Word)) $indikator = $from_diakrit;
    5757                else $indikator = 1;
    5858              $xp_translation = $xp_translation + ($indikator * $xp_from_word);
     
    6565          }
    6666        }
    67         if($translated) $xp = $xp + $xp_translation;   // XP addition for entire translation if complete translated
     67        if ($translated) $xp = $xp + $xp_translation;   // XP addition for entire translation if complete translated
    6868      }
    6969    }
    7070  }
    71   return($xp);
     71  return $xp;
    7272}
    7373
     
    7979  // Main code for users
    8080  $DbResult = $System->Database->query('SELECT `ID`, `Name` FROM `User` WHERE `Id` = '.$UserId);
    81   if($DbResult->num_rows > 0)
     81  if ($DbResult->num_rows > 0)
    8282  {
    83     while($LineUser = $DbResult->fetch_array())
     83    while ($LineUser = $DbResult->fetch_array())
    8484    {
    8585      // Build TranslatedCount query
    8686      $TranslatedCount = '(';
    87       if(count($TranslationTree) > 0)
     87      if (count($TranslationTree) > 0)
    8888      {
    89       foreach($TranslationTree as $Group)
    90         if($Group['TablePrefix'] != '')
     89      foreach ($TranslationTree as $Group)
     90        if ($Group['TablePrefix'] != '')
    9191        {
    9292          $Count = '(SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` WHERE (`Complete` = 1) AND (`Language` <> '.
Note: See TracChangeset for help on using the changeset viewer.