Prepare for gettext

This commit is contained in:
Vojtěch Sajdl 2017-12-31 00:41:58 +01:00
parent 83e72e2f4c
commit bef338fd99
No known key found for this signature in database
GPG Key ID: 082BC82518E5F32E
14 changed files with 149 additions and 149 deletions

View File

@ -5,8 +5,8 @@ require("footer.php");
render_header("Page not found");
?>
<div class="text-center">
<h1>Page Not Found</h1>
<p>Sorry, but the page you were trying to view does not exist.</p>
<h1><?php echo _("Page Not Found");?></h1>
<p><?php echo _("Sorry, but the page you were trying to view does not exist.");?></p>
</div>
<?php
render_footer();

View File

@ -21,12 +21,12 @@ if (isset($_GET['delete']))
//TODO: Pamatovat si data
render_header("Dashboard", true);
render_header(_("Dashboard"), true);
?>
<div class="text-center">
<h1>Dashboard</h1>
<h3>Welcome <?php echo $user->get_name();?></h3>
<h1><?php echo _("Dashboard");?></h1>
<h3><?php echo _("Welcome");?> <?php echo $user->get_name();?></h3>
</div>
<div id="current">
@ -38,7 +38,7 @@ render_header("Dashboard", true);
<div class="item">
<div class="timeline">
<div class="line text-muted"></div>
<h3>New incident</h3>
<h3><?php echo _("New incident");?></h3>
<form id="new-incident" action="/admin/?new=incident" method="POST" class="clearfix">
<article class="panel">
<?php if (isset($message))
@ -68,13 +68,13 @@ render_header("Dashboard", true);
<i class="glyphicon glyphicon-info-sign"></i>
</div>
<div class="panel-heading clearfix">
<input type="text" name="title" id="title" placeholder="Title" value="<?php echo htmlspecialchars($_POST['title']); ?>" required> <span id="time"><input id="time_input" type="text" pattern="(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))" name="time" value="<?php echo htmlspecialchars($_POST['time']); ?>" class="pull-right" title="Use ISO 8601 format (e.g. 2017-11-23T19:50:51+00:00)" placeholder="Time"></span>
<input type="text" name="title" id="title" placeholder="<?php echo _("Title");?>" value="<?php echo htmlspecialchars($_POST['title']); ?>" required> <span id="time"><input id="time_input" type="text" pattern="(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))" name="time" value="<?php echo htmlspecialchars($_POST['time']); ?>" class="pull-right" title="Use ISO 8601 format (e.g. 2017-11-23T19:50:51+00:00)" placeholder="<?php echo _("Time");?>"></span>
</div>
<div class="panel-body">
<textarea name="text" placeholder="Here goes your text..." required><?php echo htmlspecialchars($_POST['text']); ?></textarea>
<textarea name="text" placeholder="<?php echo _("Here goes your text...");?>" required><?php echo htmlspecialchars($_POST['text']); ?></textarea>
</div>
<div class="panel-footer clearfix">
<small>Posted by: <?php echo $user->get_username();?> <span class="pull-right" id="end_time_wrapper">Ending:&nbsp;<input id="end_time" title="Use ISO 8601 format (e.g. 2017-11-23T19:50:51+00:00)" type="text" pattern="(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))" name="end_time" class="pull-right" placeholder="End time" value="<?php echo htmlspecialchars($_POST['end_time']); ?>"></span></small>
<small><?php echo _("Posted by");?>: <?php echo $user->get_username();?> <span class="pull-right" id="end_time_wrapper"><?php echo _("Ending");?>:&nbsp;<input id="end_time" title="Use ISO 8601 format (e.g. 2017-11-23T19:50:51+00:00)" type="text" pattern="(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))" name="end_time" class="pull-right" placeholder="<?php echo _("End time");?>" value="<?php echo htmlspecialchars($_POST['end_time']); ?>"></span></small>
</div>
</article>
<select class="form-control pull-left" id="type" name="type">
@ -92,7 +92,7 @@ render_header("Dashboard", true);
}
?>
</select>
<button type="submit" class="btn btn-primary pull-right">Submit</button>
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Submit");?></button>
</form>
<?php
$constellation->render_incidents(true,$offset,5,true);

View File

@ -1,30 +1,30 @@
<?php
render_header("Login");
render_header(_("Login"));
?>
<div class="text-center">
<h1>Login</h1>
<h1><?php echo _("Login");?></h1>
</div>
<div id="login-form" class="center">
<?php if (isset($message)){?>
<p class="alert alert-danger"><?php echo $message?></p>
<?php }else{?>
<p class="alert alert-info">Please login to continue.</p>
<p class="alert alert-info"><?php echo _("Please login to continue.");?></p>
<?php }?>
<form action="/admin/" method="post">
<div class="form-group">
<label for="email">Email</label>
<input placeholder="Email" class="form-control" name="email" id="email" type="email" tabindex="1" value="<?php echo htmlspecialchars((isset($_POST['email'])?$_POST['email']:''),ENT_QUOTES);?>" required>
<label for="email"><?php echo _("Email");?></label>
<input placeholder="<?php echo _("Email");?>" class="form-control" name="email" id="email" type="email" tabindex="1" value="<?php echo htmlspecialchars((isset($_POST['email'])?$_POST['email']:''),ENT_QUOTES);?>" required>
</div>
<div class="form-group" style="margin-bottom: 8px">
<label for="pass">Password</label>
<input placeholder="Password" class="form-control" name="pass" id="pass" type="password" tabindex="2" required>
<label for="pass"><?php echo _("Password");?></label>
<input placeholder="<?php echo _("Password");?>" class="form-control" name="pass" id="pass" type="password" tabindex="2" required>
<div style="padding-top: 8px; position: relative;">
<a href="?do=lost-password" class="pull-right noselect" tabindex="5">Forgotten password?</a>
<input name="remember" id="remember" type="checkbox" tabindex="3"> <label class="lbl-login noselect" style="color: black;" for="remember">Remember me</label>
<a href="?do=lost-password" class="pull-right noselect" tabindex="5"><?php echo _("Forgotten password?");?></a>
<input name="remember" id="remember" type="checkbox" tabindex="3"> <label class="lbl-login noselect" style="color: black;" for="remember"><?php echo _("Remember me");?></label>
</div>
</div>
<div class="form-group clearfix">
<button type="submit" class="btn btn-success pull-right" tabindex="4">Login</button>
<button type="submit" class="btn btn-success pull-right" tabindex="4"><?php echo _("Login");?></button>
</div>
</form>
</div>

View File

@ -1,8 +1,8 @@
<?php
render_header("Lost password");
render_header(_("Lost password"));
?>
<div class="text-center">
<h1>Lost password</h1>
<h1><?php echo _("Lost password");?></h1>
</div>
<div id="login-form" class="center">
@ -13,12 +13,12 @@ render_header("Lost password");
$user->change_password($_POST['token']);
if (isset($message)){?>
<p class="alert alert-danger"><?php echo $message?></p>
<a href="/admin/?do=lost-password<?php echo "&id=".$_POST['id']."&token=".$_POST['token'];?>">Go back</a>
<a href="/admin/?do=lost-password<?php echo "&id=".$_POST['id']."&token=".$_POST['token'];?>"><?php echo _("Go back");?> </a>
<?php
}
else{?>
<p class="alert alert-success">Password changed successfully!</p>
<a href="/admin/">Go back to login page</a>
<p class="alert alert-success"><?php echo _("Password changed successfully!");?></p>
<a href="/admin/"><?php echo _("Go back to login page");?></a>
<?php
}
}
@ -27,12 +27,12 @@ render_header("Lost password");
User::password_link();
if (isset($message)){?>
<p class="alert alert-danger"><?php echo $message?></p>
<a href="/admin/?do=lost-password">Go back to start</a>
<a href="/admin/?do=lost-password"><?php echo _("Go back to start");?></a>
<?php
}
else{?>
<p class="alert alert-success">Email with password reset link has been sent!</p>
<a href="/admin/">Go back to login page</a>
<p class="alert alert-success"><?php echo _("Email with password reset link has been sent!");?></p>
<a href="/admin/"><?php echo _("Go back to login page");?></a>
<?php
}
}
@ -43,25 +43,25 @@ render_header("Lost password");
<?php }?>
<form action="/admin/?do=lost-password" method="post">
<?php if (!isset($_GET['id'])||!isset($_GET['token'])){?>
<label for="email">Email:</label>
<label for="email"><?php echo _("Email");?>:</label>
<div class="input-group pull-right">
<input class="form-control" name="email" id="email" placeholder="Email" type="email" required>
<input class="form-control" name="email" id="email" placeholder="<?php echo _("Email");?>" type="email" required>
<span class="input-group-btn">
<button type="submit" class="btn btn-success pull-right">Submit request</button>
<button type="submit" class="btn btn-success pull-right"><?php echo _("Submit request");?></button>
</span>
</div>
<?php }
else{
$user = new User($_GET['id']);
?>
<p class="alert alert-info">Reset password for <?php echo $user->get_name()." (".$user->get_username().")";?></p>
<p class="alert alert-info"><?php printf(_("Reset password for %s (%s)"),$user->get_name(), $user->get_username());?></p>
<input type="hidden" name="id" value="<?php echo $_GET['id'];?>" >
<input type="hidden" name="token" value="<?php echo $_GET['token'];?>" >
<label for="new_password">New password</label>
<input id="new_password" placeholder="New password" type="password" class="form-control" name="password">
<label for="new_password_check">Repeat password</label>
<input id="new_password_check" placeholder="Repeat password" type="password" class="form-control" name="password_repeat">
<button type="submit" class="btn btn-primary pull-right margin-top">Change password</button>
<label for="new_password"><?php echo _("New password");?></label>
<input id="new_password" placeholder="<?php echo _("New password");?>" type="password" class="form-control" name="password">
<label for="new_password_check"><?php echo _("Repeat password");?></label>
<input id="new_password_check" placeholder="<?php echo _("Repeat password");?>" type="password" class="form-control" name="password_repeat">
<button type="submit" class="btn btn-primary pull-right margin-top"><?php echo _("Change password");?></button>
<?php
}
?>

View File

@ -4,7 +4,7 @@ if (isset($_GET['new']))
User::add();
}
render_header("New user", true); ?>
render_header(_("New user"), true); ?>
<div class="text-center">
<h2>Add new user</h2>
</div>
@ -16,17 +16,17 @@ render_header("New user", true); ?>
<?php
} ?>
<div class="form-group">
<div class="col-sm-6"><label for="name">Name: </label><input type="text" maxlength="50" name="name" value="<?php echo htmlspecialchars($_POST['name'],ENT_QUOTES);?>" id="name" placeholder="Name" class="form-control" required></div>
<div class="col-sm-6"><label for="surname">Surname: </label><input type="text" maxlength="50" name="surname" value="<?php echo htmlspecialchars($_POST['surname'],ENT_QUOTES);?>" id="surname" placeholder="Surname" class="form-control" required></div>
<div class="col-sm-6"><label for="name"><?php echo _("Name");?>: </label><input type="text" maxlength="50" name="name" value="<?php echo htmlspecialchars($_POST['name'],ENT_QUOTES);?>" id="name" placeholder="<?php echo _("Name");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="surname"><?php echo _("Surname");?>: </label><input type="text" maxlength="50" name="surname" value="<?php echo htmlspecialchars($_POST['surname'],ENT_QUOTES);?>" id="surname" placeholder="<?php echo _("Surname");?>" class="form-control" required></div>
</div>
<div class="form-group">
<div class="col-sm-6"><label for="username">Username:</label><input type="text" maxlength="50" name="username" value="<?php echo htmlspecialchars($_POST['username'],ENT_QUOTES);?>" id="username" placeholder="Username" class="form-control" required></div>
<div class="col-sm-6"><label for="email">Email:</label><input type="email" maxlength="60" name="email" value="<?php echo htmlspecialchars($_POST['email'],ENT_QUOTES);?>" id="email" placeholder="Email" class="form-control" required></div>
<div class="col-sm-6"><label for="username"><?php echo _("Username");?>:</label><input type="text" maxlength="50" name="username" value="<?php echo htmlspecialchars($_POST['username'],ENT_QUOTES);?>" id="username" placeholder="<?php echo _("Username");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="email"><?php echo _("Email");?>:</label><input type="email" maxlength="60" name="email" value="<?php echo htmlspecialchars($_POST['email'],ENT_QUOTES);?>" id="email" placeholder="<?php echo _("Email");?>" class="form-control" required></div>
</div>
<div class="form-group">
<div class="col-sm-6"><label for="password">Password:</label><input type="password" name="password" value="<?php echo htmlspecialchars($_POST['password'],ENT_QUOTES);?>" id="password" placeholder="Password" class="form-control" required></div>
<div class="col-sm-6"><label for="password"><?php echo _("Password");?>:</label><input type="password" name="password" value="<?php echo htmlspecialchars($_POST['password'],ENT_QUOTES);?>" id="password" placeholder="<?php echo _("Password");?>" class="form-control" required></div>
<div class="col-sm-6">
<label for="permission">Permission: </label>
<label for="permission"><?php echo _("Permission");?>: </label>
<select name="permission" id="permission" class="form-control">
<?php
if (!empty($_POST['permission']))
@ -50,5 +50,5 @@ render_header("New user", true); ?>
</select>
</div>
</div>
<button type="submit" class="btn btn-primary pull-right">Submit</button>
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Submit");?></button>
</form>

View File

@ -9,7 +9,7 @@ if (isset($_GET['delete']))
Service::delete();
}
render_header("Settings", true);
render_header(_("Settings"), true);
?>
<div class="text-center">
<h2>Settings</h2>
@ -20,13 +20,13 @@ if (isset($message)){
<p class="alert alert-danger"><?php echo $message; ?></p>
<?php }?>
<section>
<h3 class="pull-left">Services</h3>
<h3 class="pull-left"><?php echo _("Services");?></h3>
<?php if ($user->get_rank() <= 1){?>
<form action="?do=settings&new=service" method="post">
<div class="input-group pull-right new-service">
<input class="form-control" name="service" placeholder="Name" type="text" value="<?php echo htmlspecialchars($_POST['service']); ?>" maxlength="50" required>
<span class="input-group-btn">
<button type="submit" class="btn btn-success pull-right">Add service</button>
<button type="submit" class="btn btn-success pull-right"><?php echo _("Add service");?></button>
</span>
</div>
</form>
@ -34,11 +34,11 @@ if (isset($message)){
<table class="table">
<thead><tr>
<th scope="col">ID</th>
<th scope="col">Name</th>
<th scope="col"><?php echo _("ID");?></th>
<th scope="col"><?php echo _("Name");?></th>
<?php if ($user->get_rank()<=1)
{?>
<th scope="col">Delete</th>
<th scope="col"><?php echo _("Delete");?></th>
<?php } ?>
</tr>
</thead>
@ -62,11 +62,11 @@ while($result = $query->fetch_assoc())
<section>
<h3 class="pull-left">Users</h3>
<?php if ($user->get_rank() == 0){?> <a href="?do=new-user" class="btn btn-success pull-right">Add new user</a><?php }?>
<h3 class="pull-left"><?php echo _("Users");?></h3>
<?php if ($user->get_rank() == 0){?> <a href="?do=new-user" class="btn btn-success pull-right"><?php echo _("Add new user");?></a><?php }?>
<table class="table">
<thead><tr><th scope="col">ID</th><th scope="col">Username</th><th scope="col">Name</th><th scope="col">Surname</th><th scope="col">Email</th><th scope="col">Role</th><th scope="col">Active</th></tr></thead>
<thead><tr><th scope="col"><?php echo _("ID");?></th><th scope="col"><?php echo _("Username");?></th><th scope="col"><?php echo _("Name");?></th><th scope="col"><?php echo _("Surname");?></th><th scope="col"><?php echo _("Email");?></th><th scope="col"><?php echo _("Role");?></th><th scope="col">Active</th></tr></thead>
<tbody>
<?php
$query = $mysqli->query("SELECT * FROM users");

View File

@ -32,11 +32,11 @@ if ($_GET['what']=='toggle')
$displayed_user->toggle();
}
render_header("User", true);
render_header(_("User"), true);
?>
<div class="text-center">
<h1>User settings</h1>
<h1><?php echo _("User settings");?></h1>
</div>
<?php if (isset($message)){?>
<p class="alert alert-danger"><?php echo $message?></p>

View File

@ -29,19 +29,19 @@ class Constellation
$query = $sql->get_result();
if ($future && $query->num_rows && !$ajax)
{
echo "<h3>Planned maintenance</h3>";
echo "<h3>"._("Planned maintenance")."</h3>";
}
else if ($query->num_rows &&!$ajax)
{
if ($offset)
{
echo '<noscript><div class="centered"><a href="?offset='.($offset-$limit+1).'&timestamp='.$timestamp.'" class="btn btn-default">Back</a></div></noscript>';
echo '<noscript><div class="centered"><a href="?offset='.($offset-$limit+1).'&timestamp='.$timestamp.'" class="btn btn-default">'._("Back").'</a></div></noscript>';
}
echo "<h3>Past incidents</h3>";
echo "<h3>"._("Past incidents")."</h3>";
}
else if (!$future &&!$ajax)
{
echo "<h3>No incidents</h3>";
echo "<h3>"._("No incidents")."</h3>";
}
$show = !$future && $query->num_rows==$limit;
$limit--;
@ -55,7 +55,7 @@ class Constellation
}
if ($show)
{
echo '<div class="centered"><a href="?offset='.($offset).'&timestamp='.$timestamp.'" id="loadmore" class="btn btn-default">Load more</a></div>';
echo '<div class="centered"><a href="?offset='.($offset).'&timestamp='.$timestamp.'" id="loadmore" class="btn btn-default">'._("Load more").'</a></div>';
}
}
}
@ -88,7 +88,7 @@ class Constellation
echo Service::current_status($array);
}
else{
$array[] = new Service(0, "No services", -1);
$array[] = new Service(0, _("No services"), -1);
}
if (!$admin)
{

View File

@ -52,27 +52,27 @@ class Incident
if (strlen($title)==0)
{
$message = "Please enter title";
$message = _("Please enter title");
return;
}else if(strlen($title)>50){
$message = "Title too long! Character limit is 50";
$message = _("Title too long! Character limit is 50");
return;
}
if (strlen($title)==0)
{
$message = "Please enter text";
$message = _("Please enter text");
return;
}
if ($type == 2 && (!strlen(trim($_POST['time'])) || !strlen(trim($_POST['end_time']))))
{
$message = "Please set start and end time! Use ISO 8601 format.";
$message = _("Please set start and end time! Use ISO 8601 format.");
return;
}
if (empty($_POST['services'])){
$message = "Please select at least one service";
$message = _("Please select at least one service");
}
else
{
@ -90,13 +90,13 @@ class Incident
$end_time = strtotime($_POST['end_time']);
if (!$time)
{
$message = "Start date format is not recognized. Please use ISO 8601 format.";
$message = _("Start date format is not recognized. Please use ISO 8601 format.");
return;
}
if (!$end_time)
{
$message = "End date format is not recognized. Please use ISO 8601 format.";
$message = _("End date format is not recognized. Please use ISO 8601 format.");
return;
}
}else{
@ -140,9 +140,9 @@ class Incident
<?php echo $this->text; ?>
</div>
<div class="panel-footer clearfix">
<small>Posted by: <?php echo $this->username;
<small><?php echo _("Posted by");?>: <?php echo $this->username;
if (isset($this->end_date)){?>
<span class="pull-right"><?php echo strtotime($this->end_date)>time()?"Ending:":"Ended:";?>&nbsp;<time class="pull-right timeago" datetime="<?php echo $this->end_date; ?>"><?php echo $this->end_date; ?></time></span>
<span class="pull-right"><?php echo strtotime($this->end_date)>time()?_("Ending"):_("Ended");?>:&nbsp;<time class="pull-right timeago" datetime="<?php echo $this->end_date; ?>"><?php echo $this->end_date; ?></time></span>
<?}?>
</small>
</div>

View File

@ -35,10 +35,10 @@ class Service
global $user, $message;
if (strlen($_POST['service'])>50)
{
$message = "Service name is too long! Character limit is 50";
$message = _("Service name is too long! Character limit is 50");
return;
}else if (strlen(trim($_POST['service']))==0){
$message = "Please enter name!";
$message = _("Please enter name!");
return;
}
@ -53,7 +53,7 @@ class Service
header("Location: /admin/?do=settings");
}else
{
$message = "Insufficient permissions";
$message = _("You don't have the permission to do that!");
}
}
@ -91,7 +91,7 @@ class Service
}
else
{
$message = "Insufficient permissions";
$message = _("You don't have the permission to do that!");
}
}

View File

@ -69,7 +69,7 @@ class User
$stmt->close();
header("Location: /admin/?do=user&id=".$id);
}else{
$message = "You don't have the permission to do that!";
$message = _("You don't have the permission to do that!");
}
}
@ -80,7 +80,7 @@ class User
{
if (strlen(trim($_POST['name']))==0 || strlen(trim($_POST['surname']))==0 || strlen(trim($_POST['email']))==0 || strlen(trim($_POST['password']))==0 || !isset($_POST['permission']))
{
$message = "Please enter all data!";
$message = _("Please enter all data!");
}else{
$name = $_POST['name'];
$surname = $_POST['surname'];
@ -104,7 +104,7 @@ class User
if (!empty($variables))
{
$message = "Please mind the following character limits: ";
$message = _("Please mind the following character limits: ");
$message .= implode(", ", $variables);
return;
}
@ -121,8 +121,8 @@ class User
if ($stmt->affected_rows>0)
{
$to = $email;
$subject = 'User account created - '.NAME;
$message = 'Hi '.$name." ".$surname."!<br>"."Your account has been created. You can login with your email address at <a href=\"".WEB_URL."/admin\">".WEB_URL."/admin </a> with password ".$pass.". Please change it as soon as possible. ";
$subject = _('User account created').' - '.NAME;
$message = sprintf(_("Hi %s!<br>"."Your account has been created. You can login with your email address at <a href=\"%s\">%s</a> with password %s - please change it as soon as possible."), .$name." ".$surname,WEB_URL."/admin", WEB_URL."/admin", $pass);
$headers = "Content-Type: text/html; charset=utf-8 ".PHP_EOL;
$headers .= "MIME-Version: 1.0 ".PHP_EOL;
$headers .= "From: ".MAILER_NAME.' <'.MAILER_ADDRESS.'>'.PHP_EOL;
@ -132,12 +132,12 @@ class User
header("Location: /admin/?do=settings");
}
else{
$message = "Username or email already used";
$message = _("Username or email already used");
}
}
}
else {
$message = "Insufficient permission";
$message = _("You don't have the permission to do that!");
}
}
@ -162,7 +162,7 @@ class User
$active = $result["active"];
if (!$active)
{
$message = "Your account has been disabled. Please contact administrator.";
$message = _("Your account has been disabled. Please contact administrator.");
}
else
{
@ -174,7 +174,7 @@ class User
$query = $stmt->get_result();
if (!$query->fetch_assoc()['count'])
{
$message = "Wrong email or password";
$message = _("Wrong email or password");
}else
{
if (isset($_POST['remember'])&&$_POST['remember'])
@ -192,7 +192,7 @@ class User
}
}
else{
$message = "Wrong email or password";
$message = _("Wrong email or password");
}
}
}
@ -219,7 +219,7 @@ class User
unset($_COOKIE['token']);
setcookie('user', null, -1, '/');
setcookie('token', null, -1, '/');
$message = "Invalid token detected, please login again!";
$message = _("Invalid token detected, please login again!");
}
Token::delete($token);
@ -230,15 +230,15 @@ class User
global $permissions, $user;
?>
<div class="row">
<div class="col-md-2 col-md-offset-2"><img src="https://www.gravatar.com/avatar/<?php echo md5( strtolower( trim( $this->email ) ) );?>" alt="Profile picture"></div>
<div class="col-md-2 col-md-offset-2"><img src="https://www.gravatar.com/avatar/<?php echo md5( strtolower( trim( $this->email ) ) );?>" alt="<?php echo _("Profile picture");?>"></div>
<div class="col-md-6"><h3><?php echo $this->name." ".$this->surname;?></h3></div>
</div>
<div class="row">
<div class="col-md-2 col-md-offset-2"><strong>ID</strong></div>
<div class="col-md-2 col-md-offset-2"><strong><?php echo _("ID");?></strong></div>
<div class="col-md-6"><?php echo $this->id; ?></div>
</div>
<div class="row">
<div class="col-md-2 col-md-offset-2"><strong>Username</strong></div>
<div class="col-md-2 col-md-offset-2"><strong><?php echo _("Username");?></strong></div>
<div class="col-md-6"><?php echo $this->username."&nbsp;"; if ($this->id!=$_SESSION['user'] && $user->get_rank()<=1 && ($user->get_rank()<$this->rank))
{
echo "<a href='/admin/?do=user&id=".$this->id."&what=toggle'>";
@ -250,12 +250,12 @@ class User
<form action="/admin/?do=user&id=<?php echo $this->id; ?>" method="POST">
<div class="row">
<div class="col-md-2 col-md-offset-2"><strong>Role</strong></div>
<div class="col-md-2 col-md-offset-2"><strong><?php echo _("Role");?></strong></div>
<div class="col-md-6"><?php if ($user->get_rank() == 0 && $this->id != $_SESSION['user']){?> <div class="input-group"><select class="form-control" name="permission"><?php foreach ($permissions as $key => $value) {
echo "<option value='$key' ".($key==$this->rank?"selected":"").">$value</option>";
} ?>
</select><span class="input-group-btn">
<button type="submit" class="btn btn-primary pull-right">Change role</button>
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Change role");?></button>
</span>
</div><?}else{ echo $permissions[$this->rank];}?></div>
</div>
@ -270,7 +270,7 @@ class User
<div class="input-group">
<input type="email" class="form-control" name="email" value="<?php echo $this->email; ?>">
<span class="input-group-btn">
<button type="submit" class="btn btn-primary pull-right">Change email</button>
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Change email");?></button>
</span>
</div>
</div>
@ -278,15 +278,15 @@ class User
</form>
<form action="/admin/?do=user" method="POST">
<div class="row">
<div class="col-md-2 col-md-offset-2"><strong>Password</strong></div>
<div class="col-md-2 col-md-offset-2"><strong><?php echo _("Password");?></strong></div>
<div class="col-md-6">
<label for="password">Old password</label>
<input id="password" placeholder="Old password" type="password" class="form-control" name="old_password">
<label for="new_password">New password</label>
<input id="new_password" placeholder="New password" type="password" class="form-control" name="password">
<label for="new_password_check">Repeat password</label>
<input id="new_password_check" placeholder="Repeat password" type="password" class="form-control" name="password_repeat">
<button type="submit" class="btn btn-primary pull-right margin-top">Change password</button>
<label for="password"><?php echo _("Old password");?></label>
<input id="password" placeholder="<?php echo _("Old password");?>" type="password" class="form-control" name="old_password">
<label for="new_password"><?php echo _("New password");?></label>
<input id="new_password" placeholder="<?php echo _("New password");?>" type="password" class="form-control" name="password">
<label for="new_password_check"><?php echo _("Repeat password");?></label>
<input id="new_password_check" placeholder="<?php echo _("Repeat password");?>" type="password" class="form-control" name="password_repeat">
<button type="submit" class="btn btn-primary pull-right margin-top"><?php echo _("Change password");?></button>
</div>
</div>
</form>
@ -296,7 +296,7 @@ class User
{
?>
<div class="row">
<div class="col-md-2 col-md-offset-2"><strong>Email</strong></div>
<div class="col-md-2 col-md-offset-2"><strong><?php echo _("Email");?></strong></div>
<div class="col-md-6">
<a href="mailto:<?php echo $this->email; ?>"><?php echo $this->email; ?></a>
</div>
@ -314,13 +314,13 @@ class User
$id = $this->id;
if ($_POST['password']!=$_POST['password_repeat'])
{
$message = "Passwords do not match!";
$message = _("Passwords do not match!");
}else{
if (!$token)
{
if ($_SESSION['user']!=$id)
{
$message = "Cannot change password of other users!";
$message = _("Cannot change password of other users!");
}else{
$stmt = $mysqli->prepare("SELECT password_salt as salt FROM users WHERE id=?");
$stmt->bind_param("i", $id);
@ -346,7 +346,7 @@ class User
User::logout();
}
else{
$message = "Wrong password!";
$message = _("Wrong password!");
}
}
}else{
@ -368,7 +368,7 @@ class User
}
else
{
$message = "Invalid token detected, please retry your request from start!";
$message = _("Invalid token detected, please retry your request from start!");
}
Token::delete($token);
@ -394,8 +394,8 @@ class User
$link = WEB_URL."/admin/?do=lost-password&id=$id&token=$token";
$to = $email;
$user = new User($id);
$subject = 'Reset password - '.NAME;
$msg = 'Hi '.$user->get_name()."!<br>Below you will find link to change your password. The link is valid for 24hrs. If you didn't request this, feel free to ignore it. <br><br><a href=\"$link\">RESET PASSWORD</a><br><br>If the link doesn't work, copy & paste it into your browser: <br>$link";
$subject = _('Reset password')' - '.NAME;
$msg = sprintf(_( "Hi %s!<br>Below you will find link to change your password. The link is valid for 24hrs. If you didn't request this, feel free to ignore it. <br><br><a href=\"%s\">RESET PASSWORD</a><br><br>If the link doesn't work, copy & paste it into your browser: <br>%s"), $user->get_name(), $link, $link);
$headers = "Content-Type: text/html; charset=utf-8 ".PHP_EOL;
$headers .= "MIME-Version: 1.0 ".PHP_EOL;
$headers .= "From: ".MAILER_NAME.' <'.MAILER_ADDRESS.'>'.PHP_EOL;
@ -415,8 +415,8 @@ class User
$link = WEB_URL."/admin/?do=change-email&id=$id&token=$token";
$to = $email;
$subject = 'Email change - '.NAME;
$msg = 'Hi '.$this->get_name()."!<br>Below you will find link to finish changing your email. The link is valid for 24hrs. If you didn't request this, feel free to ignore it. <br><br><a href=\"$link\">CHANGE EMAIL</a><br><br>If the link doesn't work, copy & paste it into your browser: <br>$link";
$subject = _('Email change').' - '.NAME;
$msg = sprintf(_( "Hi %s!<br>Below you will find link to change your email. The link is valid for 24hrs. If you didn't request this, feel free to ignore it. <br><br><a href=\"%s\">RESET PASSWORD</a><br><br>If the link doesn't work, copy & paste it into your browser: <br>%s"), $user->get_name(), $link, $link);
$headers = "Content-Type: text/html; charset=utf-8 ".PHP_EOL;
$headers .= "MIME-Version: 1.0 ".PHP_EOL;
$headers .= "From: ".MAILER_NAME.' <'.MAILER_ADDRESS.'>'.PHP_EOL;
@ -448,7 +448,7 @@ class User
}
else
{
$message = "Invalid token detected, please retry your request from start!";
$message = _("Invalid token detected, please retry your request from start!");
}
Token::delete($token);
@ -480,7 +480,7 @@ class User
header("Location: /admin/?do=user&id=".$id);
}
else{
$message = "You don't have permission to do that!";
$message = _("You don't have permission to do that!");
}
}
}

View File

@ -18,9 +18,9 @@ if ($mysqli->connect_errno) {
$mysqli->set_charset("utf8");
//This should later be translatable, maybe find a better solution?
$statuses = array("Major outage", "Minor outage", "Planned maintenance", "Operational" );
$statuses = array(_("Major outage"), _("Minor outage"), _("Planned maintenance"), _("Operational") );
$classes = array("danger", "warning", "primary", "success" );
$icons = array("fa fa-times", "fa fa-exclamation", "fa fa-info", "fa fa-check" );
$some = array("Some systems are experiencing major outages", "Some systems are experiencing minor outages", "Some systems are under maintenance");
$all = array("Our systems are experiencing major outages.", "Our systems are experiencing minor outages", "Our systems are under maintenance", "All systems operational");
$permissions = array("Super admin", "Admin", "Writer");
$some = array(_("Some systems are experiencing major outages"), _("Some systems are experiencing minor outages"), _("Some systems are under maintenance"));
$all = array(_("Our systems are experiencing major outages."), _("Our systems are experiencing minor outages"), _("Our systems are under maintenance"), _("All systems operational"));
$permissions = array(_("Super admin"), _("Admin"), _("Writer"));

View File

@ -25,7 +25,7 @@ function render_header($page_name, $admin = false){
</div>
<div class="navbar-left hidden-xs">
<ul class="nav navbar-nav">
<li><a href="<?php echo WEB_URL;?>/"><h1>Service Status</h1></a></li>
<li><a href="<?php echo WEB_URL;?>/"><h1><?php echo _("Service Status");?></h1></a></li>
</ul>
</div><!--/.nav-collapse -->
@ -56,7 +56,7 @@ else{
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="sr-only"><?php echo _("Toggle navigation");?></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
@ -65,10 +65,10 @@ else{
</div>
<div class="navbar-collapse collapse navbar-right navbar-admin">
<ul class="nav navbar-nav">
<li><a href="<?php echo WEB_URL;?>/admin/">Dashboard</a></li>
<li><a href="<?php echo WEB_URL;?>/admin/?do=user">User <?php echo "(".$user->get_username().')'; ?></a></li>
<li><a href="<?php echo WEB_URL;?>/admin/?do=settings">Settings</a></li>
<li><a href="<?php echo WEB_URL;?>/admin/?do=logout">Logout</a></li>
<li><a href="<?php echo WEB_URL;?>/admin/"><?php echo _("Dashboard");?></a></li>
<li><a href="<?php echo WEB_URL;?>/admin/?do=user"><?php echo printf(_("User (%s)"), $user->get_username());?></a></li>
<li><a href="<?php echo WEB_URL;?>/admin/?do=settings"><?php echo _("Settings");?>");?></a></li>
<li><a href="<?php echo WEB_URL;?>/admin/?do=logout"><?php echo _("Logout");?></a></li>
</ul>
</div><!--/.nav-collapse -->
</div>

View File

@ -1,9 +1,9 @@
<?php
require_once("header.php");
require_once("footer.php");
define("NAME", 'Status page'); //Website name
render_header("Install");?>
<h1 class="text-center">Installation</h1>
define("NAME", _('Status page')); //Website name
render_header(_("Install"));?>
<h1 class="text-center"><?php echo _("Installation");?></h1>
<?php
if (isset($_POST['server']))
@ -11,13 +11,13 @@ if (isset($_POST['server']))
$mysqli = new mysqli($_POST['server'],$_POST['dbuser'],$_POST['dbpassword'],$_POST['database']);
if ($mysqli->connect_errno) {
$message = "Connection failed: %s\n", $mysqli->connect_error;
$message = printf(_("Connection failed: %s\n"), $mysqli->connect_error);
}
}
if (filter_var($_POST['url'], FILTER_VALIDATE_URL) === false)
{
$message = "Please set valid url!"
$message = _("Please set valid url!");
}
//Ostatní má checky existence ve funkci pro pridani
@ -25,7 +25,7 @@ if (0 == strlen(trim($_POST['servername'])) || 0 == strlen(trim($_POST['url']))
|| 0 == strlen(trim($_POST['mailer_email'])) || 0 == strlen(trim($_POST['server'])) || 0 == strlen(trim($_POST['database']))
|| 0 == strlen(trim($_POST['dbuser'])) || 0 == strlen(trim($_POST['dbpassword'])))
{
$message = "Please enter all data!";
$message = _("Please enter all data!");
}
if(isset($_POST['server']) && !isset($message))
@ -41,7 +41,7 @@ if(isset($_POST['server']) && !isset($message))
$q_res = $mysqli->query($value);
if ($q_res === false)
{
$message = "Error while creating database. Please check permission for your account or MYSQL version.<br>Error: ".$mysqli->error;
$message = printf(_("Error while creating database. Please check permission for your account or MYSQL version.<br>Error: %s"), $mysqli->error);
break;
}
}
@ -85,48 +85,48 @@ if (isset($message))
?>
<form method="post" action="install.php" class="clearfix install">
<section class="install-section clearfix">
<h2>Website details</h2>
<summary>We need a name for your status page and a url, so we can mail users link for forgotten password etc.</summary>
<h2><?php echo _("Website details");?></h2>
<summary><?php echo _("We need a name for your status page and a url, so we can mail users link for forgotten password etc.");?></summary>
<div class="form-group clearfix">
<div class="col-sm-6"><label for="servername">Name: </label><input type="text" name="servername" value="<?php echo htmlspecialchars($_POST['servername'], ENT_QUOTES);?>" id="servername" placeholder="Name" class="form-control" required></div>
<div class="col-sm-6"><label for="url">Url: </label><input type="url" name="url" value="<?php echo htmlspecialchars($_POST['url'], ENT_QUOTES);?>" id="url" placeholder="Url" class="form-control" required></div>
<div class="col-sm-6"><label for="servername"><?php echo _("Name");?>: </label><input type="text" name="servername" value="<?php echo htmlspecialchars($_POST['servername'], ENT_QUOTES);?>" id="servername" placeholder="<?php echo _("Name");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="url"><?php echo _("Url");?>: </label><input type="url" name="url" value="<?php echo htmlspecialchars($_POST['url'], ENT_QUOTES);?>" id="url" placeholder="<?php echo _("Url");?>" class="form-control" required></div>
</div>
<summary>Also an email address for mailer would be nice :)</summary>
<summary><?php echo _("Also an email address for mailer would be nice :)");?></summary>
<div class="form-group clearfix">
<div class="col-sm-6"><label for="mailer">Name: </label><input type="text" name="mailer" value="<?php echo htmlspecialchars($_POST['mailer'], ENT_QUOTES);?>" id="mailer" placeholder="Name" class="form-control" required></div>
<div class="col-sm-6"><label for="mailer_email">Email: </label><input type="email" name="mailer_email" value="<?php echo htmlspecialchars($_POST['mailer_email'], ENT_QUOTES);?>" id="mailer_email" placeholder="Email" class="form-control" required></div>
<div class="col-sm-6"><label for="mailer"><?php echo _("Name");?>: </label><input type="text" name="mailer" value="<?php echo htmlspecialchars($_POST['mailer'], ENT_QUOTES);?>" id="mailer" placeholder="<?php echo _("Name");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="mailer_email"><?php echo _("Email");?>: </label><input type="email" name="mailer_email" value="<?php echo htmlspecialchars($_POST['mailer_email'], ENT_QUOTES);?>" id="mailer_email" placeholder="<?php echo _("Email");?>" class="form-control" required></div>
</div>
</section>
<section class="install-section clearfix">
<h2>Database connection</h2>
<summary>We need database connection to be able to create tables. Please check that your account has the permission needed to do that.</summary>
<h2><?php echo _("Database connection");?></h2>
<summary><?php echo _("We need database connection to be able to create tables. Please check that your account has the permission needed to do that.");?></summary>
<div class="form-group clearfix">
<div class="col-sm-6"><label for="server">Server: </label><input type="text" name="server" value="<?php echo htmlspecialchars($_POST['server'], ENT_QUOTES);?>" id="server" placeholder="Server" class="form-control" required></div>
<div class="col-sm-6"><label for="database">Database: </label><input type="text" name="database" value="<?php echo htmlspecialchars($_POST['database'], ENT_QUOTES);?>" id="database" placeholder="Database" class="form-control" required></div>
<div class="col-sm-6"><label for="server"><?php echo _("Server");?>: </label><input type="text" name="server" value="<?php echo htmlspecialchars($_POST['server'], ENT_QUOTES);?>" id="server" placeholder="<?php echo _("Server");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="database"><?php echo _("Database");?>: </label><input type="text" name="database" value="<?php echo htmlspecialchars($_POST['database'], ENT_QUOTES);?>" id="database" placeholder="<?php echo _("Database");?>" class="form-control" required></div>
</div>
<div class="form-group clearfix">
<div class="col-sm-6"><label for="dbuser">User: </label><input type="text" name="dbuser" value="<?php echo htmlspecialchars($_POST['dbuser'], ENT_QUOTES);?>" id="dbuser" placeholder="User" class="form-control" required></div>
<div class="col-sm-6"><label for="dbpassword">Password: </label><input type="password" name="dbpassword" value="<?php echo htmlspecialchars($_POST['dbpassword'], ENT_QUOTES);?>" id="dbpassword" placeholder="Password" class="form-control" required></div>
<div class="col-sm-6"><label for="dbuser"><?php echo _("User");?>: </label><input type="text" name="dbuser" value="<?php echo htmlspecialchars($_POST['dbuser'], ENT_QUOTES);?>" id="dbuser" placeholder="<?php echo _("User");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="dbpassword"><?php echo _("Password");?>: </label><input type="password" name="dbpassword" value="<?php echo htmlspecialchars($_POST['dbpassword'], ENT_QUOTES);?>" id="dbpassword" placeholder="<?php echo _("Password");?>" class="form-control" required></div>
</div>
</section>
<section class="install-section clearfix">
<h2>User</h2>
<summary>And finally, we need info to create a new user. You don't have to provide it, but then... No status page admin...</summary>
<h2><?php echo _("User");?></h2>
<summary><?php echo _("And finally, we need info to create a new user. You don't have to provide it, but then... No status page admin...");?></summary>
<div class="form-group">
<div class="col-sm-6"><label for="name">Name: </label><input type="text" maxlength="50" name="name" value="<?php echo htmlspecialchars($_POST['name'],ENT_QUOTES);?>" id="name" placeholder="Name" class="form-control" required></div>
<div class="col-sm-6"><label for="surname">Surname: </label><input type="text" maxlength="50" name="surname" value="<?php echo htmlspecialchars($_POST['surname'],ENT_QUOTES);?>" id="surname" placeholder="Surname" class="form-control" required></div>
<div class="col-sm-6"><label for="name"><?php echo _("Name");?>: </label><input type="text" maxlength="50" name="name" value="<?php echo htmlspecialchars($_POST['name'],ENT_QUOTES);?>" id="name" placeholder="<?php echo _("Name");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="surname"><?php echo _("Surname");?>: </label><input type="text" maxlength="50" name="surname" value="<?php echo htmlspecialchars($_POST['surname'],ENT_QUOTES);?>" id="surname" placeholder="<?php echo _("Surname");?>" class="form-control" required></div>
</div>
<div class="form-group">
<div class="col-sm-6"><label for="username">Username:</label><input type="text" maxlength="50" name="username" value="<?php echo htmlspecialchars($_POST['username'],ENT_QUOTES);?>" id="username" placeholder="Username" class="form-control" required></div>
<div class="col-sm-6"><label for="email">Email:</label><input type="email" maxlength="60" name="email" value="<?php echo htmlspecialchars($_POST['email'],ENT_QUOTES);?>" id="email" placeholder="Email" class="form-control" required></div>
<div class="col-sm-6"><label for="username"><?php echo _("Username");?>:</label><input type="text" maxlength="50" name="username" value="<?php echo htmlspecialchars($_POST['username'],ENT_QUOTES);?>" id="username" placeholder="<?php echo _("Username");?>" class="form-control" required></div>
<div class="col-sm-6"><label for="email"><?php echo _("Email");?>:</label><input type="email" maxlength="60" name="email" value="<?php echo htmlspecialchars($_POST['email'],ENT_QUOTES);?>" id="email" placeholder="<?php echo _("Email");?>" class="form-control" required></div>
</div>
<div class="form-group">
<div class="col-sm-6"><label for="password">Password:</label><input type="password" name="password" value="<?php echo htmlspecialchars($_POST['password'],ENT_QUOTES);?>" id="password" placeholder="Password" class="form-control" required></div>
<div class="col-sm-6"><label for="password"><?php echo _("Password");?>:</label><input type="password" name="password" value="<?php echo htmlspecialchars($_POST['password'],ENT_QUOTES);?>" id="password" placeholder="<?php echo _("Password");?>" class="form-control" required></div>
<div class="col-sm-6">
<input type="hidden" value="0" class="permission">
<button type="submit" class="btn btn-success pull-right">Run install!</button>
<button type="submit" class="btn btn-success pull-right"><?php echo _("Run install!");?></button>
</div>
</div>
</section>