Merge branch 'main' into issue-10
This commit is contained in:
@@ -7,6 +7,19 @@ require_once __DIR__ . "/../vendor/autoload.php";
|
||||
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . "/..");
|
||||
$dotenv->load();
|
||||
|
||||
// Database auto-generation
|
||||
if (file_exists("/../includes/install.php")) {
|
||||
return;
|
||||
add_action('run_db_populate')
|
||||
}
|
||||
|
||||
function run_db_populate() {
|
||||
// all my glorious one-time-magic.
|
||||
include( "/../includes/install.php" );
|
||||
// after all execution rename your file;
|
||||
rename( "/../includes/install.php", "/../includes/install-backup.php");
|
||||
}
|
||||
|
||||
// Session
|
||||
session_start();
|
||||
|
||||
@@ -22,6 +35,7 @@ if ($_ENV['OIDC_DISABLE_SSL'] == "true") {
|
||||
$oidc->setVerifyPeer(false);
|
||||
}
|
||||
|
||||
|
||||
// Custom functions
|
||||
function oidc_set_vars($sub, $uid, $fname, $lname, $email) {
|
||||
$_SESSION['uuid'] = $sub;
|
||||
@@ -40,14 +54,22 @@ function is_signed_in() {
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists("/../includes/install.php")) {
|
||||
return;
|
||||
add_action( 'run_db_populate')
|
||||
function create_alert($type, $msg) {
|
||||
$thisAlert = array($type, $msg);
|
||||
array_push($_SESSION['alerts'], $thisAlert);
|
||||
}
|
||||
|
||||
function run_db_populate() {
|
||||
// all my glorious one-time-magic.
|
||||
include( "/../includes/install.php" );
|
||||
// after all execution rename your file;
|
||||
rename( "/../includes/install.php", "/../includes/install-backup.php");
|
||||
function get_user_name($db, $user_uuid) {
|
||||
try {
|
||||
$stmt = "SELECT given_name, family_name FROM users WHERE uuid=:uuid";
|
||||
$sql = $db->prepare($stmt);
|
||||
$sql->bindParam(':uuid', $user_uuid);
|
||||
$sql->execute();
|
||||
$sql->setFetchMode(PDO::FETCH_ASSOC);
|
||||
$result = $sql->fetchAll();
|
||||
$usr = $result[0]['given_name'] . " " . $result[0]['family_name'];
|
||||
} catch (PDOException $e) {
|
||||
echo("Error: " . $e->getMessage());
|
||||
}
|
||||
return $usr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user