Changeset 511
- Timestamp:
- Feb 16, 2013, 4:23:29 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/install.php
r510 r511 1 1 <?php 2 2 3 $StopAfterUpdateManager = true; 4 include_once('../includes/global.php'); 5 include_once('UpdateTrace.php'); 6 $UpdateManager->Trace = $Updates; 7 $UpdateManager->InstallMethod = 'FullInstall'; 3 include_once(dirname(__FILE__).'/../includes/Database.php'); 4 include_once(dirname(__FILE__).'/../includes/system.php'); 5 include_once(dirname(__FILE__).'/../includes/Update.php'); 6 if(file_exists(dirname(__FILE__).'/../includes/config.php')) 7 include_once(dirname(__FILE__).'/../includes/config.php'); 8 include_once(dirname(__FILE__).'/UpdateTrace.php'); 9 include_once(dirname(__FILE__).'/../includes/Version.php'); 8 10 9 11 function ControlPanel() 10 12 { 11 13 global $UpdateManager; 12 14 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 15 $YesNo = array(false => 'Ne', true => 'Ano'); 16 $Output = '<h3>Správa instance</h3>'. 17 'Je instalováno: '.$YesNo[$UpdateManager->IsInstalled()].'<br/>'; 18 if($UpdateManager->IsInstalled()) 19 $Output .= 'Je aktuální: '.$YesNo[$UpdateManager->IsUpToDate()].'<br/>'. 20 'Verze databáze: '.$UpdateManager->GetDbVersion().'<br/>'; 21 $Output .= 'Verze kódu: '.$UpdateManager->Revision.'<br/>'. 22 '<form action="?" method="post">'; 23 if($UpdateManager->IsInstalled()) 24 { 25 if(!$UpdateManager->IsUpToDate()) 26 $Output .= '<input type="submit" name="update" value="Aktualizovat"/>'; 27 $Output .= '<input type="submit" name="uninstall" value="Odinstalovat"/>'; 28 } else $Output .= '<input type="submit" name="install" value="Instalovat"/>'; 29 $Output .= '</form>'; 30 return($Output); 29 31 } 30 32 31 $Output = '<?xml version="1.0" encoding="'.$System->Config['Web']['Charset'].'"?> 33 function PrepareConfig() 34 { 35 $Output = '<h3>Nastavení systému</h3>'; 36 $Output .= '<form action="" method="post">'; 37 $Output .= 'Adresa serveru: <input type="text" name="hostname"/><br/>'; 38 $Output .= 'Přihlašovací jméno: <input type="text" name="username"/><br/>'; 39 $Output .= 'Heslo: <input type="password" name="UserName"/><br/>'; 40 $Output .= 'Schéma: <input type="password" name="Schema"/><br/>'; 41 $Output .= 'Titulek webu: <input type="text" name="Title"/><br/>'; 42 $Output .= 'Email správce: <input type="text" name="AdminEmail"/><br/>'; 43 $Output .= '<input type="submit" name="configure" value="Nastavit"/>'; 44 $Output .= '</form>'; 45 return($Output); 46 } 47 48 function CreateConfig($Config) 49 { 50 $Output = "<?php 51 52 \$IsDeveloper = in_array(\$_SERVER['REMOTE_ADDR'], array('127.0.0.1')); 53 54 \$Config = array( 55 'Database' => array( 56 'Host' => 'localhost', 57 'User' => 'root', 58 'Password' => '', 59 'Database' => 'wowpreklad', 60 'DatabaseAoWoW' => 'wowpreklad_mangos', 61 'Prefix' => '', 62 'Charset' => 'utf8', 63 'MangosPrefix' => '', 64 ), 65 'Style' => 'maron', 66 'Web' => array( 67 'Title' => 'Projekt překládání textů hry WoW', 68 'Charset' => 'utf-8', 69 'Host' => 'localhost', 70 'BaseURL' => '', 71 'AdminEmail' => 'admin@localhost', 72 'Authors' => 'autor', 73 'ShowSQLQuery' => false, 74 'ShowSQLError' => \$IsDeveloper, 75 'ShowPHPError' => \$IsDeveloper, 76 'ShowRuntimeInfo' => \$IsDeveloper, 77 'FormatOutput' => \$IsDeveloper, 78 'ItemsPerPage' => 40, 79 'TempFolder' => '../tmp/', 80 'GameVersion' => '3.3.5a', 81 'VisiblePagingItems' => 20, 82 'WebCounter' => '', 83 'Timezone' => 'Europe/Prague', 84 ), 85 'ExportTaskProcessPeriod' => 10, 86 'MaxExportPerUser' => 10, 87 'AoWoWExportId' => 1, 88 ); 89 90 ?>"; 91 return($Output); 92 } 93 94 $Output = '<?xml version="1.0" encoding="utf-8"?> 32 95 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 33 96 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cz">'. 34 97 '<head>'. 35 '<meta http-equiv="content-type" content="application/xhtml+xml; charset= '.$System->Config['Web']['Charset'].'" />'.98 '<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />'. 36 99 '<title>Správa instance</title>'. 37 100 '</head><body>'; 101 if(isset($Config)) 102 { 103 $System = new System(); 104 $System->Init(); 105 $UpdateManager = new UpdateManager(); 106 $UpdateManager->Database = $System->Database; 107 $UpdateManager->Revision = $Revision; 108 $UpdateManager->Trace = $Updates; 109 $UpdateManager->InstallMethod = 'FullInstall'; 110 38 111 if(array_key_exists('update', $_POST)) 39 112 { 40 $Output .= 'Aktualizace';41 42 113 $Output .= '<h3>Aktualizace</h3>'; 114 $UpdateManager->Update(); 115 $Output .= ControlPanel(); 43 116 } else 44 117 if(array_key_exists('install', $_POST)) 45 118 { 46 $Output .= 'Instalace';47 48 119 $Output .= '<h3>Instalace</h3>'; 120 $UpdateManager->Install(); 121 $Output .= ControlPanel(); 49 122 } else 50 123 if(array_key_exists('uninstall', $_POST)) 51 124 { 52 $Output .= 'Odinstalace';53 54 125 $Output .= '<h3>Odinstalace</h3>'; 126 $UpdateManager->Uninstall(); 127 $Output .= ControlPanel(); 55 128 } else 56 129 { 57 $Output .= ControlPanel(); 130 $Output .= ControlPanel(); 131 } 132 } else 133 { 134 if(array_key_exists('configure', $_POST)) 135 { 136 $Config = array(); 137 $ConfigText = CreateConfig($Config); 138 file_put_contents('../includes/config.php', $ConfigText); 139 $Output .= 'Konfigurace nastavena'; 140 } else $Output .= PrepareConfig(); 58 141 } 59 142 $Output .= '</body></html>'; -
trunk/includes/Update.php
r507 r511 1 1 <?php 2 3 include_once('global.php');4 2 5 3 class UpdateManager -
trunk/includes/global.php
r510 r511 8 8 include_once(dirname(__FILE__).'/Page.php'); 9 9 include_once(dirname(__FILE__).'/error.php'); 10 if(file_exists(dirname(__FILE__).'/config.php')) 11 include_once(dirname(__FILE__).'/config.php'); 12 include_once(dirname(__FILE__).'/Version.php'); 10 13 11 14 GlobalInit(); … … 13 16 function GlobalInit() 14 17 { 15 16 18 global $System, $ScriptStartTime, $TranslationTree, $User, $StopAfterUpdateManager, 19 $UpdateManager, $Config; 17 20 18 21 $ScriptStartTime = GetMicrotime(); … … 20 23 if(isset($_SERVER['REMOTE_ADDR'])) session_start(); 21 24 22 if(file_exists(dirname(__FILE__).'/config.php')) include_once(dirname(__FILE__).'/config.php'); 23 else die('Nenalezen konfigurační soubor config.php ve složce includes. '. 24 'Vytvořte jej zkopírováním vzoru config.sample.php.'); 25 if(!isset($Config)) die('Systém není nainstalován. Pokračujte v instalaci <a href="admin/install.php">zde</a>.'); 25 26 date_default_timezone_set($Config['Web']['Timezone']); 26 27 $Revision = 510; // Subversion revision28 $ReleaseTime = '2013-02-15';29 27 30 28 $System = new System(); … … 35 33 $UpdateManager->Database = $System->Database; 36 34 $UpdateManager->Revision = $Revision; 37 if(isset($StopAfterUpdateManager)) return;38 35 if(!$UpdateManager->IsInstalled()) die('Systém vyžaduje instalaci databáze.'); 39 36 if(!$UpdateManager->IsUpToDate()) die('Systém vyžaduje aktualizaci databáze.'); -
trunk/index.php
r510 r511 81 81 } 82 82 83 // Echo text even if it is hidden because of caching ofexternal searching engines83 // Echo text even if it is hidden because of caching by external searching engines 84 84 return('<div style="'.$HideWelcome.'">'. 85 85 '<div id="bannertitle">'.$Config['Web']['Title'].'</div>'.
Note:
See TracChangeset
for help on using the changeset viewer.