-
Notifications
You must be signed in to change notification settings - Fork 0
/
1_0_to_1_4.mod
299 lines (295 loc) · 10.8 KB
/
1_0_to_1_4.mod
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
## EasyMOD compliant
##############################################################
## MOD Title: MapBBCode Upgrade from 1.0
## MOD Author: Zverik <[email protected]> (Ilya Zverev)
## MOD Description: Upgrade [map] bbcode MOD from 1.0 to 1.4
## MOD Version: 1.4
##
## Installation Level: Easy
## Installation Time: 15 Minutes
## Files To Edit: 10
## posting.php
## privmsg.php
## viewtopic.php
## includes/bbcode.php
## includes/page_header.php
## includes/topic_review.php
## templates/subSilver/bbcode.tpl
## templates/subSilver/posting_body.tpl
## templates/subSilver/overall_header.tpl
## templates/subSilver/simple_header.tpl
## Included Files: 5 + 16 js,css,png
## db_install.php
## language/lang_mapbbcode.php
## language/lang_mapbbcode_russian.php
## admin/admin_mapbbcode.php
## templates/subSilver/admin/mapbbcode_body.tpl
## includes/mapbbcode/*
##
## License: http://www.wtfpl.net/ WTFPL
##############################################################
## Author Notes:
## This MOD was tested on phpBB 2.0.21 and 2.0.23.
## And yes, it is EasyMOD friendly.
##############################################################
## MOD History:
##
## 2013-12-22 - Version 1.4
## - initial release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ COPY ]------------------------------------------------
#
# It is much simpler to copy those files than to modify them
#
copy root/language/lang_mapbbcode.php to language/lang_english/lang_mapbbcode.php
copy root/language/lang_mapbbcode_russian.php to language/lang_russian/lang_mapbbcode.php
copy root/admin/admin_mapbbcode.php to admin/admin_mapbbcode.php
copy root/templates/admin/mapbbcode_body.tpl to templates/subSilver/admin/mapbbcode_body.tpl
copy root/includes/mapbbcode_addons.php to includes/mapbbcode_addons.php
copy root/mapbbcode/*.* to includes/mapbbcode/*.*
#
#-----[ SQL ]------------------------------------------
#
# insert those records manually:
#
INSERT INTO phpbb_config (config_name, config_value) VALUES ('mapbb_enable_external','0');
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
if (preg_match('/\[map(?:=[0-9.,-]+)?\].*?\[\/map\]/', $postrow[$i]['post_text'])) {
#
#-----[ REPLACE WITH ]------------------------------------------
#
if (preg_match('/\[map(?:=[0-9.,-]+)?\].*?\[\/map\]|\[mapid\][a-z]+\[\/mapid\]/', $postrow[$i]['post_text'])) {
#
#-----[ OPEN ]------------------------------------------
#
privmsg.php
#
#-----[ FIND ]------------------------------------------
#
$mapbbcode_present = preg_match('/\[map(?:=[0-9.,-]+)?\].*?\[\/map\]/', $privmsg['privmsgs_text']);
#
#-----[ REPLACE WITH ]------------------------------------------
#
$mapbbcode_present = preg_match('/\[map(?:=[0-9.,-]+)?\].*?\[\/map\]|\[mapid\][a-z]+\[\/mapid\]/', $privmsg['privmsgs_text']);
#
#-----[ OPEN ]------------------------------------------
#
includes/bbcode.php
#
#-----[ FIND ]------------------------------------------
#
$bbcode_tpl['map'] = str_replace('{MAPBBCODE}', '\\1\\3', $bbcode_tpl['map']);
#
#-----[ AFTER, ADD ]------------------------------------------
#
$bbcode_tpl['mapid'] = str_replace('{DIVID}', '\\1', $bbcode_tpl['mapid']);
$bbcode_tpl['mapid'] = str_replace('{MAPID}', '\\3', $bbcode_tpl['mapid']);
#
#-----[ FIND ]------------------------------------------
#
$replacements[] = $bbcode_tpl['map'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
global $board_config;
if (isset($board_config) && $board_config['mapbb_enable_external'])
{
$mapre = '#\[mapid(:[a-fA-F0-9]+)?(\]([a-z]+)\[/mapid\])#i';
$text = preg_replace_callback($mapre, create_function('$m','return "[mapid:".make_bbcode_uid().$m[2];'), $text);
$patterns[] = $mapre;
$replacements[] = $bbcode_tpl['mapid'];
}
#
#-----[ OPEN ]------------------------------------------
#
includes/topic_review.php
#
#-----[ FIND ]------------------------------------------
#
if (preg_match('/\[map(?:=[0-9.,-]+)?\].*?\[\/map\]/', $row['post_text'])) {
#
#-----[ REPLACE WITH ]------------------------------------------
#
if (preg_match('/\[map(?:=[0-9.,-]+)?\].*?\[\/map\]|\[mapid\][a-z]+\[\/mapid\]/', $row['post_text'])) {
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
include($phpbb_root_path . 'language/lang_english/lang_mapbbcode.' . $phpEx);
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
include($phpbb_root_path . 'includes/mapbbcode_addons.' . $phpEx);
#
#-----[ FIND ]------------------------------------------
#
"LAYERS" => $board_config['mapbb_layers'],
#
#-----[ REPLACE WITH ]------------------------------------------
#
"LAYERS" => str_replace("'", "\\'", $board_config['mapbb_layers']),
#
#-----[ FIND ]------------------------------------------
#
'L_MAPBB_CLOSE' => $lang['MapBB_close'],
'L_MAPBB_REMOVE' => $lang['MapBB_remove'],
'L_MAPBB_APPLY' => $lang['MapBB_apply'],
'L_MAPBB_CANCEL' => $lang['MapBB_cancel'],
'L_MAPBB_TITLE' => $lang['MapBB_title'],
'L_MAPBB_BING' => $lang['MapBB_bing'],
'L_MAPBB_ZOOMINTITLE' => $lang['MapBB_zoomInTitle'],
'L_MAPBB_ZOOMOUTTITLE' => $lang['MapBB_zoomOutTitle'],
'L_MAPBB_APPLYTITLE' => $lang['MapBB_applyTitle'],
'L_MAPBB_CANCELTITLE' => $lang['MapBB_cancelTitle'],
'L_MAPBB_FULLSCREENTITLE' => $lang['MapBB_fullScreenTitle'],
'L_MAPBB_HELPTITLE' => $lang['MapBB_helpTitle'],
'L_MAPBB_OUTERTITLE' => $lang['MapBB_outerTitle'],
'L_MAPBB_POLYLINETITLE' => $lang['MapBB_polylineTitle'],
'L_MAPBB_POLYGONTITLE' => $lang['MapBB_polygonTitle'],
'L_MAPBB_MARKERTITLE' => $lang['MapBB_markerTitle'],
'L_MAPBB_DRAWCANCELTITLE' => $lang['MapBB_drawCancelTitle'],
'L_MAPBB_MARKERTOOLTIP' => $lang['MapBB_markerTooltip'],
'L_MAPBB_POLYLINESTARTTOOLTIP' => $lang['MapBB_polylineStartTooltip'],
'L_MAPBB_POLYLINECONTINUETOOLTIP' => $lang['MapBB_polylineContinueTooltip'],
'L_MAPBB_POLYLINEENDTOOLTIP' => $lang['MapBB_polylineEndTooltip'],
'L_MAPBB_POLYGONSTARTTOOLTIP' => $lang['MapBB_polygonStartTooltip'],
'L_MAPBB_POLYGONCONTINUETOOLTIP' => $lang['MapBB_polygonContinueTooltip'],
'L_MAPBB_POLYGONENDTOOLTIP' => $lang['MapBB_polygonEndTooltip'],
'L_MAPBB_HELPCONTENTS' => implode(',', array_map('mapbb_array_to_array', $lang['MapBB_helpContents'])),
#
#-----[ REPLACE WITH ]------------------------------------------
#
"L_MAPBB_LANG_JS" => $lang['MapBB_Lang_JS'],
"L_MAPBB_JS_ADDONS" => str_replace('%base%', 'includes/mapbbcode', $lang['MapBB_JS_Addons']),
"ENABLE_EXTERNAL" => $board_config['mapbb_enable_external'] ? 'true' : 'false',
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/bbcode.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- BEGIN map --><div id="map{DIVID}">{MAPBBCODE}</div><script language="javascript">mapBBcode.show('map{DIVID}');</script><!-- END map -->
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- BEGIN mapid --><div id="map{DIVID}"></div><script language="javascript">mapBBcode.showExternal('map{DIVID}', '{MAPID}');</script><!-- END mapid -->
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/overall_header.tpl
#
#-----[ FIND ]------------------------------------------
#
<!--[if lte IE 8]>
<link rel="stylesheet" href="includes/mapbbcode/leaflet.ie.css" />
<link rel="stylesheet" href="includes/mapbbcode/leaflet.draw.ie.css" />
<![endif]-->
<script src="includes/mapbbcode/leaflet.js"></script>
<script src="includes/mapbbcode/leaflet.draw.js"></script>
<script src="includes/mapbbcode/Bing.js"></script>
<script src="includes/mapbbcode/mapbbcode.js"></script>
<script src="includes/mapbbcode/mapbbcode-config.js"></script>
#
#-----[ REPLACE WITH ]------------------------------------------
#
<script src="includes/mapbbcode/leaflet.js"></script>
<script src="includes/mapbbcode/leaflet.draw.js"></script>
<script src="includes/mapbbcode/mapbbcode.js"></script>
<script src="includes/mapbbcode/LayerList.js"></script>
<script src="includes/mapbbcode/lang/{L_MAPBB_LANG_JS}.js"></script>
{L_MAPBB_JS_ADDONS}
#
#-----[ FIND ]------------------------------------------
#
libPath: 'includes/mapbbcode/',
#
#-----[ REPLACE WITH ]------------------------------------------
#
windowPath: 'includes/mapbbcode/',
#
#-----[ FIND ]------------------------------------------
#
fullFromStart: {ALWAYS_FULL},
#
#-----[ AFTER, ADD ]------------------------------------------
#
outerLinkTemplate: '{OUTER_LINK}',
uploadButton: {ENABLE_EXTERNAL},
#
#-----[ FIND ]------------------------------------------
#
mapBBcode.setStrings({
close: '{L_MAPBB_CLOSE}',
remove: '{L_MAPBB_REMOVE}',
apply: '{L_MAPBB_APPLY}',
cancel: '{L_MAPBB_CANCEL}',
title: '{L_MAPBB_TITLE}',
bing: '{L_MAPBB_BING}',
zoomInTitle: '{L_MAPBB_ZOOMINTITLE}',
zoomOutTitle: '{L_MAPBB_ZOOMOUTTITLE}',
applyTitle: '{L_MAPBB_APPLYTITLE}',
cancelTitle: '{L_MAPBB_CANCELTITLE}',
fullScreenTitle: '{L_MAPBB_FULLSCREENTITLE}',
helpTitle: '{L_MAPBB_HELPTITLE}',
outerTitle: '{L_MAPBB_OUTERTITLE}',
polylineTitle: '{L_MAPBB_POLYLINETITLE}',
polygonTitle: '{L_MAPBB_POLYGONTITLE}',
markerTitle: '{L_MAPBB_MARKERTITLE}',
drawCancelTitle: '{L_MAPBB_DRAWCANCELTITLE}',
markerTooltip: '{L_MAPBB_MARKERTOOLTIP}',
polylineStartTooltip: '{L_MAPBB_POLYLINESTARTTOOLTIP}',
polylineContinueTooltip: '{L_MAPBB_POLYLINECONTINUETOOLTIP}',
polylineEndTooltip: '{L_MAPBB_POLYLINEENDTOOLTIP}',
polygonStartTooltip: '{L_MAPBB_POLYGONSTARTTOOLTIP}',
polygonContinueTooltip: '{L_MAPBB_POLYGONCONTINUETOOLTIP}',
polygonEndTooltip: '{L_MAPBB_POLYGONENDTOOLTIP}',
helpContents: [{L_MAPBB_HELPCONTENTS}]
});
#
#-----[ REPLACE WITH ]------------------------------------------
#
// no strings
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/simple_header.tpl
#
#-----[ FIND ]------------------------------------------
#
<link rel="stylesheet" href="includes/mapbbcode/leaflet.draw.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="includes/mapbbcode/leaflet.ie.css" />
<link rel="stylesheet" href="includes/mapbbcode/leaflet.draw.ie.css" />
<![endif]-->
<script src="includes/mapbbcode/leaflet.js"></script>
<script src="includes/mapbbcode/leaflet.draw.js"></script>
<script src="includes/mapbbcode/Bing.js"></script>
<script src="includes/mapbbcode/mapbbcode.js"></script>
<script src="includes/mapbbcode/mapbbcode-config.js"></script>
#
#-----[ REPLACE WITH ]------------------------------------------
#
<script src="includes/mapbbcode/leaflet.js"></script>
<script src="includes/mapbbcode/mapbbcode.js"></script>
<script src="includes/mapbbcode/LayerList.js"></script>
<script src="includes/mapbbcode/lang/{L_MAPBB_LANG_JS}.js"></script>
{L_MAPBB_JS_ADDONS}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM