-
Notifications
You must be signed in to change notification settings - Fork 0
/
hlmaps.php
162 lines (138 loc) · 6.1 KB
/
hlmaps.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
<?php /*###################################################################*/
/*# hlmaps.php #*/
/*# - hlmaps main routine #*/
/*# - Copyright Scott McCrory and Brian Porter #*/
/*# - Distributed under the GPL terms - see docs for info #*/
/*# - http://hlmaps.sourceforge.net #*/
/*# #*/
/*#########################################################################*/
/*# CVS $Id$
/*#########################################################################*/
//#
//# HLmaps-php
//# Copyright (C) 2002 Scott McCrory and Brian Porter
//# All Rights Reserved
//#
//# 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.
//#
//# 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, write to the Free Software
//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
//# 02111-1307 USA
//#
//###########################################################################
/***************************************************************************/
/* CHANGE THIS TO POINT TO YOUR "hlmaps.inc" */
// Absolute filesystem path to include file
// i.e.: "/etc/hlmaps/hlmaps.inc" or "C:/hlmaps/hlmaps.inc"
$INCLUDE_FILE = "hlmaps.inc";
/***************************************************************************/
/* CHANGE THIS TO POINT TO YOUR "hlmaps.conf" */
// Absolute filesystem path to config file
// i.e.: "/etc/hlmaps/hlmaps.conf" or "C:/hlmaps/hlmaps.conf"
$CONFIG_FILE = "hlmaps.conf";
// MySQL variables. Edit these if your game server and web server are on
// different machines. hlmaps.php will load it's config data from the
// mysql server instead of a local hlmaps.conf file.
$prefs["MYSQL_SERVER"] = "127.0.0.1";
$prefs["MYSQL_USER"] = "hlmaps";
$prefs["MYSQL_PASSWORD"] = "hlmaps";
$prefs["MYSQL_DATABASE"] = "hlmaps";
$prefs["MYSQL_PREFS_TABLE"] = "prefs";
$prefs["MYSQL_PREFS_VALFIELD"] = "prefvalues";
$prefs["MYSQL_PREFS_KEYFIELD"] = "prefkeys";
/***************************************************************************/
/**** ****/
/**** # NO NEED TO EDIT BELOW THIS POINT # ****/
/**** ****/
/***************************************************************************/
/***************************************************************************/
/* Global Development Constants */
/***************************************************************************/
// Development constants - please don't mess with these
$VERSION = "0.91, December 30, 2002";
$AUTHOR_NAME = "Brian Porter";
$AUTHOR_EMAIL = "beporter@users.sourceforge.net";
$HOME_PAGE = "http://hlmaps.sourceforge.net";
//$SCRIPT_NAME = $SCRIPT_NAME; // Auto-defined by PHP in global scope
$PACKAGE_NAME = "HLmaps_php"; // Use this for credits instead
/***************************************************************************/
/* Main */
/***************************************************************************/
class mapClass
{
var $map;
var $imageurl;
var $downloadurl;
var $textfile;
var $popularity;
var $mapcycle;
var $size;
var $moddate;
}
class playerClass
{
var $name;
var $frags;
var $time;
}
// Open (and parse) the include file (which will also parse and load the
// config file for us, and tell us where our template files are.)
require($INCLUDE_FILE);
// Create an empty associative array to hold the preferences and parameters passed by URL
//$prefs = array();
$params = array();
// Create arrays to hold server info, rules, and players from live status
$serverInfo = array();
$serverRules = array();
$playerList = array();
// Create an array to hold all the map data imported from the data source
// and an integer to quickly keep track of the number of maps inside
$allMaps = array();
$numOfMaps = 0;
// Create an array to use if we're searching for a certain string in map names
$filteredMaps = array();
// We also need an array to hold the index values of maps from $allMaps we want
// to display on the current page based on viewing mode and sort order
$displayedMaps = array();
// Lastly, a global map container used by the printThisMap_...() functions
$thisMap = new mapclass;
// Set up the current environment
setDefaultValues();
getPreferences();
getParameters();
getRealtimeServerStatus();
// Load all map data from the data source
if($prefs["DATA_LOCATION"] === "mysql")
{
getMapDetails_mysql();
}
else
{
getMapDetails_text();
}
// Grab only the records we need for displaying the current page
populateMapsForPage();
// Determine which template file we use based on the arguments passed
// in the URL and insert our template file here-- it does the rest
// of the work for us.
switch($params["mode"])
{
case "single": // only one map to display
include($prefs["SINGLE_TEMPLATE_FILE"]);
break;
case "list": // show a list of maps
default: // no parameters in URL, so default to a list view
include($prefs["LIST_TEMPLATE_FILE"]);
break;
}
printCredits(); // If we haven't already, print credit information.
/*######################################################################*/ ?>