From dc3873cf006806a328b2f4ee477b8a3fd3ca4866 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Thu, 28 Jan 2010 21:37:13 -0700 Subject: [PATCH] H4 will require at a minimum PHP 5.2 --- ansel/lib/GalleryMode/Date.php | 18 +---- framework/DOM/DOM.php | 59 ++------------ framework/File_PDF/PDF.php | 91 +++++++++------------- .../lib/Horde/Kolab/Filter/Transport/LMTPTLS.php | 47 +++++------ framework/Rpc/lib/Horde/Rpc/Phpgw.php | 15 +--- .../Template/test/Horde/Template/iterator.phpt | 6 -- horde/config/nls.php | 3 +- ingo/lib/Driver/Sivtest.php | 12 +-- koward/www/horde/config/nls.php.dist | 9 +-- 9 files changed, 73 insertions(+), 187 deletions(-) diff --git a/ansel/lib/GalleryMode/Date.php b/ansel/lib/GalleryMode/Date.php index 5676d2c64..6f1281898 100644 --- a/ansel/lib/GalleryMode/Date.php +++ b/ansel/lib/GalleryMode/Date.php @@ -575,27 +575,11 @@ class Ansel_GalleryMode_Date { */ function _getArraySlice($array, $from, $count, $preserve = false) { - if ($from == 0 && $count == 0) { return $array; } - if ($preserve && version_compare(PHP_VERSION, '5.0.2', '>=')) { - return array_slice($array, $from, $count, true); - } elseif ($preserve) { - // Can't use array_slice since it won't preserve keys in PHP4 - $return = array(); - $i = 0; - foreach ($array as $key => $child) { - if ($i >= $from && $i < ($from + $count)) { - $return[$key] = $child; - } - $i++; - } - return $return; - } else { - return array_slice($array, $from, $count); - } + return array_slice($array, $from, $count, $preserve); } /** diff --git a/framework/DOM/DOM.php b/framework/DOM/DOM.php index 8df6f6d38..c90859bbf 100644 --- a/framework/DOM/DOM.php +++ b/framework/DOM/DOM.php @@ -44,7 +44,7 @@ class Horde_DOM_Document extends Horde_DOM_Node { * @param array $params Array containing either 'filename' | 'xml' keys. * You can specify an optional 'options' key. * - * @return mixed PHP 4 domxml document | Horde_DOM_Document | PEAR_Error + * @return mixed Horde_DOM_Document | PEAR_Error */ function factory($params = array()) { @@ -52,54 +52,10 @@ class Horde_DOM_Document extends Horde_DOM_Node { $params['options'] = 0; } - if (version_compare(PHP_VERSION, '5', '>=')) { - // PHP 5 with Horde_DOM. Let Horde_DOM determine - // if we are a file or string. - $doc = new Horde_DOM_Document($params); - if (isset($doc->error)) { - return $doc->error; - } - return $doc; - } - - // Load mode - if ($params['options'] & HORDE_DOM_LOAD_VALIDATE) { - $options = DOMXML_LOAD_VALIDATING; - } elseif ($params['options'] & HORDE_DOM_LOAD_RECOVER) { - $options = DOMXML_LOAD_RECOVERING; - } else { - $options = DOMXML_LOAD_PARSING; - } - - // Load options - if ($params['options'] & HORDE_DOM_LOAD_REMOVE_BLANKS) { - $options |= DOMXML_LOAD_DONT_KEEP_BLANKS; - } - if ($params['options'] & HORDE_DOM_LOAD_SUBSTITUTE_ENTITIES) { - $options |= DOMXML_LOAD_SUBSTITUTE_ENTITIES; - } - - if (isset($params['filename'])) { - if (function_exists('domxml_open_file')) { - // PHP 4 with domxml and XML file - return domxml_open_file($params['filename'], $options); - } - } elseif (isset($params['xml'])) { - if (function_exists('domxml_open_mem')) { - // PHP 4 with domxml and XML string. - $result = @domxml_open_mem($params['xml'], $options); - if (!$result) { - return PEAR::raiseError('Failed loading XML document.'); - } - return $result; - } - } elseif (function_exists('domxml_new_doc')) { - // PHP 4 creating a blank doc. - return domxml_new_doc('1.0'); + $doc = new Horde_DOM_Document($params); + if (isset($doc->error)) { + return $doc->error; } - - // No DOM support - raise error. - return PEAR::raiseError('DOM support not present.'); } /** @@ -598,12 +554,7 @@ class Horde_DOM_XPath { function factory($dom) { - if (version_compare(PHP_VERSION, '5', '>=')) { - // PHP 5 with Horde_DOM. - return new Horde_DOM_XPath($dom); - } - - return $dom->xpath_new_context(); + return new Horde_DOM_XPath($dom); } function Horde_DOM_XPath($dom) diff --git a/framework/File_PDF/PDF.php b/framework/File_PDF/PDF.php index de339a658..ccdac7c62 100644 --- a/framework/File_PDF/PDF.php +++ b/framework/File_PDF/PDF.php @@ -17,23 +17,6 @@ * @package File_PDF * @category Fileformats */ - -/** - * This hack works around Horde bug #4094 - * (http://bugs.horde.org/ticket/?id=4094) - * - * Once this package does not need to support PHP < 4.3.10 anymore the - * following definiton can be removed and the ugly code can be removed - * using - * - * sed -i -e 's/\' \. FILE_PDF_FLOAT \. \'/F/g' PDF.php - */ -if (version_compare(PHP_VERSION, '4.3.10', '>=')) { - define('FILE_PDF_FLOAT', 'F'); -} else { - define('FILE_PDF_FLOAT', 'f'); -} - class File_PDF { /** @@ -947,7 +930,7 @@ class File_PDF { $this->_out('2 J'); /* Set line width. */ $this->_line_width = $lw; - $this->_out(sprintf('%.2' . FILE_PDF_FLOAT . ' w', $lw * $this->_scale)); + $this->_out(sprintf('%.2F w', $lw * $this->_scale)); /* Force the setting of the font. Each new page requires a new * call. */ @@ -976,7 +959,7 @@ class File_PDF { /* Restore styles. */ if ($this->_line_width != $lw) { $this->_line_width = $lw; - $this->_out(sprintf('%.2' . FILE_PDF_FLOAT . ' w', $lw * $this->_scale)); + $this->_out(sprintf('%.2F w', $lw * $this->_scale)); } $result = $this->setFont($font_family, $font_style, $font_size); if (is_a($result, 'PEAR_Error')) { @@ -1097,11 +1080,11 @@ class File_PDF { { $cs = strtolower($cs); if ($cs == 'rgb') { - $this->_fill_color = sprintf('%.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' rg', $c1, $c2, $c3); + $this->_fill_color = sprintf('%.3F %.3F %.3F rg', $c1, $c2, $c3); } elseif ($cs == 'cmyk') { - $this->_fill_color = sprintf('%.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' k', $c1, $c2, $c3, $c4); + $this->_fill_color = sprintf('%.3F %.3F %.3F %.3F k', $c1, $c2, $c3, $c4); } else { - $this->_fill_color = sprintf('%.3' . FILE_PDF_FLOAT . ' g', $c1); + $this->_fill_color = sprintf('%.3F g', $c1); } if ($this->_page > 0) { $this->_out($this->_fill_color); @@ -1139,11 +1122,11 @@ class File_PDF { { $cs = strtolower($cs); if ($cs == 'rgb') { - $this->_text_color = sprintf('%.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' rg', $c1, $c2, $c3); + $this->_text_color = sprintf('%.3F %.3F %.3F rg', $c1, $c2, $c3); } elseif ($cs == 'cmyk') { - $this->_text_color = sprintf('%.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' k', $c1, $c2, $c3, $c4); + $this->_text_color = sprintf('%.3F %.3F %.3F %.3F k', $c1, $c2, $c3, $c4); } else { - $this->_text_color = sprintf('%.3' . FILE_PDF_FLOAT . ' g', $c1); + $this->_text_color = sprintf('%.3F g', $c1); } $this->_color_flag = $this->_fill_color != $this->_text_color; } @@ -1177,11 +1160,11 @@ class File_PDF { { $cs = strtolower($cs); if ($cs == 'rgb') { - $this->_draw_color = sprintf('%.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' RG', $c1, $c2, $c3); + $this->_draw_color = sprintf('%.3F %.3F %.3F RG', $c1, $c2, $c3); } elseif ($cs == 'cmyk') { - $this->_draw_color = sprintf('%.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' %.3' . FILE_PDF_FLOAT . ' K', $c1, $c2, $c3, $c4); + $this->_draw_color = sprintf('%.3F %.3F %.3F %.3F K', $c1, $c2, $c3, $c4); } else { - $this->_draw_color = sprintf('%.3' . FILE_PDF_FLOAT . ' G', $c1); + $this->_draw_color = sprintf('%.3F G', $c1); } if ($this->_page > 0) { $this->_out($this->_draw_color); @@ -1233,7 +1216,7 @@ class File_PDF { { $this->_line_width = $width; if ($this->_page > 0) { - $this->_out(sprintf('%.2' . FILE_PDF_FLOAT . ' w', $width * $this->_scale)); + $this->_out(sprintf('%.2F w', $width * $this->_scale)); } } @@ -1266,7 +1249,7 @@ class File_PDF { $y2 += $this->h; } - $this->_out(sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' m %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' l S', $x1 * $this->_scale, ($this->h - $y1) * $this->_scale, $x2 * $this->_scale, ($this->h - $y2) * $this->_scale)); + $this->_out(sprintf('%.2F %.2F m %.2F %.2F l S', $x1 * $this->_scale, ($this->h - $y1) * $this->_scale, $x2 * $this->_scale, ($this->h - $y2) * $this->_scale)); } /** @@ -1313,7 +1296,7 @@ class File_PDF { $width = $this->_toPt($width); $height = $this->_toPt($height); - $this->_out(sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' re %s', $x, $this->hPt - $y, $width, -$height, $op)); + $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s', $x, $this->hPt - $y, $width, -$height, $op)); } /** @@ -1360,10 +1343,10 @@ class File_PDF { /* Move from the given origin and set the current point * to the start of the first Bezier curve. */ - $c = sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' m', $x - $r, $y); + $c = sprintf('%.2F %.2F m', $x - $r, $y); $x = $x - $r; /* First circle quarter. */ - $c .= sprintf(' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' c', + $c .= sprintf(' %.2F %.2F %.2F %.2F %.2F %.2F c', $x, $y + $b, // First control point. $x + $r - $b, $y + $r, // Second control point. $x + $r, $y + $r); // Final point. @@ -1371,7 +1354,7 @@ class File_PDF { $x = $x + $r; $y = $y + $r; /* Second circle quarter. */ - $c .= sprintf(' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' c', + $c .= sprintf(' %.2F %.2F %.2F %.2F %.2F %.2F c', $x + $b, $y, $x + $r, $y - $r + $b, $x + $r, $y - $r); @@ -1379,7 +1362,7 @@ class File_PDF { $x = $x + $r; $y = $y - $r; /* Third circle quarter. */ - $c .= sprintf(' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' c', + $c .= sprintf(' %.2F %.2F %.2F %.2F %.2F %.2F c', $x, $y - $b, $x - $r + $b, $y - $r, $x - $r, $y - $r); @@ -1387,7 +1370,7 @@ class File_PDF { $x = $x - $r; $y = $y - $r; /* Fourth circle quarter. */ - $c .= sprintf(' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' c %s', + $c .= sprintf(' %.2F %.2F %.2F %.2F %.2F %.2F c %s', $x - $b, $y, $x - $r, $y + $r - $b, $x - $r, $y + $r, @@ -1592,7 +1575,7 @@ class File_PDF { /* Output font information if at least one page has been defined. */ if ($this->_page > 0) { - $this->_out(sprintf('BT /F%d %.2' . FILE_PDF_FLOAT . ' Tf ET', $this->_current_font['i'], $this->_font_size_pt)); + $this->_out(sprintf('BT /F%d %.2F Tf ET', $this->_current_font['i'], $this->_font_size_pt)); } } @@ -1616,7 +1599,7 @@ class File_PDF { /* Output font information if at least one page has been defined. */ if ($this->_page > 0) { - $this->_out(sprintf('BT /F%d %.2' . FILE_PDF_FLOAT . ' Tf ET', $this->_current_font['i'], $this->_font_size_pt)); + $this->_out(sprintf('BT /F%d %.2F Tf ET', $this->_current_font['i'], $this->_font_size_pt)); } } @@ -1757,7 +1740,7 @@ class File_PDF { /* Escape any potentially harmful characters. */ $text = $this->_escape($text); - $out = sprintf('BT %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' Td (%s) Tj ET', $x, $y, $text); + $out = sprintf('BT %.2F %.2F Td (%s) Tj ET', $x, $y, $text); if ($this->_underline && $text != '') { $out .= ' ' . $this->_doUnderline($x, $y, $text); } @@ -1855,7 +1838,7 @@ class File_PDF { $this->x = $x; if ($ws > 0) { $this->_word_spacing = $ws; - $this->_out(sprintf('%.3' . FILE_PDF_FLOAT . ' Tw', $ws * $k)); + $this->_out(sprintf('%.3F Tw', $ws * $k)); } } if ($width == 0) { @@ -1868,20 +1851,20 @@ class File_PDF { } else { $op = 'S'; } - $s = sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' re %s ', $this->x * $k, ($this->h - $this->y) * $k, $width * $k, -$height * $k, $op); + $s = sprintf('%.2F %.2F %.2F %.2F re %s ', $this->x * $k, ($this->h - $this->y) * $k, $width * $k, -$height * $k, $op); } if (is_string($border)) { if (strpos($border, 'L') !== false) { - $s .= sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' m %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' l S ', $this->x * $k, ($this->h - $this->y) * $k, $this->x * $k, ($this->h - ($this->y + $height)) * $k); + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $this->x * $k, ($this->h - $this->y) * $k, $this->x * $k, ($this->h - ($this->y + $height)) * $k); } if (strpos($border, 'T') !== false) { - $s .= sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' m %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' l S ', $this->x * $k, ($this->h - $this->y) * $k, ($this->x + $width) * $k, ($this->h - $this->y) * $k); + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $this->x * $k, ($this->h - $this->y) * $k, ($this->x + $width) * $k, ($this->h - $this->y) * $k); } if (strpos($border, 'R') !== false) { - $s .= sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' m %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' l S ', ($this->x + $width) * $k, ($this->h - $this->y) * $k, ($this->x + $width) * $k, ($this->h - ($this->y + $height)) * $k); + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', ($this->x + $width) * $k, ($this->h - $this->y) * $k, ($this->x + $width) * $k, ($this->h - ($this->y + $height)) * $k); } if (strpos($border, 'B') !== false) { - $s .= sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' m %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' l S ', $this->x * $k, ($this->h - ($this->y + $height)) * $k, ($this->x + $width) * $k, ($this->h - ($this->y + $height)) * $k); + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $this->x * $k, ($this->h - ($this->y + $height)) * $k, ($this->x + $width) * $k, ($this->h - ($this->y + $height)) * $k); } } if ($text != '') { @@ -1900,7 +1883,7 @@ class File_PDF { $test1 = $this->fhPt - (($this->y + $test2) * $k); $x = ($this->x + $dx) * $k; $y = ($this->h - ($this->y + .5 * $height + .3 * $this->_font_size)) * $k; - $s .= sprintf('BT %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' Td (%s) Tj ET', $x, $y, $text); + $s .= sprintf('BT %.2F %.2F Td (%s) Tj ET', $x, $y, $text); if ($this->_underline) { $s .= ' ' . $this->_doUnderline($x, $y, $text); } @@ -2054,7 +2037,7 @@ class File_PDF { $this->_word_spacing = ($ns>1) ? ($wmax - $ls) / 1000 * $this->_font_size / ($ns - 1) : 0; - $this->_out(sprintf('%.3' . FILE_PDF_FLOAT . ' Tw', + $this->_out(sprintf('%.3F Tw', $this->_word_spacing * $this->_scale)); } $result = $this->cell($width, $height, @@ -2250,7 +2233,7 @@ class File_PDF { $font_dx = cos($font_angle); $font_dy = sin($font_angle); - $s= sprintf('BT %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' Tm (%s) Tj ET', + $s= sprintf('BT %.2F %.2F %.2F %.2F %.2F %.2F Tm (%s) Tj ET', $text_dx, $text_dy, $font_dx, $font_dy, $x * $this->_scale, ($this->h-$y) * $this->_scale, $text); @@ -2364,7 +2347,7 @@ class File_PDF { $height = $width * $info['h'] / $info['w']; } - $this->_out(sprintf('q %.2' . FILE_PDF_FLOAT . ' 0 0 %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' cm /I%d Do Q', $width, $height, $x, $y - $height, $info['i'])); + $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q', $width, $height, $x, $y - $height, $info['i'])); /* Set any link if requested. */ if ($link) { @@ -2660,21 +2643,21 @@ class File_PDF { $this->_out('<_out('/Parent 1 0 R'); if (isset($this->_orientation_changes[$n])) { - $this->_out(sprintf('/MediaBox [0 0 %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ']', $hPt, $wPt)); + $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]', $hPt, $wPt)); } $this->_out('/Resources 2 0 R'); if (isset($this->_page_links[$n])) { /* Links */ $annots = '/Annots ['; foreach ($this->_page_links[$n] as $pl) { - $rect = sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . '', $pl[0], $pl[1], $pl[0] + $pl[2], $pl[1] - $pl[3]); + $rect = sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0] + $pl[2], $pl[1] - $pl[3]); $annots .= '<_textString($pl[4]) . '>>>>'; } else { $l = $this->_links[$pl[4]]; $height = isset($this->_orientation_changes[$l[0]]) ? $wPt : $hPt; - $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2' . FILE_PDF_FLOAT . ' null]>>', 1 + 2 * $l[0], $height - $l[1] * $this->_scale); + $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>', 1 + 2 * $l[0], $height - $l[1] * $this->_scale); } } $this->_out($annots . ']'); @@ -2698,7 +2681,7 @@ class File_PDF { } $this->_out($kids . ']'); $this->_out('/Count ' . $nb); - $this->_out(sprintf('/MediaBox [0 0 %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ']', $wPt, $hPt)); + $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]', $wPt, $hPt)); $this->_out('>>'); $this->_out('endobj'); } @@ -3007,7 +2990,7 @@ class File_PDF { $y = $y + ($this->_current_font['up'] * $this->_font_size_pt / 1000); $height = -$this->_current_font['ut'] * $this->_font_size_pt / 1000; - return sprintf('%.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' re f', $x, $y, $width, $height); + return sprintf('%.2F %.2F %.2F %.2F re f', $x, $y, $width, $height); } function _parseJPG($file) diff --git a/framework/Kolab_Filter/lib/Horde/Kolab/Filter/Transport/LMTPTLS.php b/framework/Kolab_Filter/lib/Horde/Kolab/Filter/Transport/LMTPTLS.php index c1b9abc00..262eaf84d 100644 --- a/framework/Kolab_Filter/lib/Horde/Kolab/Filter/Transport/LMTPTLS.php +++ b/framework/Kolab_Filter/lib/Horde/Kolab/Filter/Transport/LMTPTLS.php @@ -3,9 +3,6 @@ * @package Kolab_Filter */ -/* Require the base class */ -require_once 'Net/LMTP.php'; - /** * Extended LMTP class with support for TLS. * @@ -33,29 +30,25 @@ class Net_LMTP_TLS extends Net_LMTP { */ function auth($uid, $pwd , $method = '') { - if (version_compare(PHP_VERSION, '5.1.0', '>=')) { - if (!isset($this->_esmtp['STARTTLS'])) { - return PEAR::raiseError('LMTP server does not support authentication'); - } - if (PEAR::isError($result = $this->_put('STARTTLS'))) { - return $result; - } - if (PEAR::isError($result = $this->_parseResponse(220))) { - return $result; - } - if (PEAR::isError($result = $this->_socket->enableCrypto(true, STREAM_CRYPTO_METHOD_TLS_CLIENT))) { - return $result; - } - elseif ($result !== true) { - return PEAR::raiseError('STARTTLS failed'); - } + if (!isset($this->_esmtp['STARTTLS'])) { + return PEAR::raiseError('LMTP server does not support authentication'); + } + if (PEAR::isError($result = $this->_put('STARTTLS'))) { + return $result; + } + if (PEAR::isError($result = $this->_parseResponse(220))) { + return $result; + } + if (PEAR::isError($result = $this->_socket->enableCrypto(true, STREAM_CRYPTO_METHOD_TLS_CLIENT))) { + return $result; + } elseif ($result !== true) { + return PEAR::raiseError('STARTTLS failed'); + } - /* Send LHLO again to recieve the AUTH string from the - * LMTP server. */ - $this->_negotiate(); - if (empty($this->_esmtp['AUTH'])) { - return PEAR::raiseError('LMTP server does not support authentication'); - } + /* Send LHLO again to recieve the AUTH string from the LMTP server. */ + $this->_negotiate(); + if (empty($this->_esmtp['AUTH'])) { + return PEAR::raiseError('LMTP server does not support authentication'); } /* @@ -66,7 +59,7 @@ class Net_LMTP_TLS extends Net_LMTP { if (PEAR::isError($method = $this->_getBestAuthMethod())) { /* Return the PEAR_Error object from _getBestAuthMethod(). */ return $method; - } + } } else { $method = strtoupper($method); } @@ -84,7 +77,7 @@ class Net_LMTP_TLS extends Net_LMTP { case 'PLAIN': $result = $this->_authPlain($uid, $pwd); break; - default : + default : $result = new PEAR_Error("$method is not a supported authentication method"); break; } diff --git a/framework/Rpc/lib/Horde/Rpc/Phpgw.php b/framework/Rpc/lib/Horde/Rpc/Phpgw.php index 103eab6ff..7b14abe97 100644 --- a/framework/Rpc/lib/Horde/Rpc/Phpgw.php +++ b/framework/Rpc/lib/Horde/Rpc/Phpgw.php @@ -84,18 +84,9 @@ class Horde_Rpc_Phpgw extends Horde_Rpc // Try to resume a session if (isset($params[0]['kp3']) && $params[0]["kp3"] == session_name() && session_id() != $params[0]["sessionid"]) { Horde::logMessage("manually reload session ".$params[0]["sessionid"], __FILE__, __LINE__, PEAR_LOG_NOTICE); - // Make sure to force a completely new session ID and clear - // all session data. - if (version_compare(PHP_VERSION, '4.3.3') !== -1) { - session_regenerate_id(); - session_unset(); - session_id($params[0]["sessionid"]); - } else { - @session_destroy(); - session_id($params[0]["sessionid"]); - Horde_Registry::setupSessionHandler(); - session_start(); - } + session_regenerate_id(); + session_unset(); + session_id($params[0]["sessionid"]); } // Be authenticated or call system.login. diff --git a/framework/Template/test/Horde/Template/iterator.phpt b/framework/Template/test/Horde/Template/iterator.phpt index c79b0dd38..9b31d8911 100644 --- a/framework/Template/test/Horde/Template/iterator.phpt +++ b/framework/Template/test/Horde/Template/iterator.phpt @@ -1,11 +1,5 @@ --TEST-- Iterator Test ---SKIPIF-- - --FILE-- sivtestSocket($this->_params['username'], $this->_params['password'], $this->_params['hostspec']); - if (substr(PHP_VERSION, 0, 1) == '5') { - $domain_socket = 'unix://' . $this->_params['socket']; - } else { - $domain_socket = $this->_params['socket']; - } + $domain_socket = 'unix://' . $this->_params['socket']; $this->_sieve = new Net_Sieve($this->_params['username'], $this->_params['password'], @@ -137,11 +133,7 @@ class Ingo_Driver_Sivtest extends Ingo_Driver $command .= 'KRB5CCNAME=' . $_SERVER['KRB5CCNAME']; } - if (substr(PHP_VERSION, 0, 1) == '5') { - $domain_socket = 'unix://' . $this->_params['socket']; - } else { - $domain_socket = $this->_params['socket']; - } + $domain_socket = 'unix://' . $this->_params['socket']; $command .= ' ' . $this->_params['command'] . ' -m ' . $this->_params['logintype'] diff --git a/koward/www/horde/config/nls.php.dist b/koward/www/horde/config/nls.php.dist index a602b28cd..0baa4af7e 100644 --- a/koward/www/horde/config/nls.php.dist +++ b/koward/www/horde/config/nls.php.dist @@ -61,7 +61,7 @@ $nls['languages']['sl_SI'] = '‭Slovenian (Slovenščina)'; $nls['languages']['fi_FI'] = 'Suomi'; $nls['languages']['sv_SE'] = 'Svenska'; $nls['languages']['th_TH'] = '‭Thai (ไทย)'; -if (version_compare(PHP_VERSION, '5', 'lt') || version_compare(PHP_VERSION, '6', 'ge')) { +if (version_compare(PHP_VERSION, '6', 'ge')) { $nls['languages']['tr_TR'] = 'Türkçe'; } $nls['languages']['uk_UA'] = '‭Ukrainian (Українська)'; @@ -108,7 +108,7 @@ $nls['aliases']['sk'] = 'sk_SK'; $nls['aliases']['sl'] = 'sl_SI'; $nls['aliases']['sv'] = 'sv_SE'; $nls['aliases']['th'] = 'th_TH'; -if (version_compare(PHP_VERSION, '5', 'lt') || version_compare(PHP_VERSION, '6', 'ge')) { +if (version_compare(PHP_VERSION, '6', 'ge')) { $nls['aliases']['tr'] = 'tr_TR'; } $nls['aliases']['uk'] = 'uk_UA'; @@ -141,7 +141,7 @@ $nls['charsets']['ru_RU.KOI8-R'] = 'KOI8-R'; $nls['charsets']['sk_SK'] = 'ISO-8859-2'; $nls['charsets']['sl_SI'] = 'ISO-8859-2'; $nls['charsets']['th_TH'] = 'TIS-620'; -if (version_compare(PHP_VERSION, '5', 'lt') || version_compare(PHP_VERSION, '6', 'ge')) { +if (version_compare(PHP_VERSION, '6', 'ge')) { $nls['charsets']['tr_TR'] = 'ISO-8859-9'; } $nls['charsets']['uk_UA'] = 'windows-1251'; @@ -174,8 +174,7 @@ if (strpos(PHP_OS, 'BSD') !== false) { $nls['charsets']['sk_SK'] = 'ISO8859-2'; $nls['charsets']['sl_SI'] = 'ISO8859-2'; $nls['charsets']['th_TH'] = 'TIS-620'; - if (version_compare(PHP_VERSION, '5', 'lt') || - version_compare(PHP_VERSION, '6', 'ge')) { + if (version_compare(PHP_VERSION, '6', 'ge')) { $nls['charsets']['tr_TR'] = 'ISO-8859-9'; } $nls['charsets']['uk_UA'] = 'windows-1251'; -- 2.11.0