Completed
Push — php51 ( 0b9f5a...6e24e2 )
by Gaetano
07:06
created
demo/client/comment.php 3 patches
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -6,41 +6,41 @@  discard block
 block discarded – undo
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);
11
-	if (!$resp) { print "<p>IO error: ".$client->errstr."</p>"; bomb(); }
12
-	if ($resp->faultCode()) {
13
-		print "<p>There was an error: " . $resp->faultCode() . " " .
14
-			$resp->faultString() . "</p>";
15
-		bomb();
16
-	}
17
-	return php_xmlrpc_decode($resp->value());
9
+    $msg=new xmlrpcmsg($method, $args);
10
+    $resp=$client->send($msg);
11
+    if (!$resp) { print "<p>IO error: ".$client->errstr."</p>"; bomb(); }
12
+    if ($resp->faultCode()) {
13
+        print "<p>There was an error: " . $resp->faultCode() . " " .
14
+            $resp->faultString() . "</p>";
15
+        bomb();
16
+    }
17
+    return php_xmlrpc_decode($resp->value());
18 18
 }
19 19
 
20 20
 // create client for discussion server
21 21
 $dclient=new xmlrpc_client("${mydir}/discuss.php",
22
-													 "xmlrpc.usefulinc.com", 80);
22
+                                                        "xmlrpc.usefulinc.com", 80);
23 23
 
24 24
 // check if we're posting a comment, and send it if so
25 25
 @$storyid=$_POST["storyid"];
26 26
 if ($storyid) {
27 27
 
28 28
 
29
-	//	print "Returning to " . $HTTP_POST_VARS["returnto"];
29
+    //	print "Returning to " . $HTTP_POST_VARS["returnto"];
30 30
 
31
-	$res=dispatch($dclient, "discuss.addComment",
32
-								array(new xmlrpcval($storyid),
33
-											new xmlrpcval(stripslashes
34
-																		(@$_POST["name"])),
35
-											new xmlrpcval(stripslashes
36
-																		(@$_POST["commenttext"]))));
31
+    $res=dispatch($dclient, "discuss.addComment",
32
+                                array(new xmlrpcval($storyid),
33
+                                            new xmlrpcval(stripslashes
34
+                                                                        (@$_POST["name"])),
35
+                                            new xmlrpcval(stripslashes
36
+                                                                        (@$_POST["commenttext"]))));
37 37
 
38
-	// send the browser back to the originating page
39
-	Header("Location: ${mydir}/comment.php?catid=" .
40
-				 $_POST["catid"] . "&chanid=" .
41
-				 $_POST["chanid"] . "&oc=" .
42
-				 $_POST["catid"]);
43
-	exit(0);
38
+    // send the browser back to the originating page
39
+    Header("Location: ${mydir}/comment.php?catid=" .
40
+                    $_POST["catid"] . "&chanid=" .
41
+                    $_POST["chanid"] . "&oc=" .
42
+                    $_POST["catid"]);
43
+    exit(0);
44 44
 }
45 45
 
46 46
 // now we've got here, we're exploring the story store
@@ -52,17 +52,17 @@  discard block
 block discarded – undo
52 52
 <?php
53 53
 @$catid=$_GET["catid"];
54 54
 if (@$_GET["oc"]==$catid)
55
-	@$chanid=$_GET["chanid"];
55
+    @$chanid=$_GET["chanid"];
56 56
 else
57
-	$chanid=0;
57
+    $chanid=0;
58 58
 
59 59
 $client=new xmlrpc_client("/meerkat/xml-rpc/server.php",
60
-													"www.oreillynet.com", 80);
60
+                                                    "www.oreillynet.com", 80);
61 61
 
62 62
 if (@$_GET["comment"] &&
63
-		(!@$_GET["cdone"])) {
64
-	// we're making a comment on a story,
65
-	// so display a comment form
63
+        (!@$_GET["cdone"])) {
64
+    // we're making a comment on a story,
65
+    // so display a comment form
66 66
 ?>
67 67
 <h3>Make a comment on the story</h3>
68 68
 <form method="post">
@@ -80,54 +80,54 @@  discard block
 block discarded – undo
80 80
 </form>
81 81
 <?php
82 82
 } else {
83
-	$categories=dispatch($client, "meerkat.getCategories", array());
84
-	if ($catid)
85
-		$sources = dispatch($client, "meerkat.getChannelsByCategory",
86
-												array(new xmlrpcval($catid, "int")));
87
-	if ($chanid) {
88
-		$stories = dispatch($client, "meerkat.getItems",
89
-					array(new xmlrpcval(
90
-						array(
91
-							"channel" => new xmlrpcval($chanid, "int"),
92
-							"ids" => new xmlrpcval(1, "int"),
93
-							"descriptions" => new xmlrpcval(200, "int"),
94
-							"num_items" => new xmlrpcval(5, "int"),
95
-							"dates" => new xmlrpcval(0, "int")
96
-						), "struct")));
97
-	}
83
+    $categories=dispatch($client, "meerkat.getCategories", array());
84
+    if ($catid)
85
+        $sources = dispatch($client, "meerkat.getChannelsByCategory",
86
+                                                array(new xmlrpcval($catid, "int")));
87
+    if ($chanid) {
88
+        $stories = dispatch($client, "meerkat.getItems",
89
+                    array(new xmlrpcval(
90
+                        array(
91
+                            "channel" => new xmlrpcval($chanid, "int"),
92
+                            "ids" => new xmlrpcval(1, "int"),
93
+                            "descriptions" => new xmlrpcval(200, "int"),
94
+                            "num_items" => new xmlrpcval(5, "int"),
95
+                            "dates" => new xmlrpcval(0, "int")
96
+                        ), "struct")));
97
+    }
98 98
 ?>
99 99
 <form>
100 100
 <p>Subject area:<br />
101 101
 <select name="catid">
102 102
 <?php
103
-	if (!$catid)
104
-		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";
109
-	}
103
+    if (!$catid)
104
+        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";
109
+    }
110 110
 ?>
111 111
 </select></p>
112 112
 <?php
113
-	if ($catid) {
113
+    if ($catid) {
114 114
 ?>
115 115
 <p>News source:<br />
116 116
 <select name="chanid">
117 117
 <?php
118
-		if (!$chanid)
119
-			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";
124
-		}
118
+        if (!$chanid)
119
+            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";
124
+        }
125 125
 ?>
126 126
 </select>
127 127
 </p>
128 128
 
129 129
 <?php
130
-		} // end if ($catid)
130
+        } // end if ($catid)
131 131
 ?>
132 132
 
133 133
 <p><input type="submit" value="Update" /></p>
@@ -135,43 +135,43 @@  discard block
 block discarded – undo
135 135
 </form>
136 136
 
137 137
 <?php
138
-	 if ($chanid) {
138
+        if ($chanid) {
139 139
 ?>
140 140
 
141 141
 <h2>Stories available</h2>
142 142
 <table>
143 143
 <?php
144
-	 while(list($k,$v) = each($stories)) {
145
-		 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>";
152
-		 print "</em>";
153
-		 print "</td>";
154
-		 print "</tr>\n";
155
-		 // now look for existing comments
156
-		 $res=dispatch($dclient, "discuss.getComments",
157
-							array(new xmlrpcval($v['id'])));
158
-		 if (sizeof($res)>0) {
159
-			 print "<tr><td bgcolor=\"#dddddd\"><p><b><i>" .
160
-				 "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>";
165
-			 }
166
-			 print "</td></tr>\n";
167
-		 }
168
-		 print "<tr><td><hr /></td></tr>\n";
169
-	 }
144
+        while(list($k,$v) = each($stories)) {
145
+            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>";
152
+            print "</em>";
153
+            print "</td>";
154
+            print "</tr>\n";
155
+            // now look for existing comments
156
+            $res=dispatch($dclient, "discuss.getComments",
157
+                            array(new xmlrpcval($v['id'])));
158
+            if (sizeof($res)>0) {
159
+                print "<tr><td bgcolor=\"#dddddd\"><p><b><i>" .
160
+                    "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>";
165
+                }
166
+                print "</td></tr>\n";
167
+            }
168
+            print "<tr><td><hr /></td></tr>\n";
169
+        }
170 170
 ?>
171 171
 </table>
172 172
 
173 173
 <?php
174
-		} // end if ($chanid)
174
+        } // end if ($chanid)
175 175
 } // end if comment
176 176
 ?>
177 177
 <hr />
Please login to merge, or discard this patch.
Spacing   +41 added lines, -43 removed lines patch added patch discarded remove patch
@@ -1,44 +1,42 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		 }
Please login to merge, or discard this patch.
Braces   +18 added lines, -10 removed lines patch added patch discarded remove patch
@@ -51,10 +51,11 @@  discard block
 block discarded – undo
51 51
 <h2>Meerkat integration</h2>
52 52
 <?php
53 53
 @$catid=$_GET["catid"];
54
-if (@$_GET["oc"]==$catid)
54
+if (@$_GET["oc"]==$catid) {
55 55
 	@$chanid=$_GET["chanid"];
56
-else
56
+} else {
57 57
 	$chanid=0;
58
+}
58 59
 
59 60
 $client=new xmlrpc_client("/meerkat/xml-rpc/server.php",
60 61
 													"www.oreillynet.com", 80);
@@ -81,9 +82,10 @@  discard block
 block discarded – undo
81 82
 <?php
82 83
 } else {
83 84
 	$categories=dispatch($client, "meerkat.getCategories", array());
84
-	if ($catid)
85
-		$sources = dispatch($client, "meerkat.getChannelsByCategory",
85
+	if ($catid) {
86
+			$sources = dispatch($client, "meerkat.getChannelsByCategory",
86 87
 												array(new xmlrpcval($catid, "int")));
88
+	}
87 89
 	if ($chanid) {
88 90
 		$stories = dispatch($client, "meerkat.getItems",
89 91
 					array(new xmlrpcval(
@@ -100,11 +102,14 @@  discard block
 block discarded – undo
100 102
 <p>Subject area:<br />
101 103
 <select name="catid">
102 104
 <?php
103
-	if (!$catid)
104
-		print "<option value=\"0\">Choose a category</option>\n";
105
+	if (!$catid) {
106
+			print "<option value=\"0\">Choose a category</option>\n";
107
+	}
105 108
 	while(list($k,$v) = each($categories)) {
106 109
 		print "<option value=\"" . $v['id'] ."\"";
107
-		if ($v['id']==$catid) print " selected=\"selected\"";
110
+		if ($v['id']==$catid) {
111
+		    print " selected=\"selected\"";
112
+		}
108 113
 			print ">". $v['title'] . "</option>\n";
109 114
 	}
110 115
 ?>
@@ -115,11 +120,14 @@  discard block
 block discarded – undo
115 120
 <p>News source:<br />
116 121
 <select name="chanid">
117 122
 <?php
118
-		if (!$chanid)
119
-			print "<option value=\"0\">Choose a source</option>\n";
123
+		if (!$chanid) {
124
+					print "<option value=\"0\">Choose a source</option>\n";
125
+		}
120 126
 		while(list($k,$v) = each($sources)) {
121 127
 			print "<option value=\"" . $v['id'] ."\"";
122
-			if ($v['id']==$chanid) print "\" selected=\"selected\"";
128
+			if ($v['id']==$chanid) {
129
+			    print "\" selected=\"selected\"";
130
+			}
123 131
 			print ">". $v['title'] . "</option>\n";
124 132
 		}
125 133
 ?>
Please login to merge, or discard this patch.
demo/client/wrap.php 3 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -8,49 +8,49 @@
 block discarded – undo
8 8
 2) wrapping of remote methods into php functions
9 9
 </h3>
10 10
 <?php
11
-	include("xmlrpc.inc");
12
-	include("xmlrpc_wrappers.inc");
11
+    include("xmlrpc.inc");
12
+    include("xmlrpc_wrappers.inc");
13 13
 
14
-	$c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);
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())
18
-	{
19
-		echo "<p>Server methods list could not be retrieved: error '".htmlspecialchars($r->faultString())."'</p>\n";
20
-	}
21
-	else
22
-	{
23
-		$testcase = '';
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
26
-		{
27
-			// do not wrap remote server system methods
28
-			if (strpos($methodname, 'system.') !== 0)
29
-			{
30
-				$funcname = wrap_xmlrpc_method($c, $methodname);
31
-				if($funcname)
32
-				{
33
-					echo "<li>Remote server method ".htmlspecialchars($methodname)." wrapped into php function ".$funcname."</li>\n";
34
-				}
35
-				else
36
-				{
37
-					echo "<li>Remote server method ".htmlspecialchars($methodname)." could not be wrapped!</li>\n";
38
-				}
39
-				if($methodname == 'examples.getStateName')
40
-				{
41
-					$testcase = $funcname;
42
-				}
43
-			}
44
-		}
45
-		echo "</ul>\n";
46
-		if($testcase)
47
-		{
48
-			echo "Now testing function $testcase: remote method to convert U.S. state number into state name";
49
-			$statenum = 25;
50
-			$statename = $testcase($statenum, 2);
51
-			echo "State number $statenum is ".htmlspecialchars($statename);
52
-		}
53
-	}
14
+    $c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);
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())
18
+    {
19
+        echo "<p>Server methods list could not be retrieved: error '".htmlspecialchars($r->faultString())."'</p>\n";
20
+    }
21
+    else
22
+    {
23
+        $testcase = '';
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
26
+        {
27
+            // do not wrap remote server system methods
28
+            if (strpos($methodname, 'system.') !== 0)
29
+            {
30
+                $funcname = wrap_xmlrpc_method($c, $methodname);
31
+                if($funcname)
32
+                {
33
+                    echo "<li>Remote server method ".htmlspecialchars($methodname)." wrapped into php function ".$funcname."</li>\n";
34
+                }
35
+                else
36
+                {
37
+                    echo "<li>Remote server method ".htmlspecialchars($methodname)." could not be wrapped!</li>\n";
38
+                }
39
+                if($methodname == 'examples.getStateName')
40
+                {
41
+                    $testcase = $funcname;
42
+                }
43
+            }
44
+        }
45
+        echo "</ul>\n";
46
+        if($testcase)
47
+        {
48
+            echo "Now testing function $testcase: remote method to convert U.S. state number into state name";
49
+            $statenum = 25;
50
+            $statename = $testcase($statenum, 2);
51
+            echo "State number $statenum is ".htmlspecialchars($statename);
52
+        }
53
+    }
54 54
 ?>
55 55
 </body>
56 56
 </html>
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,22 +17,22 @@
 block discarded – undo
17 17
 	if($r->faultCode())
18 18
 	{
19 19
 		echo "<p>Server methods list could not be retrieved: error '".htmlspecialchars($r->faultString())."'</p>\n";
20
-	}
21
-	else
20
+	} else
22 21
 	{
23 22
 		$testcase = '';
24 23
 		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
24
+		foreach($r->value() as $methodname) {
25
+		    // $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
+		}
31 32
 				if($funcname)
32 33
 				{
33 34
 					echo "<li>Remote server method ".htmlspecialchars($methodname)." wrapped into php function ".$funcname."</li>\n";
34
-				}
35
-				else
35
+				} else
36 36
 				{
37 37
 					echo "<li>Remote server method ".htmlspecialchars($methodname)." could not be wrapped!</li>\n";
38 38
 				}
Please login to merge, or discard this patch.
demo/client/agesort.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,1 +1,1 @@
 block discarded – undo
1
-<html>
<head><title>xmlrpc</title></head>
<body>
<h1>Agesort demo</h1>
<h2>Send an array of 'name' => 'age' pairs to the server that will send it back sorted.</h2>
<h3>The source code demonstrates basic lib usage, including handling of xmlrpc arrays and structs</h3>
<p></p>
<?php
include("xmlrpc.inc");

$inAr=array("Dave" => 24, "Edd" => 45, "Joe" => 37, "Fred" => 27);
reset($inAr);
print "This is the input data:<br/><pre>";
while (list($key, $val)=each($inAr)) {
  print $key . ", " . $val . "\n";
}
print "</pre>";

// create parameters from the input array: an xmlrpc array of xmlrpc structs
$p=array();
foreach($inAr as $key => $val) {
  $p[]=new xmlrpcval(array("name" => new xmlrpcval($key),
                           "age" => new xmlrpcval($val, "int")), "struct");
}
$v=new xmlrpcval($p, "array");
print "Encoded into xmlrpc format it looks like this: <pre>\n" .  htmlentities($v->serialize()). "</pre>\n";

// create client and message objects
$f=new xmlrpcmsg('examples.sortByAge',  array($v));
$c=new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);

// set maximum debug level, to have the complete communication printed to screen
$c->setDebug(2);

// send request
print "Now sending request (detailed debug info follows)";
$r=&$c->send($f);

// check response for errors, and take appropriate action
if (!$r->faultCode()) {
  print "The server gave me these results:<pre>";
  $v=$r->value();
  $max=$v->arraysize();
  for($i=0; $i<$max; $i++) {
    $rec=$v->arraymem($i);
    $n=$rec->structmem("name");
    $a=$rec->structmem("age");
    print htmlspecialchars($n->scalarval()) . ", " . htmlspecialchars($a->scalarval()) . "\n";
  }

  print "<hr/>For nerds: I got this value back<br/><pre>" .
    htmlentities($r->serialize()). "</pre><hr/>\n";
} else {
  print "An error occurred:<pre>";
  print "Code: " . htmlspecialchars($r->faultCode()) .
    "\nReason: '" . htmlspecialchars($r->faultString()).'\'</pre><hr/>';
}

?>
</body>
</html>
2 1
\ No newline at end of file
2
+<html>
<head><title>xmlrpc</title></head>
<body>
<h1>Agesort demo</h1>
<h2>Send an array of 'name' => 'age' pairs to the server that will send it back sorted.</h2>
<h3>The source code demonstrates basic lib usage, including handling of xmlrpc arrays and structs</h3>
<p></p>
<?php
include("xmlrpc.inc"); $inAr = array("Dave" => 24, "Edd" => 45, "Joe" => 37, "Fred" => 27); reset($inAr); print "This is the input data:<br/><pre>"; while (list($key, $val) = each($inAr)) {
  print $key.", ".$val."\n"; }
print "</pre>"; // create parameters from the input array: an xmlrpc array of xmlrpc structs
$p = array(); foreach ($inAr as $key => $val) {
  $p[] = new xmlrpcval(array("name" => new xmlrpcval($key), "age" => new xmlrpcval($val, "int")), "struct"); }
$v = new xmlrpcval($p, "array"); print "Encoded into xmlrpc format it looks like this: <pre>\n".htmlentities($v->serialize())."</pre>\n"; // create client and message objects
$f = new xmlrpcmsg('examples.sortByAge', array($v)); $c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80); // set maximum debug level, to have the complete communication printed to screen
$c->setDebug(2); // send request
print "Now sending request (detailed debug info follows)"; $r = &$c->send($f); // check response for errors, and take appropriate action
if (!$r->faultCode()) {
  print "The server gave me these results:<pre>"; $v = $r->value(); $max = $v->arraysize(); for ($i = 0; $i<$max; $i++) {
    $rec = $v->arraymem($i); $n = $rec->structmem("name"); $a = $rec->structmem("age"); print htmlspecialchars($n->scalarval()).", ".htmlspecialchars($a->scalarval())."\n"; }

  print "<hr/>For nerds: I got this value back<br/><pre>".htmlentities($r->serialize())."</pre><hr/>\n"; } else {
  print "An error occurred:<pre>"; print "Code: ".htmlspecialchars($r->faultCode())."\nReason: '".htmlspecialchars($r->faultString()).'\'</pre><hr/>'; }

?>
</body>
</html>
3 3
\ No newline at end of file
Please login to merge, or discard this patch.
demo/client/client.php 3 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -5,45 +5,45 @@
 block discarded – undo
5 5
 <h2>Send a U.S. state number to the server and get back the state name</h2>
6 6
 <h3>The code demonstrates usage of the php_xmlrpc_encode function</h3>
7 7
 <?php
8
-	include("xmlrpc.inc");
8
+    include("xmlrpc.inc");
9 9
 
10
-	// Play nice to PHP 5 installations with REGISTER_LONG_ARRAYS off
11
-	if(!isset($HTTP_POST_VARS) && isset($_POST))
12
-	{
13
-		$HTTP_POST_VARS = $_POST;
14
-	}
10
+    // Play nice to PHP 5 installations with REGISTER_LONG_ARRAYS off
11
+    if(!isset($HTTP_POST_VARS) && isset($_POST))
12
+    {
13
+        $HTTP_POST_VARS = $_POST;
14
+    }
15 15
 
16
-	if(isset($HTTP_POST_VARS["stateno"]) && $HTTP_POST_VARS["stateno"]!="")
17
-	{
18
-		$stateno=(integer)$HTTP_POST_VARS["stateno"];
19
-		$f=new xmlrpcmsg('examples.getStateName',
20
-			array(php_xmlrpc_encode($stateno))
21
-		);
22
-		print "<pre>Sending the following request:\n\n" . htmlentities($f->serialize()) . "\n\nDebug info of server data follows...\n\n";
23
-		$c=new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);
24
-		$c->setDebug(1);
25
-		$r=&$c->send($f);
26
-		if(!$r->faultCode())
27
-		{
28
-			$v=$r->value();
29
-			print "</pre><br/>State number " . $stateno . " is "
30
-				. htmlspecialchars($v->scalarval()) . "<br/>";
31
-			// print "<HR>I got this value back<BR><PRE>" .
32
-			//  htmlentities($r->serialize()). "</PRE><HR>\n";
33
-		}
34
-		else
35
-		{
36
-			print "An error occurred: ";
37
-			print "Code: " . htmlspecialchars($r->faultCode())
38
-				. " Reason: '" . htmlspecialchars($r->faultString()) . "'</pre><br/>";
39
-		}
40
-	}
41
-	else
42
-	{
43
-		$stateno = "";
44
-	}
16
+    if(isset($HTTP_POST_VARS["stateno"]) && $HTTP_POST_VARS["stateno"]!="")
17
+    {
18
+        $stateno=(integer)$HTTP_POST_VARS["stateno"];
19
+        $f=new xmlrpcmsg('examples.getStateName',
20
+            array(php_xmlrpc_encode($stateno))
21
+        );
22
+        print "<pre>Sending the following request:\n\n" . htmlentities($f->serialize()) . "\n\nDebug info of server data follows...\n\n";
23
+        $c=new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);
24
+        $c->setDebug(1);
25
+        $r=&$c->send($f);
26
+        if(!$r->faultCode())
27
+        {
28
+            $v=$r->value();
29
+            print "</pre><br/>State number " . $stateno . " is "
30
+                . htmlspecialchars($v->scalarval()) . "<br/>";
31
+            // print "<HR>I got this value back<BR><PRE>" .
32
+            //  htmlentities($r->serialize()). "</PRE><HR>\n";
33
+        }
34
+        else
35
+        {
36
+            print "An error occurred: ";
37
+            print "Code: " . htmlspecialchars($r->faultCode())
38
+                . " Reason: '" . htmlspecialchars($r->faultString()) . "'</pre><br/>";
39
+        }
40
+    }
41
+    else
42
+    {
43
+        $stateno = "";
44
+    }
45 45
 
46
-	print "<form action=\"client.php\" method=\"POST\">
46
+    print "<form action=\"client.php\" method=\"POST\">
47 47
 <input name=\"stateno\" value=\"" . $stateno . "\"><input type=\"submit\" value=\"go\" name=\"submit\"></form>
48 48
 <p>Enter a state number to query its name</p>";
49 49
 
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,34 +8,34 @@  discard block
 block discarded – undo
8 8
 	include("xmlrpc.inc");
9 9
 
10 10
 	// Play nice to PHP 5 installations with REGISTER_LONG_ARRAYS off
11
-	if(!isset($HTTP_POST_VARS) && isset($_POST))
11
+	if (!isset($HTTP_POST_VARS) && isset($_POST))
12 12
 	{
13 13
 		$HTTP_POST_VARS = $_POST;
14 14
 	}
15 15
 
16
-	if(isset($HTTP_POST_VARS["stateno"]) && $HTTP_POST_VARS["stateno"]!="")
16
+	if (isset($HTTP_POST_VARS["stateno"]) && $HTTP_POST_VARS["stateno"] != "")
17 17
 	{
18
-		$stateno=(integer)$HTTP_POST_VARS["stateno"];
19
-		$f=new xmlrpcmsg('examples.getStateName',
18
+		$stateno = (integer) $HTTP_POST_VARS["stateno"];
19
+		$f = new xmlrpcmsg('examples.getStateName',
20 20
 			array(php_xmlrpc_encode($stateno))
21 21
 		);
22
-		print "<pre>Sending the following request:\n\n" . htmlentities($f->serialize()) . "\n\nDebug info of server data follows...\n\n";
23
-		$c=new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);
22
+		print "<pre>Sending the following request:\n\n".htmlentities($f->serialize())."\n\nDebug info of server data follows...\n\n";
23
+		$c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);
24 24
 		$c->setDebug(1);
25
-		$r=&$c->send($f);
26
-		if(!$r->faultCode())
25
+		$r = &$c->send($f);
26
+		if (!$r->faultCode())
27 27
 		{
28
-			$v=$r->value();
29
-			print "</pre><br/>State number " . $stateno . " is "
30
-				. htmlspecialchars($v->scalarval()) . "<br/>";
28
+			$v = $r->value();
29
+			print "</pre><br/>State number ".$stateno." is "
30
+				. htmlspecialchars($v->scalarval())."<br/>";
31 31
 			// print "<HR>I got this value back<BR><PRE>" .
32 32
 			//  htmlentities($r->serialize()). "</PRE><HR>\n";
33 33
 		}
34 34
 		else
35 35
 		{
36 36
 			print "An error occurred: ";
37
-			print "Code: " . htmlspecialchars($r->faultCode())
38
-				. " Reason: '" . htmlspecialchars($r->faultString()) . "'</pre><br/>";
37
+			print "Code: ".htmlspecialchars($r->faultCode())
38
+				. " Reason: '".htmlspecialchars($r->faultString())."'</pre><br/>";
39 39
 		}
40 40
 	}
41 41
 	else
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	}
45 45
 
46 46
 	print "<form action=\"client.php\" method=\"POST\">
47
-<input name=\"stateno\" value=\"" . $stateno . "\"><input type=\"submit\" value=\"go\" name=\"submit\"></form>
47
+<input name=\"stateno\" value=\"" . $stateno."\"><input type=\"submit\" value=\"go\" name=\"submit\"></form>
48 48
 <p>Enter a state number to query its name</p>";
49 49
 
50 50
 ?>
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,15 +30,13 @@
 block discarded – undo
30 30
 				. htmlspecialchars($v->scalarval()) . "<br/>";
31 31
 			// print "<HR>I got this value back<BR><PRE>" .
32 32
 			//  htmlentities($r->serialize()). "</PRE><HR>\n";
33
-		}
34
-		else
33
+		} else
35 34
 		{
36 35
 			print "An error occurred: ";
37 36
 			print "Code: " . htmlspecialchars($r->faultCode())
38 37
 				. " Reason: '" . htmlspecialchars($r->faultString()) . "'</pre><br/>";
39 38
 		}
40
-	}
41
-	else
39
+	} else
42 40
 	{
43 41
 		$stateno = "";
44 42
 	}
Please login to merge, or discard this patch.
demo/client/mail.php 3 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // Allow users to see the source of this file even if PHP is not configured for it
3 3
 if ((isset($HTTP_GET_VARS['showSource']) && $HTTP_GET_VARS['showSource']) ||
4
-	(isset($_GET['showSource']) && $_GET['showSource']))
5
-	{ highlight_file(__FILE__); die(); }
4
+    (isset($_GET['showSource']) && $_GET['showSource']))
5
+    { highlight_file(__FILE__); die(); }
6 6
 ?>
7 7
 <html>
8 8
 <head><title>xmlrpc</title></head>
@@ -18,36 +18,36 @@  discard block
 block discarded – undo
18 18
 
19 19
 // Play nice to PHP 5 installations with REGISTER_LONG_ARRAYS off
20 20
 if (!isset($HTTP_POST_VARS) && isset($_POST))
21
-	$HTTP_POST_VARS = $_POST;
21
+    $HTTP_POST_VARS = $_POST;
22 22
 
23 23
 if (isset($HTTP_POST_VARS["server"]) && $HTTP_POST_VARS["server"]) {
24
-	if ($HTTP_POST_VARS["server"]=="Userland") {
25
-		$XP="/RPC2"; $XS="206.204.24.2";
26
-	} else {
27
-		$XP="/xmlrpc/server.php"; $XS="pingu.heddley.com";
28
-	}
29
-	$f=new xmlrpcmsg('mail.send');
30
-	$f->addParam(new xmlrpcval($HTTP_POST_VARS["mailto"]));
31
-	$f->addParam(new xmlrpcval($HTTP_POST_VARS["mailsub"]));
32
-	$f->addParam(new xmlrpcval($HTTP_POST_VARS["mailmsg"]));
33
-	$f->addParam(new xmlrpcval($HTTP_POST_VARS["mailfrom"]));
34
-	$f->addParam(new xmlrpcval($HTTP_POST_VARS["mailcc"]));
35
-	$f->addParam(new xmlrpcval($HTTP_POST_VARS["mailbcc"]));
36
-	$f->addParam(new xmlrpcval("text/plain"));
24
+    if ($HTTP_POST_VARS["server"]=="Userland") {
25
+        $XP="/RPC2"; $XS="206.204.24.2";
26
+    } else {
27
+        $XP="/xmlrpc/server.php"; $XS="pingu.heddley.com";
28
+    }
29
+    $f=new xmlrpcmsg('mail.send');
30
+    $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailto"]));
31
+    $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailsub"]));
32
+    $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailmsg"]));
33
+    $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailfrom"]));
34
+    $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailcc"]));
35
+    $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailbcc"]));
36
+    $f->addParam(new xmlrpcval("text/plain"));
37 37
 
38
-	$c=new xmlrpc_client($XP, $XS, 80);
39
-	$c->setDebug(2);
40
-	$r=&$c->send($f);
41
-	if (!$r->faultCode()) {
42
-		print "Mail sent OK<br/>\n";
43
-	} else {
44
-		print "<fonr color=\"red\">";
45
-		print "Mail send failed<br/>\n";
46
-		print "Fault: ";
47
-		print "Code: " . htmlspecialchars($r->faultCode()) .
48
-	  " Reason: '" . htmlspecialchars($r->faultString()) . "'<br/>";
49
-		print "</font><br/>";
50
-	}
38
+    $c=new xmlrpc_client($XP, $XS, 80);
39
+    $c->setDebug(2);
40
+    $r=&$c->send($f);
41
+    if (!$r->faultCode()) {
42
+        print "Mail sent OK<br/>\n";
43
+    } else {
44
+        print "<fonr color=\"red\">";
45
+        print "Mail send failed<br/>\n";
46
+        print "Fault: ";
47
+        print "Code: " . htmlspecialchars($r->faultCode()) .
48
+        " Reason: '" . htmlspecialchars($r->faultString()) . "'<br/>";
49
+        print "</font><br/>";
50
+    }
51 51
 }
52 52
 ?>
53 53
 <form method="POST">
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
 	$HTTP_POST_VARS = $_POST;
22 22
 
23 23
 if (isset($HTTP_POST_VARS["server"]) && $HTTP_POST_VARS["server"]) {
24
-	if ($HTTP_POST_VARS["server"]=="Userland") {
25
-		$XP="/RPC2"; $XS="206.204.24.2";
24
+	if ($HTTP_POST_VARS["server"] == "Userland") {
25
+		$XP = "/RPC2"; $XS = "206.204.24.2";
26 26
 	} else {
27
-		$XP="/xmlrpc/server.php"; $XS="pingu.heddley.com";
27
+		$XP = "/xmlrpc/server.php"; $XS = "pingu.heddley.com";
28 28
 	}
29
-	$f=new xmlrpcmsg('mail.send');
29
+	$f = new xmlrpcmsg('mail.send');
30 30
 	$f->addParam(new xmlrpcval($HTTP_POST_VARS["mailto"]));
31 31
 	$f->addParam(new xmlrpcval($HTTP_POST_VARS["mailsub"]));
32 32
 	$f->addParam(new xmlrpcval($HTTP_POST_VARS["mailmsg"]));
@@ -35,17 +35,17 @@  discard block
 block discarded – undo
35 35
 	$f->addParam(new xmlrpcval($HTTP_POST_VARS["mailbcc"]));
36 36
 	$f->addParam(new xmlrpcval("text/plain"));
37 37
 
38
-	$c=new xmlrpc_client($XP, $XS, 80);
38
+	$c = new xmlrpc_client($XP, $XS, 80);
39 39
 	$c->setDebug(2);
40
-	$r=&$c->send($f);
40
+	$r = &$c->send($f);
41 41
 	if (!$r->faultCode()) {
42 42
 		print "Mail sent OK<br/>\n";
43 43
 	} else {
44 44
 		print "<fonr color=\"red\">";
45 45
 		print "Mail send failed<br/>\n";
46 46
 		print "Fault: ";
47
-		print "Code: " . htmlspecialchars($r->faultCode()) .
48
-	  " Reason: '" . htmlspecialchars($r->faultString()) . "'<br/>";
47
+		print "Code: ".htmlspecialchars($r->faultCode()).
48
+	  " Reason: '".htmlspecialchars($r->faultString())."'<br/>";
49 49
 		print "</font><br/>";
50 50
 	}
51 51
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,8 +17,9 @@
 block discarded – undo
17 17
 include("xmlrpc.inc");
18 18
 
19 19
 // Play nice to PHP 5 installations with REGISTER_LONG_ARRAYS off
20
-if (!isset($HTTP_POST_VARS) && isset($_POST))
20
+if (!isset($HTTP_POST_VARS) && isset($_POST)) {
21 21
 	$HTTP_POST_VARS = $_POST;
22
+}
22 23
 
23 24
 if (isset($HTTP_POST_VARS["server"]) && $HTTP_POST_VARS["server"]) {
24 25
 	if ($HTTP_POST_VARS["server"]=="Userland") {
Please login to merge, or discard this patch.
demo/client/zopetest.php 3 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -4,26 +4,26 @@
 block discarded – undo
4 4
 <h1>Zope test demo</h1>
5 5
 <h3>The code demonstrates usage of basic authentication to connect to the server</h3>
6 6
 <?php
7
-	include("xmlrpc.inc");
7
+    include("xmlrpc.inc");
8 8
 
9
-	$f = new xmlrpcmsg('document_src', array());
10
-	$c = new xmlrpc_client("/index_html", "pingu.heddley.com", 9080);
11
-	$c->setCredentials("username", "password");
12
-	$c->setDebug(2);
13
-	$r = $c->send($f);
14
-	if(!$r->faultCode())
15
-	{
16
-		$v = $r->value();
17
-		print "I received:" . htmlspecialchars($v->scalarval()) . "<br/>";
18
-		print "<hr/>I got this value back<br/>pre>" .
19
-		htmlentities($r->serialize()). "</pre>\n";
20
-	}
21
-	else
22
-	{
23
-		print "An error occurred: ";
24
-		print "Code: " . htmlspecialchars($r->faultCode())
25
-			. " Reason: '" . ($r->faultString()) . "'<br/>";
26
-	}
9
+    $f = new xmlrpcmsg('document_src', array());
10
+    $c = new xmlrpc_client("/index_html", "pingu.heddley.com", 9080);
11
+    $c->setCredentials("username", "password");
12
+    $c->setDebug(2);
13
+    $r = $c->send($f);
14
+    if(!$r->faultCode())
15
+    {
16
+        $v = $r->value();
17
+        print "I received:" . htmlspecialchars($v->scalarval()) . "<br/>";
18
+        print "<hr/>I got this value back<br/>pre>" .
19
+        htmlentities($r->serialize()). "</pre>\n";
20
+    }
21
+    else
22
+    {
23
+        print "An error occurred: ";
24
+        print "Code: " . htmlspecialchars($r->faultCode())
25
+            . " Reason: '" . ($r->faultString()) . "'<br/>";
26
+    }
27 27
 ?>
28 28
 </body>
29 29
 </html>
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,18 +11,18 @@
 block discarded – undo
11 11
 	$c->setCredentials("username", "password");
12 12
 	$c->setDebug(2);
13 13
 	$r = $c->send($f);
14
-	if(!$r->faultCode())
14
+	if (!$r->faultCode())
15 15
 	{
16 16
 		$v = $r->value();
17
-		print "I received:" . htmlspecialchars($v->scalarval()) . "<br/>";
18
-		print "<hr/>I got this value back<br/>pre>" .
19
-		htmlentities($r->serialize()). "</pre>\n";
17
+		print "I received:".htmlspecialchars($v->scalarval())."<br/>";
18
+		print "<hr/>I got this value back<br/>pre>".
19
+		htmlentities($r->serialize())."</pre>\n";
20 20
 	}
21 21
 	else
22 22
 	{
23 23
 		print "An error occurred: ";
24
-		print "Code: " . htmlspecialchars($r->faultCode())
25
-			. " Reason: '" . ($r->faultString()) . "'<br/>";
24
+		print "Code: ".htmlspecialchars($r->faultCode())
25
+			. " Reason: '".($r->faultString())."'<br/>";
26 26
 	}
27 27
 ?>
28 28
 </body>
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@
 block discarded – undo
17 17
 		print "I received:" . htmlspecialchars($v->scalarval()) . "<br/>";
18 18
 		print "<hr/>I got this value back<br/>pre>" .
19 19
 		htmlentities($r->serialize()). "</pre>\n";
20
-	}
21
-	else
20
+	} else
22 21
 	{
23 22
 		print "An error occurred: ";
24 23
 		print "Code: " . htmlspecialchars($r->faultCode())
Please login to merge, or discard this patch.
demo/client/introspect.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,1 +1,1 @@
 block discarded – undo
1
-<html>

<head><title>xmlrpc</title></head>

<body>

<h1>Introspect demo</h1>

<h2>Query server for available methods and their description</h2>

<h3>The code demonstrates usage of multicall and introspection methods</h3>

<?php

	include("xmlrpc.inc");



	function display_error($r)

	{

		print "An error occurred: ";

		print "Code: " . $r->faultCode()

			. " Reason: '" .$r->faultString()."'<br/>";

	}



	// 'new style' client constuctor

	$c = new xmlrpc_client("http://phpxmlrpc.sourceforge.net/server.php");

	print "<h3>methods available at http://" . $c->server . $c->path .  "</h3>\n";



	$m = new xmlrpcmsg('system.listMethods');

	$r =& $c->send($m);

	if($r->faultCode())

	{

		display_error($r);

	}

	else

	{

		$v=$r->value();

		for($i=0; $i<$v->arraysize(); $i++)

		{

			$mname=$v->arraymem($i);

			print "<h4>" . $mname->scalarval() . "</h4>\n";



			// build messages first, add params later

			$m1  = new xmlrpcmsg('system.methodHelp');

			$m2  = new xmlrpcmsg('system.methodSignature');

			$val = new xmlrpcval($mname->scalarval(), "string");

			$m1->addParam($val);

			$m2->addParam($val);



			// send multiple messages in one pass.

			// If server does not support multicall, client will fall back to 2 separate calls

			$ms = array($m1, $m2);

			$rs =& $c->send($ms);



			if($rs[0]->faultCode())

			{

				display_error($rs[0]);

			}

			else

			{

				$val=$rs[0]->value();

				$txt=$val->scalarval();

				if($txt != "")

				{

					print "<h4>Documentation</h4><p>${txt}</p>\n";

				}

				else

				{

					print "<p>No documentation available.</p>\n";

				}

			}



			if($rs[1]->faultCode())

			{

				display_error($rs[1]);

			}

			else

			{

				print "<h4>Signature</h4><p>\n";

				$val = $rs[1]->value();

				if($val->kindOf()=="array")

				{

					for($j=0; $j<$val->arraysize(); $j++)

					{

						$x = $val->arraymem($j);

						$ret = $x->arraymem(0);

						print "<code>" . $ret->scalarval() . " "

							. $mname->scalarval() . "(";

						if($x->arraysize()>1)

						{

							for($k=1; $k<$x->arraysize(); $k++)

							{

								$y = $x->arraymem($k);

								print $y->scalarval();

								if($k < $x->arraysize()-1)

								{

									print ", ";

								}

							}

						}

						print ")</code><br/>\n";

					}

				}

				else

				{

					print "Signature unknown\n";

				}

				print "</p>\n";

			}

		}

	}

?>

</body>

</html>

2 1
\ No newline at end of file
2
+<html>

<head><title>xmlrpc</title></head>

<body>

<h1>Introspect demo</h1>

<h2>Query server for available methods and their description</h2>

<h3>The code demonstrates usage of multicall and introspection methods</h3>

<?php

	include("xmlrpc.inc"); function display_error($r) {

		print "An error occurred: "; print "Code: ".$r->faultCode()." Reason: '".$r->faultString()."'<br/>"; }



	// 'new style' client constuctor

	$c = new xmlrpc_client("http://phpxmlrpc.sourceforge.net/server.php"); print "<h3>methods available at http://".$c->server.$c->path."</h3>\n"; $m = new xmlrpcmsg('system.listMethods'); $r = & $c->send($m); if ($r->faultCode()) {

		display_error($r); } else {

		$v = $r->value(); for ($i = 0; $i<$v->arraysize(); $i++) {

			$mname = $v->arraymem($i); print "<h4>".$mname->scalarval()."</h4>\n"; // build messages first, add params later

			$m1 = new xmlrpcmsg('system.methodHelp'); $m2 = new xmlrpcmsg('system.methodSignature'); $val = new xmlrpcval($mname->scalarval(), "string"); $m1->addParam($val); $m2->addParam($val); // send multiple messages in one pass.

			// If server does not support multicall, client will fall back to 2 separate calls

			$ms = array($m1, $m2); $rs = & $c->send($ms); if ($rs[0]->faultCode()) {

				display_error($rs[0]); } else {

				$val = $rs[0]->value(); $txt = $val->scalarval(); if ($txt != "") {

					print "<h4>Documentation</h4><p>${txt}</p>\n"; } else {

					print "<p>No documentation available.</p>\n"; }

			}



			if ($rs[1]->faultCode()) {

				display_error($rs[1]); } else {

				print "<h4>Signature</h4><p>\n"; $val = $rs[1]->value(); if ($val->kindOf() == "array") {

					for ($j = 0; $j<$val->arraysize(); $j++) {

						$x = $val->arraymem($j); $ret = $x->arraymem(0); print "<code>".$ret->scalarval()." ".$mname->scalarval()."("; if ($x->arraysize()>1) {

							for ($k = 1; $k<$x->arraysize(); $k++) {

								$y = $x->arraymem($k); print $y->scalarval(); if ($k<$x->arraysize()-1) {

									print ", "; }

							}

						}

						print ")</code><br/>\n"; }

				} else {

					print "Signature unknown\n"; }

				print "</p>\n"; }

		}

	}

?>

</body>

</html>

3 3
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,1 +1,1 @@
 block discarded – undo
1
-<html>

<head><title>xmlrpc</title></head>

<body>

<h1>Introspect demo</h1>

<h2>Query server for available methods and their description</h2>

<h3>The code demonstrates usage of multicall and introspection methods</h3>

<?php

	include("xmlrpc.inc");



	function display_error($r)

	{

		print "An error occurred: ";

		print "Code: " . $r->faultCode()

			. " Reason: '" .$r->faultString()."'<br/>";

	}



	// 'new style' client constuctor

	$c = new xmlrpc_client("http://phpxmlrpc.sourceforge.net/server.php");

	print "<h3>methods available at http://" . $c->server . $c->path .  "</h3>\n";



	$m = new xmlrpcmsg('system.listMethods');

	$r =& $c->send($m);

	if($r->faultCode())

	{

		display_error($r);

	}

	else

	{

		$v=$r->value();

		for($i=0; $i<$v->arraysize(); $i++)

		{

			$mname=$v->arraymem($i);

			print "<h4>" . $mname->scalarval() . "</h4>\n";



			// build messages first, add params later

			$m1  = new xmlrpcmsg('system.methodHelp');

			$m2  = new xmlrpcmsg('system.methodSignature');

			$val = new xmlrpcval($mname->scalarval(), "string");

			$m1->addParam($val);

			$m2->addParam($val);



			// send multiple messages in one pass.

			// If server does not support multicall, client will fall back to 2 separate calls

			$ms = array($m1, $m2);

			$rs =& $c->send($ms);



			if($rs[0]->faultCode())

			{

				display_error($rs[0]);

			}

			else

			{

				$val=$rs[0]->value();

				$txt=$val->scalarval();

				if($txt != "")

				{

					print "<h4>Documentation</h4><p>${txt}</p>\n";

				}

				else

				{

					print "<p>No documentation available.</p>\n";

				}

			}



			if($rs[1]->faultCode())

			{

				display_error($rs[1]);

			}

			else

			{

				print "<h4>Signature</h4><p>\n";

				$val = $rs[1]->value();

				if($val->kindOf()=="array")

				{

					for($j=0; $j<$val->arraysize(); $j++)

					{

						$x = $val->arraymem($j);

						$ret = $x->arraymem(0);

						print "<code>" . $ret->scalarval() . " "

							. $mname->scalarval() . "(";

						if($x->arraysize()>1)

						{

							for($k=1; $k<$x->arraysize(); $k++)

							{

								$y = $x->arraymem($k);

								print $y->scalarval();

								if($k < $x->arraysize()-1)

								{

									print ", ";

								}

							}

						}

						print ")</code><br/>\n";

					}

				}

				else

				{

					print "Signature unknown\n";

				}

				print "</p>\n";

			}

		}

	}

?>

</body>

</html>

2 1
\ No newline at end of file
2
+<html>

<head><title>xmlrpc</title></head>

<body>

<h1>Introspect demo</h1>

<h2>Query server for available methods and their description</h2>

<h3>The code demonstrates usage of multicall and introspection methods</h3>

<?php

	include("xmlrpc.inc");



	function display_error($r)

	{

		print "An error occurred: ";

		print "Code: " . $r->faultCode()

			. " Reason: '" .$r->faultString()."'<br/>";

	}



	// 'new style' client constuctor

	$c = new xmlrpc_client("http://phpxmlrpc.sourceforge.net/server.php");

	print "<h3>methods available at http://" . $c->server . $c->path .  "</h3>\n";



	$m = new xmlrpcmsg('system.listMethods');

	$r =& $c->send($m);

	if($r->faultCode())

	{

		display_error($r);

	} else

	{

		$v=$r->value();

		for($i=0; $i<$v->arraysize(); $i++)

		{

			$mname=$v->arraymem($i);

			print "<h4>" . $mname->scalarval() . "</h4>\n";



			// build messages first, add params later

			$m1  = new xmlrpcmsg('system.methodHelp');

			$m2  = new xmlrpcmsg('system.methodSignature');

			$val = new xmlrpcval($mname->scalarval(), "string");

			$m1->addParam($val);

			$m2->addParam($val);



			// send multiple messages in one pass.

			// If server does not support multicall, client will fall back to 2 separate calls

			$ms = array($m1, $m2);

			$rs =& $c->send($ms);



			if($rs[0]->faultCode())

			{

				display_error($rs[0]);

			} else

			{

				$val=$rs[0]->value();

				$txt=$val->scalarval();

				if($txt != "")

				{

					print "<h4>Documentation</h4><p>${txt}</p>\n";

				} else

				{

					print "<p>No documentation available.</p>\n";

				}

			}



			if($rs[1]->faultCode())

			{

				display_error($rs[1]);

			} else

			{

				print "<h4>Signature</h4><p>\n";

				$val = $rs[1]->value();

				if($val->kindOf()=="array")

				{

					for($j=0; $j<$val->arraysize(); $j++)

					{

						$x = $val->arraymem($j);

						$ret = $x->arraymem(0);

						print "<code>" . $ret->scalarval() . " "

							. $mname->scalarval() . "(";

						if($x->arraysize()>1)

						{

							for($k=1; $k<$x->arraysize(); $k++)

							{

								$y = $x->arraymem($k);

								print $y->scalarval();

								if($k < $x->arraysize()-1)

								{

									print ", ";

								}

							}

						}

						print ")</code><br/>\n";

					}

				} else

				{

					print "Signature unknown\n";

				}

				print "</p>\n";

			}

		}

	}

?>

</body>

</html>

3 3
\ No newline at end of file
Please login to merge, or discard this patch.
demo/client/which.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,1 +1,1 @@
 block discarded – undo
1
-<html>

<head><title>xmlrpc</title></head>

<body>

<h1>Which toolkit demo</h1>

<h2>Query server for toolkit information</h2>

<h3>The code demonstrates usage of the php_xmlrpc_decode function</h3>

<?php

	include("xmlrpc.inc");



	$f = new xmlrpcmsg('interopEchoTests.whichToolkit', array());

	$c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);

	$r = $c->send($f);

	if(!$r->faultCode())

	{

		$v = php_xmlrpc_decode($r->value());

		print "<pre>";

		print "name: " . htmlspecialchars($v["toolkitName"]) . "\n";

		print "version: " . htmlspecialchars($v["toolkitVersion"]) . "\n";

		print "docs: " . htmlspecialchars($v["toolkitDocsUrl"]) . "\n";

		print "os: " . htmlspecialchars($v["toolkitOperatingSystem"]) . "\n";

		print "</pre>";

	}

	else

	{

		print "An error occurred: ";

		print "Code: " . htmlspecialchars($r->faultCode()) . " Reason: '" . htmlspecialchars($r->faultString()) . "'\n";

	}

?>

</body>

</html>

2 1
\ No newline at end of file
2
+<html>

<head><title>xmlrpc</title></head>

<body>

<h1>Which toolkit demo</h1>

<h2>Query server for toolkit information</h2>

<h3>The code demonstrates usage of the php_xmlrpc_decode function</h3>

<?php

	include("xmlrpc.inc"); $f = new xmlrpcmsg('interopEchoTests.whichToolkit', array()); $c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80); $r = $c->send($f); if (!$r->faultCode()) {

		$v = php_xmlrpc_decode($r->value()); print "<pre>"; print "name: ".htmlspecialchars($v["toolkitName"])."\n"; print "version: ".htmlspecialchars($v["toolkitVersion"])."\n"; print "docs: ".htmlspecialchars($v["toolkitDocsUrl"])."\n"; print "os: ".htmlspecialchars($v["toolkitOperatingSystem"])."\n"; print "</pre>"; } else {

		print "An error occurred: "; print "Code: ".htmlspecialchars($r->faultCode())." Reason: '".htmlspecialchars($r->faultString())."'\n"; }

?>

</body>

</html>

3 3
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,1 +1,1 @@
 block discarded – undo
1
-<html>

<head><title>xmlrpc</title></head>

<body>

<h1>Which toolkit demo</h1>

<h2>Query server for toolkit information</h2>

<h3>The code demonstrates usage of the php_xmlrpc_decode function</h3>

<?php

	include("xmlrpc.inc");



	$f = new xmlrpcmsg('interopEchoTests.whichToolkit', array());

	$c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);

	$r = $c->send($f);

	if(!$r->faultCode())

	{

		$v = php_xmlrpc_decode($r->value());

		print "<pre>";

		print "name: " . htmlspecialchars($v["toolkitName"]) . "\n";

		print "version: " . htmlspecialchars($v["toolkitVersion"]) . "\n";

		print "docs: " . htmlspecialchars($v["toolkitDocsUrl"]) . "\n";

		print "os: " . htmlspecialchars($v["toolkitOperatingSystem"]) . "\n";

		print "</pre>";

	}

	else

	{

		print "An error occurred: ";

		print "Code: " . htmlspecialchars($r->faultCode()) . " Reason: '" . htmlspecialchars($r->faultString()) . "'\n";

	}

?>

</body>

</html>

2 1
\ No newline at end of file
2
+<html>

<head><title>xmlrpc</title></head>

<body>

<h1>Which toolkit demo</h1>

<h2>Query server for toolkit information</h2>

<h3>The code demonstrates usage of the php_xmlrpc_decode function</h3>

<?php

	include("xmlrpc.inc");



	$f = new xmlrpcmsg('interopEchoTests.whichToolkit', array());

	$c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);

	$r = $c->send($f);

	if(!$r->faultCode())

	{

		$v = php_xmlrpc_decode($r->value());

		print "<pre>";

		print "name: " . htmlspecialchars($v["toolkitName"]) . "\n";

		print "version: " . htmlspecialchars($v["toolkitVersion"]) . "\n";

		print "docs: " . htmlspecialchars($v["toolkitDocsUrl"]) . "\n";

		print "os: " . htmlspecialchars($v["toolkitOperatingSystem"]) . "\n";

		print "</pre>";

	} else

	{

		print "An error occurred: ";

		print "Code: " . htmlspecialchars($r->faultCode()) . " Reason: '" . htmlspecialchars($r->faultString()) . "'\n";

	}

?>

</body>

</html>

3 3
\ No newline at end of file
Please login to merge, or discard this patch.
doc/highlight.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -8,29 +8,29 @@  discard block
 block discarded – undo
8 8
 
9 9
 function highlight($file)
10 10
 {
11
-  $starttag = '<pre class="programlisting">';
12
-  $endtag = '</pre>';
11
+    $starttag = '<pre class="programlisting">';
12
+    $endtag = '</pre>';
13 13
 
14
-  $content = file_get_contents($file);
15
-  $last = 0;
16
-  $out = '';
17
-  while(($start = strpos($content, $starttag, $last)) !== false)
18
-  {
14
+    $content = file_get_contents($file);
15
+    $last = 0;
16
+    $out = '';
17
+    while(($start = strpos($content, $starttag, $last)) !== false)
18
+    {
19 19
     $end = strpos($content, $endtag, $start);
20
-	$code = substr($content, $start+strlen($starttag), $end-$start-strlen($starttag));
21
-	if ($code[strlen($code)-1] == "\n") {
22
-		$code = substr($code, 0, -1);
23
-	}
20
+    $code = substr($content, $start+strlen($starttag), $end-$start-strlen($starttag));
21
+    if ($code[strlen($code)-1] == "\n") {
22
+        $code = substr($code, 0, -1);
23
+    }
24 24
 //var_dump($code);
25
-	$code = str_replace(array('&gt;', '&lt;'), array('>', '<'), $code);
25
+    $code = str_replace(array('&gt;', '&lt;'), array('>', '<'), $code);
26 26
     $code = highlight_string('<?php '.$code, true);
27 27
     $code = str_replace('<span style="color: #0000BB">&lt;?php&nbsp;<br />', '<span style="color: #0000BB">', $code);
28 28
 //echo($code);
29 29
     $out = $out . substr($content, $last, $start+strlen($starttag)-$last) . $code . $endtag;
30 30
     $last = $end+strlen($endtag);
31
-  }
32
-  $out .= substr($content, $last, strlen($content));
33
-  return $out;
31
+    }
32
+    $out .= substr($content, $last, strlen($content));
33
+    return $out;
34 34
 }
35 35
 
36 36
 $dir = $argv[1];
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
 $files = scandir($dir);
39 39
 foreach($files as $file)
40 40
 {
41
-	if (substr($file, -5, 5) == '.html')
42
-	{
43
-		$out = highlight($dir.'/'.$file);
44
-		file_put_contents($dir.'/'.$file, $out);
45
-	}
41
+    if (substr($file, -5, 5) == '.html')
42
+    {
43
+        $out = highlight($dir.'/'.$file);
44
+        file_put_contents($dir.'/'.$file, $out);
45
+    }
46 46
 }
47 47
 
48 48
 ?>
49 49
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
   $content = file_get_contents($file);
15 15
   $last = 0;
16 16
   $out = '';
17
-  while(($start = strpos($content, $starttag, $last)) !== false)
17
+  while (($start = strpos($content, $starttag, $last)) !== false)
18 18
   {
19 19
     $end = strpos($content, $endtag, $start);
20 20
 	$code = substr($content, $start+strlen($starttag), $end-$start-strlen($starttag));
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     $code = highlight_string('<?php '.$code, true);
27 27
     $code = str_replace('<span style="color: #0000BB">&lt;?php&nbsp;<br />', '<span style="color: #0000BB">', $code);
28 28
 //echo($code);
29
-    $out = $out . substr($content, $last, $start+strlen($starttag)-$last) . $code . $endtag;
29
+    $out = $out.substr($content, $last, $start+strlen($starttag)-$last).$code.$endtag;
30 30
     $last = $end+strlen($endtag);
31 31
   }
32 32
   $out .= substr($content, $last, strlen($content));
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 $dir = $argv[1];
37 37
 
38 38
 $files = scandir($dir);
39
-foreach($files as $file)
39
+foreach ($files as $file)
40 40
 {
41 41
 	if (substr($file, -5, 5) == '.html')
42 42
 	{
Please login to merge, or discard this patch.