Browse Source

Create fn/ directory

Miraty 3 years ago
parent
commit
fac61531dd
7 changed files with 30 additions and 28 deletions
  1. 6 28
      common/init.php
  2. 0 0
      fn/auth.php
  3. 24 0
      fn/common.php
  4. 0 0
      fn/dns.php
  5. 0 0
      fn/ht.php
  6. 0 0
      fn/ns.php
  7. 0 0
      fn/reg.php

+ 6 - 28
common/init.php

@@ -6,39 +6,17 @@ define("SERVICE", substr(dirname($_SERVER['PHP_SELF']), strlen(CONF['common']['p
 define("PAGE", basename($_SERVER['PHP_SELF'], '.php'));
 define("PAGE", basename($_SERVER['PHP_SELF'], '.php'));
 define("DB_PATH", CONF['common']['root_path'] . "/db/niver.db"); // Niver's SQLite database
 define("DB_PATH", CONF['common']['root_path'] . "/db/niver.db"); // Niver's SQLite database
 
 
+// Page titles definition
+require "pages.php";
+
+require CONF['common']['root_path'] . "/fn/common.php";
 // Service-specific functions and constants
 // Service-specific functions and constants
 if (SERVICE === "reg" OR SERVICE === "ns")
 if (SERVICE === "reg" OR SERVICE === "ns")
-	require CONF['common']['root_path'] . "/dns.php";
+	require CONF['common']['root_path'] . "/fn/dns.php";
 if (SERVICE !== "")
 if (SERVICE !== "")
-	require CONF['common']['root_path'] . "/" . SERVICE . ".php";
-
-// Page titles definition
-require "pages.php";
+	require CONF['common']['root_path'] . "/fn/" . SERVICE . ".php";
 
 
 function success($msg) {
 function success($msg) {
 	echo "<p><strong>Succès</strong> : <em>" . $msg . "</em></p>";
 	echo "<p><strong>Succès</strong> : <em>" . $msg . "</em></p>";
 	closeHTML();
 	closeHTML();
 }
 }
-
-// When the user requests something unexpected
-function userError($msg) {
-	http_response_code(403);
-	echo "<p><strong>Erreur utilisataire</strong> : <em>" . $msg . "</em></p>";
-	closeHTML();
-}
-
-// When the system did something unexpected
-function serverError($msg) {
-	http_response_code(500);
-	error_log("Niver internal error: " . strip_tags($msg));
-	echo "<p><strong>Server error</strong>: The server encountered an error: <em>" . $msg . "</em></p>";
-	closeHTML();
-}
-
-// For use in pages that first display a form and then process it
-function switchToFormProcess($requireLogin = true) {
-	if (empty($_POST))
-		closeHTML();
-	if ($requireLogin AND !isset($_SESSION['username']))
-		userError("Vous devez être connecté·e pour effectuer cette action.");
-}

+ 0 - 0
auth.php → fn/auth.php


+ 24 - 0
fn/common.php

@@ -0,0 +1,24 @@
+<?php
+
+// When the user requests something unexpected
+function userError($msg) {
+	http_response_code(403);
+	echo "<p><strong>Erreur utilisataire</strong> : <em>" . $msg . "</em></p>";
+	closeHTML();
+}
+
+// When the system did something unexpected
+function serverError($msg) {
+	http_response_code(500);
+	error_log("Niver internal error: " . strip_tags($msg));
+	echo "<p><strong>Server error</strong>: The server encountered an error: <em>" . $msg . "</em></p>";
+	closeHTML();
+}
+
+// For use in pages that first display a form and then process it
+function switchToFormProcess($requireLogin = true) {
+	if (empty($_POST))
+		closeHTML();
+	if ($requireLogin AND !isset($_SESSION['username']))
+		userError("Vous devez être connecté·e pour effectuer cette action.");
+}

+ 0 - 0
dns.php → fn/dns.php


+ 0 - 0
ht.php → fn/ht.php


+ 0 - 0
ns.php → fn/ns.php


+ 0 - 0
reg.php → fn/reg.php