fishy-framework /core/run.php

Language PHP Lines 81
MD5 Hash 6d9d7770a8a67b6f891741c202b2d578 Estimated Cost $728 (why?)
Repository https://github.com/wilkerlucio/fishy-framework.git View Raw File View Project SPDX
 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
<?php

/*
 * Copyright 2008 Wilker Lucio <wilkerlucio@gmail.com>
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. 
 */

//set some system definitios
define('FISHY_SYSTEM_CLASS_PREFIX', 'Fishy_');

//load core exceptions
require_once FISHY_SYSTEM_CORE_PATH . '/core_exceptions.php';

//some simple usefull helpers functions
require_once FISHY_SYSTEM_CORE_PATH . '/core_helpers.php';

//autoloader for classes
include_once FISHY_SYSTEM_CORE_PATH . '/autoloader.php';

//load uri
$current_uri = Fishy_Uri::get_querystring();

//load configuration basics
$conf = include FISHY_CONFIG_PATH . '/config.php';

define('FISHY_BASE_URL', $conf->base_url);
define('FISHY_INDEX_PAGE', $conf->index_page);

//load router configuration
$router_conf = require_once FISHY_CONFIG_PATH . '/router.php';

$ROUTER = new UserRouter();

//load slice routes
foreach (glob(FISHY_SLICES_PATH . "/*/config/router.php") as $router) {
	include_once $router;
}

try {
	$current_route = $ROUTER->match($current_uri);
} catch (Fishy_RouterException $e) {
	dispatch_error($e, 404);
}

//disable magic quotes
include_once FISHY_SYSTEM_CORE_PATH . '/magic_quotes.php';

//transform upload format
include_once FISHY_SYSTEM_CORE_PATH . '/upload_transform.php';

//load database
require_once FISHY_SYSTEM_DATABASE_PATH . '/ActiveRecord.php';

$db_conf = include FISHY_CONFIG_PATH . '/db.php';

FieldAct::set_upload_path(FISHY_UPLOAD_PATH . '/');
DBCommand::configure($db_conf->host, $db_conf->user, $db_conf->password, $db_conf->database);

//if your submodules needs to do something, this is the time!
foreach (glob(FISHY_SLICES_PATH . "/*/config/setup.php") as $setup) {
	include_once $setup;
}

//run!
try {
	Fishy_Controller::run($current_route);
} catch (Exception $e) {
	dispatch_error($e);
}
Back to Top