aboutsummaryrefslogtreecommitdiff
path: root/app/Models
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2015-01-06 20:50:58 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2015-01-06 20:50:58 +0100
commit5f9672111f86c693d843138c00934a6c3eeede45 (patch)
tree4aa58d52cb0650c482820db6d3be6606bfa5c163 /app/Models
parentd3a93ea2905ae50a2365d293f9f3ef3e51bf5f30 (diff)
Fix last calls to Minz_Configuration methods
- We have still to fix actualize_script and greader api (refactoring?) - We have to fix the FreshRSS_Configuration calls - We have to fix availableLanguages calls See https://github.com/FreshRSS/FreshRSS/issues/730
Diffstat (limited to 'app/Models')
-rw-r--r--app/Models/Auth.php14
-rw-r--r--app/Models/EntryDAO.php2
-rw-r--r--app/Models/UserDAO.php4
3 files changed, 15 insertions, 5 deletions
diff --git a/app/Models/Auth.php b/app/Models/Auth.php
index 05ec61d0e..917e151ca 100644
--- a/app/Models/Auth.php
+++ b/app/Models/Auth.php
@@ -158,7 +158,16 @@ class FreshRSS_Auth {
/**
* Return if authentication is enabled on this instance of FRSS.
*/
- public static function accessNeedLogin() {
+ public static function accessNeedsLogin() {
+ $conf = Minz_Configuration::get('system');
+ $auth_type = $conf->auth_type;
+ return $auth_type !== 'none';
+ }
+
+ /**
+ * Return if authentication requires a PHP action.
+ */
+ public static function accessNeedsAction() {
$conf = Minz_Configuration::get('system');
$auth_type = $conf->auth_type;
return $auth_type === 'form' || $auth_type === 'persona';
@@ -206,7 +215,8 @@ class FreshRSS_FormAuth {
public static function makeCookie($username, $password_hash) {
do {
- $token = sha1(Minz_Configuration::salt() . $username . uniqid(mt_rand(), true));
+ $conf = Minz_Configuration::get('system');
+ $token = sha1($conf->salt . $username . uniqid(mt_rand(), true));
$token_file = DATA_PATH . '/tokens/' . $token . '.txt';
} while (file_exists($token_file));
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php
index 4d06ac028..61beeea13 100644
--- a/app/Models/EntryDAO.php
+++ b/app/Models/EntryDAO.php
@@ -586,7 +586,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
}
public function size($all = false) {
- $db = Minz_Configuration::dataBase();
+ $db = FreshRSS_Context::$system_conf->db;
$sql = 'SELECT SUM(data_length + index_length) FROM information_schema.TABLES WHERE table_schema=?'; //MySQL
$values = array($db['base']);
if (!$all) {
diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php
index 6514080bc..b55766ab4 100644
--- a/app/Models/UserDAO.php
+++ b/app/Models/UserDAO.php
@@ -2,7 +2,7 @@
class FreshRSS_UserDAO extends Minz_ModelPdo {
public function createUser($username) {
- $db = Minz_Configuration::dataBase();
+ $db = FreshRSS_Context::$system_conf->db;
require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php');
$userPDO = new Minz_ModelPdo($username);
@@ -34,7 +34,7 @@ class FreshRSS_UserDAO extends Minz_ModelPdo {
}
public function deleteUser($username) {
- $db = Minz_Configuration::dataBase();
+ $db = FreshRSS_Context::$system_conf->db;
require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php');
if ($db['type'] === 'sqlite') {