|
@@ -17,6 +17,8 @@ function serverError($msg) {
|
|
|
|
|
|
// For use in pages that first display a form and then process it
|
|
|
function switchToFormProcess($requireLogin = true) {
|
|
|
+ if (empty($_POST) AND $requireLogin AND !isset($_SESSION['username']))
|
|
|
+ echo '<p>Ce formulaire ne sera pas accepté car il faut <a class="auth" href="' . redirUrl('auth/login') . '">se connecter</a> avant.</p>';
|
|
|
if (empty($_POST))
|
|
|
closeHTML();
|
|
|
if ($requireLogin AND !isset($_SESSION['username']))
|
|
@@ -67,3 +69,10 @@ function displayIndex() { ?>
|
|
|
</dl>
|
|
|
<?php
|
|
|
}
|
|
|
+
|
|
|
+function redirUrl($pageId) {
|
|
|
+ $currentPath = '';
|
|
|
+ if (SERVICE !== '') $currentPath .= SERVICE . '/';
|
|
|
+ if (PAGE !== 'index') $currentPath .= PAGE;
|
|
|
+ return CONF['common']['prefix'] . "/$pageId?redir=$currentPath";
|
|
|
+}
|