Add line returns to generated HTML code

This commit is contained in:
Gregory Soutade 2013-10-12 11:20:54 +02:00
parent 93ccb6802b
commit 916d26b785

View File

@ -36,9 +36,9 @@ $user = (isset($_POST['user'])) ? $_POST['user'] : "";
<?php <?php
global $user; global $user;
if ($user == "") if ($user == "")
echo "<title>gPass : global Password</title>"; echo "<title>gPass : global Password</title>\n";
else else
echo "<title>gPass : global Password - $user</title>"; echo "<title>gPass : global Password - $user</title>\n";
?> ?>
</head> </head>
<body> <body>
@ -85,10 +85,10 @@ $count = 0;
} }
if ($count == 0) if ($count == 0)
echo "<b>No user found</b><br/>"; echo "<b>No user found</b><br/>\n";
else else
{ {
echo '<b>User</b> <select name="user">'; echo '<b>User</b> <select name="user">' . "\n";
foreach($users as $u) foreach($users as $u)
{ {
if (is_dir("./users/" . $u) && $u[0] != '_' && $u[0] != '.') if (is_dir("./users/" . $u) && $u[0] != '_' && $u[0] != '.')
@ -100,8 +100,8 @@ else
echo "<option value=\"$u\"/>$u</option>"; echo "<option value=\"$u\"/>$u</option>";
} }
} }
echo "</select>"; echo "</select>\n";
echo ' <b>Master key </b> <input type="password" name="mkey"/> <input name="list" type="submit" value="See"/>'; echo ' <b>Master key </b> <input type="password" name="mkey"/> <input name="list" type="submit" value="See"/>' . "\n";
} }
?> ?>
</form> </form>
@ -116,11 +116,11 @@ if ($user != "")
$nb_unciphered = 0; $nb_unciphered = 0;
list($nb_ciphered, $entries) = list_entries($user, $mkey); list($nb_ciphered, $entries) = list_entries($user, $mkey);
echo "<b>" . (count($entries) - $nb_ciphered) . " unciphered password(s)</b><br/>"; echo "<b>" . (count($entries) - $nb_ciphered) . " unciphered password(s)</b><br/>\n";
foreach($entries as $entry) foreach($entries as $entry)
{ {
if ($entry['ciphered'] == 1) continue; if ($entry['ciphered'] == 1) continue;
echo '<form method="post">'; echo '<form method="post">' . "\n";
echo '<input type="hidden" name="user" value="' . $user . '"/>'; echo '<input type="hidden" name="user" value="' . $user . '"/>';
echo '<input type="hidden" name="mkey" value="' . $mkey . '"/>'; echo '<input type="hidden" name="mkey" value="' . $mkey . '"/>';
echo '<input type="hidden" name="login_ciph" value="' . $entry['login_ciph'] . '"/>'; echo '<input type="hidden" name="login_ciph" value="' . $entry['login_ciph'] . '"/>';
@ -129,23 +129,23 @@ if ($user != "")
echo 'password <input type="text" name="pwd" value="' . $entry['password'] . '"/>'; echo 'password <input type="text" name="pwd" value="' . $entry['password'] . '"/>';
echo '<input type="submit" name="delete" value="Delete" onclick="return confirm(\'Are you sure want to delete this password ?\');"/>'; echo '<input type="submit" name="delete" value="Delete" onclick="return confirm(\'Are you sure want to delete this password ?\');"/>';
echo '<input type="submit" name="update" value="Update" onclick="return confirm(\'Are you sure want to update this password ?\');"/>'; echo '<input type="submit" name="update" value="Update" onclick="return confirm(\'Are you sure want to update this password ?\');"/>';
echo '</form>'; echo '</form>' . "\n";
} }
echo "<br/><br/>"; echo "<br/><br/>\n";
echo "<b>$nb_ciphered ciphered password(s)</b><br/>"; echo "<b>$nb_ciphered ciphered password(s)</b><br/>\n";
if ($VIEW_CIPHERED_PASSWORDS) if ($VIEW_CIPHERED_PASSWORDS)
{ {
foreach($entries as $entry) foreach($entries as $entry)
{ {
if ($entry['ciphered'] == 0) continue; if ($entry['ciphered'] == 0) continue;
echo '<form method="post">'; echo '<form method="post">' . "\n";
echo '<input type="hidden" name="user" value="' . $user . '"/>'; echo '<input type="hidden" name="user" value="' . $user . '"/>';
echo '<input type="hidden" name="mkey" value="' . $mkey . '"/>'; echo '<input type="hidden" name="mkey" value="' . $mkey . '"/>';
echo '<input class="hash" type="text" name="login_ciph" value="' . $entry['login_ciph'] . '"/>'; echo '<input class="hash" type="text" name="login_ciph" value="' . $entry['login_ciph'] . '"/>';
echo '<input class="hash" type="text" name="pwd" value="' . $entry['password'] . '"/>'; echo '<input class="hash" type="text" name="pwd" value="' . $entry['password'] . '"/>';
echo '<input type="submit" name="delete" value="Delete" onclick="return confirm(\'Are you sure want to delete this password ?\');"/>'; echo '<input type="submit" name="delete" value="Delete" onclick="return confirm(\'Are you sure want to delete this password ?\');"/>';
echo '</form>'; echo '</form>' . "\n";
} }
} }
} }
@ -157,8 +157,8 @@ if ($user != "")
if ($user != "") if ($user != "")
{ {
echo "<b>Add a new password</b><br/>"; echo "<b>Add a new password</b><br/>\n";
echo '<form method="post">'; echo '<form method="post">' . "\n";
echo '<input type="hidden" name="user" value="' . $user . '"/>'; echo '<input type="hidden" name="user" value="' . $user . '"/>';
echo 'URL <input id="new_url" type="text" name="url"/>'; echo 'URL <input id="new_url" type="text" name="url"/>';
@ -167,7 +167,7 @@ if ($user != "")
echo 'master key <input type="password" name="mkey"/>'; echo 'master key <input type="password" name="mkey"/>';
echo '<input type="button" value="Generate password" onClick="generate_password();"/>'; echo '<input type="button" value="Generate password" onClick="generate_password();"/>';
echo "<input type=\"submit\" name=\"add\" value=\"Add\" onclick='a = document.getElementById(\"new_url\") ; a.value = url_domain(a.value);'/>"; echo "<input type=\"submit\" name=\"add\" value=\"Add\" onclick='a = document.getElementById(\"new_url\") ; a.value = url_domain(a.value);'/>";
echo '</form>'; echo '</form>' . "\n";
} }
?> ?>
</div> </div>