summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-03-02 22:57:02 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-03-02 22:57:02 +0100
commit9c012e6c81e435736bfef78e0669cd236ed9d73b (patch)
tree0130fec1fb948d9910fab11aa51a8a115cc58461
parentc67180530be4f322267cbd50934a96dfab5fc8f3 (diff)
Fix SQLite CLI install
https://github.com/FreshRSS/FreshRSS/issues/1445 https://github.com/FreshRSS/FreshRSS/issues/1443 https://github.com/FreshRSS/FreshRSS/issues/1443
-rw-r--r--app/Controllers/userController.php7
-rw-r--r--lib/lib_rss.php9
2 files changed, 7 insertions, 9 deletions
diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php
index 593e24cf2..f910cecd9 100644
--- a/app/Controllers/userController.php
+++ b/app/Controllers/userController.php
@@ -115,6 +115,7 @@ class FreshRSS_user_Controller extends Minz_ActionController {
}
$ok = self::checkUsername($new_user_name);
+ $homeDir = join_path(DATA_PATH, 'users', $new_user_name);
if ($ok) {
$languages = Minz_Translate::availableLanguages();
@@ -124,7 +125,7 @@ class FreshRSS_user_Controller extends Minz_ActionController {
$ok &= !in_array(strtoupper($new_user_name), array_map('strtoupper', listUsers())); //Not an existing user, case-insensitive
- $configPath = join_path(DATA_PATH, 'users', $new_user_name, 'config.php');
+ $configPath = join_path($homeDir, 'config.php');
$ok &= !file_exists($configPath);
}
if ($ok) {
@@ -141,7 +142,9 @@ class FreshRSS_user_Controller extends Minz_ActionController {
}
}
if ($ok) {
- mkdir(join_path(DATA_PATH, 'users', $new_user_name));
+ if (!is_dir($homeDir)) {
+ mkdir($homeDir);
+ }
$userConfig['passwordHash'] = $passwordHash;
$userConfig['apiPasswordHash'] = $apiPasswordHash;
$ok &= (file_put_contents($configPath, "<?php\n return " . var_export($userConfig, true) . ';') !== false);
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index aaeeb431f..2d593b6a2 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -295,17 +295,12 @@ function invalidateHttpCache($username = '') {
function listUsers() {
$final_list = array();
$base_path = join_path(DATA_PATH, 'users');
- $dir_list = array_values(array_diff(
- scandir($base_path),
- array('..', '.', '_')
- ));
-
+ $dir_list = scandir($base_path);
foreach ($dir_list as $file) {
- if (is_dir(join_path($base_path, $file))) {
+ if ($file[0] !== '.' && is_dir(join_path($base_path, $file)) && file_exists(join_path($base_path, $file, 'config.php'))) {
$final_list[] = $file;
}
}
-
return $final_list;
}