Changeset 512 for trunk/admin/install.php
- Timestamp:
- Feb 16, 2013, 7:10:55 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/install.php
r511 r512 7 7 include_once(dirname(__FILE__).'/../includes/config.php'); 8 8 include_once(dirname(__FILE__).'/UpdateTrace.php'); 9 include_once(dirname(__FILE__).'/DefaultConfig.php'); 9 10 include_once(dirname(__FILE__).'/../includes/Version.php'); 10 11 … … 27 28 $Output .= '<input type="submit" name="uninstall" value="Odinstalovat"/>'; 28 29 } else $Output .= '<input type="submit" name="install" value="Instalovat"/>'; 30 $Output .= '<input type="submit" name="configure" value="Nastavit"/>'; 29 31 $Output .= '</form>'; 30 32 return($Output); 31 33 } 32 34 33 function PrepareConfig( )35 function PrepareConfig($Config) 34 36 { 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>'; 37 $Output = '<h3>Nastavení systému</h3>'. 38 '<form action="" method="post">'. 39 '<table>'. 40 '<tr><td>Adresa serveru:</td><td> <input type="text" name="Host" value="'.$Config['Database']['Host'].'"/></td></tr>'. 41 '<tr><td>Přihlašovací jméno:</td><td> <input type="text" name="User" value="'.$Config['Database']['User'].'"/></td></tr>'. 42 '<tr><td>Heslo:</td><td> <input type="password" name="Password"/></td></tr>'. 43 '<tr><td>Schéma:</td><td> <input type="text" name="Schema" value="'.$Config['Database']['Database'].'"/></td></tr>'. 44 '<tr><td>Relativní URL cesta:</td><td> <input type="text" name="BaseURL" value="'.$Config['Web']['BaseURL'].'"/></td></tr>'. 45 '<tr><td>Titulek webu:</td><td> <input type="text" name="Title" value="'.$Config['Web']['Title'].'"/></td></tr>'. 46 '<tr><td>Email správce:</td><td> <input type="text" name="AdminEmail" value="'.$Config['Web']['AdminEmail'].'"/></td></tr>'. 47 '<tr><td>Počet položek navigace stránkování:</td><td> <input type="text" name="VisiblePagingItems" value="'.$Config['Web']['VisiblePagingItems'].'"/></td></tr>'. 48 '<tr><td>Počet řádků tabulek na stránku:</td><td> <input type="text" name="ItemsPerPage" value="'.$Config['Web']['ItemsPerPage'].'"/></td></tr>'. 49 50 '<tr><td colspan="2"><input type="submit" name="configure_save" value="Nastavit"/></td></tr>'. 51 '</table>'. 52 '</form>'; 45 53 return($Output); 54 } 55 56 function ConfigSave($DefaultConfig) 57 { 58 $Config = $DefaultConfig; 59 if(array_key_exists('Host', $_POST)) $Config['Database']['Host'] = $_POST['Host']; 60 if(array_key_exists('User', $_POST)) $Config['Database']['User'] = $_POST['User']; 61 if(array_key_exists('Password', $_POST) and ($_POST['Password'] != '')) $Config['Database']['Password'] = $_POST['Password']; 62 if(array_key_exists('Schema', $_POST)) $Config['Database']['Database'] = $_POST['Schema']; 63 if(array_key_exists('Title', $_POST)) $Config['Web']['Title'] = $_POST['Title']; 64 if(array_key_exists('BaseURL', $_POST)) $Config['Web']['BaseURL'] = $_POST['BaseURL']; 65 if(array_key_exists('AdminEmail', $_POST)) $Config['Web']['AdminEmail'] = $_POST['AdminEmail']; 66 if(array_key_exists('VisiblePagingItems', $_POST)) $Config['Web']['VisiblePagingItems'] = $_POST['VisiblePagingItems']; 67 if(array_key_exists('ItemsPerPage', $_POST)) $Config['Web']['ItemsPerPage'] = $_POST['ItemsPerPage']; 68 $ConfigText = CreateConfig($Config); 69 file_put_contents('../includes/config.php', $ConfigText); 70 $Output .= 'Konfigurace nastavena'; 71 return($Output); 46 72 } 47 73 … … 54 80 \$Config = array( 55 81 'Database' => array( 56 'Host' => ' localhost',57 'User' => ' root',58 'Password' => ' ',59 'Database' => ' wowpreklad',82 'Host' => '".$Config['Database']['Host']."', 83 'User' => '".$Config['Database']['User']."', 84 'Password' => '".$Config['Database']['Password']."', 85 'Database' => '".$Config['Database']['Database']."', 60 86 'DatabaseAoWoW' => 'wowpreklad_mangos', 61 87 'Prefix' => '', … … 65 91 'Style' => 'maron', 66 92 'Web' => array( 67 'Title' => ' Projekt překládání textů hry WoW',93 'Title' => '".$Config['Web']['Title']."', 68 94 'Charset' => 'utf-8', 69 95 'Host' => 'localhost', 70 'BaseURL' => ' ',71 'AdminEmail' => ' admin@localhost',96 'BaseURL' => '".$Config['Web']['BaseURL']."', 97 'AdminEmail' => '".$Config['Web']['AdminEmail']."', 72 98 'Authors' => 'autor', 73 99 'ShowSQLQuery' => false, … … 76 102 'ShowRuntimeInfo' => \$IsDeveloper, 77 103 'FormatOutput' => \$IsDeveloper, 78 'ItemsPerPage' => 40,104 'ItemsPerPage' => ".$Config['Web']['ItemsPerPage'].", 79 105 'TempFolder' => '../tmp/', 80 106 'GameVersion' => '3.3.5a', 81 'VisiblePagingItems' => 20,107 'VisiblePagingItems' => ".$Config['Web']['VisiblePagingItems'].", 82 108 'WebCounter' => '', 83 109 'Timezone' => 'Europe/Prague', … … 105 131 $UpdateManager = new UpdateManager(); 106 132 $UpdateManager->Database = $System->Database; 107 $UpdateManager->Revision = $ Revision;133 $UpdateManager->Revision = $DatabaseRevision; 108 134 $UpdateManager->Trace = $Updates; 109 135 $UpdateManager->InstallMethod = 'FullInstall'; … … 127 153 $Output .= ControlPanel(); 128 154 } else 155 if(array_key_exists('configure_save', $_POST)) 156 { 157 $Output .= ConfigSave($Config); 158 $Output .= ControlPanel(); 159 } else 160 if(array_key_exists('configure', $_POST)) 161 { 162 $Output .= PrepareConfig($Config); 163 } else 129 164 { 130 165 $Output .= ControlPanel(); … … 132 167 } else 133 168 { 134 if(array_key_exists('configure ', $_POST))169 if(array_key_exists('configure_save', $_POST)) 135 170 { 136 $Config = array();137 $ConfigText = CreateConfig($Config);138 file_put_contents('../includes/config.php', $ConfigText);139 $Output .= 'Konfigurace nastavena';140 } else $Output .= PrepareConfig();171 $Output .= PrepareConfig($Config); 172 $Output .= ControlPanel(); 173 } else { 174 $Output .= PrepareConfig($DefaultConfig); 175 } 141 176 } 142 177 $Output .= '</body></html>';
Note:
See TracChangeset
for help on using the changeset viewer.