Skip to content

Commit

Permalink
First commit of new zKillboard repository including changes that use …
Browse files Browse the repository at this point in the history
…mongodb as the primary database.
  • Loading branch information
cvweiss committed May 23, 2015
0 parents commit a91e0a8
Show file tree
Hide file tree
Showing 372 changed files with 21,028 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
@@ -0,0 +1 @@
text eol=lf
6 changes: 6 additions & 0 deletions .gitignore
@@ -0,0 +1,6 @@
cache/
composer.phar
db
config.php
vendor/
sitemaps/
19 changes: 19 additions & 0 deletions .htaccess
@@ -0,0 +1,19 @@
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ /$1/ [L,R=302]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/$1 [L]

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
</IfModule>
661 changes: 661 additions & 0 deletions AGPL.md

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions CCP.md
@@ -0,0 +1,7 @@
# CCP Copyright Notice

EVE Online and the EVE logo are the registered trademarks of CCP hf. All rights are reserved worldwide.
All other trademarks are the property of their respective owners. EVE Online, the EVE logo, EVE and all associated logos and designs are the intellectual property of CCP hf.
All artwork, screenshots, characters, vehicles, storylines, world facts or other recognizable features of the intellectual property relating to these trademarks are likewise the intellectual property of CCP hf.

CCP hf. has granted permission to __zKillboard__ to use EVE Online and all associated logos and designs for promotional and information purposes on its website but does not endorse, and is not in any way affiliated with, __zKillboard__. CCP is in no way responsible for the content on or functioning of this website, nor can it be liable for any damage arising from the use of this website.
4 changes: 4 additions & 0 deletions LICENSE.md
@@ -0,0 +1,4 @@
# zKillboard License

## License
zKillboard uses the AGPLv3 license. Full license text is available in the `AGPL.md` file.
113 changes: 113 additions & 0 deletions README.md
@@ -0,0 +1,113 @@
# zKillboard
zKillboard is a killboard created for EVE-Online, for use on zkillboard.com, but can also be used for single entities.

# WARNING WARNING
This is the latest verison of zKillboard.com, which prefers NoSQL over MySQL. If you do not have experience with installing and maintaining a NoSQL database, specifically TokuMX v2.4, we do not recommend you try this at home unless you truly enjoy a challenge! There are some aspects of zKillboard.com that still utilize MySQL, but that is only because they haven't been integrated into NoSQL yet.

# WARNING
This is BETA, which means it is a work in progress. It lacks complete documentation and is currently not meant for use in production.

Since zKillboard is a beta product, it has a code base that is far from complete and enjoys numerous updates, deletions, and modifications to the code and accompanying tables. Please feel free to attempt to install zKillboard on your own server, however, we are not responsible for any difficulties you come across during installation and continuing execution of the product.

# Credits
zKillboard is released under the GNU Affero General Public License, version 3. The full license is available in the `AGPL.md` file.
zKillboard also uses data and images from EVE-Online, which is covered by a seperate license from _[CCP](http://www.ccpgames.com/en/home)_. You can see the full license in the `CCP.md` file.
It also uses various 3rd party libraries, which all carry their own licensing. Please refer to them for more info.

# Contact
`#zkb` on `irc.coldfront.net`
Mibbit link incase you're lazy: _http://chat.mibbit.com/?channel=%23zkb&server=irc.coldfront.net_

# LICENSE
see `LICENSE.md` file

# Minimum requirements
- PHP 5.4+ / HHVM 3.0+
- Apache + mod_rewrite, Nginx or any other httpd you prefer that supports php via mod_php or fastcgi.
- Linux, Mac OS X or Windows
- MariaDB 5.5+
- TokuMX 2.4+
- Composer
- cURL and php5-curl

# Recommended requirements
- PHP 5.5+ / HHVM 3.0+
- Linux
- MariaDB 5.5+
- TokuMX 2.4+
- Composer
- APC / Redis / Memcached (Doesn't matter which one)
- cURL and php5-curl

# Nginx Config
```
upstream php-upstream {
server unix:/tmp/php-fpm.sock;
server 127.0.0.1:9000;
}
server {
server_name example.com www.example.com;
listen 80;
root /path/to/zkb_install;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri = 404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_pass php-upstream;
}
}
```

# Apache rewrite
Apache rewrite is handled by the .htaccess.

# Apache Config
```
<VirtualHost *:80>
ServerAlias yourdomain.tld
DocumentRoot /path/to/zkb_install/
<Directory /path/to/zkb_install/>
Require all granted
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
```

# Other webservers
Other webservers are supported, aslong as they can run PHP, they should work.
But other webservers have other ways to write rewrites, so from our side of things, they are unsupported.
Feel free to issue pull requests to amend this.

# Cronjobs
zKillboard comes with a script that automates the cron execution.
It keeps track of when each job has been run and how frequently it needs to be executed.
Just run it every minute via cron or a similar system:

```
* * * * * /var/killboard/zkillboard.com/cron/cron.sh
```

The cron.sh file handles the output as well as rotating of the logfiles in /cron/logs/

# Updating CCP tables
To update the CCP tables, run the cli script called ```updateCCPData``` like so (assuming you symlinked cli.php) ```zkillboard updateCCPData```
It will then automatically download the latest tables from Fuzzysteve, and import them.

# Admin account

Every clean zKillboard installation comes with an admin account, default username and password is `admin`, it is highly recommended that you immediately change this password after you finish your installation.

Current special features to the admin account:

1) Any entities (pilots, corporations, etc.) added to the Admin's tracker will automatically be fetched from _https://zkillboard.com_ up to and including a full fetch of all kills, and maintaining a fetch of said kills on an hourly basis. This of course depends on the cronjob being setup.
107 changes: 107 additions & 0 deletions api.wiki
@@ -0,0 +1,107 @@
[[Category:ZKillboard]][[Category:Third Party APIs]]

== API ==
The zKillboard API is for developers and/or enthusiasts who wants to integrate zKB into their website and/or application.

== Rules ==
* Do not hammer the server with API requests.
* Follow the cacheTime indicated in the expires headers, or the cachedUntil value if you are requesting XML
* If you must do several requests in a row, place space them out as much as possible.
* Please send ''Accept-Encoding: gzip'' as header, to help save bandwidth.
* Please send ''User-Agent: <something>'' as a header. Replace ''<something>'' with your name, email, website etc. Example: User-Agent: https://zkillboard.com/ Maintainer: Karbowiak Mail: karbowiak@gmail.com
== Advice ==
* If you are hitting the API limit, perhaps you should condense your requests. E.G., instead of requesting one character at a time, request multiple characters.
* Be reasonable with your requests. Most entities don't have new kills every single hour, keep this in mind while programming your utility.
* When developing a tool, try caching the requests locally. This will help ensure you don't hit API limits during testing and also ensures you are testing against the same set of data.
== Extra Info (Read before you start fetching) ==
* Look at the X-Bin-Request-Count header and X-Bin-Max-Requests header for how many requests you've made, and how many you can make pr. hour.
* You can do any amount of requests pr. second that you want.
* All IDs used with the API are CCP IDs (Except killmail IDs, which can be internally set, but they are denoted with a - infront (negative numbers))
* If you get an error 403, look at the ''Retry-After'' header.
* The API will maximum deliver of 200 killmails.
* If the ''/limit/'' modifier is used, then ''/page/'' is unavailable.
* startTime and endTime is datetime timestamps, in the format ''YmdHi''.. Example ''2012-11-25 19:00'' is written as ''201211251900''
* ''/w-space/'' and ''/solo/'' can be combined with ''/kills/'' and ''/losses/''
* To get combined ''/kills/'' and ''/losses/'', don't pass either ''/kills/'' or ''/losses/''
* Up to 10 IDs can be fetched at the same time, by seperating them with a , (Comma)
* pastSeconds returns only kills that have happened in the past x seconds.
* pastSeconds can maximum go up to 7 days (604800 seconds)
* Default return is JSON, XML is available with ''/xml/'' parameter.
* Remember to finish with a / (Forward slash)
* All modifiers can be combined in any order
* If you do not paass /killID/ then you must pass at least two of the following modifiers. ''/w-space/'', ''/solo/'' or any of the ''/xID/'' ones. (characterID, allianceID, factionID etc.)
* Negative killIDs denote manually posted killmails.
* JSONP is available
* The API has CORS set.
* Page requests over 10 are only allowed for characterID, corporationID and allianceID
== Defaults ==
* Default sort is desc (latest to oldest)
* Default page is 1
* Default format is JSON
== URL Info ==
* ''#'' is a number
* ''YmdHi'' is a timestamp in the following format: ''201201012333'' (2012-01-01 23:33)
* ''Y'' is a year in the following format: ''2012''
* ''m'' is a month in the following format: ''01''
* ''w'' is a week in the following format: ''01''
* ''s'' is seconds
== Page / Time / Limit modifiers ==
* /limit/#/
* /page/#/
* /startTime/YmdHi/
* /endTime/YmdHi/
* /year/Y/
* /month/m/
* /week/w/
* /beforeKillID/#/
* /afterKillID/#/
* /pastSeconds/s/
* /killID/#/
== Fetch Type modifiers ==
* /kills/
* /losses/
* /w-space/
* /solo/
== Order modifiers ==
* /orderDirection/asc/ (Oldest to latest)
* /orderDirection/desc/ (Latest to oldest)
== Fetch modifiers ==
* /characterID/#/
* /corporationID/#/
* /allianceID/#/
* /factionID/#/
* /shipTypeID/#/
* /groupID/#/
* /solarSystemID/#/
* /regionID/#/
== Information modifiers ==
* /no-items/
* /no-attackers/
* /api-only/
== Format modifiers ==
* /xml/
== Examples ==
* https://zkillboard.com/api/kills/w-space/
* https://zkillboard.com/api/kills/w-space/xml/
* https://zkillboard.com/api/losses/solo/
* https://zkillboard.com/api/losses/solo/xml/
* https://zkillboard.com/api/kills/characterID/268946627/
* https://zkillboard.com/api/kills/characterID/268946627,1633218082/
* https://zkillboard.com/api/kills/characterID/268946627/xml/
* https://zkillboard.com/api/solo/kills/characterID/268946627/
* https://zkillboard.com/api/w-space/corporationID/98076299/
* https://zkillboard.com/api/w-space/corporationID/98076299/page/2/
* https://zkillboard.com/api/kills/shipID/644,638/orderDirection/asc/
* https://zkillboard.com/api/kills/regionID/10000002/
47 changes: 47 additions & 0 deletions classes/Account.php
@@ -0,0 +1,47 @@
<?php

class Account
{
public static function getUserTrackerData()
{
$entities = array("character", "corporation", "alliance", "faction", "ship", "item", "system", "region");
$entlist = array();

foreach($entities as $ent)
{
Db::execute("update zz_users_config set locker = 'tracker_$ent' where locker = '$ent'");
$result = UserConfig::get("tracker_$ent");
$part = array();

if($result != null) foreach($result as $row) {
switch($ent)
{
case "system":
$row["solarSystemID"] = $row["id"];
$row["solarSystemName"] = $row["name"];
$sunType = Db::queryField("SELECT sunTypeID FROM ccp_systems WHERE solarSystemID = :id", "sunTypeID", array(":id" => $row["id"]));
$row["sunTypeID"] = $sunType;
break;

case "item":
$row["typeID"] = $row["id"];
$row["shipName"] = $row["name"];
break;

case "ship":
$row["shipTypeID"] = $row["id"];
$row["${ent}Name"] = $row["name"];
break;

default:
$row["${ent}ID"] = $row["id"];
$row["${ent}Name"] = $row["name"];
break;
}
$part[] = $row;
}
$entlist[$ent] = $part;
}
return $entlist;
}
}

0 comments on commit a91e0a8

Please sign in to comment.