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/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.