history.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <!DOCTYPE html>
  2. <html lang="pl">
  3. <head>
  4. <title></title>
  5. <link rel="stylesheet" href="history.css" />
  6. <meta charset="UTF-8" />
  7. </head>
  8. <body>
  9. <?php
  10. // set the default timezone to use. Available since PHP 5.1
  11. date_default_timezone_set('UTC');
  12. /* File: linkify.php
  13. * Version: 20101010_1000
  14. * Copyright: (c) 2010 Jeff Roberson - http://jmrware.com
  15. * MIT License: http://www.opensource.org/licenses/mit-license.php
  16. *
  17. * Summary: This script linkifys http URLs on a page.
  18. *
  19. * Usage: See example page: linkify.html
  20. */
  21. function linkify($text) {
  22. $url_pattern = '/# Rev:20100913_0900 github.com\/jmrware\/LinkifyURL
  23. # Match http & ftp URL that is not already linkified.
  24. # Alternative 1: URL delimited by (parentheses).
  25. (\() # $1 "(" start delimiter.
  26. ((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]+) # $2: URL.
  27. (\)) # $3: ")" end delimiter.
  28. | # Alternative 2: URL delimited by [square brackets].
  29. (\[) # $4: "[" start delimiter.
  30. ((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]+) # $5: URL.
  31. (\]) # $6: "]" end delimiter.
  32. | # Alternative 3: URL delimited by {curly braces}.
  33. (\{) # $7: "{" start delimiter.
  34. ((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]+) # $8: URL.
  35. (\}) # $9: "}" end delimiter.
  36. | # Alternative 4: URL delimited by <angle brackets>.
  37. (<|&(?:lt|\#60|\#x3c);) # $10: "<" start delimiter (or HTML entity).
  38. ((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]+) # $11: URL.
  39. (>|&(?:gt|\#62|\#x3e);) # $12: ">" end delimiter (or HTML entity).
  40. | # Alternative 5: URL not delimited by (), [], {} or <>.
  41. ( # $13: Prefix proving URL not already linked.
  42. (?: ^ # Can be a beginning of line or string, or
  43. | [^=\s\'"\]] # a non-"=", non-quote, non-"]", followed by
  44. ) \s*[\'"]? # optional whitespace and optional quote;
  45. | [^=\s]\s+ # or... a non-equals sign followed by whitespace.
  46. ) # End $13. Non-prelinkified-proof prefix.
  47. ( \b # $14: Other non-delimited URL.
  48. (?:ht|f)tps?:\/\/ # Required literal http, https, ftp or ftps prefix.
  49. [a-z0-9\-._~!$\'()*+,;=:\/?#[\]@%]+ # All URI chars except "&" (normal*).
  50. (?: # Either on a "&" or at the end of URI.
  51. (?! # Allow a "&" char only if not start of an...
  52. &(?:gt|\#0*62|\#x0*3e); # HTML ">" entity, or
  53. | &(?:amp|apos|quot|\#0*3[49]|\#x0*2[27]); # a [&\'"] entity if
  54. [.!&\',:?;]? # followed by optional punctuation then
  55. (?:[^a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]|$) # a non-URI char or EOS.
  56. ) & # If neg-assertion true, match "&" (special).
  57. [a-z0-9\-._~!$\'()*+,;=:\/?#[\]@%]* # More non-& URI chars (normal*).
  58. )* # Unroll-the-loop (special normal*)*.
  59. [a-z0-9\-_~$()*+=\/#[\]@%] # Last char can\'t be [.!&\',;:?]
  60. ) # End $14. Other non-delimited URL.
  61. /imx';
  62. $url_replace = '$1$4$7$10$13<a href="$2$5$8$11$14">$2$5$8$11$14</a>$3$6$9$12';
  63. return preg_replace($url_pattern, $url_replace, $text);
  64. }
  65. foreach (glob('./history/*') as $f) {
  66. echo '<h1>'.basename($f).'</h1>';
  67. $data = file($f, FILE_IGNORE_NEW_LINES);
  68. echo '<table>';
  69. foreach ($data as $e) {
  70. $d = explode('&', $e);
  71. echo '<tr>'
  72. .'<td>'.date('H:i:s', (int)$d[0]).'</td>'
  73. .'<td>'.$d[1].'</td>'
  74. .'<td>'.linkify($d[2]).'</td>'
  75. .'</tr>';
  76. }
  77. echo '</table>';
  78. }
  79. ?>
  80. </body>
  81. <script type="text/javascript" src="jquery.min.js"></script>
  82. <script>
  83. $(document).ready(function() {
  84. $("html").scrollTop($("html")[0].scrollHeight);
  85. });
  86. </script>
  87. </html>