This repository was archived by the owner on May 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxml.php
More file actions
69 lines (59 loc) · 1.42 KB
/
xml.php
File metadata and controls
69 lines (59 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
date_default_timezone_set('America/Montreal');
?>
<html>
<head>
<title>goSMS Backup Reader</title>
<meta charset="utf8">
<style>
body{
background-color: #796144;
}
#xml{
width:75%;
margin:auto;
}
div{
border: 1px solid #000000;
border-radius: 25px 25px 25px 25px;
margin-top: 5px;
padding: 5px;
width: 50%;
}
.her{
background-color:#E2B439;
}
.me{
background-color: #328EA3;
margin-left:50%;
}
.infos{
text-align: right;
font-size:x-small;
font-style: italic;
}
</style>
</head>
<body>
<section id="xml">
<?php
$file = 'c:/backup/sms.xml'; #Path to backup file
$xml = simplexml_load_file($file);
foreach($xml->SMS as $SMS) {
#GoSMS save the date as UNIX Timestamp which is in milliseconds, so we divide it by 1000 to get it to work with Date function.
#On divise le chiffre par 1 000 car GoSMS enregistre les dates en timestamp UNIX (en millisecondes : 1 sec = 1000 ms)
$date = (string) $SMS->date;
$date /= 1000;
#If SMS->type == 2, then its a sent SMS, otherwise its a received text message.
#Si le type vaut 2, c'est un SMS envoyé, sinon c'est un texto reçu.
$who = ($SMS->type == 2) ? 'me' : 'her';
#Show time !
echo '<div class="'.$who.'">';
echo '<p>'.$SMS->body.'</p>';
echo '<p class="infos">'.date('l d/m/Y - H:i:s', $date).'</p>';
echo '</div>';
}
?>
</section>
</body>
</html>