forked from live627/smf-steam-auth
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodification.xml
181 lines (159 loc) · 6.14 KB
/
modification.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
<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<id>jonbons:steamauth</id>
<version>1.0</version>
<file name="$themedir/Login.template.php">
<operation>
<search position="after"><![CDATA[// Focus on the correct input - username or password.]]></search>
<add><![CDATA[
if (!empty($modSettings['steam_auth_api_key']))
{
loadLanguage('SteamAuth');
loadTemplate('SteamAuth');
$context['template_layers'][] = 'steam_login';
};
]]></add>
</operation>
<operation>
<search position="after"><![CDATA[// Do the focus thing...]]></search>
<add><![CDATA[
if (!empty($modSettings['steam_auth_api_key']))
{
loadLanguage('SteamAuth');
loadTemplate('SteamAuth');
$context['template_layers'][] = 'steam_login';
};
]]></add>
</operation>
</file>
<file name="$themedir/Profile.template.php">
<operation>
<search position="after"><![CDATA[function template_profile_avatar_select()]]></search>
<add><![CDATA[
function template_profile_steamid() {
global $context, $txt, $modSettings, $scripturl;
if (!empty($modSettings['steam_auth_api_key'])) {
$showLoginButton = (empty($context['member']['steam_id']) || isset($_GET['resetsteamid'])) && ($context['member']['id'] == $context['user']['id']);
$subtext = allowedTo('admin_forum') && !empty($context['member']['steam_id']) && !isset($_GET['resetsteamid']) ? '(<a href="' . $scripturl . '?action=profile;u=' . $context['member']['id'] . ';area=account;resetsteamid" style="font-style: italic;">' . $txt['steam_auth_profile_reset'] . '</a>)' : '';
if (!$showLoginButton) {
echo ' <dt>
<strong>Steam ID</strong>
';
} else {
echo ' <dt>
';
};
if ($subtext != '') {
echo ' <br>
<span class="smalltext">' . $subtext . '</span>
';
}
echo ' </dt>';
echo ' <dd>
';
if (!empty($context['member']['steam_id']) && !isset($_GET['resetsteamid'])) {
echo $context['member']['steam_id'];
} else {
if ($showLoginButton) {
echo '<input onclick="window.location=\'' . $scripturl . '?action=profile;area=account;steam\'; return false;" type="image" src="http://cdn.steamcommunity.com/public/images/signinthroughsteam/sits_large_border.png" style="background: initial; border: 0;">';
} else {
echo 'Not Set';
}
}
echo '
</dd>
';
};
};
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[if ($context['user']['is_owner'] || $context['user']['is_admin'])
echo '
<dt>', $txt['username'], ': </dt>
<dd>', $context['member']['username'], '</dd>';]]></search>
<add><![CDATA[
if (!empty($context['member']['steam_id']) && $context['user']['is_logged'] && !empty($modSettings['steam_auth_api_key']))
{
loadLanguage('SteamAuth');
echo '
<dt>', $txt['steam_auth_profile_card_label'], ': </dt>
<dd><a href="https://steamcommunity.com/profiles/', $context['member']['steam_id'], '"><img src="http://steamsignature.com/card/1/', $context['member']['steam_id'], '.png" /></a></dd>';
};
]]></add>
</operation>
</file>
<file name="$sourcedir/Subs.php">
<operation>
<search position="after"><![CDATA[// Doing an increment?]]></search>
<add><![CDATA[
if ($val == 'NULL')
$type = 'raw';
]]></add>
</operation>
</file>
<file name="$sourcedir/Load.php">
<operation>
<search position="before"><![CDATA[pg.online_color AS post_group_color, IFNULL(pg.group_name, {string:blank_string}) AS post_group, mem.is_activated, mem.warning,]]></search>
<add><![CDATA[ mem.steam_id,]]></add>
</operation>
<operation>
<search position="before"><![CDATA[mem.notify_types, lo.url, mg.online_color AS member_group_color, IFNULL(mg.group_name, {string:blank_string}) AS member_group,]]></search>
<add><![CDATA[ mem.steam_id,]]></add>
</operation>
<operation>
<search position="before"><![CDATA[mem.posts, mem.last_login, mem.member_ip, mem.member_ip2, mem.lngfile, mem.id_group]]></search>
<add><![CDATA[, mem.steam_id]]></add>
</operation>
<operation>
<search position="after"><![CDATA['aim' => $profile['aim'] != '' && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']) ? array(]]></search>
<add><![CDATA['steam_id' => $profile['steam_id'],
]]></add>
</operation>
</file>
<file name="$sourcedir/Profile-Modify.php">
<operation>
<search position="before"><![CDATA[if (!empty($profile_fields) && !$force_reload)
return;]]></search>
<add><![CDATA[
loadLanguage('SteamAuth');
if (!empty($context['auth_errors'])) {
$context['auth_error_html'] = '';
foreach ($context['auth_errors'] as $error)
$context['auth_error_html'] = $context['auth_error_html'] . ('
<p class="error">' . $error . '</p>');
};
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[ 'aim' => array(
'type' => 'text',
'label' => $txt['aim'],
'subtext' => $txt['your_aim'],
'size' => 24,
'value' => strtr(empty($cur_profile['aim']) ? '' : $cur_profile['aim'], '+', ' '),
'permission' => 'profile_extra',
'input_validate' => create_function('&$value', '
$value = strtr($value, \' \', \'+\');
return true;
'),
),]]></search>
<add><![CDATA[
'steam_id' => array(
'type' => 'callback',
'callback_func' => 'steamid',
'label' => $txt['steam_auth_profile_label'],
'subtext' => allowedTo('admin_forum') && !empty($cur_profile['steam_id']) && !isset($_GET['resetsteamid']) ? '(<a href="' . $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=account;resetsteamid" style="font-style: italic;">' . $txt['steam_auth_profile_reset'] . '</a>)' : '',
//'enabled' => !empty($cur_profile['steam_id']),
'prehtml' => isset($context['auth_error_html']) ? '<div class="alert">' . $context['auth_error_html'] . '</div>' : '',
'log_change' => true,
'permission' => 'profile_identity'
),]]></add>
</operation>
<operation>
<search position="before"><![CDATA['member_name', 'real_name', 'date_registered', 'posts', 'lngfile',]]></search>
<add><![CDATA[ 'steam_id',]]></add>
</operation>
</file>
</modification>