clockwerk-www – Blame information for rev
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
5 | vero | 1 | <?php |
2 | # |
||
3 | # Copyright (c)Melanie Thielker and Teravus Ovares (http://opensimulator.org/) |
||
4 | # |
||
5 | # Redistribution and use in source and binary forms, with or without |
||
6 | # modification, are permitted provided that the following conditions are met: |
||
7 | # * Redistributions of source code must retain the above copyright |
||
8 | # notice, this list of conditions and the following disclaimer. |
||
9 | # * Redistributions in binary form must reproduce the above copyright |
||
10 | # notice, this list of conditions and the following disclaimer in the |
||
11 | # documentation and/or other materials provided with the distribution. |
||
12 | # * Neither the name of the OpenSim Project nor the |
||
13 | # names of its contributors may be used to endorse or promote products |
||
14 | # derived from this software without specific prior written permission. |
||
15 | # |
||
16 | # THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
||
17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||
18 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
19 | # DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
||
20 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||
21 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||
22 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||
23 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
24 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
25 | # |
||
26 | |||
27 | |||
28 | ////////////////////////////////////////////////////////////////////////////// |
||
29 | // |
||
30 | // Modified by Fumi.Iseki for CMS/LMS '09 5/31 |
||
31 | // |
||
32 | |||
33 | require_once('../include/env_interface.php'); |
||
34 | require_once('./helpers.php'); |
||
35 | |||
36 | |||
37 | |||
38 | ###################### No user serviceable parts below ##################### |
||
39 | # |
||
40 | # The XMLRPC server object |
||
41 | # |
||
42 | |||
43 | $xmlrpc_server = xmlrpc_server_create(); |
||
44 | |||
45 | # |
||
46 | # Land purchase sections |
||
47 | # |
||
48 | # Functions are called by the viewer directly. |
||
49 | # |
||
50 | |||
51 | # |
||
52 | # Land buying functions |
||
53 | # |
||
54 | |||
55 | xmlrpc_server_register_method($xmlrpc_server, "preflightBuyLandPrep", "buy_land_prep"); |
||
56 | |||
57 | function buy_land_prep($method_name, $params, $app_data) |
||
58 | { |
||
59 | $req = $params[0]; |
||
60 | $agentid = $req['agentId']; |
||
61 | $sessionid = $req['secureSessionId']; |
||
62 | $amount = $req['currencyBuy']; |
||
63 | $billableArea = $req['billableArea']; |
||
64 | $ipAddress = $_SERVER['REMOTE_ADDR']; |
||
65 | |||
66 | $ret = opensim_check_secure_session($agentid, null, $sessionid); |
||
67 | |||
68 | if($ret) { |
||
69 | $confirmvalue = get_confirm_value($ipAddress); |
||
70 | $membership_levels = array('levels' => array('id' => "00000000-0000-0000-0000-000000000000", 'description' => "some level")); |
||
71 | $landUse = array('upgrade' => False, 'action' => "".SYSURL.""); |
||
72 | $currency = array('estimatedCost' => convert_to_real($amount)); |
||
73 | $membership = array('upgrade' => False, 'action' => "".SYSURL."", 'levels' => $membership_levels); |
||
74 | $response_xml = xmlrpc_encode(array('success' => True, |
||
75 | 'currency' => $currency, |
||
76 | 'membership'=> $membership, |
||
77 | 'landUse' => $landUse, |
||
78 | 'currency' => $currency, |
||
79 | 'confirm' => $confirmvalue)); |
||
80 | } |
||
81 | else { |
||
82 | $response_xml = xmlrpc_encode(array( 'success' => False, |
||
83 | 'errorMessage' => "Unable to Authenticate\n\nClick URL for more info.", |
||
84 | 'errorURI' => "".SYSURL."")); |
||
85 | } |
||
86 | |||
87 | header("Content-type: text/xml"); |
||
88 | echo $response_xml; |
||
89 | |||
90 | return ""; |
||
91 | } |
||
92 | |||
93 | |||
94 | # |
||
95 | # Perform the buy |
||
96 | # |
||
97 | |||
98 | xmlrpc_server_register_method($xmlrpc_server, "buyLandPrep", "buy_land"); |
||
99 | |||
100 | function buy_land($method_name, $params, $app_data) |
||
101 | { |
||
102 | $req = $params[0]; |
||
103 | $agentid = $req['agentId']; |
||
104 | $sessionid = $req['secureSessionId']; |
||
105 | $amount = $req['currencyBuy']; |
||
106 | $cost = $req['estimatedCost']; |
||
107 | $billableArea = $req['billableArea']; |
||
108 | $confim = $req['confirm']; |
||
109 | $ipAddress = $_SERVER['REMOTE_ADDR']; |
||
110 | |||
111 | // |
||
112 | if ($confim!=get_confirm_value($ipAddress)) { |
||
113 | $response_xml = xmlrpc_encode(array('success' => False, |
||
114 | 'errorMessage'=> "\n\nMissmatch Confirm Value!!", |
||
115 | 'errorURI' => "".SYSURL."")); |
||
116 | header("Content-type: text/xml"); |
||
117 | echo $response_xml; |
||
118 | return ""; |
||
119 | } |
||
120 | |||
121 | $ret = opensim_check_secure_session($agentid, null, $sessionid); |
||
122 | |||
123 | if ($ret) { |
||
124 | if($amount>=0) { |
||
125 | if(!process_transaction($agentid, $real, $ipAddress)) { |
||
126 | $response_xml = xmlrpc_encode(array( |
||
127 | 'success' => False, |
||
128 | 'errorMessage' => "\n\nThe gateway has declined your transaction. Please update your payment method AND try again later.", |
||
129 | 'errorURI' => "".SYSURL."")); |
||
130 | } |
||
131 | move_money($agentid, null, $amount, 5002, 0, "Land Purchase", 0, 0, $ipAddress); |
||
132 | update_simulator_balance($agentid, -1, $sessionid); |
||
133 | |||
134 | $response_xml = xmlrpc_encode(array('success' => True)); |
||
135 | } |
||
136 | else { |
||
137 | $response_xml = xmlrpc_encode(array('success' => False, |
||
138 | 'errorMessage'=> "\n\nYou do not have sufficient funds for this purchase", |
||
139 | 'errorURI' => "".SYSURL."")); |
||
140 | } |
||
141 | } |
||
142 | else { |
||
143 | $response_xml = xmlrpc_encode(array('success' => False, |
||
144 | 'errorMessage' => "\n\nUnable to Authenticate\n\nClick URL for more info.", |
||
145 | 'errorURI' => "".SYSURL."")); |
||
146 | } |
||
147 | |||
148 | header("Content-type: text/xml"); |
||
149 | echo $response_xml; |
||
150 | |||
151 | return ""; |
||
152 | } |
||
153 | |||
154 | |||
155 | |||
156 | |||
157 | # |
||
158 | # Process XMLRPC request |
||
159 | # |
||
160 | |||
161 | $request_xml = $HTTP_RAW_POST_DATA; |
||
162 | //error_log("landtool.php: ".$request_xml); |
||
163 | |||
164 | xmlrpc_server_call_method($xmlrpc_server, $request_xml, ''); |
||
165 | xmlrpc_server_destroy($xmlrpc_server); |
||
166 | |||
167 | ?> |