Changeset 343 for trunk


Ignore:
Timestamp:
Jan 17, 2012, 1:00:26 PM (13 years ago)
Author:
chronos
Message:
  • Upraveno: Správa uživatelů je nyní přetvořena na modul modulárního systému.
  • Upraveno: Hlavní objekt System je nyní odvozen z třídy ModularSystem.
Location:
trunk
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/LogShow.php

    r183 r343  
    1111  function Show()
    1212  {
    13     if(!$this->System->Modules['User']->CheckPermission('Log', 'Show')) return('Nemáte oprávnění');
     13    if(!$this->System->Models['User']->CheckPermission('Log', 'Show')) return('Nemáte oprávnění');
    1414    $DbResult = $this->Database->select('Log', 'COUNT(*)');
    1515    $RowTotal = $DbResult->fetch_array();
  • trunk/Model.php

    r342 r343  
    44define('PropertyText', 'Text');
    55define('PropertyString', 'String');
     6define('PropertyBoolean', 'Boolean');
    67define('PropertyInteger', 'Integer');
    78define('PropertyFloat', 'Float');
     
    1516  var $Name;
    1617  var $Properties;
     18  var $System;
    1719 
    18   function __construct($Database)
     20  function __construct($Database, $System)
    1921  {
    2022    $this->Database = &$Database;
     23    $this->System = &$System;
    2124    $this->AddPropertyDateTime('TimeCreate');
    2225    $this->AddPropertyOneToMany('UserCreate', 'User');
     
    5457  {     
    5558    $this->Properties[] = array('Name' => $Name, 'Type' => PropertyFloat);
     59  }
     60
     61  function AddPropertyBoolean($Name)
     62  {
     63    $this->Properties[] = array('Name' => $Name, 'Type' => PropertyBoolean);
    5664  }
    5765
  • trunk/Modules/Module.php

    r342 r343  
    1414  var $Database;
    1515  var $Installed;
     16  var $System;
    1617 
    17   function __construct($Database)
     18  function __construct($Database, $System)
    1819  {
    1920    $this->Database = &$Database;   
     21    $this->System = &$System;   
    2022  }
    2123 
     
    2527    foreach($this->Models as $ModelName)
    2628    {
    27       $Model = new $ModelName($this->Database);
     29      $Model = new $ModelName($this->Database, $this->System);
    2830      $Model->Install();
    2931      unset($Model);
     
    3739    foreach($this->Models as $ModelName)
    3840    {
    39       $Model = new $ModelName($this->Database);
     41      $Model = new $ModelName($this->Database, $this->System);
    4042      $Model->UnInstall();
    4143      unset($Model);
    4244    }
    4345    $this->Database->query('UPDATE Module SET Installed=0 WHERE Name="'.$this->Name.'"');
     46  }
     47 
     48  function Init()
     49  {
    4450  }
    4551}
     
    4955  var $Database;
    5056  var $Modules = array();
     57  var $Models = array();
    5158 
    5259  function __construct($Database)
     
    5562  }
    5663 
     64  function ModulePresent($Name)
     65  {
     66    return(array_key_exists($Name, $this->Modules));
     67  }
     68
    5769  function Init($Installed = true)
    5870  {
     
    6375    while($Module = $DbResult->fetch_array())
    6476    {
    65       include_once('Modules/'.$Module['Name'].'/'.$Module['Name'].'.php');
     77      include_once(dirname(__FILE__).'/'.$Module['Name'].'/'.$Module['Name'].'.php');
    6678      $ModuleClassName = 'Module'.$Module['Name'];
    67       $this->Modules[$Module['Name']] = new $ModuleClassName($this->Database);
     79      $this->Modules[$Module['Name']] = new $ModuleClassName($this->Database, $this);
     80      $this->Modules[$Module['Name']]->Init();
    6881    }     
    6982  }
     
    108121    // Load list of modules on disk
    109122    $ModulesOnDisk = array();
    110     $Files = scandir('Modules');
     123    $Files = scandir(dirname(__FILE__));
    111124    foreach($Files as $File)
    112     if(is_dir('Modules/'.$File) and ($File != '.') and ($File != '..'))
     125    if(is_dir(dirname(__FILE__).'/'.$File) and ($File != '.') and ($File != '..'))
    113126    {
    114127      $ModulesOnDisk[] = $File;
     
    120133    {
    121134      DebugLog('Adding module '.$ModuleName.' to list');
    122       include_once('Modules/'.$ModuleName.'/'.$ModuleName.'.php');
     135      include_once(dirname(__FILE__).'/'.$ModuleName.'/'.$ModuleName.'.php');
    123136      $ModuleClassName = 'Module'.$ModuleName;
    124137      if(class_exists($ModuleClassName))
    125138      {
    126         $Module = new $ModuleClassName($this->Database);     
     139        $Module = new $ModuleClassName($this->Database, $this);
    127140        $this->Database->insert('Module', array('Name' => $Module->Name,
    128141          'Version' => $Module->Version, 'Creator' => $Module->Creator,
  • trunk/Modules/Project/Project.php

    r342 r343  
    66class Project extends Model
    77{
    8   function __construct($Database)
     8  function __construct($Database, $System)
    99  {
    10     parent::__construct($Database);
     10    parent::__construct($Database, $System);
    1111    $this->Name = 'Project';
    1212    $this->AddPropertyDateTime('TimeSchedule');
     
    1919class ProjectComment extends Model
    2020{
    21   function __construct($Database)
     21  function __construct($Database, $System)
    2222  {
    23     parent::__construct($Database);
     23    parent::__construct($Database, $System);
    2424    $this->Name = 'ProjectComment';
    2525    $this->AddPropertyOneToMany('Project', 'Project');
     
    3030class ModuleProject extends Module
    3131{
    32   function __construct($Database)
     32  function __construct($Database, $System)
    3333  {
    34     parent::__construct($Database);
     34    parent::__construct($Database, $System);
    3535    $this->Name = 'Project';
    3636    $this->Version = '1.0';
     
    5151    parent::UnInstall();
    5252  } 
     53 
     54  function Init()
     55  {
     56  }
    5357}
    5458
  • trunk/Modules/User/user.php

    r341 r343  
    2626define('USER_EVENT_OPTIONS_CHANGED', 4);
    2727
    28 class User extends OldModule
     28class User extends Model
    2929{
    3030  var $Dependencies = array('Log');
     
    3434  var $AnonymousUserId = 98;
    3535  var $OnlineStateTimeout = 600; // in seconds
     36
     37  function __construct($Database, $System)
     38  {
     39    parent::__construct($Database, $System);
     40    $this->Name = 'User';
     41    $this->AddPropertyString('Login');   
     42    $this->AddPropertyString('Name');   
     43    $this->AddPropertyString('Password');   
     44    $this->AddPropertyString('Email');   
     45    $this->AddPropertyString('LastIpAddress');   
     46    $this->AddPropertyDateTime('LastLoginTime');
     47    $this->AddPropertyDateTime('RegistrationTime');
     48    $this->AddPropertyOneToMany('User', 'User');
     49    $this->AddPropertyBoolean('Locked');
     50    $this->AddPropertyInteger('ICQ');
     51    $this->AddPropertyString('PhoneNumber');   
     52    $this->AddPropertyString('InitPassword');   
     53  }   
    3654
    3755  function Check()
     
    266284}
    267285
     286class UserOnline extends Model
     287{
     288  function __construct($Database, $System)
     289  {
     290    parent::__construct($Database, $System);
     291    $this->Name = 'UserOnline';
     292    $this->AddPropertyOneToMany('User', 'User');
     293    $this->AddPropertyDateTime('ActivityTime');
     294    $this->AddPropertyDateTime('LoginTime');
     295    $this->AddPropertyString('SessionId');   
     296    $this->AddPropertyString('IpAddress');   
     297    $this->AddPropertyString('HostName');   
     298    $this->AddPropertyString('ScriptName');   
     299  }   
     300}
     301
    268302class ModuleUser extends Module
    269303{
    270   function __construct($Database)
    271   {
    272     parent::__construct($Database);
     304  function __construct($Database, $System)
     305  {
     306    parent::__construct($Database, $System);
    273307    $this->Name = 'User';
    274308    $this->Version = '1.0';
     
    277311    $this->Description = 'User management';
    278312    $this->Dependencies = array();
    279     //$this->Models = array('User', 'UserOnline');
    280   }
     313    $this->Models = array('User', 'UserOnline');
     314  }
     315 
     316  function Init()
     317  {     
     318    $this->System->Models['User'] = new User($this->Database, $this->System);
     319  }
     320 
     321  function Install()
     322  {
     323    parent::Install();
     324  }
     325
     326  function UnInstall()
     327  {
     328    parent::UnInstall();
     329  }
    281330}
    282331
  • trunk/Modules/log.php

    r340 r343  
    77  function NewRecord($Module, $Operation, $Value = '')
    88  {
    9     $this->Database->insert('Log', array('Time' => 'NOW()', 'User' => $this->System->Modules['User']->User['Id'], 'Module' => $Module, 'Operation' => $Operation, 'Value' => $Value));
     9    $this->Database->insert('Log', array('Time' => 'NOW()', 'User' => $this->System->Models['User']->User['Id'], 'Module' => $Module, 'Operation' => $Operation, 'Value' => $Value));
    1010    //echo($this->Database->LastQuery);
    1111  }
  • trunk/Modules/page.php

    r340 r343  
    152152    if($this->System->Config['Web']['UserSupport'] == 1)
    153153    {
    154       if($this->System->Modules['User']->User['Id'] == $this->System->Modules['User']->AnonymousUserId)
     154      if($this->System->Models['User']->User['Id'] == $this->System->Models['User']->AnonymousUserId)
    155155        $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=LoginForm">Přihlášení</a> <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserRegister">Registrace</a>';
    156         else $Output .= $this->System->Modules['User']->User['Name'].' <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=Logout">Odhlásit</a>';
     156        else $Output .= $this->System->Models['User']->User['Name'].' <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=Logout">Odhlásit</a>';
    157157   } else $Output .= '&nbsp;';
    158158// <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserOptions">Nastavení</a>';
  • trunk/aktuality/index.php

    r311 r343  
    2727    {
    2828      case 'view':
    29         if(!$this->System->Modules['User']->CheckPermission('News', 'Display', 'Item')) $Output .= 'Nemáte oprávnění';
     29        if(!$this->System->Models['User']->CheckPermission('News', 'Display', 'Item')) $Output .= 'Nemáte oprávnění';
    3030        else
    3131        {
     
    3939              else $Author = $Row['Name'];
    4040            $Output .= '<div class="Panel"><div class="Title">'.$Row['Title'].' ('.HumanDate($Row['Date']).', '.$Author.')';
    41             if($this->System->Modules['User']->User['Id'] == $Row['User'])
     41            if($this->System->Models['User']->User['Id'] == $Row['User'])
    4242            {
    4343              $Output .= '<div class="Action">';
     
    6969        while($DbRow = $DbResult->fetch_array())
    7070        {
    71           if($this->System->Modules['User']->CheckPermission('News', 'Insert', 'Group', $DbRow['Id']))
     71          if($this->System->Models['User']->CheckPermission('News', 'Insert', 'Group', $DbRow['Id']))
    7272          {
    7373            if($DbRow['Id'] == $Category) $Selected = ' selected="1"'; else $Selected = '';
     
    8888      case 'add2':
    8989        $RemoteAddr = GetRemoteAddress(); 
    90         if($this->System->Modules['User']->CheckPermission('News', 'Insert', 'Group', $Category))
     90        if($this->System->Models['User']->CheckPermission('News', 'Insert', 'Group', $Category))
    9191        {
    9292          //print_r($_FILES);
     
    110110
    111111          $_POST['content'] = str_replace("\n",'<br />',$_POST['content']);
    112           $this->Database->insert('News', array('Category' => $Category, 'Title' => $_POST['title'], 'Content' => $_POST['content'], 'Date' => 'NOW()', 'IP' => $RemoteAddr, 'Enclosure' => $Enclosures, 'Author' => $this->System->Modules['User']->User['Name'], 'User' => $this->System->Modules['User']->User['Id'], 'Link' => $_POST['link']));
     112          $this->Database->insert('News', array('Category' => $Category, 'Title' => $_POST['title'], 'Content' => $_POST['content'], 'Date' => 'NOW()', 'IP' => $RemoteAddr, 'Enclosure' => $Enclosures, 'Author' => $this->System->Models['User']->User['Name'], 'User' => $this->System->Models['User']->User['Id'], 'Link' => $_POST['link']));
    113113          $Output .= 'Aktualita přidána!<br />Pokud budete chtít vaši aktualitu smazat, klikněte na odkaz Smazat v seznamu všech aktualit v kategorii.<br /><br />';
    114114          $Output .= '<a href="index.php?category='.$_POST['category'].'">Zpět na seznam aktualit</a>';
     
    119119        $DbResult = $this->Database->query('SELECT * FROM News WHERE Id='.$_GET['id']);
    120120        $Row = $DbResult->fetch_array();
    121         if($this->System->Modules['User']->User['Id'] == $Row['User'])
     121        if($this->System->Models['User']->User['Id'] == $Row['User'])
    122122        {
    123123          $Row['Content'] = str_replace('<br />', '', $Row['Content']);
     
    140140        {
    141141          $Row = $DbResult->fetch_array();
    142           if($this->System->Modules['User']->User['Id'] == $Row['User'])
     142          if($this->System->Models['User']->User['Id'] == $Row['User'])
    143143          {
    144144            $_POST['content'] = str_replace("\n", '<br />', $_POST['content']);
     
    152152        $DbResult = $this->Database->query('SELECT * FROM News WHERE Id='.$_GET['id']);
    153153        $Row = $DbResult->fetch_array();
    154         if($this->System->Modules['User']->User['Id'] == $Row['User'])
     154        if($this->System->Models['User']->User['Id'] == $Row['User'])
    155155        {
    156156          if($Row['Enclosure'] != '')
     
    168168        break;
    169169      default:
    170         if($this->System->Modules['User']->CheckPermission('News', 'Display', 'Group', $Category))
     170        if($this->System->Models['User']->CheckPermission('News', 'Display', 'Group', $Category))
    171171        {
    172172          $News = new News($this->Database);
     
    187187              else $Author = $Row['Name'];
    188188            $Output .= '<div class="Panel"><div class="Title"><a href="?action=view&amp;id='.$Row['Id'].'">'.$Row['Title'].'</a> ('.HumanDate($Row['Date']).', '.$Author.')';
    189             if($this->System->Modules['User']->User['Id'] == $Row['User'])
     189            if($this->System->Models['User']->User['Id'] == $Row['User'])
    190190            {
    191191              $Output .= '<div class="Action">';
  • trunk/aktuality/news.php

    r340 r343  
    5151    $Output = '<div class="NewsPanel"><div class="Title">'.$Row['Caption'];     
    5252    $Output .= '<div class="Action"><a href="aktuality/index.php?category='.$Category.'">Zobrazit</a>';
    53     if($this->System->Modules['User']->CheckPermission('News', 'Insert', 'Group', $Category))
     53    if($this->System->Models['User']->CheckPermission('News', 'Insert', 'Group', $Category))
    5454      $Output .= ' <a href="aktuality/index.php?action=add&amp;category='.$Category.'">Přidat</a>';
    5555    $Output .= '</div></div><div class="Content">';
  • trunk/chat/history.php

    r150 r343  
    1919    global $MonthNames;
    2020
    21     if(!$this->System->Modules['User']->CheckPermission('Chat', 'Display')) return('Nemáte oprávnění');
     21    if(!$this->System->Models['User']->CheckPermission('Chat', 'Display')) return('Nemáte oprávnění');
    2222
    2323    if(array_key_exists('date',$_GET)) $Date = $_GET['date']; else $Date = date('Y-m-d');
  • trunk/finance/clenove.php

    r327 r343  
    1111    $Finance = $this->System->Modules['Finance'];
    1212    $this->System->Modules['Finance']->LoadTariffs();
    13     if(!$this->System->Modules['User']->CheckPermission('Finance', 'SubjectList')) return('Nemáte oprávnění');
     13    if(!$this->System->Models['User']->CheckPermission('Finance', 'SubjectList')) return('Nemáte oprávnění');
    1414
    1515    $Output = 'Seznam účastníků:<br/>';
  • trunk/finance/import.php

    r335 r343  
    99  function Show()
    1010  {
    11     if(!$this->System->Modules['User']->CheckPermission('Finance', 'SubjectList')) return('Nemáte oprávnění');
     11    if(!$this->System->Models['User']->CheckPermission('Finance', 'SubjectList')) return('Nemáte oprávnění');
    1212    if(array_key_exists('Operation', $_GET))
    1313    {
  • trunk/finance/index.php

    r294 r343  
    1515    $Output .= '<a href="tarify.php">Tarify</a><br />';
    1616    $Output .= '<a href="zarizeni.php">Výpis zařízení</a><br />';
    17     if($this->System->Modules['User']->CheckPermission('Finance', 'SubjectList')) $Output .= '<a href="clenove.php">Seznam členů</a><br />';
     17    if($this->System->Models['User']->CheckPermission('Finance', 'SubjectList')) $Output .= '<a href="clenove.php">Seznam členů</a><br />';
    1818    $Output .= '<a href="spotreba.php">Spotřeba energie</a><br />';
    1919    $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/aktuality/index.php?category=9">Investice v síti</a><br />';
  • trunk/finance/manage.php

    r340 r343  
    99  function Show()
    1010  {
    11     if(!$this->System->Modules['User']->CheckPermission('Finance', 'Manage')) return('Nemáte oprávnění');
     11    if(!$this->System->Models['User']->CheckPermission('Finance', 'Manage')) return('Nemáte oprávnění');
    1212
    1313    if(array_key_exists('Operation', $_GET)) $Operation = $_GET['Operation']; else $Operation = '';
     
    274274  function ShowMonthlyPayment()
    275275  {
    276     if(!$this->System->Modules['User']->CheckPermission('Finance', 'Manage')) return('Nemáte oprávnění');
     276    if(!$this->System->Models['User']->CheckPermission('Finance', 'Manage')) return('Nemáte oprávnění');
    277277    $Output = '';
    278278
  • trunk/finance/user_state.php

    r294 r343  
    1515    if(array_key_exists('Subject', $_GET))
    1616    {
    17       if(!$this->System->Modules['User']->CheckPermission('Finance', 'Manage')) return('Nemáte oprávnění');
     17      if(!$this->System->Models['User']->CheckPermission('Finance', 'Manage')) return('Nemáte oprávnění');
    1818      $DbResult = $this->Database->query('SELECT * FROM Subject WHERE Id='.$_GET['Subject']);
    1919      $Subject = $DbResult->fetch_assoc();
    2020    } else
    2121    {
    22       if(!$this->System->Modules['User']->CheckPermission('Finance', 'DisplaySubjectState')) return('Nemáte oprávnění');
    23       $UserId = $this->System->Modules['User']->User['Id'];
     22      if(!$this->System->Models['User']->CheckPermission('Finance', 'DisplaySubjectState')) return('Nemáte oprávnění');
     23      $UserId = $this->System->Models['User']->User['Id'];
    2424      $DbResult = $this->Database->query('SELECT * FROM Subject WHERE Id=(SELECT Subject FROM Member WHERE Id=(SELECT Member FROM User WHERE Id='.$UserId.'))');
    2525      $Subject = $DbResult->fetch_assoc();
  • trunk/finance/zivnost.php

    r338 r343  
    7676  function Show()
    7777  {
    78     if(!$this->System->Modules['User']->CheckPermission('Finance', 'TradingStatus')) return('Nemáte oprávnění');
     78    if(!$this->System->Models['User']->CheckPermission('Finance', 'TradingStatus')) return('Nemáte oprávnění');
    7979    $this->System->Modules['Finance']->LoadTariffs(1);
    8080    //TransformFinance();
  • trunk/global.php

    r342 r343  
    2020include_once('Modules/Module.php');
    2121include_once('Model.php');
    22 include_once('Modules/User/user.php');
    2322 
    2423$PrefixMultipliers = array
     
    9190);
    9291
    93 class System extends OldModule
    94 {
    95   var $Modules = array();
    96 
    97   function ModulePresent($Name)
    98   {
    99     return(array_key_exists($Name, $this->Modules));
    100   }
    101 
     92class System extends ModularSystem
     93
     94   
    10295  function AddModule($Module)
    10396  {
     
    211204  $Database->ShowSQLQuery = $Config['Web']['ShowSQLQuery'];
    212205
    213   $System = new System();
     206  $System = new System($Database);
    214207  $System->Config = $Config;
    215   $System->Database = &$Database;
     208  //$System->Install();
     209  //$System->ReloadList();
     210  $System->Init();
     211  if(isset($_SERVER['REMOTE_ADDR'])) $System->Models['User']->Check();
    216212  $System->AddModule(new Log());
    217   $System->AddModule(new User());
    218   if(isset($_SERVER['REMOTE_ADDR'])) $System->Modules['User']->Check();
    219213  $System->AddModule(new News());
    220214  $System->AddModule(new Webcam());
     
    222216  $System->AddModule(new Finance());
    223217  $System->Modules['Finance']->LoadMonthParameters(0);
    224  
    225   $System->ModularSystem = new ModularSystem($Database);
    226   $System->ModularSystem->Install();
    227   //$System->ModularSystem->ReloadList();
    228   $System->ModularSystem->Init();
    229218}
    230219
  • trunk/index.php

    r305 r343  
    2222      if($HyperLink['IconFile'] == '') $HyperLink['IconFile'] = 'clear.png';
    2323        if(substr($HyperLink['URL'], 0, 4) != 'http') $HyperLink['URL'] = $this->System->Config['Web']['RootFolder'].$HyperLink['URL'];
    24         if(($HyperLink['PermissionModule'] == '') or (($HyperLink['PermissionModule'] != '') and $this->System->Modules['User']->CheckPermission($HyperLink['PermissionModule'], $HyperLink['PermissionOperation'])))       
     24        if(($HyperLink['PermissionModule'] == '') or (($HyperLink['PermissionModule'] != '') and $this->System->Models['User']->CheckPermission($HyperLink['PermissionModule'], $HyperLink['PermissionOperation'])))       
    2525        $Output .= '<img alt="'.$HyperLink['Name'].'" src="images/favicons/'.$HyperLink['IconFile'].'" width="16" height="16" /> <a href="'.$HyperLink['URL'].'">'.$HyperLink['Name'].'</a><br />';
    2626    }
     
    6161    //$Output .= 'Server běží: '.$this->GetServerUptime().' &nbsp;  &nbsp; ';
    6262
    63     if($this->System->Modules['User']->CheckPermission('Finance', 'DisplaySubjectState'))
    64     {
    65       $DbResult = $this->Database->select('Subject', 'Money', 'Id=(SELECT Subject FROM Member WHERE Id=(SELECT Member FROM User WHERE Id='.$this->System->Modules['User']->User['Id'].'))');
     63    if($this->System->Models['User']->CheckPermission('Finance', 'DisplaySubjectState'))
     64    {
     65      $DbResult = $this->Database->select('Subject', 'Money', 'Id=(SELECT Subject FROM Member WHERE Id=(SELECT Member FROM User WHERE Id='.$this->System->Models['User']->User['Id'].'))');
    6666      if($DbResult->num_rows > 0)
    6767      {
     
    7878  {
    7979    $Output = '<a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserOptions">Profil</a><br />';
    80     if($this->System->Modules['User']->CheckPermission('Finance', 'MemberOptions'))
     80    if($this->System->Models['User']->CheckPermission('Finance', 'MemberOptions'))
    8181      $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'?Action=MemberOptions">Domácnost</a><br />';
    82     if($this->System->Modules['User']->CheckPermission('Finance', 'DisplaySubjectState'))
     82    if($this->System->Models['User']->CheckPermission('Finance', 'DisplaySubjectState'))
    8383      $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/finance/user_state.php">Finance</a><br />';
    84     if($this->System->Modules['User']->CheckPermission('Network', 'RegistredHostList'))
     84    if($this->System->Models['User']->CheckPermission('Network', 'RegistredHostList'))
    8585      $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/network/user_hosts.php">Počítače</a><br />';
    86     if($this->System->Modules['User']->CheckPermission('News', 'Insert'))
     86    if($this->System->Models['User']->CheckPermission('News', 'Insert'))
    8787      $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/aktuality/?action=add">Vložení aktuality</a><br />';
    88     if($this->System->Modules['User']->CheckPermission('EatingPlace', 'Edit'))
     88    if($this->System->Models['User']->CheckPermission('EatingPlace', 'Edit'))
    8989      $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/jidelna/menuedit.php">Editace jídelníčků</a><br />';
    90     if($this->System->Modules['User']->CheckPermission('Finance', 'Manage'))
     90    if($this->System->Models['User']->CheckPermission('Finance', 'Manage'))
    9191      $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/finance/manage.php">Správa financí</a><br />';
    92     if($this->System->Modules['User']->CheckPermission('Network', 'Administration'))
     92    if($this->System->Models['User']->CheckPermission('Network', 'Administration'))
    9393      $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/network/administration.php">Správa sítě</a><br />';
    9494    return($Output);
     
    156156        $Form = new Form('UserLogin');
    157157        $Form->OnSubmit = '?Action=Login';
    158         $Result = $this->System->Modules['User']->Login($_POST['Username'], $_POST['Password']);
     158        $Result = $this->System->Models['User']->Login($_POST['Username'], $_POST['Password']);
    159159        $Output .= $this->SystemMessage('Přihlášení', $Result);
    160160        if($Result <> USER_LOGGED_IN)
     
    169169      if($_GET['Action'] == 'Logout')
    170170      {
    171         $Output .= $this->SystemMessage('Odhlášení', $this->System->Modules['User']->Logout());
     171        $Output .= $this->SystemMessage('Odhlášení', $this->System->Models['User']->Logout());
    172172      } else
    173173      if($_GET['Action'] == 'UserOptions')
    174174      {
    175175        $UserOptions = new Form('UserOptions');
    176         $UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']);
     176        $UserOptions->LoadValuesFromDatabase($this->System->Models['User']->User['Id']);
    177177        $UserOptions->OnSubmit = '?Action=UserOptionsSave';
    178178        $Output .= $UserOptions->ShowEditForm();
     
    182182        $UserOptions = new Form('UserOptions', array());
    183183        $UserOptions->LoadValuesFromForm();
    184         $UserOptions->SaveValuesToDatabase($this->System->Modules['User']->User['Id']);
     184        $UserOptions->SaveValuesToDatabase($this->System->Models['User']->User['Id']);
    185185        $Output .= $this->SystemMessage('Nastavení', 'Nastavení uloženo.');
    186186        $this->System->Modules['Log']->NewRecord('User', 'Nastavení uživatele změněno', $UserOptions->Values['Name']);
    187         $UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']);
     187        $UserOptions->LoadValuesFromDatabase($this->System->Models['User']->User['Id']);
    188188        $UserOptions->OnSubmit = '?Action=UserOptionsSave';
    189189        $Output .= $UserOptions->ShowEditForm();
     
    198198      if($_GET['Action'] == 'UserRegisterConfirm')
    199199      {
    200         $Output .= $this->SystemMessage('Potvrzení registrace', $this->System->Modules['User']->RegisterConfirm($_GET['User'], $_GET['H']));
     200        $Output .= $this->SystemMessage('Potvrzení registrace', $this->System->Models['User']->RegisterConfirm($_GET['User'], $_GET['H']));
    201201      } else
    202202      if($_GET['Action'] == 'PasswordRecovery')
     
    210210        $Form = new Form('PasswordRecovery');
    211211        $Form->LoadValuesFromForm();
    212         $Result = $this->System->Modules['User']->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']);
     212        $Result = $this->System->Models['User']->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']);
    213213        $Output .= $this->SystemMessage('Obnova hesla', $Result);
    214214        if($Result <> USER_PASSWORD_RECOVERY_SUCCESS)
     
    219219      if($_GET['Action'] == 'PasswordRecoveryConfirm')
    220220      {
    221         $Output .= $this->SystemMessage('Obnova hesla', $this->System->Modules['User']->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P']));
     221        $Output .= $this->SystemMessage('Obnova hesla', $this->System->Models['User']->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P']));
    222222      } else
    223223      if($_GET['Action'] == 'UserRegisterSave')
     
    225225        $Form = new Form('UserRegister', array());
    226226        $Form->LoadValuesFromForm();
    227         $Result = $this->System->Modules['User']->Register($Form->Values['Login'], $Form->Values['Password'], $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Name'], $Form->Values['PhoneNumber'], $Form->Values['ICQ']);
     227        $Result = $this->System->Models['User']->Register($Form->Values['Login'], $Form->Values['Password'], $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Name'], $Form->Values['PhoneNumber'], $Form->Values['ICQ']);
    228228        $Output .= $this->SystemMessage('Registrace nového účtu', $Result);
    229229        if($Result <> USER_REGISTRATED)
     
    236236      {
    237237        $UserOptions = new Form('MemberOptions');
    238         $DbResult = $this->Database->query('SELECT Member.Id, Member.InternetTariffNextMonth, Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, Subject.IC, Subject.DIC FROM Member JOIN Subject ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->Modules['User']->User['Member']);
     238        $DbResult = $this->Database->query('SELECT Member.Id, Member.InternetTariffNextMonth, Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, Subject.IC, Subject.DIC FROM Member JOIN Subject ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->Models['User']->User['Member']);
    239239        $DbRow = $DbResult->fetch_array();
    240240        foreach($UserOptions->Definition['Items'] as $Index => $Item)
     
    254254          $UserOptions->Values['BillingPeriodNext'] = 2;
    255255         
    256         $DbResult = $this->Database->update('Member', 'Id='.$this->System->Modules['User']->User['Member'], array('InternetTariffNextMonth' => $UserOptions->Values['InternetTariffNextMonth'], 'FamilyMemberCount' => $UserOptions->Values['FamilyMemberCount'], 'BillingPeriodNext' => $UserOptions->Values['BillingPeriodNext']));
    257         $DbResult = $this->Database->query('SELECT Subject FROM Member WHERE Id='.$this->System->Modules['User']->User['Member']);
     256        $DbResult = $this->Database->update('Member', 'Id='.$this->System->Models['User']->User['Member'], array('InternetTariffNextMonth' => $UserOptions->Values['InternetTariffNextMonth'], 'FamilyMemberCount' => $UserOptions->Values['FamilyMemberCount'], 'BillingPeriodNext' => $UserOptions->Values['BillingPeriodNext']));
     257        $DbResult = $this->Database->query('SELECT Subject FROM Member WHERE Id='.$this->System->Models['User']->User['Member']);
    258258        $Member = $DbResult->fetch_assoc();
    259259        $DbResult = $this->Database->update('Subject', 'Id='.$Member['Subject'], array('Name' => $UserOptions->Values['Name'], 'AddressStreet' => $UserOptions->Values['AddressStreet'], 'AddressTown' => $UserOptions->Values['AddressTown'], 'AddressPSC' => $UserOptions->Values['AddressPSC'], 'IC' => $UserOptions->Values['IC'], 'DIC' => $UserOptions->Values['DIC']));
    260260        $Output .= $this->SystemMessage('Nastavení', 'Nastavení domácnosti uloženo.');
    261261        $this->System->Modules['Log']->NewRecord('Member+Subject', 'Nastavení člena/subjektu změněno', $UserOptions->Values['Name']);
    262         $DbResult = $this->Database->query('SELECT Member.Id, Member.InternetTariffNextMonth, Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, Subject.IC, Subject.DIC FROM Member JOIN Subject ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->Modules['User']->User['Member']);
     262        $DbResult = $this->Database->query('SELECT Member.Id, Member.InternetTariffNextMonth, Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, Subject.IC, Subject.DIC FROM Member JOIN Subject ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->Models['User']->User['Member']);
    263263        $DbRow = $DbResult->fetch_array();
    264264        foreach($UserOptions->Definition['Items'] as $Index => $Item)
     
    290290        else if($Panel['Module'] == 'UserOptions')
    291291        {
    292           if($this->System->Modules['User']->User['Id'] != $this->System->Modules['User']->AnonymousUserId) $Output .= $this->Panel('Přihlášený uživatel', $this->UserPanel());
     292          if($this->System->Models['User']->User['Id'] != $this->System->Models['User']->AnonymousUserId)
     293            $Output .= $this->Panel('Přihlášený uživatel', $this->UserPanel());
    293294        } else
    294295        if($Panel['Module'] == 'Webcam') $Output .= $this->Panel('Kamery', $this->WebcamPanel());
  • trunk/network/administration.php

    r226 r343  
    99  function Show()
    1010  {
    11     if(!$this->System->Modules['User']->CheckPermission('Network', 'Administration')) return('Nemáte oprávnění');
     11    if(!$this->System->Models['User']->CheckPermission('Network', 'Administration')) return('Nemáte oprávnění');
    1212    $Output = '';
    1313    if(array_key_exists('Action', $_GET))
  • trunk/network/restart.php

    r197 r343  
    5050  function Show()
    5151  { 
    52     if(!$this->System->Modules['User']->CheckPermission('Network', 'Administration')) return('Nemáte oprávnění');
     52    if(!$this->System->Models['User']->CheckPermission('Network', 'Administration')) return('Nemáte oprávnění');
    5353   
    5454    if(array_key_exists('Action', $_GET))
  • trunk/network/user_hosts.php

    r245 r343  
    1414    $Output = '<div align="center" style="font-size: small;"><table class="WideTable">';
    1515    $Output .= '<tr><th>Jméno počítače</th><th>Místní adresa</th><th>Veřejná adresa</th><th>CZFree adresa</th><th>Fyzická adresa</th><th>Typ</th><th>Naposledy online</th></tr>';
    16     $DbResult = $this->Database->query('SELECT NetworkDevice.*, NetworkDeviceType.Name AS HostType FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE NetworkDevice.Used = 1 AND NetworkDevice.Member = '.$this->System->Modules['User']->User['Member'].' ORDER BY NetworkDevice.Name');
     16    $DbResult = $this->Database->query('SELECT NetworkDevice.*, NetworkDeviceType.Name AS HostType FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE NetworkDevice.Used = 1 AND NetworkDevice.Member = '.$this->System->Models['User']->User['Member'].' ORDER BY NetworkDevice.Name');
    1717    while($Device = $DbResult->fetch_assoc())
    1818    {
  • trunk/otevreno.php

    r237 r343  
    3434  function EditSubject($Id)
    3535  {
    36     if($this->System->Modules['User']->CheckPermission('SubjectOpenTime', 'Edit'))
     36    if($this->System->Models['User']->CheckPermission('SubjectOpenTime', 'Edit'))
    3737    {
    3838      $Output = '<div class="Centred">';
     
    7676   
    7777    $Output = '';
    78     if($this->System->Modules['User']->CheckPermission('SubjectOpenTime', 'Edit'))
     78    if($this->System->Models['User']->CheckPermission('SubjectOpenTime', 'Edit'))
    7979    {
    8080      $this->Database->delete('SubjectOpenTimeDay', 'Subject='.$Id);
     
    188188      if($Subject['Photo'] != 0) $Output .= '<a href="FileDownload.php?Id='.$Subject['Photo'].'">Fotka</a> ';
    189189     
    190       if($this->System->Modules['User']->CheckPermission('SubjectOpenTime', 'Edit'))
     190      if($this->System->Models['User']->CheckPermission('SubjectOpenTime', 'Edit'))
    191191        $Output .= '<a href="?Action=Edit&amp;Subject='.$Subject['Id'].'">Editovat</a><br />';
    192192      $Output .= '<br />';
  • trunk/share/index.php

    r148 r343  
    6969  function Show()
    7070  {
    71     if(!$this->System->Modules['User']->CheckPermission('Share', 'Display')) return('Nemáte oprávnění');
     71    if(!$this->System->Models['User']->CheckPermission('Share', 'Display')) return('Nemáte oprávnění');
    7272
    7373    // If not only online checkbox checked
  • trunk/style.php

    r304 r343  
    142142<div id="Title">'.$Title.'</div>
    143143<div class="Navigation"><span class="MenuItem"><strong>Navigace &gt;&gt;</strong> '.$Navigation.'</span><div class="MenuItem2">&nbsp;';
    144   //if($System->Modules['User']->User['Id'] == $System->Modules['User']->AnonymousUserId)
     144  //if($System->Models['User']->User['Id'] == $System->Models['User']->AnonymousUserId)
    145145  //  $Output .= '<a href="'.$Config['Web']['RootFolder'].'?Action=LoginForm">Přihlášení</a> <a href="'.$Config['Web']['RootFolder'].'?Action=RegistrationForm">Registrace</a>';
    146   //    else $Output .= $System->Modules['User']->User['Name'].' <a href="?Action=Logout">Odhlásit</a> <a href="?Action=UserOptions">Nastavení</a>';
     146  //    else $Output .= $System->Models['User']->User['Name'].' <a href="?Action=Logout">Odhlásit</a> <a href="?Action=UserOptions">Nastavení</a>';
    147147  $Output .= '</div></div>';
    148148  echo($Output);
Note: See TracChangeset for help on using the changeset viewer.