mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
First lot of compatability fixes
This commit is contained in:
@@ -160,9 +160,9 @@ function sRandomChars($length = 15,$pattern="23456789abcdefghijkmnpqrstuvwxyz")
|
|||||||
for($i=0;$i<$length;$i++)
|
for($i=0;$i<$length;$i++)
|
||||||
{
|
{
|
||||||
if(isset($key))
|
if(isset($key))
|
||||||
$key .= $pattern{mt_rand(0,$patternlength)};
|
$key .= $pattern[mt_rand(0,$patternlength)];
|
||||||
else
|
else
|
||||||
$key = $pattern{mt_rand(0,$patternlength)};
|
$key = $pattern[mt_rand(0,$patternlength)];
|
||||||
}
|
}
|
||||||
return $key;
|
return $key;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class Console_Getopt {
|
|||||||
* erroneous POSIX fix.
|
* erroneous POSIX fix.
|
||||||
*/
|
*/
|
||||||
if ($version < 2) {
|
if ($version < 2) {
|
||||||
if (isset($args[0]{0}) && $args[0]{0} != '-') {
|
if (isset($args[0][0]) && $args[0][0] != '-') {
|
||||||
array_shift($args);
|
array_shift($args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,10 +120,10 @@ class Console_Getopt {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($arg{0} != '-' || (strlen($arg) > 1 && $arg{1} == '-' && !$long_options)) {
|
if ($arg[0] != '-' || (strlen($arg) > 1 && $arg[1] == '-' && !$long_options)) {
|
||||||
$non_opts = array_merge($non_opts, array_slice($args, $i));
|
$non_opts = array_merge($non_opts, array_slice($args, $i));
|
||||||
break;
|
break;
|
||||||
} elseif (strlen($arg) > 1 && $arg{1} == '-') {
|
} elseif (strlen($arg) > 1 && $arg[1] == '-') {
|
||||||
$error = Console_Getopt::_parseLongOption(substr($arg, 2), $long_options, $opts, $args);
|
$error = Console_Getopt::_parseLongOption(substr($arg, 2), $long_options, $opts, $args);
|
||||||
if (PEAR::isError($error))
|
if (PEAR::isError($error))
|
||||||
return $error;
|
return $error;
|
||||||
@@ -144,17 +144,17 @@ class Console_Getopt {
|
|||||||
function _parseShortOption($arg, $short_options, &$opts, &$args)
|
function _parseShortOption($arg, $short_options, &$opts, &$args)
|
||||||
{
|
{
|
||||||
for ($i = 0; $i < strlen($arg); $i++) {
|
for ($i = 0; $i < strlen($arg); $i++) {
|
||||||
$opt = $arg{$i};
|
$opt = $arg[$i];
|
||||||
$opt_arg = null;
|
$opt_arg = null;
|
||||||
|
|
||||||
/* Try to find the short option in the specifier string. */
|
/* Try to find the short option in the specifier string. */
|
||||||
if (($spec = strstr($short_options, $opt)) === false || $arg{$i} == ':')
|
if (($spec = strstr($short_options, $opt)) === false || $arg[$i] == ':')
|
||||||
{
|
{
|
||||||
return PEAR::raiseError("Console_Getopt: unrecognized option -- $opt");
|
return PEAR::raiseError("Console_Getopt: unrecognized option -- $opt");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($spec) > 1 && $spec{1} == ':') {
|
if (strlen($spec) > 1 && $spec[1] == ':') {
|
||||||
if (strlen($spec) > 2 && $spec{2} == ':') {
|
if (strlen($spec) > 2 && $spec[2] == ':') {
|
||||||
if ($i + 1 < strlen($arg)) {
|
if ($i + 1 < strlen($arg)) {
|
||||||
/* Option takes an optional argument. Use the remainder of
|
/* Option takes an optional argument. Use the remainder of
|
||||||
the arg string if there is anything left. */
|
the arg string if there is anything left. */
|
||||||
@@ -199,7 +199,7 @@ class Console_Getopt {
|
|||||||
|
|
||||||
/* Check that the options uniquely matches one of the allowed
|
/* Check that the options uniquely matches one of the allowed
|
||||||
options. */
|
options. */
|
||||||
if ($opt_rest != '' && $opt{0} != '=' &&
|
if ($opt_rest != '' && $opt[0] != '=' &&
|
||||||
$i + 1 < count($long_options) &&
|
$i + 1 < count($long_options) &&
|
||||||
$opt == substr($long_options[$i+1], 0, $opt_len)) {
|
$opt == substr($long_options[$i+1], 0, $opt_len)) {
|
||||||
return PEAR::raiseError("Console_Getopt: option --$opt is ambiguous");
|
return PEAR::raiseError("Console_Getopt: option --$opt is ambiguous");
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ class DB_common extends PEAR
|
|||||||
function quoteString($string)
|
function quoteString($string)
|
||||||
{
|
{
|
||||||
$string = $this->quote($string);
|
$string = $this->quote($string);
|
||||||
if ($string{0} == "'") {
|
if ($string[0] == "'") {
|
||||||
return substr($string, 1, -1);
|
return substr($string, 1, -1);
|
||||||
}
|
}
|
||||||
return $string;
|
return $string;
|
||||||
|
|||||||
@@ -304,9 +304,9 @@ class Date_Span
|
|||||||
$pm = 'am';
|
$pm = 'am';
|
||||||
$day = $hour = $minute = $second = 0;
|
$day = $hour = $minute = $second = 0;
|
||||||
for ($i = 0; $i < strlen($format); $i++) {
|
for ($i = 0; $i < strlen($format); $i++) {
|
||||||
$char = $format{$i};
|
$char = $format[$i];
|
||||||
if ($char == '%') {
|
if ($char == '%') {
|
||||||
$nextchar = $format{++$i};
|
$nextchar = $format[++$i];
|
||||||
switch ($nextchar) {
|
switch ($nextchar) {
|
||||||
case 'c':
|
case 'c':
|
||||||
$str .= '%d, %d:%d:%d';
|
$str .= '%d, %d:%d:%d';
|
||||||
@@ -635,9 +635,9 @@ class Date_Span
|
|||||||
}
|
}
|
||||||
$output = '';
|
$output = '';
|
||||||
for ($i = 0; $i < strlen($format); $i++) {
|
for ($i = 0; $i < strlen($format); $i++) {
|
||||||
$char = $format{$i};
|
$char = $format[$i];
|
||||||
if ($char == '%') {
|
if ($char == '%') {
|
||||||
$nextchar = $format{++$i};
|
$nextchar = $format[++$i];
|
||||||
switch ($nextchar) {
|
switch ($nextchar) {
|
||||||
case 'C':
|
case 'C':
|
||||||
$output .= sprintf(
|
$output .= sprintf(
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ class HTML_AJAX_JSON
|
|||||||
if(function_exists('mb_convert_encoding'))
|
if(function_exists('mb_convert_encoding'))
|
||||||
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
|
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
|
||||||
|
|
||||||
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
|
$bytes = (ord($utf16[0]) << 8) | ord($utf16[1]);
|
||||||
|
|
||||||
switch(true) {
|
switch(true) {
|
||||||
case ((0x7F & $bytes) == $bytes):
|
case ((0x7F & $bytes) == $bytes):
|
||||||
@@ -213,17 +213,17 @@ class HTML_AJAX_JSON
|
|||||||
case 2:
|
case 2:
|
||||||
// return a UTF-16 character from a 2-byte UTF-8 char
|
// return a UTF-16 character from a 2-byte UTF-8 char
|
||||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||||
return chr(0x07 & (ord($utf8{0}) >> 2))
|
return chr(0x07 & (ord($utf8[0]) >> 2))
|
||||||
. chr((0xC0 & (ord($utf8{0}) << 6))
|
. chr((0xC0 & (ord($utf8[0]) << 6))
|
||||||
| (0x3F & ord($utf8{1})));
|
| (0x3F & ord($utf8[1])));
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
// return a UTF-16 character from a 3-byte UTF-8 char
|
// return a UTF-16 character from a 3-byte UTF-8 char
|
||||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||||
return chr((0xF0 & (ord($utf8{0}) << 4))
|
return chr((0xF0 & (ord($utf8[0]) << 4))
|
||||||
| (0x0F & (ord($utf8{1}) >> 2)))
|
| (0x0F & (ord($utf8[1]) >> 2)))
|
||||||
. chr((0xC0 & (ord($utf8{1}) << 6))
|
. chr((0xC0 & (ord($utf8[1]) << 6))
|
||||||
| (0x7F & ord($utf8{2})));
|
| (0x7F & ord($utf8[2])));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignoring UTF-32 for now, sorry
|
// ignoring UTF-32 for now, sorry
|
||||||
@@ -268,7 +268,7 @@ class HTML_AJAX_JSON
|
|||||||
*/
|
*/
|
||||||
for ($c = 0; $c < $strlen_var; ++$c) {
|
for ($c = 0; $c < $strlen_var; ++$c) {
|
||||||
|
|
||||||
$ord_var_c = ord($var{$c});
|
$ord_var_c = ord($var[$c]);
|
||||||
|
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case $ord_var_c == 0x08:
|
case $ord_var_c == 0x08:
|
||||||
@@ -291,18 +291,18 @@ class HTML_AJAX_JSON
|
|||||||
case $ord_var_c == 0x2F:
|
case $ord_var_c == 0x2F:
|
||||||
case $ord_var_c == 0x5C:
|
case $ord_var_c == 0x5C:
|
||||||
// double quote, slash, slosh
|
// double quote, slash, slosh
|
||||||
$ascii .= '\\'.$var{$c};
|
$ascii .= '\\'.$var[$c];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
|
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
|
||||||
// characters U-00000000 - U-0000007F (same as ASCII)
|
// characters U-00000000 - U-0000007F (same as ASCII)
|
||||||
$ascii .= $var{$c};
|
$ascii .= $var[$c];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (($ord_var_c & 0xE0) == 0xC0):
|
case (($ord_var_c & 0xE0) == 0xC0):
|
||||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||||
$char = pack('C*', $ord_var_c, ord($var{$c + 1}));
|
$char = pack('C*', $ord_var_c, ord($var[$c + 1]));
|
||||||
$c += 1;
|
$c += 1;
|
||||||
$utf16 = $this->utf82utf16($char);
|
$utf16 = $this->utf82utf16($char);
|
||||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||||
@@ -312,8 +312,8 @@ class HTML_AJAX_JSON
|
|||||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||||
$char = pack('C*', $ord_var_c,
|
$char = pack('C*', $ord_var_c,
|
||||||
ord($var{$c + 1}),
|
ord($var[$c + 1]),
|
||||||
ord($var{$c + 2}));
|
ord($var[$c + 2]));
|
||||||
$c += 2;
|
$c += 2;
|
||||||
$utf16 = $this->utf82utf16($char);
|
$utf16 = $this->utf82utf16($char);
|
||||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||||
@@ -323,9 +323,9 @@ class HTML_AJAX_JSON
|
|||||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||||
$char = pack('C*', $ord_var_c,
|
$char = pack('C*', $ord_var_c,
|
||||||
ord($var{$c + 1}),
|
ord($var[$c + 1]),
|
||||||
ord($var{$c + 2}),
|
ord($var[$c + 2]),
|
||||||
ord($var{$c + 3}));
|
ord($var[$c + 3]));
|
||||||
$c += 3;
|
$c += 3;
|
||||||
$utf16 = $this->utf82utf16($char);
|
$utf16 = $this->utf82utf16($char);
|
||||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||||
@@ -335,10 +335,10 @@ class HTML_AJAX_JSON
|
|||||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||||
$char = pack('C*', $ord_var_c,
|
$char = pack('C*', $ord_var_c,
|
||||||
ord($var{$c + 1}),
|
ord($var[$c + 1]),
|
||||||
ord($var{$c + 2}),
|
ord($var[$c + 2]),
|
||||||
ord($var{$c + 3}),
|
ord($var[$c + 3]),
|
||||||
ord($var{$c + 4}));
|
ord($var[$c + 4]));
|
||||||
$c += 4;
|
$c += 4;
|
||||||
$utf16 = $this->utf82utf16($char);
|
$utf16 = $this->utf82utf16($char);
|
||||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||||
@@ -348,11 +348,11 @@ class HTML_AJAX_JSON
|
|||||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||||
$char = pack('C*', $ord_var_c,
|
$char = pack('C*', $ord_var_c,
|
||||||
ord($var{$c + 1}),
|
ord($var[$c + 1]),
|
||||||
ord($var{$c + 2}),
|
ord($var[$c + 2]),
|
||||||
ord($var{$c + 3}),
|
ord($var[$c + 3]),
|
||||||
ord($var{$c + 4}),
|
ord($var[$c + 4]),
|
||||||
ord($var{$c + 5}));
|
ord($var[$c + 5]));
|
||||||
$c += 5;
|
$c += 5;
|
||||||
$utf16 = $this->utf82utf16($char);
|
$utf16 = $this->utf82utf16($char);
|
||||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||||
@@ -518,7 +518,7 @@ class HTML_AJAX_JSON
|
|||||||
for ($c = 0; $c < $strlen_chrs; ++$c) {
|
for ($c = 0; $c < $strlen_chrs; ++$c) {
|
||||||
|
|
||||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||||
$ord_chrs_c = ord($chrs{$c});
|
$ord_chrs_c = ord($chrs[$c]);
|
||||||
|
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case $substr_chrs_c_2 == '\b':
|
case $substr_chrs_c_2 == '\b':
|
||||||
@@ -548,7 +548,7 @@ class HTML_AJAX_JSON
|
|||||||
case $substr_chrs_c_2 == '\\/':
|
case $substr_chrs_c_2 == '\\/':
|
||||||
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
|
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
|
||||||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
|
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
|
||||||
$utf8 .= $chrs{++$c};
|
$utf8 .= $chrs[++$c];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -561,7 +561,7 @@ class HTML_AJAX_JSON
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
|
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
|
||||||
$utf8 .= $chrs{$c};
|
$utf8 .= $chrs[$c];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ($ord_chrs_c & 0xE0) == 0xC0:
|
case ($ord_chrs_c & 0xE0) == 0xC0:
|
||||||
@@ -608,7 +608,7 @@ class HTML_AJAX_JSON
|
|||||||
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
|
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
|
||||||
// array, or object notation
|
// array, or object notation
|
||||||
|
|
||||||
if ($str{0} == '[') {
|
if ($str[0] == '[') {
|
||||||
$stk = array(SERVICES_JSON_IN_ARR);
|
$stk = array(SERVICES_JSON_IN_ARR);
|
||||||
$arr = array();
|
$arr = array();
|
||||||
} else {
|
} else {
|
||||||
@@ -647,7 +647,7 @@ class HTML_AJAX_JSON
|
|||||||
$top = end($stk);
|
$top = end($stk);
|
||||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||||
|
|
||||||
if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
|
if (($c == $strlen_chrs) || (($chrs[$c] == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
|
||||||
// found a comma that is not inside a string, array, etc.,
|
// found a comma that is not inside a string, array, etc.,
|
||||||
// OR we've reached the end of the character list
|
// OR we've reached the end of the character list
|
||||||
$slice = substr($chrs, $top['where'], ($c - $top['where']));
|
$slice = substr($chrs, $top['where'], ($c - $top['where']));
|
||||||
@@ -687,37 +687,37 @@ class HTML_AJAX_JSON
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
|
} elseif ((($chrs[$c] == '"') || ($chrs[$c] == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
|
||||||
// found a quote, and we are not inside a string
|
// found a quote, and we are not inside a string
|
||||||
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
|
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs[$c]));
|
||||||
//print("Found start of string at {$c}\n");
|
//print("Found start of string at {$c}\n");
|
||||||
|
|
||||||
} elseif (($chrs{$c} == $top['delim']) &&
|
} elseif (($chrs[$c] == $top['delim']) &&
|
||||||
($top['what'] == SERVICES_JSON_IN_STR) &&
|
($top['what'] == SERVICES_JSON_IN_STR) &&
|
||||||
(($chrs{$c - 1} != '\\') ||
|
(($chrs[$c - 1] != '\\') ||
|
||||||
($chrs{$c - 1} == '\\' && $chrs{$c - 2} == '\\'))) {
|
($chrs[$c - 1] == '\\' && $chrs[$c - 2] == '\\'))) {
|
||||||
// found a quote, we're in a string, and it's not escaped
|
// found a quote, we're in a string, and it's not escaped
|
||||||
array_pop($stk);
|
array_pop($stk);
|
||||||
//print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
|
//print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
|
||||||
|
|
||||||
} elseif (($chrs{$c} == '[') &&
|
} elseif (($chrs[$c] == '[') &&
|
||||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||||
// found a left-bracket, and we are in an array, object, or slice
|
// found a left-bracket, and we are in an array, object, or slice
|
||||||
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
|
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
|
||||||
//print("Found start of array at {$c}\n");
|
//print("Found start of array at {$c}\n");
|
||||||
|
|
||||||
} elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
|
} elseif (($chrs[$c] == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
|
||||||
// found a right-bracket, and we're in an array
|
// found a right-bracket, and we're in an array
|
||||||
array_pop($stk);
|
array_pop($stk);
|
||||||
//print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
//print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||||
|
|
||||||
} elseif (($chrs{$c} == '{') &&
|
} elseif (($chrs[$c] == '{') &&
|
||||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||||
// found a left-brace, and we are in an array, object, or slice
|
// found a left-brace, and we are in an array, object, or slice
|
||||||
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
|
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
|
||||||
//print("Found start of object at {$c}\n");
|
//print("Found start of object at {$c}\n");
|
||||||
|
|
||||||
} elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
|
} elseif (($chrs[$c] == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
|
||||||
// found a right-brace, and we're in an object
|
// found a right-brace, and we're in an object
|
||||||
array_pop($stk);
|
array_pop($stk);
|
||||||
//print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
//print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ class HTML_QuickForm_date extends HTML_QuickForm_group
|
|||||||
$locale =& $this->_locale[$this->_options['language']];
|
$locale =& $this->_locale[$this->_options['language']];
|
||||||
$backslash = false;
|
$backslash = false;
|
||||||
for ($i = 0, $length = strlen($this->_options['format']); $i < $length; $i++) {
|
for ($i = 0, $length = strlen($this->_options['format']); $i < $length; $i++) {
|
||||||
$sign = $this->_options['format']{$i};
|
$sign = $this->_options['format'][$i];
|
||||||
if ($backslash) {
|
if ($backslash) {
|
||||||
$backslash = false;
|
$backslash = false;
|
||||||
$separator .= $sign;
|
$separator .= $sign;
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ class HTTP
|
|||||||
$_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF'];
|
$_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($url{0} == '/') {
|
if ($url[0] == '/') {
|
||||||
return $server . $url;
|
return $server . $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ class OS_Guess
|
|||||||
$cpp = popen("/usr/bin/cpp $tmpfile", "r");
|
$cpp = popen("/usr/bin/cpp $tmpfile", "r");
|
||||||
$major = $minor = 0;
|
$major = $minor = 0;
|
||||||
while ($line = fgets($cpp, 1024)) {
|
while ($line = fgets($cpp, 1024)) {
|
||||||
if ($line{0} == '#' || trim($line) == '') {
|
if ($line[0] == '#' || trim($line) == '') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (list($major, $minor) = explode(' ', trim($line))) {
|
if (list($major, $minor) = explode(' ', trim($line))) {
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ class PEAR_Autoloader extends PEAR
|
|||||||
$methods = get_class_methods($classname);
|
$methods = get_class_methods($classname);
|
||||||
foreach ($methods as $method) {
|
foreach ($methods as $method) {
|
||||||
// don't import priviate methods and constructors
|
// don't import priviate methods and constructors
|
||||||
if ($method{0} != '_' && $method != $classname) {
|
if ($method[0] != '_' && $method != $classname) {
|
||||||
$this->_method_map[$method] = $obj;
|
$this->_method_map[$method] = $obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ class PEAR_Builder extends PEAR_Common
|
|||||||
|
|
||||||
$ret = true;
|
$ret = true;
|
||||||
while (($ent = readdir($d)) !== false) {
|
while (($ent = readdir($d)) !== false) {
|
||||||
if ($ent{0} == '.')
|
if ($ent[0] == '.')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$full = $dirname . DIRECTORY_SEPARATOR . $ent;
|
$full = $dirname . DIRECTORY_SEPARATOR . $ent;
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ class PEAR_Command
|
|||||||
$GLOBALS['_PEAR_Command_commandlist'] = array();
|
$GLOBALS['_PEAR_Command_commandlist'] = array();
|
||||||
}
|
}
|
||||||
while ($entry = readdir($dp)) {
|
while ($entry = readdir($dp)) {
|
||||||
if ($entry{0} == '.' || substr($entry, -4) != '.xml') {
|
if ($entry[0] == '.' || substr($entry, -4) != '.xml') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$class = "PEAR_Command_".substr($entry, 0, -4);
|
$class = "PEAR_Command_".substr($entry, 0, -4);
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ class PEAR_Command_Common extends PEAR
|
|||||||
while (list($option, $info) = each($this->commands[$command]['options'])) {
|
while (list($option, $info) = each($this->commands[$command]['options'])) {
|
||||||
$larg = $sarg = '';
|
$larg = $sarg = '';
|
||||||
if (isset($info['arg'])) {
|
if (isset($info['arg'])) {
|
||||||
if ($info['arg']{0} == '(') {
|
if ($info['arg'][0] == '(') {
|
||||||
$larg = '==';
|
$larg = '==';
|
||||||
$sarg = '::';
|
$sarg = '::';
|
||||||
$arg = substr($info['arg'], 1, -1);
|
$arg = substr($info['arg'], 1, -1);
|
||||||
@@ -223,7 +223,7 @@ class PEAR_Command_Common extends PEAR
|
|||||||
$help = "Options:\n";
|
$help = "Options:\n";
|
||||||
foreach ($this->commands[$command]['options'] as $k => $v) {
|
foreach ($this->commands[$command]['options'] as $k => $v) {
|
||||||
if (isset($v['arg'])) {
|
if (isset($v['arg'])) {
|
||||||
if ($v['arg']{0} == '(') {
|
if ($v['arg'][0] == '(') {
|
||||||
$arg = substr($v['arg'], 1, -1);
|
$arg = substr($v['arg'], 1, -1);
|
||||||
$sapp = " [$arg]";
|
$sapp = " [$arg]";
|
||||||
$lapp = "[=$arg]";
|
$lapp = "[=$arg]";
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ and uninstall).
|
|||||||
$root = preg_replace(array('!\\\\+!', '!/+!', "!$ds2+!"),
|
$root = preg_replace(array('!\\\\+!', '!/+!', "!$ds2+!"),
|
||||||
array('/', '/', '/'),
|
array('/', '/', '/'),
|
||||||
$root);
|
$root);
|
||||||
if ($root{0} != '/') {
|
if ($root[0] != '/') {
|
||||||
if (isset($options['windows'])) {
|
if (isset($options['windows'])) {
|
||||||
if (!preg_match('/^[A-Za-z]:/', $root)) {
|
if (!preg_match('/^[A-Za-z]:/', $root)) {
|
||||||
return PEAR::raiseError('Root directory must be an absolute path beginning ' .
|
return PEAR::raiseError('Root directory must be an absolute path beginning ' .
|
||||||
@@ -344,7 +344,7 @@ and uninstall).
|
|||||||
}
|
}
|
||||||
$params[1] = realpath($params[1]);
|
$params[1] = realpath($params[1]);
|
||||||
$config = &new PEAR_Config($params[1], '#no#system#config#', false, false);
|
$config = &new PEAR_Config($params[1], '#no#system#config#', false, false);
|
||||||
if ($root{strlen($root) - 1} == '/') {
|
if ($root[strlen($root) - 1] == '/') {
|
||||||
$root = substr($root, 0, strlen($root) - 1);
|
$root = substr($root, 0, strlen($root) - 1);
|
||||||
}
|
}
|
||||||
$config->noRegistry();
|
$config->noRegistry();
|
||||||
|
|||||||
@@ -611,7 +611,7 @@ class PEAR_Common extends PEAR
|
|||||||
foreach ($methods as $method) {
|
foreach ($methods as $method) {
|
||||||
$function = "$class::$method";
|
$function = "$class::$method";
|
||||||
$key = "function;$function";
|
$key = "function;$function";
|
||||||
if ($method{0} == '_' || !strcasecmp($method, $class) ||
|
if ($method[0] == '_' || !strcasecmp($method, $class) ||
|
||||||
isset($this->pkginfo['provides'][$key])) {
|
isset($this->pkginfo['provides'][$key])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -622,7 +622,7 @@ class PEAR_Common extends PEAR
|
|||||||
|
|
||||||
foreach ($srcinfo['declared_functions'] as $function) {
|
foreach ($srcinfo['declared_functions'] as $function) {
|
||||||
$key = "function;$function";
|
$key = "function;$function";
|
||||||
if ($function{0} == '_' || isset($this->pkginfo['provides'][$key])) {
|
if ($function[0] == '_' || isset($this->pkginfo['provides'][$key])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) {
|
if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) {
|
||||||
|
|||||||
@@ -2058,7 +2058,7 @@ class PEAR_Config extends PEAR
|
|||||||
if (OS_WINDOWS && preg_match('/^[a-z]:/i', $path)) {
|
if (OS_WINDOWS && preg_match('/^[a-z]:/i', $path)) {
|
||||||
if (preg_match('/^[a-z]:/i', $prepend)) {
|
if (preg_match('/^[a-z]:/i', $prepend)) {
|
||||||
$prepend = substr($prepend, 2);
|
$prepend = substr($prepend, 2);
|
||||||
} elseif ($prepend{0} != '\\') {
|
} elseif ($prepend[0] != '\\') {
|
||||||
$prepend = "\\$prepend";
|
$prepend = "\\$prepend";
|
||||||
}
|
}
|
||||||
$path = substr($path, 0, 2) . $prepend . substr($path, 2);
|
$path = substr($path, 0, 2) . $prepend . substr($path, 2);
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ class PEAR_DependencyDB
|
|||||||
if ($depdb['_version'] < $this->_version) {
|
if ($depdb['_version'] < $this->_version) {
|
||||||
$this->rebuildDB();
|
$this->rebuildDB();
|
||||||
}
|
}
|
||||||
if ($depdb['_version']{0} > $this->_version{0}) {
|
if ($depdb['_version'][0] > $this->_version[0]) {
|
||||||
return PEAR::raiseError('Dependency database is version ' .
|
return PEAR::raiseError('Dependency database is version ' .
|
||||||
$depdb['_version'] . ', and we are version ' .
|
$depdb['_version'] . ', and we are version ' .
|
||||||
$this->_version . ', cannot continue');
|
$this->_version . ', cannot continue');
|
||||||
|
|||||||
@@ -1078,7 +1078,7 @@ class PEAR_Downloader extends PEAR_Common
|
|||||||
if (OS_WINDOWS && preg_match('/^[a-z]:/i', $path)) {
|
if (OS_WINDOWS && preg_match('/^[a-z]:/i', $path)) {
|
||||||
if (preg_match('/^[a-z]:/i', $prepend)) {
|
if (preg_match('/^[a-z]:/i', $prepend)) {
|
||||||
$prepend = substr($prepend, 2);
|
$prepend = substr($prepend, 2);
|
||||||
} elseif ($prepend{0} != '\\') {
|
} elseif ($prepend[0] != '\\') {
|
||||||
$prepend = "\\$prepend";
|
$prepend = "\\$prepend";
|
||||||
}
|
}
|
||||||
$path = substr($path, 0, 2) . $prepend . substr($path, 2);
|
$path = substr($path, 0, 2) . $prepend . substr($path, 2);
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ class PEAR_Installer extends PEAR_Downloader
|
|||||||
if (empty($os)) {
|
if (empty($os)) {
|
||||||
$os = new OS_Guess();
|
$os = new OS_Guess();
|
||||||
}
|
}
|
||||||
if (strlen($atts['platform']) && $atts['platform']{0} == '!') {
|
if (strlen($atts['platform']) && $atts['platform'][0] == '!') {
|
||||||
$negate = true;
|
$negate = true;
|
||||||
$platform = substr($atts['platform'], 1);
|
$platform = substr($atts['platform'], 1);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ class PEAR_Installer_Role
|
|||||||
return PEAR::raiseError("registerRoles: opendir($dir) failed");
|
return PEAR::raiseError("registerRoles: opendir($dir) failed");
|
||||||
}
|
}
|
||||||
while ($entry = readdir($dp)) {
|
while ($entry = readdir($dp)) {
|
||||||
if ($entry{0} == '.' || substr($entry, -4) != '.xml') {
|
if ($entry[0] == '.' || substr($entry, -4) != '.xml') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$class = "PEAR_Installer_Role_".substr($entry, 0, -4);
|
$class = "PEAR_Installer_Role_".substr($entry, 0, -4);
|
||||||
|
|||||||
@@ -99,12 +99,12 @@ class PEAR_PackageFile
|
|||||||
*/
|
*/
|
||||||
function &parserFactory($version)
|
function &parserFactory($version)
|
||||||
{
|
{
|
||||||
if (!in_array($version{0}, array('1', '2'))) {
|
if (!in_array($version[0], array('1', '2'))) {
|
||||||
$a = false;
|
$a = false;
|
||||||
return $a;
|
return $a;
|
||||||
}
|
}
|
||||||
include_once 'PEAR/PackageFile/Parser/v' . $version{0} . '.php';
|
include_once 'PEAR/PackageFile/Parser/v' . $version[0] . '.php';
|
||||||
$version = $version{0};
|
$version = $version[0];
|
||||||
$class = "PEAR_PackageFile_Parser_v$version";
|
$class = "PEAR_PackageFile_Parser_v$version";
|
||||||
$a = new $class;
|
$a = new $class;
|
||||||
return $a;
|
return $a;
|
||||||
@@ -126,12 +126,12 @@ class PEAR_PackageFile
|
|||||||
*/
|
*/
|
||||||
function &factory($version)
|
function &factory($version)
|
||||||
{
|
{
|
||||||
if (!in_array($version{0}, array('1', '2'))) {
|
if (!in_array($version[0], array('1', '2'))) {
|
||||||
$a = false;
|
$a = false;
|
||||||
return $a;
|
return $a;
|
||||||
}
|
}
|
||||||
include_once 'PEAR/PackageFile/v' . $version{0} . '.php';
|
include_once 'PEAR/PackageFile/v' . $version[0] . '.php';
|
||||||
$version = $version{0};
|
$version = $version[0];
|
||||||
$class = $this->getClassPrefix() . $version;
|
$class = $this->getClassPrefix() . $version;
|
||||||
$a = new $class;
|
$a = new $class;
|
||||||
return $a;
|
return $a;
|
||||||
|
|||||||
@@ -875,13 +875,13 @@ class PEAR_PackageFile_Generator_v1
|
|||||||
}
|
}
|
||||||
//o <install as=..> tags for <file name=... platform=!... install-as=..>
|
//o <install as=..> tags for <file name=... platform=!... install-as=..>
|
||||||
if (isset($package['platform'][$file]) &&
|
if (isset($package['platform'][$file]) &&
|
||||||
$package['platform'][$file]{0} == '!') {
|
$package['platform'][$file][0] == '!') {
|
||||||
$generic[] = $file;
|
$generic[] = $file;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//o <ignore> tags for <file name=... platform=... install-as=..>
|
//o <ignore> tags for <file name=... platform=... install-as=..>
|
||||||
if (isset($package['platform'][$file]) &&
|
if (isset($package['platform'][$file]) &&
|
||||||
$package['platform'][$file]{0} != '!') {
|
$package['platform'][$file][0] != '!') {
|
||||||
$genericIgnore[] = $file;
|
$genericIgnore[] = $file;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -890,7 +890,7 @@ class PEAR_PackageFile_Generator_v1
|
|||||||
if (isset($package['install-as'][$file])) {
|
if (isset($package['install-as'][$file])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($platform{0} != '!') {
|
if ($platform[0] != '!') {
|
||||||
//o <ignore> tags for <file name=... platform=...>
|
//o <ignore> tags for <file name=... platform=...>
|
||||||
$genericIgnore[] = $file;
|
$genericIgnore[] = $file;
|
||||||
}
|
}
|
||||||
@@ -899,7 +899,7 @@ class PEAR_PackageFile_Generator_v1
|
|||||||
$oses = $notplatform = $platform = array();
|
$oses = $notplatform = $platform = array();
|
||||||
foreach ($package['platform'] as $file => $os) {
|
foreach ($package['platform'] as $file => $os) {
|
||||||
// get a list of oses
|
// get a list of oses
|
||||||
if ($os{0} == '!') {
|
if ($os[0] == '!') {
|
||||||
if (isset($oses[substr($os, 1)])) {
|
if (isset($oses[substr($os, 1)])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -945,7 +945,7 @@ class PEAR_PackageFile_Generator_v1
|
|||||||
// <file name=... platform=!other platform install-as=..>
|
// <file name=... platform=!other platform install-as=..>
|
||||||
if (isset($package['platform'][$file]) &&
|
if (isset($package['platform'][$file]) &&
|
||||||
$package['platform'][$file] != "!$os" &&
|
$package['platform'][$file] != "!$os" &&
|
||||||
$package['platform'][$file]{0} == '!') {
|
$package['platform'][$file][0] == '!') {
|
||||||
$release[$releaseNum]['filelist']['install'][] =
|
$release[$releaseNum]['filelist']['install'][] =
|
||||||
array(
|
array(
|
||||||
'attribs' => array(
|
'attribs' => array(
|
||||||
@@ -970,7 +970,7 @@ class PEAR_PackageFile_Generator_v1
|
|||||||
//o <ignore> tags for
|
//o <ignore> tags for
|
||||||
// <file name=... platform=other platform install-as=..>
|
// <file name=... platform=other platform install-as=..>
|
||||||
if (isset($package['platform'][$file]) &&
|
if (isset($package['platform'][$file]) &&
|
||||||
$package['platform'][$file]{0} != '!' &&
|
$package['platform'][$file][0] != '!' &&
|
||||||
$package['platform'][$file] != $os) {
|
$package['platform'][$file] != $os) {
|
||||||
$release[$releaseNum]['filelist']['ignore'][] =
|
$release[$releaseNum]['filelist']['ignore'][] =
|
||||||
array(
|
array(
|
||||||
@@ -996,7 +996,7 @@ class PEAR_PackageFile_Generator_v1
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//o <ignore> tags for <file name=... platform=other platform>
|
//o <ignore> tags for <file name=... platform=other platform>
|
||||||
if ($platform{0} != '!' && $platform != $os) {
|
if ($platform[0] != '!' && $platform != $os) {
|
||||||
$release[$releaseNum]['filelist']['ignore'][] =
|
$release[$releaseNum]['filelist']['ignore'][] =
|
||||||
array(
|
array(
|
||||||
'attribs' => array(
|
'attribs' => array(
|
||||||
|
|||||||
@@ -752,7 +752,7 @@ http://pear.php.net/dtd/package-2.0.xsd',
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_string($value) && $value && ($value{strlen($value) - 1} == "\n")) {
|
if (is_string($value) && $value && ($value[strlen($value) - 1] == "\n")) {
|
||||||
$value .= str_repeat($this->options['indent'], $this->_tagDepth);
|
$value .= str_repeat($this->options['indent'], $this->_tagDepth);
|
||||||
}
|
}
|
||||||
$tmp .= $this->_createXMLTag(array(
|
$tmp .= $this->_createXMLTag(array(
|
||||||
@@ -1501,7 +1501,7 @@ class PEAR_PackageFile_Generator_v2_XML_Util {
|
|||||||
function isValidName($string)
|
function isValidName($string)
|
||||||
{
|
{
|
||||||
// check for invalid chars
|
// check for invalid chars
|
||||||
if (!preg_match("/^[[:alnum:]_\-.]$/", $string{0})) {
|
if (!preg_match("/^[[:alnum:]_\-.]$/", $string[0])) {
|
||||||
return PEAR_PackageFile_Generator_v2_XML_Util::raiseError( "XML names may only start with letter or underscore", PEAR_PackageFile_Generator_v2_XML_Util_ERROR_INVALID_START );
|
return PEAR_PackageFile_Generator_v2_XML_Util::raiseError( "XML names may only start with letter or underscore", PEAR_PackageFile_Generator_v2_XML_Util_ERROR_INVALID_START );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1192,7 +1192,7 @@ class PEAR_PackageFile_v1
|
|||||||
$this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILEROLE,
|
$this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILEROLE,
|
||||||
array('file' => $file, 'role' => $fa['role'], 'roles' => PEAR_Common::getFileRoles()));
|
array('file' => $file, 'role' => $fa['role'], 'roles' => PEAR_Common::getFileRoles()));
|
||||||
}
|
}
|
||||||
if ($file{0} == '.' && $file{1} == '/') {
|
if ($file[0] == '.' && $file[1] == '/') {
|
||||||
$this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME,
|
$this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME,
|
||||||
array('file' => $file));
|
array('file' => $file));
|
||||||
}
|
}
|
||||||
@@ -1573,7 +1573,7 @@ class PEAR_PackageFile_v1
|
|||||||
foreach ($methods as $method) {
|
foreach ($methods as $method) {
|
||||||
$function = "$class::$method";
|
$function = "$class::$method";
|
||||||
$key = "function;$function";
|
$key = "function;$function";
|
||||||
if ($method{0} == '_' || !strcasecmp($method, $class) ||
|
if ($method[0] == '_' || !strcasecmp($method, $class) ||
|
||||||
isset($this->_packageInfo['provides'][$key])) {
|
isset($this->_packageInfo['provides'][$key])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1584,7 +1584,7 @@ class PEAR_PackageFile_v1
|
|||||||
|
|
||||||
foreach ($srcinfo['declared_functions'] as $function) {
|
foreach ($srcinfo['declared_functions'] as $function) {
|
||||||
$key = "function;$function";
|
$key = "function;$function";
|
||||||
if ($function{0} == '_' || isset($this->_packageInfo['provides'][$key])) {
|
if ($function[0] == '_' || isset($this->_packageInfo['provides'][$key])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) {
|
if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) {
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ class PEAR_PackageFile_v2_Validator
|
|||||||
foreach ($tags as $i => $tag) {
|
foreach ($tags as $i => $tag) {
|
||||||
if (!is_array($tag) || !isset($tag['attribs'])) {
|
if (!is_array($tag) || !isset($tag['attribs'])) {
|
||||||
foreach ($choice['attribs'] as $attrib) {
|
foreach ($choice['attribs'] as $attrib) {
|
||||||
if ($attrib{0} != '?') {
|
if ($attrib[0] != '?') {
|
||||||
$ret &= $this->_tagHasNoAttribs($choice['tag'],
|
$ret &= $this->_tagHasNoAttribs($choice['tag'],
|
||||||
$context);
|
$context);
|
||||||
continue 2;
|
continue 2;
|
||||||
@@ -413,7 +413,7 @@ class PEAR_PackageFile_v2_Validator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($choice['attribs'] as $attrib) {
|
foreach ($choice['attribs'] as $attrib) {
|
||||||
if ($attrib{0} != '?') {
|
if ($attrib[0] != '?') {
|
||||||
if (!isset($tag['attribs'][$attrib])) {
|
if (!isset($tag['attribs'][$attrib])) {
|
||||||
$ret &= $this->_tagMissingAttribute($choice['tag'],
|
$ret &= $this->_tagMissingAttribute($choice['tag'],
|
||||||
$attrib, $context);
|
$attrib, $context);
|
||||||
@@ -435,9 +435,9 @@ class PEAR_PackageFile_v2_Validator
|
|||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
$multi = $key{0};
|
$multi = $key[0];
|
||||||
if ($multi == '+' || $multi == '*') {
|
if ($multi == '+' || $multi == '*') {
|
||||||
$ret['multiple'] = $key{0};
|
$ret['multiple'] = $key[0];
|
||||||
$key = substr($key, 1);
|
$key = substr($key, 1);
|
||||||
}
|
}
|
||||||
if (count($attrs = explode('->', $key)) > 1) {
|
if (count($attrs = explode('->', $key)) > 1) {
|
||||||
@@ -1025,8 +1025,8 @@ class PEAR_PackageFile_v2_Validator
|
|||||||
foreach ($list['file'] as $i => $file)
|
foreach ($list['file'] as $i => $file)
|
||||||
{
|
{
|
||||||
if (isset($file['attribs']) && isset($file['attribs']['name']) &&
|
if (isset($file['attribs']) && isset($file['attribs']['name']) &&
|
||||||
$file['attribs']['name']{0} == '.' &&
|
$file['attribs']['name'][0] == '.' &&
|
||||||
$file['attribs']['name']{1} == '/') {
|
$file['attribs']['name'][1] == '/') {
|
||||||
// name is something like "./doc/whatever.txt"
|
// name is something like "./doc/whatever.txt"
|
||||||
$this->_invalidFileName($file['attribs']['name']);
|
$this->_invalidFileName($file['attribs']['name']);
|
||||||
}
|
}
|
||||||
@@ -1973,7 +1973,7 @@ class PEAR_PackageFile_v2_Validator
|
|||||||
foreach ($methods as $method) {
|
foreach ($methods as $method) {
|
||||||
$function = "$class::$method";
|
$function = "$class::$method";
|
||||||
$key = "function;$function";
|
$key = "function;$function";
|
||||||
if ($method{0} == '_' || !strcasecmp($method, $class) ||
|
if ($method[0] == '_' || !strcasecmp($method, $class) ||
|
||||||
isset($providesret[$key])) {
|
isset($providesret[$key])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1984,7 +1984,7 @@ class PEAR_PackageFile_v2_Validator
|
|||||||
|
|
||||||
foreach ($srcinfo['declared_functions'] as $function) {
|
foreach ($srcinfo['declared_functions'] as $function) {
|
||||||
$key = "function;$function";
|
$key = "function;$function";
|
||||||
if ($function{0} == '_' || isset($providesret[$key])) {
|
if ($function[0] == '_' || isset($providesret[$key])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) {
|
if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) {
|
||||||
|
|||||||
@@ -1066,7 +1066,7 @@ class PEAR_Registry extends PEAR
|
|||||||
return array('pear.php.net', 'pecl.php.net', '__uri');
|
return array('pear.php.net', 'pecl.php.net', '__uri');
|
||||||
}
|
}
|
||||||
while ($ent = readdir($dp)) {
|
while ($ent = readdir($dp)) {
|
||||||
if ($ent{0} == '.' || substr($ent, -4) != '.reg') {
|
if ($ent[0] == '.' || substr($ent, -4) != '.reg') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($ent == '__uri.reg') {
|
if ($ent == '__uri.reg') {
|
||||||
@@ -1102,7 +1102,7 @@ class PEAR_Registry extends PEAR
|
|||||||
return $pkglist;
|
return $pkglist;
|
||||||
}
|
}
|
||||||
while ($ent = readdir($dp)) {
|
while ($ent = readdir($dp)) {
|
||||||
if ($ent{0} == '.' || substr($ent, -4) != '.reg') {
|
if ($ent[0] == '.' || substr($ent, -4) != '.reg') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$pkglist[] = substr($ent, 0, -4);
|
$pkglist[] = substr($ent, 0, -4);
|
||||||
@@ -1122,7 +1122,7 @@ class PEAR_Registry extends PEAR
|
|||||||
return $pkglist;
|
return $pkglist;
|
||||||
}
|
}
|
||||||
while ($ent = readdir($dp)) {
|
while ($ent = readdir($dp)) {
|
||||||
if ($ent{0} == '.' || substr($ent, -4) != '.reg') {
|
if ($ent[0] == '.' || substr($ent, -4) != '.reg') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$pkglist[] = substr($ent, 0, -4);
|
$pkglist[] = substr($ent, 0, -4);
|
||||||
@@ -1977,7 +1977,7 @@ class PEAR_Registry extends PEAR
|
|||||||
}
|
}
|
||||||
if (!isset($components['scheme'])) {
|
if (!isset($components['scheme'])) {
|
||||||
if (strpos($components['path'], '/') !== false) {
|
if (strpos($components['path'], '/') !== false) {
|
||||||
if ($components['path']{0} == '/') {
|
if ($components['path'][0] == '/') {
|
||||||
return PEAR::raiseError('parsePackageName(): this is not ' .
|
return PEAR::raiseError('parsePackageName(): this is not ' .
|
||||||
'a package name, it begins with "/" in "' . $param . '"',
|
'a package name, it begins with "/" in "' . $param . '"',
|
||||||
'invalid', null, null, $param);
|
'invalid', null, null, $param);
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ class PEAR_Validate
|
|||||||
}
|
}
|
||||||
$vlen = strlen($test);
|
$vlen = strlen($test);
|
||||||
$majver = substr($name, strlen($name) - $vlen);
|
$majver = substr($name, strlen($name) - $vlen);
|
||||||
while ($majver && !is_numeric($majver{0})) {
|
while ($majver && !is_numeric($majver[0])) {
|
||||||
$majver = substr($majver, 1);
|
$majver = substr($majver, 1);
|
||||||
}
|
}
|
||||||
if ($majver != $test) {
|
if ($majver != $test) {
|
||||||
@@ -295,7 +295,7 @@ class PEAR_Validate
|
|||||||
}
|
}
|
||||||
if (!$this->_packagexml->getExtends()) {
|
if (!$this->_packagexml->getExtends()) {
|
||||||
if ($versioncomponents[0] == '1') {
|
if ($versioncomponents[0] == '1') {
|
||||||
if ($versioncomponents[2]{0} == '0') {
|
if ($versioncomponents[2][0] == '0') {
|
||||||
if ($versioncomponents[2] == '0') {
|
if ($versioncomponents[2] == '0') {
|
||||||
// version 1.*.0000
|
// version 1.*.0000
|
||||||
$this->_addWarning('version',
|
$this->_addWarning('version',
|
||||||
@@ -336,7 +336,7 @@ class PEAR_Validate
|
|||||||
} else {
|
} else {
|
||||||
$vlen = strlen($versioncomponents[0] . '');
|
$vlen = strlen($versioncomponents[0] . '');
|
||||||
$majver = substr($name, strlen($name) - $vlen);
|
$majver = substr($name, strlen($name) - $vlen);
|
||||||
while ($majver && !is_numeric($majver{0})) {
|
while ($majver && !is_numeric($majver[0])) {
|
||||||
$majver = substr($majver, 1);
|
$majver = substr($majver, 1);
|
||||||
}
|
}
|
||||||
if (($versioncomponents[0] != 0) && $majver != $versioncomponents[0]) {
|
if (($versioncomponents[0] != 0) && $majver != $versioncomponents[0]) {
|
||||||
@@ -347,7 +347,7 @@ class PEAR_Validate
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ($versioncomponents[0] == $majver) {
|
if ($versioncomponents[0] == $majver) {
|
||||||
if ($versioncomponents[2]{0} == '0') {
|
if ($versioncomponents[2][0] == '0') {
|
||||||
if ($versioncomponents[2] == '0') {
|
if ($versioncomponents[2] == '0') {
|
||||||
// version 2.*.0000
|
// version 2.*.0000
|
||||||
$this->_addWarning('version',
|
$this->_addWarning('version',
|
||||||
@@ -406,7 +406,7 @@ class PEAR_Validate
|
|||||||
if ($this->_packagexml->getExtends()) {
|
if ($this->_packagexml->getExtends()) {
|
||||||
$vlen = strlen($versioncomponents[0] . '');
|
$vlen = strlen($versioncomponents[0] . '');
|
||||||
$majver = substr($name, strlen($name) - $vlen);
|
$majver = substr($name, strlen($name) - $vlen);
|
||||||
while ($majver && !is_numeric($majver{0})) {
|
while ($majver && !is_numeric($majver[0])) {
|
||||||
$majver = substr($majver, 1);
|
$majver = substr($majver, 1);
|
||||||
}
|
}
|
||||||
if (($versioncomponents[0] != 0) && $majver != $versioncomponents[0]) {
|
if (($versioncomponents[0] != 0) && $majver != $versioncomponents[0]) {
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ class System
|
|||||||
} elseif($opt[0] == 'm') {
|
} elseif($opt[0] == 'm') {
|
||||||
// if the mode is clearly an octal number (starts with 0)
|
// if the mode is clearly an octal number (starts with 0)
|
||||||
// convert it to decimal
|
// convert it to decimal
|
||||||
if (strlen($opt[1]) && $opt[1]{0} == '0') {
|
if (strlen($opt[1]) && $opt[1][0] == '0') {
|
||||||
$opt[1] = octdec($opt[1]);
|
$opt[1] = octdec($opt[1]);
|
||||||
} else {
|
} else {
|
||||||
// convert to int
|
// convert to int
|
||||||
@@ -545,7 +545,7 @@ class System
|
|||||||
break;
|
break;
|
||||||
case '-name':
|
case '-name':
|
||||||
if (OS_WINDOWS) {
|
if (OS_WINDOWS) {
|
||||||
if ($args[$i+1]{0} == '\\') {
|
if ($args[$i+1][0] == '\\') {
|
||||||
// prepend drive
|
// prepend drive
|
||||||
$args[$i+1] = addslashes(substr(getcwd(), 0, 2) . $args[$i + 1]);
|
$args[$i+1] = addslashes(substr(getcwd(), 0, 2) . $args[$i + 1]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,17 +254,17 @@ class SHA256 extends hash
|
|||||||
{
|
{
|
||||||
// initialize the registers
|
// initialize the registers
|
||||||
for($j = 0; $j < 8; $j++)
|
for($j = 0; $j < 8; $j++)
|
||||||
${$vars{$j}} = $hashData->hash[$j];
|
${$vars[$j]} = $hashData->hash[$j];
|
||||||
|
|
||||||
// the SHA-256 compression function
|
// the SHA-256 compression function
|
||||||
for($j = 0; $j < 64; $j++)
|
for($j = 0; $j < 64; $j++)
|
||||||
{
|
{
|
||||||
if($j < 16)
|
if($j < 16)
|
||||||
{
|
{
|
||||||
$T1 = ord($hashData->chunks[$i]{$j*4 }) & 0xFF; $T1 <<= 8;
|
$T1 = ord($hashData->chunks[$i][$j*4 ]) & 0xFF; $T1 <<= 8;
|
||||||
$T1 |= ord($hashData->chunks[$i]{$j*4+1}) & 0xFF; $T1 <<= 8;
|
$T1 |= ord($hashData->chunks[$i][$j*4+1]) & 0xFF; $T1 <<= 8;
|
||||||
$T1 |= ord($hashData->chunks[$i]{$j*4+2}) & 0xFF; $T1 <<= 8;
|
$T1 |= ord($hashData->chunks[$i][$j*4+2]) & 0xFF; $T1 <<= 8;
|
||||||
$T1 |= ord($hashData->chunks[$i]{$j*4+3}) & 0xFF;
|
$T1 |= ord($hashData->chunks[$i][$j*4+3]) & 0xFF;
|
||||||
$W[$j] = $T1;
|
$W[$j] = $T1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -286,7 +286,7 @@ class SHA256 extends hash
|
|||||||
|
|
||||||
// compute the next hash set
|
// compute the next hash set
|
||||||
for($j = 0; $j < 8; $j++)
|
for($j = 0; $j < 8; $j++)
|
||||||
$hashData->hash[$j] = SHA256::sum(${$vars{$j}}, $hashData->hash[$j]);
|
$hashData->hash[$j] = SHA256::sum(${$vars[$j]}, $hashData->hash[$j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,7 +351,7 @@ function hexerize($str)
|
|||||||
$o = 'string(' . strlen($str) . ')' . "::\n";
|
$o = 'string(' . strlen($str) . ')' . "::\n";
|
||||||
for($i = 0, $j = strlen($str); $i < $j; $i++, $b = $i % 4)
|
for($i = 0, $j = strlen($str); $i < $j; $i++, $b = $i % 4)
|
||||||
{
|
{
|
||||||
$o .= sprintf('%02X', ord($str{$i}));
|
$o .= sprintf('%02X', ord($str[$i]));
|
||||||
// only process when 32-bits have passed through
|
// only process when 32-bits have passed through
|
||||||
if($i != 0 && $b == 3)
|
if($i != 0 && $b == 3)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user