Legend:
- Unmodified
- Added
- Removed
-
index.php
r5 r8 1 1 <?php 2 2 3 include('config.php'); 4 session_start(); 3 include_once('global.php'); 5 4 include('base.php'); 6 $Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password'], $Config['Database']['Database']);7 $Database->Prefix = $Config['Database']['Prefix'];8 $Database->charset($Config['Database']['Charset']);9 5 10 $Output = '<?xml version="1.0" encoding="utf-8"?>'."\n". 11 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'. 12 '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'. 13 '<head><link rel="stylesheet" href="style.css" type="text/css" media="all" />'. 14 //'<script type="text/javascript" src="global.js"></script>'. 15 '<title>IS</title> 16 </head><body><table class="base"><tr><td class="menu">'; 6 class IndexPage extends Page 7 { 8 var $Dependencies = array('News'); 9 var $FullTitle = ''; 10 var $ShortTitle = ''; 17 11 18 LoadTypeDefinition(); 19 LoadListDefinition(); 20 $Output .= $Output; 21 $Output .= TableList(1); 22 $Output .= TableList(0); 23 $Output .= '</td><td class="main">'; 24 $Output .= Output(); 25 $Output .= '</td></tr></table></body></html>'; 26 echo($Output); 27 //echo(phpinfo()); 12 function Show() 13 { 14 $FormUserLogin = array( 15 'Title' => 'Přihlášení', 16 'SubmitBuffonText' => 'Přihlásit', 17 'Items' => array( 18 array('Name' => 'UserName', 'Type' => 'String', 'Caption' => 'Jméno', 'Value' => ''), 19 array('Name' => 'Password', 'Type' => 'Password', 'Caption' => 'Heslo', 'Value' => ''), 20 ), 21 ); 22 $FormUserRegister = array 23 ( 24 'Title' => 'Registrace uživatele', 25 'Table' => 'User', 26 'SubmitBuffonText' => 'Registrovat', 27 'Items' => array( 28 array('Name' => 'UserName', 'Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Value' => ''), 29 array('Name' => 'Password', 'Type' => 'Password', 'Caption' => 'Heslo', 'Value' => ''), 30 array('Name' => 'Password2', 'Type' => 'Password', 'Caption' => 'Potvrzení hesla', 'Value' => ''), 31 array('Name' => 'Email', 'Type' => 'String', 'Caption' => 'E-mail', 'Value' => ''), 32 array('NAme' => 'FirstName', 'Type' => 'String', 'Caption' => 'Křestní jméno', 'Value' => ''), 33 array('Name' => 'SecondName', 'Type' => 'String', 'Caption' => 'Příjmení', 'Value' => ''), 34 ), 35 ); 36 37 $Output = '<table class="base"><tr><td class="menu">'; 38 if(array_key_exists('Action', $_GET)) 39 { 40 if($_GET['Action'] == 'Login') 41 { 42 $Output .= $this->SystemMessage('Přihlášení', $this->System->Modules['User']->Login($_POST['UserName'], $_POST['Password'])); 43 } else 44 if($_GET['Action'] == 'Logout') 45 { 46 $Output .= $this->SystemMessage('Odhlášení', $this->System->Modules['User']->Logout()); 47 } else 48 if($_GET['Action'] == 'UserRegister') 49 { 50 $Form = new Form(); 51 $Form->Definition = $FormUserRegister; 52 $Form->OnSubmit = '?Action=UserRegisterSave'; 53 $Output .= $Form->ShowEditForm(); 54 } else 55 if($_GET['Action'] == 'UserRegisterConfirm') 56 { 57 $Output .= $this->SystemMessage('Potvrzení registrace', $this->System->Modules['User']->RegisterConfirm($_GET['User'], $_GET['H'])); 58 } else 59 if($_GET['Action'] == 'UserRegisterSave') 60 { 61 $Form = new Form(); 62 $Form->Definition = $FormUserRegister; 63 $Form->LoadValuesFromForm(); 64 $Output .= $this->SystemMessage('Registrace', $this->System->Modules['User']->Register($Form->Values['Name'], $Form->Values['Password'], $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['FirstName'], $Form->Values['SecondName'])); 65 } 66 } 67 if($this->System->Modules['User']->User['Id'] == 0) 68 { 69 if(!array_key_exists('Action', $_GET)) 70 { 71 $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>'; 72 $Form = new Form(); 73 $Form->Definition = $FormUserLogin; 74 $Form->OnSubmit = '?Action=Login'; 75 $Output .= $Form->ShowEditForm(); 76 } 77 } 78 else 79 { 80 $Output .= $this->System->Modules['User']->User['UserName'].' <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=Logout">Odhlásit</a>'; 81 $Output .= '<br /><br />'; 82 LoadTypeDefinition(); 83 LoadListDefinition(); 84 $Output .= TableList(1); 85 $Output .= TableList(0); 86 $Output .= '</td><td class="main">'; 87 $Output .= Output(); 88 $Output .= '</td></tr></table></body></html>'; 89 } 90 return($Output); 91 } 92 } 93 94 $System->AddModule(new IndexPage()); 95 $System->Modules['IndexPage']->GetOutput(); 96 28 97 ?>
Note:
See TracChangeset
for help on using the changeset viewer.