source: branches/Modular/Install.php@ 425

Last change on this file since 425 was 425, checked in by chronos, 12 years ago
  • Upraveno: Automatické spouštění instalovaných modulů.
File size: 2.4 KB
Line 
1<?php
2
3include_once('Common/Global.php');
4/* @var $System System */
5$System = NULL;
6GlobalInit();
7
8function ModuleTable()
9{
10 global $System;
11
12 $Output = '<table border="1" style="border: 1px" class="WideTable">'.
13 '<tr><th>Name</th><th>Installed</th><th>Version</th><th>Dependency</th><th>Actions</th></tr>';
14 foreach($System->Modules as $Module)
15 {
16 if($Module->IsInstalled()) $Actions = '<a href="?a=uninstall&m='.$Module->Name.'">Odinstalovat</td>';
17 else $Actions = '<a href="?a=install&m='.$Module->Name.'">Instalovat</td>';
18 if($Module->IsInstalled()) $Installed = 'Ano';
19 else $Installed = 'Ne';
20 $Deps = implode(', ', $Module->Dependencies);
21 if($Deps == '') $Deps = '&nbsp;';
22 $Output .= '<tr><td>'.$Module->Name.'</td><td>'.$Installed.'</td><td>'.
23 $Module->Version.'</td><td>'.$Deps.'</td><td>'.$Actions.'</td></tr>';
24 }
25 $Output .= '</table>';
26 return($Output);
27}
28
29function ShowDefault()
30{
31 global $System;
32
33 if($System->Modules['System']->IsInstalled())
34 {
35 $Output = ModuleTable();
36 $Output .= '<a href="?a=uninstall">Odinstalovat systém</a>';
37 $Output .= ' <a href="?a=reload">Aktualizovat seznam z disku</a>';
38 } else
39 {
40 $Output = 'System ještě není instalován.<br/>';
41 $Output .= '<a href="?a=install">Instalovat systém</a>';
42 }
43 echo($Output);
44}
45
46if($System->Modules['System']->IsInstalled())
47 $System->Modules['System']->LoadFromDatabase();
48
49if($Config['Web']['SystemAdministration'] == true)
50{
51if(array_key_exists('a', $_GET))
52{
53 if($_GET['a'] == 'install')
54 {
55 if(array_key_exists('m', $_GET))
56 {
57 $Module = $System->Modules[$_GET['m']];
58 $Module->Install();
59 } else
60 {
61 $System->Modules['System']->Install();
62 $System->ReloadFromDisk();
63 $System->Modules['System']->SaveToDatabase();
64 }
65 ShowDefault();
66 }
67 else if($_GET['a'] == 'uninstall')
68 {
69 if(array_key_exists('m', $_GET))
70 {
71 $Module = $System->Modules[$_GET['m']];
72 $Module->Uninstall();
73 //$System->Modules['System']->SaveToDatabase();
74 } else
75 {
76 $System->Modules['System']->Uninstall();
77 }
78 ShowDefault();
79 } else if($_GET['a'] == 'reload')
80 {
81 $System->ReloadFromDisk();
82 $System->Modules['System']->SaveToDatabase();
83 ShowDefault();
84 }
85 else ShowDefault();
86} else ShowDefault();
87} else echo('Access denied');
88
89?>
Note: See TracBrowser for help on using the repository browser.