forked from Akkarinage/ROChargenPHP
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
101 lines (69 loc) · 3.06 KB
/
index.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
<?php
/**
* @fileoverview index.php, Dispatcher
* @author Vincent Thibault (alias KeyWorld - Twitter: @robrowser)
* @version 2.1.0
*/
ob_start();
// Error manager
ini_set('display_errors', 0);
error_reporting(E_ALL);
define('__ROOT__', dirname(__FILE__) . '/');
// Loading CORE files
require_once( __ROOT__ . 'core/class.Debug.php');
require_once( __ROOT__ . 'core/class.Controller.php');
require_once( __ROOT__ . 'core/class.Cache.php');
require_once( __ROOT__ . 'core/class.Client.php');
require_once( __ROOT__ . 'core/class.DB.php');
// Set on the debug
//Debug::enable();
/// Configs ---------------------------------------------------------
//- Cache
Cache::$path = __ROOT__ . "cache/" ; // Cache directory
Cache::$time = 15 * 60 ; // cache for 15 mins (set to 0 if you want to disable cache).
//- Client
Client::$path = __ROOT__ . "client/" ; // Define where your client path is (where you put your grfs, data, etc.)
Client::$data_ini = "DATA.INI" ; // The name of your DATA.INI (to locate your grfs, if not set: grfs will not be loaded)
Client::$AutoExtract = true ; // If true, client will save extracted files from GRF into the data folder.
//- DB
DB::$path = __ROOT__ . "db/" ; // The db folder (where is located the lua likes files)
//- Sql
Controller::$hostname = "127.0.0.1" ; // Mysql Host
Controller::$database = "ragnarok" ; // Database Name
Controller::$username = "ragnarok" ; // Database Username
Controller::$password = "ragnarok" ; // Database Pass
/// -----------------------------------------------------------------
// No write access to directory ? disable cache.
if( Cache::$time && !is_writable(Cache::$path) ) {
Cache::$time = 0;
Debug::write('Disable Cache system, don\'t have write acess to "'. Cache::$path .'".', 'error');
}
if( Client::$AutoExtract && !is_writable(Client::$path . 'data/') ) {
Client::$AutoExtract = false;
Debug::write('Disable GRF auto-extract mode, don\'t have write access to "'. Client::$path .'data/".', 'error');
}
// Don't cache images when debug mode is on
if( Debug::isEnable() ) {
Cache::$time = 0;
}
// Url Rewriting
$routes = array();
$routes['/character/(.*)/(\d+)/([0-7])'] = 'Character';
$routes['/character/(.*)'] = 'Character';
$routes['/characterhead/(.*)'] = 'CharacterHead';
$routes['/avatar/(.*)'] = 'Avatar';
$routes['/signature/(.*)'] = 'Signature';
$routes['/monster/(\d+)'] = 'Monster';
$routes['/generate/body=(F|M)-(\d+)-(1|0)-(\d+)/hair=(\d+)-(\d+)-(\d)/hats=(\d+)-(\d+)-(\d+)/equip=(\d+)-(\d+)-(\d+)/option=(\d+)/actdir=([0-7])-(\d+)-(\d+)'] = 'Generator';
//$routes['/update/(hats|mobs|robes)'] = 'Update'; // Uncomment this line if you want to perform updates by updating lua files.
try {
// Initialize client and process
Client::init();
Controller::run($routes);
}
catch(Exception $e)
{
Debug::write( $e->getMessage(), 'error');
}
// Debug
Debug::output();