From 229859445515b9f8e379a2037f177cbd277094d7 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sun, 23 Feb 2014 20:25:49 -0500 Subject: Add helpers for the user session and fix bug edit_user admin checkbox --- lib/helper.php | 10 ++++++++++ templates/project_index.php | 6 +++--- templates/project_tasks.php | 2 +- templates/user_edit.php | 2 +- templates/user_index.php | 6 +++--- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/lib/helper.php b/lib/helper.php index 922faba0..22121015 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -2,6 +2,16 @@ namespace Helper; +function is_current_user($user_id) +{ + return $_SESSION['user']['id'] == $user_id; +} + +function is_admin() +{ + return $_SESSION['user']['is_admin'] == 1; +} + function markdown($text) { require_once __DIR__.'/../vendor/Michelf/MarkdownExtra.inc.php'; diff --git a/templates/project_index.php b/templates/project_index.php index 8c75ef0b..4048879b 100644 --- a/templates/project_index.php +++ b/templates/project_index.php @@ -1,7 +1,7 @@