Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mjnaderi committed Mar 21, 2014
1 parent 95f3a47 commit 8bfbedc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
10 changes: 3 additions & 7 deletions application/controllers/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down
3 changes: 2 additions & 1 deletion application/views/pages/admin/users.twig
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
<td>{{ user.first_login_time ? user.first_login_time : 'Never' }}</td>
<td>{{ user.last_login_time ? user.last_login_time : 'Never' }}</td>
<td>
<a title="Edit" href="{{ site_url('profile/'~user.id) }}"><i class="fa fa-pencil fa-lg color3"></i></a>
<a title="Edit" href="{{ site_url('profile/'~user.id) }}"><i class="fa fa-pencil fa-lg color9"></i></a>
<a title="Submissions" href="{{ site_url('submissions/all/user/'~user.username) }}"><i class="fa fa-bars fa-lg color12"></i></a>
<span title="Delete User" class="delete_user pointer"><i title="Delete User" class="fa fa-times fa-lg color2"></i></span>
<span title="Delete Submissions" class="delete_submissions pointer"><i class="fa fa-times-circle fa-lg color1"></i></span>
</td>
Expand Down
2 changes: 1 addition & 1 deletion application/views/pages/profile.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

Expand Down
13 changes: 8 additions & 5 deletions tester/tester.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# In the name of ALLAH
# Sharif Judge
# Copyright (C) 2013 Mohammad Javad Naderi <mjnaderi@gmail.com>
# Copyright (C) 2014 Mohammad Javad Naderi <mjnaderi@gmail.com>
#
# 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
Expand All @@ -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:
Expand Down Expand Up @@ -533,17 +533,20 @@ 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' <out >tmp1 && mv tmp1 out;
tr -d ' \t\n\r\f' <correctout >tmp1 && mv tmp1 correctout;
fi
# 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
Expand Down

0 comments on commit 8bfbedc

Please sign in to comment.