corrade-http-templates – Diff between revs 2 and 6

Subversion Repositories:
Rev:
Show entire fileRegard whitespace
Rev 2 Rev 6
Line 10... Line 10...
10   10  
11 ########################################################################### 11 ###########################################################################
12 ## CONFIGURATION ## 12 ## CONFIGURATION ##
Line 13... Line -...
13 ########################################################################### -  
14   -  
15 # Set this to the name of the group. 13 ###########################################################################
16 $GROUP = 'My Group'; 14  
17 # Set this to the group password. -  
18 $PASSWORD = 'mypassword'; -  
Line 19... Line 15...
19 # Set this to Corrade's HTTP Server URL. 15 require_once('config.php');
20 $URL = 'http://corrade.internal.site:8080'; 16 require_once('functions.php');
21   17  
Line 22... Line -...
22 ########################################################################### -  
23 ## INTERNALS ## -  
24 ########################################################################### -  
25   -  
26 ########################################################################### -  
27 ## Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 ## -  
28 ########################################################################### -  
29 function wasKeyValueGet($key, $data) { -  
30 return array_reduce( -  
31 explode( -  
32 "&", -  
33 $data -  
34 ), -  
35 function($o, $p) { -  
36 $x = explode("=", $p); -  
37 return array_shift($x) != $o ? $o : array_shift($x); -  
38 }, -  
39 $key -  
40 ); -  
41 } -  
42 /////////////////////////////////////////////////////////////////////////// -  
43 // Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 // -  
44 /////////////////////////////////////////////////////////////////////////// -  
45 function wasCSVToArray($csv) { -  
46 $l = array(); -  
47 $s = array(); -  
48 $m = ""; -  
49 for ($i = 0; $i < strlen($csv); ++$i) { -  
50 switch ($csv{$i}) { -  
51 case ',': -  
52 if (sizeof($s) == 0 || !current($s) == '"') { -  
53 array_push($l, $m); -  
54 $m = ""; -  
55 break; -  
56 } -  
57 $m .= $csv{$i}; -  
58 continue; -  
59 case '"': -  
60 if ($i + 1 < strlen($csv) && $csv{$i} == $csv{$i + 1}) { -  
61 $m .= $csv{$i}; -  
62 ++$i; -  
63 break; -  
64 } -  
65 if (sizeof($s) == 0|| !current($s) == $csv[$i]) { -  
66 array_push($s, $csv{$i}); -  
67 continue; -  
68 } -  
69 array_pop($s); -  
70 break; -  
71 default: -  
72 $m .= $csv{$i}; -  
73 break; -  
74 } -  
75 } -  
76 array_push($l, $m); 18 ###########################################################################
77 return $l; 19 ## INTERNALS ##
78 } 20 ###########################################################################
79   21  
80 #### 22 ####
Line 97... Line 39...
97 } 39 }
98 curl_setopt($curl, CURLOPT_URL, $URL); 40 curl_setopt($curl, CURLOPT_URL, $URL);
99 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 41 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
100 curl_setopt($curl, CURLOPT_POST, true); 42 curl_setopt($curl, CURLOPT_POST, true);
101 curl_setopt($curl, CURLOPT_POSTFIELDS, $postvars); 43 curl_setopt($curl, CURLOPT_POSTFIELDS, $postvars);
-   44 curl_setopt($curl, CURLOPT_ENCODING, true);
102 $return = curl_exec($curl); 45 $return = curl_exec($curl);
103 curl_close($curl); 46 curl_close($curl);
Line 104... Line 47...
104   47  
105 #### 48 ####