Skip to content

Commit afa5db0

Browse files
committed
Fix anon warnings, improve login check
1 parent 38d1c67 commit afa5db0

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

.sandstorm/sandstorm-pkgdef.capnp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ const pkgdef :Spk.PackageDefinition = (
1919

2020
appTitle = (defaultText = "XRF Books"),
2121

22-
appVersion = 2, # Increment this for every release.
22+
appVersion = 3, # Increment this for every release.
2323

24-
appMarketingVersion = (defaultText = "0.0.3"),
24+
appMarketingVersion = (defaultText = "0.0.4"),
2525
# Human-readable representation of appVersion. Should match the way you
2626
# identify versions of your app in documentation and marketing.
2727

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# 0.0.4
2+
3+
- Fixed error when adding a serial entry.
4+
- Fixed warnings for anonymous users.
5+
- Only update check in date for current check out.
6+
7+
# 0.0.3
8+
9+
- Include full path in the address bar.
10+
111
# 0.0.2
212

313
- Fix some encoding and performance bugs.

includes/global.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
$xrf_myusername = "";
1212
$xrf_myuclass = "";
1313
$xrf_myulevel = 1;
14+
$xrf_mystylepref = "";
1415

1516
$xrf_db = @mysqli_connect($xrf_dbserver, $xrf_dbusername, $xrf_dbpassword, $xrf_dbname) or die(mysqli_connect_error());
1617

@@ -32,7 +33,7 @@
3233

3334
xrf_check_auth_version($xrf_auth_version_page, $xrf_auth_version_db) or die("Unable to verify authentication version. Please report to the system administrator.");
3435

35-
$xrf_myemail = $_SERVER['HTTP_X_SANDSTORM_USER_ID'];
36+
$xrf_myemail = $_SERVER['HTTP_X_SANDSTORM_USER_ID'] ?? '';
3637
$xrf_myusername = urldecode($_SERVER['HTTP_X_SANDSTORM_USERNAME']);
3738
if (strpos($_SERVER['HTTP_X_SANDSTORM_PERMISSIONS'], "admin") !== false) { $xrf_myulevel = 4; }
3839
elseif (strpos($_SERVER['HTTP_X_SANDSTORM_PERMISSIONS'], "operate") !== false) { $xrf_myulevel = 3; }
@@ -41,7 +42,7 @@
4142
if (strpos($_SERVER['HTTP_X_SANDSTORM_PERMISSIONS'], "physicalbrowse") !== false) { $xrf_myuclass = $xrf_myuclass . "P"; if ($xrf_myulevel < 2) { $xrf_myulevel = 2; } }
4243
if (strpos($_SERVER['HTTP_X_SANDSTORM_PERMISSIONS'], "restrictedarea") !== false) { $xrf_myuclass = $xrf_myuclass . "R"; }
4344

44-
if ($xrf_myusername != "Anonymous User")
45+
if ($xrf_myusername != "Anonymous User" && $xrf_myemail != '')
4546
{
4647
$xrf_adduser_query=mysqli_prepare($xrf_db, "INSERT IGNORE INTO g_users (sandstormuserid, datereg) VALUES(?,now())") or die(mysqli_error($xrf_db));
4748
mysqli_stmt_bind_param($xrf_adduser_query,"s", $xrf_myemail);

includes/global_req_login.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
$xrf_myusername = "";
1212
$xrf_myuclass = "";
1313
$xrf_myulevel = 1;
14+
$xrf_mystylepref = "";
1415

1516
$xrf_db = @mysqli_connect($xrf_dbserver, $xrf_dbusername, $xrf_dbpassword, $xrf_dbname) or die(mysqli_connect_error());
1617

@@ -32,7 +33,7 @@
3233

3334
xrf_check_auth_version($xrf_auth_version_page, $xrf_auth_version_db) or die("Unable to verify authentication version. Please report to the system administrator.");
3435

35-
$xrf_myemail = $_SERVER['HTTP_X_SANDSTORM_USER_ID'];
36+
$xrf_myemail = $_SERVER['HTTP_X_SANDSTORM_USER_ID'] ?? '';
3637
$xrf_myusername = urldecode($_SERVER['HTTP_X_SANDSTORM_USERNAME']);
3738
if (strpos($_SERVER['HTTP_X_SANDSTORM_PERMISSIONS'], "admin") !== false) { $xrf_myulevel = 4; }
3839
elseif (strpos($_SERVER['HTTP_X_SANDSTORM_PERMISSIONS'], "operate") !== false) { $xrf_myulevel = 3; }
@@ -42,7 +43,7 @@
4243
if (strpos($_SERVER['HTTP_X_SANDSTORM_PERMISSIONS'], "restrictedarea") !== false) { $xrf_myuclass = $xrf_myuclass . "R"; }
4344

4445
// Ensure user is logged in
45-
if ($xrf_myusername == "Anonymous User")
46+
if ($xrf_myusername == "Anonymous User" || $xrf_myemail == '')
4647
{
4748
die("You are not logged in!");
4849
}

0 commit comments

Comments
 (0)