Skip to content

Commit 5afda40

Browse files
committed
Fix #22 - disable user button added
1 parent 2f51eb4 commit 5afda40

File tree

5 files changed

+28
-14
lines changed

5 files changed

+28
-14
lines changed

admin/lost-password.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
$user->change_password($_POST['token']);
1414
if (isset($message)){?>
1515
<p class="alert alert-danger"><?php echo $message?></p>
16-
<a href="<?php echo WEB_URL;?>/admin/?do=lost-password<?php echo "&amp;id=".$_POST['id']."&amp;token=".$_POST['token'];?>"><?php echo _("Go back");?> </a>
16+
<a href="<?php echo WEB_URL;?>/admin/?do=lost-password<?php echo "&id=".$_POST['id']."&token=".$_POST['token'];?>"><?php echo _("Go back");?> </a>
1717
<?php
1818
}
1919
else{?>

admin/new-user.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<h2>Add new user</h2>
1010
</div>
1111

12-
<form action="<?php echo WEB_URL;?>/admin/?do=new-user&amp;new=user" method="POST" class="form-horizontal">
12+
<form action="<?php echo WEB_URL;?>/admin/?do=new-use&new=user" method="POST" class="form-horizontal">
1313
<?php if (isset($message))
1414
{?>
1515
<p class="alert alert-danger"><?php echo $message?></p>

admin/settings.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<section>
2323
<h3 class="pull-left"><?php echo _("Services");?></h3>
2424
<?php if ($user->get_rank() <= 1){?>
25-
<form action="?do=settings&amp;new=service" method="post">
25+
<form action="?do=settings&new=service" method="post">
2626
<div class="input-group pull-right new-service">
2727
<input class="form-control" name="service" placeholder="Name" type="text" value="<?php echo ((isset($_POST['service']))?htmlspecialchars($_POST['service']):''); ?>" maxlength="50" required>
2828
<span class="input-group-btn">
@@ -52,7 +52,7 @@
5252
echo "<td>".$result['name']."</td>";
5353
if ($user->get_rank()<=1)
5454
{
55-
echo '<td><a href="'.WEB_URL.'/admin/?do=settings&amp;delete='.$result['id'].'" class="pull-right delete-service"><i class="fa fa-trash"></i></a></td>';
55+
echo '<td><a href="'.WEB_URL.'/admin/?do=settings&delete='.$result['id'].'" class="pull-right delete-service"><i class="fa fa-trash"></i></a></td>';
5656
}
5757
echo "</tr>";
5858
}?>
@@ -74,7 +74,7 @@
7474
{
7575
echo "<tr>";
7676
echo "<td>".$result['id']."</td>";
77-
echo "<td><a href='".WEB_URL."/admin/?do=user&amp;id=".$result['id']."'>".$result['username']."</a></td>";
77+
echo "<td><a href='".WEB_URL."/admin/?do=user&id=".$result['id']."'>".$result['username']."</a></td>";
7878
echo "<td>".$result['name']."</td>";
7979
echo "<td>".$result['surname']."</td>";
8080
echo "<td><a href=\"mailto:".$result['email']."\">".$result['email']."</a></td>";

classes/constellation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function render_incidents($future=false, $offset=0, $limit = 5, $admin =
3939
{
4040
if ($offset)
4141
{
42-
echo '<noscript><div class="centered"><a href="'.WEB_URL.'/?offset='.($offset-$limit+1).'&amp;timestamp='.$timestamp.'" class="btn btn-default">'._("Back").'</a></div></noscript>';
42+
echo '<noscript><div class="centered"><a href="'.WEB_URL.'/?offset='.($offset-$limit+1).'&timestamp='.$timestamp.'" class="btn btn-default">'._("Back").'</a></div></noscript>';
4343
}
4444
echo "<h3>"._("Past incidents")."</h3>";
4545
}
@@ -59,7 +59,7 @@ public function render_incidents($future=false, $offset=0, $limit = 5, $admin =
5959
}
6060
if ($show)
6161
{
62-
echo '<div class="centered"><a href="'.WEB_URL.'/?offset='.($offset).'&amp;timestamp='.$timestamp.'" id="loadmore" class="btn btn-default">'._("Load more").'</a></div>';
62+
echo '<div class="centered"><a href="'.WEB_URL.'/?offset='.($offset).'&timestamp='.$timestamp.'" id="loadmore" class="btn btn-default">'._("Load more").'</a></div>';
6363
}
6464
}
6565
}

classes/user.php

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function toggle()
9797
$stmt->bind_param("i", $this->id);
9898
$stmt->execute();
9999
$stmt->close();
100-
header("Location: ".WEB_URL."/admin/?do=user&amp;id=".$id);
100+
header("Location: ".WEB_URL."/admin/?do=user&id=".$id);
101101
}else{
102102
$message = _("You don't have the permission to do that!");
103103
}
@@ -317,14 +317,14 @@ public function render_user_settings()
317317
<div class="col-md-2 col-md-offset-2"><strong><?php echo _("Username");?></strong></div>
318318
<div class="col-md-6"><?php echo $this->username." "; if ($this->id!=$_SESSION['user'] && $user->get_rank()<=1 && ($user->get_rank()<$this->rank))
319319
{
320-
echo "<a href='".WEB_URL."/admin/?do=user&amp;id=".$this->id."&amp;what=toggle'>";
320+
echo "<a href='".WEB_URL."/admin/?do=user&id=".$this->id."&what=toggle'>";
321321
echo "<i class='fa fa-".($this->active?"check success":"times danger")."'></i></a>";
322322
}else{
323323
echo "<i class='fa fa-".($this->active?"check success":"times danger")."'></i>";
324324
}?></div>
325325
</div>
326326

327-
<form action="<?php echo WEB_URL;?>/admin/?do=user&amp;id=<?php echo $this->id; ?>" method="POST">
327+
<form action="<?php echo WEB_URL;?>/admin/?do=user&id=<?php echo $this->id; ?>" method="POST">
328328
<div class="row">
329329
<div class="col-md-2 col-md-offset-2"><strong><?php echo _("Role");?></strong></div>
330330
<div class="col-md-6"><?php if ($user->get_rank() == 0 && $this->id != $_SESSION['user']){?> <div class="input-group"><select class="form-control" name="permission"><?php foreach ($permissions as $key => $value) {
@@ -379,7 +379,21 @@ public function render_user_settings()
379379
</div>
380380
<?php
381381
}
382-
382+
if ($this->id!=$_SESSION['user'] && $user->get_rank()<=1 && ($user->get_rank()<$this->rank))
383+
{?>
384+
<div class="row">
385+
<div class="col-md-2 col-md-offset-2"></div>
386+
<div class="col-md-6">
387+
<?php
388+
if ($this->active){
389+
echo '<a href="'.WEB_URL.'/admin/?do=user&id='.$this->id.'&what=toggle" class="btn btn-danger">'._("Deactivate user")."</a>";
390+
}else{
391+
echo '<a href="'.WEB_URL.'/admin/?do=user&id='.$this->id.'&what=toggle" class="btn btn-success">'._("Activate user")."</a>";
392+
}
393+
?>
394+
</div>
395+
</div>
396+
<?php }
383397
}
384398

385399
/**
@@ -484,7 +498,7 @@ public static function password_link()
484498

485499
$token = Token::add($id, 'passwd', $time);
486500

487-
$link = WEB_URL."/admin/?do=lost-password&amp;id=$id&amp;token=$token";
501+
$link = WEB_URL."/admin/?do=lost-password&id=$id&token=$token";
488502
$to = $email;
489503
$user = new User($id);
490504
$subject = _('Reset password') . ' - '.NAME;
@@ -510,7 +524,7 @@ public function email_link(){
510524
$token = Token::add($id, 'email;$email', $time);
511525

512526

513-
$link = WEB_URL."/admin/?do=change-email&amp;id=$id&amp;token=$token";
527+
$link = WEB_URL."/admin/?do=change-email&id=$id&token=$token";
514528
$to = $email;
515529
$subject = _('Email change').' - '.NAME;
516530
$msg = sprintf(_( "Hi %s!<br>Below you will find link to change your email. The link is valid for 24hrs. If you didn't request this, feel free to ignore it. <br><br><a href=\"%s\">CHANGE EMAIL</a><br><br>If the link doesn't work, copy &amp; paste it into your browser: <br>%s"), $user->get_name(), $link, $link);
@@ -588,7 +602,7 @@ public function change_permission(){
588602
$stmt = $mysqli->prepare("UPDATE users SET permission=? WHERE id=?");
589603
$stmt->bind_param("si", $permission, $id);
590604
$stmt->execute();
591-
header("Location: ".WEB_URL."/admin/?do=user&amp;id=".$id);
605+
header("Location: ".WEB_URL."/admin/?do=user&id=".$id);
592606
}
593607
else{
594608
$message = _("You don't have permission to do that!");

0 commit comments

Comments
 (0)