scrii.com tf2 stats web ui
(c) 2011 - scrii.com
All original code in this web application is licensed under the GNU General Public License version 3; a copy of the license is included in the file /LICENSE.
The Twig templating library is licensed under the New BSD license, available here: https://github.com/fabpot/Twig/blob/master/LICENSE
The Quartz usability layer for the OpenFlame Framework is licensed under the MIT license, available here: https://github.com/damianb/Quartz/blob/master/LICENSE
The OpenFlame Framework and the OpenFlame Dbal are licensed under the MIT license, available here: https://github.com/OpenFlame/OpenFlame-Framework/blob/master/LICENSE
The Twitter bootstrap licensed under the Apache License v2.0.
- PHP 5.3.0 or newer (tested on PHP 5.3.1, PHP 5.3.5, PHP 5.3.6)
bcmathextension must be available
pdoextension must be available
pdo_mysqlmust be available
register_globalsMUST be disabled in php.ini
magic_quotes_gpcMUST be disabled in php.ini
magic_quotes_runtimeMUST be disabled in php.ini
- A Steam Web API key
- A Steam group
- TF2 Stats 8.6.0 plugin by DarthNinja
If you are running a phar-packaged version, your installation of PHP needs OpenSSL installed as well.
- Twig 1.3.0 (provided in a git submodule)
- OpenFlame Framework 1.2.2-dev (provided in a git submodule)
- OpenFlame Dbal 1.0.0 (provided in a git submodule)
- Quartz (provided in a git submodule)
- Twitter bootstrap 1.3.0 (provided)
- jQuery 1.6.4 (provided)
Installation of the tf2 stats web ui is fairly straightforward.
editing the configuration file
To prepare your installation, rename or copy the file
data/config/config.json, then open it up in your favorite unix-newline-safe editor (I recommend Notepad++ for Windows users).
In it are several different settings, explained below:
db.host- This setting should be the hostname used to connect to your database server. In most circumstances, it is
db.name- The name of your database (not database user).
db.username- The database username to connect to the database with.
db.password- The password to use with the datbase username to connect to the database with.
twig.debug- Enables debug mode in the Twig template library. Only needed for anyone modifying templates themselves.
site.debug- Enables debug mode on the site itself. The full error message, backtrace, and code context is displayed instead of a vague message. Also, if
site.use_jsis enabled, additional code timing information is displayed in the page footer.
site.use_js- Embeds jQuery and the tf2.js file into the entire site. Enable only if you require the use of jQuery.
site.use_jsis enabled, this will embed the Google CDN copy of jQuery in the page, instead of the local copy.
site.use_gzip_assets- The site will use gzip-compressed assets (CSS, JS files) instead of uncompressed files to save bandwidth if this setting is enabled. If you experience problems with page styling not appearing correctly, try disabling this setting first.
site.timezone- A valid DateTime timezone. Please reference [http://us3.php.net/manual/en/timezones.php] to locate your timezone.
page.base_url- The base URL to use for all links generated on the site. If you install the site to [http://mysite.com/], this would be "/", if you install the site to [http://mysite.com/tf2stats/] this would be "/tf2stats/", etc.
steam.webapikey- Your personal Steam Web API key. See the section "obtaining a Steam Web API key" below for more details if you do not have a Steam Web API key yet.
steam.groupurl- The URL to your Steam group's profile page. This should be something like
Edit the configuration file with the appropriate values for each setting (take care not to break the JSON formatting!), then save the file and try to pull up the site.
- encounter issues loading the site, try enabling
site.debugfirst before continuing.
- have issues connecting to the database, verify the
db.settings with your host first.
- can load the page but think it looks jumbled and unstyled, try disabling the
site.use_gzip_assetssetting and see if that helps.
obtaining a Steam Web API key
To obtain a Steam Web API key, please refer to this page.
There's one somewhere in it. ;)
Make sure the
cache/twig/ directories have full read/write permissions. chmod should be
enabling pretty urls
To enable the "pretty URLs" mode, first check that you are running Apache and that you have the modules
mod_env enabled (
mod_env is needed to let the script know that rewriting is enabled).
- open up the file
.htaccessin your installation
- locate the section regarding rewriting
- uncomment the lines as instructed - just don't remove anything after the first comment hash (the
- locate the line
RewriteBase /tf2statswithin the uncommented section, and change this to match the path you set in the
page.base_pathconfiguration setting ( DO NOT LEAVE A TRAILING SLASH FOR THIS LINE )
- save the file
- access your site and look at the links to players, the top 10 listing, etc. If you're being sent to
/tf2stats/top10/for example, everything is working fine.
enabling compressed stylesheets/js files
site.use_gzip_assets to true to see if your server sends the files with the correct headers. If you load the page and the styling is screwed up beyond belief, read on. Otherwise, you're all set.
Due to a rather...odd choice by the Ubuntu repository maintainers, Apache's
mime_module configuration file declares files ending with the extension .gz to be the wrong content type. Instead of declaring the content encoding as
x-gzip (the code to do this is actually commented out), the maintainers decided to declare the content type to be
application/x-gzip, which will cause most browsers to not use the data within as merely compressed content.
To fix this problem on Ubuntu server 10.04 LTS (may apply to other versions):
- open up the file
- locate the line
# AddEncoding x-gzip .gz .tgzand uncomment it (remove the # at the beginning of the line)
- locate the line
AddType application/x-gzip .gz .tgzand comment it out (add a # at the beginning of the line)
- restart/reload Apache with
sudo service apache2 reloador
sudo service apache2 restart
- clear your browser cache
- reload the page and see if the page styling loads properly