diff options
author | David Walter Seikel | 2013-03-15 01:06:16 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-03-15 01:06:16 +1000 |
commit | 4515cca57d6a5248114b03954fe7984ba477fcce (patch) | |
tree | 2aedb44fd103effbb6c7d6870b6c2cf4b9c19c1b /web/phpxmlrpclib/compat | |
parent | Add the SQL update scripts. (diff) | |
download | opensim-SC-4515cca57d6a5248114b03954fe7984ba477fcce.zip opensim-SC-4515cca57d6a5248114b03954fe7984ba477fcce.tar.gz opensim-SC-4515cca57d6a5248114b03954fe7984ba477fcce.tar.bz2 opensim-SC-4515cca57d6a5248114b03954fe7984ba477fcce.tar.xz |
Add grid server web scripts.
Diffstat (limited to 'web/phpxmlrpclib/compat')
-rw-r--r-- | web/phpxmlrpclib/compat/array_key_exists.php | 55 | ||||
-rw-r--r-- | web/phpxmlrpclib/compat/is_a.php | 47 | ||||
-rw-r--r-- | web/phpxmlrpclib/compat/is_callable.php | 53 | ||||
-rw-r--r-- | web/phpxmlrpclib/compat/is_scalar.php | 38 | ||||
-rw-r--r-- | web/phpxmlrpclib/compat/var_export.php | 105 | ||||
-rw-r--r-- | web/phpxmlrpclib/compat/version_compare.php | 179 |
6 files changed, 477 insertions, 0 deletions
diff --git a/web/phpxmlrpclib/compat/array_key_exists.php b/web/phpxmlrpclib/compat/array_key_exists.php new file mode 100644 index 0000000..4a93ce4 --- /dev/null +++ b/web/phpxmlrpclib/compat/array_key_exists.php | |||
@@ -0,0 +1,55 @@ | |||
1 | <?php | ||
2 | // +----------------------------------------------------------------------+ | ||
3 | // | PHP Version 4 | | ||
4 | // +----------------------------------------------------------------------+ | ||
5 | // | Copyright (c) 1997-2004 The PHP Group | | ||
6 | // +----------------------------------------------------------------------+ | ||
7 | // | This source file is subject to version 3.0 of the PHP license, | | ||
8 | // | that is bundled with this package in the file LICENSE, and is | | ||
9 | // | available at through the world-wide-web at | | ||
10 | // | http://www.php.net/license/3_0.txt. | | ||
11 | // | If you did not receive a copy of the PHP license and are unable to | | ||
12 | // | obtain it through the world-wide-web, please send a note to | | ||
13 | // | license@php.net so we can mail you a copy immediately. | | ||
14 | // +----------------------------------------------------------------------+ | ||
15 | // | Authors: Aidan Lister <aidan@php.net> | | ||
16 | // +----------------------------------------------------------------------+ | ||
17 | // | ||
18 | // $Id: array_key_exists.php 2 2009-03-16 20:22:51Z ggiunta $ | ||
19 | |||
20 | |||
21 | /** | ||
22 | * Replace array_key_exists() | ||
23 | * | ||
24 | * @category PHP | ||
25 | * @package PHP_Compat | ||
26 | * @link http://php.net/function.array_key_exists | ||
27 | * @author Aidan Lister <aidan@php.net> | ||
28 | * @version $Revision: 1.1 $ | ||
29 | * @since PHP 4.1.0 | ||
30 | * @require PHP 4.0.0 (user_error) | ||
31 | */ | ||
32 | if (!function_exists('array_key_exists')) { | ||
33 | function array_key_exists($key, $search) | ||
34 | { | ||
35 | if (!is_scalar($key)) { | ||
36 | user_error('array_key_exists() The first argument should be either a string or an integer', | ||
37 | E_USER_WARNING); | ||
38 | return false; | ||
39 | } | ||
40 | |||
41 | if (is_object($search)) { | ||
42 | $search = get_object_vars($search); | ||
43 | } | ||
44 | |||
45 | if (!is_array($search)) { | ||
46 | user_error('array_key_exists() The second argument should be either an array or an object', | ||
47 | E_USER_WARNING); | ||
48 | return false; | ||
49 | } | ||
50 | |||
51 | return in_array($key, array_keys($search)); | ||
52 | } | ||
53 | } | ||
54 | |||
55 | ?> \ No newline at end of file | ||
diff --git a/web/phpxmlrpclib/compat/is_a.php b/web/phpxmlrpclib/compat/is_a.php new file mode 100644 index 0000000..2c5c129 --- /dev/null +++ b/web/phpxmlrpclib/compat/is_a.php | |||
@@ -0,0 +1,47 @@ | |||
1 | <?php | ||
2 | // +----------------------------------------------------------------------+ | ||
3 | // | PHP Version 4 | | ||
4 | // +----------------------------------------------------------------------+ | ||
5 | // | Copyright (c) 1997-2004 The PHP Group | | ||
6 | // +----------------------------------------------------------------------+ | ||
7 | // | This source file is subject to version 3.0 of the PHP license, | | ||
8 | // | that is bundled with this package in the file LICENSE, and is | | ||
9 | // | available at through the world-wide-web at | | ||
10 | // | http://www.php.net/license/3_0.txt. | | ||
11 | // | If you did not receive a copy of the PHP license and are unable to | | ||
12 | // | obtain it through the world-wide-web, please send a note to | | ||
13 | // | license@php.net so we can mail you a copy immediately. | | ||
14 | // +----------------------------------------------------------------------+ | ||
15 | // | Authors: Aidan Lister <aidan@php.net> | | ||
16 | // +----------------------------------------------------------------------+ | ||
17 | // | ||
18 | // $Id: is_a.php 2 2009-03-16 20:22:51Z ggiunta $ | ||
19 | |||
20 | |||
21 | /** | ||
22 | * Replace function is_a() | ||
23 | * | ||
24 | * @category PHP | ||
25 | * @package PHP_Compat | ||
26 | * @link http://php.net/function.is_a | ||
27 | * @author Aidan Lister <aidan@php.net> | ||
28 | * @version $Revision: 1.2 $ | ||
29 | * @since PHP 4.2.0 | ||
30 | * @require PHP 4.0.0 (user_error) (is_subclass_of) | ||
31 | */ | ||
32 | if (!function_exists('is_a')) { | ||
33 | function is_a($object, $class) | ||
34 | { | ||
35 | if (!is_object($object)) { | ||
36 | return false; | ||
37 | } | ||
38 | |||
39 | if (get_class($object) == strtolower($class)) { | ||
40 | return true; | ||
41 | } else { | ||
42 | return is_subclass_of($object, $class); | ||
43 | } | ||
44 | } | ||
45 | } | ||
46 | |||
47 | ?> \ No newline at end of file | ||
diff --git a/web/phpxmlrpclib/compat/is_callable.php b/web/phpxmlrpclib/compat/is_callable.php new file mode 100644 index 0000000..419697a --- /dev/null +++ b/web/phpxmlrpclib/compat/is_callable.php | |||
@@ -0,0 +1,53 @@ | |||
1 | <?php | ||
2 | /** | ||
3 | * Replace function is_callable() | ||
4 | * | ||
5 | * @category PHP | ||
6 | * @package PHP_Compat | ||
7 | * @link http://php.net/function.is_callable | ||
8 | * @author Gaetano Giunta <giunta.gaetano@sea-aeroportimilano.it> | ||
9 | * @version $Id: is_callable.php 2 2009-03-16 20:22:51Z ggiunta $ | ||
10 | * @since PHP 4.0.6 | ||
11 | * @require PHP 4.0.0 (true, false, etc...) | ||
12 | * @todo add the 3rd parameter syntax... | ||
13 | */ | ||
14 | if (!function_exists('is_callable')) { | ||
15 | function is_callable($var, $syntax_only=false) | ||
16 | { | ||
17 | if ($syntax_only) | ||
18 | { | ||
19 | /* from The Manual: | ||
20 | * If the syntax_only argument is TRUE the function only verifies | ||
21 | * that var might be a function or method. It will only reject simple | ||
22 | * variables that are not strings, or an array that does not have a | ||
23 | * valid structure to be used as a callback. The valid ones are | ||
24 | * supposed to have only 2 entries, the first of which is an object | ||
25 | * or a string, and the second a string | ||
26 | */ | ||
27 | return (is_string($var) || (is_array($var) && count($var) == 2 && is_string(end($var)) && (is_string(reset($var)) || is_object(reset($var))))); | ||
28 | } | ||
29 | else | ||
30 | { | ||
31 | if (is_string($var)) | ||
32 | { | ||
33 | return function_exists($var); | ||
34 | } | ||
35 | else if (is_array($var) && count($var) == 2 && is_string($method = end($var))) | ||
36 | { | ||
37 | $obj = reset($var); | ||
38 | if (is_string($obj)) | ||
39 | { | ||
40 | $methods = get_class_methods($obj); | ||
41 | return (bool)(is_array($methods) && in_array(strtolower($method), $methods)); | ||
42 | } | ||
43 | else if (is_object($obj)) | ||
44 | { | ||
45 | return method_exists($obj, $method); | ||
46 | } | ||
47 | } | ||
48 | return false; | ||
49 | } | ||
50 | } | ||
51 | } | ||
52 | |||
53 | ?> \ No newline at end of file | ||
diff --git a/web/phpxmlrpclib/compat/is_scalar.php b/web/phpxmlrpclib/compat/is_scalar.php new file mode 100644 index 0000000..dd87730 --- /dev/null +++ b/web/phpxmlrpclib/compat/is_scalar.php | |||
@@ -0,0 +1,38 @@ | |||
1 | <?php | ||
2 | // +----------------------------------------------------------------------+ | ||
3 | // | PHP Version 4 | | ||
4 | // +----------------------------------------------------------------------+ | ||
5 | // | Copyright (c) 1997-2004 The PHP Group | | ||
6 | // +----------------------------------------------------------------------+ | ||
7 | // | This source file is subject to version 3.0 of the PHP license, | | ||
8 | // | that is bundled with this package in the file LICENSE, and is | | ||
9 | // | available at through the world-wide-web at | | ||
10 | // | http://www.php.net/license/3_0.txt. | | ||
11 | // | If you did not receive a copy of the PHP license and are unable to | | ||
12 | // | obtain it through the world-wide-web, please send a note to | | ||
13 | // | license@php.net so we can mail you a copy immediately. | | ||
14 | // +----------------------------------------------------------------------+ | ||
15 | // | ||
16 | // $Id: is_scalar.php 2 2009-03-16 20:22:51Z ggiunta $ | ||
17 | |||
18 | |||
19 | /** | ||
20 | * Replace is_scalar() | ||
21 | * | ||
22 | * @category PHP | ||
23 | * @package PHP_Compat | ||
24 | * @link http://php.net/function.is_scalar | ||
25 | * @author Gaetano Giunta | ||
26 | * @version $Revision: 1.2 $ | ||
27 | * @since PHP 4.0.5 | ||
28 | * @require PHP 4 (is_bool) | ||
29 | */ | ||
30 | if (!function_exists('is_scalar')) { | ||
31 | function is_scalar($val) | ||
32 | { | ||
33 | // Check input | ||
34 | return (is_bool($val) || is_int($val) || is_float($val) || is_string($val)); | ||
35 | } | ||
36 | } | ||
37 | |||
38 | ?> \ No newline at end of file | ||
diff --git a/web/phpxmlrpclib/compat/var_export.php b/web/phpxmlrpclib/compat/var_export.php new file mode 100644 index 0000000..7273a1e --- /dev/null +++ b/web/phpxmlrpclib/compat/var_export.php | |||
@@ -0,0 +1,105 @@ | |||
1 | <?php | ||
2 | // +----------------------------------------------------------------------+ | ||
3 | // | PHP Version 4 | | ||
4 | // +----------------------------------------------------------------------+ | ||
5 | // | Copyright (c) 1997-2004 The PHP Group | | ||
6 | // +----------------------------------------------------------------------+ | ||
7 | // | This source file is subject to version 3.0 of the PHP license, | | ||
8 | // | that is bundled with this package in the file LICENSE, and is | | ||
9 | // | available at through the world-wide-web at | | ||
10 | // | http://www.php.net/license/3_0.txt. | | ||
11 | // | If you did not receive a copy of the PHP license and are unable to | | ||
12 | // | obtain it through the world-wide-web, please send a note to | | ||
13 | // | license@php.net so we can mail you a copy immediately. | | ||
14 | // +----------------------------------------------------------------------+ | ||
15 | // | Authors: Aidan Lister <aidan@php.net> | | ||
16 | // +----------------------------------------------------------------------+ | ||
17 | // | ||
18 | // $Id: var_export.php 2 2009-03-16 20:22:51Z ggiunta $ | ||
19 | |||
20 | |||
21 | /** | ||
22 | * Replace var_export() | ||
23 | * | ||
24 | * @category PHP | ||
25 | * @package PHP_Compat | ||
26 | * @link http://php.net/function.var_export | ||
27 | * @author Aidan Lister <aidan@php.net> | ||
28 | * @version $Revision: 1.2 $ | ||
29 | * @since PHP 4.2.0 | ||
30 | * @require PHP 4.0.0 (user_error) | ||
31 | */ | ||
32 | if (!function_exists('var_export')) { | ||
33 | function var_export($array, $return = false, $lvl=0) | ||
34 | { | ||
35 | // Common output variables | ||
36 | $indent = ' '; | ||
37 | $doublearrow = ' => '; | ||
38 | $lineend = ",\n"; | ||
39 | $stringdelim = '\''; | ||
40 | |||
41 | // Check the export isn't a simple string / int | ||
42 | if (is_string($array)) { | ||
43 | $out = $stringdelim . str_replace('\'', '\\\'', str_replace('\\', '\\\\', $array)) . $stringdelim; | ||
44 | } elseif (is_int($array) || is_float($array)) { | ||
45 | $out = (string)$array; | ||
46 | } elseif (is_bool($array)) { | ||
47 | $out = $array ? 'true' : 'false'; | ||
48 | } elseif (is_null($array)) { | ||
49 | $out = 'NULL'; | ||
50 | } elseif (is_resource($array)) { | ||
51 | $out = 'resource'; | ||
52 | } else { | ||
53 | // Begin the array export | ||
54 | // Start the string | ||
55 | $out = "array (\n"; | ||
56 | |||
57 | // Loop through each value in array | ||
58 | foreach ($array as $key => $value) { | ||
59 | // If the key is a string, delimit it | ||
60 | if (is_string($key)) { | ||
61 | $key = str_replace('\'', '\\\'', str_replace('\\', '\\\\', $key)); | ||
62 | $key = $stringdelim . $key . $stringdelim; | ||
63 | } | ||
64 | |||
65 | $val = var_export($value, true, $lvl+1); | ||
66 | // Delimit value | ||
67 | /*if (is_array($value)) { | ||
68 | // We have an array, so do some recursion | ||
69 | // Do some basic recursion while increasing the indent | ||
70 | $recur_array = explode($newline, var_export($value, true)); | ||
71 | $temp_array = array(); | ||
72 | foreach ($recur_array as $recur_line) { | ||
73 | $temp_array[] = $indent . $recur_line; | ||
74 | } | ||
75 | $recur_array = implode($newline, $temp_array); | ||
76 | $value = $newline . $recur_array; | ||
77 | } elseif (is_null($value)) { | ||
78 | $value = 'NULL'; | ||
79 | } else { | ||
80 | $value = str_replace($find, $replace, $value); | ||
81 | $value = $stringdelim . $value . $stringdelim; | ||
82 | }*/ | ||
83 | |||
84 | // Piece together the line | ||
85 | for ($i = 0; $i < $lvl; $i++) | ||
86 | $out .= $indent; | ||
87 | $out .= $key . $doublearrow . $val . $lineend; | ||
88 | } | ||
89 | |||
90 | // End our string | ||
91 | for ($i = 0; $i < $lvl; $i++) | ||
92 | $out .= $indent; | ||
93 | $out .= ")"; | ||
94 | } | ||
95 | |||
96 | // Decide method of output | ||
97 | if ($return === true) { | ||
98 | return $out; | ||
99 | } else { | ||
100 | echo $out; | ||
101 | return; | ||
102 | } | ||
103 | } | ||
104 | } | ||
105 | ?> \ No newline at end of file | ||
diff --git a/web/phpxmlrpclib/compat/version_compare.php b/web/phpxmlrpclib/compat/version_compare.php new file mode 100644 index 0000000..a1211ea --- /dev/null +++ b/web/phpxmlrpclib/compat/version_compare.php | |||
@@ -0,0 +1,179 @@ | |||
1 | <?php | ||
2 | // +----------------------------------------------------------------------+ | ||
3 | // | PHP Version 4 | | ||
4 | // +----------------------------------------------------------------------+ | ||
5 | // | Copyright (c) 1997-2004 The PHP Group | | ||
6 | // +----------------------------------------------------------------------+ | ||
7 | // | This source file is subject to version 3.0 of the PHP license, | | ||
8 | // | that is bundled with this package in the file LICENSE, and is | | ||
9 | // | available at through the world-wide-web at | | ||
10 | // | http://www.php.net/license/3_0.txt. | | ||
11 | // | If you did not receive a copy of the PHP license and are unable to | | ||
12 | // | obtain it through the world-wide-web, please send a note to | | ||
13 | // | license@php.net so we can mail you a copy immediately. | | ||
14 | // +----------------------------------------------------------------------+ | ||
15 | // | Authors: Philippe Jausions <Philippe.Jausions@11abacus.com> | | ||
16 | // | Aidan Lister <aidan@php.net> | | ||
17 | // +----------------------------------------------------------------------+ | ||
18 | // | ||
19 | // $Id: version_compare.php 2 2009-03-16 20:22:51Z ggiunta $ | ||
20 | |||
21 | |||
22 | /** | ||
23 | * Replace version_compare() | ||
24 | * | ||
25 | * @category PHP | ||
26 | * @package PHP_Compat | ||
27 | * @link http://php.net/function.version_compare | ||
28 | * @author Philippe Jausions <Philippe.Jausions@11abacus.com> | ||
29 | * @author Aidan Lister <aidan@php.net> | ||
30 | * @version $Revision: 1.1 $ | ||
31 | * @since PHP 4.1.0 | ||
32 | * @require PHP 4.0.0 (user_error) | ||
33 | */ | ||
34 | if (!function_exists('version_compare')) { | ||
35 | function version_compare($version1, $version2, $operator = '<') | ||
36 | { | ||
37 | // Check input | ||
38 | if (!is_scalar($version1)) { | ||
39 | user_error('version_compare() expects parameter 1 to be string, ' . | ||
40 | gettype($version1) . ' given', E_USER_WARNING); | ||
41 | return; | ||
42 | } | ||
43 | |||
44 | if (!is_scalar($version2)) { | ||
45 | user_error('version_compare() expects parameter 2 to be string, ' . | ||
46 | gettype($version2) . ' given', E_USER_WARNING); | ||
47 | return; | ||
48 | } | ||
49 | |||
50 | if (!is_scalar($operator)) { | ||
51 | user_error('version_compare() expects parameter 3 to be string, ' . | ||
52 | gettype($operator) . ' given', E_USER_WARNING); | ||
53 | return; | ||
54 | } | ||
55 | |||
56 | // Standardise versions | ||
57 | $v1 = explode('.', | ||
58 | str_replace('..', '.', | ||
59 | preg_replace('/([^0-9\.]+)/', '.$1.', | ||
60 | str_replace(array('-', '_', '+'), '.', | ||
61 | trim($version1))))); | ||
62 | |||
63 | $v2 = explode('.', | ||
64 | str_replace('..', '.', | ||
65 | preg_replace('/([^0-9\.]+)/', '.$1.', | ||
66 | str_replace(array('-', '_', '+'), '.', | ||
67 | trim($version2))))); | ||
68 | |||
69 | // Replace empty entries at the start of the array | ||
70 | while (empty($v1[0]) && array_shift($v1)) {} | ||
71 | while (empty($v2[0]) && array_shift($v2)) {} | ||
72 | |||
73 | // Release state order | ||
74 | // '#' stands for any number | ||
75 | $versions = array( | ||
76 | 'dev' => 0, | ||
77 | 'alpha' => 1, | ||
78 | 'a' => 1, | ||
79 | 'beta' => 2, | ||
80 | 'b' => 2, | ||
81 | 'RC' => 3, | ||
82 | '#' => 4, | ||
83 | 'p' => 5, | ||
84 | 'pl' => 5); | ||
85 | |||
86 | // Loop through each segment in the version string | ||
87 | $compare = 0; | ||
88 | for ($i = 0, $x = min(count($v1), count($v2)); $i < $x; $i++) { | ||
89 | if ($v1[$i] == $v2[$i]) { | ||
90 | continue; | ||
91 | } | ||
92 | $i1 = $v1[$i]; | ||
93 | $i2 = $v2[$i]; | ||
94 | if (is_numeric($i1) && is_numeric($i2)) { | ||
95 | $compare = ($i1 < $i2) ? -1 : 1; | ||
96 | break; | ||
97 | } | ||
98 | // We use the position of '#' in the versions list | ||
99 | // for numbers... (so take care of # in original string) | ||
100 | if ($i1 == '#') { | ||
101 | $i1 = ''; | ||
102 | } elseif (is_numeric($i1)) { | ||
103 | $i1 = '#'; | ||
104 | } | ||
105 | if ($i2 == '#') { | ||
106 | $i2 = ''; | ||
107 | } elseif (is_numeric($i2)) { | ||
108 | $i2 = '#'; | ||
109 | } | ||
110 | if (isset($versions[$i1]) && isset($versions[$i2])) { | ||
111 | $compare = ($versions[$i1] < $versions[$i2]) ? -1 : 1; | ||
112 | } elseif (isset($versions[$i1])) { | ||
113 | $compare = 1; | ||
114 | } elseif (isset($versions[$i2])) { | ||
115 | $compare = -1; | ||
116 | } else { | ||
117 | $compare = 0; | ||
118 | } | ||
119 | |||
120 | break; | ||
121 | } | ||
122 | |||
123 | // If previous loop didn't find anything, compare the "extra" segments | ||
124 | if ($compare == 0) { | ||
125 | if (count($v2) > count($v1)) { | ||
126 | if (isset($versions[$v2[$i]])) { | ||
127 | $compare = ($versions[$v2[$i]] < 4) ? 1 : -1; | ||
128 | } else { | ||
129 | $compare = -1; | ||
130 | } | ||
131 | } elseif (count($v2) < count($v1)) { | ||
132 | if (isset($versions[$v1[$i]])) { | ||
133 | $compare = ($versions[$v1[$i]] < 4) ? -1 : 1; | ||
134 | } else { | ||
135 | $compare = 1; | ||
136 | } | ||
137 | } | ||
138 | } | ||
139 | |||
140 | // Compare the versions | ||
141 | if (func_num_args() > 2) { | ||
142 | switch ($operator) { | ||
143 | case '>': | ||
144 | case 'gt': | ||
145 | return (bool) ($compare > 0); | ||
146 | break; | ||
147 | case '>=': | ||
148 | case 'ge': | ||
149 | return (bool) ($compare >= 0); | ||
150 | break; | ||
151 | case '<=': | ||
152 | case 'le': | ||
153 | return (bool) ($compare <= 0); | ||
154 | break; | ||
155 | case '==': | ||
156 | case '=': | ||
157 | case 'eq': | ||
158 | return (bool) ($compare == 0); | ||
159 | break; | ||
160 | case '<>': | ||
161 | case '!=': | ||
162 | case 'ne': | ||
163 | return (bool) ($compare != 0); | ||
164 | break; | ||
165 | case '': | ||
166 | case '<': | ||
167 | case 'lt': | ||
168 | return (bool) ($compare < 0); | ||
169 | break; | ||
170 | default: | ||
171 | return; | ||
172 | } | ||
173 | } | ||
174 | |||
175 | return $compare; | ||
176 | } | ||
177 | } | ||
178 | |||
179 | ?> \ No newline at end of file | ||