1.x Atlas -
+ i18n. See upgrade-from-1.0.txt for more details.
+ + PHP 8.1 stuff
1.0 Lykos - 2022-11-12
/**
* scientia
*
- * Copyright 2022 Johannes Keßler
+ * Copyright 2023 Johannes Keßler
*
* https://www.bananas-playground.net/projekt/scientia/
*
ini_set('error_reporting',-1); // E_ALL & E_STRICT
## check request
-$_urlToParse = filter_var($_SERVER['QUERY_STRING'],FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
+$_urlToParse = filter_var($_SERVER['QUERY_STRING'],FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW);
if(!empty($_urlToParse)) {
# see http://de2.php.net/manual/en/regexp.reference.unicode.php
if(preg_match('/[\p{C}\p{M}\p{Sc}\p{Sk}\p{So}\p{Zl}\p{Zp}]/u',$_urlToParse) === 1) {
&& isset(UPLOAD_SECRET[$payload['asl']])
) {
if(DEBUG) error_log("[DEBUG] Valid payload so far");
- if(!empty($payload['data'])) {
- $filteredData = filter_var($payload['data'],FILTER_SANITIZE_FULL_SPECIAL_CHARS);
- if(!empty($filteredData)) {
- if(DEBUG) error_log("[DEBUG] Validated payload");
- $_create = true;
- }
+ $filteredData = filter_var($payload['data'],FILTER_SANITIZE_FULL_SPECIAL_CHARS);
+ if(!empty($filteredData)) {
+ if(DEBUG) error_log("[DEBUG] Validated payload");
+ $_create = true;
}
}
}
exit();
}
-# database object
-$DB = false;
-
## DB connection
$DB = new mysqli(DB_HOST, DB_USERNAME,DB_PASSWORD, DB_NAME);
if ($DB->connect_errno) exit('Can not connect to MySQL Server');
require_once 'lib/entry.class.php';
$Entry = new Entry($DB);
$do = $Entry->create($filteredData);
-if($do !== false) {
+if(!empty($do)) {
$contentBody['message'] = date('/Y/m/d/').$do;
}
else {
header($contentType);
http_response_code($httpResponseCode);
echo json_encode($contentBody);
+$DB->close();
/**
* scientia
*
- * Copyright 2022 Johannes Keßler
+ * Copyright 2023 Johannes Keßler
*
* https://www.bananas-playground.net/projekt/scientia/
*
# i18n
$i18n = new I18n();
-# database object
-$DB = false;
-
## DB connection
$DB = new mysqli(DB_HOST, DB_USERNAME,DB_PASSWORD, DB_NAME);
if ($DB->connect_errno) exit('Can not connect to MySQL Server');
$_year = date('Y');
$_month = date('m');
$_day = date('d');
-$_id = false;
+$_id = '';
$_requestDateProvided = '';
$TemplateData = array();
/**
* scientia
*
- * Copyright 2022 Johannes Keßler
+ * Copyright 2023 Johannes Keßler
*
* https://www.bananas-playground.net/projekt/scientia/
*
/**
* @var string The lang code
*/
- private $_defaultLangToUse = 'en';
+ private string $_defaultLangToUse = 'en';
/**
* @var array The loaded lang information from the file
*/
- private $_langData = array();
+ private array $_langData = array();
/**
* i18n constructor.
}
return $ret;
}
-}
\ No newline at end of file
+}
/**
* scientia
*
- * Copyright 2022 Johannes Keßler
+ * Copyright 2023 Johannes Keßler
*
* https://www.bananas-playground.net/projekt/scientia/
*
* Decode a base64-encoded big-endian integer of up to 64 bits.
*
* @see https://www.jwz.org/base64-shortlinks/
- * @param int $id
- * @return false|int|string|string[]
+ * @param string $id
+ * @return int
*/
- static function b64sl_unpack_id(int $id) {
+ static function b64sl_unpack_id(string $id): int {
$id = str_replace ('-', '+', $id); // decode URL-unsafe "+" "/"
$id = str_replace ('_', '/', $id);
$id = base64_decode ($id);
* @param $key string
* @return mixed
*/
- static function ifset(array $array, string $key) {
+ static function ifset(array $array, string $key): mixed {
return isset($array[$key]) ? $array[$key] : false;
}
* a very simple HTTP_AUTH authentication.
* Needs FRONTEND_USERNAME and FRONTEND_PASSWORD defined
*/
- static function simpleAuth() {
+ static function simpleAuth(): void {
if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])
|| $_SERVER['PHP_AUTH_USER'] !== FRONTEND_USERNAME || $_SERVER['PHP_AUTH_PW'] !== FRONTEND_PASSWORD
) {
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="<?php echo PATH_WEBROOT; ?>/view/water.css">
- <style type=text/css>
+ <style>
body {
max-width: 90%;
}