Skip to content

Commit

Permalink
Add notification about apache2
Browse files Browse the repository at this point in the history
  • Loading branch information
budziam committed Sep 9, 2018
1 parent 1ffa0d0 commit 720bd4a
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 79 deletions.
16 changes: 16 additions & 0 deletions includes/Kernels/InstallKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ protected function full()
$server_modules .= eval($template->install_full_render('module'));
}

$notifyHttpServer = $this->generateHttpServerNotification();

// Pobranie ostatecznego szablonu
$output = eval($template->install_full_render('index'));

Expand All @@ -102,9 +104,23 @@ protected function update()
$update_info = $updateInfo->updateInfo($everything_ok, $files_priv, $files_del, $modules);
$class = $everything_ok ? "ok" : "bad";

$notifyHttpServer = $this->generateHttpServerNotification();

// Pobranie ostatecznego szablonu
$output = eval($template->install_update_render('index'));

return new Response($output);
}

protected function generateHttpServerNotification()
{
/** @var Template $template */
$template = $this->app->make(Template::class);

if (str_contains(strtolower($_SERVER["SERVER_SOFTWARE"]), 'apache')) {
return '';
}

return eval($template->install_render('http_server_notification'));
}
}
5 changes: 5 additions & 0 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,11 @@ function starts_with($haystack, $needle)
return substr($haystack, 0, strlen($needle)) === (string)$needle;
}

function str_contains($string, $needle)
{
return strpos($string, $needle) !== false;
}

/**
* Prints var_dump in pre
*
Expand Down
11 changes: 11 additions & 0 deletions install/styles/full.css
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,14 @@ h2 {
font-weight: bold;
font-size: 18px;
}

.notify {
margin: 0 8px 8px 8px;
padding: 12px;
width: 580px;
}

.notify.apache2 {
border: 2px solid #F9FF00;
background: rgba(255, 255, 0, 0.1);
}
5 changes: 5 additions & 0 deletions install/styles/update.css
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ h2 {
text-shadow: 1px 1px 1px #FFAA25;
}

.notify.apache2 {
border: 2px solid #F9FF00;
background: rgba(255, 255, 0, 0.1);
}

.notify.attention {
border: 2px solid #FF0000;
background: rgba(255, 0, 0, 0.1);
Expand Down
106 changes: 54 additions & 52 deletions install/templates/full/index.html
Original file line number Diff line number Diff line change
@@ -1,77 +1,79 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/plain" charset="UTF-8"/>
<title>Instalacja - Sklep SMS</title>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="jscripts/full.js?version={__VERSION__}"></script>
<script type="text/javascript" src="../jscripts/infobox.js?version={__VERSION__}"></script>
<script type="text/javascript" src="../jscripts/stocks.js?version={__VERSION__}"></script>
<script type="text/javascript" src="../js.php?script=language&version={__VERSION__}"></script>
<link href="styles/full.css?version={__VERSION__}" rel="stylesheet"/>
<link href="../styles/infobox.css?version={__VERSION__}" rel="stylesheet"/>
<meta http-equiv="Content-Type" content="text/plain" charset="UTF-8"/>
<title>Instalacja - Sklep SMS</title>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="jscripts/full.js?version={__VERSION__}"></script>
<script type="text/javascript" src="../jscripts/infobox.js?version={__VERSION__}"></script>
<script type="text/javascript" src="../jscripts/stocks.js?version={__VERSION__}"></script>
<script type="text/javascript" src="../js.php?script=language&version={__VERSION__}"></script>
<link href="styles/full.css?version={__VERSION__}" rel="stylesheet"/>
<link href="../styles/infobox.css?version={__VERSION__}" rel="stylesheet"/>
</head>
<body>
<div class="window">
<h1>Instalator Sklepu SMS</h1>
<h1>Instalator Sklepu SMS</h1>

<form id="form_install" class="content">
<div class="left" style="width: auto">
<h2>Dane do bazy danych</h2>
{$notifyHttpServer}

<div class="data">
<div class="label">Host</div>
<div class="field"><input type="text" name="db_host"/></div>
<form id="form_install" class="content">
<div class="left" style="width: auto">
<h2>Dane do bazy danych</h2>

<div class="label">Port</div>
<div class="field"><input type="number" name="db_port" value="3306"/></div>
<div class="data">
<div class="label">Host</div>
<div class="field"><input type="text" name="db_host"/></div>

<div class="label">Użytkownik</div>
<div class="field"><input type="text" name="db_user"/></div>
<div class="label">Port</div>
<div class="field"><input type="number" name="db_port" value="3306"/></div>

<div class="label">Hasło</div>
<div class="field"><input type="password" name="db_password"/></div>
<div class="label">Użytkownik</div>
<div class="field"><input type="text" name="db_user"/></div>

<div class="label">Nazwa bazy</div>
<div class="field"><input type="text" name="db_db"/></div>
</div>
<div class="label">Hasło</div>
<div class="field"><input type="password" name="db_password"/></div>

<h2>Dane Licencji</h2>
<div class="label">Nazwa bazy</div>
<div class="field"><input type="text" name="db_db"/></div>
</div>

<div class="data">
<div class="label">ID Licencji</div>
<div class="field"><input type="text" name="license_id"/></div>
<h2>Dane Licencji</h2>

<div class="label">Hasło</div>
<div class="field"><input type="password" name="license_password"/>
</div>
</div>
<div class="data">
<div class="label">ID Licencji</div>
<div class="field"><input type="text" name="license_id"/></div>

<div class="label">Hasło</div>
<div class="field"><input type="password" name="license_password"/>
</div>
</div>

<h2>Dane Administratora</h2>
<h2>Dane Administratora</h2>

<div class="data">
<div class="label">Login</div>
<div class="field"><input type="text" name="admin_username"/></div>
<div class="data">
<div class="label">Login</div>
<div class="field"><input type="text" name="admin_username"/></div>

<div class="label">Hasło</div>
<div class="field"><input type="password" name="admin_password"/>
<div class="label">Hasło</div>
<div class="field"><input type="password" name="admin_password"/>
</div>
</div>
</div>
</div>
</div>
<div class="right">
<h2>Uprawnienia do zapisu</h2>
<div class="right">
<h2>Uprawnienia do zapisu</h2>

<div class="data">{$files_privilages}</div>
<div class="data">{$files_privilages}</div>

<h2>Moduły na serwerze</h2>
<h2>Moduły na serwerze</h2>

<div class="data">{$server_modules}</div>
</div>
<br style="clear: both"/>
<div class="data">{$server_modules}</div>
</div>
<br style="clear: both"/>

<div style="text-align: center;">
<input type="submit" value="Instaluj"/>
</div>
</form>
<div style="text-align: center;">
<input type="submit" value="Instaluj"/>
</div>
</form>
</div>
</body>
</html>
6 changes: 6 additions & 0 deletions install/templates/http_server_notification.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="notify apache2">
Wykryto, iż nie korzystasz z <b>Apache2</b>!<br/>
Jedynym, oficjalnie wspieranym serwerem HTTP jest Apache2. Korzystanie z innego serwera może powodować, że sklep
będzie funkcjonował nieprawidłowo. W przypadku serwera niewspierającego plików <i>.htaccess</i> należy
samodzielnie zabezpieczyć odpowiednie katalogi.
</div>
56 changes: 29 additions & 27 deletions install/templates/update/index.html
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/plain" charset="UTF-8"/>
<title>Aktualizacja - Sklep SMS</title>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="jscripts/update.js?version={__VERSION__}"></script>
<script type="text/javascript" src="../jscripts/infobox.js?version={__VERSION__}"></script>
<script type="text/javascript" src="../jscripts/stocks.js?version={__VERSION__}"></script>
<script type="text/javascript" src="../js.php?script=language&version={__VERSION__}"></script>
<link href="styles/update.css?version={__VERSION__}" rel="stylesheet"/>
<link href="../styles/infobox.css?version={__VERSION__}" rel="stylesheet"/>
<meta http-equiv="Content-Type" content="text/plain" charset="UTF-8"/>
<title>Aktualizacja - Sklep SMS</title>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="jscripts/update.js?version={__VERSION__}"></script>
<script type="text/javascript" src="../jscripts/infobox.js?version={__VERSION__}"></script>
<script type="text/javascript" src="../jscripts/stocks.js?version={__VERSION__}"></script>
<script type="text/javascript" src="../js.php?script=language&version={__VERSION__}"></script>
<link href="styles/update.css?version={__VERSION__}" rel="stylesheet"/>
<link href="../styles/infobox.css?version={__VERSION__}" rel="stylesheet"/>
</head>
<body>
<div class="window {$class}">
<h1>Aktualizator Sklepu</h1>
<h1>Aktualizator Sklepu</h1>

<div class="notify backup">
<div style="font-weight: bold;">Pamiętaj, aby przed wykonaniem aktualizacji zadbać o backup <i>( kopię zapasową
)</i></div>
<ul>
<li>Bazy danych sklepu</li>
<li>Plików znajdujących się na FTP serwerów gier</li>
<li>Plików znajdujących się na FTP strony WWW</li>
</ul>
</div>
<form id="form_update" class="content">
<div class="update_info">
{$update_info}
</div>
<br style="clear: both"/>
{$notifyHttpServer}

<div style="text-align: center;">
<input type="submit" value="Aktualizuj"/>
<div class="notify backup">
<div style="font-weight: bold;">Pamiętaj, aby przed wykonaniem aktualizacji zadbać o backup <i>( kopię zapasową
)</i></div>
<ul>
<li>Bazy danych sklepu</li>
<li>Plików znajdujących się na FTP serwerów gier</li>
<li>Plików znajdujących się na FTP strony WWW</li>
</ul>
</div>
</form>
<form id="form_update" class="content">
<div class="update_info">
{$update_info}
</div>
<br style="clear: both"/>

<div style="text-align: center;">
<input type="submit" value="Aktualizuj"/>
</div>
</form>
</div>
<br/><br/>
</body>
Expand Down

0 comments on commit 720bd4a

Please sign in to comment.