Merge branch 'master' into chrono-privacy

This commit is contained in:
El RIDO
2024-05-05 10:25:31 +02:00
64 changed files with 949 additions and 216 deletions
+1 -1
View File
@@ -241,7 +241,7 @@ class Configuration
// ensure the basepath ends in a slash, if one is set
if (
strlen($this->_configuration['main']['basepath']) &&
!empty($this->_configuration['main']['basepath']) &&
substr_compare($this->_configuration['main']['basepath'], '/', -1) !== 0
) {
$this->_configuration['main']['basepath'] .= '/';
+5 -5
View File
@@ -178,7 +178,7 @@ class Controller
// force default language, if language selection is disabled and a default is set
if (!$this->_conf->getKey('languageselection') && strlen($lang) == 2) {
$_COOKIE['lang'] = $lang;
setcookie('lang', $lang, 0, '', '', true);
setcookie('lang', $lang, array('SameSite' => 'Lax', 'Secure' => true));
}
}
@@ -320,10 +320,10 @@ class Controller
$this->_error = $e->getMessage();
}
if ($this->_request->isJsonApiCall()) {
if (strlen($this->_error)) {
$this->_return_message(1, $this->_error);
} else {
if (empty($this->_error)) {
$this->_return_message(0, $dataid);
} else {
$this->_return_message(1, $this->_error);
}
}
}
@@ -389,7 +389,7 @@ class Controller
$languageselection = '';
if ($this->_conf->getKey('languageselection')) {
$languageselection = I18n::getLanguage();
setcookie('lang', $languageselection, 0, '', '', true);
setcookie('lang', $languageselection, array('SameSite' => 'Lax', 'Secure' => true));
}
// strip policies that are unsupported in meta tag
+1 -1
View File
@@ -56,7 +56,7 @@ class ServerSalt extends AbstractPersistence
*/
public static function get()
{
if (strlen(self::$_salt)) {
if (!empty(self::$_salt)) {
return self::$_salt;
}
+1 -1
View File
@@ -50,7 +50,7 @@ class View
*/
public function draw($template)
{
$file = substr($template, 0, 9) === 'bootstrap' ? 'bootstrap' : $template;
$file = substr($template, 0, 10) === 'bootstrap-' ? 'bootstrap' : $template;
$path = PATH . 'tpl' . DIRECTORY_SEPARATOR . $file . '.php';
if (!file_exists($path)) {
throw new Exception('Template ' . $template . ' not found!', 80);
+10 -10
View File
@@ -109,9 +109,9 @@ class Vizhash16x16
for ($i = 0; $i < 7; ++$i) {
$action = $this->getInt();
$color = imagecolorallocate($image, $r, $g, $b);
$r = $r0 = ($r0 + $this->getInt() / 25) % 256;
$g = $g0 = ($g0 + $this->getInt() / 25) % 256;
$b = $b0 = ($b0 + $this->getInt() / 25) % 256;
$r = $r0 = ((int) $r0 + $this->getInt() / 25) % 256;
$g = $g0 = ((int) $g0 + $this->getInt() / 25) % 256;
$b = $b0 = ((int) $b0 + $this->getInt() / 25) % 256;
$this->drawshape($image, $action, $color);
}
@@ -136,7 +136,7 @@ class Vizhash16x16
{
$v = $this->VALUES[$this->VALUES_INDEX];
++$this->VALUES_INDEX;
$this->VALUES_INDEX %= count($this->VALUES); // Warp around the array
$this->VALUES_INDEX %= count($this->VALUES); // Wrap around the array
return $v;
}
@@ -148,7 +148,7 @@ class Vizhash16x16
*/
private function getX()
{
return $this->width * $this->getInt() / 256;
return (int) $this->width * $this->getInt() / 256;
}
/**
@@ -159,7 +159,7 @@ class Vizhash16x16
*/
private function getY()
{
return $this->height * $this->getInt() / 256;
return (int) $this->height * $this->getInt() / 256;
}
/**
@@ -190,9 +190,9 @@ class Vizhash16x16
($color2[2] - $color1[2]) / $size,
);
for ($i = 0; $i < $size; ++$i) {
$r = $color1[0] + ($diffs[0] * $i);
$g = $color1[1] + ($diffs[1] * $i);
$b = $color1[2] + ($diffs[2] * $i);
$r = $color1[0] + ((int) $diffs[0] * $i);
$g = $color1[1] + ((int) $diffs[1] * $i);
$b = $color1[2] + ((int) $diffs[2] * $i);
if ($direction == 'h') {
imageline($img, $i, 0, $i, $sizeinv, imagecolorallocate($img, $r, $g, $b));
} else {
@@ -222,7 +222,7 @@ class Vizhash16x16
break;
case 3:
$points = array($this->getX(), $this->getY(), $this->getX(), $this->getY(), $this->getX(), $this->getY(), $this->getX(), $this->getY());
imagefilledpolygon($image, $points, 4, $color);
version_compare(PHP_VERSION, '8.1', '<') ? imagefilledpolygon($image, $points, 4, $color) : imagefilledpolygon($image, $points, $color);
break;
default:
$start = $this->getInt() * 360 / 256;