[2] | 1 | <?php |
---|
[2364] | 2 | |
---|
| 3 | /*************************************************************************** |
---|
| 4 | * Expresso Livre * |
---|
| 5 | * http://www.expressolivre.org * |
---|
| 6 | * -------------------------------------------- * |
---|
| 7 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 8 | * under the terms of the GNU General Public License as published by the * |
---|
| 9 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
| 10 | * option) any later version. * |
---|
| 11 | \**************************************************************************/ |
---|
[2] | 12 | // by Edd Dumbill (C) 1999-2001 |
---|
| 13 | // <edd@usefulinc.com> |
---|
| 14 | // xmlrpc.inc,v 1.18 2001/07/06 18:23:57 edmundd |
---|
| 15 | |
---|
| 16 | // License is granted to use or modify this software ("XML-RPC for PHP") |
---|
| 17 | // for commercial or non-commercial use provided the copyright of the author |
---|
| 18 | // is preserved in any distributed or derivative work. |
---|
| 19 | |
---|
| 20 | // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR |
---|
| 21 | // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
---|
| 22 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
---|
| 23 | // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
---|
| 24 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
---|
| 25 | // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
---|
| 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
---|
| 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
---|
| 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
---|
| 29 | // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 30 | |
---|
| 31 | class xmlrpcresp |
---|
| 32 | { |
---|
| 33 | var $xv = array(); |
---|
| 34 | var $fn; |
---|
| 35 | var $fs = ''; |
---|
| 36 | var $hdrs; |
---|
| 37 | |
---|
| 38 | function xmlrpcresp($val='', $fcode=0, $fstr='') |
---|
| 39 | { |
---|
| 40 | if ($fcode!=0) |
---|
| 41 | { |
---|
| 42 | $this->xv = 0; |
---|
| 43 | $this->fn = $fcode; |
---|
| 44 | $this->fs = htmlspecialchars($fstr); |
---|
| 45 | } |
---|
| 46 | else |
---|
| 47 | { |
---|
| 48 | if($val) |
---|
| 49 | { |
---|
| 50 | $this->xv = $val; |
---|
| 51 | } |
---|
| 52 | $this->fn = 0; |
---|
| 53 | } |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | function faultCode() |
---|
| 57 | { |
---|
| 58 | if (isset($this->fn)) |
---|
| 59 | { |
---|
| 60 | return $this->fn; |
---|
| 61 | } |
---|
| 62 | else |
---|
| 63 | { |
---|
| 64 | return 0; |
---|
| 65 | } |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | function faultString() |
---|
| 69 | { |
---|
| 70 | return $this->fs; |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | function value() |
---|
| 74 | { |
---|
| 75 | return $this->xv; |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | function serialize() |
---|
| 79 | { |
---|
| 80 | $rs='<methodResponse>'."\n"; |
---|
| 81 | if (isset($this->fn) && !empty($this->fn)) |
---|
| 82 | { |
---|
| 83 | $rs .= '<fault> |
---|
| 84 | <value> |
---|
| 85 | <struct> |
---|
| 86 | <member> |
---|
| 87 | <name>faultCode</name> |
---|
| 88 | <value><int>' . $this->fn . '</int></value> |
---|
| 89 | </member> |
---|
| 90 | <member> |
---|
| 91 | <name>faultString</name> |
---|
| 92 | <value><string>' . $this->fs . '</string></value> |
---|
| 93 | </member> |
---|
| 94 | </struct> |
---|
| 95 | </value> |
---|
| 96 | </fault>'; |
---|
| 97 | } |
---|
| 98 | else |
---|
| 99 | { |
---|
| 100 | $rs .= '<params>'."\n".'<param>'."\n".@$this->xv->serialize().'</param>'."\n".'</params>'; |
---|
| 101 | } |
---|
| 102 | $rs.="\n".'</methodResponse>'; |
---|
| 103 | return $rs; |
---|
| 104 | } |
---|
| 105 | } |
---|
| 106 | ?> |
---|