comparison forum/Themes/Vamp/Errors.template.php @ 76:e3e11437ecea website

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