1
<?php
2
/**
3
 *   File functions:
4
 *   Bugtrack - automated errors and warnings
5
 *
6
 *   @name                 : bugtrack.php                            
7
 *   @copyright            : (C) 2004-2005 Vallheru Team based on Gamers-Fusion ver 2.5
8
 *   @author               : thindil <thindil@users.sourceforge.net>
9
 *   @author               : Marek 'marq' Chodor <marek.chodor@gmail.com>
10
 *   @version              : 0.8 beta
11
 *   @since                : 24.08.2007
12
 *
13
 */
14
15
//
16
//
17
//       This program is free software; you can redistribute it and/or modify
18
//   it under the terms of the GNU General Public License as published by
19
//   the Free Software Foundation; either version 2 of the License, or
20
//   (at your option) any later version.
21
//
22
//   This program is distributed in the hope that it will be useful,
23
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
24
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
//   GNU General Public License for more details.
26
//
27
//   You should have received a copy of the GNU General Public License
28
//   along with this program; if not, write to the Free Software
29
//   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
30
//
31
// 
32
33
/**
34
* Site name
35
*/
36
$title = "Panel Administracyjny";
37
38
/**
39
* Add left and head side of site
40
*/
41
require_once("includes/head.php");
42
43
/**
44
* Get the localization for game
45
*/
46
require_once("languages/".$player -> lang."/bugtrack.php");
47
48
/**
49
* Check permission
50
*/
51
if($player -> rank != 'Admin' and $player->rank != 'Techniczny') 
52
{
53
	error (NO_PERM);
54
}
55
56
/**
57
* Get data from database and assign to variables
58
*/
59
$bugs = $db -> Execute("SELECT * FROM bugtrack ORDER BY amount desc");
60
$arrid = array();
61
$arrtype = array();
62
$arrinfo = array();
63
$arramount = array();
64
$arrfile = array();
65
$arrline = array();
66
$arrrefer = array();
67
$i = 0;
68
while (!$bugs -> EOF) 
69
{
70
    $arrid[$i] = $bugs -> fields['id'];
71
    $arrtype[$i] = $bugs -> fields['type'];
72
    $arrinfo[$i] = $bugs -> fields['info'];
73
    $arramount[$i] = $bugs -> fields['amount'];
74
    $arrfile[$i] = wordwrap($bugs -> fields['file'],20,"\n",1);
75
    $arrline[$i] = $bugs -> fields['line'];
76
    $arrrefer[$i] = wordwrap($bugs -> fields['referer'],20,"\n",1);
77
    $i = $i + 1;
78
    $bugs -> MoveNext();
79
}
80
$bugs -> Close();
81
82
$smarty -> assign("Message", "");
83
84
/**
85
* Delete bugs from bugtrack
86
*/
87
if (isset($_GET['action']) && $_GET['action'] == 'delete') 
88
{
89
    foreach ($arrid as $bid) 
90
    {
91
        if (isset($_POST[$bid])) 
92
        {
93
            $db -> Execute("DELETE FROM bugtrack WHERE id=".$bid);
94
        }
95
    }
96
    $smarty -> assign("Message", DELETED);
97
} 
98
99
/**
100
* Clear bugtrack
101
*/
102
if (isset($_GET['action']) && $_GET['action'] == 'clear') 
103
{
104
    $db -> Execute("TRUNCATE TABLE bugtrack");
105
    $smarty -> assign("Message", DELETED);
106
} 
107
108
109
/**
110
* Assign variables and display page
111
*/
112
$smarty -> assign(array("Bid" => $arrid,
113
    "Btype" => $arrtype,
114
    "Binfo" => $arrinfo,
115
    "Bamount" => $arramount,
116
    "Bfile" => $arrfile,
117
    "Brefer" => $arrrefer,
118
    "Bline" => $arrline,
119
    "Buginfo" => BUG_INFO,
120
    "Bid2" => B_ID,
121
    "Btype2" => B_TYPE,
122
    "Bamount2" => B_AMOUNT,
123
    "Bfile2" => B_FILE,
124
    "Bref" => B_REF,
125
    "Bline2" => B_LINE,
126
	"Adelete" => A_DELETE,
127
	"Aclear" => A_CLEAR,
128
    "Binfo2" => B_INFO));
129
$smarty -> display('bugtrack.tpl');
130
131
/**
132
* Add right and bottom side of page
133
*/
134
require_once("includes/foot.php");
135
?>