Installation translated

This commit is contained in:
Matteo Gheza 2020-09-04 22:50:08 +02:00
parent 72170689d9
commit aeb9556de6
5 changed files with 311 additions and 154 deletions

View File

@ -510,9 +510,9 @@ class translations{
public function client_languages() {
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
$client_languages = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
$client_languages = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
} else {
$client_languages = "en-US;q=0.5,en;q=0.3";
$client_languages = "en-US;q=0.5,en;q=0.3";
}
if(strpos($client_languages, ';') == false){
if(strpos($client_languages, '-') !== false){

View File

@ -3,14 +3,15 @@ if (file_exists("installHelper.php")) {
try {
require('installHelper.php');
} catch (Exception $e) {
die("Please re-download Allerta. Installation corrupted (".$e);
die("Please re-download Allerta. Installation corrupted (".$e.")");
}
} else {
die("Please re-download Allerta. Installation corrupted");
}
if (!file_exists("runInstall.php")) {
die("Already installed");
t("Already installed");
exit();
}
$populated = false;
@ -40,16 +41,16 @@ if (file_exists("../config.php")) {
}
} catch (Exception $e) {
$dbnameValue = "allerta";
$unameValue = "user";
$pwdValue = "password";
$unameValue = t("user", false);
$pwdValue = t("password", false);
$dbhostValue = "localhost";
$prefixValue = "allerta01";
$configOk = false;
}
} else {
$dbnameValue = "allerta";
$unameValue = "user";
$pwdValue = "password";
$unameValue = t("user", false);
$pwdValue = t("password", false);
$dbhostValue = "localhost";
$prefixValue = "allerta01";
$configOk = false;
@ -61,87 +62,87 @@ if(!is_cli()){
<meta name="viewport" content="width=device-width">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex,nofollow">
<title>Allerta installazione</title>
<title>Allerta <?php t("installation"); ?></title>
<link rel="stylesheet" id="dashicons-css" href="dashicons.min.css?installation" type="text/css" media="all">
<link rel="stylesheet" id="buttons-css" href="buttons.min.css?installation" type="text/css" media="all">
<link rel="stylesheet" id="forms-css" href="forms.min.css?installation" type="text/css" media="all">
<link rel="stylesheet" id="install-css" href="install.min.css?installation" type="text/css" media="all">
<?php if(isset($_POST["step"])){ if($_POST["step"] == "4"){ ?><script async src="zxcvbn.js"></script><?php } } ?>
<script async src="zxcvbn.js"></script>
</head>
<body class="wp-core-ui">
<p id="logo"><a href="javascript:alert('TODO: add docs');">Allerta</a></p>
<?php if(!isset($_POST["step"]) && !$configOk){ ?>
<h1 class="screen-reader-text">Prima di iniziare</h1>
<p>Benvenuto in Allerta. Prima di iniziare abbiamo bisogno di alcune informazioni sul database. Devi conoscere i seguenti dati prima di procedere.</p>
<h1 class="screen-reader-text"><?php t("Before starting"); ?></h1>
<p><?php t("Welcome in Allerta. We need some informations about the database. You have to know the following informations:"); ?></p>
<ol>
<li>name del database</li>
<li>name user del database</li>
<li>Password del database</li>
<li>Host del database</li>
<li>Prefisso tabelle (se desideri execre più Allerta con un solo database)</li>
<li><?php t("DB name"); ?></li>
<li><?php t("DB username"); ?></li>
<li><?php t("DB password"); ?></li>
<li><?php t("DB host"); ?></li>
<li><?php t("DB prefix"); ?></li>
</ol>
<p>
Utilizzeremo queste informazioni per creare un file <code>config.php</code>. <strong>
Se per qualsiasi motivo la creazione automatica dei file non funziona, non ti preoccupare. Tutto questo non fa altro che inserire le informazioni nel database e in un file di configurazione. Puoi aprire <code>config-sample.php</code> in un editor di testo, inserire i tuoi dati, e salvarlo come <code>config.php</code>. </strong>
<p>Con ogni probabilità, queste informazioni ti sono state già fornite dal tuo fornitore di hosting. Se non disponi di queste informazioni, dovrai contattare il tuo fornitore prima di poter proseguire. Se invece è tutto pronto…</p>
<?php t("We will use this informations for creating a file"); ?> <code>config.php</code>. <strong>
<?php printf(t("If for any reason automatic file creation doesn't work, don't worry. You can just open %s in a text editor, enter your details, and save it as", false), "<code>config-sample.php</code>"); ?> <code>config.php</code>. </strong>
<p><?php t("In all likelihood, this information has already been provided to you by your hosting provider. If you don't have this information, you'll need to contact your provider before you can continue. But if everything is ready ..."); ?></p>
<p class="step">
<form method="POST">
<input type="hidden" name="step" value="2">
<input type="submit" value="Invia" class="button button-large">
<input type="submit" value="<?php t("Submit"); ?>" class="button button-large">
</form>
</p>
<?php
} else if (in_array("2",$_POST)) {
?>
<h1 class="screen-reader-text">Configura la connection al database</h1>
<h1 class="screen-reader-text"><?php t("Configure the database connection"); ?></h1>
<form method="post">
<p>Di seguito puoi inserire i dettagli di connection al database. Se non sei sicuro dei dati da inserire contatta il tuo fornitore di hosting.</p>
<p><?php t("Below you can enter your database connection details. If you are not sure of the data to enter, contact your hosting provider"); ?>.</p>
<table class="form-table" role="presentation">
<tbody>
<tr>
<th scope="row"><label for="dbname">name database</label></th>
<th scope="row"><label for="dbname"><?php t("DB name"); ?></label></th>
<td><input name="dbname" id="dbname" type="text" aria-describedby="dbname-desc" size="25" value="<?php echo $dbnameValue; ?>" autofocus=""></td>
<td id="dbname-desc">Il name del database che vuoi utilizzare con Allerta.</td>
<td id="dbname-desc"><?php t("The name of the database you want to use with Allerta"); ?>.</td>
</tr>
<tr>
<th scope="row"><label for="uname">name user</label></th>
<th scope="row"><label for="uname"><?php t("DB username"); ?></label></th>
<td><input name="uname" id="uname" type="text" aria-describedby="uname-desc" size="25" value="<?php echo $unameValue; ?>"></td>
<td id="uname-desc">Il tuo name user del database.</td>
<td id="uname-desc"><?php t("Your"); echo(" "); t("DB username"); ?>.</td>
</tr>
<tr>
<th scope="row"><label for="pwd">Password</label></th>
<th scope="row"><label for="pwd"><?php t("DB password"); ?></label></th>
<td><input name="pwd" id="pwd" type="text" aria-describedby="pwd-desc" size="25" value="<?php echo $pwdValue; ?>" autocomplete="off"></td>
<td id="pwd-desc">La tua password del database.</td>
<td id="pwd-desc"><?php t("Your"); echo(" "); t("DB password"); ?>.</td>
</tr>
<tr>
<th scope="row"><label for="dbhost">Host del database</label></th>
<th scope="row"><label for="dbhost"><?php t("DB host"); ?></label></th>
<td><input name="dbhost" id="dbhost" type="text" aria-describedby="dbhost-desc" size="25" value="<?php echo $dbhostValue; ?>"></td>
<td id="dbhost-desc">
Se <code>localhost</code> non funziona, puoi ottenere queste informazioni dal tuo provider di hosting.
<?php printf(t("If %s doesn't work, you can get this information from your hosting provider", false), "<code>localhost</code>"); ?>.
</td>
</tr>
<tr>
<th scope="row"><label for="prefix">Prefisso table</label></th>
<th scope="row"><label for="prefix"><?php t("DB prefix"); ?></label></th>
<td><input name="prefix" id="prefix" type="text" aria-describedby="prefix-desc" value="<?php echo $prefixValue; ?>" size="25"></td>
<td id="prefix-desc">Edit questa voce se desideri execre più installazioni di Allerta su un singolo database.</td>
<td id="prefix-desc"><?php t("Edit this item if you want to perform multiple Alert installations on a single database"); ?>.</td>
</tr>
</tbody>
</table>
<input type="hidden" name="step" value="3">
<p class="step"><input name="submit" type="submit" value="Invia" class="button button-large"></p>
<p class="step"><input name="submit" type="submit" value="<?php t("Submit"); ?>" class="button button-large"></p>
</form>
<?php
} else if (in_array("3",$_POST)) {
checkConnection($_POST["dbhost"],$_POST["uname"],$_POST["pwd"],$_POST["dbname"]);
generateConfig($_POST["dbhost"],$_POST["uname"],$_POST["pwd"],$_POST["dbname"],$_POST["prefix"]);
?>
<h1 class="screen-reader-text">File di configurazione creato con successo!</h1>
<p>Ottimo lavoro, amico! Hai completato questa parte dell'installazione. Ora Allerta può comunicare con il database. Se sei pronto, ora è il momento di…</p>
<h1 class="screen-reader-text"><?php t("Configuration file created successfully!"); ?></h1>
<p><?php t("Great job, man!"); echo(" "); t("You have completed this part of the installation. Allerta can now communicate with the database"); echo(".<br> "); t("If you are ready, it's time to..."); ?></p>
<p class="step">
<form method="POST">
<input type="hidden" name="step" value="4">
<input type="submit" class="button button-large" value="Popolare il database">
<input type="submit" class="button button-large" value="<?php t("Populate DB"); ?>">
</form>
</p>
<?php
@ -150,9 +151,9 @@ if(!is_cli()){
header("Location: install.php");
} else if ($populated && !$userPopulated && !in_array("5",$_POST)) {
?>
<h1 class="screen-reader-text">Evviva!</h1>
<p>Hai <b>quasi terminato</b> l'installazione di Allerta, devi solo inserire alcune informazioni.</p>
<h2>Informazioni necessarie</h2>
<h1 class="screen-reader-text"><?php t("Urray!"); ?></h1>
<p><?php t("You are almost finished installing Allerta, you just need to enter some information"); ?>.</p>
<h2><?php t("Necessary informations:"); ?></h2>
<p class="step">
<form id="setup" method="post">
<script>
@ -163,27 +164,27 @@ if(!is_cli()){
case 1:
document.getElementById("pass1").className = "short";
document.getElementById("pass-strength-result").className = "short";
document.getElementById("pass-strength-result").innerHTML = "Molto debole";
document.getElementById("pass-strength-result").innerHTML = "<?php t("Very weak"); ?>";
break;
case 2:
document.getElementById("pass1").className = "bad";
document.getElementById("pass-strength-result").className = "bad";
document.getElementById("pass-strength-result").innerHTML = "Debole";
document.getElementById("pass-strength-result").innerHTML = "<?php t("Weak"); ?>";
break;
case 3:
document.getElementById("pass1").className = "good";
document.getElementById("pass-strength-result").className = "good";
document.getElementById("pass-strength-result").innerHTML = "Media";
document.getElementById("pass-strength-result").innerHTML = "<?php t("Good"); ?>";
break;
case 4:
document.getElementById("pass1").className = "strong";
document.getElementById("pass-strength-result").className = "strong";
document.getElementById("pass-strength-result").innerHTML = "Forte";
document.getElementById("pass-strength-result").innerHTML = "<?php t("Strong"); ?>";
break;
case 5:
document.getElementById("pass1").className = "strong";
document.getElementById("pass-strength-result").className = "strong";
document.getElementById("pass-strength-result").innerHTML = "Forte";
document.getElementById("pass-strength-result").innerHTML = "<?php t("Very strong"); ?>";
break;
default:
// code block
@ -193,60 +194,60 @@ if(!is_cli()){
<table class="form-table" role="presentation">
<tbody>
<tr>
<th scope="row"><label for="user_login">name user admin</label></th>
<th scope="row"><label for="user_login"><?php t("Admin username"); ?></label></th>
<td>
<input name="user_name" type="text" id="user_login" size="75" value="">
<p>I nomi user possono essere composti soltanto da caratteri alfanumerici, spazi, trattini bassi, trattini, punti e il simbolo @.</p>
<p><?php t("Usernames can only contains alphanumeric characters, spaces, underscores, dashes, periods, and the @ symbol"); ?>.</p>
</td>
</tr>
<tr class="form-field form-required user-pass1-wrap">
<th scope="row">
<label for="pass1">
Password</label>
<?php t("Password"); ?></label>
</th>
<td>
<div class="wp-pwd">
<input type="text" name="admin_password" id="pass1" class="regular-text short" autocomplete="off" aria-describedby="pass-strength-result" onkeyup="validatePwd()">
<div id="pass-strength-result" aria-live="polite" class="short">Molto debole</div>
<div id="pass-strength-result" aria-live="polite" class="short"><?php t("Very weak"); ?></div>
</div>
<p><span class="description important">
<strong>Importante:</strong>
Avrai bisogno di questa password per accedere. Conservala in un posto sicuro.</span></p>
<strong><?php t("Important:"); ?></strong>
<?php t("You will need this password to log in. Keep it in a safe place"); ?>.</span></p>
</td>
</tr>
<tr>
<th scope="row">Rendi user admin visibile</th>
<th scope="row"><?php t("Is admin visible?"); ?></th>
<td>
<fieldset>
<legend class="screen-reader-text"><span>Rendi user admin visibile </span></legend>
<legend class="screen-reader-text"><span><?php t("Make admin user visible"); ?></span></legend>
<label for="admin_visible"><input name="admin_visible" type="checkbox" id="admin_visible" value="0">
Rendi l'user admin visibile agli altri user</label>
<p class="description">Attivando questa opzione, l'user che verrà creato sarà visibile negli elenchi e nelle procedure.</p>
<?php t("Make admin user visible"); echo(" "); t("to other users"); ?></label>
<p class="description"><?php t("By activating this option, the user that will be created will be visible in lists and procedures"); ?>.</p>
</fieldset>
</td>
</tr>
<tr>
<th scope="row">Aggiungi i permessi di sviluppatore</th>
<th scope="row"><?php t("Add developer permissions to admin user"); ?></th>
<td>
<fieldset>
<label for="developer"><input name="developer" type="checkbox" id="developer" value="0">
Aggiungi all'utente admin i permessi di sviluppatore</label>
<p class="description">Attivando questa opzione, l'utente potrà eseguire il debug e accedere a varie console amministrative.</p>
<?php t("Add developer permissions to admin user"); ?></label>
<p class="description"><?php t("By activating this option, the user will be able to debug Allerta"); ?>.</p>
</fieldset>
</td>
</tr>
<tr>
<th scope="row"><label for="admin_email">La tua email</label></th>
<th scope="row"><label for="admin_email"><?php t("Your email"); ?></label></th>
<td><input name="admin_email" type="email" id="admin_email" size="50" value="">
<p>Controlla attentamente il tuo indirizzo email prima di continuare.</p></td>
<p><?php t("Please check your email address carefully before continuing"); ?>.</p></td>
</tr>
<tr>
<th scope="row"><label for="owner">owner</label></th>
<th scope="row"><label for="owner"><?php t("Owner"); ?></label></th>
<td><input name="owner" type="text" id="owner" size="100" value="">
<p>Verrà utilizzato nei report.</p></td>
<p><?php t("It will be used in reports"); ?>.</p></td>
</tr>
</tbody></table>
<p class="step"><input type="submit" name="Submit" id="submit" class="button button-large" value="Installa Allerta"></p>
<p class="step"><input type="submit" name="Submit" id="submit" class="button button-large" value="<?php t("Install Allerta"); ?>"></p>
<input type="hidden" name="step" value="5">
</form>
</p>
@ -256,10 +257,10 @@ if(!is_cli()){
header("Location: install.php");
} else if ($userPopulated) {
?>
<h1 class="screen-reader-text">Installazione terminata con successo.</h1>
<p>Ottimo lavoro, amico! Hai completato l'installazione. Ora Allerta può funzionare correttamente. Adesso è il momento di…</p>
<h1 class="screen-reader-text"><?php t("Installation completed successfully"); ?>.</h1>
<p><?php t("Great job, man!"); echo(" "); t("You have completed the installation. Allerta can now function properly"); echo(".<br> "); t("If you are ready, it's time to..."); ?></p>
<p class="step">
<a href="../index.php">execre il login</a>
<a href="../index.php"><?php t("Login"); ?></a>
</p>
<?php
unlink("runInstall.php");

View File

@ -2,6 +2,65 @@
use GetOpt\GetOpt as Getopt;
use GetOpt\Option;
function client_languages() {
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
$client_languages = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
} else {
$client_languages = "en-US;q=0.5,en;q=0.3";
}
if(strpos($client_languages, ';') == false){
if(strpos($client_languages, '-') !== false){
return [substr($client_languages, 0, 5)];
} else {
return [substr($client_languages, 0, 2)];
}
} else {
$client_languages = explode(",", $client_languages);
$tmp_languages = [];
foreach($client_languages as $key=>$language){
if(strpos($language, ';') == false){
$tmp_languages[$language] = 1;
} else {
$tmp_languages[explode(";q=",$language)[0]] = (float) explode(";q=",$language)[1];
}
}
arsort($tmp_languages);
return array_keys($tmp_languages);
}
}
$client_languages = client_languages();
$loaded_languages = ["en", "it"];
$default_language = "en";
$language = null;
foreach($client_languages as $tmp_language){
if(in_array($tmp_language, $loaded_languages) && $language == null){
$language = $tmp_language;
}
}
if (file_exists("translations/".$language.".php")){
$loaded_translations = require("translations/".$language.".php");
} else {
$loaded_translations = require("translations/en.php");
}
function t($string, $echo=true){
global $loaded_translations;
try {
if (!array_key_exists($string, $loaded_translations))
throw new Exception ('string does not exist');
$string = $loaded_translations[$string];
} catch (\Exception $e) {
print("no");
}
if ($echo){
echo "<u>".$string."</u>";
} else {
return "<u>".$string."</u>";
}
}
function is_cli() //https://www.binarytides.com/php-check-running-cli/
{
if( defined('STDIN') )
@ -52,19 +111,19 @@ function checkConnection($host, $user, $password, $database, $return=false){
}
$connectionOk = false;
?>
<div class="wp-die-message"><h1>Errore nello stabilire una connection al database</h1>
<p>Questo potrebbe voler dire che name user e password nel file <code>config.php</code> sono sbagliate o che non possiamo contattare il database <code><?php echo $database; ?></code>. Potrebbe voler dire che il tuo database è irraddbile.</p>
<div class="wp-die-message"><h1><?php t("Error establishing a database connection"); ?></h1>
<p><?php printf(t("This could mean that %s and %s in file %s are wrong or that we cannot contact database %s. It could mean that your database is unreachable", false), t("DB username",false), t("DB password",false), "<code>config.php</code>", "<code>$database</code>"); ?>.</p>
<ul>
<li>Sei sicuro di avere name user e password corretti?</li>
<li>Sei sicuro di aver scritto l'hostname corretto?</li>
<li>Sei sicuro che il server del database sia attivo?</li>
<li><?php printf(t("Are you sure that %s and %s correct?", false), t("DB username",false), t("DB password",false)); ?></li>
<li><?php t("Are you sure you have entered the correct hostname?"); ?></li>
<li><?php t("Are you sure the database server is up and running?"); ?></li>
</ul>
<p>Se non sei sicuro di cosa vogliano dire questi termini prova a contattare il tuo fornitore di hosting. Prova a fornire le seguenti informazioni:</p>
<p><?php t("If you're not sure what these terms mean, try contacting your hosting provider. Try providing the following information:"); ?></p>
<details>
<summary>Informazioni avanzate</summary>
<summary><?php t("Advanced informations"); ?></summary>
<pre><?php echo($e); ?></pre>
</details>
<p class="step"><a href="#" onclick="javascript:history.go(-2);return false;" class="button button-large">Riprova</a></p>
<p class="step"><a href="#" onclick="javascript:history.go(-2);return false;" class="button button-large"><?php t("Try again"); ?></a></p>
</div>
<?php
exit();
@ -87,19 +146,19 @@ function checkConnection($host, $user, $password, $database, $return=false){
exit(7);
}
?>
<div class="wp-die-message"><h1>Impossibile selezionare il database</h1>
<p>Siamo riusciti a connetterci al server del database (il che significa che il tuo name user e password sono ok), ma non siamo riusciti a selezionare il database <code><?php echo $database; ?></code>.</p>
<div class="wp-die-message"><h1><?php t("Cannot select database"); ?></h1>
<p><?php t("We were able to connect to the database server (which means your username and password are ok)"); echo(", "); t("but we could not select the database"); ?> <code><?php echo $database; ?></code>.</p>
<ul>
<li>Sei sicuro che esista?</li>
<li>L'user <code><?php echo $user; ?></code> ha i permessi per usare il database <code><?php echo $database; ?></code>?</li>
<li>In alcuni sistemi il name del tuo database ha il tuo name user come prefisso, ovvero <code><?php echo $user; ?>_<?php echo $database; ?></code>. Potrebbe essere questo il problema?</li>
<li><?php t("Are you sure that it exists?"); ?></li>
<li><?php printf(t("Does user %s have permissions to use database %s?", false), "<code>$user</code>", "<code>$database</code>"); ?></li>
<li><?php printf(t("In some systems your database name has your username as a prefix, which is %s. Could this be the problem?", false), "<code>".$user."_".$database."</code>"); ?> </li>
</ul>
<p>Se non sei sicuro di cosa vogliano dire questi termini prova a contattare il tuo fornitore di hosting. Prova a fornire le seguenti informazioni:</p>
<p><?php t("If you're not sure what these terms mean, try contacting your hosting provider. Try providing the following information:"); ?></p>
<details>
<summary>Informazioni avanzate</summary>
<summary><?php t("Advanced informations"); ?></summary>
<pre><?php echo($e); ?></pre>
</details>
<p class="step"><a href="#" onclick="javascript:history.go(-2);return false;" class="button button-large">Riprova</a></p>
<p class="step"><a href="#" onclick="javascript:history.go(-2);return false;" class="button button-large"><?php t("Try again"); ?></a></p>
</div>
<?php
exit();
@ -130,12 +189,12 @@ function generateConfig($host,$user,$password,$db,$prefix,$path=".."){
exit(6);
}
?>
<div class="wp-die-message"><h1>Impossibile editre il file di configurazioni</h1>
<p>Non siamo riusciti a scrivere il file di configurazione <code>config.php</code>, richiesto per il funzionamento del programma.<br>E' tuttavia possibile editrlo manualmente, seguentdo le seguenti istruzioni:</p>
<div class="wp-die-message"><h1></h1>
<p><?php printf(t("We were unable to write the configuration file %s, which is required for the program to work", false), "<code>config.php</code>"); echo ".<br>"; t("It is however possible to edit it manually by following the instructions below:"); ?></p>
<ul>
<li>Accedere alla cartella di installazione di allerta (connettersi via FTP in caso di server sul cloud).</li>
<li>Rinominare il file <code>config-sample.php</code> in <code>config.php</code>.</li>
<li>Edit le prime 16 righe del file con il seguente testo:</li>
<li><?php t("Access the Allerta installation folder (connect via FTP in case of cloud server)"); ?>.</li>
<li><?php printf(t("Rename the file %s to %s", false), "<code>config-sample.php</code>", "<code>config.php</code>"); ?>.</li>
<li><?php t("Replace the first 16 lines of the file with the following text:"); ?></li>
<code>
&lt;?php<br>
// ** Database settings ** //<br>
@ -155,12 +214,12 @@ define( 'DB_HOST', '<?php echo $host; ?>' );<br>
define( 'DB_PREFIX', '<?php echo $prefix; ?>' );<br>
</code>
</ul>
<p>Se non sei sicuro di cosa vogliano dire questi termini prova a contattare il tuo fornitore di hosting. Prova a fornire le seguenti informazioni:</p>
<p><?php t("If you're not sure what these terms mean, try contacting your hosting provider. Try providing the following information:"); ?></p>
<details>
<summary>Informazioni avanzate</summary>
<summary><?php t("Advanced informations"); ?></summary>
<pre><?php echo($e); ?></pre>
</details>
<p class="step"><a href="#" onclick="javascript:history.go(-1);return false;" class="button button-large">Riprova</a></p>
<p class="step"><a href="#" onclick="javascript:history.go(-1);return false;" class="button button-large"><?php t("Try again"); ?></a></p>
</div>
<?php
exit();
@ -355,14 +414,14 @@ INSERT INTO `".$prefix."_tipo` (`id`, `name`) VALUES (NULL, 'type1'), (NULL, 'ty
exit(10);
}
?>
<div class="wp-die-message"><h1>Impossibile creare le tabelle</h1>
<p>Siamo riusciti a connetterci al server del database (il che significa che il tuo name user e password sono ok), ma non siamo riusciti a creare le tabelle.</p>
<p>Se non sei sicuro di cosa vogliano dire questi termini prova a contattare il tuo fornitore di hosting. Prova a fornire le seguenti informazioni:</p>
<div class="wp-die-message"><h1><?php t("Unable to create tables"); ?></h1>
<p><?php t("We were able to connect to the database server (which means your username and password are ok)"); echo(", "); t("but we were unable to create the tables"); ?>.</p>
<p><?php t("If you're not sure what these terms mean, try contacting your hosting provider. Try providing the following information:"); ?></p>
<details>
<summary>Informazioni avanzate</summary>
<summary><?php t("Advanced informations"); ?></summary>
<pre><?php echo($e); ?></pre>
</details>
<p class="step"><a href="#" onclick="javascript:history.go(-1);return false;" class="button button-large">Riprova</a></p>
<p class="step"><a href="#" onclick="javascript:history.go(-1);return false;" class="button button-large"><?php t("Try again"); ?></a></p>
</div>
<?php
exit();
@ -426,14 +485,14 @@ $option_check_cf_ip");
exit(11);
}
?>
<div class="wp-die-message"><h1>Impossibile riempire le tabelle</h1>
<p>Siamo riusciti a connetterci al server del database (il che significa che il tuo name user e password sono ok), ma non siamo riusciti a riempire le tabelle.</p>
<p>Se non sei sicuro di cosa vogliano dire questi termini prova a contattare il tuo fornitore di hosting. Prova a fornire le seguenti informazioni:</p>
<div class="wp-die-message"><h1><?php t("Unable to fill in the tables"); ?></h1>
<p><?php t("We were able to connect to the database server (which means your username and password are ok)"); echo(", "); t("but we were unable to fill in the tables"); ?>.</p>
<p><?php t("If you're not sure what these terms mean, try contacting your hosting provider. Try providing the following information:"); ?></p>
<details>
<summary>Informazioni avanzate</summary>
<summary><?php t("Advanced informations"); ?></summary>
<pre><?php echo($e); ?></pre>
</details>
<p class="step"><a href="#" onclick="javascript:history.go(-1);return false;" class="button button-large">Riprova</a></p>
<p class="step"><a href="#" onclick="javascript:history.go(-1);return false;" class="button button-large"><?php t("Try again"); ?></a></p>
</div>
<?php
exit();
@ -464,7 +523,7 @@ function cli_helper($action, $options){
$path = isset($options->getOptions["path"]) ? "." : "..";
checkConnection($db_host, $db_username, $db_password, $db_name);
generateConfig($db_host,$db_username,$db_password,$db_name,$db_prefix,$path);
echo("Config created successful");
t("Config created successful");
exit(0);
case "populate":
$name = validate_arg($options, "name", "admin");
@ -474,7 +533,7 @@ function cli_helper($action, $options){
$owner = validate_arg($options, "owner", "Owner");
initDB();
initOptions($name, $visible, $password, $report_email, $owner);
echo("DB Populated successful");
t("DB Populated successful");
unlink("runInstall.php");
exit(0);
}
@ -485,65 +544,66 @@ function run_cli(){
$getopt->addCommands([
\GetOpt\Command::create('config', 'conf', [
\GetOpt\Option::create('n', 'db_name', \GetOpt\GetOpt::OPTIONAL_ARGUMENT)
->setDescription('DB name')
->setArgumentName('DB name'),
->setDescription(t("DB name",false))
->setArgumentName(t("DB name",false)),
\GetOpt\Option::create('u', 'db_username', \GetOpt\GetOpt::OPTIONAL_ARGUMENT)
->setDescription('DB username')
->setArgumentName('DB username'),
->setDescription(t("DB username",false))
->setArgumentName(t("DB username",false)),
\GetOpt\Option::create('a', 'db_password', \GetOpt\GetOpt::OPTIONAL_ARGUMENT)
->setDescription('DB password')
->setArgumentName('DB password'),
->setDescription(t("DB password",false))
->setArgumentName(t("DB password",false)),
\GetOpt\Option::create('o', 'db_host', \GetOpt\GetOpt::OPTIONAL_ARGUMENT)
->setDescription('DB host')
->setArgumentName('DB host'),
->setDescription(t("DB host",false))
->setArgumentName(t("DB host",false)),
\GetOpt\Option::create('r', 'db_prefix', \GetOpt\GetOpt::OPTIONAL_ARGUMENT)
->setDescription('DB prefix')
->setArgumentName('DB prefix')
->setDescription(t("DB prefix",false))
->setArgumentName(t("DB prefix",false))
])->setDescription(
'Creates the config file "config.php".' . PHP_EOL .
t("Create the config file",false).' "config.php".' . PHP_EOL .
PHP_EOL .
'This file is required for running "populate".'
)->setShortDescription('Create a new config file'),
sprintf(t("This file is required for running %s",false),'"populate"') . "."
)->setShortDescription(t("Create a new config file",false)),
\GetOpt\Command::create('populate', 'Populate', [
\GetOpt\Option::create('m', 'name', \GetOpt\GetOpt::OPTIONAL_ARGUMENT)
->setDescription('Admin name')
->setArgumentName('Admin name'),
->setDescription(t("Admin name",false))
->setArgumentName(t("Admin name",false)),
\GetOpt\Option::create('b', 'visible', \GetOpt\GetOpt::NO_ARGUMENT)
->setDescription('Is admin visible?')
->setArgumentName('Is admin visible?'),
->setDescription(t("Is admin visible?",false))
->setArgumentName(t("Is admin visible?",false)),
\GetOpt\Option::create('s', 'password', \GetOpt\GetOpt::OPTIONAL_ARGUMENT)
->setDescription('Admin password')
->setArgumentName('Admin password'),
->setDescription(t("Admin password",false))
->setArgumentName(t("Admin password",false)),
\GetOpt\Option::create('w', 'owner', \GetOpt\GetOpt::OPTIONAL_ARGUMENT)
->setDescription('Owner')
->setArgumentName('Owner'),
->setDescription(t("Owner",false))
->setArgumentName(t("Owner",false)),
\GetOpt\Option::create('e', 'report_email', \GetOpt\GetOpt::OPTIONAL_ARGUMENT)
->setDescription('Report email')
->setArgumentName('Report email')
->setDescription(t("Report email",false))
->setArgumentName(t("Report email",false))
])->setDescription(
'Populate Allerta database.' . PHP_EOL .
t("Populate Allerta database",false) . "." . PHP_EOL .
PHP_EOL .
'This require a working config.php file.'
)->setShortDescription('Populate DB')
sprintf(t("This require a working %s file",false),"config.php") . "."
)->setShortDescription(t("Populate DB",false))
]);
$getopt->addOptions([
Option::create('v', 'version', \GetOpt\GetOpt::NO_ARGUMENT)
->setDescription('Show version information and quit'),
->setDescription(t("Show version information and quit",false)),
Option::create('h', 'help', \GetOpt\GetOpt::NO_ARGUMENT)
->setDescription('Show this help and quit'),
->setDescription(t("Show this help and quit",false)),
Option::create("p", 'path', \GetOpt\GetOpt::OPTIONAL_ARGUMENT)
->setDescription('Destination path')
->setDescription(t("Destination path",false))
->setArgumentName('path')
->setValidation('is_writable', function($operand, $value) {
if(file_exists($value)){
echo($value . ' is not writable. Directory permissions: ' . @fileperms($value));
printf(t("%s is not writable. Directory permissions: %s"),$value,@fileperms($value));
exit(4);
} else {
echo($value . ' not exists.');
printf(t("%s not exists"),$value);
echo(".");
exit(3);
}
})

View File

@ -0,0 +1,97 @@
<?php
// Translated by: Name Surname (github, email or another social profile url/username)
return [
"Already installed" => "Already installed",
"user" => "user",
"password" => "password",
"installation" => "installation",
"Before starting" => "Before starting",
"Welcome in Allerta. We need some informations about the database. You have to know the following informations:" => "Welcome in Allerta. We need some informations about the database. You have to know the following informations:",
"DB name" => "DB name",
"DB username" => "DB username",
"DB password" => "DB password",
"DB host" => "DB host",
"DB prefix" => "DB prefix",
"We will use this informations for creating a file" => "We will use this informations for creating a file",
"If for any reason automatic file creation doesn't work, don't worry. You can just open %s in a text editor, enter your details, and save it as" => "If for any reason automatic file creation doesn't work, don't worry. You can just open %s in a text editor, enter your details, and save it as",
"In all likelihood, this information has already been provided to you by your hosting provider. If you don't have this information, you'll need to contact your provider before you can continue. But if everything is ready ..." => "In all likelihood, this information has already been provided to you by your hosting provider. If you don't have this information, you'll need to contact your provider before you can continue. But if everything is ready ...",
"Submit" => "Submit",
"Configure the database connection" => "Configure the database connection",
"Below you can enter your database connection details. If you are not sure of the data to enter, contact your hosting provider" => "Below you can enter your database connection details. If you are not sure of the data to enter, contact your hosting provider",
"The name of the database you want to use with Allerta" => "The name of the database you want to use with Allerta",
"Your" => "Your",
"If %s doesn't work, you can get this information from your hosting provider" => "If %s doesn't work, you can get this information from your hosting provider",
"Edit this item if you want to perform multiple Alert installations on a single database" => "Edit this item if you want to perform multiple Alert installations on a single database",
"Error establishing a database connection" => "Error establishing a database connection",
"This could mean that %s and %s in file %s are wrong or that we cannot contact database %s. It could mean that your database is unreachable" => "This could mean that %s and %s in file %s are wrong or that we cannot contact database %s. It could mean that your database is unreachable",
"Are you sure that %s and %s correct?" => "Are you sure that %s and %s correct?",
"Are you sure you have entered the correct hostname?" => "Are you sure you have entered the correct hostname?",
"Are you sure the database server is up and running?" => "Are you sure the database server is up and running?",
"If you're not sure what these terms mean, try contacting your hosting provider. Try providing the following information:" => "If you're not sure what these terms mean, try contacting your hosting provider. Try providing the following information:",
"Advanced informations" => "Advanced informations",
"Try again" => "Try again",
"Cannot select database" => "Cannot select database",
"We were able to connect to the database server (which means your username and password are ok)" => "We were able to connect to the database server (which means your username and password are ok)",
"but we could not select the database" => "but we could not select the database",
"Are you sure that it exists?" => "Are you sure that it exists?",
"Does user %s have permissions to use database %s?" => "Does user %s have permissions to use database %s?",
"In some systems your database name has your username as a prefix, which is %s. Could this be the problem?" => "In some systems your database name has your username as a prefix, which is %s. Could this be the problem?",
"Cannot edit the configuration file" => "Cannot edit the configuration file",
"We were unable to write the configuration file %s, which is required for the program to work" => "We were unable to write the configuration file %s, which is required for the program to work",
"It is however possible to edit it manually by following the instructions below:" => "It is however possible to edit it manually by following the instructions below:",
"Access the Allerta installation folder (connect via FTP in case of cloud server)" => "Access the Allerta installation folder (connect via FTP in case of cloud server)",
"Rename the file %s to %s" => "Rename the file %s to %s",
"Replace the first 16 lines of the file with the following text:" => "Replace the first 16 lines of the file with the following text:",
"Unable to create tables" => "Unable to create tables",
"but we were unable to create the tables" => "but we were unable to create the tables",
"Unable to create tables" => "Unable to fill in the tables",
"but we were unable to fill in the tables" => "but we were unable to fill in the tables",
"Config created successful" => "Config created successful",
"DB Populated successful" => "DB Populated successful",
"Create the config file" => "Create the config file",
"This file is required for running %s" => "This file is required for running %s",
"Create a new config file" => "Create a new config file",
"Configuration file created successfully!" => "Configuration file created successfully!",
"Great job, man!" => "Great job, man!",
"You have completed this part of the installation. Allerta can now communicate with the database" => "You have completed this part of the installation. Allerta can now communicate with the database",
"If you are ready, it's time to..." => "If you are ready, it's time to...",
"Admin name" => "Admin name",
"Is admin visible?" => "Is admin visible?",
"Admin password" => "Admin password",
"Owner" => "Owner",
"Report email" => "Report email",
"Populate Allerta database" => "Populate Allerta database",
"This require a working %s file" => "This require a working %s file",
"Populate DB" => "Populate DB",
"Show version information and quit" => "Show version information and quit",
"Show this help and quit" => "Show this help and quit",
"Destination path" => "Destination path",
"%s is not writable. Directory permissions: %s" => "%s is not writable. Directory permissions: %s",
"%s not exists" => "%s not exists",
"Urray!" => "Urray!",
"You are almost finished installing Allerta, you just need to enter some information" => "You are almost finished installing Allerta, you just need to enter some information",
"Necessary informations:" => "Necessary informations:",
"Very weak" => "Very weak",
"Weak" => "Weak",
"Good" => "Good",
"Strong" => "Strong",
"Very strong" => "Very strong",
"Admin username" => "Admin username",
"Usernames can only contains alphanumeric characters, spaces, underscores, dashes, periods, and the @ symbol" => "Usernames can only contains alphanumeric characters, spaces, underscores, dashes, periods, and the @ symbol",
"Password" => "Password",
"Important:" => "Important:",
"You will need this password to log in. Keep it in a safe place" => "You will need this password to log in. Keep it in a safe place",
"Make admin user visible" => "Make admin user visible",
"to other users" => "to other users",
"By activating this option, the user that will be created will be visible in lists and procedures" => "By activating this option, the user that will be created will be visible in lists and procedures",
"Add developer permissions to admin user" => "Add developer permissions to admin user",
"By activating this option, the user will be able to debug Allerta" => "By activating this option, the user will be able to debug Allerta",
"Your email" => "Your email",
"Please check your email address carefully before continuing" => "Please check your email address carefully before continuing",
"It will be used in reports" => "It will be used in reports",
"Install Allerta" => "Install Allerta",
"Installation completed successfully" => "Installation completed successfully",
"You have completed the installation. Allerta can now function properly" => "You have completed the installation. Allerta can now function properly",
"Login" => "Login"
];

File diff suppressed because one or more lines are too long