Changeset 10


Ignore:
Timestamp:
Jun 1, 2023, 1:31:28 AM (18 months ago)
Author:
chronos
Message:
  • Fixed: More class type casting.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/BaseView.php

    r8 r10  
    1212    global $ReleaseTime, $Revision;
    1313
    14     $Output = '<?xml version="1.0" encoding="'.$this->System->Config['Web']['Charset'].'"?>'."\n".
     14    $Output = '<?xml version="1.0" encoding="'.Core::Cast($this->System)->Config['Web']['Charset'].'"?>'."\n".
    1515    '<!DOCTYPE html>'.
    1616    '<html>'.
    1717    '<head>'.
    1818    '<meta http-equiv="Content-Language" content="cs"/>'.
    19     '<meta http-equiv="content-type" content="text/html; charset='.$this->System->Config['Web']['Charset'].'" />'.
     19    '<meta http-equiv="content-type" content="text/html; charset='.Core::Cast($this->System)->Config['Web']['Charset'].'" />'.
    2020    '<meta name="robots" content="all" />'.
    21     '<title>'.$this->System->Config['Web']['Title'].'</title>'.
     21    '<title>'.Core::Cast($this->System)->Config['Web']['Title'].'</title>'.
    2222    '<link rel="StyleSheet" href="'.$this->System->Link('/style/basic/style.css').'" type="text/css" media="all"/>'.
    23     implode("\n", $this->System->HeadItems).
     23    implode("\n", Core::Cast($this->System)->HeadItems).
    2424    '</head><body>';
    2525    $Output .= $this->ShowHeader();
    2626    $Output .= $Content;
    2727    $Output .= '<br/><div style="text-align: center; font-size: small;">Verze: '.$Revision.' ('.HumanDate($ReleaseTime).')'.
    28       ' &nbsp; <a href="https://svn.zdechov.net/trac/open2ride/browser/trunk">Zdrojový kód</a> &nbsp; '.
    29       '<a href="https://svn.zdechov.net/trac/open2ride/log/trunk?verbose=on">Historie změn</a></div>';
     28      ' &nbsp; <a href="https://app.zdechov.net/open2ride/browser/trunk">Zdrojový kód</a> &nbsp; '.
     29      '<a href="https://app.zdechov.net/open2ride/log/trunk?verbose=on">Historie změn</a></div>';
    3030    $Output .= '</body></html>';
    3131    echo($Output);
     
    3737    $Output .= '<div class="MenuItem">';
    3838    $Bar = '';
    39     foreach ($this->System->Bars['TopLeft'] as $BarItem)
     39    foreach (Core::Cast($this->System)->Bars['TopLeft'] as $BarItem)
    4040      $Bar .= call_user_func($BarItem);
    41       if (trim($Bar) != '') $Output .= $Bar;
     41    if (trim($Bar) != '') $Output .= $Bar;
    4242      else $Output .= '&nbsp;';
    4343    $Output .= '</div><div class="MenuItem2">';
    4444    $Bar = '';
    45     foreach ($this->System->Bars['Top'] as $BarItem)
     45    foreach (Core::Cast($this->System)->Bars['Top'] as $BarItem)
    4646      $Bar .= call_user_func($BarItem);
    47       if (trim($Bar) != '') $Output .= $Bar;
     47    if (trim($Bar) != '') $Output .= $Bar;
    4848      else $Output .= '&nbsp;';
    4949    $Output .= '</div></div>';
     
    5353  function GetOutput($Page)
    5454  {
    55     $Page->OnSystemMessage = array($this->System->BaseView, 'SystemMessage');
     55    $Page->OnSystemMessage = array(Core::Cast($this->System)->BaseView, 'SystemMessage');
    5656    $Output = $this->ShowPage($Page->Show());
    5757    return $Output;
  • trunk/Application/Core.php

    r8 r10  
    2323  public FormManager $FormManager;
    2424  public BaseView $BaseView;
     25  public User $User;
    2526
    2627  function __construct()
  • trunk/Application/Version.php

    r9 r10  
    66// and system will need database update.
    77
    8 $Revision = 9;
     8$Revision = 10;
    99$DatabaseRevision = 7;
    1010$ReleaseTime = strtotime('2023-06-01');
  • trunk/Modules/Ride/PageNewRide.php

    r8 r10  
    6161          'LEFT JOIN CarModel ON CarModel.Id=Car.Model '.
    6262          'LEFT JOIN CarManufacturer ON CarManufacturer.Id = CarModel.Manufacturer '.
    63           'WHERE Car.Owner='.$this->System->User->User['Id']);
     63          'WHERE Car.Owner='.Core::Cast($this->System)->User->User['Id']);
    6464        while ($DbRow = $DbResult->fetch_assoc())
    6565        {
     
    115115      if ($_GET['step'] == '3') {
    116116        $this->Database->insert('Ride', array(
    117           'Driver' => $this->System->User->User['Id'],
     117          'Driver' => Core::Cast($this->System)->User->User['Id'],
    118118          'SeatCount' => $_POST['seats'],
    119119          'Car' => $_POST['car'],
  • trunk/Modules/Ride/PageRideDetail.php

    r8 r10  
    108108        $this->System->Database->insert('Passenger', array(
    109109          'Ride' => $_POST['id'],
    110           'User' => $this->System->User->User['Id'],
     110          'User' => Core::Cast($this->System)->User->User['Id'],
    111111          'SeatCount' => $_POST['seats'],
    112112          'RideStopFrom' => $_POST['fromid'],
  • trunk/Modules/User/ModuleUser.php

    r9 r10  
    131131  function DoStart(): void
    132132  {
    133     $this->System->User = new User($this->System);
    134     if (isset($_SERVER['REMOTE_ADDR'])) $this->System->User->Check();
     133    Core::Cast($this->System)->User = new User($this->System);
     134    if (isset($_SERVER['REMOTE_ADDR'])) Core::Cast($this->System)->User->Check();
    135135    $this->System->RegisterPage(['userlist'], 'PageUserList');
    136136    $this->System->RegisterPage(['user'], 'PageUser');
    137     $this->System->RegisterPageBarItem('Top', 'User', array($this, 'TopBarCallback'));
    138     $this->System->FormManager->RegisterClass('UserLogin', array(
     137    Core::Cast($this->System)->RegisterPageBarItem('Top', 'User', array($this, 'TopBarCallback'));
     138    Core::Cast($this->System)->FormManager->RegisterClass('UserLogin', array(
    139139      'Title' => 'Přihlášení uživatele',
    140140      'SubmitText' => 'Přihlásit',
     
    146146      ),
    147147    ));
    148     $this->System->FormManager->RegisterClass('UserOptions', array(
     148    Core::Cast($this->System)->FormManager->RegisterClass('UserOptions', array(
    149149      'Title' => 'Základní nastavení',
    150150      'Table' => 'User',
     
    158158      ),
    159159    ));
    160     $this->System->FormManager->RegisterClass('UserRegister', array(
     160    Core::Cast($this->System)->FormManager->RegisterClass('UserRegister', array(
    161161      'Title' => 'Registrace uživatele',
    162162      'SubmitText' => 'Registrovat',
     
    170170      ),
    171171    ));
    172     $this->System->FormManager->RegisterClass('PasswordRecovery', array(
     172    Core::Cast($this->System)->FormManager->RegisterClass('PasswordRecovery', array(
    173173      'Title' => 'Obnova hesla',
    174174      'SubmitText' => 'Obnovit',
     
    179179      ),
    180180    ));
    181     $this->System->FormManager->RegisterClass('APIToken', array(
     181    Core::Cast($this->System)->FormManager->RegisterClass('APIToken', array(
    182182      'Title' => 'Přístupový token',
    183183      'Table' => 'APIToken',
     
    187187      ),
    188188    ));
    189     $this->System->FormManager->RegisterClass('User', array(
     189    Core::Cast($this->System)->FormManager->RegisterClass('User', array(
    190190      'Title' => 'Uživatelé',
    191191      'Table' => 'User',
     
    206206      ),
    207207    ));
    208     $this->System->FormManager->RegisterClass('PermissionUserAssignment', array(
     208    Core::Cast($this->System)->FormManager->RegisterClass('PermissionUserAssignment', array(
    209209      'Title' => 'Oprávnění uživatelů',
    210210      'Table' => 'PermissionUserAssignment',
     
    215215      ),
    216216    ));
    217     $this->System->FormManager->RegisterClass('PermissionGroup', array(
     217    Core::Cast($this->System)->FormManager->RegisterClass('PermissionGroup', array(
    218218      'Title' => 'Skupiny oprávnění',
    219219      'Table' => 'PermissionGroup',
     
    224224      ),
    225225    ));
    226     $this->System->FormManager->RegisterClass('PermissionGroupAssignment', array(
     226    Core::Cast($this->System)->FormManager->RegisterClass('PermissionGroupAssignment', array(
    227227      'Title' => 'Přiřazení skupin oprávnění',
    228228      'Table' => 'PermissionGroupAssignment',
     
    233233      ),
    234234    ));
    235     $this->System->FormManager->RegisterClass('PermissionOperation', array(
     235    Core::Cast($this->System)->FormManager->RegisterClass('PermissionOperation', array(
    236236      'Title' => 'Operace oprávnění',
    237237      'Table' => 'PermissionOperation',
     
    244244      ),
    245245    ));
    246     $this->System->FormManager->RegisterFormType('TUser', array(
     246    Core::Cast($this->System)->FormManager->RegisterFormType('TUser', array(
    247247      'Type' => 'Reference',
    248248      'Table' => 'User',
     
    251251      'Filter' => '1',
    252252    ));
    253     $this->System->FormManager->RegisterFormType('TPermissionGroup', array(
     253    Core::Cast($this->System)->FormManager->RegisterFormType('TPermissionGroup', array(
    254254      'Type' => 'Reference',
    255255      'Table' => 'PermissionGroup',
     
    258258      'Filter' => '1',
    259259    ));
    260     $this->System->FormManager->RegisterFormType('TPermissionGroupAssignment', array(
     260    Core::Cast($this->System)->FormManager->RegisterFormType('TPermissionGroupAssignment', array(
    261261      'Type' => 'Reference',
    262262      'Table' => 'PermissionGroupAssignment',
     
    265265      'Filter' => '1',
    266266    ));
    267     $this->System->FormManager->RegisterFormType('TPermissionOperation', array(
     267    Core::Cast($this->System)->FormManager->RegisterFormType('TPermissionOperation', array(
    268268      'Type' => 'Reference',
    269269      'Table' => 'PermissionOperation',
     
    288288  function TopBarCallback()
    289289  {
    290     if ($this->System->User->User['Id'] == null)
     290    if (Core::Cast($this->System)->User->User['Id'] == null)
    291291    {
    292292      $Output = '<a href="'.$this->System->Link('/user/?Action=LoginForm').'">Přihlášení</a> '.
     
    294294    } else
    295295    {
    296       $Output = $this->System->User->User['Name'].
     296      $Output = Core::Cast($this->System)->User->User['Name'].
    297297        ' <a href="'.$this->System->Link('/user/?Action=UserMenu').'">Nabídka</a>'.
    298298        ' <a href="'.$this->System->Link('/user/?Action=Logout').'">Odhlásit</a>';
  • trunk/Modules/User/PageUser.php

    r8 r10  
    2323    $Query = 'SELECT `Contact`.`Value`, `Contact`.`Description`, (SELECT `Name` FROM `ContactCategory` WHERE `ContactCategory`.`Id` = `Contact`.`Category`) AS `Category` '.
    2424      'FROM `Contact` WHERE `User` = '.
    25       $this->System->User->User['Id'];
     25      Core::Cast($this->System)->User->User['Id'];
    2626    $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS T');
    2727    $DbRow = $DbResult->fetch_row();
     
    6060  {
    6161    $Output = '';
    62     if ($this->System->User->User['Id'] != null)
     62    if (Core::Cast($this->System)->User->User['Id'] != null)
    6363    {
    6464      $Actions = '';
     
    7575      $Output .= $this->Panel('Nabídka uživatele', $Actions);
    7676      $Output .= '</td><td style="vertical-align:top;">';
    77       if ($this->System->User->User['Id'] != null)
    78         {
    79           $Form = new Form($this->System->FormManager);
     77      if (Core::Cast($this->System)->User->User['Id'] != null)
     78        {
     79          $Form = new Form(Core::Cast($this->System)->FormManager);
    8080          $Form->SetClass('UserOptions');
    81           $Form->LoadValuesFromDatabase($this->System->User->User['Id']);
     81          $Form->LoadValuesFromDatabase(Core::Cast($this->System)->User->User['Id']);
    8282          $Form->OnSubmit = '?Action=UserOptionsSave';
    8383          $Output .= $Form->ShowViewForm();
     
    100100      if ($Action == 'LoginForm')
    101101      {
    102         $Form = new Form($this->System->FormManager);
     102        $Form = new Form(Core::Cast($this->System)->FormManager);
    103103        $Form->SetClass('UserLogin');
    104104        $Form->OnSubmit = '?Action=Login';
     
    111111        if (array_key_exists('Username', $_POST) and array_key_exists('Password', $_POST))
    112112        {
    113           $Form = new Form($this->System->FormManager);
     113          $Form = new Form(Core::Cast($this->System)->FormManager);
    114114          $Form->SetClass('UserLogin');
    115115          $Form->OnSubmit = '?Action=Login';
    116116          if (array_key_exists('StayLogged', $_POST) and ($_POST['StayLogged'] == 'on')) $StayLogged = true;
    117117            else $StayLogged = false;
    118           $Result = $this->System->User->Login($_POST['Username'], $_POST['Password'], $StayLogged);
     118          $Result = Core::Cast($this->System)->User->Login($_POST['Username'], $_POST['Password'], $StayLogged);
    119119          $Output .= $this->SystemMessage('Přihlášení', $Result);
    120120          if ($Result <> USER_LOGGED_IN)
     
    134134      if ($Action == 'Logout')
    135135      {
    136         if ($this->System->User->User['Id'] != null)
    137         {
    138           $Output .= $this->SystemMessage('Odhlášení', $this->System->User->Logout());
     136        if (Core::Cast($this->System)->User->User['Id'] != null)
     137        {
     138          $Output .= $this->SystemMessage('Odhlášení', Core::Cast($this->System)->User->Logout());
    139139        } else $Output .= $this->SystemMessage('Nastavení uživatele', 'Nejste přihlášen');
    140140      } else
    141141      if ($Action == 'UserOptions')
    142142      {
    143         if ($this->System->User->User['Id'] != null)
    144         {
    145           $Form = new Form($this->System->FormManager);
     143        if (Core::Cast($this->System)->User->User['Id'] != null)
     144        {
     145          $Form = new Form(Core::Cast($this->System)->FormManager);
    146146          $Form->SetClass('UserOptions');
    147           $Form->LoadValuesFromDatabase($this->System->User->User['Id']);
     147          $Form->LoadValuesFromDatabase(Core::Cast($this->System)->User->User['Id']);
    148148          $Form->OnSubmit = '?Action=UserOptionsSave';
    149149          $Output .= $Form->ShowEditForm();
     
    152152      if ($Action == 'UserOptionsSave')
    153153      {
    154         $Form = new Form($this->System->FormManager);
     154        $Form = new Form(Core::Cast($this->System)->FormManager);
    155155        $Form->SetClass('UserOptions');
    156156        $Form->LoadValuesFromForm();
    157         $Form->SaveValuesToDatabase($this->System->User->User['Id']);
     157        $Form->SaveValuesToDatabase(Core::Cast($this->System)->User->User['Id']);
    158158        $Output .= $this->SystemMessage('Nastavení', 'Nastavení uloženo.');
    159159        $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'Nastavení uživatele změněno', $Form->Values['Name']);
    160         $Form->LoadValuesFromDatabase($this->System->User->User['Id']);
     160        $Form->LoadValuesFromDatabase(Core::Cast($this->System)->User->User['Id']);
    161161        $Form->OnSubmit = '?Action=UserOptionsSave';
    162162        $Output .= $Form->ShowEditForm();
     
    164164      if ($Action == 'UserRegister')
    165165      {
    166         $Form = new Form($this->System->FormManager);
     166        $Form = new Form(Core::Cast($this->System)->FormManager);
    167167        $Form->SetClass('UserRegister');
    168168        //$Form->LoadValuesFromForm();
     
    173173      {
    174174        $Output .= $this->SystemMessage('Potvrzení registrace',
    175           $this->System->User->RegisterConfirm($_GET['User'], $_GET['H']));
     175        Core::Cast($this->System)->User->RegisterConfirm($_GET['User'], $_GET['H']));
    176176      } else
    177177      if ($Action == 'PasswordRecovery')
    178178      {
    179         $Form = new Form($this->System->FormManager);
     179        $Form = new Form(Core::Cast($this->System)->FormManager);
    180180        $Form->SetClass('PasswordRecovery');
    181181        $Form->OnSubmit = '?Action=PasswordRecovery2';
     
    184184      if ($Action == 'PasswordRecovery2')
    185185      {
    186         $Form = new Form($this->System->FormManager);
     186        $Form = new Form(Core::Cast($this->System)->FormManager);
    187187        $Form->SetClass('PasswordRecovery');
    188188        $Form->LoadValuesFromForm();
    189         $Result = $this->System->User->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']);
     189        $Result = Core::Cast($this->System)->User->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']);
    190190        $Output .= $this->SystemMessage('Obnova hesla', $Result);
    191191        if ($Result <> USER_PASSWORD_RECOVERY_SUCCESS)
     
    196196      if ($Action == 'PasswordRecoveryConfirm')
    197197      {
    198         $Output .= $this->SystemMessage('Obnova hesla', $this->System->User->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P']));
     198        $Output .= $this->SystemMessage('Obnova hesla', Core::Cast($this->System)->User->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P']));
    199199      } else
    200200      if ($Action == 'UserRegisterSave')
    201201      {
    202         $Form = new Form($this->System->FormManager);
     202        $Form = new Form(Core::Cast($this->System)->FormManager);
    203203        $Form->SetClass('UserRegister');
    204204        $Form->LoadValuesFromForm();
    205         $Result = $this->System->User->Register($Form->Values['Login'], $Form->Values['Password'],
     205        $Result = Core::Cast($this->System)->User->Register($Form->Values['Login'], $Form->Values['Password'],
    206206          $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Name']);
    207207        $Output .= $this->SystemMessage('Registrace nového účtu', $Result);
Note: See TracChangeset for help on using the changeset viewer.