-
Notifications
You must be signed in to change notification settings - Fork 2
/
install_mod.xml
202 lines (193 loc) · 8.5 KB
/
install_mod.xml
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
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="modx.prosilver.en.xsl"?>
<!--NOTICE: Please open this file in your web browser. If presented with a security warning, you may safely tell it to allow the blocked content.-->
<!--For security purposes, please check: http://www.phpbb.com/mods/ for the latest version of this MOD.\nAlthough MODs are checked before being allowed in the MODs Database there is no guarantee that there are no security problems within the MOD.\nNo support will be given for MODs not found within the MODs Database which can be found at http://www.phpbb.com/mods/-->
<mod xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.phpbb.com/mods/xml/modx-1.2.5.xsd">
<header>
<meta name="generator" content="MODX file generated with PP MODX Creator by tumba25 (online version)"/>
<meta name="generator" content="MODX file generated by MODX Generator by tumba25"/>
<license><![CDATA[http://opensource.org/licenses/gpl-license.php GNU General Public License v2]]></license>
<title lang="en"><![CDATA[phpBB Mobile]]></title>
<description lang="en"><![CDATA[phpBB Mobile is a fully automatic modification which, when a user accesses your forum using a mobile device, sends them a mobile optimised version of the forum. The style was built using iWebKit, so is designed for iOS devices such as the iPhone and iPad, but it also works with other phones with webkit based browsers or browsers that support css3, meaning it will work for Android, BlackBerries, etc.]]></description>
<author-group>
<author>
<realname><![CDATA[Callum Macrae]]></realname>
<username><![CDATA[Callum95]]></username>
<homepage><![CDATA[http://lynxphp.com/]]></homepage>
<email><![CDATA[[email protected]]]></email>
</author>
</author-group>
<mod-version>2.0.0-RC2</mod-version>
<installation>
<level>easy</level>
<time>300</time>
<target-version>3.0.8</target-version>
</installation>
</header>
<action-group>
<copy>
<file from="root/adm/style/acp_mobile.html" to="adm/style/acp_mobile.html"/>
<file from="root/includes/mobile.php" to="includes/mobile.php"/>
<file from="root/includes/acp/acp_mobile.php" to="includes/acp/acp_mobile.php"/>
<file from="root/includes/acp/info/acp_mobile.php" to="includes/acp/info/acp_mobile.php"/>
<file from="root/language/en/mods/info_acp_mobile.php" to="language/en/mods/info_acp_mobile.php"/>
<file from="root/language/en/mods/mobile.php" to="language/en/mods/mobile.php"/>
<file from="root/language/en/mods/permissions_mobile.php" to="language/en/mods/permissions_mobile.php"/>
<file from="root/install_mobile.php" to="install_mobile.php"/>
<file from="root/umil/*.*" to="umil/*.*"/>
<file from="root/styles/mobile/*.*" to="styles/mobile/*.*"/>
</copy>
<open src="common.php">
<edit>
<find><![CDATA[ @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);
}]]></find>
<action type="after-add"><![CDATA[//phpBB Mobile
require($phpbb_root_path . 'includes/mobile.' . $phpEx);]]></action>
</edit>
</open>
<open src="includes/session.php">
<edit>
<find><![CDATA[ global $db, $template, $config, $auth, $phpEx, $phpbb_root_path, $cache;]]></find>
<action type="replace-with"><![CDATA[ global $db, $template, $config, $auth, $phpEx, $phpbb_root_path, $cache, $user;]]></action>
</edit>
<edit>
<find><![CDATA[ if (!empty($_GET['style']) && $auth->acl_get('a_styles') && !defined('ADMIN_START'))
{
global $SID, $_EXTRA_URL;
$style = request_var('style', 0);
$SID .= '&style=' . $style;
$_EXTRA_URL = array('style=' . $style);
}
else
{
// Set up style
$style = ($style) ? $style : ((!$config['override_user_style']) ? $this->data['user_style'] : $config['default_style']);
}
$sql = 'SELECT s.style_id, t.template_storedb, t.template_path, t.template_id, t.bbcode_bitfield, t.template_inherits_id, t.template_inherit_path, c.theme_path, c.theme_name, c.theme_storedb, c.theme_id, i.imageset_path, i.imageset_id, i.imageset_name
FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . ' c, ' . STYLES_IMAGESET_TABLE . " i
WHERE s.style_id = $style
AND t.template_id = s.template_id
AND c.theme_id = s.theme_id
AND i.imageset_id = s.imageset_id";
$result = $db->sql_query($sql, 3600);
$this->theme = $db->sql_fetchrow($result);
$db->sql_freeresult($result);]]></find>
<action type="replace-with"><![CDATA[ // START PHPBB MOBILE
$mobile_enabled = request_var($config['cookie_name'] . '_mobile', true, false, true);
$mobile_override = request_var('mobile_disable', (bool) false);
$this->mobile_style = isset($config['mobile_enabled']) && $config['mobile_enabled'] && preg_match($config['mobile_agents'], $this->browser) && $auth->acl_get('u_mobile') && $mobile_enabled && !$mobile_override;
if ($this->mobile_style)
{
$user->add_lang('mods/mobile');
$this->theme = array(
'style_id' => '2000',
'template_storedb' => '0',
'template_path' => 'mobile',
'template_id' => '2000',
'bbcode_bitfield' => '+Ng=',
'template_inherits_id' => '0',
'template_inherit_path' => '',
'theme_path' => 'mobile',
'theme_name' => 'phpBB iPhone',
'theme_storedb' => '0',
'theme_id' => '2000',
'imageset_path' => 'mobile',
'imageset_id' => '2000',
'imageset_name' => 'phpBB iPhone',
);
}
else
{
// This code is original phpBB code
if (!empty($_GET['style']) && $auth->acl_get('a_styles') && !defined('ADMIN_START'))
{
global $SID, $_EXTRA_URL;
$style = request_var('style', 0);
$SID .= '&style=' . $style;
$_EXTRA_URL = array('style=' . $style);
}
else
{
// Set up style
$style = ($style) ? $style : ((!$config['override_user_style']) ? $this->data['user_style'] : $config['default_style']);
}
$sql = 'SELECT s.style_id, t.template_storedb, t.template_path, t.template_id, t.bbcode_bitfield, t.template_inherits_id, t.template_inherit_path, c.theme_path, c.theme_name, c.theme_storedb, c.theme_id, i.imageset_path, i.imageset_id, i.imageset_name
FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . ' c, ' . STYLES_IMAGESET_TABLE . " i
WHERE s.style_id = $style
AND t.template_id = s.template_id
AND c.theme_id = s.theme_id
AND i.imageset_id = s.imageset_id";
$result = $db->sql_query($sql, 3600);
$this->theme = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
}
// END PHPBB MOBILE]]></action>
</edit>
<edit>
<find><![CDATA[ // Same query in style.php]]></find>
<action type="before-add"><![CDATA[ if (!$this->mobile_style)
{]]></action>
</edit>
<edit>
<find><![CDATA[ add_log('admin', 'LOG_IMAGESET_LANG_MISSING', $this->theme['imageset_name'], $this->img_lang);
}
}]]></find>
<action type="after-add"><![CDATA[ }
else
{
$this->img_array = $this->fetch_imageset_cfg('mobile');
$this->img_array = array_merge($this->img_array, $this->fetch_imageset_cfg('mobile', true));
$template->assign_vars(array(
'U_DESKTOP' => append_sid($user->page['page'], "mobile_disable=1"),
));
}]]></action>
</edit>
<edit>
<find><![CDATA[}
?>]]></find>
<action type="before-add"><![CDATA[ function fetch_imageset_cfg($imageset_name, $lang = false)
{
global $phpbb_root_path;
$lang = ($lang) ? '/' . $this->img_lang : '';
$img_array = array();
if (@file_exists("{$phpbb_root_path}styles/{$imageset_name}/imageset{$lang}/imageset.cfg"))
{
$cfg_data_imageset_data = parse_cfg_file("{$phpbb_root_path}styles/{$imageset_name}/imageset{$lang}/imageset.cfg");
foreach ($cfg_data_imageset_data as $image_name => $value)
{
if (strpos($value, '*') !== false)
{
if (substr($value, -1, 1) === '*')
{
list($image_filename, $image_height) = explode('*', $value);
$image_width = 0;
}
else
{
list($image_filename, $image_height, $image_width) = explode('*', $value);
}
}
else
{
$image_filename = $value;
$image_height = $image_width = 0;
}
if (strpos($image_name, 'img_') === 0 && $image_filename)
{
$image_name = substr($image_name, 4);
$img_array[$image_name] = array(
'image_filename' => $image_filename,
'image_height' => $image_height,
'image_width' => $image_width,
'image_lang' => ($lang) ? $this->img_lang : false,
);
}
}
}
return $img_array;
}]]></action>
</edit>
</open>
<php-installer><![CDATA[install_mobile.php]]></php-installer>
</action-group>
</mod>