aboutsummaryrefslogtreecommitdiff
path: root/app/Models
diff options
context:
space:
mode:
Diffstat (limited to 'app/Models')
-rw-r--r--app/Models/Auth.php34
-rw-r--r--app/Models/DatabaseDAO.php12
2 files changed, 27 insertions, 19 deletions
diff --git a/app/Models/Auth.php b/app/Models/Auth.php
index fcbf37fa3..77a244843 100644
--- a/app/Models/Auth.php
+++ b/app/Models/Auth.php
@@ -23,8 +23,10 @@ class FreshRSS_Auth {
if ($current_user === '') {
$conf = Minz_Configuration::get('system');
$current_user = $conf->default_user;
- Minz_Session::_param('currentUser', $current_user);
- Minz_Session::_param('csrf');
+ Minz_Session::_params([
+ 'currentUser' => $current_user,
+ 'csrf' => false,
+ ]);
}
if (self::$login_ok) {
@@ -55,9 +57,11 @@ class FreshRSS_Auth {
$current_user = '';
if (isset($credentials[1])) {
$current_user = trim($credentials[0]);
- Minz_Session::_param('currentUser', $current_user);
- Minz_Session::_param('passwordHash', trim($credentials[1]));
- Minz_Session::_param('csrf');
+ Minz_Session::_params([
+ 'currentUser' => $current_user,
+ 'passwordHash' => trim($credentials[1]),
+ 'csrf' => false,
+ ]);
}
return $current_user != '';
case 'http_auth':
@@ -79,8 +83,10 @@ class FreshRSS_Auth {
]);
}
if ($login_ok) {
- Minz_Session::_param('currentUser', $current_user);
- Minz_Session::_param('csrf');
+ Minz_Session::_params([
+ 'currentUser' => $current_user,
+ 'csrf' => false,
+ ]);
}
return $login_ok;
case 'none':
@@ -118,8 +124,10 @@ class FreshRSS_Auth {
self::$login_ok = false;
}
- Minz_Session::_param('loginOk', self::$login_ok);
- Minz_Session::_param('REMOTE_USER', httpAuthUser());
+ Minz_Session::_params([
+ 'loginOk' => self::$login_ok,
+ 'REMOTE_USER' => httpAuthUser(),
+ ]);
return self::$login_ok;
}
@@ -153,9 +161,11 @@ class FreshRSS_Auth {
*/
public static function removeAccess() {
self::$login_ok = false;
- Minz_Session::_param('loginOk');
- Minz_Session::_param('csrf');
- Minz_Session::_param('REMOTE_USER');
+ Minz_Session::_params([
+ 'loginOk' => false,
+ 'csrf' => false,
+ 'REMOTE_USER' => false,
+ ]);
$system_conf = Minz_Configuration::get('system');
$username = '';
diff --git a/app/Models/DatabaseDAO.php b/app/Models/DatabaseDAO.php
index 2e0ee25a0..9d762a615 100644
--- a/app/Models/DatabaseDAO.php
+++ b/app/Models/DatabaseDAO.php
@@ -20,11 +20,10 @@ class FreshRSS_DatabaseDAO extends Minz_ModelPdo {
try {
$sql = sprintf($SQL_CREATE_DB, empty($db['base']) ? '' : $db['base']);
- return $this->pdo->exec($sql) !== false;
+ return $this->pdo->exec($sql) === false ? 'Error during CREATE DATABASE' : '';
} catch (Exception $e) {
- $_SESSION['bd_error'] = $e->getMessage();
- syslog(LOG_DEBUG, __method__ . ' warning: ' . $e->getMessage());
- return false;
+ syslog(LOG_DEBUG, __method__ . ' notice: ' . $e->getMessage());
+ return $e->getMessage();
}
}
@@ -33,11 +32,10 @@ class FreshRSS_DatabaseDAO extends Minz_ModelPdo {
$sql = 'SELECT 1';
$stm = $this->pdo->query($sql);
$res = $stm->fetchAll(PDO::FETCH_COLUMN, 0);
- return $res != false;
+ return $res == false ? 'Error during SQL connection test!' : '';
} catch (Exception $e) {
- $_SESSION['bd_error'] = $e->getMessage();
syslog(LOG_DEBUG, __method__ . ' warning: ' . $e->getMessage());
- return false;
+ return $e->getMessage();
}
}