Guest User

Untitled

a guest
Jul 23rd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. #!/usr/bin/php
  2. <?php
  3.  
  4. //echo "kopeteHistXml2Html.php - Exporting Kopete history xml-files to html (CLI-Version)";
  5.  
  6. $doc=simplexml_load_file($argv[1]);
  7.  
  8. //var_dump($doc);
  9.  
  10. $new_msgs=array();
  11. foreach ($doc->msg as $msg) {
  12. $a=$msg->attributes();
  13. $msg_p=array("nick"=>(string)$a->nick,"in?"=>((string)$a->in=="1"),"time"=>(string)$a->time,"text"=>(string)$msg);
  14. $new_msgs[]=$msg_p;
  15. }
  16.  
  17.  
  18. ?>
  19. <!DOCTYPE html>
  20. <html>
  21. <head>
  22. <meta charset="utf-8" />
  23. <title>Chatlog</title>
  24. <style>
  25. * {padding:0;margin:0;}
  26. body {font-size:12px; width:600px; margin:0 auto;font-family:Tahoma, sans-serif;}
  27. h1 {margin:20px 0 50px 0;text-align:center;}
  28. .out {text-align:right;padding-right:300px;}
  29. .in {text-align:left;padding-left:300px;}
  30. dt {font-size:8px;color:#999;}
  31. dd {padding-bottom:10px;}
  32. </style>
  33. </head>
  34. <body>
  35. <h1>Chatlog</h1>
  36. <dl>
  37. <?php foreach ($new_msgs as $ms) : ?>
  38.  
  39. <dt class="<?php echo ($ms["in?"]?"in":"out"); ?>"><?php echo htmlspecialchars($ms["nick"]); ?></dt>
  40. <dd class="<?php echo ($ms["in?"]?"in":"out"); ?>"><?php echo htmlspecialchars($ms["text"]); ?></dd>
  41.  
  42. <?php endforeach; ?>
  43. </dl>
  44. </body>
  45. </html>
Add Comment
Please, Sign In to add comment