clockwerk-www – Blame information for rev
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
5 | vero | 1 | <?php |
2 | |||
3 | require_once('../include/env_interface.php'); |
||
4 | |||
5 | |||
6 | //$request_xml = $HTTP_RAW_POST_DATA; |
||
7 | //error_log("offline.php: ".$request_xml); |
||
8 | |||
9 | |||
10 | // |
||
11 | if (!opensim_is_access_from_region_server()) { |
||
12 | $remote_addr = $_SERVER["REMOTE_ADDR"]; |
||
13 | error_log("offline.php: Illegal access from ".$remote_addr); |
||
14 | exit; |
||
15 | } |
||
16 | |||
17 | |||
18 | $DbLink = new DB(OFFLINE_DB_HOST, OFFLINE_DB_NAME, OFFLINE_DB_USER, OFFLINE_DB_PASS); |
||
19 | |||
20 | $method = $_SERVER["PATH_INFO"]; |
||
21 | |||
22 | |||
23 | if ($method == "/SaveMessage/") { |
||
24 | $msg = $HTTP_RAW_POST_DATA; |
||
25 | $start = strpos($msg, "?>"); |
||
26 | |||
27 | if ($start != -1) { |
||
28 | $start+=2; |
||
29 | $msg = substr($msg, $start); |
||
30 | //$parts = split("[<>]", $msg); |
||
31 | $parts = preg_split("/[<>]/", $msg); |
||
32 | $from_agent = $parts[4]; |
||
33 | $to_agent = $parts[12]; |
||
34 | |||
35 | if (isGUID($from_agent) and isGUID($to_agent)) { |
||
36 | $query_str = "INSERT INTO ".OFFLINE_MESSAGE_TBL." (to_uuid,from_uuid,message) VALUES ('".$to_agent."','".$from_agent."','".mysql_escape_string($msg)."')"; |
||
37 | $DbLink->query($query_str); |
||
38 | |||
39 | if ($DbLink->Errno==0) { |
||
40 | echo '<?xml version="1.0" encoding="utf-8"?><boolean>true</boolean>'; |
||
41 | exit; |
||
42 | } |
||
43 | } |
||
44 | } |
||
45 | |||
46 | echo '<?xml version="1.0" encoding="utf-8"?><boolean>false</boolean>'; |
||
47 | exit; |
||
48 | } |
||
49 | |||
50 | |||
51 | if ($method == "/RetrieveMessages/") { |
||
52 | $parms = $HTTP_RAW_POST_DATA; |
||
53 | //$parts = split("[<>]", $parms); |
||
54 | $parts = preg_split("/[<>]/", $parms); |
||
55 | $agent_id = $parts[6]; |
||
56 | $errno = -1; |
||
57 | |||
58 | if (isGUID($agent_id)) { |
||
59 | $DbLink->query("SELECT message FROM ".OFFLINE_MESSAGE_TBL." WHERE to_uuid='".$agent_id."'"); |
||
60 | $errno = $DbLink->Errno; |
||
61 | } |
||
62 | |||
63 | echo '<?xml version="1.0" encoding="utf-8"?>'; |
||
64 | echo '<ArrayOfGridInstantMessage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">'; |
||
65 | |||
66 | if ($errno==0) { |
||
67 | while(list($message) = $DbLink->next_record()) { |
||
68 | echo $message; |
||
69 | } |
||
70 | } |
||
71 | echo '</ArrayOfGridInstantMessage>'; |
||
72 | |||
73 | if ($errno==0) { |
||
74 | $DbLink->query("DELETE FROM ".OFFLINE_MESSAGE_TBL." WHERE to_uuid='".$agent_id."'"); |
||
75 | } |
||
76 | exit; |
||
77 | } |
||
78 | |||
79 | |||
80 | ?> |