diff options
-rw-r--r-- | models/base.php | 20 | ||||
-rw-r--r-- | templates/project_index.php | 2 | ||||
-rw-r--r-- | templates/user_edit.php | 2 | ||||
-rw-r--r-- | templates/user_index.php | 20 |
4 files changed, 24 insertions, 20 deletions
diff --git a/models/base.php b/models/base.php index 8259bc6f..1029074d 100644 --- a/models/base.php +++ b/models/base.php @@ -2,16 +2,16 @@ namespace Model; -require 'vendor/SimpleValidator/Validator.php'; -require 'vendor/SimpleValidator/Base.php'; -require 'vendor/SimpleValidator/Validators/Required.php'; -require 'vendor/SimpleValidator/Validators/Unique.php'; -require 'vendor/SimpleValidator/Validators/MaxLength.php'; -require 'vendor/SimpleValidator/Validators/MinLength.php'; -require 'vendor/SimpleValidator/Validators/Integer.php'; -require 'vendor/SimpleValidator/Validators/Equals.php'; -require 'vendor/SimpleValidator/Validators/AlphaNumeric.php'; -require 'vendor/PicoDb/Database.php'; +require __DIR__.'/../vendor/SimpleValidator/Validator.php'; +require __DIR__.'/../vendor/SimpleValidator/Base.php'; +require __DIR__.'/../vendor/SimpleValidator/Validators/Required.php'; +require __DIR__.'/../vendor/SimpleValidator/Validators/Unique.php'; +require __DIR__.'/../vendor/SimpleValidator/Validators/MaxLength.php'; +require __DIR__.'/../vendor/SimpleValidator/Validators/MinLength.php'; +require __DIR__.'/../vendor/SimpleValidator/Validators/Integer.php'; +require __DIR__.'/../vendor/SimpleValidator/Validators/Equals.php'; +require __DIR__.'/../vendor/SimpleValidator/Validators/AlphaNumeric.php'; +require __DIR__.'/../vendor/PicoDb/Database.php'; require __DIR__.'/schema.php'; abstract class Base diff --git a/templates/project_index.php b/templates/project_index.php index 8bb09a62..0fc2468c 100644 --- a/templates/project_index.php +++ b/templates/project_index.php @@ -1,9 +1,11 @@ <section id="main"> <div class="page-header"> <h2><?= t('Projects') ?><span id="page-counter"> (<?= $nb_projects ?>)</span></h2> + <?php if ($_SESSION['user']['is_admin'] == 1): ?> <ul> <li><a href="?controller=project&action=create"><?= t('New project') ?></a></li> </ul> + <?php endif ?> </div> <section> <?php if (empty($projects)): ?> diff --git a/templates/user_edit.php b/templates/user_edit.php index d9901e4e..66794c49 100644 --- a/templates/user_edit.php +++ b/templates/user_edit.php @@ -2,7 +2,7 @@ <div class="page-header"> <h2><?= t('Edit user') ?></h2> <ul> - <li><a href="?action=users"><?= t('All users') ?></a></li> + <li><a href="?controller=user"><?= t('All users') ?></a></li> </ul> </div> <section> diff --git a/templates/user_index.php b/templates/user_index.php index c83a5417..20baac2f 100644 --- a/templates/user_index.php +++ b/templates/user_index.php @@ -1,9 +1,11 @@ <section id="main"> <div class="page-header"> <h2><?= t('Users') ?><span id="page-counter"> (<?= $nb_users ?>)</span></h2> + <?php if ($_SESSION['user']['is_admin'] == 1): ?> <ul> <li><a href="?controller=user&action=create"><?= t('New user') ?></a></li> </ul> + <?php endif ?> </div> <section> <?php if (empty($users)): ?> @@ -14,9 +16,7 @@ <th><?= t('Username') ?></th> <th><?= t('Administrator') ?></th> <th><?= t('Default Project') ?></th> - <?php if ($_SESSION['user']['is_admin'] == 1): ?> - <th><?= t('Actions') ?></th> - <?php endif ?> + <th><?= t('Actions') ?></th> </tr> <?php foreach ($users as $user): ?> <tr> @@ -29,15 +29,17 @@ <td> <?= $projects[$user['default_project_id']] ?> </td> - <?php if ($_SESSION['user']['is_admin'] == 1): ?> <td> - <a href="?controller=user&action=edit&user_id=<?= $user['id'] ?>"><?= t('edit') ?></a> - <?php if (count($users) > 1): ?> - <?= t('or') ?> - <a href="?controller=user&action=confirm&user_id=<?= $user['id'] ?>"><?= t('remove') ?></a> + <?php if ($_SESSION['user']['is_admin'] == 1 || $_SESSION['user']['id'] == $user['id']): ?> + <a href="?controller=user&action=edit&user_id=<?= $user['id'] ?>"><?= t('edit') ?></a> + <?php endif ?> + <?php if ($_SESSION['user']['is_admin'] == 1): ?> + <?php if (count($users) > 1): ?> + <?= t('or') ?> + <a href="?controller=user&action=confirm&user_id=<?= $user['id'] ?>"><?= t('remove') ?></a> + <?php endif ?> <?php endif ?> </td> - <?php endif ?> </tr> <?php endforeach ?> </table> |