Chris@76
|
1 <?php
|
Chris@76
|
2 /**
|
Chris@76
|
3 * Simple Machines Forum (SMF)
|
Chris@76
|
4 *
|
Chris@76
|
5 * @package SMF
|
Chris@76
|
6 * @author Simple Machines
|
Chris@76
|
7 * @copyright 2011 Simple Machines
|
Chris@76
|
8 * @license http://www.simplemachines.org/about/smf/license.php BSD
|
Chris@76
|
9 *
|
Chris@76
|
10 * @version 2.0
|
Chris@76
|
11 */
|
Chris@76
|
12
|
Chris@76
|
13 // !!!
|
Chris@76
|
14 /* This template file contains only the sub template fatal_error. It is
|
Chris@76
|
15 shown when an error occurs, and should show at least a back button and
|
Chris@76
|
16 $context['error_message'].
|
Chris@76
|
17 */
|
Chris@76
|
18
|
Chris@76
|
19 // Show an error message.....
|
Chris@76
|
20 function template_fatal_error()
|
Chris@76
|
21 {
|
Chris@76
|
22 global $context, $settings, $options, $txt;
|
Chris@76
|
23
|
Chris@76
|
24 echo '
|
Chris@76
|
25 <div id="fatal_error">
|
Chris@76
|
26 <div class="cat_bar">
|
Chris@76
|
27 <h3 class="catbg">
|
Chris@76
|
28 ', $context['error_title'], '
|
Chris@76
|
29 </h3>
|
Chris@76
|
30 </div>
|
Chris@76
|
31 <div class="windowbg">
|
Chris@76
|
32 <span class="topslice"><span></span></span>
|
Chris@76
|
33 <div class="padding">', $context['error_message'], '</div>
|
Chris@76
|
34 <span class="botslice"><span></span></span>
|
Chris@76
|
35 </div>
|
Chris@76
|
36 </div>';
|
Chris@76
|
37
|
Chris@76
|
38 // Show a back button (using javascript.)
|
Chris@76
|
39 echo '
|
Chris@76
|
40 <div class="centertext"><a href="javascript:history.go(-1)">', $txt['back'], '</a></div>';
|
Chris@76
|
41 }
|
Chris@76
|
42
|
Chris@76
|
43 function template_error_log()
|
Chris@76
|
44 {
|
Chris@76
|
45 global $context, $settings, $options, $scripturl, $txt, $modSettings;
|
Chris@76
|
46
|
Chris@76
|
47 echo '
|
Chris@76
|
48 <form action="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';start=', $context['start'], $context['has_filter'] ? $context['filter']['href'] : '', '" method="post" accept-charset="', $context['character_set'], '" onsubmit="if (lastClicked == \'remove_all\' && !confirm(\'', $txt['sure_about_errorlog_remove'], '\')) return false; else return true;">
|
Chris@76
|
49 <script type="text/javascript"><!-- // --><![CDATA[
|
Chris@76
|
50 var lastClicked = "";
|
Chris@76
|
51 // ]]></script>
|
Chris@76
|
52 <div class="title_bar clear_right">
|
Chris@76
|
53 <h3 class="titlebg">
|
Chris@76
|
54 <span class="ie6_header floatleft">
|
Chris@76
|
55 <a href="', $scripturl, '?action=helpadmin;help=error_log" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" align="top" /></a> ', $txt['errlog'], '
|
Chris@76
|
56 </span>
|
Chris@76
|
57 </h3>
|
Chris@76
|
58 </div>
|
Chris@76
|
59 <table border="0" cellspacing="1" class="table_grid" id="error_log">
|
Chris@76
|
60 <tr>
|
Chris@76
|
61 <td colspan="3" class="windowbg">
|
Chris@76
|
62 ', $txt['apply_filter_of_type'], ':';
|
Chris@76
|
63
|
Chris@76
|
64 $error_types = array();
|
Chris@76
|
65 foreach ($context['error_types'] as $type => $details)
|
Chris@76
|
66 $error_types[] = ($details['is_selected'] ? '<img src="' . $settings['images_url'] . '/selected.gif" alt="" /> ' : '') . '<a href="' . $details['url'] . '" ' . ($details['is_selected'] ? 'style="font-weight: bold;"' : '') . ' title="' . $details['description'] . '">' . $details['label'] . '</a>';
|
Chris@76
|
67
|
Chris@76
|
68 echo '
|
Chris@76
|
69 ', implode(' | ', $error_types), '
|
Chris@76
|
70 </td>
|
Chris@76
|
71 </tr>
|
Chris@76
|
72 <tr>
|
Chris@76
|
73 <td colspan="3" class="windowbg">
|
Chris@76
|
74 ', $txt['pages'], ': ', $context['page_index'], '
|
Chris@76
|
75 </td>
|
Chris@76
|
76 </tr>';
|
Chris@76
|
77
|
Chris@76
|
78 if ($context['has_filter'])
|
Chris@76
|
79 echo '
|
Chris@76
|
80 <tr>
|
Chris@76
|
81 <td colspan="3" class="windowbg">
|
Chris@76
|
82 <strong>', $txt['applying_filter'], ':</strong> ', $context['filter']['entity'], ' ', $context['filter']['value']['html'], ' (<a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', '">', $txt['clear_filter'], '</a>)
|
Chris@76
|
83 </td>
|
Chris@76
|
84 </tr>';
|
Chris@76
|
85
|
Chris@76
|
86 if (!empty($context['errors']))
|
Chris@76
|
87 echo '
|
Chris@76
|
88 <tr class="titlebg">
|
Chris@76
|
89 <td colspan="3" class="lefttext">
|
Chris@76
|
90 <div class="floatright"><input type="submit" value="', $txt['remove_selection'], '" onclick="lastClicked = \'remove_selection\';" class="button_submit" /> <input type="submit" name="delall" value="', $context['has_filter'] ? $txt['remove_filtered_results'] : $txt['remove_all'], '" onclick="lastClicked = \'remove_all\';" class="button_submit" /></div>
|
Chris@76
|
91 <label for="check_all1"><input type="checkbox" id="check_all1" onclick="invertAll(this, this.form, \'delete[]\'); this.form.check_all2.checked = this.checked;" class="input_check" /><strong>', $txt['check_all'], '</strong></label>
|
Chris@76
|
92 </td>
|
Chris@76
|
93 </tr>';
|
Chris@76
|
94
|
Chris@76
|
95 foreach ($context['errors'] as $error)
|
Chris@76
|
96 {
|
Chris@76
|
97 echo '
|
Chris@76
|
98 <tr class="windowbg', $error['alternate'] ? '2' : '', '">
|
Chris@76
|
99 <td rowspan="2" class="checkbox_column">
|
Chris@76
|
100 <input type="checkbox" name="delete[]" value="', $error['id'], '" class="input_check" />
|
Chris@76
|
101 </td>
|
Chris@76
|
102 <td class="half_width">
|
Chris@76
|
103 <a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=id_member;value=', $error['member']['id'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_member'], '"><img src="', $settings['images_url'], '/filter.gif" alt="', $txt['apply_filter'], ': ', $txt['filter_only_member'], '" /></a>
|
Chris@76
|
104 <strong>', $error['member']['link'], '</strong><br />
|
Chris@76
|
105 <a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=ip;value=', $error['member']['ip'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_ip'], '"><img src="', $settings['images_url'], '/filter.gif" alt="', $txt['apply_filter'], ': ', $txt['filter_only_ip'], '" /></a>
|
Chris@76
|
106 <strong><a href="', $scripturl, '?action=trackip;searchip=', $error['member']['ip'], '">', $error['member']['ip'], '</a></strong>
|
Chris@76
|
107 <br />
|
Chris@76
|
108 </td>
|
Chris@76
|
109 <td class="half_width">
|
Chris@76
|
110 <a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? '' : ';desc', $context['has_filter'] ? $context['filter']['href'] : '', '" title="', $txt['reverse_direction'], '"><img src="', $settings['images_url'], '/sort_', $context['sort_direction'], '.gif" alt="', $txt['reverse_direction'], '" /></a>
|
Chris@76
|
111 ', $error['time'], '
|
Chris@76
|
112 <br />';
|
Chris@76
|
113
|
Chris@76
|
114 if ($error['member']['session'] != '')
|
Chris@76
|
115 echo '
|
Chris@76
|
116 <a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=session;value=', $error['member']['session'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_session'], '"><img src="', $settings['images_url'], '/filter.gif" alt="', $txt['apply_filter'], ': ', $txt['filter_only_session'], '" /></a>
|
Chris@76
|
117 ', $error['member']['session'], '
|
Chris@76
|
118 <br />';
|
Chris@76
|
119
|
Chris@76
|
120 echo '
|
Chris@76
|
121 <a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=error_type;value=', $error['error_type']['type'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_type'], '"><img src="', $settings['images_url'], '/filter.gif" alt="', $txt['apply_filter'], ': ', $txt['filter_only_type'], '" /></a>
|
Chris@76
|
122 ', $txt['error_type'], ': ', $error['error_type']['name'], '
|
Chris@76
|
123 </td>
|
Chris@76
|
124 </tr>
|
Chris@76
|
125 <tr class="windowbg', $error['alternate'] ? '2' : '', '">
|
Chris@76
|
126 <td colspan="2">
|
Chris@76
|
127 <div class="clear_left floatleft"><a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=url;value=', $error['url']['href'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_url'], '"><img src="', $settings['images_url'], '/filter.gif" alt="', $txt['apply_filter'], ': ', $txt['filter_only_url'], '" /></a></div>
|
Chris@76
|
128 <div class="floatleft marginleft"><a href="', $error['url']['html'], '">', $error['url']['html'], '</a></div>
|
Chris@76
|
129 <div class="clear_left floatleft"><a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=message;value=', $error['message']['href'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_message'], '"><img src="', $settings['images_url'], '/filter.gif" alt="', $txt['apply_filter'], ': ', $txt['filter_only_message'], '" /></a></div>
|
Chris@76
|
130 <div class="floatleft marginleft">', $error['message']['html'], '</div>';
|
Chris@76
|
131
|
Chris@76
|
132 if (!empty($error['file']))
|
Chris@76
|
133 echo '
|
Chris@76
|
134 <div class="clear_left floatleft"><a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=file;value=', $error['file']['search'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_file'], '"><img src="', $settings['images_url'], '/filter.gif" alt="', $txt['apply_filter'], ': ', $txt['filter_only_file'], '" /></a></div>
|
Chris@76
|
135 <div class="floatleft marginleft">
|
Chris@76
|
136 ', $txt['file'], ': ', $error['file']['link'], '<br />
|
Chris@76
|
137 ', $txt['line'], ': ', $error['file']['line'], '
|
Chris@76
|
138 </div>';
|
Chris@76
|
139
|
Chris@76
|
140 echo '
|
Chris@76
|
141 </td>
|
Chris@76
|
142 </tr>';
|
Chris@76
|
143 }
|
Chris@76
|
144
|
Chris@76
|
145 if (!empty($context['errors']))
|
Chris@76
|
146 echo '
|
Chris@76
|
147 <tr class="titlebg">
|
Chris@76
|
148 <td colspan="3" class="lefttext">
|
Chris@76
|
149 <div class="floatright"><input type="submit" value="', $txt['remove_selection'], '" onclick="lastClicked = \'remove_selection\';" class="button_submit" /> <input type="submit" name="delall" value="', $context['has_filter'] ? $txt['remove_filtered_results'] : $txt['remove_all'], '" onclick="lastClicked = \'remove_all\';" class="button_submit" /></div>
|
Chris@76
|
150 <label for="check_all2"><input type="checkbox" id="check_all2" onclick="invertAll(this, this.form, \'delete[]\'); this.form.check_all1.checked = this.checked;" class="input_check" /><strong>', $txt['check_all'], '</strong></label>
|
Chris@76
|
151 </td>
|
Chris@76
|
152 </tr>';
|
Chris@76
|
153 else
|
Chris@76
|
154 echo '
|
Chris@76
|
155 <tr>
|
Chris@76
|
156 <td colspan="3" class="windowbg2">', $txt['errlog_no_entries'], '</td>
|
Chris@76
|
157 </tr>';
|
Chris@76
|
158
|
Chris@76
|
159 echo '
|
Chris@76
|
160 <tr>
|
Chris@76
|
161 <td colspan="3" class="windowbg">
|
Chris@76
|
162 ', $txt['pages'], ': ', $context['page_index'], '
|
Chris@76
|
163 </td>
|
Chris@76
|
164 </tr>
|
Chris@76
|
165 </table><br />';
|
Chris@76
|
166 if ($context['sort_direction'] == 'down')
|
Chris@76
|
167 echo '
|
Chris@76
|
168 <input type="hidden" name="desc" value="1" />';
|
Chris@76
|
169 echo '
|
Chris@76
|
170 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
|
Chris@76
|
171 </form>';
|
Chris@76
|
172 }
|
Chris@76
|
173
|
Chris@76
|
174 function template_show_file()
|
Chris@76
|
175 {
|
Chris@76
|
176 global $context, $settings;
|
Chris@76
|
177
|
Chris@76
|
178 echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
Chris@76
|
179 <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
|
Chris@76
|
180 <head>
|
Chris@76
|
181 <title>', $context['file_data']['file'], '</title>
|
Chris@76
|
182 <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
|
Chris@76
|
183 <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index.css" />
|
Chris@76
|
184 </head>
|
Chris@76
|
185 <body>
|
Chris@76
|
186 <table border="0" cellpadding="0" cellspacing="3">';
|
Chris@76
|
187 foreach ($context['file_data']['contents'] as $index => $line)
|
Chris@76
|
188 {
|
Chris@76
|
189 $line_num = $index+$context['file_data']['min'];
|
Chris@76
|
190 $is_target = $line_num == $context['file_data']['target'];
|
Chris@76
|
191 echo '
|
Chris@76
|
192 <tr>
|
Chris@76
|
193 <td align="right"', $is_target ? ' style="font-weight: bold; border: 1px solid black;border-width: 1px 0 1px 1px;">==>' : '>', $line_num , ':</td>
|
Chris@76
|
194 <td style="white-space: nowrap;', $is_target ? ' border: 1px solid black;border-width: 1px 1px 1px 0;':'','">', $line, '</td>
|
Chris@76
|
195 </tr>';
|
Chris@76
|
196 }
|
Chris@76
|
197 echo '
|
Chris@76
|
198 </table>
|
Chris@76
|
199 </body>
|
Chris@76
|
200 </html>';
|
Chris@76
|
201 }
|
Chris@76
|
202
|
Chris@76
|
203 ?> |