Changeset 8 for trunk/Modules/User


Ignore:
Timestamp:
Jun 1, 2023, 12:18:18 AM (19 months ago)
Author:
chronos
Message:
  • Modified: Updated Common package.
  • Modified: Form types made as separate FormManager package.
  • Fixed: PHP 8.1 support.
Location:
trunk/Modules/User
Files:
1 added
1 copied
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/Modules/User/ModuleUser.php

    r7 r8  
    11<?php
    22
    3 include_once(dirname(__FILE__).'/UserModel.php');
    4 include_once(dirname(__FILE__).'/UserList.php');
    5 include_once(dirname(__FILE__).'/UserPage.php');
    6 
    7 class ModuleUser extends AppModule
     3include_once(dirname(__FILE__).'/User.php');
     4include_once(dirname(__FILE__).'/PageUserList.php');
     5include_once(dirname(__FILE__).'/PageUser.php');
     6
     7class ModuleUser extends Module
    88{
    99  var $UserPanel;
     
    2121  }
    2222
    23   function DoInstall()
     23  function DoInstall(): void
    2424  {
    2525    $this->Database->query('CREATE TABLE IF NOT EXISTS `User` ('.
     
    107107  }
    108108
    109   function DoUninstall()
     109  function DoUninstall(): void
    110110  {
    111111    $this->Database->query('DROP TABLE `PermissionUserAssignment`');
     
    117117  }
    118118
    119   function DoUpgrade()
     119  function DoUpgrade(): string
    120120  {
    121121    /*
     
    126126    }
    127127    */
    128   }
    129 
    130   function DoStart()
     128    return '';
     129  }
     130
     131  function DoStart(): void
    131132  {
    132133    $this->System->User = new User($this->System);
     
    281282  }
    282283
    283   function DoStop()
     284  function DoStop(): void
    284285  {
    285286  }
  • trunk/Modules/User/PageUser.php

    r7 r8  
    33class PageUser extends Page
    44{
    5   var $FullTitle = 'Uživatel';
    6   var $ShortTitle = 'Uživatel';
    7   var $ParentClass = 'PagePortal';
     5  function __construct(System $System)
     6  {
     7    parent::__construct($System);
     8    $this->Title = 'Uživatel';
     9    $this->Description = 'Uživatel';
     10    $this->ParentClass = 'PagePortal';
     11  }
    812
    913  function Panel($Title, $Content, $Menu = array())
     
    8892  }
    8993
    90   function Show()
     94  function Show(): string
    9195  {
    9296    $Output = '';
  • trunk/Modules/User/PageUserList.php

    r7 r8  
    33class PageUserList extends Page
    44{
    5   var $FullTitle = 'Seznam registrovaných uživatelů';
    6   var $ShortTitle = 'Seznam uživatelů';
    7   var $ParentClass = 'PagePortal';
     5  function __construct(System $System)
     6  {
     7    parent::__construct($System);
     8    $this->Title = 'Seznam uživatelů';
     9    $this->Description = 'Seznam registrovaných uživatelů';
     10    $this->ParentClass = 'PagePortal';
     11  }
    812
    9   function Show()
     13  function Show(): string
    1014  {
    1115    if (!$this->System->User->CheckPermission('User', 'ShowList'))
  • trunk/Modules/User/User.php

    r7 r8  
    11<?php
     2
     3include_once(dirname(__FILE__).'/PasswordHash.php');
    24
    35define('LOGIN_USED', 'Přihlašovací jméno již použito.');
     
    2830define('DEFAULT_GROUP', 1);
    2931
    30 class PasswordHash
    31 {
    32   function Hash($Password, $Salt)
    33   {
    34     return sha1(sha1($Password).$Salt);
    35   }
    36 
    37   function Verify($Password, $Salt, $StoredHash)
    38   {
    39     return $this->Hash($Password, $Salt) == $StoredHash;
    40   }
    41 
    42   function GetSalt()
    43   {
    44     mt_srand(microtime(true) * 100000 + memory_get_usage(true));
    45     return sha1(uniqid(mt_rand(), true));
    46   }
    47 }
    48 
    4932// TODO: Make User class more general without dependencies to System, Mail, Log
    5033
Note: See TracChangeset for help on using the changeset viewer.