@@ -14,8 +14,7 @@ discard block |
||
14 | 14 | function stripslashes_deep($value) |
15 | 15 | { |
16 | 16 | $value = is_array($value) ? |
17 | - array_map('stripslashes_deep', $value) : |
|
18 | - stripslashes($value); |
|
17 | + array_map('stripslashes_deep', $value) : stripslashes($value); |
|
19 | 18 | |
20 | 19 | return $value; |
21 | 20 | } |
@@ -25,7 +24,7 @@ discard block |
||
25 | 24 | $preferredEncodings = 'UTF-8, ASCII, ISO-8859-1, UTF-7, EUC-JP, SJIS, eucJP-win, SJIS-win, JIS, ISO-2022-JP'; |
26 | 25 | $inputcharset = mb_detect_encoding(urldecode($_SERVER['REQUEST_URI']), $preferredEncodings); |
27 | 26 | |
28 | - if ( isset( $_GET['usepost'] ) && $_GET['usepost'] === 'true' ) |
|
27 | + if (isset($_GET['usepost']) && $_GET['usepost'] === 'true') |
|
29 | 28 | { |
30 | 29 | $_GET = $_POST; |
31 | 30 | $inputcharset = mb_detect_encoding(implode('', $_GET), $preferredEncodings); |
@@ -69,11 +68,11 @@ discard block |
||
69 | 68 | $verifypeer = true; |
70 | 69 | else |
71 | 70 | $verifypeer = false; |
72 | - $cainfo= isset($_GET['cainfo']) ? $_GET['cainfo'] : ''; |
|
71 | + $cainfo = isset($_GET['cainfo']) ? $_GET['cainfo'] : ''; |
|
73 | 72 | $proxy = isset($_GET['proxy']) ? $_GET['proxy'] : 0; |
74 | 73 | if (strpos($proxy, 'http://') === 0) |
75 | 74 | $proxy = substr($proxy, 7); |
76 | - $proxyuser= isset($_GET['proxyuser']) ? $_GET['proxyuser'] : ''; |
|
75 | + $proxyuser = isset($_GET['proxyuser']) ? $_GET['proxyuser'] : ''; |
|
77 | 76 | $proxypwd = isset($_GET['proxypwd']) ? $_GET['proxypwd'] : ''; |
78 | 77 | $timeout = isset($_GET['timeout']) ? $_GET['timeout'] : 0; |
79 | 78 | if (!is_numeric($timeout)) |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | if ($proxy != '') { |
83 | 83 | $pproxy = explode(':', $proxy); |
84 | - if (count($pproxy) > 1) |
|
84 | + if (count($pproxy)>1) |
|
85 | 85 | $pport = $pproxy[1]; |
86 | 86 | else |
87 | 87 | $pport = 8080; |
@@ -175,8 +175,8 @@ discard block |
||
175 | 175 | if ($wstype == 1) |
176 | 176 | { |
177 | 177 | $msg[0]->payload = "{\n". |
178 | - '"method": "' . $method . "\",\n\"params\": [" . |
|
179 | - $payload . |
|
178 | + '"method": "'.$method."\",\n\"params\": [". |
|
179 | + $payload. |
|
180 | 180 | "\n],\n\"id\": "; |
181 | 181 | // fix: if user gave an empty string, use NULL, or we'll break json syntax |
182 | 182 | if ($id == "") |
@@ -196,10 +196,10 @@ discard block |
||
196 | 196 | } |
197 | 197 | } |
198 | 198 | else |
199 | - $msg[0]->payload = $msg[0]->xml_header($inputcharset) . |
|
200 | - '<methodName>' . $method . "</methodName>\n<params>" . |
|
201 | - $payload . |
|
202 | - "</params>\n" . $msg[0]->xml_footer(); |
|
199 | + $msg[0]->payload = $msg[0]->xml_header($inputcharset). |
|
200 | + '<methodName>'.$method."</methodName>\n<params>". |
|
201 | + $payload. |
|
202 | + "</params>\n".$msg[0]->xml_footer(); |
|
203 | 203 | $actionname = 'Execution of method '.$method; |
204 | 204 | break; |
205 | 205 | default: // give a warning |
@@ -214,20 +214,20 @@ discard block |
||
214 | 214 | $response = null; |
215 | 215 | // execute method(s) |
216 | 216 | if ($debug) |
217 | - echo '<div class="dbginfo"><h2>Debug info:</h2>'; /// @todo use ob_start instead |
|
217 | + echo '<div class="dbginfo"><h2>Debug info:</h2>'; /// @todo use ob_start instead |
|
218 | 218 | $resp = array(); |
219 | - $mtime = explode(' ',microtime()); |
|
220 | - $time = (float)$mtime[0] + (float)$mtime[1]; |
|
219 | + $mtime = explode(' ', microtime()); |
|
220 | + $time = (float) $mtime[0]+(float) $mtime[1]; |
|
221 | 221 | foreach ($msg as $message) |
222 | 222 | { |
223 | 223 | // catch errors: for older xmlrpc libs, send does not return by ref |
224 | - @$response =& $client->send($message, $timeout, $httpprotocol); |
|
224 | + @$response = & $client->send($message, $timeout, $httpprotocol); |
|
225 | 225 | $resp[] = $response; |
226 | 226 | if (!$response || $response->faultCode()) |
227 | 227 | break; |
228 | 228 | } |
229 | - $mtime = explode(' ',microtime()); |
|
230 | - $time = (float)$mtime[0] + (float)$mtime[1] - $time; |
|
229 | + $mtime = explode(' ', microtime()); |
|
230 | + $time = (float) $mtime[0]+(float) $mtime[1]-$time; |
|
231 | 231 | if ($debug) |
232 | 232 | echo "</div>\n"; |
233 | 233 | |
@@ -239,15 +239,15 @@ discard block |
||
239 | 239 | // call failed! echo out error msg! |
240 | 240 | //echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset).'</h2>'; |
241 | 241 | echo "<h3>$protoname call FAILED!</h3>\n"; |
242 | - echo "<p>Fault code: [" . htmlspecialchars($response->faultCode(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding']) . |
|
243 | - "] Reason: '" . htmlspecialchars($response->faultString(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding']) . "'</p>\n"; |
|
242 | + echo "<p>Fault code: [".htmlspecialchars($response->faultCode(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding']). |
|
243 | + "] Reason: '".htmlspecialchars($response->faultString(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding'])."'</p>\n"; |
|
244 | 244 | echo (strftime("%d/%b/%Y:%H:%M:%S\n")); |
245 | 245 | } |
246 | 246 | else |
247 | 247 | { |
248 | 248 | // call succeeded: parse results |
249 | 249 | //echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset).'</h2>'; |
250 | - printf ("<h3>%s call(s) OK (%.2f secs.)</h3>\n", $protoname, $time); |
|
250 | + printf("<h3>%s call(s) OK (%.2f secs.)</h3>\n", $protoname, $time); |
|
251 | 251 | echo (strftime("%d/%b/%Y:%H:%M:%S\n")); |
252 | 252 | |
253 | 253 | switch ($action) |
@@ -255,15 +255,15 @@ discard block |
||
255 | 255 | case 'list': |
256 | 256 | |
257 | 257 | $v = $response->value(); |
258 | - if ($v->kindOf()=="array") |
|
258 | + if ($v->kindOf() == "array") |
|
259 | 259 | { |
260 | 260 | $max = $v->arraysize(); |
261 | 261 | echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; |
262 | 262 | echo "<thead>\n<tr><th>Method</th><th>Description</th></tr>\n</thead>\n<tbody>\n"; |
263 | - for($i=0; $i < $max; $i++) |
|
263 | + for ($i = 0; $i<$max; $i++) |
|
264 | 264 | { |
265 | 265 | $rec = $v->arraymem($i); |
266 | - if ($i%2) $class=' class="oddrow"'; else $class = ' class="evenrow"'; |
|
266 | + if ($i % 2) $class = ' class="oddrow"'; else $class = ' class="evenrow"'; |
|
267 | 267 | echo ("<tr><td$class>".htmlspecialchars($rec->scalarval(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding'])."</td><td$class><form action=\"controller.php\" method=\"get\" target=\"frmcontroller\">". |
268 | 268 | "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
269 | 269 | "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
@@ -319,33 +319,33 @@ discard block |
||
319 | 319 | if ($desc == "") |
320 | 320 | $desc = "-"; |
321 | 321 | echo "<tr><td class=\"evenrow\">Description</td><td colspan=\"3\" class=\"evenrow\">$desc</td></tr>\n"; |
322 | - $payload=""; |
|
323 | - $alt_payload=""; |
|
324 | - if ($r2->kindOf()!="array") |
|
322 | + $payload = ""; |
|
323 | + $alt_payload = ""; |
|
324 | + if ($r2->kindOf() != "array") |
|
325 | 325 | echo "<tr><td class=\"oddrow\">Signature</td><td class=\"oddrow\">Unknown</td><td class=\"oddrow\"> </td></tr>\n"; |
326 | 326 | else |
327 | 327 | { |
328 | - for($i=0; $i < $r2->arraysize(); $i++) |
|
328 | + for ($i = 0; $i<$r2->arraysize(); $i++) |
|
329 | 329 | { |
330 | - if ($i+1%2) $class=' class="oddrow"'; else $class = ' class="evenrow"'; |
|
330 | + if ($i+1 % 2) $class = ' class="oddrow"'; else $class = ' class="evenrow"'; |
|
331 | 331 | echo "<tr><td$class>Signature ".($i+1)."</td><td$class>"; |
332 | 332 | $x = $r2->arraymem($i); |
333 | - if ($x->kindOf()=="array") |
|
333 | + if ($x->kindOf() == "array") |
|
334 | 334 | { |
335 | 335 | $ret = $x->arraymem(0); |
336 | - echo "<code>OUT: " . htmlspecialchars($ret->scalarval(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding']) . "<br />IN: ("; |
|
337 | - if ($x->arraysize() > 1) |
|
336 | + echo "<code>OUT: ".htmlspecialchars($ret->scalarval(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding'])."<br />IN: ("; |
|
337 | + if ($x->arraysize()>1) |
|
338 | 338 | { |
339 | - for($k = 1; $k < $x->arraysize(); $k++) |
|
339 | + for ($k = 1; $k<$x->arraysize(); $k++) |
|
340 | 340 | { |
341 | 341 | $y = $x->arraymem($k); |
342 | 342 | echo $y->scalarval(); |
343 | 343 | if ($wstype != 1) |
344 | 344 | { |
345 | - $payload = $payload . '<param><value><'.htmlspecialchars($y->scalarval(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding']).'></'.htmlspecialchars($y->scalarval(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding'])."></value></param>\n"; |
|
345 | + $payload = $payload.'<param><value><'.htmlspecialchars($y->scalarval(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding']).'></'.htmlspecialchars($y->scalarval(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding'])."></value></param>\n"; |
|
346 | 346 | } |
347 | 347 | $alt_payload .= $y->scalarval(); |
348 | - if ($k < $x->arraysize()-1) |
|
348 | + if ($k<$x->arraysize()-1) |
|
349 | 349 | { |
350 | 350 | $alt_payload .= ';'; |
351 | 351 | echo ", "; |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | case 'wrap': |
430 | 430 | $r1 = $resp[0]->value(); |
431 | 431 | $r2 = $resp[1]->value(); |
432 | - if ($r2->kindOf()!="array" || $r2->arraysize() <= $methodsig) |
|
432 | + if ($r2->kindOf() != "array" || $r2->arraysize()<=$methodsig) |
|
433 | 433 | echo "Error: signature unknown\n"; |
434 | 434 | else |
435 | 435 | { |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | $msig = php_xmlrpc_decode($r2); |
438 | 438 | $msig = $msig[$methodsig]; |
439 | 439 | $proto = $protocol == 2 ? 'https' : $protocol == 1 ? 'http11' : ''; |
440 | - if ($proxy == '' && $username == '' && !$requestcompression && !$responsecompression && |
|
440 | + if ($proxy == '' && $username == '' && !$requestcompression && !$responsecompression && |
|
441 | 441 | $clientcookies == '') |
442 | 442 | { |
443 | 443 | $opts = 0; // simple client copy in stub code |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | //--> |
215 | 215 | </script> |
216 | 216 | </head> |
217 | -<body onload="switchtransport(<?php echo $wstype;?>); switchaction(); switchssl(); switchauth(); swicthcainfo();<?php if ($run) echo ' document.forms[2].submit();'; ?>"> |
|
217 | +<body onload="switchtransport(<?php echo $wstype; ?>); switchaction(); switchssl(); switchauth(); swicthcainfo();<?php if ($run) echo ' document.forms[2].submit();'; ?>"> |
|
218 | 218 | <h1>XMLRPC <form name="frmxmlrpc" style="display: inline;" action="."><input name="yes" type="radio" onclick="switchtransport(0);"/></form> |
219 | 219 | /<form name="frmjsonrpc" style="display: inline;" action="."><input name="yes" type="radio" onclick="switchtransport(1);"/></form>JSONRPC Debugger (based on the <a href="http://phpxmlrpc.sourceforge.net">PHP-XMLRPC</a> library)</h1> |
220 | 220 | <form name="frmaction" method="get" action="action.php" target="frmaction" onSubmit="switchFormMethod();" |
@@ -232,10 +232,10 @@ discard block |
||
232 | 232 | <table id="actionblock"> |
233 | 233 | <tr> |
234 | 234 | <td><h2>Action</h2></td> |
235 | -<td>List available methods<input type="radio" name="action" value="list"<?php if ($action=='list') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
236 | -<td>Describe method<input type="radio" name="action" value="describe"<?php if ($action=='describe') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
237 | -<td>Execute method<input type="radio" name="action" value="execute"<?php if ($action=='execute') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
238 | -<td>Generate stub for method call<input type="radio" name="action" value="wrap"<?php if ($action=='wrap') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
235 | +<td>List available methods<input type="radio" name="action" value="list"<?php if ($action == 'list') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
236 | +<td>Describe method<input type="radio" name="action" value="describe"<?php if ($action == 'describe') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
237 | +<td>Execute method<input type="radio" name="action" value="execute"<?php if ($action == 'execute') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
238 | +<td>Generate stub for method call<input type="radio" name="action" value="wrap"<?php if ($action == 'wrap') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
239 | 239 | </tr> |
240 | 240 | </table> |
241 | 241 | <input type="hidden" name="methodsig" value="<?php echo htmlspecialchars($methodsig, ENT_COMPAT, $inputcharset); ?>" /> |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | <td class="labelcell">Name:</td><td><input type="text" name="method" value="<?php echo htmlspecialchars($method, ENT_COMPAT, $inputcharset); ?>" /></td> |
247 | 247 | <td class="labelcell">Payload:<br/><div id="methodpayloadbtn"></div></td><td><textarea id="methodpayload" name="methodpayload" rows="1" cols="40"><?php echo htmlspecialchars($payload, ENT_COMPAT, $inputcharset); ?></textarea></td> |
248 | 248 | <td class="labelcell" id="idcell">Msg id: <input type="text" name="id" size="3" value="<?php echo htmlspecialchars($id, ENT_COMPAT, $inputcharset); ?>"/></td> |
249 | -<td><input type="hidden" name="wstype" value="<?php echo $wstype;?>" /> |
|
249 | +<td><input type="hidden" name="wstype" value="<?php echo $wstype; ?>" /> |
|
250 | 250 | <input type="submit" value="Execute" onclick="return verifyserver();"/></td> |
251 | 251 | </tr> |
252 | 252 | </table> |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | <option value="2"<?php if ($debug == 2) echo ' selected="selected"'; ?>>More</option> |
261 | 261 | </select> |
262 | 262 | </td> |
263 | -<td class="labelcell">Timeout:</td><td><input type="text" name="timeout" size="3" value="<?php if ($timeout > 0) echo $timeout; ?>" /></td> |
|
263 | +<td class="labelcell">Timeout:</td><td><input type="text" name="timeout" size="3" value="<?php if ($timeout>0) echo $timeout; ?>" /></td> |
|
264 | 264 | <td class="labelcell">Protocol:</td><td><select name="protocol" onchange="switchssl(); switchauth(); swicthcainfo();"> |
265 | 265 | <option value="0"<?php if ($protocol == 0) echo ' selected="selected"'; ?>>HTTP 1.0</option> |
266 | 266 | <option value="1"<?php if ($protocol == 1) echo ' selected="selected"'; ?>>HTTP 1.1</option> |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | $timeout = 0; |
24 | 24 | $url = php_xmlrpc_decode($m->getParam(0)); |
25 | 25 | $c = new xmlrpc_client($url); |
26 | - if ($m->getNumParams() > 3) |
|
26 | + if ($m->getNumParams()>3) |
|
27 | 27 | { |
28 | 28 | // we have to set some options onto the client. |
29 | 29 | // Note that if we do not untaint the received values, warnings might be generated... |
30 | 30 | $options = php_xmlrpc_decode($m->getParam(3)); |
31 | - foreach($options as $key => $val) |
|
31 | + foreach ($options as $key => $val) |
|
32 | 32 | { |
33 | - switch($key) |
|
33 | + switch ($key) |
|
34 | 34 | { |
35 | 35 | case 'Cookie': |
36 | 36 | break; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $method = php_xmlrpc_decode($m->getParam(1)); |
60 | 60 | $pars = $m->getParam(2); |
61 | 61 | $m = new xmlrpcmsg($method); |
62 | - for ($i = 0; $i < $pars->arraySize(); $i++) |
|
62 | + for ($i = 0; $i<$pars->arraySize(); $i++) |
|
63 | 63 | { |
64 | 64 | $m->addParam($pars->arraymem($i)); |
65 | 65 | } |
@@ -3,9 +3,9 @@ discard block |
||
3 | 3 | include("xmlrpc.inc"); |
4 | 4 | include("xmlrpcs.inc"); |
5 | 5 | |
6 | - $addcomment_sig=array(array($xmlrpcInt, $xmlrpcString, $xmlrpcString, $xmlrpcString)); |
|
6 | + $addcomment_sig = array(array($xmlrpcInt, $xmlrpcString, $xmlrpcString, $xmlrpcString)); |
|
7 | 7 | |
8 | - $addcomment_doc='Adds a comment to an item. The first parameter |
|
8 | + $addcomment_doc = 'Adds a comment to an item. The first parameter |
|
9 | 9 | is the item ID, the second the name of the commenter, and the third |
10 | 10 | is the comment itself. Returns the number of comments against that |
11 | 11 | ID.'; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | function addcomment($m) |
14 | 14 | { |
15 | 15 | global $xmlrpcerruser; |
16 | - $err=""; |
|
16 | + $err = ""; |
|
17 | 17 | // since validation has already been carried out for us, |
18 | 18 | // we know we got exactly 3 string values |
19 | 19 | $n = php_xmlrpc_decode($m); |
@@ -21,31 +21,31 @@ discard block |
||
21 | 21 | $name = $n[1]; |
22 | 22 | $comment = $n[2]; |
23 | 23 | |
24 | - $dbh=dba_open("/tmp/comments.db", "c", "db2"); |
|
25 | - if($dbh) |
|
24 | + $dbh = dba_open("/tmp/comments.db", "c", "db2"); |
|
25 | + if ($dbh) |
|
26 | 26 | { |
27 | - $countID="${msgID}_count"; |
|
28 | - if(dba_exists($countID, $dbh)) |
|
27 | + $countID = "${msgID}_count"; |
|
28 | + if (dba_exists($countID, $dbh)) |
|
29 | 29 | { |
30 | - $count=dba_fetch($countID, $dbh); |
|
30 | + $count = dba_fetch($countID, $dbh); |
|
31 | 31 | } |
32 | 32 | else |
33 | 33 | { |
34 | - $count=0; |
|
34 | + $count = 0; |
|
35 | 35 | } |
36 | 36 | // add the new comment in |
37 | - dba_insert($msgID . "_comment_${count}", $comment, $dbh); |
|
38 | - dba_insert($msgID . "_name_${count}", $name, $dbh); |
|
37 | + dba_insert($msgID."_comment_${count}", $comment, $dbh); |
|
38 | + dba_insert($msgID."_name_${count}", $name, $dbh); |
|
39 | 39 | $count++; |
40 | 40 | dba_replace($countID, $count, $dbh); |
41 | 41 | dba_close($dbh); |
42 | 42 | } |
43 | 43 | else |
44 | 44 | { |
45 | - $err="Unable to open comments database."; |
|
45 | + $err = "Unable to open comments database."; |
|
46 | 46 | } |
47 | 47 | // if we generated an error, create an error return response |
48 | - if($err) |
|
48 | + if ($err) |
|
49 | 49 | { |
50 | 50 | return new xmlrpcresp(0, $xmlrpcerruser, $err); |
51 | 51 | } |
@@ -57,37 +57,37 @@ discard block |
||
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | - $getcomments_sig=array(array($xmlrpcArray, $xmlrpcString)); |
|
60 | + $getcomments_sig = array(array($xmlrpcArray, $xmlrpcString)); |
|
61 | 61 | |
62 | - $getcomments_doc='Returns an array of comments for a given ID, which |
|
62 | + $getcomments_doc = 'Returns an array of comments for a given ID, which |
|
63 | 63 | is the sole argument. Each array item is a struct containing name |
64 | 64 | and comment text.'; |
65 | 65 | |
66 | 66 | function getcomments($m) |
67 | 67 | { |
68 | 68 | global $xmlrpcerruser; |
69 | - $err=""; |
|
70 | - $ra=array(); |
|
69 | + $err = ""; |
|
70 | + $ra = array(); |
|
71 | 71 | // get the first param |
72 | - if(XMLRPC_EPI_ENABLED == '1') |
|
72 | + if (XMLRPC_EPI_ENABLED == '1') |
|
73 | 73 | { |
74 | - $msgID=xmlrpc_decode($m->getParam(0)); |
|
74 | + $msgID = xmlrpc_decode($m->getParam(0)); |
|
75 | 75 | } |
76 | 76 | else |
77 | 77 | { |
78 | - $msgID=php_xmlrpc_decode($m->getParam(0)); |
|
78 | + $msgID = php_xmlrpc_decode($m->getParam(0)); |
|
79 | 79 | } |
80 | - $dbh=dba_open("/tmp/comments.db", "r", "db2"); |
|
81 | - if($dbh) |
|
80 | + $dbh = dba_open("/tmp/comments.db", "r", "db2"); |
|
81 | + if ($dbh) |
|
82 | 82 | { |
83 | - $countID="${msgID}_count"; |
|
84 | - if(dba_exists($countID, $dbh)) |
|
83 | + $countID = "${msgID}_count"; |
|
84 | + if (dba_exists($countID, $dbh)) |
|
85 | 85 | { |
86 | - $count=dba_fetch($countID, $dbh); |
|
87 | - for($i=0; $i<$count; $i++) |
|
86 | + $count = dba_fetch($countID, $dbh); |
|
87 | + for ($i = 0; $i<$count; $i++) |
|
88 | 88 | { |
89 | - $name=dba_fetch("${msgID}_name_${i}", $dbh); |
|
90 | - $comment=dba_fetch("${msgID}_comment_${i}", $dbh); |
|
89 | + $name = dba_fetch("${msgID}_name_${i}", $dbh); |
|
90 | + $comment = dba_fetch("${msgID}_comment_${i}", $dbh); |
|
91 | 91 | // push a new struct onto the return array |
92 | 92 | $ra[] = array( |
93 | 93 | "name" => $name, |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | } |
99 | 99 | // if we generated an error, create an error return response |
100 | - if($err) |
|
100 | + if ($err) |
|
101 | 101 | { |
102 | 102 | return new xmlrpcresp(0, $xmlrpcerruser, $err); |
103 | 103 | } |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming" |
72 | 72 | ); |
73 | 73 | |
74 | - $findstate_sig=array(array($xmlrpcString, $xmlrpcInt)); |
|
75 | - $findstate_doc='When passed an integer between 1 and 51 returns the |
|
74 | + $findstate_sig = array(array($xmlrpcString, $xmlrpcInt)); |
|
75 | + $findstate_doc = 'When passed an integer between 1 and 51 returns the |
|
76 | 76 | name of a US state, where the integer is the index of that state name |
77 | 77 | in an alphabetic order.'; |
78 | 78 | |
@@ -80,24 +80,24 @@ discard block |
||
80 | 80 | function findstate($m) |
81 | 81 | { |
82 | 82 | global $xmlrpcerruser, $stateNames; |
83 | - $err=""; |
|
83 | + $err = ""; |
|
84 | 84 | // get the first param |
85 | - $sno=$m->getParam(0); |
|
85 | + $sno = $m->getParam(0); |
|
86 | 86 | |
87 | 87 | // param must be there and of the correct type: server object does the |
88 | 88 | // validation for us |
89 | 89 | |
90 | 90 | // extract the value of the state number |
91 | - $snv=$sno->scalarval(); |
|
91 | + $snv = $sno->scalarval(); |
|
92 | 92 | // look it up in our array (zero-based) |
93 | 93 | if (isset($stateNames[$snv-1])) |
94 | 94 | { |
95 | - $sname=$stateNames[$snv-1]; |
|
95 | + $sname = $stateNames[$snv-1]; |
|
96 | 96 | } |
97 | 97 | else |
98 | 98 | { |
99 | 99 | // not, there so complain |
100 | - $err="I don't have a state for the index '" . $snv . "'"; |
|
100 | + $err = "I don't have a state for the index '".$snv."'"; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | // if we generated an error, create an error return response |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | else |
130 | 130 | { |
131 | 131 | // not, there so complain |
132 | - return "I don't have a state for the index '" . $stateno . "'"; |
|
132 | + return "I don't have a state for the index '".$stateno."'"; |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | $findstate2_sig = wrap_php_function('inner_findstate'); |
@@ -141,70 +141,70 @@ discard block |
||
141 | 141 | $obj = new xmlrpc_server_methods_container(); |
142 | 142 | $findstate4_sig = wrap_php_function(array($obj, 'findstate')); |
143 | 143 | |
144 | - $addtwo_sig=array(array($xmlrpcInt, $xmlrpcInt, $xmlrpcInt)); |
|
145 | - $addtwo_doc='Add two integers together and return the result'; |
|
144 | + $addtwo_sig = array(array($xmlrpcInt, $xmlrpcInt, $xmlrpcInt)); |
|
145 | + $addtwo_doc = 'Add two integers together and return the result'; |
|
146 | 146 | function addtwo($m) |
147 | 147 | { |
148 | - $s=$m->getParam(0); |
|
149 | - $t=$m->getParam(1); |
|
150 | - return new xmlrpcresp(new xmlrpcval($s->scalarval()+$t->scalarval(),"int")); |
|
148 | + $s = $m->getParam(0); |
|
149 | + $t = $m->getParam(1); |
|
150 | + return new xmlrpcresp(new xmlrpcval($s->scalarval()+$t->scalarval(), "int")); |
|
151 | 151 | } |
152 | 152 | |
153 | - $addtwodouble_sig=array(array($xmlrpcDouble, $xmlrpcDouble, $xmlrpcDouble)); |
|
154 | - $addtwodouble_doc='Add two doubles together and return the result'; |
|
153 | + $addtwodouble_sig = array(array($xmlrpcDouble, $xmlrpcDouble, $xmlrpcDouble)); |
|
154 | + $addtwodouble_doc = 'Add two doubles together and return the result'; |
|
155 | 155 | function addtwodouble($m) |
156 | 156 | { |
157 | - $s=$m->getParam(0); |
|
158 | - $t=$m->getParam(1); |
|
159 | - return new xmlrpcresp(new xmlrpcval($s->scalarval()+$t->scalarval(),"double")); |
|
157 | + $s = $m->getParam(0); |
|
158 | + $t = $m->getParam(1); |
|
159 | + return new xmlrpcresp(new xmlrpcval($s->scalarval()+$t->scalarval(), "double")); |
|
160 | 160 | } |
161 | 161 | |
162 | - $stringecho_sig=array(array($xmlrpcString, $xmlrpcString)); |
|
163 | - $stringecho_doc='Accepts a string parameter, returns the string.'; |
|
162 | + $stringecho_sig = array(array($xmlrpcString, $xmlrpcString)); |
|
163 | + $stringecho_doc = 'Accepts a string parameter, returns the string.'; |
|
164 | 164 | function stringecho($m) |
165 | 165 | { |
166 | 166 | // just sends back a string |
167 | - $s=$m->getParam(0); |
|
167 | + $s = $m->getParam(0); |
|
168 | 168 | $v = $s->scalarval(); |
169 | 169 | return new xmlrpcresp(new xmlrpcval($s->scalarval())); |
170 | 170 | } |
171 | 171 | |
172 | - $echoback_sig=array(array($xmlrpcString, $xmlrpcString)); |
|
173 | - $echoback_doc='Accepts a string parameter, returns the entire incoming payload'; |
|
172 | + $echoback_sig = array(array($xmlrpcString, $xmlrpcString)); |
|
173 | + $echoback_doc = 'Accepts a string parameter, returns the entire incoming payload'; |
|
174 | 174 | function echoback($m) |
175 | 175 | { |
176 | 176 | // just sends back a string with what i got |
177 | 177 | // sent to me, just escaped, that's all |
178 | 178 | // |
179 | 179 | // $m is an incoming message |
180 | - $s="I got the following message:\n" . $m->serialize(); |
|
180 | + $s = "I got the following message:\n".$m->serialize(); |
|
181 | 181 | return new xmlrpcresp(new xmlrpcval($s)); |
182 | 182 | } |
183 | 183 | |
184 | - $echosixtyfour_sig=array(array($xmlrpcString, $xmlrpcBase64)); |
|
185 | - $echosixtyfour_doc='Accepts a base64 parameter and returns it decoded as a string'; |
|
184 | + $echosixtyfour_sig = array(array($xmlrpcString, $xmlrpcBase64)); |
|
185 | + $echosixtyfour_doc = 'Accepts a base64 parameter and returns it decoded as a string'; |
|
186 | 186 | function echosixtyfour($m) |
187 | 187 | { |
188 | 188 | // accepts an encoded value, but sends it back |
189 | 189 | // as a normal string. this is to test base64 encoding |
190 | 190 | // is working as expected |
191 | - $incoming=$m->getParam(0); |
|
191 | + $incoming = $m->getParam(0); |
|
192 | 192 | return new xmlrpcresp(new xmlrpcval($incoming->scalarval(), "string")); |
193 | 193 | } |
194 | 194 | |
195 | - $bitflipper_sig=array(array($xmlrpcArray, $xmlrpcArray)); |
|
196 | - $bitflipper_doc='Accepts an array of booleans, and returns them inverted'; |
|
195 | + $bitflipper_sig = array(array($xmlrpcArray, $xmlrpcArray)); |
|
196 | + $bitflipper_doc = 'Accepts an array of booleans, and returns them inverted'; |
|
197 | 197 | function bitflipper($m) |
198 | 198 | { |
199 | 199 | global $xmlrpcArray; |
200 | 200 | |
201 | - $v=$m->getParam(0); |
|
202 | - $sz=$v->arraysize(); |
|
203 | - $rv=new xmlrpcval(array(), $xmlrpcArray); |
|
201 | + $v = $m->getParam(0); |
|
202 | + $sz = $v->arraysize(); |
|
203 | + $rv = new xmlrpcval(array(), $xmlrpcArray); |
|
204 | 204 | |
205 | - for($j=0; $j<$sz; $j++) |
|
205 | + for ($j = 0; $j<$sz; $j++) |
|
206 | 206 | { |
207 | - $b=$v->arraymem($j); |
|
207 | + $b = $v->arraymem($j); |
|
208 | 208 | if ($b->scalarval()) |
209 | 209 | { |
210 | 210 | $rv->addScalar(false, "boolean"); |
@@ -235,18 +235,18 @@ discard block |
||
235 | 235 | |
236 | 236 | // don't even ask me _why_ these come padded with |
237 | 237 | // hyphens, I couldn't tell you :p |
238 | - $a=str_replace("-", "", $a); |
|
239 | - $b=str_replace("-", "", $b); |
|
238 | + $a = str_replace("-", "", $a); |
|
239 | + $b = str_replace("-", "", $b); |
|
240 | 240 | |
241 | - if ($agesorter_arr[$a]==$agesorter[$b]) |
|
241 | + if ($agesorter_arr[$a] == $agesorter[$b]) |
|
242 | 242 | { |
243 | 243 | return 0; |
244 | 244 | } |
245 | - return ($agesorter_arr[$a] > $agesorter_arr[$b]) ? -1 : 1; |
|
245 | + return ($agesorter_arr[$a]>$agesorter_arr[$b]) ? -1 : 1; |
|
246 | 246 | } |
247 | 247 | |
248 | - $agesorter_sig=array(array($xmlrpcArray, $xmlrpcArray)); |
|
249 | - $agesorter_doc='Send this method an array of [string, int] structs, eg: |
|
248 | + $agesorter_sig = array(array($xmlrpcArray, $xmlrpcArray)); |
|
249 | + $agesorter_doc = 'Send this method an array of [string, int] structs, eg: |
|
250 | 250 | <pre> |
251 | 251 | Dave 35 |
252 | 252 | Edd 45 |
@@ -261,43 +261,43 @@ discard block |
||
261 | 261 | |
262 | 262 | xmlrpc_debugmsg("Entering 'agesorter'"); |
263 | 263 | // get the parameter |
264 | - $sno=$m->getParam(0); |
|
264 | + $sno = $m->getParam(0); |
|
265 | 265 | // error string for [if|when] things go wrong |
266 | - $err=""; |
|
266 | + $err = ""; |
|
267 | 267 | // create the output value |
268 | - $v=new xmlrpcval(); |
|
269 | - $agar=array(); |
|
268 | + $v = new xmlrpcval(); |
|
269 | + $agar = array(); |
|
270 | 270 | |
271 | - if (isset($sno) && $sno->kindOf()=="array") |
|
271 | + if (isset($sno) && $sno->kindOf() == "array") |
|
272 | 272 | { |
273 | - $max=$sno->arraysize(); |
|
273 | + $max = $sno->arraysize(); |
|
274 | 274 | // TODO: create debug method to print can work once more |
275 | 275 | // print "<!-- found $max array elements -->\n"; |
276 | - for($i=0; $i<$max; $i++) |
|
276 | + for ($i = 0; $i<$max; $i++) |
|
277 | 277 | { |
278 | - $rec=$sno->arraymem($i); |
|
279 | - if ($rec->kindOf()!="struct") |
|
278 | + $rec = $sno->arraymem($i); |
|
279 | + if ($rec->kindOf() != "struct") |
|
280 | 280 | { |
281 | - $err="Found non-struct in array at element $i"; |
|
281 | + $err = "Found non-struct in array at element $i"; |
|
282 | 282 | break; |
283 | 283 | } |
284 | 284 | // extract name and age from struct |
285 | - $n=$rec->structmem("name"); |
|
286 | - $a=$rec->structmem("age"); |
|
285 | + $n = $rec->structmem("name"); |
|
286 | + $a = $rec->structmem("age"); |
|
287 | 287 | // $n and $a are xmlrpcvals, |
288 | 288 | // so get the scalarval from them |
289 | - $agar[$n->scalarval()]=$a->scalarval(); |
|
289 | + $agar[$n->scalarval()] = $a->scalarval(); |
|
290 | 290 | } |
291 | 291 | |
292 | - $agesorter_arr=$agar; |
|
292 | + $agesorter_arr = $agar; |
|
293 | 293 | // hack, must make global as uksort() won't |
294 | 294 | // allow us to pass any other auxilliary information |
295 | 295 | uksort($agesorter_arr, agesorter_compare); |
296 | - $outAr=array(); |
|
297 | - while (list( $key, $val ) = each( $agesorter_arr ) ) |
|
296 | + $outAr = array(); |
|
297 | + while (list($key, $val) = each($agesorter_arr)) |
|
298 | 298 | { |
299 | 299 | // recreate each struct element |
300 | - $outAr[]=new xmlrpcval(array("name" => |
|
300 | + $outAr[] = new xmlrpcval(array("name" => |
|
301 | 301 | new xmlrpcval($key), |
302 | 302 | "age" => |
303 | 303 | new xmlrpcval($val, "int")), "struct"); |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | } |
308 | 308 | else |
309 | 309 | { |
310 | - $err="Must be one parameter, an array of structs"; |
|
310 | + $err = "Must be one parameter, an array of structs"; |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | if ($err) |
@@ -322,13 +322,13 @@ discard block |
||
322 | 322 | |
323 | 323 | // signature and instructions, place these in the dispatch |
324 | 324 | // map |
325 | - $mail_send_sig=array(array( |
|
325 | + $mail_send_sig = array(array( |
|
326 | 326 | $xmlrpcBoolean, $xmlrpcString, $xmlrpcString, |
327 | 327 | $xmlrpcString, $xmlrpcString, $xmlrpcString, |
328 | 328 | $xmlrpcString, $xmlrpcString |
329 | 329 | )); |
330 | 330 | |
331 | - $mail_send_doc='mail.send(recipient, subject, text, sender, cc, bcc, mimetype)<br/> |
|
331 | + $mail_send_doc = 'mail.send(recipient, subject, text, sender, cc, bcc, mimetype)<br/> |
|
332 | 332 | recipient, cc, and bcc are strings, comma-separated lists of email addresses, as described above.<br/> |
333 | 333 | subject is a string, the subject of the message.<br/> |
334 | 334 | sender is a string, it\'s the email address of the person sending the message. This string can not be |
@@ -342,51 +342,51 @@ discard block |
||
342 | 342 | function mail_send($m) |
343 | 343 | { |
344 | 344 | global $xmlrpcerruser, $xmlrpcBoolean; |
345 | - $err=""; |
|
345 | + $err = ""; |
|
346 | 346 | |
347 | - $mTo=$m->getParam(0); |
|
348 | - $mSub=$m->getParam(1); |
|
349 | - $mBody=$m->getParam(2); |
|
350 | - $mFrom=$m->getParam(3); |
|
351 | - $mCc=$m->getParam(4); |
|
352 | - $mBcc=$m->getParam(5); |
|
353 | - $mMime=$m->getParam(6); |
|
347 | + $mTo = $m->getParam(0); |
|
348 | + $mSub = $m->getParam(1); |
|
349 | + $mBody = $m->getParam(2); |
|
350 | + $mFrom = $m->getParam(3); |
|
351 | + $mCc = $m->getParam(4); |
|
352 | + $mBcc = $m->getParam(5); |
|
353 | + $mMime = $m->getParam(6); |
|
354 | 354 | |
355 | - if ($mTo->scalarval()=="") |
|
355 | + if ($mTo->scalarval() == "") |
|
356 | 356 | { |
357 | - $err="Error, no 'To' field specified"; |
|
357 | + $err = "Error, no 'To' field specified"; |
|
358 | 358 | } |
359 | 359 | |
360 | - if ($mFrom->scalarval()=="") |
|
360 | + if ($mFrom->scalarval() == "") |
|
361 | 361 | { |
362 | - $err="Error, no 'From' field specified"; |
|
362 | + $err = "Error, no 'From' field specified"; |
|
363 | 363 | } |
364 | 364 | |
365 | - $msghdr="From: " . $mFrom->scalarval() . "\n"; |
|
366 | - $msghdr.="To: ". $mTo->scalarval() . "\n"; |
|
365 | + $msghdr = "From: ".$mFrom->scalarval()."\n"; |
|
366 | + $msghdr .= "To: ".$mTo->scalarval()."\n"; |
|
367 | 367 | |
368 | - if ($mCc->scalarval()!="") |
|
368 | + if ($mCc->scalarval() != "") |
|
369 | 369 | { |
370 | - $msghdr.="Cc: " . $mCc->scalarval(). "\n"; |
|
370 | + $msghdr .= "Cc: ".$mCc->scalarval()."\n"; |
|
371 | 371 | } |
372 | - if ($mBcc->scalarval()!="") |
|
372 | + if ($mBcc->scalarval() != "") |
|
373 | 373 | { |
374 | - $msghdr.="Bcc: " . $mBcc->scalarval(). "\n"; |
|
374 | + $msghdr .= "Bcc: ".$mBcc->scalarval()."\n"; |
|
375 | 375 | } |
376 | - if ($mMime->scalarval()!="") |
|
376 | + if ($mMime->scalarval() != "") |
|
377 | 377 | { |
378 | - $msghdr.="Content-type: " . $mMime->scalarval() . "\n"; |
|
378 | + $msghdr .= "Content-type: ".$mMime->scalarval()."\n"; |
|
379 | 379 | } |
380 | - $msghdr.="X-Mailer: XML-RPC for PHP mailer 1.0"; |
|
380 | + $msghdr .= "X-Mailer: XML-RPC for PHP mailer 1.0"; |
|
381 | 381 | |
382 | - if ($err=="") |
|
382 | + if ($err == "") |
|
383 | 383 | { |
384 | 384 | if (!mail("", |
385 | 385 | $mSub->scalarval(), |
386 | 386 | $mBody->scalarval(), |
387 | 387 | $msghdr)) |
388 | 388 | { |
389 | - $err="Error, could not send the mail."; |
|
389 | + $err = "Error, could not send the mail."; |
|
390 | 390 | } |
391 | 391 | } |
392 | 392 | |
@@ -400,8 +400,8 @@ discard block |
||
400 | 400 | } |
401 | 401 | } |
402 | 402 | |
403 | - $getallheaders_sig=array(array($xmlrpcStruct)); |
|
404 | - $getallheaders_doc='Returns a struct containing all the HTTP headers received with the request. Provides limited functionality with IIS'; |
|
403 | + $getallheaders_sig = array(array($xmlrpcStruct)); |
|
404 | + $getallheaders_doc = 'Returns a struct containing all the HTTP headers received with the request. Provides limited functionality with IIS'; |
|
405 | 405 | function getallheaders_xmlrpc($m) |
406 | 406 | { |
407 | 407 | global $xmlrpcerruser; |
@@ -423,12 +423,12 @@ discard block |
||
423 | 423 | } |
424 | 424 | } |
425 | 425 | |
426 | - $setcookies_sig=array(array($xmlrpcInt, $xmlrpcStruct)); |
|
427 | - $setcookies_doc='Sends to client a response containing a single \'1\' digit, and sets to it http cookies as received in the request (array of structs describing a cookie)'; |
|
426 | + $setcookies_sig = array(array($xmlrpcInt, $xmlrpcStruct)); |
|
427 | + $setcookies_doc = 'Sends to client a response containing a single \'1\' digit, and sets to it http cookies as received in the request (array of structs describing a cookie)'; |
|
428 | 428 | function setcookies($m) |
429 | 429 | { |
430 | 430 | $m = $m->getParam(0); |
431 | - while(list($name,$value) = $m->structeach()) |
|
431 | + while (list($name, $value) = $m->structeach()) |
|
432 | 432 | { |
433 | 433 | $cookiedesc = php_xmlrpc_decode($value); |
434 | 434 | setcookie($name, @$cookiedesc['value'], @$cookiedesc['expires'], @$cookiedesc['path'], @$cookiedesc['domain'], @$cookiedesc['secure']); |
@@ -436,60 +436,60 @@ discard block |
||
436 | 436 | return new xmlrpcresp(new xmlrpcval(1, 'int')); |
437 | 437 | } |
438 | 438 | |
439 | - $getcookies_sig=array(array($xmlrpcStruct)); |
|
440 | - $getcookies_doc='Sends to client a response containing all http cookies as received in the request (as struct)'; |
|
439 | + $getcookies_sig = array(array($xmlrpcStruct)); |
|
440 | + $getcookies_doc = 'Sends to client a response containing all http cookies as received in the request (as struct)'; |
|
441 | 441 | function getcookies($m) |
442 | 442 | { |
443 | 443 | return new xmlrpcresp(php_xmlrpc_encode($_COOKIE)); |
444 | 444 | } |
445 | 445 | |
446 | - $v1_arrayOfStructs_sig=array(array($xmlrpcInt, $xmlrpcArray)); |
|
447 | - $v1_arrayOfStructs_doc='This handler takes a single parameter, an array of structs, each of which contains at least three elements named moe, larry and curly, all <i4>s. Your handler must add all the struct elements named curly and return the result.'; |
|
446 | + $v1_arrayOfStructs_sig = array(array($xmlrpcInt, $xmlrpcArray)); |
|
447 | + $v1_arrayOfStructs_doc = 'This handler takes a single parameter, an array of structs, each of which contains at least three elements named moe, larry and curly, all <i4>s. Your handler must add all the struct elements named curly and return the result.'; |
|
448 | 448 | function v1_arrayOfStructs($m) |
449 | 449 | { |
450 | - $sno=$m->getParam(0); |
|
451 | - $numcurly=0; |
|
452 | - for($i=0; $i<$sno->arraysize(); $i++) |
|
450 | + $sno = $m->getParam(0); |
|
451 | + $numcurly = 0; |
|
452 | + for ($i = 0; $i<$sno->arraysize(); $i++) |
|
453 | 453 | { |
454 | - $str=$sno->arraymem($i); |
|
454 | + $str = $sno->arraymem($i); |
|
455 | 455 | $str->structreset(); |
456 | - while(list($key,$val)=$str->structeach()) |
|
456 | + while (list($key, $val) = $str->structeach()) |
|
457 | 457 | { |
458 | - if ($key=="curly") |
|
458 | + if ($key == "curly") |
|
459 | 459 | { |
460 | - $numcurly+=$val->scalarval(); |
|
460 | + $numcurly += $val->scalarval(); |
|
461 | 461 | } |
462 | 462 | } |
463 | 463 | } |
464 | 464 | return new xmlrpcresp(new xmlrpcval($numcurly, "int")); |
465 | 465 | } |
466 | 466 | |
467 | - $v1_easyStruct_sig=array(array($xmlrpcInt, $xmlrpcStruct)); |
|
468 | - $v1_easyStruct_doc='This handler takes a single parameter, a struct, containing at least three elements named moe, larry and curly, all <i4>s. Your handler must add the three numbers and return the result.'; |
|
467 | + $v1_easyStruct_sig = array(array($xmlrpcInt, $xmlrpcStruct)); |
|
468 | + $v1_easyStruct_doc = 'This handler takes a single parameter, a struct, containing at least three elements named moe, larry and curly, all <i4>s. Your handler must add the three numbers and return the result.'; |
|
469 | 469 | function v1_easyStruct($m) |
470 | 470 | { |
471 | - $sno=$m->getParam(0); |
|
472 | - $moe=$sno->structmem("moe"); |
|
473 | - $larry=$sno->structmem("larry"); |
|
474 | - $curly=$sno->structmem("curly"); |
|
475 | - $num=$moe->scalarval() + $larry->scalarval() + $curly->scalarval(); |
|
471 | + $sno = $m->getParam(0); |
|
472 | + $moe = $sno->structmem("moe"); |
|
473 | + $larry = $sno->structmem("larry"); |
|
474 | + $curly = $sno->structmem("curly"); |
|
475 | + $num = $moe->scalarval()+$larry->scalarval()+$curly->scalarval(); |
|
476 | 476 | return new xmlrpcresp(new xmlrpcval($num, "int")); |
477 | 477 | } |
478 | 478 | |
479 | - $v1_echoStruct_sig=array(array($xmlrpcStruct, $xmlrpcStruct)); |
|
480 | - $v1_echoStruct_doc='This handler takes a single parameter, a struct. Your handler must return the struct.'; |
|
479 | + $v1_echoStruct_sig = array(array($xmlrpcStruct, $xmlrpcStruct)); |
|
480 | + $v1_echoStruct_doc = 'This handler takes a single parameter, a struct. Your handler must return the struct.'; |
|
481 | 481 | function v1_echoStruct($m) |
482 | 482 | { |
483 | - $sno=$m->getParam(0); |
|
483 | + $sno = $m->getParam(0); |
|
484 | 484 | return new xmlrpcresp($sno); |
485 | 485 | } |
486 | 486 | |
487 | - $v1_manyTypes_sig=array(array( |
|
487 | + $v1_manyTypes_sig = array(array( |
|
488 | 488 | $xmlrpcArray, $xmlrpcInt, $xmlrpcBoolean, |
489 | 489 | $xmlrpcString, $xmlrpcDouble, $xmlrpcDateTime, |
490 | 490 | $xmlrpcBase64 |
491 | 491 | )); |
492 | - $v1_manyTypes_doc='This handler takes six parameters, and returns an array containing all the parameters.'; |
|
492 | + $v1_manyTypes_doc = 'This handler takes six parameters, and returns an array containing all the parameters.'; |
|
493 | 493 | function v1_manyTypes($m) |
494 | 494 | { |
495 | 495 | return new xmlrpcresp(new xmlrpcval(array( |
@@ -503,58 +503,58 @@ discard block |
||
503 | 503 | )); |
504 | 504 | } |
505 | 505 | |
506 | - $v1_moderateSizeArrayCheck_sig=array(array($xmlrpcString, $xmlrpcArray)); |
|
507 | - $v1_moderateSizeArrayCheck_doc='This handler takes a single parameter, which is an array containing between 100 and 200 elements. Each of the items is a string, your handler must return a string containing the concatenated text of the first and last elements.'; |
|
506 | + $v1_moderateSizeArrayCheck_sig = array(array($xmlrpcString, $xmlrpcArray)); |
|
507 | + $v1_moderateSizeArrayCheck_doc = 'This handler takes a single parameter, which is an array containing between 100 and 200 elements. Each of the items is a string, your handler must return a string containing the concatenated text of the first and last elements.'; |
|
508 | 508 | function v1_moderateSizeArrayCheck($m) |
509 | 509 | { |
510 | - $ar=$m->getParam(0); |
|
511 | - $sz=$ar->arraysize(); |
|
512 | - $first=$ar->arraymem(0); |
|
513 | - $last=$ar->arraymem($sz-1); |
|
514 | - return new xmlrpcresp(new xmlrpcval($first->scalarval() . |
|
510 | + $ar = $m->getParam(0); |
|
511 | + $sz = $ar->arraysize(); |
|
512 | + $first = $ar->arraymem(0); |
|
513 | + $last = $ar->arraymem($sz-1); |
|
514 | + return new xmlrpcresp(new xmlrpcval($first->scalarval(). |
|
515 | 515 | $last->scalarval(), "string")); |
516 | 516 | } |
517 | 517 | |
518 | - $v1_simpleStructReturn_sig=array(array($xmlrpcStruct, $xmlrpcInt)); |
|
519 | - $v1_simpleStructReturn_doc='This handler takes one parameter, and returns a struct containing three elements, times10, times100 and times1000, the result of multiplying the number by 10, 100 and 1000.'; |
|
518 | + $v1_simpleStructReturn_sig = array(array($xmlrpcStruct, $xmlrpcInt)); |
|
519 | + $v1_simpleStructReturn_doc = 'This handler takes one parameter, and returns a struct containing three elements, times10, times100 and times1000, the result of multiplying the number by 10, 100 and 1000.'; |
|
520 | 520 | function v1_simpleStructReturn($m) |
521 | 521 | { |
522 | - $sno=$m->getParam(0); |
|
523 | - $v=$sno->scalarval(); |
|
522 | + $sno = $m->getParam(0); |
|
523 | + $v = $sno->scalarval(); |
|
524 | 524 | return new xmlrpcresp(new xmlrpcval(array( |
525 | - "times10" => new xmlrpcval($v*10, "int"), |
|
526 | - "times100" => new xmlrpcval($v*100, "int"), |
|
527 | - "times1000" => new xmlrpcval($v*1000, "int")), |
|
525 | + "times10" => new xmlrpcval($v * 10, "int"), |
|
526 | + "times100" => new xmlrpcval($v * 100, "int"), |
|
527 | + "times1000" => new xmlrpcval($v * 1000, "int")), |
|
528 | 528 | "struct" |
529 | 529 | )); |
530 | 530 | } |
531 | 531 | |
532 | - $v1_nestedStruct_sig=array(array($xmlrpcInt, $xmlrpcStruct)); |
|
533 | - $v1_nestedStruct_doc='This handler takes a single parameter, a struct, that models a daily calendar. At the top level, there is one struct for each year. Each year is broken down into months, and months into days. Most of the days are empty in the struct you receive, but the entry for April 1, 2000 contains a least three elements named moe, larry and curly, all <i4>s. Your handler must add the three numbers and return the result.'; |
|
532 | + $v1_nestedStruct_sig = array(array($xmlrpcInt, $xmlrpcStruct)); |
|
533 | + $v1_nestedStruct_doc = 'This handler takes a single parameter, a struct, that models a daily calendar. At the top level, there is one struct for each year. Each year is broken down into months, and months into days. Most of the days are empty in the struct you receive, but the entry for April 1, 2000 contains a least three elements named moe, larry and curly, all <i4>s. Your handler must add the three numbers and return the result.'; |
|
534 | 534 | function v1_nestedStruct($m) |
535 | 535 | { |
536 | - $sno=$m->getParam(0); |
|
537 | - |
|
538 | - $twoK=$sno->structmem("2000"); |
|
539 | - $april=$twoK->structmem("04"); |
|
540 | - $fools=$april->structmem("01"); |
|
541 | - $curly=$fools->structmem("curly"); |
|
542 | - $larry=$fools->structmem("larry"); |
|
543 | - $moe=$fools->structmem("moe"); |
|
544 | - return new xmlrpcresp(new xmlrpcval($curly->scalarval() + $larry->scalarval() + $moe->scalarval(), "int")); |
|
536 | + $sno = $m->getParam(0); |
|
537 | + |
|
538 | + $twoK = $sno->structmem("2000"); |
|
539 | + $april = $twoK->structmem("04"); |
|
540 | + $fools = $april->structmem("01"); |
|
541 | + $curly = $fools->structmem("curly"); |
|
542 | + $larry = $fools->structmem("larry"); |
|
543 | + $moe = $fools->structmem("moe"); |
|
544 | + return new xmlrpcresp(new xmlrpcval($curly->scalarval()+$larry->scalarval()+$moe->scalarval(), "int")); |
|
545 | 545 | } |
546 | 546 | |
547 | - $v1_countTheEntities_sig=array(array($xmlrpcStruct, $xmlrpcString)); |
|
548 | - $v1_countTheEntities_doc='This handler takes a single parameter, a string, that contains any number of predefined entities, namely <, >, & \' and ".<BR>Your handler must return a struct that contains five fields, all numbers: ctLeftAngleBrackets, ctRightAngleBrackets, ctAmpersands, ctApostrophes, ctQuotes.'; |
|
547 | + $v1_countTheEntities_sig = array(array($xmlrpcStruct, $xmlrpcString)); |
|
548 | + $v1_countTheEntities_doc = 'This handler takes a single parameter, a string, that contains any number of predefined entities, namely <, >, & \' and ".<BR>Your handler must return a struct that contains five fields, all numbers: ctLeftAngleBrackets, ctRightAngleBrackets, ctAmpersands, ctApostrophes, ctQuotes.'; |
|
549 | 549 | function v1_countTheEntities($m) |
550 | 550 | { |
551 | - $sno=$m->getParam(0); |
|
552 | - $str=$sno->scalarval(); |
|
553 | - $gt=0; $lt=0; $ap=0; $qu=0; $amp=0; |
|
554 | - for($i=0; $i<strlen($str); $i++) |
|
551 | + $sno = $m->getParam(0); |
|
552 | + $str = $sno->scalarval(); |
|
553 | + $gt = 0; $lt = 0; $ap = 0; $qu = 0; $amp = 0; |
|
554 | + for ($i = 0; $i<strlen($str); $i++) |
|
555 | 555 | { |
556 | - $c=substr($str, $i, 1); |
|
557 | - switch($c) |
|
556 | + $c = substr($str, $i, 1); |
|
557 | + switch ($c) |
|
558 | 558 | { |
559 | 559 | case ">": |
560 | 560 | $gt++; |
@@ -588,42 +588,42 @@ discard block |
||
588 | 588 | // trivial interop tests |
589 | 589 | // http://www.xmlrpc.com/stories/storyReader$1636 |
590 | 590 | |
591 | - $i_echoString_sig=array(array($xmlrpcString, $xmlrpcString)); |
|
592 | - $i_echoString_doc="Echoes string."; |
|
591 | + $i_echoString_sig = array(array($xmlrpcString, $xmlrpcString)); |
|
592 | + $i_echoString_doc = "Echoes string."; |
|
593 | 593 | |
594 | - $i_echoStringArray_sig=array(array($xmlrpcArray, $xmlrpcArray)); |
|
595 | - $i_echoStringArray_doc="Echoes string array."; |
|
594 | + $i_echoStringArray_sig = array(array($xmlrpcArray, $xmlrpcArray)); |
|
595 | + $i_echoStringArray_doc = "Echoes string array."; |
|
596 | 596 | |
597 | - $i_echoInteger_sig=array(array($xmlrpcInt, $xmlrpcInt)); |
|
598 | - $i_echoInteger_doc="Echoes integer."; |
|
597 | + $i_echoInteger_sig = array(array($xmlrpcInt, $xmlrpcInt)); |
|
598 | + $i_echoInteger_doc = "Echoes integer."; |
|
599 | 599 | |
600 | - $i_echoIntegerArray_sig=array(array($xmlrpcArray, $xmlrpcArray)); |
|
601 | - $i_echoIntegerArray_doc="Echoes integer array."; |
|
600 | + $i_echoIntegerArray_sig = array(array($xmlrpcArray, $xmlrpcArray)); |
|
601 | + $i_echoIntegerArray_doc = "Echoes integer array."; |
|
602 | 602 | |
603 | - $i_echoFloat_sig=array(array($xmlrpcDouble, $xmlrpcDouble)); |
|
604 | - $i_echoFloat_doc="Echoes float."; |
|
603 | + $i_echoFloat_sig = array(array($xmlrpcDouble, $xmlrpcDouble)); |
|
604 | + $i_echoFloat_doc = "Echoes float."; |
|
605 | 605 | |
606 | - $i_echoFloatArray_sig=array(array($xmlrpcArray, $xmlrpcArray)); |
|
607 | - $i_echoFloatArray_doc="Echoes float array."; |
|
606 | + $i_echoFloatArray_sig = array(array($xmlrpcArray, $xmlrpcArray)); |
|
607 | + $i_echoFloatArray_doc = "Echoes float array."; |
|
608 | 608 | |
609 | - $i_echoStruct_sig=array(array($xmlrpcStruct, $xmlrpcStruct)); |
|
610 | - $i_echoStruct_doc="Echoes struct."; |
|
609 | + $i_echoStruct_sig = array(array($xmlrpcStruct, $xmlrpcStruct)); |
|
610 | + $i_echoStruct_doc = "Echoes struct."; |
|
611 | 611 | |
612 | - $i_echoStructArray_sig=array(array($xmlrpcArray, $xmlrpcArray)); |
|
613 | - $i_echoStructArray_doc="Echoes struct array."; |
|
612 | + $i_echoStructArray_sig = array(array($xmlrpcArray, $xmlrpcArray)); |
|
613 | + $i_echoStructArray_doc = "Echoes struct array."; |
|
614 | 614 | |
615 | - $i_echoValue_doc="Echoes any value back."; |
|
616 | - $i_echoValue_sig=array(array($xmlrpcValue, $xmlrpcValue)); |
|
615 | + $i_echoValue_doc = "Echoes any value back."; |
|
616 | + $i_echoValue_sig = array(array($xmlrpcValue, $xmlrpcValue)); |
|
617 | 617 | |
618 | - $i_echoBase64_sig=array(array($xmlrpcBase64, $xmlrpcBase64)); |
|
619 | - $i_echoBase64_doc="Echoes base64."; |
|
618 | + $i_echoBase64_sig = array(array($xmlrpcBase64, $xmlrpcBase64)); |
|
619 | + $i_echoBase64_doc = "Echoes base64."; |
|
620 | 620 | |
621 | - $i_echoDate_sig=array(array($xmlrpcDateTime, $xmlrpcDateTime)); |
|
622 | - $i_echoDate_doc="Echoes dateTime."; |
|
621 | + $i_echoDate_sig = array(array($xmlrpcDateTime, $xmlrpcDateTime)); |
|
622 | + $i_echoDate_doc = "Echoes dateTime."; |
|
623 | 623 | |
624 | 624 | function i_echoParam($m) |
625 | 625 | { |
626 | - $s=$m->getParam(0); |
|
626 | + $s = $m->getParam(0); |
|
627 | 627 | return new xmlrpcresp($s); |
628 | 628 | } |
629 | 629 | |
@@ -639,23 +639,23 @@ discard block |
||
639 | 639 | function i_echoBase64($m) { return i_echoParam($m); } |
640 | 640 | function i_echoDate($m) { return i_echoParam($m); } |
641 | 641 | |
642 | - $i_whichToolkit_sig=array(array($xmlrpcStruct)); |
|
643 | - $i_whichToolkit_doc="Returns a struct containing the following strings: toolkitDocsUrl, toolkitName, toolkitVersion, toolkitOperatingSystem."; |
|
642 | + $i_whichToolkit_sig = array(array($xmlrpcStruct)); |
|
643 | + $i_whichToolkit_doc = "Returns a struct containing the following strings: toolkitDocsUrl, toolkitName, toolkitVersion, toolkitOperatingSystem."; |
|
644 | 644 | |
645 | 645 | function i_whichToolkit($m) |
646 | 646 | { |
647 | - global $xmlrpcName, $xmlrpcVersion,$SERVER_SOFTWARE; |
|
648 | - $ret=array( |
|
647 | + global $xmlrpcName, $xmlrpcVersion, $SERVER_SOFTWARE; |
|
648 | + $ret = array( |
|
649 | 649 | "toolkitDocsUrl" => "http://phpxmlrpc.sourceforge.net/", |
650 | 650 | "toolkitName" => $xmlrpcName, |
651 | 651 | "toolkitVersion" => $xmlrpcVersion, |
652 | 652 | "toolkitOperatingSystem" => isset ($SERVER_SOFTWARE) ? $SERVER_SOFTWARE : $_SERVER['SERVER_SOFTWARE'] |
653 | 653 | ); |
654 | - return new xmlrpcresp ( php_xmlrpc_encode($ret)); |
|
654 | + return new xmlrpcresp(php_xmlrpc_encode($ret)); |
|
655 | 655 | } |
656 | 656 | |
657 | - $o=new xmlrpc_server_methods_container; |
|
658 | - $a=array( |
|
657 | + $o = new xmlrpc_server_methods_container; |
|
658 | + $a = array( |
|
659 | 659 | "examples.getStateName" => array( |
660 | 660 | "function" => "findstate", |
661 | 661 | "signature" => $findstate_sig, |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | if ($findstate5_sig) |
838 | 838 | $a['examples.php4.getStateName'] = $findstate5_sig; |
839 | 839 | |
840 | - $s=new xmlrpc_server($a, false); |
|
840 | + $s = new xmlrpc_server($a, false); |
|
841 | 841 | $s->setdebug(3); |
842 | 842 | $s->compress_response = true; |
843 | 843 |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | print "<h3>Testing value serialization</h3>\n"; |
10 | 10 | |
11 | 11 | $v = new xmlrpcval(23, "int"); |
12 | - print "<PRE>" . htmlentities($v->serialize()) . "</PRE>"; |
|
12 | + print "<PRE>".htmlentities($v->serialize())."</PRE>"; |
|
13 | 13 | $v = new xmlrpcval("What are you saying? >> << &&"); |
14 | - print "<PRE>" . htmlentities($v->serialize()) . "</PRE>"; |
|
14 | + print "<PRE>".htmlentities($v->serialize())."</PRE>"; |
|
15 | 15 | |
16 | 16 | $v = new xmlrpcval(array( |
17 | 17 | new xmlrpcval("ABCDEFHIJ"), |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | "array" |
21 | 21 | ); |
22 | 22 | |
23 | - print "<PRE>" . htmlentities($v->serialize()) . "</PRE>"; |
|
23 | + print "<PRE>".htmlentities($v->serialize())."</PRE>"; |
|
24 | 24 | |
25 | 25 | $v = new xmlrpcval( |
26 | 26 | array( |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | "struct" |
49 | 49 | ); |
50 | 50 | |
51 | - print "<PRE>" . htmlentities($v->serialize()) . "</PRE>"; |
|
51 | + print "<PRE>".htmlentities($v->serialize())."</PRE>"; |
|
52 | 52 | |
53 | 53 | $w = new xmlrpcval(array($v, new xmlrpcval("That was the struct!")), "array"); |
54 | 54 | |
55 | - print "<PRE>" . htmlentities($w->serialize()) . "</PRE>"; |
|
55 | + print "<PRE>".htmlentities($w->serialize())."</PRE>"; |
|
56 | 56 | |
57 | 57 | $w = new xmlrpcval("Mary had a little lamb, |
58 | 58 | Whose fleece was white as snow, |
@@ -64,26 +64,26 @@ discard block |
||
64 | 64 | Ten thousand volts went down its back |
65 | 65 | And turned it into nylon", "base64" |
66 | 66 | ); |
67 | - print "<PRE>" . htmlentities($w->serialize()) . "</PRE>"; |
|
68 | - print "<PRE>Value of base64 string is: '" . $w->scalarval() . "'</PRE>"; |
|
67 | + print "<PRE>".htmlentities($w->serialize())."</PRE>"; |
|
68 | + print "<PRE>Value of base64 string is: '".$w->scalarval()."'</PRE>"; |
|
69 | 69 | |
70 | 70 | $f->method(''); |
71 | 71 | $f->addParam(new xmlrpcval("41", "int")); |
72 | 72 | |
73 | 73 | print "<h3>Testing request serialization</h3>\n"; |
74 | 74 | $op = $f->serialize(); |
75 | - print "<PRE>" . htmlentities($op) . "</PRE>"; |
|
75 | + print "<PRE>".htmlentities($op)."</PRE>"; |
|
76 | 76 | |
77 | 77 | print "<h3>Testing ISO date format</h3><pre>\n"; |
78 | 78 | |
79 | 79 | $t = time(); |
80 | 80 | $date = iso8601_encode($t); |
81 | 81 | print "Now is $t --> $date\n"; |
82 | - print "Or in UTC, that is " . iso8601_encode($t, 1) . "\n"; |
|
82 | + print "Or in UTC, that is ".iso8601_encode($t, 1)."\n"; |
|
83 | 83 | $tb = iso8601_decode($date); |
84 | 84 | print "That is to say $date --> $tb\n"; |
85 | - print "Which comes out at " . iso8601_encode($tb) . "\n"; |
|
86 | - print "Which was the time in UTC at " . iso8601_decode($date, 1) . "\n"; |
|
85 | + print "Which comes out at ".iso8601_encode($tb)."\n"; |
|
86 | + print "Which was the time in UTC at ".iso8601_decode($date, 1)."\n"; |
|
87 | 87 | |
88 | 88 | print "</pre>\n"; |
89 | 89 | ?> |
@@ -1,44 +1,42 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | include("xmlrpc.inc"); |
3 | 3 | |
4 | -$mydir="/demo"; |
|
4 | +$mydir = "/demo"; |
|
5 | 5 | |
6 | 6 | // define some utility functions |
7 | 7 | function bomb() { print "</body></html>"; exit(); } |
8 | 8 | function dispatch($client, $method, $args) { |
9 | - $msg=new xmlrpcmsg($method, $args); |
|
10 | - $resp=$client->send($msg); |
|
9 | + $msg = new xmlrpcmsg($method, $args); |
|
10 | + $resp = $client->send($msg); |
|
11 | 11 | if (!$resp) { print "<p>IO error: ".$client->errstr."</p>"; bomb(); } |
12 | 12 | if ($resp->faultCode()) { |
13 | - print "<p>There was an error: " . $resp->faultCode() . " " . |
|
14 | - $resp->faultString() . "</p>"; |
|
13 | + print "<p>There was an error: ".$resp->faultCode()." ". |
|
14 | + $resp->faultString()."</p>"; |
|
15 | 15 | bomb(); |
16 | 16 | } |
17 | 17 | return php_xmlrpc_decode($resp->value()); |
18 | 18 | } |
19 | 19 | |
20 | 20 | // create client for discussion server |
21 | -$dclient=new xmlrpc_client("${mydir}/discuss.php", |
|
21 | +$dclient = new xmlrpc_client("${mydir}/discuss.php", |
|
22 | 22 | "xmlrpc.usefulinc.com", 80); |
23 | 23 | |
24 | 24 | // check if we're posting a comment, and send it if so |
25 | -@$storyid=$_POST["storyid"]; |
|
25 | +@$storyid = $_POST["storyid"]; |
|
26 | 26 | if ($storyid) { |
27 | 27 | |
28 | 28 | |
29 | 29 | // print "Returning to " . $HTTP_POST_VARS["returnto"]; |
30 | 30 | |
31 | - $res=dispatch($dclient, "discuss.addComment", |
|
31 | + $res = dispatch($dclient, "discuss.addComment", |
|
32 | 32 | array(new xmlrpcval($storyid), |
33 | - new xmlrpcval(stripslashes |
|
34 | - (@$_POST["name"])), |
|
35 | - new xmlrpcval(stripslashes |
|
36 | - (@$_POST["commenttext"])))); |
|
33 | + new xmlrpcval(stripslashes(@$_POST["name"])), |
|
34 | + new xmlrpcval(stripslashes(@$_POST["commenttext"])))); |
|
37 | 35 | |
38 | 36 | // send the browser back to the originating page |
39 | - Header("Location: ${mydir}/comment.php?catid=" . |
|
40 | - $_POST["catid"] . "&chanid=" . |
|
41 | - $_POST["chanid"] . "&oc=" . |
|
37 | + Header("Location: ${mydir}/comment.php?catid=". |
|
38 | + $_POST["catid"]."&chanid=". |
|
39 | + $_POST["chanid"]."&oc=". |
|
42 | 40 | $_POST["catid"]); |
43 | 41 | exit(0); |
44 | 42 | } |
@@ -50,13 +48,13 @@ discard block |
||
50 | 48 | <body bgcolor="#ffffff"> |
51 | 49 | <h2>Meerkat integration</h2> |
52 | 50 | <?php |
53 | -@$catid=$_GET["catid"]; |
|
54 | -if (@$_GET["oc"]==$catid) |
|
55 | - @$chanid=$_GET["chanid"]; |
|
51 | +@$catid = $_GET["catid"]; |
|
52 | +if (@$_GET["oc"] == $catid) |
|
53 | + @$chanid = $_GET["chanid"]; |
|
56 | 54 | else |
57 | - $chanid=0; |
|
55 | + $chanid = 0; |
|
58 | 56 | |
59 | -$client=new xmlrpc_client("/meerkat/xml-rpc/server.php", |
|
57 | +$client = new xmlrpc_client("/meerkat/xml-rpc/server.php", |
|
60 | 58 | "www.oreillynet.com", 80); |
61 | 59 | |
62 | 60 | if (@$_GET["comment"] && |
@@ -71,7 +69,7 @@ discard block |
||
71 | 69 | name="commenttext"></textarea></p> |
72 | 70 | <input type="submit" value="Send comment" /> |
73 | 71 | <input type="hidden" name="storyid" |
74 | - value="<?php echo @$_GET["comment"];?>" /> |
|
72 | + value="<?php echo @$_GET["comment"]; ?>" /> |
|
75 | 73 | <input type="hidden" name="chanid" |
76 | 74 | value="<?php echo $chanid; ?>" /> |
77 | 75 | <input type="hidden" name="catid" |
@@ -80,7 +78,7 @@ discard block |
||
80 | 78 | </form> |
81 | 79 | <?php |
82 | 80 | } else { |
83 | - $categories=dispatch($client, "meerkat.getCategories", array()); |
|
81 | + $categories = dispatch($client, "meerkat.getCategories", array()); |
|
84 | 82 | if ($catid) |
85 | 83 | $sources = dispatch($client, "meerkat.getChannelsByCategory", |
86 | 84 | array(new xmlrpcval($catid, "int"))); |
@@ -102,10 +100,10 @@ discard block |
||
102 | 100 | <?php |
103 | 101 | if (!$catid) |
104 | 102 | print "<option value=\"0\">Choose a category</option>\n"; |
105 | - while(list($k,$v) = each($categories)) { |
|
106 | - print "<option value=\"" . $v['id'] ."\""; |
|
107 | - if ($v['id']==$catid) print " selected=\"selected\""; |
|
108 | - print ">". $v['title'] . "</option>\n"; |
|
103 | + while (list($k, $v) = each($categories)) { |
|
104 | + print "<option value=\"".$v['id']."\""; |
|
105 | + if ($v['id'] == $catid) print " selected=\"selected\""; |
|
106 | + print ">".$v['title']."</option>\n"; |
|
109 | 107 | } |
110 | 108 | ?> |
111 | 109 | </select></p> |
@@ -117,10 +115,10 @@ discard block |
||
117 | 115 | <?php |
118 | 116 | if (!$chanid) |
119 | 117 | print "<option value=\"0\">Choose a source</option>\n"; |
120 | - while(list($k,$v) = each($sources)) { |
|
121 | - print "<option value=\"" . $v['id'] ."\""; |
|
122 | - if ($v['id']==$chanid) print "\" selected=\"selected\""; |
|
123 | - print ">". $v['title'] . "</option>\n"; |
|
118 | + while (list($k, $v) = each($sources)) { |
|
119 | + print "<option value=\"".$v['id']."\""; |
|
120 | + if ($v['id'] == $chanid) print "\" selected=\"selected\""; |
|
121 | + print ">".$v['title']."</option>\n"; |
|
124 | 122 | } |
125 | 123 | ?> |
126 | 124 | </select> |
@@ -141,27 +139,27 @@ discard block |
||
141 | 139 | <h2>Stories available</h2> |
142 | 140 | <table> |
143 | 141 | <?php |
144 | - while(list($k,$v) = each($stories)) { |
|
142 | + while (list($k, $v) = each($stories)) { |
|
145 | 143 | print "<tr>"; |
146 | - print "<td><b>" . $v['title'] . "</b><br />"; |
|
147 | - print $v['description'] . "<br />"; |
|
148 | - print "<em><a target=\"_blank\" href=\"" . |
|
149 | - $v['link'] . "\">Read full story</a> "; |
|
150 | - print "<a href=\"comment.php?catid=${catid}&chanid=${chanid}&" . |
|
151 | - "oc=${oc}&comment=" . $v['id'] . "\">Comment on this story</a>"; |
|
144 | + print "<td><b>".$v['title']."</b><br />"; |
|
145 | + print $v['description']."<br />"; |
|
146 | + print "<em><a target=\"_blank\" href=\"". |
|
147 | + $v['link']."\">Read full story</a> "; |
|
148 | + print "<a href=\"comment.php?catid=${catid}&chanid=${chanid}&". |
|
149 | + "oc=${oc}&comment=".$v['id']."\">Comment on this story</a>"; |
|
152 | 150 | print "</em>"; |
153 | 151 | print "</td>"; |
154 | 152 | print "</tr>\n"; |
155 | 153 | // now look for existing comments |
156 | - $res=dispatch($dclient, "discuss.getComments", |
|
154 | + $res = dispatch($dclient, "discuss.getComments", |
|
157 | 155 | array(new xmlrpcval($v['id']))); |
158 | 156 | if (sizeof($res)>0) { |
159 | - print "<tr><td bgcolor=\"#dddddd\"><p><b><i>" . |
|
157 | + print "<tr><td bgcolor=\"#dddddd\"><p><b><i>". |
|
160 | 158 | "Comments on this story:</i></b></p>"; |
161 | - for($i=0; $i<sizeof($res); $i++) { |
|
162 | - $s=$res[$i]; |
|
163 | - print "<p><b>From:</b> " . htmlentities($s['name']) . "<br />"; |
|
164 | - print "<b>Comment:</b> " . htmlentities($s['comment']) . "</p>"; |
|
159 | + for ($i = 0; $i<sizeof($res); $i++) { |
|
160 | + $s = $res[$i]; |
|
161 | + print "<p><b>From:</b> ".htmlentities($s['name'])."<br />"; |
|
162 | + print "<b>Comment:</b> ".htmlentities($s['comment'])."</p>"; |
|
165 | 163 | } |
166 | 164 | print "</td></tr>\n"; |
167 | 165 | } |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | |
14 | 14 | $c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80); |
15 | 15 | $c->return_type = 'phpvals'; // let client give us back php values instead of xmlrpcvals |
16 | - $r =& $c->send(new xmlrpcmsg('system.listMethods')); |
|
17 | - if($r->faultCode()) |
|
16 | + $r = & $c->send(new xmlrpcmsg('system.listMethods')); |
|
17 | + if ($r->faultCode()) |
|
18 | 18 | { |
19 | 19 | echo "<p>Server methods list could not be retrieved: error '".htmlspecialchars($r->faultString())."'</p>\n"; |
20 | 20 | } |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | { |
23 | 23 | $testcase = ''; |
24 | 24 | echo "<p>Server methods list retrieved, now wrapping it up...</p>\n<ul>\n"; |
25 | - foreach($r->value() as $methodname) // $r->value is an array of strings |
|
25 | + foreach ($r->value() as $methodname) // $r->value is an array of strings |
|
26 | 26 | { |
27 | 27 | // do not wrap remote server system methods |
28 | 28 | if (strpos($methodname, 'system.') !== 0) |
29 | 29 | { |
30 | 30 | $funcname = wrap_xmlrpc_method($c, $methodname); |
31 | - if($funcname) |
|
31 | + if ($funcname) |
|
32 | 32 | { |
33 | 33 | echo "<li>Remote server method ".htmlspecialchars($methodname)." wrapped into php function ".$funcname."</li>\n"; |
34 | 34 | } |
@@ -36,14 +36,14 @@ discard block |
||
36 | 36 | { |
37 | 37 | echo "<li>Remote server method ".htmlspecialchars($methodname)." could not be wrapped!</li>\n"; |
38 | 38 | } |
39 | - if($methodname == 'examples.getStateName') |
|
39 | + if ($methodname == 'examples.getStateName') |
|
40 | 40 | { |
41 | 41 | $testcase = $funcname; |
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | echo "</ul>\n"; |
46 | - if($testcase) |
|
46 | + if ($testcase) |
|
47 | 47 | { |
48 | 48 | echo "Now testing function $testcase: remote method to convert U.S. state number into state name"; |
49 | 49 | $statenum = 25; |