corrade-http-templates – Diff between revs 2 and 12
?pathlinks?
Rev 2 | Rev 12 | |||
---|---|---|---|---|
Line 10... | Line 10... | |||
10 | |
10 | |
|
11 | ########################################################################### |
11 | ########################################################################### |
|
12 | ## CONFIGURATION ## |
12 | ## CONFIGURATION ## |
|
Line 13... | Line 13... | |||
13 | ########################################################################### |
13 | ########################################################################### |
|
14 | |
14 | |
|
- | 15 | # The configuration file for this script containing the settings. |
||
Line 15... | Line 16... | |||
15 | // The configuration file for this script containing the settings. |
16 | require_once('config.php'); |
|
16 | include_once("config.php"); |
17 | require_once('functions.php'); |
|
17 | |
18 | |
|
Line 18... | Line -... | |||
18 | ########################################################################### |
- | ||
19 | ## INTERNALS ## |
- | ||
20 | ########################################################################### |
- | ||
21 | |
- | ||
22 | ########################################################################### |
- | ||
23 | ## Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 ## |
- | ||
24 | ########################################################################### |
- | ||
25 | function wasKeyValueGet($key, $data) { |
- | ||
26 | return array_reduce( |
- | ||
27 | explode( |
- | ||
28 | "&", |
- | ||
29 | $data |
- | ||
30 | ), |
- | ||
31 | function($o, $p) { |
- | ||
32 | $x = explode("=", $p); |
- | ||
33 | return array_shift($x) != $o ? $o : array_shift($x); |
- | ||
34 | }, |
- | ||
35 | $key |
- | ||
36 | ); |
- | ||
37 | } |
- | ||
38 | /////////////////////////////////////////////////////////////////////////// |
- | ||
39 | // Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 // |
- | ||
40 | /////////////////////////////////////////////////////////////////////////// |
- | ||
41 | function wasCSVToArray($csv) { |
- | ||
42 | $l = array(); |
- | ||
43 | $s = array(); |
- | ||
44 | $m = ""; |
- | ||
45 | for ($i = 0; $i < strlen($csv); ++$i) { |
- | ||
46 | switch ($csv{$i}) { |
- | ||
47 | case ',': |
- | ||
48 | if (sizeof($s) == 0 || !current($s) == '"') { |
- | ||
49 | array_push($l, $m); |
- | ||
50 | $m = ""; |
- | ||
51 | break; |
- | ||
52 | } |
- | ||
53 | $m .= $csv{$i}; |
- | ||
54 | continue; |
- | ||
55 | case '"': |
- | ||
56 | if ($i + 1 < strlen($csv) && $csv{$i} == $csv{$i + 1}) { |
- | ||
57 | $m .= $csv{$i}; |
- | ||
58 | ++$i; |
- | ||
59 | break; |
- | ||
60 | } |
- | ||
61 | if (sizeof($s) == 0|| !current($s) == $csv[$i]) { |
- | ||
62 | array_push($s, $csv{$i}); |
- | ||
63 | continue; |
- | ||
64 | } |
- | ||
65 | array_pop($s); |
- | ||
66 | break; |
- | ||
67 | default: |
- | ||
68 | $m .= $csv{$i}; |
- | ||
69 | break; |
- | ||
70 | } |
- | ||
71 | } |
- | ||
72 | array_push($l, $m); |
19 | ########################################################################### |
|
73 | return $l; |
20 | ## INTERNALS ## |
|
74 | } |
21 | ########################################################################### |
|
75 | |
22 | |
|
76 | #### |
23 | #### |