-
Notifications
You must be signed in to change notification settings - Fork 6
/
tasks.php
135 lines (130 loc) · 3.11 KB
/
tasks.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
//Author: Kadir CETINKAYA - breakv0id@0xdeffbeef
require_once("base.php");
if($loggedin===false)
{
$_SESSION['error'] .= "Sorulari gorebilmeniz icin giris yapmaniz gerekmektedir.";
header("Location: index.php");
exit;
}
if(!isset($_GET['id']))
{
$tMan = new Tasks();
$tasks = $tMan->tasks;
$cats = $tMan->cats;
?>
<div class="container">
<?php
foreach($cats as $cat)
{
?>
<div class="panel panel-default">
<div class="panel-heading"><?=$cat?></div>
<div class="panel-body">
<div class="btn-group btn-group-md">
<?php
foreach($tasks[$cat] as $task)
{
$type = "btn";
if($loggedin===true && $task->hasSolved($team->id)===true)
$type .= " btn-success";
else if(empty($task->realsolvers))
$type .= " btn-primary";
else if($loggedin===true)
$type .= " btn-danger";
else
$type .= " btn-default";
if($task->status !== 1)
$type .= " disabled";
?>
<a href='?id=<?=$task->id?>' type="button" class='<?=$type?>'><?=$task->name?><br/><?=$task->point?><br/><?=$task->author?></a>
<?php
}
?>
</div>
</div>
</div>
<?php
}
?>
</div>
<?php
}
else
{
try
{
$task = new Task($_GET['id']);
if($task->status!==1 && $admin !== true)
throw new Exception($ltask[0]);
}
catch(Exception $e)
{
$error = $e->getMessage()."\n";
$_SESSION['error'] = $error;
header("Location: ".$_SERVER['PHP_SELF']);
exit;
}
?>
<div class="container">
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title">
<div style="float:left;"><?=$task->name?>-<?=$task->point?></div>
<div style="float:right;"><?=$task->cat?></div>
</div>
<div style="clear:both"></div>
</div>
<div class="panel-body">
<center><?=nl2br($task->desc)?><br/><a href='<?=$task->link?>'><?=$task->link?></a></center>
<form action="#" method="POST">
<input type="hidden" value="<?=$task->id?>" name="id">
<div class="form-group">
<label class="col-sm-1 control-label" for="desc"><?=$ltask[2]?></label>
<div class="col-sm-11 form-inline">
<input type="text" name="flag" class="form-control" id="flag" placeholder='<?=$ltask[3]?>'>
<button type="submit" name="action" value="attempt" class="btn btn-primary"><?=$ltask[4]?></button>
</div>
</div>
</form>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="author">Author</label>
<div class="col-sm-10">
<p><?=$task->author?></p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="solvers">Solvers</label>
<div class="col-sm-10">
<p>
<?php
$solvers = array();
foreach($task->solvers as $solver)
{
try
{
$t = new Team($solver);
$solvers[] = $t->name;
}
catch(Exception $e)
{
}
}
$solvers = array_filter($solvers);
if(!empty($solvers))
echo implode(',', $solvers);
else
echo $ltask[5];
?>
</p>
</div>
</div>
</div>
<?php
?>
<?php
}
require_once("footer.php");
?>