Changeset 590 for trunk/Modules/Setup/Update.php
- Timestamp:
- Nov 2, 2013, 12:10:42 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Setup/Update.php
r589 r590 45 45 { 46 46 $TraceItem = $this->Trace[$DbRevision]; 47 $Output .= 'Aktualizace na verzi: '.$TraceItem['Revision'].'<br/>'; 47 $Output .= 'Aktualizace na verzi: '.$TraceItem['Revision'].'<br/>'; 48 echo($Output); 48 49 $RevUpdate = $TraceItem['Function']; 49 50 $RevUpdate($this); … … 58 59 $InstallMethod = $this->InstallMethod; 59 60 $InstallMethod($this); 61 $this->Update(); 60 62 } 61 63 … … 88 90 var $Updates; 89 91 var $Database; 92 var $ConfigDir; 90 93 91 94 function __construct() 92 95 { 96 $this->ConfigDir = dirname(__FILE__).'/../..'; 93 97 } 94 98 … … 124 128 $Output .= '<input type="submit" name="insert_sample_data" value="Vložit vzorová data"/> '; 125 129 $Output .= '<input type="submit" name="uninstall" value="Odinstalovat"/> '; 130 //$Output .= $this->ShowList(); 126 131 } else $Output .= '<input type="submit" name="install" value="Instalovat"/> '; 127 132 } … … 214 219 } 215 220 221 function ShowList() 222 { 223 $Output = ''; 224 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Module`'); 225 $DbRow = $DbResult->fetch_row(); 226 $PageList = GetPageList($DbRow[0]); 227 228 $Output .= $PageList['Output']; 229 $Output .= '<table class="WideTable" style="font-size: small;">'; 230 231 $TableColumns = array( 232 array('Name' => 'Name', 'Title' => 'Jméno'), 233 array('Name' => 'Creator', 'Title' => 'Tvůrce'), 234 array('Name' => 'Version', 'Title' => 'Verze'), 235 array('Name' => 'License', 'Title' => 'Licence'), 236 array('Name' => 'Installed', 'Title' => 'Instalováno'), 237 array('Name' => 'Description', 'Title' => 'Popis'), 238 array('Name' => 'Dependencies', 'Title' => 'Závislosti'), 239 array('Name' => '', 'Title' => 'Akce'), 240 ); 241 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 242 $Output .= $Order['Output']; 243 $Query = 'SELECT *, (SELECT GROUP_CONCAT(`T1`.`Name` SEPARATOR ", ") FROM `SystemModuleDependency` '. 244 'LEFT JOIN `SystemModule` AS `T1` ON `T1`.`Id` = `SystemModuleDependency`.`DependencyModule` '. 245 'WHERE `SystemModuleDependency`.`Module` = `SystemModule`.`Id`) AS `Dependencies` '. 246 'FROM `SystemModule` '.$Order['SQL'].$PageList['SQLLimit']; 247 248 $DbResult = $this->Database->query($Query); 249 while($Module = $DbResult->fetch_assoc()) 250 { 251 if($Module['Dependencies'] != '') $Dependencies = $Module['Dependencies']; 252 else $Dependencies = ' '; 253 if($Module['Installed'] == 1) $Installed = 'Ano'; 254 else $Installed = 'Ne'; 255 if($Module['Installed'] == 1) $Actions = '<a href="?A=Uninstall&Id='.$Module['Id'].'">Odinstalovat</a>'; 256 else $Actions = '<a href="?A=Install&Id='.$Module['Id'].'">Instalovat</a>'; 257 $Output .= '<tr><td>'.$Module['Name'].'</td>'. 258 '<td>'.$Module['Creator'].'</td>'. 259 '<td>'.$Module['Version'].'</td>'. 260 '<td>'.$Module['License'].'</td>'. 261 '<td>'.$Installed.'</td>'. 262 '<td>'.$Module['Description'].'</td>'. 263 '<td>'.$Dependencies.'</td>'. 264 '<td>'.$Actions.'</td></tr>'; 265 } 266 $Output .= '</table>'; 267 $Output .= $PageList['Output']; 268 $Output .= '<p><a href="?A=SaveToDb">Uložit do databáze</a></p>'; 269 return($Output); 270 } 271 216 272 function PrepareConfig($Config) 217 273 { 218 274 $Output = ''; 219 if(!file_exists( '../config.php') and !is_writable('..'))275 if(!file_exists($this->ConfigDir.'/config.php') and !is_writable($this->ConfigDir)) 220 276 $Output .= 'Varování: Konfigurační soubor nebude možné zapsat, protože složka není povolená pro zápis!'; 221 if(file_exists( '../config.php') and !is_writable('../config.php'))277 if(file_exists($this->ConfigDir.'/config.php') and !is_writable($this->ConfigDir.'/config.php')) 222 278 $Output .= 'Varování: Konfigurační soubor nebude možné zapsat, protože soubor config.php není povolen pro zápis!'; 223 279 $Output .= '<h3>Nastavení systému</h3>'. … … 238 294 if($Def['Type'] == 'String') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>'; 239 295 if($Def['Type'] == 'Password') $Output .= '<input type="password" name="'.$Def['Name'].'"/>'; 296 if($Def['Type'] == 'PasswordEncoded') $Output .= '<input type="password" name="'.$Def['Name'].'"/>'; 240 297 if($Def['Type'] == 'Integer') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>'; 241 298 if($Def['Type'] == 'Float') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>'; … … 259 316 if($Def['Type'] == 'Password') if(array_key_exists($Def['Name'], $_POST) and ($_POST[$Def['Name']] != '')) 260 317 $Value = $_POST[$Def['Name']]; 318 if($Def['Type'] == 'PasswordEncoded') if(array_key_exists($Def['Name'], $_POST) and ($_POST[$Def['Name']] != '')) 319 $Value = sha1($_POST[$Def['Name']]); 261 320 if($Def['Type'] == 'Integer') if(array_key_exists($Def['Name'], $_POST)) 262 321 $Value = $_POST[$Def['Name']]; … … 278 337 } 279 338 $ConfigText = $this->CreateConfig($Config); 280 file_put_contents( '../config.php', $ConfigText);339 file_put_contents($this->ConfigDir.'/config.php', $ConfigText); 281 340 $Output .= 'Konfigurace nastavena<br/>'; 282 341 return($Output);
Note:
See TracChangeset
for help on using the changeset viewer.