A free, self-hostable news aggregator…
Show more information about user when selected
Marien Fressinaudd4ad951b9b68
diff --git a/app/Controllers/userController.php b/app/Controllers/userController.phpindex 00b51cc3d..4a04737f2 100644--- a/app/Controllers/userController.php+++ b/app/Controllers/userController.php@@ -87,11 +87,24 @@ class FreshRSS_user_Controller extends Minz_ActionController {* This action displays the user management page.*/public function manageAction() {+ if (!FreshRSS_Auth::hasAccess('admin')) {+ Minz_Error::error(403,+ array('error' => array(_t('access_denied'))));+ }+Minz_View::prependTitle(_t('users.manage') . ' · ');- $this->view->current_user = Minz_Request::param(- 'u', Minz_Session::param('currentUser', '_')- );+ $userDAO = new FreshRSS_UserDAO();++ $username = Minz_Request::param('u', Minz_Session::param('currentUser'));+ if (!$userDAO->exist($username)) {+ $username = Minz_Session::param('currentUser');+ }+ $this->view->current_user = $username;++ $entryDAO = FreshRSS_Factory::createEntryDao($this->view->current_user);+ $this->view->nb_articles = $entryDAO->count();+ $this->view->size_user = $entryDAO->size();}public function createAction() {diff --git a/app/Models/Factory.php b/app/Models/Factory.phpindex 08569b2e2..93f4552f7 100644--- a/app/Models/Factory.php+++ b/app/Models/Factory.php@@ -2,30 +2,30 @@class FreshRSS_Factory {- public static function createFeedDao() {+ public static function createFeedDao($username = null) {$db = Minz_Configuration::dataBase();if ($db['type'] === 'sqlite') {- return new FreshRSS_FeedDAOSQLite();+ return new FreshRSS_FeedDAOSQLite($username);} else {- return new FreshRSS_FeedDAO();+ return new FreshRSS_FeedDAO($username);}}- public static function createEntryDao() {+ public static function createEntryDao($username = null) {$db = Minz_Configuration::dataBase();if ($db['type'] === 'sqlite') {- return new FreshRSS_EntryDAOSQLite();+ return new FreshRSS_EntryDAOSQLite($username);} else {- return new FreshRSS_EntryDAO();+ return new FreshRSS_EntryDAO($username);}}- public static function createStatsDAO() {+ public static function createStatsDAO($username = null) {$db = Minz_Configuration::dataBase();if ($db['type'] === 'sqlite') {- return new FreshRSS_StatsDAOSQLite();+ return new FreshRSS_StatsDAOSQLite($username);} else {- return new FreshRSS_StatsDAO();+ return new FreshRSS_StatsDAO($username);}}diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.phpindex 15215258c..85b45c4a7 100644--- a/app/Models/UserDAO.php+++ b/app/Models/UserDAO.php@@ -53,4 +53,8 @@ class FreshRSS_UserDAO extends Minz_ModelPdo {}}}++ public function exist($username) {+ return file_exists(DATA_PATH . '/' . $username . '_user.php');+ }}diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtmlindex adbfdb77e..8f424c126 100644--- a/app/views/configure/archiving.phtml+++ b/app/views/configure/archiving.phtml@@ -60,7 +60,7 @@<div class="form-group"><p class="group-name"><?php echo _t('current_user'); ?></p><div class="group-controls">- <p><?php echo formatNumber($this->nb_total), ' ', _t('articles'), ', ', formatBytes($this->size_user); ?></p>+ <p><?php echo _t('articles', formatNumber($this->nb_total)), ' — ', formatBytes($this->size_user); ?></p><input type="hidden" name="optimiseDatabase" value="1" /><button type="submit" class="btn btn-important"><?php echo _t('optimize_bdd'); ?></button><?php echo _i('help'); ?> <?php echo _t('optimize_todo_sometimes'); ?>diff --git a/app/views/user/manage.phtml b/app/views/user/manage.phtmlindex fb569872b..65e60add5 100644--- a/app/views/user/manage.phtml+++ b/app/views/user/manage.phtml@@ -63,6 +63,8 @@<option data-url="<?php echo _url('user', 'manage', 'u', $username); ?>" <?php echo $this->current_user === $username ? 'selected="selected"' : ''; ?> value="<?php echo $username; ?>"><?php echo $username; ?></option><?php } ?></select>++ <p><?php echo _t('articles', formatNumber($this->nb_articles)), ', ', formatBytes($this->size_user); ?></p></div></div>