From 8bfbedc7a994a2304dfecca89a9678975dd37f35 Mon Sep 17 00:00:00 2001 From: mjnaderi Date: Fri, 21 Mar 2014 14:13:00 +0330 Subject: [PATCH] minor changes --- application/controllers/Profile.php | 10 +++------- application/views/pages/admin/users.twig | 3 ++- application/views/pages/profile.twig | 2 +- tester/tester.sh | 13 ++++++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/application/controllers/Profile.php b/application/controllers/Profile.php index f8c39e677..71d5aee56 100644 --- a/application/controllers/Profile.php +++ b/application/controllers/Profile.php @@ -104,15 +104,11 @@ public function _role_check($role) { // Non-admin users should not be able to change user role: if ($this->user->level <= 2) - if($role == '') - return TRUE; - else - return FALSE; + return ($role == ''); + // Admins can change everybody's user role: $roles = array('admin', 'head_instructor', 'instructor', 'student'); - if (in_array($role, $roles)) - return TRUE; - return FALSE; + return in_array($role, $roles); } diff --git a/application/views/pages/admin/users.twig b/application/views/pages/admin/users.twig index 3e7c6d0cf..05efd3248 100644 --- a/application/views/pages/admin/users.twig +++ b/application/views/pages/admin/users.twig @@ -52,7 +52,8 @@ {{ user.first_login_time ? user.first_login_time : 'Never' }} {{ user.last_login_time ? user.last_login_time : 'Never' }} - + + diff --git a/application/views/pages/profile.twig b/application/views/pages/profile.twig index 7f992413e..3ca4122ea 100644 --- a/application/views/pages/profile.twig +++ b/application/views/pages/profile.twig @@ -5,7 +5,7 @@ #} {% set selected='users' %} {% extends 'templates/base.twig' %} -{% block icon %}{% endblock %} +{% block icon %}fa-user{% endblock %} {% block title %}Profile{% endblock %} {% block head_title %}Profile{% endblock %} diff --git a/tester/tester.sh b/tester/tester.sh index e788eb700..ec1666919 100755 --- a/tester/tester.sh +++ b/tester/tester.sh @@ -2,7 +2,7 @@ # In the name of ALLAH # Sharif Judge -# Copyright (C) 2013 Mohammad Javad Naderi +# Copyright (C) 2014 Mohammad Javad Naderi # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,7 +20,7 @@ ##################### Example Usage ##################### -# tester.sh /home/mohammad/judge/homeworks/hw6/p1 mjn problem problem c 1 1 50000 1000000 diff -bB 1 1 1 0 1 +# tester.sh /home/mohammad/judge/homeworks/hw6/p1 mjn problem problem c 1 1 50000 1000000 diff -bB 1 1 1 0 1 1 # In this example judge assumes that the file is located at: # /home/mohammad/judge/homeworks/hw6/p1/mjn/problem.c # And test cases are located at: @@ -533,7 +533,7 @@ for((i=1;i<=TST;i++)); do fi else cp $PROBLEMPATH/out/output$i.txt correctout - if [ "$DIFFOPTION" = "ignore" ];then + if [ "$DIFFOPTION" = "ignore" ]; then # Removing all newlines and whitespaces before diff tr -d ' \t\n\r\f' tmp1 && mv tmp1 out; tr -d ' \t\n\r\f' tmp1 && mv tmp1 correctout; @@ -541,9 +541,12 @@ for((i=1;i<=TST;i++)); do # Add a newline at the end of both files echo "" >> out echo "" >> correctout + if [ "$DIFFTOOL" = "diff" ]; then + # Add -q to diff options (for faster diff) + DIFFARGUMENT="-q $DIFFARGUMENT" + fi # Compare output files - if $DIFFTOOL $DIFFARGUMENT out correctout >/dev/null 2>/dev/null - then + if $DIFFTOOL $DIFFARGUMENT out correctout >/dev/null 2>/dev/null; then ACCEPTED=true fi fi