Errors.template.php 11 KB

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