summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Controller/User.php32
-rw-r--r--app/Locale/fr_FR/translations.php2
-rw-r--r--app/Model/ProjectPermission.php2
-rw-r--r--app/Template/user/edit.php (renamed from app/Template/user_edit.php)6
-rw-r--r--app/Template/user/external.php (renamed from app/Template/user_external.php)8
-rw-r--r--app/Template/user/index.php (renamed from app/Template/user_index.php)0
-rw-r--r--app/Template/user/last.php (renamed from app/Template/user_last.php)0
-rw-r--r--app/Template/user/layout.php (renamed from app/Template/user_layout.php)2
-rw-r--r--app/Template/user/login.php (renamed from app/Template/user_login.php)6
-rw-r--r--app/Template/user/new.php (renamed from app/Template/user_new.php)3
-rw-r--r--app/Template/user/notifications.php (renamed from app/Template/user_notifications.php)7
-rw-r--r--app/Template/user/password.php (renamed from app/Template/user_password.php)15
-rw-r--r--app/Template/user/remove.php13
-rw-r--r--app/Template/user/sessions.php (renamed from app/Template/user_sessions.php)2
-rw-r--r--app/Template/user/show.php (renamed from app/Template/user_show.php)0
-rw-r--r--app/Template/user/sidebar.php (renamed from app/Template/user_sidebar.php)2
-rw-r--r--app/Template/user_remove.php12
17 files changed, 60 insertions, 52 deletions
diff --git a/app/Controller/User.php b/app/Controller/User.php
index 0a4d66f2..31413fc0 100644
--- a/app/Controller/User.php
+++ b/app/Controller/User.php
@@ -34,7 +34,7 @@ class User extends Base
$this->response->redirect('?controller=app');
}
- $this->response->html($this->template->layout('user_login', array(
+ $this->response->html($this->template->layout('user/login', array(
'errors' => array(),
'values' => array(),
'no_layout' => true,
@@ -63,7 +63,7 @@ class User extends Base
}
}
- $this->response->html($this->template->layout('user_login', array(
+ $this->response->html($this->template->layout('user/login', array(
'errors' => $errors,
'values' => $values,
'no_layout' => true,
@@ -90,7 +90,7 @@ class User extends Base
$params['title'] = ($params['user']['name'] ?: $params['user']['username']).' (#'.$params['user']['id'].')';
}
- return $this->template->layout('user_layout', $params);
+ return $this->template->layout('user/layout', $params);
}
/**
@@ -130,7 +130,7 @@ class User extends Base
$nb_users = $this->user->count();
$this->response->html(
- $this->template->layout('user_index', array(
+ $this->template->layout('user/index', array(
'board_selector' => $this->projectPermission->getAllowedProjects($this->acl->getUserId()),
'projects' => $this->project->getList(),
'nb_users' => $nb_users,
@@ -156,7 +156,7 @@ class User extends Base
*/
public function create()
{
- $this->response->html($this->template->layout('user_new', array(
+ $this->response->html($this->template->layout('user/new', array(
'board_selector' => $this->projectPermission->getAllowedProjects($this->acl->getUserId()),
'projects' => $this->project->getList(),
'errors' => array(),
@@ -186,7 +186,7 @@ class User extends Base
}
}
- $this->response->html($this->template->layout('user_new', array(
+ $this->response->html($this->template->layout('user/new', array(
'board_selector' => $this->projectPermission->getAllowedProjects($this->acl->getUserId()),
'projects' => $this->project->getList(),
'errors' => $errors,
@@ -203,7 +203,7 @@ class User extends Base
public function show()
{
$user = $this->getUser();
- $this->response->html($this->layout('user_show', array(
+ $this->response->html($this->layout('user/show', array(
'projects' => $this->projectPermission->getAllowedProjects($user['id']),
'user' => $user,
)));
@@ -217,7 +217,7 @@ class User extends Base
public function last()
{
$user = $this->getUser();
- $this->response->html($this->layout('user_last', array(
+ $this->response->html($this->layout('user/last', array(
'last_logins' => $this->lastLogin->getAll($user['id']),
'user' => $user,
)));
@@ -231,7 +231,7 @@ class User extends Base
public function sessions()
{
$user = $this->getUser();
- $this->response->html($this->layout('user_sessions', array(
+ $this->response->html($this->layout('user/sessions', array(
'sessions' => $this->authentication->backend('rememberMe')->getAll($user['id']),
'user' => $user,
)));
@@ -266,7 +266,7 @@ class User extends Base
$this->response->redirect('?controller=user&action=notifications&user_id='.$user['id']);
}
- $this->response->html($this->layout('user_notifications', array(
+ $this->response->html($this->layout('user/notifications', array(
'projects' => $this->projectPermission->getAllowedProjects($user['id']),
'notifications' => $this->notification->readSettings($user['id']),
'user' => $user,
@@ -281,7 +281,7 @@ class User extends Base
public function external()
{
$user = $this->getUser();
- $this->response->html($this->layout('user_external', array(
+ $this->response->html($this->layout('user/external', array(
'last_logins' => $this->lastLogin->getAll($user['id']),
'user' => $user,
)));
@@ -316,7 +316,7 @@ class User extends Base
}
}
- $this->response->html($this->layout('user_password', array(
+ $this->response->html($this->layout('user/password', array(
'values' => $values,
'errors' => $errors,
'user' => $user,
@@ -365,7 +365,7 @@ class User extends Base
}
}
- $this->response->html($this->layout('user_edit', array(
+ $this->response->html($this->layout('user/edit', array(
'values' => $values,
'errors' => $errors,
'projects' => $this->projectPermission->filterProjects($this->project->getList(), $user['id']),
@@ -395,7 +395,7 @@ class User extends Base
$this->response->redirect('?controller=user');
}
- $this->response->html($this->layout('user_remove', array(
+ $this->response->html($this->layout('user/remove', array(
'user' => $user,
)));
}
@@ -431,7 +431,7 @@ class User extends Base
$this->response->redirect('?controller=app');
}
else {
- $this->response->html($this->template->layout('user_login', array(
+ $this->response->html($this->template->layout('user/login', array(
'errors' => array('login' => t('Google authentication failed')),
'values' => array(),
'no_layout' => true,
@@ -493,7 +493,7 @@ class User extends Base
$this->response->redirect('?controller=app');
}
else {
- $this->response->html($this->template->layout('user_login', array(
+ $this->response->html($this->template->layout('user/login', array(
'errors' => array('login' => t('GitHub authentication failed')),
'values' => array(),
'no_layout' => true,
diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php
index 4eb0dc72..94ed70d2 100644
--- a/app/Locale/fr_FR/translations.php
+++ b/app/Locale/fr_FR/translations.php
@@ -457,7 +457,7 @@ return array(
'Edit profile' => 'Modifier le profil',
'Change password' => 'Changer le mot de passe',
'Password modification' => 'Changement de mot de passe',
- 'External authentications' => 'Authentifications externe',
+ 'External authentications' => 'Authentifications externes',
'Google Account' => 'Compte Google',
'Github Account' => 'Compte Github',
'Never connected.' => 'Jamais connecté.',
diff --git a/app/Model/ProjectPermission.php b/app/Model/ProjectPermission.php
index c890a94f..8984ef3e 100644
--- a/app/Model/ProjectPermission.php
+++ b/app/Model/ProjectPermission.php
@@ -176,7 +176,7 @@ class ProjectPermission extends Base
*/
public function isUserAllowed($project_id, $user_id)
{
- return $this->user->isAdmin($user_id) || $this->isMember($project_id, $user_id);
+ return $project_id === 0 || $this->user->isAdmin($user_id) || $this->isMember($project_id, $user_id);
}
/**
diff --git a/app/Template/user_edit.php b/app/Template/user/edit.php
index 14063d49..bc942567 100644
--- a/app/Template/user_edit.php
+++ b/app/Template/user/edit.php
@@ -1,7 +1,7 @@
<div class="page-header">
<h2><?= t('Edit user') ?></h2>
</div>
-<form method="post" action="?controller=user&amp;action=edit&amp;user_id=<?= $user['id'] ?>" autocomplete="off">
+<form method="post" action="<?= Helper\u('user', 'edit', array('user_id' => $user['id'])) ?>" autocomplete="off">
<?= Helper\form_csrf() ?>
@@ -25,6 +25,8 @@
<?php endif ?>
<div class="form-actions">
- <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> <a href="?controller=user&amp;action=show&amp;user_id=<?= $user['id'] ?>"><?= t('cancel') ?></a>
+ <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
+ <?= t('or') ?>
+ <?= Helper\a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?>
</div>
</form> \ No newline at end of file
diff --git a/app/Template/user_external.php b/app/Template/user/external.php
index 676b2c73..31ffcb75 100644
--- a/app/Template/user_external.php
+++ b/app/Template/user/external.php
@@ -8,9 +8,9 @@
<p class="listing">
<?php if (Helper\is_current_user($user['id'])): ?>
<?php if (empty($user['google_id'])): ?>
- <a href="?controller=user&amp;action=google<?= Helper\param_csrf() ?>"><?= t('Link my Google Account') ?></a>
+ <?= Helper\a(t('Link my Google Account'), 'user', 'google', array(), true) ?>
<?php else: ?>
- <a href="?controller=user&amp;action=unlinkGoogle<?= Helper\param_csrf() ?>"><?= t('Unlink my Google Account') ?></a>
+ <?= Helper\a(t('Unlink my Google Account'), 'user', 'unlinkGoogle', array(), true) ?>
<?php endif ?>
<?php else: ?>
<?= empty($user['google_id']) ? t('No account linked.') : t('Account linked.') ?>
@@ -24,9 +24,9 @@
<p class="listing">
<?php if (Helper\is_current_user($user['id'])): ?>
<?php if (empty($user['github_id'])): ?>
- <a href="?controller=user&amp;action=gitHub<?= Helper\param_csrf() ?>"><?= t('Link my GitHub Account') ?></a>
+ <?= Helper\a(t('Link my GitHub Account'), 'user', 'github', array(), true) ?>
<?php else: ?>
- <a href="?controller=user&amp;action=unlinkGitHub<?= Helper\param_csrf() ?>"><?= t('Unlink my GitHub Account') ?></a>
+ <?= Helper\a(t('Unlink my GitHub Account'), 'user', 'unlinkGitHub', array(), true) ?>
<?php endif ?>
<?php else: ?>
<?= empty($user['github_id']) ? t('No account linked.') : t('Account linked.') ?>
diff --git a/app/Template/user_index.php b/app/Template/user/index.php
index 73612b0b..73612b0b 100644
--- a/app/Template/user_index.php
+++ b/app/Template/user/index.php
diff --git a/app/Template/user_last.php b/app/Template/user/last.php
index 0b55b0d5..0b55b0d5 100644
--- a/app/Template/user_last.php
+++ b/app/Template/user/last.php
diff --git a/app/Template/user_layout.php b/app/Template/user/layout.php
index 1fbc1ea0..0778b716 100644
--- a/app/Template/user_layout.php
+++ b/app/Template/user/layout.php
@@ -9,7 +9,7 @@
</div>
<section class="sidebar-container" id="user-section">
- <?= Helper\template('user_sidebar', array('user' => $user)) ?>
+ <?= Helper\template('user/sidebar', array('user' => $user)) ?>
<div class="sidebar-content">
<?= $user_content_for_layout ?>
diff --git a/app/Template/user_login.php b/app/Template/user/login.php
index a8e8fc15..fea44a01 100644
--- a/app/Template/user_login.php
+++ b/app/Template/user/login.php
@@ -4,7 +4,7 @@
<p class="alert alert-error"><?= Helper\escape($errors['login']) ?></p>
<?php endif ?>
- <form method="post" action="?controller=user&amp;action=check&amp;redirect_query=<?= urlencode($redirect_query) ?>">
+ <form method="post" action="<?= Helper\u('user', 'check', array('redirect_query' => urlencode($redirect_query))) ?>">
<?= Helper\form_csrf() ?>
@@ -17,11 +17,11 @@
<?= Helper\form_checkbox('remember_me', t('Remember Me'), 1) ?><br/>
<?php if (GOOGLE_AUTH): ?>
- <a href="?controller=user&amp;action=google"><?= t('Login with my Google Account') ?></a>
+ <?= Helper\a(t('Login with my Google Account'), 'user', 'google') ?>
<?php endif ?>
<?php if (GITHUB_AUTH): ?>
- <a href="?controller=user&amp;action=gitHub"><?= t('Login with my GitHub Account') ?></a>
+ <?= Helper\a(t('Login with my GitHub Account'), 'user', 'gitHub') ?>
<?php endif ?>
<div class="form-actions">
diff --git a/app/Template/user_new.php b/app/Template/user/new.php
index 1e483ade..af5824e0 100644
--- a/app/Template/user_new.php
+++ b/app/Template/user/new.php
@@ -31,7 +31,8 @@
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
- <?= t('or') ?> <?= Helper\a(t('cancel'), 'user', 'index') ?>
+ <?= t('or') ?>
+ <?= Helper\a(t('cancel'), 'user', 'index') ?>
</div>
</form>
</section>
diff --git a/app/Template/user_notifications.php b/app/Template/user/notifications.php
index 4a32a41d..33da61fb 100644
--- a/app/Template/user_notifications.php
+++ b/app/Template/user/notifications.php
@@ -2,7 +2,7 @@
<h2><?= t('Email notifications') ?></h2>
</div>
-<form method="post" action="?controller=user&amp;action=notifications&amp;user_id=<?= $user['id'] ?>" autocomplete="off">
+<form method="post" action="<?= Helper\u('user', 'notifications', array('user_id' => $user['id'])) ?>" autocomplete="off">
<?= Helper\form_csrf() ?>
@@ -13,13 +13,14 @@
<div class="form-checkbox-group">
<?php foreach ($projects as $project_id => $project_name): ?>
- <?= Helper\form_checkbox('projects['.$project_id.']', $project_name, '1', isset($notifications['project_'.$project_id])) ?>
+ <?= Helper\form_checkbox('projects['.$project_id.']', $project_name, '1', isset($notifications['project_'.$project_id])) ?><br/>
<?php endforeach ?>
</div>
<?php endif ?>
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
- <?= t('or') ?> <a href="?controller=user&amp;action=show&amp;user_id=<?= $user['id'] ?>"><?= t('cancel') ?></a>
+ <?= t('or') ?>
+ <?= Helper\a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?>
</div>
</form> \ No newline at end of file
diff --git a/app/Template/user_password.php b/app/Template/user/password.php
index 5da38595..76e0ab15 100644
--- a/app/Template/user_password.php
+++ b/app/Template/user/password.php
@@ -2,13 +2,15 @@
<h2><?= t('Password modification') ?></h2>
</div>
-<form method="post" action="?controller=user&amp;action=password&amp;user_id=<?= $user['id'] ?>" autocomplete="off">
+<form method="post" action="<?= Helper\u('user', 'password', array('user_id' => $user['id'])) ?>" autocomplete="off">
<?= Helper\form_hidden('id', $values) ?>
<?= Helper\form_csrf() ?>
- <?= Helper\form_label(t('Current password for the user "%s"', Helper\get_username()), 'current_password') ?>
- <?= Helper\form_password('current_password', $values, $errors) ?><br/>
+ <div class="alert alert-error">
+ <?= Helper\form_label(t('Current password for the user "%s"', Helper\get_username()), 'current_password') ?>
+ <?= Helper\form_password('current_password', $values, $errors) ?><br/>
+ </div>
<?= Helper\form_label(t('New password for the user "%s"', Helper\get_username($user)), 'password') ?>
<?= Helper\form_password('password', $values, $errors) ?><br/>
@@ -17,7 +19,8 @@
<?= Helper\form_password('confirmation', $values, $errors) ?><br/>
<div class="form-actions">
- <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= t('or') ?> <a href="?controller=user&amp;action=show&amp;user_id=<?= $user['id'] ?>"><?= t('cancel') ?></a>
+ <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
+ <?= t('or') ?>
+ <?= Helper\a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?>
</div>
-
-</form> \ No newline at end of file
+</form>
diff --git a/app/Template/user/remove.php b/app/Template/user/remove.php
new file mode 100644
index 00000000..5f58b631
--- /dev/null
+++ b/app/Template/user/remove.php
@@ -0,0 +1,13 @@
+<div class="page-header">
+ <h2><?= t('Remove user') ?></h2>
+</div>
+
+<div class="confirm">
+ <p class="alert alert-info"><?= t('Do you really want to remove this user: "%s"?', $user['name'] ?: $user['username']) ?></p>
+
+ <div class="form-actions">
+ <?= Helper\a(t('Yes'), 'user', 'remove', array('user_id' => $user['id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?>
+ <?= t('or') ?>
+ <?= Helper\a(t('cancel'), 'user', 'show', array('user_id' => $user['id'])) ?>
+ </div>
+</div> \ No newline at end of file
diff --git a/app/Template/user_sessions.php b/app/Template/user/sessions.php
index b647d726..d05d5b6d 100644
--- a/app/Template/user_sessions.php
+++ b/app/Template/user/sessions.php
@@ -19,7 +19,7 @@
<td><?= dt('%B %e, %Y at %k:%M %p', $session['expiration']) ?></td>
<td><?= Helper\escape($session['ip']) ?></td>
<td><?= Helper\escape(Helper\summary($session['user_agent'])) ?></td>
- <td><a href="?controller=user&amp;action=removeSession&amp;user_id=<?= $user['id'] ?>&amp;id=<?= $session['id'].Helper\param_csrf() ?>"><?= t('Remove') ?></a></td>
+ <td><?= Helper\a(t('Remove'), 'user', 'removeSession', array('user_id' => $user['id'], 'id' => $session['id']), true) ?></td>
</tr>
<?php endforeach ?>
</table>
diff --git a/app/Template/user_show.php b/app/Template/user/show.php
index 1c843751..1c843751 100644
--- a/app/Template/user_show.php
+++ b/app/Template/user/show.php
diff --git a/app/Template/user_sidebar.php b/app/Template/user/sidebar.php
index 16532143..0a1a0764 100644
--- a/app/Template/user_sidebar.php
+++ b/app/Template/user/sidebar.php
@@ -30,7 +30,7 @@
</li>
<?php endif ?>
- <?php if (Helper\is_admin()): ?>
+ <?php if (Helper\is_admin() && ! Helper\is_current_user($user['id'])): ?>
<li>
<?= Helper\a(t('Remove'), 'user', 'remove', array('user_id' => $user['id'])) ?>
</li>
diff --git a/app/Template/user_remove.php b/app/Template/user_remove.php
deleted file mode 100644
index c20ccbba..00000000
--- a/app/Template/user_remove.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<div class="page-header">
- <h2><?= t('Remove user') ?></h2>
-</div>
-
-<div class="confirm">
- <p class="alert alert-info"><?= t('Do you really want to remove this user: "%s"?', $user['name'] ?: $user['username']) ?></p>
-
- <div class="form-actions">
- <a href="?controller=user&amp;action=remove&amp;confirmation=yes&amp;user_id=<?= $user['id'].Helper\param_csrf() ?>" class="btn btn-red"><?= t('Yes') ?></a>
- <?= t('or') ?> <a href="?controller=user&amp;action=show&amp;user_id=<?= $user['id'] ?>"><?= t('cancel') ?></a>
- </div>
-</div> \ No newline at end of file