mirror of
https://github.com/ZeJMaN/LBCAlerte_ynh.git
synced 2025-07-06 11:50:48 +02:00
Initial commit
Functional, without SSO
This commit is contained in:
30
sources/app/admin/views/add-user.phtml
Normal file
30
sources/app/admin/views/add-user.phtml
Normal file
@ -0,0 +1,30 @@
|
||||
<form action="" method="post" autocomplete="off">
|
||||
<h2>Ajouter un utilisateur</h2>
|
||||
<dl>
|
||||
<dt><label for="username">Nom d'utilisateur</label></dt>
|
||||
<dd>
|
||||
<input type="text" id="username" name="username" value="<?php
|
||||
echo htmlspecialchars($user->getUsername());
|
||||
?>" />
|
||||
<?php if (isset($errors["username"])) : ?>
|
||||
<p class="error"><?php echo $errors["username"]; ?></p>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt><label for="password">Mot de passe</label></dt>
|
||||
<dd>
|
||||
<input type="password" id="password" name="password" />
|
||||
<?php if (isset($errors["password"])) : ?>
|
||||
<p class="error"><?php echo $errors["password"]; ?></p>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt><label for="confirmPassword">Confirmez le mot de passe</label></dt>
|
||||
<dd>
|
||||
<input type="password" id="confirmPassword" name="confirmPassword" />
|
||||
<?php if (isset($errors["confirmPassword"])) : ?>
|
||||
<p class="error"><?php echo $errors["confirmPassword"]; ?></p>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
</dl>
|
||||
<p><input type="submit" value="Enregistrer" />
|
||||
| <a href="?mod=admin&a=users">annuler</a></p>
|
||||
</form>
|
6
sources/app/admin/views/delete-user.phtml
Normal file
6
sources/app/admin/views/delete-user.phtml
Normal file
@ -0,0 +1,6 @@
|
||||
<form action="" method="post">
|
||||
<p>
|
||||
Supprimer l'utilisateur "<?php echo htmlspecialchars($user->getUsername()); ?>" ?<br />
|
||||
<input type="submit" value="Oui" /> | <a href="?mod=admin&a=users">non</a>
|
||||
</p>
|
||||
</form>
|
38
sources/app/admin/views/layout.phtml
Normal file
38
sources/app/admin/views/layout.phtml
Normal file
@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Alerte mail pour Leboncoin.fr</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="robots" content="none">
|
||||
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" href="static/styles.css?v=<?php echo APPLICATION_VERSION; ?>" />
|
||||
</head>
|
||||
<body>
|
||||
<?php if ($userAuthed) : ?>
|
||||
<header>
|
||||
<h1><a href="./">Système d'alerte Leboncoin</a></h1>
|
||||
<ul class="topmenu">
|
||||
<li<?php echo $action === "users"?' class="active"':''; ?>><a href="?mod=admin&a=users">Utilisateurs</a></li>
|
||||
<li<?php echo $action === "storage"?' class="active"':''; ?>><a href="?mod=admin&a=storage">Stockage</a></li>
|
||||
<li<?php echo $action === "proxy"?' class="active"':''; ?>><a href="?mod=admin&a=proxy">Proxy</a></li>
|
||||
<li<?php echo $action === "mail"?' class="active"':''; ?>><a href="?mod=admin&a=mail">Mail</a></li>
|
||||
<li<?php echo $action === "upgrade"?' class="active"':''; ?>><a href="?mod=admin&a=upgrade">Mise à jour</a></li>
|
||||
<li<?php echo $action === "log"?' class="active"':''; ?>><a href="?mod=admin&a=log">Log</a></li>
|
||||
<li style="float: right;"><a href="?a=logout">Déconnexion <span>(<?php echo htmlspecialchars($userAuthed->getUsername()); ?>)</span></a></li>
|
||||
</ul>
|
||||
</header>
|
||||
<?php endif; ?>
|
||||
<div class="content">
|
||||
<?php echo $content; ?>
|
||||
</div>
|
||||
<?php if ($userAuthed) : ?>
|
||||
<footer>
|
||||
<?php if ($userAuthed->getUsername() == "admin") : ?>
|
||||
<a href="?mod=admin&a=users" style="color: #EF0000;">Administration</a> |
|
||||
<?php endif; ?>
|
||||
Version <?php echo APPLICATION_VERSION; ?>
|
||||
| <a href="https://github.com/Blount/LBCAlerte/issues">Rapporter un bug</a>
|
||||
</footer>
|
||||
<?php endif; ?>
|
||||
</body>
|
||||
</html>
|
19
sources/app/admin/views/log.phtml
Normal file
19
sources/app/admin/views/log.phtml
Normal file
@ -0,0 +1,19 @@
|
||||
<h2>Fichier jounal</h2>
|
||||
<p>Voici les dernières lignes du fichier log: <?php
|
||||
echo htmlspecialchars($filename, null, "UTF-8"); ?></p>
|
||||
<ul id="lastlog" class="lastlog">
|
||||
<?php if (0 == count($lines)) : ?>
|
||||
<li>Rien à signaler.</li>
|
||||
<?php else: ?>
|
||||
<?php foreach ($lines AS $line) : ?>
|
||||
<li<?php
|
||||
if (strpos($line, "ERROR")) {
|
||||
echo ' class="lastlog-error"';
|
||||
}
|
||||
?>><?php echo htmlspecialchars($line, null, "UTF-8"); ?></li>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("lastlog").scrollTop = 50000;
|
||||
</script>
|
84
sources/app/admin/views/mail.phtml
Normal file
84
sources/app/admin/views/mail.phtml
Normal file
@ -0,0 +1,84 @@
|
||||
<?php if (empty($errors) && isset($_POST["testSMTP"])) : ?>
|
||||
<div style="width: 680px; border: 1px solid #666666; margin-bottom: 10px; padding: 10px;">
|
||||
<h2>Test d'envoi de mail</h2>
|
||||
<?php if (isset($testSended)) : ?>
|
||||
<p style="font-weight: bold; color: #333399;">Vous devriez recevoir un mail de test à l'adresse suivante : <?php
|
||||
echo htmlspecialchars($options["testMail"]);
|
||||
?></p>
|
||||
<?php elseif (isset($testError)): ?>
|
||||
<p style="font-weight: bold; color: #993333;">Erreur de l'envoi du mail : <?php
|
||||
echo htmlspecialchars($testError);
|
||||
?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<form action="" method="post" autocomplete="off">
|
||||
<h2>Configuration de l'envoi des mails</h2>
|
||||
<dl>
|
||||
<dt style="clear: both;"><label for="from">Adresse e-mail à indiquer comme expéditeur</label></dt>
|
||||
<dd>
|
||||
<input type="text" id="from" name="from" value="<?php
|
||||
echo htmlspecialchars($options["from"]);
|
||||
?>" size="40" />
|
||||
</dd>
|
||||
<dt style="margin-bottom: 5px;"><label>Serveur SMTP externe</label></dt>
|
||||
<dd style="float: left;">
|
||||
<label for="host">Hôte / IP :</label><br />
|
||||
<input type="text" id="host" name="host" value="<?php
|
||||
echo htmlspecialchars($options["host"]);
|
||||
?>" />
|
||||
</dd>
|
||||
<dd style="float: left; margin-left: 10px;">
|
||||
<label for="port">Port :</label><br />
|
||||
<input type="text" id="port" name="port" value="<?php
|
||||
echo htmlspecialchars($options["port"]);
|
||||
?>" size="10" />
|
||||
<?php if (isset($errors["server"])) : ?>
|
||||
<p class="error"><?php echo $errors["server"]; ?></p>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
|
||||
<dt style="clear: both; margin-bottom: 5px;">
|
||||
<label>Utilisateur et mot de passe SMTP si une identification est nécessaire</label>
|
||||
</dt>
|
||||
<dd style="float: left;">
|
||||
<label for="username">Utilisateur :</label><br />
|
||||
<input type="text" id="username" name="username" value="<?php
|
||||
echo htmlspecialchars($options["username"]);
|
||||
?>" />
|
||||
</dd>
|
||||
<dd style="float: left; margin-left: 10px;">
|
||||
<label for="password">Mot de passe :</label><br />
|
||||
<input type="password" id="password" name="password" value="<?php
|
||||
echo htmlspecialchars($options["password"]);
|
||||
?>" />
|
||||
<?php if (isset($errors["password"])) : ?>
|
||||
<p class="error"><?php echo $errors["password"]; ?></p>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt style="clear: both;"><label for="secure">Sécurité de la connexion</label></dt>
|
||||
<dd>
|
||||
<select name="secure">
|
||||
<option value=""<?php echo empty($options["secure"])?' selected="selected"':''; ?>>Aucune</option>
|
||||
<option value="tls"<?php echo $options["secure"] == "tls"?' selected="selected"':''; ?>>TLS</option>
|
||||
<option value="ssl"<?php echo $options["secure"] == "ssl"?' selected="selected"':''; ?>>SSL</option>
|
||||
</select>
|
||||
</dd>
|
||||
<dt style="clear: both;">
|
||||
<label for="testMail">Pour tester l'envoi des mails, entrez une adresse et cliquez sur "Tester"</label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" id="testMail" name="testMail" value="<?php
|
||||
echo htmlspecialchars($options["testMail"]);
|
||||
?>" size="40" />
|
||||
<?php if (isset($errors["testMail"])) : ?>
|
||||
<p class="error"><?php echo $errors["testMail"]; ?></p>
|
||||
<?php endif; ?>
|
||||
<p class="description">Un mail de test sera envoyé à cette adresse</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<p>
|
||||
<input type="submit" value="Enregistrer" />
|
||||
<input type="submit" name="testSMTP" value="Tester" />
|
||||
</p>
|
||||
</form>
|
62
sources/app/admin/views/proxy.phtml
Normal file
62
sources/app/admin/views/proxy.phtml
Normal file
@ -0,0 +1,62 @@
|
||||
<?php if (isset($_POST["testProxy"])) : ?>
|
||||
<div style="width: 680px; border: 1px solid #666666; margin-bottom: 10px; padding: 10px;">
|
||||
<h2>Test de connexion</h2>
|
||||
<ul>
|
||||
<?php if (!$client->hasProxy()) : ?>
|
||||
<li>aucun proxy configuré.</li>
|
||||
<?php else: ?>
|
||||
<li>utilisation d'un proxy pour la connexion.</li>
|
||||
<?php endif; ?>
|
||||
<li>Connexion à <a href="http://portail.free.fr">portail.free.fr</a> :
|
||||
<?php if (isset($errors["test"]["site"])) : ?>
|
||||
<span style="color: red;">échec</span>
|
||||
(erreur: <?php echo htmlspecialchars($errors["test"]["site"]); ?>)
|
||||
<?php else: ?>
|
||||
<span style="color: #009900;">réussi</span>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<li>Connexion à <a href="https://www.leboncoin.fr">Leboncoin</a> :
|
||||
<?php if (isset($errors["test"]["lbc"])) : ?>
|
||||
<span style="color: red;">échec</span>
|
||||
(erreur: <?php echo htmlspecialchars($errors["test"]["lbc"]); ?>)
|
||||
<?php else: ?>
|
||||
<span style="color: #009900;">réussi</span>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<h2>Configuration d'un serveur proxy</h2>
|
||||
<p>
|
||||
Vous pouvez configurer ici un proxy de connexion qui sera
|
||||
utilisé pour se connecter à Leboncoin.
|
||||
</p>
|
||||
<form action="" method="post" autocomplete="off">
|
||||
<h2>Paramètres du proxy</h2>
|
||||
<dl>
|
||||
<dt><label for="proxy_ip">Adresse du proxy</label></dt>
|
||||
<dd><input type="text" id="proxy_ip" name="proxy_ip" value="<?php
|
||||
echo htmlspecialchars($options["proxy_ip"]);
|
||||
?>" /></dd>
|
||||
<dt><label for="proxy_port">Port</label></dt>
|
||||
<dd><input type="text" id="proxy_port" name="proxy_port" value="<?php
|
||||
echo htmlspecialchars($options["proxy_port"]);
|
||||
?>" size="7" /></dd>
|
||||
</dl>
|
||||
|
||||
<h2>Le serveur proxy requiert une identification ?</h2>
|
||||
<dl>
|
||||
<dt><label for="proxy_user">Utilisateur</label></dt>
|
||||
<dd><input type="text" id="proxy_user" name="proxy_user" value="<?php
|
||||
echo htmlspecialchars($options["proxy_user"]);
|
||||
?>" />
|
||||
</dd>
|
||||
<dt><label for="proxy_password">Mot de passe</label></dt>
|
||||
<dd><input type="password" id="proxy_password" name="proxy_password"<?php
|
||||
echo !empty($options["proxy_password"])?' placeholder="Valeur masquée"':""; ?> /></dd>
|
||||
</dl>
|
||||
<p>
|
||||
<input type="submit" value="Enregistrer" />
|
||||
<input type="submit" name="testProxy" value="Tester la connexion" />
|
||||
</p>
|
||||
</form>
|
102
sources/app/admin/views/storage.phtml
Normal file
102
sources/app/admin/views/storage.phtml
Normal file
@ -0,0 +1,102 @@
|
||||
|
||||
|
||||
<?php if (isset($_GET["success"])) : ?>
|
||||
<p style="color: #001FA6;"><strong>Mise à jour de la configuration effectuée.</strong></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<p>Vous pouvez choisir de stocker les données de l'application
|
||||
(utilisateurs, alertes, options, etc.)
|
||||
dans des fichiers ou en base de données (MySQL).</p>
|
||||
<form action="?mod=admin&a=storage" method="post" autocomplete="off">
|
||||
<h2>Configuration du stockage des données</h2>
|
||||
|
||||
<dl>
|
||||
<dt><label>Type de stockage :</label></dt>
|
||||
<dd>
|
||||
<label for="typefiles">
|
||||
<input type="radio" id="typefiles" name="type" value="files"<?php
|
||||
echo "files" == $currentStorage["type"] ? ' checked="checked"' : ""
|
||||
?> />
|
||||
fichiers
|
||||
</label>
|
||||
<label for="typedb" style="margin-left: 40px;">
|
||||
<input type="radio" id="typedb" name="type" value="db"<?php
|
||||
echo "db" == $currentStorage["type"] ? ' checked="checked"' : ""
|
||||
?> />
|
||||
base de données MySQL
|
||||
</label>
|
||||
<?php if (!empty($errors["type"])) : ?>
|
||||
<p class="error"><?php echo $errors["type"]; ?></p>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt class="storage-db-options"><label for="options-host">Adresse du serveur</label></dt>
|
||||
<dd class="storage-db-options">
|
||||
<input type="text" id="options-host" name="options[host]" value="<?php
|
||||
echo isset($currentStorage["options"]["host"]) ? htmlspecialchars($currentStorage["options"]["host"]) : "localhost"
|
||||
?>" />
|
||||
<?php if (!empty($errors["host"])) : ?>
|
||||
<p class="error"><?php echo $errors["host"]; ?></p>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt class="storage-db-options"><label for="options-user">Utilisateur</label></dt>
|
||||
<dd class="storage-db-options">
|
||||
<input type="text" id="options-user" name="options[user]" value="<?php
|
||||
echo isset($currentStorage["options"]["user"]) ? htmlspecialchars($currentStorage["options"]["user"]) : ""
|
||||
?>" />
|
||||
<?php if (!empty($errors["user"])) : ?>
|
||||
<p class="error"><?php echo $errors["user"]; ?></p>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt class="storage-db-options"><label for="options-password">Mot de passe</label></dt>
|
||||
<dd class="storage-db-options">
|
||||
<input type="password" id="options-password" name="options[password]" value="<?php
|
||||
echo isset($currentStorage["options"]["password"]) ? htmlspecialchars($currentStorage["options"]["password"]) : ""
|
||||
?>" />
|
||||
<?php if (!empty($errors["password"])) : ?>
|
||||
<p class="error"><?php echo $errors["password"]; ?></p>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt class="storage-db-options"><label for="options-base">Nom de la base de données</label></dt>
|
||||
<dd class="storage-db-options">
|
||||
<input type="text" id="options-base" name="options[dbname]" value="<?php
|
||||
echo isset($currentStorage["options"]["dbname"]) ? htmlspecialchars($currentStorage["options"]["dbname"]) : ""
|
||||
?>" />
|
||||
<?php if (!empty($errors["dbname"])) : ?>
|
||||
<p class="error"><?php echo $errors["dbname"]; ?></p>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<?php if (is_dir(DOCUMENT_ROOT."/var/configs") && 2 < count(scandir(DOCUMENT_ROOT."/var/configs"))) : ?>
|
||||
<dt class="storage-db-options">
|
||||
<label for="importtodb"><input type="checkbox" id="importtodb" name="importtodb" value="1"<?php
|
||||
echo isset($_POST["importtodb"]) ? ' checked="checked"' : ""
|
||||
?>" /> importer les données existantes dans la base de données.</label>
|
||||
<?php if (!empty($errors["dbname"])) : ?>
|
||||
<p class="error"><?php echo $errors["dbname"]; ?></p>
|
||||
<?php endif; ?>
|
||||
</dt>
|
||||
<?php endif; ?>
|
||||
</dl>
|
||||
<p><input type="submit" value="Enregistrer" /></p>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
if (document.querySelectorAll) {
|
||||
var elements = document.querySelectorAll(".storage-db-options");
|
||||
var buttons = document.querySelectorAll("input[name=type]");
|
||||
var fnCheck = function () {
|
||||
var display = document.querySelector("input[value=db]").checked ? "block" : "none";
|
||||
for (var i = 0; i < elements.length; i++) {
|
||||
elements[i].style.display = display;
|
||||
}
|
||||
};
|
||||
for (var j = 0; j < buttons.length; j++) {
|
||||
buttons[j].addEventListener("change", fnCheck);
|
||||
}
|
||||
fnCheck();
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
54
sources/app/admin/views/upgrade.phtml
Normal file
54
sources/app/admin/views/upgrade.phtml
Normal file
@ -0,0 +1,54 @@
|
||||
<?php if (!empty($errors)) : ?>
|
||||
<p class="error">
|
||||
<?php echo implode("<br />", $errors); ?>
|
||||
</p>
|
||||
<br />
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($upgradeStarted || $upgradeAvailable) : ?>
|
||||
<p>
|
||||
<strong><span style="color: #EF0000;">ATTENTION :</span>
|
||||
avant de lancer la mise à jour automatique,
|
||||
merci d'effectuer une sauvegarde de vos données actuelles.</strong>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($upgradeStarted) : ?>
|
||||
|
||||
<form action="" method="post">
|
||||
<p>
|
||||
Cliquer sur "Mettre à jour" afin de terminer la mise à jour.
|
||||
</p>
|
||||
<p>
|
||||
<input type="hidden" name="upgrade" value="1" />
|
||||
<input type="submit" value="Mettre à jour" />
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<?php elseif ($upgradeAvailable) : ?>
|
||||
<h2>Une mise à jour est disponible</h2>
|
||||
<p>
|
||||
Vous utilisez actuellement la version <strong><?php echo APPLICATION_VERSION; ?></strong>.
|
||||
La version <strong><?php echo $lastVersion; ?></strong> est disponible.
|
||||
</p>
|
||||
<?php if ($allow_update) : ?>
|
||||
<form action="" method="post">
|
||||
<p>
|
||||
<input type="hidden" name="upgrade" value="1" />
|
||||
<input type="submit" value="Mettre à jour" />
|
||||
</p>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php else : ?>
|
||||
<p><strong>Vous utilisez déjà la dernière version.</strong></p>
|
||||
<form action="" method="post">
|
||||
<p>
|
||||
Dernière vérification effectuée le <?php echo date("d/m/Y à H:i", $_SESSION["lbcLastVersionTime"]); ?>
|
||||
</p>
|
||||
<p>
|
||||
<input type="hidden" name="checkVersion" value="1" />
|
||||
<input type="submit" value="Vérifier à nouveau" />
|
||||
</p>
|
||||
</form>
|
||||
<?php endif; ?>
|
23
sources/app/admin/views/users.phtml
Normal file
23
sources/app/admin/views/users.phtml
Normal file
@ -0,0 +1,23 @@
|
||||
<p><a href="?mod=admin&a=add-user">Nouvel utilisateur</a></p>
|
||||
<table style="width: 500px; text-align: left;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nom d'utilisateur</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($users AS $user) : ?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($user->getUsername()); ?></td>
|
||||
<td>
|
||||
<?php if ($user->getUsername() != "admin") : ?>
|
||||
<a href="?mod=admin&a=delete-user&username=<?php echo urlencode($user->getUsername()); ?>">supprimer</a>
|
||||
<?php else: ?>
|
||||
-
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
Reference in New Issue
Block a user