/
umif_manual_v1.txt
146 lines (119 loc) · 3.61 KB
/
umif_manual_v1.txt
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
{PHP_START}
/**
*
* @author {AUTHOR_USERNAME} ({AUTHOR_FULLNAME}) {AUTHOR_EMAIL}
* @package umil
* @copyright (c) {COPYRIGHT_YEAR} {COPYRIGHT_AUTHOR}
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('{LANG_FILE}');
if (!file_exists($phpbb_root_path . 'umil/umil.' . $phpEx))
{
trigger_error('Please download the latest UMIL (Unified MOD Install Library) from: <a href="http://www.phpbb.com/mods/umil/">phpBB.com/mods/umil</a>', E_USER_ERROR);
}
// We only allow a founder to install this MOD
if ($user->data['user_type'] != USER_FOUNDER)
{
if ($user->data['user_id'] == ANONYMOUS)
{
login_box('', 'LOGIN');
}
trigger_error('NOT_AUTHORISED');
}
if (!class_exists('umil'))
{
include($phpbb_root_path . 'umil/umil.' . $phpEx);
}
$umil = new umil(true);
$mod = array(
'name' => '{MOD_NAME}',
'version' => '{MOD_VERSION}',
'config' => '{MOD_CONFIG}',
'enable' => '{MOD_ENABLE}',
);
if (confirm_box(true))
{
// Install the base {MOD_VERSION} version
if (!$umil->config_exists($mod['config']))
{
// Lets add a config setting for enabling/disabling the MOD and set it to true
$umil->config_add($mod['enable'], true);
// We must handle the version number ourselves.
$umil->config_add($mod['config'], $mod['version']);
<!-- IF .permissions -->
$umil->permission_add(array(
<!-- BEGIN permissions -->
array('{permissions.VALUE}', {permissions.S_GLOBAL}),
<!-- END permissions -->
));
<!-- ENDIF -->
<!-- IF .set_perms -->
$umil->permission_set(array(
<!-- BEGIN set_perms -->
array('{set_perms.ROLE}', '{set_perms.NAME}'),
<!-- END set_perms -->
));
<!-- ENDIF -->
<!-- IF .table -->
$umil->table_add({TABLE_NAME}, array(
'COLUMNS' => array(
<!-- BEGIN table -->
'{table.NAME}' => array('{table.TYPE}', {table.DEFAULT}<!-- IF table.OPTION -->, 'auto_increment'<!-- ENDIF -->),
<!-- END table -->
),
<!-- IF .primary_keys -->
<!-- BEGIN primary_keys -->
'PRIMARY_KEY' => <!-- IF primary_keys.MULTIPLE_KEYS -->array('{primary_keys.KEY}', '{primary_keys.KEY2}'),<!-- ELSE -->'{primary_keys.KEY}',<!-- ENDIF -->
<!-- END primary_keys -->
<!-- ENDIF -->
<!-- IF .table_keys -->
'KEYS' => array(
<!-- BEGIN table_keys -->
'{table_keys.INDEX}' => array('{table_keys.TYPE}', array('{table_keys.COLUMN}'<!-- IF table_keys.COLUMN2 -->, 'table_keys.COLUMN2'<!-- ENDIF -->)),
<!-- END table_keys -->
),
<!-- ENDIF -->
));
<!-- ENDIF -->
<!-- BEGIN columns -->
$umil->table_column_add('{columns.TABLE}', '{columns.NAME}', array('{columns.TYPE}', {columns.DEFAULT}<!-- IF columns.OPTION -->, 'auto_increment'<!-- ENDIF -->));
<!-- END columns -->
<!-- BEGIN index -->
$umil->table_index_add('{index.TABLE}', '{index.INDEX}', '{index.COLUMN}');
<!-- END index -->
<!-- BEGIN configs -->
$umil->config_add('{configs.NAME}', '{configs.VALUE}', '{configs.S_DYNAMIC}');
<!-- END configs -->
<!-- IF .modules -->
$umil->module_add(array(
<!-- BEGIN modules -->
array('{modules.CLASS}', '{modules.PARENT}',
array('module_basename' => '{modules.BASENAME}'),
),
<!-- END modules -->
));
<!-- ENDIF -->
// Our final action, we purge the board cache
$umil->cache_purge();
}
// We are done
trigger_error('Done!');
}
else
{
confirm_box(false, 'INSTALL_TEST_MOD');
}
// Shouldn't get here.
redirect($phpbb_root_path . $user->page['page_name']);
{PHP_END}