Ignore:
Timestamp:
Feb 22, 2015, 11:20:50 PM (9 years ago)
Author:
chronos
Message:
  • Modified: Tabs converted to spaces.
  • Modified: Remove spaces from end of lines.
  • Added: Code format script.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/install.php

    r805 r816  
    2020{
    2121  global $UpdateManager;
    22        
     22
    2323  $YesNo = array(false => 'Ne', true => 'Ano');
    2424  $Output = '<h3>Správa instance</h3>'.
     
    4343function PrepareConfig($Config)
    4444{
    45         $Output = '';
     45  $Output = '';
    4646  if(!file_exists('../includes/config.php') and !is_writable('../includes'))
    47         $Output .= 'Varování: Konfigurační soubor nebude možné zapsat, protože složka includes není povolená pro zápis!';
     47    $Output .= 'Varování: Konfigurační soubor nebude možné zapsat, protože složka includes není povolená pro zápis!';
    4848  if(file_exists('../includes/config.php') and !is_writable('../includes/config.php'))
    49         $Output .= 'Varování: Konfigurační soubor nebude možné zapsat, protože soubor config.php není povolen pro zápis!';
     49    $Output .= 'Varování: Konfigurační soubor nebude možné zapsat, protože soubor config.php není povolen pro zápis!';
    5050  $Output .= '<h3>Nastavení systému</h3>'.
    5151    '<form action="" method="post">'.
    52     '<table>'. 
     52    '<table>'.
    5353    '<tr><td>Systémové heslo:</td><td> <input type="password" name="SystemPassword" value=""/></td></tr>'.
    5454    '<tr><td>Adresa serveru:</td><td> <input type="text" name="Host" value="'.$Config['Database']['Host'].'"/></td></tr>'.
     
    6262    '<tr><td>Počet položek navigace stránkování:</td><td> <input type="text" name="VisiblePagingItems" value="'.$Config['Web']['VisiblePagingItems'].'"/></td></tr>'.
    6363    '<tr><td>Počet řádků tabulek na stránku:</td><td> <input type="text" name="ItemsPerPage" value="'.$Config['Web']['ItemsPerPage'].'"/></td></tr>'.
    64    
     64
    6565    '<tr><td colspan="2"><input type="submit" name="configure_save" value="Nastavit"/></td></tr>'.
    66     '</table>'. 
     66    '</table>'.
    6767    '</form>';
    6868  return($Output);
     
    7272{
    7373  $Config = $DefaultConfig;
    74   if(array_key_exists('SystemPassword', $_POST) and ($_POST['SystemPassword'] != '')) 
    75         $Config['SystemPassword'] = sha1($_POST['SystemPassword']);
     74  if(array_key_exists('SystemPassword', $_POST) and ($_POST['SystemPassword'] != ''))
     75    $Config['SystemPassword'] = sha1($_POST['SystemPassword']);
    7676  if(array_key_exists('Host', $_POST)) $Config['Database']['Host'] = $_POST['Host'];
    7777  if(array_key_exists('User', $_POST)) $Config['Database']['User'] = $_POST['User'];
    78   if(array_key_exists('Password', $_POST) and ($_POST['Password'] != '')) 
    79         $Config['Database']['Password'] = $_POST['Password'];
     78  if(array_key_exists('Password', $_POST) and ($_POST['Password'] != ''))
     79    $Config['Database']['Password'] = $_POST['Password'];
    8080  if(array_key_exists('Schema', $_POST)) $Config['Database']['Database'] = $_POST['Schema'];
    8181  if(array_key_exists('Title', $_POST)) $Config['Web']['Title'] = $_POST['Title'];
     
    8888  file_put_contents('../includes/config.php', $ConfigText);
    8989  $Output .= 'Konfigurace nastavena<br/>';
    90   return($Output);     
     90  return($Output);
    9191}
    9292
     
    137137  'MaxExportPerUser' => 10,
    138138  'AoWoWExportId' => 1,
    139   'OriginalLanguage' => 1, 
     139  'OriginalLanguage' => 1,
    140140  'SystemPassword' => '".$Config['SystemPassword']."',
    141141);";
     
    145145function LoginPanel()
    146146{
    147         $Output = '<h3>Přihlášení k instalaci</h3>'.
    148                         '<form action="" method="post">'.
    149                         '<table>'.
    150                         '<tr><td>Systémové heslo:</td><td> <input type="password" name="SystemPassword" value=""/></td></tr>'.
    151                         '</table>'.
    152                         '<input type="submit" name="login" value="Přihlásit"/>'.
    153                         '</form>';     
    154         return($Output);
     147  $Output = '<h3>Přihlášení k instalaci</h3>'.
     148      '<form action="" method="post">'.
     149      '<table>'.
     150      '<tr><td>Systémové heslo:</td><td> <input type="password" name="SystemPassword" value=""/></td></tr>'.
     151      '</table>'.
     152      '<input type="submit" name="login" value="Přihlásit"/>'.
     153      '</form>';
     154  return($Output);
    155155}
    156156
     
    166166if(isset($Config))
    167167{
    168         if(!array_key_exists('SystemPassword', $_SESSION)) $_SESSION['SystemPassword'] = '';
    169         if(array_key_exists('login', $_POST)) $_SESSION['SystemPassword'] = $_POST['SystemPassword'];
    170         if(sha1($_SESSION['SystemPassword']) != $Config['SystemPassword'])
    171         {
    172                 $Output .= LoginPanel();
    173         } else
    174         {
     168  if(!array_key_exists('SystemPassword', $_SESSION)) $_SESSION['SystemPassword'] = '';
     169  if(array_key_exists('login', $_POST)) $_SESSION['SystemPassword'] = $_POST['SystemPassword'];
     170  if(sha1($_SESSION['SystemPassword']) != $Config['SystemPassword'])
     171  {
     172    $Output .= LoginPanel();
     173  } else
     174  {
    175175  $System = new System();
    176176  $System->Init();
     
    183183if(array_key_exists('logout', $_POST))
    184184{
    185         $_SESSION['SystemPassword'] = '';
    186         $Output .= 'Odhlášen';
     185  $_SESSION['SystemPassword'] = '';
     186  $Output .= 'Odhlášen';
    187187  $Output .= LoginPanel();
    188188} else
     
    208208{
    209209  $Output .= ConfigSave($Config);
    210   $Output .= ControlPanel();   
    211 } else 
     210  $Output .= ControlPanel();
     211} else
    212212if(array_key_exists('configure', $_POST))
    213213{
     
    215215} else
    216216{
    217   $Output .= ControlPanel();   
    218 }
    219         }
    220 } else 
     217  $Output .= ControlPanel();
     218}
     219  }
     220} else
    221221{
    222222  if(array_key_exists('configure_save', $_POST))
    223223  {
    224224    $Output .= ConfigSave($DefaultConfig);
    225     $Output .= 'Pokračujte k přihlášení <a href="">zde</a>';   
     225    $Output .= 'Pokračujte k přihlášení <a href="">zde</a>';
    226226  } else {
    227         $Output .= PrepareConfig($DefaultConfig);
     227    $Output .= PrepareConfig($DefaultConfig);
    228228  }
    229229}
Note: See TracChangeset for help on using the changeset viewer.