Ignore:
Timestamp:
Jan 14, 2021, 7:38:26 PM (4 years ago)
Author:
chronos
Message:
  • Fixed: Correct typecasting of System class.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Core.php

    r895 r896  
    8585  {
    8686    return $this->RootURLFolder.$Target;
    87   }
    88 
    89   function ShowAction(string $Id): string
    90   {
    91     $Output = '';
    92     $DbResult = $this->Database->query('SELECT *, `ActionIcon`.`Name` AS `Icon` FROM `Action` '.
    93       'LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '.
    94       'WHERE (`Action`.`Id`='.$Id.')');
    95     if ($DbResult->num_rows > 0)
    96     {
    97       $Action = $DbResult->fetch_assoc();
    98       if ($Action['Icon'] == '') $Action['Icon'] = 'clear.png';
    99       if (substr($Action['URL'], 0, 4) != 'http') $Action['URL'] = $this->Link($Action['URL']);
    100       if (!defined('NEW_PERMISSION') or ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission('System', 'Read', 'Item', $Id))
    101         $Output .= '<img alt="'.$Action['Title'].'" src="'.$this->Link('/images/favicons/'.$Action['Icon']).
    102         '" width="16" height="16" /> <a href="'.$Action['URL'].'">'.$Action['Title'].'</a>';
    103     }
    104     return $Output;
    10587  }
    10688
     
    233215    unset($this->PageHeaders[$Name]);
    234216  }
     217
     218  static function Cast(System $System): Core
     219  {
     220    if ($System instanceof Core)
     221    {
     222      return $System;
     223    }
     224    throw new Exception('Expected ModuleSetup type but '.gettype($System));
     225  }
    235226}
    236227
Note: See TracChangeset for help on using the changeset viewer.