Compare commits
No commits in common. "a272d50174a829d407d178b246be1c7ae31066c6" and "c245bbb3be4a2251959b62cfe610f594bd771862" have entirely different histories.
a272d50174
...
c245bbb3be
|
@ -13,9 +13,10 @@ function connectDB($config, $database = '', $dbFile = '', $platformId = '') {
|
|||
'type' => 'sqlite',
|
||||
'dbFile' => $dbFile,
|
||||
]);
|
||||
return ['db' => $db, 'error' => null];
|
||||
} catch (Exception $e) {
|
||||
return ['db' => null, 'error' => getError('Error connecting to DB.', $e->getMessage())];
|
||||
$error = getError('Error connecting to DB.', $e->getMessage());
|
||||
include '../app/templates/block-message.php';
|
||||
exit();
|
||||
}
|
||||
|
||||
// connecting to a jilo-web database of the web app
|
||||
|
@ -29,9 +30,10 @@ function connectDB($config, $database = '', $dbFile = '', $platformId = '') {
|
|||
'dbFile' => $config['db']['sqlite_file'],
|
||||
]);
|
||||
$pdo = $db->getConnection();
|
||||
return ['db' => $db, 'error' => null];
|
||||
} catch (Exception $e) {
|
||||
return ['db' => null, 'error' => getError('Error connecting to DB.', $e->getMessage())];
|
||||
$error = getError('Error connecting to DB.', $e->getMessage());
|
||||
include '../app/templates/block-message.php';
|
||||
exit();
|
||||
}
|
||||
// mysql/mariadb database
|
||||
} elseif ($config['db']['db_type'] === 'mysql' || $config['db']['db_type'] === 'mariadb') {
|
||||
|
@ -45,9 +47,10 @@ function connectDB($config, $database = '', $dbFile = '', $platformId = '') {
|
|||
'password' => $config['db']['sql_password'],
|
||||
]);
|
||||
$pdo = $db->getConnection();
|
||||
return ['db' => $db, 'error' => null];
|
||||
} catch (Exception $e) {
|
||||
return ['db' => null, 'error' => getError('Error connecting to DB.', $e->getMessage())];
|
||||
$error = getError('Error connecting to DB.', $e->getMessage());
|
||||
include '../app/templates/block-message.php';
|
||||
exit();
|
||||
}
|
||||
// unknown database
|
||||
} else {
|
||||
|
@ -58,5 +61,6 @@ function connectDB($config, $database = '', $dbFile = '', $platformId = '') {
|
|||
|
||||
}
|
||||
|
||||
return $db;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -4,13 +4,8 @@ require '../app/classes/conference.php';
|
|||
require '../app/classes/participant.php';
|
||||
|
||||
// connect to database
|
||||
$response = connectDB($config, 'jilo', $platformDetails[0]['jilo_database'], $platform_id);
|
||||
if ($response['db'] === null) {
|
||||
$error = $response['error'];
|
||||
include '../app/templates/block-message.php';
|
||||
} else {
|
||||
$db = $response['db'];
|
||||
}
|
||||
$db = connectDB($config, 'jilo', $platformDetails[0]['jilo_database'], $platform_id);
|
||||
|
||||
|
||||
//
|
||||
// dashboard widget listings
|
||||
|
|
|
@ -1,24 +1,13 @@
|
|||
<?php
|
||||
|
||||
// 'error' for errors
|
||||
// 'notice' for all non-critical messages
|
||||
if (isset($_SESSION['error'])) {
|
||||
echo "\t\t" . '<div class="error">' . $_SESSION['error'] . '</div>';
|
||||
}
|
||||
|
||||
// 'notice' for all non-critical messages
|
||||
if (isset($_SESSION['notice'])) {
|
||||
echo "\t\t" . '<div class="notice">' . $_SESSION['notice'] . '</div>';
|
||||
}
|
||||
|
||||
// 'error' for errors
|
||||
if (isset($error)) {
|
||||
echo "\t\t" . '<div class="error">' . $error . '</div>';
|
||||
}
|
||||
|
||||
// 'notice' for all non-critical messages
|
||||
if (isset($_SESSION['notice'])) {
|
||||
echo "\t\t" . '<div class="notice">' . $_SESSION['notice'] . '</div>';
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue