Changeset 589 for trunk/Modules/Setup/Update.php
- Timestamp:
- Nov 1, 2013, 4:22:59 PM (11 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Setup/Update.php
r583 r589 1 1 <?php 2 3 include_once('Database.php');4 2 5 3 class UpdateManager … … 30 28 function IsInstalled() 31 29 { 30 debug_backtrace(); 32 31 $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->VersionTable.'"'); 33 32 return($DbResult->num_rows > 0); … … 88 87 var $Revision; 89 88 var $Updates; 89 var $Database; 90 90 91 91 function __construct() … … 108 108 { 109 109 $YesNo = array(false => 'Ne', true => 'Ano'); 110 $Output = '<h3>Správa instance</h3>'. 111 'Je instalováno: '.$YesNo[$this->UpdateManager->IsInstalled()].'<br/>'; 112 if($this->UpdateManager->IsInstalled()) 113 $Output .= 'Je aktuální: '.$YesNo[$this->UpdateManager->IsUpToDate()].'<br/>'. 114 'Verze databáze: '.$this->UpdateManager->GetDbVersion().'<br/>'; 115 $Output .= 'Verze databáze kódu: '.$this->UpdateManager->Revision.'<br/>'. 116 '<form action="" method="post">'; 117 if($this->UpdateManager->IsInstalled()) 118 { 119 if(!$this->UpdateManager->IsUpToDate()) 120 $Output .= '<input type="submit" name="update" value="Aktualizovat"/> '; 121 $Output .= '<input type="submit" name="insert_sample_data" value="Vložit vzorová data"/> '; 122 $Output .= '<input type="submit" name="uninstall" value="Odinstalovat"/> '; 123 } else $Output .= '<input type="submit" name="install" value="Instalovat"/> '; 110 $Output = '<form action="" method="post">'; 111 112 $Output .= 'Je připojení k databázi: '.$YesNo[$this->UpdateManager->Database->Connected()].'<br/>'; 113 if($this->UpdateManager->Database->Connected()) 114 { 115 $Output .= 'Je instalováno: '.$YesNo[$this->UpdateManager->IsInstalled()].'<br/>'; 116 if($this->UpdateManager->IsInstalled()) 117 $Output .= 'Je aktuální: '.$YesNo[$this->UpdateManager->IsUpToDate()].'<br/>'. 118 'Verze databáze: '.$this->UpdateManager->GetDbVersion().'<br/>'; 119 $Output .= 'Verze databáze kódu: '.$this->UpdateManager->Revision.'<br/>'; 120 if($this->UpdateManager->IsInstalled()) 121 { 122 if(!$this->UpdateManager->IsUpToDate()) 123 $Output .= '<input type="submit" name="update" value="Aktualizovat"/> '; 124 $Output .= '<input type="submit" name="insert_sample_data" value="Vložit vzorová data"/> '; 125 $Output .= '<input type="submit" name="uninstall" value="Odinstalovat"/> '; 126 } else $Output .= '<input type="submit" name="install" value="Instalovat"/> '; 127 } 124 128 $Output .= '<input type="submit" name="configure" value="Nastavit"/> '; 125 129 $Output .= '<input type="submit" name="logout" value="Odhlásit"/> '; … … 146 150 } else 147 151 { 148 date_default_timezone_set('Europe/Prague');149 // SQL injection hack protection150 foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);151 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);152 153 if(isset($_SERVER['REMOTE_ADDR'])) session_start();154 155 $Database = new Database();156 $Database->Connect($this->Config['Database']['Host'], $this->Config['Database']['User'],157 $this->Config['Database']['Password'], $this->Config['Database']['Database']);158 $Database->Prefix = $this->Config['Database']['Prefix'];159 $Database->charset($this->Config['Database']['Charset']);160 $Database->ShowSQLError = $this->Config['Web']['ShowSQLError'];161 $Database->ShowSQLQuery = $this->Config['Web']['ShowSQLQuery'];162 163 152 $this->UpdateManager = new UpdateManager(); 164 $this->UpdateManager->Database = $ Database;153 $this->UpdateManager->Database = $this->Database; 165 154 $this->UpdateManager->Revision = $this->DatabaseRevision; 166 155 $this->UpdateManager->Trace = $this->Updates; … … 222 211 } 223 212 $Output .= '</body></html>'; 224 echo($Output);213 return($Output); 225 214 } 226 215
Note:
See TracChangeset
for help on using the changeset viewer.