Errors.template.php 11 KB

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