This repository was archived by the owner on Jun 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.xml
More file actions
236 lines (207 loc) · 8.78 KB
/
install.xml
File metadata and controls
236 lines (207 loc) · 8.78 KB
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
<?xml version="1.0"?>
<?xml-stylesheet href="modification.xsl" type="text/xsl"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ATTENTION: If you are trying to install this manually, you should try
the package manager. If it will not work for you, please take a look
at the following for information on this format:
http://mods.simplemachines.org/docs/manual-install.php
================================================================================
Modification files can be used to modify files so that they do what
your package needs them to do to work properly.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<!-- This information needs to be the same as that in the package-info.xml. -->
<id>Niko:PostHistory</id>
<version>1.02</version>
<file name="$sourcedir/Post.php">
<operation>
<search position="replace"><![CDATA[m.body,
m.poster_name]]></search>
<add><![CDATA[IFNULL(h.body, m.body) AS body,
m.poster_name]]></add>
</operation>
<operation>
<search position="before"><![CDATA[ INNER JOIN {db_prefix}topics AS t ON (t.id_topic = {int:current_topic})
LEFT JOIN {db_prefix}attachments AS a ON (a.id_msg = m.id_msg AND a.attachment_type = {int:attachment_type})]]></search>
<add><![CDATA[
LEFT JOIN {db_prefix}messages_history AS h ON (h.id_msg = {int:id_msg} AND h.id_edit = {int:id_edit})]]></add>
</operation>
<operation>
<search position="before"><![CDATA['attachment_type' => 0,
'id_msg' => $_REQUEST['msg'],]]></search>
<add><![CDATA[
'id_edit' => isset($_REQUEST['restore_edit']) ? (int) $_REQUEST['restore_edit'] : 0,]]></add>
</operation>
<operation>
<search position="after"><![CDATA[ // When was it last modified?]]></search>
<add><![CDATA[
if (isset($_REQUEST['restoreEdit']) && $row['id_member_poster'] == $user_info['id'] && !allowedTo('posthistory_restore_any'))
isAllowedTo('posthistory_restore_own');
elseif (isset($_REQUEST['restoreEdit']))
isAllowedTo('posthistory_restore_any');
]]></add>
</operation>
</file>
<file name="$sourcedir/Subs-Post.php">
<operation>
<search position="before"><![CDATA[ if (!empty($modSettings['search_custom_index_config'])]]></search>
<add><![CDATA[ || !empty($modSettings['posthistoryEnabled'])]]></add>
</operation>
<operation>
<search position="replace"><
);
list ($old_body) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);]]></search>
<add><
);
list ($old_body, $ph_modify_name, $ph_modify_time, $ph_poster_name, $ph_poster_time) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
// Add to Post History table
if (!empty($modSettings['posthistoryEnabled']))
$smcFunc['db_insert']('',
'{db_prefix}messages_history',
array(
'id_msg' => 'int',
'modified_name' => 'string-255',
'modified_time' => 'int',
'body' => 'string',
),
array(
$msgOptions['id'],
!empty($ph_modify_name) ? $ph_modify_name : $ph_poster_name,
!empty($ph_modify_time) ? $ph_modify_time : $ph_poster_time,
$old_body,
),
array('id_edit')
);
if (empty($modSettings['search_custom_index_config']))
unset($old_body);
unset($ph_modify_name, $ph_modify_time, $ph_poster_name, $ph_poster_time);
// END Post History]]></add>
</operation>
</file>
<file name="$sourcedir/RemoveTopic.php">
<operation>
<search position="after"><![CDATA[ if (!empty($modSettings['search_custom_index_config']))]]></search>
<add><
);
]]></add>
</operation>
<operation>
<search position="after"><![CDATA[ // Delete anything related to the topic.]]></search>
<add><',
array(
'topics' => $topics,
)
);
while ($row = $smcFunc['db_fetch_assoc']($request))
$messages[] = $row['id_msg'];
$smcFunc['db_free_result']($request);
if (!empty($messages))
$smcFunc['db_query']('', '
DELETE FROM {db_prefix}messages_history
WHERE id_msg IN({array_int:messages})',
array(
'messages' => $messages,
)
);
]]></add>
</operation>
</file>
<file name="$sourcedir/Who.php">
<operation>
<search position="before"><![CDATA[ 'mods' => array(]]></search>
<add><![CDATA[
'Post History © 2007-2009 <a href="http://www.madjoki.com/">Niko Pahajoki</a>',]]></add>
</operation>
</file>
<file name="$sourcedir/Display.php">
<operation>
<search position="after"><![CDATA[ // Fetch attachments.]]></search>
<add><![CDATA[
// Get edited posts for Post History
if (!empty($modSettings['posthistoryEnabled']) && (allowedTo('posthistory_view_any') || allowedTo('posthistory_view_own')))
{
$request = $smcFunc['db_query']('', '
SELECT DISTINCT id_msg
FROM {db_prefix}messages_history
WHERE id_msg IN ({array_int:message_list})',
array(
'message_list' => $messages,
)
);
$context['post_history'] = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$context['post_history'][$row['id_msg']] = $row['id_msg'];
$smcFunc['db_free_result']($request);
}
]]></add>
</operation>
<operation>
<search position="after"><![CDATA['can_see_ip']]></search>
<add><![CDATA['can_see_history' => !empty($modSettings['posthistoryEnabled']) && (allowedTo('posthistory_view_any') || (allowedTo('posthistory_view_own') && $message['id_member'] == $user_info['id'] && !empty($user_info['id']))),
'has_history' => isset($context['post_history'][$message['id_msg']]),
]]></add>
</operation>
</file>
<file name="$themedir/Display.template.php">
<operation>
<search position="replace"><![CDATA[ if ($settings['show_modify'] && !empty($message['modified']['name']))
echo '
« <em>', $txt['last_edit'], ': ', $message['modified']['time'], ' ', $txt['by'], ' ', $message['modified']['name'], '</em> »';]]></search>
<add><![CDATA[
// Show last edit + has history?
if ($settings['show_modify'] && !empty($message['modified']['name']) && $message['can_see_history'] && $message['has_history'])
echo '
<a href="', $scripturl, '?action=posthistory;topic=', $context['current_topic'], '.0;msg=', $message['id'], '" onclick="return reqWin(this.href + \';popup\');">« <em>', $txt['last_edit'], ': ', $message['modified']['time'], $message['modified']['name'] !== $message['member']['name'] ? ' ' . $txt['by'] . ' ' . $message['modified']['name'] : '', '</em> »</a>';
// No last edit but history?
elseif ($message['can_see_history'] && $message['has_history'])
echo '
<a href="', $scripturl, '?action=posthistory;topic=', $context['current_topic'], '.0;msg=', $message['id'], '" onclick="return reqWin(this.href + \';popup\');">« <em>', $txt['view_post_history'], '</em> »</a>';
// or ..last edit but no history?
elseif ($settings['show_modify'] && !empty($message['modified']['name']))
echo '
« <em>', $txt['last_edit'], ': ', $message['modified']['time'], ' ', $txt['by'], ' ', $message['modified']['name'], '</em> »';]]></add>
</operation>
</file>
<file name="$themes_dir/core/Display.template.php">
<operation>
<search position="before"><![CDATA[ $restore_message_button = create_button('restore_topic.gif', 'restore_message', 'restore_message', 'align="middle"');]]></search>
<add><![CDATA[
$history_button = create_button('calendarpe.gif', 'view_post_history', 'view_post_history', 'align="middle"');]]></add>
</operation>
<operation>
<search position="after"><![CDATA[// Show a checkbox for quick moderation?]]></search>
<add><![CDATA[
// Can we see history?
if ($message['can_see_history'] && $message['has_history'])
echo '
<li><a href="', $scripturl, '?action=posthistory;topic=', $context['current_topic'], '.0;msg=', $message['id'], '">', $history_button, '</a></li>';
]]></add>
</operation>
</file>
</modification>