-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathroster.php
186 lines (162 loc) · 6.49 KB
/
roster.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<?php
/***************************************************************************
* roster.php
* ---------------
* begin : Thursday, May 25, 2006
* copyright : (C) 2007 - 2008 Douglas Wagner
* email : [email protected]
*
* $Id: roster.php,v 2.00 2008/03/10 01:16:26 psotfx Exp $
*
***************************************************************************/
/***************************************************************************
*
* WoW Raid Manager - Raid Management Software for World of Warcraft
* Copyright (C) 2007-2008 Douglas Wagner
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
****************************************************************************/
// commons
define("IN_PHPRAID", true);
require_once('./common.php');
// page authentication
define("PAGE_LVL","anonymous");
require_once("includes/authentication.php");
/*************************************************************
* Setup Record Output Information for Data Table
*************************************************************/
// Set StartRecord for Page
if(!isset($_GET['Base']) || !is_numeric($_GET['Base']))
$startRecord = 1;
else
$startRecord = scrub_input($_GET['Base']);
// Set Sort Field for Page
if(!isset($_GET['Sort'])||$_GET['Sort']=='')
{
$sortField="";
$initSort=FALSE;
}
else
{
$sortField = scrub_input($_GET['Sort']);
$initSort=TRUE;
}
// Set Sort Descending Mark
if(!isset($_GET['SortDescending']) || !is_numeric($_GET['SortDescending']))
$sortDesc = 0;
else
$sortDesc = scrub_input($_GET['SortDescending']);
$pageURL = 'roster.php?';
/**************************************************************
* End Record Output Setup for Data Table
**************************************************************/
// for now, we'll let everyone view the character list
$sql = "SELECT * FROM " . $phpraid_config['db_prefix'] . "chars";
$result = $db_raid->sql_query($sql) or print_error($sql, $db_raid->sql_error(), 1);
$chars = array();
// get all the chars and throw them in that nice array for
// output by the report class
while($data = $db_raid->sql_fetchrow($result, true)) {
$sql = sprintf("SELECT * FROM " . $phpraid_config['db_prefix'] . "profile WHERE profile_id=%s", quote_smart($data['profile_id']));
$data_result = $db_raid->sql_query($sql) or print_error($sql, $db_raid->sql_error(), 1);
$data_profdetail = $db_raid->sql_fetchrow($data_result);
$data['name'] = utf8_check($data['name']);
// if ($phpraid_config['enable_armory'])
// $charname = get_armorychar($data['name'], $data['guild']);
// else
$charname = $data['name'];
// Get the Internationalized data to display from the database values:
foreach ($wrm_global_races as $global_race)
if ($data['race'] == $global_race['race_id'])
$race = $phprlang[$global_race['lang_index']];
foreach ($wrm_global_classes as $global_class)
if ($data['class'] == $global_class['class_id'])
$class = $phprlang[$global_class['lang_index']];
foreach($wrm_global_specs as $global_spec)
{
if($data['pri_spec'] == $global_spec['spec']) $pri_spec = $phprlang[$global_spec['lang_index']];
if($data['sec_spec'] == $global_spec['spec']) $sec_spec = $phprlang[$global_spec['lang_index']];
}
// Get the Guild Name to Display instead of Just the ID
$sql = sprintf("SELECT guild_name FROM " . $phpraid_config['db_prefix'] . "guilds WHERE guild_id=%s",quote_smart($data['guild']));
$guild_result = $db_raid->sql_query($sql) or print_error($sql, $db_raid->sql_error(), 1);
$guild_data = $db_raid->sql_fetchrow($guild_result, true);
$guild_name = $guild_data['guild_name'];
array_push($chars,
array(
'ID'=>$data['char_id'],
'Name'=> $charname,
'Guild'=>$guild_name,
'Level'=>$data['lvl'],
'Race'=>$race,
'Class'=>$class,
'Pri_Spec'=>$pri_spec,
'Sec_Spec'=>$sec_spec,
//'Arcane'=>$data['arcane'],
//'Fire'=>$data['fire'],
//'Frost'=>$data['frost'],
//'Nature'=>$data['nature'],
//'Shadow'=>$data['shadow'],
'Profile'=>'<a href="admin/admin_usermgt.php?mode=details&user_id=' . $data['profile_id'] . '">' . $data_profdetail['username'] . '</a>'
)
);
}
if(scrub_input($_SESSION['priv_configuration'] != 1))
{
hideCol('Profile');
}
/**************************************************************
* Code to setup for a Dynamic Table Create: roster1 View.
**************************************************************/
$viewName = 'roster1';
//Setup Columns
$roster_headers = array();
$record_count_array = array();
$roster_headers = getVisibleColumns($viewName);
//Get Record Counts
$roster_record_count_array = getRecordCounts($chars, $raid_headers, $startRecord);
//Get the Jump Menu and pass it down
$rosterJumpMenu = getPageNavigation($chars, $startRecord, $pageURL, $sortField, $sortDesc);
//Setup Default Data Sort from Headers Table
if (!$initSort)
foreach ($roster_headers as $column_rec)
if ($column_rec['default_sort'])
$sortField = $column_rec['column_name'];
//Setup Data
$chars = paginateSortAndFormat($chars, $sortField, $sortDesc, $startRecord, $viewName);
/****************************************************************
* Data Assign for Template.
****************************************************************/
$wrmsmarty->assign('roster_data', $chars);
$wrmsmarty->assign('roster_jump_menu', $rosterJumpMenu);
$wrmsmarty->assign('column_name', $roster_headers);
$wrmsmarty->assign('roster_record_counts', $roster_record_count_array);
$wrmsmarty->assign('header_data',
array(
'template_name' => $phpraid_config['template'],
'gamepack_name' => $phpraid_config['gamepack_name'],
'roster_header' => $phprlang['roster_header'],
'sort_url_base' => $pageURL,
'sort_descending' => $sortDesc,
'sort_text' => $phprlang['sort_text'],
)
);
//
// Start output of page
//
require_once('includes/page_header.php');
$wrmsmarty->display('roster.html');
require_once('includes/page_footer.php');
?>