Chris@76
|
1 <?php
|
Chris@76
|
2
|
Chris@76
|
3 /**
|
Chris@76
|
4 * Simple Machines Forum (SMF)
|
Chris@76
|
5 *
|
Chris@76
|
6 * @package SMF
|
Chris@76
|
7 * @author Simple Machines http://www.simplemachines.org
|
Chris@76
|
8 * @copyright 2011 Simple Machines
|
Chris@76
|
9 * @license http://www.simplemachines.org/about/smf/license.php BSD
|
Chris@76
|
10 *
|
Chris@76
|
11 * @version 2.0.4
|
Chris@76
|
12 */
|
Chris@76
|
13
|
Chris@76
|
14 if (!defined('SMF'))
|
Chris@76
|
15 die('Hacking attempt...');
|
Chris@76
|
16
|
Chris@76
|
17 /* Show a list of all errors that were logged on the forum.
|
Chris@76
|
18
|
Chris@76
|
19 void ViewErrorLog()
|
Chris@76
|
20 - sets all the context up to show the error log for maintenance.
|
Chris@76
|
21 - uses the Errors template and error_log sub template.
|
Chris@76
|
22 - requires the maintain_forum permission.
|
Chris@76
|
23 - uses the 'view_errors' administration area.
|
Chris@76
|
24 - accessed from ?action=admin;area=logs;sa=errorlog.
|
Chris@76
|
25
|
Chris@76
|
26 void deleteErrors()
|
Chris@76
|
27 - deletes all or some of the errors in the error log.
|
Chris@76
|
28 - applies any necessary filters to deletion.
|
Chris@76
|
29 - should only be called by ViewErrorLog().
|
Chris@76
|
30 - attempts to TRUNCATE the table to reset the auto_increment.
|
Chris@76
|
31 - redirects back to the error log when done.
|
Chris@76
|
32
|
Chris@76
|
33 void ViewFile()
|
Chris@76
|
34 - will do php highlighting on the file specified in $_REQUEST['file']
|
Chris@76
|
35 - file must be readable
|
Chris@76
|
36 - full file path must be base64 encoded
|
Chris@76
|
37 - user must have admin_forum permission
|
Chris@76
|
38 - the line number number is specified by $_REQUEST['line']
|
Chris@76
|
39 - Will try to get the 20 lines before and after the specified line
|
Chris@76
|
40 */
|
Chris@76
|
41
|
Chris@76
|
42 // View the forum's error log.
|
Chris@76
|
43 function ViewErrorLog()
|
Chris@76
|
44 {
|
Chris@76
|
45 global $scripturl, $txt, $context, $modSettings, $user_profile, $filter, $boarddir, $sourcedir, $themedir, $smcFunc;
|
Chris@76
|
46
|
Chris@76
|
47 // Viewing contents of a file?
|
Chris@76
|
48 if (isset($_GET['file']))
|
Chris@76
|
49 return ViewFile();
|
Chris@76
|
50
|
Chris@76
|
51 // Check for the administrative permission to do this.
|
Chris@76
|
52 isAllowedTo('admin_forum');
|
Chris@76
|
53
|
Chris@76
|
54 // Templates, etc...
|
Chris@76
|
55 loadLanguage('ManageMaintenance');
|
Chris@76
|
56 loadTemplate('Errors');
|
Chris@76
|
57
|
Chris@76
|
58 // You can filter by any of the following columns:
|
Chris@76
|
59 $filters = array(
|
Chris@76
|
60 'id_member' => $txt['username'],
|
Chris@76
|
61 'ip' => $txt['ip_address'],
|
Chris@76
|
62 'session' => $txt['session'],
|
Chris@76
|
63 'url' => $txt['error_url'],
|
Chris@76
|
64 'message' => $txt['error_message'],
|
Chris@76
|
65 'error_type' => $txt['error_type'],
|
Chris@76
|
66 'file' => $txt['file'],
|
Chris@76
|
67 'line' => $txt['line'],
|
Chris@76
|
68 );
|
Chris@76
|
69
|
Chris@76
|
70 // Set up the filtering...
|
Chris@76
|
71 if (isset($_GET['value'], $_GET['filter']) && isset($filters[$_GET['filter']]))
|
Chris@76
|
72 $filter = array(
|
Chris@76
|
73 'variable' => $_GET['filter'],
|
Chris@76
|
74 'value' => array(
|
Chris@76
|
75 'sql' => in_array($_GET['filter'], array('message', 'url', 'file')) ? base64_decode(strtr($_GET['value'], array(' ' => '+'))) : $smcFunc['db_escape_wildcard_string']($_GET['value']),
|
Chris@76
|
76 ),
|
Chris@76
|
77 'href' => ';filter=' . $_GET['filter'] . ';value=' . $_GET['value'],
|
Chris@76
|
78 'entity' => $filters[$_GET['filter']]
|
Chris@76
|
79 );
|
Chris@76
|
80
|
Chris@76
|
81 // Deleting, are we?
|
Chris@76
|
82 if (isset($_POST['delall']) || isset($_POST['delete']))
|
Chris@76
|
83 deleteErrors();
|
Chris@76
|
84
|
Chris@76
|
85 // Just how many errors are there?
|
Chris@76
|
86 $result = $smcFunc['db_query']('', '
|
Chris@76
|
87 SELECT COUNT(*)
|
Chris@76
|
88 FROM {db_prefix}log_errors' . (isset($filter) ? '
|
Chris@76
|
89 WHERE ' . $filter['variable'] . ' LIKE {string:filter}' : ''),
|
Chris@76
|
90 array(
|
Chris@76
|
91 'filter' => isset($filter) ? $filter['value']['sql'] : '',
|
Chris@76
|
92 )
|
Chris@76
|
93 );
|
Chris@76
|
94 list ($num_errors) = $smcFunc['db_fetch_row']($result);
|
Chris@76
|
95 $smcFunc['db_free_result']($result);
|
Chris@76
|
96
|
Chris@76
|
97 // If this filter is empty...
|
Chris@76
|
98 if ($num_errors == 0 && isset($filter))
|
Chris@76
|
99 redirectexit('action=admin;area=logs;sa=errorlog' . (isset($_REQUEST['desc']) ? ';desc' : ''));
|
Chris@76
|
100
|
Chris@76
|
101 // Clean up start.
|
Chris@76
|
102 if (!isset($_GET['start']) || $_GET['start'] < 0)
|
Chris@76
|
103 $_GET['start'] = 0;
|
Chris@76
|
104
|
Chris@76
|
105 // Do we want to reverse error listing?
|
Chris@76
|
106 $context['sort_direction'] = isset($_REQUEST['desc']) ? 'down' : 'up';
|
Chris@76
|
107
|
Chris@76
|
108 // Set the page listing up.
|
Chris@76
|
109 $context['page_index'] = constructPageIndex($scripturl . '?action=admin;area=logs;sa=errorlog' . ($context['sort_direction'] == 'down' ? ';desc' : '') . (isset($filter) ? $filter['href'] : ''), $_GET['start'], $num_errors, $modSettings['defaultMaxMessages']);
|
Chris@76
|
110 $context['start'] = $_GET['start'];
|
Chris@76
|
111
|
Chris@76
|
112 // Find and sort out the errors.
|
Chris@76
|
113 $request = $smcFunc['db_query']('', '
|
Chris@76
|
114 SELECT id_error, id_member, ip, url, log_time, message, session, error_type, file, line
|
Chris@76
|
115 FROM {db_prefix}log_errors' . (isset($filter) ? '
|
Chris@76
|
116 WHERE ' . $filter['variable'] . ' LIKE {string:filter}' : '') . '
|
Chris@76
|
117 ORDER BY id_error ' . ($context['sort_direction'] == 'down' ? 'DESC' : '') . '
|
Chris@76
|
118 LIMIT ' . $_GET['start'] . ', ' . $modSettings['defaultMaxMessages'],
|
Chris@76
|
119 array(
|
Chris@76
|
120 'filter' => isset($filter) ? $filter['value']['sql'] : '',
|
Chris@76
|
121 )
|
Chris@76
|
122 );
|
Chris@76
|
123 $context['errors'] = array();
|
Chris@76
|
124 $members = array();
|
Chris@76
|
125
|
Chris@76
|
126 for ($i = 0; $row = $smcFunc['db_fetch_assoc']($request); $i ++)
|
Chris@76
|
127 {
|
Chris@76
|
128 $search_message = preg_replace('~<span class="remove">(.+?)</span>~', '%', $smcFunc['db_escape_wildcard_string']($row['message']));
|
Chris@76
|
129 if ($search_message == $filter['value']['sql'])
|
Chris@76
|
130 $search_message = $smcFunc['db_escape_wildcard_string']($row['message']);
|
Chris@76
|
131 $show_message = strtr(strtr(preg_replace('~<span class="remove">(.+?)</span>~', '$1', $row['message']), array("\r" => '', '<br />' => "\n", '<' => '<', '>' => '>', '"' => '"')), array("\n" => '<br />'));
|
Chris@76
|
132
|
Chris@76
|
133 $context['errors'][$row['id_error']] = array(
|
Chris@76
|
134 'alternate' => $i %2 == 0,
|
Chris@76
|
135 'member' => array(
|
Chris@76
|
136 'id' => $row['id_member'],
|
Chris@76
|
137 'ip' => $row['ip'],
|
Chris@76
|
138 'session' => $row['session']
|
Chris@76
|
139 ),
|
Chris@76
|
140 'time' => timeformat($row['log_time']),
|
Chris@76
|
141 'timestamp' => $row['log_time'],
|
Chris@76
|
142 'url' => array(
|
Chris@76
|
143 'html' => htmlspecialchars((substr($row['url'], 0, 1) == '?' ? $scripturl : '') . $row['url']),
|
Chris@76
|
144 'href' => base64_encode($smcFunc['db_escape_wildcard_string']($row['url']))
|
Chris@76
|
145 ),
|
Chris@76
|
146 'message' => array(
|
Chris@76
|
147 'html' => $show_message,
|
Chris@76
|
148 'href' => base64_encode($search_message)
|
Chris@76
|
149 ),
|
Chris@76
|
150 'id' => $row['id_error'],
|
Chris@76
|
151 'error_type' => array(
|
Chris@76
|
152 'type' => $row['error_type'],
|
Chris@76
|
153 'name' => isset($txt['errortype_'.$row['error_type']]) ? $txt['errortype_'.$row['error_type']] : $row['error_type'],
|
Chris@76
|
154 ),
|
Chris@76
|
155 'file' => array(),
|
Chris@76
|
156 );
|
Chris@76
|
157 if (!empty($row['file']) && !empty($row['line']))
|
Chris@76
|
158 {
|
Chris@76
|
159 // Eval'd files rarely point to the right location and cause havoc for linking, so don't link them.
|
Chris@76
|
160 $linkfile = strpos($row['file'], 'eval') === false || strpos($row['file'], '?') === false; // De Morgan's Law. Want this true unless both are present.
|
Chris@76
|
161
|
Chris@76
|
162 $context['errors'][$row['id_error']]['file'] = array(
|
Chris@76
|
163 'file' => $row['file'],
|
Chris@76
|
164 'line' => $row['line'],
|
Chris@76
|
165 'href' => $scripturl . '?action=admin;area=logs;sa=errorlog;file=' . base64_encode($row['file']) . ';line=' . $row['line'],
|
Chris@76
|
166 'link' => $linkfile ? '<a href="' . $scripturl . '?action=admin;area=logs;sa=errorlog;file=' . base64_encode($row['file']) . ';line=' . $row['line'] . '" onclick="return reqWin(this.href, 600, 400, false);">' . $row['file'] . '</a>' : $row['file'],
|
Chris@76
|
167 'search' => base64_encode($row['file']),
|
Chris@76
|
168 );
|
Chris@76
|
169 }
|
Chris@76
|
170
|
Chris@76
|
171 // Make a list of members to load later.
|
Chris@76
|
172 $members[$row['id_member']] = $row['id_member'];
|
Chris@76
|
173 }
|
Chris@76
|
174 $smcFunc['db_free_result']($request);
|
Chris@76
|
175
|
Chris@76
|
176 // Load the member data.
|
Chris@76
|
177 if (!empty($members))
|
Chris@76
|
178 {
|
Chris@76
|
179 // Get some additional member info...
|
Chris@76
|
180 $request = $smcFunc['db_query']('', '
|
Chris@76
|
181 SELECT id_member, member_name, real_name
|
Chris@76
|
182 FROM {db_prefix}members
|
Chris@76
|
183 WHERE id_member IN ({array_int:member_list})
|
Chris@76
|
184 LIMIT ' . count($members),
|
Chris@76
|
185 array(
|
Chris@76
|
186 'member_list' => $members,
|
Chris@76
|
187 )
|
Chris@76
|
188 );
|
Chris@76
|
189 while ($row = $smcFunc['db_fetch_assoc']($request))
|
Chris@76
|
190 $members[$row['id_member']] = $row;
|
Chris@76
|
191 $smcFunc['db_free_result']($request);
|
Chris@76
|
192
|
Chris@76
|
193 // This is a guest...
|
Chris@76
|
194 $members[0] = array(
|
Chris@76
|
195 'id_member' => 0,
|
Chris@76
|
196 'member_name' => '',
|
Chris@76
|
197 'real_name' => $txt['guest_title']
|
Chris@76
|
198 );
|
Chris@76
|
199
|
Chris@76
|
200 // Go through each error and tack the data on.
|
Chris@76
|
201 foreach ($context['errors'] as $id => $dummy)
|
Chris@76
|
202 {
|
Chris@76
|
203 $memID = $context['errors'][$id]['member']['id'];
|
Chris@76
|
204 $context['errors'][$id]['member']['username'] = $members[$memID]['member_name'];
|
Chris@76
|
205 $context['errors'][$id]['member']['name'] = $members[$memID]['real_name'];
|
Chris@76
|
206 $context['errors'][$id]['member']['href'] = empty($memID) ? '' : $scripturl . '?action=profile;u=' . $memID;
|
Chris@76
|
207 $context['errors'][$id]['member']['link'] = empty($memID) ? $txt['guest_title'] : '<a href="' . $scripturl . '?action=profile;u=' . $memID . '">' . $context['errors'][$id]['member']['name'] . '</a>';
|
Chris@76
|
208 }
|
Chris@76
|
209 }
|
Chris@76
|
210
|
Chris@76
|
211 // Filtering anything?
|
Chris@76
|
212 if (isset($filter))
|
Chris@76
|
213 {
|
Chris@76
|
214 $context['filter'] = &$filter;
|
Chris@76
|
215
|
Chris@76
|
216 // Set the filtering context.
|
Chris@76
|
217 if ($filter['variable'] == 'id_member')
|
Chris@76
|
218 {
|
Chris@76
|
219 $id = $filter['value']['sql'];
|
Chris@76
|
220 loadMemberData($id, false, 'minimal');
|
Chris@76
|
221 $context['filter']['value']['html'] = '<a href="' . $scripturl . '?action=profile;u=' . $id . '">' . $user_profile[$id]['real_name'] . '</a>';
|
Chris@76
|
222 }
|
Chris@76
|
223 elseif ($filter['variable'] == 'url')
|
Chris@76
|
224 $context['filter']['value']['html'] = '\'' . strtr(htmlspecialchars((substr($filter['value']['sql'], 0, 1) == '?' ? $scripturl : '') . $filter['value']['sql']), array('\_' => '_')) . '\'';
|
Chris@76
|
225 elseif ($filter['variable'] == 'message')
|
Chris@76
|
226 {
|
Chris@76
|
227 $context['filter']['value']['html'] = '\'' . strtr(htmlspecialchars($filter['value']['sql']), array("\n" => '<br />', '<br />' => '<br />', "\t" => ' ', '\_' => '_', '\\%' => '%', '\\\\' => '\\')) . '\'';
|
Chris@76
|
228 $context['filter']['value']['html'] = preg_replace('~&lt;span class=&quot;remove&quot;&gt;(.+?)&lt;/span&gt;~', '$1', $context['filter']['value']['html']);
|
Chris@76
|
229 }
|
Chris@76
|
230 elseif ($filter['variable'] == 'error_type')
|
Chris@76
|
231 {
|
Chris@76
|
232 $context['filter']['value']['html'] = '\'' . strtr(htmlspecialchars($filter['value']['sql']), array("\n" => '<br />', '<br />' => '<br />', "\t" => ' ', '\_' => '_', '\\%' => '%', '\\\\' => '\\')) . '\'';
|
Chris@76
|
233 }
|
Chris@76
|
234 else
|
Chris@76
|
235 $context['filter']['value']['html'] = &$filter['value']['sql'];
|
Chris@76
|
236 }
|
Chris@76
|
237
|
Chris@76
|
238 $context['error_types'] = array();
|
Chris@76
|
239
|
Chris@76
|
240 $context['error_types']['all'] = array(
|
Chris@76
|
241 'label' => $txt['errortype_all'],
|
Chris@76
|
242 'description' => isset($txt['errortype_all_desc']) ? $txt['errortype_all_desc'] : '',
|
Chris@76
|
243 'url' => $scripturl . '?action=admin;area=logs;sa=errorlog' . ($context['sort_direction'] == 'down' ? ';desc' : ''),
|
Chris@76
|
244 'is_selected' => empty($filter),
|
Chris@76
|
245 );
|
Chris@76
|
246
|
Chris@76
|
247 $sum = 0;
|
Chris@76
|
248 // What type of errors do we have and how many do we have?
|
Chris@76
|
249 $request = $smcFunc['db_query']('', '
|
Chris@76
|
250 SELECT error_type, COUNT(*) AS num_errors
|
Chris@76
|
251 FROM {db_prefix}log_errors
|
Chris@76
|
252 GROUP BY error_type
|
Chris@76
|
253 ORDER BY error_type = {string:critical_type} DESC, error_type ASC',
|
Chris@76
|
254 array(
|
Chris@76
|
255 'critical_type' => 'critical',
|
Chris@76
|
256 )
|
Chris@76
|
257 );
|
Chris@76
|
258 while ($row = $smcFunc['db_fetch_assoc']($request))
|
Chris@76
|
259 {
|
Chris@76
|
260 // Total errors so far?
|
Chris@76
|
261 $sum += $row['num_errors'];
|
Chris@76
|
262
|
Chris@76
|
263 $context['error_types'][$sum] = array(
|
Chris@76
|
264 'label' => (isset($txt['errortype_' . $row['error_type']]) ? $txt['errortype_' . $row['error_type']] : $row['error_type']) . ' (' . $row['num_errors'] . ')',
|
Chris@76
|
265 'description' => isset($txt['errortype_' . $row['error_type'] . '_desc']) ? $txt['errortype_' . $row['error_type'] . '_desc'] : '',
|
Chris@76
|
266 'url' => $scripturl . '?action=admin;area=logs;sa=errorlog' . ($context['sort_direction'] == 'down' ? ';desc' : '') . ';filter=error_type;value=' . $row['error_type'],
|
Chris@76
|
267 'is_selected' => isset($filter) && $filter['value']['sql'] == $smcFunc['db_escape_wildcard_string']($row['error_type']),
|
Chris@76
|
268 );
|
Chris@76
|
269 }
|
Chris@76
|
270 $smcFunc['db_free_result']($request);
|
Chris@76
|
271
|
Chris@76
|
272 // Update the all errors tab with the total number of errors
|
Chris@76
|
273 $context['error_types']['all']['label'] .= ' (' . $sum . ')';
|
Chris@76
|
274
|
Chris@76
|
275 // Finally, work out what is the last tab!
|
Chris@76
|
276 if (isset($context['error_types'][$sum]))
|
Chris@76
|
277 $context['error_types'][$sum]['is_last'] = true;
|
Chris@76
|
278 else
|
Chris@76
|
279 $context['error_types']['all']['is_last'] = true;
|
Chris@76
|
280
|
Chris@76
|
281 // And this is pretty basic ;).
|
Chris@76
|
282 $context['page_title'] = $txt['errlog'];
|
Chris@76
|
283 $context['has_filter'] = isset($filter);
|
Chris@76
|
284 $context['sub_template'] = 'error_log';
|
Chris@76
|
285 }
|
Chris@76
|
286
|
Chris@76
|
287 // Delete errors from the database.
|
Chris@76
|
288 function deleteErrors()
|
Chris@76
|
289 {
|
Chris@76
|
290 global $filter, $smcFunc;
|
Chris@76
|
291
|
Chris@76
|
292 // Make sure the session exists and is correct; otherwise, might be a hacker.
|
Chris@76
|
293 checkSession();
|
Chris@76
|
294
|
Chris@76
|
295 // Delete all or just some?
|
Chris@76
|
296 if (isset($_POST['delall']) && !isset($filter))
|
Chris@76
|
297 $smcFunc['db_query']('truncate_table', '
|
Chris@76
|
298 TRUNCATE {db_prefix}log_errors',
|
Chris@76
|
299 array(
|
Chris@76
|
300 )
|
Chris@76
|
301 );
|
Chris@76
|
302 // Deleting all with a filter?
|
Chris@76
|
303 elseif (isset($_POST['delall']) && isset($filter))
|
Chris@76
|
304 $smcFunc['db_query']('', '
|
Chris@76
|
305 DELETE FROM {db_prefix}log_errors
|
Chris@76
|
306 WHERE ' . $filter['variable'] . ' LIKE {string:filter}',
|
Chris@76
|
307 array(
|
Chris@76
|
308 'filter' => $filter['value']['sql'],
|
Chris@76
|
309 )
|
Chris@76
|
310 );
|
Chris@76
|
311 // Just specific errors?
|
Chris@76
|
312 elseif (!empty($_POST['delete']))
|
Chris@76
|
313 {
|
Chris@76
|
314 $smcFunc['db_query']('', '
|
Chris@76
|
315 DELETE FROM {db_prefix}log_errors
|
Chris@76
|
316 WHERE id_error IN ({array_int:error_list})',
|
Chris@76
|
317 array(
|
Chris@76
|
318 'error_list' => array_unique($_POST['delete']),
|
Chris@76
|
319 )
|
Chris@76
|
320 );
|
Chris@76
|
321
|
Chris@76
|
322 // Go back to where we were.
|
Chris@76
|
323 redirectexit('action=admin;area=logs;sa=errorlog' . (isset($_REQUEST['desc']) ? ';desc' : '') . ';start=' . $_GET['start'] . (isset($filter) ? ';filter=' . $_GET['filter'] . ';value=' . $_GET['value'] : ''));
|
Chris@76
|
324 }
|
Chris@76
|
325
|
Chris@76
|
326 // Back to the error log!
|
Chris@76
|
327 redirectexit('action=admin;area=logs;sa=errorlog' . (isset($_REQUEST['desc']) ? ';desc' : ''));
|
Chris@76
|
328 }
|
Chris@76
|
329
|
Chris@76
|
330 function ViewFile()
|
Chris@76
|
331 {
|
Chris@76
|
332 global $context, $txt, $boarddir, $sourcedir, $cachedir;
|
Chris@76
|
333 // Check for the administrative permission to do this.
|
Chris@76
|
334 isAllowedTo('admin_forum');
|
Chris@76
|
335
|
Chris@76
|
336 // Decode the file and get the line
|
Chris@76
|
337 $file = realpath(base64_decode($_REQUEST['file']));
|
Chris@76
|
338 $real_board = realpath($boarddir);
|
Chris@76
|
339 $real_source = realpath($sourcedir);
|
Chris@76
|
340 $real_cache = realpath($cachedir);
|
Chris@76
|
341 $basename = strtolower(basename($file));
|
Chris@76
|
342 $ext = strrchr($basename, '.');
|
Chris@76
|
343 $line = isset($_REQUEST['line']) ? (int) $_REQUEST['line'] : 0;
|
Chris@76
|
344
|
Chris@76
|
345 // Make sure the file we are looking for is one they are allowed to look at
|
Chris@76
|
346 if ($ext != '.php' || (strpos($file, $real_board) === false && strpos($file, $real_source) === false) || ($basename == 'settings.php' || $basename == 'settings_bak.php') || strpos($file, $real_cache) !== false || !is_readable($file))
|
Chris@76
|
347 fatal_lang_error('error_bad_file', true, array(htmlspecialchars($file)));
|
Chris@76
|
348
|
Chris@76
|
349 // get the min and max lines
|
Chris@76
|
350 $min = $line - 20 <= 0 ? 1 : $line - 20;
|
Chris@76
|
351 $max = $line + 21; // One additional line to make everything work out correctly
|
Chris@76
|
352
|
Chris@76
|
353 if ($max <= 0 || $min >= $max)
|
Chris@76
|
354 fatal_lang_error('error_bad_line');
|
Chris@76
|
355
|
Chris@76
|
356 $file_data = explode('<br />', highlight_php_code(htmlspecialchars(implode('', file($file)))));
|
Chris@76
|
357
|
Chris@76
|
358 // We don't want to slice off too many so lets make sure we stop at the last one
|
Chris@76
|
359 $max = min($max, max(array_keys($file_data)));
|
Chris@76
|
360
|
Chris@76
|
361 $file_data = array_slice($file_data, $min-1, $max - $min);
|
Chris@76
|
362
|
Chris@76
|
363 $context['file_data'] = array(
|
Chris@76
|
364 'contents' => $file_data,
|
Chris@76
|
365 'min' => $min,
|
Chris@76
|
366 'target' => $line,
|
Chris@76
|
367 'file' => strtr($file, array('"' => '\\"')),
|
Chris@76
|
368 );
|
Chris@76
|
369
|
Chris@76
|
370 loadTemplate('Errors');
|
Chris@76
|
371 $context['template_layers'] = array();
|
Chris@76
|
372 $context['sub_template'] = 'show_file';
|
Chris@76
|
373
|
Chris@76
|
374 }
|
Chris@76
|
375
|
Chris@76
|
376 ?> |