- Timestamp:
- Feb 16, 2013, 7:58:18 PM (12 years ago)
- Location:
- trunk/admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/DefaultConfig.php
r512 r513 37 37 'MaxExportPerUser' => 10, 38 38 'AoWoWExportId' => 1, 39 'SystemPassword' => '', 39 40 ); 40 41 -
trunk/admin/install.php
r512 r513 21 21 'Verze databáze: '.$UpdateManager->GetDbVersion().'<br/>'; 22 22 $Output .= 'Verze kódu: '.$UpdateManager->Revision.'<br/>'. 23 '<form action=" ?" method="post">';23 '<form action="" method="post">'; 24 24 if($UpdateManager->IsInstalled()) 25 25 { 26 26 if(!$UpdateManager->IsUpToDate()) 27 $Output .= '<input type="submit" name="update" value="Aktualizovat"/>'; 28 $Output .= '<input type="submit" name="uninstall" value="Odinstalovat"/>'; 29 } else $Output .= '<input type="submit" name="install" value="Instalovat"/>'; 30 $Output .= '<input type="submit" name="configure" value="Nastavit"/>'; 27 $Output .= '<input type="submit" name="update" value="Aktualizovat"/> '; 28 $Output .= '<input type="submit" name="uninstall" value="Odinstalovat"/> '; 29 } else $Output .= '<input type="submit" name="install" value="Instalovat"/> '; 30 $Output .= '<input type="submit" name="configure" value="Nastavit"/> '; 31 $Output .= '<input type="submit" name="logout" value="Odhlásit"/> '; 31 32 $Output .= '</form>'; 32 33 return($Output); … … 35 36 function PrepareConfig($Config) 36 37 { 37 $Output = '<h3>Nastavení systému</h3>'. 38 $Output = ''; 39 if(!file_exists('../includes/config.php') and !is_writable('../includes')) 40 $Output .= 'Varování: Konfigurační soubor nebude možné zapsat, protože složka includes není povolená pro zápis!'; 41 if(file_exists('../includes/config.php') and !is_writable('../includes/config.php')) 42 $Output .= 'Varování: Konfigurační soubor nebude možné zapsat, protože soubor config.php není povolen pro zápis!'; 43 $Output .= '<h3>Nastavení systému</h3>'. 38 44 '<form action="" method="post">'. 39 45 '<table>'. 46 '<tr><td>Systémové heslo:</td><td> <input type="password" name="SystemPassword" value=""/></td></tr>'. 40 47 '<tr><td>Adresa serveru:</td><td> <input type="text" name="Host" value="'.$Config['Database']['Host'].'"/></td></tr>'. 41 48 '<tr><td>Přihlašovací jméno:</td><td> <input type="text" name="User" value="'.$Config['Database']['User'].'"/></td></tr>'. … … 57 64 { 58 65 $Config = $DefaultConfig; 66 if(array_key_exists('SystemPassword', $_POST) and ($_POST['SystemPassword'] != '')) 67 $Config['SystemPassword'] = sha1($_POST['SystemPassword']); 59 68 if(array_key_exists('Host', $_POST)) $Config['Database']['Host'] = $_POST['Host']; 60 69 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']; 70 if(array_key_exists('Password', $_POST) and ($_POST['Password'] != '')) 71 $Config['Database']['Password'] = $_POST['Password']; 62 72 if(array_key_exists('Schema', $_POST)) $Config['Database']['Database'] = $_POST['Schema']; 63 73 if(array_key_exists('Title', $_POST)) $Config['Web']['Title'] = $_POST['Title']; … … 68 78 $ConfigText = CreateConfig($Config); 69 79 file_put_contents('../includes/config.php', $ConfigText); 70 $Output .= 'Konfigurace nastavena ';80 $Output .= 'Konfigurace nastavena<br/>'; 71 81 return($Output); 72 82 } … … 112 122 'MaxExportPerUser' => 10, 113 123 'AoWoWExportId' => 1, 124 'SystemPassword' => '".$Config['SystemPassword']."', 114 125 ); 115 126 … … 117 128 return($Output); 118 129 } 130 131 function LoginPanel() 132 { 133 $Output = '<h3>Přihlášení k instalaci</h3>'. 134 '<form action="" method="post">'. 135 '<table>'. 136 '<tr><td>Systémové heslo:</td><td> <input type="password" name="SystemPassword" value=""/></td></tr>'. 137 '</table>'. 138 '<input type="submit" name="login" value="Přihlásit"/>'. 139 '</form>'; 140 return($Output); 141 } 142 143 session_start(); 119 144 120 145 $Output = '<?xml version="1.0" encoding="utf-8"?> … … 127 152 if(isset($Config)) 128 153 { 154 if(!array_key_exists('SystemPassword', $_SESSION)) $_SESSION['SystemPassword'] = ''; 155 if(array_key_exists('login', $_POST)) $_SESSION['SystemPassword'] = $_POST['SystemPassword']; 156 if(sha1($_SESSION['SystemPassword']) != $Config['SystemPassword']) 157 { 158 $Output .= LoginPanel(); 159 } else 160 { 129 161 $System = new System(); 130 162 $System->Init(); … … 135 167 $UpdateManager->InstallMethod = 'FullInstall'; 136 168 169 if(array_key_exists('logout', $_POST)) 170 { 171 $_SESSION['SystemPassword'] = ''; 172 $Output .= 'Odhlášen'; 173 $Output .= LoginPanel(); 174 } else 137 175 if(array_key_exists('update', $_POST)) 138 176 { … … 165 203 $Output .= ControlPanel(); 166 204 } 205 } 167 206 } else 168 207 { 169 208 if(array_key_exists('configure_save', $_POST)) 170 209 { 171 $Output .= PrepareConfig($Config);172 $Output .= ControlPanel();210 $Output .= ConfigSave($DefaultConfig); 211 $Output .= 'Pokračujte k přihlášení <a href="">zde</a>'; 173 212 } else { 174 213 $Output .= PrepareConfig($DefaultConfig);
Note:
See TracChangeset
for help on using the changeset viewer.