Changeset 981


Ignore:
Timestamp:
Dec 1, 2025, 10:11:09 PM (3 hours ago)
Author:
chronos
Message:
  • Fixed: Check if system user is logged in modules page.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Version.php

    r977 r981  
    11<?php
    22
    3 $Revision = 977; // Subversion revision
     3$Revision = 981; // Subversion revision
    44$DatabaseRevision = 970; // SQL structure revision
    5 $ReleaseTime = strtotime('2025-06-30');
     5$ReleaseTime = strtotime('2026-12-01');
  • trunk/Packages/Common/Modules/ModuleManager.php

    r946 r981  
    1414    $this->Description = 'User interface for module management.';
    1515    $this->Dependencies = array(ModuleSetup::GetName());
    16     $this->Revision = 1;
    1716    $this->Type = ModuleType::System;
    1817    $this->Models = array(ModelField::GetClassName(), ModuleDependency::GetClassName());
     
    3029    //$this->LoadFromDatabase();
    3130
    32     $this->System->FormManager->RegisterClass('Module', array(
     31    Core::Cast($this->System)->FormManager->RegisterClass('Module', array(
    3332      'Title' => 'Moduly',
    3433      'Table' => 'Module',
     
    4948      ),
    5049    ));
    51     $this->System->FormManager->RegisterFormType('TModule', array(
     50    Core::Cast($this->System)->FormManager->RegisterFormType('TModule', array(
    5251      'Type' => 'Reference',
    5352      'Table' => 'Module',
     
    5655      'Filter' => '1',
    5756    ));
    58     $this->System->FormManager->RegisterFormType('TModelListModule', array(
     57    Core::Cast($this->System)->FormManager->RegisterFormType('TModelListModule', array(
    5958      'Type' => 'ManyToOne',
    6059      'Table' => 'Model',
     
    6362      'Filter' => '1',
    6463    ));
    65     $this->System->FormManager->RegisterClass('Model', array(
     64    Core::Cast($this->System)->FormManager->RegisterClass('Model', array(
    6665      'Title' => 'Modely',
    6766      'Table' => 'Model',
     
    7675      ),
    7776    ));
    78     $this->System->FormManager->RegisterFormType('TModel', array(
     77    Core::Cast($this->System)->FormManager->RegisterFormType('TModel', array(
    7978      'Type' => 'Reference',
    8079      'Table' => 'Model',
     
    8382      'Filter' => '1',
    8483    ));
    85     $this->System->FormManager->RegisterFormType('TModelFieldListModel', array(
     84    Core::Cast($this->System)->FormManager->RegisterFormType('TModelFieldListModel', array(
    8685      'Type' => 'ManyToOne',
    8786      'Table' => 'ModelField',
     
    9089      'Filter' => '1',
    9190    ));
    92     $this->System->FormManager->RegisterClass('ModelField', array(
     91    Core::Cast($this->System)->FormManager->RegisterClass('ModelField', array(
    9392      'Title' => 'Pole modelu',
    9493      'Table' => 'ModelField',
     
    104103      ),
    105104    ));
    106     $this->System->FormManager->RegisterFormType('TModuleLink', array(
     105    Core::Cast($this->System)->FormManager->RegisterFormType('TModuleLink', array(
    107106      'Type' => 'Reference',
    108107      'Table' => 'ModuleLink',
     
    111110      'Filter' => '1',
    112111    ));
    113     $this->System->FormManager->RegisterFormType('TModuleLinkListModule', array(
     112    Core::Cast($this->System)->FormManager->RegisterFormType('TModuleLinkListModule', array(
    114113      'Type' => 'ManyToOne',
    115114      'Table' => 'ModuleLink',
     
    118117      'Filter' => '1',
    119118    ));
    120     $this->System->FormManager->RegisterClass('ModuleLink', array(
     119    Core::Cast($this->System)->FormManager->RegisterClass('ModuleLink', array(
    121120      'Title' => 'Vazby modulu',
    122121      'Table' => 'ModuleLink',
     
    127126      ),
    128127    ));
    129     $this->System->FormManager->RegisterFormType('TModule', array(
     128    Core::Cast($this->System)->FormManager->RegisterFormType('TModule', array(
    130129      'Type' => 'Reference',
    131130      'Table' => 'Module',
     
    250249        'Type' => ModelColumnType::GetName($Field->Type), 'Nullable' => (int)$Field->Nullable));
    251250    }
    252     if ($ModelDesc->DefaultValues != null)
    253     {
    254       $Values = call_user_func('self::'.$ModelDesc->DefaultValues);
     251    if ($ModelDesc->DefaultValuesMethod != null)
     252    {
     253      $Values = call_user_func('self::'.$ModelDesc->DefaultValuesMethod);
    255254      foreach ($Values as $Value)
    256255      {
     
    303302  {
    304303    //DebugLog('Loading modules...');
    305     $this->Modules = array();
    306304    $Query = 'SELECT `Id`, `Name`,`Installed` FROM `Module`';
    307305    $DbResult = $this->Database->query($Query);
     
    419417  function Show(): string
    420418  {
     419    if (!ModuleSetup::Cast($this->System->GetModule('Setup'))->UserLogged())
     420      return 'Nemáte oprávnění';
     421
    421422    $Output = '';
    422423    if (array_key_exists('op', $_GET)) $Operation = $_GET['op'];
  • trunk/Packages/Common/Modules/Setup.php

    r912 r981  
    1515    $this->License = 'GNU/GPLv3';
    1616    $this->Description = 'Base setup module';
    17     $this->Revision = 1;
    1817    $this->Type = ModuleType::System;
    1918
     
    5958    $Output = $this->UpdateManager->Upgrade();
    6059    return $Output;
     60  }
     61
     62  function UserLogged(): bool
     63  {
     64    if (!array_key_exists('SystemPassword', $_SESSION)) $_SESSION['SystemPassword'] = '';
     65    if (array_key_exists('login', $_POST)) $_SESSION['SystemPassword'] = $_POST['SystemPassword'];
     66    return sha1($_SESSION['SystemPassword']) == Core::Cast($this->System)->Config['SystemPassword'];
    6167  }
    6268}
     
    125131  function Show(): string
    126132  {
    127     global $ConfigDefinition, $DatabaseRevision, $Config, $Updates;
     133    global $DatabaseRevision, $Config;
    128134
    129135    $this->UpdateManager = ModuleSetup::Cast($this->System->GetModule('Setup'))->UpdateManager;
     
    136142    if (isset($this->Config))
    137143    {
    138       if (!array_key_exists('SystemPassword', $_SESSION)) $_SESSION['SystemPassword'] = '';
    139       if (array_key_exists('login', $_POST)) $_SESSION['SystemPassword'] = $_POST['SystemPassword'];
    140       if (sha1($_SESSION['SystemPassword']) != $this->Config['SystemPassword'])
     144      if (!ModuleSetup::Cast($this->System->GetModule('Setup'))->UserLogged())
    141145      {
    142146        $Output .= $this->LoginPanel();
     
    153157        else if ($Action == 'models')
    154158        {
    155           $this->System->FormManager->UpdateSQLMeta();
     159          Core::Cast($this->System)->FormManager->UpdateSQLMeta();
    156160        }
    157161        else if ($Action == 'upgrade')
Note: See TracChangeset for help on using the changeset viewer.