1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* |
4
|
|
|
* @package Board3 Portal v2.1 |
5
|
|
|
* @copyright (c) 2013 Board3 Group ( www.board3.de ) |
6
|
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 |
7
|
|
|
* |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace board3\portal\migrations; |
11
|
|
|
|
12
|
|
|
class v210_beta1 extends \phpbb\db\migration\migration |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* Portal config table |
16
|
|
|
* @var $portal_config |
17
|
|
|
*/ |
18
|
|
|
private $portal_config = array(); |
19
|
|
|
|
20
|
|
|
public function effectively_installed() |
21
|
|
|
{ |
22
|
|
|
return $this->db_tools->sql_table_exists($this->table_prefix . 'portal_modules'); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
static public function depends_on() |
26
|
|
|
{ |
27
|
|
|
return array('\phpbb\db\migration\data\v310\extensions'); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
public function update_schema() |
31
|
|
|
{ |
32
|
|
|
return array( |
33
|
|
|
'add_tables' => array( |
34
|
|
|
$this->table_prefix . 'portal_modules' => array( |
35
|
|
|
'COLUMNS' => array( |
36
|
|
|
'module_id' => array('UINT:3', null, 'auto_increment'), |
37
|
|
|
'module_classname' => array('VCHAR:64', ''), |
38
|
|
|
'module_column' => array('TINT:3', 0), |
39
|
|
|
'module_order' => array('TINT:3', 0), |
40
|
|
|
'module_name' => array('VCHAR', ''), |
41
|
|
|
'module_image_src' => array('VCHAR', ''), |
42
|
|
|
'module_image_width' => array('INT:3', 0), |
43
|
|
|
'module_image_height' => array('INT:3', 0), |
44
|
|
|
'module_group_ids' => array('VCHAR', ''), |
45
|
|
|
'module_status' => array('TINT:1', 1), |
46
|
|
|
), |
47
|
|
|
|
48
|
|
|
'PRIMARY_KEY' => 'module_id', |
49
|
|
|
), |
50
|
|
|
$this->table_prefix . 'portal_config' => array( |
51
|
|
|
'COLUMNS' => array( |
52
|
|
|
'config_name' => array('VCHAR:255', ''), |
53
|
|
|
'config_value'=> array('MTEXT', ''), |
54
|
|
|
), |
55
|
|
|
|
56
|
|
|
'PRIMARY_KEY' => 'config_name', |
57
|
|
|
), |
58
|
|
|
), |
59
|
|
|
); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function revert_schema() |
63
|
|
|
{ |
64
|
|
|
return array( |
65
|
|
|
'drop_tables' => array( |
66
|
|
|
$this->table_prefix . 'portal_modules', |
67
|
|
|
$this->table_prefix . 'portal_config', |
68
|
|
|
), |
69
|
|
|
); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
public function update_data() |
73
|
|
|
{ |
74
|
|
|
return array( |
75
|
|
|
array('custom', array(array($this, 'clean_portal_data'))), |
76
|
|
|
array('config.add', array('board3_portal_version', '2.1.0b1')), |
77
|
|
|
array('config.add', array('board3_enable', 1)), |
78
|
|
|
array('config.add', array('board3_left_column', 1)), |
79
|
|
|
array('config.add', array('board3_right_column', 1)), |
80
|
|
|
array('config.add', array('board3_version_check', 1)), |
81
|
|
|
array('config.add', array('board3_forum_index', 1)), |
82
|
|
|
array('config.add', array('board3_left_column_width', 180)), |
83
|
|
|
array('config.add', array('board3_right_column_width', 180)), |
84
|
|
|
array('config.add', array('board3_phpbb_menu', 0)), |
85
|
|
|
array('config.add', array('board3_display_jumpbox', 1)), |
86
|
|
|
array('config.add', array('board3_menu_1', '')), |
87
|
|
|
array('config.add', array('board3_menu_url_new_window_1', '')), |
88
|
|
|
array('config.add', array('board3_birthdays_ahead_3', 30)), |
89
|
|
|
array('config.add', array('board3_attachments_number_6', 8)), |
90
|
|
|
array('config.add', array('board3_attach_max_length_6', 15)), |
91
|
|
|
array('config.add', array('board3_attachments_forum_ids_6', '')), |
92
|
|
|
array('config.add', array('board3_attachments_forum_exclude_6', '')), |
93
|
|
|
array('config.add', array('board3_attachments_filetype_6', '')), |
94
|
|
|
array('config.add', array('board3_attachments_exclude_6', '')), |
95
|
|
|
array('config.add', array('board3_topposters_7', 5)), |
96
|
|
|
array('config.add', array('board3_max_last_member_8', 8)), |
97
|
|
|
array('config.add', array('board3_welcome_message_10', '')), |
98
|
|
|
array('config.add', array('board3_welcome_message_uid_10', '')), |
99
|
|
|
array('config.add', array('board3_welcome_message_bitfield_10', '')), |
100
|
|
|
array('config.add', array('board3_max_topics_11', 10)), |
101
|
|
|
array('config.add', array('board3_recent_title_limit_11', 100)), |
102
|
|
|
array('config.add', array('board3_recent_forum_11', '')), |
103
|
|
|
array('config.add', array('board3_recent_exclude_forums_11', 1)), |
104
|
|
|
array('config.add', array('board3_announcements_style_12', '')), |
105
|
|
|
array('config.add', array('board3_number_of_announcements_12', 1)), |
106
|
|
|
array('config.add', array('board3_announcements_day_12', '')), |
107
|
|
|
array('config.add', array('board3_announcements_length_12', 200)), |
108
|
|
|
array('config.add', array('board3_global_announcements_forum_12', '')), |
109
|
|
|
array('config.add', array('board3_announcements_forum_exclude_12', '')), |
110
|
|
|
array('config.add', array('board3_announcements_archive_12', 1)), |
111
|
|
|
array('config.add', array('board3_announcements_permissions_12', 1)), |
112
|
|
|
array('config.add', array('board3_show_announcements_replies_views_12', 1)), |
113
|
|
|
array('config.add', array('board3_news_length_13', 250)), |
114
|
|
|
array('config.add', array('board3_news_forum_13', '')), |
115
|
|
|
array('config.add', array('board3_news_permissions_13', 1)), |
116
|
|
|
array('config.add', array('board3_number_of_news_13', 5)), |
117
|
|
|
array('config.add', array('board3_show_all_news_13', 1)), |
118
|
|
|
array('config.add', array('board3_news_exclude_13', '')), |
119
|
|
|
array('config.add', array('board3_news_archive_13', 1)), |
120
|
|
|
array('config.add', array('board3_news_show_last_13', '')), |
121
|
|
|
array('config.add', array('board3_show_news_replies_views_13', 1)), |
122
|
|
|
array('config.add', array('board3_news_style_13', 1)), |
123
|
|
|
array('config.add', array('board3_poll_allow_vote_14', 1)), |
124
|
|
|
array('config.add', array('board3_poll_topic_id_14', '')), |
125
|
|
|
array('config.add', array('board3_poll_exclude_id_14', '')), |
126
|
|
|
array('config.add', array('board3_poll_hide_14', '')), |
127
|
|
|
array('config.add', array('board3_poll_limit_14', 3)), |
128
|
|
|
array('config.add', array('board3_user_menu_register_16', 1)), |
129
|
|
|
array('config.add', array('board3_sunday_first_18', 1)), |
130
|
|
|
array('config.add', array('board3_calendar_today_color_18', '#000000')), |
131
|
|
|
array('config.add', array('board3_calendar_sunday_color_18', '#FF0000')), |
132
|
|
|
array('config.add', array('board3_long_month_18', '')), |
133
|
|
|
array('config.add', array('board3_display_events_18', '')), |
134
|
|
|
array('config.add', array('board3_events_18', '')), |
135
|
|
|
array('config.add', array('board3_events_url_new_window_18', '')), |
136
|
|
|
array('config.add', array('board3_leaders_ext_19', '')), |
137
|
|
|
array('config.add', array('board3_last_visited_bots_number_20', 1)), |
138
|
|
|
array('config.add', array('board3_links_21', '')), |
139
|
|
|
array('config.add', array('board3_links_url_new_window_21', '')), |
140
|
|
|
array('permission.add', array('u_view_portal', true)), |
141
|
|
|
array('permission.add', array('a_manage_portal', true)), |
142
|
|
|
array('permission.permission_set', array('GUESTS', 'u_view_portal', 'group')), |
143
|
|
|
array('permission.permission_set', array('REGISTERED_COPPA', 'u_view_portal', 'group')), |
144
|
|
|
array('permission.permission_set', array('GLOBAL_MODERATORS', 'u_view_portal', 'group')), |
145
|
|
|
array('permission.permission_set', array('ADMINISTRATORS', 'u_view_portal', 'group')), |
146
|
|
|
array('permission.permission_set', array('BOTS', 'u_view_portal', 'group')), |
147
|
|
|
array('permission.permission_set', array('NEWLY_REGISTERED', 'u_view_portal', 'group')), |
148
|
|
|
array('permission.permission_set', array('ADMINISTRATORS', 'a_manage_portal', 'group')), |
149
|
|
|
array('module.add', array( |
150
|
|
|
'acp', |
151
|
|
|
'ACP_CAT_DOT_MODS', |
152
|
|
|
'ACP_PORTAL', |
153
|
|
|
)), |
154
|
|
|
array('module.add', array( |
155
|
|
|
'acp', |
156
|
|
|
'ACP_PORTAL', |
157
|
|
|
array( |
158
|
|
|
'module_basename' => '\board3\portal\acp\portal_module', |
159
|
|
|
'module_mode' => 'config', |
160
|
|
|
'module_auth' => 'acl_a_manage_portal', |
161
|
|
|
'module_langname' => 'ACP_PORTAL_GENERAL_INFO', |
162
|
|
|
), |
163
|
|
|
)), |
164
|
|
|
array('module.add', array( |
165
|
|
|
'acp', |
166
|
|
|
'ACP_PORTAL', |
167
|
|
|
array( |
168
|
|
|
'module_basename' => '\board3\portal\acp\portal_module', |
169
|
|
|
'module_mode' => 'modules', |
170
|
|
|
'module_auth' => 'acl_a_manage_portal', |
171
|
|
|
'module_langname' => 'ACP_PORTAL_MODULES', |
172
|
|
|
), |
173
|
|
|
)), |
174
|
|
|
|
175
|
|
|
array('custom', array(array($this, 'add_portal_data'))), |
176
|
|
|
); |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
public function add_portal_data() |
180
|
|
|
{ |
181
|
|
|
if ($this->db_tools->sql_table_exists($this->table_prefix . 'portal_config')) |
182
|
|
|
{ |
183
|
|
|
$sql = 'SELECT * |
184
|
|
|
FROM ' . $this->table_prefix . 'portal_config'; |
185
|
|
|
$result = $this->db->sql_query_limit($sql, 1); |
186
|
|
|
$row = $this->db->sql_fetchrow($result); |
187
|
|
|
$this->db->sql_freeresult($result); |
188
|
|
|
if (!empty($row)) |
189
|
|
|
{ |
190
|
|
|
return; |
191
|
|
|
} |
192
|
|
|
} |
193
|
|
|
else |
194
|
|
|
{ |
195
|
|
|
return; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
// get the correct group IDs from the database |
199
|
|
|
$in_ary = array('GUESTS', 'REGISTERED', 'REGISTERED_COPPA'); |
200
|
|
|
$groups_ary = array(); |
201
|
|
|
|
202
|
|
|
$sql = 'SELECT group_id, group_name |
203
|
|
|
FROM ' . $this->table_prefix . 'groups |
204
|
|
|
WHERE ' . $this->db->sql_in_set('group_name', $in_ary); |
205
|
|
|
$result = $this->db->sql_query($sql); |
206
|
|
View Code Duplication |
while ($row = $this->db->sql_fetchrow($result)) |
207
|
|
|
{ |
208
|
|
|
$groups_ary[$row['group_name']] = $row['group_id']; |
209
|
|
|
} |
210
|
|
|
$this->db->sql_freeresult($result); |
211
|
|
|
|
212
|
|
|
// set portal config |
213
|
|
|
$this->set_portal_config('board3_menu_array_1', serialize(array( |
214
|
|
|
array( |
215
|
|
|
'title' => 'M_CONTENT', |
216
|
|
|
'url' => '', |
217
|
|
|
'type' => '', |
218
|
|
|
'permission' => '', |
219
|
|
|
), |
220
|
|
|
array( |
221
|
|
|
'title' => 'INDEX', |
222
|
|
|
'url' => 'index.php', |
223
|
|
|
'type' => 1, |
224
|
|
|
'permission' => '', |
225
|
|
|
), |
226
|
|
|
array( |
227
|
|
|
'title' => 'SEARCH', |
228
|
|
|
'url' => 'search.php', |
229
|
|
|
'type' => 1, |
230
|
|
|
'permission' => '', |
231
|
|
|
), |
232
|
|
|
array( |
233
|
|
|
'title' => 'REGISTER', |
234
|
|
|
'url' => 'ucp.php?mode=register', |
235
|
|
|
'type' => 1, |
236
|
|
|
'permission' => $groups_ary['GUESTS'], |
237
|
|
|
), |
238
|
|
|
array( |
239
|
|
|
'title' => 'MEMBERLIST', |
240
|
|
|
'url' => 'memberlist.php', |
241
|
|
|
'type' => 1, |
242
|
|
|
'permission' => $groups_ary['REGISTERED'] . ',' . $groups_ary['REGISTERED_COPPA'], |
243
|
|
|
), |
244
|
|
|
array( |
245
|
|
|
'title' => 'THE_TEAM', |
246
|
|
|
'url' => 'memberlist.php?mode=leaders', |
247
|
|
|
'type' => 1, |
248
|
|
|
'permission' => $groups_ary['REGISTERED'] . ',' . $groups_ary['REGISTERED_COPPA'], |
249
|
|
|
), |
250
|
|
|
array( |
251
|
|
|
'title' => 'M_HELP', |
252
|
|
|
'url' => '', |
253
|
|
|
'type' => '', |
254
|
|
|
'permission' => '', |
255
|
|
|
), |
256
|
|
|
array( |
257
|
|
|
'title' => 'FAQ', |
258
|
|
|
'url' => 'faq.php', |
259
|
|
|
'type' => 1, |
260
|
|
|
'permission' => '', |
261
|
|
|
), |
262
|
|
|
array( |
263
|
|
|
'title' => 'M_BBCODE', |
264
|
|
|
'url' => 'faq.php?mode=bbcode', |
265
|
|
|
'type' => 1, |
266
|
|
|
'permission' => '', |
267
|
|
|
), |
268
|
|
|
array( |
269
|
|
|
'title' => 'M_TERMS', |
270
|
|
|
'url' => 'ucp.php?mode=terms', |
271
|
|
|
'type' => 1, |
272
|
|
|
'permission' => '', |
273
|
|
|
), |
274
|
|
|
array( |
275
|
|
|
'title' => 'M_PRV', |
276
|
|
|
'url' => 'ucp.php?mode=privacy', |
277
|
|
|
'type' => 1, |
278
|
|
|
'permission' => '', |
279
|
|
|
), |
280
|
|
|
))); |
281
|
|
|
$this->set_portal_config('board3_welcome_message_10', 'Welcome to my Community!'); |
282
|
|
|
$this->set_portal_config('board3_calendar_events_18', ''); |
283
|
|
|
$this->set_portal_config('board3_links_array_21', serialize(array( |
284
|
|
|
array( |
285
|
|
|
'title' => 'Board3.de', |
286
|
|
|
'url' => 'http://www.board3.de/', |
287
|
|
|
'type' => 2, |
288
|
|
|
'permission' => '', |
289
|
|
|
), |
290
|
|
|
array( |
291
|
|
|
'title' => 'phpBB.com', |
292
|
|
|
'url' => 'http://www.phpbb.com/', |
293
|
|
|
'type' => 2, |
294
|
|
|
'permission' => '', |
295
|
|
|
), |
296
|
|
|
))); |
297
|
|
|
|
298
|
|
|
// Populate module table |
299
|
|
|
$board3_sql_query = array( |
300
|
|
|
array( |
301
|
|
|
'module_classname' => '\board3\portal\modules\main_menu', |
302
|
|
|
'module_column' => 1, |
303
|
|
|
'module_order' => 1, |
304
|
|
|
'module_name' => 'M_MENU', |
305
|
|
|
'module_image_src' => 'portal_menu.png', |
306
|
|
|
'module_group_ids' => '', |
307
|
|
|
'module_image_width' => 16, |
308
|
|
|
'module_image_height' => 16, |
309
|
|
|
'module_status' => 1, |
310
|
|
|
), |
311
|
|
|
array( |
312
|
|
|
'module_classname' => '\board3\portal\modules\stylechanger', |
313
|
|
|
'module_column' => 1, |
314
|
|
|
'module_order' => 2, |
315
|
|
|
'module_name' => 'BOARD_STYLE', |
316
|
|
|
'module_image_src' => 'portal_style.png', |
317
|
|
|
'module_group_ids' => '', |
318
|
|
|
'module_image_width' => 16, |
319
|
|
|
'module_image_height' => 16, |
320
|
|
|
'module_status' => 1, |
321
|
|
|
), |
322
|
|
|
array( |
323
|
|
|
'module_classname' => '\board3\portal\modules\birthday_list', |
324
|
|
|
'module_column' => 1, |
325
|
|
|
'module_order' => 3, |
326
|
|
|
'module_name' => 'BIRTHDAYS', |
327
|
|
|
'module_image_src' => 'portal_birthday.png', |
328
|
|
|
'module_group_ids' => '', |
329
|
|
|
'module_image_width' => 16, |
330
|
|
|
'module_image_height' => 16, |
331
|
|
|
'module_status' => 1, |
332
|
|
|
), |
333
|
|
|
array( |
334
|
|
|
'module_classname' => '\board3\portal\modules\clock', |
335
|
|
|
'module_column' => 1, |
336
|
|
|
'module_order' => 4, |
337
|
|
|
'module_name' => 'CLOCK', |
338
|
|
|
'module_image_src' => 'portal_clock.png', |
339
|
|
|
'module_group_ids' => '', |
340
|
|
|
'module_image_width' => 16, |
341
|
|
|
'module_image_height' => 16, |
342
|
|
|
'module_status' => 1, |
343
|
|
|
), |
344
|
|
|
array( |
345
|
|
|
'module_classname' => '\board3\portal\modules\search', |
346
|
|
|
'module_column' => 1, |
347
|
|
|
'module_order' => 5, |
348
|
|
|
'module_name' => 'PORTAL_SEARCH', |
349
|
|
|
'module_image_src' => 'portal_search.png', |
350
|
|
|
'module_group_ids' => '', |
351
|
|
|
'module_image_width' => 16, |
352
|
|
|
'module_image_height' => 16, |
353
|
|
|
'module_status' => 1, |
354
|
|
|
), |
355
|
|
|
array( |
356
|
|
|
'module_classname' => '\board3\portal\modules\attachments', |
357
|
|
|
'module_column' => 1, |
358
|
|
|
'module_order' => 6, |
359
|
|
|
'module_name' => 'PORTAL_ATTACHMENTS', |
360
|
|
|
'module_image_src' => 'portal_attach.png', |
361
|
|
|
'module_group_ids' => '', |
362
|
|
|
'module_image_width' => 16, |
363
|
|
|
'module_image_height' => 16, |
364
|
|
|
'module_status' => 1, |
365
|
|
|
), |
366
|
|
|
array( |
367
|
|
|
'module_classname' => '\board3\portal\modules\topposters', |
368
|
|
|
'module_column' => 1, |
369
|
|
|
'module_order' => 7, |
370
|
|
|
'module_name' => 'TOPPOSTERS', |
371
|
|
|
'module_image_src' => 'portal_top_poster.png', |
372
|
|
|
'module_group_ids' => '', |
373
|
|
|
'module_image_width' => 16, |
374
|
|
|
'module_image_height' => 16, |
375
|
|
|
'module_status' => 1, |
376
|
|
|
), |
377
|
|
|
array( |
378
|
|
|
'module_classname' => '\board3\portal\modules\latest_members', |
379
|
|
|
'module_column' => 1, |
380
|
|
|
'module_order' => 8, |
381
|
|
|
'module_name' => 'LATEST_MEMBERS', |
382
|
|
|
'module_image_src' => 'portal_members.png', |
383
|
|
|
'module_group_ids' => '', |
384
|
|
|
'module_image_width' => 16, |
385
|
|
|
'module_image_height' => 16, |
386
|
|
|
'module_status' => 1, |
387
|
|
|
), |
388
|
|
|
array( |
389
|
|
|
'module_classname' => '\board3\portal\modules\link_us', |
390
|
|
|
'module_column' => 1, |
391
|
|
|
'module_order' => 9, |
392
|
|
|
'module_name' => 'LINK_US', |
393
|
|
|
'module_image_src' => 'portal_link_us.png', |
394
|
|
|
'module_group_ids' => '', |
395
|
|
|
'module_image_width' => 16, |
396
|
|
|
'module_image_height' => 16, |
397
|
|
|
'module_status' => 1, |
398
|
|
|
), |
399
|
|
|
array( |
400
|
|
|
'module_classname' => '\board3\portal\modules\welcome', |
401
|
|
|
'module_column' => 2, |
402
|
|
|
'module_order' => 1, |
403
|
|
|
'module_name' => 'PORTAL_WELCOME', |
404
|
|
|
'module_image_src' => '', |
405
|
|
|
'module_group_ids' => '', |
406
|
|
|
'module_image_width' => 16, |
407
|
|
|
'module_image_height' => 16, |
408
|
|
|
'module_status' => 1, |
409
|
|
|
), |
410
|
|
|
array( |
411
|
|
|
'module_classname' => '\board3\portal\modules\recent', |
412
|
|
|
'module_column' => 2, |
413
|
|
|
'module_order' => 2, |
414
|
|
|
'module_name' => 'PORTAL_RECENT', |
415
|
|
|
'module_image_src' => '', |
416
|
|
|
'module_group_ids' => '', |
417
|
|
|
'module_image_width' => 16, |
418
|
|
|
'module_image_height' => 16, |
419
|
|
|
'module_status' => 1, |
420
|
|
|
), |
421
|
|
|
array( |
422
|
|
|
'module_classname' => '\board3\portal\modules\announcements', |
423
|
|
|
'module_column' => 2, |
424
|
|
|
'module_order' => 3, |
425
|
|
|
'module_name' => 'GLOBAL_ANNOUNCEMENTS', |
426
|
|
|
'module_image_src' => '', |
427
|
|
|
'module_group_ids' => '', |
428
|
|
|
'module_image_width' => 16, |
429
|
|
|
'module_image_height' => 16, |
430
|
|
|
'module_status' => 1, |
431
|
|
|
), |
432
|
|
|
array( |
433
|
|
|
'module_classname' => '\board3\portal\modules\news', |
434
|
|
|
'module_column' => 2, |
435
|
|
|
'module_order' => 4, |
436
|
|
|
'module_name' => 'LATEST_NEWS', |
437
|
|
|
'module_image_src' => '', |
438
|
|
|
'module_group_ids' => '', |
439
|
|
|
'module_image_width' => 16, |
440
|
|
|
'module_image_height' => 16, |
441
|
|
|
'module_status' => 1, |
442
|
|
|
), |
443
|
|
|
array( |
444
|
|
|
'module_classname' => '\board3\portal\modules\poll', |
445
|
|
|
'module_column' => 2, |
446
|
|
|
'module_order' => 5, |
447
|
|
|
'module_name' => 'PORTAL_POLL', |
448
|
|
|
'module_image_src' => 'portal_poll.png', |
449
|
|
|
'module_group_ids' => '', |
450
|
|
|
'module_image_width' => 16, |
451
|
|
|
'module_image_height' => 16, |
452
|
|
|
'module_status' => 1, |
453
|
|
|
), |
454
|
|
|
array( |
455
|
|
|
'module_classname' => '\board3\portal\modules\whois_online', |
456
|
|
|
'module_column' => 2, |
457
|
|
|
'module_order' => 6, |
458
|
|
|
'module_name' => 'PORTAL_WHOIS_ONLINE', |
459
|
|
|
'module_image_src' => 'portal_friends.png', |
460
|
|
|
'module_group_ids' => '', |
461
|
|
|
'module_image_width' => 16, |
462
|
|
|
'module_image_height' => 16, |
463
|
|
|
'module_status' => 1, |
464
|
|
|
), |
465
|
|
|
array( |
466
|
|
|
'module_classname' => '\board3\portal\modules\user_menu', |
467
|
|
|
'module_column' => 3, |
468
|
|
|
'module_order' => 1, |
469
|
|
|
'module_name' => 'USER_MENU', |
470
|
|
|
'module_image_src' => 'portal_user.png', |
471
|
|
|
'module_group_ids' => '', |
472
|
|
|
'module_image_width' => 16, |
473
|
|
|
'module_image_height' => 16, |
474
|
|
|
'module_status' => 1, |
475
|
|
|
), |
476
|
|
|
array( |
477
|
|
|
'module_classname' => '\board3\portal\modules\statistics', |
478
|
|
|
'module_column' => 3, |
479
|
|
|
'module_order' => 2, |
480
|
|
|
'module_name' => 'STATISTICS', |
481
|
|
|
'module_image_src' => 'portal_statistics.png', |
482
|
|
|
'module_group_ids' => '', |
483
|
|
|
'module_image_width' => 16, |
484
|
|
|
'module_image_height' => 16, |
485
|
|
|
'module_status' => 1, |
486
|
|
|
), |
487
|
|
|
array( |
488
|
|
|
'module_classname' => '\board3\portal\modules\calendar', |
489
|
|
|
'module_column' => 3, |
490
|
|
|
'module_order' => 3, |
491
|
|
|
'module_name' => 'PORTAL_CALENDAR', |
492
|
|
|
'module_image_src' => 'portal_calendar.png', |
493
|
|
|
'module_group_ids' => '', |
494
|
|
|
'module_image_width' => 16, |
495
|
|
|
'module_image_height' => 16, |
496
|
|
|
'module_status' => 1, |
497
|
|
|
), |
498
|
|
|
array( |
499
|
|
|
'module_classname' => '\board3\portal\modules\leaders', |
500
|
|
|
'module_column' => 3, |
501
|
|
|
'module_order' => 4, |
502
|
|
|
'module_name' => 'THE_TEAM', |
503
|
|
|
'module_image_src' => 'portal_team.png', |
504
|
|
|
'module_group_ids' => '', |
505
|
|
|
'module_image_width' => 16, |
506
|
|
|
'module_image_height' => 16, |
507
|
|
|
'module_status' => 1, |
508
|
|
|
), |
509
|
|
|
array( |
510
|
|
|
'module_classname' => '\board3\portal\modules\latest_bots', |
511
|
|
|
'module_column' => 3, |
512
|
|
|
'module_order' => 5, |
513
|
|
|
'module_name' => 'LATEST_BOTS', |
514
|
|
|
'module_image_src' => 'portal_bots.png', |
515
|
|
|
'module_group_ids' => '', |
516
|
|
|
'module_image_width' => 16, |
517
|
|
|
'module_image_height' => 16, |
518
|
|
|
'module_status' => 1, |
519
|
|
|
), |
520
|
|
|
array( |
521
|
|
|
'module_classname' => '\board3\portal\modules\links', |
522
|
|
|
'module_column' => 3, |
523
|
|
|
'module_order' => 6, |
524
|
|
|
'module_name' => 'PORTAL_LINKS', |
525
|
|
|
'module_image_src' => 'portal_links.png', |
526
|
|
|
'module_group_ids' => '', |
527
|
|
|
'module_image_width' => 16, |
528
|
|
|
'module_image_height' => 16, |
529
|
|
|
'module_status' => 1, |
530
|
|
|
), |
531
|
|
|
); |
532
|
|
|
$this->db->sql_multi_insert($this->table_prefix . 'portal_modules', $board3_sql_query); |
533
|
|
|
} |
534
|
|
|
|
535
|
|
|
/** |
536
|
|
|
* Set config value. Creates missing config entry. |
537
|
|
|
* Only use this if your config value might exceed 255 characters, otherwise please use set_config |
538
|
|
|
* |
539
|
|
|
* @param string $config_name Name of config entry to add or update |
540
|
|
|
* @param mixed $config_value Value of config entry to add or update |
541
|
|
|
*/ |
542
|
|
|
private function set_portal_config($config_name, $config_value) |
543
|
|
|
{ |
544
|
|
|
$portal_config = $this->portal_config; |
545
|
|
|
|
546
|
|
|
$sql = 'UPDATE ' . $this->table_prefix . "portal_config |
547
|
|
|
SET config_value = '" . $this->db->sql_escape($config_value) . "' |
548
|
|
|
WHERE config_name = '" . $this->db->sql_escape($config_name) . "'"; |
549
|
|
|
$this->db->sql_query($sql); |
550
|
|
|
|
551
|
|
|
if (!$this->db->sql_affectedrows() && !isset($portal_config[$config_name])) |
552
|
|
|
{ |
553
|
|
|
$sql = 'INSERT INTO ' . $this->table_prefix . 'portal_config ' . $this->db->sql_build_array('INSERT', array( |
554
|
|
|
'config_name' => $config_name, |
555
|
|
|
'config_value' => $config_value)); |
556
|
|
|
$this->db->sql_query($sql); |
557
|
|
|
} |
558
|
|
|
|
559
|
|
|
$this->portal_config[$config_name] = $config_value; |
560
|
|
|
} |
561
|
|
|
|
562
|
|
|
/** |
563
|
|
|
* Clean portal data upon fresh install from config table |
564
|
|
|
*/ |
565
|
|
|
public function clean_portal_data() |
566
|
|
|
{ |
567
|
|
|
// Only run if portal version is not beta 1 or doesn't exist |
568
|
|
|
if (!isset($this->config['board3_portal_version']) || $this->config['board3_portal_version'] !== '2.1.0-b1') |
569
|
|
|
{ |
570
|
|
|
foreach ($this->config as $key => $entry) |
571
|
|
|
{ |
572
|
|
|
if (strpos($key, 'board3_porrtal_') === 0) |
573
|
|
|
{ |
574
|
|
|
$this->config->delete($key); |
575
|
|
|
} |
576
|
|
|
} |
577
|
|
|
|
578
|
|
|
// Make sure entries are removed from database |
579
|
|
|
$sql = 'DELETE FROM ' . CONFIG_TABLE . ' |
580
|
|
|
WHERE config_name ' . $this->db->sql_like_expression('board3_portal_' . $this->db->get_any_char()); |
581
|
|
|
$this->db->sql_query($sql); |
582
|
|
|
} |
583
|
|
|
} |
584
|
|
|
} |
585
|
|
|
|