Ignore:
Timestamp:
Mar 6, 2023, 1:48:45 AM (22 months ago)
Author:
chronos
Message:
  • Fixed: Class types casting for better type checking.
  • Fixed: XML direct export.
  • Modified: User class instance moved from Core class to ModuleUser class.
File:
1 edited

Legend:

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

    r888 r893  
    55  function Translate($Group, $TextID, $Complete, $Language)
    66  {
     7    $User = ModuleUser::Cast($this->System->GetModule('User'))->User;
    78    $Output = '';
    89    $Table = $Group['TablePrefix'];
     
    1718      // Get data for english original
    1819      $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE (`Entry`='.$SourceText['Entry'].') '.
    19           'AND (`Language` = '.$this->System->Config['OriginalLanguage'].') AND (`VersionStart` = '.$SourceText['VersionStart'].') '.
     20          'AND (`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].') AND (`VersionStart` = '.$SourceText['VersionStart'].') '.
    2021          'AND (`VersionEnd` = '.$SourceText['VersionEnd'].')');
    2122      if ($DbResult->num_rows > 0)
     
    3334          else $Filter = ' AND 0';
    3435
    35           $Query = 'SELECT * FROM `'.$Table.'` WHERE (`Language` = '.$this->System->Config['OriginalLanguage'].')'.$Filter;
     36          $Query = 'SELECT * FROM `'.$Table.'` WHERE (`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].')'.$Filter;
    3637          $DbResult = $this->Database->query($Query);
    3738          while ($EnglishFound = $DbResult->fetch_assoc())
    3839          {
    3940            // Get user translation paired to found english item entry
    40             $DbResult2 = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE (`User` = '.$this->System->User->Id.
     41            $DbResult2 = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE (`User` = '.$User->Id.
    4142              ') AND (`Entry` = '.$EnglishFound['Entry'].') AND (`VersionStart` = '.$EnglishFound['VersionStart'].
    4243              ') AND (`VersionEnd` = '.$EnglishFound['VersionEnd'].')');
     
    110111              $Columns = '`Entry`, `VersionStart`, `VersionEnd`, `Language`, `User`, `Take`, `ModifyTime`';
    111112              $Values = $EnglishFound['Entry'].', '.$EnglishFound['VersionStart'].', '.
    112                   $EnglishFound['VersionEnd'].', '.$Language.', '.$this->System->User->Id.', '.$TakeID.', NOW()';
     113                  $EnglishFound['VersionEnd'].', '.$Language.', '.$User->Id.', '.$TakeID.', NOW()';
    113114
    114115              $CompleteParts = 0;
     
    178179    global $Message, $MessageType;
    179180
     181    $User = ModuleUser::Cast($this->System->GetModule('User'))->User;
    180182    $Output = '';
    181183    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
     
    188190    $Group = $TranslationTree[$GroupId];
    189191    $Table = $Group['TablePrefix'];
    190     if ($this->System->User->Licence(LICENCE_USER))
     192    if ($User->Licence(LICENCE_USER))
    191193    {
    192194      if (array_key_exists('ID', $_POST) and is_numeric($_POST['ID']))
     
    202204        $Output .= $this->ShowRedirection($GroupId, $Table, $TextID);
    203205
    204         UserLevelUpdate($this->System->User->Id);
     206        UserLevelUpdate($User->Id);
    205207      } else $Output .= ShowMessage('Položka nenalezena', MESSAGE_CRITICAL);
    206208    } else
     
    237239  function ShowRedirection($GroupId, $Table, $TextID)
    238240  {
     241    $User = ModuleUser::Cast($this->System->GetModule('User'))->User;
    239242    // Address and redirecting
    240243    $Output = '<br />'.T('Translate').': <a href="'.$this->System->Link('/TranslationList.php?group='.$GroupId.'&amp;state=1&amp;user=0&entry=').'">'.T('Not translated').'</a> ';
     
    243246    $next = FollowingTran($TextID, $Table, $GroupId);
    244247    $Output .= '<br /><br />';
    245     $DbResult = $this->Database->query('SELECT `Redirecting` FROM `User` WHERE `ID`='.$this->System->User->Id);
     248    $DbResult = $this->Database->query('SELECT `Redirecting` FROM `User` WHERE `ID`='.$User->Id);
    246249    $redirecting = $DbResult->fetch_assoc();
    247250
Note: See TracChangeset for help on using the changeset viewer.