Changeset 71


Ignore:
Timestamp:
Aug 23, 2009, 6:14:01 PM (15 years ago)
Author:
george
Message:
  • Upraveno: Znovu zprovozněny třídy HomePage, Server a User.
Location:
trunk
Files:
1 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Readme.txt

    r54 r71  
    1515
    1616
    17 2) Konfigurační soubory
     172) Soubory nastavení
    1818
    19   Zkopírovat soubor www/config.sample.php na www/config.php a vyplnit údaje.
     19  Zkopírovat soubor www/Application/Config/ConfigSample.php na Config.php ve stejné složce a vyplnit údaje.
    2020  Uživatelský účet pro přístup do databáze MySQL musí mít plný přístup, aby mohl vytvářet databáze pro servery.
    2121
  • trunk/www/Application/Config

    • Property svn:ignore set to
      Config.php
  • trunk/www/Application/Controller/HomePage.php

    r69 r71  
    88    $View = new HomePageView($this->System);
    99    return($Page->GetOutput($View->Welcome()));
     10  }
     11 
     12  function Info()
     13  {
     14    $Page = new PageView($this->System);
     15    $View = new HomePageView($this->System);
     16    return($Page->GetOutput($View->Info()));
     17  }
     18
     19  function State()
     20  {
     21    $Page = new PageView($this->System);
     22    $View = new HomePageView($this->System);
     23    return($Page->GetOutput($View->State()));
    1024  }
    1125 
     
    2337    if(array_key_exists('Action', $_GET))
    2438    {
    25       if($_GET['Action'] == 'LoginForm')
    26       {
    27         $UserView = new UserView($this->Database, $this->System);
    28         $Output .= $UserView->LoginForm();
    29       } else
    30       if($_GET['Action'] == 'Login')
    31       {
    32         $UserView = new UserView($this->Database, $this->System);
    33         $Output .= $UserView->LoginResult();
    34       } else
    35       if($_GET['Action'] == 'Logout')
    36       {
    37         $UserView = new UserView($this->Database, $this->System);
    38         $Output .= $UserView->Logout();
    39       } else
    40       if($_GET['Action'] == 'UserOptions')
    41       {
    42         $UserView = new UserView($this->Database, $this->System);
    43         $Output .= $UserView->Options();
    44       } else
    45       if($_GET['Action'] == 'UserOptionsSave')
    46       {
    47         $UserView = new UserView($this->Database, $this->System);
    48         $Output .= $UserView->OptionsSave();
    49       } else
    50       if($_GET['Action'] == 'UserRegister')
    51       {
    52         $UserView = new UserView($this->Database, $this->System);
    53         $Output .= $UserView->Register();
    54       } else
    55       if($_GET['Action'] == 'UserRegisterConfirm')
    56       {
    57         $UserView = new UserView($this->Database, $this->System);
    58         $Output .= $UserView->RegisterConfirm();
    59       } else
    60       if($_GET['Action'] == 'PasswordRecovery')
    61       {
    62         $UserView = new UserView($this->Database, $this->System);
    63         $Output .= $UserView->PasswordRecovery();
    64       } else
    65       if($_GET['Action'] == 'PasswordRecoveryFinish')
    66       {
    67         $UserView = new UserView($this->Database, $this->System);
    68         $Output .= $UserView->PasswordRecoveryFinish();
    69       } else
    70       if($_GET['Action'] == 'PasswordRecoveryConfirm')
    71       {
    72         $UserView = new UserView($this->Database, $this->System);
    73         $Output .= $UserView->PasswordRecoveryConfirm();
    74       } else
    75       if($_GET['Action'] == 'UserRegisterSave')
    76       {
    77         $UserView = new UserView($this->Database, $this->System);
    78         $Output .= $UserView->RegisterSave();
    79       } else
    80       if($_GET['Action'] == 'ServerAdd')
    81       {
    82         $ServerView = new ServerView($this->Database, $this->System);
    83         $Output .= $ServerView->Add();
    84       } else
    85       if($_GET['Action'] == 'ServerCreate')
    86       {
    87         $ServerView = new ServerView($this->Database, $this->System);
    88         $Output .= $ServerView->Create();
    89       } else
    90       if($_GET['Action'] == 'ServerShow')
    91       {
    92         $ServerView = new ServerView($this->Database, $this->System);
    93         $Output .= $ServerView->Item();
    94         //if(array_key_exists('Id', $_GET)) $Output .= $this->ShowServer($_GET['Id']);
    95         //else $this->SystemMessage('Zobrazení serveru', 'Nebylo zadáno Id');
    96       } else
    97       if($_GET['Action'] == 'ServerEdit')
    98       {
    99         $ServerView = new ServerView($this->Database, $this->System);
    100         $Output .= $ServerView->Edit();
    101       } else
    102       if($_GET['Action'] == 'ServerSave')
    103       {
    104         $ServerView = new ServerView($this->Database, $this->System);
    105         $Output .= $ServerView->Save();
    106       } else
    107       if($_GET['Action'] == 'ServerStart')
    108       {
    109         $ServerView = new ServerView($this->Database, $this->System);
    110         $Output .= $ServerView->Start();
    111       } else
    112       if($_GET['Action'] == 'ServerStop')
    113       {
    114         $ServerView = new ServerView($this->Database, $this->System);
    115         $Output .= $ServerView->Stop();
    116       } else
    117       if($_GET['Action'] == 'ServerDatabaseImport')
    118       {
    119         $DatabaseView = new DatabaseView($this->Database, $this->System);
    120         $Output .= $DatabaseView->Import();
    121       } else
    12239      if($_GET['Action'] == 'EmulatorShow')
    12340      {
     
    17592        $Output .= $UpdateView->ItemList();
    17693      } else     
    177       if($_GET['Action'] == 'GameAccountRegister')
    178       {
    179         $ServerView = new ServerView($this->Database, $this->System);
    180         $Output .= $ServerView->AccountCreate();
    181       } else
    182       if($_GET['Action'] == 'GameAccountRegister2')
    183       {
    184         $ServerView = new ServerView($this->Database, $this->System);
    185         $Output .= $ServerView->AccountCreateFinish();
    186       } else     
    187       if($_GET['Action'] == 'Info')
    188       {
    189         $BaseView = new BaseView($this->Database, $this->System);
    190         $Output .= $BaseView->Info();
    191       } else     
    19294      if($_GET['Action'] == 'BackupAdd')
    19395      {
     
    244146        $BaseView = new BaseView($this->Database, $this->System);
    245147        $Output .= $BaseView->State();
    246       } else
    247       if($_GET['Action'] == 'ServerList')
    248       {
    249         $ServerView = new ServerView($this->Database, $this->System);
    250         $Output .= $ServerView->ItemList();
    251148      } else
    252149      if($_GET['Action'] == 'RealmList')
  • trunk/www/Application/Controller/Include.php

    r69 r71  
    44include('Application/Controller/Realm.php');
    55include('Application/Controller/Server.php');
     6include('Application/Controller/User.php');
    67
    78?>
  • trunk/www/Application/Controller/Server.php

    r69 r71  
    33class ServerController extends Controller
    44{
     5  function Add()
     6  {
     7    $Page = new PageView($this->System);
     8    $View = new ServerView($this->System);
     9    return($Page->GetOutput($View->Add()));
     10  } 
    511 
     12  function Create()
     13  {
     14    $Page = new PageView($this->System);
     15    $View = new ServerView($this->System);
     16    return($Page->GetOutput($View->Create()));
     17  } 
     18 
     19  function Show()
     20  {
     21    $Page = new PageView($this->System);
     22    $View = new ServerView($this->System);
     23    return($Page->GetOutput($View->Item()));
     24  } 
     25
     26  function Edit()
     27  {
     28    $Page = new PageView($this->System);
     29    $View = new ServerView($this->System);
     30    return($Page->GetOutput($View->Edit()));
     31  } 
     32
     33  function Save()
     34  {
     35    $Page = new PageView($this->System);
     36    $View = new ServerView($this->System);
     37    return($Page->GetOutput($View->Save()));
     38  } 
     39 
     40  function Start()
     41  {
     42    $Page = new PageView($this->System);
     43    $View = new ServerView($this->System);
     44    return($Page->GetOutput($View->Start()));
     45  } 
     46 
     47  function Stop()
     48  {
     49    $Page = new PageView($this->System);
     50    $View = new ServerView($this->System);
     51    return($Page->GetOutput($View->Stop()));
     52  } 
     53 
     54  function DatabaseImport()
     55  {
     56    $Page = new PageView($this->System);
     57    $View = new DatabaseView($this->System);
     58    return($Page->GetOutput($View->Import()));
     59  } 
     60
     61  function ItemList()
     62  {
     63    $Page = new PageView($this->System);
     64    $View = new ServerView($this->System);
     65    return($Page->GetOutput($View->ItemList()));
     66  } 
     67
     68  function GameAccountRegister()
     69  {
     70    $Page = new PageView($this->System);
     71    $View = new ServerView($this->System);
     72    return($Page->GetOutput($View->AccountCreate()));
     73  } 
     74
     75  function GameAccountRegisterFinish()
     76  {
     77    $Page = new PageView($this->System);
     78    $View = new ServerView($this->System);
     79    return($Page->GetOutput($View->AccountCreateFinish()));
     80  } 
    681}
    782
  • trunk/www/Application/Include.php

    r69 r71  
    22
    33include('Application/CustomTypes.php');
    4 include('Application/Config/Config.php');
     4if(file_exists('Application/Config/Config.php')) include('Application/Config/Config.php');
     5  else die('Nenalezen soubor Application/Config/Config.php. Vytvořte jej kopií ze souboru Application/Config/ConfigSample.php.');
    56include('Application/Model/Include.php');
    67include('Application/View/Include.php');
  • trunk/www/Application/Style/Style.css

    r69 r71  
    6969}
    7070
    71 #Footer
     71.Footer
    7272{
    7373  border-style: solid;
     
    7878  font-size: 10px;
    7979  text-align: center;
     80}
     81
     82.Footer ul li
     83{
     84  display: inline;
     85  padding-left: 5px;
     86  padding-right: 5px;
    8087}
    8188
  • trunk/www/Application/View/Page.php

    r69 r71  
    2929  {
    3030    $Output = '<div class="Navigation"><span class="MenuItem">'.
    31     '<a href="?Action=Info">Informace</a>'.
    32     ' <a href="?Module=System&amp;Action=State">Stav systému</a>'.
    33     ' <a href="?Module=Server&amp;Action=List">Seznam serverů</a>'.
    34     ' <a href="?Module=Client&amp;Action=List">Verze klienta</a>'.
    35     ' <a href="?Module=Emulator&amp;Action=List">Verze emulátoru</a>'.
     31    '<a href="?Module=HomePage&amp;Action=Info">Informace</a>'.
     32    ' <a href="?Module=HomePage&amp;Action=State">Stav systému</a>'.
     33    ' <a href="?Module=Server&amp;Action=ItemList">Seznam serverů</a>'.
     34    ' <a href="?Module=Client&amp;Action=ItemList">Verze klienta</a>'.
     35    ' <a href="?Module=Emulator&amp;Action=ItemList">Verze emulátoru</a>'.
    3636    '</span><div class="MenuItem2">';
    3737    if($this->System->Modules['User']->User['Id'] == $this->System->Modules['User']->AnonymousUserId)
     
    4040      if($this->Config['Web']['UserRegistrationEnabled']) $Output .= ' <a href="'.$this->System->Config['Web']['RootFolder'].'/?Module=User&amp;Action=Register">Registrace</a>';
    4141    } else $Output .= $this->System->Modules['User']->User['Name'].' <a href="'.$this->Config['Web']['RootFolder'].'/?Module=User&amp;Action=Logout">Odhlásit</a>'.
    42        ' <a href="'.$this->Config['Web']['RootFolder'].'/?Module=Userr&amp;Action=Options">Nastavení</a>';
     42       ' <a href="'.$this->Config['Web']['RootFolder'].'/?Module=User&amp;Action=Options">Nastavení</a>';
    4343    $Output .= '</div></div>';
    4444    return($Output);
     
    5050   
    5151    $Time = round($this->System->GetMicrotime() - $ScriptTimeStart, 2);
    52     $Output = '<div id="Footer">
    53    <i>| Založeno na projektu <a href="http://svn.zdechov.net/trac/wowhosting/">WoW hosting</a>'.
    54    ' | <a href="http://svn.zdechov.net/trac/wowhosting/browser">Zdrojové kódy</a>'.
    55    ' | <a href="http://svn.zdechov.net/trac/wowhosting/log?verbose=on">Novinky</a>'.
    56    ' | Správce: '.$this->Config['Web']['Admin'].
    57    ' | E-mail: '.$this->Config['Web']['AdminEmail'].' | ';
    58     if($this->Config['Web']['ShowRuntimeInfo'] == true) $Output .= ' Doba generování: '.$Time.' s / '.ini_get('max_execution_time').' s | Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B |';
    59   $Output .= '</i></div></body></html>';
     52    $Output = '<div class="Footer">
     53   <ul><li>Založeno na projektu <a href="http://svn.zdechov.net/trac/wowhosting/">WoW hosting</a></li>'.
     54   '<li><a href="http://svn.zdechov.net/trac/wowhosting/browser">Zdrojové kódy</a></li>'.
     55   '<li><a href="http://svn.zdechov.net/trac/wowhosting/log?verbose=on">Novinky</a></li>'.
     56   '<li>Správce: '.$this->Config['Web']['Admin'].'</li>'.
     57   '<li>E-mail: '.$this->Config['Web']['AdminEmail'].'</li>';
     58    if($this->Config['Web']['ShowRuntimeInfo'] == true) $Output .= '<li>Doba generování: '.$Time.' s / '.ini_get('max_execution_time').' s</li><li>Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B</li>';
     59  $Output .= '</ul></div></body></html>';
    6060    return($Output);
    6161  }
  • trunk/www/Application/View/Server.php

    r69 r71  
    9797    foreach($Table->Values as $Index => $Item)
    9898    {
    99      $Table->Values[$Index]['Actions'] = '<a href="?Action=ServerShow&amp;Id='.$Item['Id'].'">Podrobnosti</a>';
     99     $Table->Values[$Index]['Actions'] = '<a href="?Module=Server&amp;Action=Show&amp;Id='.$Item['Id'].'">Podrobnosti</a>';
    100100     unset($Table->Values[$Index]['Id']);
    101101    }
     
    109109      $DbRow = $DbResult->fetch_row();
    110110      if(($ServerCount < $Config['MaxServerCount']) and ($DbRow[0] < $Config['MaxServerCountPerUser']))
    111         $Output .= '<br /><div style="text-align: center;"><a href="?Action=ServerAdd">Vytvořit nový server</a></dev>';     
     111        $Output .= '<br /><div style="text-align: center;"><a href="?Module=Server&amp;Action=Add">Vytvořit nový server</a></dev>';     
    112112    }
    113113    return($Output);
     
    123123    {
    124124    $Output = '<h4>Podrobnosti serveru</h4>';
    125     $Form = new Form($this->ItemFormClass);
     125    $Form = new Form($this->System, $this->ItemFormClass);
    126126    $Form->LoadValuesFromDatabase($Id);
    127127    $Form->Definition['Items']['Realmlist'] = array('Type' => 'String', 'Caption' => 'Adresa k připojení', 'Default' => '');   
     
    142142      if(array_key_exists('Id', $Server->Server['Database']) and ($Server->Server['Lock'] == 0))
    143143      {
    144         if($ServerStatus['RealmdPortState'] == true) $Output .= ' <a href="?Action=ServerStop&amp;Id='.$Server->Id.'">Zastavit</a>  <a href="?Action=ServerRestart&amp;Id='.$Server->Id.'">Restartovat</a>';
    145           else $Output .= ' <a href="?Action=ServerStart&amp;Id='.$Server->Id.'">Spustit</a>';
     144        if($ServerStatus['RealmdPortState'] == true) $Output .= ' <a href="?Action=ServerStop&amp;Id='.$Server->Id.'">Zastavit</a>  <a href="?Module=Server&amp;Action=Restart&amp;Id='.$Server->Id.'">Restartovat</a>';
     145          else $Output .= ' <a href="?Module=Server&amp;Action=Start&amp;Id='.$Server->Id.'">Spustit</a>';
    146146      }
    147147      if($Server->Server['Lock'] == 0)
    148148      {
    149         $Output .= ' <a href="?Action=ServerEdit&amp;Id='.$Server->Id.'">Upravit základní nastavení</a>';
     149        $Output .= ' <a href="?Module=Server&amp;Action=Edit&amp;Id='.$Server->Id.'">Upravit základní nastavení</a>';
    150150      }
    151151      //$Output .= ' <a href="?Action=ServerDatabaseImport&amp;Id='.$Server->Id.'">Načtení čisté databáze</a>';
    152       $Output .= ' <a href="?Action=RealmAdd&amp;Id='.$Server->Id.'">Vytvořit nový svět</a>';
    153       $Output .= ' <a href="?Action=UpdateRealmCharacters&amp;Id='.$Server->Id.'">Aktualizovat počty postav</a>';
     152      $Output .= ' <a href="?Module=Realm&amp;Action=Add&amp;Id='.$Server->Id.'">Vytvořit nový svět</a>';
     153      $Output .= ' <a href="?Module=Realm&amp;Action=UpdateCharacters&amp;Id='.$Server->Id.'">Aktualizovat počty postav</a>';
    154154    }
    155     $Output .= ' <a href="?Action=GameAccountRegister&amp;Id='.$Server->Id.'">Vytvoření herního účtu</a>';
     155    $Output .= ' <a href="?Module=Server&amp;Action=GameAccountRegister&amp;Id='.$Server->Id.'">Vytvoření herního účtu</a>';
    156156    $Output .= '</div>';
    157157   
    158158    // Show realmlist
    159     $RealmView = new RealmView($this->Database, $this->System);
     159    $RealmView = new RealmView($this->System);
    160160    $Output .= $RealmView->ItemList();
    161161    } else $Output = $this->System->SystemMessage('Zobrazení serveru', 'Server se zadaným id nenalezen.');
     
    180180        else
    181181        {
    182           $Form = new Form($this->CreateFormClass);
     182          $Form = new Form($this->System, $this->CreateFormClass);
    183183          $Form->LoadValuesFromForm();
    184184          $Form->OnSubmit = '?Action=ServerCreate';
     
    208208        if($NewPortRealmd < $Config['BaseNetworkPortRealmd']) $NewPortRealmd = $Config['BaseNetworkPortRealmd'];
    209209           
    210         $Form = new Form($this->CreateFormClass, array());
     210        $Form = new Form($this->System, $this->CreateFormClass, array());
    211211        $Form->LoadValuesFromForm();
    212212        $this->Database->insert('Server', array('Name' => $Form->Values['Name'], 'Description' => $Form->Values['Description'], 'User' => $this->System->Modules['User']->User['Id'], 'Homepage' => $Form->Values['Homepage'], 'Database' => $Form->Values['Database'], 'NetworkPortRealmd' => $NewPortRealmd, 'Lock' => 1, 'TimeCreate' => 'NOW()'));
     
    215215        $Server->CreateDatabase();           
    216216        $Output .= $this->System->SystemMessage('Vytvoření serveru', $Server->ImportDatabase(true));
    217         $TaskView = new TaskView($this->Database, $this->System);
     217        $TaskView = new TaskView($this->System);
    218218        $Output .= $TaskView->ItemList();
    219219        //$UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']);
     
    231231    if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
    232232    {
    233       $Form = new Form($this->EditFormClass, array());
     233      $Form = new Form($this->System, $this->EditFormClass, array());
    234234      $Form->LoadValuesFromForm();
    235235      $ServerId = $_POST['ServerId'];
     
    253253    if(($this->System->Modules['User']->User['Id'] == $Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
    254254    {
    255       $Form = new Form($this->EditFormClass);
     255      $Form = new Form($this->System, $this->EditFormClass);
    256256      $Form->LoadValuesFromDatabase($_GET['Id']);
    257257      $Form->Values['ServerId'] = $_GET['Id'];
     
    271271      {
    272272        $Output .= $this->System->SystemMessage('Spuštění serveru', $Server->Start());
    273         $TaskView = new TaskView($this->Database, $this->System);
     273        $TaskView = new TaskView($this->System);
    274274        $Output .= $TaskView->ItemList();;
    275275      } else $this->System->SystemMessage('Spuštění serveru', 'Nemáte oprávnění');
     
    287287      {
    288288        $Output .= $this->System->SystemMessage('Zastavení serveru', $Server->Stop());
    289         $TaskView = new TaskView($this->Database, $this->System);
     289        $TaskView = new TaskView($this->System);
    290290        $Output .= $TaskView->ItemList();;
    291291      } else $this->System->SystemMessage('Zastavení serveru', 'Nemáte oprávnění');
     
    296296  function AccountCreate()
    297297  {
    298     $Form = new Form($this->GameAccountNewFormClass);
     298    $Form = new Form($this->System, $this->GameAccountNewFormClass);
    299299    $Form->LoadValuesFromForm();
    300300    $Form->Values['ServerId'] = $_GET['Id'];
    301     $Form->OnSubmit = '?Action=GameAccountRegister2';
     301    $Form->OnSubmit = '?Module=Server&amp;Action=GameAccountRegisterFinish';
    302302    $Output = $Form->ShowEditForm();
    303303    return($Output);
     
    306306  function AccountCreateFinish()
    307307  {
    308     $Form = new Form($this->GameAccountNewFormClass);
     308    $Form = new Form($this->System, $this->GameAccountNewFormClass);
    309309    $Form->LoadValuesFromForm();
    310310    $Server = new Server($this->Database, $Form->Values['ServerId']);
    311311    $Output = $this->System->SystemMessage('Vytvoření herního účtu', $Server->NewAccount($Form->Values['Name'], $Form->Values['Password'], $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Expansion']));
    312     $Output .= '<a href="?Action=GameAccountRegister&amp;Id='.$Form->Values['ServerId'].'">Zpět k zadání údajů</a>';
     312    $Output .= '<a href="?Module=Server&amp;Action=GameAccountRegister&amp;Id='.$Form->Values['ServerId'].'">Zpět k zadání údajů</a>';
    313313    return($Output);
    314314  }
  • trunk/www/Application/View/User.php

    r69 r71  
    4949  );
    5050 
    51   function LoginForm()
     51  function Login()
    5252  {
    5353    global $Config;
    5454   
    55     $Form = new Form($this->LoginFormClass);
    56     $Form->OnSubmit = '?Action=Login';
     55    $Form = new Form($this->System, $this->LoginFormClass);
     56    $Form->OnSubmit = '?Module=User&amp;Action=LoginFinish';
    5757    $Output = $Form->ShowEditForm();
    5858    $Output .= '<div class="Centred">';
    5959    if($Config['Web']['UserRegistrationEnabled'])
    60       $Output .= '<a href="?Action=UserRegister">Registrovat se</a> ';
    61     $Output .= '<a href="?Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';
     60      $Output .= '<a href="?Module=User&amp;Action=Register">Registrovat se</a> ';
     61    $Output .= '<a href="?Module=User&amp;Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';
    6262    return($Output);
    6363  }
    6464 
    65   function LoginResult()
     65  function LoginFinish()
    6666  {
    67     $Form = new Form($this->LoginFormClass);
    68     $Form->OnSubmit = '?Action=Login';
     67    $Form = new Form($this->System, $this->LoginFormClass);
     68    $Form->OnSubmit = '?Module=User&amp;Action=LoginFinish';
    6969    $Form->LoadValuesFromForm();
    7070    $Result = $this->System->Modules['User']->Login($Form->Values['Username'], $Form->Values['Password']);
     
    7474      $Form->Values['Password'] = '';
    7575      $Output .= $Form->ShowEditForm();
    76       $Output .= '<div class="Centred"><a href="?Action=UserRegister">Registrovat se</a> '.
    77         '<a href="?Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';
     76      $Output .= '<div class="Centred"><a href="?Module=User&amp;Action=UserRegister">Registrovat se</a> '.
     77        '<a href="?Module=User&amp;Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';
    7878    }
    7979    return($Output);
     
    8686    if($Config['Web']['UserRegistrationEnabled'])
    8787    {
    88       $Form = new Form($this->RegisterFormClass, array());
     88      $Form = new Form($this->System, $this->RegisterFormClass, array());
    8989      $Form->LoadValuesFromForm();
    9090      $Result = $this->System->Modules['User']->Register($Form->Values['Login'], $Form->Values['Password'], $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Name']);
     
    9292      if($Result <> USER_REGISTRATED)
    9393      {
    94         $Form->OnSubmit = '?Action=UserRegisterSave';
     94        $Form->OnSubmit = '?Module=User&amp;Action=UserRegisterSave';
    9595        $Output = $Form->ShowEditForm();
    9696      }
     
    108108  function PasswordRecoveryFinish()
    109109  {
    110     $Form = new Form($this->PasswordRecoveryFormClass);
     110    $Form = new Form($this->System, $this->PasswordRecoveryFormClass);
    111111    $Form->LoadValuesFromForm();
    112112    $Result = $this->System->Modules['User']->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']);
     
    121121  function PasswordRecovery()
    122122  {
    123     $Form = new Form($this->PasswordRecoveryFormClass);
    124     $Form->OnSubmit = '?Action=PasswordRecovery2';
     123    $Form = new Form($this->System, $this->PasswordRecoveryFormClass);
     124    $Form->OnSubmit = '?Module=User&amp;Action=PasswordRecovery2';
    125125    $Output = $Form->ShowEditForm();
    126126    return($Output);
     
    130130  {
    131131    $Output = $this->System->SystemMessage('Odhlášení', $this->System->Modules['User']->Logout());
    132     $Output .= $this->LoginForm();
     132    $Output .= $this->Login();
    133133    return($Output);
    134134  }
     
    136136  function Options()
    137137  {
    138     $UserOptions = new Form($this->OptionsFormClass);
     138    $UserOptions = new Form($this->System, $this->OptionsFormClass);
    139139    $UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']);
    140     $UserOptions->OnSubmit = '?Action=UserOptionsSave';
     140    $UserOptions->OnSubmit = '?Module=User&amp;Action=UserOptionsSave';
    141141    $Output = $UserOptions->ShowEditForm();
    142142    return($Output);
     
    145145  function OptionsSave()
    146146  {
    147     $UserOptions = new Form($this->OptionsFormClass, array());
     147    $UserOptions = new Form($this->System, $this->OptionsFormClass, array());
    148148    $UserOptions->LoadValuesFromForm();
    149149    $UserOptions->SaveValuesToDatabase($this->System->Modules['User']->User['Id']);
     
    151151    $this->System->Modules['Log']->NewRecord('User', 'Nastavení uživatele změněno', $UserOptions->Values['Name']);
    152152    $UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']);
    153     $UserOptions->OnSubmit = '?Action=UserOptionsSave';
     153    $UserOptions->OnSubmit = '?Module=User&amp;Action=UserOptionsSave';
    154154    $Output .= $UserOptions->ShowEditForm();
    155155    return($Output);
     
    162162    if($Config['Web']['UserRegistrationEnabled'])
    163163    {
    164       $Form = new Form($this->RegisterFormClass);
     164      $Form = new Form($this->System, $this->RegisterFormClass);
    165165      $Form->LoadValuesFromForm();
    166       $Form->OnSubmit = '?Action=UserRegisterSave';
     166      $Form->OnSubmit = '?Module=User&amp;Action=UserRegisterSave';
    167167      $Output = 'Vyplňte správně požadované údaje. Na zadaný email vám bude zaslán aktivační email.';
    168168      $Output .= $Form->ShowEditForm();
  • trunk/www/Base/Form.php

    r69 r71  
    11<?php
    22
    3 class Form
     3class Form extends Module
    44{
    55  var $Definition = array();
     
    77  var $OnSubmit = '';
    88 
    9   function __construct($FormClass)
     9  function __construct($System, $FormClass)
    1010  { 
    1111    $this->Definition = $FormClass;
     
    1414      $this->Values[$Index] = '';
    1515    }   
     16    $this->System = $System;
     17    $this->Database = $System->Database;
     18    $this->Config = $System->Config;
    1619  }
    1720
     
    2427  function ShowTableBlock($Context = '')
    2528  {
    26     global $Database, $FormTypes;
     29    global $FormTypes;
    2730
    2831    $Table = array(
     
    4144      }
    4245    }
    43     $Output = '<div style="text-align: center">'.$this->Definition['Title'].'</div>'.Table($Table, 'WideTable');
     46    $Html = new Html();
     47    $Output = '<div style="text-align: center">'.$this->Definition['Title'].'</div>'.$Html->Table($Table, 'WideTable');
    4448    return($Output);
    4549  }
     
    5458  function ShowEditBlock($Context = '')
    5559  {
    56     global $Database, $FormTypes;
     60    global $FormTypes;
    5761
    5862    $Table = array(
     
    7074      }
    7175    }
    72     $Output = '<fieldset><legend>'.$this->Definition['Title'].'</legend>'.Table($Table, 'BasicTable').
     76    $Html = new Html();
     77    $Output = '<fieldset><legend>'.$this->Definition['Title'].'</legend>'.$Html->Table($Table, 'BasicTable').
    7378    '</fieldset>';
    7479    foreach($this->Definition['Items'] as $Index => $Item)
     
    7984  function LoadValuesFromDatabase($Id)
    8085  {
    81     global $Database;
    82 
    83     $DbResult = $Database->query('SELECT T.* FROM '.$this->Definition['Table'].' AS T WHERE T.Id='.$Id);
     86    $DbResult = $this->Database->query('SELECT T.* FROM '.$this->Definition['Table'].' AS T WHERE T.Id='.$Id);
    8487    if($DbResult->num_rows > 0) $DbRow = $DbResult->fetch_assoc();
    8588    foreach($this->Definition['Items'] as $Index => $Item)
     
    9497  function SaveValuesToDatabase($Id)
    9598  {
    96     global $Database;
    97 
    9899    if($Id == 0)
    99100    {
    100101      $this->Values['Id'] = $Id;
    101       $DbResult = $Database->replace($this->Definition['Table'], $this->Values);
     102      $DbResult = $this->Database->replace($this->Definition['Table'], $this->Values);
    102103    } else
    103     $DbResult = $Database->update($this->Definition['Table'], 'Id='.$Id, $this->Values);
     104    $DbResult = $this->Database->update($this->Definition['Table'], 'Id='.$Id, $this->Values);
    104105  }
    105106
  • trunk/www/Base/Html.php

    r69 r71  
    11<?php
    22
    3 class HTML extends Module
     3class HTML
    44{
    55  function ShowArray($Value)
  • trunk/www/Base/Table.php

    r69 r71  
    5757      'Rows' => $this->Values,
    5858    );
    59     $Output = Table($Table, 'WideTable');
    60     $Output .= '<div class="Pager">'.PageList('Page', $this->Page, $this->TotalRowCount, $Config['Web']['TableRowPerPage']).'</div>';
     59    $Html = new Html();
     60    $Output = $Html->Table($Table, 'WideTable');
     61    $Output .= '<div class="Pager">'.$Html->PageList('Page', $this->Page, $this->TotalRowCount, $Config['Web']['TableRowPerPage']).'</div>';
    6162    return($Output);
    6263  } 
  • trunk/www/Base/Types/Base.php

    r69 r71  
    11<?php
    22
    3 class TypeBase
     3class TypeBase extends Module
    44{
    55  var $DatabaseCompareOperators = array();
  • trunk/www/Base/Types/Include.php

    r69 r71  
    4242function ExecuteTypeEvent($TypeName, $Event, $Parameters = array())
    4343{
    44   global $TypeDefinitionList;
     44  global $TypeDefinitionList, $System;
    4545 
    4646  if(array_key_exists($TypeName, $TypeDefinitionList))
     
    4848    $Type = $TypeDefinitionList[$TypeName];
    4949    $TypeClass = 'Type'.$Type['Class'];
    50     $TypeObject = new $TypeClass;
     50    $TypeObject = new $TypeClass($System);
    5151    if(is_callable(array($TypeObject, $Event))) return($TypeObject->$Event($Parameters));
    5252      else return($TypeName.'->'.$Event.'('.serialize($Parameters).')');
  • trunk/www/Base/Types/PointerOneToOne.php

    r69 r71  
    55  function OnView($Item)
    66  {
    7     global $Database, $TypeDefinitionList;
     7    global $TypeDefinitionList;
    88
    99    $Type = $TypeDefinitionList[$Item['Type']];
    10     $DbResult = $Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name FROM `'.$Type['Parameters']['Table'].'` WHERE `'.$Type['Parameters']['Id'].'`='.$Item['Value']);
     10    $DbResult = $this->Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name FROM `'.$Type['Parameters']['Table'].'` WHERE `'.$Type['Parameters']['Id'].'`='.$Item['Value']);
    1111    $DbRow = $DbResult->fetch_assoc();
    1212    $Output = $DbRow['Name'];
     
    2424  function OnEdit($Item)
    2525  {
    26     global $Database, $TypeDefinitionList;
     26    global $TypeDefinitionList;
    2727
    2828    $Output = '<select name="'.$Item['Name'].'">';
     
    3030    if(array_key_exists('Condition', $Type['Parameters'])) $Where = ' WHERE '.$Type['Parameters']['Condition'];
    3131      else $Where = '';
    32     $DbResult = $Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name,'.$Type['Parameters']['Id'].' AS Id FROM `'.$Type['Parameters']['Table'].'`'.$Where.' ORDER BY Name DESC');
     32    $DbResult = $this->Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name,'.$Type['Parameters']['Id'].' AS Id FROM `'.$Type['Parameters']['Table'].'`'.$Where.' ORDER BY Name DESC');
    3333    while($DbRow = $DbResult->fetch_assoc())
    3434    {
Note: See TracChangeset for help on using the changeset viewer.