';
echo '' .
- '' . htmlspecialchars($l['file_name']) . '';
+ '' . jirafeau_escape($l['file_name']) . '';
echo ' | ';
- echo '' . $l['mime_type'] . ' | ';
+ echo '' . jirafeau_escape($l['mime_type']) . ' | ';
echo '' . jirafeau_human_size($l['file_size']) . ' | ';
echo '' . ($l['time'] == -1 ? 'â' : jirafeau_get_datetimefield($l['time'])) . ' | ';
echo '';
@@ -628,16 +628,19 @@ function jirafeau_admin_list($name, $file_hash, $link_hash)
'' .
'' .
'' .
' | ';
@@ -1243,3 +1246,34 @@ function jirafeau_replace_markers($content, $htmllinebreaks = false)
return $content;
}
+
+function jirafeau_escape($string)
+{
+ return htmlspecialchars($string, ENT_QUOTES);
+}
+
+function jirafeau_admin_session_start()
+{
+ $_SESSION['admin_auth'] = true;
+ $_SESSION['admin_csrf'] = md5(uniqid(mt_rand(), true));
+}
+
+function jirafeau_admin_session_end()
+{
+ $_SESSION = array();
+ session_destroy();
+}
+
+function jirafeau_admin_session_logged()
+{
+ return isset($_SESSION['admin_auth']) &&
+ isset($_SESSION['admin_csrf']) &&
+ isset($_POST['admin_csrf']) &&
+ $_SESSION['admin_auth'] === true &&
+ $_SESSION['admin_csrf'] === $_POST['admin_csrf'];
+}
+
+function jirafeau_admin_csrf_field()
+{
+ return "";
+}