3 Commits

Author SHA1 Message Date
da5d7ffa53 🚧 Migrate from Sentry to GlitchTip (#129)
Signed-off-by: Luke Tainton <luke@tainton.uk>
2020-08-18 20:14:08 +01:00
02c397bca2 Add Sentry (#127)
Signed-off-by: Luke Tainton <luke@tainton.uk>
2020-08-18 18:32:29 +01:00
a4ae987f94 Move break rule in footer (#124)
* Update footer.php

* Change line break to pipe

* Remove full stop

Co-authored-by: Alexander Davis <alex@adcm.uk>
2020-08-18 17:58:07 +01:00
6 changed files with 1823 additions and 29 deletions

View File

@@ -13,3 +13,5 @@ OIDC_HOST = ""
OIDC_CLIENT_ID = ""
OIDC_CLIENT_SECRET = ""
OIDC_DISABLE_SSL = ""
SENTRY_ENVIRONMENT = ""

View File

@@ -2,6 +2,7 @@
"require": {
"ramsey/uuid": "^4.0",
"vlucas/phpdotenv": "^5.0",
"jumbojett/openid-connect-php": "^0.9.0"
"jumbojett/openid-connect-php": "^0.9.0",
"sentry/sdk": "^2.1"
}
}

1785
app/composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,25 @@
return $version;
}
function oidc_set_vars($sub, $uid, $fname, $lname, $email)
{
$_SESSION['uuid'] = $sub;
$_SESSION['username'] = $uid;
$_SESSION['given_name'] = $fname;
$_SESSION['family_name'] = $lname;
$_SESSION['full_name'] = $fname . " " . $lname;
$_SESSION['email'] = $email;
}
function is_signed_in()
{
if (isset($_SESSION['is_signed_in'])) {
return true;
} else {
return false;
}
}
function user_exists($db, $uuid)
{
try {
@@ -15,7 +34,7 @@
$sql->setFetchMode(PDO::FETCH_ASSOC);
$result = $sql->fetchAll();
} catch (PDOException $e) {
$alert = array("danger", "Error during check for user record: " . $e->getMessage());
throw new Exception("Error in user_exists(): " . $e->getMessage());
die();
}
if (empty($result)) {
@@ -34,7 +53,8 @@
$sql->setFetchMode(PDO::FETCH_ASSOC);
$result = $sql->fetchAll();
} catch (PDOException $e) {
echo("Error: " . $e->getMessage());
throw new Exception("Error in get_all_users(): " . $e->getMessage());
die();
}
return $result;
}
@@ -50,7 +70,8 @@
$result = $sql->fetchAll();
$usr = $result[0]['given_name'] . " " . $result[0]['family_name'];
} catch (PDOException $e) {
echo("Error: " . $e->getMessage());
throw new Exception("Error in get_user_name(): " . $e->getMessage());
die();
}
return $usr;
}

View File

@@ -1,9 +1,9 @@
<footer class="footer mt-auto py-3">
<div class="text-center text-muted">
<?php
echo($_ENV['APP_NAME'] . " " . get_version() . "<br>");
echo($_ENV['APP_NAME'] . " " . get_version());
if ($_ENV['APP_NAME'] != "FHeD") {
echo("Powered by FHeD.");
echo("| Powered by FHeD");
};
?><br>
<?php if (is_signed_in()) {

View File

@@ -7,6 +7,15 @@ require_once __DIR__ . "/../vendor/autoload.php";
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . "/..");
$dotenv->load();
// Custom functions
require_once __DIR__ . "/app_functions.php";
// Sentry
Sentry\init([
'dsn' => 'https://7c4607ed5e804d08926cc0bbc0d3fbe9@app.glitchtip.com/59',
'release' => get_version(),
]);
// Database auto-generation
if (file_exists("/../includes/install.php")) {
return;
@@ -34,25 +43,3 @@ if ($_ENV['OIDC_DISABLE_SSL'] == "true") {
$oidc->setVerifyHost(false);
$oidc->setVerifyPeer(false);
}
// Custom functions
require_once __DIR__ . "/app_functions.php";
function oidc_set_vars($sub, $uid, $fname, $lname, $email) {
$_SESSION['uuid'] = $sub;
$_SESSION['username'] = $uid;
$_SESSION['given_name'] = $fname;
$_SESSION['family_name'] = $lname;
$_SESSION['full_name'] = $fname . " " . $lname;
$_SESSION['email'] = $email;
}
function is_signed_in() {
if (isset($_SESSION['is_signed_in'])) {
return true;
} else {
return false;
}
}