-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.php
149 lines (141 loc) · 2.99 KB
/
install.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
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
147
148
149
<?php
/**
* install.php
*
* @package Team Page
* @version 5.2
* @author Diego Andrés <diegoandres_cortes@outlook.com>
* @copyright Copyright (c) 2022, SMF Tricks
* @license https://www.mozilla.org/en-US/MPL/2.0/
*/
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');
elseif (!defined('SMF'))
exit('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');
global $smcFunc, $context;
db_extend('packages');
if (empty($context['uninstalling']))
{
// Team Page - Groups
$tables[] = [
'table_name' => '{db_prefix}teampage_groups',
'columns' => [
[
'name' => 'id_group',
'type' => 'smallint',
'size' => 5,
'unsigned' => true,
'not_null' => true,
'default' => 0,
],
[
'name' => 'id_page',
'type' => 'smallint',
'size' => 3,
'not_null' => true,
'default' => 0,
'unsigned' => true,
],
[
'name' => 'placement',
'type' => 'varchar',
'size' => 10,
'not_null' => true,
],
[
'name' => 'position',
'type' => 'smallint',
'size' => 3,
'not_null' => true,
'default' => 0,
'unsigned' => true,
],
],
'indexes' => [
[
'type' => 'primary',
'columns' => ['id_group', 'id_page']
],
[
'type' => 'index',
'columns' => ['placement']
],
],
'if_exists' => 'ignore',
'error' => 'fatal',
'parameters' => [],
];
// Team Page - Custom Pages
$tables[] = [
'table_name' => '{db_prefix}teampage_pages',
'columns' => [
[
'name' => 'id_page',
'type' => 'smallint',
'size' => 3,
'not_null' => true,
'auto' => true,
'unsigned' => true,
],
[
'name' => 'page_name',
'type' => 'varchar',
'size' => 35,
'not_null' => true,
],
[
'name' => 'page_action',
'type' => 'varchar',
'size' => 15,
'not_null' => true,
],
[
'name' => 'page_type',
'type' => 'text',
'not_null' => true,
],
[
'name' => 'page_body',
'type' => 'text',
'not_null' => false,
],
[
'name' => 'page_order',
'type' => 'smallint',
'size' => 3,
'default' => 0,
'not_null' => true,
'unsigned' => true,
],
[
'name' => 'mods_style',
'type' => 'smallint',
'size' => 3,
'not_null' => true,
'default' => 0,
'unsigned' => true,
],
[
'name' => 'page_boards',
'type' => 'text',
'not_null' => false,
],
],
'indexes' => [
[
'type' => 'primary',
'columns' => ['id_page']
],
[
'type' => 'index',
'columns' => ['page_order', 'page_action']
]
],
'if_exists' => 'ignore',
'error' => 'fatal',
'parameters' => [],
];
// Installing
foreach ($tables as $table)
$smcFunc['db_create_table']($table['table_name'], $table['columns'], $table['indexes'], $table['parameters'], $table['if_exists'], $table['error']);
}