-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathkeys.php
97 lines (81 loc) · 3.53 KB
/
keys.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
<?php
/***************************************************************************
*
* 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 2 of the License, or
* (at your option) any later version.
*
* Portions of this program are derived from publicly licensed software
* projects including, but not limited to phpBB, Magelo Clone,
* EQEmulator, EQEditor, and Allakhazam Clone.
*
* Author:
* Maudigan(Airwalking)
*
* September 26 2014
* cleaned up double carriage returns through whole file
* update character table name
* September 28, 2014 - Maudigan
* added code to monitor database performance
* altered character profile initialization to remove redundant query
***************************************************************************/
define('INCHARBROWSER', true);
include_once("include/config.php");
include_once("include/debug.php");
include_once("include/sql.php");
include_once("include/profile.php");
include_once("include/global.php");
include_once("include/language.php");
include_once("include/functions.php");
global $game_db;
//if character name isnt provided post error message and exit
if(!$_GET['char']) message_die($language['MESSAGE_ERROR'],$language['MESSAGE_NO_CHAR']);
else $charName = $_GET['char'];
//character initializations - rewritten 9/28/2014
$char = new profile($charName); //the profile class will sanitize the character name
$charID = $char->char_id();
$name = $char->GetValue('name');
$mypermission = GetPermissions($char->GetValue('gm'), $char->GetValue('anon'), $char->char_id());
//block view if user level doesnt have permission
if ($mypermission['keys'] && !isAdmin()) message_die($language['MESSAGE_ERROR'],$language['MESSAGE_ITEM_NO_VIEW']);
//=============================
//grab the keys the user has
//=============================
$query = "SELECT k.item_id, i.Name AS 'key' FROM character_keyring AS k LEFT JOIN items AS i ON i.id = k.item_id WHERE k.id = $charID ORDER BY i.Name;";
if (defined('DB_PERFORMANCE')) dbp_query_stat('query', $query); //added 9/28/2014
$results = $game_db->query($query);
if (!numRows($results)) message_die($language['KEYS_KEY']." - ".$name,$language['MESSAGE_NO_KEYS']);
//drop page
$d_title = " - ".$name.$language['PAGE_TITLES_KEYS'];
include("include/header.php");
//build body template
$template->set_filenames(array(
'keys' => 'keys_body.tpl')
);
$template->assign_vars(array(
'NAME' => $name,
'L_KEY' => $language['KEYS_KEY'],
'L_KEYS' => $language['BUTTON_KEYS'],
'L_AAS' => $language['BUTTON_AAS'],
'L_FLAGS' => $language['BUTTON_FLAGS'],
'L_SKILLS' => $language['BUTTON_SKILLS'],
'L_CORPSE' => $language['BUTTON_CORPSE'],
'L_FACTION' => $language['BUTTON_FACTION'],
'L_BOOKMARK' => $language['BUTTON_BOOKMARK'],
'L_INVENTORY' => $language['BUTTON_INVENTORY'],
'L_CHARMOVE' => $language['BUTTON_CHARMOVE'],
'L_DONE' => $language['BUTTON_DONE'])
);
foreach($results AS $row) {
$template->assign_block_vars("keys", array(
'KEY' => $row['key'],
'ITEM_ID' => $row["item_id"])
);
}
$template->pparse('keys');
$template->destroy;
//added to monitor database performance 9/28/2014
if (defined('DB_PERFORMANCE')) print dbp_dump_buffer('query');
include("include/footer.php");
?>