Shared access to the database for GrimaUser and GrimaInstitution.
More...
Shared access to the database for GrimaUser and GrimaInstitution.
Definition at line 3896 of file grima-lib.php.
◆ getDb()
| static GrimaDB::getDb |
( |
|
) |
|
|
staticprotected |
Definition at line 3919 of file grima-lib.php.
References getenvWithFileFallbackAndDefault(), and tableExists().
3925 if ($db_user && $db_pass) {
3926 self::$db =
new PDO($db_url, $db_user, $db_pass);
3928 self::$db =
new PDO($db_url);
3931 self::$db->exec(
"CREATE TABLE institutions ( institution VARCHAR(100) PRIMARY KEY, apikey VARCHAR(100), server VARCHAR(100) )");
3934 self::$db->exec(
"CREATE TABLE users ( institution VARCHAR(100), username VARCHAR(100), password VARCHAR(255), isAdmin INTEGER )");
3936 }
catch (Exception $e) {
3937 self::$db =
'stateless';
tableExists($pdo, $table)
getenvWithFileFallbackAndDefault( $env_name, $default=false)
◆ getInstitutions()
| static GrimaDB::getInstitutions |
( |
|
) |
|
|
static |
Definition at line 3947 of file grima-lib.php.
Referenced by GrimaFormField\__construct().
3950 $db = self::getDb();
3951 $result =
$db->query(
'SELECT institution FROM institutions' );
3952 foreach( $result as $row ) {
3953 $ret[] = $row[
'institution'];
3955 }
catch (Exception $e) {
◆ getIterator()
Definition at line 3976 of file grima-lib.php.
3977 return new ArrayIterator($this->info);
◆ getPasswordAlgorithm()
| GrimaDB::getPasswordAlgorithm |
( |
|
) |
|
|
protected |
Definition at line 3943 of file grima-lib.php.
3944 return defined(
"PASSWORD_ARGON2I") ? constant(
"PASSWORD_ARGON2I") : PASSWORD_DEFAULT;
◆ init()
◆ isEmpty()
| static GrimaDB::isEmpty |
( |
|
) |
|
|
static |
Definition at line 3905 of file grima-lib.php.
3906 $db = self::getDb();
3907 $result =
$db->query(
'SELECT COUNT(*) as c FROM institutions' );
3908 foreach( $result as $row ) {
3909 if ($row[
'c']>0)
return false;
◆ isStateless()
| static GrimaDB::isStateless |
( |
|
) |
|
|
static |
◆ offsetExists()
| GrimaDB::offsetExists |
( |
|
$offset |
) |
|
Definition at line 3960 of file grima-lib.php.
3961 return isset($this->info[$offset]);
◆ offsetGet()
| GrimaDB::offsetGet |
( |
|
$offset |
) |
|
Definition at line 3964 of file grima-lib.php.
3965 return isset($this->info[$offset]) ? $this->info[$offset] :
'';
◆ offsetSet()
| GrimaDB::offsetSet |
( |
|
$offset, |
|
|
|
$value |
|
) |
|
|
◆ offsetUnset()
| GrimaDB::offsetUnset |
( |
|
$offset |
) |
|
◆ $db
◆ $info
The documentation for this class was generated from the following file: