-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.php
101 lines (90 loc) · 2.43 KB
/
init.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 defined('SYSPATH') or die ('No direct script access.');
// define some constants that make it easier to add line endings
if ( ! defined('EOL')) {
/**
* CONST :: end of line
* @var string
*/
define('EOL', "\r\n");
}
if ( ! defined('HEOL')) {
/**
* CONST :: HTML line ending with new line
* @var string
*/
define('HEOL', "<br />\r\n");
}
if ( ! defined('TAB')) {
/**
* CONST :: HTML line ending with new line
* @var string
*/
define('TAB', "\t");
}
$routes = Kohana::$config->load('xm.routes');
if ($routes['login']) {
// login page
Route::set('login', 'login(/<action>)', array('action' => '[a-z_]{0,}',))
->defaults(array(
'controller' => 'Login',
'action' => NULL,
));
}
if ($routes['account']) {
// account: profile and change password
Route::set('account', 'account(/<action>)', array('action' => '[a-z_]{0,}',))
->defaults(array(
'controller' => 'Account',
'action' => 'profile',
));
}
if ($routes['xm_db_admin']) {
// claero admin
// Most cases: /dbadmin/user/edit/2
// Special case for download: /dbadmin/demo/download/2/public_filename
// Special case for add_multiple: /dbadmin/demo/add_mulitple/5 (where 5 is the number of records to add)
Route::set('xm_db_admin', 'dbadmin(/<model>(/<action>(/<id>(/<column_name>))))', array(
'model' => '[a-zA-Z0-9_]{0,}',
'action' => '[a-z_]+',
'id' => '\d+',
'column_name' => '[a-z_]+')
)->defaults(array(
'controller' => 'XMAdmin',
'model' => NULL, // this is the default object that will be displayed when accessing xm_db_admin (dbadmin) without a model
'action' => 'index',
'id' => NULL,
'column_name' => NULL,
));
}
if ($routes['model_create']) {
// model create
Route::set('model_create', 'model_create(/<model>/<action>)', array(
'model' => '[a-zA-Z0-9_]{0,}',
))->defaults(array(
'controller' => 'Model_Create',
'action' => 'index',
'model' => NULL,
));
}
if ($routes['user_admin']) {
Route::set('user_admin', 'user_admin(/<action>(/<id>))')
->defaults(array(
'controller' => 'User_Admin',
'action' => NULL,
));
}
if ($routes['content_admin']) {
// route for content admin
Route::set('content_admin', 'content_admin(/<action>(/<id>))')
->defaults(array(
'controller' => 'Content',
'action' => 'index',
));
}
if ($routes['error_admin']) {
Route::set('error_admin', 'error_admin(/<action>(/<error_group_id>(/<error_log_id>)))')
->defaults(array(
'controller' => 'Error_Admin',
'action' => NULL,
));
}