]> git.mxchange.org Git - core.git/commitdiff
Some hacks for missing extensions and XP:
authorRoland Häder <roland@mxchange.org>
Wed, 14 Mar 2012 14:09:17 +0000 (14:09 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 14 Mar 2012 14:09:17 +0000 (14:09 +0000)
- used mb_convert_encoding() as fall-back solution if extension recode is not
  found.
- At least on my XP box at work 'COMPUTERNAME' did work

inc/classes/main/console/class_ConsoleTools.php
inc/classes/main/filter/class_FilterChain.php
inc/classes/main/parser/xml/class_XmlParser.php

index ef97485be4fa72e2f131e9d866d108610800b503..e6fdfda88f226b1485a4470b85da879c99b68848 100644 (file)
@@ -110,6 +110,9 @@ class ConsoleTools extends BaseFrameworkSystem {
                        if (isset($_SERVER['SESSION_SVR'])) {
                                // Resolve it
                                $ip = $helperInstance->resolveIpAddress($_SERVER['SESSION_SVR']);
+                       } elseif (isset($_SERVER['COMPUTERNAME'])) {
+                               // May happen on some XP systems, so also try this
+                               $ip = $helperInstance->resolveIpAddress($_SERVER['COMPUTERNAME']);
                        } else {
                                // Could not find our hostname
                                $helperInstance->debugOutput(sprintf("[%s:] WARNING: Cannot resolve my own IP address.",
index dcdb882c14cb927d82f285fd2eb6a9944d5bbd46..dcc94f4e5fa6f82f169cb7c54c3e2dee883f089c 100644 (file)
@@ -69,15 +69,16 @@ class FilterChain extends BaseFrameworkSystem {
         */
        public function processFilters (Requestable $requestInstance, Responseable $responseInstance) {
                // Run all filters
-               //* DEBUG */ echo "COUNT=".count($this->filters)."<br />\n";
+               //* DEBUG */ $this->debugOutput('COUNT=' . count($this->filters));
                foreach ($this->filters as $filterInstance) {
                        // Try to execute this filter
                        try {
-                               //* DEBUG */ echo "FILTER: ".$filterInstance->__toString().": Processing started.<br />\n";
+                               //* DEBUG */ $this->debugOutput('FILTER: ' . $filterInstance->__toString() . ': Processing started.');
                                $filterInstance->execute($requestInstance, $responseInstance);
-                               //* DEBUG */ echo "FILTER: ".$filterInstance->__toString().": Processing ended.<br />\n";
+                               //* DEBUG */ $this->debugOutput('FILTER: ' . $filterInstance->__toString() . ': Processing ended.');
                        } catch (FilterChainException $e) {
                                // This exception can be thrown to just skip any further processing
+                               $this->debugOutput('Failed to execute lase filter ' . $filterInstance->__toString() . ': ' . $e->getMessage());
                                break;
                        }
                } // END - foreach
index fa674b5369ef662592721679b1bd058977ee48f6..ce5c0a9be5c71c61b861064ddb13c11a2205e0f4 100644 (file)
@@ -72,9 +72,12 @@ class XmlParser extends BaseParser implements Parseable {
                } elseif (function_exists('recode')) {
                        // Recode found, so use it
                        $content = recode('html..utf8', $content);
+               } elseif (function_exists('mb_convert_encoding')) {
+                       // Use mb_convert_encoding()
+                       $content = mb_convert_encoding($content, 'UTF-8', 'auto');
                } else {
                        // @TODO We need to find a fallback solution here
-                       $this->partialStub('Cannot find recode extension!');
+                       $this->partialStub('Cannot find recode/mbstring extension!');
                } // END - if
 
                // Get an XML parser