From e2c8d89e410c0724ecd0ee0a7f7a1e64e8ca2f93 Mon Sep 17 00:00:00 2001 From: rMalie Date: Tue, 2 Aug 2011 11:43:58 +0000 Subject: [PATCH] // Merge with revision 7841 --- CHANGELOG | 263 + admin-dev/ajax.php | 8 +- admin-dev/header.inc.php | 4 +- admin-dev/login.php | 2 +- admin-dev/tabs/AdminAttributes.php | 8 + admin-dev/tabs/AdminCountries.php | 6 +- admin-dev/tabs/AdminImport.php | 2 +- admin-dev/tabs/AdminPPreferences.php | 3 +- admin-dev/tabs/AdminPreferences.php | 13 +- admin-dev/tabs/AdminProducts.php | 8 +- admin-dev/tabs/AdminStores.php | 2 +- admin-dev/tabs/AdminUpgrade.php | 86 +- admin-dev/themes/flashyturtle/admin.css | 6 +- admin-dev/themes/flashyturtle/bg-submenu.png | Bin 0 -> 153 bytes admin-dev/themes/oldschool/admin.css | 4 +- admin-dev/themes/origins/admin.css | 6 +- admin-dev/themes/origins/bg-submenu.png | Bin 0 -> 190 bytes classes/Carrier.php | 33 +- classes/FrontController.php | 6 +- classes/Image.php | 3 + classes/PaymentModule.php | 3 +- classes/Product.php | 42 +- controllers/AddressController.php | 8 +- controllers/AuthController.php | 11 +- controllers/OrderOpcController.php | 7 +- img/t/AdminUpgrade.gif | Bin 0 -> 349 bytes install-dev/img/bg_input_button.png | Bin 0 -> 141 bytes install-dev/index.php | 4 +- install-dev/model.php | 1 - install-dev/preactivation.php | 10 +- install-dev/sql/db_settings_lite.sql | 13 +- install-dev/sql/upgrade/1.4.5.0.sql | 14 + install-dev/view.css | 10 +- install-dev/xml/checkShopInfos.php | 4 +- modules/blockcustomerprivacy/es.php | 13 + modules/blocklayered/es.php | 77 +- modules/blocklink/config.xml | 2 +- modules/canadapost/canadapost.php | 1691 ++++ modules/canadapost/carrier.jpg | Bin 0 -> 6661 bytes modules/canadapost/config.xml | 12 + .../kit_mondialrelay => canadapost}/index.php | 2 +- modules/canadapost/logo.gif | Bin 0 -> 1005 bytes modules/canadapost/sql-install.php | 81 + modules/canadapost/sql-uninstall.php | 9 + modules/canadapost/xml-package.tpl | 8 + modules/canadapost/xml.tpl | 16 + modules/ebay/ebay.php | 109 +- modules/ebay/es.php | 80 + modules/fedexcarrier/es.php | 8 + modules/followup/followup.php | 8 +- modules/gcheckout/es.php | 4 +- modules/hipay/es.php | 5 + modules/loyalty/es.php | 10 +- modules/mondialrelay/AdminMondialRelay.php | 2 +- modules/mondialrelay/ajax.php | 24 +- modules/mondialrelay/classes/JSMin.php | 314 + .../mondialrelay/classes/MRCreateTickets.php | 21 +- .../mondialrelay/classes/MRGetRelayPoint.php | 238 + modules/mondialrelay/classes/MRGetTickets.php | 2 - modules/mondialrelay/classes/MRManagement.php | 85 +- modules/mondialrelay/classes/MRTools.php | 67 + modules/mondialrelay/config.xml | 2 +- modules/mondialrelay/cron.php | 2 +- modules/mondialrelay/de.php | 5 - modules/mondialrelay/es.php | 5 - modules/mondialrelay/fr.php | 5 - modules/mondialrelay/googlemap.php | 120 - .../mondialrelay/images/selectRelayPoint.png | Bin 0 -> 2139 bytes modules/mondialrelay/it.php | 10 +- modules/mondialrelay/js/gmap.js | 2126 +++++ modules/mondialrelay/kit_mondialrelay/MR.gif | Bin 1756 -> 0 bytes .../kit_mondialrelay/MR_small.gif | Bin 797 -> 0 bytes .../RechercheDetailPointRelais_ajax.php | 151 - .../RecherchePointRelais_ajax.php | 101 - .../kit_mondialrelay/SuiviExpedition_ajax.php | 6 - .../mondialrelay/kit_mondialrelay/close.gif | Bin 246 -> 0 bytes .../kit_mondialrelay/js/include_MR.js | 56 - .../kit_mondialrelay/js/index.php | 36 - .../kit_mondialrelay/js/ressources_MR.js | 344 - .../mondialrelay/kit_mondialrelay/loading.gif | Bin 6494 -> 0 bytes .../mondialrelay/kit_mondialrelay/loupe.gif | Bin 1756 -> 0 bytes .../mondialrelay/kit_mondialrelay/marker.gif | Bin 1196 -> 0 bytes .../kit_mondialrelay/mr_opc_ajax.php | 27 - .../kit_mondialrelay/tools/index.php | 36 - .../kit_mondialrelay/tools/nusoap/index.php | 36 - .../tools/nusoap/lib/class.nusoap_base.php | 995 -- .../tools/nusoap/lib/class.soap_fault.php | 89 - .../tools/nusoap/lib/class.soap_parser.php | 642 -- .../tools/nusoap/lib/class.soap_server.php | 1126 --- .../nusoap/lib/class.soap_transport_http.php | 1306 --- .../tools/nusoap/lib/class.soap_val.php | 106 - .../tools/nusoap/lib/class.soapclient.php | 991 -- .../tools/nusoap/lib/class.wsdl.php | 1937 ---- .../tools/nusoap/lib/class.wsdlcache.php | 209 - .../tools/nusoap/lib/class.xmlschema.php | 972 -- .../tools/nusoap/lib/index.php | 36 - .../tools/nusoap/lib/nusoap.php | 8148 ----------------- .../tools/nusoap/lib/nusoapmime.php | 501 - modules/mondialrelay/logo_hd.png | Bin 0 -> 2996 bytes modules/mondialrelay/mondialrelay.js | 517 +- modules/mondialrelay/mondialrelay.php | 369 +- modules/mondialrelay/mondialrelay.tpl | 90 +- modules/mondialrelay/style.css | 135 + modules/moneybookers/es.php | 9 + modules/moneybookers/moneybookers.php | 14 +- modules/pagesnotfound/fr.php | 1 + modules/pagesnotfound/pagesnotfound.php | 12 +- modules/paypal/paypal.php | 5 +- modules/paypal/standard/paypal.tpl | 2 +- modules/prestafraud/prestafraud.php | 4 +- modules/shopimporter/es.php | 3 + modules/socolissimo/es.php | 2 +- modules/themeinstallator/es.php | 1 - modules/themeinstallator/fr.php | 1 - modules/trustedshops/es.php | 12 +- modules/upscarrier/es.php | 6 +- modules/uspscarrier/es.php | 6 +- readme_de.txt | 24 +- readme_it.txt | 2 +- themes/prestashop/css/comparator.css | 82 +- themes/prestashop/css/global.css | 3 +- themes/prestashop/lang/es.php | 2 +- themes/prestashop/order-opc-new-account.tpl | 2 +- themes/prestashop/products-comparison.tpl | 2 - translations/en/admin.php | 2 +- translations/es/admin.php | 238 +- translations/es/errors.php | 12 +- translations/es/fields.php | 10 + translations/es/pdf.php | 1 + translations/fr/admin.php | 32 +- 130 files changed, 6620 insertions(+), 18585 deletions(-) create mode 100644 admin-dev/themes/flashyturtle/bg-submenu.png create mode 100644 admin-dev/themes/origins/bg-submenu.png create mode 100644 img/t/AdminUpgrade.gif create mode 100755 install-dev/img/bg_input_button.png create mode 100644 install-dev/sql/upgrade/1.4.5.0.sql create mode 100644 modules/blockcustomerprivacy/es.php create mode 100755 modules/canadapost/canadapost.php create mode 100644 modules/canadapost/carrier.jpg create mode 100755 modules/canadapost/config.xml rename modules/{mondialrelay/kit_mondialrelay => canadapost}/index.php (96%) mode change 100644 => 100755 create mode 100644 modules/canadapost/logo.gif create mode 100755 modules/canadapost/sql-install.php create mode 100755 modules/canadapost/sql-uninstall.php create mode 100755 modules/canadapost/xml-package.tpl create mode 100755 modules/canadapost/xml.tpl create mode 100755 modules/mondialrelay/classes/JSMin.php create mode 100755 modules/mondialrelay/classes/MRGetRelayPoint.php create mode 100755 modules/mondialrelay/classes/MRTools.php delete mode 100755 modules/mondialrelay/googlemap.php create mode 100755 modules/mondialrelay/images/selectRelayPoint.png create mode 100644 modules/mondialrelay/js/gmap.js delete mode 100755 modules/mondialrelay/kit_mondialrelay/MR.gif delete mode 100755 modules/mondialrelay/kit_mondialrelay/MR_small.gif delete mode 100755 modules/mondialrelay/kit_mondialrelay/RechercheDetailPointRelais_ajax.php delete mode 100755 modules/mondialrelay/kit_mondialrelay/RecherchePointRelais_ajax.php delete mode 100755 modules/mondialrelay/kit_mondialrelay/SuiviExpedition_ajax.php delete mode 100755 modules/mondialrelay/kit_mondialrelay/close.gif delete mode 100755 modules/mondialrelay/kit_mondialrelay/js/include_MR.js delete mode 100644 modules/mondialrelay/kit_mondialrelay/js/index.php delete mode 100755 modules/mondialrelay/kit_mondialrelay/js/ressources_MR.js delete mode 100755 modules/mondialrelay/kit_mondialrelay/loading.gif delete mode 100755 modules/mondialrelay/kit_mondialrelay/loupe.gif delete mode 100755 modules/mondialrelay/kit_mondialrelay/marker.gif delete mode 100644 modules/mondialrelay/kit_mondialrelay/mr_opc_ajax.php delete mode 100644 modules/mondialrelay/kit_mondialrelay/tools/index.php delete mode 100644 modules/mondialrelay/kit_mondialrelay/tools/nusoap/index.php delete mode 100755 modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.nusoap_base.php delete mode 100755 modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_fault.php delete mode 100755 modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_parser.php delete mode 100755 modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_server.php delete mode 100755 modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_transport_http.php delete mode 100755 modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_val.php delete mode 100755 modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soapclient.php delete mode 100755 modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.wsdl.php delete mode 100755 modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.wsdlcache.php delete mode 100755 modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.xmlschema.php delete mode 100644 modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/index.php delete mode 100755 modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/nusoap.php delete mode 100755 modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/nusoapmime.php create mode 100755 modules/mondialrelay/logo_hd.png diff --git a/CHANGELOG b/CHANGELOG index 173f8906e..93ba9f810 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -33,6 +33,269 @@ Release Notes for PrestaShop 1.4 [+] FO : add dispatcher +#################################### +# v1.4.4.0 - 7803 (2011-07-28) # +#################################### + + Added Features: + + [+] Project : adding RTL language management + + [+] BO : new class Upgrader to check PrestaShop version or download last version. + [+] BO : new file ajax-tab.php, you can now make request without ajax.php and handle them directly in the appropriate AdminXXX + [+] BO : new tab AdminUpgrade can now automatize the upgrade process. Thanks a lot to Broceliande/Eric Dolou for his great help + + [+] CORE : Add the possibility to personalize an address layout with special chars. + + [+] MO : A better view of the currency used by the module. + [+] MO : Fetch content use more than one method (CURL, fopen, fsockopen and file_get_content) + [+] MO : Moneybookers, Add the possibility to display the logo in the front Office (works with live edit). + [+] MO : New Module - Canada Post (0.1) + [+] MO : new module dedicated to german users which enable you to display legal notice on the customer account creation + + Improved/changed features: + + [*] Installer : improve installer template + [*] Installer : now class ConfigurationTest is located in classes directory and renamed to ConfigurationTestCore + [*] Installer : now method tryToConnect don't use an existing ressource except if specified + [*] Installer : php directory is now directly related to INSTALL_DIR + + [*] FO : #PSCFI-2691 - Adding index.php file for redirection + [*] FO : CC-24 - Adding previous button for the address creation + [*] FO : CC-32 - Adding a checkbox for the displaying of "Powered by PS" + [*] FO : CC-93 - Review of the compare product system + [*] FO : CC-93 - Review of the compare product system. Adding CompareProduct class + [*] FO : Change the id "passwd" by "login_passwd" to avoid ambiguous id in OPC ordering (with guest authorization). + [*] FO : Fixed #PSCFI-2176 - now you can use vars in your mail subject + [*] FO : Update the jquery.cluetip.js library. From V0.9.9 to V1.1.3 + + [*] BO : Add option to disable apache option multiviews. Linked with #PSCFI-2597 + [*] BO : Added check for safe_mode before activating new image system + [*] BO : Added compatibility check before moving images to the new filesystem + [*] BO : AdminTab childs can now handle ajax request like index.php (with tab and token params) using specific method ajaxProcess + [*] BO : Bug Fixed #PSCFI-2282 - Shipping Prices Range with a tax excluded group + [*] BO : CC-108 - Remove informations about stocks in AdminProducts when the stock management is disabled + [*] BO : CC-26 - Adding German and Italian translations + [*] BO : CC-26 - Rename Alias Tab as Alias Research + [*] BO : CC-50 - Increasing the size of the description area + [*] BO : CC-99 - Better visibility for the delete module button + [*] BO : FA-35 - Changing manufacturer translation in French for the BO. Replaced "fabricant" by "marque" + [*] BO : FA-35 - Changing manufacturer translation in French for the BO. Replaced "fabricant" by "marque" + [*] BO : Fixed bug PSCFI-2416 - The whole search index is not rewritten when you update a single product + [*] BO : It is now possible to edit the field date_add with AdminImport + [*] BO : Upgrader class now also check if autoupgrade is indicated for the last version, from http://www.prestashop.com/xml/version.xml + [*] BO : added alert if attachment is bind to a product + [*] BO : backup directory is now a static definition in Backup class + [*] BO : improve CSV import when no csv file is available + [*] BO : improve category listing in product edition and loyalty module + [*] BO : improved Upgrader to check ps version + [*] BO : improved backup class + [*] BO : refactoring #PSCFI-2458 - AdminCarrier when Zone disabled & overcomplex processing ( Carrier ) + [*] BO : the new image filesystem is now entirely deactivated when the legacy setting is activated + + [*] Classes : improvement #PSCFI-2278 - Don't die in Mail::send() method + [*] Classes : improvement #PSCFI-2278 - refactoring + [*] Classes : improvement #PSCFI-2440 - Tools class improvements + + [*] MO : Adding traduction for blockcms + [*] MO : New Admin Panel for "Layered Navigation" module, "Build your own template" feature! + [*] MO : Now use the variable Calcul_mode in the hash of the cache + [*] MO : Numerous bugs fixed for the "Layered Navigation" module + [*] MO : Numerous bugs fixed for the "Layered Navigation" module + [*] MO : Translations and changes on TrustedShop module + [*] MO : Translations and changes on TrustedShop module (part 2) + [*] MO : Upgrade on the UPS module (from enigma32, thx to him :) + [*] MO : Upgrade on the USPS module (from enigma32, thx to him :) + [*] MO : Upgrade on the fedex module (from enigma32, thx to him :) + [*] MO : stats live performance improvment - PSCFI-2080 + [*] MO : you can now hook blockpermanentlinks on the footer + + [*] WS : Add new feature for date_add/date_upd, PSCFI-2380 + [*] WS : Allow to change Webservice permission behavior + + Fixed bugs: + + [-] PROJECT : Fix template mail for new layout system + + [-] INSTALLER : CSS Preactivation + [-] Installer : Remove a bad space + [-] Installer : fix error about version number (1.4.3.0 included when current version is 1.4.3) + [-] Installer : fixed Tools::checkDb method when class Validate, DD or MySQL are already loaded + [-] Installer : fixed a bug in add_missing_rewrite_value.php + [-] Installer : log is now working correctly + + [-] FO : Bug Fixed #PSCFI-2520 - Attribute EcoTax not correctly applied + [-] FO : Bug Fixed #PSCFI-2725 Incorrect VAT address + [-] FO : Bug Fixed #PSCFI-2734 - Quantity prices not displayed correctly when changing currency + [-] FO : BugFix #36138 - Problem with product preview and url rewrite + [-] FO : BugFix #PSCFI-2382 - Reductions without end dates are not possible + [-] FO : BugFix #PSCFI-2382 - Reductions without end dates are not possible + [-] FO : BugFix #PSCFI-2386 - Invalid argument supplied for foreach() + [-] FO : BugFix #PSCFI-2402 - Product::getDefaultAttribute is wrong when all attributes quantity less than minimumQuantity + [-] FO : BugFix #PSCFI-2487 - Save and preview shows blank page if CCC is enabled + [-] FO : BugFix #PSCFI-2498 - Problems with .htaccess + [-] FO : BugFix #PSCFI-2537 - RMA not opening/showing content + [-] FO : BugFix #PSCFI-2537 - RMA not opening/showing content + [-] FO : Fix product sort for Smarty 2 + [-] FO : Fix undefined json variable in opc when an user select a product and want to be identified. + [-] FO : Fixed #PSCFI-2144 - wrong url params, ? instead of & + [-] FO : Fixed Bug #PSCFI-2726, Display properly the text depending of the recyclable preference option. + [-] FO : Fixed bug #PSCFI-2003 - "Next" button is hidden in scenes slider on FO + [-] FO : Fixed bug #PSCFI-2099. Country and state are properly displayed when another invoice address is selected + [-] FO : Fixed bug #PSCFI-2316 - there was a notice when you added a product without image to your cart + [-] FO : Fixed bug #PSCFI-2393 - After copying language files forwards to frontend with error msg + [-] FO : Fixed bug #PSCFI-2417, The compatibility with recent theme under older Prestashop version (< 1.4.2) works. + [-] FO : Fixed bug #PSCFI-2662 - Empty script block in order-detail.tpl + [-] FO : Problem with .htaccess + [-] FO : fixed bug #PSCFI-2299 - Default-home image location + [-] FO : fixed bug #PSCFI-2310 - carrier disabled in OPC + [-] FO : fixed bug #PSCFI-2326 - fixed smarty error with Smarty 2 + [-] FO : fixed bug #PSCFI-2348 - bug in order-opc.js 1.4.3 + [-] FO : fixed bug #PSCFI-2406 - Redirect index file for created image folders + [-] FO : fixed bug #PSCFI-2408 - invalid date producttooltip module + [-] FO : fixed bug #PSCFI-2464 - manufacturers and suppliers blocks should not display products in inactive categories + [-] FO : fixed bug #PSCFI-2493 - One page checkout, "undefined" DNI + [-] FO : fixed bug #PSCFI-2502 - The clicking "Continue shopping" on Shopping cart summary is not working properly. + [-] FO : fixed bug #PSCFI-2735 - Order manipulation possible after payment method selection + [-] FO : fixed bug with guest checkout + [-] FO : fixed notice error on One page checkout with Blocknewsletter module + + [-] BO : "alias" tab name is too long + [-] BO : Bug Fixed #PSCFI-2368 - Disable ecotax and ecotax is still present on the front office + [-] BO : BugFix #PSCFI-1903 - Problem with payment module limited to some countries + [-] BO : BugFix #PSCFI-2420 - AdminImport.php ( import csv ) missing handling for escaped list separator and UTF-8 BOM issue + [-] BO : BugFix #PSCFI-2420 - AdminImport.php ( import csv ) missing handling for escaped list separator and UTF-8 BOM issue + [-] BO : BugFix #PSCFI-2536 - SendMailTest.js does not escape its parameters causing malfunction when trying to send htmlentities (v. 1.4.1.0) + [-] BO : BugFix #PSCFI-2550 - can't give a product an attribute of "0" + [-] BO : BugFix #PSCFI-2568 - Order page display problem: box expands to overlap another box + [-] BO : BugFix #PSCFI-2584 - Orders could have a totals negative + [-] BO : BugFix #PSCFI-2614 - Add new method simplexml_load_file + [-] BO : BugFix #PSCFI-2614 - Bug this localization file + [-] BO : BugFix #PSCFI-2642 - Translation problem with modules + [-] BO : BugFix #PSCFI-2645 - sendtoafriend problem with translation + [-] BO : BugFix #PSCFI-2663 - "New order" email has hardcoded address format + [-] BO : BugFix #PSCFI-2690 - Incorrect closing comment + [-] BO : BugFix #PSCFI-2708 Syntax error (working with PHP 5.3 and more) + [-] BO : BugFix #PSCFI-2767 - Change guest index of product_comment + [-] BO : Fixed Bug #PSCFI-2665, Backup times is now correctly displayed with a H 24 format. + [-] BO : Fixed bug #PSCFI-2379 - Avoid the call of memory_get_usage() if it is not defined + [-] BO : Fixed bug #PSCFI-2379 - Missing token in form action + [-] BO : Fixed bug #PSCFI-2424 - PS_OS_WS_PAYEMENT should be PS_OS_WS_PAYMENT + [-] BO : Fixed bug #PSCFI-2429 - IE9 compatibility problem with upload + [-] BO : Fixed bug #PSCFI-2535 - Losing opening div + [-] BO : Fixed bug #PSCFI-2670 - Increase mime size for attachment from 64 to 128 for support docx file + [-] BO : Fixed bug - Empty the cache in the theme for module overrided + [-] BO : Fixed bug PSCFI-2253 - Error "invalid date" with some version of PHP fixed + [-] BO : Global was missing on AdminThemes + [-] BO : In the search tab, Deleted a function which deleted the first occurrence when the last have the samed value in the "search" field + [-] BO : PNG images are now supported after activation in BO. Backward compatible. + [-] BO : US address format is now correctly displayed for the PDF. + [-] BO : fix call on categoryUpdate hook when we change the status of a category #PSCFI-2669 + [-] BO : fixed bug #PSCFI-2235 - Module panel inoperative after module suppression + [-] BO : fixed bug #PSCFI-2300 - clear useless variable in replaceByAbsoluteURL method + [-] BO : fixed bug #PSCFI-2301 - html /form tag is inside the translatable string + [-] BO : fixed bug #PSCFI-2302 - Product - CSV import: "available for order" and "show price" not available? + [-] BO : fixed bug #PSCFI-2302 - Product - CSV import: "available for order" and "show price" not available? + [-] BO : fixed bug #PSCFI-2303 - in AdminManufacturers.php have a repeated code + [-] BO : fixed bug #PSCFI-2319 - $default_country varaible is missing in AdminProduct + [-] BO : fixed bug #PSCFI-2321 - fixed bug on pagination display on AdminGroups + [-] BO : fixed bug #PSCFI-2322 - fixed bug on product.tpl + [-] BO : fixed bug #PSCFI-2336 - Small typo error in Back Office + [-] BO : fixed bug #PSCFI-2360 - redundant lines in Tools::generateHtaccess() + [-] BO : fixed bug #PSCFI-2365 - "Warning : the secure key is empty, check your payment account before validation" error with FreeOrder module + [-] BO : fixed bug #PSCFI-2366 - Module Bug / "tab cannot be found" on IIS + [-] BO : fixed bug #PSCFI-2421 - watermark does not show on regenerated images + [-] BO : fixed bug #PSCFI-2447 - Button Home is gone after adding new specific price + [-] BO : fixed bug #PSCFI-2455 - Minimum order purchase considers shipping costs + [-] BO : fixed bug #PSCFI-2496 - quantity number in pack option + [-] BO : fixed bug #PSCFI-2507 - AdminProducts undefined variable and non-object PHP notices in Apache log + [-] BO : fixed bug #PSCFI-2533 - image quality button not checked + [-] BO : fixed bug #PSCFI-2706 - fields were not created in database for deactivated languages, causing issues when the language is reactivated + [-] BO : fixed product images zip upload + [-] BO : update jquery colorpicker plugin #PSCFI-2325 + + [-] Classes : added some checks to Image class + [-] Classes : fix moving images to new filesystem when unused images are present + [-] Classes : fixed bug #PSCFI-2005 - Merchandise Returns status emails to customers are BO language dependent + [-] Classes : fixed bug #PSCFI-2234 - Hookexec doesn't properly manage execeptions when passing filename by parameter + [-] Classes : fixed bug #PSCFI-2311 - Function Validate::isUrl has a problem + [-] Classes : fixed bug #PSCFI-2511 - Deleting a product with attachment deletes attachment + [-] Classes : fixed bug #PSCFI-2723 - CLONE - Reductions without end dates are not possible + [-] Classes : fixed bug on stock mouvement and hook update quantity + [-] Classes : fixed rights settings for image folders + [-] Classes : fixed url rewrite for missing category images - #PSCFI-2635 + + [-] CORE : Check correctly the availability of an object for an external module shipping + [-] Core : Fixed bug PSCFI-2436. Cookie object is properly verified before trying to use one of the attributs for the getDefaultCountryId method. + + [-] MO : #PSCFI-2663 - Fix new layout address for mailalerts. + [-] MO : Add footer hook for blocklayered to allow AJAX sorting of products + [-] MO : Bug fixed on Twenga module (1.7) Image link on PrestaShop 1.3 was wrong (module enabled for nl) + [-] MO : Bug fixed on eBay module, when apache cache was enabled, the method fetchToken did not work properly + [-] MO : BugFix #PPSCFI-2536 - SendMailTest.js does not escape its parameters causing malfunction when trying to send htmlentities (v. 1.4.1.0) + [-] MO : BugFix #PSCFI-2201 - error output of set_time_limit must be "muted" + [-] MO : BugFix #PSCFI-2304 - On calculte remaining amount of a voucher, use cart total with tax. + [-] MO : BugFix #PSCFI-2305 - Followup module SQL error + [-] MO : BugFix #PSCFI-2376 - Bad code : mapi_payment.php line 429 + [-] MO : BugFix #PSCFI-2427 - Do not fix PSCFI-2427, but the module follow up + [-] MO : BugFix #PSCFI-2571 - Missing a global $cookie + [-] MO : BugFix #PSCFI-2581 - NEWSLETTER MODULE : Country's filter problem + [-] MO : BugFix #PSCFI-2585 - HTML typo in blocklink module + [-] MO : BugFix #PSCFI-2593 - Sale message hidden after uncheck (option from layered block module) + [-] MO : BugFix #PSCFI-2602 - Web service dispatcher does not stripslashes from POSTed XML + [-] MO : BugFix Module Dibs - Must work with PS1.3 + [-] MO : BugFix in module producttooltip - Can show product page + [-] MO : Changing the version of the Treepodia module + [-] MO : Changing the version of the fedex module (#previousCommit) + [-] MO : Ebay, fix an order validation issue when products list is empty + [-] MO : Fedex module used id_lang 2 by default, now use cookie + [-] MO : Fixed bug #PSCFI-2369, 'authorization-amount-notification' send now a correct answer to Google. + [-] MO : Fixed bug #PSCFI-2370, Shipping fees correctly take in consideration for the form validation + [-] MO : Fixed bug #PSCFI-2370. Shipping delivery message is correctly set for Google summary order. + [-] MO : Fixed bug SQL error when generate filters + [-] MO : Fixed bug according to the last commit about secure_key + [-] MO : Module Twenga hiding errors + [-] MO : Module treepodia little fix for IE + [-] MO : MoneyBookers, fix string manipulation after a fetching content + [-] MO : MoneyBookers, replace getProtocol to http:// for older PrestaShop version using with a unsecure page + [-] MO : Ogone. Add an ignore key list variable to generate properly the sha1. + [-] MO : PayPal fixing rounding issues + [-] MO : PayPal module fixing order state issue + [-] MO : PayPal retrocompatibility issue + [-] MO : PaySafeCard template directory was wrong + [-] MO : Paypal, fix the express checkout + [-] MO : TrustedShops , fix translations + [-] MO : Twenga module (1.7) can now handle more products on their feed + [-] MO : added check if curl is loaded in layered block + [-] MO : display hook footer for blocklayered module only on page category + [-] MO : fix little bug on themeinstallator with blockcms module + [-] MO : fixed bug #PSCFI-2249 - Loyalty Point information should not display during Instant Checkout? + [-] MO : fixed bug #PSCFI-2318 - fixed typo error in add-to-cart.tpl file of Treepodia module + [-] MO : fixed bug #PSCFI-2374 - carriercompare module is not showing any result + [-] MO : fixed bug #PSCFI-2713 - Fix issue on Blockwishlist module + [-] MO : fixed bug PSCFI-2337 in the statsforecast module : no more division by zero + [-] MO : fixed token undifined in shopimport + [-] MO : modules exceptions weren't perfectly managed by the theme installer + + [-] WS : Bug PSCFI-2624 fixed + [-] WS : Bug PSCFI-2684 fixed + [-] WS : Bug PSCFI-2685 fixed + [-] WS : Bug PSCFI-2748 fixed + [-] WS : Fix a bug when adding a Configuration (Found via Unit Test) + [-] WS : Fixed bug PSCFI-2603 + [-] WS : Small fix + [-] WS : Small fix in Order entity (setCurrentState) + [-] WS : Small fix in Webservice back-office tab + [-] WS : [-] WS : Bug PSCFI-2377 fixed + + [-] PDF : Bug Fixed #PSCFI-2425 - Incorrect tax breakdown (tax excl group) + + [-] TR : fixed fr translation, thanks to Sabrina + [-] TR : translation minor fix + [-] TR : translations fr about AdminUpgrade.php + [-] TR : when a module class was called before the translation proces, its translation wasn't found. + + #################################### # v1.4.3.0 - 7119 (2011-06-16) # #################################### diff --git a/admin-dev/ajax.php b/admin-dev/ajax.php index 40cb370ab..d71ec5a2c 100644 --- a/admin-dev/ajax.php +++ b/admin-dev/ajax.php @@ -628,7 +628,7 @@ if (Tools::isSubmit('getAdminHomeElement')) $protocol = (!empty($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) != 'off') ? 'https' : 'http'; $isoUser = Language::getIsoById(intval($cookie->id_lang)); $isoCountry = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT')); - $context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5))); + $stream_context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5))); // SCREENCAST if (@fsockopen('www.prestashop.com', 80, $errno, $errst, 3)) @@ -637,7 +637,7 @@ if (Tools::isSubmit('getAdminHomeElement')) $result['screencast'] = 'NOK'; // PREACTIVATION - $content = @file_get_contents($protocol.'://www.prestashop.com/partner/preactivation/preactivation-block.php?version=1.0&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&protocol='.$protocol.'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&date_creation='._PS_CREATION_DATE_.'&v='._PS_VERSION_.'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $context); + $content = @file_get_contents($protocol.'://www.prestashop.com/partner/preactivation/preactivation-block.php?version=1.0&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&protocol='.$protocol.'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&date_creation='._PS_CREATION_DATE_.'&v='._PS_VERSION_.'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context); if (!$content) $result['partner_preactivation'] = 'NOK'; else @@ -663,7 +663,7 @@ if (Tools::isSubmit('getAdminHomeElement')) } // DISCOVER PRESTASHOP - $content = @file_get_contents($protocol.'://www.prestashop.com/partner/prestashop/prestashop-link.php?iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang, false, $context); + $content = @file_get_contents($protocol.'://www.prestashop.com/partner/prestashop/prestashop-link.php?iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang, false, $stream_context); if (!$content) $result['discover_prestashop'] = 'NOK'; else @@ -677,7 +677,7 @@ if (Tools::isSubmit('getAdminHomeElement')) if (@fsockopen('www.prestashop.com', 80, $errno, $errst, 3)) $result['discover_prestashop'] .= ''; - $content = @file_get_contents($protocol.'://www.prestashop.com/partner/paypal/paypal-tips.php?protocol='.$protocol.'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang, false, $context); + $content = @file_get_contents($protocol.'://www.prestashop.com/partner/paypal/paypal-tips.php?protocol='.$protocol.'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang, false, $stream_context); $content = explode('|', $content); if ($content[0] == 'OK') $result['discover_prestashop'] .= $content[1]; diff --git a/admin-dev/header.inc.php b/admin-dev/header.inc.php index b44065ad7..af8960717 100644 --- a/admin-dev/header.inc.php +++ b/admin-dev/header.inc.php @@ -167,11 +167,11 @@ if ($employee->bo_uimode == 'hover') $(this).addClass("active"); } '; -echo ' +echo '
' .(file_exists(PS_ADMIN_DIR.'/../install') ? '
' .translate('For security reasons, you must also:').' '. - translate('deleted the /install folder'). + translate('delete the /install folder'). '
' : '').' '; diff --git a/admin-dev/login.php b/admin-dev/login.php index 34550de3b..c4b479496 100644 --- a/admin-dev/login.php +++ b/admin-dev/login.php @@ -145,7 +145,7 @@ $randomNb = rand(100, 999); if(file_exists(PS_ADMIN_DIR.'/../install') OR file_exists(PS_ADMIN_DIR.'/../admin')) { echo ' '.translate('For security reasons, you cannot connect to the Back Office until after you have:').'

- - '.translate('deleted the /install folder').'
+ - '.translate('delete the /install folder').'
- '.translate('renamed the /admin folder (eg. ').'/admin'.$randomNb.')

'.translate('Please then access this page by the new url (eg. http://www.domain.tld/admin').$randomNb.')
'; } diff --git a/admin-dev/tabs/AdminAttributes.php b/admin-dev/tabs/AdminAttributes.php index 855f60db3..776a105db 100644 --- a/admin-dev/tabs/AdminAttributes.php +++ b/admin-dev/tabs/AdminAttributes.php @@ -144,6 +144,14 @@ class AdminAttributes extends AdminTab else $this->_errors[] = Tools::displayError('You do not have permission to delete here.'); } + elseif (Tools::isSubmit('submitAddattribute')) + { + // clean \n\r characters + foreach($_POST as $key => $value) + if (preg_match('/^name_/Ui', $key)) + $_POST[$key] = str_replace ('\n', '', str_replace('\r', '', $value)); + parent::postProcess(); + } else parent::postProcess(); } diff --git a/admin-dev/tabs/AdminCountries.php b/admin-dev/tabs/AdminCountries.php index 13c2cb325..8d2b9f523 100644 --- a/admin-dev/tabs/AdminCountries.php +++ b/admin-dev/tabs/AdminCountries.php @@ -48,7 +48,11 @@ class AdminCountries extends AdminTab 'a!active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'a!active')); $this->optionTitle = $this->l('Countries options'); - $this->_fieldsOptions = array('PS_COUNTRY_DEFAULT' => array('title' => $this->l('Default country:'), 'desc' => $this->l('The default country used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_country', 'list' => Country::getCountries(Context::getContext()->language->id))); + $this->_fieldsOptions = array( + 'PS_COUNTRY_DEFAULT' => array('title' => $this->l('Default country:'), 'desc' => $this->l('The default country used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_country', 'list' => Country::getCountries(Context::getContext()->language->id)), + 'PS_RESTRICT_DELIVERED_COUNTRIES' => array('title' => $this->l('Restrict countries in FO by those delivered by active carriers'), 'cast' => 'intval', 'type' => 'bool', 'default' => '0') + ); + parent::__construct(); } diff --git a/admin-dev/tabs/AdminImport.php b/admin-dev/tabs/AdminImport.php index 52cb61239..8f5360439 100644 --- a/admin-dev/tabs/AdminImport.php +++ b/admin-dev/tabs/AdminImport.php @@ -983,7 +983,7 @@ class AdminImport extends AdminTab { $obj = new Attribute(); $obj->id_attribute_group = $groups[$group]; - $obj->name[$defaultLanguage] = $attribute; + $obj->name[$defaultLanguage] = str_replace('\n', '', str_replace('\r', '', $attribute)); if (($fieldError = $obj->validateFields(UNFRIENDLY_ERROR, true)) === true AND ($langFieldError = $obj->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true) { $obj->add(); diff --git a/admin-dev/tabs/AdminPPreferences.php b/admin-dev/tabs/AdminPPreferences.php index bd94dd5b4..07badc905 100644 --- a/admin-dev/tabs/AdminPPreferences.php +++ b/admin-dev/tabs/AdminPPreferences.php @@ -58,11 +58,12 @@ class AdminPPreferences extends AdminPreferences array('id' => '3', 'name' => $this->l('Product modified date')) ), 'identifier' => 'id'), 'PS_PRODUCTS_ORDER_WAY' => array('title' => $this->l('Default order way:'), 'desc' => $this->l('Default order way for product list'), 'type' => 'select', 'list' => array(array('id' => '0', 'name' => $this->l('Ascending')), array('id' => '1', 'name' => $this->l('Descending'))), 'identifier' => 'id'), + 'PS_PRODUCT_SHORT_DESC_LIMIT' => array('title' => $this->l('Short description max size'), 'desc' => $this->l('Set the maximum size of product short description'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text'), 'PS_IMAGE_GENERATION_METHOD' => array('title' => $this->l('Image generated by:'), 'validation' => 'isUnsignedId', 'required' => true, 'cast' => 'intval', 'type' => 'select', 'list' => array(array('id' => '0', 'name' => $this->l('auto')), array('id' => '1', 'name' => $this->l('width')), array('id' => '2', 'name' => $this->l('height'))), 'identifier' => 'id', 'visibility' => Shop::CONTEXT_ALL), 'PS_PRODUCT_PICTURE_MAX_SIZE' => array('title' => $this->l('Maximum size of product pictures:'), 'desc' => $this->l('The maximum size of pictures uploadable by customers (in Bytes)'), 'validation' => 'isUnsignedId', 'required' => true, 'cast' => 'intval', 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL), 'PS_PRODUCT_PICTURE_WIDTH' => array('title' => $this->l('Product pictures width:'), 'desc' => $this->l('The maximum width of pictures uploadable by customers'), 'validation' => 'isUnsignedId', 'required' => true, 'cast' => 'intval', 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL), 'PS_PRODUCT_PICTURE_HEIGHT' => array('title' => $this->l('Product pictures height:'), 'desc' => $this->l('The maximum height of pictures uploadable by customers'), 'validation' => 'isUnsignedId', 'required' => true, 'cast' => 'intval', 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL), - 'PS_LEGACY_IMAGES' => array('title' => $this->l('Activate legacy images compatibility:'), 'desc' => $this->l('This should be set to yes unless this is a new installation of PrestaShop'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool', 'visibility' => Shop::CONTEXT_ALL) + 'PS_LEGACY_IMAGES' => array('title' => $this->l('Use the legacy image filesystem:'), 'desc' => $this->l('This should be set to yes unless you successfully moved images in Preferences > Images tab'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool', 'visibility' => Shop::CONTEXT_ALL), ); parent::__construct(); diff --git a/admin-dev/tabs/AdminPreferences.php b/admin-dev/tabs/AdminPreferences.php index de5616adc..35db529f8 100644 --- a/admin-dev/tabs/AdminPreferences.php +++ b/admin-dev/tabs/AdminPreferences.php @@ -88,7 +88,7 @@ class AdminPreferences extends AdminTab 'PS_GIFT_WRAPPING' => array('title' => $this->l('Offer gift-wrapping'), 'desc' => $this->l('Suggest gift-wrapping to customer and possibility of leaving a message'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->l('Gift-wrapping price'), 'desc' => $this->l('Set a price for gift-wrapping'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'), 'PS_GIFT_WRAPPING_TAX' => array('title' => $this->l('Gift-wrapping tax'), 'desc' => $this->l('Set a tax for gift-wrapping'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $taxes, 'identifier' => 'id'), - 'PS_ATTACHMENT_MAXIMUM_SIZE' => array('title' => $this->l('Attachment maximum size'), 'desc' => $this->l('Set the maximum size of attachment files (in MegaBytes)'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text'), + 'PS_ATTACHMENT_MAXIMUM_SIZE' => array('title' => $this->l('Attachment maximum size'), 'desc' => $this->l('Set the maximum size of attachment files (in MegaBytes).').' '.$this->l('Maximum:').' '.((int)str_replace('M', '', ini_get('post_max_size')) > (int)str_replace('M', '', ini_get('upload_max_filesize')) ? ini_get('upload_max_filesize') : ini_get('post_max_size')), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '2'), 'PS_RECYCLABLE_PACK' => array('title' => $this->l('Offer recycled packaging'), 'desc' => $this->l('Suggest recycled packaging to customer'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CART_FOLLOWING' => array('title' => $this->l('Cart re-display at login'), 'desc' => $this->l('After customer logs in, recall and display contents of his/her last shopping cart'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_PRICE_ROUND_MODE' => array('title' => $this->l('Round mode'), 'desc' => $this->l('You can choose how to round prices: always round superior; always round inferior, or classic rounding'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $round_mode, 'identifier' => 'value'), @@ -117,6 +117,15 @@ class AdminPreferences extends AdminTab public function postProcess() { + if (Tools::getValue('PS_ATTACHMENT_MAXIMUM_SIZE')) + { + $uploadMaxSize = (int)str_replace('M', '',ini_get('upload_max_filesize')); + $postMaxSize = (int)str_replace('M', '', ini_get('post_max_size')); + $maxSize = $uploadMaxSize < $postMaxSize ? $uploadMaxSize : $postMaxSize; + + $_POST['PS_ATTACHMENT_MAXIMUM_SIZE'] = $maxSize < Tools::getValue('PS_ATTACHMENT_MAXIMUM_SIZE') ? $maxSize : Tools::getValue('PS_ATTACHMENT_MAXIMUM_SIZE'); + } + if (isset($_POST['submitGeneral'.$this->table])) { Module::hookExec('categoryUpdate'); // We call this hook, for regenerate cache of categories @@ -160,6 +169,7 @@ class AdminPreferences extends AdminTab else $this->_errors[] = Tools::displayError('You do not have permission to edit here.'); } + parent::postProcess(); } @@ -336,6 +346,7 @@ class AdminPreferences extends AdminTab else $(\'input[name=PS_MAINTENANCE_IP]\').attr(\'value\',\''.Tools::getRemoteAddr().'\'); } +
'.$tabname.''; diff --git a/admin-dev/tabs/AdminProducts.php b/admin-dev/tabs/AdminProducts.php index ab8078a48..946d3aceb 100644 --- a/admin-dev/tabs/AdminProducts.php +++ b/admin-dev/tabs/AdminProducts.php @@ -1113,10 +1113,12 @@ class AdminProducts extends AdminTab } /* Check description short size without html */ + $limit = (int)Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT'); + if ($limit <= 0) $limit = 400; foreach ($languages AS $language) if ($value = Tools::getValue('description_short_'.$language['id_lang'])) - if (Tools::strlen(strip_tags($value)) > 400) - $this->_errors[] = $this->l('the field').' '.call_user_func(array($className, 'displayFieldName'), 'description_short').' ('.$language['name'].') '.$this->l('is too long').' : 400 '.$this->l('chars max').' ('.$this->l('count now').' '.Tools::strlen(strip_tags($value)).')'; + if (Tools::strlen(strip_tags($value)) > $limit) + $this->_errors[] = $this->l('the field').' '.call_user_func(array($className, 'displayFieldName'), 'description_short').' ('.$language['name'].') '.$this->l('is too long').' : '.$limit.' '.$this->l('chars max').' ('.$this->l('count now').' '.Tools::strlen(strip_tags($value)).')'; /* Check multilingual fields sizes */ foreach ($rules['sizeLang'] AS $fieldLang => $maxLength) foreach ($languages AS $language) @@ -2099,6 +2101,7 @@ class AdminProducts extends AdminTab updateFriendlyURL(); $.ajax({ url: "'.dirname(self::$currentIndex).'/ajax.php", + cache: false, dataType: "json", data: "ajaxProductManufacturers=1", success: function(j) { @@ -2116,6 +2119,7 @@ class AdminProducts extends AdminTab }); $.ajax({ url: "'.dirname(self::$currentIndex).'/ajax.php", + cache: false, dataType: "json", data: "ajaxProductSuppliers=1", success: function(j) { diff --git a/admin-dev/tabs/AdminStores.php b/admin-dev/tabs/AdminStores.php index 7619f85cf..90066ca77 100644 --- a/admin-dev/tabs/AdminStores.php +++ b/admin-dev/tabs/AdminStores.php @@ -58,7 +58,7 @@ class AdminStores extends AdminTab 'state' => array('title' => $this->l('State'), 'width' => 100), 'city' => array('title' => $this->l('City'), 'width' => 100), 'postcode' => array('title' => $this->l('Zip code'), 'width' => 50), - 'name' => array('title' => $this->l('Name'), 'width' => 120), + 'name' => array('title' => $this->l('Name'), 'width' => 120, 'filter_key' => 'a!name'), 'phone' => array('title' => $this->l('Phone'), 'width' => 70), 'fax' => array('title' => $this->l('Fax'), 'width' => 70), 'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false) diff --git a/admin-dev/tabs/AdminUpgrade.php b/admin-dev/tabs/AdminUpgrade.php index b739f3f6f..11639bc61 100755 --- a/admin-dev/tabs/AdminUpgrade.php +++ b/admin-dev/tabs/AdminUpgrade.php @@ -102,16 +102,16 @@ class AdminUpgrade extends AdminPreferences { $this->_fieldsAutoUpgrade['PS_AUTOUP_DONT_SAVE_IMAGES'] = array( 'title' => $this->l('Don\'t save images'), 'cast' => 'intval', 'validation' => 'isBool', - 'type' => 'bool', 'desc'=>$this->l('You can exclude the image directory from backup if you already saved it by an other method. (not recommended)'), + 'type' => 'bool', 'desc'=>$this->l('You can exclude the image directory from backup if you already saved it by another method (not recommended)'), ); $this->_fieldsAutoUpgrade['PS_AUTOUP_KEEP_DEFAULT_THEME'] = array( 'title' => $this->l('Keep theme "prestashop"'), 'cast' => 'intval', 'validation' => 'isBool', - 'type' => 'bool', 'desc'=>$this->l('if you have customized prestashop default theme, you can protect it from upgrade (not recommended)'), + 'type' => 'bool', 'desc'=>$this->l('If you have customized PrestaShop default theme, you can protect it from upgrade (not recommended)'), ); $this->_fieldsAutoUpgrade['PS_AUTOUP_KEEP_TRAD'] = array( - 'title' => $this->l('Don\'t keep translations'), 'cast' => 'intval', 'validation' => 'isBool', + 'title' => $this->l('Keep translations'), 'cast' => 'intval', 'validation' => 'isBool', 'type' => 'bool', 'desc'=>$this->l('If set too yes, you will keep all your translations'), ); // allow manual mode only for dev @@ -185,7 +185,18 @@ class AdminUpgrade extends AdminPreferences $this->nextParams['filesToUpgrade'] = $this->currentParams['filesToUpgrade']; $this->backupDbFilename = Configuration::get('UPGRADER_BACKUPDB_FILENAME'); + if(!file_exists($this->backupDbFilename)) + { + $this->backupDbFilename = ''; + Configuration::updateValue('UPGRADER_BACKUPDB_FILENAME',''); + } $this->backupFilesFilename = Configuration::get('UPGRADER_BACKUPFILES_FILENAME'); + if(!file_exists($this->backupFilesFilename)) + { + $this->backupFilesFilename = ''; + Configuration::updateValue('UPGRADER_BACKUPFILES_FILENAME',''); + } + $this->autoupgradePath = $this->adminDir.DIRECTORY_SEPARATOR.$this->autoupgradeDir; @@ -257,9 +268,15 @@ class AdminUpgrade extends AdminPreferences $this->_postConfig($this->_fieldsAutoUpgrade); } + public function ajaxProcessUpgradeComplete() + { + $this->nextDesc = $this->l('Upgrade process done. Congratulations ! You can now reactive your shop.'); + $this->next = ''; + } + public function ajaxProcessUpgradeNow() { - $this->nextDesc = 'Starting upgrade ...'; + $this->nextDesc = $this->l('Starting upgrade ...'); $this->next = 'desactiveShop'; } public function ajaxProcessSvnExport() @@ -1092,7 +1109,7 @@ class AdminUpgrade extends AdminPreferences } else if (!method_exists(get_class($this), 'ajaxProcess'.$action)) { - $this->nextDesc = sprintf($this->l('action "%1$s" non trouvée '), $action); + $this->nextDesc = sprintf($this->l('action "%1$s" not found'), $action); $this->next = 'error'; $this->error = '1'; } @@ -1190,17 +1207,17 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where private function _displayRollbackForm() { echo '
'.$this->l('Rollback').' -
'; +
'; if (empty($this->backupFilesFilename) AND empty($this->backupDbFilename)) echo $this->l('No rollback available'); else if (!empty($this->backupFilesFilename) OR !empty($this->backupDbFilename)) { - echo ''; + echo '
'; } if (!empty($this->backupFilesFilename)) - echo '
restoreFiles '.sprintf($this->l('click to restore %s'),$this->backupFilesFilename).'
'; + echo '
restoreFiles '.sprintf($this->l('click to restore %s'),$this->backupFilesFilename).'

'; if (!empty($this->backupDbFilename)) - echo '
restoreDb '.sprintf($this->l('click to restore %s'), $this->backupDbFilename).'
'; + echo '
restoreDb '.sprintf($this->l('click to restore %s'), $this->backupDbFilename).'

'; echo '
'; } @@ -1211,13 +1228,13 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where echo '
'; echo ''.$this->l('Your current configuration').''; - echo ''.$this->l('root directory').' : '.$this->prodRootDir.'

'; + echo ''.$this->l('Root directory').' : '.$this->prodRootDir.'

'; if ($this->rootWritable) $srcRootWritable = '../img/admin/enabled.gif'; else $srcRootWritable = '../img/admin/disabled.gif'; - echo ''.$this->l('Root directory').' : '.' '.($this->rootWritable?$this->l('root directory is fully writable'):$this->l('root directory is not writable recursively')).'.

'; + echo ''.$this->l('Root directory status').' : '.' '.($this->rootWritable?$this->l('fully writable'):$this->l('not writable recursively')).'

'; if ($this->upgrader->needUpgrade) { @@ -1245,7 +1262,7 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where $srcExecTime = '../img/admin/enabled.gif'; else $srcExecTime = '../img/admin/warning.gif'; - echo ''.$this->l('php time limit').' : '.''.($max_exec_time == 0?$this->l('disabled'):$max_exec_time.' '.$this->l('seconds')).'

'; + echo ''.$this->l('PHP time limit').' : '.''.($max_exec_time == 0?$this->l('disabled'):$max_exec_time.' '.$this->l('seconds')).'

'; if ($this->rootWritable) $srcRootWritable = '../img/admin/enabled.gif'; @@ -1268,7 +1285,7 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where // @TODO : this should be checked when init() if ($this->isUpgradeAllowed()) { if ($pleaseUpdate) { - echo '
  • information '.$this->l('Latest Prestashop version available is:').' '.$pleaseUpdate['name'].'
  • '; + echo '
  • information '.$this->l('Latest Prestashop version available is:').' '.$pleaseUpdate['name'].'
  • '; } // echo ''; // echo ''; @@ -1337,34 +1354,45 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where // temporary infoUpdate will be in #tmpInformation echo ''; } + public function display() { - $this->displayWarning('This function is experimental. It\'s currently recommended to make a backup of your files and database.'); + $this->displayWarning($this->l('This function is experimental. It\'s highly recommended to make a backup of your files and database before starting the upgrade process.')); - if ($this->apacheModExists('mod_evasive')) - sleep(1); // update['name'] = version name // update['num'] = only the version // update['link'] = download link // @TODO - if ($this->useSvn AND FALSE) + + if ($this->isUpgradeAllowed()) + { + if ($this->useSvn) echo '

    '.$this->l('Unstable upgrade').'

    '.$this->l('Your current configuration indicate you want to upgrade your system from the unstable development branch, with no version number. If you upgrade, you will not be able to follow the official release process anymore').'.

    '; - $this->_displayUpgraderForm(); + echo '
    '; $this->_displayRollbackForm(); echo '
    '; - $this->_displayForm('autoUpgradeOptions',$this->_fieldsAutoUpgrade,''.$this->l('Options').'', 'my-autoupgrade-option',''); + $this->_displayForm('autoUpgradeOptions',$this->_fieldsAutoUpgrade,''.$this->l('Options').'', '','prefs'); echo ''; + } + else + { + echo '
    + '.$this->l('Update').''; + echo '

    '.$this->l('You currently don\'t need to use this feature.').'

    '; + echo '
    '; + } + } private function _getJsInit() @@ -1456,7 +1484,7 @@ function parseXMLResult(xmlRet) .hide("slow"); // difference with the original function - ret = {next:"upgradeComplete",nextParams:""}; + ret = {next:"upgradeComplete",nextParams:{typeResult:"json"},status:"ok"}; } else @@ -1471,7 +1499,7 @@ function parseXMLResult(xmlRet) // propose rollback if there is an error if (confirm(txtError[parseInt(ret.getAttribute("error"))]+"\r\n\r\n'.$this->l('Do you want to rollback ?').'")) - ret = {next:"rollback","nextParams":nextParams}; + ret = {next:"rollback",nextParams:{typeResult:"json"},status:"error"}; } return ret @@ -1519,6 +1547,11 @@ function doAjaxRequest(action, nextParams){ }, success : function(res,textStatus,jqXHR) { + if(eval("typeof nextParams") == "undefined") + { + nextParams = {typeResult : "json"}; + } + if (nextParams.typeResult == "xml") { xmlRes = parseXMLResult(res); @@ -1526,12 +1559,14 @@ function doAjaxRequest(action, nextParams){ res.next = xmlRes.next; // if xml, we keep the next params nextParams = myNext; - - // res.status = "ok", + res.status = xmlRes.status; } else { res = $.parseJSON(res); + nextParams = res.nextParams; + } + if (res.status == "ok") { // a @@ -1557,7 +1592,6 @@ function doAjaxRequest(action, nextParams){ $("#"+action).addClass("steperror"); handleError(res); } - } }, error: function(res,textStatus,jqXHR) { @@ -1607,9 +1641,9 @@ function prepareNextButton(button_selector, nextParams) */ function handleSuccess(res) { + updateInfoStep(res.nextDesc); if (res.next != "") { - updateInfoStep(res.nextDesc); addQuickInfo(res.nextQuickInfo); $("#"+res.next).addClass("nextStep"); diff --git a/admin-dev/themes/flashyturtle/admin.css b/admin-dev/themes/flashyturtle/admin.css index ab0a01999..246862e17 100644 --- a/admin-dev/themes/flashyturtle/admin.css +++ b/admin-dev/themes/flashyturtle/admin.css @@ -39,9 +39,9 @@ legend{background:#7AB51D url(thead.png) repeat-x top left;border:1px solid #364 #menu img{display:inline;padding:0 3px 0 6px;vertical-align:top;width:16px;height:16px} #menu li.active{background-position:0 -70px} #menu li.active a{color:#000} -#submenu{clear:both;color:#666;margin:0;height:38px;padding:0} -.withLeftBorder{background:transparent url(separator_subnav.png) no-repeat 0 5px} -#submenu li{display:inline;list-style:none;margin:0;background:transparent url(separator_subnav.png) no-repeat right 0;padding-left:8px;padding-right:8px;margin-top:8px;float:left;height:20px} +#submenu{clear:both;color:#666;margin:0;padding:0;border-bottom: #A2A8B2 1px solid} +.withLeftBorder{background:url(bg-submenu.png) repeat-x #DADADA;background-position:0 -1px} +#submenu li{display:inline;list-style:none;margin:0;background:transparent url(separator_subnav.png) no-repeat right 0;padding-left:8px;padding-right:8px;margin-top:8px;float:left;height:29px} #submenu li a{text-decoration:underline} #menu li{_height:32px;_padding-top:3px} #menu li a{_display:inline;_padding:6px 6px 4px} diff --git a/admin-dev/themes/flashyturtle/bg-submenu.png b/admin-dev/themes/flashyturtle/bg-submenu.png new file mode 100644 index 0000000000000000000000000000000000000000..59e2b8af6f19f324aea5ea5dd2c0adba2af295f2 GIT binary patch literal 153 zcmeAS@N?(olHy`uVBq!ia0vp^j6kf;!3HGHJy2Q%5-1LGcVbv~PUa<$!;&U>c zv7h@-A}f&3S>O>_%)r2R1cVumRBy3?mAnmV91cX)$XytJ`OXWP6kg`KbLh*2~7Z;!Y(!d literal 0 HcmV?d00001 diff --git a/admin-dev/themes/oldschool/admin.css b/admin-dev/themes/oldschool/admin.css index a1b138ef4..8643c5f74 100644 --- a/admin-dev/themes/oldschool/admin.css +++ b/admin-dev/themes/oldschool/admin.css @@ -35,9 +35,9 @@ legend{background:#FFF6D3;border:1px solid #DFD5C3;font-weight:700;margin:0;padd #menu img{display:inline;padding:0 3px 0 6px;vertical-align:top;width:16px;height:16px} #menu li.active,#menu li:hover{background-position:0 -38px;white-space:nowrap;} #menu li.active a{color:#000} -#submenu{background:#ECEADE;clear:both;color:#666;margin:0;height:32px;padding:0;border:1px solid #999999} +#submenu{background:#ECEADE;clear:both;color:#666;margin:0;padding:0;border:1px solid #999999} .withLeftBorder{background:transparent url(separator_subnav.png) no-repeat 0 5px} -#submenu li{display:inline;list-style:none;margin:0;background:transparent url(separator_subnav.png) no-repeat right 0;padding-left:7px;padding-right:7px;margin-top:8px;float:left;height:20px} +#submenu li{display:inline;list-style:none;margin:0;background:transparent url(separator_subnav.png) no-repeat right 0;padding-left:7px;padding-right:7px;margin-top:8px;float:left;height:29px} #submenu li a{text-decoration:underline} #menu li{_height:32px;_padding-top:3px} #menu li a{_display:inline;_padding:6px 5px 4px 0} diff --git a/admin-dev/themes/origins/admin.css b/admin-dev/themes/origins/admin.css index 6c1532ec1..0d023778e 100644 --- a/admin-dev/themes/origins/admin.css +++ b/admin-dev/themes/origins/admin.css @@ -37,9 +37,9 @@ legend{background:#FFF6D3;border:1px solid #DFD5C3;font-weight:700;margin:0;padd #menu img{display:inline;padding:0 3px 0 6px;vertical-align:top;width:16px;height:16px} #menu li.active{background-position:0 -38px;white-space:nowrap;} #menu li.active a{color:#000} -#submenu{clear:both;color:#666;margin:0;height:38px;padding:0} -.withLeftBorder{background:transparent url(separator_subnav.png) no-repeat 0 5px} -#submenu li{display:inline;list-style:none;margin:0;background:transparent url(separator_subnav.png) no-repeat right 0;padding-left:8px;padding-right:8px;margin-top:8px;float:left;height:20px} +#submenu{clear:both;color:#666;margin:0;padding:0;border-bottom: #A2A8B2 1px solid} +.withLeftBorder{background:url(bg-submenu.png) repeat-x #DADADA;background-position:0 -1px} +#submenu li{display:inline;list-style:none;margin:0;background:transparent url(separator_subnav.png) no-repeat right 0;padding-left:8px;padding-right:8px;margin-top:8px;float:left;height:29px} #submenu li a{text-decoration:underline} #menu li{_height:32px;_padding-top:3px} #menu li a{_display:inline;_padding:6px 5px 4px 0} diff --git a/admin-dev/themes/origins/bg-submenu.png b/admin-dev/themes/origins/bg-submenu.png new file mode 100644 index 0000000000000000000000000000000000000000..ba30c6b36a23059550bb97316aecb1cbeb933019 GIT binary patch literal 190 zcmeAS@N?(olHy`uVBq!ia0vp^j6kf;!3HGHJy2Q%5-1LGcVbv~PUa<$!;&U>c zv7h@-A}f&3S>O>_%)r2R2!t6$HM|;tf|4b!5hcO-X(i=}MX3w{iJ5sNdVa1U3T4K6 zrh2BHU4I?`73q1pIEF}sC-10xdZWH=d;a}@=}8Ps93TJxuTK$^68DugJIY}==h?(O e4YTi!M;Hp`I(U?&+O7lYWbkzLb6Mw<&;$V4f;hPV literal 0 HcmV?d00001 diff --git a/classes/Carrier.php b/classes/Carrier.php index a1fb3d46d..dc2209822 100644 --- a/classes/Carrier.php +++ b/classes/Carrier.php @@ -399,7 +399,38 @@ class CarrierCore extends ObjectModel return $carriers; } - public static function getCarriersForOrder($id_zone, $groups = NULL, Cart $cart = null, $id_currency = null, $id_lang = null) + public static function getDeliveredCountries($id_lang, $activeCountries = false, $activeCarriers = false, $containStates = NULL) + { + if (!Validate::isBool($activeCountries) OR !Validate::isBool($activeCarriers)) + die(Tools::displayError()); + + $states = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' + SELECT s.* + FROM `'._DB_PREFIX_.'state` s + ORDER BY s.`name` ASC'); + + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' + SELECT cl.*,c.*, cl.`name` AS country, zz.`name` AS zone FROM `'._DB_PREFIX_.'country` c + LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country` AND cl.`id_lang` = 1) + INNER JOIN (`'._DB_PREFIX_.'carrier_zone` cz INNER JOIN `'._DB_PREFIX_.'carrier` cr ON ( cr.id_carrier = cz.id_carrier AND cr.deleted = 0 '.($activeCarriers ? + 'AND cr.active = 1) ' : ') ').' + LEFT JOIN `'._DB_PREFIX_.'zone` zz ON cz.id_zone = zz.id_zone) ON zz.`id_zone` = c.`id_zone` + WHERE 1 + '.($activeCountries ? 'AND c.active = 1' : '').' + '.(!is_null($containStates) ? 'AND c.`contains_states` = '.(int)($containStates) : '').' + ORDER BY cl.name ASC'); + + $countries = array(); + foreach ($result AS &$country) + $countries[$country['id_country']] = $country; + foreach ($states AS &$state) + if (isset($countries[$state['id_country']])) /* Does not keep the state if its country has been disabled and not selected */ + $countries[$state['id_country']]['states'][] = $state; + + return $countries; + } + + public static function getCarriersForOrder($id_zone, $groups = NULL) { $context = Context::getContext(); if (!$id_lang) diff --git a/classes/FrontController.php b/classes/FrontController.php index a86638147..96901de18 100755 --- a/classes/FrontController.php +++ b/classes/FrontController.php @@ -67,7 +67,6 @@ class FrontControllerCore public function __construct() { global $useSSL; - $useSSL = $this->ssl; } @@ -393,8 +392,9 @@ class FrontControllerCore if (isset($this->php_self) AND !empty($this->php_self)) { // $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain - $canonicalURL = $this->context->link->getPageLink($this->php_self, $this->ssl, $this->context->language->id); - if (!preg_match('/^'.Tools::pRegexp($canonicalURL, '/').'([&?].*)?$/i', (($this->ssl AND Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'])) + + $canonicalURL = $link->getPageLink($this->php_self, $this->ssl, $this->context->language->id); + if (!Tools::getValue('ajax') && !preg_match('/^'.Tools::pRegexp($canonicalURL, '/').'([&?].*)?$/', (($this->ssl AND Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'])) { header('HTTP/1.0 301 Moved'); $params = ''; diff --git a/classes/Image.php b/classes/Image.php index f74f74cfd..4f70b1316 100644 --- a/classes/Image.php +++ b/classes/Image.php @@ -538,6 +538,8 @@ class ImageCore extends ObjectModel if (!$image || $image->id !== (int)$matches[2]) $image = new Image((int)$matches[2]); + if (Validate::isLoadedObject($image)) + { // create the new folder if it does not exist if (!$image->createImgFolder()) return false; @@ -549,6 +551,7 @@ class ImageCore extends ObjectModel if (!@rename(_PS_PROD_IMG_DIR_.$file, $new_path) || !file_exists($new_path)) return false; } + } if ((int)$max_execution_time != 0 && (time() - $start_time > (int)$max_execution_time - 4)) return 'timeout'; } diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index f8b5135b5..87d01a417 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -219,6 +219,7 @@ abstract class PaymentModuleCore extends Module if (!empty($product['ecotax'])) $ecotaxTaxRate = Tax::getProductEcotaxRate($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}); + $product_price = (float)Product::getPriceStatic((int)($product['id_product']), false, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), (Product::getTaxCalculationMethod((int)($order->id_customer)) == PS_TAX_EXC ? 2 : 6), NULL, false, false, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}), $specificPrice, false); $quantityDiscount = SpecificPrice::getQuantityDiscount((int)$product['id_product'], $this->context->shop->getID(), (int)$cart->id_currency, (int)$vat_address->id_country, (int)$customer->id_default_group, (int)$product['cart_quantity']); $unitPrice = Product::getPriceStatic((int)$product['id_product'], true, ($product['id_product_attribute'] ? intval($product['id_product_attribute']) : NULL), 2, NULL, false, true, 1, false, (int)$order->id_customer, NULL, (int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}); $quantityDiscountValue = $quantityDiscount ? ((Product::getTaxCalculationMethod((int)$order->id_customer) == PS_TAX_EXC ? Tools::ps_round($unitPrice, 2) : $unitPrice) - $quantityDiscount['price'] * (1 + $tax_rate / 100)) : 0.00; @@ -228,7 +229,7 @@ abstract class PaymentModuleCore extends Module \''.pSQL($product['name'].((isset($product['attributes']) AND $product['attributes'] != NULL) ? ' - '.$product['attributes'] : '')).'\', '.(int)($product['cart_quantity']).', '.$quantityInStock.', - '.(float)(Product::getPriceStatic((int)($product['id_product']), false, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), (Product::getTaxCalculationMethod((int)($order->id_customer)) == PS_TAX_EXC ? 2 : 6), NULL, false, false, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}), $specificPrice, FALSE)).', + '.$product_price.', '.(float)(($specificPrice AND $specificPrice['reduction_type'] == 'percentage') ? $specificPrice['reduction'] * 100 : 0.00).', '.(float)(($specificPrice AND $specificPrice['reduction_type'] == 'amount') ? (!$specificPrice['id_currency'] ? Tools::convertPrice($specificPrice['reduction'], $order->id_currency) : $specificPrice['reduction']) : 0.00).', '.(float)(Group::getReduction((int)($order->id_customer))).', diff --git a/classes/Product.php b/classes/Product.php index 4000bff09..e54b38b2f 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -243,7 +243,7 @@ class ProductCore extends ObjectModel 'cache_has_attachments' => 'isBool' ); protected $fieldsRequiredLang = array('link_rewrite', 'name'); - /* Description short is limited to 400 chars, but without html, so it can't be generic */ + /* Description short is limited to 400 chars (but can be configured in Preferences Tab), but without html, so it can't be generic */ protected $fieldsSizeLang = array('meta_description' => 255, 'meta_keywords' => 255, 'meta_title' => 128, 'link_rewrite' => 128, 'name' => 128, 'available_now' => 255, 'available_later' => 255); protected $fieldsValidateLang = array( @@ -550,13 +550,16 @@ class ProductCore extends ObjectModel public function validateFieldsLang($die = true, $errorReturn = false) { + $limit = (int)Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT'); + if ($limit <= 0) + $limit = 400; if (!is_array($this->description_short)) $this->description_short = array(); foreach ($this->description_short as $k => $value) - if (Tools::strlen(strip_tags($value)) > 400) + if (Tools::strlen(strip_tags($value)) > $limit) { - if ($die) die (Tools::displayError().' ('.get_class($this).'->description: length > 400 for language '.$k.')'); - return $errorReturn ? get_class($this).'->'.Tools::displayError('description: length > 400 for language').' '.$k : false; + if ($die) die (Tools::displayError().' ('.get_class($this).'->description: length > '.$limit.' for language '.$k.')'); + return $errorReturn ? get_class($this).'->'.Tools::displayError('description: length >').' '.$limit.' '.Tools::displayError('for language').' '.$k : false; } return parent::validateFieldsLang($die, $errorReturn); } @@ -1635,8 +1638,7 @@ class ProductCore extends ObjectModel * @return float Product price */ public static function getPriceStatic($id_product, $usetax = true, $id_product_attribute = NULL, $decimals = 6, $divisor = NULL, $only_reduc = false, - $usereduc = true, $quantity = 1, $forceAssociatedTax = false, $id_customer = NULL, $id_cart = NULL, $id_address = NULL, &$specificPriceOutput = NULL, - $with_ecotax = TRUE, Context $context = null) + $usereduc = true, $quantity = 1, $forceAssociatedTax = false, $id_customer = NULL, $id_cart = NULL, $id_address = NULL, &$specificPriceOutput = NULL, $with_ecotax = true, $use_groupReduction = true, Context $context = null) { if (!$context) $context = Context::getContext(); @@ -1711,7 +1713,7 @@ class ProductCore extends ObjectModel $usetax = false; return Product::priceCalculation($context->shop->getID(), $id_product, $id_product_attribute, $id_country, $id_state, $id_county, $id_currency, $id_group, $quantity, $usetax, $decimals, $only_reduc, - $usereduc, $with_ecotax, $specificPriceOutput); + $usereduc, $with_ecotax, $specificPriceOutput, $use_groupReduction); } /** @@ -1733,7 +1735,7 @@ class ProductCore extends ObjectModel * @param variable_reference $specific_price_output If a specific price applies regarding the previous parameters, this variable is filled with the corresponding SpecificPrice object * @return float Product price **/ - public static function priceCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $id_county, $id_currency, $id_group, $quantity, $use_tax, $decimals, $only_reduc, $use_reduc, $with_ecotax, &$specific_price) + public static function priceCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $id_county, $id_currency, $id_group, $quantity, $use_tax, $decimals, $only_reduc, $use_reduc, $with_ecotax, &$specific_price, $use_groupReduction) { // Caching if ($id_product_attribute === NULL) @@ -1803,13 +1805,15 @@ class ProductCore extends ObjectModel $price -= $reduc; // Group reduction + if ($use_groupReduction) + { if ($reductionFromCategory = (float)(GroupReduction::getValueForProduct($id_product, $id_group))) $price -= $price * $reductionFromCategory; else // apply group reduction if there is no group reduction for this category $price *= ((100 - Group::getReductionByIdGroup($id_group)) / 100); + } $price = Tools::ps_round($price, $decimals); - // Eco Tax if (($result['ecotax'] OR isset($result['attribute_ecotax'])) AND $with_ecotax) { @@ -3066,22 +3070,21 @@ class ProductCore extends ObjectModel public function checkAccess($id_customer) { if (!$id_customer) - { return (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT ctg.`id_group` FROM `'._DB_PREFIX_.'category_product` cp INNER JOIN `'._DB_PREFIX_.'category_group` ctg ON (ctg.`id_category` = cp.`id_category`) WHERE cp.`id_product` = '.(int)$this->id.' AND ctg.`id_group` = 1'); - } else { + else return (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT cg.`id_group` FROM `'._DB_PREFIX_.'category_product` cp INNER JOIN `'._DB_PREFIX_.'category_group` ctg ON (ctg.`id_category` = cp.`id_category`) INNER JOIN `'._DB_PREFIX_.'customer_group` cg ON (cg.`id_group` = ctg.`id_group`) WHERE cp.`id_product` = '.(int)$this->id.' AND cg.`id_customer` = '.(int)$id_customer); - } } + /** * Add a stock movement for current product * @@ -3092,7 +3095,7 @@ class ProductCore extends ObjectModel * @param int $id_employee * @return bool */ - public function addStockMvt($quantity, $id_reason, $id_product_attribute = NULL, $id_order = NULL, $id_employee = NULL) + public function addStockMvt($quantity, $id_reason, $id_product_attribute = null, $id_order = null, $id_employee = null) { if (!$this->id) return; @@ -3114,12 +3117,15 @@ class ProductCore extends ObjectModel $stockMvt->id_employee = (int)$id_employee; $stockMvt->quantity = $quantity; $stockMvt->id_stock_mvt_reason = (int)$id_reason; - $result = $stockMvt->add(); - // @hook updateQuantity - Hook::updateQuantity($this, null); - - return $result; + // adding stock mouvement, this action update the stock of product in database only + if ($stockMvt->add()) + { + $this->quantity = $this->getStock(); + Hook::updateQuantity($this, null); + return true; + } + return false; } public function getStockMvts($id_lang) diff --git a/controllers/AddressController.php b/controllers/AddressController.php index 34cd1f8dc..29ebad6cf 100644 --- a/controllers/AddressController.php +++ b/controllers/AddressController.php @@ -239,8 +239,12 @@ class AddressControllerCore extends FrontController } else $selectedCountry = (int)Configuration::get('PS_COUNTRY_DEFAULT'); - - $countries = Country::getCountries($this->context->language->id, true); + + if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) + $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true); + else + $countries = Country::getCountries($this->context->language->id, true); + $countriesList = ''; foreach ($countries AS $country) $countriesList .= ''; diff --git a/controllers/AuthController.php b/controllers/AuthController.php index deebcbff6..0c8175d87 100644 --- a/controllers/AuthController.php +++ b/controllers/AuthController.php @@ -303,8 +303,11 @@ class AuthControllerCore extends FrontController }*/ if (!isset($selectedCountry)) $selectedCountry = (int)(Configuration::get('PS_COUNTRY_DEFAULT')); - $countries = Country::getCountries($this->context->language->id, true); + if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) + $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true); + else + $countries = Country::getCountries($this->context->language->id, true); $this->context->smarty->assign(array( 'countries' => $countries, 'sl_country' => (isset($selectedCountry) ? $selectedCountry : 0), @@ -361,7 +364,11 @@ class AuthControllerCore extends FrontController $this->context->smarty->assign('back', Tools::safeOutput($back)); if (strpos($back, 'order.php') !== false) { - $countries = Country::getCountries($this->context->language->id, true); + if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) + $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true); + else + $countries = Country::getCountries($this->context->language->id, true); + $this->context->smarty->assign(array( 'inOrderProcess' => true, 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), diff --git a/controllers/OrderOpcController.php b/controllers/OrderOpcController.php index ccdcd2d42..4108f493a 100644 --- a/controllers/OrderOpcController.php +++ b/controllers/OrderOpcController.php @@ -230,7 +230,12 @@ class OrderOpcControllerCore extends ParentOrderController $this->_assignWrappingAndTOS(); $selectedCountry = (int)(Configuration::get('PS_COUNTRY_DEFAULT')); - $countries = Country::getCountries($this->context->language->id, true); + + if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) + $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true); + else + $countries = Country::getCountries($this->context->language->id, true); + $this->context->smarty->assign(array( 'isLogged' => $this->isLogged, 'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0, diff --git a/img/t/AdminUpgrade.gif b/img/t/AdminUpgrade.gif new file mode 100644 index 0000000000000000000000000000000000000000..d69c81a04c0e32edd8457613419fc44bbd32d77f GIT binary patch literal 349 zcmV-j0iym#Nk%v~VGsZi0Hpu`l)?bvLJn?{ zH2Nj6bey9BqSL8SN_fhmgNW=j9DxNQ6m}FkFo7IMA0jaV3Nbn=RtXLYA_@vRi%$s# vBB3G|lusuZ2B|F=rAa3qsi~w^Jt+XTDXdQq84$j|0Z%yx#Kpu9LqPyL+heCX literal 0 HcmV?d00001 diff --git a/install-dev/img/bg_input_button.png b/install-dev/img/bg_input_button.png new file mode 100755 index 0000000000000000000000000000000000000000..777517706da020db945c673a245be14d94936397 GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^j6lrF!3-ofN0qGwQj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS>JiueP3LR|m-`}g9-i*Mh)efaR<*RNk8Zy%HZr9?bk978H@ mB_*UJq$MOJBqlI$7%(u{F>sgEzjy$YXYh3Ob6Mw<&;$U(zA$D0 literal 0 HcmV?d00001 diff --git a/install-dev/index.php b/install-dev/index.php index 6bb58ca3e..3f6403441 100644 --- a/install-dev/index.php +++ b/install-dev/index.php @@ -762,8 +762,8 @@ if ($lm->getIncludeTradFilename()) return ''; } - $context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 3))); - $content = @file_get_contents('http://www.prestashop.com/partner/preactivation/partners.php?version=1.0', false, $context); + $stream_context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 3))); + $content = @file_get_contents('http://www.prestashop.com/partner/preactivation/partners.php?version=1.0', false, $stream_context); if ($content && $content[0] == '<') { $result = simplexml_load_string($content); diff --git a/install-dev/model.php b/install-dev/model.php index cfba7fc6a..2c8915f0a 100644 --- a/install-dev/model.php +++ b/install-dev/model.php @@ -63,7 +63,6 @@ if ($tmp = strpos($_SERVER['REQUEST_URI'], '?')) $_SERVER['REQUEST_URI'] = str_replace('//', '/', $_SERVER['REQUEST_URI']); define('INSTALL_VERSION', '1.5.0.1'); - define('PS_INSTALLATION_IN_PROGRESS', true); include_once(INSTALL_PATH.'/classes/ToolsInstall.php'); define('SETTINGS_FILE', INSTALL_PATH.'/../config/settings.inc.php'); diff --git a/install-dev/preactivation.php b/install-dev/preactivation.php index bdf7df9c6..bb5a0c12e 100644 --- a/install-dev/preactivation.php +++ b/install-dev/preactivation.php @@ -16,8 +16,8 @@ $p = addslashes(strtolower($_GET['partner'])); $c = addslashes(strtolower($_GET['country_iso_code'])); - $context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5))); - $content = @file_get_contents('http://www.prestashop.com/partner/preactivation/fields.php?version=1.0&partner='.$p.'&country_iso_code='.$c, false, $context); + $stream_context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5))); + $content = @file_get_contents('http://www.prestashop.com/partner/preactivation/fields.php?version=1.0&partner='.$p.'&country_iso_code='.$c, false, $stream_context); if ($content && $content[0] == '<') { @@ -28,7 +28,7 @@ echo '


    '; foreach ($result->field as $field) { - echo '
    '; + echo '
    '; if ($field->type == 'text' || $field->type == 'password') echo 'size) ? 'size="'.$field->size.'"' : '').' value="'.(isset($_GET[trim($field->key)]) ? $_GET[trim($field->key)] : $field->default).'" />'; elseif ($field->type == 'radio') @@ -99,7 +99,7 @@ if ($_GET['request'] == 'send') { - $context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5))); + $stream_context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5))); $url = 'http://www.prestashop.com/partner/preactivation/actions.php?version=1.0&partner='.addslashes($_GET['partner']); // Protect fields @@ -111,7 +111,7 @@ foreach ($_GET as $key => $val) $url .= '&'.$key.'='.urlencode($val); $url .= '&security='.md5($_GET['email']._COOKIE_IV_); - $content = @file_get_contents($url, false, $context); + $content = @file_get_contents($url, false, $stream_context); if ($content) echo $content; else diff --git a/install-dev/sql/db_settings_lite.sql b/install-dev/sql/db_settings_lite.sql index 2a7dafeb7..2db213592 100644 --- a/install-dev/sql/db_settings_lite.sql +++ b/install-dev/sql/db_settings_lite.sql @@ -202,7 +202,8 @@ INSERT INTO `PREFIX_configuration` (`id_configuration`, `name`, `value`, `date_a (131, 'PS_PNG_QUALITY', '7', NOW(), NOW()), (132, 'PS_JPEG_QUALITY', '90', NOW(), NOW()), (133, 'PS_COOKIE_LIFETIME_FO', '480', NOW(), NOW()), -(134, 'PS_COOKIE_LIFETIME_BO', '480', NOW(), NOW()); +(134, 'PS_COOKIE_LIFETIME_BO', '480', NOW(), NOW()), +(135, 'PS_RESTRICT_DELIVERED_COUNTRIES', '0', NOW(), NOW()); INSERT INTO `PREFIX_configuration_lang` (`id_configuration`, `id_lang`, `value`, `date_upd`) VALUES (36, 1, 'IN', NOW()),(36, 2, 'FA', NOW()),(36, 3, 'CU', NOW()),(36, 4, 'FA', NOW()),(36, 5, 'FA', NOW()), @@ -740,7 +741,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES (1, 12, 'Addresses'),(1, 13, 'Statuses'),(1, 14, 'Vouchers'),(1, 15, 'Currencies'),(1, 16, 'Taxes'),(1, 17, 'Carriers'),(1, 18, 'Countries'), (1, 19, 'Zones'),(1, 20, 'Price Ranges'),(1, 21, 'Weight Ranges'),(1, 22, 'Positions'),(1, 23, 'Database'),(1, 24, 'E-mail'),(1, 26, 'Image'), (1, 27, 'Products'),(1, 28, 'Contacts'),(1, 29, 'Employees'),(1, 30, 'Profiles'),(1, 31, 'Permissions'),(1, 32, 'Languages'),(1, 33, 'Translations'), -(1, 34, 'Suppliers'),(1, 35, 'Tabs'),(1, 36, 'Features'),(1, 37, 'Quick Access'),(1, 38, 'Appearance'),(1, 39, 'Contact Information'),(1, 40, 'Alias ​​Research'), +(1, 34, 'Suppliers'),(1, 35, 'Tabs'),(1, 36, 'Features'),(1, 37, 'Quick Access'),(1, 38, 'Appearance'),(1, 39, 'Contact Information'),(1, 40, 'Aliases'), (1, 41, 'Import'),(1, 42, 'Invoices'),(1, 43, 'Search'),(1, 44, 'Localization'),(1, 46, 'States'),(1, 47, 'Merchandise Returns'),(1, 48, 'PDF'), (1, 49, 'Credit Slips'),(1, 51, 'Settings'),(1, 52, 'Subdomains'),(1, 53, 'DB backup'),(1, 54, 'Order Messages'), (1, 55, 'Delivery Slips'),(1, 56, 'SEO & URLs'),(1, 57, 'CMS'),(1, 58, 'Image Mapping'),(1, 59, 'Customer Messages'),(1, 60, 'Tracking'), @@ -755,7 +756,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES (2, 14, 'Bons de réduction'),(2, 15, 'Devises'),(2, 16, 'Taxes'),(2, 17, 'Transporteurs'),(2, 18, 'Pays'),(2, 19, 'Zones'),(2, 20, 'Tranches de prix'), (2, 21, 'Tranches de poids'),(2, 22, 'Positions'),(2, 23, 'Base de données'),(2, 24, 'Emails'),(2, 26, 'Images'),(2, 27, 'Produits'),(2, 28, 'Contacts'), (2, 29, 'Employés'),(2, 30, 'Profils'),(2, 31, 'Permissions'),(2, 32, 'Langues'),(2, 33, 'Traductions'),(2, 34, 'Fournisseurs'),(2, 35, 'Onglets'), -(2, 36, 'Caractéristiques'),(2, 37, 'Accès rapide'),(2, 38, 'Apparence'),(2, 39, 'Coordonnées'),(2, 40, 'Alias de recherche'),(2, 41, 'Import'),(2, 42, 'Factures'), +(2, 36, 'Caractéristiques'),(2, 37, 'Accès rapide'),(2, 38, 'Apparence'),(2, 39, 'Coordonnées'),(2, 40, 'Alias'),(2, 41, 'Import'),(2, 42, 'Factures'), (2, 43, 'Recherche'),(2, 44, 'Localisation'),(2, 46, 'Etats'),(2, 47, 'Retours produits'),(2, 48, 'PDF'),(2, 49, 'Avoirs'), (2, 51, 'Configuration'),(2, 52, 'Sous domaines'),(2, 53, 'Sauvegarde BDD'),(2, 54, 'Messages prédéfinis'),(2, 55, 'Bons de livraison'), (2, 56, 'SEO & URLs'),(2, 57, 'CMS'),(2, 58, 'Scènes'),(2, 59, 'Messages clients'),(2, 60, 'Suivi'),(2, 61, 'Moteurs de recherche'), @@ -770,7 +771,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES (3, 13, 'Estados'),(3, 14, 'Vales de descuento'),(3, 15, 'Divisas'),(3, 16, 'Impuestos'),(3, 17, 'Transportistas'),(3, 18, 'Países'),(3, 19, 'Zonas'), (3, 20, 'Franja de precios'),(3, 21, 'Franja de pesos'),(3, 22, 'Posiciones'),(3, 23, 'Base de datos'),(3, 24, 'Emails'),(3, 26, 'Imágenes'), (3, 27, 'Productos'),(3, 28, 'Contactos'),(3, 29, 'Empleados'),(3, 30, 'Perfiles'),(3, 31, 'Permisos'),(3, 32, 'Idiomas'),(3, 33, 'Traducciones'), -(3, 34, 'Proveedores'),(3, 35, 'Pestañas'),(3, 36, 'Características'),(3, 37, 'Acceso rápido'),(3, 38, 'Aspecto'),(3, 39, 'Datos'),(3, 40, 'Alias ​​de Investigación'), +(3, 34, 'Proveedores'),(3, 35, 'Pestañas'),(3, 36, 'Características'),(3, 37, 'Acceso rápido'),(3, 38, 'Aspecto'),(3, 39, 'Datos'),(3, 40, 'Alias'), (3, 41, 'Importar'),(3, 42, 'Facturas'),(3, 43, 'Búsqueda'),(3, 44, 'Ubicación'),(3, 46, 'Estados'),(3, 47, 'Devolución productos'),(3, 48, 'PDF'), (3, 49, 'Vales'),(3, 51, 'Configuración'),(3, 52, 'Subcampos'),(3, 53, 'Copia de seguridad'),(3, 54, 'Mensajes de Orden'), (3, 55, 'Albaranes de entrega'),(3, 56, 'SEO & URLs'),(3, 57, 'CMS'),(3, 58, 'Mapeo de la imagen'),(3, 59, 'Mensajes del cliente'),(3, 60, 'Rastreo'), @@ -784,7 +785,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES (4, 12, 'Adressen'),(4, 13, 'Status'),(4, 14, 'Gutscheine'),(4, 15, 'Währungen'),(4, 16, 'Steuern'),(4, 17, 'Lieferanten'),(4, 18, 'Länder'), (4, 19, 'Zonen'),(4, 20, 'Preislagen'),(4, 21, 'Gewichtsklassen'),(4, 22, 'Positionen'),(4, 23, 'Datenbank'),(4, 24, 'E-Mail'),(4, 26, 'Bild'), (4, 27, 'Produkte'),(4, 28, 'Kontakte'),(4, 29, 'Mitarbeiter'),(4, 30, 'Profile'),(4, 31, 'Berechtigungen'),(4, 32, 'Sprachen'),(4, 33, 'Übersetzungen'), -(4, 34, 'Zulieferer'),(4, 35, 'Tabs'),(4, 36, 'Funktionen'),(4, 37, 'Schnellzugriff'),(4, 38, 'Aussehen'),(4, 39, 'Kontaktinformation'),(4, 40, 'Suchname'), +(4, 34, 'Zulieferer'),(4, 35, 'Tabs'),(4, 36, 'Funktionen'),(4, 37, 'Schnellzugriff'),(4, 38, 'Aussehen'),(4, 39, 'Kontaktinformation'),(4, 40, 'Alias'), (4, 41, 'Import'),(4, 42, 'Rechnungen'),(4, 43, 'Suche'),(4, 44, 'Lokalisierung'),(4, 46, 'Staaten'),(4, 47, 'Warenrücksendungen'),(4, 48, 'PDF'), (4, 49, 'Gutscheine'),(4, 51, 'Einstellungen'),(4, 52, 'Subdomains'),(4, 53, 'DB-Backup'),(4, 54, 'Bestellnachrichten'), (4, 55, 'Lieferscheine'),(4, 56, 'SEO & URLs'),(4, 57, 'CMS'),(4, 58, 'Image Mapping'),(4, 59, 'Kundennachrichten'),(4, 60, 'Tracking'), @@ -799,7 +800,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES (5, 12, 'Indirizzi'),(5, 13, 'Status'),(5, 14, 'Voucher'),(5, 15, 'Valute'),(5, 16, 'Tasse'),(5, 17, 'Corrieri'),(5, 18, 'Nazioni'), (5, 19, 'Zone'),(5, 20, 'Fasce di prezzo'),(5, 21, 'Fasce di peso'),(5, 22, 'Posizioni'),(5, 23, 'Database'),(5, 24, 'E-mail'),(5, 26, 'Immagine'), (5, 27, 'Prodotti'),(5, 28, 'Contatti'),(5, 29, 'Impiegati'),(5, 30, 'Profili'),(5, 31, 'Permessi'),(5, 32, 'Lingue'),(5, 33, 'Traduzioni'), -(5, 34, 'Fornitori'),(5, 35, 'Tab'),(5, 36, 'Caratteristiche'),(5, 37, 'Accesso rapido'),(5, 38, 'Aspetto'),(5, 39, 'Informazioni di contatto'),(5, 40, 'Alias di ricerca'), +(5, 34, 'Fornitori'),(5, 35, 'Tab'),(5, 36, 'Caratteristiche'),(5, 37, 'Accesso rapido'),(5, 38, 'Aspetto'),(5, 39, 'Informazioni di contatto'),(5, 40, 'Alias'), (5, 41, 'Importa'),(5, 42, 'Fatture'),(5, 43, 'Cerca'),(5, 44, 'Localizzazione'),(5, 46, 'Stati'),(5, 47, 'Resi merci'),(5, 48, 'PDF'), (5, 49, 'Note di credito'),(5, 51, 'Impostazioni'),(5, 52, 'Sottodomini'),(5, 53, 'DB backup'),(5, 54, 'Messaggi ordine'), (5, 55, 'Note di consegna'),(5, 56, 'SEO & URLs'),(5, 57, 'CMS'),(5, 58, 'Mappatura immagine'),(5, 59, 'Messaggi cliente'),(5, 60, 'Rintracciare'), diff --git a/install-dev/sql/upgrade/1.4.5.0.sql b/install-dev/sql/upgrade/1.4.5.0.sql new file mode 100644 index 000000000..0f3d8270a --- /dev/null +++ b/install-dev/sql/upgrade/1.4.5.0.sql @@ -0,0 +1,14 @@ +SET NAMES 'utf8'; + +INSERT IGNORE INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES +('PS_RESTRICT_DELIVERED_COUNTRIES', '0', NOW(), NOW()); + +UPDATE `PREFIX_country_lang` +SET `name` = 'United States' +WHERE `name` = 'United State' +AND `id_lang` = ( + SELECT `id_lang` + FROM `PREFIX_lang` + WHERE `iso_code` = 'en' + LIMIT 1 +); \ No newline at end of file diff --git a/install-dev/view.css b/install-dev/view.css index 09810edd1..b56d05d1b 100644 --- a/install-dev/view.css +++ b/install-dev/view.css @@ -126,6 +126,7 @@ h1 {font-size:24px;} h2 { padding-bottom:20px; font-size:18px; + line-height:20px; } h3 { padding-bottom:20px; @@ -161,6 +162,7 @@ input.button { padding:0 30px; height:31px; line-height:31px; + font-weight:bold; color:#fff; text-shadow:0 1px 0 #0d7903; background:#039701 url(img/bt.png) repeat-x 0 0; @@ -191,7 +193,7 @@ input.text { padding:0 6px; height:22px; width:218px;/* 230 */ - background:#fff img(img/bg-input-text.png) repeat-x 0 0; + background:#fff url(img/bg_input_button.png) repeat-x 0 0; border:1px solid #ccc; } select { @@ -316,6 +318,7 @@ ol#tabs{ color:#adadad; } ol#tabs li.selected{ + font-weight: bold; color:#000; background : url(img/bg-li-tabs.png) no-repeat 1px 15px; } @@ -380,6 +383,8 @@ ul#footer a:link, ul#footer a:active, ul#footer a:visited { } .sheet .contentTitle .stepList li.ok {background-position:0 -50px;} .sheet .contentTitle .stepList li.ko {background-position:0 -100px;} + .sheet .contentTitle h1 {text-shadow:0 1px 0 #fff;} + .sheet .contentTitle ul {list-style-type:none;} li.title { margin:0; @@ -472,8 +477,7 @@ ul#optional {list-style-type:none;} #mailPart .userInfos { padding-left:18px; - font-size:11px; - font-style:italic; + font: 11px Georgia, Arial, Sans-serif italic; color:#999; } diff --git a/install-dev/xml/checkShopInfos.php b/install-dev/xml/checkShopInfos.php index c125e7296..9f20a132d 100644 --- a/install-dev/xml/checkShopInfos.php +++ b/install-dev/xml/checkShopInfos.php @@ -199,8 +199,8 @@ if (isFormValid()) require_once(dirname(__FILE__).'/../../classes/LocalizationPack.php'); - $context = stream_context_create(array('http' => array('timeout' => 5))); - $localization_file = @Tools::file_get_contents('http://www.prestashop.com/download/localization_pack.php?country='.$_GET['countryName'], false, $context); + $stream_context = stream_context_create(array('http' => array('timeout' => 5))); + $localization_file = @Tools::file_get_contents('http://www.prestashop.com/download/localization_pack.php?country='.$_GET['countryName'], false, $stream_context); if (!$localization_file AND file_exists(dirname(__FILE__).'/../../localization/'.strtolower($_GET['countryName']).'.xml')) $localization_file = @file_get_contents(dirname(__FILE__).'/../../localization/'.strtolower($_GET['countryName']).'.xml'); if ($localization_file) diff --git a/modules/blockcustomerprivacy/es.php b/modules/blockcustomerprivacy/es.php new file mode 100644 index 000000000..64c3a7def --- /dev/null +++ b/modules/blockcustomerprivacy/es.php @@ -0,0 +1,13 @@ +blockcustomerprivacy_0cec62d1bea02fbb1484d55d14f493dd'] = 'Bloque de privacidad de datos de los clientes'; +$_MODULE['<{blockcustomerprivacy}prestashop>blockcustomerprivacy_3a32ec2dbd8d955f6240d95d6004557c'] = 'Agrega un bloque para mostrar un mensaje respecto a la privacidad de los datos.'; +$_MODULE['<{blockcustomerprivacy}prestashop>blockcustomerprivacy_20015706a8cbd457cbb6ea3e7d5dc9b3'] = 'Configuración actualizada'; +$_MODULE['<{blockcustomerprivacy}prestashop>blockcustomerprivacy_b75fe4f32f17eb695f145704a8909146'] = 'Mensaje sobre la privacidad de datos de los clientes'; +$_MODULE['<{blockcustomerprivacy}prestashop>blockcustomerprivacy_03e6791c07164957bb87bfad5030f846'] = 'Mensaje que se mostrará en el formulario de creación de la cuenta.'; +$_MODULE['<{blockcustomerprivacy}prestashop>blockcustomerprivacy_2d4e74ab9c95452f5948cd959d186b6d'] = 'Sugerencias: Recuerde que si el texto es demasiado largo para ser escrito directamente en el formulario, puede añadir un enlace a una de sus páginas creadas a través de la ficha de la CMS.'; +$_MODULE['<{blockcustomerprivacy}prestashop>blockcustomerprivacy_c9cc8cce247e49bae79f15173ce97354'] = 'Guardar'; +$_MODULE['<{blockcustomerprivacy}prestashop>blockcustomerprivacy_ffeb523df77567c7fad7faf8af5f7e46'] = 'Por favor, acepte el acuerdo sobre la privacidad de los datos de los clientes marcando la casilla de abajo.'; +$_MODULE['<{blockcustomerprivacy}prestashop>blockcustomerprivacy_fb0440f9ca32a8b49eded51b09e70821'] = 'Privacidad de los datos de los clientes'; diff --git a/modules/blocklayered/es.php b/modules/blocklayered/es.php index a5dc11e7f..304b8ae04 100644 --- a/modules/blocklayered/es.php +++ b/modules/blocklayered/es.php @@ -4,32 +4,55 @@ global $_MODULE; $_MODULE = array(); $_MODULE['<{blocklayered}prestashop>blocklayered_84241e458cdd5162745500a59a3680f3'] = 'Bloque navegación por facetas'; $_MODULE['<{blocklayered}prestashop>blocklayered_2d08fa8e157fe3f1875402cbd98aee1b'] = 'Muestra un bloque con los filtros de la navegación por facetas'; +$_MODULE['<{blocklayered}prestashop>blocklayered_1b90c001d668d0ec894392d8e6695054'] = 'Debe habilitar la extensión cURL en el servidor si desea utilizar un link corto.'; $_MODULE['<{blocklayered}prestashop>blocklayered_7ad3f384bcf30d783b5a6f6c810b4762'] = 'La base de datos por niveles de navegación se ha iniciado con éxito'; +$_MODULE['<{blocklayered}prestashop>blocklayered_817c37b9c1f5cd4a450dad384e63e6c7'] = 'Su filtro'; +$_MODULE['<{blocklayered}prestashop>blocklayered_3185cefd67b575e582063148e4f15860'] = 'se ha actualizado correctamente.'; +$_MODULE['<{blocklayered}prestashop>blocklayered_7ccab4d8de5d6b9bb61e99c7bba343ab'] = 'se ha añadido correctamente.'; $_MODULE['<{blocklayered}prestashop>blocklayered_6e7db02664c13dd5b517a12eafab88b1'] = 'El nombre de usuario Bit.ly está vacío'; $_MODULE['<{blocklayered}prestashop>blocklayered_f5da5c32121b39bb2100b9b63ccf4c4c'] = 'Api_key Bit.ly está vacía'; $_MODULE['<{blocklayered}prestashop>blocklayered_fe016d3b990c2a9dd72ab6b45892f2ae'] = 'Configuración guardada con éxito'; $_MODULE['<{blocklayered}prestashop>blocklayered_bb291cb01196158549fba8f6fe636d4a'] = 'Los ajustes no se guardan'; +$_MODULE['<{blocklayered}prestashop>blocklayered_4ad0f0fe31d93e0d8dd7a7fc69a72784'] = 'Filtros de plantilla borrados, categorías actualizadas (modelo por defecto aplicado).'; +$_MODULE['<{blocklayered}prestashop>blocklayered_91e77d047f2496b7ba8c9def96d03324'] = 'Plantilla de filtros que no se encuentran'; $_MODULE['<{blocklayered}prestashop>blocklayered_09da2b6f1217055bb22caa6ea08d9b80'] = 'Capas de navegación'; -$_MODULE['<{blocklayered}prestashop>blocklayered_382a0cf3c7ea26e9c7d0642d6d0ec07d'] = 'Este módulo se encuentra en versión beta y se mejorará'; -$_MODULE['<{blocklayered}prestashop>blocklayered_016d6031144c99f759b36c5e00c79e91'] = '10 mejoras futuras'; -$_MODULE['<{blocklayered}prestashop>blocklayered_b77ae7b3f227f97fdbfbaee819c048d6'] = 'Actualizar en tiempo real de la tabla de caché'; -$_MODULE['<{blocklayered}prestashop>blocklayered_3cd881c5805a5564b080022968081652'] = 'Filtros adicionales (precios, peso)'; -$_MODULE['<{blocklayered}prestashop>blocklayered_f67587ba40eff59a15796352c9037ddf'] = 'Capacidad de gestión de filtros por categoría en la configuración del módulo'; -$_MODULE['<{blocklayered}prestashop>blocklayered_559175435fec02f846564385b20b98e2'] = 'Capacidad de ocultar los grupos de filtro sin valores y los valores con 0 productos'; -$_MODULE['<{blocklayered}prestashop>blocklayered_abb461f7d4d8271a12ceead064d13cd0'] = 'Estadísticas y análisis'; -$_MODULE['<{blocklayered}prestashop>blocklayered_6af4dd46928a781eda42b940d3394ca6'] = 'Administrar tipo de productos y paginación'; -$_MODULE['<{blocklayered}prestashop>blocklayered_b4ecb2bd1ea5153550669329db53277d'] = 'Añadir un cheque a la tabla categoría_grupo'; -$_MODULE['<{blocklayered}prestashop>blocklayered_d99bf479cc40101e28f1f0ba1bfb6150'] = 'Los links SEO y la construcción de URL en tiempo real (capacidad de dar la dirección a alguien)'; -$_MODULE['<{blocklayered}prestashop>blocklayered_27c7b93d882068a1137a9350c7f1a132'] = 'Añadir más opciones en la configuración del módulo'; -$_MODULE['<{blocklayered}prestashop>blocklayered_fb8082696a8d7a40fa62ea0e89b18c32'] = 'Ejecución mejoras'; -$_MODULE['<{blocklayered}prestashop>blocklayered_7263de0a10ad25dfdadc44791c44fb1f'] = 'Inicialización de caché'; -$_MODULE['<{blocklayered}prestashop>blocklayered_d15ce73cbadfe1e806ee7abd08a7fe4d'] = 'Antes de usar este módulo por primera vez tiene que inicializar el caché'; -$_MODULE['<{blocklayered}prestashop>blocklayered_2875534393f5ef32e42d92c30e9dfda5'] = 'Advertencia: Esto puede tardar varios minutos.'; -$_MODULE['<{blocklayered}prestashop>blocklayered_15aa842a19af51c2cf1ec631cdf8337a'] = 'Si no lo hace, esta tabla caché podría ser cada vez más grande ( y ser menos eficaz), y sus visitantes no tendrán acceso a todas las nuevas opciones (atributos, características).'; -$_MODULE['<{blocklayered}prestashop>blocklayered_c64a069750ff8924b029b2206cabf3b2'] = 'Inicializar la base de datos de navegación por capas'; +$_MODULE['<{blocklayered}prestashop>blocklayered_a607dc3941415ecea04bb1eb8a978962'] = 'Plantillas de los filtros existentes'; +$_MODULE['<{blocklayered}prestashop>blocklayered_9923a3739235561cc50eb9446dc1771e'] = 'las plantillas de filtros están configuradas:'; +$_MODULE['<{blocklayered}prestashop>blocklayered_7dce122004969d56ae2e0245cb754d35'] = 'Editar'; +$_MODULE['<{blocklayered}prestashop>blocklayered_d180b4e0681bba834c76b479590e1c1e'] = 'Eliminar plantilla de filtro #'; +$_MODULE['<{blocklayered}prestashop>blocklayered_d1457b72c3fb323a2671125aef3eab5d'] = '?'; +$_MODULE['<{blocklayered}prestashop>blocklayered_f2a6c498fb90ee345d997f888fce3b18'] = 'Borrar'; +$_MODULE['<{blocklayered}prestashop>blocklayered_058eeeba77f547f8a9a295a0efd4f6cd'] = 'No se encontró plantilla de filtro.'; +$_MODULE['<{blocklayered}prestashop>blocklayered_cb54e4c9b7712ca15c711aeacfabf0a2'] = 'Construya su propia plantilla de filtros'; +$_MODULE['<{blocklayered}prestashop>blocklayered_0ce4150f57948567deeaa58d0c367412'] = 'Paso 1 / 3 - Seleccione las categorías'; +$_MODULE['<{blocklayered}prestashop>blocklayered_99cdd6365310333a594b16e5658eee5c'] = 'Utilice esta plantilla para:'; +$_MODULE['<{blocklayered}prestashop>blocklayered_62f5d708d6ad1fa1ddd9429a65cccbea'] = 'Todas las categorías'; +$_MODULE['<{blocklayered}prestashop>blocklayered_fe0619d5f4999e09c622e32da7e7566a'] = 'Específicas'; +$_MODULE['<{blocklayered}prestashop>blocklayered_b0b5ccb4a195a07fd3eed14affb8695f'] = 'categorías'; +$_MODULE['<{blocklayered}prestashop>blocklayered_ef7de3f485174ff47f061ad27d83d0ee'] = 'seleccionadas'; +$_MODULE['<{blocklayered}prestashop>blocklayered_f72c75bdf80dc88b2529162f4947edc8'] = 'Por favor, seleccione al menos una categoría específica o seleccione \"Todas las categorías\".'; +$_MODULE['<{blocklayered}prestashop>blocklayered_64646db703ca003a37bd1e73977a3a4d'] = 'Categorías a partir de esta plantilla'; +$_MODULE['<{blocklayered}prestashop>blocklayered_d758a9754eb9f36db05c22ad0c77e38e'] = 'Seleccione al menos una categoría con esta plantilla de filtro'; +$_MODULE['<{blocklayered}prestashop>blocklayered_5965d2ce192837f00d743d8a674382c1'] = 'Pulse el botón \"Guardar esta selección\" o cerrar la ventana para guardar'; +$_MODULE['<{blocklayered}prestashop>blocklayered_72dd03f11489ff6f604a4eb57c957202'] = 'Guardar esta selección'; +$_MODULE['<{blocklayered}prestashop>blocklayered_2e527847e8c785f3fd99651f64006798'] = 'Paso 2 / 3 - Seleccione los filtros'; +$_MODULE['<{blocklayered}prestashop>blocklayered_3488a51eb7f723d65daeff912e69b177'] = 'Filtros seleccionados'; +$_MODULE['<{blocklayered}prestashop>blocklayered_cf3cd81b30d4c4fd996ae5374fe656da'] = 'No se ha elegido ningún filtro todavía.'; +$_MODULE['<{blocklayered}prestashop>blocklayered_8524de963f07201e5c086830d370797f'] = 'Cargando ...'; +$_MODULE['<{blocklayered}prestashop>blocklayered_597c70730ebddba7d845e686665f9f28'] = 'Ha seleccionado-Todas las categorías, todas las plantillas de filtro existentes se eliminarán, ¿está de acuerdo?'; +$_MODULE['<{blocklayered}prestashop>blocklayered_74a6a547d86659933a210680efb6e6d1'] = 'Paso 3 / 3 - de un nombre a la plantilla'; +$_MODULE['<{blocklayered}prestashop>blocklayered_f8263d99054a4cdb3428196f078fa212'] = 'Nombre de la plantilla:'; +$_MODULE['<{blocklayered}prestashop>blocklayered_b96ce93c61b856a0163c116820646b19'] = 'Mi plantilla'; +$_MODULE['<{blocklayered}prestashop>blocklayered_5f514b580ea1b6bdb681916bc1deb207'] = 'sólo como un recordatorio'; +$_MODULE['<{blocklayered}prestashop>blocklayered_ef1094d9826e98f5417e0a37f1742133'] = 'Guardar esta plantilla de filtro'; $_MODULE['<{blocklayered}prestashop>blocklayered_254f642527b45bc260048e30704edb39'] = 'Configuración'; -$_MODULE['<{blocklayered}prestashop>blocklayered_32cd1899a36fd598df5a4e417bc6339a'] = 'Posible compartir URL'; -$_MODULE['<{blocklayered}prestashop>blocklayered_05ce875b6f1cb8477077f33bad5e9325'] = 'Al activar esta opción, sus visitantes comparten la dirección URL de su búsqueda'; +$_MODULE['<{blocklayered}prestashop>blocklayered_054b4f3ea543c990f6b125f41af6ebf7'] = 'Opción'; +$_MODULE['<{blocklayered}prestashop>blocklayered_689202409e48743b914713f96d93947c'] = 'Valor'; +$_MODULE['<{blocklayered}prestashop>blocklayered_9868c3ac0748acf3b981a96cfe163ee8'] = 'Ocultar los valores de filtro cuando no hay ningún producto en venta'; +$_MODULE['<{blocklayered}prestashop>blocklayered_93cba07454f06a4a960172bbd6e2a435'] = 'Sí'; +$_MODULE['<{blocklayered}prestashop>blocklayered_bafd7322c6e97d25b6299b5d6fe8920b'] = 'No'; +$_MODULE['<{blocklayered}prestashop>blocklayered_8531c73de81b9ed94322dda7cf947daa'] = 'Mostrar el número de productos que concuerden'; +$_MODULE['<{blocklayered}prestashop>blocklayered_8b6c3aa61f1e15caefb66e68e7e64924'] = 'Permitir a los clientes compartir URLs'; $_MODULE['<{blocklayered}prestashop>blocklayered_abc07e5243a77d8bebcadd90fca23d74'] = 'Para ofrecer a sus clientes enlaces cortos, crear una cuenta en bit.ly, luego copiar y pegar usuario y API key'; $_MODULE['<{blocklayered}prestashop>blocklayered_d67850bd126f070221dcfd5fa6317043'] = 'Regístrate'; $_MODULE['<{blocklayered}prestashop>blocklayered_68fd0151074a3dba747f94b2fd8cf5f4'] = 'Ingresar bit.ly'; @@ -45,10 +68,22 @@ $_MODULE['<{blocklayered}prestashop>blocklayered_fcebe56087b9373f15514831184fa57 $_MODULE['<{blocklayered}prestashop>blocklayered_2d25c72c1b18e562f6654fff8e11711e'] = 'No disponible'; $_MODULE['<{blocklayered}prestashop>blocklayered_c0bd7654d5b278e65f21cf4e9153fdb4'] = 'Fabricante'; $_MODULE['<{blocklayered}prestashop>blocklayered_8c489d0946f66d17d73f26366a4bf620'] = 'Peso'; +$_MODULE['<{blocklayered}prestashop>blocklayered_308edffd52afae39cc6277e246ec5df8'] = 'Filtros disponibles'; +$_MODULE['<{blocklayered}prestashop>blocklayered_cfbc982f8fb7a0cc3abb3c85c795ab41'] = 'Filtro de Subcategorías '; +$_MODULE['<{blocklayered}prestashop>blocklayered_cd50ff1c5332f9920acf8173c4aab425'] = 'Filtro stock del producto'; +$_MODULE['<{blocklayered}prestashop>blocklayered_048c1728a0a6cf36f56c9dcdd23d8a14'] = 'Filtro estado del producto'; +$_MODULE['<{blocklayered}prestashop>blocklayered_02ecc2cbb645a2b859deba6907334cc8'] = 'Filtro fabricante del producto'; +$_MODULE['<{blocklayered}prestashop>blocklayered_cc72ed9534a489b5d2e5882735bf1364'] = 'Filtro peso del producto'; +$_MODULE['<{blocklayered}prestashop>blocklayered_d73c57be7aad115d20508215e8ea9951'] = 'Grupo de atributos'; +$_MODULE['<{blocklayered}prestashop>blocklayered_736b91750e516139acc13c5eb6564f92'] = 'atributos'; +$_MODULE['<{blocklayered}prestashop>blocklayered_d2eb444e35c0a71f0a85df8194acb5b6'] = 'atributo'; +$_MODULE['<{blocklayered}prestashop>blocklayered_ee59f74265cd7f85d0ad30206a1a89b0'] = 'Este grupo permitirá al usuario seleccionar un color'; +$_MODULE['<{blocklayered}prestashop>blocklayered_b07e7131a6007b2a1a765bdd0e1e4894'] = 'Característica:'; +$_MODULE['<{blocklayered}prestashop>blocklayered_f09cc7ee3a9a93273f4b80601cafb00c'] = 'valores'; +$_MODULE['<{blocklayered}prestashop>blocklayered_2063c1608d6e0baf80249c42e2be5804'] = 'valor'; $_MODULE['<{blocklayered}prestashop>blocklayered_c32516babc5b6c47eb8ce1bfc223253c'] = 'Catálogo'; $_MODULE['<{blocklayered}prestashop>blocklayered_aa3c0ac7e57fcf0e2e25d270ff502b6e'] = 'Compartir su búsqueda'; $_MODULE['<{blocklayered}prestashop>blocklayered_1262d1b9fbffb3a8e85ac9e4b449e989'] = 'filtros habilitados:'; $_MODULE['<{blocklayered}prestashop>blocklayered_853ae90f0351324bd73ea615e6487517'] = ':'; $_MODULE['<{blocklayered}prestashop>blocklayered_ea4788705e6873b424c65e91c2846b19'] = 'Cancelar'; -$_MODULE['<{blocklayered}prestashop>blocklayered_87ba2ecc8b6915e8bd6f5089918229fd'] = 'Franja'; -$_MODULE['<{blocklayered}prestashop>blocklayered_8524de963f07201e5c086830d370797f'] = 'Cargando ...'; +$_MODULE['<{blocklayered}prestashop>blocklayered_75954a3c6f2ea54cb9dff249b6b5e8e6'] = 'Rango:'; diff --git a/modules/blocklink/config.xml b/modules/blocklink/config.xml index ca288f68f..726e2f5c9 100755 --- a/modules/blocklink/config.xml +++ b/modules/blocklink/config.xml @@ -8,6 +8,6 @@ Are you sure you want to delete all your links ? 1 - 1 + 0 \ No newline at end of file diff --git a/modules/canadapost/canadapost.php b/modules/canadapost/canadapost.php new file mode 100755 index 000000000..fa8aad782 --- /dev/null +++ b/modules/canadapost/canadapost.php @@ -0,0 +1,1691 @@ + +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 7288 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ +if (!defined('_CAN_LOAD_FILES_')) + exit; + +class CanadaPost extends CarrierModule +{ + public $id_carrier; + + private $_html = ''; + private $_postErrors = array(); + private $_webserviceTestResult = ''; + private $_webserviceError = ''; + private $_fieldsList = array(); + private $_calculModeList = array(); + private $_dimensionUnit = ''; + private $_weightUnit = ''; + private $_dimensionUnitList = array('CM' => 'CM', 'IN' => 'IN', 'CMS' => 'CM', 'INC' => 'IN'); + private $_weightUnitList = array('KG' => 'KGS', 'KGS' => 'KGS', 'LBS' => 'LBS', 'LB' => 'LBS'); + private $_moduleName = 'canadapost'; + + /* + ** Construct Method + ** + */ + + public function __construct() + { + $this->name = 'canadapost'; + $this->tab = 'shipping_logistics'; + $this->version = '0.1'; + $this->author = 'PrestaShop'; + $this->limited_countries = array('ca'); + + parent::__construct (); + + $this->displayName = $this->l('Canada Post Carrier'); + $this->description = $this->l('Offer your customers, different delivery methods with Canada Post'); + + if (self::isInstalled($this->name)) + { + // Loading Var + $warning = array(); + $this->loadingVar(); + + // Check cURL option availibility + if (!is_callable('curl_exec')) + $warning[] = "'".$this->l('cURL option')."', "; + + // Check Configuration Values + foreach ($this->_fieldsList as $keyConfiguration => $name) + if (!Configuration::get($keyConfiguration) && !empty($name)) + $warning[] = '\''.$name.'\' '; + + // Check calcul mode + if (!Configuration::get('CP_CARRIER_CALCUL_MODE')) + Configuration::updateValue('CP_CARRIER_CALCUL_MODE', 'onepackage'); + + // Checking Unit + $this->_dimensionUnit = $this->_dimensionUnitList[strtoupper(Configuration::get('PS_DIMENSION_UNIT'))]; + $this->_weightUnit = $this->_weightUnitList[strtoupper(Configuration::get('PS_WEIGHT_UNIT'))]; + if (!$this->_weightUnit || !$this->_weightUnitList[$this->_weightUnit]) + $warning[] = $this->l('\'Weight Unit (LB or KG).\'').' '; + if (!$this->_dimensionUnit || !$this->_dimensionUnitList[$this->_dimensionUnit]) + $warning[] = $this->l('\'Dimension Unit (CM or IN).\'').' '; + + // Generate Warnings + if (count($warning)) + $this->warning .= implode(' , ',$warning).$this->l('must be configured to use this module correctly').' '; + } + } + + public function loadingVar() + { + // Loading Fields List + $this->_fieldsList = array( + 'CP_CARRIER_ACCOUNT' => $this->l('Canada Post account'), + 'CP_CARRIER_PACKAGING_WEIGHT' => $this->l('Packaging weight'), + 'CP_CARRIER_HANDLING_FEE' => $this->l('Handling fee'), + 'CP_CARRIER_ADDRESS1' => '', + 'CP_CARRIER_ADDRESS2' => '', + 'CP_CARRIER_POSTAL_CODE' => '', + 'CP_CARRIER_CITY' => '', + 'CP_CARRIER_STATE' => '', + 'CP_CARRIER_COUNTRY' => '', + 'CP_CARRIER_CALCUL_MODE' => '', + ); + + // Loading calcul mode list + $this->_calculModeList = array( + 'onepackage' => $this->l('All items in one package'), + 'split' => $this->l('Split one item per package') + ); + } + + + + /* + ** Install / Uninstall Methods + ** + */ + + public function install() + { + // Install SQL + include(dirname(__FILE__).'/sql-install.php'); + foreach ($sql as $s) + if (!Db::getInstance()->Execute($s)) + return false; + + // Install Carriers + $this->installCarriers(); + + // Install Module + if (!parent::install() OR !$this->registerHook('updateCarrier')) + return false; + + return true; + } + + public function uninstall() + { + // Uninstall Carriers + Db::getInstance()->autoExecute(_DB_PREFIX_.'carrier', array('deleted' => 1), 'UPDATE', '`external_module_name` = \'canadapost\' OR `id_carrier` IN (SELECT DISTINCT(`id_carrier`) FROM `'._DB_PREFIX_.'cp_rate_service_code`)'); + + // Uninstall Config + foreach ($this->_fieldsList as $keyConfiguration => $name) + if (!Configuration::deleteByName($keyConfiguration)) + return false; + + // Uninstall SQL + include(dirname(__FILE__).'/sql-uninstall.php'); + foreach ($sql as $s) + if (!Db::getInstance()->Execute($s)) + return false; + + // Uninstall Module + if (!parent::uninstall() OR !$this->unregisterHook('updateCarrier')) + return false; + + return true; + } + + public function installCarriers() + { + // Unactive all CanadaPost Carriers + Db::getInstance()->autoExecute(_DB_PREFIX_.'cp_rate_service_code', array('active' => 0), 'UPDATE'); + + // Get all services availables + $rateServiceList = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'cp_rate_service_code`'); + foreach ($rateServiceList as $rateService) + if (!$rateService['id_carrier']) + { + $config = array( + 'name' => $rateService['service'], + 'id_tax_rules_group' => 0, + 'active' => true, + 'deleted' => 0, + 'shipping_handling' => false, + 'range_behavior' => 0, + 'delay' => array('fr' => $rateService['delay'], 'en' => $rateService['delay'], Language::getIsoById(Configuration::get('PS_LANG_DEFAULT')) => $rateService['delay']), + 'id_zone' => 1, + 'is_module' => true, + 'shipping_external' => true, + 'external_module_name' => $this->_moduleName, + 'need_range' => true + ); + $id_carrier = $this->installExternalCarrier($config); + Db::getInstance()->autoExecute(_DB_PREFIX_.'cp_rate_service_code', array('id_carrier' => (int)($id_carrier), 'id_carrier_history' => (int)($id_carrier)), 'UPDATE', '`id_cp_rate_service_code` = '.(int)($rateService['id_cp_rate_service_code'])); + } + } + + public static function installExternalCarrier($config) + { + $carrier = new Carrier(); + $carrier->name = $config['name']; + $carrier->id_tax_rules_group = $config['id_tax_rules_group']; + $carrier->id_zone = $config['id_zone']; + $carrier->active = $config['active']; + $carrier->deleted = $config['deleted']; + $carrier->delay = $config['delay']; + $carrier->shipping_handling = $config['shipping_handling']; + $carrier->range_behavior = $config['range_behavior']; + $carrier->is_module = $config['is_module']; + $carrier->shipping_external = $config['shipping_external']; + $carrier->external_module_name = $config['external_module_name']; + $carrier->need_range = $config['need_range']; + + $languages = Language::getLanguages(true); + foreach ($languages as $language) + { + if ($language['iso_code'] == 'fr') + $carrier->delay[(int)$language['id_lang']] = $config['delay'][$language['iso_code']]; + if ($language['iso_code'] == 'en') + $carrier->delay[(int)$language['id_lang']] = $config['delay'][$language['iso_code']]; + if ($language['iso_code'] == Language::getIsoById(Configuration::get('PS_LANG_DEFAULT'))) + $carrier->delay[(int)$language['id_lang']] = $config['delay'][$language['iso_code']]; + } + + if ($carrier->add()) + { + $groups = Group::getGroups(true); + foreach ($groups as $group) + Db::getInstance()->autoExecute(_DB_PREFIX_.'carrier_group', array('id_carrier' => (int)($carrier->id), 'id_group' => (int)($group['id_group'])), 'INSERT'); + + $rangePrice = new RangePrice(); + $rangePrice->id_carrier = $carrier->id; + $rangePrice->delimiter1 = '0'; + $rangePrice->delimiter2 = '10000'; + $rangePrice->add(); + + $rangeWeight = new RangeWeight(); + $rangeWeight->id_carrier = $carrier->id; + $rangeWeight->delimiter1 = '0'; + $rangeWeight->delimiter2 = '10000'; + $rangeWeight->add(); + + $zones = Zone::getZones(true); + foreach ($zones as $zone) + { + Db::getInstance()->autoExecute(_DB_PREFIX_.'carrier_zone', array('id_carrier' => (int)($carrier->id), 'id_zone' => (int)($zone['id_zone'])), 'INSERT'); + Db::getInstance()->autoExecuteWithNullValues(_DB_PREFIX_.'delivery', array('id_carrier' => (int)($carrier->id), 'id_range_price' => (int)($rangePrice->id), 'id_range_weight' => NULL, 'id_zone' => (int)($zone['id_zone']), 'price' => '0'), 'INSERT'); + Db::getInstance()->autoExecuteWithNullValues(_DB_PREFIX_.'delivery', array('id_carrier' => (int)($carrier->id), 'id_range_price' => NULL, 'id_range_weight' => (int)($rangeWeight->id), 'id_zone' => (int)($zone['id_zone']), 'price' => '0'), 'INSERT'); + } + + // Copy Logo + if (!copy(dirname(__FILE__).'/carrier.jpg', _PS_SHIP_IMG_DIR_.'/'.(int)$carrier->id.'.jpg')) + return false; + + // Return ID Carrier + return (int)($carrier->id); + } + + return false; + } + + + + /* + ** Global Form Config Methods + ** + */ + + public function getContent() + { + $this->_html .= '

    ' . $this->l('Canada Post Carrier').'

    '; + if (!empty($_POST) AND Tools::isSubmit('submitSave')) + { + $this->_postValidation(); + if (!sizeof($this->_postErrors)) + $this->_postProcess(); + else + foreach ($this->_postErrors AS $err) + $this->_html .= '
    nok '.$err.'
    '; + } + $this->_displayForm(); + return $this->_html; + } + + private function _displayForm() + { + $this->_html .= '
    + '.$this->l('Canada Post Module Status').''; + + $alert = array(); + $this->_webserviceTestResult = $this->webserviceTest(); + if (!Configuration::get('CP_CARRIER_ACCOUNT')) + $alert['generalSettings'] = 1; + if (Db::getInstance()->getValue('SELECT * FROM `'._DB_PREFIX_.'cp_rate_service_code` WHERE `active` = 1') < 1) + $alert['deliveryServices'] = 1; + if (!$this->_webserviceTestResult) + $alert['webserviceTest'] = 1; + if (!is_callable('curl_exec')) + $alert['curl'] = 1; + + + if (!count($alert)) + $this->_html .= ''.$this->l('Canada Post Carrier is configured and online!').''; + else + { + $this->_html .= ''.$this->l('Canada Post Carrier is not configured yet, you must:').''; + $this->_html .= '
    '.(isset($alert['generalSettings']) ? '' : '').' 1) '.$this->l('Fill the "General Settings" form'); + $this->_html .= '
    '.(isset($alert['deliveryServices']) ? '' : '').' 2) '.$this->l('Select your available delivery service'); + $this->_html .= '
    '.(isset($alert['webserviceTest']) ? '' : '').' 3) '.$this->l('Webservice test connection').($this->_webserviceError ? ' : '.$this->_webserviceError : ''); + $this->_html .= '
    '.(isset($alert['curl']) ? '' : '').' 4) '.$this->l('cURL is enabled'); + } + + + $this->_html .= '
     
    '; + $this->_html .= $this->_displayFormConfig(); + } + + private function _postValidation() + { + if (Tools::getValue('section') == 'general') + $this->_postValidationGeneral(); + elseif (Tools::getValue('section') == 'category') + $this->_postValidationCategory(); + elseif (Tools::getValue('section') == 'product') + $this->_postValidationProduct(); + } + + private function _postProcess() + { + if (Tools::getValue('section') == 'general') + $this->_postProcessGeneral(); + elseif (Tools::getValue('section') == 'category') + $this->_postProcessCategory(); + elseif (Tools::getValue('section') == 'product') + $this->_postProcessProduct(); + } + + + + + /* + ** General Form Config Methods + ** + */ + + private function _displayFormConfig() + { + $html = ' + +
    + + + + +
    +
    +
    + + + '; + if (isset($_GET['id_tab'])) + $html .= ''; + return $html; + } + + private function _displayFormGeneral() + { + global $cookie; + $configCurrency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT')); + + $html = ' + + + + + +
    +

    '.$this->l('General configuration').' :

    + +
    +

    + +
    + + '.Tools::getValue('ps_weight_unit', Configuration::get('PS_WEIGHT_UNIT')).' +
    + +
    + + '.$configCurrency->sign.' +
    +
    + +
    +

    '.$this->l('Localization configuration').' :

    + +
    + +

    '.$this->l('The weight unit of your shop (eg. kg or lbs)').'

    +
    + +
    + +

    '.$this->l('The dimension unit of your shop (eg. cm or in)').'

    +
    +
    + +
    +

    '.$this->l('Address configuration').' :

    + +
    + +
    + +

    + +
    + +
    + +

    ' . $this->l('Select country from within the list.') . '

    +
    + +
    '; + $id_country_current = 0; + $statesList = Db::getInstance()->ExecuteS(' + SELECT `id_state`, `id_country`, `name` + FROM `'._DB_PREFIX_.'state` WHERE `active` = 1 + ORDER BY `id_country`, `name` ASC'); + foreach ($statesList as $v) + { + if ($id_country_current != $v['id_country']) + { + if ($id_country_current != 0) + $html .= ''; + $html .= '
    '.$this->l('There is no state configuration for this country').'
    + +
    +
    + +
    +

    '.$this->l('Service configuration').' :

    + + +
    + +

    ' . $this->l('Using the calcul mode "All items in one package" will automatically use default packaging size and delivery services. Specifics configurations for categories or product won\'t be use.') . '

    +
    + +
    '; + $rateServiceList = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'cp_rate_service_code`'); + foreach($rateServiceList as $rateService) + $html .= ' '.$rateService['service'].' '.($this->webserviceTest($rateService['code']) ? '('.$this->l('Available').')' : '('.$this->l('Not available').')').'
    '; + $html .= ' +

    ' . $this->l('Choose the delivery service which will be available for customers.') . '

    +
    +
    + +
    + + + '; + return $html; + } + + private function _postValidationGeneral() + { + // Check configuration values + if (Tools::getValue('cp_carrier_account') == NULL) + $this->_postErrors[] = $this->l('Your Canada Post account is not specified'); + elseif (Tools::getValue('cp_carrier_postal_code') == NULL) + $this->_postErrors[] = $this->l('Your Zip / Postal code is not specified'); + elseif (Tools::getValue('cp_carrier_city') == NULL) + $this->_postErrors[] = $this->l('Your city is not specified'); + elseif (Tools::getValue('cp_carrier_country') == NULL OR Tools::getValue('cp_carrier_country') == 0) + $this->_postErrors[] = $this->l('Your country is not specified'); + + + + // Check Canada Post webservice availibity + if (!$this->_postErrors) + { + // Unactive all Canada Post Carriers + Db::getInstance()->autoExecute(_DB_PREFIX_.'cp_rate_service_code', array('active' => 0), 'UPDATE'); + + // If no errors appear, the carrier is being activated, else, the carrier is being deactivated + if (!$this->_postErrors) + { + // Get available services + $serviceSelected = Tools::getValue('service'); + + // Active available carrier + if ($serviceSelected) + foreach ($serviceSelected as $ss) + { + $id_carrier = Db::getInstance()->getValue('SELECT `id_carrier` FROM `'._DB_PREFIX_.'cp_rate_service_code` WHERE `id_cp_rate_service_code` = '.(int)($ss)); + Db::getInstance()->autoExecute(_DB_PREFIX_.'cp_rate_service_code', array('active' => 1), 'UPDATE', '`id_cp_rate_service_code` = '.(int)($ss)); + } + } + + // All new configurations values are saved to be sure to test webservices with it + Configuration::updateValue('CP_CARRIER_ACCOUNT', Tools::getValue('cp_carrier_account')); + Configuration::updateValue('CP_CARRIER_PACKAGING_WEIGHT', Tools::getValue('cp_carrier_packaging_weight')); + Configuration::updateValue('CP_CARRIER_HANDLING_FEE', Tools::getValue('cp_carrier_handling_fee')); + Configuration::updateValue('CP_CARRIER_ADDRESS1', Tools::getValue('cp_carrier_address1')); + Configuration::updateValue('CP_CARRIER_ADDRESS2', Tools::getValue('cp_carrier_address2')); + Configuration::updateValue('CP_CARRIER_POSTAL_CODE', Tools::getValue('cp_carrier_postal_code')); + Configuration::updateValue('CP_CARRIER_CITY', Tools::getValue('cp_carrier_city')); + Configuration::updateValue('CP_CARRIER_STATE', Tools::getValue('cp_carrier_state')); + Configuration::updateValue('CP_CARRIER_COUNTRY', Tools::getValue('cp_carrier_country')); + Configuration::updateValue('CP_CARRIER_CALCUL_MODE', Tools::getValue('cp_carrier_calcul_mode')); + Configuration::updateValue('PS_WEIGHT_UNIT', $this->_weightUnitList[strtoupper(Tools::getValue('ps_weight_unit'))]); + Configuration::updateValue('PS_DIMENSION_UNIT', $this->_dimensionUnitList[strtoupper(Tools::getValue('ps_dimension_unit'))]); + if (isset($this->_weightUnitList[strtoupper(Tools::getValue('ps_weight_unit'))])) + $this->_weightUnit = $this->_weightUnitList[strtoupper(Tools::getValue('ps_weight_unit'))]; + if (isset($this->_dimensionUnitList[strtoupper(Tools::getValue('ps_dimension_unit'))])) + $this->_dimensionUnit = $this->_dimensionUnitList[strtoupper(Tools::getValue('ps_dimension_unit'))]; + if (!$this->webserviceTest()) + $this->_postErrors[] = $this->l('Prestashop could not connect to Canada Post webservices').' :
    '.($this->_webserviceError ? $this->_webserviceError : $this->l('No error description found')); + } + } + + private function _postProcessGeneral() + { + // Saving new configurations + if (Configuration::updateValue('CP_CARRIER_ACCOUNT', Tools::getValue('cp_carrier_account')) AND + Configuration::updateValue('CP_CARRIER_PACKAGING_WEIGHT', Tools::getValue('cp_carrier_packaging_weight')) AND + Configuration::updateValue('CP_CARRIER_HANDLING_FEE', Tools::getValue('cp_carrier_handling_fee')) AND + Configuration::updateValue('CP_CARRIER_POSTAL_CODE', Tools::getValue('cp_carrier_postal_code')) AND + Configuration::updateValue('CP_CARRIER_CITY', Tools::getValue('cp_carrier_city')) AND + Configuration::updateValue('CP_CARRIER_STATE', Tools::getValue('cp_carrier_state')) AND + Configuration::updateValue('CP_CARRIER_COUNTRY', Tools::getValue('cp_carrier_country')) AND + Configuration::updateValue('CP_CARRIER_CALCUL_MODE', Tools::getValue('cp_carrier_calcul_mode')) AND + Configuration::updateValue('PS_WEIGHT_UNIT', $this->_weightUnitList[strtoupper(Tools::getValue('ps_weight_unit'))]) AND + Configuration::updateValue('PS_DIMENSION_UNIT', $this->_dimensionUnitList[strtoupper(Tools::getValue('ps_dimension_unit'))])) + $this->_html .= $this->displayConfirmation($this->l('Settings updated')); + else + $this->_html .= $this->displayErrors($this->l('Settings failed')); + } + + + + /* + ** Category Form Config Methods + ** + */ + + private function _getPathInTab($id_category) + { + global $cookie; + + $category = Db::getInstance()->getRow(' + SELECT id_category, level_depth, nleft, nright + FROM '._DB_PREFIX_.'category + WHERE id_category = '.(int)$id_category); + + if (isset($category['id_category'])) + { + $categories = Db::getInstance()->ExecuteS(' + SELECT c.id_category, cl.name, cl.link_rewrite + FROM '._DB_PREFIX_.'category c + LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category) + WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND cl.id_lang = '.(int)($cookie->id_lang).' + ORDER BY c.level_depth ASC + LIMIT '.(int)($category['level_depth'] + 1)); + + $n = 1; + $pathTab = array(); + $nCategories = (int)sizeof($categories); + foreach ($categories AS $category) + $pathTab[] = htmlentities($category['name'], ENT_NOQUOTES, 'UTF-8'); + + return $pathTab; + } + } + + private function _getChildCategories($categories, $id, $path = array(), $pathAdd = '') + { + $html = ''; + if ($pathAdd != '') + $path[] = $pathAdd; + if (isset($categories[$id])) + foreach ($categories[$id] as $idc => $cc) + { + $html .= ''; + $html .= $this->_getChildCategories($categories, $idc, $path, $cc['infos']['name']); + } + return $html; + } + + private function _isPostCheck($id_cp_rate_service_code) + { + $services = Tools::getValue('service'); + if ($services) + foreach ($services as $s) + if ($s == $id_cp_rate_service_code) + return 1; + return 0; + } + + private function _displayFormCategory() + { + global $cookie; + + // Check if the module is configured + if (!$this->_webserviceTestResult) + return '

    '.$this->l('You have to configure "General Settings" tab before using this tab.').'


    '; + + // Display header + $html = '

    '.$this->l('In this tab, you can set a specific configuration for each category.').'


    + + + + + + + + + + + '; + + // Loading config list + $configCategoryList = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'cp_rate_config` WHERE `id_category` > 0'); + if (!$configCategoryList) + $html .= ''; + foreach ($configCategoryList as $k => $c) + { + // Category Path + $path = ''; + $pathTab = $this->_getPathInTab($c['id_category']); + foreach ($pathTab as $p) + { + if (!empty($path)) { $path .= ' > '; } + $path .= $p; + } + + // Loading config currency + $configCurrency = new Currency($c['id_currency']); + + // Loading services attached to this config + $services = ''; + $servicesTab = Db::getInstance()->ExecuteS(' + SELECT ursc.`service` + FROM `'._DB_PREFIX_.'cp_rate_config_service` urcs + LEFT JOIN `'._DB_PREFIX_.'cp_rate_service_code` ursc ON (ursc.`id_cp_rate_service_code` = urcs.`id_cp_rate_service_code`) + WHERE urcs.`id_cp_rate_config` = '.(int)$c['id_cp_rate_config']); + foreach ($servicesTab as $s) + $services .= $s['service'].'
    '; + + // Display line + $alt = 0; + if ($k % 2 != 0) + $alt = ' class="alt_row"'; + $html .= ' + + + + + + + '; + } + + $html .= ' + +
    '.$this->l('ID Config').''.$this->l('Category').''.$this->l('Additional charges').''.$this->l('Services').''.$this->l('Actions').'
    '.$this->l('There is no specific Canada Post configuration for categories at this point.').'
    '.$c['id_cp_rate_config'].''.$path.''.$c['additional_charges'].' '.$configCurrency->sign.''.$services.' + + + +
    + +
    +


    '; + + // Add or Edit Category Configuration + if (Tools::getValue('action') == 'edit' && Tools::getValue('section') == 'category') + { + // Loading config + $configSelected = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'cp_rate_config` WHERE `id_cp_rate_config` = '.(int)(Tools::getValue('id_cp_rate_config'))); + + // Category Path + $path = ''; + $pathTab = $this->_getPathInTab($configSelected['id_category']); + foreach ($pathTab as $p) + { + if (!empty($path)) { $path .= ' > '; } + $path .= $p; + } + + $html .= '

    '.$this->l('Update a rule').' ('.$this->l('Add a rule').' ?)

    +
    + +
    '.$path.'

    + + +

    + +
    '; + $rateServiceList = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'cp_rate_service_code`'); + foreach($rateServiceList as $rateService) + { + $configServiceSelected = Db::getInstance()->getValue('SELECT `id_cp_rate_service_code` FROM `'._DB_PREFIX_.'cp_rate_config_service` WHERE `id_cp_rate_config` = '.(int)(Tools::getValue('id_cp_rate_config')).' AND `id_cp_rate_service_code` = '.(int)($rateService['id_cp_rate_service_code'])); + $html .= '_isPostCheck($rateService['id_cp_rate_service_code']) == 1 || $configServiceSelected > 0) ? 'checked="checked"' : '').' /> '.$rateService['service'].'
    '; + } + $html .= ' +

    ' . $this->l('Choose the delivery service which will be available for customers.') . '

    +
    +
    +
    '; + } + else + { + $html .= '

    '.$this->l('Add a rule').'

    +
    + +
    + +
    + +

    + +
    '; + $rateServiceList = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'cp_rate_service_code`'); + foreach($rateServiceList as $rateService) + $html .= '_isPostCheck($rateService['id_cp_rate_service_code']) == 1) ? 'checked="checked"' : '').' /> '.$rateService['service'].'
    '; + $html .= ' +

    ' . $this->l('Choose the delivery service which will be available for customers.') . '

    +
    +
    +
    '; + } + + return $html; + } + + private function _postValidationCategory() + { + // Check post values + if (Tools::getValue('id_category') == NULL) + $this->_postErrors[] = $this->l('You have to select a category.'); + + if (!$this->_postErrors) + { + $id_cp_rate_config = Db::getInstance()->getValue('SELECT `id_cp_rate_config` FROM `'._DB_PREFIX_.'cp_rate_config` WHERE `id_category` = '.(int)Tools::getValue('id_category')); + + // Check if a config does not exist in Add case + if ($id_cp_rate_config > 0 && Tools::getValue('action') == 'add') + $this->_postErrors[] = $this->l('This category already has a specific Canada Post configuration.'); + + // Check if a config exists and if the IDs config correspond in Upd case + if (Tools::getValue('action') == 'edit' && (!isset($id_cp_rate_config) || $id_cp_rate_config != Tools::getValue('id_cp_rate_config'))) + $this->_postErrors[] = $this->l('An error occurred, please try again.'); + + // Check if a config exists in Delete case + if (Tools::getValue('action') == 'delete' && !isset($id_cp_rate_config)) + $this->_postErrors[] = $this->l('An error occurred, please try again.'); + } + } + + private function _postProcessCategory() + { + // Init Var + $date = date('Y-m-d H:i:s'); + $services = Tools::getValue('service'); + + // Add Script + if (Tools::getValue('action') == 'add') + { + $addTab = array( + 'id_product' => 0, + 'id_category' => (int)(Tools::getValue('id_category')), + 'id_currency' => (int)(Configuration::get('PS_CURRENCY_DEFAULT')), + 'additional_charges' => pSQL(Tools::getValue('additional_charges')), + 'date_add' => pSQL($date), + 'date_upd' => pSQL($date) + ); + Db::getInstance()->autoExecute(_DB_PREFIX_.'cp_rate_config', $addTab, 'INSERT'); + $id_cp_rate_config = Db::getInstance()->Insert_ID(); + foreach ($services as $s) + { + $addTab = array('id_cp_rate_service_code' => pSQL($s), 'id_cp_rate_config' => (int)$id_cp_rate_config, 'date_add' => pSQL($date), 'date_upd' => pSQL($date)); + Db::getInstance()->autoExecute(_DB_PREFIX_.'cp_rate_config_service', $addTab, 'INSERT'); + } + + // Display Results + if ($id_cp_rate_config > 0) + $this->_html .= $this->displayConfirmation($this->l('Settings updated')); + else + $this->_html .= $this->displayErrors($this->l('Settings failed')); + } + + // Update Script + if (Tools::getValue('action') == 'edit' && Tools::getValue('id_cp_rate_config')) + { + $updTab = array( + 'id_currency' => (int)(Configuration::get('PS_CURRENCY_DEFAULT')), + 'additional_charges' => pSQL(Tools::getValue('additional_charges')), + 'date_upd' => pSQL($date) + ); + $result = Db::getInstance()->autoExecute(_DB_PREFIX_.'cp_rate_config', $updTab, 'UPDATE', '`id_cp_rate_config` = '.(int)Tools::getValue('id_cp_rate_config')); + Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'cp_rate_config_service` WHERE `id_cp_rate_config` = '.(int)Tools::getValue('id_cp_rate_config')); + foreach ($services as $s) + { + $addTab = array('id_cp_rate_service_code' => pSQL($s), 'id_cp_rate_config' => (int)Tools::getValue('id_cp_rate_config'), 'date_add' => pSQL($date), 'date_upd' => pSQL($date)); + Db::getInstance()->autoExecute(_DB_PREFIX_.'cp_rate_config_service', $addTab, 'INSERT'); + } + + // Display Results + if ($result) + $this->_html .= $this->displayConfirmation($this->l('Settings updated')); + else + $this->_html .= $this->displayErrors($this->l('Settings failed')); + } + + // Delete Script + if (Tools::getValue('action') == 'delete' && Tools::getValue('id_cp_rate_config')) + { + $result1 = Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'cp_rate_config` WHERE `id_cp_rate_config` = '.(int)Tools::getValue('id_cp_rate_config')); + $result2 = Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'cp_rate_config_service` WHERE `id_cp_rate_config` = '.(int)Tools::getValue('id_cp_rate_config')); + + // Display Results + if ($result1) + $this->_html .= $this->displayConfirmation($this->l('Settings updated')); + else + $this->_html .= $this->displayErrors($this->l('Settings failed')); + } + } + + + + /* + ** Product Form Config Methods + ** + */ + + private function _displayFormProduct() + { + global $cookie; + + // Check if the module is configured + if (!$this->_webserviceTestResult) + return '

    '.$this->l('You have to configure "General Settings" tab before using this tab.').'


    '; + + // Display header + $html = '

    '.$this->l('In this tab, you can set a specific configuration for each product.').'


    + + + + + + + + + + + '; + + // Loading config list + $configProductList = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'cp_rate_config` WHERE `id_product` > 0'); + if (!$configProductList) + $html .= ''; + foreach ($configProductList as $k => $c) + { + // Loading Product + $product = new Product((int)$c['id_product'], false, (int)$cookie->id_lang); + + // Loading config currency + $configCurrency = new Currency($c['id_currency']); + + // Loading services attached to this config + $services = ''; + $servicesTab = Db::getInstance()->ExecuteS(' + SELECT ursc.`service` + FROM `'._DB_PREFIX_.'cp_rate_config_service` urcs + LEFT JOIN `'._DB_PREFIX_.'cp_rate_service_code` ursc ON (ursc.`id_cp_rate_service_code` = urcs.`id_cp_rate_service_code`) + WHERE urcs.`id_cp_rate_config` = '.(int)$c['id_cp_rate_config']); + foreach ($servicesTab as $s) + $services .= $s['service'].'
    '; + + // Display line + $alt = 0; + if ($k % 2 != 0) + $alt = ' class="alt_row"'; + $html .= ' + + + + + + + '; + } + + $html .= ' + +
    '.$this->l('ID Config').''.$this->l('Product').''.$this->l('Additional charges').''.$this->l('Services').''.$this->l('Actions').'
    '.$this->l('There is no specific Canada Post configuration for products at this point.').'
    '.$c['id_cp_rate_config'].''.$product->name.''.$c['additional_charges'].' '.$configCurrency->sign.''.$services.' + + + +
    + +
    +


    '; + + // Add or Edit Product Configuration + if (Tools::getValue('action') == 'edit' && Tools::getValue('section') == 'product') + { + // Loading config + $configSelected = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'cp_rate_config` WHERE `id_cp_rate_config` = '.(int)(Tools::getValue('id_cp_rate_config'))); + $product = new Product((int)$configSelected['id_product'], false, (int)$cookie->id_lang); + + $html .= '

    '.$this->l('Update a rule').' ('.$this->l('Add a rule').' ?)

    +
    + +
    '.$product->name.'

    + + +

    + +
    '; + $rateServiceList = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'cp_rate_service_code`'); + foreach($rateServiceList as $rateService) + { + $configServiceSelected = Db::getInstance()->getValue('SELECT `id_cp_rate_service_code` FROM `'._DB_PREFIX_.'cp_rate_config_service` WHERE `id_cp_rate_config` = '.(int)(Tools::getValue('id_cp_rate_config')).' AND `id_cp_rate_service_code` = '.(int)($rateService['id_cp_rate_service_code'])); + $html .= '_isPostCheck($rateService['id_cp_rate_service_code']) == 1 || $configServiceSelected > 0) ? 'checked="checked"' : '').' /> '.$rateService['service'].'
    '; + } + $html .= ' +

    ' . $this->l('Choose the delivery service which will be available for customers.') . '

    +
    +
    +
    '; + } + else + { + $html .= '

    '.$this->l('Add a rule').'

    +
    + +
    + +
    + + +

    + +
    '; + $rateServiceList = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'cp_rate_service_code`'); + foreach($rateServiceList as $rateService) + $html .= '_isPostCheck($rateService['id_cp_rate_service_code']) == 1) ? 'checked="checked"' : '').' /> '.$rateService['service'].'
    '; + $html .= ' +

    ' . $this->l('Choose the delivery service which will be available for customers.') . '

    +
    +
    +
    '; + } + + return $html; + } + + private function _postValidationProduct() + { + // Check post values + if (Tools::getValue('id_product') == NULL) + $this->_postErrors[] = $this->l('You have to select a product.'); + + if (!$this->_postErrors) + { + $id_cp_rate_config = Db::getInstance()->getValue('SELECT `id_cp_rate_config` FROM `'._DB_PREFIX_.'cp_rate_config` WHERE `id_product` = '.(int)Tools::getValue('id_product')); + + // Check if a config does not exist in Add case + if ($id_cp_rate_config > 0 && Tools::getValue('action') == 'add') + $this->_postErrors[] = $this->l('This product already has a specific Canada Post configuration.'); + + // Check if a config exists and if the IDs config correspond in Upd case + if (Tools::getValue('action') == 'edit' && (!isset($id_cp_rate_config) || $id_cp_rate_config != Tools::getValue('id_cp_rate_config'))) + $this->_postErrors[] = $this->l('An error occurred, please try again.'); + + // Check if a config exists in Delete case + if (Tools::getValue('action') == 'delete' && !isset($id_cp_rate_config)) + $this->_postErrors[] = $this->l('An error occurred, please try again.'); + } + } + + private function _postProcessProduct() + { + // Init Var + $date = date('Y-m-d H:i:s'); + $services = Tools::getValue('service'); + + // Add Script + if (Tools::getValue('action') == 'add') + { + $addTab = array( + 'id_product' => (int)(Tools::getValue('id_product')), + 'id_category' => 0, + 'id_currency' => (int)(Configuration::get('PS_CURRENCY_DEFAULT')), + 'additional_charges' => pSQL(Tools::getValue('additional_charges')), + 'date_add' => pSQL($date), + 'date_upd' => pSQL($date) + ); + Db::getInstance()->autoExecute(_DB_PREFIX_.'cp_rate_config', $addTab, 'INSERT'); + $id_cp_rate_config = Db::getInstance()->Insert_ID(); + foreach ($services as $s) + { + $addTab = array('id_cp_rate_service_code' => pSQL($s), 'id_cp_rate_config' => (int)$id_cp_rate_config, 'date_add' => pSQL($date), 'date_upd' => pSQL($date)); + Db::getInstance()->autoExecute(_DB_PREFIX_.'cp_rate_config_service', $addTab, 'INSERT'); + } + + // Display Results + if ($id_cp_rate_config > 0) + $this->_html .= $this->displayConfirmation($this->l('Settings updated')); + else + $this->_html .= $this->displayErrors($this->l('Settings failed')); + } + + // Update Script + if (Tools::getValue('action') == 'edit' && Tools::getValue('id_cp_rate_config')) + { + $updTab = array( + 'id_currency' => (int)(Configuration::get('PS_CURRENCY_DEFAULT')), + 'additional_charges' => pSQL(Tools::getValue('additional_charges')), + 'date_upd' => pSQL($date) + ); + $result = Db::getInstance()->autoExecute(_DB_PREFIX_.'cp_rate_config', $updTab, 'UPDATE', '`id_cp_rate_config` = '.(int)Tools::getValue('id_cp_rate_config')); + Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'cp_rate_config_service` WHERE `id_cp_rate_config` = '.(int)Tools::getValue('id_cp_rate_config')); + foreach ($services as $s) + { + $addTab = array('id_cp_rate_service_code' => pSQL($s), 'id_cp_rate_config' => (int)Tools::getValue('id_cp_rate_config'), 'date_add' => pSQL($date), 'date_upd' => pSQL($date)); + Db::getInstance()->autoExecute(_DB_PREFIX_.'cp_rate_config_service', $addTab, 'INSERT'); + } + + // Display Results + if ($result) + $this->_html .= $this->displayConfirmation($this->l('Settings updated')); + else + $this->_html .= $this->displayErrors($this->l('Settings failed')); + } + + // Delete Script + if (Tools::getValue('action') == 'delete' && Tools::getValue('id_cp_rate_config')) + { + $result1 = Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'cp_rate_config` WHERE `id_cp_rate_config` = '.(int)Tools::getValue('id_cp_rate_config')); + $result2 = Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'cp_rate_config_service` WHERE `id_cp_rate_config` = '.(int)Tools::getValue('id_cp_rate_config')); + + // Display Results + if ($result1) + $this->_html .= $this->displayConfirmation($this->l('Settings updated')); + else + $this->_html .= $this->displayErrors($this->l('Settings failed')); + } + } + + + + /* + ** Help Config Methods + ** + */ + + private function _displayHelp() + { + return '

    '.$this->l('Welcome to the PrestaShop Canada Post Module configurator.').'

    +

    '.$this->l('This section will help you to understand how to configure this module correctly.').'

    +
    +

    1. '.$this->l('General Settings').'

    +

    '.$this->l('See below for the description of each field :').'

    +

    '.$this->l('Your Canada Post Account').' : '.$this->l('You must subscribe to Canada Post website at this address').' http://www.canadapost.ca

    +

    '.$this->l('Zip / Postal Code').' : '.$this->l('This field must be the Zip / Postal code of your package starting point.').'

    +

    '.$this->l('Country').' : '.$this->l('This field must be the country of your package starting point.').'

    +

    '.$this->l('Delivery Service').' : '.$this->l('These checkboxes correspond to the delivery services you want to be available (when there is no specific configuration for the product or the category product).').'

    +
    +

    2. '.$this->l('Categories Settings').'

    +

    '.$this->l('This section allows you to define a specific Canada Post configuration for each product category (such as Additional charges).').'

    +
    +

    3. '.$this->l('Products Settings').'

    +

    '.$this->l('This section allows you to define a specific Canada Post configuration for each product (such as Additional charges).').'

    +
    + '; + } + + public function hookupdateCarrier($params) + { + if ((int)($params['id_carrier']) != (int)($params['carrier']->id)) + { + $serviceSelected = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'cp_rate_service_code` WHERE `id_carrier` = '.(int)$params['id_carrier']); + $update = array('id_carrier' => (int)($params['carrier']->id), 'id_carrier_history' => pSQL($serviceSelected['id_carrier_history'].'|'.(int)($params['carrier']->id))); + Db::getInstance()->autoExecute(_DB_PREFIX_.'cp_rate_service_code', $update, 'UPDATE', '`id_carrier` = '.(int)$params['id_carrier']); + } + } + + public function displayInfoByCart() + { + } + + + + /* + ** Front Methods + ** + */ + + public function getCartCurrencyRate($id_currency_origin, $id_cart) + { + $conversionRate = 1; + $cart = new Cart($id_cart); + if ($id_currency_origin > 0 && $cart->id_currency != $id_currency_origin) + { + $currencyOrigin = new Currency((int)$id_currency_origin); + $conversionRate /= $currencyOrigin->conversion_rate; + $currencySelect = new Currency((int)$cart->id_currency); + $conversionRate *= $currencySelect->conversion_rate; + } + return $conversionRate; + } + + public function getOrderShippingCostHash($wsParams) + { + $paramHash = ''; + $productHash = ''; + foreach ($wsParams['products'] as $product) + { + if (!empty($productHash)) + $productHash .= '|'; + $productHash .= $product['id_product'].':'.$product['id_product_attribute'].':'.$product['cart_quantity']; + } + foreach ($wsParams as $k => $v) + if ($k != 'products') + $paramHash .= '/'.$v; + return md5($productHash.$paramHash.Configuration::get('CP_CARRIER_CALCUL_MODE')); + } + + public function getOrderShippingCostCache($wsParams) + { + // Get Cache + $row = Db::getInstance()->getRow(" + SELECT * FROM `"._DB_PREFIX_."cp_cache` + WHERE `id_cart` = ".(int)($wsParams['id_cart'])." + AND `id_carrier` = ".(int)($this->id_carrier)." + AND `hash` = '".pSQL($wsParams['hash'])."'"); + + if ($row['id_currency']) + { + // Check Currency Rate And Calcul + $conversionRate = $this->getCartCurrencyRate($row['id_currency'], (int)$wsParams['id_cart']); + $row['total_charges'] = $row['total_charges'] * $conversionRate; + + // Return Cache + return $row; + } + + return false; + } + + public function saveOrderShippingCostCache($wsParams, $wscost) + { + $is_available = 1; + if (!$wscost) + $is_available = 0; + $date = date('Y-m-d H:i:s'); + $cart = new Cart((int)$wsParams['id_cart']); + $insert = array( + 'id_cart' => (int)($wsParams['id_cart']), + 'id_carrier' => (int)($this->id_carrier), + 'hash' => pSQL($wsParams['hash']), + 'id_currency' => (int)($cart->id_currency), + 'total_charges' => pSQL($wscost), + 'is_available' => (int)($is_available), + 'date_add' => pSQL($date), + 'date_upd' => pSQL($date) + ); + Db::getInstance()->autoExecute(_DB_PREFIX_.'cp_cache', $insert, 'INSERT'); + } + + public function loadShippingCostConfig($product) + { + // Init var + $config = array(); + + // Check if there is a specific product configuration + if ($product['id_product'] > 0) + { + $productConfiguration = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'cp_rate_config` WHERE `id_product` = '.(int)($product['id_product'])); + if ($productConfiguration['id_cp_rate_config']) + { + $servicesConfiguration = Db::getInstance()->ExecuteS(' + SELECT urcs.*, ursc.`id_carrier` + FROM `'._DB_PREFIX_.'cp_rate_config_service` urcs + LEFT JOIN `'._DB_PREFIX_.'cp_rate_service_code` ursc ON (ursc.`id_cp_rate_service_code` = urcs.`id_cp_rate_service_code`) + WHERE `id_cp_rate_config` = '.(int)($productConfiguration['id_cp_rate_config'])); + foreach ($servicesConfiguration as $service) + $productConfiguration['services'][$service['id_cp_rate_service_code']] = $service; + return $productConfiguration; + } + } + + // Check if there is a specific category configuration + if ($product['id_category_default'] > 0) + { + $categoryConfiguration = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'cp_rate_config` WHERE `id_category` = '.(int)($product['id_category_default'])); + if ($categoryConfiguration['id_cp_rate_config']) + { + $servicesConfiguration = Db::getInstance()->ExecuteS(' + SELECT urcs.*, ursc.`id_carrier` + FROM `'._DB_PREFIX_.'cp_rate_config_service` urcs + LEFT JOIN `'._DB_PREFIX_.'cp_rate_service_code` ursc ON (ursc.`id_cp_rate_service_code` = urcs.`id_cp_rate_service_code`) + WHERE `id_cp_rate_config` = '.(int)($categoryConfiguration['id_cp_rate_config'])); + foreach ($servicesConfiguration as $service) + $categoryConfiguration['services'][$service['id_cp_rate_service_code']] = $service; + return $categoryConfiguration; + } + } + + // Return general config + $servicesConfiguration = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'cp_rate_service_code` WHERE `active` = 1'); + foreach ($servicesConfiguration as $service) + $config['services'][$service['id_cp_rate_service_code']] = $service; + return $config; + } + + public function getWebserviceShippingCost($wsParams) + { + // Init var + $cost = 0; + + // Calcul mode condition + if (Configuration::get('CP_CARRIER_CALCUL_MODE') == 'onepackage') + { + $width = 0; + $height = 0; + $depth = 0; + $weight = 0; + $id_product = ''; + + foreach ($wsParams['products'] as $product) + { + if ($product['width'] && $product['width'] > $width) $width = $product['width']; + if ($product['height'] && $product['height'] > $height) $height = $product['height']; + if ($product['depth'] && $product['depth'] > $depth) $depth = $product['depth']; + if ($product['weight']) + $weight += ($product['weight'] * $product['quantity']); + $id_product = $product['id_product'].','; + } + $weight += Tools::getValue('cp_carrier_packaging_weight', Configuration::get('CP_CARRIER_PACKAGING_WEIGHT')); + + // Get service in adequation with carrier and check if available + $servicesConfiguration = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'cp_rate_service_code` WHERE `active` = 1'); + foreach ($servicesConfiguration as $service) + $config['services'][$service['id_cp_rate_service_code']] = $service; + $serviceSelected = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'cp_rate_service_code` WHERE `id_carrier` = '.(int)($this->id_carrier)); + if (!isset($config['services'][$serviceSelected['id_cp_rate_service_code']])) + return false; + + $wsParams['service'] = $serviceSelected['service']; + $wsParams['package_list'] = array(); + $wsParams['package_list'][] = array( + 'width' => ($width > 0 ? $width : 7), + 'height' => ($height > 0 ? $height : 3), + 'depth' => ($depth > 0 ? $depth : 5), + 'weight' => ($weight > 0 ? $weight : .5), + 'quantity' => 1, + 'id_product' => $id_product, + ); + } + else + { + // Getting shipping cost for each product + foreach ($wsParams['products'] as $product) + { + // Load specific configuration + $config = $this->loadShippingCostConfig($product); + + // Get service in adequation with carrier and check if available + $serviceSelected = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'cp_rate_service_code` WHERE `id_carrier` = '.(int)($this->id_carrier)); + if (!isset($config['services'][$serviceSelected['id_cp_rate_service_code']])) + return false; + + // Load param product + $wsParams['service'] = $serviceSelected['service']; + $wsParams['package_list'][] = array( + 'width' => ($product['width'] ? $product['width'] : 1), + 'height' => ($product['height'] ? $product['height'] : 1), + 'depth' => ($product['depth'] ? $product['depth'] : 1), + 'weight' => ($product['weight'] ? $product['weight'] : 1), + 'quantity' => $product['quantity'], + 'id_product' => $product['id_product'], + ); + + // If Additional charges + if (isset($config['id_currency']) && isset($config['additional_charges'])) + { + $conversionRate = 1; + $conversionRate = $this->getCartCurrencyRate((int)($config['id_currency']), (int)$wsParams['id_cart']); + $cost += ($config['additional_charges'] * $conversionRate); + } + } + } + + + // If webservice return a cost, we add it, else, we return the original shipping cost + $result = $this->getCanadaPostShippingCost($wsParams); + if ($result['connect'] && $result['cost'] > 0) + return ($cost + $result['cost'] + Tools::getValue('cp_carrier_handling_fee', Configuration::get('CP_CARRIER_HANDLING_FEE'))); + return false; + } + + public function getOrderShippingCost($params, $shipping_cost) + { + // Init var + $address = new Address($params->id_address_delivery); + $recipient_country = Db::getInstance()->getRow('SELECT `iso_code` FROM `'._DB_PREFIX_.'country` WHERE `id_country` = '.(int)($address->id_country)); + $recipient_state = Db::getInstance()->getRow('SELECT `iso_code` FROM `'._DB_PREFIX_.'state` WHERE `id_state` = '.(int)($address->id_state)); + $shipper_country = Db::getInstance()->getRow('SELECT `iso_code` FROM `'._DB_PREFIX_.'country` WHERE `id_country` = '.(int)(Configuration::get('CP_CARRIER_COUNTRY'))); + $shipper_state = Db::getInstance()->getRow('SELECT `iso_code` FROM `'._DB_PREFIX_.'state` WHERE `id_state` = '.(int)(Configuration::get('CP_CARRIER_STATE'))); + $products = $params->getProducts(); + + // Webservices Params + $wsParams = array( + 'id_cart' => $params->id, + 'id_address_delivery' => $params->id_address_delivery, + 'recipient_address1' => $address->address1, + 'recipient_address2' => $address->address2, + 'recipient_postalcode' => $address->postcode, + 'recipient_city' => $address->city, + 'recipient_country_iso' => $recipient_country['iso_code'], + 'recipient_state_iso' => $recipient_state['iso_code'], + 'shipper_address1' => Configuration::get('CP_CARRIER_ADDRESS1'), + 'shipper_address2' => Configuration::get('CP_CARRIER_ADDRESS2'), + 'shipper_postalcode' => Configuration::get('CP_CARRIER_POSTAL_CODE'), + 'shipper_city' => Configuration::get('CP_CARRIER_CITY'), + 'shipper_country_iso' => $shipper_country['iso_code'], + 'shipper_state_iso' => $shipper_state['iso_code'], + 'products' => $params->getProducts() + ); + $wsParams['hash'] = $this->getOrderShippingCostHash($wsParams); + + // Check cache + $cache = $this->getOrderShippingCostCache($wsParams); + if ($cache['id_cp_cache'] > 0) + { + if ($cache['is_available'] == 0) + return false; + if ($cache['total_charges']) + return $cache['total_charges']; + } + + // Get Webservices Cost and Cache it + $wscost = $this->getWebserviceShippingCost($wsParams); + $this->saveOrderShippingCostCache($wsParams, $wscost); + + if ($wscost > 0) + return $wscost + $shipping_cost; + return false; + } + + public function getOrderShippingCostExternal($params) + { + return $this->getOrderShippingCost($params, 23); + } + + + + /* + ** Webservices Methods + ** + */ + + public function webserviceTest($service = '') + { + // Check API Key + if (!Configuration::get('CP_CARRIER_ACCOUNT')) + return false; + + // Example Params for testing + $shipper_country = Db::getInstance()->getRow('SELECT `iso_code` FROM `'._DB_PREFIX_.'country` WHERE `id_country` = '.(int)(Configuration::get('CP_CARRIER_COUNTRY'))); + $shipper_state = Db::getInstance()->getRow('SELECT `iso_code` FROM `'._DB_PREFIX_.'state` WHERE `id_state` = '.(int)(Configuration::get('CP_CARRIER_STATE'))); + $wsParams = array( + 'recipient_address1' => Configuration::get('CP_CARRIER_ADDRESS1'), + 'recipient_address2' => Configuration::get('CP_CARRIER_ADDRESS2'), + 'recipient_postalcode' => Configuration::get('CP_CARRIER_POSTAL_CODE'), + 'recipient_city' => Configuration::get('CP_CARRIER_CITY'), + 'recipient_country_iso' => $shipper_country['iso_code'], + 'recipient_state_iso' => $shipper_state['iso_code'], + 'shipper_address1' => Configuration::get('CP_CARRIER_ADDRESS1'), + 'shipper_address2' => Configuration::get('CP_CARRIER_ADDRESS2'), + 'shipper_postalcode' => Configuration::get('CP_CARRIER_POSTAL_CODE'), + 'shipper_city' => Configuration::get('CP_CARRIER_CITY'), + 'shipper_country_iso' => $shipper_country['iso_code'], + 'shipper_state_iso' => $shipper_state['iso_code'], + 'package_list' => array( + array('width' => 10, 'height' => 3, 'depth' => 10, 'weight' => 0.75, 'quantity' => 1, 'id_product' => 1), + array('width' => 3, 'height' => 3, 'depth' => 3, 'weight' => 0.75, 'quantity' => 1, 'id_product' => 2), + ), + ); + + // Unit or Large Test + if (!empty($service)) + $servicesList = array(array('service' => $service)); + else + $servicesList = Db::getInstance()->ExecuteS('SELECT `service` FROM `'._DB_PREFIX_.'cp_rate_service_code`'); + + // Testing Service + foreach ($servicesList as $service) + { + // Sending Request + $service = $service['service']; + $wsParams['service'] = $service; + + $delivery = Db::getInstance()->getValue('SELECT `result` FROM `'._DB_PREFIX_.'cp_cache_test` WHERE `hash` = \''.pSQL(md5($this->getXml($wsParams).$service)).'\''); + if ($delivery) + $delivery = unserialize($delivery); + else + $resultTab = $this->sendRequest($wsParams); + + // Finding the good delivery service + if (isset($resultTab->ratesAndServicesResponse->product)) + foreach ($resultTab->ratesAndServicesResponse->product as $d) + if (strtolower((string)$d->name) == strtolower($service)) + { + $delivery = array(); + $delivery['name'] = (string)$d->name; + $delivery['rate'] = (string)$d->rate; + } + + // Return results + if ($delivery) + { + Db::getInstance()->autoExecute(_DB_PREFIX_.'cp_cache_test', array('hash' => pSQL(md5($this->getXml($wsParams).$service)), 'result' => pSQL(serialize($delivery)), 'date_add' => pSQL(date('Y-m-d H:i:s')), 'date_upd' => pSQL(date('Y-m-d H:i:s'))), 'INSERT'); + return true; + } + + if (isset($resultTab->error->statusMessage) && (string)$resultTab->error->statusMessage != '') + $this->_webserviceError = $this->l('Error').' '.(string)$resultTab->error->statusCode.' : '.(string)$resultTab->error->statusMessage; + else + { + $this->_webserviceError = $this->l('Canada Post Webservice seems to be down, please wait a few minutes and try again.'); + return false; + } + } + + return false; + } + + public function getCanadaPostShippingCost($wsParams) + { + // Check Arguments + if (!$wsParams) + return array('connect' => false, 'cost' => 0); + + // Sending Request + $resultTab = $this->sendRequest($wsParams); + + // Finding the good delivery service + if (isset($resultTab->ratesAndServicesResponse->product) && $resultTab->ratesAndServicesResponse->product) + foreach ($resultTab->ratesAndServicesResponse->product as $d) + if (strtolower((string)$d->name) != '' && strtolower((string)$d->name) == strtolower($wsParams['service'])) + { + $delivery = array(); + $delivery['name'] = (string)$d->name; + $delivery['rate'] = (string)$d->rate; + } + if (!isset($delivery)) + return array('connect' => false, 'cost' => 0); + + // Check currency + $conversionRate = $this->getCartCurrencyRate(Currency::getIdByIsoCode('CAD'), $wsParams['id_cart']); + + // Return results + return array('connect' => true, 'cost' => $delivery['rate'] * $conversionRate); + } + + public function sendRequest($wsParams) + { + // POST Request + $errno = $errstr = $result = ''; + $xml = $this->getXml($wsParams); + + if (is_callable('curl_exec')) + { + // Curl Request + $ch = curl_init("http://sellonline.canadapost.ca"); + curl_setopt($ch, CURLOPT_HEADER, 1); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_TIMEOUT, 60); + curl_setopt($ch, CURLOPT_PORT, 30000); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); + curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); + $result = curl_exec($ch); + } + else + { + // FsockOpen Request + $timeout = 5; + $fp = fsockopen("http://sellonline.canadapost.ca:30000", "80", $errno, $errstr, $timeout); + if ($fp) + { + $request = "POST HTTP/1.1\r\n"; + $request .= "Host: sellonline.canadapost.ca\r\n"; + $request .= "Content-type: application/x-www-form-urlencoded\r\n"; + $request .= "Connection: Close\r\n"; + $request .= "Content-length: ".strlen($xml)."\r\n\r\n"; + $request .= $xml."\r\n\r\n"; + fwrite($fp, $request); + + stream_set_blocking($fp, TRUE); + stream_set_timeout($fp,$timeout); + $info = stream_get_meta_data($fp); + + $result = ''; + while ((!feof($fp)) && (!$info['timed_out'])) + { + $result .= fgets($fp, 4096); + $info = stream_get_meta_data($fp); + } + if ($info['timed_out']) + { + $this->_webserviceError = $this->l('Canada Post Webservice timed out.'); + return false; + } + } + else + { + $this->_webserviceError = $this->l('Could not connect to CanadaPost.com'); + return false; + } + } + + // Get xml from HTTP Result + $data = strstr($result, ' $p) + { + // KG, LB, OU conversions + if ($this->_weightUnit == 'LB' || $this->_weightUnit == 'LBS') + $p['weight'] = round($p['weight'] / 2.20462262); + + // Replace in template + $search = array( + '[[Quantity]]', + '[[PackageWeight]]', + '[[Length]]', + '[[Width]]', + '[[Height]]', + '[[Name]]', + ); + $replace = array( + $p['quantity'], + $p['weight'], + $p['width'], + $p['height'], + $p['depth'], + 'Product '.$p['id_product'], + ); + $xmlPackageList .= str_replace($search, $replace, $xmlPackageTemplate); + } + + + // Template Xml + $search = array( + '[[IsoCode]]', + '[[UserLogin]]', + '[[ShipFromPostalCode]]', + '[[ItemsPrice]]', + '[[ShipToCity]]', + '[[ShipToStateCode]]', + '[[ShipToCountryCode]]', + '[[ShipToPostalCode]]', + '[[PackageList]]', + ); + $replace = array( + 'EN', + Configuration::get('CP_CARRIER_ACCOUNT'), + $wsParams['shipper_postalcode'], + 10, + $wsParams['recipient_city'], + $wsParams['recipient_state_iso'], + $wsParams['recipient_country_iso'], + $wsParams['recipient_postalcode'], + $xmlPackageList, + ); + $xmlTemplate = @file_get_contents(dirname(__FILE__).'/xml.tpl'); + $xml = str_replace($search, $replace, $xmlTemplate); + + + // Return + return $xml; + } + +} + diff --git a/modules/canadapost/carrier.jpg b/modules/canadapost/carrier.jpg new file mode 100644 index 0000000000000000000000000000000000000000..15d0eb5758ba9cf7477e237d3dd1e21ab078424d GIT binary patch literal 6661 zcmbt&c~n!$_HGan6#)SO0U@n2D1*p67|2B%kXa^~1Ox;GgvcBrBq~A}1a6Cff{?}m zgvew-1OgF~kXBkFgMd+nB#p?JbC^6WA$jTh*1GSX_s3iBx6j(=)H+qQtG->+u1`2A zoP`~9c5rfliHV89E{h(RkPW+PkB*6g!Q9+nx-b}QFKoA%DojF@5)-MdnA(5S4q_)@ z;{W--OO$B@6TM+_B6Sz(KXO^5|J3=<_d-}qLdq$3d!Jv@Oir1dvJ|!S1$OSAcK=86 zkCFe8fqyCs-@xSd!Zctv#l?=ncFBo}%ZUkTFu17q693z_2*iIxY?t_Mi9M2g_wAPw z73eq!+a)G0zH7I*gv9RMqS9HSeAsR|3HhT&c6$^&!z7O-9x}f5TkYQCXWRM}y@mlz zlklY5`}Qj-A68M-($+a~QrFbX+``hz`rNPf4vy!YoV|T~FZ%fh1V&tmjEcS*6Puip znwE~fk&%5TCl{ZWUvRJVepz|NgNK!mpFDk5SO2`B@g=Ff<5lPDuI>RUjXucuvIJ5R~5M1^C&7qG{!!T zgOnX=oP^>6hnu5vv|f=%I^L`P@X54^up8g_QZ=P^X{6cjkFk`h?IElEFXr$c1^eNh z_5DIvUg)7dEi4n)hNp(!ROQhy{ zIX<;jV=Z3t#0O>p;TrNeD(pDV`s_RP!3;I$_Jz0XDhTaeqB~#YvcCQ9_EmmAWP2@13GY@)t1G%>A9)#;iFFAshbIy;OCHqmmBhY z*N%W>n8Rz2Pxb+Q%y zi5HxJ@LU8OxaS|_??BnR*)t_cW5Kg|tC;8HU{3W}p3A3spfh))!@4D3-!v<5-MtgN ze99bq2a4mO_=+fzBh|5|1;bbsNQ^xN=lC&jd7+Ym6BxIycA)9;_nKp1`asNT0xu!K z)B>aiIMwq*dOjhXkb}X;QVFhLAVi|2RYrE=Ul?-RJ1f}f3>2j2*pJG?DfOM;8$-(M zmIDx#Td`sjz3t8S>??hvp$HxdISINGo$RrPY)viwYLC@Y_hB^!9$?z$51o}Nh?w0YeVVmmV#-UVOw=HD$xAjXoAl$MvC)ZFA(pX z?SuCnFJYzZ>|uD1)hd?O?BL*C2K?y%N%D2PD0!=tl#yH15DTpN4uLnr6 zUlD;NHf0$P@H~FQp1=e{UBEmeup-xRvqTkh5JU|!@gZuEFE;>tsESu04>=54^5xiW zYOcT(uaK|BHOQnYpYCgVvUHI}G~k>AxPt`1M>dB5YZAhuWTmjoJ~jAmZ73P+WX}|k zRT?1WfuGsXCKho?sznhRqT6bg()2j(U|o@I#cTjZCyU*bOzl2ZZ8*Tho5Whnw3ugK z|5?0giMRDlbkDWOsdwD=5Z5)T&5y?*$bW}_~asTQOX z__AE7OeUqls~x2}@mCqE_|b};-BP^5{VJZ~p(gDSek?GN+d)xYs>IqnvF$rH-*FYR|5kzX1=E)D(NR%)k!Y=w&4EkJ-W4GpmgjqCns z?0M6jQ&R;+AJvFNm#U?yqDPm08O=^vJ8hh4_?fYl1my#<+cfJ5I!+?i_Ta>(OJ+Qh zI?ifq%fyeAv9i1tWnVH=+qAoa^pXaDjo7;39pmLBXu(~c!Q%k866k~^HHeoZgteEK z)Ct~)wlk?a8sd_43cgQ!wC~7wiX!>Up;rHZxb(_B9jHuT9H}z-^=lvtdORq-YseEk z_DAJbb(&Vy#S#}G%v?|ocgD#ZY3N4P9DvTz|HerSvzN6cm;U}M`t0FpoexG2v2e4N z^4a9Z*O*}a#$0i!Lh8uV=lWWgqRfk}6_XX+Eiq;uKh(ZQY&Zahw**CG)*vv?|K<`e#Ymu*RrKLutrQqBf4)!6Bn2=emTKmq?1G zoDwums_*G9|VPMTJQHo(I z?{p|{We4QP31PQopn3Q1%#zPRTjh|}_Bqy+k+okokMHsneVilB&Kgv+u~hdC0I+SR z_xr9!gR=Ot2MtPjJ+E+vp|3)hLqVn|L`Y>bW%LuYYSQZVf7l1nOcjI;fUo3d9V;>1& z4l}i#%4ognouk-1t3H>1N84&Jf1yG7?B+dn$z{GYfGHo{g*y;Nn&?OP9WguzOrJ4e znp|p;ww`pAQ9H(9$A)v4L&BV^GXxe~6r?q=k~rJzxP=<#0?a#@Frr{ga0;-XGIP44 zZ}U-)7bl3I6vvP%go&o2B0_JLqGX5u8G(-QBSTqWDVvu+-_vLCd%(iaueav|i@9!N zv+Z=U$lXbTj|v#?o$5X%w9ZAy5e!GM2z1u`%|2=LIy;@#3#SQT(wjn<3gi;h_7M}$ zCi3LTff$x8arR4--}#<#1K!3TInyOCzO$J4&`YBoS>~Lj1_r>C>Dvn|0KD567tTt$<7fnEP(fXR`+=Kf z_tSo&3O2W=Vt+2aJ8U@qK?1rJvz>@ury+Mmckbk2)i6jXW*Y%j&;%v`{7p&jxQ02< zNj-@P;#NmEj`Nc_HqkzCHB_IWc@w9wMFt%^9n_@8sVfj18AVvsF7)ja!tR7K-E(z? zF#Cq+M~;VQ%P{jfI##nr3WM)*j}_+VUu%W__N?FQ%kV1mh|Dkd+@GLO@6ciPkZkX4 zxL8^NJy;mVjOU>8Pt^AmEle%!DdT*b@%gI%;wh#GnAuVWd30pKj7r}@(V;?l6O@%X zo1TO5uuJ1OIvZiix(CX~Ym^s1_?;)$y>>an4KS4$qUJ$jJ9N)O&47)a9K z#e_W=6re^=yD<4R_^P=E3}p68><~~D&J}^sEh5ysO{>IFCufzgx*)y) zb+9Gs@mQm)xC4Bru+%t!LVfk>I$9LHGVVrwqTFaJDf#F9Si_RC*S)ED zQup}VIv#O+BEy7(V(D#NfU34nedcT73MvHB*+Ec0FhhkaZg}jwYP~W@;uwhchnNG? zw>Z2#iyP@V&;==I4)8vHYsk=!Nn@Sk8Sk22P6GPc-M}uQL=@wwTpeqxX<>0 zhu~>C#_Wc4UpD!1|&Lk)-X4KR+K@%=OLMf*y z+3%C>asEY+|I>f`IAC6gnU)9SAszPn+&1$z;)1Qz=%#e^h1Z0Bfr5Yv?|9ZiN9K0= zA;tN@iXAN_e6_^HlUa&)E}Y}om^)p$+}#k~ph`OUd+A-6Q;UZ5XnHRr7nCOfxokak|+VsW=aNj0^i)g%#s2?DDrISClwh&ul`i%L!7$(fMexmOPx z<3f&%Cd}<(zB|v`oYH>pS`+zxlYD;FmNJH%B~Zl4CZOIHsUm2nZqq{<%Ot!E9iU_* zPU_mR%`?=Z$cKSl8>}nG>9gp7#y<5sZDVT&ZIWrnlXdK6*pdEF$PZLP1 z&SJ+AgO$BL@ys&SuHuaOvfP%#d{ZzgpG(0{YmbxFxQ5bGRV(5&fjWiYGTxp!csnSn zYm~PVVzp9dzW#pSJ)Mh2@0K1JH51vA4CGxLNeIhtCPxA;ob;kTMM!inaOeS6pEN;g zH0ug{OR9(Lj7LoRjoQVgdglJv3>*44LjCkm-OMw3X~?Ai^bKSz=~cPG`n5eb@(2BB zkq`eojSgMrYwbTQiGO?_Z2j{|-e7oiVU4nax6D%HJInnthZ0Xevwlf;k+%9+ubN|Z zR#!LWE8$FnA5QAFr!!)>w{EPO)qAh|Q_Dz;G_K#!RE@`S-0Iz_Of@X(Wc{Fd+_aS+ z!MFfHZ))}fo!Kd(?$5Nhff|KjoFz4+6y(h*p(F9#Ayq9_JDfb97NS$w-gs{s^9$Sr7931_-KzBh1Q%&LBI>){rDuq$ep)Mf& zh*twAikCaifzkp!2FD&)gJgfLZmt)dJQ=Ac_`&+tzXo3WX@on-;7lv*5OFcMT@aCj zEGEOjc@6_lP6Th6X+lr9HYSXaquKO6o2;;oJ)aUV9vqKO^=Mzpm`qdS4$-r#H}mh@ zXV{jci)*t^b8(_kt-tjRy4t5b?#JF?6s(X_k=Z$XE_DPN96jIt(E#K6GfD^}nUheD zLqlQ`L+`JT41SBd&at?BqxCaNuJN~@-)^{H&vCuom~z6i-nwO9ZV_Uw=zNyb*~8b~ zb?0Op#G7T9lm&&ycx_o`n9ey5l|O3ProX6yo+&%E;Lv*Z%ax>#QPlm%1$s+=H{jCi zKW}t;nC%>|8ChSL7@4UQ{Ie*X5HLVIztah#qG$=rTJuqdKCN5x7i7v zyWzq){+|m};O;@G#xABtghlGsg`IX>MCj+_0jk>wLVDXJ*7oG5m8L5ozR)z@kzJC@ z>mbg(y7@j*q2g1Whm8N?zC`oFx~aFxS}(lct-EQ>(dje-bW7U_A9#9DIxBcq2>T+%@x#AZ+1N>%a02fru`h(gp8duQ zyl1w*R(mX7YwgrwUBX6TwQXjX`rQhJ4}+BVvd=7rrHav1+9kh2!2usO|01sDGH@7s zoV~pD456N0Gz8pF`f1f{Urg7k81N@kWV5MU;C18clV{P<`LzYjVA*$1AuPf+R|s<_ z>@miPx56FZ&s;5e5^oSDl~E5%BtgU77wKdD<3l9OKwWYu9vadg(j+}{(uokeLVno%NsWp0bLAZB412i;UU40@|F6vj?$yXt zlBa;)@AmhVORiR^?6^LTcM42=faRAHgN$31J73F_gRzaYzL`6AGj~1Q^b(B2oxS z-nt3J*YTYJ9G`ymE{|-*p=7fZg|NG+)#uzr!I`Y&&~rDojZ6Q9kSTWrQYSa^Q>vBe-W1-kFXuD2 zsrA%^1g)8pXMzzz`=0z8v%Tk>p&?M?ohVpg(yG(B$~Sr8U{rGg|0w7|mY-h-dbQ>0aQoj08cqgJ!gfaWDR;FFn8wUMQ1z5jy^zAv1dp)Tkf5kd_LTCM29r!kkaV;BuFl=OgA+aci%bXln|DxXXTyvqiN{y z>vj9-gw@2fq#voCF^)diLiDy^pBk4Ug&h^b+LV|3*%UZ~8=t=Qq0kG|xW!pHPF40` zf04~81gkj8cMvup>R-9jf+a7|Fq>=#MD(X2)x!+p>tdCDYLm2!wA#8`?{Qoy2XXx- z?V-7$uPRoQx6LtEpnOngfFfhN2g?+g?$m8C;R}SlmyvShIH2Ac!qxI!fs_S+IB07I zr1s@-iqfgrUqt7UB;E{l_zO}L1xLPsuxo2Uy~Y^KE@VszOF=^#4s;1L6#yPPI!|;n zkZ};XbRB(0v}YBrknJKlsN6oa>Sk9KGCQ@$P!TF06vFJ<(E3_0C(QJannA%Xa$`Wn zO60aHBulqF1TwO1t@$1R^DagT;Gphk$bt?foRtt}FfcQ)R9Nl47Ah8_`p9qBDs$l5 ze8AXTu(p-`3x_q|d^z*R`6Hc0hv4S8iccs#df3Vl&Fh;Q(SC4mx!gaG`z@9&jN}~H zPrZCmk-aqP)etIY5$Lnf@Mui!;xo%_FoXFpDT!_w&>K|h^{qQYvnw@jBYBptgQ}?I-HHC5%5S^kt06{VV5AA7$UQI zK|_1Yj8I6B!Dw*}54`F`3l5Sg6CH*t(tge#S*uIy$!<`xXt8BeIy5Q(0^_Gow{mfx z3I;t&mf)(ZVy}$wJ=k!#-S10j`gEW3uUKU{w3rjY_a48`0ZQ5BGe8LH6pNh5Y2=e=s(CnHH z1Wn1#1pRAxSrnm37728*!!^<(3R;IA$SX#qawrAZePbfFct#=CLY0zdwsIcIcD%JI z9pv3}<5UapO2OgsAmT&Kn($k5=}G=SF1M2H@a4zq;wxvtN#ru(l=9@rfUa4@!?3H~ zXflI!_TXJgd+bG;Lo@u|q1FxHfl64d%0)W;WVe^g=K;@(_WR9qsmot3wRX((D@xe} NCEbf(qZ5Rm{}-TjNo@cC literal 0 HcmV?d00001 diff --git a/modules/canadapost/config.xml b/modules/canadapost/config.xml new file mode 100755 index 000000000..391ac0b9d --- /dev/null +++ b/modules/canadapost/config.xml @@ -0,0 +1,12 @@ + + + canadapost + + + + + + 1 + 1 + ca + \ No newline at end of file diff --git a/modules/mondialrelay/kit_mondialrelay/index.php b/modules/canadapost/index.php old mode 100644 new mode 100755 similarity index 96% rename from modules/mondialrelay/kit_mondialrelay/index.php rename to modules/canadapost/index.php index 4e2611d37..b559f9855 --- a/modules/mondialrelay/kit_mondialrelay/index.php +++ b/modules/canadapost/index.php @@ -20,7 +20,7 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision$ +* @version Release: $Revision: 7233 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/modules/canadapost/logo.gif b/modules/canadapost/logo.gif new file mode 100644 index 0000000000000000000000000000000000000000..e7dac26dc875e5c66b1340e6abda1727e05e22b5 GIT binary patch literal 1005 zcmZ?wbhEHb6krf$_|Cu}#1t>e94pQeC&wHu!xGEPl*G)G%*c?!$dJm&kjBcG%Eg$> z$&|>=l*GfF#KV%v%aSC-lpx5IsK^qn%oe4@7NgA?p3QET&1Rp=YFo@|S<7bO$m;LP zF|mDQ=J?3W`Hz9&9|PkbMy5X;oPRjE{%~>s z<>CFy$N!gK;GclNF9pS)x_ZA%Ouu>ie)snK?&bg8$M1)i_YZIXpZA&pDULCT)pz|nzet| zt^2Wk$G@FB{_WZG{lKB02M_-^a^&aP^S{oW`~B+0uea}hy?gWX-Mc?uzy104_22jJ ze?b7~%uz68LO=)PQczxC;JCyf%pv2kVZlKb7P}gW1q_XjEUZp@ZcJ2e?~{<^l9A|O zVCw2pa9k(QaA0Ahh+^=wfP)SXT4h}3Fa$;xGBdFn=tM + [[Quantity]] + [[PackageWeight]] + [[Length]] + [[Width]] + [[Height]] + [[Name]] + diff --git a/modules/canadapost/xml.tpl b/modules/canadapost/xml.tpl new file mode 100755 index 000000000..b60826a4b --- /dev/null +++ b/modules/canadapost/xml.tpl @@ -0,0 +1,16 @@ + + + [[IsoCode]] + + [[UserLogin]] + [[ShipFromPostalCode]] + [[ItemsPrice]] + +[[PackageList]] + + [[ShipToCity]] + [[ShipToStateCode]] + [[ShipToCountryCode]] + [[ShipToPostalCode]] + + diff --git a/modules/ebay/ebay.php b/modules/ebay/ebay.php index daa2979b0..45f51295b 100755 --- a/modules/ebay/ebay.php +++ b/modules/ebay/ebay.php @@ -457,9 +457,8 @@ class Ebay extends Module // Displaying Information from Prestashop - $context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5))); - $prestashopContent = @file_get_contents('http://www.prestashop.com/partner/modules/ebay.php?version='.$this->version.'&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'®istered='.($alert['registration'] == 1 ? 'no' : 'yes').'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$this->context->language->id.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $context); - + $stream_context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5))); + $prestashopContent = @file_get_contents('http://www.prestashop.com/partner/modules/ebay.php?version='.$this->version.'&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'®istered='.($alert['registration'] == 1 ? 'no' : 'yes').'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$this->context->language->id.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context); // Displaying page $this->_html .= '
    @@ -865,9 +864,9 @@ class Ebay extends Module

    '.$this->l('Beware : Only product default categories are used for this configuration.').'


    - * Certaines catégories bénéficient du nouveau format d’annonces multi-versions qui permet de publier 1 seule annonce pour plusieurs versions du même produit.
    - Pour les catégories ne bénéficiant pas de ce format multi-versions, une annonce sera créée pour chaque version du produit.
    - Cliquez ici pour plus d’informations sur les catégories multi-versions + * Certaines catégories bénéficient du nouveau format d’annonces multi-versions qui permet de publier 1 seule annonce pour plusieurs versions du même produit.
    + Pour les catégories ne bénéficiant pas de ce format multi-versions, une annonce sera créée pour chaque version du produit.
    + Cliquez ici pour plus d’informations sur les catégories multi-versions



    '; - ?> - - - - -
    - - - - $(document).ready(function () - { - recherche_MR(\'relativ_base_dir='.$_GET['relativ_base_dir'].'&Pays='.$_GET['Pays'].'&Ville='.$_GET['Ville'].'&CP='.$_GET['CP'].'&Taille=&Poids='.$_GET['Poids'].'&Action='.$_GET['Action'].'&num='.$_GET['num'].'\'); - - window.onload = function() - { - var cpt = 0; - google_map_init(); - if (json_addresses && json_addresses.addresses) - while (json_addresses.addresses[cpt]) - { - if (json_addresses.addresses[cpt].address3.length) - { - address_google = json_addresses.addresses[cpt].address3+\' \'+json_addresses.addresses[cpt].postcode+\' \'+json_addresses.addresses[cpt].city+\' \'+json_addresses.addresses[cpt].iso_country; - address = json_addresses.addresses[cpt].address1+\'
    \'+json_addresses.addresses[cpt].address2+\' \'+json_addresses.addresses[cpt].address3+\'
    \'+json_addresses.addresses[cpt].postcode+\' \'+json_addresses.addresses[cpt].city+\' \'+json_addresses.addresses[cpt].iso_country; - codeAddress(address, address_google); - } - cpt++; - } - } - }); -'; -?> diff --git a/modules/mondialrelay/images/selectRelayPoint.png b/modules/mondialrelay/images/selectRelayPoint.png new file mode 100755 index 0000000000000000000000000000000000000000..b6462f07a2bacddd9625fd56f3b1330789089d2a GIT binary patch literal 2139 zcmV-h2&DIkP)RSQKz;#Wi;KuEmsfW#{j z@BMRl;7{m(fCLgkDpDea0wF3OL0U??$~Nolk7RA%>pL@thr8bHdhPYK*WSG;8OgGI z<(WBi&bi<7bL8H=d)jKX*xA`3gn)l`B_RU0o%P<8x(hS;r`zOj3j_%joy}hzNFjdz-bjH9`oaX*zxp1%@_LDGwt? z9eR-pGrZsMULr!RR%3g68#_>K@BL%~W&RSMRhuRq@;tQr@CYGbtytwdC0u)04aRdcS1QIab?&EYg^{YQG zO)dgo^LisjooVpQj@w98j}RmTA_9m7iBJ(l$r-P`{Yh~lt)9fxMPmC&F5B>#i_kcj zKT3EZgd8p=NjU#jR1Co=S$IaTpP(k95jUtx9b8O^`d}1-IrVG4D25IU(y%`}4RdFL zi<7ixz+h2>7e~9h&eOfm=tl{TfK98cUR>kV#tm>a6n}u*Wi?_a1sAi>aa0+{1SZ3q z9NtV-(EuV5?PP-wyN~EqAT^dghRk~Y@%SN6k_~JmpG#~G_%@23MXYlc0v?OWK?Uez z!!oJq@TBu8)u_%++9pc_%hftJF22TwJmNo_|K;-9Rg4QT1Kyscwoh7Tp8E`7Xe3++ zVASAEAeca+J+jP!#N23nnW$FdTI)+Bu8Sb_x*eR$uwn|~>!L9DEU|rR7jBq1MG*ob z7R4bzMj#3vRpr*oZFbvj{<;2uxLzS9#wbWQ9%|3(YQ5+I%i+DPh#Zr69%ckoK~!j% zWhz?ZdAf~rDGwg~iKM?nv;>{KK3A5m5Sy6b1IWt+(=cS1u?B%$Ek%S_EjKTJ6-^Ck z&#}|rA~PAiT~9qMbMxvN-YY>~GIo^FwWBPr?&Fy#c+Cg`uf#3Bx%z!R-uyS6-gBZ5 zabfu~x31oxA{F`}fPj=Br%;BR_+eUX5vN@hj1M%W&KoOll6j9&3sw;Can559h#-{U zU<0eZNROmQ)Osweo|w85hgZOxefK(`eI=lX7|;Mtj~TvM5-{`dNQ(N`i>ksLfs3L9 zDfvdPnZ;=65q*8>Qk<0CQ&p_B7U$etU!}4iei3Ip7Hf#$y~kRMy>Q_INsxFpX$vTu-&w|xdECgd4CfrpW)s_NHo0`^5*r&Ebh}-QF{Nbmc@|Em-CI?u*XyjT ztmJTEjN#d{XKZe6lBOx6!tA1pPg_+egRo|$Z4%=s-HnokpX9 z_a0-+7Z#JxN|0%q^7!#%k|fEQeCN&`fCEj=vaIx&H>?DUtN{*}tcqxI6h&OSc8$At z?_#|7R4SE&=9X!+cOKP?7fFzlgmL)eoTFN;;+)GPzJa8UB#E@#wYp&~E?WoDVI{PS z%pc53;I!*blMq@|kH<-K?BV`^iJ2z^<*2p~KRd5*xagd-()a;if$4hT6vax6HF556 zhdy3i9$CM1M8=MhSvWy3YUoE9kw%CLQHUT`p1VDEJ5NwDT8$MNwt-0lS>*8ocBr{! zUa8J;5K(3Wd17S*^5naOJhv7FgB8o&?jQJg_iy+}>C+*4T;a{DKja&)yoJdUtQws7 zFWjqtTE?4E#0CO=6R0?WAVfCiFTLOMVC#?gWy>B3eU=E#z;FKbE+6bZpenT!r8$k8 zH>xS6$U0?mDUVb}M%VZhgOW*Z);eyB5BB~}tGU95J0G#t+vaxT2H#%&2@kUOxckX( z`O53JvA#+OZffnDB`E&5m!+BLbO4Hmj@{m9fB@Ve(s~YI1M3tCKm7m}K1%Gbe=iR^l znpc-EVQm%B3SJH1&P2P)uE~QSZ+uID?i)Tl;tdz0>)8Hf+Pw{)W$*K=_dnvZ=bv(+ zS>wt27Ppt)LgENX`!f}xPU|U@&C?jh1#hDaT(TIY&F99KB?DvJ$(hE?8&LAF?m$PH*n)V{~@SAk|mhTU_=PwNzyEz zC!YL1&iwNjFZwuW)0zew17Wx)fWb|(|EB~-5#Rn;s&iT^Ueuy5>L$~?(wd9xL^{Ca z0d5Q%o>3L+VdHYvR}-d9&Yx!|(qK*q0b8wBNz)W#49>Z+_tFLv4nH4t!Lmp-_%w<0 z0S!eCJ}3yEMRa*A%CnX2GHH1L3*`!*nmNv6B@1Emn);lcJBJ)IqBuVIW zI=SI<&S8w<;lqa{Nphf#g(@Wr$`#KGF6JeSldklRJ9Dj8mondialrelay_2f84f9d5731852c4d07d52ef0badc42e'] = 'Problema per ottenere gli indirizzi da MondialRelay Webservice: i server di Mondial Relay potrebbero essere inattivi'; -$_MODULE['<{mondialrelay}prestashop>mondialrelay_016854c68c7122b18d89ff0f5e40502b'] = 'Il Relay Point non è vicino al tuo indirizzo, per favore cambia il tuo indirizzo o utilizza un altro corriere'; -$_MODULE['<{mondialrelay}prestashop>mondialrelay_21034ae6d01a83e702839a72ba8a77b0'] = '(Tasse escl.)'; -$_MODULE['<{mondialrelay}prestashop>mondialrelay_1f87346a16cf80c372065de3c54c86d9'] = '(Tasse incl.)'; -$_MODULE['<{mondialrelay}prestashop>mondialrelay_e7a6ca4e744870d455a57b644f696457'] = 'Gratis!'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_44585fcd617dce6416d8283b026714c1'] = 'Mondial Relay'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_ed4a3b96dc1f38c160775cac1f7bcd6d'] = 'Consegna nei punti Relay'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_70d70ce314f545b7c500a086f147f64b'] = 'Negozio non valido'; @@ -33,7 +28,6 @@ $_MODULE['<{mondialrelay}prestashop>mondialrelay_b962d8fb95f5a439f50502152f3bad7 $_MODULE['<{mondialrelay}prestashop>mondialrelay_faf1247ae6846a9955a466d4f301bbe4'] = 'Pagina corriere'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_10d78806b84b97ebc774e9f6277af6ac'] = 'Per generare le etichette, è necessario disporre di un indirizzo valido e registrato per il tuo negozio sulla tua '; $_MODULE['<{mondialrelay}prestashop>mondialrelay_af5efea250326c1c34d69aa9364b482c'] = 'pagina contatti'; -$_MODULE['<{mondialrelay}prestashop>mondialrelay_ddcd6a653f661fd7d219d9102528b917'] = 'Vai al front office'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_fcf5b2122da1d5a5f5c7253b96a3f9d9'] = 'URL Cron task:'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_362dff77f7403550e886db901404856c'] = 'Cancellazione riuscita'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_66661dacf33146201b60dc16520ddd68'] = 'Aggiungere un metodo di spedizione'; @@ -62,6 +56,7 @@ $_MODULE['<{mondialrelay}prestashop>mondialrelay_907eba32d950bfab68227fd7ea22999 $_MODULE['<{mondialrelay}prestashop>mondialrelay_0c24ec05a02c710cedd400e3680d8b81'] = 'Elenco metodo di spedizione '; $_MODULE['<{mondialrelay}prestashop>mondialrelay_14039af96b01e718a9c9d9c1259b6472'] = 'Nessun metodo di spedizione creato'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_8596361cec00f8d2438d264827eee737'] = 'Config di spedizione.'; +$_MODULE['<{mondialrelay}prestashop>mondialrelay_c9cc8cce247e49bae79f15173ce97354'] = 'Salva'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_f4f70727dc34561dfde1a3c529b6205c'] = 'Impostazioni'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_d02bbc3cb147c272b0445ac5ca7d1a36'] = 'Stato ordine'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_818f954f4838ecad839c5dcbd287d291'] = 'Scegli lo stato dell\'ordine per le etichette. È possibile gestire le etichette'; @@ -72,7 +67,6 @@ $_MODULE['<{mondialrelay}prestashop>mondialrelay_93cba07454f06a4a960172bbd6e2a43 $_MODULE['<{mondialrelay}prestashop>mondialrelay_b9f5c797ebbf55adccdd8539a65a0241'] = 'Disattivato'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_bafd7322c6e97d25b6299b5d6fe8920b'] = 'No'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_9c5c09beb32c36129b857c2a40c861b6'] = 'Visualizza una mappa di Google sul tuo operatore Mondial Relay, può rallentare il caricamento della pagina del corriere '; -$_MODULE['<{mondialrelay}prestashop>mondialrelay_c9cc8cce247e49bae79f15173ce97354'] = 'Salva'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_1ba3935c9858ffb8e19a35ca640b8505'] = 'Impostazioni account Mondial Relay'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_12a3fbd35c1cab4b1101b91d708efd15'] = 'Insegna WebService:'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_6f0434b67007b555dfd1201f4e0d5254'] = 'Codice marchio:'; @@ -86,5 +80,3 @@ $_MODULE['<{mondialrelay}prestashop>mondialrelay_0dbe844fb964d5eca2f51be724e4329 $_MODULE['<{mondialrelay}prestashop>mondialrelay_c6aefd5e2191e1210a2f50416812b517'] = 'Follow-up URL'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_61e70b58e38fd01daa254f44c4fa264b'] = 'N. Point Relay:'; $_MODULE['<{mondialrelay}prestashop>orderdetail_81b7b4587a2a3ea7a0d6bb1df3fbba54'] = 'Consegna a'; - -?> \ No newline at end of file diff --git a/modules/mondialrelay/js/gmap.js b/modules/mondialrelay/js/gmap.js new file mode 100644 index 000000000..4d0e9fd7f --- /dev/null +++ b/modules/mondialrelay/js/gmap.js @@ -0,0 +1,2126 @@ +/* + * GMAP3 Plugin for JQuery + * Version : 3.4 + * Date : July 04, 2011 + * Licence : GPL v3 : http://www.gnu.org/licenses/gpl.html + * Author : DEMONTE Jean-Baptiste + * Contact : jbdemonte@gmail.com + * Web site : http://gmap3.net + * + * Copyright (c) 2010-2011 Jean-Baptiste DEMONTE + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +(function ($) { + + /***************************************************************************/ + /* STACK */ + /***************************************************************************/ + function Stack (){ + var st={}; + this.init = function (id){ + if (!st[id]){ + st[id] = []; + } + } + this.empty = function (id){ + var i; + if (!st[id]) { + return true; + } + for(i = 0; i < st[id].length; i++){ + if (st[id][i]){ + return false + } + } + return true; + } + this.add = function (id, v){ + this.init(id); + st[id].push(v); + } + this.addNext = function (id, v){ + var t=[], i, k = 0; + this.init(id); + for(i = 0; i < st[id].length; i++){ + if (!st[id][i]){ + continue; + } + if (k == 1) { + t.push(v); + } + t.push(st[id][i]); + k++; + } + if (k < 2) { + t.push(v); + } + st[id] = t; + } + this.get = function (id){ + var i; + if (st[id]){ + for(i = 0; i < st[id].length; i++){ + if (st[id][i]) { + return st[id][i]; + } + } + } + return false; + } + this.ack = function (id){ + var i; + if (st[id]) { + for(i = 0; i < st[id].length; i++){ + if (st[id][i]) { + delete st[id][i]; + break; + } + } + if (this.empty(id)){ + delete st[id]; + } + } + } + } + /***************************************************************************/ + /* CLUSTERER */ + /***************************************************************************/ + + function Clusterer(){ + var markers = [], events=[], stored=[], latest=[], redrawing = false, redraw; + + this.events = function(){ + for(var i=0; i= 0){ + same[j] = true; + } else { + this.freeIndex(i); + } + } + return same; + } + + this.add = function(latLng, marker){ + markers.push({latLng:latLng, marker:marker}); + } + + this.get = function(i){ + return markers[i]; + } + + this.clusters = function(map, radius, force){ + var proj = map.getProjection(), + nwP = proj.fromLatLngToPoint( + new google.maps.LatLng( + map.getBounds().getNorthEast().lat(), + map.getBounds().getSouthWest().lng() + ) + ), + i, j, j2, p, x, y, k, k2, + z = map.getZoom(), + pos = {}, + saved = {}, + unik = {}, + clusters = [], + cluster, + chk, + lat, lng, keys, cnt, + bounds = map.getBounds(); + + cnt = 0; + keys = {}; + for(i = 0; i < markers.length; i++){ + if (!bounds.contains(markers[i].latLng)){ + continue; + } + p = proj.fromLatLngToPoint(markers[i].latLng); + pos[i] = [ + Math.floor((p.x - nwP.x) * Math.pow(2, z)), + Math.floor((p.y - nwP.y) * Math.pow(2, z)) + ]; + keys[i] = true; + cnt++; + } + // check if visible markers have changed + if (!force){ + for(k = 0; k < latest.length; k++){ + if( k in keys ){ + cnt--; + } else { + break; + } + } + if (!cnt){ + return false; // no change + } + } + + // save current keys to check later if an update has been done + latest = keys; + + keys = []; + for(i in pos){ + x = pos[i][0]; + y = pos[i][1]; + if ( !(x in saved) ){ + saved[x] = {}; + } + if (!( y in saved[x]) ) { + saved[x][y] = i; + unik[i] = {}; + keys.push(i); + } + unik[ saved[x][y] ][i] = true; + } + radius = Math.pow(radius, 2); + delete(saved); + + k = 0; + while(1){ + while((k 1; + saved = cluster; + } else { + chk = cluster.idx.length > saved.idx.length; + if (chk){ + saved = cluster; + } + } + if (chk){ + p = proj.fromLatLngToPoint( new google.maps.LatLng(saved.lat, saved.lng) ); + lat = Math.floor((p.x - nwP.x) * Math.pow(2, z)); + lng = Math.floor((p.y - nwP.y) * Math.pow(2, z)); + } + } while(chk); + + for(k2 = 0; k2 < saved.idx.length; k2++){ + if (saved.idx[k2] in unik){ + delete(unik[saved.idx[k2]]); + } + } + clusters.push(saved); + } + return clusters; + } + + this.getBounds = function(){ + var i, bounds = new google.maps.LatLngBounds(); + for(i = 0; i < markers.length; i++){ + bounds.extend(markers[i].latLng); + } + return bounds; + } + } + + /***************************************************************************/ + /* GMAP3 */ + /***************************************************************************/ + + var gmap3 = { + _ids:{}, + _properties:['events','onces','options','apply', 'callback', 'data', 'tag'], + + _default:{ + verbose:false, + unit: 'mi', + init:{ + mapTypeId : google.maps.MapTypeId.ROADMAP, + center:[46.578498,2.457275], + zoom: 2 + } + }, + _running:{ + }, + _stack: new Stack(), + /** + * @desc create default structure if not existing + **/ + _init: function($this, id){ + if (!this._ids[id]) { + this._ids[id] = { + $this:$this, + styles: {}, + stored:{}, + map:null + }; + } + }, + /** + * @desc store actions to do in a stack manager + **/ + _plan: function($this, id, list){ + var k; + this._init($this, id); + for(k = 0; k < list.length; k++) { + this._stack.add(id, list[k] ); + } + this._run(id); + }, + /** + * @desc return true if action has to be executed directly + **/ + _isDirect: function(id, todo){ + var action = this._ival(todo, 'action'), + directs = { + distance :true, + earthradius :true, + get :true + }; + return action in directs; + }, + /** + * @desc execute action directly + **/ + _direct: function(id, todo){ + var action = this._ival(todo, 'action'); + if (action.substr(0,1) == ':'){ + action = action.substr(1); + } + return this[action](id, $.extend({}, action in this._default ? this._default[action] : {}, todo.args ? todo.args : todo)); + }, + /** + * @desc store one action to do in a stack manager after the first + **/ + _planNext: function(id, a){ + var $this = this._jObject(id); + this._init($this, id); + this._stack.addNext(id, a); + }, + /** + * @desc called when action in finished, to acknoledge the current in stack and start next one + **/ + _end: function(id){ + delete this._running[id]; + this._stack.ack(id); + this._run(id); + }, + /** + * @desc if not running, start next action in stack + **/ + _run: function(id){ + if (this._running[id]) return; + var a = this._stack.get(id); + if (!a) return; + this._running[id] = true; + this._proceed(id, a); + }, + + _geocoder: null, + _getGeocoder: function(){ + if (!this._geocoder) this._geocoder = new google.maps.Geocoder(); + return this._geocoder; + }, + + _directionsService: null, + _getDirectionsService: function(){ + if (!this._directionsService) this._directionsService = new google.maps.DirectionsService(); + return this._directionsService; + }, + + _elevationService: null, + _getElevationService: function(){ + if (!this._elevationService) this._elevationService = new google.maps.ElevationService(); + return this._elevationService; + }, + + _maxZoomService:null, + _getMaxZoomService: function(){ + if (!this._maxZoomService) this._maxZoomService = new google.maps.MaxZoomService(); + return this._maxZoomService; + }, + + _getMap: function( id ){ + return this._ids[id].map; + }, + + _setMap: function (id, map){ + this._ids[id].map = map; + }, + + _jObject: function( id ){ + return this._ids[id].$this; + }, + + _addStyle: function(id, styleId, style){ + this._ids[id].styles[ styleId ] = style; + }, + + _getStyles: function(id){ + return this._ids[id].styles; + }, + + _getStyle: function(id, styleId){ + return this._ids[id].styles[ styleId ]; + }, + + _styleExist: function(id, styleId){ + return this._ids[id] && this._ids[id].styles[ styleId ]; + }, + + _getDirectionRenderer: function(id){ + return this._getStored(id, 'directionrenderer'); + }, + + _exist: function(id){ + return this._ids[id].map ? true : false; + }, + + /** + * @desc return last non-null object + **/ + _getStored: function(id, name, last, tag){ + if (!this._ids[id].stored[name] || !this._ids[id].stored[name].length){ + return null; + } + var t = this._ids[id].stored[name], + i, + idx = last ? t.length : -1, + add = last ? -1 : 1; + for(i=0; i= 0; idx--){ + if ( (t[idx] !== undefined) && (t[idx].tag !== undefined) && ($.inArray(t[idx].tag, tag) >= 0) ){ + break; + } + } + } else { + for(idx = 0; idx < t.length; idx++){ + if ( (t[idx] !== undefined) && (t[idx].tag !== undefined) && ($.inArray(t[idx].tag, tag) >= 0) ){ + break; + } + } + } + } else { + idx = pop ? t.length - 1 : 0; + } + if ( !(idx in t) ) { + return false; + } + // Google Map element + if (typeof(t[idx].obj.setMap) === 'function') { + t[idx].obj.setMap(null); + } + // JQuery + if (typeof(t[idx].obj.remove) === 'function') { + t[idx].obj.remove(); + } + // internal (cluster) + if (typeof(t[idx].obj.free) === 'function') { + t[idx].obj.free(); + } + delete t[idx].obj; + if (tag !== undefined){ + this._ids[id].stored[name] = this._rmFromArray(t,idx); + } else { + if (pop) { + t.pop(); + } else { + t.shift(); + } + } + return true; + }, + + /** + * @desc manage remove objects + **/ + _clear: function(id, list, last, first, tag){ + var n, i; + if (!list || !list.length){ + list = []; + for(k in this._ids[id].stored){ + list.push(k); + } + } else { + list = this._array(list); + } + for(i = 0; i < list.length; i++){ + if (list[i]){ + n = list[i].toLowerCase(); + if (!this._ids[id].stored[n]) continue; + if (last){ + this._unstore(id, n, tag, true); + } else if (first){ + this._unstore(id, n, tag, false); + } else { + while (this._unstore(id, n, tag, false)); + } + } + } + }, + + /** + * @desc return true if "init" action must be run + **/ + _autoInit: function(name){ + var i, + names = [ + 'init', + 'geolatlng', + 'getlatlng', + 'getroute', + 'getelevation', + 'addstyledmap', + 'setdefault', + 'destroy' + ]; + if ( !name ) { + return true; + } + for(i = 0; i < names.length; i++){ + if (names[i] === name) { + return false; + } + } + return true; + }, + /** + * @desc call functions associated + * @param + * id : string + * action : string : function wanted + * + * options : {} + * + * O1 : {} + * O2 : {} + * ... + * On : {} + * => On : option : {} + * action : string : function name + * ... (depending of functions called) + * + * args : [] : parameters for directs call to map + * target? : object : replace map to call function + **/ + _proceed: function(id, todo){ + todo = todo || {}; + var action = this._ival(todo, 'action') || 'init', + iaction = action.toLowerCase(), + ok = true, + target = this._ival(todo, 'target'), + args = this._ival(todo, 'args'), + map, out; + if ( !this._exist(id) && this._autoInit(iaction) ){ + this.init(id, $.extend({}, this._default.init, todo.args && todo.args.map ? todo.args.map : todo.map ? todo.map : {}), true); + } + if (!target && !args && (iaction in this) && (typeof(this[iaction]) === 'function')){ + // framework functions + this[iaction](id, $.extend({}, iaction in this._default ? this._default[iaction] : {}, todo.args ? todo.args : todo)); // call fnc and extends defaults data + } else { + if (target && (typeof(target) === 'object')){ + if (typeof(target[action]) === 'function'){ + out = target[action].apply(target, todo.args ? todo.args : []); + } else ok = false; + // gm direct function : no result so not rewrited, directly wrapped using array "args" as parameters (ie. setOptions, addMapType, ...) + } else { + map = this._getMap(id); + if (typeof(map[action]) === 'function'){ + out = map[action].apply(map, todo.args ? todo.args : [] ); + } else ok = false; + } + if (!ok && this._default.verbose) alert("unknown action : " + action); + this._callback(id, out, todo); + this._end(id); + } + }, + + /** + * @desc call a function of framework or google map object of the instance + * @param + * id : string : instance + * fncName : string : function name + * ... (depending on function called) + **/ + _call: function(/* id, fncName [, ...] */){ + if ( (arguments.length < 2) || (!this._exist(arguments[0])) ){ + return ; + } + var i, id = arguments[0], + fname = arguments[1], + map = this._getMap(id), + args = []; + if (typeof(map[ fname ]) !== 'function') { + return; + } + for(i=2; i { eventName => function, } + * onces => { eventName => function, } + * data => mixed data + * ] + **/ + _attachEvents : function(id, sender, todo){ + var name; + if (!todo) return + if (todo.events){ + for(name in todo.events){ + if (typeof(todo.events[name]) === 'function'){ + this._attachEvent(id, sender, name, todo.events[name], todo.data, false); + } + } + } + if (todo.onces){ + for(name in todo.onces){ + if (typeof(todo.onces[name]) === 'function'){ + this._attachEvent(id, sender, name, todo.onces[name], todo.data, true); + } + } + } + }, + + /** + * @desc execute callback functions + **/ + _callback: function(mixed, result, todo){ + var k, $j; + if (typeof(todo.callback) === 'function') { + $j = typeof(mixed) === 'number' ? this._jObject(mixed) : mixed; + todo.callback.apply($j, [result]); + } else if (typeof(todo.callback) === 'object') { + for(k in todo.callback){ + if (!$j) $j = typeof(mixed) === 'number' ? this._jObject(mixed) : mixed; + if (typeof(todo.callback[k]) === 'function') todo.callback[k].apply($j, [result]); + } + } + }, + + /** + * @desc execute end functions + **/ + _manageEnd: function(id, sender, todo, internal){ + var k, c; + if (sender && (typeof(sender) === 'object')){ + this._attachEvents(id, sender, todo); + for(k in todo.apply){ + c = todo.apply[k]; + if(!c.action) continue; + if (typeof(sender[c.action]) !== 'function') { + continue; + } + if (c.args) { + sender[c.action].apply(sender, c.args); + } else { + sender[c.action](); + } + } + } + if (!internal) { + this._callback(id, sender, todo); + this._end(id); + } + }, + + /** + * @desc return true if mixed is usable as number + **/ + _isNumeric: function (mixed){ + return (typeof(mixed) === 'number' || typeof(mixed) === 'string') && mixed !== '' && !isNaN(mixed); + }, + + /** + * @desc convert mixed [ lat, lng ] objet by google.maps.LatLng + **/ + _latLng: function(mixed, emptyReturnMixed, noFlat){ + var k, latLng={}, i=0, + empty = emptyReturnMixed ? mixed : null; + if (!mixed || (typeof(mixed) === 'string')){ + return empty; + } + if (mixed.latLng) { + return this._latLng(mixed.latLng); + } + if (typeof(mixed.lat) === 'function') { + return mixed; + } else if ( this._isNumeric(mixed.lat) ) { + return new google.maps.LatLng(mixed.lat, mixed.lng); + } else if ( !noFlat ){ + for(k in mixed){ + if ( !this._isNumeric(mixed[k]) ) return empty; + latLng[i?'lng':'lat'] = mixed[k]; + if (i) break; + i++; + } + if (i) return new google.maps.LatLng(latLng.lat, latLng.lng); + } + return empty; + }, + + _count: function(mixed){ + var k, c = 0; + for(k in mixed) c++; + return c; + }, + + /** + * @desc convert mixed [ sw, ne ] object by google.maps.LatLngBounds + **/ + _latLngBounds: function(mixed, flatAllowed, emptyReturnMixed){ + var empty, cnt, ne, sw, k, t, ok, nesw, i; + if (!mixed) { + return null; + } + empty = emptyReturnMixed ? mixed : null; + if (typeof(mixed.getCenter) === 'function') { + return mixed; + } + cnt = this._count(mixed); + if (cnt == 2){ + if (mixed.ne && mixed.sw){ + ne = this._latLng(mixed.ne); + sw = this._latLng(mixed.sw); + } else { + for(k in mixed){ + if (!ne) { + ne = this._latLng(mixed[k]); + } else { + sw = this._latLng(mixed[k]); + } + } + } + if (sw && ne) return new google.maps.LatLngBounds(sw, ne); + return empty; + } else if (cnt == 4){ + t = ['n', 'e', 's', 'w']; + ok=true; + for(i in t) ok &= this._isNumeric(mixed[t[i]]); + if (ok) return new google.maps.LatLngBounds(this._latLng([mixed.s, mixed.w]), this._latLng([mixed.n, mixed.e])); + if (flatAllowed){ + i=0; + nesw={}; + for(k in mixed){ + if (!this._isNumeric(mixed[k])) return empty; + nesw[t[i]] = mixed[k]; + i++; + } + return new google.maps.LatLngBounds(this._latLng([nesw.s, nesw.w]), this._latLng([nesw.n, nesw.e])); + } + } + return empty; + }, + + /** + * @desc search an (insensitive) key + **/ + _ikey: function(object, key){ + if (key.toLowerCase){ + key = key.toLowerCase(); + for(var k in object){ + if (k.toLowerCase && (k.toLowerCase() == key)) return k; + } + } + return false; + }, + + /** + * @desc search an (insensitive) key + **/ + _ival: function(object, key, def){ + var k = this._ikey(object, key); + if ( k ) return object[k]; + return def; + }, + + /** + * @desc return true if at least one key is set in object + * nb: keys in lowercase + **/ + _hasKey: function(object, keys){ + var n, k; + if (!object || !keys) return false; + for(n in object){ + if (n.toLowerCase){ + n = n.toLowerCase(); + for(k in keys){ + if (n == keys[k]) return true; + } + } + } + return false; + }, + + /** + * @desc return a standard object + * nb: include in lowercase + **/ + _extractObject: function(todo, include, r){ + if (this._hasKey(todo, this._properties) || this._hasKey(todo, include)){ + var k, p, ip, r={}; + for(k in this._properties){ + p=this._properties[k]; + ip = this._ikey(todo, p); + r[p] = ip ? todo[ip] : {}; + } + for(k in include){ + p=include [k]; + ip = this._ikey(todo, p); + if (ip) r[p] = todo[ip]; + } + return r; + } else { + r.options= {}; + for(k in todo){ + if (k === 'action') continue; + r.options[k] = todo[k]; + } + return r; + } + }, + + /** + * @desc identify object from object list or parameters list : [ objectName:{data} ] or [ otherObject:{}, ] or [ object properties ] + * nb: include, exclude in lowercase + **/ + _object: function(name, todo, include, exclude){ + var k = this._ikey(todo, name), + p, r = {}, keys=['map'], + cb='callback'; + r[cb] = this._ival(todo, cb); + if (k) return this._extractObject(todo[k], include, r); + for(k in exclude) keys.push(exclude[k]); + if (!this._hasKey(todo, keys)) r = this._extractObject(todo, include, r); + for(k in this._properties){ + p=this._properties[k]; + if (!r[p]) r[p] = {}; + } + return r; + }, + + /** + * @desc Returns the geographical coordinates from an address and call internal method + **/ + _resolveLatLng: function(id, todo, method, all){ + var address = this._ival(todo, 'address'), + region, params, + that = this, cb; + if ( address ){ + cb = function(results, status) { + if (status == google.maps.GeocoderStatus.OK){ + that[method](id, todo, all ? results : results[0].geometry.location); + } else { + if (that._default.verbose){ + alert('Geocode error : ' + status); + } + that[method](id, todo, false); + } + }; + if (typeof(address) === 'object'){ + params = address; + } else { + params = { 'address': address }; + region = this._ival(todo, 'region'); + if (region){ + params.region = region; + } + } + this._getGeocoder().geocode( params, cb ); + } else { + this[method](id, todo, this._latLng(todo, false, true)); + } + }, + + /*============================*/ + /* PUBLIC */ + /*============================*/ + + /** + * @desc Destroy an existing instance + **/ + destroy: function(id, todo){ + var k, $j; + if (this._ids[id]){ + this._clear(id); + this._ids[id].$this.empty(); + if (this._ids[id].bl) delete this._ids[id].bl; + for(k in this._ids[id].styles){ + delete this._ids[id].styles[ k ]; + } + delete this._ids[id].map; + $j = this._jObject(id); + delete this._ids[id]; + this._callback($j, null, todo); + } + this._end(id); + }, + + /** + * @desc Initialize google map object an attach it to the dom element (using id) + **/ + init: function(id, todo, internal){ + var o, opts, map, styles, k, $this; + if ( (id == '') || (this._exist(id)) ) return this._end(id); + o = this._object('map', todo); + if ( (typeof(o.options.center) === 'boolean') && o.options.center) { + return false; // wait for an address resolution + } + opts = $.extend({}, this._default.init, o.options); + if (!opts.center) { + opts.center = [this._default.init.center.lat, this._default.init.center.lng]; + } + opts.center = this._latLng(opts.center); + $this = this._jObject(id); + this._setMap(id, new google.maps.Map($this.get(0), opts)); + map = this._getMap(id); + + // add previous added styles + styles = this._getStyles( id ); + for(k in styles) map.mapTypes.set(k, styles[k]); + + this._manageEnd(id, map, o, internal); + return true; + }, + + /** + * @desc Returns the geographical coordinates from an address + **/ + getlatlng: function(id, todo){ + this._resolveLatLng(id, todo, '_getLatLng', true); + }, + _getLatLng: function(id, todo, results){ + this._manageEnd(id, results, todo); + }, + + /** + * @desc Return address from latlng + **/ + getaddress: function(id, todo){ + var callback, + $this = this._jObject(id), + latLng = this._latLng(todo, false, true), + address = this._ival(todo, 'address'), + params = latLng ? {latLng:latLng} : ( address ? (typeof(address) === 'string' ? {address:address} : address) : null), + cb = this._ival(todo, 'callback'); + if (params && cb && typeof(cb) === 'function') { + callback = function(results, status) { + var out = status == google.maps.GeocoderStatus.OK ? results : false; + cb.apply($this, [out, status]); + }; + this._getGeocoder().geocode(params, callback); + } + this._end(id); + }, + + /** + * @desc Return a route + **/ + getroute: function(id, todo){ + var callback, + $this = this._jObject(id), + cb = this._ival(todo, 'callback'); + if ( (typeof(cb) === 'function') && todo.options ) { + todo.options.origin = this._latLng(todo.options.origin, true); + todo.options.destination = this._latLng(todo.options.destination, true); + callback = function(results, status) { + var out = status == google.maps.DirectionsStatus.OK ? results : false; + cb.apply($this, [out, status]); + }; + this._getDirectionsService().route( todo.options, callback ); + } + this._end(id); + }, + /** + * @desc return elevation + **/ + getelevation: function(id, todo){ + var callback, latLng, ls, k, path, samples, + locations = [], + $this = this._jObject(id), + cb = this._ival(todo, 'callback'), + latLng = this._ival(todo, 'latlng'); + if (cb && typeof(cb) === 'function') { + callback = function(results, status) { + var out = status == google.maps.ElevationStatus.OK ? results : false; + cb.apply($this, [out, status]); + }; + if (latLng){ + locations.push( this._latLng(latLng) ); + } else { + ls = this._ival(todo, 'locations'); + if (ls){ + for(k in ls){ + locations.push( this._latLng(ls[k]) ); + } + } + } + if (locations.length){ + this._getElevationService().getElevationForLocations({locations:locations}, callback); + } else { + path = this._ival(todo, 'path'); + samples = this._ival(todo, 'samples'); + if (path && samples){ + for(k in path){ + locations.push(this._latLng(path[k])); + } + if (locations.length){ + this._getElevationService().getElevationAlongPath( {path:locations, samples:samples}, callback ); + } + } + } + } + this._end(id); + }, + + /** + * @desc Add a marker to a map after address resolution + * if [infowindow] add an infowindow attached to the marker + **/ + addmarker: function(id, todo){ + this._resolveLatLng(id, todo, '_addMarker'); + }, + + _addMarker: function(id, todo, latLng, internal){ + var result, oi, to, + n = 'marker', niw = 'infowindow', + o = this._object(n, todo, ['to']); + if (!internal){ + if (!latLng) { + this._manageEnd(id, false, o); + return; + } + this._subcall(id, todo, latLng); + } else if (!latLng){ + return; + } + if (o.to){ + to = this._getStoredId(id, o.to); + result = to && (typeof(to.add) === 'function'); + if (result){ + to.add(latLng, todo); + if (typeof(to.redraw) === 'function'){ + to.redraw(); + } + } + if (!internal){ + this._manageEnd(id, result, o); + } + } else { + o.options.position = latLng; + o.options.map = this._getMap(id); + result = new google.maps.Marker(o.options); + if ( todo[niw] ){ + oi = this._object(niw, todo[niw], ['open']); + if ( (oi['open'] === undefined) || oi['open'] ) { + oi.apply = this._array(oi.apply); + oi.apply.unshift({action:'open', args:[this._getMap(id), result]}); + } + oi.action = 'add'+niw; + this._planNext(id, oi); + } + if (!internal){ + this._store(id, n, result, o); + this._manageEnd(id, result, o); + } + } + return result; + }, + + /** + * @desc Add markers (without address resolution) + **/ + addmarkers: function(id, todo){ + if (this._ival(todo, 'clusters')){ + this._addclusteredmarkers(id, todo); + } else { + this._addmarkers(id, todo); + } + }, + _addmarkers: function(id, todo){ + var result, o, k, latLng, marker, options = {}, tmp, to, + n = 'marker', + markers = this._ival(todo, 'markers'); + this._subcall(id, todo); + if ( !markers || (typeof(markers) !== 'object') ) { + return this._end(id); + } + o = this._object(n, todo, ['to', 'markers']); + + if (o.to){ + to = this._getStoredId(id, o.to); + result = to && (typeof(to.add) === 'function'); + if (result){ + for(k in markers){ + latLng = this._latLng(markers[k]); + if (!latLng) continue; + to.add(latLng, markers[k]); + } + if (typeof(to.redraw) === 'function'){ + to.redraw(); + } + } + this._manageEnd(id, result, o); + } else { + $.extend(true, options, o.options); + options.map = this._getMap(id); + result = []; + for(k in markers){ + latLng = this._latLng(markers[k]); + if (!latLng) continue; + if (markers[k].options){ + tmp = {}; + $.extend(true, tmp, options, markers[k].options); + o.options = tmp; + } else { + o.options = options; + } + o.options.position = latLng; + marker = new google.maps.Marker(o.options); + result.push(marker); + o.data = markers[k].data; + o.tag = markers[k].tag; + this._store(id, n, marker, o); + this._manageEnd(id, marker, o, true); + } + o.options = options; // restore previous for futur use + this._callback(id, result, todo); + this._end(id); + } + }, + + resize: function(id) + { + google.maps.event.trigger(this._getMap(id), 'resize'); + }, + + getscale: function(id, todo, internal){ + var map = this._getMap(id), + zoom = map.getZoom(), + scales = [ + 77.864462034120315, + 45.42785688110077, + 16.220730575856892, + 6.879509682822463, + 3.5034960477802986, + 1.8034610362879133, + 0.9127181102723314, + 0.4598746767146186, + 0.23053567913908648, + 0.11545247438886701, + 0.05775371939320953, + 0.02881647975962874, + 0.014414070716531697, + 0.007207618499622224, + 0.003603886381819732, + 0.0018015948787526637, + 0.0009008246767800296, + 0.0004504160086085826, + 0.00022520761796505934, + 0.00011260535432642145, + 0.00005630113180858676 + ]; + scale = scales[zoom]; + if (!internal){ + this._callback(id, scale, todo); + this._end(id); + } + return scale; + }, + _addclusteredmarkers:function(id, todo){ + var clusterer, i, latLng, storeId, + that = this, + radius = this._ival(todo, 'radius'), + markers = this._ival(todo, 'markers'), + styles = this._ival(todo, 'clusters'); + + if (! this._getMap(id).getBounds() ){ // map not initialised => bounds not available + // wait for map + google.maps.event.addListenerOnce( + this._getMap(id), + 'bounds_changed', + function() { + that._addclusteredmarkers(id, todo); + } + ); + return; + } + + if (typeof(radius) === 'number'){ + clusterer = new Clusterer(); + for (i = 0 ; i < markers.length; i++){ + latLng = this._latLng(markers[i]); + clusterer.add(latLng, markers[i]); + } + storeId = this._initClusters(id, todo, clusterer, radius, styles); + } + + this._callback(id, storeId, todo); + this._end(id); + }, + + _initClusters: function(id, todo, clusterer, radius, styles){ + var that=this, + map = this._getMap(id); + + clusterer.setRedraw(function(force){ + var same, clusters = clusterer.clusters(map, radius, force); + if (clusters){ + same = clusterer.freeDiff(clusters); + that._displayClusters(id, todo, clusterer, clusters, same, styles); + } + }); + + clusterer.events( + google.maps.event.addListener( + map, + 'zoom_changed', + function() { + clusterer.redraw(true); + } + ), + google.maps.event.addListener( + map, + 'bounds_changed', + function() { + clusterer.redraw(); + } + ) + ); + + clusterer.redraw(); + return this._store(id, 'cluster', clusterer, todo); + }, + + _displayClusters: function(id, todo, clusterer, clusters, same, styles){ + var k, i, ii, m, done, obj, cluster, options = {}, tmp, + atodo, + ctodo = this._ival(todo, 'cluster') || {}, + mtodo = this._ival(todo, 'marker') || todo; + for(i = 0; i < clusters.length; i++){ + if (i in same){ + continue; + } + cluster = clusters[i]; + done = false; + if (cluster.idx.length > 1){ + m = 0; + for(k in styles){ + if ( (k > m) && (k <= cluster.idx.length) ){ + m = k; + } + } + if (styles[m]){ + atodo = { + content:styles[m].content.replace('CLUSTER_COUNT', cluster.idx.length), + offset:{ + x: -this._ival(styles[m], 'width')/2, + y: -this._ival(styles[m], 'height')/2 + } + }; + obj = this._addOverlay(id, atodo, this._latLng(cluster), true); + + ctodo.data = { + latLng: this._latLng(cluster), + markers:[] + }; + for(ii=0; ii
    '), + listeners = []; + + this._subcall(id, todo, latLng); + map = this._getMap(id); + + $div + .css('border', 'none') + .css('borderWidth', '0px') + .css('position', 'absolute'); + $div.append($(opts.content)); + + function f() { + google.maps.OverlayView.call(this); + this.setMap(map); + } + + f.prototype = new google.maps.OverlayView(); + + f.prototype.onAdd = function() { + var panes = this.getPanes(); + if (opts.pane in panes) { + $(panes[opts.pane]).append($div); + } + } + f.prototype.draw = function() { + var overlayProjection = this.getProjection(), + ps = overlayProjection.fromLatLngToDivPixel(latLng), + that = this; + + $div + .css('left', (ps.x+opts.offset.x) + 'px') + .css('top' , (ps.y+opts.offset.y) + 'px'); + + $.each( ("dblclick click mouseover mousemove mouseout mouseup mousedown").split(" "), function( i, name ) { + listeners.push( + google.maps.event.addDomListener($div[0], name, function(e) { + google.maps.event.trigger(that, name); + }) + ); + }); + listeners.push( + google.maps.event.addDomListener($div[0], "contextmenu", function(e) { + google.maps.event.trigger(that, "rightclick"); + }) + ); + } + f.prototype.onRemove = function() { + for (var i = 0; i < listeners.length; i++) { + google.maps.event.removeListener(listeners[i]); + } + $div.remove(); + } + f.prototype.hide = function() { + $div.hide(); + } + f.prototype.show = function() { + $div.show(); + } + f.prototype.toggle = function() { + if ($div) { + if ($div.is(':visible')){ + this.show(); + } else { + this.hide(); + } + } + } + f.prototype.toggleDOM = function() { + if (this.getMap()) { + this.setMap(null); + } else { + this.setMap(map); + } + } + f.prototype.getDOMElement = function() { + return $div[0]; + } + ov = new f(); + if (!internal){ + this._store(id, 'overlay', ov, o); + this._manageEnd(id, ov, o); + } + return ov; + }, + + /** + * @desc add fixed panel to a map + **/ + addfixpanel: function(id, todo){ + var n = 'fixpanel', + o = this._object(n, todo), + x=0, y=0, $c, $div; + if (o.options.content){ + $c = $(o.options.content); + + if (o.options.left !== undefined){ + x = o.options.left; + } else if (o.options.right !== undefined){ + x = this._jObject(id).width() - $c.width() - o.options.right; + } else if (o.options.center){ + x = (this._jObject(id).width() - $c.width()) / 2; + } + + if (o.options.top !== undefined){ + y = o.options.top; + } else if (o.options.bottom !== undefined){ + y = this._jObject(id).height() - $c.height() - o.options.bottom; + } else if (o.options.middle){ + y = (this._jObject(id).height() - $c.height()) / 2 + } + + $div = $('
    ') + .css('position', 'absolute') + .css('top', y+'px') + .css('left', x+'px') + .css('z-index', '1000') + .append(o.options.content); + + this._jObject(id).first().prepend($div); + this._attachEvents(id, this._getMap(id), o); + this._store(id, n, $div, o); + this._callback(id, $div, o); + } + this._end(id); + }, + + /** + * @desc Add a direction renderer to a map + **/ + adddirectionsrenderer: function(id, todo, internal){ + var n = 'directionrenderer', + dr, o = this._object(n, todo, ['panelId']); + this._clear(id, n); + o.options.map = this._getMap(id); + dr = new google.maps.DirectionsRenderer(o.options); + if (o.panelId) { + dr.setPanel(document.getElementById(o.panelId)); + } + this._store(id, n, dr, o); + this._manageEnd(id, dr, o, internal); + }, + + /** + * @desc Set direction panel to a dom element from it ID + **/ + setdirectionspanel: function(id, todo){ + var dr, o = this._object('directionpanel', todo, ['id']); + if (o.id) { + dr = this._getDirectionRenderer(id); + dr.setPanel(document.getElementById(o.id)); + } + this._manageEnd(id, dr, o); + }, + + /** + * @desc Set directions on a map (create Direction Renderer if needed) + **/ + setdirections: function(id, todo){ + var dr, o = this._object('directions', todo); + if (todo) o.options.directions = todo.directions ? todo.directions : (todo.options && todo.options.directions ? todo.options.directions : null); + if (o.options.directions) { + dr = this._getDirectionRenderer(id); + if (!dr) { + this.adddirectionsrenderer(id, o, true); + dr = this._getDirectionRenderer(id); + } else { + dr.setDirections(o.options.directions); + } + } + this._manageEnd(id, dr, o); + }, + + /** + * @desc set a streetview to a map + **/ + setstreetview: function(id, todo){ + var o = this._object('streetview', todo, ['id']), + panorama; + if (o.options.position){ + o.options.position = this._latLng(o.options.position); + } + panorama = new google.maps.StreetViewPanorama(document.getElementById(o.id),o.options); + this._getMap(id).setStreetView(panorama); + this._manageEnd(id, panorama, o); + }, + + /** + * @desc add a kml layer to a map + **/ + addkmllayer: function(id, todo){ + var n = 'kmllayer', + o = this._object(n, todo, ['url']), + kml; + o.options.map = this._getMap(id); + kml = new google.maps.KmlLayer(o.url, o.options); + this._store(id, n, kml, o); + this._manageEnd(id, kml, o); + }, + + /** + * @desc add a traffic layer to a map + **/ + addtrafficlayer: function(id, todo){ + var n = 'trafficlayer', + o = this._object(n, todo), + tl = this._getStored(id, n); + if (!tl){ + tl = new google.maps.TrafficLayer(); + tl.setMap(this._getMap(id)); + this._store(id, n, tl, o); + } + this._manageEnd(id, tl, o); + }, + + /** + * @desc set a bicycling layer to a map + **/ + addbicyclinglayer: function(id, todo){ + var n = 'bicyclinglayer', + o = this._object(n, todo), + bl = this._getStored(id, n); + if (!bl){ + bl = new google.maps.BicyclingLayer(); + bl.setMap(this._getMap(id)); + this._store(id, n, bl, o); + } + this._manageEnd(id, bl, o); + }, + + + /** + * @desc add a ground overlay to a map + **/ + addgroundoverlay: function(id, todo){ + var n = 'groundoverlay', + o = this._object(n, todo, ['bounds', 'url']), + ov; + o.bounds = this._latLngBounds(o.bounds); + if (o.bounds && o.url){ + ov = new google.maps.GroundOverlay(o.url, o.bounds); + ov.setMap(this._getMap(id)); + this._store(id, n, ov, o); + } + this._manageEnd(id, ov, o); + }, + + /** + * @desc Geolocalise the user and return a LatLng + **/ + geolatlng: function(id, todo){ + var geo, + cb = this._ival(todo, 'callback'), + $this = this._jObject(id); + if (typeof(cb) === 'function') { + if(navigator.geolocation) { + browserSupportFlag = true; + navigator.geolocation.getCurrentPosition(function(position) { + var out = new google.maps.LatLng(position.coords.latitude,position.coords.longitude); + cb.apply($this, [out]); + }, function() { + var out = false; + cb.apply($this, [out]); + }); + } else if (google.gears) { + browserSupportFlag = true; + geo = google.gears.factory.create('beta.geolocation'); + geo.getCurrentPosition(function(position) { + var out = new google.maps.LatLng(position.latitude,position.longitude); + cb.apply($this, [out]); + }, function() { + out = false; + cb.apply($this, [out]); + }); + } else { + out = false; + cb.apply($this, [out]); + } + } + this._end(id); + }, + + /** + * @desc Add a style to a map + **/ + addstyledmap: function(id, todo, internal){ + var o = this._object('styledmap', todo, ['id', 'style']), + style; + if (o.style && o.id && !this._styleExist(id, o.id)) { + style = new google.maps.StyledMapType(o.style, o.options); + this._addStyle(id, o.id, style); + if (this._getMap(id)) this._getMap(id).mapTypes.set(o.id, style); + } + this._manageEnd(id, style, o, internal); + }, + + /** + * @desc Set a style to a map (add it if needed) + **/ + setstyledmap: function(id, todo){ + var o = this._object('styledmap', todo, ['id', 'style']), + style; + if (o.id) { + this.addstyledmap(id, o, true); + style = this._getStyle(id, o.id); + if (style) { + this._getMap(id).setMapTypeId(o.id); + this._callback(id, style, todo); + } + } + this._manageEnd(id, style, o); + }, + + /** + * @desc Remove objects from a map + **/ + clear: function(id, todo){ + var list = this._array(this._ival(todo, 'list') || this._ival(todo, 'name')), + last = this._ival(todo, 'last', false), + first = this._ival(todo, 'first', false), + tag = this._ival(todo, 'tag'); + if (tag !== undefined){ + tag = this._array(tag); + } + this._clear(id, list, last, first, tag); + this._end(id); + }, + + /** + * @desc Return Google object(s) wanted + **/ + get: function(id, todo){ + var name = this._ival(todo, 'name') || 'map', + first= this._ival(todo, 'first'), + all = this._ival(todo, 'all'), + tag = this._ival(todo, 'tag'), + r, i, t; + name = name.toLowerCase(); + if (tag !== undefined){ + tag = this._array(tag); + } + if (name == 'map'){ + return this._getMap(id); + } + if (first){ + return this._getStored(id, name, false, tag); + } else if (all){ + r = new Array(); + t = this._ids[id].stored[name]; + if (t){ + for(i = 0; i < t.length; i++){ + if (!t[i]){ + continue; + } + if (tag !== undefined) { + if ( (t[i].tag === undefined) || ($.inArray(t[i].tag, tag) < 0) ){ + continue; + } + } + r.push(t[i].obj); + } + } + return r; + } else { + return this._getStored(id, name, true, tag); + } + }, + + /** + * @desc return the radius of the earth depending on the unit + **/ + earthradius: function(unit){ + unit = unit ? unit : this._default.unit; + return (typeof(unit) === 'string' && (unit.toLowerCase() === 'km')) ? 6371 : 3959; + }, + + /** + * @desc the distance between 2 latLng depending on the unit + **/ + distance: function(id, todo){ + var unit = this._ival(todo, 'unit'), + a = this._latLng(this._ival(todo, 'a')), + b = this._latLng(this._ival(todo, 'b')), + e,f,g,h, dist; + if (a && b){ + e=(Math.PI*a.lat()/180); + f=(Math.PI*a.lng()/180); + g=(Math.PI*b.lat()/180); + h=(Math.PI*b.lng()/180); + dist = this.earthradius(unit)*Math.acos(Math.min(Math.cos(e)*Math.cos(g)*Math.cos(f)*Math.cos(h)+Math.cos(e)*Math.sin(f)*Math.cos(g)*Math.sin(h)+Math.sin(e)*Math.sin(g),1)); + } + return dist; + }, + + /** + * @desc return the max zoom of a latlng + **/ + getmaxzoom: function(id, todo){ + this._resolveLatLng(id, todo, '_getMaxZoom'); + }, + _getMaxZoom: function(id, todo, latLng){ + var callback, + $this = this._jObject(id), + cb = this._ival(todo, 'callback'); + if (cb && typeof(cb) === 'function') { + callback = function(result) { + var zoom = result.status == google.maps.MaxZoomStatus.OK ? result.zoom : false; + cb.apply($this, [zoom, result.status]); + }; + this._getMaxZoomService().getMaxZoomAtLatLng(latLng, callback); + } + this._end(id); + }, + + /** + * @desc modify default values + **/ + setdefault: function(id, todo, internal){ + for(var k in todo){ + if (typeof(this._default[k]) === 'object'){ + this._default[k] = jQuery.extend({}, this._default[k], todo[k]); + } else { + this._default[k] = todo[k]; + } + } + if (!internal){ + this._end(id); + } + }, + /** + * @desc : autofit a map using its overlays (markers, rectangles ...) + **/ + autofit: function(id, todo, internal){ + var n, i, stored, obj, empty = true, bounds = new google.maps.LatLngBounds(); + if (id in this._ids){ + for(n in this._ids[id].stored){ + stored = this._ids[id].stored[n]; + for(i = 0; i < stored.length; i++){ + obj = stored[i].obj; + if (obj.getPosition){ + bounds.extend(obj.getPosition()); + empty = false; + } else if (obj.getBounds){ + bounds.extend(obj.getBounds().getNorthEast()); + bounds.extend(obj.getBounds().getSouthWest()); + empty = false; + } else if (obj.getPaths){ + obj.getPaths().forEach(function(path){ + path.forEach(function(latLng){ + bounds.extend(latLng); + empty = false; + }); + }); + } else if (obj.getPath){ + obj.getPath().forEach(function(latLng){ + bounds.extend(latLng); + empty = false; + }); + } else if (obj.getCenter){ + bounds.extend(obj.getCenter()); + empty = false; + } + } + } + if (!empty){ + this._getMap(id).fitBounds(bounds); + } + } + if (!internal){ + this._manageEnd(id, empty ? false : bounds, todo, internal); + } + } + + }; + + var globalId = 0; + + $.fn.gmap3 = function(){ + var a,i, + todo = [], + results = [], + empty = true; + for(i=0; ii>&<6<{8$(_-QXND1$Rm%OC}V8Wi<=liwHBY# zojZ?1UUk?+dd+bjrA!TT-ZnN%=RVz^ai9DC2jB1K^Y!p_w|5A)25f$L1UC6IUF2ko|vT|9ur0e$}_nS{ZbXI=a2M&Ux??FDx6VoCYZovNjZ zd&_qpEZ^s?)YPs%s#~jXT5oP$Z|jtHbV;9f^LwlNpFJAr|9S9v{fohdH?LcTZ`wwN zpG>|Rl=1syf@hnr-pGglRE$q3Cf;s+n3@(1iN#|xGvo8~AC?wBDaGQ?lKJiBm9@2n zjg8f9sq~9Xrc}z6O2wD0t(|`X{^vhkz;Fu&0RS3s@T=w5Cji6_@H=7;rGZOip5Qk7 zqjMo31h&hoiqa@5g@M+wBZwMa{|}%Cg3{oMK${z>BM6YD8j|*2&-gtKQPnRhq1gxm zJHj;Q08Jn4o3KWZu+B9Il3^GkfbD0{TE0*8oUj*kJ+@(<#{e`#?NoM;2X>GD0;9id zOX3gWpf+eL^PUJ%X}*h4D|3yz0#&2BA^wZpo0c>yUHxme5Qz{xBx@0EdKVlzeo`YKpf}td^a@u${!x+3GNx7g zBe`5w;1lYF$$@D>0!oc;BEt`G;TUtga&`ydWGtoOoXh=-+W0F4H%`4ifff;xHJpn|3sH8ln=_ zV93-n!telWQ?L+eRv`~1`lWLK9ehi=;HJhOra~=Cd>JISE=qhR1s%|w2bf?m_cHLl zsc^*Zg4HuA`fAbmaBBHD^r*l+s-8)<;)>>qBfO3|Q%=)Hl{V2&p#fc45(Vi5N;ab6A#C)6hZWbIf zX*KsF$k`;S>M9sLa34xijl1+C=W|j2>UKm zB_bv^h&n{ZIUhG;W6g{_(7mYib`DCh71cusvOoO(GI(T@Q4#G`27M;ekE|z{I%}F> z>4AimVy%Zk)>qY?4fu^n9L$YIOD#$v>N<;DQAl0KZ;5vJxiT$Bl)yxVc5rA+19m!R z0;=f}*3(IAmUqJg-Fy;v*(un0v_J*GZ8fEjD>q3r0FdeuHI?x}Y~2 g7f>fu>E}5+$9OH*kqt)M{3!^!c0XIs*Z^?+2RFM*(*OVf diff --git a/modules/mondialrelay/kit_mondialrelay/MR_small.gif b/modules/mondialrelay/kit_mondialrelay/MR_small.gif deleted file mode 100755 index 571069d5700d50111aab8a23114765b899eb58a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 797 zcmZ?wbhEHblw*)*c;?D**WNWPS?t~XMfY62A4SDKPDuUrqb!HNSp+ucAFstXff5T&PtYEBE8(t?!qwE(+8;d}ztD{F2kBHavWA@yCsuPoLhHIXz`^ zv;UXFN8im|_^hNNFGsmDQ~mFkFPEJh*Yu>7$H~r}omF39@v5uu*RLPv&uzQ!74Uk( z>)ycrheR*xUS_ZE3`lOobjtZUH%M z2ad4APMm8*1rz!m1O@q*#d0?+^iXz|sks^bpyS9l('Closed');} else {$p1=$o1.' - '.$f1;}; -if ($o2=='00:00' && $f2=='00:00') {$p2=$mondialrelay->l('Closed');} else {$p2=$o2.' - '.$f2;}; -if ($p1=='Ferm' && $p2=='Ferm' ) {$p=$mondialrelay->l('Closed');} else {$p=$p1.'  '.$p2;}; -return utf8_encode($p); -}; - - - - - -$k_security=strtoupper(md5(_Enseigne_webservice.$client_Num.$client_Pays._Key_webservice)); - -require_once('tools/nusoap/lib/nusoap.php'); -$client_mr = new nusoap_client("http://www.mondialrelay.fr/webservice/Web_Services.asmx?WSDL",true); - -$client_mr->soap_defencoding = 'UTF-8'; -$client_mr->decode_utf8 = false; - -$params = array( -'Enseigne' => _Enseigne_webservice, -'Num' => $client_Num, -'Pays' => $client_Pays, -'Security' => $k_security, -); - - - - -$result_mr = $client_mr->call('WSI2_DetailPointRelais', $params, 'http://www.mondialrelay.fr/webservice/', 'http://www.mondialrelay.fr/webservice/WSI2_DetailPointRelais'); -if ($client_mr->fault) -{ -echo 'a|

    Fault (Expect - The request contains an invalid SOAP body)

    ';
    -print_r($result);
    -echo '
    |'.$num; -} else -{ -$err = $client_mr->getError(); -if ($err) { echo 'a|

    Error

    ' . $err . '
    |'.$num; } -else -{ -$sortie_titre=""; -$sortie_loc=""; -$sortie_info=""; -$sortie_photo=""; -$sortie_plan=""; -$sortie_horaires=""; -echo $result_mr['WSI2_DetailPointRelaisResult']['STAT'].'|'; - - -$sortie_horaires.=""; -$sortie_horaires.="".$mondialrelay->l('Monday').""; -$sortie_horaires.="".mr_horaire_fr($result_mr['WSI2_DetailPointRelaisResult']['Horaires_Lundi']['string'][0],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Lundi']['string'][1],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Lundi']['string'][2],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Lundi']['string'][3]).""; -$sortie_horaires.=""; -$sortie_horaires.=""; -$sortie_horaires.="".$mondialrelay->l('Tuesday').""; -$sortie_horaires.="".mr_horaire_fr($result_mr['WSI2_DetailPointRelaisResult']['Horaires_Mardi']['string'][0],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Mardi']['string'][1],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Mardi']['string'][2],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Mardi']['string'][3]).""; -$sortie_horaires.=""; -$sortie_horaires.=""; -$sortie_horaires.="".$mondialrelay->l('Wednesday').""; -$sortie_horaires.="".mr_horaire_fr($result_mr['WSI2_DetailPointRelaisResult']['Horaires_Mercredi']['string'][0],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Mercredi']['string'][1],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Mercredi']['string'][2],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Mercredi']['string'][3]).""; -$sortie_horaires.=""; -$sortie_horaires.="".$mondialrelay->l('Thursday').""; -$sortie_horaires.="".mr_horaire_fr($result_mr['WSI2_DetailPointRelaisResult']['Horaires_Jeudi']['string'][0],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Jeudi']['string'][1],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Jeudi']['string'][2],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Jeudi']['string'][3]).""; -$sortie_horaires.=""; -$sortie_horaires.="".$mondialrelay->l('Friday').""; -$sortie_horaires.="".mr_horaire_fr($result_mr['WSI2_DetailPointRelaisResult']['Horaires_Vendredi']['string'][0],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Vendredi']['string'][1],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Vendredi']['string'][2],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Vendredi']['string'][3]).""; -$sortie_horaires.=""; -$sortie_horaires.="".$mondialrelay->l('Saturday').""; -$sortie_horaires.="".mr_horaire_fr($result_mr['WSI2_DetailPointRelaisResult']['Horaires_Samedi']['string'][0],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Samedi']['string'][1],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Samedi']['string'][2],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Samedi']['string'][3]).""; -$sortie_horaires.=""; -$sortie_horaires.="".$mondialrelay->l('Sunday').""; -$sortie_horaires.="".mr_horaire_fr($result_mr['WSI2_DetailPointRelaisResult']['Horaires_Dimanche']['string'][0],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Dimanche']['string'][1],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Dimanche']['string'][2],$result_mr['WSI2_DetailPointRelaisResult']['Horaires_Dimanche']['string'][3]).""; -$sortie_horaires.=""; - -$sortie_horaires="".$sortie_horaires."
    "; - - -$sortie_titre.="".$result_mr['WSI2_DetailPointRelaisResult']['LgAdr1'].""; -if ($result_mr['WSI2_DetailPointRelaisResult']['LgAdr2']!='') {$sortie_titre.="
    ".$result_mr['WSI2_DetailPointRelaisResult']['LgAdr2'];}; -if ($result_mr['WSI2_DetailPointRelaisResult']['LgAdr3']!='') {$sortie_titre.="
    ".$result_mr['WSI2_DetailPointRelaisResult']['LgAdr3'];}; -if ($result_mr['WSI2_DetailPointRelaisResult']['LgAdr4']!='') {$sortie_titre.="
    ".$result_mr['WSI2_DetailPointRelaisResult']['LgAdr4'];}; -if ($result_mr['WSI2_DetailPointRelaisResult']['CP']!='') {$sortie_titre.="
    ".$result_mr['WSI2_DetailPointRelaisResult']['CP'];}; -if ($result_mr['WSI2_DetailPointRelaisResult']['Ville']!='') {$sortie_titre.=" ".$result_mr['WSI2_DetailPointRelaisResult']['Ville'];}; -//if ($result_mr['WSI2_DetailPointRelaisResult']['Pays']!='') {$sortie_titre.=" - ".$result_mr['WSI2_DetailPointRelaisResult']['Pays'];}; -$sortie_titre="

    ".$sortie_titre."

    "; - - -if ($result_mr['WSI2_DetailPointRelaisResult']['Localisation1']!='') {$sortie_loc.=$result_mr['WSI2_DetailPointRelaisResult']['Localisation1'];}; -if ($result_mr['WSI2_DetailPointRelaisResult']['Localisation2']!='') {$sortie_loc.="
    ".$result_mr['WSI2_DetailPointRelaisResult']['Localisation2'];}; -if ($sortie_loc!="") {$sortie_loc="

    ".$sortie_loc."

    ";} - -if ($result_mr['WSI2_DetailPointRelaisResult']['Information']!='') {$sortie_info="

    ".$result_mr['WSI2_DetailPointRelaisResult']['Information']."

    ";}; - - -if ($result_mr['WSI2_DetailPointRelaisResult']['URL_Photo']!='') {$sortie_photo="";}; -if ($result_mr['WSI2_DetailPointRelaisResult']['URL_Plan']!='') {$sortie_plan.="";}; -$fermer=""; - - -echo "
    ".$fermer."
    -
    - - - - - - - -

    Votre Point Relais

    -
    ".utf8_encode($sortie_titre.$sortie_loc.$sortie_info)."

    - ".$sortie_plan." -
    - ".$sortie_horaires."
    ".$sortie_photo." -
    -
    l('Select this Relay Point'))."\" type=\"button\" onclick=\" - document.getElementById('MRchoixRelais".$num.'_'.$result_mr['WSI2_DetailPointRelaisResult']['Num']."').checked=true;select_PR_MR('".$result_mr['WSI2_DetailPointRelaisResult']['Num']."','".$num."');masque_recherche_MR_detail('".$num."');\">
    -
    |".$num; - - -} -} -?> diff --git a/modules/mondialrelay/kit_mondialrelay/RecherchePointRelais_ajax.php b/modules/mondialrelay/kit_mondialrelay/RecherchePointRelais_ajax.php deleted file mode 100755 index 9e0e20025..000000000 --- a/modules/mondialrelay/kit_mondialrelay/RecherchePointRelais_ajax.php +++ /dev/null @@ -1,101 +0,0 @@ -getValue('SELECT `MR_Selected_Num` FROM `'._DB_PREFIX_.'mr_selected` WHERE `id_cart` = '.$cookie->id_cart); - -$mondialrelay = new MondialRelay(); - -DEFINE('_Enseigne_webservice', Configuration::get('MR_ENSEIGNE_WEBSERVICE')); -DEFINE('_Key_webservice', Configuration::get('MR_KEY_WEBSERVICE')); - -header('Content-Type: text/html; charset=utf-8'); - -$relativ_base_dir = $_POST['relativ_base_dir']; -$client_pays_iso = $_POST['Pays']; -$client_ville = $_POST['Ville']; -$client_cp = $_POST['CP']; -$card_taille = $_POST['Taille']; -$card_weight = $_POST['Poids']; -$client_type_exp = $_POST['Action']; -$num = $_POST['num']; - - -$k_security = strtoupper(md5(_Enseigne_webservice.$client_pays_iso.$client_ville.$client_cp.$card_taille.$card_weight.$client_type_exp._Key_webservice)); - -require_once('tools/nusoap/lib/nusoap.php'); -$client_mr = new nusoap_client("http://www.mondialrelay.fr/webservice/Web_Services.asmx?WSDL", true); - -$client_mr->soap_defencoding = 'UTF-8'; -$client_mr->decode_utf8 = false; - -$params = array( -'Enseigne' => _Enseigne_webservice, -'Pays' => $client_pays_iso, -'Ville' => $client_ville, -'CP' => $client_cp, -'Taille' => '', -'Poids' => $card_weight, -'Action' => $client_type_exp, -'Security' => $k_security, -); - -$result_mr = $client_mr->call('WSI2_RecherchePointRelais', $params, 'http://www.mondialrelay.fr/webservice/', 'http://www.mondialrelay.fr/webservice/WSI2_RecherchePointRelais'); -if ($client_mr->fault) -{ - echo 'a|

    Fault (Expect - The request contains an invalid SOAP body)

    ';
    -	print_r($result);
    -	echo '
    |'.$num; -} -else -{ - $err = $client_mr->getError(); - if ($err) - echo '{"error" : "'.$err.'"}'; - else if (($code = $result_mr['WSI2_RecherchePointRelaisResult']['STAT']) != 0) - echo '{"statError": {"code": "'.$code.'", "msg": "'. - (array_key_exists($code, $statCode)) ? $statCode[$code] : 'Unknown error'.'}}'; - else - { - $tr = ""; - echo '{'; - for ($i = 1; $i <= 10; $i++) - { - //if ($i==1) {$checked="checked=\"checked\"" ;} else {$checked="";}; - if($i < 10) - $l = '0'.$i; - else - $l = '10'; - $numWSI2 = $result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']; - } - - echo '"base_dir" : "'.$relativ_base_dir.'", '; - echo '"addresses" : ['; - $i = 0; - $total = count($result_mr['WSI2_RecherchePointRelaisResult'] ); - - foreach ($result_mr['WSI2_RecherchePointRelaisResult'] as $key => $val) - { - if ($key != 'STAT') - { - echo '{"address1" : "'.addslashes($val['LgAdr1']).'", - "address2" : "'.addslashes($val['LgAdr2']).'", - "address3" : "'.addslashes($val['LgAdr3']).'", - "address4" : "'.addslashes($val['LgAdr4']).'", - "postcode" : "'.addslashes($val['CP']).'", - "city" : "'.addslashes($val['Ville']).'", - "iso_country" : "'.addslashes($val['Pays']).'", - "num" : "'.$val['Num'].'", - "checked" : '.($val['Num'] == $id_cart_address ? 1 : 0).'}'.(($i + 1) == $total ? '' : ', '); - } - ++$i; - } - echo ']}'; - } -} -?> diff --git a/modules/mondialrelay/kit_mondialrelay/SuiviExpedition_ajax.php b/modules/mondialrelay/kit_mondialrelay/SuiviExpedition_ajax.php deleted file mode 100755 index 296dcdb9a..000000000 --- a/modules/mondialrelay/kit_mondialrelay/SuiviExpedition_ajax.php +++ /dev/null @@ -1,6 +0,0 @@ -'.$var_Expedition.'<'._Key_webservice.'>')); -echo 'http://www.mondialrelay.fr/lg_fr/espaces/url/popup_exp_details.aspx?cmrq='._Enseigne_webservice.'&nexp='.$var_Expedition.'&crc='.$k_security; diff --git a/modules/mondialrelay/kit_mondialrelay/close.gif b/modules/mondialrelay/kit_mondialrelay/close.gif deleted file mode 100755 index 02de7f792451d1e68a9ca36008973fcaf18b063c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 246 zcmZ?wbhEHbRAEqI*v!eWckkZn>gp3GPRyAz=gXHbGiJ<4O-;Rb?_N|?)c^ng88Cq2 zPZmZ722KVYkPOHS2A0JJCp}m1wRnAY_x}WquH!#s-A;09b|`hsVl245x4`Ck$6iUB z89h$izl@p|YzX4vGd(*;e^zzgioHT%;)mF{yw+u8Z)rMVT5R6KvBH&kX=B1Bfre9# zbBj1O2r^W2TGThHwFG&!DY7Rrv(!0u%k_2%br?*Ro;sTD~_w=^x?fAG-ZBS(*M3Nly&0J0=rq5uE@ diff --git a/modules/mondialrelay/kit_mondialrelay/js/include_MR.js b/modules/mondialrelay/kit_mondialrelay/js/include_MR.js deleted file mode 100755 index ddc54d7bc..000000000 --- a/modules/mondialrelay/kit_mondialrelay/js/include_MR.js +++ /dev/null @@ -1,56 +0,0 @@ -var gl_base_dir; - -function set_html_MR_recherche(obj, num, base_dir, cpt) -{ -gl_base_dir = base_dir; - -var html = '\ -
    \ -
    \ - \ - \ - \ - \ - \ - \ - \ -
    '+obj.address1+' - \ -'+obj.address2+''; -if (obj.address2 != '') - html = html + ' - '; -html = html + ''+obj.address3+''; -if (obj.address3 != '') - html = html + ' - '; -html = html + ''+obj.address4+''; -if (obj.address4 != '') - html = html + ' - '; -html = html + ''+obj.postcode+' \ -'+obj.city+' - \ -'+obj.iso_country+'
    '; - $('#mondialrelay_'+num).html($('#mondialrelay_'+num).html()+html); - if (obj.checked == '1' || cpt == 0) - select_PR_MR(obj.num, num); -} - -function include_mondialrelay(num) -{ - $('#form_mondialrelay_'+num).html('\ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ -
    \ -
    \ -
    '); -} diff --git a/modules/mondialrelay/kit_mondialrelay/js/index.php b/modules/mondialrelay/kit_mondialrelay/js/index.php deleted file mode 100644 index 4e2611d37..000000000 --- a/modules/mondialrelay/kit_mondialrelay/js/index.php +++ /dev/null @@ -1,36 +0,0 @@ - -* @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision$ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); -header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); - -header("Cache-Control: no-store, no-cache, must-revalidate"); -header("Cache-Control: post-check=0, pre-check=0", false); -header("Pragma: no-cache"); - -header("Location: ../"); -exit; \ No newline at end of file diff --git a/modules/mondialrelay/kit_mondialrelay/js/ressources_MR.js b/modules/mondialrelay/kit_mondialrelay/js/ressources_MR.js deleted file mode 100755 index ee04adafe..000000000 --- a/modules/mondialrelay/kit_mondialrelay/js/ressources_MR.js +++ /dev/null @@ -1,344 +0,0 @@ -var relativ_base_dir = _PS_MR_MODULE_DIR_; -var num_mode_actif = -1; - -img_loader = new Image; -img_loader.src = _PS_MR_MODULE_DIR_+'images/loader.gif'; - -var google_map_general = null; -var geocoder = null; -var recherche = 0; -var json_addresses = null; - -function affiche_mydiv_mr(id_carrier, args) -{ - if ($('#id_carrier_mr' + id_carrier).attr("checked") == true) - { - if ($('#mondialrelay_' + id_carrier).css('display') == 'none') - { - $('#mondialrelay_' + id_carrier).toggle('slow'); - $('#mondialrelay_' + id_carrier).show(); - if ($('#mondialrelay_' + id_carrier).html() == '') - recherche_MR(id_carrier, args); - else - $("#all_mondialrelay_map_" + id_carrier).show(); - } - } - else - { - if ($('#mondialrelay_' + id_carrier).css('display') == 'block') - $('#mondialrelay_' + id_carrier).toggle('slow'); - $('#mondialrelay_' + id_carrier).hide(); - $("#all_mondialrelay_map_" + id_carrier).hide(); - } -} - -function recherche_MR(num, args) -{ - $.ajax({ - type: "POST", - url: _PS_MR_MODULE_DIR_ + 'kit_mondialrelay/RecherchePointRelais_ajax.php', - data: args , - dataType: 'json', - beforeSend : function(params) - { - $('#loading_mr').show(); - }, - success: function(obj) - { - $('#loading_mr').hide(); - $('#mondialrelay_'+num).html(''); - $("#all_mondialrelay_map_" + num).show(); - var cpt = 0; - if (obj.error) - $('#mondialrelay_'+num).html('

    '+server_error+'

    '); - else - { - while (obj.addresses[cpt]) - { - if (obj.addresses[cpt].num) - set_html_MR_recherche(obj.addresses[cpt], num, obj.base_dir, cpt); - ++cpt; - } - if (!obj.addresses[0].num) - $('#mondialrelay_'+num).html('

    '+address_error+'

    '); - } - }, - error: function(xhr, ajaxOptions, thrownError) - { - - } - }); -} - - function masque_recherche_MR_detail(num) - { - document.getElementById('bg_detail_md_'+num).style.display='none'; - document.getElementById('detail_md_'+num).style.display='none'; - document.getElementById('detail_md_'+num).innerHTML='' - } - - function recherche_MR_detail(num, pays, num_mode) - { - oXmlhttpMR5.open('POST',_PS_MR_MODULE_DIR_ + 'kit_mondialrelay/RechercheDetailPointRelais_ajax.php'); - oXmlhttpMR5.onreadystatechange=function() { - if (oXmlhttpMR5.readyState==1) { - var arrayPageSize = getPageSize_MR(); - var arrayScroll = getPageScroll_MR(); - document.getElementById('bg_detail_md_'+num_mode).style.height = (arrayPageSize[1] + 'px'); - document.getElementById('bg_detail_md_'+num_mode).style.display='block'; - document.getElementById('detail_md_'+num_mode).style.top = (Math.round(arrayScroll[1]+(arrayPageSize[3]-480)/2)+ 'px'); - document.getElementById('detail_md_'+num_mode).style.left = (Math.round((arrayPageSize[2]-740)/2)+ 'px'); - document.getElementById('detail_md_'+num_mode).innerHTML="
    "; - document.getElementById('detail_md_'+num_mode).style.display='block'; - } - /*if (oXmlhttpMR5.readyState==2) { - var arrayPageSize = getPageSize_MR(); - var arrayScroll = getPageScroll_MR(); - document.getElementById('bg_detail_md').style.height = (arrayPageSize[1] + 'px'); - document.getElementById('bg_detail_md').style.display='block'; - document.getElementById('detail_md').style.top = (Math.round(arrayScroll[1]+(arrayPageSize[3]-480)/2)+ 'px'); - document.getElementById('detail_md').style.left = (Math.round((arrayPageSize[2]-740)/2)+ 'px'); - document.getElementById('detail_md').innerHTML="
    "; - document.getElementById('detail_md').style.display='block'; - }*/ - if (oXmlhttpMR5.readyState==4 && oXmlhttpMR5.status == 200) { - var response = oXmlhttpMR5.responseText || "z|"; - res=response.split('|'); - if (res[0]!=0 && res[0]!='a' && res[0]!='z') - {masque_recherche_MR_detail(num_mode); - message_MR(res[0]);} - else if (res[0]=='a') {document.getElementById('detail_md_'+res[2]).innerHTML=res[1];} - else if (res[0]=='z') {masque_recherche_MR_detail(res[2]); alert('Requ�te sans r�ponse.');} - else {document.getElementById('detail_md_'+res[2]).innerHTML=res[1];};}; - } - - oXmlhttpMR5.setRequestHeader("Content-type", "application/x-www-form-urlencoded; "); - var data = 'relativ_base_dir='+encodeURIComponent(relativ_base_dir)+'&Num='+encodeURIComponent(num)+'&Pays='+encodeURIComponent(pays)+'&num_mode='+num_mode; - oXmlhttpMR5.send (data); - - - } - -function select_PR_MR(num, id_carrier) -{ - if (num != '') - { - $('#MR_Selected_Num_'+id_carrier).val(num); - $('#MR_Selected_LgAdr1_'+id_carrier).val($('#MR_LgAdr1_'+num).html()); - $('#MR_Selected_LgAdr2_'+id_carrier).val($('#MR_LgAdr2_'+num).html()); - $('#MR_Selected_LgAdr3_'+id_carrier).val($('#MR_LgAdr3_'+num).html()); - $('#MR_Selected_LgAdr4_'+id_carrier).val($('#MR_LgAdr4_'+num).html()); - $('#MR_Selected_CP_'+id_carrier).val($('#MR_CP_'+num).html()); - $('#MR_Selected_Ville_'+id_carrier).val($('#MR_Ville_'+num).html()); - $('#MR_Selected_Pays_'+id_carrier).val($('#MR_Pays_'+num).html()); - } - else - { - $('#MR_Selected_Num_'+id_carrier).val(''); - $('#MR_Selected_LgAdr1_'+id_carrier).val(''); - $('#MR_Selected_LgAdr2_'+id_carrier).val(''); - $('#MR_Selected_LgAdr3_'+id_carrier).val(''); - $('#MR_Selected_LgAdr4_'+id_carrier).val(''); - $('#MR_Selected_CP_'+id_carrier).val(''); - $('#MR_Selected_Ville_'+id_carrier).val(''); - $('#MR_Selected_Pays_'+id_carrier).val(''); - }; - if (one_page_checkout == true) - { - $.ajax({ - type: 'POST', - url: gl_base_dir + 'modules/mondialrelay/kit_mondialrelay/mr_opc_ajax.php', - async: true, - cache: false, - data: 'Num='+$('#MR_Selected_Num_'+id_carrier).val()+'&LgAdr1='+$('#MR_Selected_LgAdr1_'+id_carrier).val()+'&LgAdr2='+$('#MR_Selected_LgAdr2_'+id_carrier).val()+'&LgAdr3='+$('#MR_Selected_LgAdr3_'+id_carrier).val()+'&LgAdr4='+$('#MR_Selected_LgAdr4_'+id_carrier).val()+'&CP='+ $('#MR_Selected_CP_'+id_carrier).val()+'&Ville='+$('#MR_Selected_Ville_'+id_carrier).val()+'&Pays='+$('#MR_Selected_Pays_'+id_carrier).val() - }); - } - - // 1.3 compatibility, hookProcessCarrier Missing - // Allow to fill the database with the selected information - $.ajax({ - type: 'POST', - url: _PS_MR_MODULE_DIR_ + 'ajax.php', - data: 'method=addSelectedCarrierToDB' + - '&id_carrier=' + id_carrier + - '&MR_Selected_Num_' + id_carrier + '=' + $('#MR_Selected_Num_' + id_carrier).val() + - '&MR_Selected_LgAdr1_' + id_carrier + '=' + $('#MR_Selected_LgAdr1_' + id_carrier).val() + - '&MR_Selected_LgAdr2_' + id_carrier + '=' + $('#MR_Selected_LgAdr2_' + id_carrier).val() + - '&MR_Selected_LgAdr3_' + id_carrier + '=' + $('#MR_Selected_LgAdr3_' + id_carrier).val() + - '&MR_Selected_LgAdr4_' + id_carrier + '=' + $('#MR_Selected_LgAdr4_' + id_carrier).val() + - '&MR_Selected_CP_' + id_carrier + '=' + $('#MR_Selected_CP_' + id_carrier).val() + - '&MR_Selected_Ville_' + id_carrier + '=' + $('#MR_Selected_Ville_' + id_carrier).val() + - '&MR_Selected_Pays_' + id_carrier + '=' + $('#MR_Selected_Pays_' + id_carrier).val(), - success: function(json) - { - //console.log(json); - }, - error: function(xhr, ajaxOptions, thrownError) - { - //console.log(xhr); - //console.log(thrownError); - //console.log(ajaxOptions); - } - }); - -} - -function message_MR(etat) -{ - if (etat == 'a') {alert("R�sultat vide");} - if (etat == 1) {alert("Enseigne invalide");} - if (etat == 2) {alert("Num�ro d'enseigne vide ou inexistant");} - if (etat == 3) {alert("Num�ro de compte enseigne invalide");} - if (etat == 5) {alert("Num�ro de dossier enseigne invalide");} - if (etat == 7) {alert("Num�ro de client enseigne invalide");} - if (etat == 9) {alert("Nom de ville non reconnu ou non unique");} - if (etat == 10) {alert("Type de collecte invalide ou incorrect (1/D > Domicile -- 3/R > Relais)");} - if (etat == 11) {alert("Num�ro de Point Relais de collecte invalide");} - if (etat == 12) {alert("Pays du Point Relais de collecte invalide");} - if (etat == 13) {alert("Type de livraison invalide ou incorrect (1/D > Domicile -- 3/R > Relais)");} - if (etat == 14) {alert("Num�ro du Point Relais de livraison invalide");} - if (etat == 15) {alert("Pays du Point Relais de livraison invalide");} - if (etat == 16) {alert("Code pays invalide");} - if (etat == 17) {alert("Adresse invalide");} - if (etat == 18) {alert("Ville invalide");} - if (etat == 19) {alert("Code postal invalide");} - if (etat == 20) {alert("Poids du colis invalide");} - if (etat == 21) {alert("Taille (Longueur + Hauteur) du colis invalide");} - if (etat == 22) {alert("Taille du Colis invalide");} - if (etat == 24) {alert("Num�ro de Colis Mondial Relay invalide");} - if (etat == 28) {alert("Mode de collecte invalide");} - if (etat == 29) {alert("Mode de livraison invalide");} - if (etat == 30) {alert("Adresse (L1) de l'exp�diteur invalide");} - if (etat == 31) {alert("Adresse (L2) de l'exp�diteur invalide");} - if (etat == 33) {alert("Adresse (L3) de l'exp�diteur invalide");} - if (etat == 34) {alert("Adresse (L4) de l'exp�diteur invalide");} - if (etat == 35) {alert("Ville de l'exp�diteur invalide");} - if (etat == 36) {alert("Code postal de l'exp�diteur invalide");} - if (etat == 37) {alert("Pays de l'exp�diteur invalide");} - if (etat == 38) {alert("Num�ro de t�l�phone de l'exp�diteur invalide");} - if (etat == 39) {alert("Adresse e-mail de l'exp�diteur invalide");} - if (etat == 40) {alert("Action impossible sans ville ni code postal");} - if (etat == 41) {alert("Mode de livraison invalide");} - if (etat == 42) {alert("Montant CRT invalide");} - if (etat == 43) {alert("Devise CRT invalide");} - if (etat == 44) {alert("Valeur du colis invalide");} - if (etat == 45) {alert("Devise de la valeur du colis invalide");} - if (etat == 46) {alert("Plage de num�ro d'exp�dition epuisee");} - if (etat == 47) {alert("Nombre de colis invalide");} - if (etat == 48) {alert("Multi-colis en Point Relais Interdit");} - if (etat == 49) {alert("Mode de collecte ou de livraison invalide");} - if (etat == 50) {alert("Adresse (L1) du destinataire invalide");} - if (etat == 51) {alert("Adresse (L2) du destinataire invalide");} - if (etat == 53) {alert("Adresse (L3) du destinataire invalide");} - if (etat == 54) {alert("Adresse (L4) du destinataire invalide");} - if (etat == 55) {alert("Ville du destinataire invalide");} - if (etat == 56) {alert("Code postal du destinataire invalide");} - if (etat == 57) {alert("Pays du destinataire invalide");} - if (etat == 58) {alert("Num�ro de t�l�phone du destinataire invalide");} - if (etat == 59) {alert("Adresse e-mail du destinataire invalide");} - if (etat == 60) {alert("Champ texte libre invalide");} - if (etat == 61) {alert("Top avisage invalide");} - if (etat == 62) {alert("Instruction de livraison invalide");} - if (etat == 63) {alert("Assurance invalide ou incorrecte");} - if (etat == 64) {alert("Temps de montage invalide");} - if (etat == 65) {alert("Top rendez-vous invalide");} - if (etat == 66) {alert("Top reprise invalide");} - if (etat == 70) {alert("Num�ro de Point Relais invalide");} - if (etat == 72) {alert("Langue exp�diteur invalide");} - if (etat == 73) {alert("Langue destinataire invalide");} - if (etat == 74) {alert("Langue invalide");} - if (etat == 80) {alert("Code tracing : Colis enregistre");} - if (etat == 81) {alert("Code tracing : Colis en traitement chez Mondial Relay");} - if (etat == 82) {alert("Code tracing : Colis livre");} - if (etat == 83) {alert("Code tracing : Anomalie");} - if (etat == 84) {alert("84 (R�serv� Code Tracing)");} - if (etat == 85) {alert("85 (R�serv� Code Tracing)");} - if (etat == 86) {alert("86 (R�serv� Code Tracing)");} - if (etat == 87) {alert("87 (R�serv� Code Tracing)");} - if (etat == 88) {alert("88 (R�serv� Code Tracing)");} - if (etat == 89) {alert("89 (R�serv� Code Tracing)");} - if (etat == 90) {alert("AS400 indisponible");} - if (etat == 91) {alert("Num�ro d'exp�dition invalide");} - if (etat == 93) {alert("Aucun �l�ment retourn� par le plan de tri\n\ - Si vous effectuez une collecte ou une livraison en Point Relais, v�rifiez que les\n\ - Point Relais sont bien disponibles.\n\ - Si vous effectuez une livraison � domicile, il est probable que le code postal que\n\ - vous avez indiquez n'existe pas.");} - if (etat == 94) {alert("Colis Inexistant");} - if (etat == 95) {alert("Compte Enseigne non active");} - if (etat == 96) {alert("Type d'enseigne incorrect en Base");} - if (etat == 97) {alert("Cl� de s�curit� invalide");} - if (etat == 98) {alert("Service Indisponible");} - if (etat == 99) {alert("Erreur g�n�rique du service\n\ - Cette erreur peut �tre d� autant � un probl�me technique du service qu'� des\n\ - donn�es incorrectes ou inexistantes dans la Base de Donn�es. Lorsque vous avez\n\ - cette erreur veuillez la notifier � Mondial Relay en pr�cisant la date et l'heure de la\n\ - connexion ainsi que les informations envoy�s au WebService afin d'effectuer une\n\ - v�rification.");} -} - - -function getPageScroll_MR() -{ - - var yScroll; - - if (self.pageYOffset) { - yScroll = self.pageYOffset; - } else if (document.documentElement && document.documentElement.scrollTop){ // Explorer 6 Strict - yScroll = document.documentElement.scrollTop; - } else if (document.body) {// all other Explorers - yScroll = document.body.scrollTop; - } - - arrayPageScroll = new Array('',yScroll) - return arrayPageScroll; -} - - -function getPageSize_MR() -{ - - var xScroll, yScroll; - - if (window.innerHeight && window.scrollMaxY) { - xScroll = document.body.scrollWidth; - yScroll = window.innerHeight + window.scrollMaxY; - } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac - xScroll = document.body.scrollWidth; - yScroll = document.body.scrollHeight; - } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari - xScroll = document.body.offsetWidth; - yScroll = document.body.offsetHeight; - } - - var windowWidth, windowHeight; - if (self.innerHeight) { // all except Explorer - windowWidth = self.innerWidth; - windowHeight = self.innerHeight; - } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode - windowWidth = document.documentElement.clientWidth; - windowHeight = document.documentElement.clientHeight; - } else if (document.body) { // other Explorers - windowWidth = document.body.clientWidth; - windowHeight = document.body.clientHeight; - } - - // for small pages with total height less then height of the viewport - if(yScroll < windowHeight){ - pageHeight = windowHeight; - } else { - pageHeight = yScroll; - } - - // for small pages with total width less then width of the viewport - if(xScroll < windowWidth){ - pageWidth = windowWidth; - } else { - pageWidth = xScroll; - } - - - arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) - return arrayPageSize; -} diff --git a/modules/mondialrelay/kit_mondialrelay/loading.gif b/modules/mondialrelay/kit_mondialrelay/loading.gif deleted file mode 100755 index 33e386eb26fa373fea8336b26e5edfff56542737..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6494 zcmajkXH-+^)(7x-atfXV2vrb-fQWPf2SIurKtVxzQK=GoLK84x=vAs9NK~41LJ$z7 z4WUVIVnIQ{f-<0>qv*^y27?gLu|EghX`paSitiboEg14mcBt z5&Id$pco8B>^+oiU;50rHp z!uRRp6Qy#5+i5=z$i!6=^mp4eDGAFj1So6Z*;=1u*#T^Du|7MjM!dw4KYOOrHtzvE zioBoe?qRlhm}!L$Hb?ev(r4ag5;Uv?^dcnp1V^DX7YvL5$ho5liRozSo>M+qi5N%? z0IlQAIiNkrwaXPs1(Ny@3?j@b*%Cs1L%MB7bu)(=6NGPQ)ZiHHK45A=fNf%Owl{)hRGpUQ}1Z9n@G)?+j&Z#g*3)R_9L#8F=T zKRgD~1P=Pl4>clXw=;<^_kFbi{=1C>ROvmaD;LWo#46c}Ti|PQ6p{$H1HDSI*6d^} z0mm-bm0&FlE4aP>MENo2f>)@6yh2$WPri~6`Am!38#%Rpw&~}}{`n&hQCm$-N&Owi z_p9#P4~0hnZtnYJ_KB*VrrBYrQHONGVFggs*ewqgv-i|IVpoiTMcf^^g^OW2c>RD` zvj^e^(GiM!FppPFSF0&-o^j)Psr^24?#mvR!PG$=Ug*v&c|fq7r*Re@%cp(EdiH`d z>BrY4mp9%nyqSCZ?#-tkpZ}~V_WNi4&pW~7*P?m?2#<{O5VNH3Yp?uiQ&;fS1iRg2 z+x+~aUj(s@Y`t!5iS`M)N>sF67+BLUcc}b9h}}i4ISfCucu4J`8z9Z1}UhxTAzG%YYeyAypiV>o}+pZmAAA(1=2Chwa%Pc*Xj` zfI&K6M^#sM5Kkwu4<0{1G(7jP^UkhG?!|{s=MVE#zA}j&9DGDrd%w1^>%)hSzkdGh z_b(VMDr~|mX2r4nt4YGQ`2n|k{B3^Nrd{0Gt_88BQ3S*Wq!Y+;x9bSEAL+aAWRuEe zw{YTRYu{6>$i@xHmDZCtmU2e=iaj2nd}UQK58D+$?6EOhuwX%(w!>*!eJ56ELl$Z{ z0eT3Kj*;ZT<&2c%thM17`FI!epa`9VdxZltWBK6N9K%yKL2@!d3#<+|5Lq`UGJ-g>UQKjQoOe|Y?3ev|-L;ICML{x{2DkZ>A>ywndQ&}6*Y zZ_e1y#2&_8HHz8jWr13dUQZ2+LxUDWTElCf*m1A=A$yq^A9grpoF0GL!oFD;HeFd9 z1B)B)*s-Rj993HvRjqa^Z;~(AyRtH-j zp$JYlAiz91(S|7VVqW?FN~iZS`SHdsgSGiro4Z!48K2+W#r@|t`72hSvfFXr8V24j zv+~ctT{Rl|{U}9%Udd~?<5cO+khE+@wpi8(<>F`Ws^(mmN}@1L5rZO%ig5>Gs>!m) zyhcRFb;own5UUgX=YWGrdiNzIC3m*PZd$9k&n)z{IwZ*R9TN*BhU;s{9}rQNIi?#L z#utN2u#||F33AAY6R`I2O0ZVoEIdLNJcK=w>vM!ZQx?S5s6}RRR}#gWj2RX@IZ8lN z>ksTulaKv@lY?Af->|{)30~*vn!AEQ>JJ}JJQ#lZ>}i?B(({$3@{LA(M(nG#gk8H30r)|}Hj%`&Rj_SpKzvI-?Y5@g{ELn*e$z5mD9g~u^OTaQTH=^TIKW3}_1p|s`^U5~33i#LT7aGP4+ zhr1G`@$R1PBA|%v!3bFh@G=SXbmoqW2e8K|nsVlDkA?JjPOw8|GglUsy=UlY z%VxFHy=$0ftoFAq>)^c!=f2JV6dxeZ*BE8n?(kuogU!hA!b{SLtn@{r0tsA5wRK&Z z-mHSK!2l(xJ0_>ZQUk3sc@DT zu~U7 zBJ(-q3&QC=M@Lvpk2^nqU$Nt# z4-^xz9e;%-x}D(jHiB{Ym0~MuiLHQyVt$dUoNUn*Z@F{pPkUE>6Nsmy*O@;@>j_MU zhhP#kY}QFs{!3P(OGMDVYwnC|ku|l5YcWO_NSq$&`{lx!j2G|AsOECqizY!pP!vtg z35ZMNb3d7u$?tS7*EtIX<1QjVM!rC5n(lc{5DSpcrc`i3SZsuR5l{hmav)g5IwdZ_ zi5+H;EY+JD@J(fjP}?n0|Jt;Iio;E!j4Rr3Qwwh1eVW#UNVfrd8O(kCn0d6V{p#xq zQ5N>yPnBrX9BoC2$dbaiyptKQpR;Kp~W zimI<=*bqroFI(z#QuEEhI zy0EzFJcoKr<<{aQ^(`#%+ZopW&fp@I;UUOhVO!^Yv-I_cL9WiRW_N)@w3n@W)&~J) zRNsC&eEtJ%G$CszkwCw_pWVB~t=hrhJ|>zt{34`m^o@`E>qCxFjmxOruuIlc5e@)} zr0#V)AA=agNt{RQ4!Lmw@#2=+G$0UjPAMFSkqXR}hp(leG)MYAxFC3|AM(rg(ZEB@ zSSSWxE0J2&$O18)%}TdW7z ztFl0P-NvW9UkUh6!sK&!TW$~=EM|p)Kmehc`|iIGsgjKem4uPZ!x`BKmLx{cEYCpF zIg@I{Bk|SgnH*5AxYZ3zQgCx1Cb~eR9RmD(YN9cvDH83YWgW>qVMF^S@6D==6#7Zf z@q?EJ(Rr41CptGjCN%&YE+x(TJT3yppS}n~LwiNE{pOy1U+;jbjDIIhy4!0)7k3pu zqM7}bf@3?y-!h`(%OAb)4~o@pvK)3`jW^t1HsXgnS__;Xi}>(E9w&y>W%9;KpA(aF z=(&B17QKROE?7@RW~gJLQ_9p%FJi;9=&stG^9!5$~!Xy5O6!oa$Va6@RyajJY4C0$psInrXNn&=9aB2Hm-Qc5!;{0k&Zt zD17pC173J^*7LE7f1ymMMQhJQY?%Ce3xfoc)Pb};-!g)8JIJU1)*F9-OosSB`DDLF z<^0&AKR|32gkwunjJb$;#aCR_>(z2arSsUXIClvCm|>}C-@S)isEaX}62m^ilXVtX zBC^R$jSWG_&mTtxLwV28b_L@TQ6y7s0`FJyTF{ zqNtoXB2CXUuA)2|Xq!f{JR{?QoD}Y}FeTC^hM=Pt>T@)iBXA1@JV!X8a{|DhILecp zyLH`RlUI73=I)u6lh0pbX$ApiNRg?Hp5Nun2GCEFR$7ih3>^)jD74Pu2VCRD-kW1Z z16R?@r+Qe%gL9rYb(%s47(!)!O&#}4&zX9PP0u{`Yt2FKUt2j6(pbebi;HhTQ_sLN zMBTEa>a}ni5vl<5OxvOu5`WaSOWH&TinG6Q#`i}P*8GVBs#|L%fWmgCsbMHZ`y8jX zZd|;nH&0Zwxf!>uQ5N3hLS9h3RUvEyA{ZE3jkyvnNHNzmf(#keMGUNYgMVq6wsB^4 zjCV|S$FOUKXCbBvMe04KNVsmFVDRG9#XB>RXsnxqs7+IATRdQ1TQ8=$&^J>*_@Gl< z({2921~QEPCgxfzqz1LyPQ7c@UCa+q7e6wa^))!Sw^JbV(sQl2AGbTk z;L7UO5y=m@R&07uxb#GCQz%gmjrR@gkTHZ36UD}5+Bmzgx1MzuaH80IM;q*}lEYEZ ziz*o4bc{QmhK)tZ*x>WgP^vE`)D{yN8-veJil%$Jc!Q_XF?N2}gp*IFx*V@6JXvUk zW0ZR2r%+pJW8?j5GlYT*;`~^yP5|K1D$cu^j z0tZ$n{Fk0aSSzg_`StUzoqw%UJliXN@xLnWgDGRWdTa)#JE6Xq`$BAN@?wqq)dZqt z7H*s+>e?h$Poo-&SMUbeCY{-__nDOOXN8o5k9aujMcCUe|5jjYvrErFTORTc$Lqx( zHZYHpgOD>>P8m`<27wMvL?{n;NJk?OqXAsyzk&u=t6&^V%FUCL_Ea-UO!P|-i_*O} zNeq*$@T|aYv72yGeK}L3c}V0YV{EcBtqg2#v0(MqJYX1m**zKW$7NUU_8!HJPi(mC z53XS{o?33cTUwJ^f5j%8EdF(o;F=D9f{y?E!=0(&tb`_*e%epbu=K%f~`wy zBvPk+yCbIsamr^nm!(Dk@W>mAql`$d8>=M6kpuJ_a9wzslZ5fjZ{+**CHjhx?G$hNM>4HcXAclo(c9!ZRiw=jzE_n$BL*(`+k zJ3O{tO|2DuvD{^~{!WK-wdH|9gGl%J6mFUHZ;wg7?E39@0F`|*EId8MbZX2 zsZg=JaTQo|$XDAp$6H6r&pSAWDXE19cLe93ck}fe+}|PsNi|4m8Bg521K+6_IIBD} zFy0*Wq}I3r2i~3{F8MstU+6sfcHsH@plILMd)GG#W064 zZ#@VsTxmolLb)p5y?syLQow+t9H4I1o5C5p(9iq@O2|1?d)83j%viE-DhTk2E3&qv zdDdeJ{BT6YT9Y-tD#iCy7v1A$R~a0wYK;+Es#PYkBv*C2t-I}%2n7oQe8vnw5~S_Z z@QNw9mkw$vbAn);$r%bU0I9A?z8G2CP+xJwptOmrI;WI=QyfgLZfT<7GHaTkZjcUj z*os%f;}q7=)J=bu-Ef({_ybZ>qrzBXL?-F^u@&*I?bpsYy;BhDEXV)FvZBXhwk zlB!CC>$z}^N|=3vR{+B7BEm@jz(6qz(>FLcG(5>4*fxbP?{By>Rd%~`c7*!q^c47j z9h&okpZ81#p8av*F@}C*&+}JWFW1Q%v%mb*N?aPXo4lgQ4~o14|u)xqKMrKzmA-to!i@~qnNoYCo=&+4w% z?4hQp#>U2(ot~7<=#sL;#>L5)&*^`Mi16_6ot~iL;^Nlo^@_*i^7HkFw$JM7?WwD+ zq}J@A)aumK)Uw>~k(QXU*zNA_?$6K9%;xj#?Cgfe<+|YVyWj5M;NY#i#QpsG$jHc? zprNa-u$t25!NtYz@$kRn^QEe**x1;#-SOJ(^`4`o|NZ}roTB~x|HsM8+uhy6;_sr; z>+%G0bf{c#K&CUM){Ji1uy}-ZU-rkYQ=8MSY($dn<(9rw)`Qz~U zkht{W?(qEl{Qdp?>+9>lz`*wQ_VV)b#Kgqq<>mhW|Mm6tzP`Tu z`}_I%`OM7B!^6Y+`uh0z_{z%4_xJbn^Yi@r`_0YG>gwwB^z`K9W@`a9#-r(Q;|NhL)&%@;N_x1ML+SaMV_jmhKf?d^b+orRyQh>@0!k&=OmjK1RXyuH8w z{{OSy@srKv-rU{a-`?o<`OxU}lAxpK=jfHBtNZ=@F3GE$ol#Bz`?`8!@|PE z!??J(yS==;y1S3c=)}dxsMhU^jE;|!l&`R|qSo%}?CYe{?e6XA?d$C6>FMa{>(0{C zn5wS7;P0N%?8(Z^oz(2i%FD&&^zQEL=IZI!)z-=8^!fMt$;rv4$J&s`<(|9C?C$O9 z>+0?A?)&}viH?!Y%glq9p!oRu*VotK;oYl$Q7T_>YvA<>%&wi;IVl zkM;HUz2Nh+#LJ4Nvh?=zzrDWv{rLR;`Tza;{{Q;;`uWn<*{Im;!N0)5*5Sh5>aW`H z=JovB+u4=K-L$l{>GJu%*WugS-O1tYmdxa;!^+m!*RI0Jfsv7rn3#r?m+FRE&_Ol3G=c|gTEvvlKW306kQIR7V}md+=<)(DymY_; zEF7GZM-B|Ifq@eOvGi0#{%ipsMONHFgbf9B;G`lPHovJVYY z;G)jA1{gpB2`UhgPd+?o@P!p#kZ7VqSb%{k4t{DtLjd}y5YHy*bi)ZV4YV-B2DSiU z1su&}@zq1piTuwMVoU%452!RSjUCwp;KB|JAhG}fF6^U4C_^ydszm^R!2)w=Owb7* z_AoKR8Y3{_fd@@Au)qc`OhCpEZh+*f9Q{B;Q5jlnfkg$Gv=c}mnM6}T3PnV+zzr0< z6Gs>}VI)u*arBb}m|}dnF+mAz)WQZb%2c5N0DeS4zzv81AchqX{fGrm0%SB7HClY} z1sdBtGYk-oxbez0i^G6{7(YKG5F1%^^_4$Y$YllHSJa_~8>wt?2;2wFfskw!YT1O_^5jB#L3WK@vGFI`a5$}L!! ydz9+ZVi62WJ;gMW6<3t;g$SKg;06}TI?GMEv;|phB!7Ox0v0Bq1-c0&AOJhk>H;SK diff --git a/modules/mondialrelay/kit_mondialrelay/marker.gif b/modules/mondialrelay/kit_mondialrelay/marker.gif deleted file mode 100755 index 3850b2cd1ff7924a9bb7cb76b0afb6a81a13b472..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1196 zcmdth{ZpC+0KoAFK}BJJiiijsFQOAQh0JE*CWZ(b>2zK>U8iiiZi;#;b+$ZT>AIWF z0kfSiv@Bn)7MW+Zot{6qiO78G(3PHYM%*LLM0>Tr8;Zr?@%S(-hKj||PGJKB z1JB@31qB5$2{CMATD5<^20DIw=5WG0iD zOrxBqQ7)VgW3$;JI!(kloz9?fIGpI{=*)0N2Ah$|W?p79u0*nOB3WE6m&fDfaU$}g zBW1Bs#c>=ypP!bN)|mXJR4V;EC8OUug26jd?h<>eI>6_u5hV0KP*b+tmFsJ+dvsi{%c@oQ^q ze=W{mx_J$}UZiXi*45S3*Vi{RG=MkdU}+&(A_wI%n_Skex%NfdU0qvIM@NUfN!i)i z+11t6-QBI#YIj?k`}_Otn)ZQ#0o|io`vdLZ;Gq3s-^g(5&m(t7M@QjDy0Nh_cvuJj z^uy${$9jWqYHDiEpfeZ@Mx$|VMmM)G0zcEw&(FgK{ojVCCX;DtX=!+Km10FxBcx(PXD_uLJP8gC+#*wi~759c7;g?IrX>)p?-s3(= zUFRXgQ(Hth)<@&h)`G$ePFzad!+FCx9$rLp^cceXJF z$bk~Ksx~veG)Z=qF{uJN8C?hYPp`4T&p61ddV2GxH5zN8I6ZD@yh9G9e-aFF>89|bYJlUYKXbdV>vLPC*?u> zkWieD?wM}#3gE89@_Phdr+j>tph4%!oxeoll)?!*^SHN}QX*GbFJxORleoCYSxs1D l|F_d9%J?3Wi6l%+x2RA6z=*3F1_1TA6Yo#6gb;wY{{id_cart); -$result_MR = Db::getInstance()->ExecuteS("SELECT * FROM "._DB_PREFIX_."mr_method WHERE id_carrier='".(int)($cart->id_carrier)."' ;"); - -Db::getInstance()->delete(_DB_PREFIX_.'mr_selected','id_cart = "'.(int)($cart->id).'"'); -$mrselected = new MondialRelayClass(); -$mrselected->id_customer = $cart->id_customer; -$mrselected->id_method = $result_MR[0]['id_mr_method']; -$mrselected->id_cart = $cart->id; -$mrselected->MR_Selected_Num = $_POST['Num']; -$mrselected->MR_Selected_LgAdr1 = $_POST['LgAdr1']; -$mrselected->MR_Selected_LgAdr2 = $_POST['LgAdr2']; -$mrselected->MR_Selected_LgAdr3 = $_POST['LgAdr3']; -$mrselected->MR_Selected_LgAdr4 = $_POST['LgAdr4']; -$mrselected->MR_Selected_CP = $_POST['CP']; -$mrselected->MR_Selected_Ville = $_POST['Ville']; -$mrselected->MR_Selected_Pays = $_POST['Pays']; -$mrselected->save(); - - diff --git a/modules/mondialrelay/kit_mondialrelay/tools/index.php b/modules/mondialrelay/kit_mondialrelay/tools/index.php deleted file mode 100644 index dce6b30f5..000000000 --- a/modules/mondialrelay/kit_mondialrelay/tools/index.php +++ /dev/null @@ -1,36 +0,0 @@ - -* @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision$ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); -header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); - -header("Cache-Control: no-store, no-cache, must-revalidate"); -header("Cache-Control: post-check=0, pre-check=0", false); -header("Pragma: no-cache"); - -header("Location: ../"); -exit; \ No newline at end of file diff --git a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/index.php b/modules/mondialrelay/kit_mondialrelay/tools/nusoap/index.php deleted file mode 100644 index dce6b30f5..000000000 --- a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/index.php +++ /dev/null @@ -1,36 +0,0 @@ - -* @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision$ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); -header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); - -header("Cache-Control: no-store, no-cache, must-revalidate"); -header("Cache-Control: post-check=0, pre-check=0", false); -header("Pragma: no-cache"); - -header("Location: ../"); -exit; \ No newline at end of file diff --git a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.nusoap_base.php b/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.nusoap_base.php deleted file mode 100755 index 1f9eb6057..000000000 --- a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.nusoap_base.php +++ /dev/null @@ -1,995 +0,0 @@ - -* @author Scott Nichol -* @version $Id: class.nusoap_base.php 7091 2011-06-16 11:34:02Z mMarinetti $ -* @access public -*/ -class nusoap_base { - /** - * Identification for HTTP headers. - * - * @var string - * @access private - */ - var $title = 'NuSOAP'; - /** - * Version for HTTP headers. - * - * @var string - * @access private - */ - var $version = '0.9.5'; - /** - * CVS revision for HTTP headers. - * - * @var string - * @access private - */ - var $revision = '$Revision: 7091 $'; - /** - * Current error string (manipulated by getError/setError) - * - * @var string - * @access private - */ - var $error_str = ''; - /** - * Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment) - * - * @var string - * @access private - */ - var $debug_str = ''; - /** - * toggles automatic encoding of special characters as entities - * (should always be true, I think) - * - * @var boolean - * @access private - */ - var $charencoding = true; - /** - * the debug level for this instance - * - * @var integer - * @access private - */ - var $debugLevel; - - /** - * set schema version - * - * @var string - * @access public - */ - var $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'; - - /** - * charset encoding for outgoing messages - * - * @var string - * @access public - */ - var $soap_defencoding = 'ISO-8859-1'; - //var $soap_defencoding = 'UTF-8'; - - /** - * namespaces in an array of prefix => uri - * - * this is "seeded" by a set of constants, but it may be altered by code - * - * @var array - * @access public - */ - var $namespaces = array( - 'SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/', - 'xsd' => 'http://www.w3.org/2001/XMLSchema', - 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance', - 'SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/' - ); - - /** - * namespaces used in the current context, e.g. during serialization - * - * @var array - * @access private - */ - var $usedNamespaces = array(); - - /** - * XML Schema types in an array of uri => (array of xml type => php type) - * is this legacy yet? - * no, this is used by the nusoap_xmlschema class to verify type => namespace mappings. - * @var array - * @access public - */ - var $typemap = array( - 'http://www.w3.org/2001/XMLSchema' => array( - 'string'=>'string','boolean'=>'boolean','float'=>'double','double'=>'double','decimal'=>'double', - 'duration'=>'','dateTime'=>'string','time'=>'string','date'=>'string','gYearMonth'=>'', - 'gYear'=>'','gMonthDay'=>'','gDay'=>'','gMonth'=>'','hexBinary'=>'string','base64Binary'=>'string', - // abstract "any" types - 'anyType'=>'string','anySimpleType'=>'string', - // derived datatypes - 'normalizedString'=>'string','token'=>'string','language'=>'','NMTOKEN'=>'','NMTOKENS'=>'','Name'=>'','NCName'=>'','ID'=>'', - 'IDREF'=>'','IDREFS'=>'','ENTITY'=>'','ENTITIES'=>'','integer'=>'integer','nonPositiveInteger'=>'integer', - 'negativeInteger'=>'integer','long'=>'integer','int'=>'integer','short'=>'integer','byte'=>'integer','nonNegativeInteger'=>'integer', - 'unsignedLong'=>'','unsignedInt'=>'','unsignedShort'=>'','unsignedByte'=>'','positiveInteger'=>''), - 'http://www.w3.org/2000/10/XMLSchema' => array( - 'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double', - 'float'=>'double','dateTime'=>'string', - 'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'), - 'http://www.w3.org/1999/XMLSchema' => array( - 'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double', - 'float'=>'double','dateTime'=>'string', - 'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'), - 'http://soapinterop.org/xsd' => array('SOAPStruct'=>'struct'), - 'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string','array'=>'array','Array'=>'array'), - 'http://xml.apache.org/xml-soap' => array('Map') - ); - - /** - * XML entities to convert - * - * @var array - * @access public - * @deprecated - * @see expandEntities - */ - var $xmlEntities = array('quot' => '"','amp' => '&', - 'lt' => '<','gt' => '>','apos' => "'"); - - /** - * constructor - * - * @access public - */ - function nusoap_base() { - $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel']; - } - - /** - * gets the global debug level, which applies to future instances - * - * @return integer Debug level 0-9, where 0 turns off - * @access public - */ - function getGlobalDebugLevel() { - return $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel']; - } - - /** - * sets the global debug level, which applies to future instances - * - * @param int $level Debug level 0-9, where 0 turns off - * @access public - */ - function setGlobalDebugLevel($level) { - $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'] = $level; - } - - /** - * gets the debug level for this instance - * - * @return int Debug level 0-9, where 0 turns off - * @access public - */ - function getDebugLevel() { - return $this->debugLevel; - } - - /** - * sets the debug level for this instance - * - * @param int $level Debug level 0-9, where 0 turns off - * @access public - */ - function setDebugLevel($level) { - $this->debugLevel = $level; - } - - /** - * adds debug data to the instance debug string with formatting - * - * @param string $string debug data - * @access private - */ - function debug($string){ - if ($this->debugLevel > 0) { - $this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n"); - } - } - - /** - * adds debug data to the instance debug string without formatting - * - * @param string $string debug data - * @access public - */ - function appendDebug($string){ - if ($this->debugLevel > 0) { - // it would be nice to use a memory stream here to use - // memory more efficiently - $this->debug_str .= $string; - } - } - - /** - * clears the current debug data for this instance - * - * @access public - */ - function clearDebug() { - // it would be nice to use a memory stream here to use - // memory more efficiently - $this->debug_str = ''; - } - - /** - * gets the current debug data for this instance - * - * @return debug data - * @access public - */ - function &getDebug() { - // it would be nice to use a memory stream here to use - // memory more efficiently - return $this->debug_str; - } - - /** - * gets the current debug data for this instance as an XML comment - * this may change the contents of the debug data - * - * @return debug data as an XML comment - * @access public - */ - function &getDebugAsXMLComment() { - // it would be nice to use a memory stream here to use - // memory more efficiently - while (strpos($this->debug_str, '--')) { - $this->debug_str = str_replace('--', '- -', $this->debug_str); - } - $ret = ""; - return $ret; - } - - /** - * expands entities, e.g. changes '<' to '<'. - * - * @param string $val The string in which to expand entities. - * @access private - */ - function expandEntities($val) { - if ($this->charencoding) { - $val = str_replace('&', '&', $val); - $val = str_replace("'", ''', $val); - $val = str_replace('"', '"', $val); - $val = str_replace('<', '<', $val); - $val = str_replace('>', '>', $val); - } - return $val; - } - - /** - * returns error string if present - * - * @return mixed error string or false - * @access public - */ - function getError(){ - if($this->error_str != ''){ - return $this->error_str; - } - return false; - } - - /** - * sets error string - * - * @return boolean $string error string - * @access private - */ - function setError($str){ - $this->error_str = $str; - } - - /** - * detect if array is a simple array or a struct (associative array) - * - * @param mixed $val The PHP array - * @return string (arraySimple|arrayStruct) - * @access private - */ - function isArraySimpleOrStruct($val) { - $keyList = array_keys($val); - foreach ($keyList as $keyListValue) { - if (!is_int($keyListValue)) { - return 'arrayStruct'; - } - } - return 'arraySimple'; - } - - /** - * serializes PHP values in accordance w/ section 5. Type information is - * not serialized if $use == 'literal'. - * - * @param mixed $val The value to serialize - * @param string $name The name (local part) of the XML element - * @param string $type The XML schema type (local part) for the element - * @param string $name_ns The namespace for the name of the XML element - * @param string $type_ns The namespace for the type of the element - * @param array $attributes The attributes to serialize as name=>value pairs - * @param string $use The WSDL "use" (encoded|literal) - * @param boolean $soapval Whether this is called from soapval. - * @return string The serialized element, possibly with child elements - * @access public - */ - function serialize_val($val,$name=false,$type=false,$name_ns=false,$type_ns=false,$attributes=false,$use='encoded',$soapval=false) { - $this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use, soapval=$soapval"); - $this->appendDebug('value=' . $this->varDump($val)); - $this->appendDebug('attributes=' . $this->varDump($attributes)); - - if (is_object($val) && get_class($val) == 'soapval' && (! $soapval)) { - $this->debug("serialize_val: serialize soapval"); - $xml = $val->serialize($use); - $this->appendDebug($val->getDebug()); - $val->clearDebug(); - $this->debug("serialize_val of soapval returning $xml"); - return $xml; - } - // force valid name if necessary - if (is_numeric($name)) { - $name = '__numeric_' . $name; - } elseif (! $name) { - $name = 'noname'; - } - // if name has ns, add ns prefix to name - $xmlns = ''; - if($name_ns){ - $prefix = 'nu'.rand(1000,9999); - $name = $prefix.':'.$name; - $xmlns .= " xmlns:$prefix=\"$name_ns\""; - } - // if type is prefixed, create type prefix - if($type_ns != '' && $type_ns == $this->namespaces['xsd']){ - // need to fix this. shouldn't default to xsd if no ns specified - // w/o checking against typemap - $type_prefix = 'xsd'; - } elseif($type_ns){ - $type_prefix = 'ns'.rand(1000,9999); - $xmlns .= " xmlns:$type_prefix=\"$type_ns\""; - } - // serialize attributes if present - $atts = ''; - if($attributes){ - foreach($attributes as $k => $v){ - $atts .= " $k=\"".$this->expandEntities($v).'"'; - } - } - // serialize null value - if (is_null($val)) { - $this->debug("serialize_val: serialize null"); - if ($use == 'literal') { - // TODO: depends on minOccurs - $xml = "<$name$xmlns$atts/>"; - $this->debug("serialize_val returning $xml"); - return $xml; - } else { - if (isset($type) && isset($type_prefix)) { - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = ''; - } - $xml = "<$name$xmlns$type_str$atts xsi:nil=\"true\"/>"; - $this->debug("serialize_val returning $xml"); - return $xml; - } - } - // serialize if an xsd built-in primitive type - if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){ - $this->debug("serialize_val: serialize xsd built-in primitive type"); - if (is_bool($val)) { - if ($type == 'boolean') { - $val = $val ? 'true' : 'false'; - } elseif (! $val) { - $val = 0; - } - } else if (is_string($val)) { - $val = $this->expandEntities($val); - } - if ($use == 'literal') { - $xml = "<$name$xmlns$atts>$val"; - $this->debug("serialize_val returning $xml"); - return $xml; - } else { - $xml = "<$name$xmlns xsi:type=\"xsd:$type\"$atts>$val"; - $this->debug("serialize_val returning $xml"); - return $xml; - } - } - // detect type and serialize - $xml = ''; - switch(true) { - case (is_bool($val) || $type == 'boolean'): - $this->debug("serialize_val: serialize boolean"); - if ($type == 'boolean') { - $val = $val ? 'true' : 'false'; - } elseif (! $val) { - $val = 0; - } - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:boolean\"$atts>$val"; - } - break; - case (is_int($val) || is_long($val) || $type == 'int'): - $this->debug("serialize_val: serialize int"); - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val"; - } - break; - case (is_float($val)|| is_double($val) || $type == 'float'): - $this->debug("serialize_val: serialize float"); - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:float\"$atts>$val"; - } - break; - case (is_string($val) || $type == 'string'): - $this->debug("serialize_val: serialize string"); - $val = $this->expandEntities($val); - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:string\"$atts>$val"; - } - break; - case is_object($val): - $this->debug("serialize_val: serialize object"); - if (get_class($val) == 'soapval') { - $this->debug("serialize_val: serialize soapval object"); - $pXml = $val->serialize($use); - $this->appendDebug($val->getDebug()); - $val->clearDebug(); - } else { - if (! $name) { - $name = get_class($val); - $this->debug("In serialize_val, used class name $name as element name"); - } else { - $this->debug("In serialize_val, do not override name $name for element name for class " . get_class($val)); - } - foreach(get_object_vars($val) as $k => $v){ - $pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use); - } - } - if(isset($type) && isset($type_prefix)){ - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = ''; - } - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$pXml"; - } else { - $xml .= "<$name$xmlns$type_str$atts>$pXml"; - } - break; - break; - case (is_array($val) || $type): - // detect if struct or array - $valueType = $this->isArraySimpleOrStruct($val); - if($valueType=='arraySimple' || preg_match('/^ArrayOf/',$type)){ - $this->debug("serialize_val: serialize array"); - $i = 0; - if(is_array($val) && count($val)> 0){ - foreach($val as $v){ - if(is_object($v) && get_class($v) == 'soapval'){ - $tt_ns = $v->type_ns; - $tt = $v->type; - } elseif (is_array($v)) { - $tt = $this->isArraySimpleOrStruct($v); - } else { - $tt = gettype($v); - } - $array_types[$tt] = 1; - // TODO: for literal, the name should be $name - $xml .= $this->serialize_val($v,'item',false,false,false,false,$use); - ++$i; - } - if(count($array_types) > 1){ - $array_typename = 'xsd:anyType'; - } elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) { - if ($tt == 'integer') { - $tt = 'int'; - } - $array_typename = 'xsd:'.$tt; - } elseif(isset($tt) && $tt == 'arraySimple'){ - $array_typename = 'SOAP-ENC:Array'; - } elseif(isset($tt) && $tt == 'arrayStruct'){ - $array_typename = 'unnamed_struct_use_soapval'; - } else { - // if type is prefixed, create type prefix - if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){ - $array_typename = 'xsd:' . $tt; - } elseif ($tt_ns) { - $tt_prefix = 'ns' . rand(1000, 9999); - $array_typename = "$tt_prefix:$tt"; - $xmlns .= " xmlns:$tt_prefix=\"$tt_ns\""; - } else { - $array_typename = $tt; - } - } - $array_type = $i; - if ($use == 'literal') { - $type_str = ''; - } else if (isset($type) && isset($type_prefix)) { - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"".$array_typename."[$array_type]\""; - } - // empty array - } else { - if ($use == 'literal') { - $type_str = ''; - } else if (isset($type) && isset($type_prefix)) { - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:anyType[0]\""; - } - } - // TODO: for array in literal, there is no wrapper here - $xml = "<$name$xmlns$type_str$atts>".$xml.""; - } else { - // got a struct - $this->debug("serialize_val: serialize struct"); - if(isset($type) && isset($type_prefix)){ - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = ''; - } - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>"; - } else { - $xml .= "<$name$xmlns$type_str$atts>"; - } - foreach($val as $k => $v){ - // Apache Map - if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') { - $xml .= ''; - $xml .= $this->serialize_val($k,'key',false,false,false,false,$use); - $xml .= $this->serialize_val($v,'value',false,false,false,false,$use); - $xml .= ''; - } else { - $xml .= $this->serialize_val($v,$k,false,false,false,false,$use); - } - } - $xml .= ""; - } - break; - default: - $this->debug("serialize_val: serialize unknown"); - $xml .= 'not detected, got '.gettype($val).' for '.$val; - break; - } - $this->debug("serialize_val returning $xml"); - return $xml; - } - - /** - * serializes a message - * - * @param string $body the XML of the SOAP body - * @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array - * @param array $namespaces optional the namespaces used in generating the body and headers - * @param string $style optional (rpc|document) - * @param string $use optional (encoded|literal) - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) - * @return string the message - * @access public - */ - function serializeEnvelope($body,$headers=false,$namespaces=array(),$style='rpc',$use='encoded',$encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'){ - // TODO: add an option to automatically run utf8_encode on $body and $headers - // if $this->soap_defencoding is UTF-8. Not doing this automatically allows - // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1 - - $this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle"); - $this->debug("headers:"); - $this->appendDebug($this->varDump($headers)); - $this->debug("namespaces:"); - $this->appendDebug($this->varDump($namespaces)); - - // serialize namespaces - $ns_string = ''; - foreach(array_merge($this->namespaces,$namespaces) as $k => $v){ - $ns_string .= " xmlns:$k=\"$v\""; - } - if($encodingStyle) { - $ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string"; - } - - // serialize headers - if($headers){ - if (is_array($headers)) { - $xml = ''; - foreach ($headers as $k => $v) { - if (is_object($v) && get_class($v) == 'soapval') { - $xml .= $this->serialize_val($v, false, false, false, false, false, $use); - } else { - $xml .= $this->serialize_val($v, $k, false, false, false, false, $use); - } - } - $headers = $xml; - $this->debug("In serializeEnvelope, serialized array of headers to $headers"); - } - $headers = "".$headers.""; - } - // serialize envelope - return - 'soap_defencoding .'"?'.">". - '". - $headers. - "". - $body. - "". - ""; - } - - /** - * formats a string to be inserted into an HTML stream - * - * @param string $str The string to format - * @return string The formatted string - * @access public - * @deprecated - */ - function formatDump($str){ - $str = htmlspecialchars($str); - return nl2br($str); - } - - /** - * contracts (changes namespace to prefix) a qualified name - * - * @param string $qname qname - * @return string contracted qname - * @access private - */ - function contractQname($qname){ - // get element namespace - //$this->xdebug("Contract $qname"); - if (strrpos($qname, ':')) { - // get unqualified name - $name = substr($qname, strrpos($qname, ':') + 1); - // get ns - $ns = substr($qname, 0, strrpos($qname, ':')); - $p = $this->getPrefixFromNamespace($ns); - if ($p) { - return $p . ':' . $name; - } - return $qname; - } else { - return $qname; - } - } - - /** - * expands (changes prefix to namespace) a qualified name - * - * @param string $qname qname - * @return string expanded qname - * @access private - */ - function expandQname($qname){ - // get element prefix - if(strpos($qname,':') && !preg_match('/^http:\/\//',$qname)){ - // get unqualified name - $name = substr(strstr($qname,':'),1); - // get ns prefix - $prefix = substr($qname,0,strpos($qname,':')); - if(isset($this->namespaces[$prefix])){ - return $this->namespaces[$prefix].':'.$name; - } else { - return $qname; - } - } else { - return $qname; - } - } - - /** - * returns the local part of a prefixed string - * returns the original string, if not prefixed - * - * @param string $str The prefixed string - * @return string The local part - * @access public - */ - function getLocalPart($str){ - if($sstr = strrchr($str,':')){ - // get unqualified name - return substr( $sstr, 1 ); - } else { - return $str; - } - } - - /** - * returns the prefix part of a prefixed string - * returns false, if not prefixed - * - * @param string $str The prefixed string - * @return mixed The prefix or false if there is no prefix - * @access public - */ - function getPrefix($str){ - if($pos = strrpos($str,':')){ - // get prefix - return substr($str,0,$pos); - } - return false; - } - - /** - * pass it a prefix, it returns a namespace - * - * @param string $prefix The prefix - * @return mixed The namespace, false if no namespace has the specified prefix - * @access public - */ - function getNamespaceFromPrefix($prefix){ - if (isset($this->namespaces[$prefix])) { - return $this->namespaces[$prefix]; - } - //$this->setError("No namespace registered for prefix '$prefix'"); - return false; - } - - /** - * returns the prefix for a given namespace (or prefix) - * or false if no prefixes registered for the given namespace - * - * @param string $ns The namespace - * @return mixed The prefix, false if the namespace has no prefixes - * @access public - */ - function getPrefixFromNamespace($ns) { - foreach ($this->namespaces as $p => $n) { - if ($ns == $n || $ns == $p) { - $this->usedNamespaces[$p] = $n; - return $p; - } - } - return false; - } - - /** - * returns the time in ODBC canonical form with microseconds - * - * @return string The time in ODBC canonical form with microseconds - * @access public - */ - function getmicrotime() { - if (function_exists('gettimeofday')) { - $tod = gettimeofday(); - $sec = $tod['sec']; - $usec = $tod['usec']; - } else { - $sec = time(); - $usec = 0; - } - return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec); - } - - /** - * Returns a string with the output of var_dump - * - * @param mixed $data The variable to var_dump - * @return string The output of var_dump - * @access public - */ - function varDump($data) { - ob_start(); - var_dump($data); - $ret_val = ob_get_contents(); - ob_end_clean(); - return $ret_val; - } - - /** - * represents the object as a string - * - * @return string - * @access public - */ - function __toString() { - return $this->varDump($this); - } -} - -// XML Schema Datatype Helper Functions - -//xsd:dateTime helpers - -/** -* convert unix timestamp to ISO 8601 compliant date string -* -* @param int $timestamp Unix time stamp -* @param boolean $utc Whether the time stamp is UTC or local -* @return mixed ISO 8601 date string or false -* @access public -*/ -function timestamp_to_iso8601($timestamp,$utc=true){ - $datestr = date('Y-m-d\TH:i:sO',$timestamp); - $pos = strrpos($datestr, "+"); - if ($pos === FALSE) { - $pos = strrpos($datestr, "-"); - } - if ($pos !== FALSE) { - if (strlen($datestr) == $pos + 5) { - $datestr = substr($datestr, 0, $pos + 3) . ':' . substr($datestr, -2); - } - } - if($utc){ - $pattern = '/'. - '([0-9]{4})-'. // centuries & years CCYY- - '([0-9]{2})-'. // months MM- - '([0-9]{2})'. // days DD - 'T'. // separator T - '([0-9]{2}):'. // hours hh: - '([0-9]{2}):'. // minutes mm: - '([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss... - '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's - '/'; - - if(preg_match($pattern,$datestr,$regs)){ - return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]); - } - return false; - } else { - return $datestr; - } -} - -/** -* convert ISO 8601 compliant date string to unix timestamp -* -* @param string $datestr ISO 8601 compliant date string -* @return mixed Unix timestamp (int) or false -* @access public -*/ -function iso8601_to_timestamp($datestr){ - $pattern = '/'. - '([0-9]{4})-'. // centuries & years CCYY- - '([0-9]{2})-'. // months MM- - '([0-9]{2})'. // days DD - 'T'. // separator T - '([0-9]{2}):'. // hours hh: - '([0-9]{2}):'. // minutes mm: - '([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss... - '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's - '/'; - if(preg_match($pattern,$datestr,$regs)){ - // not utc - if($regs[8] != 'Z'){ - $op = substr($regs[8],0,1); - $h = substr($regs[8],1,2); - $m = substr($regs[8],strlen($regs[8])-2,2); - if($op == '-'){ - $regs[4] = $regs[4] + $h; - $regs[5] = $regs[5] + $m; - } elseif($op == '+'){ - $regs[4] = $regs[4] - $h; - $regs[5] = $regs[5] - $m; - } - } - return gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); -// return strtotime("$regs[1]-$regs[2]-$regs[3] $regs[4]:$regs[5]:$regs[6]Z"); - } else { - return false; - } -} - -/** -* sleeps some number of microseconds -* -* @param string $usec the number of microseconds to sleep -* @access public -* @deprecated -*/ -function usleepWindows($usec) -{ - $start = gettimeofday(); - - do - { - $stop = gettimeofday(); - $timePassed = 1000000 * ($stop['sec'] - $start['sec']) - + $stop['usec'] - $start['usec']; - } - while ($timePassed < $usec); -} - - diff --git a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_fault.php b/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_fault.php deleted file mode 100755 index bc496e474..000000000 --- a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_fault.php +++ /dev/null @@ -1,89 +0,0 @@ - -* @version $Id: class.soap_fault.php 6844 2011-06-03 14:46:51Z dMetzger $ -* @access public -*/ -class nusoap_fault extends nusoap_base { - /** - * The fault code (client|server) - * @var string - * @access private - */ - var $faultcode; - /** - * The fault actor - * @var string - * @access private - */ - var $faultactor; - /** - * The fault string, a description of the fault - * @var string - * @access private - */ - var $faultstring; - /** - * The fault detail, typically a string or array of string - * @var mixed - * @access private - */ - var $faultdetail; - - /** - * constructor - * - * @param string $faultcode (SOAP-ENV:Client | SOAP-ENV:Server) - * @param string $faultactor only used when msg routed between multiple actors - * @param string $faultstring human readable error message - * @param mixed $faultdetail detail, typically a string or array of string - */ - function nusoap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){ - parent::nusoap_base(); - $this->faultcode = $faultcode; - $this->faultactor = $faultactor; - $this->faultstring = $faultstring; - $this->faultdetail = $faultdetail; - } - - /** - * serialize a fault - * - * @return string The serialization of the fault instance. - * @access public - */ - function serialize(){ - $ns_string = ''; - foreach($this->namespaces as $k => $v){ - $ns_string .= "\n xmlns:$k=\"$v\""; - } - $return_msg = - 'soap_defencoding.'"?>'. - '\n". - ''. - ''. - $this->serialize_val($this->faultcode, 'faultcode'). - $this->serialize_val($this->faultactor, 'faultactor'). - $this->serialize_val($this->faultstring, 'faultstring'). - $this->serialize_val($this->faultdetail, 'detail'). - ''. - ''. - ''; - return $return_msg; - } -} - -/** - * Backward compatibility - */ -class soap_fault extends nusoap_fault { -} - - diff --git a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_parser.php b/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_parser.php deleted file mode 100755 index cce2874a0..000000000 --- a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_parser.php +++ /dev/null @@ -1,642 +0,0 @@ - -* @author Scott Nichol -* @version $Id: class.soap_parser.php 6844 2011-06-03 14:46:51Z dMetzger $ -* @access public -*/ -class nusoap_parser extends nusoap_base { - - var $xml = ''; - var $xml_encoding = ''; - var $method = ''; - var $root_struct = ''; - var $root_struct_name = ''; - var $root_struct_namespace = ''; - var $root_header = ''; - var $document = ''; // incoming SOAP body (text) - // determines where in the message we are (envelope,header,body,method) - var $status = ''; - var $position = 0; - var $depth = 0; - var $default_namespace = ''; - var $namespaces = array(); - var $message = array(); - var $parent = ''; - var $fault = false; - var $fault_code = ''; - var $fault_str = ''; - var $fault_detail = ''; - var $depth_array = array(); - var $debug_flag = true; - var $soapresponse = NULL; // parsed SOAP Body - var $soapheader = NULL; // parsed SOAP Header - var $responseHeaders = ''; // incoming SOAP headers (text) - var $body_position = 0; - // for multiref parsing: - // array of id => pos - var $ids = array(); - // array of id => hrefs => pos - var $multirefs = array(); - // toggle for auto-decoding element content - var $decode_utf8 = true; - - /** - * constructor that actually does the parsing - * - * @param string $xml SOAP message - * @param string $encoding character encoding scheme of message - * @param string $method method for which XML is parsed (unused?) - * @param string $decode_utf8 whether to decode UTF-8 to ISO-8859-1 - * @access public - */ - function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){ - parent::nusoap_base(); - $this->xml = $xml; - $this->xml_encoding = $encoding; - $this->method = $method; - $this->decode_utf8 = $decode_utf8; - - // Check whether content has been read. - if(!empty($xml)){ - // Check XML encoding - $pos_xml = strpos($xml, '', $pos_xml + 2) - $pos_xml + 1); - if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) { - $xml_encoding = $res[1]; - if (strtoupper($xml_encoding) != $encoding) { - $err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'"; - $this->debug($err); - if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') { - $this->setError($err); - return; - } - // when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endpoint is just sloppy and proceed - } else { - $this->debug('Charset from HTTP Content-Type matches encoding from XML declaration'); - } - } else { - $this->debug('No encoding specified in XML declaration'); - } - } else { - $this->debug('No XML declaration'); - } - $this->debug('Entering nusoap_parser(), length='.strlen($xml).', encoding='.$encoding); - // Create an XML parser - why not xml_parser_create_ns? - $this->parser = xml_parser_create($this->xml_encoding); - // Set the options for parsing the XML data. - //xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); - xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); - xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding); - // Set the object for the parser. - xml_set_object($this->parser, $this); - // Set the element handlers for the parser. - xml_set_element_handler($this->parser, 'start_element','end_element'); - xml_set_character_data_handler($this->parser,'character_data'); - - // Parse the XML file. - if(!xml_parse($this->parser,$xml,true)){ - // Display an error message. - $err = sprintf('XML error parsing SOAP payload on line %d: %s', - xml_get_current_line_number($this->parser), - xml_error_string(xml_get_error_code($this->parser))); - $this->debug($err); - $this->debug("XML payload:\n" . $xml); - $this->setError($err); - } else { - $this->debug('in nusoap_parser ctor, message:'); - $this->appendDebug($this->varDump($this->message)); - $this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root_struct_name); - // get final value - $this->soapresponse = $this->message[$this->root_struct]['result']; - // get header value - if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){ - $this->soapheader = $this->message[$this->root_header]['result']; - } - // resolve hrefs/ids - if(sizeof($this->multirefs) > 0){ - foreach($this->multirefs as $id => $hrefs){ - $this->debug('resolving multirefs for id: '.$id); - $idVal = $this->buildVal($this->ids[$id]); - if (is_array($idVal) && isset($idVal['!id'])) { - unset($idVal['!id']); - } - foreach($hrefs as $refPos => $ref){ - $this->debug('resolving href at pos '.$refPos); - $this->multirefs[$id][$refPos] = $idVal; - } - } - } - } - xml_parser_free($this->parser); - } else { - $this->debug('xml was empty, didn\'t parse!'); - $this->setError('xml was empty, didn\'t parse!'); - } - } - - /** - * start-element handler - * - * @param resource $parser XML parser object - * @param string $name element name - * @param array $attrs associative array of attributes - * @access private - */ - function start_element($parser, $name, $attrs) { - // position in a total number of elements, starting from 0 - // update class level pos - $pos = $this->position++; - // and set mine - $this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>''); - // depth = how many levels removed from root? - // set mine as current global depth and increment global depth value - $this->message[$pos]['depth'] = $this->depth++; - - // else add self as child to whoever the current parent is - if($pos != 0){ - $this->message[$this->parent]['children'] .= '|'.$pos; - } - // set my parent - $this->message[$pos]['parent'] = $this->parent; - // set self as current parent - $this->parent = $pos; - // set self as current value for this depth - $this->depth_array[$this->depth] = $pos; - // get element prefix - if(strpos($name,':')){ - // get ns prefix - $prefix = substr($name,0,strpos($name,':')); - // get unqualified name - $name = substr(strstr($name,':'),1); - } - // set status - if ($name == 'Envelope' && $this->status == '') { - $this->status = 'envelope'; - } elseif ($name == 'Header' && $this->status == 'envelope') { - $this->root_header = $pos; - $this->status = 'header'; - } elseif ($name == 'Body' && $this->status == 'envelope'){ - $this->status = 'body'; - $this->body_position = $pos; - // set method - } elseif($this->status == 'body' && $pos == ($this->body_position+1)) { - $this->status = 'method'; - $this->root_struct_name = $name; - $this->root_struct = $pos; - $this->message[$pos]['type'] = 'struct'; - $this->debug("found root struct $this->root_struct_name, pos $this->root_struct"); - } - // set my status - $this->message[$pos]['status'] = $this->status; - // set name - $this->message[$pos]['name'] = htmlspecialchars($name); - // set attrs - $this->message[$pos]['attrs'] = $attrs; - - // loop through atts, logging ns and type declarations - $attstr = ''; - foreach($attrs as $key => $value){ - $key_prefix = $this->getPrefix($key); - $key_localpart = $this->getLocalPart($key); - // if ns declarations, add to class level array of valid namespaces - if($key_prefix == 'xmlns'){ - if(preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/',$value)){ - $this->XMLSchemaVersion = $value; - $this->namespaces['xsd'] = $this->XMLSchemaVersion; - $this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance'; - } - $this->namespaces[$key_localpart] = $value; - // set method namespace - if($name == $this->root_struct_name){ - $this->methodNamespace = $value; - } - // if it's a type declaration, set type - } elseif($key_localpart == 'type'){ - if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') { - // do nothing: already processed arrayType - } else { - $value_prefix = $this->getPrefix($value); - $value_localpart = $this->getLocalPart($value); - $this->message[$pos]['type'] = $value_localpart; - $this->message[$pos]['typePrefix'] = $value_prefix; - if(isset($this->namespaces[$value_prefix])){ - $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix]; - } else if(isset($attrs['xmlns:'.$value_prefix])) { - $this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix]; - } - // should do something here with the namespace of specified type? - } - } elseif($key_localpart == 'arrayType'){ - $this->message[$pos]['type'] = 'array'; - /* do arrayType ereg here - [1] arrayTypeValue ::= atype asize - [2] atype ::= QName rank* - [3] rank ::= '[' (',')* ']' - [4] asize ::= '[' length~ ']' - [5] length ::= nextDimension* Digit+ - [6] nextDimension ::= Digit+ ',' - */ - $expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/'; - if(preg_match($expr,$value,$regs)){ - $this->message[$pos]['typePrefix'] = $regs[1]; - $this->message[$pos]['arrayTypePrefix'] = $regs[1]; - if (isset($this->namespaces[$regs[1]])) { - $this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]]; - } else if (isset($attrs['xmlns:'.$regs[1]])) { - $this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]]; - } - $this->message[$pos]['arrayType'] = $regs[2]; - $this->message[$pos]['arraySize'] = $regs[3]; - $this->message[$pos]['arrayCols'] = $regs[4]; - } - // specifies nil value (or not) - } elseif ($key_localpart == 'nil'){ - $this->message[$pos]['nil'] = ($value == 'true' || $value == '1'); - // some other attribute - } elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') { - $this->message[$pos]['xattrs']['!' . $key] = $value; - } - - if ($key == 'xmlns') { - $this->default_namespace = $value; - } - // log id - if($key == 'id'){ - $this->ids[$value] = $pos; - } - // root - if($key_localpart == 'root' && $value == 1){ - $this->status = 'method'; - $this->root_struct_name = $name; - $this->root_struct = $pos; - $this->debug("found root struct $this->root_struct_name, pos $pos"); - } - // for doclit - $attstr .= " $key=\"$value\""; - } - // get namespace - must be done after namespace atts are processed - if(isset($prefix)){ - $this->message[$pos]['namespace'] = $this->namespaces[$prefix]; - $this->default_namespace = $this->namespaces[$prefix]; - } else { - $this->message[$pos]['namespace'] = $this->default_namespace; - } - if($this->status == 'header'){ - if ($this->root_header != $pos) { - $this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>"; - } - } elseif($this->root_struct_name != ''){ - $this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>"; - } - } - - /** - * end-element handler - * - * @param resource $parser XML parser object - * @param string $name element name - * @access private - */ - function end_element($parser, $name) { - // position of current element is equal to the last value left in depth_array for my depth - $pos = $this->depth_array[$this->depth--]; - - // get element prefix - if(strpos($name,':')){ - // get ns prefix - $prefix = substr($name,0,strpos($name,':')); - // get unqualified name - $name = substr(strstr($name,':'),1); - } - - // build to native type - if(isset($this->body_position) && $pos > $this->body_position){ - // deal w/ multirefs - if(isset($this->message[$pos]['attrs']['href'])){ - // get id - $id = substr($this->message[$pos]['attrs']['href'],1); - // add placeholder to href array - $this->multirefs[$id][$pos] = 'placeholder'; - // add set a reference to it as the result value - $this->message[$pos]['result'] =& $this->multirefs[$id][$pos]; - // build complexType values - } elseif($this->message[$pos]['children'] != ''){ - // if result has already been generated (struct/array) - if(!isset($this->message[$pos]['result'])){ - $this->message[$pos]['result'] = $this->buildVal($pos); - } - // build complexType values of attributes and possibly simpleContent - } elseif (isset($this->message[$pos]['xattrs'])) { - if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) { - $this->message[$pos]['xattrs']['!'] = null; - } elseif (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') { - if (isset($this->message[$pos]['type'])) { - $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - } else { - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - } else { - $this->message[$pos]['xattrs']['!'] = $this->message[$pos]['cdata']; - } - } - } - $this->message[$pos]['result'] = $this->message[$pos]['xattrs']; - // set value of simpleType (or nil complexType) - } else { - //$this->debug('adding data for scalar value '.$this->message[$pos]['name'].' of value '.$this->message[$pos]['cdata']); - if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) { - $this->message[$pos]['xattrs']['!'] = null; - } elseif (isset($this->message[$pos]['type'])) { - $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - } else { - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - } else { - $this->message[$pos]['result'] = $this->message[$pos]['cdata']; - } - } - - /* add value to parent's result, if parent is struct/array - $parent = $this->message[$pos]['parent']; - if($this->message[$parent]['type'] != 'map'){ - if(strtolower($this->message[$parent]['type']) == 'array'){ - $this->message[$parent]['result'][] = $this->message[$pos]['result']; - } else { - $this->message[$parent]['result'][$this->message[$pos]['name']] = $this->message[$pos]['result']; - } - } - */ - } - } - - // for doclit - if($this->status == 'header'){ - if ($this->root_header != $pos) { - $this->responseHeaders .= ""; - } - } elseif($pos >= $this->root_struct){ - $this->document .= ""; - } - // switch status - if ($pos == $this->root_struct){ - $this->status = 'body'; - $this->root_struct_namespace = $this->message[$pos]['namespace']; - } elseif ($pos == $this->root_header) { - $this->status = 'envelope'; - } elseif ($name == 'Body' && $this->status == 'body') { - $this->status = 'envelope'; - } elseif ($name == 'Header' && $this->status == 'header') { // will never happen - $this->status = 'envelope'; - } elseif ($name == 'Envelope' && $this->status == 'envelope') { - $this->status = ''; - } - // set parent back to my parent - $this->parent = $this->message[$pos]['parent']; - } - - /** - * element content handler - * - * @param resource $parser XML parser object - * @param string $data element content - * @access private - */ - function character_data($parser, $data){ - $pos = $this->depth_array[$this->depth]; - if ($this->xml_encoding=='UTF-8'){ - // TODO: add an option to disable this for folks who want - // raw UTF-8 that, e.g., might not map to iso-8859-1 - // TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1"); - if($this->decode_utf8){ - $data = utf8_decode($data); - } - } - $this->message[$pos]['cdata'] .= $data; - // for doclit - if($this->status == 'header'){ - $this->responseHeaders .= $data; - } else { - $this->document .= $data; - } - } - - /** - * get the parsed message (SOAP Body) - * - * @return mixed - * @access public - * @deprecated use get_soapbody instead - */ - function get_response(){ - return $this->soapresponse; - } - - /** - * get the parsed SOAP Body (NULL if there was none) - * - * @return mixed - * @access public - */ - function get_soapbody(){ - return $this->soapresponse; - } - - /** - * get the parsed SOAP Header (NULL if there was none) - * - * @return mixed - * @access public - */ - function get_soapheader(){ - return $this->soapheader; - } - - /** - * get the unparsed SOAP Header - * - * @return string XML or empty if no Header - * @access public - */ - function getHeaders(){ - return $this->responseHeaders; - } - - /** - * decodes simple types into PHP variables - * - * @param string $value value to decode - * @param string $type XML type to decode - * @param string $typens XML type namespace to decode - * @return mixed PHP value - * @access private - */ - function decodeSimple($value, $type, $typens) { - // TODO: use the namespace! - if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') { - return (string) $value; - } - if ($type == 'int' || $type == 'integer' || $type == 'short' || $type == 'byte') { - return (int) $value; - } - if ($type == 'float' || $type == 'double' || $type == 'decimal') { - return (double) $value; - } - if ($type == 'boolean') { - if (strtolower($value) == 'false' || strtolower($value) == 'f') { - return false; - } - return (boolean) $value; - } - if ($type == 'base64' || $type == 'base64Binary') { - $this->debug('Decode base64 value'); - return base64_decode($value); - } - // obscure numeric types - if ($type == 'nonPositiveInteger' || $type == 'negativeInteger' - || $type == 'nonNegativeInteger' || $type == 'positiveInteger' - || $type == 'unsignedInt' - || $type == 'unsignedShort' || $type == 'unsignedByte') { - return (int) $value; - } - // bogus: parser treats array with no elements as a simple type - if ($type == 'array') { - return array(); - } - // everything else - return (string) $value; - } - - /** - * builds response structures for compound values (arrays/structs) - * and scalars - * - * @param integer $pos position in node tree - * @return mixed PHP value - * @access private - */ - function buildVal($pos){ - if(!isset($this->message[$pos]['type'])){ - $this->message[$pos]['type'] = ''; - } - $this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']); - // if there are children... - if($this->message[$pos]['children'] != ''){ - $this->debug('in buildVal, there are children'); - $children = explode('|',$this->message[$pos]['children']); - array_shift($children); // knock off empty - // md array - if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){ - $r=0; // rowcount - $c=0; // colcount - foreach($children as $child_pos){ - $this->debug("in buildVal, got an MD array element: $r, $c"); - $params[$r][] = $this->message[$child_pos]['result']; - $c++; - if($c == $this->message[$pos]['arrayCols']){ - $c = 0; - $r++; - } - } - // array - } elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){ - $this->debug('in buildVal, adding array '.$this->message[$pos]['name']); - foreach($children as $child_pos){ - $params[] = &$this->message[$child_pos]['result']; - } - // apache Map type: java hashtable - } elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap'){ - $this->debug('in buildVal, Java Map '.$this->message[$pos]['name']); - foreach($children as $child_pos){ - $kv = explode("|",$this->message[$child_pos]['children']); - $params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result']; - } - // generic compound type - //} elseif($this->message[$pos]['type'] == 'SOAPStruct' || $this->message[$pos]['type'] == 'struct') { - } else { - // Apache Vector type: treat as an array - $this->debug('in buildVal, adding Java Vector or generic compound type '.$this->message[$pos]['name']); - if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') { - $notstruct = 1; - } else { - $notstruct = 0; - } - // - foreach($children as $child_pos){ - if($notstruct){ - $params[] = &$this->message[$child_pos]['result']; - } else { - if (isset($params[$this->message[$child_pos]['name']])) { - // de-serialize repeated element name into an array - if ((!is_array($params[$this->message[$child_pos]['name']])) || (!isset($params[$this->message[$child_pos]['name']][0]))) { - $params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]); - } - $params[$this->message[$child_pos]['name']][] = &$this->message[$child_pos]['result']; - } else { - $params[$this->message[$child_pos]['name']] = &$this->message[$child_pos]['result']; - } - } - } - } - if (isset($this->message[$pos]['xattrs'])) { - $this->debug('in buildVal, handling attributes'); - foreach ($this->message[$pos]['xattrs'] as $n => $v) { - $params[$n] = $v; - } - } - // handle simpleContent - if (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') { - $this->debug('in buildVal, handling simpleContent'); - if (isset($this->message[$pos]['type'])) { - $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - } else { - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - } else { - $params['!'] = $this->message[$pos]['cdata']; - } - } - } - $ret = is_array($params) ? $params : array(); - $this->debug('in buildVal, return:'); - $this->appendDebug($this->varDump($ret)); - return $ret; - } else { - $this->debug('in buildVal, no children, building scalar'); - $cdata = isset($this->message[$pos]['cdata']) ? $this->message[$pos]['cdata'] : ''; - if (isset($this->message[$pos]['type'])) { - $ret = $this->decodeSimple($cdata, $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - $this->debug("in buildVal, return: $ret"); - return $ret; - } - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $ret = $this->decodeSimple($cdata, $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - $this->debug("in buildVal, return: $ret"); - return $ret; - } - $ret = $this->message[$pos]['cdata']; - $this->debug("in buildVal, return: $ret"); - return $ret; - } - } -} - -/** - * Backward compatibility - */ -class soap_parser extends nusoap_parser { -} - - diff --git a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_server.php b/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_server.php deleted file mode 100755 index 87db07909..000000000 --- a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_server.php +++ /dev/null @@ -1,1126 +0,0 @@ - -* @author Scott Nichol -* @version $Id: class.soap_server.php 6844 2011-06-03 14:46:51Z dMetzger $ -* @access public -*/ -class nusoap_server extends nusoap_base { - /** - * HTTP headers of request - * @var array - * @access private - */ - var $headers = array(); - /** - * HTTP request - * @var string - * @access private - */ - var $request = ''; - /** - * SOAP headers from request (incomplete namespace resolution; special characters not escaped) (text) - * @var string - * @access public - */ - var $requestHeaders = ''; - /** - * SOAP Headers from request (parsed) - * @var mixed - * @access public - */ - var $requestHeader = NULL; - /** - * SOAP body request portion (incomplete namespace resolution; special characters not escaped) (text) - * @var string - * @access public - */ - var $document = ''; - /** - * SOAP payload for request (text) - * @var string - * @access public - */ - var $requestSOAP = ''; - /** - * requested method namespace URI - * @var string - * @access private - */ - var $methodURI = ''; - /** - * name of method requested - * @var string - * @access private - */ - var $methodname = ''; - /** - * method parameters from request - * @var array - * @access private - */ - var $methodparams = array(); - /** - * SOAP Action from request - * @var string - * @access private - */ - var $SOAPAction = ''; - /** - * character set encoding of incoming (request) messages - * @var string - * @access public - */ - var $xml_encoding = ''; - /** - * toggles whether the parser decodes element content w/ utf8_decode() - * @var boolean - * @access public - */ - var $decode_utf8 = true; - - /** - * HTTP headers of response - * @var array - * @access public - */ - var $outgoing_headers = array(); - /** - * HTTP response - * @var string - * @access private - */ - var $response = ''; - /** - * SOAP headers for response (text or array of soapval or associative array) - * @var mixed - * @access public - */ - var $responseHeaders = ''; - /** - * SOAP payload for response (text) - * @var string - * @access private - */ - var $responseSOAP = ''; - /** - * method return value to place in response - * @var mixed - * @access private - */ - var $methodreturn = false; - /** - * whether $methodreturn is a string of literal XML - * @var boolean - * @access public - */ - var $methodreturnisliteralxml = false; - /** - * SOAP fault for response (or false) - * @var mixed - * @access private - */ - var $fault = false; - /** - * text indication of result (for debugging) - * @var string - * @access private - */ - var $result = 'successful'; - - /** - * assoc array of operations => opData; operations are added by the register() - * method or by parsing an external WSDL definition - * @var array - * @access private - */ - var $operations = array(); - /** - * wsdl instance (if one) - * @var mixed - * @access private - */ - var $wsdl = false; - /** - * URL for WSDL (if one) - * @var mixed - * @access private - */ - var $externalWSDLURL = false; - /** - * whether to append debug to response as XML comment - * @var boolean - * @access public - */ - var $debug_flag = false; - - - /** - * constructor - * the optional parameter is a path to a WSDL file that you'd like to bind the server instance to. - * - * @param mixed $wsdl file path or URL (string), or wsdl instance (object) - * @access public - */ - function nusoap_server($wsdl=false){ - parent::nusoap_base(); - // turn on debugging? - global $debug; - global $HTTP_SERVER_VARS; - - if (isset($_SERVER)) { - $this->debug("_SERVER is defined:"); - $this->appendDebug($this->varDump($_SERVER)); - } elseif (isset($HTTP_SERVER_VARS)) { - $this->debug("HTTP_SERVER_VARS is defined:"); - $this->appendDebug($this->varDump($HTTP_SERVER_VARS)); - } else { - $this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined."); - } - - if (isset($debug)) { - $this->debug("In nusoap_server, set debug_flag=$debug based on global flag"); - $this->debug_flag = $debug; - } elseif (isset($_SERVER['QUERY_STRING'])) { - $qs = explode('&', $_SERVER['QUERY_STRING']); - foreach ($qs as $v) { - if (substr($v, 0, 6) == 'debug=') { - $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #1"); - $this->debug_flag = substr($v, 6); - } - } - } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { - $qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']); - foreach ($qs as $v) { - if (substr($v, 0, 6) == 'debug=') { - $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #2"); - $this->debug_flag = substr($v, 6); - } - } - } - - // wsdl - if($wsdl){ - $this->debug("In nusoap_server, WSDL is specified"); - if (is_object($wsdl) && (get_class($wsdl) == 'wsdl')) { - $this->wsdl = $wsdl; - $this->externalWSDLURL = $this->wsdl->wsdl; - $this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL); - } else { - $this->debug('Create wsdl from ' . $wsdl); - $this->wsdl = new wsdl($wsdl); - $this->externalWSDLURL = $wsdl; - } - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - if($err = $this->wsdl->getError()){ - die('WSDL ERROR: '.$err); - } - } - } - - /** - * processes request and returns response - * - * @param string $data usually is the value of $HTTP_RAW_POST_DATA - * @access public - */ - function service($data){ - global $HTTP_SERVER_VARS; - - if (isset($_SERVER['REQUEST_METHOD'])) { - $rm = $_SERVER['REQUEST_METHOD']; - } elseif (isset($HTTP_SERVER_VARS['REQUEST_METHOD'])) { - $rm = $HTTP_SERVER_VARS['REQUEST_METHOD']; - } else { - $rm = ''; - } - - if (isset($_SERVER['QUERY_STRING'])) { - $qs = $_SERVER['QUERY_STRING']; - } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { - $qs = $HTTP_SERVER_VARS['QUERY_STRING']; - } else { - $qs = ''; - } - $this->debug("In service, request method=$rm query string=$qs strlen(\$data)=" . strlen($data)); - - if ($rm == 'POST') { - $this->debug("In service, invoke the request"); - $this->parse_request($data); - if (! $this->fault) { - $this->invoke_method(); - } - if (! $this->fault) { - $this->serialize_return(); - } - $this->send_response(); - } elseif (preg_match('/wsdl/', $qs) ){ - $this->debug("In service, this is a request for WSDL"); - if ($this->externalWSDLURL){ - if (strpos($this->externalWSDLURL, "http://") !== false) { // assume URL - $this->debug("In service, re-direct for WSDL"); - header('Location: '.$this->externalWSDLURL); - } else { // assume file - $this->debug("In service, use file passthru for WSDL"); - header("Content-Type: text/xml\r\n"); - $pos = strpos($this->externalWSDLURL, "file://"); - if ($pos === false) { - $filename = $this->externalWSDLURL; - } else { - $filename = substr($this->externalWSDLURL, $pos + 7); - } - $fp = fopen($this->externalWSDLURL, 'r'); - fpassthru($fp); - } - } elseif ($this->wsdl) { - $this->debug("In service, serialize WSDL"); - header("Content-Type: text/xml; charset=ISO-8859-1\r\n"); - print $this->wsdl->serialize($this->debug_flag); - if ($this->debug_flag) { - $this->debug('wsdl:'); - $this->appendDebug($this->varDump($this->wsdl)); - print $this->getDebugAsXMLComment(); - } - } else { - $this->debug("In service, there is no WSDL"); - header("Content-Type: text/html; charset=ISO-8859-1\r\n"); - print "This service does not provide WSDL"; - } - } elseif ($this->wsdl) { - $this->debug("In service, return Web description"); - print $this->wsdl->webDescription(); - } else { - $this->debug("In service, no Web description"); - header("Content-Type: text/html; charset=ISO-8859-1\r\n"); - print "This service does not provide a Web description"; - } - } - - /** - * parses HTTP request headers. - * - * The following fields are set by this function (when successful) - * - * headers - * request - * xml_encoding - * SOAPAction - * - * @access private - */ - function parse_http_headers() { - global $HTTP_SERVER_VARS; - - $this->request = ''; - $this->SOAPAction = ''; - if(function_exists('getallheaders')){ - $this->debug("In parse_http_headers, use getallheaders"); - $headers = getallheaders(); - foreach($headers as $k=>$v){ - $k = strtolower($k); - $this->headers[$k] = $v; - $this->request .= "$k: $v\r\n"; - $this->debug("$k: $v"); - } - // get SOAPAction header - if(isset($this->headers['soapaction'])){ - $this->SOAPAction = str_replace('"','',$this->headers['soapaction']); - } - // get the character encoding of the incoming request - if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){ - $enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1)); - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - } elseif(isset($_SERVER) && is_array($_SERVER)){ - $this->debug("In parse_http_headers, use _SERVER"); - foreach ($_SERVER as $k => $v) { - if (substr($k, 0, 5) == 'HTTP_') { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); - } else { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); - } - if ($k == 'soapaction') { - // get SOAPAction header - $k = 'SOAPAction'; - $v = str_replace('"', '', $v); - $v = str_replace('\\', '', $v); - $this->SOAPAction = $v; - } else if ($k == 'content-type') { - // get the character encoding of the incoming request - if (strpos($v, '=')) { - $enc = substr(strstr($v, '='), 1); - $enc = str_replace('"', '', $enc); - $enc = str_replace('\\', '', $enc); - if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) { - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - } - $this->headers[$k] = $v; - $this->request .= "$k: $v\r\n"; - $this->debug("$k: $v"); - } - } elseif (is_array($HTTP_SERVER_VARS)) { - $this->debug("In parse_http_headers, use HTTP_SERVER_VARS"); - foreach ($HTTP_SERVER_VARS as $k => $v) { - if (substr($k, 0, 5) == 'HTTP_') { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); $k = strtolower(substr($k, 5)); - } else { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); $k = strtolower($k); - } - if ($k == 'soapaction') { - // get SOAPAction header - $k = 'SOAPAction'; - $v = str_replace('"', '', $v); - $v = str_replace('\\', '', $v); - $this->SOAPAction = $v; - } else if ($k == 'content-type') { - // get the character encoding of the incoming request - if (strpos($v, '=')) { - $enc = substr(strstr($v, '='), 1); - $enc = str_replace('"', '', $enc); - $enc = str_replace('\\', '', $enc); - if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) { - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - } - $this->headers[$k] = $v; - $this->request .= "$k: $v\r\n"; - $this->debug("$k: $v"); - } - } else { - $this->debug("In parse_http_headers, HTTP headers not accessible"); - $this->setError("HTTP headers not accessible"); - } - } - - /** - * parses a request - * - * The following fields are set by this function (when successful) - * - * headers - * request - * xml_encoding - * SOAPAction - * request - * requestSOAP - * methodURI - * methodname - * methodparams - * requestHeaders - * document - * - * This sets the fault field on error - * - * @param string $data XML string - * @access private - */ - function parse_request($data='') { - $this->debug('entering parse_request()'); - $this->parse_http_headers(); - $this->debug('got character encoding: '.$this->xml_encoding); - // uncompress if necessary - if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] != '') { - $this->debug('got content encoding: ' . $this->headers['content-encoding']); - if ($this->headers['content-encoding'] == 'deflate' || $this->headers['content-encoding'] == 'gzip') { - // if decoding works, use it. else assume data wasn't gzencoded - if (function_exists('gzuncompress')) { - if ($this->headers['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) { - $data = $degzdata; - } elseif ($this->headers['content-encoding'] == 'gzip' && $degzdata = gzinflate(substr($data, 10))) { - $data = $degzdata; - } else { - $this->fault('SOAP-ENV:Client', 'Errors occurred when trying to decode the data'); - return; - } - } else { - $this->fault('SOAP-ENV:Client', 'This Server does not support compressed data'); - return; - } - } - } - $this->request .= "\r\n".$data; - $data = $this->parseRequest($this->headers, $data); - $this->requestSOAP = $data; - $this->debug('leaving parse_request'); - } - - /** - * invokes a PHP function for the requested SOAP method - * - * The following fields are set by this function (when successful) - * - * methodreturn - * - * Note that the PHP function that is called may also set the following - * fields to affect the response sent to the client - * - * responseHeaders - * outgoing_headers - * - * This sets the fault field on error - * - * @access private - */ - function invoke_method() { - $this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodURI . ' SOAPAction=' . $this->SOAPAction); - - // - // if you are debugging in this area of the code, your service uses a class to implement methods, - // you use SOAP RPC, and the client is .NET, please be aware of the following... - // when the .NET wsdl.exe utility generates a proxy, it will remove the '.' or '..' from the - // method name. that is fine for naming the .NET methods. it is not fine for properly constructing - // the XML request and reading the XML response. you need to add the RequestElementName and - // ResponseElementName to the System.Web.Services.Protocols.SoapRpcMethodAttribute that wsdl.exe - // generates for the method. these parameters are used to specify the correct XML element names - // for .NET to use, i.e. the names with the '.' in them. - // - $orig_methodname = $this->methodname; - if ($this->wsdl) { - if ($this->opData = $this->wsdl->getOperationData($this->methodname)) { - $this->debug('in invoke_method, found WSDL operation=' . $this->methodname); - $this->appendDebug('opData=' . $this->varDump($this->opData)); - } elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) { - // Note: hopefully this case will only be used for doc/lit, since rpc services should have wrapper element - $this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . $this->opData['name']); - $this->appendDebug('opData=' . $this->varDump($this->opData)); - $this->methodname = $this->opData['name']; - } else { - $this->debug('in invoke_method, no WSDL for operation=' . $this->methodname); - $this->fault('SOAP-ENV:Client', "Operation '" . $this->methodname . "' is not defined in the WSDL for this service"); - return; - } - } else { - $this->debug('in invoke_method, no WSDL to validate method'); - } - - // if a . is present in $this->methodname, we see if there is a class in scope, - // which could be referred to. We will also distinguish between two deliminators, - // to allow methods to be called a the class or an instance - if (strpos($this->methodname, '..') > 0) { - $delim = '..'; - } else if (strpos($this->methodname, '.') > 0) { - $delim = '.'; - } else { - $delim = ''; - } - $this->debug("in invoke_method, delim=$delim"); - - $class = ''; - $method = ''; - if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1) { - $try_class = substr($this->methodname, 0, strpos($this->methodname, $delim)); - if (class_exists($try_class)) { - // get the class and method name - $class = $try_class; - $method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim)); - $this->debug("in invoke_method, class=$class method=$method delim=$delim"); - } else { - $this->debug("in invoke_method, class=$try_class not found"); - } - } else { - $try_class = ''; - $this->debug("in invoke_method, no class to try"); - } - - // does method exist? - if ($class == '') { - if (!function_exists($this->methodname)) { - $this->debug("in invoke_method, function '$this->methodname' not found!"); - $this->result = 'fault: method not found'; - $this->fault('SOAP-ENV:Client',"method '$this->methodname'('$orig_methodname') not defined in service('$try_class' '$delim')"); - return; - } - } else { - $method_to_compare = (substr(phpversion(), 0, 2) == '4.') ? strtolower($method) : $method; - if (!in_array($method_to_compare, get_class_methods($class))) { - $this->debug("in invoke_method, method '$this->methodname' not found in class '$class'!"); - $this->result = 'fault: method not found'; - $this->fault('SOAP-ENV:Client',"method '$this->methodname'/'$method_to_compare'('$orig_methodname') not defined in service/'$class'('$try_class' '$delim')"); - return; - } - } - - // evaluate message, getting back parameters - // verify that request parameters match the method's signature - if(! $this->verify_method($this->methodname,$this->methodparams)){ - // debug - $this->debug('ERROR: request not verified against method signature'); - $this->result = 'fault: request failed validation against method signature'; - // return fault - $this->fault('SOAP-ENV:Client',"Operation '$this->methodname' not defined in service."); - return; - } - - // if there are parameters to pass - $this->debug('in invoke_method, params:'); - $this->appendDebug($this->varDump($this->methodparams)); - $this->debug("in invoke_method, calling '$this->methodname'"); - if (!function_exists('call_user_func_array')) { - if ($class == '') { - $this->debug('in invoke_method, calling function using eval()'); - $funcCall = "\$this->methodreturn = $this->methodname("; - } else { - if ($delim == '..') { - $this->debug('in invoke_method, calling class method using eval()'); - $funcCall = "\$this->methodreturn = ".$class."::".$method."("; - } else { - $this->debug('in invoke_method, calling instance method using eval()'); - // generate unique instance name - $instname = "\$inst_".time(); - $funcCall = $instname." = new ".$class."(); "; - $funcCall .= "\$this->methodreturn = ".$instname."->".$method."("; - } - } - if ($this->methodparams) { - foreach ($this->methodparams as $param) { - if (is_array($param) || is_object($param)) { - $this->fault('SOAP-ENV:Client', 'NuSOAP does not handle complexType parameters correctly when using eval; call_user_func_array must be available'); - return; - } - $funcCall .= "\"$param\","; - } - $funcCall = substr($funcCall, 0, -1); - } - $funcCall .= ');'; - $this->debug('in invoke_method, function call: '.$funcCall); - @eval($funcCall); - } else { - if ($class == '') { - $this->debug('in invoke_method, calling function using call_user_func_array()'); - $call_arg = "$this->methodname"; // straight assignment changes $this->methodname to lower case after call_user_func_array() - } elseif ($delim == '..') { - $this->debug('in invoke_method, calling class method using call_user_func_array()'); - $call_arg = array ($class, $method); - } else { - $this->debug('in invoke_method, calling instance method using call_user_func_array()'); - $instance = new $class (); - $call_arg = array(&$instance, $method); - } - if (is_array($this->methodparams)) { - $this->methodreturn = call_user_func_array($call_arg, array_values($this->methodparams)); - } else { - $this->methodreturn = call_user_func_array($call_arg, array()); - } - } - $this->debug('in invoke_method, methodreturn:'); - $this->appendDebug($this->varDump($this->methodreturn)); - $this->debug("in invoke_method, called method $this->methodname, received data of type ".gettype($this->methodreturn)); - } - - /** - * serializes the return value from a PHP function into a full SOAP Envelope - * - * The following fields are set by this function (when successful) - * - * responseSOAP - * - * This sets the fault field on error - * - * @access private - */ - function serialize_return() { - $this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI); - // if fault - if (isset($this->methodreturn) && is_object($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class($this->methodreturn) == 'nusoap_fault'))) { - $this->debug('got a fault object from method'); - $this->fault = $this->methodreturn; - return; - } elseif ($this->methodreturnisliteralxml) { - $return_val = $this->methodreturn; - // returned value(s) - } else { - $this->debug('got a(n) '.gettype($this->methodreturn).' from method'); - $this->debug('serializing return value'); - if($this->wsdl){ - if (sizeof($this->opData['output']['parts']) > 1) { - $this->debug('more than one output part, so use the method return unchanged'); - $opParams = $this->methodreturn; - } elseif (sizeof($this->opData['output']['parts']) == 1) { - $this->debug('exactly one output part, so wrap the method return in a simple array'); - // TODO: verify that it is not already wrapped! - //foreach ($this->opData['output']['parts'] as $name => $type) { - // $this->debug('wrap in element named ' . $name); - //} - $opParams = array($this->methodreturn); - } - $return_val = $this->wsdl->serializeRPCParameters($this->methodname,'output',$opParams); - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - if($errstr = $this->wsdl->getError()){ - $this->debug('got wsdl error: '.$errstr); - $this->fault('SOAP-ENV:Server', 'unable to serialize result'); - return; - } - } else { - if (isset($this->methodreturn)) { - $return_val = $this->serialize_val($this->methodreturn, 'return'); - } else { - $return_val = ''; - $this->debug('in absence of WSDL, assume void return for backward compatibility'); - } - } - } - $this->debug('return value:'); - $this->appendDebug($this->varDump($return_val)); - - $this->debug('serializing response'); - if ($this->wsdl) { - $this->debug('have WSDL for serialization: style is ' . $this->opData['style']); - if ($this->opData['style'] == 'rpc') { - $this->debug('style is rpc for serialization: use is ' . $this->opData['output']['use']); - if ($this->opData['output']['use'] == 'literal') { - // http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace - if ($this->methodURI) { - $payload = 'methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'methodname."Response>"; - } else { - $payload = '<'.$this->methodname.'Response>'.$return_val.'methodname.'Response>'; - } - } else { - if ($this->methodURI) { - $payload = 'methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'methodname."Response>"; - } else { - $payload = '<'.$this->methodname.'Response>'.$return_val.'methodname.'Response>'; - } - } - } else { - $this->debug('style is not rpc for serialization: assume document'); - $payload = $return_val; - } - } else { - $this->debug('do not have WSDL for serialization: assume rpc/encoded'); - $payload = 'methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'methodname."Response>"; - } - $this->result = 'successful'; - if($this->wsdl){ - //if($this->debug_flag){ - $this->appendDebug($this->wsdl->getDebug()); - // } - if (isset($this->opData['output']['encodingStyle'])) { - $encodingStyle = $this->opData['output']['encodingStyle']; - } else { - $encodingStyle = ''; - } - // Added: In case we use a WSDL, return a serialized env. WITH the usedNamespaces. - $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders,$this->wsdl->usedNamespaces,$this->opData['style'],$this->opData['output']['use'],$encodingStyle); - } else { - $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders); - } - $this->debug("Leaving serialize_return"); - } - - /** - * sends an HTTP response - * - * The following fields are set by this function (when successful) - * - * outgoing_headers - * response - * - * @access private - */ - function send_response() { - $this->debug('Enter send_response'); - if ($this->fault) { - $payload = $this->fault->serialize(); - $this->outgoing_headers[] = "HTTP/1.0 500 Internal Server Error"; - $this->outgoing_headers[] = "Status: 500 Internal Server Error"; - } else { - $payload = $this->responseSOAP; - // Some combinations of PHP+Web server allow the Status - // to come through as a header. Since OK is the default - // just do nothing. - // $this->outgoing_headers[] = "HTTP/1.0 200 OK"; - // $this->outgoing_headers[] = "Status: 200 OK"; - } - // add debug data if in debug mode - if(isset($this->debug_flag) && $this->debug_flag){ - $payload .= $this->getDebugAsXMLComment(); - } - $this->outgoing_headers[] = "Server: $this->title Server v$this->version"; - preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev); - $this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")"; - // Let the Web server decide about this - //$this->outgoing_headers[] = "Connection: Close\r\n"; - $payload = $this->getHTTPBody($payload); - $type = $this->getHTTPContentType(); - $charset = $this->getHTTPContentTypeCharset(); - $this->outgoing_headers[] = "Content-Type: $type" . ($charset ? '; charset=' . $charset : ''); - //begin code to compress payload - by John - // NOTE: there is no way to know whether the Web server will also compress - // this data. - if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) { - if (strstr($this->headers['accept-encoding'], 'gzip')) { - if (function_exists('gzencode')) { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - $this->outgoing_headers[] = "Content-Encoding: gzip"; - $payload = gzencode($payload); - } else { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - } - } elseif (strstr($this->headers['accept-encoding'], 'deflate')) { - // Note: MSIE requires gzdeflate output (no Zlib header and checksum), - // instead of gzcompress output, - // which conflicts with HTTP 1.1 spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5) - if (function_exists('gzdeflate')) { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - $this->outgoing_headers[] = "Content-Encoding: deflate"; - $payload = gzdeflate($payload); - } else { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - } - } - } - //end code - $this->outgoing_headers[] = "Content-Length: ".strlen($payload); - reset($this->outgoing_headers); - foreach($this->outgoing_headers as $hdr){ - header($hdr, false); - } - print $payload; - $this->response = join("\r\n",$this->outgoing_headers)."\r\n\r\n".$payload; - } - - /** - * takes the value that was created by parsing the request - * and compares to the method's signature, if available. - * - * @param string $operation The operation to be invoked - * @param array $request The array of parameter values - * @return boolean Whether the operation was found - * @access private - */ - function verify_method($operation,$request){ - if(isset($this->wsdl) && is_object($this->wsdl)){ - if($this->wsdl->getOperationData($operation)){ - return true; - } - } elseif(isset($this->operations[$operation])){ - return true; - } - return false; - } - - /** - * processes SOAP message received from client - * - * @param array $headers The HTTP headers - * @param string $data unprocessed request data from client - * @return mixed value of the message, decoded into a PHP type - * @access private - */ - function parseRequest($headers, $data) { - $this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' headers:'); - $this->appendDebug($this->varDump($headers)); - if (!isset($headers['content-type'])) { - $this->setError('Request not of type text/xml (no content-type header)'); - return false; - } - if (!strstr($headers['content-type'], 'text/xml')) { - $this->setError('Request not of type text/xml'); - return false; - } - if (strpos($headers['content-type'], '=')) { - $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1)); - $this->debug('Got response encoding: ' . $enc); - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser'); - // parse response, get soap parser obj - $parser = new nusoap_parser($data,$this->xml_encoding,'',$this->decode_utf8); - // parser debug - $this->debug("parser debug: \n".$parser->getDebug()); - // if fault occurred during message parsing - if($err = $parser->getError()){ - $this->result = 'fault: error in msg parsing: '.$err; - $this->fault('SOAP-ENV:Client',"error in msg parsing:\n".$err); - // else successfully parsed request into soapval object - } else { - // get/set methodname - $this->methodURI = $parser->root_struct_namespace; - $this->methodname = $parser->root_struct_name; - $this->debug('methodname: '.$this->methodname.' methodURI: '.$this->methodURI); - $this->debug('calling parser->get_soapbody()'); - $this->methodparams = $parser->get_soapbody(); - // get SOAP headers - $this->requestHeaders = $parser->getHeaders(); - // get SOAP Header - $this->requestHeader = $parser->get_soapheader(); - // add document for doclit support - $this->document = $parser->document; - } - } - - /** - * gets the HTTP body for the current response. - * - * @param string $soapmsg The SOAP payload - * @return string The HTTP body, which includes the SOAP payload - * @access private - */ - function getHTTPBody($soapmsg) { - return $soapmsg; - } - - /** - * gets the HTTP content type for the current response. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type for the current response. - * @access private - */ - function getHTTPContentType() { - return 'text/xml'; - } - - /** - * gets the HTTP content type charset for the current response. - * returns false for non-text content types. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type charset for the current response. - * @access private - */ - function getHTTPContentTypeCharset() { - return $this->soap_defencoding; - } - - /** - * add a method to the dispatch map (this has been replaced by the register method) - * - * @param string $methodname - * @param string $in array of input values - * @param string $out array of output values - * @access public - * @deprecated - */ - function add_to_map($methodname,$in,$out){ - $this->operations[$methodname] = array('name' => $methodname,'in' => $in,'out' => $out); - } - - /** - * register a service function with the server - * - * @param string $name the name of the PHP function, class.method or class..method - * @param array $in assoc array of input values: key = param name, value = param type - * @param array $out assoc array of output values: key = param name, value = param type - * @param mixed $namespace the element namespace for the method or false - * @param mixed $soapaction the soapaction for the method or false - * @param mixed $style optional (rpc|document) or false Note: when 'document' is specified, parameter and return wrappers are created for you automatically - * @param mixed $use optional (encoded|literal) or false - * @param string $documentation optional Description to include in WSDL - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) - * @access public - */ - function register($name,$in=array(),$out=array(),$namespace=false,$soapaction=false,$style=false,$use=false,$documentation='',$encodingStyle=''){ - global $HTTP_SERVER_VARS; - - if($this->externalWSDLURL){ - die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.'); - } - if (! $name) { - die('You must specify a name when you register an operation'); - } - if (!is_array($in)) { - die('You must provide an array for operation inputs'); - } - if (!is_array($out)) { - die('You must provide an array for operation outputs'); - } - if(false == $namespace) { - } - if(false == $soapaction) { - if (isset($_SERVER)) { - $SERVER_NAME = $_SERVER['SERVER_NAME']; - $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; - $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'); - } elseif (isset($HTTP_SERVER_VARS)) { - $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME']; - $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']; - $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'; - } else { - $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); - } - if ($HTTPS == '1' || $HTTPS == 'on') { - $SCHEME = 'https'; - } else { - $SCHEME = 'http'; - } - $soapaction = "$SCHEME://$SERVER_NAME$SCRIPT_NAME/$name"; - } - if(false == $style) { - $style = "rpc"; - } - if(false == $use) { - $use = "encoded"; - } - if ($use == 'encoded' && $encodingStyle == '') { - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - } - - $this->operations[$name] = array( - 'name' => $name, - 'in' => $in, - 'out' => $out, - 'namespace' => $namespace, - 'soapaction' => $soapaction, - 'style' => $style); - if($this->wsdl){ - $this->wsdl->addOperation($name,$in,$out,$namespace,$soapaction,$style,$use,$documentation,$encodingStyle); - } - return true; - } - - /** - * Specify a fault to be returned to the client. - * This also acts as a flag to the server that a fault has occurred. - * - * @param string $faultcode - * @param string $faultstring - * @param string $faultactor - * @param string $faultdetail - * @access public - */ - function fault($faultcode,$faultstring,$faultactor='',$faultdetail=''){ - if ($faultdetail == '' && $this->debug_flag) { - $faultdetail = $this->getDebug(); - } - $this->fault = new nusoap_fault($faultcode,$faultactor,$faultstring,$faultdetail); - $this->fault->soap_defencoding = $this->soap_defencoding; - } - - /** - * Sets up wsdl object. - * Acts as a flag to enable internal WSDL generation - * - * @param string $serviceName, name of the service - * @param mixed $namespace optional 'tns' service namespace or false - * @param mixed $endpoint optional URL of service endpoint or false - * @param string $style optional (rpc|document) WSDL style (also specified by operation) - * @param string $transport optional SOAP transport - * @param mixed $schemaTargetNamespace optional 'types' targetNamespace for service schema or false - */ - function configureWSDL($serviceName,$namespace = false,$endpoint = false,$style='rpc', $transport = 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false) - { - global $HTTP_SERVER_VARS; - - if (isset($_SERVER)) { - $SERVER_NAME = $_SERVER['SERVER_NAME']; - $SERVER_PORT = $_SERVER['SERVER_PORT']; - $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; - $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'); - } elseif (isset($HTTP_SERVER_VARS)) { - $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME']; - $SERVER_PORT = $HTTP_SERVER_VARS['SERVER_PORT']; - $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']; - $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'; - } else { - $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); - } - // If server name has port number attached then strip it (else port number gets duplicated in WSDL output) (occurred using lighttpd and FastCGI) - $colon = strpos($SERVER_NAME,":"); - if ($colon) { - $SERVER_NAME = substr($SERVER_NAME, 0, $colon); - } - if ($SERVER_PORT == 80) { - $SERVER_PORT = ''; - } else { - $SERVER_PORT = ':' . $SERVER_PORT; - } - if(false == $namespace) { - $namespace = "http://$SERVER_NAME/soap/$serviceName"; - } - - if(false == $endpoint) { - if ($HTTPS == '1' || $HTTPS == 'on') { - $SCHEME = 'https'; - } else { - $SCHEME = 'http'; - } - $endpoint = "$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME"; - } - - if(false == $schemaTargetNamespace) { - $schemaTargetNamespace = $namespace; - } - - $this->wsdl = new wsdl; - $this->wsdl->serviceName = $serviceName; - $this->wsdl->endpoint = $endpoint; - $this->wsdl->namespaces['tns'] = $namespace; - $this->wsdl->namespaces['soap'] = 'http://schemas.xmlsoap.org/wsdl/soap/'; - $this->wsdl->namespaces['wsdl'] = 'http://schemas.xmlsoap.org/wsdl/'; - if ($schemaTargetNamespace != $namespace) { - $this->wsdl->namespaces['types'] = $schemaTargetNamespace; - } - $this->wsdl->schemas[$schemaTargetNamespace][0] = new nusoap_xmlschema('', '', $this->wsdl->namespaces); - if ($style == 'document') { - $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaInfo['elementFormDefault'] = 'qualified'; - } - $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaTargetNamespace = $schemaTargetNamespace; - $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/soap/encoding/'][0] = array('location' => '', 'loaded' => true); - $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/wsdl/'][0] = array('location' => '', 'loaded' => true); - $this->wsdl->bindings[$serviceName.'Binding'] = array( - 'name'=>$serviceName.'Binding', - 'style'=>$style, - 'transport'=>$transport, - 'portType'=>$serviceName.'PortType'); - $this->wsdl->ports[$serviceName.'Port'] = array( - 'binding'=>$serviceName.'Binding', - 'location'=>$endpoint, - 'bindingType'=>'http://schemas.xmlsoap.org/wsdl/soap/'); - } -} - -/** - * Backward compatibility - */ -class soap_server extends nusoap_server { -} - - diff --git a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_transport_http.php b/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_transport_http.php deleted file mode 100755 index dbefc8bb9..000000000 --- a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_transport_http.php +++ /dev/null @@ -1,1306 +0,0 @@ - -* @author Scott Nichol -* @version $Id: class.soap_transport_http.php 6844 2011-06-03 14:46:51Z dMetzger $ -* @access public -*/ -class soap_transport_http extends nusoap_base { - - var $url = ''; - var $uri = ''; - var $digest_uri = ''; - var $scheme = ''; - var $host = ''; - var $port = ''; - var $path = ''; - var $request_method = 'POST'; - var $protocol_version = '1.0'; - var $encoding = ''; - var $outgoing_headers = array(); - var $incoming_headers = array(); - var $incoming_cookies = array(); - var $outgoing_payload = ''; - var $incoming_payload = ''; - var $response_status_line; // HTTP response status line - var $useSOAPAction = true; - var $persistentConnection = false; - var $ch = false; // cURL handle - var $ch_options = array(); // cURL custom options - var $use_curl = false; // force cURL use - var $proxy = null; // proxy information (associative array) - var $username = ''; - var $password = ''; - var $authtype = ''; - var $digestRequest = array(); - var $certRequest = array(); // keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional) - // cainfofile: certificate authority file, e.g. '$pathToPemFiles/rootca.pem' - // sslcertfile: SSL certificate file, e.g. '$pathToPemFiles/mycert.pem' - // sslkeyfile: SSL key file, e.g. '$pathToPemFiles/mykey.pem' - // passphrase: SSL key password/passphrase - // certpassword: SSL certificate password - // verifypeer: default is 1 - // verifyhost: default is 1 - - /** - * constructor - * - * @param string $url The URL to which to connect - * @param array $curl_options User-specified cURL options - * @param boolean $use_curl Whether to try to force cURL use - * @access public - */ - function soap_transport_http($url, $curl_options = NULL, $use_curl = false){ - parent::nusoap_base(); - $this->debug("ctor url=$url use_curl=$use_curl curl_options:"); - $this->appendDebug($this->varDump($curl_options)); - $this->setURL($url); - if (is_array($curl_options)) { - $this->ch_options = $curl_options; - } - $this->use_curl = $use_curl; - preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev); - $this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')'); - } - - /** - * sets a cURL option - * - * @param mixed $option The cURL option (always integer?) - * @param mixed $value The cURL option value - * @access private - */ - function setCurlOption($option, $value) { - $this->debug("setCurlOption option=$option, value="); - $this->appendDebug($this->varDump($value)); - curl_setopt($this->ch, $option, $value); - } - - /** - * sets an HTTP header - * - * @param string $name The name of the header - * @param string $value The value of the header - * @access private - */ - function setHeader($name, $value) { - $this->outgoing_headers[$name] = $value; - $this->debug("set header $name: $value"); - } - - /** - * unsets an HTTP header - * - * @param string $name The name of the header - * @access private - */ - function unsetHeader($name) { - if (isset($this->outgoing_headers[$name])) { - $this->debug("unset header $name"); - unset($this->outgoing_headers[$name]); - } - } - - /** - * sets the URL to which to connect - * - * @param string $url The URL to which to connect - * @access private - */ - function setURL($url) { - $this->url = $url; - - $u = parse_url($url); - foreach($u as $k => $v){ - $this->debug("parsed URL $k = $v"); - $this->$k = $v; - } - - // add any GET params to path - if(isset($u['query']) && $u['query'] != ''){ - $this->path .= '?' . $u['query']; - } - - // set default port - if(!isset($u['port'])){ - if($u['scheme'] == 'https'){ - $this->port = 443; - } else { - $this->port = 80; - } - } - - $this->uri = $this->path; - $this->digest_uri = $this->uri; - - // build headers - if (!isset($u['port'])) { - $this->setHeader('Host', $this->host); - } else { - $this->setHeader('Host', $this->host.':'.$this->port); - } - - if (isset($u['user']) && $u['user'] != '') { - $this->setCredentials(urldecode($u['user']), isset($u['pass']) ? urldecode($u['pass']) : ''); - } - } - - /** - * gets the I/O method to use - * - * @return string I/O method to use (socket|curl|unknown) - * @access private - */ - function io_method() { - if ($this->use_curl || ($this->scheme == 'https') || ($this->scheme == 'http' && $this->authtype == 'ntlm') || ($this->scheme == 'http' && is_array($this->proxy) && $this->proxy['authtype'] == 'ntlm')) - return 'curl'; - if (($this->scheme == 'http' || $this->scheme == 'ssl') && $this->authtype != 'ntlm' && (!is_array($this->proxy) || $this->proxy['authtype'] != 'ntlm')) - return 'socket'; - return 'unknown'; - } - - /** - * establish an HTTP connection - * - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @return boolean true if connected, false if not - * @access private - */ - function connect($connection_timeout=0,$response_timeout=30){ - // For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like - // "regular" socket. - // TODO: disabled for now because OpenSSL must be *compiled* in (not just - // loaded), and until PHP5 stream_get_wrappers is not available. -// if ($this->scheme == 'https') { -// if (version_compare(phpversion(), '4.3.0') >= 0) { -// if (extension_loaded('openssl')) { -// $this->scheme = 'ssl'; -// $this->debug('Using SSL over OpenSSL'); -// } -// } -// } - $this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, scheme $this->scheme, host $this->host, port $this->port"); - if ($this->io_method() == 'socket') { - if (!is_array($this->proxy)) { - $host = $this->host; - $port = $this->port; - } else { - $host = $this->proxy['host']; - $port = $this->proxy['port']; - } - - // use persistent connection - if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){ - if (!feof($this->fp)) { - $this->debug('Re-use persistent connection'); - return true; - } - fclose($this->fp); - $this->debug('Closed persistent connection at EOF'); - } - - // munge host if using OpenSSL - if ($this->scheme == 'ssl') { - $host = 'ssl://' . $host; - } - $this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout); - - // open socket - if($connection_timeout > 0){ - $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout); - } else { - $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str); - } - - // test pointer - if(!$this->fp) { - $msg = 'Couldn\'t open socket connection to server ' . $this->url; - if ($this->errno) { - $msg .= ', Error ('.$this->errno.'): '.$this->error_str; - } else { - $msg .= ' prior to connect(). This is often a problem looking up the host name.'; - } - $this->debug($msg); - $this->setError($msg); - return false; - } - - // set response timeout - $this->debug('set response timeout to ' . $response_timeout); - socket_set_timeout( $this->fp, $response_timeout); - - $this->debug('socket connected'); - return true; - } else if ($this->io_method() == 'curl') { - if (!extension_loaded('curl')) { -// $this->setError('cURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS'); - $this->setError('The PHP cURL Extension is required for HTTPS or NLTM. You will need to re-build or update your PHP to include cURL or change php.ini to load the PHP cURL extension.'); - return false; - } - // Avoid warnings when PHP does not have these options - if (defined('CURLOPT_CONNECTIONTIMEOUT')) - $CURLOPT_CONNECTIONTIMEOUT = CURLOPT_CONNECTIONTIMEOUT; - else - $CURLOPT_CONNECTIONTIMEOUT = 78; - if (defined('CURLOPT_HTTPAUTH')) - $CURLOPT_HTTPAUTH = CURLOPT_HTTPAUTH; - else - $CURLOPT_HTTPAUTH = 107; - if (defined('CURLOPT_PROXYAUTH')) - $CURLOPT_PROXYAUTH = CURLOPT_PROXYAUTH; - else - $CURLOPT_PROXYAUTH = 111; - if (defined('CURLAUTH_BASIC')) - $CURLAUTH_BASIC = CURLAUTH_BASIC; - else - $CURLAUTH_BASIC = 1; - if (defined('CURLAUTH_DIGEST')) - $CURLAUTH_DIGEST = CURLAUTH_DIGEST; - else - $CURLAUTH_DIGEST = 2; - if (defined('CURLAUTH_NTLM')) - $CURLAUTH_NTLM = CURLAUTH_NTLM; - else - $CURLAUTH_NTLM = 8; - - $this->debug('connect using cURL'); - // init CURL - $this->ch = curl_init(); - // set url - $hostURL = ($this->port != '') ? "$this->scheme://$this->host:$this->port" : "$this->scheme://$this->host"; - // add path - $hostURL .= $this->path; - $this->setCurlOption(CURLOPT_URL, $hostURL); - // follow location headers (re-directs) - if (ini_get('safe_mode') || ini_get('open_basedir')) { - $this->debug('safe_mode or open_basedir set, so do not set CURLOPT_FOLLOWLOCATION'); - $this->debug('safe_mode = '); - $this->appendDebug($this->varDump(ini_get('safe_mode'))); - $this->debug('open_basedir = '); - $this->appendDebug($this->varDump(ini_get('open_basedir'))); - } else { - $this->setCurlOption(CURLOPT_FOLLOWLOCATION, 1); - } - // ask for headers in the response output - $this->setCurlOption(CURLOPT_HEADER, 1); - // ask for the response output as the return value - $this->setCurlOption(CURLOPT_RETURNTRANSFER, 1); - // encode - // We manage this ourselves through headers and encoding -// if(function_exists('gzuncompress')){ -// $this->setCurlOption(CURLOPT_ENCODING, 'deflate'); -// } - // persistent connection - if ($this->persistentConnection) { - // I believe the following comment is now bogus, having applied to - // the code when it used CURLOPT_CUSTOMREQUEST to send the request. - // The way we send data, we cannot use persistent connections, since - // there will be some "junk" at the end of our request. - //$this->setCurlOption(CURL_HTTP_VERSION_1_1, true); - $this->persistentConnection = false; - $this->setHeader('Connection', 'close'); - } - // set timeouts - if ($connection_timeout != 0) { - $this->setCurlOption($CURLOPT_CONNECTIONTIMEOUT, $connection_timeout); - } - if ($response_timeout != 0) { - $this->setCurlOption(CURLOPT_TIMEOUT, $response_timeout); - } - - if ($this->scheme == 'https') { - $this->debug('set cURL SSL verify options'); - // recent versions of cURL turn on peer/host checking by default, - // while PHP binaries are not compiled with a default location for the - // CA cert bundle, so disable peer/host checking. - //$this->setCurlOption(CURLOPT_CAINFO, 'f:\php-4.3.2-win32\extensions\curl-ca-bundle.crt'); - $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 0); - $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 0); - - // support client certificates (thanks Tobias Boes, Doug Anarino, Eryan Ariobowo) - if ($this->authtype == 'certificate') { - $this->debug('set cURL certificate options'); - if (isset($this->certRequest['cainfofile'])) { - $this->setCurlOption(CURLOPT_CAINFO, $this->certRequest['cainfofile']); - } - if (isset($this->certRequest['verifypeer'])) { - $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, $this->certRequest['verifypeer']); - } else { - $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 1); - } - if (isset($this->certRequest['verifyhost'])) { - $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, $this->certRequest['verifyhost']); - } else { - $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 1); - } - if (isset($this->certRequest['sslcertfile'])) { - $this->setCurlOption(CURLOPT_SSLCERT, $this->certRequest['sslcertfile']); - } - if (isset($this->certRequest['sslkeyfile'])) { - $this->setCurlOption(CURLOPT_SSLKEY, $this->certRequest['sslkeyfile']); - } - if (isset($this->certRequest['passphrase'])) { - $this->setCurlOption(CURLOPT_SSLKEYPASSWD, $this->certRequest['passphrase']); - } - if (isset($this->certRequest['certpassword'])) { - $this->setCurlOption(CURLOPT_SSLCERTPASSWD, $this->certRequest['certpassword']); - } - } - } - if ($this->authtype && ($this->authtype != 'certificate')) { - if ($this->username) { - $this->debug('set cURL username/password'); - $this->setCurlOption(CURLOPT_USERPWD, "$this->username:$this->password"); - } - if ($this->authtype == 'basic') { - $this->debug('set cURL for Basic authentication'); - $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_BASIC); - } - if ($this->authtype == 'digest') { - $this->debug('set cURL for digest authentication'); - $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_DIGEST); - } - if ($this->authtype == 'ntlm') { - $this->debug('set cURL for NTLM authentication'); - $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_NTLM); - } - } - if (is_array($this->proxy)) { - $this->debug('set cURL proxy options'); - if ($this->proxy['port'] != '') { - $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host'].':'.$this->proxy['port']); - } else { - $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host']); - } - if ($this->proxy['username'] || $this->proxy['password']) { - $this->debug('set cURL proxy authentication options'); - $this->setCurlOption(CURLOPT_PROXYUSERPWD, $this->proxy['username'].':'.$this->proxy['password']); - if ($this->proxy['authtype'] == 'basic') { - $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_BASIC); - } - if ($this->proxy['authtype'] == 'ntlm') { - $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_NTLM); - } - } - } - $this->debug('cURL connection set up'); - return true; - } else { - $this->setError('Unknown scheme ' . $this->scheme); - $this->debug('Unknown scheme ' . $this->scheme); - return false; - } - } - - /** - * sends the SOAP request and gets the SOAP response via HTTP[S] - * - * @param string $data message data - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @param array $cookies cookies to send - * @return string data - * @access public - */ - function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) { - - $this->debug('entered send() with data of length: '.strlen($data)); - - $this->tryagain = true; - $tries = 0; - while ($this->tryagain) { - $this->tryagain = false; - if ($tries++ < 2) { - // make connnection - if (!$this->connect($timeout, $response_timeout)){ - return false; - } - - // send request - if (!$this->sendRequest($data, $cookies)){ - return false; - } - - // get response - $respdata = $this->getResponse(); - } else { - $this->setError("Too many tries to get an OK response ($this->response_status_line)"); - } - } - $this->debug('end of send()'); - return $respdata; - } - - - /** - * sends the SOAP request and gets the SOAP response via HTTPS using CURL - * - * @param string $data message data - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @param array $cookies cookies to send - * @return string data - * @access public - * @deprecated - */ - function sendHTTPS($data, $timeout=0, $response_timeout=30, $cookies) { - return $this->send($data, $timeout, $response_timeout, $cookies); - } - - /** - * if authenticating, set user credentials here - * - * @param string $username - * @param string $password - * @param string $authtype (basic|digest|certificate|ntlm) - * @param array $digestRequest (keys must be nonce, nc, realm, qop) - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) - * @access public - */ - function setCredentials($username, $password, $authtype = 'basic', $digestRequest = array(), $certRequest = array()) { - $this->debug("setCredentials username=$username authtype=$authtype digestRequest="); - $this->appendDebug($this->varDump($digestRequest)); - $this->debug("certRequest="); - $this->appendDebug($this->varDump($certRequest)); - // cf. RFC 2617 - if ($authtype == 'basic') { - $this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':','',$username).':'.$password)); - } elseif ($authtype == 'digest') { - if (isset($digestRequest['nonce'])) { - $digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1; - - // calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html) - - // A1 = unq(username-value) ":" unq(realm-value) ":" passwd - $A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password; - - // H(A1) = MD5(A1) - $HA1 = md5($A1); - - // A2 = Method ":" digest-uri-value - $A2 = $this->request_method . ':' . $this->digest_uri; - - // H(A2) - $HA2 = md5($A2); - - // KD(secret, data) = H(concat(secret, ":", data)) - // if qop == auth: - // request-digest = <"> < KD ( H(A1), unq(nonce-value) - // ":" nc-value - // ":" unq(cnonce-value) - // ":" unq(qop-value) - // ":" H(A2) - // ) <"> - // if qop is missing, - // request-digest = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <"> - - $unhashedDigest = ''; - $nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : ''; - $cnonce = $nonce; - if ($digestRequest['qop'] != '') { - $unhashedDigest = $HA1 . ':' . $nonce . ':' . sprintf("%08d", $digestRequest['nc']) . ':' . $cnonce . ':' . $digestRequest['qop'] . ':' . $HA2; - } else { - $unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2; - } - - $hashedDigest = md5($unhashedDigest); - - $opaque = ''; - if (isset($digestRequest['opaque'])) { - $opaque = ', opaque="' . $digestRequest['opaque'] . '"'; - } - - $this->setHeader('Authorization', 'Digest username="' . $username . '", realm="' . $digestRequest['realm'] . '", nonce="' . $nonce . '", uri="' . $this->digest_uri . $opaque . '", cnonce="' . $cnonce . '", nc=' . sprintf("%08x", $digestRequest['nc']) . ', qop="' . $digestRequest['qop'] . '", response="' . $hashedDigest . '"'); - } - } elseif ($authtype == 'certificate') { - $this->certRequest = $certRequest; - $this->debug('Authorization header not set for certificate'); - } elseif ($authtype == 'ntlm') { - // do nothing - $this->debug('Authorization header not set for ntlm'); - } - $this->username = $username; - $this->password = $password; - $this->authtype = $authtype; - $this->digestRequest = $digestRequest; - } - - /** - * set the soapaction value - * - * @param string $soapaction - * @access public - */ - function setSOAPAction($soapaction) { - $this->setHeader('SOAPAction', '"' . $soapaction . '"'); - } - - /** - * use http encoding - * - * @param string $enc encoding style. supported values: gzip, deflate, or both - * @access public - */ - function setEncoding($enc='gzip, deflate') { - if (function_exists('gzdeflate')) { - $this->protocol_version = '1.1'; - $this->setHeader('Accept-Encoding', $enc); - if (!isset($this->outgoing_headers['Connection'])) { - $this->setHeader('Connection', 'close'); - $this->persistentConnection = false; - } - // deprecated as of PHP 5.3.0 - //set_magic_quotes_runtime(0); - $this->encoding = $enc; - } - } - - /** - * set proxy info here - * - * @param string $proxyhost use an empty string to remove proxy - * @param string $proxyport - * @param string $proxyusername - * @param string $proxypassword - * @param string $proxyauthtype (basic|ntlm) - * @access public - */ - function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '', $proxyauthtype = 'basic') { - if ($proxyhost) { - $this->proxy = array( - 'host' => $proxyhost, - 'port' => $proxyport, - 'username' => $proxyusername, - 'password' => $proxypassword, - 'authtype' => $proxyauthtype - ); - if ($proxyusername != '' && $proxypassword != '' && $proxyauthtype = 'basic') { - $this->setHeader('Proxy-Authorization', ' Basic '.base64_encode($proxyusername.':'.$proxypassword)); - } - } else { - $this->debug('remove proxy'); - $proxy = null; - unsetHeader('Proxy-Authorization'); - } - } - - - /** - * Test if the given string starts with a header that is to be skipped. - * Skippable headers result from chunked transfer and proxy requests. - * - * @param string $data The string to check. - * @returns boolean Whether a skippable header was found. - * @access private - */ - function isSkippableCurlHeader(&$data) { - $skipHeaders = array( 'HTTP/1.1 100', - 'HTTP/1.0 301', - 'HTTP/1.1 301', - 'HTTP/1.0 302', - 'HTTP/1.1 302', - 'HTTP/1.0 401', - 'HTTP/1.1 401', - 'HTTP/1.0 200 Connection established'); - foreach ($skipHeaders as $hd) { - $prefix = substr($data, 0, strlen($hd)); - if ($prefix == $hd) return true; - } - - return false; - } - - /** - * decode a string that is encoded w/ "chunked' transfer encoding - * as defined in RFC2068 19.4.6 - * - * @param string $buffer - * @param string $lb - * @returns string - * @access public - * @deprecated - */ - function decodeChunked($buffer, $lb){ - // length := 0 - $length = 0; - $new = ''; - - // read chunk-size, chunk-extension (if any) and CRLF - // get the position of the linebreak - $chunkend = strpos($buffer, $lb); - if ($chunkend == FALSE) { - $this->debug('no linebreak found in decodeChunked'); - return $new; - } - $temp = substr($buffer,0,$chunkend); - $chunk_size = hexdec( trim($temp) ); - $chunkstart = $chunkend + strlen($lb); - // while (chunk-size > 0) { - while ($chunk_size > 0) { - $this->debug("chunkstart: $chunkstart chunk_size: $chunk_size"); - $chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size); - - // Just in case we got a broken connection - if ($chunkend == FALSE) { - $chunk = substr($buffer,$chunkstart); - // append chunk-data to entity-body - $new .= $chunk; - $length += strlen($chunk); - break; - } - - // read chunk-data and CRLF - $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart); - // append chunk-data to entity-body - $new .= $chunk; - // length := length + chunk-size - $length += strlen($chunk); - // read chunk-size and CRLF - $chunkstart = $chunkend + strlen($lb); - - $chunkend = strpos($buffer, $lb, $chunkstart) + strlen($lb); - if ($chunkend == FALSE) { - break; //Just in case we got a broken connection - } - $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart); - $chunk_size = hexdec( trim($temp) ); - $chunkstart = $chunkend; - } - return $new; - } - - /** - * Writes the payload, including HTTP headers, to $this->outgoing_payload. - * - * @param string $data HTTP body - * @param string $cookie_str data for HTTP Cookie header - * @return void - * @access private - */ - function buildPayload($data, $cookie_str = '') { - // Note: for cURL connections, $this->outgoing_payload is ignored, - // as is the Content-Length header, but these are still created as - // debugging guides. - - // add content-length header - if ($this->request_method != 'GET') { - $this->setHeader('Content-Length', strlen($data)); - } - - // start building outgoing payload: - if ($this->proxy) { - $uri = $this->url; - } else { - $uri = $this->uri; - } - $req = "$this->request_method $uri HTTP/$this->protocol_version"; - $this->debug("HTTP request: $req"); - $this->outgoing_payload = "$req\r\n"; - - // loop thru headers, serializing - foreach($this->outgoing_headers as $k => $v){ - $hdr = $k.': '.$v; - $this->debug("HTTP header: $hdr"); - $this->outgoing_payload .= "$hdr\r\n"; - } - - // add any cookies - if ($cookie_str != '') { - $hdr = 'Cookie: '.$cookie_str; - $this->debug("HTTP header: $hdr"); - $this->outgoing_payload .= "$hdr\r\n"; - } - - // header/body separator - $this->outgoing_payload .= "\r\n"; - - // add data - $this->outgoing_payload .= $data; - } - - /** - * sends the SOAP request via HTTP[S] - * - * @param string $data message data - * @param array $cookies cookies to send - * @return boolean true if OK, false if problem - * @access private - */ - function sendRequest($data, $cookies = NULL) { - // build cookie string - $cookie_str = $this->getCookiesForRequest($cookies, (($this->scheme == 'ssl') || ($this->scheme == 'https'))); - - // build payload - $this->buildPayload($data, $cookie_str); - - if ($this->io_method() == 'socket') { - // send payload - if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) { - $this->setError('couldn\'t write message data to socket'); - $this->debug('couldn\'t write message data to socket'); - return false; - } - $this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload)); - return true; - } else if ($this->io_method() == 'curl') { - // set payload - // cURL does say this should only be the verb, and in fact it - // turns out that the URI and HTTP version are appended to this, which - // some servers refuse to work with (so we no longer use this method!) - //$this->setCurlOption(CURLOPT_CUSTOMREQUEST, $this->outgoing_payload); - $curl_headers = array(); - foreach($this->outgoing_headers as $k => $v){ - if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || $k == 'Authorization' || $k == 'Proxy-Authorization') { - $this->debug("Skip cURL header $k: $v"); - } else { - $curl_headers[] = "$k: $v"; - } - } - if ($cookie_str != '') { - $curl_headers[] = 'Cookie: ' . $cookie_str; - } - $this->setCurlOption(CURLOPT_HTTPHEADER, $curl_headers); - $this->debug('set cURL HTTP headers'); - if ($this->request_method == "POST") { - $this->setCurlOption(CURLOPT_POST, 1); - $this->setCurlOption(CURLOPT_POSTFIELDS, $data); - $this->debug('set cURL POST data'); - } else { - } - // insert custom user-set cURL options - foreach ($this->ch_options as $key => $val) { - $this->setCurlOption($key, $val); - } - - $this->debug('set cURL payload'); - return true; - } - } - - /** - * gets the SOAP response via HTTP[S] - * - * @return string the response (also sets member variables like incoming_payload) - * @access private - */ - function getResponse(){ - $this->incoming_payload = ''; - - if ($this->io_method() == 'socket') { - // loop until headers have been retrieved - $data = ''; - while (!isset($lb)){ - - // We might EOF during header read. - if(feof($this->fp)) { - $this->incoming_payload = $data; - $this->debug('found no headers before EOF after length ' . strlen($data)); - $this->debug("received before EOF:\n" . $data); - $this->setError('server failed to send headers'); - return false; - } - - $tmp = fgets($this->fp, 256); - $tmplen = strlen($tmp); - $this->debug("read line of $tmplen bytes: " . trim($tmp)); - - if ($tmplen == 0) { - $this->incoming_payload = $data; - $this->debug('socket read of headers timed out after length ' . strlen($data)); - $this->debug("read before timeout: " . $data); - $this->setError('socket read of headers timed out'); - return false; - } - - $data .= $tmp; - $pos = strpos($data,"\r\n\r\n"); - if($pos > 1){ - $lb = "\r\n"; - } else { - $pos = strpos($data,"\n\n"); - if($pos > 1){ - $lb = "\n"; - } - } - // remove 100 headers - if (isset($lb) && preg_match('/^HTTP\/1.1 100/',$data)) { - unset($lb); - $data = ''; - }// - } - // store header data - $this->incoming_payload .= $data; - $this->debug('found end of headers after length ' . strlen($data)); - // process headers - $header_data = trim(substr($data,0,$pos)); - $header_array = explode($lb,$header_data); - $this->incoming_headers = array(); - $this->incoming_cookies = array(); - foreach($header_array as $header_line){ - $arr = explode(':',$header_line, 2); - if(count($arr) > 1){ - $header_name = strtolower(trim($arr[0])); - $this->incoming_headers[$header_name] = trim($arr[1]); - if ($header_name == 'set-cookie') { - // TODO: allow multiple cookies from parseCookie - $cookie = $this->parseCookie(trim($arr[1])); - if ($cookie) { - $this->incoming_cookies[] = $cookie; - $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); - } else { - $this->debug('did not find cookie in ' . trim($arr[1])); - } - } - } else if (isset($header_name)) { - // append continuation line to previous header - $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; - } - } - - // loop until msg has been received - if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') { - $content_length = 2147483647; // ignore any content-length header - $chunked = true; - $this->debug("want to read chunked content"); - } elseif (isset($this->incoming_headers['content-length'])) { - $content_length = $this->incoming_headers['content-length']; - $chunked = false; - $this->debug("want to read content of length $content_length"); - } else { - $content_length = 2147483647; - $chunked = false; - $this->debug("want to read content to EOF"); - } - $data = ''; - do { - if ($chunked) { - $tmp = fgets($this->fp, 256); - $tmplen = strlen($tmp); - $this->debug("read chunk line of $tmplen bytes"); - if ($tmplen == 0) { - $this->incoming_payload = $data; - $this->debug('socket read of chunk length timed out after length ' . strlen($data)); - $this->debug("read before timeout:\n" . $data); - $this->setError('socket read of chunk length timed out'); - return false; - } - $content_length = hexdec(trim($tmp)); - $this->debug("chunk length $content_length"); - } - $strlen = 0; - while (($strlen < $content_length) && (!feof($this->fp))) { - $readlen = min(8192, $content_length - $strlen); - $tmp = fread($this->fp, $readlen); - $tmplen = strlen($tmp); - $this->debug("read buffer of $tmplen bytes"); - if (($tmplen == 0) && (!feof($this->fp))) { - $this->incoming_payload = $data; - $this->debug('socket read of body timed out after length ' . strlen($data)); - $this->debug("read before timeout:\n" . $data); - $this->setError('socket read of body timed out'); - return false; - } - $strlen += $tmplen; - $data .= $tmp; - } - if ($chunked && ($content_length > 0)) { - $tmp = fgets($this->fp, 256); - $tmplen = strlen($tmp); - $this->debug("read chunk terminator of $tmplen bytes"); - if ($tmplen == 0) { - $this->incoming_payload = $data; - $this->debug('socket read of chunk terminator timed out after length ' . strlen($data)); - $this->debug("read before timeout:\n" . $data); - $this->setError('socket read of chunk terminator timed out'); - return false; - } - } - } while ($chunked && ($content_length > 0) && (!feof($this->fp))); - if (feof($this->fp)) { - $this->debug('read to EOF'); - } - $this->debug('read body of length ' . strlen($data)); - $this->incoming_payload .= $data; - $this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server'); - - // close filepointer - if( - (isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') || - (! $this->persistentConnection) || feof($this->fp)){ - fclose($this->fp); - $this->fp = false; - $this->debug('closed socket'); - } - - // connection was closed unexpectedly - if($this->incoming_payload == ''){ - $this->setError('no response from server'); - return false; - } - - // decode transfer-encoding -// if(isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked'){ -// if(!$data = $this->decodeChunked($data, $lb)){ -// $this->setError('Decoding of chunked data failed'); -// return false; -// } - //print "
    \nde-chunked:\n---------------\n$data\n\n---------------\n
    "; - // set decoded payload -// $this->incoming_payload = $header_data.$lb.$lb.$data; -// } - - } else if ($this->io_method() == 'curl') { - // send and receive - $this->debug('send and receive with cURL'); - $this->incoming_payload = curl_exec($this->ch); - $data = $this->incoming_payload; - - $cErr = curl_error($this->ch); - if ($cErr != '') { - $err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'
    '; - // TODO: there is a PHP bug that can cause this to SEGV for CURLINFO_CONTENT_TYPE - foreach(curl_getinfo($this->ch) as $k => $v){ - $err .= "$k: $v
    "; - } - $this->debug($err); - $this->setError($err); - curl_close($this->ch); - return false; - } else { - //echo '
    ';
    -			//var_dump(curl_getinfo($this->ch));
    -			//echo '
    '; - } - // close curl - $this->debug('No cURL error, closing cURL'); - curl_close($this->ch); - - // try removing skippable headers - $savedata = $data; - while ($this->isSkippableCurlHeader($data)) { - $this->debug("Found HTTP header to skip"); - if ($pos = strpos($data,"\r\n\r\n")) { - $data = ltrim(substr($data,$pos)); - } elseif($pos = strpos($data,"\n\n") ) { - $data = ltrim(substr($data,$pos)); - } - } - - if ($data == '') { - // have nothing left; just remove 100 header(s) - $data = $savedata; - while (preg_match('/^HTTP\/1.1 100/',$data)) { - if ($pos = strpos($data,"\r\n\r\n")) { - $data = ltrim(substr($data,$pos)); - } elseif($pos = strpos($data,"\n\n") ) { - $data = ltrim(substr($data,$pos)); - } - } - } - - // separate content from HTTP headers - if ($pos = strpos($data,"\r\n\r\n")) { - $lb = "\r\n"; - } elseif( $pos = strpos($data,"\n\n")) { - $lb = "\n"; - } else { - $this->debug('no proper separation of headers and document'); - $this->setError('no proper separation of headers and document'); - return false; - } - $header_data = trim(substr($data,0,$pos)); - $header_array = explode($lb,$header_data); - $data = ltrim(substr($data,$pos)); - $this->debug('found proper separation of headers and document'); - $this->debug('cleaned data, stringlen: '.strlen($data)); - // clean headers - foreach ($header_array as $header_line) { - $arr = explode(':',$header_line,2); - if(count($arr) > 1){ - $header_name = strtolower(trim($arr[0])); - $this->incoming_headers[$header_name] = trim($arr[1]); - if ($header_name == 'set-cookie') { - // TODO: allow multiple cookies from parseCookie - $cookie = $this->parseCookie(trim($arr[1])); - if ($cookie) { - $this->incoming_cookies[] = $cookie; - $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); - } else { - $this->debug('did not find cookie in ' . trim($arr[1])); - } - } - } else if (isset($header_name)) { - // append continuation line to previous header - $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; - } - } - } - - $this->response_status_line = $header_array[0]; - $arr = explode(' ', $this->response_status_line, 3); - $http_version = $arr[0]; - $http_status = (int)($arr[1]); - $http_reason = count($arr) > 2 ? $arr[2] : ''; - - // see if we need to resend the request with http digest authentication - if (isset($this->incoming_headers['location']) && ($http_status == 301 || $http_status == 302)) { - $this->debug("Got $http_status $http_reason with Location: " . $this->incoming_headers['location']); - $this->setURL($this->incoming_headers['location']); - $this->tryagain = true; - return false; - } - - // see if we need to resend the request with http digest authentication - if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) { - $this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authenticate']); - if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) { - $this->debug('Server wants digest authentication'); - // remove "Digest " from our elements - $digestString = str_replace('Digest ', '', $this->incoming_headers['www-authenticate']); - - // parse elements into array - $digestElements = explode(',', $digestString); - foreach ($digestElements as $val) { - $tempElement = explode('=', trim($val), 2); - $digestRequest[$tempElement[0]] = str_replace("\"", '', $tempElement[1]); - } - - // should have (at least) qop, realm, nonce - if (isset($digestRequest['nonce'])) { - $this->setCredentials($this->username, $this->password, 'digest', $digestRequest); - $this->tryagain = true; - return false; - } - } - $this->debug('HTTP authentication failed'); - $this->setError('HTTP authentication failed'); - return false; - } - - if ( - ($http_status >= 300 && $http_status <= 307) || - ($http_status >= 400 && $http_status <= 417) || - ($http_status >= 501 && $http_status <= 505) - ) { - $this->setError("Unsupported HTTP response status $http_status $http_reason (soapclient->response has contents of the response)"); - return false; - } - - // decode content-encoding - if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){ - if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){ - // if decoding works, use it. else assume data wasn't gzencoded - if(function_exists('gzinflate')){ - //$timer->setMarker('starting decoding of gzip/deflated content'); - // IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress) - // this means there are no Zlib headers, although there should be - $this->debug('The gzinflate function exists'); - $datalen = strlen($data); - if ($this->incoming_headers['content-encoding'] == 'deflate') { - if ($degzdata = @gzinflate($data)) { - $data = $degzdata; - $this->debug('The payload has been inflated to ' . strlen($data) . ' bytes'); - if (strlen($data) < $datalen) { - // test for the case that the payload has been compressed twice - $this->debug('The inflated payload is smaller than the gzipped one; try again'); - if ($degzdata = @gzinflate($data)) { - $data = $degzdata; - $this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes'); - } - } - } else { - $this->debug('Error using gzinflate to inflate the payload'); - $this->setError('Error using gzinflate to inflate the payload'); - } - } elseif ($this->incoming_headers['content-encoding'] == 'gzip') { - if ($degzdata = @gzinflate(substr($data, 10))) { // do our best - $data = $degzdata; - $this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes'); - if (strlen($data) < $datalen) { - // test for the case that the payload has been compressed twice - $this->debug('The un-gzipped payload is smaller than the gzipped one; try again'); - if ($degzdata = @gzinflate(substr($data, 10))) { - $data = $degzdata; - $this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes'); - } - } - } else { - $this->debug('Error using gzinflate to un-gzip the payload'); - $this->setError('Error using gzinflate to un-gzip the payload'); - } - } - //$timer->setMarker('finished decoding of gzip/deflated content'); - //print "\nde-inflated:\n---------------\n$data\n-------------\n"; - // set decoded payload - $this->incoming_payload = $header_data.$lb.$lb.$data; - } else { - $this->debug('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.'); - $this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.'); - } - } else { - $this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); - $this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); - } - } else { - $this->debug('No Content-Encoding header'); - } - - if(strlen($data) == 0){ - $this->debug('no data after headers!'); - $this->setError('no data present after HTTP headers'); - return false; - } - - return $data; - } - - /** - * sets the content-type for the SOAP message to be sent - * - * @param string $type the content type, MIME style - * @param mixed $charset character set used for encoding (or false) - * @access public - */ - function setContentType($type, $charset = false) { - $this->setHeader('Content-Type', $type . ($charset ? '; charset=' . $charset : '')); - } - - /** - * specifies that an HTTP persistent connection should be used - * - * @return boolean whether the request was honored by this method. - * @access public - */ - function usePersistentConnection(){ - if (isset($this->outgoing_headers['Accept-Encoding'])) { - return false; - } - $this->protocol_version = '1.1'; - $this->persistentConnection = true; - $this->setHeader('Connection', 'Keep-Alive'); - return true; - } - - /** - * parse an incoming Cookie into it's parts - * - * @param string $cookie_str content of cookie - * @return array with data of that cookie - * @access private - */ - /* - * TODO: allow a Set-Cookie string to be parsed into multiple cookies - */ - function parseCookie($cookie_str) { - $cookie_str = str_replace('; ', ';', $cookie_str) . ';'; - $data = preg_split('/;/', $cookie_str); - $value_str = $data[0]; - - $cookie_param = 'domain='; - $start = strpos($cookie_str, $cookie_param); - if ($start > 0) { - $domain = substr($cookie_str, $start + strlen($cookie_param)); - $domain = substr($domain, 0, strpos($domain, ';')); - } else { - $domain = ''; - } - - $cookie_param = 'expires='; - $start = strpos($cookie_str, $cookie_param); - if ($start > 0) { - $expires = substr($cookie_str, $start + strlen($cookie_param)); - $expires = substr($expires, 0, strpos($expires, ';')); - } else { - $expires = ''; - } - - $cookie_param = 'path='; - $start = strpos($cookie_str, $cookie_param); - if ( $start > 0 ) { - $path = substr($cookie_str, $start + strlen($cookie_param)); - $path = substr($path, 0, strpos($path, ';')); - } else { - $path = '/'; - } - - $cookie_param = ';secure;'; - if (strpos($cookie_str, $cookie_param) !== FALSE) { - $secure = true; - } else { - $secure = false; - } - - $sep_pos = strpos($value_str, '='); - - if ($sep_pos) { - $name = substr($value_str, 0, $sep_pos); - $value = substr($value_str, $sep_pos + 1); - $cookie= array( 'name' => $name, - 'value' => $value, - 'domain' => $domain, - 'path' => $path, - 'expires' => $expires, - 'secure' => $secure - ); - return $cookie; - } - return false; - } - - /** - * sort out cookies for the current request - * - * @param array $cookies array with all cookies - * @param boolean $secure is the send-content secure or not? - * @return string for Cookie-HTTP-Header - * @access private - */ - function getCookiesForRequest($cookies, $secure=false) { - $cookie_str = ''; - if ((! is_null($cookies)) && (is_array($cookies))) { - foreach ($cookies as $cookie) { - if (! is_array($cookie)) { - continue; - } - $this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']); - if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) { - if (strtotime($cookie['expires']) <= time()) { - $this->debug('cookie has expired'); - continue; - } - } - if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) { - $domain = preg_quote($cookie['domain']); - if (! preg_match("'.*$domain$'i", $this->host)) { - $this->debug('cookie has different domain'); - continue; - } - } - if ((isset($cookie['path'])) && (! empty($cookie['path']))) { - $path = preg_quote($cookie['path']); - if (! preg_match("'^$path.*'i", $this->path)) { - $this->debug('cookie is for a different path'); - continue; - } - } - if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) { - $this->debug('cookie is secure, transport is not'); - continue; - } - $cookie_str .= $cookie['name'] . '=' . $cookie['value'] . '; '; - $this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']); - } - } - return $cookie_str; - } -} - - diff --git a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_val.php b/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_val.php deleted file mode 100755 index 9287e0861..000000000 --- a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soap_val.php +++ /dev/null @@ -1,106 +0,0 @@ - -* @version $Id: class.soap_val.php 6844 2011-06-03 14:46:51Z dMetzger $ -* @access public -*/ -class soapval extends nusoap_base { - /** - * The XML element name - * - * @var string - * @access private - */ - var $name; - /** - * The XML type name (string or false) - * - * @var mixed - * @access private - */ - var $type; - /** - * The PHP value - * - * @var mixed - * @access private - */ - var $value; - /** - * The XML element namespace (string or false) - * - * @var mixed - * @access private - */ - var $element_ns; - /** - * The XML type namespace (string or false) - * - * @var mixed - * @access private - */ - var $type_ns; - /** - * The XML element attributes (array or false) - * - * @var mixed - * @access private - */ - var $attributes; - - /** - * constructor - * - * @param string $name optional name - * @param mixed $type optional type name - * @param mixed $value optional value - * @param mixed $element_ns optional namespace of value - * @param mixed $type_ns optional namespace of type - * @param mixed $attributes associative array of attributes to add to element serialization - * @access public - */ - function soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) { - parent::nusoap_base(); - $this->name = $name; - $this->type = $type; - $this->value = $value; - $this->element_ns = $element_ns; - $this->type_ns = $type_ns; - $this->attributes = $attributes; - } - - /** - * return serialized value - * - * @param string $use The WSDL use value (encoded|literal) - * @return string XML data - * @access public - */ - function serialize($use='encoded') { - return $this->serialize_val($this->value, $this->name, $this->type, $this->element_ns, $this->type_ns, $this->attributes, $use, true); - } - - /** - * decodes a soapval object into a PHP native type - * - * @return mixed - * @access public - */ - function decode(){ - return $this->value; - } -} - - - - diff --git a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soapclient.php b/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soapclient.php deleted file mode 100755 index c21822967..000000000 --- a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.soapclient.php +++ /dev/null @@ -1,991 +0,0 @@ -call( string methodname [ ,array parameters] ); -* -* // bye bye client -* unset($soapclient); -* -* @author Dietrich Ayala -* @author Scott Nichol -* @version $Id: class.soapclient.php 6844 2011-06-03 14:46:51Z dMetzger $ -* @access public -*/ -class nusoap_client extends nusoap_base { - - var $username = ''; // Username for HTTP authentication - var $password = ''; // Password for HTTP authentication - var $authtype = ''; // Type of HTTP authentication - var $certRequest = array(); // Certificate for HTTP SSL authentication - var $requestHeaders = false; // SOAP headers in request (text) - var $responseHeaders = ''; // SOAP headers from response (incomplete namespace resolution) (text) - var $responseHeader = NULL; // SOAP Header from response (parsed) - var $document = ''; // SOAP body response portion (incomplete namespace resolution) (text) - var $endpoint; - var $forceEndpoint = ''; // overrides WSDL endpoint - var $proxyhost = ''; - var $proxyport = ''; - var $proxyusername = ''; - var $proxypassword = ''; - var $portName = ''; // port name to use in WSDL - var $xml_encoding = ''; // character set encoding of incoming (response) messages - var $http_encoding = false; - var $timeout = 0; // HTTP connection timeout - var $response_timeout = 30; // HTTP response timeout - var $endpointType = ''; // soap|wsdl, empty for WSDL initialization error - var $persistentConnection = false; - var $defaultRpcParams = false; // This is no longer used - var $request = ''; // HTTP request - var $response = ''; // HTTP response - var $responseData = ''; // SOAP payload of response - var $cookies = array(); // Cookies from response or for request - var $decode_utf8 = true; // toggles whether the parser decodes element content w/ utf8_decode() - var $operations = array(); // WSDL operations, empty for WSDL initialization error - var $curl_options = array(); // User-specified cURL options - var $bindingType = ''; // WSDL operation binding type - var $use_curl = false; // whether to always try to use cURL - - /* - * fault related variables - */ - /** - * @var fault - * @access public - */ - var $fault; - /** - * @var faultcode - * @access public - */ - var $faultcode; - /** - * @var faultstring - * @access public - */ - var $faultstring; - /** - * @var faultdetail - * @access public - */ - var $faultdetail; - - /** - * constructor - * - * @param mixed $endpoint SOAP server or WSDL URL (string), or wsdl instance (object) - * @param mixed $wsdl optional, set to 'wsdl' or true if using WSDL - * @param string $proxyhost optional - * @param string $proxyport optional - * @param string $proxyusername optional - * @param string $proxypassword optional - * @param integer $timeout set the connection timeout - * @param integer $response_timeout set the response timeout - * @param string $portName optional portName in WSDL document - * @access public - */ - function nusoap_client($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){ - parent::nusoap_base(); - $this->endpoint = $endpoint; - $this->proxyhost = $proxyhost; - $this->proxyport = $proxyport; - $this->proxyusername = $proxyusername; - $this->proxypassword = $proxypassword; - $this->timeout = $timeout; - $this->response_timeout = $response_timeout; - $this->portName = $portName; - - $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); - $this->appendDebug('endpoint=' . $this->varDump($endpoint)); - - // make values - if($wsdl){ - if (is_object($endpoint) && (get_class($endpoint) == 'wsdl')) { - $this->wsdl = $endpoint; - $this->endpoint = $this->wsdl->wsdl; - $this->wsdlFile = $this->endpoint; - $this->debug('existing wsdl instance created from ' . $this->endpoint); - $this->checkWSDL(); - } else { - $this->wsdlFile = $this->endpoint; - $this->wsdl = null; - $this->debug('will use lazy evaluation of wsdl from ' . $this->endpoint); - } - $this->endpointType = 'wsdl'; - } else { - $this->debug("instantiate SOAP with endpoint at $endpoint"); - $this->endpointType = 'soap'; - } - } - - /** - * calls method, returns PHP native type - * - * @param string $operation SOAP server URL or path - * @param mixed $params An array, associative or simple, of the parameters - * for the method call, or a string that is the XML - * for the call. For rpc style, this call will - * wrap the XML in a tag named after the method, as - * well as the SOAP Envelope and Body. For document - * style, this will only wrap with the Envelope and Body. - * IMPORTANT: when using an array with document style, - * in which case there - * is really one parameter, the root of the fragment - * used in the call, which encloses what programmers - * normally think of parameters. A parameter array - * *must* include the wrapper. - * @param string $namespace optional method namespace (WSDL can override) - * @param string $soapAction optional SOAPAction value (WSDL can override) - * @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array - * @param boolean $rpcParams optional (no longer used) - * @param string $style optional (rpc|document) the style to use when serializing parameters (WSDL can override) - * @param string $use optional (encoded|literal) the use when serializing parameters (WSDL can override) - * @return mixed response from SOAP call, normally an associative array mirroring the structure of the XML response, false for certain fatal errors - * @access public - */ - function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAction='',$headers=false,$rpcParams=null,$style='rpc',$use='encoded'){ - $this->operation = $operation; - $this->fault = false; - $this->setError(''); - $this->request = ''; - $this->response = ''; - $this->responseData = ''; - $this->faultstring = ''; - $this->faultcode = ''; - $this->opData = array(); - - $this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType"); - $this->appendDebug('params=' . $this->varDump($params)); - $this->appendDebug('headers=' . $this->varDump($headers)); - if ($headers) { - $this->requestHeaders = $headers; - } - if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { - $this->loadWSDL(); - if ($this->getError()) - return false; - } - // serialize parameters - if($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)){ - // use WSDL for operation - $this->opData = $opData; - $this->debug("found operation"); - $this->appendDebug('opData=' . $this->varDump($opData)); - if (isset($opData['soapAction'])) { - $soapAction = $opData['soapAction']; - } - if (! $this->forceEndpoint) { - $this->endpoint = $opData['endpoint']; - } else { - $this->endpoint = $this->forceEndpoint; - } - $namespace = isset($opData['input']['namespace']) ? $opData['input']['namespace'] : $namespace; - $style = $opData['style']; - $use = $opData['input']['use']; - // add ns to ns array - if($namespace != '' && !isset($this->wsdl->namespaces[$namespace])){ - $nsPrefix = 'ns' . rand(1000, 9999); - $this->wsdl->namespaces[$nsPrefix] = $namespace; - } - $nsPrefix = $this->wsdl->getPrefixFromNamespace($namespace); - // serialize payload - if (is_string($params)) { - $this->debug("serializing param string for WSDL operation $operation"); - $payload = $params; - } elseif (is_array($params)) { - $this->debug("serializing param array for WSDL operation $operation"); - $payload = $this->wsdl->serializeRPCParameters($operation,'input',$params,$this->bindingType); - } else { - $this->debug('params must be array or string'); - $this->setError('params must be array or string'); - return false; - } - $usedNamespaces = $this->wsdl->usedNamespaces; - if (isset($opData['input']['encodingStyle'])) { - $encodingStyle = $opData['input']['encodingStyle']; - } else { - $encodingStyle = ''; - } - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - if ($errstr = $this->wsdl->getError()) { - $this->debug('got wsdl error: '.$errstr); - $this->setError('wsdl error: '.$errstr); - return false; - } - } elseif($this->endpointType == 'wsdl') { - // operation not in WSDL - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->setError('operation '.$operation.' not present in WSDL.'); - $this->debug("operation '$operation' not present in WSDL."); - return false; - } else { - // no WSDL - //$this->namespaces['ns1'] = $namespace; - $nsPrefix = 'ns' . rand(1000, 9999); - // serialize - $payload = ''; - if (is_string($params)) { - $this->debug("serializing param string for operation $operation"); - $payload = $params; - } elseif (is_array($params)) { - $this->debug("serializing param array for operation $operation"); - foreach($params as $k => $v){ - $payload .= $this->serialize_val($v,$k,false,false,false,false,$use); - } - } else { - $this->debug('params must be array or string'); - $this->setError('params must be array or string'); - return false; - } - $usedNamespaces = array(); - if ($use == 'encoded') { - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - } else { - $encodingStyle = ''; - } - } - // wrap RPC calls with method element - if ($style == 'rpc') { - if ($use == 'literal') { - $this->debug("wrapping RPC request with literal method element"); - if ($namespace) { - // http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace - $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" . - $payload . - ""; - } else { - $payload = "<$operation>" . $payload . ""; - } - } else { - $this->debug("wrapping RPC request with encoded method element"); - if ($namespace) { - $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" . - $payload . - ""; - } else { - $payload = "<$operation>" . - $payload . - ""; - } - } - } - // serialize envelope - $soapmsg = $this->serializeEnvelope($payload,$this->requestHeaders,$usedNamespaces,$style,$use,$encodingStyle); - $this->debug("endpoint=$this->endpoint, soapAction=$soapAction, namespace=$namespace, style=$style, use=$use, encodingStyle=$encodingStyle"); - $this->debug('SOAP message length=' . strlen($soapmsg) . ' contents (max 1000 bytes)=' . substr($soapmsg, 0, 1000)); - // send - $return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_timeout); - if($errstr = $this->getError()){ - $this->debug('Error: '.$errstr); - return false; - } else { - $this->return = $return; - $this->debug('sent message successfully and got a(n) '.gettype($return)); - $this->appendDebug('return=' . $this->varDump($return)); - - // fault? - if(is_array($return) && isset($return['faultcode'])){ - $this->debug('got fault'); - $this->setError($return['faultcode'].': '.$return['faultstring']); - $this->fault = true; - foreach($return as $k => $v){ - $this->$k = $v; - $this->debug("$k = $v
    "); - } - return $return; - } elseif ($style == 'document') { - // NOTE: if the response is defined to have multiple parts (i.e. unwrapped), - // we are only going to return the first part here...sorry about that - return $return; - } else { - // array of return values - if(is_array($return)){ - // multiple 'out' parameters, which we return wrapped up - // in the array - if(sizeof($return) > 1){ - return $return; - } - // single 'out' parameter (normally the return value) - $return = array_shift($return); - $this->debug('return shifted value: '); - $this->appendDebug($this->varDump($return)); - return $return; - // nothing returned (ie, echoVoid) - } else { - return ""; - } - } - } - } - - /** - * check WSDL passed as an instance or pulled from an endpoint - * - * @access private - */ - function checkWSDL() { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->debug('checkWSDL'); - // catch errors - if ($errstr = $this->wsdl->getError()) { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->debug('got wsdl error: '.$errstr); - $this->setError('wsdl error: '.$errstr); - } elseif ($this->operations = $this->wsdl->getOperations($this->portName, 'soap')) { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->bindingType = 'soap'; - $this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for binding type '.$this->bindingType); - } elseif ($this->operations = $this->wsdl->getOperations($this->portName, 'soap12')) { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->bindingType = 'soap12'; - $this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for binding type '.$this->bindingType); - $this->debug('**************** WARNING: SOAP 1.2 BINDING *****************'); - } else { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->debug('getOperations returned false'); - $this->setError('no operations defined in the WSDL document!'); - } - } - - /** - * instantiate wsdl object and parse wsdl file - * - * @access public - */ - function loadWSDL() { - $this->debug('instantiating wsdl class with doc: '.$this->wsdlFile); - $this->wsdl = new wsdl('',$this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword,$this->timeout,$this->response_timeout,$this->curl_options,$this->use_curl); - $this->wsdl->setCredentials($this->username, $this->password, $this->authtype, $this->certRequest); - $this->wsdl->fetchWSDL($this->wsdlFile); - $this->checkWSDL(); - } - - /** - * get available data pertaining to an operation - * - * @param string $operation operation name - * @return array array of data pertaining to the operation - * @access public - */ - function getOperationData($operation){ - if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { - $this->loadWSDL(); - if ($this->getError()) - return false; - } - if(isset($this->operations[$operation])){ - return $this->operations[$operation]; - } - $this->debug("No data for operation: $operation"); - } - - /** - * send the SOAP message - * - * Note: if the operation has multiple return values - * the return value of this method will be an array - * of those values. - * - * @param string $msg a SOAPx4 soapmsg object - * @param string $soapaction SOAPAction value - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @return mixed native PHP types. - * @access private - */ - function send($msg, $soapaction = '', $timeout=0, $response_timeout=30) { - $this->checkCookies(); - // detect transport - switch(true){ - // http(s) - case preg_match('/^http/',$this->endpoint): - $this->debug('transporting via HTTP'); - if($this->persistentConnection == true && is_object($this->persistentConnection)){ - $http =& $this->persistentConnection; - } else { - $http = new soap_transport_http($this->endpoint, $this->curl_options, $this->use_curl); - if ($this->persistentConnection) { - $http->usePersistentConnection(); - } - } - $http->setContentType($this->getHTTPContentType(), $this->getHTTPContentTypeCharset()); - $http->setSOAPAction($soapaction); - if($this->proxyhost && $this->proxyport){ - $http->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword); - } - if($this->authtype != '') { - $http->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest); - } - if($this->http_encoding != ''){ - $http->setEncoding($this->http_encoding); - } - $this->debug('sending message, length='.strlen($msg)); - if(preg_match('/^http:/',$this->endpoint)){ - //if(strpos($this->endpoint,'http:')){ - $this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies); - } elseif(preg_match('/^https/',$this->endpoint)){ - //} elseif(strpos($this->endpoint,'https:')){ - //if(phpversion() == '4.3.0-dev'){ - //$response = $http->send($msg,$timeout,$response_timeout); - //$this->request = $http->outgoing_payload; - //$this->response = $http->incoming_payload; - //} else - $this->responseData = $http->sendHTTPS($msg,$timeout,$response_timeout,$this->cookies); - } else { - $this->setError('no http/s in endpoint url'); - } - $this->request = $http->outgoing_payload; - $this->response = $http->incoming_payload; - $this->appendDebug($http->getDebug()); - $this->UpdateCookies($http->incoming_cookies); - - // save transport object if using persistent connections - if ($this->persistentConnection) { - $http->clearDebug(); - if (!is_object($this->persistentConnection)) { - $this->persistentConnection = $http; - } - } - - if($err = $http->getError()){ - $this->setError('HTTP Error: '.$err); - return false; - } elseif($this->getError()){ - return false; - } else { - $this->debug('got response, length='. strlen($this->responseData).' type='.$http->incoming_headers['content-type']); - return $this->parseResponse($http->incoming_headers, $this->responseData); - } - break; - default: - $this->setError('no transport found, or selected transport is not yet supported!'); - return false; - break; - } - } - - /** - * processes SOAP message returned from server - * - * @param array $headers The HTTP headers - * @param string $data unprocessed response data from server - * @return mixed value of the message, decoded into a PHP type - * @access private - */ - function parseResponse($headers, $data) { - $this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' headers:'); - $this->appendDebug($this->varDump($headers)); - if (!isset($headers['content-type'])) { - $this->setError('Response not of type text/xml (no content-type header)'); - return false; - } - if (!strstr($headers['content-type'], 'text/xml')) { - $this->setError('Response not of type text/xml: ' . $headers['content-type']); - return false; - } - if (strpos($headers['content-type'], '=')) { - $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1)); - $this->debug('Got response encoding: ' . $enc); - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser'); - $parser = new nusoap_parser($data,$this->xml_encoding,$this->operation,$this->decode_utf8); - // add parser debug data to our debug - $this->appendDebug($parser->getDebug()); - // if parse errors - if($errstr = $parser->getError()){ - $this->setError( $errstr); - // destroy the parser object - unset($parser); - return false; - } else { - // get SOAP headers - $this->responseHeaders = $parser->getHeaders(); - // get SOAP headers - $this->responseHeader = $parser->get_soapheader(); - // get decoded message - $return = $parser->get_soapbody(); - // add document for doclit support - $this->document = $parser->document; - // destroy the parser object - unset($parser); - // return decode message - return $return; - } - } - - /** - * sets user-specified cURL options - * - * @param mixed $option The cURL option (always integer?) - * @param mixed $value The cURL option value - * @access public - */ - function setCurlOption($option, $value) { - $this->debug("setCurlOption option=$option, value="); - $this->appendDebug($this->varDump($value)); - $this->curl_options[$option] = $value; - } - - /** - * sets the SOAP endpoint, which can override WSDL - * - * @param string $endpoint The endpoint URL to use, or empty string or false to prevent override - * @access public - */ - function setEndpoint($endpoint) { - $this->debug("setEndpoint(\"$endpoint\")"); - $this->forceEndpoint = $endpoint; - } - - /** - * set the SOAP headers - * - * @param mixed $headers String of XML with SOAP header content, or array of soapval objects for SOAP headers - * @access public - */ - function setHeaders($headers){ - $this->debug("setHeaders headers="); - $this->appendDebug($this->varDump($headers)); - $this->requestHeaders = $headers; - } - - /** - * get the SOAP response headers (namespace resolution incomplete) - * - * @return string - * @access public - */ - function getHeaders(){ - return $this->responseHeaders; - } - - /** - * get the SOAP response Header (parsed) - * - * @return mixed - * @access public - */ - function getHeader(){ - return $this->responseHeader; - } - - /** - * set proxy info here - * - * @param string $proxyhost - * @param string $proxyport - * @param string $proxyusername - * @param string $proxypassword - * @access public - */ - function setHTTPProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '') { - $this->proxyhost = $proxyhost; - $this->proxyport = $proxyport; - $this->proxyusername = $proxyusername; - $this->proxypassword = $proxypassword; - } - - /** - * if authenticating, set user credentials here - * - * @param string $username - * @param string $password - * @param string $authtype (basic|digest|certificate|ntlm) - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) - * @access public - */ - function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) { - $this->debug("setCredentials username=$username authtype=$authtype certRequest="); - $this->appendDebug($this->varDump($certRequest)); - $this->username = $username; - $this->password = $password; - $this->authtype = $authtype; - $this->certRequest = $certRequest; - } - - /** - * use HTTP encoding - * - * @param string $enc HTTP encoding - * @access public - */ - function setHTTPEncoding($enc='gzip, deflate'){ - $this->debug("setHTTPEncoding(\"$enc\")"); - $this->http_encoding = $enc; - } - - /** - * Set whether to try to use cURL connections if possible - * - * @param boolean $use Whether to try to use cURL - * @access public - */ - function setUseCURL($use) { - $this->debug("setUseCURL($use)"); - $this->use_curl = $use; - } - - /** - * use HTTP persistent connections if possible - * - * @access public - */ - function useHTTPPersistentConnection(){ - $this->debug("useHTTPPersistentConnection"); - $this->persistentConnection = true; - } - - /** - * gets the default RPC parameter setting. - * If true, default is that call params are like RPC even for document style. - * Each call() can override this value. - * - * This is no longer used. - * - * @return boolean - * @access public - * @deprecated - */ - function getDefaultRpcParams() { - return $this->defaultRpcParams; - } - - /** - * sets the default RPC parameter setting. - * If true, default is that call params are like RPC even for document style - * Each call() can override this value. - * - * This is no longer used. - * - * @param boolean $rpcParams - * @access public - * @deprecated - */ - function setDefaultRpcParams($rpcParams) { - $this->defaultRpcParams = $rpcParams; - } - - /** - * dynamically creates an instance of a proxy class, - * allowing user to directly call methods from wsdl - * - * @return object soap_proxy object - * @access public - */ - function getProxy() { - $r = rand(); - $evalStr = $this->_getProxyClassCode($r); - //$this->debug("proxy class: $evalStr"); - if ($this->getError()) { - $this->debug("Error from _getProxyClassCode, so return NULL"); - return null; - } - // eval the class - eval($evalStr); - // instantiate proxy object - eval("\$proxy = new nusoap_proxy_$r('');"); - // transfer current wsdl data to the proxy thereby avoiding parsing the wsdl twice - $proxy->endpointType = 'wsdl'; - $proxy->wsdlFile = $this->wsdlFile; - $proxy->wsdl = $this->wsdl; - $proxy->operations = $this->operations; - $proxy->defaultRpcParams = $this->defaultRpcParams; - // transfer other state - $proxy->soap_defencoding = $this->soap_defencoding; - $proxy->username = $this->username; - $proxy->password = $this->password; - $proxy->authtype = $this->authtype; - $proxy->certRequest = $this->certRequest; - $proxy->requestHeaders = $this->requestHeaders; - $proxy->endpoint = $this->endpoint; - $proxy->forceEndpoint = $this->forceEndpoint; - $proxy->proxyhost = $this->proxyhost; - $proxy->proxyport = $this->proxyport; - $proxy->proxyusername = $this->proxyusername; - $proxy->proxypassword = $this->proxypassword; - $proxy->http_encoding = $this->http_encoding; - $proxy->timeout = $this->timeout; - $proxy->response_timeout = $this->response_timeout; - $proxy->persistentConnection = &$this->persistentConnection; - $proxy->decode_utf8 = $this->decode_utf8; - $proxy->curl_options = $this->curl_options; - $proxy->bindingType = $this->bindingType; - $proxy->use_curl = $this->use_curl; - return $proxy; - } - - /** - * dynamically creates proxy class code - * - * @return string PHP/NuSOAP code for the proxy class - * @access private - */ - function _getProxyClassCode($r) { - $this->debug("in getProxy endpointType=$this->endpointType"); - $this->appendDebug("wsdl=" . $this->varDump($this->wsdl)); - if ($this->endpointType != 'wsdl') { - $evalStr = 'A proxy can only be created for a WSDL client'; - $this->setError($evalStr); - $evalStr = "echo \"$evalStr\";"; - return $evalStr; - } - if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { - $this->loadWSDL(); - if ($this->getError()) { - return "echo \"" . $this->getError() . "\";"; - } - } - $evalStr = ''; - foreach ($this->operations as $operation => $opData) { - if ($operation != '') { - // create param string and param comment string - if (sizeof($opData['input']['parts']) > 0) { - $paramStr = ''; - $paramArrayStr = ''; - $paramCommentStr = ''; - foreach ($opData['input']['parts'] as $name => $type) { - $paramStr .= "\$$name, "; - $paramArrayStr .= "'$name' => \$$name, "; - $paramCommentStr .= "$type \$$name, "; - } - $paramStr = substr($paramStr, 0, strlen($paramStr)-2); - $paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr)-2); - $paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr)-2); - } else { - $paramStr = ''; - $paramArrayStr = ''; - $paramCommentStr = 'void'; - } - $opData['namespace'] = !isset($opData['namespace']) ? 'http://testuri.com' : $opData['namespace']; - $evalStr .= "// $paramCommentStr - function " . str_replace('.', '__', $operation) . "($paramStr) { - \$params = array($paramArrayStr); - return \$this->call('$operation', \$params, '".$opData['namespace']."', '".(isset($opData['soapAction']) ? $opData['soapAction'] : '')."'); - } - "; - unset($paramStr); - unset($paramCommentStr); - } - } - $evalStr = 'class nusoap_proxy_'.$r.' extends nusoap_client { - '.$evalStr.' -}'; - return $evalStr; - } - - /** - * dynamically creates proxy class code - * - * @return string PHP/NuSOAP code for the proxy class - * @access public - */ - function getProxyClassCode() { - $r = rand(); - return $this->_getProxyClassCode($r); - } - - /** - * gets the HTTP body for the current request. - * - * @param string $soapmsg The SOAP payload - * @return string The HTTP body, which includes the SOAP payload - * @access private - */ - function getHTTPBody($soapmsg) { - return $soapmsg; - } - - /** - * gets the HTTP content type for the current request. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type for the current request. - * @access private - */ - function getHTTPContentType() { - return 'text/xml'; - } - - /** - * gets the HTTP content type charset for the current request. - * returns false for non-text content types. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type charset for the current request. - * @access private - */ - function getHTTPContentTypeCharset() { - return $this->soap_defencoding; - } - - /* - * whether or not parser should decode utf8 element content - * - * @return always returns true - * @access public - */ - function decodeUTF8($bool){ - $this->decode_utf8 = $bool; - return true; - } - - /** - * adds a new Cookie into $this->cookies array - * - * @param string $name Cookie Name - * @param string $value Cookie Value - * @return boolean if cookie-set was successful returns true, else false - * @access public - */ - function setCookie($name, $value) { - if (strlen($name) == 0) { - return false; - } - $this->cookies[] = array('name' => $name, 'value' => $value); - return true; - } - - /** - * gets all Cookies - * - * @return array with all internal cookies - * @access public - */ - function getCookies() { - return $this->cookies; - } - - /** - * checks all Cookies and delete those which are expired - * - * @return boolean always return true - * @access private - */ - function checkCookies() { - if (sizeof($this->cookies) == 0) { - return true; - } - $this->debug('checkCookie: check ' . sizeof($this->cookies) . ' cookies'); - $curr_cookies = $this->cookies; - $this->cookies = array(); - foreach ($curr_cookies as $cookie) { - if (! is_array($cookie)) { - $this->debug('Remove cookie that is not an array'); - continue; - } - if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) { - if (strtotime($cookie['expires']) > time()) { - $this->cookies[] = $cookie; - } else { - $this->debug('Remove expired cookie ' . $cookie['name']); - } - } else { - $this->cookies[] = $cookie; - } - } - $this->debug('checkCookie: '.sizeof($this->cookies).' cookies left in array'); - return true; - } - - /** - * updates the current cookies with a new set - * - * @param array $cookies new cookies with which to update current ones - * @return boolean always return true - * @access private - */ - function UpdateCookies($cookies) { - if (sizeof($this->cookies) == 0) { - // no existing cookies: take whatever is new - if (sizeof($cookies) > 0) { - $this->debug('Setting new cookie(s)'); - $this->cookies = $cookies; - } - return true; - } - if (sizeof($cookies) == 0) { - // no new cookies: keep what we've got - return true; - } - // merge - foreach ($cookies as $newCookie) { - if (!is_array($newCookie)) { - continue; - } - if ((!isset($newCookie['name'])) || (!isset($newCookie['value']))) { - continue; - } - $newName = $newCookie['name']; - - $found = false; - for ($i = 0; $i < count($this->cookies); $i++) { - $cookie = $this->cookies[$i]; - if (!is_array($cookie)) { - continue; - } - if (!isset($cookie['name'])) { - continue; - } - if ($newName != $cookie['name']) { - continue; - } - $newDomain = isset($newCookie['domain']) ? $newCookie['domain'] : 'NODOMAIN'; - $domain = isset($cookie['domain']) ? $cookie['domain'] : 'NODOMAIN'; - if ($newDomain != $domain) { - continue; - } - $newPath = isset($newCookie['path']) ? $newCookie['path'] : 'NOPATH'; - $path = isset($cookie['path']) ? $cookie['path'] : 'NOPATH'; - if ($newPath != $path) { - continue; - } - $this->cookies[$i] = $newCookie; - $found = true; - $this->debug('Update cookie ' . $newName . '=' . $newCookie['value']); - break; - } - if (! $found) { - $this->debug('Add cookie ' . $newName . '=' . $newCookie['value']); - $this->cookies[] = $newCookie; - } - } - return true; - } -} - -if (!extension_loaded('soap')) { - /** - * For backwards compatiblity, define soapclient unless the PHP SOAP extension is loaded. - */ - class soapclient extends nusoap_client { - } -} -?> diff --git a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.wsdl.php b/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.wsdl.php deleted file mode 100755 index d775098af..000000000 --- a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.wsdl.php +++ /dev/null @@ -1,1937 +0,0 @@ - -* @author Scott Nichol -* @version $Id: class.wsdl.php 6844 2011-06-03 14:46:51Z dMetzger $ -* @access public -*/ -class wsdl extends nusoap_base { - // URL or filename of the root of this WSDL - var $wsdl; - // define internal arrays of bindings, ports, operations, messages, etc. - var $schemas = array(); - var $currentSchema; - var $message = array(); - var $complexTypes = array(); - var $messages = array(); - var $currentMessage; - var $currentOperation; - var $portTypes = array(); - var $currentPortType; - var $bindings = array(); - var $currentBinding; - var $ports = array(); - var $currentPort; - var $opData = array(); - var $status = ''; - var $documentation = false; - var $endpoint = ''; - // array of wsdl docs to import - var $import = array(); - // parser vars - var $parser; - var $position = 0; - var $depth = 0; - var $depth_array = array(); - // for getting wsdl - var $proxyhost = ''; - var $proxyport = ''; - var $proxyusername = ''; - var $proxypassword = ''; - var $timeout = 0; - var $response_timeout = 30; - var $curl_options = array(); // User-specified cURL options - var $use_curl = false; // whether to always try to use cURL - // for HTTP authentication - var $username = ''; // Username for HTTP authentication - var $password = ''; // Password for HTTP authentication - var $authtype = ''; // Type of HTTP authentication - var $certRequest = array(); // Certificate for HTTP SSL authentication - - /** - * constructor - * - * @param string $wsdl WSDL document URL - * @param string $proxyhost - * @param string $proxyport - * @param string $proxyusername - * @param string $proxypassword - * @param integer $timeout set the connection timeout - * @param integer $response_timeout set the response timeout - * @param array $curl_options user-specified cURL options - * @param boolean $use_curl try to use cURL - * @access public - */ - function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){ - parent::nusoap_base(); - $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); - $this->proxyhost = $proxyhost; - $this->proxyport = $proxyport; - $this->proxyusername = $proxyusername; - $this->proxypassword = $proxypassword; - $this->timeout = $timeout; - $this->response_timeout = $response_timeout; - if (is_array($curl_options)) - $this->curl_options = $curl_options; - $this->use_curl = $use_curl; - $this->fetchWSDL($wsdl); - } - - /** - * fetches the WSDL document and parses it - * - * @access public - */ - function fetchWSDL($wsdl) { - $this->debug("parse and process WSDL path=$wsdl"); - $this->wsdl = $wsdl; - // parse wsdl file - if ($this->wsdl != "") { - $this->parseWSDL($this->wsdl); - } - // imports - // TODO: handle imports more properly, grabbing them in-line and nesting them - $imported_urls = array(); - $imported = 1; - while ($imported > 0) { - $imported = 0; - // Schema imports - foreach ($this->schemas as $ns => $list) { - foreach ($list as $xs) { - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! - foreach ($xs->imports as $ns2 => $list2) { - for ($ii = 0; $ii < count($list2); $ii++) { - if (! $list2[$ii]['loaded']) { - $this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true; - $url = $list2[$ii]['location']; - if ($url != '') { - $urlparts = parse_url($url); - if (!isset($urlparts['host'])) { - $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' .$wsdlparts['port'] : '') . - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; - } - if (! in_array($url, $imported_urls)) { - $this->parseWSDL($url); - $imported++; - $imported_urls[] = $url; - } - } else { - $this->debug("Unexpected scenario: empty URL for unloaded import"); - } - } - } - } - } - } - // WSDL imports - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! - foreach ($this->import as $ns => $list) { - for ($ii = 0; $ii < count($list); $ii++) { - if (! $list[$ii]['loaded']) { - $this->import[$ns][$ii]['loaded'] = true; - $url = $list[$ii]['location']; - if ($url != '') { - $urlparts = parse_url($url); - if (!isset($urlparts['host'])) { - $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') . - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; - } - if (! in_array($url, $imported_urls)) { - $this->parseWSDL($url); - $imported++; - $imported_urls[] = $url; - } - } else { - $this->debug("Unexpected scenario: empty URL for unloaded import"); - } - } - } - } - } - // add new data to operation data - foreach($this->bindings as $binding => $bindingData) { - if (isset($bindingData['operations']) && is_array($bindingData['operations'])) { - foreach($bindingData['operations'] as $operation => $data) { - $this->debug('post-parse data gathering for ' . $operation); - $this->bindings[$binding]['operations'][$operation]['input'] = - isset($this->bindings[$binding]['operations'][$operation]['input']) ? - array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) : - $this->portTypes[ $bindingData['portType'] ][$operation]['input']; - $this->bindings[$binding]['operations'][$operation]['output'] = - isset($this->bindings[$binding]['operations'][$operation]['output']) ? - array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) : - $this->portTypes[ $bindingData['portType'] ][$operation]['output']; - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){ - $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ]; - } - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){ - $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ]; - } - // Set operation style if necessary, but do not override one already provided - if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['style'])) { - $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style']; - } - $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : ''; - $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : ''; - $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : ''; - } - } - } - } - - /** - * parses the wsdl document - * - * @param string $wsdl path or URL - * @access private - */ - function parseWSDL($wsdl = '') { - $this->debug("parse WSDL at path=$wsdl"); - - if ($wsdl == '') { - $this->debug('no wsdl passed to parseWSDL()!!'); - $this->setError('no wsdl passed to parseWSDL()!!'); - return false; - } - - // parse $wsdl for url format - $wsdl_props = parse_url($wsdl); - - if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) { - $this->debug('getting WSDL http(s) URL ' . $wsdl); - // get wsdl - $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl); - $tr->request_method = 'GET'; - $tr->useSOAPAction = false; - if($this->proxyhost && $this->proxyport){ - $tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword); - } - if ($this->authtype != '') { - $tr->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest); - } - $tr->setEncoding('gzip, deflate'); - $wsdl_string = $tr->send('', $this->timeout, $this->response_timeout); - //$this->debug("WSDL request\n" . $tr->outgoing_payload); - //$this->debug("WSDL response\n" . $tr->incoming_payload); - $this->appendDebug($tr->getDebug()); - // catch errors - if($err = $tr->getError() ){ - $errstr = 'Getting ' . $wsdl . ' - HTTP ERROR: '.$err; - $this->debug($errstr); - $this->setError($errstr); - unset($tr); - return false; - } - unset($tr); - $this->debug("got WSDL URL"); - } else { - // $wsdl is not http(s), so treat it as a file URL or plain file path - if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) { - $path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path']; - } else { - $path = $wsdl; - } - $this->debug('getting WSDL file ' . $path); - if ($fp = @fopen($path, 'r')) { - $wsdl_string = ''; - while ($data = fread($fp, 32768)) { - $wsdl_string .= $data; - } - fclose($fp); - } else { - $errstr = "Bad path to WSDL file $path"; - $this->debug($errstr); - $this->setError($errstr); - return false; - } - } - $this->debug('Parse WSDL'); - // end new code added - // Create an XML parser. - $this->parser = xml_parser_create(); - // Set the options for parsing the XML data. - // xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); - xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); - // Set the object for the parser. - xml_set_object($this->parser, $this); - // Set the element handlers for the parser. - xml_set_element_handler($this->parser, 'start_element', 'end_element'); - xml_set_character_data_handler($this->parser, 'character_data'); - // Parse the XML file. - if (!xml_parse($this->parser, $wsdl_string, true)) { - // Display an error message. - $errstr = sprintf( - 'XML error parsing WSDL from %s on line %d: %s', - $wsdl, - xml_get_current_line_number($this->parser), - xml_error_string(xml_get_error_code($this->parser)) - ); - $this->debug($errstr); - $this->debug("XML payload:\n" . $wsdl_string); - $this->setError($errstr); - return false; - } - // free the parser - xml_parser_free($this->parser); - $this->debug('Parsing WSDL done'); - // catch wsdl parse errors - if($this->getError()){ - return false; - } - return true; - } - - /** - * start-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @param string $attrs associative array of attributes - * @access private - */ - function start_element($parser, $name, $attrs) - { - if ($this->status == 'schema') { - $this->currentSchema->schemaStartElement($parser, $name, $attrs); - $this->appendDebug($this->currentSchema->getDebug()); - $this->currentSchema->clearDebug(); - } elseif (preg_match('/schema$/', $name)) { - $this->debug('Parsing WSDL schema'); - // $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")"); - $this->status = 'schema'; - $this->currentSchema = new nusoap_xmlschema('', '', $this->namespaces); - $this->currentSchema->schemaStartElement($parser, $name, $attrs); - $this->appendDebug($this->currentSchema->getDebug()); - $this->currentSchema->clearDebug(); - } else { - // position in the total number of elements, starting from 0 - $pos = $this->position++; - $depth = $this->depth++; - // set self as current value for this depth - $this->depth_array[$depth] = $pos; - $this->message[$pos] = array('cdata' => ''); - // process attributes - if (count($attrs) > 0) { - // register namespace declarations - foreach($attrs as $k => $v) { - if (preg_match('/^xmlns/',$k)) { - if ($ns_prefix = substr(strrchr($k, ':'), 1)) { - $this->namespaces[$ns_prefix] = $v; - } else { - $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v; - } - if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') { - $this->XMLSchemaVersion = $v; - $this->namespaces['xsi'] = $v . '-instance'; - } - } - } - // expand each attribute prefix to its namespace - foreach($attrs as $k => $v) { - $k = strpos($k, ':') ? $this->expandQname($k) : $k; - if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') { - $v = strpos($v, ':') ? $this->expandQname($v) : $v; - } - $eAttrs[$k] = $v; - } - $attrs = $eAttrs; - } else { - $attrs = array(); - } - // get element prefix, namespace and name - if (preg_match('/:/', $name)) { - // get ns prefix - $prefix = substr($name, 0, strpos($name, ':')); - // get ns - $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : ''; - // get unqualified name - $name = substr(strstr($name, ':'), 1); - } - // process attributes, expanding any prefixes to namespaces - // find status, register data - switch ($this->status) { - case 'message': - if ($name == 'part') { - if (isset($attrs['type'])) { - $this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs)); - $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type']; - } - if (isset($attrs['element'])) { - $this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs)); - $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^'; - } - } - break; - case 'portType': - switch ($name) { - case 'operation': - $this->currentPortOperation = $attrs['name']; - $this->debug("portType $this->currentPortType operation: $this->currentPortOperation"); - if (isset($attrs['parameterOrder'])) { - $this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrder']; - } - break; - case 'documentation': - $this->documentation = true; - break; - // merge input/output data - default: - $m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : ''; - $this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m; - break; - } - break; - case 'binding': - switch ($name) { - case 'binding': - // get ns prefix - if (isset($attrs['style'])) { - $this->bindings[$this->currentBinding]['prefix'] = $prefix; - } - $this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs); - break; - case 'header': - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus]['headers'][] = $attrs; - break; - case 'operation': - if (isset($attrs['soapAction'])) { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $attrs['soapAction']; - } - if (isset($attrs['style'])) { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['style']; - } - if (isset($attrs['name'])) { - $this->currentOperation = $attrs['name']; - $this->debug("current binding operation: $this->currentOperation"); - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['name']; - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->currentBinding; - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this->bindings[$this->currentBinding]['endpoint']) ? $this->bindings[$this->currentBinding]['endpoint'] : ''; - } - break; - case 'input': - $this->opStatus = 'input'; - break; - case 'output': - $this->opStatus = 'output'; - break; - case 'body': - if (isset($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus])) { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_merge($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus], $attrs); - } else { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $attrs; - } - break; - } - break; - case 'service': - switch ($name) { - case 'port': - $this->currentPort = $attrs['name']; - $this->debug('current port: ' . $this->currentPort); - $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']); - - break; - case 'address': - $this->ports[$this->currentPort]['location'] = $attrs['location']; - $this->ports[$this->currentPort]['bindingType'] = $namespace; - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace; - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location']; - break; - } - break; - } - // set status - switch ($name) { - case 'import': - if (isset($attrs['location'])) { - $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false); - $this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]).')'); - } else { - $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true); - if (! $this->getPrefixFromNamespace($attrs['namespace'])) { - $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; - } - $this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$attrs['namespace']]).')'); - } - break; - //wait for schema - //case 'types': - // $this->status = 'schema'; - // break; - case 'message': - $this->status = 'message'; - $this->messages[$attrs['name']] = array(); - $this->currentMessage = $attrs['name']; - break; - case 'portType': - $this->status = 'portType'; - $this->portTypes[$attrs['name']] = array(); - $this->currentPortType = $attrs['name']; - break; - case "binding": - if (isset($attrs['name'])) { - // get binding name - if (strpos($attrs['name'], ':')) { - $this->currentBinding = $this->getLocalPart($attrs['name']); - } else { - $this->currentBinding = $attrs['name']; - } - $this->status = 'binding'; - $this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']); - $this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']); - } - break; - case 'service': - $this->serviceName = $attrs['name']; - $this->status = 'service'; - $this->debug('current service: ' . $this->serviceName); - break; - case 'definitions': - foreach ($attrs as $name => $value) { - $this->wsdl_info[$name] = $value; - } - break; - } - } - } - - /** - * end-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @access private - */ - function end_element($parser, $name){ - // unset schema status - if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) { - $this->status = ""; - $this->appendDebug($this->currentSchema->getDebug()); - $this->currentSchema->clearDebug(); - $this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema; - $this->debug('Parsing WSDL schema done'); - } - if ($this->status == 'schema') { - $this->currentSchema->schemaEndElement($parser, $name); - } else { - // bring depth down a notch - $this->depth--; - } - // end documentation - if ($this->documentation) { - //TODO: track the node to which documentation should be assigned; it can be a part, message, etc. - //$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->documentation; - $this->documentation = false; - } - } - - /** - * element content handler - * - * @param string $parser XML parser object - * @param string $data element content - * @access private - */ - function character_data($parser, $data) - { - $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0; - if (isset($this->message[$pos]['cdata'])) { - $this->message[$pos]['cdata'] .= $data; - } - if ($this->documentation) { - $this->documentation .= $data; - } - } - - /** - * if authenticating, set user credentials here - * - * @param string $username - * @param string $password - * @param string $authtype (basic|digest|certificate|ntlm) - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) - * @access public - */ - function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) { - $this->debug("setCredentials username=$username authtype=$authtype certRequest="); - $this->appendDebug($this->varDump($certRequest)); - $this->username = $username; - $this->password = $password; - $this->authtype = $authtype; - $this->certRequest = $certRequest; - } - - function getBindingData($binding) - { - if (is_array($this->bindings[$binding])) { - return $this->bindings[$binding]; - } - } - - /** - * returns an assoc array of operation names => operation data - * - * @param string $portName WSDL port name - * @param string $bindingType eg: soap, smtp, dime (only soap and soap12 are currently supported) - * @return array - * @access public - */ - function getOperations($portName = '', $bindingType = 'soap') { - $ops = array(); - if ($bindingType == 'soap') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; - } elseif ($bindingType == 'soap12') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; - } else { - $this->debug("getOperations bindingType $bindingType may not be supported"); - } - $this->debug("getOperations for port '$portName' bindingType $bindingType"); - // loop thru ports - foreach($this->ports as $port => $portData) { - $this->debug("getOperations checking port $port bindingType " . $portData['bindingType']); - if ($portName == '' || $port == $portName) { - // binding type of port matches parameter - if ($portData['bindingType'] == $bindingType) { - $this->debug("getOperations found port $port bindingType $bindingType"); - //$this->debug("port data: " . $this->varDump($portData)); - //$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ])); - // merge bindings - if (isset($this->bindings[ $portData['binding'] ]['operations'])) { - $ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']); - } - } - } - } - if (count($ops) == 0) { - $this->debug("getOperations found no operations for port '$portName' bindingType $bindingType"); - } - return $ops; - } - - /** - * returns an associative array of data necessary for calling an operation - * - * @param string $operation name of operation - * @param string $bindingType type of binding eg: soap, soap12 - * @return array - * @access public - */ - function getOperationData($operation, $bindingType = 'soap') - { - if ($bindingType == 'soap') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; - } elseif ($bindingType == 'soap12') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; - } - // loop thru ports - foreach($this->ports as $port => $portData) { - // binding type of port matches parameter - if ($portData['bindingType'] == $bindingType) { - // get binding - //foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { - foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) { - // note that we could/should also check the namespace here - if ($operation == $bOperation) { - $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation]; - return $opData; - } - } - } - } - } - - /** - * returns an associative array of data necessary for calling an operation - * - * @param string $soapAction soapAction for operation - * @param string $bindingType type of binding eg: soap, soap12 - * @return array - * @access public - */ - function getOperationDataForSoapAction($soapAction, $bindingType = 'soap') { - if ($bindingType == 'soap') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; - } elseif ($bindingType == 'soap12') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; - } - // loop thru ports - foreach($this->ports as $port => $portData) { - // binding type of port matches parameter - if ($portData['bindingType'] == $bindingType) { - // loop through operations for the binding - foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { - if ($opData['soapAction'] == $soapAction) { - return $opData; - } - } - } - } - } - - /** - * returns an array of information about a given type - * returns false if no type exists by the given name - * - * typeDef = array( - * 'elements' => array(), // refs to elements array - * 'restrictionBase' => '', - * 'phpType' => '', - * 'order' => '(sequence|all)', - * 'attrs' => array() // refs to attributes array - * ) - * - * @param string $type the type - * @param string $ns namespace (not prefix) of the type - * @return mixed - * @access public - * @see nusoap_xmlschema - */ - function getTypeDef($type, $ns) { - $this->debug("in getTypeDef: type=$type, ns=$ns"); - if ((! $ns) && isset($this->namespaces['tns'])) { - $ns = $this->namespaces['tns']; - $this->debug("in getTypeDef: type namespace forced to $ns"); - } - if (!isset($this->schemas[$ns])) { - foreach ($this->schemas as $ns0 => $schema0) { - if (strcasecmp($ns, $ns0) == 0) { - $this->debug("in getTypeDef: replacing schema namespace $ns with $ns0"); - $ns = $ns0; - break; - } - } - } - if (isset($this->schemas[$ns])) { - $this->debug("in getTypeDef: have schema for namespace $ns"); - for ($i = 0; $i < count($this->schemas[$ns]); $i++) { - $xs = &$this->schemas[$ns][$i]; - $t = $xs->getTypeDef($type); - $this->appendDebug($xs->getDebug()); - $xs->clearDebug(); - if ($t) { - $this->debug("in getTypeDef: found type $type"); - if (!isset($t['phpType'])) { - // get info for type to tack onto the element - $uqType = substr($t['type'], strrpos($t['type'], ':') + 1); - $ns = substr($t['type'], 0, strrpos($t['type'], ':')); - $etype = $this->getTypeDef($uqType, $ns); - if ($etype) { - $this->debug("found type for [element] $type:"); - $this->debug($this->varDump($etype)); - if (isset($etype['phpType'])) { - $t['phpType'] = $etype['phpType']; - } - if (isset($etype['elements'])) { - $t['elements'] = $etype['elements']; - } - if (isset($etype['attrs'])) { - $t['attrs'] = $etype['attrs']; - } - } else { - $this->debug("did not find type for [element] $type"); - } - } - return $t; - } - } - $this->debug("in getTypeDef: did not find type $type"); - } else { - $this->debug("in getTypeDef: do not have schema for namespace $ns"); - } - return false; - } - - /** - * prints html description of services - * - * @access private - */ - function webDescription(){ - global $HTTP_SERVER_VARS; - - if (isset($_SERVER)) { - $PHP_SELF = $_SERVER['PHP_SELF']; - } elseif (isset($HTTP_SERVER_VARS)) { - $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; - } else { - $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); - } - - $b = ' - NuSOAP: '.$this->serviceName.' - - - - -
    -

    -
    '.$this->serviceName.'
    - -
    '; - return $b; - } - - /** - * serialize the parsed wsdl - * - * @param mixed $debug whether to put debug=1 in endpoint URL - * @return string serialization of WSDL - * @access public - */ - function serialize($debug = 0) - { - $xml = ''; - $xml .= "\nnamespaces as $k => $v) { - $xml .= " xmlns:$k=\"$v\""; - } - // 10.9.02 - add poulter fix for wsdl and tns declarations - if (isset($this->namespaces['wsdl'])) { - $xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\""; - } - if (isset($this->namespaces['tns'])) { - $xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\""; - } - $xml .= '>'; - // imports - if (sizeof($this->import) > 0) { - foreach($this->import as $ns => $list) { - foreach ($list as $ii) { - if ($ii['location'] != '') { - $xml .= ''; - } else { - $xml .= ''; - } - } - } - } - // types - if (count($this->schemas)>=1) { - $xml .= "\n\n"; - foreach ($this->schemas as $ns => $list) { - foreach ($list as $xs) { - $xml .= $xs->serializeSchema(); - } - } - $xml .= ''; - } - // messages - if (count($this->messages) >= 1) { - foreach($this->messages as $msgName => $msgParts) { - $xml .= "\n'; - if(is_array($msgParts)){ - foreach($msgParts as $partName => $partType) { - // print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'
    '; - if (strpos($partType, ':')) { - $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType)); - } elseif (isset($this->typemap[$this->namespaces['xsd']][$partType])) { - // print 'checking typemap: '.$this->XMLSchemaVersion.'
    '; - $typePrefix = 'xsd'; - } else { - foreach($this->typemap as $ns => $types) { - if (isset($types[$partType])) { - $typePrefix = $this->getPrefixFromNamespace($ns); - } - } - if (!isset($typePrefix)) { - die("$partType has no namespace!"); - } - } - $ns = $this->getNamespaceFromPrefix($typePrefix); - $localPart = $this->getLocalPart($partType); - $typeDef = $this->getTypeDef($localPart, $ns); - if ($typeDef['typeClass'] == 'element') { - $elementortype = 'element'; - if (substr($localPart, -1) == '^') { - $localPart = substr($localPart, 0, -1); - } - } else { - $elementortype = 'type'; - } - $xml .= "\n" . ' '; - } - } - $xml .= '
    '; - } - } - // bindings & porttypes - if (count($this->bindings) >= 1) { - $binding_xml = ''; - $portType_xml = ''; - foreach($this->bindings as $bindingName => $attrs) { - $binding_xml .= "\n'; - $binding_xml .= "\n" . ' '; - $portType_xml .= "\n'; - foreach($attrs['operations'] as $opName => $opParts) { - $binding_xml .= "\n" . ' '; - $binding_xml .= "\n" . ' '; - if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') { - $enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"'; - } else { - $enc_style = ''; - } - $binding_xml .= "\n" . ' '; - if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') { - $enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"'; - } else { - $enc_style = ''; - } - $binding_xml .= "\n" . ' '; - $binding_xml .= "\n" . ' '; - $portType_xml .= "\n" . ' ' . htmlspecialchars($opParts['documentation']) . ''; - } - $portType_xml .= "\n" . ' '; - $portType_xml .= "\n" . ' '; - $portType_xml .= "\n" . ' '; - } - $portType_xml .= "\n" . ''; - $binding_xml .= "\n" . ''; - } - $xml .= $portType_xml . $binding_xml; - } - // services - $xml .= "\nserviceName . '">'; - if (count($this->ports) >= 1) { - foreach($this->ports as $pName => $attrs) { - $xml .= "\n" . ' '; - $xml .= "\n" . ' '; - $xml .= "\n" . ' '; - } - } - $xml .= "\n" . ''; - return $xml . "\n"; - } - - /** - * determine whether a set of parameters are unwrapped - * when they are expect to be wrapped, Microsoft-style. - * - * @param string $type the type (element name) of the wrapper - * @param array $parameters the parameter values for the SOAP call - * @return boolean whether they parameters are unwrapped (and should be wrapped) - * @access private - */ - function parametersMatchWrapped($type, &$parameters) { - $this->debug("in parametersMatchWrapped type=$type, parameters="); - $this->appendDebug($this->varDump($parameters)); - - // split type into namespace:unqualified-type - if (strpos($type, ':')) { - $uqType = substr($type, strrpos($type, ':') + 1); - $ns = substr($type, 0, strrpos($type, ':')); - $this->debug("in parametersMatchWrapped: got a prefixed type: $uqType, $ns"); - if ($this->getNamespaceFromPrefix($ns)) { - $ns = $this->getNamespaceFromPrefix($ns); - $this->debug("in parametersMatchWrapped: expanded prefixed type: $uqType, $ns"); - } - } else { - // TODO: should the type be compared to types in XSD, and the namespace - // set to XSD if the type matches? - $this->debug("in parametersMatchWrapped: No namespace for type $type"); - $ns = ''; - $uqType = $type; - } - - // get the type information - if (!$typeDef = $this->getTypeDef($uqType, $ns)) { - $this->debug("in parametersMatchWrapped: $type ($uqType) is not a supported type."); - return false; - } - $this->debug("in parametersMatchWrapped: found typeDef="); - $this->appendDebug($this->varDump($typeDef)); - if (substr($uqType, -1) == '^') { - $uqType = substr($uqType, 0, -1); - } - $phpType = $typeDef['phpType']; - $arrayType = (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : ''); - $this->debug("in parametersMatchWrapped: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: $arrayType"); - - // we expect a complexType or element of complexType - if ($phpType != 'struct') { - $this->debug("in parametersMatchWrapped: not a struct"); - return false; - } - - // see whether the parameter names match the elements - if (isset($typeDef['elements']) && is_array($typeDef['elements'])) { - $elements = 0; - $matches = 0; - foreach ($typeDef['elements'] as $name => $attrs) { - if (isset($parameters[$name])) { - $this->debug("in parametersMatchWrapped: have parameter named $name"); - $matches++; - } else { - $this->debug("in parametersMatchWrapped: do not have parameter named $name"); - } - $elements++; - } - - $this->debug("in parametersMatchWrapped: $matches parameter names match $elements wrapped parameter names"); - if ($matches == 0) { - return false; - } - return true; - } - - // since there are no elements for the type, if the user passed no - // parameters, the parameters match wrapped. - $this->debug("in parametersMatchWrapped: no elements type $ns:$uqType"); - return count($parameters) == 0; - } - - /** - * serialize PHP values according to a WSDL message definition - * contrary to the method name, this is not limited to RPC - * - * TODO - * - multi-ref serialization - * - validate PHP values against type definitions, return errors if invalid - * - * @param string $operation operation name - * @param string $direction (input|output) - * @param mixed $parameters parameter value(s) - * @param string $bindingType (soap|soap12) - * @return mixed parameters serialized as XML or false on error (e.g. operation not found) - * @access public - */ - function serializeRPCParameters($operation, $direction, $parameters, $bindingType = 'soap') { - $this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion, bindingType=$bindingType"); - $this->appendDebug('parameters=' . $this->varDump($parameters)); - - if ($direction != 'input' && $direction != 'output') { - $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); - $this->setError('The value of the \$direction argument needs to be either "input" or "output"'); - return false; - } - if (!$opData = $this->getOperationData($operation, $bindingType)) { - $this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); - $this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); - return false; - } - $this->debug('in serializeRPCParameters: opData:'); - $this->appendDebug($this->varDump($opData)); - - // Get encoding style for output and set to current - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { - $encodingStyle = $opData['output']['encodingStyle']; - $enc_style = $encodingStyle; - } - - // set input params - $xml = ''; - if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) { - $parts = &$opData[$direction]['parts']; - $part_count = sizeof($parts); - $style = $opData['style']; - $use = $opData[$direction]['use']; - $this->debug("have $part_count part(s) to serialize using $style/$use"); - if (is_array($parameters)) { - $parametersArrayType = $this->isArraySimpleOrStruct($parameters); - $parameter_count = count($parameters); - $this->debug("have $parameter_count parameter(s) provided as $parametersArrayType to serialize"); - // check for Microsoft-style wrapped parameters - if ($style == 'document' && $use == 'literal' && $part_count == 1 && isset($parts['parameters'])) { - $this->debug('check whether the caller has wrapped the parameters'); - if ($direction == 'output' && $parametersArrayType == 'arraySimple' && $parameter_count == 1) { - // TODO: consider checking here for double-wrapping, when - // service function wraps, then NuSOAP wraps again - $this->debug("change simple array to associative with 'parameters' element"); - $parameters['parameters'] = $parameters[0]; - unset($parameters[0]); - } - if (($parametersArrayType == 'arrayStruct' || $parameter_count == 0) && !isset($parameters['parameters'])) { - $this->debug('check whether caller\'s parameters match the wrapped ones'); - if ($this->parametersMatchWrapped($parts['parameters'], $parameters)) { - $this->debug('wrap the parameters for the caller'); - $parameters = array('parameters' => $parameters); - $parameter_count = 1; - } - } - } - foreach ($parts as $name => $type) { - $this->debug("serializing part $name of type $type"); - // Track encoding style - if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { - $encodingStyle = $opData[$direction]['encodingStyle']; - $enc_style = $encodingStyle; - } else { - $enc_style = false; - } - // NOTE: add error handling here - // if serializeType returns false, then catch global error and fault - if ($parametersArrayType == 'arraySimple') { - $p = array_shift($parameters); - $this->debug('calling serializeType w/indexed param'); - $xml .= $this->serializeType($name, $type, $p, $use, $enc_style); - } elseif (isset($parameters[$name])) { - $this->debug('calling serializeType w/named param'); - $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style); - } else { - // TODO: only send nillable - $this->debug('calling serializeType w/null param'); - $xml .= $this->serializeType($name, $type, null, $use, $enc_style); - } - } - } else { - $this->debug('no parameters passed.'); - } - } - $this->debug("serializeRPCParameters returning: $xml"); - return $xml; - } - - /** - * serialize a PHP value according to a WSDL message definition - * - * TODO - * - multi-ref serialization - * - validate PHP values against type definitions, return errors if invalid - * - * @param string $operation operation name - * @param string $direction (input|output) - * @param mixed $parameters parameter value(s) - * @return mixed parameters serialized as XML or false on error (e.g. operation not found) - * @access public - * @deprecated - */ - function serializeParameters($operation, $direction, $parameters) - { - $this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion"); - $this->appendDebug('parameters=' . $this->varDump($parameters)); - - if ($direction != 'input' && $direction != 'output') { - $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); - $this->setError('The value of the \$direction argument needs to be either "input" or "output"'); - return false; - } - if (!$opData = $this->getOperationData($operation)) { - $this->debug('Unable to retrieve WSDL data for operation: ' . $operation); - $this->setError('Unable to retrieve WSDL data for operation: ' . $operation); - return false; - } - $this->debug('opData:'); - $this->appendDebug($this->varDump($opData)); - - // Get encoding style for output and set to current - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { - $encodingStyle = $opData['output']['encodingStyle']; - $enc_style = $encodingStyle; - } - - // set input params - $xml = ''; - if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) { - - $use = $opData[$direction]['use']; - $this->debug("use=$use"); - $this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)'); - if (is_array($parameters)) { - $parametersArrayType = $this->isArraySimpleOrStruct($parameters); - $this->debug('have ' . $parametersArrayType . ' parameters'); - foreach($opData[$direction]['parts'] as $name => $type) { - $this->debug('serializing part "'.$name.'" of type "'.$type.'"'); - // Track encoding style - if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { - $encodingStyle = $opData[$direction]['encodingStyle']; - $enc_style = $encodingStyle; - } else { - $enc_style = false; - } - // NOTE: add error handling here - // if serializeType returns false, then catch global error and fault - if ($parametersArrayType == 'arraySimple') { - $p = array_shift($parameters); - $this->debug('calling serializeType w/indexed param'); - $xml .= $this->serializeType($name, $type, $p, $use, $enc_style); - } elseif (isset($parameters[$name])) { - $this->debug('calling serializeType w/named param'); - $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style); - } else { - // TODO: only send nillable - $this->debug('calling serializeType w/null param'); - $xml .= $this->serializeType($name, $type, null, $use, $enc_style); - } - } - } else { - $this->debug('no parameters passed.'); - } - } - $this->debug("serializeParameters returning: $xml"); - return $xml; - } - - /** - * serializes a PHP value according a given type definition - * - * @param string $name name of value (part or element) - * @param string $type XML schema type of value (type or element) - * @param mixed $value a native PHP value (parameter value) - * @param string $use use for part (encoded|literal) - * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style) - * @param boolean $unqualified a kludge for what should be XML namespace form handling - * @return string value serialized as an XML string - * @access private - */ - function serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false) - { - $this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=" . ($unqualified ? "unqualified" : "qualified")); - $this->appendDebug("value=" . $this->varDump($value)); - if($use == 'encoded' && $encodingStyle) { - $encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"'; - } - - // if a soapval has been supplied, let its type override the WSDL - if (is_object($value) && get_class($value) == 'soapval') { - if ($value->type_ns) { - $type = $value->type_ns . ':' . $value->type; - $forceType = true; - $this->debug("in serializeType: soapval overrides type to $type"); - } elseif ($value->type) { - $type = $value->type; - $forceType = true; - $this->debug("in serializeType: soapval overrides type to $type"); - } else { - $forceType = false; - $this->debug("in serializeType: soapval does not override type"); - } - $attrs = $value->attributes; - $value = $value->value; - $this->debug("in serializeType: soapval overrides value to $value"); - if ($attrs) { - if (!is_array($value)) { - $value['!'] = $value; - } - foreach ($attrs as $n => $v) { - $value['!' . $n] = $v; - } - $this->debug("in serializeType: soapval provides attributes"); - } - } else { - $forceType = false; - } - - $xml = ''; - if (strpos($type, ':')) { - $uqType = substr($type, strrpos($type, ':') + 1); - $ns = substr($type, 0, strrpos($type, ':')); - $this->debug("in serializeType: got a prefixed type: $uqType, $ns"); - if ($this->getNamespaceFromPrefix($ns)) { - $ns = $this->getNamespaceFromPrefix($ns); - $this->debug("in serializeType: expanded prefixed type: $uqType, $ns"); - } - - if($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/'){ - $this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type'); - if ($unqualified && $use == 'literal') { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - if (is_null($value)) { - if ($use == 'literal') { - // TODO: depends on minOccurs - $xml = "<$name$elementNS/>"; - } else { - // TODO: depends on nillable, which should be checked before calling this method - $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - if ($uqType == 'Array') { - // JBoss/Axis does this sometimes - return $this->serialize_val($value, $name, false, false, false, false, $use); - } - if ($uqType == 'boolean') { - if ((is_string($value) && $value == 'false') || (! $value)) { - $value = 'false'; - } else { - $value = 'true'; - } - } - if ($uqType == 'string' && gettype($value) == 'string') { - $value = $this->expandEntities($value); - } - if (($uqType == 'long' || $uqType == 'unsignedLong') && gettype($value) == 'double') { - $value = sprintf("%.0lf", $value); - } - // it's a scalar - // TODO: what about null/nil values? - // check type isn't a custom type extending xmlschema namespace - if (!$this->getTypeDef($uqType, $ns)) { - if ($use == 'literal') { - if ($forceType) { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value"; - } else { - $xml = "<$name$elementNS>$value"; - } - } else { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - $this->debug('custom type extends XML Schema or SOAP Encoding namespace (yuck)'); - } else if ($ns == 'http://xml.apache.org/xml-soap') { - $this->debug('in serializeType: appears to be Apache SOAP type'); - if ($uqType == 'Map') { - $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); - if (! $tt_prefix) { - $this->debug('in serializeType: Add namespace for Apache SOAP type'); - $tt_prefix = 'ns' . rand(1000, 9999); - $this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap'; - // force this to be added to usedNamespaces - $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); - } - $contents = ''; - foreach($value as $k => $v) { - $this->debug("serializing map element: key $k, value $v"); - $contents .= ''; - $contents .= $this->serialize_val($k,'key',false,false,false,false,$use); - $contents .= $this->serialize_val($v,'value',false,false,false,false,$use); - $contents .= ''; - } - if ($use == 'literal') { - if ($forceType) { - $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\">$contents"; - } else { - $xml = "<$name>$contents"; - } - } else { - $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\"$encodingStyle>$contents"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - $this->debug('in serializeType: Apache SOAP type, but only support Map'); - } - } else { - // TODO: should the type be compared to types in XSD, and the namespace - // set to XSD if the type matches? - $this->debug("in serializeType: No namespace for type $type"); - $ns = ''; - $uqType = $type; - } - if(!$typeDef = $this->getTypeDef($uqType, $ns)){ - $this->setError("$type ($uqType) is not a supported type."); - $this->debug("in serializeType: $type ($uqType) is not a supported type."); - return false; - } else { - $this->debug("in serializeType: found typeDef"); - $this->appendDebug('typeDef=' . $this->varDump($typeDef)); - if (substr($uqType, -1) == '^') { - $uqType = substr($uqType, 0, -1); - } - } - if (!isset($typeDef['phpType'])) { - $this->setError("$type ($uqType) has no phpType."); - $this->debug("in serializeType: $type ($uqType) has no phpType."); - return false; - } - $phpType = $typeDef['phpType']; - $this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') ); - // if php type == struct, map value to the element names - if ($phpType == 'struct') { - if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') { - $elementName = $uqType; - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { - $elementNS = " xmlns=\"$ns\""; - } else { - $elementNS = " xmlns=\"\""; - } - } else { - $elementName = $name; - if ($unqualified) { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - } - if (is_null($value)) { - if ($use == 'literal') { - // TODO: depends on minOccurs and nillable - $xml = "<$elementName$elementNS/>"; - } else { - $xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - if (is_object($value)) { - $value = get_object_vars($value); - } - if (is_array($value)) { - $elementAttrs = $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType); - if ($use == 'literal') { - if ($forceType) { - $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">"; - } else { - $xml = "<$elementName$elementNS$elementAttrs>"; - } - } else { - $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>"; - } - - if (isset($typeDef['simpleContent']) && $typeDef['simpleContent'] == 'true') { - if (isset($value['!'])) { - $xml .= $value['!']; - $this->debug("in serializeType: serialized simpleContent for type $type"); - } else { - $this->debug("in serializeType: no simpleContent to serialize for type $type"); - } - } else { - // complexContent - $xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle); - } - $xml .= ""; - } else { - $this->debug("in serializeType: phpType is struct, but value is not an array"); - $this->setError("phpType is struct, but value is not an array: see debug output for details"); - $xml = ''; - } - } elseif ($phpType == 'array') { - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { - $elementNS = " xmlns=\"$ns\""; - } else { - if ($unqualified) { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - } - if (is_null($value)) { - if ($use == 'literal') { - // TODO: depends on minOccurs - $xml = "<$name$elementNS/>"; - } else { - $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . - ":Array\" " . - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . - ':arrayType="' . - $this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) . - ':' . - $this->getLocalPart($typeDef['arrayType'])."[0]\"/>"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - if (isset($typeDef['multidimensional'])) { - $nv = array(); - foreach($value as $v) { - $cols = ',' . sizeof($v); - $nv = array_merge($nv, $v); - } - $value = $nv; - } else { - $cols = ''; - } - if (is_array($value) && sizeof($value) >= 1) { - $rows = sizeof($value); - $contents = ''; - foreach($value as $k => $v) { - $this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]"); - //if (strpos($typeDef['arrayType'], ':') ) { - if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) { - $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use); - } else { - $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use); - } - } - } else { - $rows = 0; - $contents = null; - } - // TODO: for now, an empty value will be serialized as a zero element - // array. Revisit this when coding the handling of null/nil values. - if ($use == 'literal') { - $xml = "<$name$elementNS>" - .$contents - .""; - } else { - $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/').':Array" '. - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') - .':arrayType="' - .$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) - .":".$this->getLocalPart($typeDef['arrayType'])."[$rows$cols]\">" - .$contents - .""; - } - } elseif ($phpType == 'scalar') { - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { - $elementNS = " xmlns=\"$ns\""; - } else { - if ($unqualified) { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - } - if ($use == 'literal') { - if ($forceType) { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value"; - } else { - $xml = "<$name$elementNS>$value"; - } - } else { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value"; - } - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - - /** - * serializes the attributes for a complexType - * - * @param array $typeDef our internal representation of an XML schema type (or element) - * @param mixed $value a native PHP value (parameter value) - * @param string $ns the namespace of the type - * @param string $uqType the local part of the type - * @return string value serialized as an XML string - * @access private - */ - function serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType) { - $this->debug("serializeComplexTypeAttributes for XML Schema type $ns:$uqType"); - $xml = ''; - if (isset($typeDef['extensionBase'])) { - $nsx = $this->getPrefix($typeDef['extensionBase']); - $uqTypex = $this->getLocalPart($typeDef['extensionBase']); - if ($this->getNamespaceFromPrefix($nsx)) { - $nsx = $this->getNamespaceFromPrefix($nsx); - } - if ($typeDefx = $this->getTypeDef($uqTypex, $nsx)) { - $this->debug("serialize attributes for extension base $nsx:$uqTypex"); - $xml .= $this->serializeComplexTypeAttributes($typeDefx, $value, $nsx, $uqTypex); - } else { - $this->debug("extension base $nsx:$uqTypex is not a supported type"); - } - } - if (isset($typeDef['attrs']) && is_array($typeDef['attrs'])) { - $this->debug("serialize attributes for XML Schema type $ns:$uqType"); - if (is_array($value)) { - $xvalue = $value; - } elseif (is_object($value)) { - $xvalue = get_object_vars($value); - } else { - $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType"); - $xvalue = array(); - } - foreach ($typeDef['attrs'] as $aName => $attrs) { - if (isset($xvalue['!' . $aName])) { - $xname = '!' . $aName; - $this->debug("value provided for attribute $aName with key $xname"); - } elseif (isset($xvalue[$aName])) { - $xname = $aName; - $this->debug("value provided for attribute $aName with key $xname"); - } elseif (isset($attrs['default'])) { - $xname = '!' . $aName; - $xvalue[$xname] = $attrs['default']; - $this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName); - } else { - $xname = ''; - $this->debug("no value provided for attribute $aName"); - } - if ($xname) { - $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\""; - } - } - } else { - $this->debug("no attributes to serialize for XML Schema type $ns:$uqType"); - } - return $xml; - } - - /** - * serializes the elements for a complexType - * - * @param array $typeDef our internal representation of an XML schema type (or element) - * @param mixed $value a native PHP value (parameter value) - * @param string $ns the namespace of the type - * @param string $uqType the local part of the type - * @param string $use use for part (encoded|literal) - * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style) - * @return string value serialized as an XML string - * @access private - */ - function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false) { - $this->debug("in serializeComplexTypeElements for XML Schema type $ns:$uqType"); - $xml = ''; - if (isset($typeDef['extensionBase'])) { - $nsx = $this->getPrefix($typeDef['extensionBase']); - $uqTypex = $this->getLocalPart($typeDef['extensionBase']); - if ($this->getNamespaceFromPrefix($nsx)) { - $nsx = $this->getNamespaceFromPrefix($nsx); - } - if ($typeDefx = $this->getTypeDef($uqTypex, $nsx)) { - $this->debug("serialize elements for extension base $nsx:$uqTypex"); - $xml .= $this->serializeComplexTypeElements($typeDefx, $value, $nsx, $uqTypex, $use, $encodingStyle); - } else { - $this->debug("extension base $nsx:$uqTypex is not a supported type"); - } - } - if (isset($typeDef['elements']) && is_array($typeDef['elements'])) { - $this->debug("in serializeComplexTypeElements, serialize elements for XML Schema type $ns:$uqType"); - if (is_array($value)) { - $xvalue = $value; - } elseif (is_object($value)) { - $xvalue = get_object_vars($value); - } else { - $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType"); - $xvalue = array(); - } - // toggle whether all elements are present - ideally should validate against schema - if (count($typeDef['elements']) != count($xvalue)){ - $optionals = true; - } - foreach ($typeDef['elements'] as $eName => $attrs) { - if (!isset($xvalue[$eName])) { - if (isset($attrs['default'])) { - $xvalue[$eName] = $attrs['default']; - $this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName); - } - } - // if user took advantage of a minOccurs=0, then only serialize named parameters - if (isset($optionals) - && (!isset($xvalue[$eName])) - && ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true') - ){ - if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') { - $this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']); - } - // do nothing - $this->debug("no value provided for complexType element $eName and element is not nillable, so serialize nothing"); - } else { - // get value - if (isset($xvalue[$eName])) { - $v = $xvalue[$eName]; - } else { - $v = null; - } - if (isset($attrs['form'])) { - $unqualified = ($attrs['form'] == 'unqualified'); - } else { - $unqualified = false; - } - if (isset($attrs['maxOccurs']) && ($attrs['maxOccurs'] == 'unbounded' || $attrs['maxOccurs'] > 1) && isset($v) && is_array($v) && $this->isArraySimpleOrStruct($v) == 'arraySimple') { - $vv = $v; - foreach ($vv as $k => $v) { - if (isset($attrs['type']) || isset($attrs['ref'])) { - // serialize schema-defined type - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); - } else { - // serialize generic type (can this ever really happen?) - $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); - $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); - } - } - } else { - if (is_null($v) && isset($attrs['minOccurs']) && $attrs['minOccurs'] == '0') { - // do nothing - } elseif (is_null($v) && isset($attrs['nillable']) && $attrs['nillable'] == 'true') { - // TODO: serialize a nil correctly, but for now serialize schema-defined type - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); - } elseif (isset($attrs['type']) || isset($attrs['ref'])) { - // serialize schema-defined type - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); - } else { - // serialize generic type (can this ever really happen?) - $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); - $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); - } - } - } - } - } else { - $this->debug("no elements to serialize for XML Schema type $ns:$uqType"); - } - return $xml; - } - - /** - * adds an XML Schema complex type to the WSDL types - * - * @param string $name - * @param string $typeClass (complexType|simpleType|attribute) - * @param string $phpType currently supported are array and struct (php assoc array) - * @param string $compositor (all|sequence|choice) - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param array $elements e.g. array ( name => array(name=>'',type=>'') ) - * @param array $attrs e.g. array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]')) - * @param string $arrayType as namespace:name (xsd:string) - * @see nusoap_xmlschema - * @access public - */ - function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType='') { - if (count($elements) > 0) { - $eElements = array(); - foreach($elements as $n => $e){ - // expand each element - $ee = array(); - foreach ($e as $k => $v) { - $k = strpos($k,':') ? $this->expandQname($k) : $k; - $v = strpos($v,':') ? $this->expandQname($v) : $v; - $ee[$k] = $v; - } - $eElements[$n] = $ee; - } - $elements = $eElements; - } - - if (count($attrs) > 0) { - foreach($attrs as $n => $a){ - // expand each attribute - foreach ($a as $k => $v) { - $k = strpos($k,':') ? $this->expandQname($k) : $k; - $v = strpos($v,':') ? $this->expandQname($v) : $v; - $aa[$k] = $v; - } - $eAttrs[$n] = $aa; - } - $attrs = $eAttrs; - } - - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; - $arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType; - - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; - $this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType); - } - - /** - * adds an XML Schema simple type to the WSDL types - * - * @param string $name - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param string $typeClass (should always be simpleType) - * @param string $phpType (should always be scalar) - * @param array $enumeration array of values - * @see nusoap_xmlschema - * @access public - */ - function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) { - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; - - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; - $this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration); - } - - /** - * adds an element to the WSDL types - * - * @param array $attrs attributes that must include name and type - * @see nusoap_xmlschema - * @access public - */ - function addElement($attrs) { - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; - $this->schemas[$typens][0]->addElement($attrs); - } - - /** - * register an operation with the server - * - * @param string $name operation (method) name - * @param array $in assoc array of input values: key = param name, value = param type - * @param array $out assoc array of output values: key = param name, value = param type - * @param string $namespace optional The namespace for the operation - * @param string $soapaction optional The soapaction for the operation - * @param string $style (rpc|document) optional The style for the operation Note: when 'document' is specified, parameter and return wrappers are created for you automatically - * @param string $use (encoded|literal) optional The use for the parameters (cannot mix right now) - * @param string $documentation optional The description to include in the WSDL - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) - * @access public - */ - function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){ - if ($use == 'encoded' && $encodingStyle == '') { - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - } - - if ($style == 'document') { - $elements = array(); - foreach ($in as $n => $t) { - $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); - } - $this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements); - $this->addElement(array('name' => $name, 'type' => $name . 'RequestType')); - $in = array('parameters' => 'tns:' . $name . '^'); - - $elements = array(); - foreach ($out as $n => $t) { - $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); - } - $this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements); - $this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType', 'form' => 'qualified')); - $out = array('parameters' => 'tns:' . $name . 'Response' . '^'); - } - - // get binding - $this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] = - array( - 'name' => $name, - 'binding' => $this->serviceName . 'Binding', - 'endpoint' => $this->endpoint, - 'soapAction' => $soapaction, - 'style' => $style, - 'input' => array( - 'use' => $use, - 'namespace' => $namespace, - 'encodingStyle' => $encodingStyle, - 'message' => $name . 'Request', - 'parts' => $in), - 'output' => array( - 'use' => $use, - 'namespace' => $namespace, - 'encodingStyle' => $encodingStyle, - 'message' => $name . 'Response', - 'parts' => $out), - 'namespace' => $namespace, - 'transport' => 'http://schemas.xmlsoap.org/soap/http', - 'documentation' => $documentation); - // add portTypes - // add messages - if($in) - { - foreach($in as $pName => $pType) - { - if(strpos($pType,':')) { - $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); - } - $this->messages[$name.'Request'][$pName] = $pType; - } - } else { - $this->messages[$name.'Request']= '0'; - } - if($out) - { - foreach($out as $pName => $pType) - { - if(strpos($pType,':')) { - $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); - } - $this->messages[$name.'Response'][$pName] = $pType; - } - } else { - $this->messages[$name.'Response']= '0'; - } - return true; - } -} - diff --git a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.wsdlcache.php b/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.wsdlcache.php deleted file mode 100755 index 990a0c7ae..000000000 --- a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.wsdlcache.php +++ /dev/null @@ -1,209 +0,0 @@ - -* @author Ingo Fischer -* @version $Id: class.wsdlcache.php 6844 2011-06-03 14:46:51Z dMetzger $ -* @access public -*/ -class nusoap_wsdlcache { - /** - * @var resource - * @access private - */ - var $fplock; - /** - * @var integer - * @access private - */ - var $cache_lifetime; - /** - * @var string - * @access private - */ - var $cache_dir; - /** - * @var string - * @access public - */ - var $debug_str = ''; - - /** - * constructor - * - * @param string $cache_dir directory for cache-files - * @param integer $cache_lifetime lifetime for caching-files in seconds or 0 for unlimited - * @access public - */ - function nusoap_wsdlcache($cache_dir='.', $cache_lifetime=0) { - $this->fplock = array(); - $this->cache_dir = $cache_dir != '' ? $cache_dir : '.'; - $this->cache_lifetime = $cache_lifetime; - } - - /** - * creates the filename used to cache a wsdl instance - * - * @param string $wsdl The URL of the wsdl instance - * @return string The filename used to cache the instance - * @access private - */ - function createFilename($wsdl) { - return $this->cache_dir.'/wsdlcache-' . md5($wsdl); - } - - /** - * adds debug data to the class level debug string - * - * @param string $string debug data - * @access private - */ - function debug($string){ - $this->debug_str .= get_class($this).": $string\n"; - } - - /** - * gets a wsdl instance from the cache - * - * @param string $wsdl The URL of the wsdl instance - * @return object wsdl The cached wsdl instance, null if the instance is not in the cache - * @access public - */ - function get($wsdl) { - $filename = $this->createFilename($wsdl); - if ($this->obtainMutex($filename, "r")) { - // check for expired WSDL that must be removed from the cache - if ($this->cache_lifetime > 0) { - if (file_exists($filename) && (time() - filemtime($filename) > $this->cache_lifetime)) { - unlink($filename); - $this->debug("Expired $wsdl ($filename) from cache"); - $this->releaseMutex($filename); - return null; - } - } - // see what there is to return - if (!file_exists($filename)) { - $this->debug("$wsdl ($filename) not in cache (1)"); - $this->releaseMutex($filename); - return null; - } - $fp = @fopen($filename, "r"); - if ($fp) { - $s = implode("", @file($filename)); - fclose($fp); - $this->debug("Got $wsdl ($filename) from cache"); - } else { - $s = null; - $this->debug("$wsdl ($filename) not in cache (2)"); - } - $this->releaseMutex($filename); - return (!is_null($s)) ? unserialize($s) : null; - } else { - $this->debug("Unable to obtain mutex for $filename in get"); - } - return null; - } - - /** - * obtains the local mutex - * - * @param string $filename The Filename of the Cache to lock - * @param string $mode The open-mode ("r" or "w") or the file - affects lock-mode - * @return boolean Lock successfully obtained ?! - * @access private - */ - function obtainMutex($filename, $mode) { - if (isset($this->fplock[md5($filename)])) { - $this->debug("Lock for $filename already exists"); - return false; - } - $this->fplock[md5($filename)] = fopen($filename.".lock", "w"); - if ($mode == "r") { - return flock($this->fplock[md5($filename)], LOCK_SH); - } else { - return flock($this->fplock[md5($filename)], LOCK_EX); - } - } - - /** - * adds a wsdl instance to the cache - * - * @param object wsdl $wsdl_instance The wsdl instance to add - * @return boolean WSDL successfully cached - * @access public - */ - function put($wsdl_instance) { - $filename = $this->createFilename($wsdl_instance->wsdl); - $s = serialize($wsdl_instance); - if ($this->obtainMutex($filename, "w")) { - $fp = fopen($filename, "w"); - if (! $fp) { - $this->debug("Cannot write $wsdl_instance->wsdl ($filename) in cache"); - $this->releaseMutex($filename); - return false; - } - fputs($fp, $s); - fclose($fp); - $this->debug("Put $wsdl_instance->wsdl ($filename) in cache"); - $this->releaseMutex($filename); - return true; - } else { - $this->debug("Unable to obtain mutex for $filename in put"); - } - return false; - } - - /** - * releases the local mutex - * - * @param string $filename The Filename of the Cache to lock - * @return boolean Lock successfully released - * @access private - */ - function releaseMutex($filename) { - $ret = flock($this->fplock[md5($filename)], LOCK_UN); - fclose($this->fplock[md5($filename)]); - unset($this->fplock[md5($filename)]); - if (! $ret) { - $this->debug("Not able to release lock for $filename"); - } - return $ret; - } - - /** - * removes a wsdl instance from the cache - * - * @param string $wsdl The URL of the wsdl instance - * @return boolean Whether there was an instance to remove - * @access public - */ - function remove($wsdl) { - $filename = $this->createFilename($wsdl); - if (!file_exists($filename)) { - $this->debug("$wsdl ($filename) not in cache to be removed"); - return false; - } - // ignore errors obtaining mutex - $this->obtainMutex($filename, "w"); - $ret = unlink($filename); - $this->debug("Removed ($ret) $wsdl ($filename) from cache"); - $this->releaseMutex($filename); - return $ret; - } -} - -/** - * For backward compatibility - */ -class wsdlcache extends nusoap_wsdlcache { -} -?> diff --git a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.xmlschema.php b/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.xmlschema.php deleted file mode 100755 index 1552e8254..000000000 --- a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/class.xmlschema.php +++ /dev/null @@ -1,972 +0,0 @@ - -* @author Scott Nichol -* @version $Id: class.xmlschema.php 6844 2011-06-03 14:46:51Z dMetzger $ -* @access public -*/ -class nusoap_xmlschema extends nusoap_base { - - // files - var $schema = ''; - var $xml = ''; - // namespaces - var $enclosingNamespaces; - // schema info - var $schemaInfo = array(); - var $schemaTargetNamespace = ''; - // types, elements, attributes defined by the schema - var $attributes = array(); - var $complexTypes = array(); - var $complexTypeStack = array(); - var $currentComplexType = null; - var $elements = array(); - var $elementStack = array(); - var $currentElement = null; - var $simpleTypes = array(); - var $simpleTypeStack = array(); - var $currentSimpleType = null; - // imports - var $imports = array(); - // parser vars - var $parser; - var $position = 0; - var $depth = 0; - var $depth_array = array(); - var $message = array(); - var $defaultNamespace = array(); - - /** - * constructor - * - * @param string $schema schema document URI - * @param string $xml xml document URI - * @param string $namespaces namespaces defined in enclosing XML - * @access public - */ - function nusoap_xmlschema($schema='',$xml='',$namespaces=array()){ - parent::nusoap_base(); - $this->debug('nusoap_xmlschema class instantiated, inside constructor'); - // files - $this->schema = $schema; - $this->xml = $xml; - - // namespaces - $this->enclosingNamespaces = $namespaces; - $this->namespaces = array_merge($this->namespaces, $namespaces); - - // parse schema file - if($schema != ''){ - $this->debug('initial schema file: '.$schema); - $this->parseFile($schema, 'schema'); - } - - // parse xml file - if($xml != ''){ - $this->debug('initial xml file: '.$xml); - $this->parseFile($xml, 'xml'); - } - - } - - /** - * parse an XML file - * - * @param string $xml path/URL to XML file - * @param string $type (schema | xml) - * @return boolean - * @access public - */ - function parseFile($xml,$type){ - // parse xml file - if($xml != ""){ - $xmlStr = @join("",@file($xml)); - if($xmlStr == ""){ - $msg = 'Error reading XML from '.$xml; - $this->setError($msg); - $this->debug($msg); - return false; - } else { - $this->debug("parsing $xml"); - $this->parseString($xmlStr,$type); - $this->debug("done parsing $xml"); - return true; - } - } - return false; - } - - /** - * parse an XML string - * - * @param string $xml path or URL - * @param string $type (schema|xml) - * @access private - */ - function parseString($xml,$type){ - // parse xml string - if($xml != ""){ - - // Create an XML parser. - $this->parser = xml_parser_create(); - // Set the options for parsing the XML data. - xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); - - // Set the object for the parser. - xml_set_object($this->parser, $this); - - // Set the element handlers for the parser. - if($type == "schema"){ - xml_set_element_handler($this->parser, 'schemaStartElement','schemaEndElement'); - xml_set_character_data_handler($this->parser,'schemaCharacterData'); - } elseif($type == "xml"){ - xml_set_element_handler($this->parser, 'xmlStartElement','xmlEndElement'); - xml_set_character_data_handler($this->parser,'xmlCharacterData'); - } - - // Parse the XML file. - if(!xml_parse($this->parser,$xml,true)){ - // Display an error message. - $errstr = sprintf('XML error parsing XML schema on line %d: %s', - xml_get_current_line_number($this->parser), - xml_error_string(xml_get_error_code($this->parser)) - ); - $this->debug($errstr); - $this->debug("XML payload:\n" . $xml); - $this->setError($errstr); - } - - xml_parser_free($this->parser); - } else{ - $this->debug('no xml passed to parseString()!!'); - $this->setError('no xml passed to parseString()!!'); - } - } - - /** - * gets a type name for an unnamed type - * - * @param string Element name - * @return string A type name for an unnamed type - * @access private - */ - function CreateTypeName($ename) { - $scope = ''; - for ($i = 0; $i < count($this->complexTypeStack); $i++) { - $scope .= $this->complexTypeStack[$i] . '_'; - } - return $scope . $ename . '_ContainedType'; - } - - /** - * start-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @param string $attrs associative array of attributes - * @access private - */ - function schemaStartElement($parser, $name, $attrs) { - - // position in the total number of elements, starting from 0 - $pos = $this->position++; - $depth = $this->depth++; - // set self as current value for this depth - $this->depth_array[$depth] = $pos; - $this->message[$pos] = array('cdata' => ''); - if ($depth > 0) { - $this->defaultNamespace[$pos] = $this->defaultNamespace[$this->depth_array[$depth - 1]]; - } else { - $this->defaultNamespace[$pos] = false; - } - - // get element prefix - if($prefix = $this->getPrefix($name)){ - // get unqualified name - $name = $this->getLocalPart($name); - } else { - $prefix = ''; - } - - // loop thru attributes, expanding, and registering namespace declarations - if(count($attrs) > 0){ - foreach($attrs as $k => $v){ - // if ns declarations, add to class level array of valid namespaces - if(preg_match('/^xmlns/',$k)){ - //$this->xdebug("$k: $v"); - //$this->xdebug('ns_prefix: '.$this->getPrefix($k)); - if($ns_prefix = substr(strrchr($k,':'),1)){ - //$this->xdebug("Add namespace[$ns_prefix] = $v"); - $this->namespaces[$ns_prefix] = $v; - } else { - $this->defaultNamespace[$pos] = $v; - if (! $this->getPrefixFromNamespace($v)) { - $this->namespaces['ns'.(count($this->namespaces)+1)] = $v; - } - } - if($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema'){ - $this->XMLSchemaVersion = $v; - $this->namespaces['xsi'] = $v.'-instance'; - } - } - } - foreach($attrs as $k => $v){ - // expand each attribute - $k = strpos($k,':') ? $this->expandQname($k) : $k; - $v = strpos($v,':') ? $this->expandQname($v) : $v; - $eAttrs[$k] = $v; - } - $attrs = $eAttrs; - } else { - $attrs = array(); - } - // find status, register data - switch($name){ - case 'all': // (optional) compositor content for a complexType - case 'choice': - case 'group': - case 'sequence': - //$this->xdebug("compositor $name for currentComplexType: $this->currentComplexType and currentElement: $this->currentElement"); - $this->complexTypes[$this->currentComplexType]['compositor'] = $name; - //if($name == 'all' || $name == 'sequence'){ - // $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; - //} - break; - case 'attribute': // complexType attribute - //$this->xdebug("parsing attribute $attrs[name] $attrs[ref] of value: ".$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']); - $this->xdebug("parsing attribute:"); - $this->appendDebug($this->varDump($attrs)); - if (!isset($attrs['form'])) { - // TODO: handle globals - $attrs['form'] = $this->schemaInfo['attributeFormDefault']; - } - if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) { - $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - if (!strpos($v, ':')) { - // no namespace in arrayType attribute value... - if ($this->defaultNamespace[$pos]) { - // ...so use the default - $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos] . ':' . $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - } - } - } - if(isset($attrs['name'])){ - $this->attributes[$attrs['name']] = $attrs; - $aname = $attrs['name']; - } elseif(isset($attrs['ref']) && $attrs['ref'] == 'http://schemas.xmlsoap.org/soap/encoding/:arrayType'){ - if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) { - $aname = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - } else { - $aname = ''; - } - } elseif(isset($attrs['ref'])){ - $aname = $attrs['ref']; - $this->attributes[$attrs['ref']] = $attrs; - } - - if($this->currentComplexType){ // This should *always* be - $this->complexTypes[$this->currentComplexType]['attrs'][$aname] = $attrs; - } - // arrayType attribute - if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == 'arrayType'){ - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - $prefix = $this->getPrefix($aname); - if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])){ - $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - } else { - $v = ''; - } - if(strpos($v,'[,]')){ - $this->complexTypes[$this->currentComplexType]['multidimensional'] = true; - } - $v = substr($v,0,strpos($v,'[')); // clip the [] - if(!strpos($v,':') && isset($this->typemap[$this->XMLSchemaVersion][$v])){ - $v = $this->XMLSchemaVersion.':'.$v; - } - $this->complexTypes[$this->currentComplexType]['arrayType'] = $v; - } - break; - case 'complexContent': // (optional) content for a complexType - $this->xdebug("do nothing for element $name"); - break; - case 'complexType': - array_push($this->complexTypeStack, $this->currentComplexType); - if(isset($attrs['name'])){ - // TODO: what is the scope of named complexTypes that appear - // nested within other c complexTypes? - $this->xdebug('processing named complexType '.$attrs['name']); - //$this->currentElement = false; - $this->currentComplexType = $attrs['name']; - $this->complexTypes[$this->currentComplexType] = $attrs; - $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType'; - // This is for constructs like - // - // - // - // - // - if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){ - $this->xdebug('complexType is unusual array'); - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - } else { - $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; - } - } else { - $name = $this->CreateTypeName($this->currentElement); - $this->xdebug('processing unnamed complexType for element ' . $this->currentElement . ' named ' . $name); - $this->currentComplexType = $name; - //$this->currentElement = false; - $this->complexTypes[$this->currentComplexType] = $attrs; - $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType'; - // This is for constructs like - // - // - // - // - // - if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){ - $this->xdebug('complexType is unusual array'); - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - } else { - $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; - } - } - $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'false'; - break; - case 'element': - array_push($this->elementStack, $this->currentElement); - if (!isset($attrs['form'])) { - if ($this->currentComplexType) { - $attrs['form'] = $this->schemaInfo['elementFormDefault']; - } else { - // global - $attrs['form'] = 'qualified'; - } - } - if(isset($attrs['type'])){ - $this->xdebug("processing typed element ".$attrs['name']." of type ".$attrs['type']); - if (! $this->getPrefix($attrs['type'])) { - if ($this->defaultNamespace[$pos]) { - $attrs['type'] = $this->defaultNamespace[$pos] . ':' . $attrs['type']; - $this->xdebug('used default namespace to make type ' . $attrs['type']); - } - } - // This is for constructs like - // - // - // - // - // - if ($this->currentComplexType && $this->complexTypes[$this->currentComplexType]['phpType'] == 'array') { - $this->xdebug('arrayType for unusual array is ' . $attrs['type']); - $this->complexTypes[$this->currentComplexType]['arrayType'] = $attrs['type']; - } - $this->currentElement = $attrs['name']; - $ename = $attrs['name']; - } elseif(isset($attrs['ref'])){ - $this->xdebug("processing element as ref to ".$attrs['ref']); - $this->currentElement = "ref to ".$attrs['ref']; - $ename = $this->getLocalPart($attrs['ref']); - } else { - $type = $this->CreateTypeName($this->currentComplexType . '_' . $attrs['name']); - $this->xdebug("processing untyped element " . $attrs['name'] . ' type ' . $type); - $this->currentElement = $attrs['name']; - $attrs['type'] = $this->schemaTargetNamespace . ':' . $type; - $ename = $attrs['name']; - } - if (isset($ename) && $this->currentComplexType) { - $this->xdebug("add element $ename to complexType $this->currentComplexType"); - $this->complexTypes[$this->currentComplexType]['elements'][$ename] = $attrs; - } elseif (!isset($attrs['ref'])) { - $this->xdebug("add element $ename to elements array"); - $this->elements[ $attrs['name'] ] = $attrs; - $this->elements[ $attrs['name'] ]['typeClass'] = 'element'; - } - break; - case 'enumeration': // restriction value list member - $this->xdebug('enumeration ' . $attrs['value']); - if ($this->currentSimpleType) { - $this->simpleTypes[$this->currentSimpleType]['enumeration'][] = $attrs['value']; - } elseif ($this->currentComplexType) { - $this->complexTypes[$this->currentComplexType]['enumeration'][] = $attrs['value']; - } - break; - case 'extension': // simpleContent or complexContent type extension - $this->xdebug('extension ' . $attrs['base']); - if ($this->currentComplexType) { - $ns = $this->getPrefix($attrs['base']); - if ($ns == '') { - $this->complexTypes[$this->currentComplexType]['extensionBase'] = $this->schemaTargetNamespace . ':' . $attrs['base']; - } else { - $this->complexTypes[$this->currentComplexType]['extensionBase'] = $attrs['base']; - } - } else { - $this->xdebug('no current complexType to set extensionBase'); - } - break; - case 'import': - if (isset($attrs['schemaLocation'])) { - $this->xdebug('import namespace ' . $attrs['namespace'] . ' from ' . $attrs['schemaLocation']); - $this->imports[$attrs['namespace']][] = array('location' => $attrs['schemaLocation'], 'loaded' => false); - } else { - $this->xdebug('import namespace ' . $attrs['namespace']); - $this->imports[$attrs['namespace']][] = array('location' => '', 'loaded' => true); - if (! $this->getPrefixFromNamespace($attrs['namespace'])) { - $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; - } - } - break; - case 'include': - if (isset($attrs['schemaLocation'])) { - $this->xdebug('include into namespace ' . $this->schemaTargetNamespace . ' from ' . $attrs['schemaLocation']); - $this->imports[$this->schemaTargetNamespace][] = array('location' => $attrs['schemaLocation'], 'loaded' => false); - } else { - $this->xdebug('ignoring invalid XML Schema construct: include without schemaLocation attribute'); - } - break; - case 'list': // simpleType value list - $this->xdebug("do nothing for element $name"); - break; - case 'restriction': // simpleType, simpleContent or complexContent value restriction - $this->xdebug('restriction ' . $attrs['base']); - if($this->currentSimpleType){ - $this->simpleTypes[$this->currentSimpleType]['type'] = $attrs['base']; - } elseif($this->currentComplexType){ - $this->complexTypes[$this->currentComplexType]['restrictionBase'] = $attrs['base']; - if(strstr($attrs['base'],':') == ':Array'){ - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - } - } - break; - case 'schema': - $this->schemaInfo = $attrs; - $this->schemaInfo['schemaVersion'] = $this->getNamespaceFromPrefix($prefix); - if (isset($attrs['targetNamespace'])) { - $this->schemaTargetNamespace = $attrs['targetNamespace']; - } - if (!isset($attrs['elementFormDefault'])) { - $this->schemaInfo['elementFormDefault'] = 'unqualified'; - } - if (!isset($attrs['attributeFormDefault'])) { - $this->schemaInfo['attributeFormDefault'] = 'unqualified'; - } - break; - case 'simpleContent': // (optional) content for a complexType - if ($this->currentComplexType) { // This should *always* be - $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'true'; - } else { - $this->xdebug("do nothing for element $name because there is no current complexType"); - } - break; - case 'simpleType': - array_push($this->simpleTypeStack, $this->currentSimpleType); - if(isset($attrs['name'])){ - $this->xdebug("processing simpleType for name " . $attrs['name']); - $this->currentSimpleType = $attrs['name']; - $this->simpleTypes[ $attrs['name'] ] = $attrs; - $this->simpleTypes[ $attrs['name'] ]['typeClass'] = 'simpleType'; - $this->simpleTypes[ $attrs['name'] ]['phpType'] = 'scalar'; - } else { - $name = $this->CreateTypeName($this->currentComplexType . '_' . $this->currentElement); - $this->xdebug('processing unnamed simpleType for element ' . $this->currentElement . ' named ' . $name); - $this->currentSimpleType = $name; - //$this->currentElement = false; - $this->simpleTypes[$this->currentSimpleType] = $attrs; - $this->simpleTypes[$this->currentSimpleType]['phpType'] = 'scalar'; - } - break; - case 'union': // simpleType type list - $this->xdebug("do nothing for element $name"); - break; - default: - $this->xdebug("do not have any logic to process element $name"); - } - } - - /** - * end-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @access private - */ - function schemaEndElement($parser, $name) { - // bring depth down a notch - $this->depth--; - // position of current element is equal to the last value left in depth_array for my depth - if(isset($this->depth_array[$this->depth])){ - $pos = $this->depth_array[$this->depth]; - } - // get element prefix - if ($prefix = $this->getPrefix($name)){ - // get unqualified name - $name = $this->getLocalPart($name); - } else { - $prefix = ''; - } - // move on... - if($name == 'complexType'){ - $this->xdebug('done processing complexType ' . ($this->currentComplexType ? $this->currentComplexType : '(unknown)')); - $this->xdebug($this->varDump($this->complexTypes[$this->currentComplexType])); - $this->currentComplexType = array_pop($this->complexTypeStack); - //$this->currentElement = false; - } - if($name == 'element'){ - $this->xdebug('done processing element ' . ($this->currentElement ? $this->currentElement : '(unknown)')); - $this->currentElement = array_pop($this->elementStack); - } - if($name == 'simpleType'){ - $this->xdebug('done processing simpleType ' . ($this->currentSimpleType ? $this->currentSimpleType : '(unknown)')); - $this->xdebug($this->varDump($this->simpleTypes[$this->currentSimpleType])); - $this->currentSimpleType = array_pop($this->simpleTypeStack); - } - } - - /** - * element content handler - * - * @param string $parser XML parser object - * @param string $data element content - * @access private - */ - function schemaCharacterData($parser, $data){ - $pos = $this->depth_array[$this->depth - 1]; - $this->message[$pos]['cdata'] .= $data; - } - - /** - * serialize the schema - * - * @access public - */ - function serializeSchema(){ - - $schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion); - $xml = ''; - // imports - if (sizeof($this->imports) > 0) { - foreach($this->imports as $ns => $list) { - foreach ($list as $ii) { - if ($ii['location'] != '') { - $xml .= " <$schemaPrefix:import location=\"" . $ii['location'] . '" namespace="' . $ns . "\" />\n"; - } else { - $xml .= " <$schemaPrefix:import namespace=\"" . $ns . "\" />\n"; - } - } - } - } - // complex types - foreach($this->complexTypes as $typeName => $attrs){ - $contentStr = ''; - // serialize child elements - if(isset($attrs['elements']) && (count($attrs['elements']) > 0)){ - foreach($attrs['elements'] as $element => $eParts){ - if(isset($eParts['ref'])){ - $contentStr .= " <$schemaPrefix:element ref=\"$element\"/>\n"; - } else { - $contentStr .= " <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($eParts['type']) . "\""; - foreach ($eParts as $aName => $aValue) { - // handle, e.g., abstract, default, form, minOccurs, maxOccurs, nillable - if ($aName != 'name' && $aName != 'type') { - $contentStr .= " $aName=\"$aValue\""; - } - } - $contentStr .= "/>\n"; - } - } - // compositor wraps elements - if (isset($attrs['compositor']) && ($attrs['compositor'] != '')) { - $contentStr = " <$schemaPrefix:$attrs[compositor]>\n".$contentStr." \n"; - } - } - // attributes - if(isset($attrs['attrs']) && (count($attrs['attrs']) >= 1)){ - foreach($attrs['attrs'] as $attr => $aParts){ - $contentStr .= " <$schemaPrefix:attribute"; - foreach ($aParts as $a => $v) { - if ($a == 'ref' || $a == 'type') { - $contentStr .= " $a=\"".$this->contractQName($v).'"'; - } elseif ($a == 'http://schemas.xmlsoap.org/wsdl/:arrayType') { - $this->usedNamespaces['wsdl'] = $this->namespaces['wsdl']; - $contentStr .= ' wsdl:arrayType="'.$this->contractQName($v).'"'; - } else { - $contentStr .= " $a=\"$v\""; - } - } - $contentStr .= "/>\n"; - } - } - // if restriction - if (isset($attrs['restrictionBase']) && $attrs['restrictionBase'] != ''){ - $contentStr = " <$schemaPrefix:restriction base=\"".$this->contractQName($attrs['restrictionBase'])."\">\n".$contentStr." \n"; - // complex or simple content - if ((isset($attrs['elements']) && count($attrs['elements']) > 0) || (isset($attrs['attrs']) && count($attrs['attrs']) > 0)){ - $contentStr = " <$schemaPrefix:complexContent>\n".$contentStr." \n"; - } - } - // finalize complex type - if($contentStr != ''){ - $contentStr = " <$schemaPrefix:complexType name=\"$typeName\">\n".$contentStr." \n"; - } else { - $contentStr = " <$schemaPrefix:complexType name=\"$typeName\"/>\n"; - } - $xml .= $contentStr; - } - // simple types - if(isset($this->simpleTypes) && count($this->simpleTypes) > 0){ - foreach($this->simpleTypes as $typeName => $eParts){ - $xml .= " <$schemaPrefix:simpleType name=\"$typeName\">\n <$schemaPrefix:restriction base=\"".$this->contractQName($eParts['type'])."\">\n"; - if (isset($eParts['enumeration'])) { - foreach ($eParts['enumeration'] as $e) { - $xml .= " <$schemaPrefix:enumeration value=\"$e\"/>\n"; - } - } - $xml .= " \n "; - } - } - // elements - if(isset($this->elements) && count($this->elements) > 0){ - foreach($this->elements as $element => $eParts){ - $xml .= " <$schemaPrefix:element name=\"$element\" type=\"".$this->contractQName($eParts['type'])."\"/>\n"; - } - } - // attributes - if(isset($this->attributes) && count($this->attributes) > 0){ - foreach($this->attributes as $attr => $aParts){ - $xml .= " <$schemaPrefix:attribute name=\"$attr\" type=\"".$this->contractQName($aParts['type'])."\"\n/>"; - } - } - // finish 'er up - $attr = ''; - foreach ($this->schemaInfo as $k => $v) { - if ($k == 'elementFormDefault' || $k == 'attributeFormDefault') { - $attr .= " $k=\"$v\""; - } - } - $el = "<$schemaPrefix:schema$attr targetNamespace=\"$this->schemaTargetNamespace\"\n"; - foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) { - $el .= " xmlns:$nsp=\"$ns\""; - } - $xml = $el . ">\n".$xml."\n"; - return $xml; - } - - /** - * adds debug data to the clas level debug string - * - * @param string $string debug data - * @access private - */ - function xdebug($string){ - $this->debug('<' . $this->schemaTargetNamespace . '> '.$string); - } - - /** - * get the PHP type of a user defined type in the schema - * PHP type is kind of a misnomer since it actually returns 'struct' for assoc. arrays - * returns false if no type exists, or not w/ the given namespace - * else returns a string that is either a native php type, or 'struct' - * - * @param string $type name of defined type - * @param string $ns namespace of type - * @return mixed - * @access public - * @deprecated - */ - function getPHPType($type,$ns){ - if(isset($this->typemap[$ns][$type])){ - //print "found type '$type' and ns $ns in typemap
    "; - return $this->typemap[$ns][$type]; - } elseif(isset($this->complexTypes[$type])){ - //print "getting type '$type' and ns $ns from complexTypes array
    "; - return $this->complexTypes[$type]['phpType']; - } - return false; - } - - /** - * returns an associative array of information about a given type - * returns false if no type exists by the given name - * - * For a complexType typeDef = array( - * 'restrictionBase' => '', - * 'phpType' => '', - * 'compositor' => '(sequence|all)', - * 'elements' => array(), // refs to elements array - * 'attrs' => array() // refs to attributes array - * ... and so on (see addComplexType) - * ) - * - * For simpleType or element, the array has different keys. - * - * @param string $type - * @return mixed - * @access public - * @see addComplexType - * @see addSimpleType - * @see addElement - */ - function getTypeDef($type){ - //$this->debug("in getTypeDef for type $type"); - if (substr($type, -1) == '^') { - $is_element = 1; - $type = substr($type, 0, -1); - } else { - $is_element = 0; - } - - if((! $is_element) && isset($this->complexTypes[$type])){ - $this->xdebug("in getTypeDef, found complexType $type"); - return $this->complexTypes[$type]; - } elseif((! $is_element) && isset($this->simpleTypes[$type])){ - $this->xdebug("in getTypeDef, found simpleType $type"); - if (!isset($this->simpleTypes[$type]['phpType'])) { - // get info for type to tack onto the simple type - // TODO: can this ever really apply (i.e. what is a simpleType really?) - $uqType = substr($this->simpleTypes[$type]['type'], strrpos($this->simpleTypes[$type]['type'], ':') + 1); - $ns = substr($this->simpleTypes[$type]['type'], 0, strrpos($this->simpleTypes[$type]['type'], ':')); - $etype = $this->getTypeDef($uqType); - if ($etype) { - $this->xdebug("in getTypeDef, found type for simpleType $type:"); - $this->xdebug($this->varDump($etype)); - if (isset($etype['phpType'])) { - $this->simpleTypes[$type]['phpType'] = $etype['phpType']; - } - if (isset($etype['elements'])) { - $this->simpleTypes[$type]['elements'] = $etype['elements']; - } - } - } - return $this->simpleTypes[$type]; - } elseif(isset($this->elements[$type])){ - $this->xdebug("in getTypeDef, found element $type"); - if (!isset($this->elements[$type]['phpType'])) { - // get info for type to tack onto the element - $uqType = substr($this->elements[$type]['type'], strrpos($this->elements[$type]['type'], ':') + 1); - $ns = substr($this->elements[$type]['type'], 0, strrpos($this->elements[$type]['type'], ':')); - $etype = $this->getTypeDef($uqType); - if ($etype) { - $this->xdebug("in getTypeDef, found type for element $type:"); - $this->xdebug($this->varDump($etype)); - if (isset($etype['phpType'])) { - $this->elements[$type]['phpType'] = $etype['phpType']; - } - if (isset($etype['elements'])) { - $this->elements[$type]['elements'] = $etype['elements']; - } - if (isset($etype['extensionBase'])) { - $this->elements[$type]['extensionBase'] = $etype['extensionBase']; - } - } elseif ($ns == 'http://www.w3.org/2001/XMLSchema') { - $this->xdebug("in getTypeDef, element $type is an XSD type"); - $this->elements[$type]['phpType'] = 'scalar'; - } - } - return $this->elements[$type]; - } elseif(isset($this->attributes[$type])){ - $this->xdebug("in getTypeDef, found attribute $type"); - return $this->attributes[$type]; - } elseif (preg_match('/_ContainedType$/', $type)) { - $this->xdebug("in getTypeDef, have an untyped element $type"); - $typeDef['typeClass'] = 'simpleType'; - $typeDef['phpType'] = 'scalar'; - $typeDef['type'] = 'http://www.w3.org/2001/XMLSchema:string'; - return $typeDef; - } - $this->xdebug("in getTypeDef, did not find $type"); - return false; - } - - /** - * returns a sample serialization of a given type, or false if no type by the given name - * - * @param string $type name of type - * @return mixed - * @access public - * @deprecated - */ - function serializeTypeDef($type){ - //print "in sTD() for type $type
    "; - if($typeDef = $this->getTypeDef($type)){ - $str .= '<'.$type; - if(is_array($typeDef['attrs'])){ - foreach($typeDef['attrs'] as $attName => $data){ - $str .= " $attName=\"{type = ".$data['type']."}\""; - } - } - $str .= " xmlns=\"".$this->schema['targetNamespace']."\""; - if(count($typeDef['elements']) > 0){ - $str .= ">"; - foreach($typeDef['elements'] as $element => $eData){ - $str .= $this->serializeTypeDef($element); - } - $str .= ""; - } elseif($typeDef['typeClass'] == 'element') { - $str .= ">"; - } else { - $str .= "/>"; - } - return $str; - } - return false; - } - - /** - * returns HTML form elements that allow a user - * to enter values for creating an instance of the given type. - * - * @param string $name name for type instance - * @param string $type name of type - * @return string - * @access public - * @deprecated - */ - function typeToForm($name,$type){ - // get typedef - if($typeDef = $this->getTypeDef($type)){ - // if struct - if($typeDef['phpType'] == 'struct'){ - $buffer .= ''; - foreach($typeDef['elements'] as $child => $childDef){ - $buffer .= " - - "; - } - $buffer .= '
    $childDef[name] (type: ".$this->getLocalPart($childDef['type'])."):
    '; - // if array - } elseif($typeDef['phpType'] == 'array'){ - $buffer .= ''; - for($i=0;$i < 3; $i++){ - $buffer .= " - - "; - } - $buffer .= '
    array item (type: $typeDef[arrayType]):
    '; - // if scalar - } else { - $buffer .= ""; - } - } else { - $buffer .= ""; - } - return $buffer; - } - - /** - * adds a complex type to the schema - * - * example: array - * - * addType( - * 'ArrayOfstring', - * 'complexType', - * 'array', - * '', - * 'SOAP-ENC:Array', - * array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'string[]'), - * 'xsd:string' - * ); - * - * example: PHP associative array ( SOAP Struct ) - * - * addType( - * 'SOAPStruct', - * 'complexType', - * 'struct', - * 'all', - * array('myVar'=> array('name'=>'myVar','type'=>'string') - * ); - * - * @param name - * @param typeClass (complexType|simpleType|attribute) - * @param phpType: currently supported are array and struct (php assoc array) - * @param compositor (all|sequence|choice) - * @param restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param elements = array ( name = array(name=>'',type=>'') ) - * @param attrs = array( - * array( - * 'ref' => "http://schemas.xmlsoap.org/soap/encoding/:arrayType", - * "http://schemas.xmlsoap.org/wsdl/:arrayType" => "string[]" - * ) - * ) - * @param arrayType: namespace:name (http://www.w3.org/2001/XMLSchema:string) - * @access public - * @see getTypeDef - */ - function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType=''){ - $this->complexTypes[$name] = array( - 'name' => $name, - 'typeClass' => $typeClass, - 'phpType' => $phpType, - 'compositor'=> $compositor, - 'restrictionBase' => $restrictionBase, - 'elements' => $elements, - 'attrs' => $attrs, - 'arrayType' => $arrayType - ); - - $this->xdebug("addComplexType $name:"); - $this->appendDebug($this->varDump($this->complexTypes[$name])); - } - - /** - * adds a simple type to the schema - * - * @param string $name - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param string $typeClass (should always be simpleType) - * @param string $phpType (should always be scalar) - * @param array $enumeration array of values - * @access public - * @see nusoap_xmlschema - * @see getTypeDef - */ - function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) { - $this->simpleTypes[$name] = array( - 'name' => $name, - 'typeClass' => $typeClass, - 'phpType' => $phpType, - 'type' => $restrictionBase, - 'enumeration' => $enumeration - ); - - $this->xdebug("addSimpleType $name:"); - $this->appendDebug($this->varDump($this->simpleTypes[$name])); - } - - /** - * adds an element to the schema - * - * @param array $attrs attributes that must include name and type - * @see nusoap_xmlschema - * @access public - */ - function addElement($attrs) { - if (! $this->getPrefix($attrs['type'])) { - $attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['type']; - } - $this->elements[ $attrs['name'] ] = $attrs; - $this->elements[ $attrs['name'] ]['typeClass'] = 'element'; - - $this->xdebug("addElement " . $attrs['name']); - $this->appendDebug($this->varDump($this->elements[ $attrs['name'] ])); - } -} - -/** - * Backward compatibility - */ -class XMLSchema extends nusoap_xmlschema { -} - - diff --git a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/index.php b/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/index.php deleted file mode 100644 index 4e2611d37..000000000 --- a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/index.php +++ /dev/null @@ -1,36 +0,0 @@ - -* @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision$ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); -header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); - -header("Cache-Control: no-store, no-cache, must-revalidate"); -header("Cache-Control: post-check=0, pre-check=0", false); -header("Pragma: no-cache"); - -header("Location: ../"); -exit; \ No newline at end of file diff --git a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/nusoap.php b/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/nusoap.php deleted file mode 100755 index 7d1fa1f92..000000000 --- a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/nusoap.php +++ /dev/null @@ -1,8148 +0,0 @@ - -* @author Scott Nichol -* @version $Id: nusoap.php 7091 2011-06-16 11:34:02Z mMarinetti $ -* @access public -*/ -class nusoap_base { - /** - * Identification for HTTP headers. - * - * @var string - * @access private - */ - var $title = 'NuSOAP'; - /** - * Version for HTTP headers. - * - * @var string - * @access private - */ - var $version = '0.9.5'; - /** - * CVS revision for HTTP headers. - * - * @var string - * @access private - */ - var $revision = '$Revision: 7091 $'; - /** - * Current error string (manipulated by getError/setError) - * - * @var string - * @access private - */ - var $error_str = ''; - /** - * Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment) - * - * @var string - * @access private - */ - var $debug_str = ''; - /** - * toggles automatic encoding of special characters as entities - * (should always be true, I think) - * - * @var boolean - * @access private - */ - var $charencoding = true; - /** - * the debug level for this instance - * - * @var integer - * @access private - */ - var $debugLevel; - - /** - * set schema version - * - * @var string - * @access public - */ - var $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'; - - /** - * charset encoding for outgoing messages - * - * @var string - * @access public - */ - var $soap_defencoding = 'ISO-8859-1'; - //var $soap_defencoding = 'UTF-8'; - - /** - * namespaces in an array of prefix => uri - * - * this is "seeded" by a set of constants, but it may be altered by code - * - * @var array - * @access public - */ - var $namespaces = array( - 'SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/', - 'xsd' => 'http://www.w3.org/2001/XMLSchema', - 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance', - 'SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/' - ); - - /** - * namespaces used in the current context, e.g. during serialization - * - * @var array - * @access private - */ - var $usedNamespaces = array(); - - /** - * XML Schema types in an array of uri => (array of xml type => php type) - * is this legacy yet? - * no, this is used by the nusoap_xmlschema class to verify type => namespace mappings. - * @var array - * @access public - */ - var $typemap = array( - 'http://www.w3.org/2001/XMLSchema' => array( - 'string'=>'string','boolean'=>'boolean','float'=>'double','double'=>'double','decimal'=>'double', - 'duration'=>'','dateTime'=>'string','time'=>'string','date'=>'string','gYearMonth'=>'', - 'gYear'=>'','gMonthDay'=>'','gDay'=>'','gMonth'=>'','hexBinary'=>'string','base64Binary'=>'string', - // abstract "any" types - 'anyType'=>'string','anySimpleType'=>'string', - // derived datatypes - 'normalizedString'=>'string','token'=>'string','language'=>'','NMTOKEN'=>'','NMTOKENS'=>'','Name'=>'','NCName'=>'','ID'=>'', - 'IDREF'=>'','IDREFS'=>'','ENTITY'=>'','ENTITIES'=>'','integer'=>'integer','nonPositiveInteger'=>'integer', - 'negativeInteger'=>'integer','long'=>'integer','int'=>'integer','short'=>'integer','byte'=>'integer','nonNegativeInteger'=>'integer', - 'unsignedLong'=>'','unsignedInt'=>'','unsignedShort'=>'','unsignedByte'=>'','positiveInteger'=>''), - 'http://www.w3.org/2000/10/XMLSchema' => array( - 'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double', - 'float'=>'double','dateTime'=>'string', - 'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'), - 'http://www.w3.org/1999/XMLSchema' => array( - 'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double', - 'float'=>'double','dateTime'=>'string', - 'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'), - 'http://soapinterop.org/xsd' => array('SOAPStruct'=>'struct'), - 'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string','array'=>'array','Array'=>'array'), - 'http://xml.apache.org/xml-soap' => array('Map') - ); - - /** - * XML entities to convert - * - * @var array - * @access public - * @deprecated - * @see expandEntities - */ - var $xmlEntities = array('quot' => '"','amp' => '&', - 'lt' => '<','gt' => '>','apos' => "'"); - - /** - * constructor - * - * @access public - */ - function nusoap_base() { - $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel']; - } - - /** - * gets the global debug level, which applies to future instances - * - * @return integer Debug level 0-9, where 0 turns off - * @access public - */ - function getGlobalDebugLevel() { - return $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel']; - } - - /** - * sets the global debug level, which applies to future instances - * - * @param int $level Debug level 0-9, where 0 turns off - * @access public - */ - function setGlobalDebugLevel($level) { - $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'] = $level; - } - - /** - * gets the debug level for this instance - * - * @return int Debug level 0-9, where 0 turns off - * @access public - */ - function getDebugLevel() { - return $this->debugLevel; - } - - /** - * sets the debug level for this instance - * - * @param int $level Debug level 0-9, where 0 turns off - * @access public - */ - function setDebugLevel($level) { - $this->debugLevel = $level; - } - - /** - * adds debug data to the instance debug string with formatting - * - * @param string $string debug data - * @access private - */ - function debug($string){ - if ($this->debugLevel > 0) { - $this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n"); - } - } - - /** - * adds debug data to the instance debug string without formatting - * - * @param string $string debug data - * @access public - */ - function appendDebug($string){ - if ($this->debugLevel > 0) { - // it would be nice to use a memory stream here to use - // memory more efficiently - $this->debug_str .= $string; - } - } - - /** - * clears the current debug data for this instance - * - * @access public - */ - function clearDebug() { - // it would be nice to use a memory stream here to use - // memory more efficiently - $this->debug_str = ''; - } - - /** - * gets the current debug data for this instance - * - * @return debug data - * @access public - */ - function &getDebug() { - // it would be nice to use a memory stream here to use - // memory more efficiently - return $this->debug_str; - } - - /** - * gets the current debug data for this instance as an XML comment - * this may change the contents of the debug data - * - * @return debug data as an XML comment - * @access public - */ - function &getDebugAsXMLComment() { - // it would be nice to use a memory stream here to use - // memory more efficiently - while (strpos($this->debug_str, '--')) { - $this->debug_str = str_replace('--', '- -', $this->debug_str); - } - $ret = ""; - return $ret; - } - - /** - * expands entities, e.g. changes '<' to '<'. - * - * @param string $val The string in which to expand entities. - * @access private - */ - function expandEntities($val) { - if ($this->charencoding) { - $val = str_replace('&', '&', $val); - $val = str_replace("'", ''', $val); - $val = str_replace('"', '"', $val); - $val = str_replace('<', '<', $val); - $val = str_replace('>', '>', $val); - } - return $val; - } - - /** - * returns error string if present - * - * @return mixed error string or false - * @access public - */ - function getError(){ - if($this->error_str != ''){ - return $this->error_str; - } - return false; - } - - /** - * sets error string - * - * @return boolean $string error string - * @access private - */ - function setError($str){ - $this->error_str = $str; - } - - /** - * detect if array is a simple array or a struct (associative array) - * - * @param mixed $val The PHP array - * @return string (arraySimple|arrayStruct) - * @access private - */ - function isArraySimpleOrStruct($val) { - $keyList = array_keys($val); - foreach ($keyList as $keyListValue) { - if (!is_int($keyListValue)) { - return 'arrayStruct'; - } - } - return 'arraySimple'; - } - - /** - * serializes PHP values in accordance w/ section 5. Type information is - * not serialized if $use == 'literal'. - * - * @param mixed $val The value to serialize - * @param string $name The name (local part) of the XML element - * @param string $type The XML schema type (local part) for the element - * @param string $name_ns The namespace for the name of the XML element - * @param string $type_ns The namespace for the type of the element - * @param array $attributes The attributes to serialize as name=>value pairs - * @param string $use The WSDL "use" (encoded|literal) - * @param boolean $soapval Whether this is called from soapval. - * @return string The serialized element, possibly with child elements - * @access public - */ - function serialize_val($val,$name=false,$type=false,$name_ns=false,$type_ns=false,$attributes=false,$use='encoded',$soapval=false) { - $this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use, soapval=$soapval"); - $this->appendDebug('value=' . $this->varDump($val)); - $this->appendDebug('attributes=' . $this->varDump($attributes)); - - if (is_object($val) && get_class($val) == 'soapval' && (! $soapval)) { - $this->debug("serialize_val: serialize soapval"); - $xml = $val->serialize($use); - $this->appendDebug($val->getDebug()); - $val->clearDebug(); - $this->debug("serialize_val of soapval returning $xml"); - return $xml; - } - // force valid name if necessary - if (is_numeric($name)) { - $name = '__numeric_' . $name; - } elseif (! $name) { - $name = 'noname'; - } - // if name has ns, add ns prefix to name - $xmlns = ''; - if($name_ns){ - $prefix = 'nu'.rand(1000,9999); - $name = $prefix.':'.$name; - $xmlns .= " xmlns:$prefix=\"$name_ns\""; - } - // if type is prefixed, create type prefix - if($type_ns != '' && $type_ns == $this->namespaces['xsd']){ - // need to fix this. shouldn't default to xsd if no ns specified - // w/o checking against typemap - $type_prefix = 'xsd'; - } elseif($type_ns){ - $type_prefix = 'ns'.rand(1000,9999); - $xmlns .= " xmlns:$type_prefix=\"$type_ns\""; - } - // serialize attributes if present - $atts = ''; - if($attributes){ - foreach($attributes as $k => $v){ - $atts .= " $k=\"".$this->expandEntities($v).'"'; - } - } - // serialize null value - if (is_null($val)) { - $this->debug("serialize_val: serialize null"); - if ($use == 'literal') { - // TODO: depends on minOccurs - $xml = "<$name$xmlns$atts/>"; - $this->debug("serialize_val returning $xml"); - return $xml; - } else { - if (isset($type) && isset($type_prefix)) { - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = ''; - } - $xml = "<$name$xmlns$type_str$atts xsi:nil=\"true\"/>"; - $this->debug("serialize_val returning $xml"); - return $xml; - } - } - // serialize if an xsd built-in primitive type - if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){ - $this->debug("serialize_val: serialize xsd built-in primitive type"); - if (is_bool($val)) { - if ($type == 'boolean') { - $val = $val ? 'true' : 'false'; - } elseif (! $val) { - $val = 0; - } - } else if (is_string($val)) { - $val = $this->expandEntities($val); - } - if ($use == 'literal') { - $xml = "<$name$xmlns$atts>$val"; - $this->debug("serialize_val returning $xml"); - return $xml; - } else { - $xml = "<$name$xmlns xsi:type=\"xsd:$type\"$atts>$val"; - $this->debug("serialize_val returning $xml"); - return $xml; - } - } - // detect type and serialize - $xml = ''; - switch(true) { - case (is_bool($val) || $type == 'boolean'): - $this->debug("serialize_val: serialize boolean"); - if ($type == 'boolean') { - $val = $val ? 'true' : 'false'; - } elseif (! $val) { - $val = 0; - } - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:boolean\"$atts>$val"; - } - break; - case (is_int($val) || is_long($val) || $type == 'int'): - $this->debug("serialize_val: serialize int"); - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val"; - } - break; - case (is_float($val)|| is_double($val) || $type == 'float'): - $this->debug("serialize_val: serialize float"); - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:float\"$atts>$val"; - } - break; - case (is_string($val) || $type == 'string'): - $this->debug("serialize_val: serialize string"); - $val = $this->expandEntities($val); - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:string\"$atts>$val"; - } - break; - case is_object($val): - $this->debug("serialize_val: serialize object"); - if (get_class($val) == 'soapval') { - $this->debug("serialize_val: serialize soapval object"); - $pXml = $val->serialize($use); - $this->appendDebug($val->getDebug()); - $val->clearDebug(); - } else { - if (! $name) { - $name = get_class($val); - $this->debug("In serialize_val, used class name $name as element name"); - } else { - $this->debug("In serialize_val, do not override name $name for element name for class " . get_class($val)); - } - foreach(get_object_vars($val) as $k => $v){ - $pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use); - } - } - if(isset($type) && isset($type_prefix)){ - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = ''; - } - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$pXml"; - } else { - $xml .= "<$name$xmlns$type_str$atts>$pXml"; - } - break; - break; - case (is_array($val) || $type): - // detect if struct or array - $valueType = $this->isArraySimpleOrStruct($val); - if($valueType=='arraySimple' || preg_match('/^ArrayOf/',$type)){ - $this->debug("serialize_val: serialize array"); - $i = 0; - if(is_array($val) && count($val)> 0){ - foreach($val as $v){ - if(is_object($v) && get_class($v) == 'soapval'){ - $tt_ns = $v->type_ns; - $tt = $v->type; - } elseif (is_array($v)) { - $tt = $this->isArraySimpleOrStruct($v); - } else { - $tt = gettype($v); - } - $array_types[$tt] = 1; - // TODO: for literal, the name should be $name - $xml .= $this->serialize_val($v,'item',false,false,false,false,$use); - ++$i; - } - if(count($array_types) > 1){ - $array_typename = 'xsd:anyType'; - } elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) { - if ($tt == 'integer') { - $tt = 'int'; - } - $array_typename = 'xsd:'.$tt; - } elseif(isset($tt) && $tt == 'arraySimple'){ - $array_typename = 'SOAP-ENC:Array'; - } elseif(isset($tt) && $tt == 'arrayStruct'){ - $array_typename = 'unnamed_struct_use_soapval'; - } else { - // if type is prefixed, create type prefix - if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){ - $array_typename = 'xsd:' . $tt; - } elseif ($tt_ns) { - $tt_prefix = 'ns' . rand(1000, 9999); - $array_typename = "$tt_prefix:$tt"; - $xmlns .= " xmlns:$tt_prefix=\"$tt_ns\""; - } else { - $array_typename = $tt; - } - } - $array_type = $i; - if ($use == 'literal') { - $type_str = ''; - } else if (isset($type) && isset($type_prefix)) { - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"".$array_typename."[$array_type]\""; - } - // empty array - } else { - if ($use == 'literal') { - $type_str = ''; - } else if (isset($type) && isset($type_prefix)) { - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:anyType[0]\""; - } - } - // TODO: for array in literal, there is no wrapper here - $xml = "<$name$xmlns$type_str$atts>".$xml.""; - } else { - // got a struct - $this->debug("serialize_val: serialize struct"); - if(isset($type) && isset($type_prefix)){ - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = ''; - } - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>"; - } else { - $xml .= "<$name$xmlns$type_str$atts>"; - } - foreach($val as $k => $v){ - // Apache Map - if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') { - $xml .= ''; - $xml .= $this->serialize_val($k,'key',false,false,false,false,$use); - $xml .= $this->serialize_val($v,'value',false,false,false,false,$use); - $xml .= ''; - } else { - $xml .= $this->serialize_val($v,$k,false,false,false,false,$use); - } - } - $xml .= ""; - } - break; - default: - $this->debug("serialize_val: serialize unknown"); - $xml .= 'not detected, got '.gettype($val).' for '.$val; - break; - } - $this->debug("serialize_val returning $xml"); - return $xml; - } - - /** - * serializes a message - * - * @param string $body the XML of the SOAP body - * @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array - * @param array $namespaces optional the namespaces used in generating the body and headers - * @param string $style optional (rpc|document) - * @param string $use optional (encoded|literal) - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) - * @return string the message - * @access public - */ - function serializeEnvelope($body,$headers=false,$namespaces=array(),$style='rpc',$use='encoded',$encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'){ - // TODO: add an option to automatically run utf8_encode on $body and $headers - // if $this->soap_defencoding is UTF-8. Not doing this automatically allows - // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1 - - $this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle"); - $this->debug("headers:"); - $this->appendDebug($this->varDump($headers)); - $this->debug("namespaces:"); - $this->appendDebug($this->varDump($namespaces)); - - // serialize namespaces - $ns_string = ''; - foreach(array_merge($this->namespaces,$namespaces) as $k => $v){ - $ns_string .= " xmlns:$k=\"$v\""; - } - if($encodingStyle) { - $ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string"; - } - - // serialize headers - if($headers){ - if (is_array($headers)) { - $xml = ''; - foreach ($headers as $k => $v) { - if (is_object($v) && get_class($v) == 'soapval') { - $xml .= $this->serialize_val($v, false, false, false, false, false, $use); - } else { - $xml .= $this->serialize_val($v, $k, false, false, false, false, $use); - } - } - $headers = $xml; - $this->debug("In serializeEnvelope, serialized array of headers to $headers"); - } - $headers = "".$headers.""; - } - // serialize envelope - return - 'soap_defencoding .'"?'.">". - '". - $headers. - "". - $body. - "". - ""; - } - - /** - * formats a string to be inserted into an HTML stream - * - * @param string $str The string to format - * @return string The formatted string - * @access public - * @deprecated - */ - function formatDump($str){ - $str = htmlspecialchars($str); - return nl2br($str); - } - - /** - * contracts (changes namespace to prefix) a qualified name - * - * @param string $qname qname - * @return string contracted qname - * @access private - */ - function contractQname($qname){ - // get element namespace - //$this->xdebug("Contract $qname"); - if (strrpos($qname, ':')) { - // get unqualified name - $name = substr($qname, strrpos($qname, ':') + 1); - // get ns - $ns = substr($qname, 0, strrpos($qname, ':')); - $p = $this->getPrefixFromNamespace($ns); - if ($p) { - return $p . ':' . $name; - } - return $qname; - } else { - return $qname; - } - } - - /** - * expands (changes prefix to namespace) a qualified name - * - * @param string $qname qname - * @return string expanded qname - * @access private - */ - function expandQname($qname){ - // get element prefix - if(strpos($qname,':') && !preg_match('/^http:\/\//',$qname)){ - // get unqualified name - $name = substr(strstr($qname,':'),1); - // get ns prefix - $prefix = substr($qname,0,strpos($qname,':')); - if(isset($this->namespaces[$prefix])){ - return $this->namespaces[$prefix].':'.$name; - } else { - return $qname; - } - } else { - return $qname; - } - } - - /** - * returns the local part of a prefixed string - * returns the original string, if not prefixed - * - * @param string $str The prefixed string - * @return string The local part - * @access public - */ - function getLocalPart($str){ - if($sstr = strrchr($str,':')){ - // get unqualified name - return substr( $sstr, 1 ); - } else { - return $str; - } - } - - /** - * returns the prefix part of a prefixed string - * returns false, if not prefixed - * - * @param string $str The prefixed string - * @return mixed The prefix or false if there is no prefix - * @access public - */ - function getPrefix($str){ - if($pos = strrpos($str,':')){ - // get prefix - return substr($str,0,$pos); - } - return false; - } - - /** - * pass it a prefix, it returns a namespace - * - * @param string $prefix The prefix - * @return mixed The namespace, false if no namespace has the specified prefix - * @access public - */ - function getNamespaceFromPrefix($prefix){ - if (isset($this->namespaces[$prefix])) { - return $this->namespaces[$prefix]; - } - //$this->setError("No namespace registered for prefix '$prefix'"); - return false; - } - - /** - * returns the prefix for a given namespace (or prefix) - * or false if no prefixes registered for the given namespace - * - * @param string $ns The namespace - * @return mixed The prefix, false if the namespace has no prefixes - * @access public - */ - function getPrefixFromNamespace($ns) { - foreach ($this->namespaces as $p => $n) { - if ($ns == $n || $ns == $p) { - $this->usedNamespaces[$p] = $n; - return $p; - } - } - return false; - } - - /** - * returns the time in ODBC canonical form with microseconds - * - * @return string The time in ODBC canonical form with microseconds - * @access public - */ - function getmicrotime() { - if (function_exists('gettimeofday')) { - $tod = gettimeofday(); - $sec = $tod['sec']; - $usec = $tod['usec']; - } else { - $sec = time(); - $usec = 0; - } - return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec); - } - - /** - * Returns a string with the output of var_dump - * - * @param mixed $data The variable to var_dump - * @return string The output of var_dump - * @access public - */ - function varDump($data) { - ob_start(); - var_dump($data); - $ret_val = ob_get_contents(); - ob_end_clean(); - return $ret_val; - } - - /** - * represents the object as a string - * - * @return string - * @access public - */ - function __toString() { - return $this->varDump($this); - } -} - -// XML Schema Datatype Helper Functions - -//xsd:dateTime helpers - -/** -* convert unix timestamp to ISO 8601 compliant date string -* -* @param int $timestamp Unix time stamp -* @param boolean $utc Whether the time stamp is UTC or local -* @return mixed ISO 8601 date string or false -* @access public -*/ -function timestamp_to_iso8601($timestamp,$utc=true){ - $datestr = date('Y-m-d\TH:i:sO',$timestamp); - $pos = strrpos($datestr, "+"); - if ($pos === FALSE) { - $pos = strrpos($datestr, "-"); - } - if ($pos !== FALSE) { - if (strlen($datestr) == $pos + 5) { - $datestr = substr($datestr, 0, $pos + 3) . ':' . substr($datestr, -2); - } - } - if($utc){ - $pattern = '/'. - '([0-9]{4})-'. // centuries & years CCYY- - '([0-9]{2})-'. // months MM- - '([0-9]{2})'. // days DD - 'T'. // separator T - '([0-9]{2}):'. // hours hh: - '([0-9]{2}):'. // minutes mm: - '([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss... - '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's - '/'; - - if(preg_match($pattern,$datestr,$regs)){ - return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]); - } - return false; - } else { - return $datestr; - } -} - -/** -* convert ISO 8601 compliant date string to unix timestamp -* -* @param string $datestr ISO 8601 compliant date string -* @return mixed Unix timestamp (int) or false -* @access public -*/ -function iso8601_to_timestamp($datestr){ - $pattern = '/'. - '([0-9]{4})-'. // centuries & years CCYY- - '([0-9]{2})-'. // months MM- - '([0-9]{2})'. // days DD - 'T'. // separator T - '([0-9]{2}):'. // hours hh: - '([0-9]{2}):'. // minutes mm: - '([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss... - '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's - '/'; - if(preg_match($pattern,$datestr,$regs)){ - // not utc - if($regs[8] != 'Z'){ - $op = substr($regs[8],0,1); - $h = substr($regs[8],1,2); - $m = substr($regs[8],strlen($regs[8])-2,2); - if($op == '-'){ - $regs[4] = $regs[4] + $h; - $regs[5] = $regs[5] + $m; - } elseif($op == '+'){ - $regs[4] = $regs[4] - $h; - $regs[5] = $regs[5] - $m; - } - } - return gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); -// return strtotime("$regs[1]-$regs[2]-$regs[3] $regs[4]:$regs[5]:$regs[6]Z"); - } else { - return false; - } -} - -/** -* sleeps some number of microseconds -* -* @param string $usec the number of microseconds to sleep -* @access public -* @deprecated -*/ -function usleepWindows($usec) -{ - $start = gettimeofday(); - - do - { - $stop = gettimeofday(); - $timePassed = 1000000 * ($stop['sec'] - $start['sec']) - + $stop['usec'] - $start['usec']; - } - while ($timePassed < $usec); -} - -?> -* @version $Id: nusoap.php 7091 2011-06-16 11:34:02Z mMarinetti $ -* @access public -*/ -class nusoap_fault extends nusoap_base { - /** - * The fault code (client|server) - * @var string - * @access private - */ - var $faultcode; - /** - * The fault actor - * @var string - * @access private - */ - var $faultactor; - /** - * The fault string, a description of the fault - * @var string - * @access private - */ - var $faultstring; - /** - * The fault detail, typically a string or array of string - * @var mixed - * @access private - */ - var $faultdetail; - - /** - * constructor - * - * @param string $faultcode (SOAP-ENV:Client | SOAP-ENV:Server) - * @param string $faultactor only used when msg routed between multiple actors - * @param string $faultstring human readable error message - * @param mixed $faultdetail detail, typically a string or array of string - */ - function nusoap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){ - parent::nusoap_base(); - $this->faultcode = $faultcode; - $this->faultactor = $faultactor; - $this->faultstring = $faultstring; - $this->faultdetail = $faultdetail; - } - - /** - * serialize a fault - * - * @return string The serialization of the fault instance. - * @access public - */ - function serialize(){ - $ns_string = ''; - foreach($this->namespaces as $k => $v){ - $ns_string .= "\n xmlns:$k=\"$v\""; - } - $return_msg = - 'soap_defencoding.'"?>'. - '\n". - ''. - ''. - $this->serialize_val($this->faultcode, 'faultcode'). - $this->serialize_val($this->faultactor, 'faultactor'). - $this->serialize_val($this->faultstring, 'faultstring'). - $this->serialize_val($this->faultdetail, 'detail'). - ''. - ''. - ''; - return $return_msg; - } -} - -/** - * Backward compatibility - */ -class soap_fault extends nusoap_fault { -} - -?> -* @author Scott Nichol -* @version $Id: nusoap.php 7091 2011-06-16 11:34:02Z mMarinetti $ -* @access public -*/ -class nusoap_xmlschema extends nusoap_base { - - // files - var $schema = ''; - var $xml = ''; - // namespaces - var $enclosingNamespaces; - // schema info - var $schemaInfo = array(); - var $schemaTargetNamespace = ''; - // types, elements, attributes defined by the schema - var $attributes = array(); - var $complexTypes = array(); - var $complexTypeStack = array(); - var $currentComplexType = null; - var $elements = array(); - var $elementStack = array(); - var $currentElement = null; - var $simpleTypes = array(); - var $simpleTypeStack = array(); - var $currentSimpleType = null; - // imports - var $imports = array(); - // parser vars - var $parser; - var $position = 0; - var $depth = 0; - var $depth_array = array(); - var $message = array(); - var $defaultNamespace = array(); - - /** - * constructor - * - * @param string $schema schema document URI - * @param string $xml xml document URI - * @param string $namespaces namespaces defined in enclosing XML - * @access public - */ - function nusoap_xmlschema($schema='',$xml='',$namespaces=array()){ - parent::nusoap_base(); - $this->debug('nusoap_xmlschema class instantiated, inside constructor'); - // files - $this->schema = $schema; - $this->xml = $xml; - - // namespaces - $this->enclosingNamespaces = $namespaces; - $this->namespaces = array_merge($this->namespaces, $namespaces); - - // parse schema file - if($schema != ''){ - $this->debug('initial schema file: '.$schema); - $this->parseFile($schema, 'schema'); - } - - // parse xml file - if($xml != ''){ - $this->debug('initial xml file: '.$xml); - $this->parseFile($xml, 'xml'); - } - - } - - /** - * parse an XML file - * - * @param string $xml path/URL to XML file - * @param string $type (schema | xml) - * @return boolean - * @access public - */ - function parseFile($xml,$type){ - // parse xml file - if($xml != ""){ - $xmlStr = @join("",@file($xml)); - if($xmlStr == ""){ - $msg = 'Error reading XML from '.$xml; - $this->setError($msg); - $this->debug($msg); - return false; - } else { - $this->debug("parsing $xml"); - $this->parseString($xmlStr,$type); - $this->debug("done parsing $xml"); - return true; - } - } - return false; - } - - /** - * parse an XML string - * - * @param string $xml path or URL - * @param string $type (schema|xml) - * @access private - */ - function parseString($xml,$type){ - // parse xml string - if($xml != ""){ - - // Create an XML parser. - $this->parser = xml_parser_create(); - // Set the options for parsing the XML data. - xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); - - // Set the object for the parser. - xml_set_object($this->parser, $this); - - // Set the element handlers for the parser. - if($type == "schema"){ - xml_set_element_handler($this->parser, 'schemaStartElement','schemaEndElement'); - xml_set_character_data_handler($this->parser,'schemaCharacterData'); - } elseif($type == "xml"){ - xml_set_element_handler($this->parser, 'xmlStartElement','xmlEndElement'); - xml_set_character_data_handler($this->parser,'xmlCharacterData'); - } - - // Parse the XML file. - if(!xml_parse($this->parser,$xml,true)){ - // Display an error message. - $errstr = sprintf('XML error parsing XML schema on line %d: %s', - xml_get_current_line_number($this->parser), - xml_error_string(xml_get_error_code($this->parser)) - ); - $this->debug($errstr); - $this->debug("XML payload:\n" . $xml); - $this->setError($errstr); - } - - xml_parser_free($this->parser); - } else{ - $this->debug('no xml passed to parseString()!!'); - $this->setError('no xml passed to parseString()!!'); - } - } - - /** - * gets a type name for an unnamed type - * - * @param string Element name - * @return string A type name for an unnamed type - * @access private - */ - function CreateTypeName($ename) { - $scope = ''; - for ($i = 0; $i < count($this->complexTypeStack); $i++) { - $scope .= $this->complexTypeStack[$i] . '_'; - } - return $scope . $ename . '_ContainedType'; - } - - /** - * start-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @param string $attrs associative array of attributes - * @access private - */ - function schemaStartElement($parser, $name, $attrs) { - - // position in the total number of elements, starting from 0 - $pos = $this->position++; - $depth = $this->depth++; - // set self as current value for this depth - $this->depth_array[$depth] = $pos; - $this->message[$pos] = array('cdata' => ''); - if ($depth > 0) { - $this->defaultNamespace[$pos] = $this->defaultNamespace[$this->depth_array[$depth - 1]]; - } else { - $this->defaultNamespace[$pos] = false; - } - - // get element prefix - if($prefix = $this->getPrefix($name)){ - // get unqualified name - $name = $this->getLocalPart($name); - } else { - $prefix = ''; - } - - // loop thru attributes, expanding, and registering namespace declarations - if(count($attrs) > 0){ - foreach($attrs as $k => $v){ - // if ns declarations, add to class level array of valid namespaces - if(preg_match('/^xmlns/',$k)){ - //$this->xdebug("$k: $v"); - //$this->xdebug('ns_prefix: '.$this->getPrefix($k)); - if($ns_prefix = substr(strrchr($k,':'),1)){ - //$this->xdebug("Add namespace[$ns_prefix] = $v"); - $this->namespaces[$ns_prefix] = $v; - } else { - $this->defaultNamespace[$pos] = $v; - if (! $this->getPrefixFromNamespace($v)) { - $this->namespaces['ns'.(count($this->namespaces)+1)] = $v; - } - } - if($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema'){ - $this->XMLSchemaVersion = $v; - $this->namespaces['xsi'] = $v.'-instance'; - } - } - } - foreach($attrs as $k => $v){ - // expand each attribute - $k = strpos($k,':') ? $this->expandQname($k) : $k; - $v = strpos($v,':') ? $this->expandQname($v) : $v; - $eAttrs[$k] = $v; - } - $attrs = $eAttrs; - } else { - $attrs = array(); - } - // find status, register data - switch($name){ - case 'all': // (optional) compositor content for a complexType - case 'choice': - case 'group': - case 'sequence': - //$this->xdebug("compositor $name for currentComplexType: $this->currentComplexType and currentElement: $this->currentElement"); - $this->complexTypes[$this->currentComplexType]['compositor'] = $name; - //if($name == 'all' || $name == 'sequence'){ - // $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; - //} - break; - case 'attribute': // complexType attribute - //$this->xdebug("parsing attribute $attrs[name] $attrs[ref] of value: ".$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']); - $this->xdebug("parsing attribute:"); - $this->appendDebug($this->varDump($attrs)); - if (!isset($attrs['form'])) { - // TODO: handle globals - $attrs['form'] = $this->schemaInfo['attributeFormDefault']; - } - if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) { - $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - if (!strpos($v, ':')) { - // no namespace in arrayType attribute value... - if ($this->defaultNamespace[$pos]) { - // ...so use the default - $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos] . ':' . $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - } - } - } - if(isset($attrs['name'])){ - $this->attributes[$attrs['name']] = $attrs; - $aname = $attrs['name']; - } elseif(isset($attrs['ref']) && $attrs['ref'] == 'http://schemas.xmlsoap.org/soap/encoding/:arrayType'){ - if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) { - $aname = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - } else { - $aname = ''; - } - } elseif(isset($attrs['ref'])){ - $aname = $attrs['ref']; - $this->attributes[$attrs['ref']] = $attrs; - } - - if($this->currentComplexType){ // This should *always* be - $this->complexTypes[$this->currentComplexType]['attrs'][$aname] = $attrs; - } - // arrayType attribute - if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == 'arrayType'){ - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - $prefix = $this->getPrefix($aname); - if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])){ - $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - } else { - $v = ''; - } - if(strpos($v,'[,]')){ - $this->complexTypes[$this->currentComplexType]['multidimensional'] = true; - } - $v = substr($v,0,strpos($v,'[')); // clip the [] - if(!strpos($v,':') && isset($this->typemap[$this->XMLSchemaVersion][$v])){ - $v = $this->XMLSchemaVersion.':'.$v; - } - $this->complexTypes[$this->currentComplexType]['arrayType'] = $v; - } - break; - case 'complexContent': // (optional) content for a complexType - $this->xdebug("do nothing for element $name"); - break; - case 'complexType': - array_push($this->complexTypeStack, $this->currentComplexType); - if(isset($attrs['name'])){ - // TODO: what is the scope of named complexTypes that appear - // nested within other c complexTypes? - $this->xdebug('processing named complexType '.$attrs['name']); - //$this->currentElement = false; - $this->currentComplexType = $attrs['name']; - $this->complexTypes[$this->currentComplexType] = $attrs; - $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType'; - // This is for constructs like - // - // - // - // - // - if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){ - $this->xdebug('complexType is unusual array'); - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - } else { - $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; - } - } else { - $name = $this->CreateTypeName($this->currentElement); - $this->xdebug('processing unnamed complexType for element ' . $this->currentElement . ' named ' . $name); - $this->currentComplexType = $name; - //$this->currentElement = false; - $this->complexTypes[$this->currentComplexType] = $attrs; - $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType'; - // This is for constructs like - // - // - // - // - // - if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){ - $this->xdebug('complexType is unusual array'); - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - } else { - $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; - } - } - $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'false'; - break; - case 'element': - array_push($this->elementStack, $this->currentElement); - if (!isset($attrs['form'])) { - if ($this->currentComplexType) { - $attrs['form'] = $this->schemaInfo['elementFormDefault']; - } else { - // global - $attrs['form'] = 'qualified'; - } - } - if(isset($attrs['type'])){ - $this->xdebug("processing typed element ".$attrs['name']." of type ".$attrs['type']); - if (! $this->getPrefix($attrs['type'])) { - if ($this->defaultNamespace[$pos]) { - $attrs['type'] = $this->defaultNamespace[$pos] . ':' . $attrs['type']; - $this->xdebug('used default namespace to make type ' . $attrs['type']); - } - } - // This is for constructs like - // - // - // - // - // - if ($this->currentComplexType && $this->complexTypes[$this->currentComplexType]['phpType'] == 'array') { - $this->xdebug('arrayType for unusual array is ' . $attrs['type']); - $this->complexTypes[$this->currentComplexType]['arrayType'] = $attrs['type']; - } - $this->currentElement = $attrs['name']; - $ename = $attrs['name']; - } elseif(isset($attrs['ref'])){ - $this->xdebug("processing element as ref to ".$attrs['ref']); - $this->currentElement = "ref to ".$attrs['ref']; - $ename = $this->getLocalPart($attrs['ref']); - } else { - $type = $this->CreateTypeName($this->currentComplexType . '_' . $attrs['name']); - $this->xdebug("processing untyped element " . $attrs['name'] . ' type ' . $type); - $this->currentElement = $attrs['name']; - $attrs['type'] = $this->schemaTargetNamespace . ':' . $type; - $ename = $attrs['name']; - } - if (isset($ename) && $this->currentComplexType) { - $this->xdebug("add element $ename to complexType $this->currentComplexType"); - $this->complexTypes[$this->currentComplexType]['elements'][$ename] = $attrs; - } elseif (!isset($attrs['ref'])) { - $this->xdebug("add element $ename to elements array"); - $this->elements[ $attrs['name'] ] = $attrs; - $this->elements[ $attrs['name'] ]['typeClass'] = 'element'; - } - break; - case 'enumeration': // restriction value list member - $this->xdebug('enumeration ' . $attrs['value']); - if ($this->currentSimpleType) { - $this->simpleTypes[$this->currentSimpleType]['enumeration'][] = $attrs['value']; - } elseif ($this->currentComplexType) { - $this->complexTypes[$this->currentComplexType]['enumeration'][] = $attrs['value']; - } - break; - case 'extension': // simpleContent or complexContent type extension - $this->xdebug('extension ' . $attrs['base']); - if ($this->currentComplexType) { - $ns = $this->getPrefix($attrs['base']); - if ($ns == '') { - $this->complexTypes[$this->currentComplexType]['extensionBase'] = $this->schemaTargetNamespace . ':' . $attrs['base']; - } else { - $this->complexTypes[$this->currentComplexType]['extensionBase'] = $attrs['base']; - } - } else { - $this->xdebug('no current complexType to set extensionBase'); - } - break; - case 'import': - if (isset($attrs['schemaLocation'])) { - $this->xdebug('import namespace ' . $attrs['namespace'] . ' from ' . $attrs['schemaLocation']); - $this->imports[$attrs['namespace']][] = array('location' => $attrs['schemaLocation'], 'loaded' => false); - } else { - $this->xdebug('import namespace ' . $attrs['namespace']); - $this->imports[$attrs['namespace']][] = array('location' => '', 'loaded' => true); - if (! $this->getPrefixFromNamespace($attrs['namespace'])) { - $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; - } - } - break; - case 'include': - if (isset($attrs['schemaLocation'])) { - $this->xdebug('include into namespace ' . $this->schemaTargetNamespace . ' from ' . $attrs['schemaLocation']); - $this->imports[$this->schemaTargetNamespace][] = array('location' => $attrs['schemaLocation'], 'loaded' => false); - } else { - $this->xdebug('ignoring invalid XML Schema construct: include without schemaLocation attribute'); - } - break; - case 'list': // simpleType value list - $this->xdebug("do nothing for element $name"); - break; - case 'restriction': // simpleType, simpleContent or complexContent value restriction - $this->xdebug('restriction ' . $attrs['base']); - if($this->currentSimpleType){ - $this->simpleTypes[$this->currentSimpleType]['type'] = $attrs['base']; - } elseif($this->currentComplexType){ - $this->complexTypes[$this->currentComplexType]['restrictionBase'] = $attrs['base']; - if(strstr($attrs['base'],':') == ':Array'){ - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - } - } - break; - case 'schema': - $this->schemaInfo = $attrs; - $this->schemaInfo['schemaVersion'] = $this->getNamespaceFromPrefix($prefix); - if (isset($attrs['targetNamespace'])) { - $this->schemaTargetNamespace = $attrs['targetNamespace']; - } - if (!isset($attrs['elementFormDefault'])) { - $this->schemaInfo['elementFormDefault'] = 'unqualified'; - } - if (!isset($attrs['attributeFormDefault'])) { - $this->schemaInfo['attributeFormDefault'] = 'unqualified'; - } - break; - case 'simpleContent': // (optional) content for a complexType - if ($this->currentComplexType) { // This should *always* be - $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'true'; - } else { - $this->xdebug("do nothing for element $name because there is no current complexType"); - } - break; - case 'simpleType': - array_push($this->simpleTypeStack, $this->currentSimpleType); - if(isset($attrs['name'])){ - $this->xdebug("processing simpleType for name " . $attrs['name']); - $this->currentSimpleType = $attrs['name']; - $this->simpleTypes[ $attrs['name'] ] = $attrs; - $this->simpleTypes[ $attrs['name'] ]['typeClass'] = 'simpleType'; - $this->simpleTypes[ $attrs['name'] ]['phpType'] = 'scalar'; - } else { - $name = $this->CreateTypeName($this->currentComplexType . '_' . $this->currentElement); - $this->xdebug('processing unnamed simpleType for element ' . $this->currentElement . ' named ' . $name); - $this->currentSimpleType = $name; - //$this->currentElement = false; - $this->simpleTypes[$this->currentSimpleType] = $attrs; - $this->simpleTypes[$this->currentSimpleType]['phpType'] = 'scalar'; - } - break; - case 'union': // simpleType type list - $this->xdebug("do nothing for element $name"); - break; - default: - $this->xdebug("do not have any logic to process element $name"); - } - } - - /** - * end-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @access private - */ - function schemaEndElement($parser, $name) { - // bring depth down a notch - $this->depth--; - // position of current element is equal to the last value left in depth_array for my depth - if(isset($this->depth_array[$this->depth])){ - $pos = $this->depth_array[$this->depth]; - } - // get element prefix - if ($prefix = $this->getPrefix($name)){ - // get unqualified name - $name = $this->getLocalPart($name); - } else { - $prefix = ''; - } - // move on... - if($name == 'complexType'){ - $this->xdebug('done processing complexType ' . ($this->currentComplexType ? $this->currentComplexType : '(unknown)')); - $this->xdebug($this->varDump($this->complexTypes[$this->currentComplexType])); - $this->currentComplexType = array_pop($this->complexTypeStack); - //$this->currentElement = false; - } - if($name == 'element'){ - $this->xdebug('done processing element ' . ($this->currentElement ? $this->currentElement : '(unknown)')); - $this->currentElement = array_pop($this->elementStack); - } - if($name == 'simpleType'){ - $this->xdebug('done processing simpleType ' . ($this->currentSimpleType ? $this->currentSimpleType : '(unknown)')); - $this->xdebug($this->varDump($this->simpleTypes[$this->currentSimpleType])); - $this->currentSimpleType = array_pop($this->simpleTypeStack); - } - } - - /** - * element content handler - * - * @param string $parser XML parser object - * @param string $data element content - * @access private - */ - function schemaCharacterData($parser, $data){ - $pos = $this->depth_array[$this->depth - 1]; - $this->message[$pos]['cdata'] .= $data; - } - - /** - * serialize the schema - * - * @access public - */ - function serializeSchema(){ - - $schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion); - $xml = ''; - // imports - if (sizeof($this->imports) > 0) { - foreach($this->imports as $ns => $list) { - foreach ($list as $ii) { - if ($ii['location'] != '') { - $xml .= " <$schemaPrefix:import location=\"" . $ii['location'] . '" namespace="' . $ns . "\" />\n"; - } else { - $xml .= " <$schemaPrefix:import namespace=\"" . $ns . "\" />\n"; - } - } - } - } - // complex types - foreach($this->complexTypes as $typeName => $attrs){ - $contentStr = ''; - // serialize child elements - if(isset($attrs['elements']) && (count($attrs['elements']) > 0)){ - foreach($attrs['elements'] as $element => $eParts){ - if(isset($eParts['ref'])){ - $contentStr .= " <$schemaPrefix:element ref=\"$element\"/>\n"; - } else { - $contentStr .= " <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($eParts['type']) . "\""; - foreach ($eParts as $aName => $aValue) { - // handle, e.g., abstract, default, form, minOccurs, maxOccurs, nillable - if ($aName != 'name' && $aName != 'type') { - $contentStr .= " $aName=\"$aValue\""; - } - } - $contentStr .= "/>\n"; - } - } - // compositor wraps elements - if (isset($attrs['compositor']) && ($attrs['compositor'] != '')) { - $contentStr = " <$schemaPrefix:$attrs[compositor]>\n".$contentStr." \n"; - } - } - // attributes - if(isset($attrs['attrs']) && (count($attrs['attrs']) >= 1)){ - foreach($attrs['attrs'] as $attr => $aParts){ - $contentStr .= " <$schemaPrefix:attribute"; - foreach ($aParts as $a => $v) { - if ($a == 'ref' || $a == 'type') { - $contentStr .= " $a=\"".$this->contractQName($v).'"'; - } elseif ($a == 'http://schemas.xmlsoap.org/wsdl/:arrayType') { - $this->usedNamespaces['wsdl'] = $this->namespaces['wsdl']; - $contentStr .= ' wsdl:arrayType="'.$this->contractQName($v).'"'; - } else { - $contentStr .= " $a=\"$v\""; - } - } - $contentStr .= "/>\n"; - } - } - // if restriction - if (isset($attrs['restrictionBase']) && $attrs['restrictionBase'] != ''){ - $contentStr = " <$schemaPrefix:restriction base=\"".$this->contractQName($attrs['restrictionBase'])."\">\n".$contentStr." \n"; - // complex or simple content - if ((isset($attrs['elements']) && count($attrs['elements']) > 0) || (isset($attrs['attrs']) && count($attrs['attrs']) > 0)){ - $contentStr = " <$schemaPrefix:complexContent>\n".$contentStr." \n"; - } - } - // finalize complex type - if($contentStr != ''){ - $contentStr = " <$schemaPrefix:complexType name=\"$typeName\">\n".$contentStr." \n"; - } else { - $contentStr = " <$schemaPrefix:complexType name=\"$typeName\"/>\n"; - } - $xml .= $contentStr; - } - // simple types - if(isset($this->simpleTypes) && count($this->simpleTypes) > 0){ - foreach($this->simpleTypes as $typeName => $eParts){ - $xml .= " <$schemaPrefix:simpleType name=\"$typeName\">\n <$schemaPrefix:restriction base=\"".$this->contractQName($eParts['type'])."\">\n"; - if (isset($eParts['enumeration'])) { - foreach ($eParts['enumeration'] as $e) { - $xml .= " <$schemaPrefix:enumeration value=\"$e\"/>\n"; - } - } - $xml .= " \n "; - } - } - // elements - if(isset($this->elements) && count($this->elements) > 0){ - foreach($this->elements as $element => $eParts){ - $xml .= " <$schemaPrefix:element name=\"$element\" type=\"".$this->contractQName($eParts['type'])."\"/>\n"; - } - } - // attributes - if(isset($this->attributes) && count($this->attributes) > 0){ - foreach($this->attributes as $attr => $aParts){ - $xml .= " <$schemaPrefix:attribute name=\"$attr\" type=\"".$this->contractQName($aParts['type'])."\"\n/>"; - } - } - // finish 'er up - $attr = ''; - foreach ($this->schemaInfo as $k => $v) { - if ($k == 'elementFormDefault' || $k == 'attributeFormDefault') { - $attr .= " $k=\"$v\""; - } - } - $el = "<$schemaPrefix:schema$attr targetNamespace=\"$this->schemaTargetNamespace\"\n"; - foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) { - $el .= " xmlns:$nsp=\"$ns\""; - } - $xml = $el . ">\n".$xml."\n"; - return $xml; - } - - /** - * adds debug data to the clas level debug string - * - * @param string $string debug data - * @access private - */ - function xdebug($string){ - $this->debug('<' . $this->schemaTargetNamespace . '> '.$string); - } - - /** - * get the PHP type of a user defined type in the schema - * PHP type is kind of a misnomer since it actually returns 'struct' for assoc. arrays - * returns false if no type exists, or not w/ the given namespace - * else returns a string that is either a native php type, or 'struct' - * - * @param string $type name of defined type - * @param string $ns namespace of type - * @return mixed - * @access public - * @deprecated - */ - function getPHPType($type,$ns){ - if(isset($this->typemap[$ns][$type])){ - //print "found type '$type' and ns $ns in typemap
    "; - return $this->typemap[$ns][$type]; - } elseif(isset($this->complexTypes[$type])){ - //print "getting type '$type' and ns $ns from complexTypes array
    "; - return $this->complexTypes[$type]['phpType']; - } - return false; - } - - /** - * returns an associative array of information about a given type - * returns false if no type exists by the given name - * - * For a complexType typeDef = array( - * 'restrictionBase' => '', - * 'phpType' => '', - * 'compositor' => '(sequence|all)', - * 'elements' => array(), // refs to elements array - * 'attrs' => array() // refs to attributes array - * ... and so on (see addComplexType) - * ) - * - * For simpleType or element, the array has different keys. - * - * @param string $type - * @return mixed - * @access public - * @see addComplexType - * @see addSimpleType - * @see addElement - */ - function getTypeDef($type){ - //$this->debug("in getTypeDef for type $type"); - if (substr($type, -1) == '^') { - $is_element = 1; - $type = substr($type, 0, -1); - } else { - $is_element = 0; - } - - if((! $is_element) && isset($this->complexTypes[$type])){ - $this->xdebug("in getTypeDef, found complexType $type"); - return $this->complexTypes[$type]; - } elseif((! $is_element) && isset($this->simpleTypes[$type])){ - $this->xdebug("in getTypeDef, found simpleType $type"); - if (!isset($this->simpleTypes[$type]['phpType'])) { - // get info for type to tack onto the simple type - // TODO: can this ever really apply (i.e. what is a simpleType really?) - $uqType = substr($this->simpleTypes[$type]['type'], strrpos($this->simpleTypes[$type]['type'], ':') + 1); - $ns = substr($this->simpleTypes[$type]['type'], 0, strrpos($this->simpleTypes[$type]['type'], ':')); - $etype = $this->getTypeDef($uqType); - if ($etype) { - $this->xdebug("in getTypeDef, found type for simpleType $type:"); - $this->xdebug($this->varDump($etype)); - if (isset($etype['phpType'])) { - $this->simpleTypes[$type]['phpType'] = $etype['phpType']; - } - if (isset($etype['elements'])) { - $this->simpleTypes[$type]['elements'] = $etype['elements']; - } - } - } - return $this->simpleTypes[$type]; - } elseif(isset($this->elements[$type])){ - $this->xdebug("in getTypeDef, found element $type"); - if (!isset($this->elements[$type]['phpType'])) { - // get info for type to tack onto the element - $uqType = substr($this->elements[$type]['type'], strrpos($this->elements[$type]['type'], ':') + 1); - $ns = substr($this->elements[$type]['type'], 0, strrpos($this->elements[$type]['type'], ':')); - $etype = $this->getTypeDef($uqType); - if ($etype) { - $this->xdebug("in getTypeDef, found type for element $type:"); - $this->xdebug($this->varDump($etype)); - if (isset($etype['phpType'])) { - $this->elements[$type]['phpType'] = $etype['phpType']; - } - if (isset($etype['elements'])) { - $this->elements[$type]['elements'] = $etype['elements']; - } - if (isset($etype['extensionBase'])) { - $this->elements[$type]['extensionBase'] = $etype['extensionBase']; - } - } elseif ($ns == 'http://www.w3.org/2001/XMLSchema') { - $this->xdebug("in getTypeDef, element $type is an XSD type"); - $this->elements[$type]['phpType'] = 'scalar'; - } - } - return $this->elements[$type]; - } elseif(isset($this->attributes[$type])){ - $this->xdebug("in getTypeDef, found attribute $type"); - return $this->attributes[$type]; - } elseif (preg_match('/_ContainedType$/', $type)) { - $this->xdebug("in getTypeDef, have an untyped element $type"); - $typeDef['typeClass'] = 'simpleType'; - $typeDef['phpType'] = 'scalar'; - $typeDef['type'] = 'http://www.w3.org/2001/XMLSchema:string'; - return $typeDef; - } - $this->xdebug("in getTypeDef, did not find $type"); - return false; - } - - /** - * returns a sample serialization of a given type, or false if no type by the given name - * - * @param string $type name of type - * @return mixed - * @access public - * @deprecated - */ - function serializeTypeDef($type){ - //print "in sTD() for type $type
    "; - if($typeDef = $this->getTypeDef($type)){ - $str .= '<'.$type; - if(is_array($typeDef['attrs'])){ - foreach($typeDef['attrs'] as $attName => $data){ - $str .= " $attName=\"{type = ".$data['type']."}\""; - } - } - $str .= " xmlns=\"".$this->schema['targetNamespace']."\""; - if(count($typeDef['elements']) > 0){ - $str .= ">"; - foreach($typeDef['elements'] as $element => $eData){ - $str .= $this->serializeTypeDef($element); - } - $str .= ""; - } elseif($typeDef['typeClass'] == 'element') { - $str .= ">"; - } else { - $str .= "/>"; - } - return $str; - } - return false; - } - - /** - * returns HTML form elements that allow a user - * to enter values for creating an instance of the given type. - * - * @param string $name name for type instance - * @param string $type name of type - * @return string - * @access public - * @deprecated - */ - function typeToForm($name,$type){ - // get typedef - if($typeDef = $this->getTypeDef($type)){ - // if struct - if($typeDef['phpType'] == 'struct'){ - $buffer .= ''; - foreach($typeDef['elements'] as $child => $childDef){ - $buffer .= " - - "; - } - $buffer .= '
    $childDef[name] (type: ".$this->getLocalPart($childDef['type'])."):
    '; - // if array - } elseif($typeDef['phpType'] == 'array'){ - $buffer .= ''; - for($i=0;$i < 3; $i++){ - $buffer .= " - - "; - } - $buffer .= '
    array item (type: $typeDef[arrayType]):
    '; - // if scalar - } else { - $buffer .= ""; - } - } else { - $buffer .= ""; - } - return $buffer; - } - - /** - * adds a complex type to the schema - * - * example: array - * - * addType( - * 'ArrayOfstring', - * 'complexType', - * 'array', - * '', - * 'SOAP-ENC:Array', - * array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'string[]'), - * 'xsd:string' - * ); - * - * example: PHP associative array ( SOAP Struct ) - * - * addType( - * 'SOAPStruct', - * 'complexType', - * 'struct', - * 'all', - * array('myVar'=> array('name'=>'myVar','type'=>'string') - * ); - * - * @param name - * @param typeClass (complexType|simpleType|attribute) - * @param phpType: currently supported are array and struct (php assoc array) - * @param compositor (all|sequence|choice) - * @param restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param elements = array ( name = array(name=>'',type=>'') ) - * @param attrs = array( - * array( - * 'ref' => "http://schemas.xmlsoap.org/soap/encoding/:arrayType", - * "http://schemas.xmlsoap.org/wsdl/:arrayType" => "string[]" - * ) - * ) - * @param arrayType: namespace:name (http://www.w3.org/2001/XMLSchema:string) - * @access public - * @see getTypeDef - */ - function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType=''){ - $this->complexTypes[$name] = array( - 'name' => $name, - 'typeClass' => $typeClass, - 'phpType' => $phpType, - 'compositor'=> $compositor, - 'restrictionBase' => $restrictionBase, - 'elements' => $elements, - 'attrs' => $attrs, - 'arrayType' => $arrayType - ); - - $this->xdebug("addComplexType $name:"); - $this->appendDebug($this->varDump($this->complexTypes[$name])); - } - - /** - * adds a simple type to the schema - * - * @param string $name - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param string $typeClass (should always be simpleType) - * @param string $phpType (should always be scalar) - * @param array $enumeration array of values - * @access public - * @see nusoap_xmlschema - * @see getTypeDef - */ - function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) { - $this->simpleTypes[$name] = array( - 'name' => $name, - 'typeClass' => $typeClass, - 'phpType' => $phpType, - 'type' => $restrictionBase, - 'enumeration' => $enumeration - ); - - $this->xdebug("addSimpleType $name:"); - $this->appendDebug($this->varDump($this->simpleTypes[$name])); - } - - /** - * adds an element to the schema - * - * @param array $attrs attributes that must include name and type - * @see nusoap_xmlschema - * @access public - */ - function addElement($attrs) { - if (! $this->getPrefix($attrs['type'])) { - $attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['type']; - } - $this->elements[ $attrs['name'] ] = $attrs; - $this->elements[ $attrs['name'] ]['typeClass'] = 'element'; - - $this->xdebug("addElement " . $attrs['name']); - $this->appendDebug($this->varDump($this->elements[ $attrs['name'] ])); - } -} - -/** - * Backward compatibility - */ -class XMLSchema extends nusoap_xmlschema { -} - -?> -* @version $Id: nusoap.php 7091 2011-06-16 11:34:02Z mMarinetti $ -* @access public -*/ -class soapval extends nusoap_base { - /** - * The XML element name - * - * @var string - * @access private - */ - var $name; - /** - * The XML type name (string or false) - * - * @var mixed - * @access private - */ - var $type; - /** - * The PHP value - * - * @var mixed - * @access private - */ - var $value; - /** - * The XML element namespace (string or false) - * - * @var mixed - * @access private - */ - var $element_ns; - /** - * The XML type namespace (string or false) - * - * @var mixed - * @access private - */ - var $type_ns; - /** - * The XML element attributes (array or false) - * - * @var mixed - * @access private - */ - var $attributes; - - /** - * constructor - * - * @param string $name optional name - * @param mixed $type optional type name - * @param mixed $value optional value - * @param mixed $element_ns optional namespace of value - * @param mixed $type_ns optional namespace of type - * @param mixed $attributes associative array of attributes to add to element serialization - * @access public - */ - function soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) { - parent::nusoap_base(); - $this->name = $name; - $this->type = $type; - $this->value = $value; - $this->element_ns = $element_ns; - $this->type_ns = $type_ns; - $this->attributes = $attributes; - } - - /** - * return serialized value - * - * @param string $use The WSDL use value (encoded|literal) - * @return string XML data - * @access public - */ - function serialize($use='encoded') { - return $this->serialize_val($this->value, $this->name, $this->type, $this->element_ns, $this->type_ns, $this->attributes, $use, true); - } - - /** - * decodes a soapval object into a PHP native type - * - * @return mixed - * @access public - */ - function decode(){ - return $this->value; - } -} - - - -?> -* @author Scott Nichol -* @version $Id: nusoap.php 7091 2011-06-16 11:34:02Z mMarinetti $ -* @access public -*/ -class soap_transport_http extends nusoap_base { - - var $url = ''; - var $uri = ''; - var $digest_uri = ''; - var $scheme = ''; - var $host = ''; - var $port = ''; - var $path = ''; - var $request_method = 'POST'; - var $protocol_version = '1.0'; - var $encoding = ''; - var $outgoing_headers = array(); - var $incoming_headers = array(); - var $incoming_cookies = array(); - var $outgoing_payload = ''; - var $incoming_payload = ''; - var $response_status_line; // HTTP response status line - var $useSOAPAction = true; - var $persistentConnection = false; - var $ch = false; // cURL handle - var $ch_options = array(); // cURL custom options - var $use_curl = false; // force cURL use - var $proxy = null; // proxy information (associative array) - var $username = ''; - var $password = ''; - var $authtype = ''; - var $digestRequest = array(); - var $certRequest = array(); // keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional) - // cainfofile: certificate authority file, e.g. '$pathToPemFiles/rootca.pem' - // sslcertfile: SSL certificate file, e.g. '$pathToPemFiles/mycert.pem' - // sslkeyfile: SSL key file, e.g. '$pathToPemFiles/mykey.pem' - // passphrase: SSL key password/passphrase - // certpassword: SSL certificate password - // verifypeer: default is 1 - // verifyhost: default is 1 - - /** - * constructor - * - * @param string $url The URL to which to connect - * @param array $curl_options User-specified cURL options - * @param boolean $use_curl Whether to try to force cURL use - * @access public - */ - function soap_transport_http($url, $curl_options = NULL, $use_curl = false){ - parent::nusoap_base(); - $this->debug("ctor url=$url use_curl=$use_curl curl_options:"); - $this->appendDebug($this->varDump($curl_options)); - $this->setURL($url); - if (is_array($curl_options)) { - $this->ch_options = $curl_options; - } - $this->use_curl = $use_curl; - preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev); - $this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')'); - } - - /** - * sets a cURL option - * - * @param mixed $option The cURL option (always integer?) - * @param mixed $value The cURL option value - * @access private - */ - function setCurlOption($option, $value) { - $this->debug("setCurlOption option=$option, value="); - $this->appendDebug($this->varDump($value)); - curl_setopt($this->ch, $option, $value); - } - - /** - * sets an HTTP header - * - * @param string $name The name of the header - * @param string $value The value of the header - * @access private - */ - function setHeader($name, $value) { - $this->outgoing_headers[$name] = $value; - $this->debug("set header $name: $value"); - } - - /** - * unsets an HTTP header - * - * @param string $name The name of the header - * @access private - */ - function unsetHeader($name) { - if (isset($this->outgoing_headers[$name])) { - $this->debug("unset header $name"); - unset($this->outgoing_headers[$name]); - } - } - - /** - * sets the URL to which to connect - * - * @param string $url The URL to which to connect - * @access private - */ - function setURL($url) { - $this->url = $url; - - $u = parse_url($url); - foreach($u as $k => $v){ - $this->debug("parsed URL $k = $v"); - $this->$k = $v; - } - - // add any GET params to path - if(isset($u['query']) && $u['query'] != ''){ - $this->path .= '?' . $u['query']; - } - - // set default port - if(!isset($u['port'])){ - if($u['scheme'] == 'https'){ - $this->port = 443; - } else { - $this->port = 80; - } - } - - $this->uri = $this->path; - $this->digest_uri = $this->uri; - - // build headers - if (!isset($u['port'])) { - $this->setHeader('Host', $this->host); - } else { - $this->setHeader('Host', $this->host.':'.$this->port); - } - - if (isset($u['user']) && $u['user'] != '') { - $this->setCredentials(urldecode($u['user']), isset($u['pass']) ? urldecode($u['pass']) : ''); - } - } - - /** - * gets the I/O method to use - * - * @return string I/O method to use (socket|curl|unknown) - * @access private - */ - function io_method() { - if ($this->use_curl || ($this->scheme == 'https') || ($this->scheme == 'http' && $this->authtype == 'ntlm') || ($this->scheme == 'http' && is_array($this->proxy) && $this->proxy['authtype'] == 'ntlm')) - return 'curl'; - if (($this->scheme == 'http' || $this->scheme == 'ssl') && $this->authtype != 'ntlm' && (!is_array($this->proxy) || $this->proxy['authtype'] != 'ntlm')) - return 'socket'; - return 'unknown'; - } - - /** - * establish an HTTP connection - * - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @return boolean true if connected, false if not - * @access private - */ - function connect($connection_timeout=0,$response_timeout=30){ - // For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like - // "regular" socket. - // TODO: disabled for now because OpenSSL must be *compiled* in (not just - // loaded), and until PHP5 stream_get_wrappers is not available. -// if ($this->scheme == 'https') { -// if (version_compare(phpversion(), '4.3.0') >= 0) { -// if (extension_loaded('openssl')) { -// $this->scheme = 'ssl'; -// $this->debug('Using SSL over OpenSSL'); -// } -// } -// } - $this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, scheme $this->scheme, host $this->host, port $this->port"); - if ($this->io_method() == 'socket') { - if (!is_array($this->proxy)) { - $host = $this->host; - $port = $this->port; - } else { - $host = $this->proxy['host']; - $port = $this->proxy['port']; - } - - // use persistent connection - if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){ - if (!feof($this->fp)) { - $this->debug('Re-use persistent connection'); - return true; - } - fclose($this->fp); - $this->debug('Closed persistent connection at EOF'); - } - - // munge host if using OpenSSL - if ($this->scheme == 'ssl') { - $host = 'ssl://' . $host; - } - $this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout); - - // open socket - if($connection_timeout > 0){ - $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout); - } else { - $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str); - } - - // test pointer - if(!$this->fp) { - $msg = 'Couldn\'t open socket connection to server ' . $this->url; - if ($this->errno) { - $msg .= ', Error ('.$this->errno.'): '.$this->error_str; - } else { - $msg .= ' prior to connect(). This is often a problem looking up the host name.'; - } - $this->debug($msg); - $this->setError($msg); - return false; - } - - // set response timeout - $this->debug('set response timeout to ' . $response_timeout); - socket_set_timeout( $this->fp, $response_timeout); - - $this->debug('socket connected'); - return true; - } else if ($this->io_method() == 'curl') { - if (!extension_loaded('curl')) { -// $this->setError('cURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS'); - $this->setError('The PHP cURL Extension is required for HTTPS or NLTM. You will need to re-build or update your PHP to include cURL or change php.ini to load the PHP cURL extension.'); - return false; - } - // Avoid warnings when PHP does not have these options - if (defined('CURLOPT_CONNECTIONTIMEOUT')) - $CURLOPT_CONNECTIONTIMEOUT = CURLOPT_CONNECTIONTIMEOUT; - else - $CURLOPT_CONNECTIONTIMEOUT = 78; - if (defined('CURLOPT_HTTPAUTH')) - $CURLOPT_HTTPAUTH = CURLOPT_HTTPAUTH; - else - $CURLOPT_HTTPAUTH = 107; - if (defined('CURLOPT_PROXYAUTH')) - $CURLOPT_PROXYAUTH = CURLOPT_PROXYAUTH; - else - $CURLOPT_PROXYAUTH = 111; - if (defined('CURLAUTH_BASIC')) - $CURLAUTH_BASIC = CURLAUTH_BASIC; - else - $CURLAUTH_BASIC = 1; - if (defined('CURLAUTH_DIGEST')) - $CURLAUTH_DIGEST = CURLAUTH_DIGEST; - else - $CURLAUTH_DIGEST = 2; - if (defined('CURLAUTH_NTLM')) - $CURLAUTH_NTLM = CURLAUTH_NTLM; - else - $CURLAUTH_NTLM = 8; - - $this->debug('connect using cURL'); - // init CURL - $this->ch = curl_init(); - // set url - $hostURL = ($this->port != '') ? "$this->scheme://$this->host:$this->port" : "$this->scheme://$this->host"; - // add path - $hostURL .= $this->path; - $this->setCurlOption(CURLOPT_URL, $hostURL); - // follow location headers (re-directs) - if (ini_get('safe_mode') || ini_get('open_basedir')) { - $this->debug('safe_mode or open_basedir set, so do not set CURLOPT_FOLLOWLOCATION'); - $this->debug('safe_mode = '); - $this->appendDebug($this->varDump(ini_get('safe_mode'))); - $this->debug('open_basedir = '); - $this->appendDebug($this->varDump(ini_get('open_basedir'))); - } else { - $this->setCurlOption(CURLOPT_FOLLOWLOCATION, 1); - } - // ask for headers in the response output - $this->setCurlOption(CURLOPT_HEADER, 1); - // ask for the response output as the return value - $this->setCurlOption(CURLOPT_RETURNTRANSFER, 1); - // encode - // We manage this ourselves through headers and encoding -// if(function_exists('gzuncompress')){ -// $this->setCurlOption(CURLOPT_ENCODING, 'deflate'); -// } - // persistent connection - if ($this->persistentConnection) { - // I believe the following comment is now bogus, having applied to - // the code when it used CURLOPT_CUSTOMREQUEST to send the request. - // The way we send data, we cannot use persistent connections, since - // there will be some "junk" at the end of our request. - //$this->setCurlOption(CURL_HTTP_VERSION_1_1, true); - $this->persistentConnection = false; - $this->setHeader('Connection', 'close'); - } - // set timeouts - if ($connection_timeout != 0) { - $this->setCurlOption($CURLOPT_CONNECTIONTIMEOUT, $connection_timeout); - } - if ($response_timeout != 0) { - $this->setCurlOption(CURLOPT_TIMEOUT, $response_timeout); - } - - if ($this->scheme == 'https') { - $this->debug('set cURL SSL verify options'); - // recent versions of cURL turn on peer/host checking by default, - // while PHP binaries are not compiled with a default location for the - // CA cert bundle, so disable peer/host checking. - //$this->setCurlOption(CURLOPT_CAINFO, 'f:\php-4.3.2-win32\extensions\curl-ca-bundle.crt'); - $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 0); - $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 0); - - // support client certificates (thanks Tobias Boes, Doug Anarino, Eryan Ariobowo) - if ($this->authtype == 'certificate') { - $this->debug('set cURL certificate options'); - if (isset($this->certRequest['cainfofile'])) { - $this->setCurlOption(CURLOPT_CAINFO, $this->certRequest['cainfofile']); - } - if (isset($this->certRequest['verifypeer'])) { - $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, $this->certRequest['verifypeer']); - } else { - $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 1); - } - if (isset($this->certRequest['verifyhost'])) { - $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, $this->certRequest['verifyhost']); - } else { - $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 1); - } - if (isset($this->certRequest['sslcertfile'])) { - $this->setCurlOption(CURLOPT_SSLCERT, $this->certRequest['sslcertfile']); - } - if (isset($this->certRequest['sslkeyfile'])) { - $this->setCurlOption(CURLOPT_SSLKEY, $this->certRequest['sslkeyfile']); - } - if (isset($this->certRequest['passphrase'])) { - $this->setCurlOption(CURLOPT_SSLKEYPASSWD, $this->certRequest['passphrase']); - } - if (isset($this->certRequest['certpassword'])) { - $this->setCurlOption(CURLOPT_SSLCERTPASSWD, $this->certRequest['certpassword']); - } - } - } - if ($this->authtype && ($this->authtype != 'certificate')) { - if ($this->username) { - $this->debug('set cURL username/password'); - $this->setCurlOption(CURLOPT_USERPWD, "$this->username:$this->password"); - } - if ($this->authtype == 'basic') { - $this->debug('set cURL for Basic authentication'); - $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_BASIC); - } - if ($this->authtype == 'digest') { - $this->debug('set cURL for digest authentication'); - $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_DIGEST); - } - if ($this->authtype == 'ntlm') { - $this->debug('set cURL for NTLM authentication'); - $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_NTLM); - } - } - if (is_array($this->proxy)) { - $this->debug('set cURL proxy options'); - if ($this->proxy['port'] != '') { - $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host'].':'.$this->proxy['port']); - } else { - $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host']); - } - if ($this->proxy['username'] || $this->proxy['password']) { - $this->debug('set cURL proxy authentication options'); - $this->setCurlOption(CURLOPT_PROXYUSERPWD, $this->proxy['username'].':'.$this->proxy['password']); - if ($this->proxy['authtype'] == 'basic') { - $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_BASIC); - } - if ($this->proxy['authtype'] == 'ntlm') { - $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_NTLM); - } - } - } - $this->debug('cURL connection set up'); - return true; - } else { - $this->setError('Unknown scheme ' . $this->scheme); - $this->debug('Unknown scheme ' . $this->scheme); - return false; - } - } - - /** - * sends the SOAP request and gets the SOAP response via HTTP[S] - * - * @param string $data message data - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @param array $cookies cookies to send - * @return string data - * @access public - */ - function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) { - - $this->debug('entered send() with data of length: '.strlen($data)); - - $this->tryagain = true; - $tries = 0; - while ($this->tryagain) { - $this->tryagain = false; - if ($tries++ < 2) { - // make connnection - if (!$this->connect($timeout, $response_timeout)){ - return false; - } - - // send request - if (!$this->sendRequest($data, $cookies)){ - return false; - } - - // get response - $respdata = $this->getResponse(); - } else { - $this->setError("Too many tries to get an OK response ($this->response_status_line)"); - } - } - $this->debug('end of send()'); - return $respdata; - } - - - /** - * sends the SOAP request and gets the SOAP response via HTTPS using CURL - * - * @param string $data message data - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @param array $cookies cookies to send - * @return string data - * @access public - * @deprecated - */ - function sendHTTPS($data, $timeout=0, $response_timeout=30, $cookies) { - return $this->send($data, $timeout, $response_timeout, $cookies); - } - - /** - * if authenticating, set user credentials here - * - * @param string $username - * @param string $password - * @param string $authtype (basic|digest|certificate|ntlm) - * @param array $digestRequest (keys must be nonce, nc, realm, qop) - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) - * @access public - */ - function setCredentials($username, $password, $authtype = 'basic', $digestRequest = array(), $certRequest = array()) { - $this->debug("setCredentials username=$username authtype=$authtype digestRequest="); - $this->appendDebug($this->varDump($digestRequest)); - $this->debug("certRequest="); - $this->appendDebug($this->varDump($certRequest)); - // cf. RFC 2617 - if ($authtype == 'basic') { - $this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':','',$username).':'.$password)); - } elseif ($authtype == 'digest') { - if (isset($digestRequest['nonce'])) { - $digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1; - - // calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html) - - // A1 = unq(username-value) ":" unq(realm-value) ":" passwd - $A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password; - - // H(A1) = MD5(A1) - $HA1 = md5($A1); - - // A2 = Method ":" digest-uri-value - $A2 = $this->request_method . ':' . $this->digest_uri; - - // H(A2) - $HA2 = md5($A2); - - // KD(secret, data) = H(concat(secret, ":", data)) - // if qop == auth: - // request-digest = <"> < KD ( H(A1), unq(nonce-value) - // ":" nc-value - // ":" unq(cnonce-value) - // ":" unq(qop-value) - // ":" H(A2) - // ) <"> - // if qop is missing, - // request-digest = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <"> - - $unhashedDigest = ''; - $nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : ''; - $cnonce = $nonce; - if ($digestRequest['qop'] != '') { - $unhashedDigest = $HA1 . ':' . $nonce . ':' . sprintf("%08d", $digestRequest['nc']) . ':' . $cnonce . ':' . $digestRequest['qop'] . ':' . $HA2; - } else { - $unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2; - } - - $hashedDigest = md5($unhashedDigest); - - $opaque = ''; - if (isset($digestRequest['opaque'])) { - $opaque = ', opaque="' . $digestRequest['opaque'] . '"'; - } - - $this->setHeader('Authorization', 'Digest username="' . $username . '", realm="' . $digestRequest['realm'] . '", nonce="' . $nonce . '", uri="' . $this->digest_uri . $opaque . '", cnonce="' . $cnonce . '", nc=' . sprintf("%08x", $digestRequest['nc']) . ', qop="' . $digestRequest['qop'] . '", response="' . $hashedDigest . '"'); - } - } elseif ($authtype == 'certificate') { - $this->certRequest = $certRequest; - $this->debug('Authorization header not set for certificate'); - } elseif ($authtype == 'ntlm') { - // do nothing - $this->debug('Authorization header not set for ntlm'); - } - $this->username = $username; - $this->password = $password; - $this->authtype = $authtype; - $this->digestRequest = $digestRequest; - } - - /** - * set the soapaction value - * - * @param string $soapaction - * @access public - */ - function setSOAPAction($soapaction) { - $this->setHeader('SOAPAction', '"' . $soapaction . '"'); - } - - /** - * use http encoding - * - * @param string $enc encoding style. supported values: gzip, deflate, or both - * @access public - */ - function setEncoding($enc='gzip, deflate') { - if (function_exists('gzdeflate')) { - $this->protocol_version = '1.1'; - $this->setHeader('Accept-Encoding', $enc); - if (!isset($this->outgoing_headers['Connection'])) { - $this->setHeader('Connection', 'close'); - $this->persistentConnection = false; - } - // deprecated as of PHP 5.3.0 - //set_magic_quotes_runtime(0); - $this->encoding = $enc; - } - } - - /** - * set proxy info here - * - * @param string $proxyhost use an empty string to remove proxy - * @param string $proxyport - * @param string $proxyusername - * @param string $proxypassword - * @param string $proxyauthtype (basic|ntlm) - * @access public - */ - function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '', $proxyauthtype = 'basic') { - if ($proxyhost) { - $this->proxy = array( - 'host' => $proxyhost, - 'port' => $proxyport, - 'username' => $proxyusername, - 'password' => $proxypassword, - 'authtype' => $proxyauthtype - ); - if ($proxyusername != '' && $proxypassword != '' && $proxyauthtype = 'basic') { - $this->setHeader('Proxy-Authorization', ' Basic '.base64_encode($proxyusername.':'.$proxypassword)); - } - } else { - $this->debug('remove proxy'); - $proxy = null; - unsetHeader('Proxy-Authorization'); - } - } - - - /** - * Test if the given string starts with a header that is to be skipped. - * Skippable headers result from chunked transfer and proxy requests. - * - * @param string $data The string to check. - * @returns boolean Whether a skippable header was found. - * @access private - */ - function isSkippableCurlHeader(&$data) { - $skipHeaders = array( 'HTTP/1.1 100', - 'HTTP/1.0 301', - 'HTTP/1.1 301', - 'HTTP/1.0 302', - 'HTTP/1.1 302', - 'HTTP/1.0 401', - 'HTTP/1.1 401', - 'HTTP/1.0 200 Connection established'); - foreach ($skipHeaders as $hd) { - $prefix = substr($data, 0, strlen($hd)); - if ($prefix == $hd) return true; - } - - return false; - } - - /** - * decode a string that is encoded w/ "chunked' transfer encoding - * as defined in RFC2068 19.4.6 - * - * @param string $buffer - * @param string $lb - * @returns string - * @access public - * @deprecated - */ - function decodeChunked($buffer, $lb){ - // length := 0 - $length = 0; - $new = ''; - - // read chunk-size, chunk-extension (if any) and CRLF - // get the position of the linebreak - $chunkend = strpos($buffer, $lb); - if ($chunkend == FALSE) { - $this->debug('no linebreak found in decodeChunked'); - return $new; - } - $temp = substr($buffer,0,$chunkend); - $chunk_size = hexdec( trim($temp) ); - $chunkstart = $chunkend + strlen($lb); - // while (chunk-size > 0) { - while ($chunk_size > 0) { - $this->debug("chunkstart: $chunkstart chunk_size: $chunk_size"); - $chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size); - - // Just in case we got a broken connection - if ($chunkend == FALSE) { - $chunk = substr($buffer,$chunkstart); - // append chunk-data to entity-body - $new .= $chunk; - $length += strlen($chunk); - break; - } - - // read chunk-data and CRLF - $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart); - // append chunk-data to entity-body - $new .= $chunk; - // length := length + chunk-size - $length += strlen($chunk); - // read chunk-size and CRLF - $chunkstart = $chunkend + strlen($lb); - - $chunkend = strpos($buffer, $lb, $chunkstart) + strlen($lb); - if ($chunkend == FALSE) { - break; //Just in case we got a broken connection - } - $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart); - $chunk_size = hexdec( trim($temp) ); - $chunkstart = $chunkend; - } - return $new; - } - - /** - * Writes the payload, including HTTP headers, to $this->outgoing_payload. - * - * @param string $data HTTP body - * @param string $cookie_str data for HTTP Cookie header - * @return void - * @access private - */ - function buildPayload($data, $cookie_str = '') { - // Note: for cURL connections, $this->outgoing_payload is ignored, - // as is the Content-Length header, but these are still created as - // debugging guides. - - // add content-length header - if ($this->request_method != 'GET') { - $this->setHeader('Content-Length', strlen($data)); - } - - // start building outgoing payload: - if ($this->proxy) { - $uri = $this->url; - } else { - $uri = $this->uri; - } - $req = "$this->request_method $uri HTTP/$this->protocol_version"; - $this->debug("HTTP request: $req"); - $this->outgoing_payload = "$req\r\n"; - - // loop thru headers, serializing - foreach($this->outgoing_headers as $k => $v){ - $hdr = $k.': '.$v; - $this->debug("HTTP header: $hdr"); - $this->outgoing_payload .= "$hdr\r\n"; - } - - // add any cookies - if ($cookie_str != '') { - $hdr = 'Cookie: '.$cookie_str; - $this->debug("HTTP header: $hdr"); - $this->outgoing_payload .= "$hdr\r\n"; - } - - // header/body separator - $this->outgoing_payload .= "\r\n"; - - // add data - $this->outgoing_payload .= $data; - } - - /** - * sends the SOAP request via HTTP[S] - * - * @param string $data message data - * @param array $cookies cookies to send - * @return boolean true if OK, false if problem - * @access private - */ - function sendRequest($data, $cookies = NULL) { - // build cookie string - $cookie_str = $this->getCookiesForRequest($cookies, (($this->scheme == 'ssl') || ($this->scheme == 'https'))); - - // build payload - $this->buildPayload($data, $cookie_str); - - if ($this->io_method() == 'socket') { - // send payload - if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) { - $this->setError('couldn\'t write message data to socket'); - $this->debug('couldn\'t write message data to socket'); - return false; - } - $this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload)); - return true; - } else if ($this->io_method() == 'curl') { - // set payload - // cURL does say this should only be the verb, and in fact it - // turns out that the URI and HTTP version are appended to this, which - // some servers refuse to work with (so we no longer use this method!) - //$this->setCurlOption(CURLOPT_CUSTOMREQUEST, $this->outgoing_payload); - $curl_headers = array(); - foreach($this->outgoing_headers as $k => $v){ - if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || $k == 'Authorization' || $k == 'Proxy-Authorization') { - $this->debug("Skip cURL header $k: $v"); - } else { - $curl_headers[] = "$k: $v"; - } - } - if ($cookie_str != '') { - $curl_headers[] = 'Cookie: ' . $cookie_str; - } - $this->setCurlOption(CURLOPT_HTTPHEADER, $curl_headers); - $this->debug('set cURL HTTP headers'); - if ($this->request_method == "POST") { - $this->setCurlOption(CURLOPT_POST, 1); - $this->setCurlOption(CURLOPT_POSTFIELDS, $data); - $this->debug('set cURL POST data'); - } else { - } - // insert custom user-set cURL options - foreach ($this->ch_options as $key => $val) { - $this->setCurlOption($key, $val); - } - - $this->debug('set cURL payload'); - return true; - } - } - - /** - * gets the SOAP response via HTTP[S] - * - * @return string the response (also sets member variables like incoming_payload) - * @access private - */ - function getResponse(){ - $this->incoming_payload = ''; - - if ($this->io_method() == 'socket') { - // loop until headers have been retrieved - $data = ''; - while (!isset($lb)){ - - // We might EOF during header read. - if(feof($this->fp)) { - $this->incoming_payload = $data; - $this->debug('found no headers before EOF after length ' . strlen($data)); - $this->debug("received before EOF:\n" . $data); - $this->setError('server failed to send headers'); - return false; - } - - $tmp = fgets($this->fp, 256); - $tmplen = strlen($tmp); - $this->debug("read line of $tmplen bytes: " . trim($tmp)); - - if ($tmplen == 0) { - $this->incoming_payload = $data; - $this->debug('socket read of headers timed out after length ' . strlen($data)); - $this->debug("read before timeout: " . $data); - $this->setError('socket read of headers timed out'); - return false; - } - - $data .= $tmp; - $pos = strpos($data,"\r\n\r\n"); - if($pos > 1){ - $lb = "\r\n"; - } else { - $pos = strpos($data,"\n\n"); - if($pos > 1){ - $lb = "\n"; - } - } - // remove 100 headers - if (isset($lb) && preg_match('/^HTTP\/1.1 100/',$data)) { - unset($lb); - $data = ''; - }// - } - // store header data - $this->incoming_payload .= $data; - $this->debug('found end of headers after length ' . strlen($data)); - // process headers - $header_data = trim(substr($data,0,$pos)); - $header_array = explode($lb,$header_data); - $this->incoming_headers = array(); - $this->incoming_cookies = array(); - foreach($header_array as $header_line){ - $arr = explode(':',$header_line, 2); - if(count($arr) > 1){ - $header_name = strtolower(trim($arr[0])); - $this->incoming_headers[$header_name] = trim($arr[1]); - if ($header_name == 'set-cookie') { - // TODO: allow multiple cookies from parseCookie - $cookie = $this->parseCookie(trim($arr[1])); - if ($cookie) { - $this->incoming_cookies[] = $cookie; - $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); - } else { - $this->debug('did not find cookie in ' . trim($arr[1])); - } - } - } else if (isset($header_name)) { - // append continuation line to previous header - $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; - } - } - - // loop until msg has been received - if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') { - $content_length = 2147483647; // ignore any content-length header - $chunked = true; - $this->debug("want to read chunked content"); - } elseif (isset($this->incoming_headers['content-length'])) { - $content_length = $this->incoming_headers['content-length']; - $chunked = false; - $this->debug("want to read content of length $content_length"); - } else { - $content_length = 2147483647; - $chunked = false; - $this->debug("want to read content to EOF"); - } - $data = ''; - do { - if ($chunked) { - $tmp = fgets($this->fp, 256); - $tmplen = strlen($tmp); - $this->debug("read chunk line of $tmplen bytes"); - if ($tmplen == 0) { - $this->incoming_payload = $data; - $this->debug('socket read of chunk length timed out after length ' . strlen($data)); - $this->debug("read before timeout:\n" . $data); - $this->setError('socket read of chunk length timed out'); - return false; - } - $content_length = hexdec(trim($tmp)); - $this->debug("chunk length $content_length"); - } - $strlen = 0; - while (($strlen < $content_length) && (!feof($this->fp))) { - $readlen = min(8192, $content_length - $strlen); - $tmp = fread($this->fp, $readlen); - $tmplen = strlen($tmp); - $this->debug("read buffer of $tmplen bytes"); - if (($tmplen == 0) && (!feof($this->fp))) { - $this->incoming_payload = $data; - $this->debug('socket read of body timed out after length ' . strlen($data)); - $this->debug("read before timeout:\n" . $data); - $this->setError('socket read of body timed out'); - return false; - } - $strlen += $tmplen; - $data .= $tmp; - } - if ($chunked && ($content_length > 0)) { - $tmp = fgets($this->fp, 256); - $tmplen = strlen($tmp); - $this->debug("read chunk terminator of $tmplen bytes"); - if ($tmplen == 0) { - $this->incoming_payload = $data; - $this->debug('socket read of chunk terminator timed out after length ' . strlen($data)); - $this->debug("read before timeout:\n" . $data); - $this->setError('socket read of chunk terminator timed out'); - return false; - } - } - } while ($chunked && ($content_length > 0) && (!feof($this->fp))); - if (feof($this->fp)) { - $this->debug('read to EOF'); - } - $this->debug('read body of length ' . strlen($data)); - $this->incoming_payload .= $data; - $this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server'); - - // close filepointer - if( - (isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') || - (! $this->persistentConnection) || feof($this->fp)){ - fclose($this->fp); - $this->fp = false; - $this->debug('closed socket'); - } - - // connection was closed unexpectedly - if($this->incoming_payload == ''){ - $this->setError('no response from server'); - return false; - } - - // decode transfer-encoding -// if(isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked'){ -// if(!$data = $this->decodeChunked($data, $lb)){ -// $this->setError('Decoding of chunked data failed'); -// return false; -// } - //print "
    \nde-chunked:\n---------------\n$data\n\n---------------\n
    "; - // set decoded payload -// $this->incoming_payload = $header_data.$lb.$lb.$data; -// } - - } else if ($this->io_method() == 'curl') { - // send and receive - $this->debug('send and receive with cURL'); - $this->incoming_payload = curl_exec($this->ch); - $data = $this->incoming_payload; - - $cErr = curl_error($this->ch); - if ($cErr != '') { - $err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'
    '; - // TODO: there is a PHP bug that can cause this to SEGV for CURLINFO_CONTENT_TYPE - foreach(curl_getinfo($this->ch) as $k => $v){ - $err .= "$k: $v
    "; - } - $this->debug($err); - $this->setError($err); - curl_close($this->ch); - return false; - } else { - //echo '
    ';
    -			//var_dump(curl_getinfo($this->ch));
    -			//echo '
    '; - } - // close curl - $this->debug('No cURL error, closing cURL'); - curl_close($this->ch); - - // try removing skippable headers - $savedata = $data; - while ($this->isSkippableCurlHeader($data)) { - $this->debug("Found HTTP header to skip"); - if ($pos = strpos($data,"\r\n\r\n")) { - $data = ltrim(substr($data,$pos)); - } elseif($pos = strpos($data,"\n\n") ) { - $data = ltrim(substr($data,$pos)); - } - } - - if ($data == '') { - // have nothing left; just remove 100 header(s) - $data = $savedata; - while (preg_match('/^HTTP\/1.1 100/',$data)) { - if ($pos = strpos($data,"\r\n\r\n")) { - $data = ltrim(substr($data,$pos)); - } elseif($pos = strpos($data,"\n\n") ) { - $data = ltrim(substr($data,$pos)); - } - } - } - - // separate content from HTTP headers - if ($pos = strpos($data,"\r\n\r\n")) { - $lb = "\r\n"; - } elseif( $pos = strpos($data,"\n\n")) { - $lb = "\n"; - } else { - $this->debug('no proper separation of headers and document'); - $this->setError('no proper separation of headers and document'); - return false; - } - $header_data = trim(substr($data,0,$pos)); - $header_array = explode($lb,$header_data); - $data = ltrim(substr($data,$pos)); - $this->debug('found proper separation of headers and document'); - $this->debug('cleaned data, stringlen: '.strlen($data)); - // clean headers - foreach ($header_array as $header_line) { - $arr = explode(':',$header_line,2); - if(count($arr) > 1){ - $header_name = strtolower(trim($arr[0])); - $this->incoming_headers[$header_name] = trim($arr[1]); - if ($header_name == 'set-cookie') { - // TODO: allow multiple cookies from parseCookie - $cookie = $this->parseCookie(trim($arr[1])); - if ($cookie) { - $this->incoming_cookies[] = $cookie; - $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); - } else { - $this->debug('did not find cookie in ' . trim($arr[1])); - } - } - } else if (isset($header_name)) { - // append continuation line to previous header - $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; - } - } - } - - $this->response_status_line = $header_array[0]; - $arr = explode(' ', $this->response_status_line, 3); - $http_version = $arr[0]; - $http_status = (int)($arr[1]); - $http_reason = count($arr) > 2 ? $arr[2] : ''; - - // see if we need to resend the request with http digest authentication - if (isset($this->incoming_headers['location']) && ($http_status == 301 || $http_status == 302)) { - $this->debug("Got $http_status $http_reason with Location: " . $this->incoming_headers['location']); - $this->setURL($this->incoming_headers['location']); - $this->tryagain = true; - return false; - } - - // see if we need to resend the request with http digest authentication - if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) { - $this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authenticate']); - if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) { - $this->debug('Server wants digest authentication'); - // remove "Digest " from our elements - $digestString = str_replace('Digest ', '', $this->incoming_headers['www-authenticate']); - - // parse elements into array - $digestElements = explode(',', $digestString); - foreach ($digestElements as $val) { - $tempElement = explode('=', trim($val), 2); - $digestRequest[$tempElement[0]] = str_replace("\"", '', $tempElement[1]); - } - - // should have (at least) qop, realm, nonce - if (isset($digestRequest['nonce'])) { - $this->setCredentials($this->username, $this->password, 'digest', $digestRequest); - $this->tryagain = true; - return false; - } - } - $this->debug('HTTP authentication failed'); - $this->setError('HTTP authentication failed'); - return false; - } - - if ( - ($http_status >= 300 && $http_status <= 307) || - ($http_status >= 400 && $http_status <= 417) || - ($http_status >= 501 && $http_status <= 505) - ) { - $this->setError("Unsupported HTTP response status $http_status $http_reason (soapclient->response has contents of the response)"); - return false; - } - - // decode content-encoding - if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){ - if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){ - // if decoding works, use it. else assume data wasn't gzencoded - if(function_exists('gzinflate')){ - //$timer->setMarker('starting decoding of gzip/deflated content'); - // IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress) - // this means there are no Zlib headers, although there should be - $this->debug('The gzinflate function exists'); - $datalen = strlen($data); - if ($this->incoming_headers['content-encoding'] == 'deflate') { - if ($degzdata = @gzinflate($data)) { - $data = $degzdata; - $this->debug('The payload has been inflated to ' . strlen($data) . ' bytes'); - if (strlen($data) < $datalen) { - // test for the case that the payload has been compressed twice - $this->debug('The inflated payload is smaller than the gzipped one; try again'); - if ($degzdata = @gzinflate($data)) { - $data = $degzdata; - $this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes'); - } - } - } else { - $this->debug('Error using gzinflate to inflate the payload'); - $this->setError('Error using gzinflate to inflate the payload'); - } - } elseif ($this->incoming_headers['content-encoding'] == 'gzip') { - if ($degzdata = @gzinflate(substr($data, 10))) { // do our best - $data = $degzdata; - $this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes'); - if (strlen($data) < $datalen) { - // test for the case that the payload has been compressed twice - $this->debug('The un-gzipped payload is smaller than the gzipped one; try again'); - if ($degzdata = @gzinflate(substr($data, 10))) { - $data = $degzdata; - $this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes'); - } - } - } else { - $this->debug('Error using gzinflate to un-gzip the payload'); - $this->setError('Error using gzinflate to un-gzip the payload'); - } - } - //$timer->setMarker('finished decoding of gzip/deflated content'); - //print "\nde-inflated:\n---------------\n$data\n-------------\n"; - // set decoded payload - $this->incoming_payload = $header_data.$lb.$lb.$data; - } else { - $this->debug('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.'); - $this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.'); - } - } else { - $this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); - $this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); - } - } else { - $this->debug('No Content-Encoding header'); - } - - if(strlen($data) == 0){ - $this->debug('no data after headers!'); - $this->setError('no data present after HTTP headers'); - return false; - } - - return $data; - } - - /** - * sets the content-type for the SOAP message to be sent - * - * @param string $type the content type, MIME style - * @param mixed $charset character set used for encoding (or false) - * @access public - */ - function setContentType($type, $charset = false) { - $this->setHeader('Content-Type', $type . ($charset ? '; charset=' . $charset : '')); - } - - /** - * specifies that an HTTP persistent connection should be used - * - * @return boolean whether the request was honored by this method. - * @access public - */ - function usePersistentConnection(){ - if (isset($this->outgoing_headers['Accept-Encoding'])) { - return false; - } - $this->protocol_version = '1.1'; - $this->persistentConnection = true; - $this->setHeader('Connection', 'Keep-Alive'); - return true; - } - - /** - * parse an incoming Cookie into it's parts - * - * @param string $cookie_str content of cookie - * @return array with data of that cookie - * @access private - */ - /* - * TODO: allow a Set-Cookie string to be parsed into multiple cookies - */ - function parseCookie($cookie_str) { - $cookie_str = str_replace('; ', ';', $cookie_str) . ';'; - $data = preg_split('/;/', $cookie_str); - $value_str = $data[0]; - - $cookie_param = 'domain='; - $start = strpos($cookie_str, $cookie_param); - if ($start > 0) { - $domain = substr($cookie_str, $start + strlen($cookie_param)); - $domain = substr($domain, 0, strpos($domain, ';')); - } else { - $domain = ''; - } - - $cookie_param = 'expires='; - $start = strpos($cookie_str, $cookie_param); - if ($start > 0) { - $expires = substr($cookie_str, $start + strlen($cookie_param)); - $expires = substr($expires, 0, strpos($expires, ';')); - } else { - $expires = ''; - } - - $cookie_param = 'path='; - $start = strpos($cookie_str, $cookie_param); - if ( $start > 0 ) { - $path = substr($cookie_str, $start + strlen($cookie_param)); - $path = substr($path, 0, strpos($path, ';')); - } else { - $path = '/'; - } - - $cookie_param = ';secure;'; - if (strpos($cookie_str, $cookie_param) !== FALSE) { - $secure = true; - } else { - $secure = false; - } - - $sep_pos = strpos($value_str, '='); - - if ($sep_pos) { - $name = substr($value_str, 0, $sep_pos); - $value = substr($value_str, $sep_pos + 1); - $cookie= array( 'name' => $name, - 'value' => $value, - 'domain' => $domain, - 'path' => $path, - 'expires' => $expires, - 'secure' => $secure - ); - return $cookie; - } - return false; - } - - /** - * sort out cookies for the current request - * - * @param array $cookies array with all cookies - * @param boolean $secure is the send-content secure or not? - * @return string for Cookie-HTTP-Header - * @access private - */ - function getCookiesForRequest($cookies, $secure=false) { - $cookie_str = ''; - if ((! is_null($cookies)) && (is_array($cookies))) { - foreach ($cookies as $cookie) { - if (! is_array($cookie)) { - continue; - } - $this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']); - if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) { - if (strtotime($cookie['expires']) <= time()) { - $this->debug('cookie has expired'); - continue; - } - } - if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) { - $domain = preg_quote($cookie['domain']); - if (! preg_match("'.*$domain$'i", $this->host)) { - $this->debug('cookie has different domain'); - continue; - } - } - if ((isset($cookie['path'])) && (! empty($cookie['path']))) { - $path = preg_quote($cookie['path']); - if (! preg_match("'^$path.*'i", $this->path)) { - $this->debug('cookie is for a different path'); - continue; - } - } - if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) { - $this->debug('cookie is secure, transport is not'); - continue; - } - $cookie_str .= $cookie['name'] . '=' . $cookie['value'] . '; '; - $this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']); - } - } - return $cookie_str; - } -} - -?> -* @author Scott Nichol -* @version $Id: nusoap.php 7091 2011-06-16 11:34:02Z mMarinetti $ -* @access public -*/ -class nusoap_server extends nusoap_base { - /** - * HTTP headers of request - * @var array - * @access private - */ - var $headers = array(); - /** - * HTTP request - * @var string - * @access private - */ - var $request = ''; - /** - * SOAP headers from request (incomplete namespace resolution; special characters not escaped) (text) - * @var string - * @access public - */ - var $requestHeaders = ''; - /** - * SOAP Headers from request (parsed) - * @var mixed - * @access public - */ - var $requestHeader = NULL; - /** - * SOAP body request portion (incomplete namespace resolution; special characters not escaped) (text) - * @var string - * @access public - */ - var $document = ''; - /** - * SOAP payload for request (text) - * @var string - * @access public - */ - var $requestSOAP = ''; - /** - * requested method namespace URI - * @var string - * @access private - */ - var $methodURI = ''; - /** - * name of method requested - * @var string - * @access private - */ - var $methodname = ''; - /** - * method parameters from request - * @var array - * @access private - */ - var $methodparams = array(); - /** - * SOAP Action from request - * @var string - * @access private - */ - var $SOAPAction = ''; - /** - * character set encoding of incoming (request) messages - * @var string - * @access public - */ - var $xml_encoding = ''; - /** - * toggles whether the parser decodes element content w/ utf8_decode() - * @var boolean - * @access public - */ - var $decode_utf8 = true; - - /** - * HTTP headers of response - * @var array - * @access public - */ - var $outgoing_headers = array(); - /** - * HTTP response - * @var string - * @access private - */ - var $response = ''; - /** - * SOAP headers for response (text or array of soapval or associative array) - * @var mixed - * @access public - */ - var $responseHeaders = ''; - /** - * SOAP payload for response (text) - * @var string - * @access private - */ - var $responseSOAP = ''; - /** - * method return value to place in response - * @var mixed - * @access private - */ - var $methodreturn = false; - /** - * whether $methodreturn is a string of literal XML - * @var boolean - * @access public - */ - var $methodreturnisliteralxml = false; - /** - * SOAP fault for response (or false) - * @var mixed - * @access private - */ - var $fault = false; - /** - * text indication of result (for debugging) - * @var string - * @access private - */ - var $result = 'successful'; - - /** - * assoc array of operations => opData; operations are added by the register() - * method or by parsing an external WSDL definition - * @var array - * @access private - */ - var $operations = array(); - /** - * wsdl instance (if one) - * @var mixed - * @access private - */ - var $wsdl = false; - /** - * URL for WSDL (if one) - * @var mixed - * @access private - */ - var $externalWSDLURL = false; - /** - * whether to append debug to response as XML comment - * @var boolean - * @access public - */ - var $debug_flag = false; - - - /** - * constructor - * the optional parameter is a path to a WSDL file that you'd like to bind the server instance to. - * - * @param mixed $wsdl file path or URL (string), or wsdl instance (object) - * @access public - */ - function nusoap_server($wsdl=false){ - parent::nusoap_base(); - // turn on debugging? - global $debug; - global $HTTP_SERVER_VARS; - - if (isset($_SERVER)) { - $this->debug("_SERVER is defined:"); - $this->appendDebug($this->varDump($_SERVER)); - } elseif (isset($HTTP_SERVER_VARS)) { - $this->debug("HTTP_SERVER_VARS is defined:"); - $this->appendDebug($this->varDump($HTTP_SERVER_VARS)); - } else { - $this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined."); - } - - if (isset($debug)) { - $this->debug("In nusoap_server, set debug_flag=$debug based on global flag"); - $this->debug_flag = $debug; - } elseif (isset($_SERVER['QUERY_STRING'])) { - $qs = explode('&', $_SERVER['QUERY_STRING']); - foreach ($qs as $v) { - if (substr($v, 0, 6) == 'debug=') { - $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #1"); - $this->debug_flag = substr($v, 6); - } - } - } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { - $qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']); - foreach ($qs as $v) { - if (substr($v, 0, 6) == 'debug=') { - $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #2"); - $this->debug_flag = substr($v, 6); - } - } - } - - // wsdl - if($wsdl){ - $this->debug("In nusoap_server, WSDL is specified"); - if (is_object($wsdl) && (get_class($wsdl) == 'wsdl')) { - $this->wsdl = $wsdl; - $this->externalWSDLURL = $this->wsdl->wsdl; - $this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL); - } else { - $this->debug('Create wsdl from ' . $wsdl); - $this->wsdl = new wsdl($wsdl); - $this->externalWSDLURL = $wsdl; - } - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - if($err = $this->wsdl->getError()){ - die('WSDL ERROR: '.$err); - } - } - } - - /** - * processes request and returns response - * - * @param string $data usually is the value of $HTTP_RAW_POST_DATA - * @access public - */ - function service($data){ - global $HTTP_SERVER_VARS; - - if (isset($_SERVER['REQUEST_METHOD'])) { - $rm = $_SERVER['REQUEST_METHOD']; - } elseif (isset($HTTP_SERVER_VARS['REQUEST_METHOD'])) { - $rm = $HTTP_SERVER_VARS['REQUEST_METHOD']; - } else { - $rm = ''; - } - - if (isset($_SERVER['QUERY_STRING'])) { - $qs = $_SERVER['QUERY_STRING']; - } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { - $qs = $HTTP_SERVER_VARS['QUERY_STRING']; - } else { - $qs = ''; - } - $this->debug("In service, request method=$rm query string=$qs strlen(\$data)=" . strlen($data)); - - if ($rm == 'POST') { - $this->debug("In service, invoke the request"); - $this->parse_request($data); - if (! $this->fault) { - $this->invoke_method(); - } - if (! $this->fault) { - $this->serialize_return(); - } - $this->send_response(); - } elseif (preg_match('/wsdl/', $qs) ){ - $this->debug("In service, this is a request for WSDL"); - if ($this->externalWSDLURL){ - if (strpos($this->externalWSDLURL, "http://") !== false) { // assume URL - $this->debug("In service, re-direct for WSDL"); - header('Location: '.$this->externalWSDLURL); - } else { // assume file - $this->debug("In service, use file passthru for WSDL"); - header("Content-Type: text/xml\r\n"); - $pos = strpos($this->externalWSDLURL, "file://"); - if ($pos === false) { - $filename = $this->externalWSDLURL; - } else { - $filename = substr($this->externalWSDLURL, $pos + 7); - } - $fp = fopen($this->externalWSDLURL, 'r'); - fpassthru($fp); - } - } elseif ($this->wsdl) { - $this->debug("In service, serialize WSDL"); - header("Content-Type: text/xml; charset=ISO-8859-1\r\n"); - print $this->wsdl->serialize($this->debug_flag); - if ($this->debug_flag) { - $this->debug('wsdl:'); - $this->appendDebug($this->varDump($this->wsdl)); - print $this->getDebugAsXMLComment(); - } - } else { - $this->debug("In service, there is no WSDL"); - header("Content-Type: text/html; charset=ISO-8859-1\r\n"); - print "This service does not provide WSDL"; - } - } elseif ($this->wsdl) { - $this->debug("In service, return Web description"); - print $this->wsdl->webDescription(); - } else { - $this->debug("In service, no Web description"); - header("Content-Type: text/html; charset=ISO-8859-1\r\n"); - print "This service does not provide a Web description"; - } - } - - /** - * parses HTTP request headers. - * - * The following fields are set by this function (when successful) - * - * headers - * request - * xml_encoding - * SOAPAction - * - * @access private - */ - function parse_http_headers() { - global $HTTP_SERVER_VARS; - - $this->request = ''; - $this->SOAPAction = ''; - if(function_exists('getallheaders')){ - $this->debug("In parse_http_headers, use getallheaders"); - $headers = getallheaders(); - foreach($headers as $k=>$v){ - $k = strtolower($k); - $this->headers[$k] = $v; - $this->request .= "$k: $v\r\n"; - $this->debug("$k: $v"); - } - // get SOAPAction header - if(isset($this->headers['soapaction'])){ - $this->SOAPAction = str_replace('"','',$this->headers['soapaction']); - } - // get the character encoding of the incoming request - if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){ - $enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1)); - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - } elseif(isset($_SERVER) && is_array($_SERVER)){ - $this->debug("In parse_http_headers, use _SERVER"); - foreach ($_SERVER as $k => $v) { - if (substr($k, 0, 5) == 'HTTP_') { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); - } else { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); - } - if ($k == 'soapaction') { - // get SOAPAction header - $k = 'SOAPAction'; - $v = str_replace('"', '', $v); - $v = str_replace('\\', '', $v); - $this->SOAPAction = $v; - } else if ($k == 'content-type') { - // get the character encoding of the incoming request - if (strpos($v, '=')) { - $enc = substr(strstr($v, '='), 1); - $enc = str_replace('"', '', $enc); - $enc = str_replace('\\', '', $enc); - if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) { - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - } - $this->headers[$k] = $v; - $this->request .= "$k: $v\r\n"; - $this->debug("$k: $v"); - } - } elseif (is_array($HTTP_SERVER_VARS)) { - $this->debug("In parse_http_headers, use HTTP_SERVER_VARS"); - foreach ($HTTP_SERVER_VARS as $k => $v) { - if (substr($k, 0, 5) == 'HTTP_') { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); $k = strtolower(substr($k, 5)); - } else { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); $k = strtolower($k); - } - if ($k == 'soapaction') { - // get SOAPAction header - $k = 'SOAPAction'; - $v = str_replace('"', '', $v); - $v = str_replace('\\', '', $v); - $this->SOAPAction = $v; - } else if ($k == 'content-type') { - // get the character encoding of the incoming request - if (strpos($v, '=')) { - $enc = substr(strstr($v, '='), 1); - $enc = str_replace('"', '', $enc); - $enc = str_replace('\\', '', $enc); - if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) { - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - } - $this->headers[$k] = $v; - $this->request .= "$k: $v\r\n"; - $this->debug("$k: $v"); - } - } else { - $this->debug("In parse_http_headers, HTTP headers not accessible"); - $this->setError("HTTP headers not accessible"); - } - } - - /** - * parses a request - * - * The following fields are set by this function (when successful) - * - * headers - * request - * xml_encoding - * SOAPAction - * request - * requestSOAP - * methodURI - * methodname - * methodparams - * requestHeaders - * document - * - * This sets the fault field on error - * - * @param string $data XML string - * @access private - */ - function parse_request($data='') { - $this->debug('entering parse_request()'); - $this->parse_http_headers(); - $this->debug('got character encoding: '.$this->xml_encoding); - // uncompress if necessary - if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] != '') { - $this->debug('got content encoding: ' . $this->headers['content-encoding']); - if ($this->headers['content-encoding'] == 'deflate' || $this->headers['content-encoding'] == 'gzip') { - // if decoding works, use it. else assume data wasn't gzencoded - if (function_exists('gzuncompress')) { - if ($this->headers['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) { - $data = $degzdata; - } elseif ($this->headers['content-encoding'] == 'gzip' && $degzdata = gzinflate(substr($data, 10))) { - $data = $degzdata; - } else { - $this->fault('SOAP-ENV:Client', 'Errors occurred when trying to decode the data'); - return; - } - } else { - $this->fault('SOAP-ENV:Client', 'This Server does not support compressed data'); - return; - } - } - } - $this->request .= "\r\n".$data; - $data = $this->parseRequest($this->headers, $data); - $this->requestSOAP = $data; - $this->debug('leaving parse_request'); - } - - /** - * invokes a PHP function for the requested SOAP method - * - * The following fields are set by this function (when successful) - * - * methodreturn - * - * Note that the PHP function that is called may also set the following - * fields to affect the response sent to the client - * - * responseHeaders - * outgoing_headers - * - * This sets the fault field on error - * - * @access private - */ - function invoke_method() { - $this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodURI . ' SOAPAction=' . $this->SOAPAction); - - // - // if you are debugging in this area of the code, your service uses a class to implement methods, - // you use SOAP RPC, and the client is .NET, please be aware of the following... - // when the .NET wsdl.exe utility generates a proxy, it will remove the '.' or '..' from the - // method name. that is fine for naming the .NET methods. it is not fine for properly constructing - // the XML request and reading the XML response. you need to add the RequestElementName and - // ResponseElementName to the System.Web.Services.Protocols.SoapRpcMethodAttribute that wsdl.exe - // generates for the method. these parameters are used to specify the correct XML element names - // for .NET to use, i.e. the names with the '.' in them. - // - $orig_methodname = $this->methodname; - if ($this->wsdl) { - if ($this->opData = $this->wsdl->getOperationData($this->methodname)) { - $this->debug('in invoke_method, found WSDL operation=' . $this->methodname); - $this->appendDebug('opData=' . $this->varDump($this->opData)); - } elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) { - // Note: hopefully this case will only be used for doc/lit, since rpc services should have wrapper element - $this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . $this->opData['name']); - $this->appendDebug('opData=' . $this->varDump($this->opData)); - $this->methodname = $this->opData['name']; - } else { - $this->debug('in invoke_method, no WSDL for operation=' . $this->methodname); - $this->fault('SOAP-ENV:Client', "Operation '" . $this->methodname . "' is not defined in the WSDL for this service"); - return; - } - } else { - $this->debug('in invoke_method, no WSDL to validate method'); - } - - // if a . is present in $this->methodname, we see if there is a class in scope, - // which could be referred to. We will also distinguish between two deliminators, - // to allow methods to be called a the class or an instance - if (strpos($this->methodname, '..') > 0) { - $delim = '..'; - } else if (strpos($this->methodname, '.') > 0) { - $delim = '.'; - } else { - $delim = ''; - } - $this->debug("in invoke_method, delim=$delim"); - - $class = ''; - $method = ''; - if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1) { - $try_class = substr($this->methodname, 0, strpos($this->methodname, $delim)); - if (class_exists($try_class)) { - // get the class and method name - $class = $try_class; - $method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim)); - $this->debug("in invoke_method, class=$class method=$method delim=$delim"); - } else { - $this->debug("in invoke_method, class=$try_class not found"); - } - } else { - $try_class = ''; - $this->debug("in invoke_method, no class to try"); - } - - // does method exist? - if ($class == '') { - if (!function_exists($this->methodname)) { - $this->debug("in invoke_method, function '$this->methodname' not found!"); - $this->result = 'fault: method not found'; - $this->fault('SOAP-ENV:Client',"method '$this->methodname'('$orig_methodname') not defined in service('$try_class' '$delim')"); - return; - } - } else { - $method_to_compare = (substr(phpversion(), 0, 2) == '4.') ? strtolower($method) : $method; - if (!in_array($method_to_compare, get_class_methods($class))) { - $this->debug("in invoke_method, method '$this->methodname' not found in class '$class'!"); - $this->result = 'fault: method not found'; - $this->fault('SOAP-ENV:Client',"method '$this->methodname'/'$method_to_compare'('$orig_methodname') not defined in service/'$class'('$try_class' '$delim')"); - return; - } - } - - // evaluate message, getting back parameters - // verify that request parameters match the method's signature - if(! $this->verify_method($this->methodname,$this->methodparams)){ - // debug - $this->debug('ERROR: request not verified against method signature'); - $this->result = 'fault: request failed validation against method signature'; - // return fault - $this->fault('SOAP-ENV:Client',"Operation '$this->methodname' not defined in service."); - return; - } - - // if there are parameters to pass - $this->debug('in invoke_method, params:'); - $this->appendDebug($this->varDump($this->methodparams)); - $this->debug("in invoke_method, calling '$this->methodname'"); - if (!function_exists('call_user_func_array')) { - if ($class == '') { - $this->debug('in invoke_method, calling function using eval()'); - $funcCall = "\$this->methodreturn = $this->methodname("; - } else { - if ($delim == '..') { - $this->debug('in invoke_method, calling class method using eval()'); - $funcCall = "\$this->methodreturn = ".$class."::".$method."("; - } else { - $this->debug('in invoke_method, calling instance method using eval()'); - // generate unique instance name - $instname = "\$inst_".time(); - $funcCall = $instname." = new ".$class."(); "; - $funcCall .= "\$this->methodreturn = ".$instname."->".$method."("; - } - } - if ($this->methodparams) { - foreach ($this->methodparams as $param) { - if (is_array($param) || is_object($param)) { - $this->fault('SOAP-ENV:Client', 'NuSOAP does not handle complexType parameters correctly when using eval; call_user_func_array must be available'); - return; - } - $funcCall .= "\"$param\","; - } - $funcCall = substr($funcCall, 0, -1); - } - $funcCall .= ');'; - $this->debug('in invoke_method, function call: '.$funcCall); - @eval($funcCall); - } else { - if ($class == '') { - $this->debug('in invoke_method, calling function using call_user_func_array()'); - $call_arg = "$this->methodname"; // straight assignment changes $this->methodname to lower case after call_user_func_array() - } elseif ($delim == '..') { - $this->debug('in invoke_method, calling class method using call_user_func_array()'); - $call_arg = array ($class, $method); - } else { - $this->debug('in invoke_method, calling instance method using call_user_func_array()'); - $instance = new $class (); - $call_arg = array(&$instance, $method); - } - if (is_array($this->methodparams)) { - $this->methodreturn = call_user_func_array($call_arg, array_values($this->methodparams)); - } else { - $this->methodreturn = call_user_func_array($call_arg, array()); - } - } - $this->debug('in invoke_method, methodreturn:'); - $this->appendDebug($this->varDump($this->methodreturn)); - $this->debug("in invoke_method, called method $this->methodname, received data of type ".gettype($this->methodreturn)); - } - - /** - * serializes the return value from a PHP function into a full SOAP Envelope - * - * The following fields are set by this function (when successful) - * - * responseSOAP - * - * This sets the fault field on error - * - * @access private - */ - function serialize_return() { - $this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI); - // if fault - if (isset($this->methodreturn) && is_object($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class($this->methodreturn) == 'nusoap_fault'))) { - $this->debug('got a fault object from method'); - $this->fault = $this->methodreturn; - return; - } elseif ($this->methodreturnisliteralxml) { - $return_val = $this->methodreturn; - // returned value(s) - } else { - $this->debug('got a(n) '.gettype($this->methodreturn).' from method'); - $this->debug('serializing return value'); - if($this->wsdl){ - if (sizeof($this->opData['output']['parts']) > 1) { - $this->debug('more than one output part, so use the method return unchanged'); - $opParams = $this->methodreturn; - } elseif (sizeof($this->opData['output']['parts']) == 1) { - $this->debug('exactly one output part, so wrap the method return in a simple array'); - // TODO: verify that it is not already wrapped! - //foreach ($this->opData['output']['parts'] as $name => $type) { - // $this->debug('wrap in element named ' . $name); - //} - $opParams = array($this->methodreturn); - } - $return_val = $this->wsdl->serializeRPCParameters($this->methodname,'output',$opParams); - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - if($errstr = $this->wsdl->getError()){ - $this->debug('got wsdl error: '.$errstr); - $this->fault('SOAP-ENV:Server', 'unable to serialize result'); - return; - } - } else { - if (isset($this->methodreturn)) { - $return_val = $this->serialize_val($this->methodreturn, 'return'); - } else { - $return_val = ''; - $this->debug('in absence of WSDL, assume void return for backward compatibility'); - } - } - } - $this->debug('return value:'); - $this->appendDebug($this->varDump($return_val)); - - $this->debug('serializing response'); - if ($this->wsdl) { - $this->debug('have WSDL for serialization: style is ' . $this->opData['style']); - if ($this->opData['style'] == 'rpc') { - $this->debug('style is rpc for serialization: use is ' . $this->opData['output']['use']); - if ($this->opData['output']['use'] == 'literal') { - // http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace - if ($this->methodURI) { - $payload = 'methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'methodname."Response>"; - } else { - $payload = '<'.$this->methodname.'Response>'.$return_val.'methodname.'Response>'; - } - } else { - if ($this->methodURI) { - $payload = 'methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'methodname."Response>"; - } else { - $payload = '<'.$this->methodname.'Response>'.$return_val.'methodname.'Response>'; - } - } - } else { - $this->debug('style is not rpc for serialization: assume document'); - $payload = $return_val; - } - } else { - $this->debug('do not have WSDL for serialization: assume rpc/encoded'); - $payload = 'methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'methodname."Response>"; - } - $this->result = 'successful'; - if($this->wsdl){ - //if($this->debug_flag){ - $this->appendDebug($this->wsdl->getDebug()); - // } - if (isset($this->opData['output']['encodingStyle'])) { - $encodingStyle = $this->opData['output']['encodingStyle']; - } else { - $encodingStyle = ''; - } - // Added: In case we use a WSDL, return a serialized env. WITH the usedNamespaces. - $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders,$this->wsdl->usedNamespaces,$this->opData['style'],$this->opData['output']['use'],$encodingStyle); - } else { - $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders); - } - $this->debug("Leaving serialize_return"); - } - - /** - * sends an HTTP response - * - * The following fields are set by this function (when successful) - * - * outgoing_headers - * response - * - * @access private - */ - function send_response() { - $this->debug('Enter send_response'); - if ($this->fault) { - $payload = $this->fault->serialize(); - $this->outgoing_headers[] = "HTTP/1.0 500 Internal Server Error"; - $this->outgoing_headers[] = "Status: 500 Internal Server Error"; - } else { - $payload = $this->responseSOAP; - // Some combinations of PHP+Web server allow the Status - // to come through as a header. Since OK is the default - // just do nothing. - // $this->outgoing_headers[] = "HTTP/1.0 200 OK"; - // $this->outgoing_headers[] = "Status: 200 OK"; - } - // add debug data if in debug mode - if(isset($this->debug_flag) && $this->debug_flag){ - $payload .= $this->getDebugAsXMLComment(); - } - $this->outgoing_headers[] = "Server: $this->title Server v$this->version"; - preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev); - $this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")"; - // Let the Web server decide about this - //$this->outgoing_headers[] = "Connection: Close\r\n"; - $payload = $this->getHTTPBody($payload); - $type = $this->getHTTPContentType(); - $charset = $this->getHTTPContentTypeCharset(); - $this->outgoing_headers[] = "Content-Type: $type" . ($charset ? '; charset=' . $charset : ''); - //begin code to compress payload - by John - // NOTE: there is no way to know whether the Web server will also compress - // this data. - if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) { - if (strstr($this->headers['accept-encoding'], 'gzip')) { - if (function_exists('gzencode')) { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - $this->outgoing_headers[] = "Content-Encoding: gzip"; - $payload = gzencode($payload); - } else { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - } - } elseif (strstr($this->headers['accept-encoding'], 'deflate')) { - // Note: MSIE requires gzdeflate output (no Zlib header and checksum), - // instead of gzcompress output, - // which conflicts with HTTP 1.1 spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5) - if (function_exists('gzdeflate')) { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - $this->outgoing_headers[] = "Content-Encoding: deflate"; - $payload = gzdeflate($payload); - } else { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - } - } - } - //end code - $this->outgoing_headers[] = "Content-Length: ".strlen($payload); - reset($this->outgoing_headers); - foreach($this->outgoing_headers as $hdr){ - header($hdr, false); - } - print $payload; - $this->response = join("\r\n",$this->outgoing_headers)."\r\n\r\n".$payload; - } - - /** - * takes the value that was created by parsing the request - * and compares to the method's signature, if available. - * - * @param string $operation The operation to be invoked - * @param array $request The array of parameter values - * @return boolean Whether the operation was found - * @access private - */ - function verify_method($operation,$request){ - if(isset($this->wsdl) && is_object($this->wsdl)){ - if($this->wsdl->getOperationData($operation)){ - return true; - } - } elseif(isset($this->operations[$operation])){ - return true; - } - return false; - } - - /** - * processes SOAP message received from client - * - * @param array $headers The HTTP headers - * @param string $data unprocessed request data from client - * @return mixed value of the message, decoded into a PHP type - * @access private - */ - function parseRequest($headers, $data) { - $this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' headers:'); - $this->appendDebug($this->varDump($headers)); - if (!isset($headers['content-type'])) { - $this->setError('Request not of type text/xml (no content-type header)'); - return false; - } - if (!strstr($headers['content-type'], 'text/xml')) { - $this->setError('Request not of type text/xml'); - return false; - } - if (strpos($headers['content-type'], '=')) { - $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1)); - $this->debug('Got response encoding: ' . $enc); - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser'); - // parse response, get soap parser obj - $parser = new nusoap_parser($data,$this->xml_encoding,'',$this->decode_utf8); - // parser debug - $this->debug("parser debug: \n".$parser->getDebug()); - // if fault occurred during message parsing - if($err = $parser->getError()){ - $this->result = 'fault: error in msg parsing: '.$err; - $this->fault('SOAP-ENV:Client',"error in msg parsing:\n".$err); - // else successfully parsed request into soapval object - } else { - // get/set methodname - $this->methodURI = $parser->root_struct_namespace; - $this->methodname = $parser->root_struct_name; - $this->debug('methodname: '.$this->methodname.' methodURI: '.$this->methodURI); - $this->debug('calling parser->get_soapbody()'); - $this->methodparams = $parser->get_soapbody(); - // get SOAP headers - $this->requestHeaders = $parser->getHeaders(); - // get SOAP Header - $this->requestHeader = $parser->get_soapheader(); - // add document for doclit support - $this->document = $parser->document; - } - } - - /** - * gets the HTTP body for the current response. - * - * @param string $soapmsg The SOAP payload - * @return string The HTTP body, which includes the SOAP payload - * @access private - */ - function getHTTPBody($soapmsg) { - return $soapmsg; - } - - /** - * gets the HTTP content type for the current response. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type for the current response. - * @access private - */ - function getHTTPContentType() { - return 'text/xml'; - } - - /** - * gets the HTTP content type charset for the current response. - * returns false for non-text content types. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type charset for the current response. - * @access private - */ - function getHTTPContentTypeCharset() { - return $this->soap_defencoding; - } - - /** - * add a method to the dispatch map (this has been replaced by the register method) - * - * @param string $methodname - * @param string $in array of input values - * @param string $out array of output values - * @access public - * @deprecated - */ - function add_to_map($methodname,$in,$out){ - $this->operations[$methodname] = array('name' => $methodname,'in' => $in,'out' => $out); - } - - /** - * register a service function with the server - * - * @param string $name the name of the PHP function, class.method or class..method - * @param array $in assoc array of input values: key = param name, value = param type - * @param array $out assoc array of output values: key = param name, value = param type - * @param mixed $namespace the element namespace for the method or false - * @param mixed $soapaction the soapaction for the method or false - * @param mixed $style optional (rpc|document) or false Note: when 'document' is specified, parameter and return wrappers are created for you automatically - * @param mixed $use optional (encoded|literal) or false - * @param string $documentation optional Description to include in WSDL - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) - * @access public - */ - function register($name,$in=array(),$out=array(),$namespace=false,$soapaction=false,$style=false,$use=false,$documentation='',$encodingStyle=''){ - global $HTTP_SERVER_VARS; - - if($this->externalWSDLURL){ - die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.'); - } - if (! $name) { - die('You must specify a name when you register an operation'); - } - if (!is_array($in)) { - die('You must provide an array for operation inputs'); - } - if (!is_array($out)) { - die('You must provide an array for operation outputs'); - } - if(false == $namespace) { - } - if(false == $soapaction) { - if (isset($_SERVER)) { - $SERVER_NAME = $_SERVER['SERVER_NAME']; - $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; - $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'); - } elseif (isset($HTTP_SERVER_VARS)) { - $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME']; - $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']; - $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'; - } else { - $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); - } - if ($HTTPS == '1' || $HTTPS == 'on') { - $SCHEME = 'https'; - } else { - $SCHEME = 'http'; - } - $soapaction = "$SCHEME://$SERVER_NAME$SCRIPT_NAME/$name"; - } - if(false == $style) { - $style = "rpc"; - } - if(false == $use) { - $use = "encoded"; - } - if ($use == 'encoded' && $encodingStyle == '') { - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - } - - $this->operations[$name] = array( - 'name' => $name, - 'in' => $in, - 'out' => $out, - 'namespace' => $namespace, - 'soapaction' => $soapaction, - 'style' => $style); - if($this->wsdl){ - $this->wsdl->addOperation($name,$in,$out,$namespace,$soapaction,$style,$use,$documentation,$encodingStyle); - } - return true; - } - - /** - * Specify a fault to be returned to the client. - * This also acts as a flag to the server that a fault has occurred. - * - * @param string $faultcode - * @param string $faultstring - * @param string $faultactor - * @param string $faultdetail - * @access public - */ - function fault($faultcode,$faultstring,$faultactor='',$faultdetail=''){ - if ($faultdetail == '' && $this->debug_flag) { - $faultdetail = $this->getDebug(); - } - $this->fault = new nusoap_fault($faultcode,$faultactor,$faultstring,$faultdetail); - $this->fault->soap_defencoding = $this->soap_defencoding; - } - - /** - * Sets up wsdl object. - * Acts as a flag to enable internal WSDL generation - * - * @param string $serviceName, name of the service - * @param mixed $namespace optional 'tns' service namespace or false - * @param mixed $endpoint optional URL of service endpoint or false - * @param string $style optional (rpc|document) WSDL style (also specified by operation) - * @param string $transport optional SOAP transport - * @param mixed $schemaTargetNamespace optional 'types' targetNamespace for service schema or false - */ - function configureWSDL($serviceName,$namespace = false,$endpoint = false,$style='rpc', $transport = 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false) - { - global $HTTP_SERVER_VARS; - - if (isset($_SERVER)) { - $SERVER_NAME = $_SERVER['SERVER_NAME']; - $SERVER_PORT = $_SERVER['SERVER_PORT']; - $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; - $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'); - } elseif (isset($HTTP_SERVER_VARS)) { - $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME']; - $SERVER_PORT = $HTTP_SERVER_VARS['SERVER_PORT']; - $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']; - $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'; - } else { - $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); - } - // If server name has port number attached then strip it (else port number gets duplicated in WSDL output) (occurred using lighttpd and FastCGI) - $colon = strpos($SERVER_NAME,":"); - if ($colon) { - $SERVER_NAME = substr($SERVER_NAME, 0, $colon); - } - if ($SERVER_PORT == 80) { - $SERVER_PORT = ''; - } else { - $SERVER_PORT = ':' . $SERVER_PORT; - } - if(false == $namespace) { - $namespace = "http://$SERVER_NAME/soap/$serviceName"; - } - - if(false == $endpoint) { - if ($HTTPS == '1' || $HTTPS == 'on') { - $SCHEME = 'https'; - } else { - $SCHEME = 'http'; - } - $endpoint = "$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME"; - } - - if(false == $schemaTargetNamespace) { - $schemaTargetNamespace = $namespace; - } - - $this->wsdl = new wsdl; - $this->wsdl->serviceName = $serviceName; - $this->wsdl->endpoint = $endpoint; - $this->wsdl->namespaces['tns'] = $namespace; - $this->wsdl->namespaces['soap'] = 'http://schemas.xmlsoap.org/wsdl/soap/'; - $this->wsdl->namespaces['wsdl'] = 'http://schemas.xmlsoap.org/wsdl/'; - if ($schemaTargetNamespace != $namespace) { - $this->wsdl->namespaces['types'] = $schemaTargetNamespace; - } - $this->wsdl->schemas[$schemaTargetNamespace][0] = new nusoap_xmlschema('', '', $this->wsdl->namespaces); - if ($style == 'document') { - $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaInfo['elementFormDefault'] = 'qualified'; - } - $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaTargetNamespace = $schemaTargetNamespace; - $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/soap/encoding/'][0] = array('location' => '', 'loaded' => true); - $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/wsdl/'][0] = array('location' => '', 'loaded' => true); - $this->wsdl->bindings[$serviceName.'Binding'] = array( - 'name'=>$serviceName.'Binding', - 'style'=>$style, - 'transport'=>$transport, - 'portType'=>$serviceName.'PortType'); - $this->wsdl->ports[$serviceName.'Port'] = array( - 'binding'=>$serviceName.'Binding', - 'location'=>$endpoint, - 'bindingType'=>'http://schemas.xmlsoap.org/wsdl/soap/'); - } -} - -/** - * Backward compatibility - */ -class soap_server extends nusoap_server { -} - -?> -* @author Scott Nichol -* @version $Id: nusoap.php 7091 2011-06-16 11:34:02Z mMarinetti $ -* @access public -*/ -class wsdl extends nusoap_base { - // URL or filename of the root of this WSDL - var $wsdl; - // define internal arrays of bindings, ports, operations, messages, etc. - var $schemas = array(); - var $currentSchema; - var $message = array(); - var $complexTypes = array(); - var $messages = array(); - var $currentMessage; - var $currentOperation; - var $portTypes = array(); - var $currentPortType; - var $bindings = array(); - var $currentBinding; - var $ports = array(); - var $currentPort; - var $opData = array(); - var $status = ''; - var $documentation = false; - var $endpoint = ''; - // array of wsdl docs to import - var $import = array(); - // parser vars - var $parser; - var $position = 0; - var $depth = 0; - var $depth_array = array(); - // for getting wsdl - var $proxyhost = ''; - var $proxyport = ''; - var $proxyusername = ''; - var $proxypassword = ''; - var $timeout = 0; - var $response_timeout = 30; - var $curl_options = array(); // User-specified cURL options - var $use_curl = false; // whether to always try to use cURL - // for HTTP authentication - var $username = ''; // Username for HTTP authentication - var $password = ''; // Password for HTTP authentication - var $authtype = ''; // Type of HTTP authentication - var $certRequest = array(); // Certificate for HTTP SSL authentication - - /** - * constructor - * - * @param string $wsdl WSDL document URL - * @param string $proxyhost - * @param string $proxyport - * @param string $proxyusername - * @param string $proxypassword - * @param integer $timeout set the connection timeout - * @param integer $response_timeout set the response timeout - * @param array $curl_options user-specified cURL options - * @param boolean $use_curl try to use cURL - * @access public - */ - function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){ - parent::nusoap_base(); - $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); - $this->proxyhost = $proxyhost; - $this->proxyport = $proxyport; - $this->proxyusername = $proxyusername; - $this->proxypassword = $proxypassword; - $this->timeout = $timeout; - $this->response_timeout = $response_timeout; - if (is_array($curl_options)) - $this->curl_options = $curl_options; - $this->use_curl = $use_curl; - $this->fetchWSDL($wsdl); - } - - /** - * fetches the WSDL document and parses it - * - * @access public - */ - function fetchWSDL($wsdl) { - $this->debug("parse and process WSDL path=$wsdl"); - $this->wsdl = $wsdl; - // parse wsdl file - if ($this->wsdl != "") { - $this->parseWSDL($this->wsdl); - } - // imports - // TODO: handle imports more properly, grabbing them in-line and nesting them - $imported_urls = array(); - $imported = 1; - while ($imported > 0) { - $imported = 0; - // Schema imports - foreach ($this->schemas as $ns => $list) { - foreach ($list as $xs) { - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! - foreach ($xs->imports as $ns2 => $list2) { - for ($ii = 0; $ii < count($list2); $ii++) { - if (! $list2[$ii]['loaded']) { - $this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true; - $url = $list2[$ii]['location']; - if ($url != '') { - $urlparts = parse_url($url); - if (!isset($urlparts['host'])) { - $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' .$wsdlparts['port'] : '') . - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; - } - if (! in_array($url, $imported_urls)) { - $this->parseWSDL($url); - $imported++; - $imported_urls[] = $url; - } - } else { - $this->debug("Unexpected scenario: empty URL for unloaded import"); - } - } - } - } - } - } - // WSDL imports - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! - foreach ($this->import as $ns => $list) { - for ($ii = 0; $ii < count($list); $ii++) { - if (! $list[$ii]['loaded']) { - $this->import[$ns][$ii]['loaded'] = true; - $url = $list[$ii]['location']; - if ($url != '') { - $urlparts = parse_url($url); - if (!isset($urlparts['host'])) { - $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') . - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; - } - if (! in_array($url, $imported_urls)) { - $this->parseWSDL($url); - $imported++; - $imported_urls[] = $url; - } - } else { - $this->debug("Unexpected scenario: empty URL for unloaded import"); - } - } - } - } - } - // add new data to operation data - foreach($this->bindings as $binding => $bindingData) { - if (isset($bindingData['operations']) && is_array($bindingData['operations'])) { - foreach($bindingData['operations'] as $operation => $data) { - $this->debug('post-parse data gathering for ' . $operation); - $this->bindings[$binding]['operations'][$operation]['input'] = - isset($this->bindings[$binding]['operations'][$operation]['input']) ? - array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) : - $this->portTypes[ $bindingData['portType'] ][$operation]['input']; - $this->bindings[$binding]['operations'][$operation]['output'] = - isset($this->bindings[$binding]['operations'][$operation]['output']) ? - array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) : - $this->portTypes[ $bindingData['portType'] ][$operation]['output']; - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){ - $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ]; - } - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){ - $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ]; - } - // Set operation style if necessary, but do not override one already provided - if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['style'])) { - $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style']; - } - $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : ''; - $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : ''; - $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : ''; - } - } - } - } - - /** - * parses the wsdl document - * - * @param string $wsdl path or URL - * @access private - */ - function parseWSDL($wsdl = '') { - $this->debug("parse WSDL at path=$wsdl"); - - if ($wsdl == '') { - $this->debug('no wsdl passed to parseWSDL()!!'); - $this->setError('no wsdl passed to parseWSDL()!!'); - return false; - } - - // parse $wsdl for url format - $wsdl_props = parse_url($wsdl); - - if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) { - $this->debug('getting WSDL http(s) URL ' . $wsdl); - // get wsdl - $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl); - $tr->request_method = 'GET'; - $tr->useSOAPAction = false; - if($this->proxyhost && $this->proxyport){ - $tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword); - } - if ($this->authtype != '') { - $tr->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest); - } - $tr->setEncoding('gzip, deflate'); - $wsdl_string = $tr->send('', $this->timeout, $this->response_timeout); - //$this->debug("WSDL request\n" . $tr->outgoing_payload); - //$this->debug("WSDL response\n" . $tr->incoming_payload); - $this->appendDebug($tr->getDebug()); - // catch errors - if($err = $tr->getError() ){ - $errstr = 'Getting ' . $wsdl . ' - HTTP ERROR: '.$err; - $this->debug($errstr); - $this->setError($errstr); - unset($tr); - return false; - } - unset($tr); - $this->debug("got WSDL URL"); - } else { - // $wsdl is not http(s), so treat it as a file URL or plain file path - if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) { - $path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path']; - } else { - $path = $wsdl; - } - $this->debug('getting WSDL file ' . $path); - if ($fp = @fopen($path, 'r')) { - $wsdl_string = ''; - while ($data = fread($fp, 32768)) { - $wsdl_string .= $data; - } - fclose($fp); - } else { - $errstr = "Bad path to WSDL file $path"; - $this->debug($errstr); - $this->setError($errstr); - return false; - } - } - $this->debug('Parse WSDL'); - // end new code added - // Create an XML parser. - $this->parser = xml_parser_create(); - // Set the options for parsing the XML data. - // xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); - xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); - // Set the object for the parser. - xml_set_object($this->parser, $this); - // Set the element handlers for the parser. - xml_set_element_handler($this->parser, 'start_element', 'end_element'); - xml_set_character_data_handler($this->parser, 'character_data'); - // Parse the XML file. - if (!xml_parse($this->parser, $wsdl_string, true)) { - // Display an error message. - $errstr = sprintf( - 'XML error parsing WSDL from %s on line %d: %s', - $wsdl, - xml_get_current_line_number($this->parser), - xml_error_string(xml_get_error_code($this->parser)) - ); - $this->debug($errstr); - $this->debug("XML payload:\n" . $wsdl_string); - $this->setError($errstr); - return false; - } - // free the parser - xml_parser_free($this->parser); - $this->debug('Parsing WSDL done'); - // catch wsdl parse errors - if($this->getError()){ - return false; - } - return true; - } - - /** - * start-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @param string $attrs associative array of attributes - * @access private - */ - function start_element($parser, $name, $attrs) - { - if ($this->status == 'schema') { - $this->currentSchema->schemaStartElement($parser, $name, $attrs); - $this->appendDebug($this->currentSchema->getDebug()); - $this->currentSchema->clearDebug(); - } elseif (preg_match('/schema$/', $name)) { - $this->debug('Parsing WSDL schema'); - // $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")"); - $this->status = 'schema'; - $this->currentSchema = new nusoap_xmlschema('', '', $this->namespaces); - $this->currentSchema->schemaStartElement($parser, $name, $attrs); - $this->appendDebug($this->currentSchema->getDebug()); - $this->currentSchema->clearDebug(); - } else { - // position in the total number of elements, starting from 0 - $pos = $this->position++; - $depth = $this->depth++; - // set self as current value for this depth - $this->depth_array[$depth] = $pos; - $this->message[$pos] = array('cdata' => ''); - // process attributes - if (count($attrs) > 0) { - // register namespace declarations - foreach($attrs as $k => $v) { - if (preg_match('/^xmlns/',$k)) { - if ($ns_prefix = substr(strrchr($k, ':'), 1)) { - $this->namespaces[$ns_prefix] = $v; - } else { - $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v; - } - if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') { - $this->XMLSchemaVersion = $v; - $this->namespaces['xsi'] = $v . '-instance'; - } - } - } - // expand each attribute prefix to its namespace - foreach($attrs as $k => $v) { - $k = strpos($k, ':') ? $this->expandQname($k) : $k; - if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') { - $v = strpos($v, ':') ? $this->expandQname($v) : $v; - } - $eAttrs[$k] = $v; - } - $attrs = $eAttrs; - } else { - $attrs = array(); - } - // get element prefix, namespace and name - if (preg_match('/:/', $name)) { - // get ns prefix - $prefix = substr($name, 0, strpos($name, ':')); - // get ns - $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : ''; - // get unqualified name - $name = substr(strstr($name, ':'), 1); - } - // process attributes, expanding any prefixes to namespaces - // find status, register data - switch ($this->status) { - case 'message': - if ($name == 'part') { - if (isset($attrs['type'])) { - $this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs)); - $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type']; - } - if (isset($attrs['element'])) { - $this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs)); - $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^'; - } - } - break; - case 'portType': - switch ($name) { - case 'operation': - $this->currentPortOperation = $attrs['name']; - $this->debug("portType $this->currentPortType operation: $this->currentPortOperation"); - if (isset($attrs['parameterOrder'])) { - $this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrder']; - } - break; - case 'documentation': - $this->documentation = true; - break; - // merge input/output data - default: - $m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : ''; - $this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m; - break; - } - break; - case 'binding': - switch ($name) { - case 'binding': - // get ns prefix - if (isset($attrs['style'])) { - $this->bindings[$this->currentBinding]['prefix'] = $prefix; - } - $this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs); - break; - case 'header': - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus]['headers'][] = $attrs; - break; - case 'operation': - if (isset($attrs['soapAction'])) { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $attrs['soapAction']; - } - if (isset($attrs['style'])) { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['style']; - } - if (isset($attrs['name'])) { - $this->currentOperation = $attrs['name']; - $this->debug("current binding operation: $this->currentOperation"); - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['name']; - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->currentBinding; - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this->bindings[$this->currentBinding]['endpoint']) ? $this->bindings[$this->currentBinding]['endpoint'] : ''; - } - break; - case 'input': - $this->opStatus = 'input'; - break; - case 'output': - $this->opStatus = 'output'; - break; - case 'body': - if (isset($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus])) { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_merge($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus], $attrs); - } else { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $attrs; - } - break; - } - break; - case 'service': - switch ($name) { - case 'port': - $this->currentPort = $attrs['name']; - $this->debug('current port: ' . $this->currentPort); - $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']); - - break; - case 'address': - $this->ports[$this->currentPort]['location'] = $attrs['location']; - $this->ports[$this->currentPort]['bindingType'] = $namespace; - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace; - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location']; - break; - } - break; - } - // set status - switch ($name) { - case 'import': - if (isset($attrs['location'])) { - $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false); - $this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]).')'); - } else { - $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true); - if (! $this->getPrefixFromNamespace($attrs['namespace'])) { - $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; - } - $this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$attrs['namespace']]).')'); - } - break; - //wait for schema - //case 'types': - // $this->status = 'schema'; - // break; - case 'message': - $this->status = 'message'; - $this->messages[$attrs['name']] = array(); - $this->currentMessage = $attrs['name']; - break; - case 'portType': - $this->status = 'portType'; - $this->portTypes[$attrs['name']] = array(); - $this->currentPortType = $attrs['name']; - break; - case "binding": - if (isset($attrs['name'])) { - // get binding name - if (strpos($attrs['name'], ':')) { - $this->currentBinding = $this->getLocalPart($attrs['name']); - } else { - $this->currentBinding = $attrs['name']; - } - $this->status = 'binding'; - $this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']); - $this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']); - } - break; - case 'service': - $this->serviceName = $attrs['name']; - $this->status = 'service'; - $this->debug('current service: ' . $this->serviceName); - break; - case 'definitions': - foreach ($attrs as $name => $value) { - $this->wsdl_info[$name] = $value; - } - break; - } - } - } - - /** - * end-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @access private - */ - function end_element($parser, $name){ - // unset schema status - if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) { - $this->status = ""; - $this->appendDebug($this->currentSchema->getDebug()); - $this->currentSchema->clearDebug(); - $this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema; - $this->debug('Parsing WSDL schema done'); - } - if ($this->status == 'schema') { - $this->currentSchema->schemaEndElement($parser, $name); - } else { - // bring depth down a notch - $this->depth--; - } - // end documentation - if ($this->documentation) { - //TODO: track the node to which documentation should be assigned; it can be a part, message, etc. - //$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->documentation; - $this->documentation = false; - } - } - - /** - * element content handler - * - * @param string $parser XML parser object - * @param string $data element content - * @access private - */ - function character_data($parser, $data) - { - $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0; - if (isset($this->message[$pos]['cdata'])) { - $this->message[$pos]['cdata'] .= $data; - } - if ($this->documentation) { - $this->documentation .= $data; - } - } - - /** - * if authenticating, set user credentials here - * - * @param string $username - * @param string $password - * @param string $authtype (basic|digest|certificate|ntlm) - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) - * @access public - */ - function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) { - $this->debug("setCredentials username=$username authtype=$authtype certRequest="); - $this->appendDebug($this->varDump($certRequest)); - $this->username = $username; - $this->password = $password; - $this->authtype = $authtype; - $this->certRequest = $certRequest; - } - - function getBindingData($binding) - { - if (is_array($this->bindings[$binding])) { - return $this->bindings[$binding]; - } - } - - /** - * returns an assoc array of operation names => operation data - * - * @param string $portName WSDL port name - * @param string $bindingType eg: soap, smtp, dime (only soap and soap12 are currently supported) - * @return array - * @access public - */ - function getOperations($portName = '', $bindingType = 'soap') { - $ops = array(); - if ($bindingType == 'soap') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; - } elseif ($bindingType == 'soap12') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; - } else { - $this->debug("getOperations bindingType $bindingType may not be supported"); - } - $this->debug("getOperations for port '$portName' bindingType $bindingType"); - // loop thru ports - foreach($this->ports as $port => $portData) { - $this->debug("getOperations checking port $port bindingType " . $portData['bindingType']); - if ($portName == '' || $port == $portName) { - // binding type of port matches parameter - if ($portData['bindingType'] == $bindingType) { - $this->debug("getOperations found port $port bindingType $bindingType"); - //$this->debug("port data: " . $this->varDump($portData)); - //$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ])); - // merge bindings - if (isset($this->bindings[ $portData['binding'] ]['operations'])) { - $ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']); - } - } - } - } - if (count($ops) == 0) { - $this->debug("getOperations found no operations for port '$portName' bindingType $bindingType"); - } - return $ops; - } - - /** - * returns an associative array of data necessary for calling an operation - * - * @param string $operation name of operation - * @param string $bindingType type of binding eg: soap, soap12 - * @return array - * @access public - */ - function getOperationData($operation, $bindingType = 'soap') - { - if ($bindingType == 'soap') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; - } elseif ($bindingType == 'soap12') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; - } - // loop thru ports - foreach($this->ports as $port => $portData) { - // binding type of port matches parameter - if ($portData['bindingType'] == $bindingType) { - // get binding - //foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { - foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) { - // note that we could/should also check the namespace here - if ($operation == $bOperation) { - $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation]; - return $opData; - } - } - } - } - } - - /** - * returns an associative array of data necessary for calling an operation - * - * @param string $soapAction soapAction for operation - * @param string $bindingType type of binding eg: soap, soap12 - * @return array - * @access public - */ - function getOperationDataForSoapAction($soapAction, $bindingType = 'soap') { - if ($bindingType == 'soap') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; - } elseif ($bindingType == 'soap12') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; - } - // loop thru ports - foreach($this->ports as $port => $portData) { - // binding type of port matches parameter - if ($portData['bindingType'] == $bindingType) { - // loop through operations for the binding - foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { - if ($opData['soapAction'] == $soapAction) { - return $opData; - } - } - } - } - } - - /** - * returns an array of information about a given type - * returns false if no type exists by the given name - * - * typeDef = array( - * 'elements' => array(), // refs to elements array - * 'restrictionBase' => '', - * 'phpType' => '', - * 'order' => '(sequence|all)', - * 'attrs' => array() // refs to attributes array - * ) - * - * @param string $type the type - * @param string $ns namespace (not prefix) of the type - * @return mixed - * @access public - * @see nusoap_xmlschema - */ - function getTypeDef($type, $ns) { - $this->debug("in getTypeDef: type=$type, ns=$ns"); - if ((! $ns) && isset($this->namespaces['tns'])) { - $ns = $this->namespaces['tns']; - $this->debug("in getTypeDef: type namespace forced to $ns"); - } - if (!isset($this->schemas[$ns])) { - foreach ($this->schemas as $ns0 => $schema0) { - if (strcasecmp($ns, $ns0) == 0) { - $this->debug("in getTypeDef: replacing schema namespace $ns with $ns0"); - $ns = $ns0; - break; - } - } - } - if (isset($this->schemas[$ns])) { - $this->debug("in getTypeDef: have schema for namespace $ns"); - for ($i = 0; $i < count($this->schemas[$ns]); $i++) { - $xs = &$this->schemas[$ns][$i]; - $t = $xs->getTypeDef($type); - $this->appendDebug($xs->getDebug()); - $xs->clearDebug(); - if ($t) { - $this->debug("in getTypeDef: found type $type"); - if (!isset($t['phpType'])) { - // get info for type to tack onto the element - $uqType = substr($t['type'], strrpos($t['type'], ':') + 1); - $ns = substr($t['type'], 0, strrpos($t['type'], ':')); - $etype = $this->getTypeDef($uqType, $ns); - if ($etype) { - $this->debug("found type for [element] $type:"); - $this->debug($this->varDump($etype)); - if (isset($etype['phpType'])) { - $t['phpType'] = $etype['phpType']; - } - if (isset($etype['elements'])) { - $t['elements'] = $etype['elements']; - } - if (isset($etype['attrs'])) { - $t['attrs'] = $etype['attrs']; - } - } else { - $this->debug("did not find type for [element] $type"); - } - } - return $t; - } - } - $this->debug("in getTypeDef: did not find type $type"); - } else { - $this->debug("in getTypeDef: do not have schema for namespace $ns"); - } - return false; - } - - /** - * prints html description of services - * - * @access private - */ - function webDescription(){ - global $HTTP_SERVER_VARS; - - if (isset($_SERVER)) { - $PHP_SELF = $_SERVER['PHP_SELF']; - } elseif (isset($HTTP_SERVER_VARS)) { - $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; - } else { - $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); - } - - $b = ' - NuSOAP: '.$this->serviceName.' - - - - -
    -

    -
    '.$this->serviceName.'
    - -
    '; - return $b; - } - - /** - * serialize the parsed wsdl - * - * @param mixed $debug whether to put debug=1 in endpoint URL - * @return string serialization of WSDL - * @access public - */ - function serialize($debug = 0) - { - $xml = ''; - $xml .= "\nnamespaces as $k => $v) { - $xml .= " xmlns:$k=\"$v\""; - } - // 10.9.02 - add poulter fix for wsdl and tns declarations - if (isset($this->namespaces['wsdl'])) { - $xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\""; - } - if (isset($this->namespaces['tns'])) { - $xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\""; - } - $xml .= '>'; - // imports - if (sizeof($this->import) > 0) { - foreach($this->import as $ns => $list) { - foreach ($list as $ii) { - if ($ii['location'] != '') { - $xml .= ''; - } else { - $xml .= ''; - } - } - } - } - // types - if (count($this->schemas)>=1) { - $xml .= "\n\n"; - foreach ($this->schemas as $ns => $list) { - foreach ($list as $xs) { - $xml .= $xs->serializeSchema(); - } - } - $xml .= ''; - } - // messages - if (count($this->messages) >= 1) { - foreach($this->messages as $msgName => $msgParts) { - $xml .= "\n'; - if(is_array($msgParts)){ - foreach($msgParts as $partName => $partType) { - // print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'
    '; - if (strpos($partType, ':')) { - $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType)); - } elseif (isset($this->typemap[$this->namespaces['xsd']][$partType])) { - // print 'checking typemap: '.$this->XMLSchemaVersion.'
    '; - $typePrefix = 'xsd'; - } else { - foreach($this->typemap as $ns => $types) { - if (isset($types[$partType])) { - $typePrefix = $this->getPrefixFromNamespace($ns); - } - } - if (!isset($typePrefix)) { - die("$partType has no namespace!"); - } - } - $ns = $this->getNamespaceFromPrefix($typePrefix); - $localPart = $this->getLocalPart($partType); - $typeDef = $this->getTypeDef($localPart, $ns); - if ($typeDef['typeClass'] == 'element') { - $elementortype = 'element'; - if (substr($localPart, -1) == '^') { - $localPart = substr($localPart, 0, -1); - } - } else { - $elementortype = 'type'; - } - $xml .= "\n" . ' '; - } - } - $xml .= '
    '; - } - } - // bindings & porttypes - if (count($this->bindings) >= 1) { - $binding_xml = ''; - $portType_xml = ''; - foreach($this->bindings as $bindingName => $attrs) { - $binding_xml .= "\n'; - $binding_xml .= "\n" . ' '; - $portType_xml .= "\n'; - foreach($attrs['operations'] as $opName => $opParts) { - $binding_xml .= "\n" . ' '; - $binding_xml .= "\n" . ' '; - if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') { - $enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"'; - } else { - $enc_style = ''; - } - $binding_xml .= "\n" . ' '; - if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') { - $enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"'; - } else { - $enc_style = ''; - } - $binding_xml .= "\n" . ' '; - $binding_xml .= "\n" . ' '; - $portType_xml .= "\n" . ' ' . htmlspecialchars($opParts['documentation']) . ''; - } - $portType_xml .= "\n" . ' '; - $portType_xml .= "\n" . ' '; - $portType_xml .= "\n" . ' '; - } - $portType_xml .= "\n" . ''; - $binding_xml .= "\n" . ''; - } - $xml .= $portType_xml . $binding_xml; - } - // services - $xml .= "\nserviceName . '">'; - if (count($this->ports) >= 1) { - foreach($this->ports as $pName => $attrs) { - $xml .= "\n" . ' '; - $xml .= "\n" . ' '; - $xml .= "\n" . ' '; - } - } - $xml .= "\n" . ''; - return $xml . "\n"; - } - - /** - * determine whether a set of parameters are unwrapped - * when they are expect to be wrapped, Microsoft-style. - * - * @param string $type the type (element name) of the wrapper - * @param array $parameters the parameter values for the SOAP call - * @return boolean whether they parameters are unwrapped (and should be wrapped) - * @access private - */ - function parametersMatchWrapped($type, &$parameters) { - $this->debug("in parametersMatchWrapped type=$type, parameters="); - $this->appendDebug($this->varDump($parameters)); - - // split type into namespace:unqualified-type - if (strpos($type, ':')) { - $uqType = substr($type, strrpos($type, ':') + 1); - $ns = substr($type, 0, strrpos($type, ':')); - $this->debug("in parametersMatchWrapped: got a prefixed type: $uqType, $ns"); - if ($this->getNamespaceFromPrefix($ns)) { - $ns = $this->getNamespaceFromPrefix($ns); - $this->debug("in parametersMatchWrapped: expanded prefixed type: $uqType, $ns"); - } - } else { - // TODO: should the type be compared to types in XSD, and the namespace - // set to XSD if the type matches? - $this->debug("in parametersMatchWrapped: No namespace for type $type"); - $ns = ''; - $uqType = $type; - } - - // get the type information - if (!$typeDef = $this->getTypeDef($uqType, $ns)) { - $this->debug("in parametersMatchWrapped: $type ($uqType) is not a supported type."); - return false; - } - $this->debug("in parametersMatchWrapped: found typeDef="); - $this->appendDebug($this->varDump($typeDef)); - if (substr($uqType, -1) == '^') { - $uqType = substr($uqType, 0, -1); - } - $phpType = $typeDef['phpType']; - $arrayType = (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : ''); - $this->debug("in parametersMatchWrapped: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: $arrayType"); - - // we expect a complexType or element of complexType - if ($phpType != 'struct') { - $this->debug("in parametersMatchWrapped: not a struct"); - return false; - } - - // see whether the parameter names match the elements - if (isset($typeDef['elements']) && is_array($typeDef['elements'])) { - $elements = 0; - $matches = 0; - foreach ($typeDef['elements'] as $name => $attrs) { - if (isset($parameters[$name])) { - $this->debug("in parametersMatchWrapped: have parameter named $name"); - $matches++; - } else { - $this->debug("in parametersMatchWrapped: do not have parameter named $name"); - } - $elements++; - } - - $this->debug("in parametersMatchWrapped: $matches parameter names match $elements wrapped parameter names"); - if ($matches == 0) { - return false; - } - return true; - } - - // since there are no elements for the type, if the user passed no - // parameters, the parameters match wrapped. - $this->debug("in parametersMatchWrapped: no elements type $ns:$uqType"); - return count($parameters) == 0; - } - - /** - * serialize PHP values according to a WSDL message definition - * contrary to the method name, this is not limited to RPC - * - * TODO - * - multi-ref serialization - * - validate PHP values against type definitions, return errors if invalid - * - * @param string $operation operation name - * @param string $direction (input|output) - * @param mixed $parameters parameter value(s) - * @param string $bindingType (soap|soap12) - * @return mixed parameters serialized as XML or false on error (e.g. operation not found) - * @access public - */ - function serializeRPCParameters($operation, $direction, $parameters, $bindingType = 'soap') { - $this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion, bindingType=$bindingType"); - $this->appendDebug('parameters=' . $this->varDump($parameters)); - - if ($direction != 'input' && $direction != 'output') { - $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); - $this->setError('The value of the \$direction argument needs to be either "input" or "output"'); - return false; - } - if (!$opData = $this->getOperationData($operation, $bindingType)) { - $this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); - $this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); - return false; - } - $this->debug('in serializeRPCParameters: opData:'); - $this->appendDebug($this->varDump($opData)); - - // Get encoding style for output and set to current - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { - $encodingStyle = $opData['output']['encodingStyle']; - $enc_style = $encodingStyle; - } - - // set input params - $xml = ''; - if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) { - $parts = &$opData[$direction]['parts']; - $part_count = sizeof($parts); - $style = $opData['style']; - $use = $opData[$direction]['use']; - $this->debug("have $part_count part(s) to serialize using $style/$use"); - if (is_array($parameters)) { - $parametersArrayType = $this->isArraySimpleOrStruct($parameters); - $parameter_count = count($parameters); - $this->debug("have $parameter_count parameter(s) provided as $parametersArrayType to serialize"); - // check for Microsoft-style wrapped parameters - if ($style == 'document' && $use == 'literal' && $part_count == 1 && isset($parts['parameters'])) { - $this->debug('check whether the caller has wrapped the parameters'); - if ($direction == 'output' && $parametersArrayType == 'arraySimple' && $parameter_count == 1) { - // TODO: consider checking here for double-wrapping, when - // service function wraps, then NuSOAP wraps again - $this->debug("change simple array to associative with 'parameters' element"); - $parameters['parameters'] = $parameters[0]; - unset($parameters[0]); - } - if (($parametersArrayType == 'arrayStruct' || $parameter_count == 0) && !isset($parameters['parameters'])) { - $this->debug('check whether caller\'s parameters match the wrapped ones'); - if ($this->parametersMatchWrapped($parts['parameters'], $parameters)) { - $this->debug('wrap the parameters for the caller'); - $parameters = array('parameters' => $parameters); - $parameter_count = 1; - } - } - } - foreach ($parts as $name => $type) { - $this->debug("serializing part $name of type $type"); - // Track encoding style - if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { - $encodingStyle = $opData[$direction]['encodingStyle']; - $enc_style = $encodingStyle; - } else { - $enc_style = false; - } - // NOTE: add error handling here - // if serializeType returns false, then catch global error and fault - if ($parametersArrayType == 'arraySimple') { - $p = array_shift($parameters); - $this->debug('calling serializeType w/indexed param'); - $xml .= $this->serializeType($name, $type, $p, $use, $enc_style); - } elseif (isset($parameters[$name])) { - $this->debug('calling serializeType w/named param'); - $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style); - } else { - // TODO: only send nillable - $this->debug('calling serializeType w/null param'); - $xml .= $this->serializeType($name, $type, null, $use, $enc_style); - } - } - } else { - $this->debug('no parameters passed.'); - } - } - $this->debug("serializeRPCParameters returning: $xml"); - return $xml; - } - - /** - * serialize a PHP value according to a WSDL message definition - * - * TODO - * - multi-ref serialization - * - validate PHP values against type definitions, return errors if invalid - * - * @param string $operation operation name - * @param string $direction (input|output) - * @param mixed $parameters parameter value(s) - * @return mixed parameters serialized as XML or false on error (e.g. operation not found) - * @access public - * @deprecated - */ - function serializeParameters($operation, $direction, $parameters) - { - $this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion"); - $this->appendDebug('parameters=' . $this->varDump($parameters)); - - if ($direction != 'input' && $direction != 'output') { - $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); - $this->setError('The value of the \$direction argument needs to be either "input" or "output"'); - return false; - } - if (!$opData = $this->getOperationData($operation)) { - $this->debug('Unable to retrieve WSDL data for operation: ' . $operation); - $this->setError('Unable to retrieve WSDL data for operation: ' . $operation); - return false; - } - $this->debug('opData:'); - $this->appendDebug($this->varDump($opData)); - - // Get encoding style for output and set to current - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { - $encodingStyle = $opData['output']['encodingStyle']; - $enc_style = $encodingStyle; - } - - // set input params - $xml = ''; - if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) { - - $use = $opData[$direction]['use']; - $this->debug("use=$use"); - $this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)'); - if (is_array($parameters)) { - $parametersArrayType = $this->isArraySimpleOrStruct($parameters); - $this->debug('have ' . $parametersArrayType . ' parameters'); - foreach($opData[$direction]['parts'] as $name => $type) { - $this->debug('serializing part "'.$name.'" of type "'.$type.'"'); - // Track encoding style - if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { - $encodingStyle = $opData[$direction]['encodingStyle']; - $enc_style = $encodingStyle; - } else { - $enc_style = false; - } - // NOTE: add error handling here - // if serializeType returns false, then catch global error and fault - if ($parametersArrayType == 'arraySimple') { - $p = array_shift($parameters); - $this->debug('calling serializeType w/indexed param'); - $xml .= $this->serializeType($name, $type, $p, $use, $enc_style); - } elseif (isset($parameters[$name])) { - $this->debug('calling serializeType w/named param'); - $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style); - } else { - // TODO: only send nillable - $this->debug('calling serializeType w/null param'); - $xml .= $this->serializeType($name, $type, null, $use, $enc_style); - } - } - } else { - $this->debug('no parameters passed.'); - } - } - $this->debug("serializeParameters returning: $xml"); - return $xml; - } - - /** - * serializes a PHP value according a given type definition - * - * @param string $name name of value (part or element) - * @param string $type XML schema type of value (type or element) - * @param mixed $value a native PHP value (parameter value) - * @param string $use use for part (encoded|literal) - * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style) - * @param boolean $unqualified a kludge for what should be XML namespace form handling - * @return string value serialized as an XML string - * @access private - */ - function serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false) - { - $this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=" . ($unqualified ? "unqualified" : "qualified")); - $this->appendDebug("value=" . $this->varDump($value)); - if($use == 'encoded' && $encodingStyle) { - $encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"'; - } - - // if a soapval has been supplied, let its type override the WSDL - if (is_object($value) && get_class($value) == 'soapval') { - if ($value->type_ns) { - $type = $value->type_ns . ':' . $value->type; - $forceType = true; - $this->debug("in serializeType: soapval overrides type to $type"); - } elseif ($value->type) { - $type = $value->type; - $forceType = true; - $this->debug("in serializeType: soapval overrides type to $type"); - } else { - $forceType = false; - $this->debug("in serializeType: soapval does not override type"); - } - $attrs = $value->attributes; - $value = $value->value; - $this->debug("in serializeType: soapval overrides value to $value"); - if ($attrs) { - if (!is_array($value)) { - $value['!'] = $value; - } - foreach ($attrs as $n => $v) { - $value['!' . $n] = $v; - } - $this->debug("in serializeType: soapval provides attributes"); - } - } else { - $forceType = false; - } - - $xml = ''; - if (strpos($type, ':')) { - $uqType = substr($type, strrpos($type, ':') + 1); - $ns = substr($type, 0, strrpos($type, ':')); - $this->debug("in serializeType: got a prefixed type: $uqType, $ns"); - if ($this->getNamespaceFromPrefix($ns)) { - $ns = $this->getNamespaceFromPrefix($ns); - $this->debug("in serializeType: expanded prefixed type: $uqType, $ns"); - } - - if($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/'){ - $this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type'); - if ($unqualified && $use == 'literal') { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - if (is_null($value)) { - if ($use == 'literal') { - // TODO: depends on minOccurs - $xml = "<$name$elementNS/>"; - } else { - // TODO: depends on nillable, which should be checked before calling this method - $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - if ($uqType == 'Array') { - // JBoss/Axis does this sometimes - return $this->serialize_val($value, $name, false, false, false, false, $use); - } - if ($uqType == 'boolean') { - if ((is_string($value) && $value == 'false') || (! $value)) { - $value = 'false'; - } else { - $value = 'true'; - } - } - if ($uqType == 'string' && gettype($value) == 'string') { - $value = $this->expandEntities($value); - } - if (($uqType == 'long' || $uqType == 'unsignedLong') && gettype($value) == 'double') { - $value = sprintf("%.0lf", $value); - } - // it's a scalar - // TODO: what about null/nil values? - // check type isn't a custom type extending xmlschema namespace - if (!$this->getTypeDef($uqType, $ns)) { - if ($use == 'literal') { - if ($forceType) { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value"; - } else { - $xml = "<$name$elementNS>$value"; - } - } else { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - $this->debug('custom type extends XML Schema or SOAP Encoding namespace (yuck)'); - } else if ($ns == 'http://xml.apache.org/xml-soap') { - $this->debug('in serializeType: appears to be Apache SOAP type'); - if ($uqType == 'Map') { - $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); - if (! $tt_prefix) { - $this->debug('in serializeType: Add namespace for Apache SOAP type'); - $tt_prefix = 'ns' . rand(1000, 9999); - $this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap'; - // force this to be added to usedNamespaces - $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); - } - $contents = ''; - foreach($value as $k => $v) { - $this->debug("serializing map element: key $k, value $v"); - $contents .= ''; - $contents .= $this->serialize_val($k,'key',false,false,false,false,$use); - $contents .= $this->serialize_val($v,'value',false,false,false,false,$use); - $contents .= ''; - } - if ($use == 'literal') { - if ($forceType) { - $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\">$contents"; - } else { - $xml = "<$name>$contents"; - } - } else { - $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\"$encodingStyle>$contents"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - $this->debug('in serializeType: Apache SOAP type, but only support Map'); - } - } else { - // TODO: should the type be compared to types in XSD, and the namespace - // set to XSD if the type matches? - $this->debug("in serializeType: No namespace for type $type"); - $ns = ''; - $uqType = $type; - } - if(!$typeDef = $this->getTypeDef($uqType, $ns)){ - $this->setError("$type ($uqType) is not a supported type."); - $this->debug("in serializeType: $type ($uqType) is not a supported type."); - return false; - } else { - $this->debug("in serializeType: found typeDef"); - $this->appendDebug('typeDef=' . $this->varDump($typeDef)); - if (substr($uqType, -1) == '^') { - $uqType = substr($uqType, 0, -1); - } - } - if (!isset($typeDef['phpType'])) { - $this->setError("$type ($uqType) has no phpType."); - $this->debug("in serializeType: $type ($uqType) has no phpType."); - return false; - } - $phpType = $typeDef['phpType']; - $this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') ); - // if php type == struct, map value to the element names - if ($phpType == 'struct') { - if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') { - $elementName = $uqType; - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { - $elementNS = " xmlns=\"$ns\""; - } else { - $elementNS = " xmlns=\"\""; - } - } else { - $elementName = $name; - if ($unqualified) { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - } - if (is_null($value)) { - if ($use == 'literal') { - // TODO: depends on minOccurs and nillable - $xml = "<$elementName$elementNS/>"; - } else { - $xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - if (is_object($value)) { - $value = get_object_vars($value); - } - if (is_array($value)) { - $elementAttrs = $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType); - if ($use == 'literal') { - if ($forceType) { - $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">"; - } else { - $xml = "<$elementName$elementNS$elementAttrs>"; - } - } else { - $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>"; - } - - if (isset($typeDef['simpleContent']) && $typeDef['simpleContent'] == 'true') { - if (isset($value['!'])) { - $xml .= $value['!']; - $this->debug("in serializeType: serialized simpleContent for type $type"); - } else { - $this->debug("in serializeType: no simpleContent to serialize for type $type"); - } - } else { - // complexContent - $xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle); - } - $xml .= ""; - } else { - $this->debug("in serializeType: phpType is struct, but value is not an array"); - $this->setError("phpType is struct, but value is not an array: see debug output for details"); - $xml = ''; - } - } elseif ($phpType == 'array') { - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { - $elementNS = " xmlns=\"$ns\""; - } else { - if ($unqualified) { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - } - if (is_null($value)) { - if ($use == 'literal') { - // TODO: depends on minOccurs - $xml = "<$name$elementNS/>"; - } else { - $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . - ":Array\" " . - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . - ':arrayType="' . - $this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) . - ':' . - $this->getLocalPart($typeDef['arrayType'])."[0]\"/>"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - if (isset($typeDef['multidimensional'])) { - $nv = array(); - foreach($value as $v) { - $cols = ',' . sizeof($v); - $nv = array_merge($nv, $v); - } - $value = $nv; - } else { - $cols = ''; - } - if (is_array($value) && sizeof($value) >= 1) { - $rows = sizeof($value); - $contents = ''; - foreach($value as $k => $v) { - $this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]"); - //if (strpos($typeDef['arrayType'], ':') ) { - if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) { - $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use); - } else { - $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use); - } - } - } else { - $rows = 0; - $contents = null; - } - // TODO: for now, an empty value will be serialized as a zero element - // array. Revisit this when coding the handling of null/nil values. - if ($use == 'literal') { - $xml = "<$name$elementNS>" - .$contents - .""; - } else { - $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/').':Array" '. - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') - .':arrayType="' - .$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) - .":".$this->getLocalPart($typeDef['arrayType'])."[$rows$cols]\">" - .$contents - .""; - } - } elseif ($phpType == 'scalar') { - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { - $elementNS = " xmlns=\"$ns\""; - } else { - if ($unqualified) { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - } - if ($use == 'literal') { - if ($forceType) { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value"; - } else { - $xml = "<$name$elementNS>$value"; - } - } else { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value"; - } - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - - /** - * serializes the attributes for a complexType - * - * @param array $typeDef our internal representation of an XML schema type (or element) - * @param mixed $value a native PHP value (parameter value) - * @param string $ns the namespace of the type - * @param string $uqType the local part of the type - * @return string value serialized as an XML string - * @access private - */ - function serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType) { - $this->debug("serializeComplexTypeAttributes for XML Schema type $ns:$uqType"); - $xml = ''; - if (isset($typeDef['extensionBase'])) { - $nsx = $this->getPrefix($typeDef['extensionBase']); - $uqTypex = $this->getLocalPart($typeDef['extensionBase']); - if ($this->getNamespaceFromPrefix($nsx)) { - $nsx = $this->getNamespaceFromPrefix($nsx); - } - if ($typeDefx = $this->getTypeDef($uqTypex, $nsx)) { - $this->debug("serialize attributes for extension base $nsx:$uqTypex"); - $xml .= $this->serializeComplexTypeAttributes($typeDefx, $value, $nsx, $uqTypex); - } else { - $this->debug("extension base $nsx:$uqTypex is not a supported type"); - } - } - if (isset($typeDef['attrs']) && is_array($typeDef['attrs'])) { - $this->debug("serialize attributes for XML Schema type $ns:$uqType"); - if (is_array($value)) { - $xvalue = $value; - } elseif (is_object($value)) { - $xvalue = get_object_vars($value); - } else { - $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType"); - $xvalue = array(); - } - foreach ($typeDef['attrs'] as $aName => $attrs) { - if (isset($xvalue['!' . $aName])) { - $xname = '!' . $aName; - $this->debug("value provided for attribute $aName with key $xname"); - } elseif (isset($xvalue[$aName])) { - $xname = $aName; - $this->debug("value provided for attribute $aName with key $xname"); - } elseif (isset($attrs['default'])) { - $xname = '!' . $aName; - $xvalue[$xname] = $attrs['default']; - $this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName); - } else { - $xname = ''; - $this->debug("no value provided for attribute $aName"); - } - if ($xname) { - $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\""; - } - } - } else { - $this->debug("no attributes to serialize for XML Schema type $ns:$uqType"); - } - return $xml; - } - - /** - * serializes the elements for a complexType - * - * @param array $typeDef our internal representation of an XML schema type (or element) - * @param mixed $value a native PHP value (parameter value) - * @param string $ns the namespace of the type - * @param string $uqType the local part of the type - * @param string $use use for part (encoded|literal) - * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style) - * @return string value serialized as an XML string - * @access private - */ - function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false) { - $this->debug("in serializeComplexTypeElements for XML Schema type $ns:$uqType"); - $xml = ''; - if (isset($typeDef['extensionBase'])) { - $nsx = $this->getPrefix($typeDef['extensionBase']); - $uqTypex = $this->getLocalPart($typeDef['extensionBase']); - if ($this->getNamespaceFromPrefix($nsx)) { - $nsx = $this->getNamespaceFromPrefix($nsx); - } - if ($typeDefx = $this->getTypeDef($uqTypex, $nsx)) { - $this->debug("serialize elements for extension base $nsx:$uqTypex"); - $xml .= $this->serializeComplexTypeElements($typeDefx, $value, $nsx, $uqTypex, $use, $encodingStyle); - } else { - $this->debug("extension base $nsx:$uqTypex is not a supported type"); - } - } - if (isset($typeDef['elements']) && is_array($typeDef['elements'])) { - $this->debug("in serializeComplexTypeElements, serialize elements for XML Schema type $ns:$uqType"); - if (is_array($value)) { - $xvalue = $value; - } elseif (is_object($value)) { - $xvalue = get_object_vars($value); - } else { - $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType"); - $xvalue = array(); - } - // toggle whether all elements are present - ideally should validate against schema - if (count($typeDef['elements']) != count($xvalue)){ - $optionals = true; - } - foreach ($typeDef['elements'] as $eName => $attrs) { - if (!isset($xvalue[$eName])) { - if (isset($attrs['default'])) { - $xvalue[$eName] = $attrs['default']; - $this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName); - } - } - // if user took advantage of a minOccurs=0, then only serialize named parameters - if (isset($optionals) - && (!isset($xvalue[$eName])) - && ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true') - ){ - if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') { - $this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']); - } - // do nothing - $this->debug("no value provided for complexType element $eName and element is not nillable, so serialize nothing"); - } else { - // get value - if (isset($xvalue[$eName])) { - $v = $xvalue[$eName]; - } else { - $v = null; - } - if (isset($attrs['form'])) { - $unqualified = ($attrs['form'] == 'unqualified'); - } else { - $unqualified = false; - } - if (isset($attrs['maxOccurs']) && ($attrs['maxOccurs'] == 'unbounded' || $attrs['maxOccurs'] > 1) && isset($v) && is_array($v) && $this->isArraySimpleOrStruct($v) == 'arraySimple') { - $vv = $v; - foreach ($vv as $k => $v) { - if (isset($attrs['type']) || isset($attrs['ref'])) { - // serialize schema-defined type - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); - } else { - // serialize generic type (can this ever really happen?) - $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); - $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); - } - } - } else { - if (is_null($v) && isset($attrs['minOccurs']) && $attrs['minOccurs'] == '0') { - // do nothing - } elseif (is_null($v) && isset($attrs['nillable']) && $attrs['nillable'] == 'true') { - // TODO: serialize a nil correctly, but for now serialize schema-defined type - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); - } elseif (isset($attrs['type']) || isset($attrs['ref'])) { - // serialize schema-defined type - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); - } else { - // serialize generic type (can this ever really happen?) - $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); - $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); - } - } - } - } - } else { - $this->debug("no elements to serialize for XML Schema type $ns:$uqType"); - } - return $xml; - } - - /** - * adds an XML Schema complex type to the WSDL types - * - * @param string $name - * @param string $typeClass (complexType|simpleType|attribute) - * @param string $phpType currently supported are array and struct (php assoc array) - * @param string $compositor (all|sequence|choice) - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param array $elements e.g. array ( name => array(name=>'',type=>'') ) - * @param array $attrs e.g. array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]')) - * @param string $arrayType as namespace:name (xsd:string) - * @see nusoap_xmlschema - * @access public - */ - function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType='') { - if (count($elements) > 0) { - $eElements = array(); - foreach($elements as $n => $e){ - // expand each element - $ee = array(); - foreach ($e as $k => $v) { - $k = strpos($k,':') ? $this->expandQname($k) : $k; - $v = strpos($v,':') ? $this->expandQname($v) : $v; - $ee[$k] = $v; - } - $eElements[$n] = $ee; - } - $elements = $eElements; - } - - if (count($attrs) > 0) { - foreach($attrs as $n => $a){ - // expand each attribute - foreach ($a as $k => $v) { - $k = strpos($k,':') ? $this->expandQname($k) : $k; - $v = strpos($v,':') ? $this->expandQname($v) : $v; - $aa[$k] = $v; - } - $eAttrs[$n] = $aa; - } - $attrs = $eAttrs; - } - - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; - $arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType; - - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; - $this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType); - } - - /** - * adds an XML Schema simple type to the WSDL types - * - * @param string $name - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param string $typeClass (should always be simpleType) - * @param string $phpType (should always be scalar) - * @param array $enumeration array of values - * @see nusoap_xmlschema - * @access public - */ - function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) { - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; - - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; - $this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration); - } - - /** - * adds an element to the WSDL types - * - * @param array $attrs attributes that must include name and type - * @see nusoap_xmlschema - * @access public - */ - function addElement($attrs) { - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; - $this->schemas[$typens][0]->addElement($attrs); - } - - /** - * register an operation with the server - * - * @param string $name operation (method) name - * @param array $in assoc array of input values: key = param name, value = param type - * @param array $out assoc array of output values: key = param name, value = param type - * @param string $namespace optional The namespace for the operation - * @param string $soapaction optional The soapaction for the operation - * @param string $style (rpc|document) optional The style for the operation Note: when 'document' is specified, parameter and return wrappers are created for you automatically - * @param string $use (encoded|literal) optional The use for the parameters (cannot mix right now) - * @param string $documentation optional The description to include in the WSDL - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) - * @access public - */ - function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){ - if ($use == 'encoded' && $encodingStyle == '') { - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - } - - if ($style == 'document') { - $elements = array(); - foreach ($in as $n => $t) { - $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); - } - $this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements); - $this->addElement(array('name' => $name, 'type' => $name . 'RequestType')); - $in = array('parameters' => 'tns:' . $name . '^'); - - $elements = array(); - foreach ($out as $n => $t) { - $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); - } - $this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements); - $this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType', 'form' => 'qualified')); - $out = array('parameters' => 'tns:' . $name . 'Response' . '^'); - } - - // get binding - $this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] = - array( - 'name' => $name, - 'binding' => $this->serviceName . 'Binding', - 'endpoint' => $this->endpoint, - 'soapAction' => $soapaction, - 'style' => $style, - 'input' => array( - 'use' => $use, - 'namespace' => $namespace, - 'encodingStyle' => $encodingStyle, - 'message' => $name . 'Request', - 'parts' => $in), - 'output' => array( - 'use' => $use, - 'namespace' => $namespace, - 'encodingStyle' => $encodingStyle, - 'message' => $name . 'Response', - 'parts' => $out), - 'namespace' => $namespace, - 'transport' => 'http://schemas.xmlsoap.org/soap/http', - 'documentation' => $documentation); - // add portTypes - // add messages - if($in) - { - foreach($in as $pName => $pType) - { - if(strpos($pType,':')) { - $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); - } - $this->messages[$name.'Request'][$pName] = $pType; - } - } else { - $this->messages[$name.'Request']= '0'; - } - if($out) - { - foreach($out as $pName => $pType) - { - if(strpos($pType,':')) { - $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); - } - $this->messages[$name.'Response'][$pName] = $pType; - } - } else { - $this->messages[$name.'Response']= '0'; - } - return true; - } -} -?> -* @author Scott Nichol -* @version $Id: nusoap.php 7091 2011-06-16 11:34:02Z mMarinetti $ -* @access public -*/ -class nusoap_parser extends nusoap_base { - - var $xml = ''; - var $xml_encoding = ''; - var $method = ''; - var $root_struct = ''; - var $root_struct_name = ''; - var $root_struct_namespace = ''; - var $root_header = ''; - var $document = ''; // incoming SOAP body (text) - // determines where in the message we are (envelope,header,body,method) - var $status = ''; - var $position = 0; - var $depth = 0; - var $default_namespace = ''; - var $namespaces = array(); - var $message = array(); - var $parent = ''; - var $fault = false; - var $fault_code = ''; - var $fault_str = ''; - var $fault_detail = ''; - var $depth_array = array(); - var $debug_flag = true; - var $soapresponse = NULL; // parsed SOAP Body - var $soapheader = NULL; // parsed SOAP Header - var $responseHeaders = ''; // incoming SOAP headers (text) - var $body_position = 0; - // for multiref parsing: - // array of id => pos - var $ids = array(); - // array of id => hrefs => pos - var $multirefs = array(); - // toggle for auto-decoding element content - var $decode_utf8 = true; - - /** - * constructor that actually does the parsing - * - * @param string $xml SOAP message - * @param string $encoding character encoding scheme of message - * @param string $method method for which XML is parsed (unused?) - * @param string $decode_utf8 whether to decode UTF-8 to ISO-8859-1 - * @access public - */ - function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){ - parent::nusoap_base(); - $this->xml = $xml; - $this->xml_encoding = $encoding; - $this->method = $method; - $this->decode_utf8 = $decode_utf8; - - // Check whether content has been read. - if(!empty($xml)){ - // Check XML encoding - $pos_xml = strpos($xml, '', $pos_xml + 2) - $pos_xml + 1); - if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) { - $xml_encoding = $res[1]; - if (strtoupper($xml_encoding) != $encoding) { - $err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'"; - $this->debug($err); - if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') { - $this->setError($err); - return; - } - // when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endpoint is just sloppy and proceed - } else { - $this->debug('Charset from HTTP Content-Type matches encoding from XML declaration'); - } - } else { - $this->debug('No encoding specified in XML declaration'); - } - } else { - $this->debug('No XML declaration'); - } - $this->debug('Entering nusoap_parser(), length='.strlen($xml).', encoding='.$encoding); - // Create an XML parser - why not xml_parser_create_ns? - $this->parser = xml_parser_create($this->xml_encoding); - // Set the options for parsing the XML data. - //xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); - xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); - xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding); - // Set the object for the parser. - xml_set_object($this->parser, $this); - // Set the element handlers for the parser. - xml_set_element_handler($this->parser, 'start_element','end_element'); - xml_set_character_data_handler($this->parser,'character_data'); - - // Parse the XML file. - if(!xml_parse($this->parser,$xml,true)){ - // Display an error message. - $err = sprintf('XML error parsing SOAP payload on line %d: %s', - xml_get_current_line_number($this->parser), - xml_error_string(xml_get_error_code($this->parser))); - $this->debug($err); - $this->debug("XML payload:\n" . $xml); - $this->setError($err); - } else { - $this->debug('in nusoap_parser ctor, message:'); - $this->appendDebug($this->varDump($this->message)); - $this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root_struct_name); - // get final value - $this->soapresponse = $this->message[$this->root_struct]['result']; - // get header value - if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){ - $this->soapheader = $this->message[$this->root_header]['result']; - } - // resolve hrefs/ids - if(sizeof($this->multirefs) > 0){ - foreach($this->multirefs as $id => $hrefs){ - $this->debug('resolving multirefs for id: '.$id); - $idVal = $this->buildVal($this->ids[$id]); - if (is_array($idVal) && isset($idVal['!id'])) { - unset($idVal['!id']); - } - foreach($hrefs as $refPos => $ref){ - $this->debug('resolving href at pos '.$refPos); - $this->multirefs[$id][$refPos] = $idVal; - } - } - } - } - xml_parser_free($this->parser); - } else { - $this->debug('xml was empty, didn\'t parse!'); - $this->setError('xml was empty, didn\'t parse!'); - } - } - - /** - * start-element handler - * - * @param resource $parser XML parser object - * @param string $name element name - * @param array $attrs associative array of attributes - * @access private - */ - function start_element($parser, $name, $attrs) { - // position in a total number of elements, starting from 0 - // update class level pos - $pos = $this->position++; - // and set mine - $this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>''); - // depth = how many levels removed from root? - // set mine as current global depth and increment global depth value - $this->message[$pos]['depth'] = $this->depth++; - - // else add self as child to whoever the current parent is - if($pos != 0){ - $this->message[$this->parent]['children'] .= '|'.$pos; - } - // set my parent - $this->message[$pos]['parent'] = $this->parent; - // set self as current parent - $this->parent = $pos; - // set self as current value for this depth - $this->depth_array[$this->depth] = $pos; - // get element prefix - if(strpos($name,':')){ - // get ns prefix - $prefix = substr($name,0,strpos($name,':')); - // get unqualified name - $name = substr(strstr($name,':'),1); - } - // set status - if ($name == 'Envelope' && $this->status == '') { - $this->status = 'envelope'; - } elseif ($name == 'Header' && $this->status == 'envelope') { - $this->root_header = $pos; - $this->status = 'header'; - } elseif ($name == 'Body' && $this->status == 'envelope'){ - $this->status = 'body'; - $this->body_position = $pos; - // set method - } elseif($this->status == 'body' && $pos == ($this->body_position+1)) { - $this->status = 'method'; - $this->root_struct_name = $name; - $this->root_struct = $pos; - $this->message[$pos]['type'] = 'struct'; - $this->debug("found root struct $this->root_struct_name, pos $this->root_struct"); - } - // set my status - $this->message[$pos]['status'] = $this->status; - // set name - $this->message[$pos]['name'] = htmlspecialchars($name); - // set attrs - $this->message[$pos]['attrs'] = $attrs; - - // loop through atts, logging ns and type declarations - $attstr = ''; - foreach($attrs as $key => $value){ - $key_prefix = $this->getPrefix($key); - $key_localpart = $this->getLocalPart($key); - // if ns declarations, add to class level array of valid namespaces - if($key_prefix == 'xmlns'){ - if(preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/',$value)){ - $this->XMLSchemaVersion = $value; - $this->namespaces['xsd'] = $this->XMLSchemaVersion; - $this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance'; - } - $this->namespaces[$key_localpart] = $value; - // set method namespace - if($name == $this->root_struct_name){ - $this->methodNamespace = $value; - } - // if it's a type declaration, set type - } elseif($key_localpart == 'type'){ - if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') { - // do nothing: already processed arrayType - } else { - $value_prefix = $this->getPrefix($value); - $value_localpart = $this->getLocalPart($value); - $this->message[$pos]['type'] = $value_localpart; - $this->message[$pos]['typePrefix'] = $value_prefix; - if(isset($this->namespaces[$value_prefix])){ - $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix]; - } else if(isset($attrs['xmlns:'.$value_prefix])) { - $this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix]; - } - // should do something here with the namespace of specified type? - } - } elseif($key_localpart == 'arrayType'){ - $this->message[$pos]['type'] = 'array'; - /* do arrayType ereg here - [1] arrayTypeValue ::= atype asize - [2] atype ::= QName rank* - [3] rank ::= '[' (',')* ']' - [4] asize ::= '[' length~ ']' - [5] length ::= nextDimension* Digit+ - [6] nextDimension ::= Digit+ ',' - */ - $expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/'; - if(preg_match($expr,$value,$regs)){ - $this->message[$pos]['typePrefix'] = $regs[1]; - $this->message[$pos]['arrayTypePrefix'] = $regs[1]; - if (isset($this->namespaces[$regs[1]])) { - $this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]]; - } else if (isset($attrs['xmlns:'.$regs[1]])) { - $this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]]; - } - $this->message[$pos]['arrayType'] = $regs[2]; - $this->message[$pos]['arraySize'] = $regs[3]; - $this->message[$pos]['arrayCols'] = $regs[4]; - } - // specifies nil value (or not) - } elseif ($key_localpart == 'nil'){ - $this->message[$pos]['nil'] = ($value == 'true' || $value == '1'); - // some other attribute - } elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') { - $this->message[$pos]['xattrs']['!' . $key] = $value; - } - - if ($key == 'xmlns') { - $this->default_namespace = $value; - } - // log id - if($key == 'id'){ - $this->ids[$value] = $pos; - } - // root - if($key_localpart == 'root' && $value == 1){ - $this->status = 'method'; - $this->root_struct_name = $name; - $this->root_struct = $pos; - $this->debug("found root struct $this->root_struct_name, pos $pos"); - } - // for doclit - $attstr .= " $key=\"$value\""; - } - // get namespace - must be done after namespace atts are processed - if(isset($prefix)){ - $this->message[$pos]['namespace'] = $this->namespaces[$prefix]; - $this->default_namespace = $this->namespaces[$prefix]; - } else { - $this->message[$pos]['namespace'] = $this->default_namespace; - } - if($this->status == 'header'){ - if ($this->root_header != $pos) { - $this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>"; - } - } elseif($this->root_struct_name != ''){ - $this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>"; - } - } - - /** - * end-element handler - * - * @param resource $parser XML parser object - * @param string $name element name - * @access private - */ - function end_element($parser, $name) { - // position of current element is equal to the last value left in depth_array for my depth - $pos = $this->depth_array[$this->depth--]; - - // get element prefix - if(strpos($name,':')){ - // get ns prefix - $prefix = substr($name,0,strpos($name,':')); - // get unqualified name - $name = substr(strstr($name,':'),1); - } - - // build to native type - if(isset($this->body_position) && $pos > $this->body_position){ - // deal w/ multirefs - if(isset($this->message[$pos]['attrs']['href'])){ - // get id - $id = substr($this->message[$pos]['attrs']['href'],1); - // add placeholder to href array - $this->multirefs[$id][$pos] = 'placeholder'; - // add set a reference to it as the result value - $this->message[$pos]['result'] =& $this->multirefs[$id][$pos]; - // build complexType values - } elseif($this->message[$pos]['children'] != ''){ - // if result has already been generated (struct/array) - if(!isset($this->message[$pos]['result'])){ - $this->message[$pos]['result'] = $this->buildVal($pos); - } - // build complexType values of attributes and possibly simpleContent - } elseif (isset($this->message[$pos]['xattrs'])) { - if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) { - $this->message[$pos]['xattrs']['!'] = null; - } elseif (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') { - if (isset($this->message[$pos]['type'])) { - $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - } else { - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - } else { - $this->message[$pos]['xattrs']['!'] = $this->message[$pos]['cdata']; - } - } - } - $this->message[$pos]['result'] = $this->message[$pos]['xattrs']; - // set value of simpleType (or nil complexType) - } else { - //$this->debug('adding data for scalar value '.$this->message[$pos]['name'].' of value '.$this->message[$pos]['cdata']); - if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) { - $this->message[$pos]['xattrs']['!'] = null; - } elseif (isset($this->message[$pos]['type'])) { - $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - } else { - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - } else { - $this->message[$pos]['result'] = $this->message[$pos]['cdata']; - } - } - - /* add value to parent's result, if parent is struct/array - $parent = $this->message[$pos]['parent']; - if($this->message[$parent]['type'] != 'map'){ - if(strtolower($this->message[$parent]['type']) == 'array'){ - $this->message[$parent]['result'][] = $this->message[$pos]['result']; - } else { - $this->message[$parent]['result'][$this->message[$pos]['name']] = $this->message[$pos]['result']; - } - } - */ - } - } - - // for doclit - if($this->status == 'header'){ - if ($this->root_header != $pos) { - $this->responseHeaders .= ""; - } - } elseif($pos >= $this->root_struct){ - $this->document .= ""; - } - // switch status - if ($pos == $this->root_struct){ - $this->status = 'body'; - $this->root_struct_namespace = $this->message[$pos]['namespace']; - } elseif ($pos == $this->root_header) { - $this->status = 'envelope'; - } elseif ($name == 'Body' && $this->status == 'body') { - $this->status = 'envelope'; - } elseif ($name == 'Header' && $this->status == 'header') { // will never happen - $this->status = 'envelope'; - } elseif ($name == 'Envelope' && $this->status == 'envelope') { - $this->status = ''; - } - // set parent back to my parent - $this->parent = $this->message[$pos]['parent']; - } - - /** - * element content handler - * - * @param resource $parser XML parser object - * @param string $data element content - * @access private - */ - function character_data($parser, $data){ - $pos = $this->depth_array[$this->depth]; - if ($this->xml_encoding=='UTF-8'){ - // TODO: add an option to disable this for folks who want - // raw UTF-8 that, e.g., might not map to iso-8859-1 - // TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1"); - if($this->decode_utf8){ - $data = utf8_decode($data); - } - } - $this->message[$pos]['cdata'] .= $data; - // for doclit - if($this->status == 'header'){ - $this->responseHeaders .= $data; - } else { - $this->document .= $data; - } - } - - /** - * get the parsed message (SOAP Body) - * - * @return mixed - * @access public - * @deprecated use get_soapbody instead - */ - function get_response(){ - return $this->soapresponse; - } - - /** - * get the parsed SOAP Body (NULL if there was none) - * - * @return mixed - * @access public - */ - function get_soapbody(){ - return $this->soapresponse; - } - - /** - * get the parsed SOAP Header (NULL if there was none) - * - * @return mixed - * @access public - */ - function get_soapheader(){ - return $this->soapheader; - } - - /** - * get the unparsed SOAP Header - * - * @return string XML or empty if no Header - * @access public - */ - function getHeaders(){ - return $this->responseHeaders; - } - - /** - * decodes simple types into PHP variables - * - * @param string $value value to decode - * @param string $type XML type to decode - * @param string $typens XML type namespace to decode - * @return mixed PHP value - * @access private - */ - function decodeSimple($value, $type, $typens) { - // TODO: use the namespace! - if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') { - return (string) $value; - } - if ($type == 'int' || $type == 'integer' || $type == 'short' || $type == 'byte') { - return (int) $value; - } - if ($type == 'float' || $type == 'double' || $type == 'decimal') { - return (double) $value; - } - if ($type == 'boolean') { - if (strtolower($value) == 'false' || strtolower($value) == 'f') { - return false; - } - return (boolean) $value; - } - if ($type == 'base64' || $type == 'base64Binary') { - $this->debug('Decode base64 value'); - return base64_decode($value); - } - // obscure numeric types - if ($type == 'nonPositiveInteger' || $type == 'negativeInteger' - || $type == 'nonNegativeInteger' || $type == 'positiveInteger' - || $type == 'unsignedInt' - || $type == 'unsignedShort' || $type == 'unsignedByte') { - return (int) $value; - } - // bogus: parser treats array with no elements as a simple type - if ($type == 'array') { - return array(); - } - // everything else - return (string) $value; - } - - /** - * builds response structures for compound values (arrays/structs) - * and scalars - * - * @param integer $pos position in node tree - * @return mixed PHP value - * @access private - */ - function buildVal($pos){ - if(!isset($this->message[$pos]['type'])){ - $this->message[$pos]['type'] = ''; - } - $this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']); - // if there are children... - if($this->message[$pos]['children'] != ''){ - $this->debug('in buildVal, there are children'); - $children = explode('|',$this->message[$pos]['children']); - array_shift($children); // knock off empty - // md array - if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){ - $r=0; // rowcount - $c=0; // colcount - foreach($children as $child_pos){ - $this->debug("in buildVal, got an MD array element: $r, $c"); - $params[$r][] = $this->message[$child_pos]['result']; - $c++; - if($c == $this->message[$pos]['arrayCols']){ - $c = 0; - $r++; - } - } - // array - } elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){ - $this->debug('in buildVal, adding array '.$this->message[$pos]['name']); - foreach($children as $child_pos){ - $params[] = &$this->message[$child_pos]['result']; - } - // apache Map type: java hashtable - } elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap'){ - $this->debug('in buildVal, Java Map '.$this->message[$pos]['name']); - foreach($children as $child_pos){ - $kv = explode("|",$this->message[$child_pos]['children']); - $params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result']; - } - // generic compound type - //} elseif($this->message[$pos]['type'] == 'SOAPStruct' || $this->message[$pos]['type'] == 'struct') { - } else { - // Apache Vector type: treat as an array - $this->debug('in buildVal, adding Java Vector or generic compound type '.$this->message[$pos]['name']); - if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') { - $notstruct = 1; - } else { - $notstruct = 0; - } - // - foreach($children as $child_pos){ - if($notstruct){ - $params[] = &$this->message[$child_pos]['result']; - } else { - if (isset($params[$this->message[$child_pos]['name']])) { - // de-serialize repeated element name into an array - if ((!is_array($params[$this->message[$child_pos]['name']])) || (!isset($params[$this->message[$child_pos]['name']][0]))) { - $params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]); - } - $params[$this->message[$child_pos]['name']][] = &$this->message[$child_pos]['result']; - } else { - $params[$this->message[$child_pos]['name']] = &$this->message[$child_pos]['result']; - } - } - } - } - if (isset($this->message[$pos]['xattrs'])) { - $this->debug('in buildVal, handling attributes'); - foreach ($this->message[$pos]['xattrs'] as $n => $v) { - $params[$n] = $v; - } - } - // handle simpleContent - if (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') { - $this->debug('in buildVal, handling simpleContent'); - if (isset($this->message[$pos]['type'])) { - $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - } else { - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - } else { - $params['!'] = $this->message[$pos]['cdata']; - } - } - } - $ret = is_array($params) ? $params : array(); - $this->debug('in buildVal, return:'); - $this->appendDebug($this->varDump($ret)); - return $ret; - } else { - $this->debug('in buildVal, no children, building scalar'); - $cdata = isset($this->message[$pos]['cdata']) ? $this->message[$pos]['cdata'] : ''; - if (isset($this->message[$pos]['type'])) { - $ret = $this->decodeSimple($cdata, $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - $this->debug("in buildVal, return: $ret"); - return $ret; - } - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $ret = $this->decodeSimple($cdata, $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - $this->debug("in buildVal, return: $ret"); - return $ret; - } - $ret = $this->message[$pos]['cdata']; - $this->debug("in buildVal, return: $ret"); - return $ret; - } - } -} - -/** - * Backward compatibility - */ -class soap_parser extends nusoap_parser { -} - -?>call( string methodname [ ,array parameters] ); -* -* // bye bye client -* unset($soapclient); -* -* @author Dietrich Ayala -* @author Scott Nichol -* @version $Id: nusoap.php 7091 2011-06-16 11:34:02Z mMarinetti $ -* @access public -*/ -class nusoap_client extends nusoap_base { - - var $username = ''; // Username for HTTP authentication - var $password = ''; // Password for HTTP authentication - var $authtype = ''; // Type of HTTP authentication - var $certRequest = array(); // Certificate for HTTP SSL authentication - var $requestHeaders = false; // SOAP headers in request (text) - var $responseHeaders = ''; // SOAP headers from response (incomplete namespace resolution) (text) - var $responseHeader = NULL; // SOAP Header from response (parsed) - var $document = ''; // SOAP body response portion (incomplete namespace resolution) (text) - var $endpoint; - var $forceEndpoint = ''; // overrides WSDL endpoint - var $proxyhost = ''; - var $proxyport = ''; - var $proxyusername = ''; - var $proxypassword = ''; - var $portName = ''; // port name to use in WSDL - var $xml_encoding = ''; // character set encoding of incoming (response) messages - var $http_encoding = false; - var $timeout = 0; // HTTP connection timeout - var $response_timeout = 30; // HTTP response timeout - var $endpointType = ''; // soap|wsdl, empty for WSDL initialization error - var $persistentConnection = false; - var $defaultRpcParams = false; // This is no longer used - var $request = ''; // HTTP request - var $response = ''; // HTTP response - var $responseData = ''; // SOAP payload of response - var $cookies = array(); // Cookies from response or for request - var $decode_utf8 = true; // toggles whether the parser decodes element content w/ utf8_decode() - var $operations = array(); // WSDL operations, empty for WSDL initialization error - var $curl_options = array(); // User-specified cURL options - var $bindingType = ''; // WSDL operation binding type - var $use_curl = false; // whether to always try to use cURL - - /* - * fault related variables - */ - /** - * @var fault - * @access public - */ - var $fault; - /** - * @var faultcode - * @access public - */ - var $faultcode; - /** - * @var faultstring - * @access public - */ - var $faultstring; - /** - * @var faultdetail - * @access public - */ - var $faultdetail; - - /** - * constructor - * - * @param mixed $endpoint SOAP server or WSDL URL (string), or wsdl instance (object) - * @param mixed $wsdl optional, set to 'wsdl' or true if using WSDL - * @param string $proxyhost optional - * @param string $proxyport optional - * @param string $proxyusername optional - * @param string $proxypassword optional - * @param integer $timeout set the connection timeout - * @param integer $response_timeout set the response timeout - * @param string $portName optional portName in WSDL document - * @access public - */ - function nusoap_client($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){ - parent::nusoap_base(); - $this->endpoint = $endpoint; - $this->proxyhost = $proxyhost; - $this->proxyport = $proxyport; - $this->proxyusername = $proxyusername; - $this->proxypassword = $proxypassword; - $this->timeout = $timeout; - $this->response_timeout = $response_timeout; - $this->portName = $portName; - - $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); - $this->appendDebug('endpoint=' . $this->varDump($endpoint)); - - // make values - if($wsdl){ - if (is_object($endpoint) && (get_class($endpoint) == 'wsdl')) { - $this->wsdl = $endpoint; - $this->endpoint = $this->wsdl->wsdl; - $this->wsdlFile = $this->endpoint; - $this->debug('existing wsdl instance created from ' . $this->endpoint); - $this->checkWSDL(); - } else { - $this->wsdlFile = $this->endpoint; - $this->wsdl = null; - $this->debug('will use lazy evaluation of wsdl from ' . $this->endpoint); - } - $this->endpointType = 'wsdl'; - } else { - $this->debug("instantiate SOAP with endpoint at $endpoint"); - $this->endpointType = 'soap'; - } - } - - /** - * calls method, returns PHP native type - * - * @param string $operation SOAP server URL or path - * @param mixed $params An array, associative or simple, of the parameters - * for the method call, or a string that is the XML - * for the call. For rpc style, this call will - * wrap the XML in a tag named after the method, as - * well as the SOAP Envelope and Body. For document - * style, this will only wrap with the Envelope and Body. - * IMPORTANT: when using an array with document style, - * in which case there - * is really one parameter, the root of the fragment - * used in the call, which encloses what programmers - * normally think of parameters. A parameter array - * *must* include the wrapper. - * @param string $namespace optional method namespace (WSDL can override) - * @param string $soapAction optional SOAPAction value (WSDL can override) - * @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array - * @param boolean $rpcParams optional (no longer used) - * @param string $style optional (rpc|document) the style to use when serializing parameters (WSDL can override) - * @param string $use optional (encoded|literal) the use when serializing parameters (WSDL can override) - * @return mixed response from SOAP call, normally an associative array mirroring the structure of the XML response, false for certain fatal errors - * @access public - */ - function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAction='',$headers=false,$rpcParams=null,$style='rpc',$use='encoded'){ - $this->operation = $operation; - $this->fault = false; - $this->setError(''); - $this->request = ''; - $this->response = ''; - $this->responseData = ''; - $this->faultstring = ''; - $this->faultcode = ''; - $this->opData = array(); - - $this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType"); - $this->appendDebug('params=' . $this->varDump($params)); - $this->appendDebug('headers=' . $this->varDump($headers)); - if ($headers) { - $this->requestHeaders = $headers; - } - if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { - $this->loadWSDL(); - if ($this->getError()) - return false; - } - // serialize parameters - if($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)){ - // use WSDL for operation - $this->opData = $opData; - $this->debug("found operation"); - $this->appendDebug('opData=' . $this->varDump($opData)); - if (isset($opData['soapAction'])) { - $soapAction = $opData['soapAction']; - } - if (! $this->forceEndpoint) { - $this->endpoint = $opData['endpoint']; - } else { - $this->endpoint = $this->forceEndpoint; - } - $namespace = isset($opData['input']['namespace']) ? $opData['input']['namespace'] : $namespace; - $style = $opData['style']; - $use = $opData['input']['use']; - // add ns to ns array - if($namespace != '' && !isset($this->wsdl->namespaces[$namespace])){ - $nsPrefix = 'ns' . rand(1000, 9999); - $this->wsdl->namespaces[$nsPrefix] = $namespace; - } - $nsPrefix = $this->wsdl->getPrefixFromNamespace($namespace); - // serialize payload - if (is_string($params)) { - $this->debug("serializing param string for WSDL operation $operation"); - $payload = $params; - } elseif (is_array($params)) { - $this->debug("serializing param array for WSDL operation $operation"); - $payload = $this->wsdl->serializeRPCParameters($operation,'input',$params,$this->bindingType); - } else { - $this->debug('params must be array or string'); - $this->setError('params must be array or string'); - return false; - } - $usedNamespaces = $this->wsdl->usedNamespaces; - if (isset($opData['input']['encodingStyle'])) { - $encodingStyle = $opData['input']['encodingStyle']; - } else { - $encodingStyle = ''; - } - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - if ($errstr = $this->wsdl->getError()) { - $this->debug('got wsdl error: '.$errstr); - $this->setError('wsdl error: '.$errstr); - return false; - } - } elseif($this->endpointType == 'wsdl') { - // operation not in WSDL - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->setError('operation '.$operation.' not present in WSDL.'); - $this->debug("operation '$operation' not present in WSDL."); - return false; - } else { - // no WSDL - //$this->namespaces['ns1'] = $namespace; - $nsPrefix = 'ns' . rand(1000, 9999); - // serialize - $payload = ''; - if (is_string($params)) { - $this->debug("serializing param string for operation $operation"); - $payload = $params; - } elseif (is_array($params)) { - $this->debug("serializing param array for operation $operation"); - foreach($params as $k => $v){ - $payload .= $this->serialize_val($v,$k,false,false,false,false,$use); - } - } else { - $this->debug('params must be array or string'); - $this->setError('params must be array or string'); - return false; - } - $usedNamespaces = array(); - if ($use == 'encoded') { - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - } else { - $encodingStyle = ''; - } - } - // wrap RPC calls with method element - if ($style == 'rpc') { - if ($use == 'literal') { - $this->debug("wrapping RPC request with literal method element"); - if ($namespace) { - // http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace - $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" . - $payload . - ""; - } else { - $payload = "<$operation>" . $payload . ""; - } - } else { - $this->debug("wrapping RPC request with encoded method element"); - if ($namespace) { - $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" . - $payload . - ""; - } else { - $payload = "<$operation>" . - $payload . - ""; - } - } - } - // serialize envelope - $soapmsg = $this->serializeEnvelope($payload,$this->requestHeaders,$usedNamespaces,$style,$use,$encodingStyle); - $this->debug("endpoint=$this->endpoint, soapAction=$soapAction, namespace=$namespace, style=$style, use=$use, encodingStyle=$encodingStyle"); - $this->debug('SOAP message length=' . strlen($soapmsg) . ' contents (max 1000 bytes)=' . substr($soapmsg, 0, 1000)); - // send - $return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_timeout); - if($errstr = $this->getError()){ - $this->debug('Error: '.$errstr); - return false; - } else { - $this->return = $return; - $this->debug('sent message successfully and got a(n) '.gettype($return)); - $this->appendDebug('return=' . $this->varDump($return)); - - // fault? - if(is_array($return) && isset($return['faultcode'])){ - $this->debug('got fault'); - $this->setError($return['faultcode'].': '.$return['faultstring']); - $this->fault = true; - foreach($return as $k => $v){ - $this->$k = $v; - $this->debug("$k = $v
    "); - } - return $return; - } elseif ($style == 'document') { - // NOTE: if the response is defined to have multiple parts (i.e. unwrapped), - // we are only going to return the first part here...sorry about that - return $return; - } else { - // array of return values - if(is_array($return)){ - // multiple 'out' parameters, which we return wrapped up - // in the array - if(sizeof($return) > 1){ - return $return; - } - // single 'out' parameter (normally the return value) - $return = array_shift($return); - $this->debug('return shifted value: '); - $this->appendDebug($this->varDump($return)); - return $return; - // nothing returned (ie, echoVoid) - } else { - return ""; - } - } - } - } - - /** - * check WSDL passed as an instance or pulled from an endpoint - * - * @access private - */ - function checkWSDL() { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->debug('checkWSDL'); - // catch errors - if ($errstr = $this->wsdl->getError()) { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->debug('got wsdl error: '.$errstr); - $this->setError('wsdl error: '.$errstr); - } elseif ($this->operations = $this->wsdl->getOperations($this->portName, 'soap')) { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->bindingType = 'soap'; - $this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for binding type '.$this->bindingType); - } elseif ($this->operations = $this->wsdl->getOperations($this->portName, 'soap12')) { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->bindingType = 'soap12'; - $this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for binding type '.$this->bindingType); - $this->debug('**************** WARNING: SOAP 1.2 BINDING *****************'); - } else { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->debug('getOperations returned false'); - $this->setError('no operations defined in the WSDL document!'); - } - } - - /** - * instantiate wsdl object and parse wsdl file - * - * @access public - */ - function loadWSDL() { - $this->debug('instantiating wsdl class with doc: '.$this->wsdlFile); - $this->wsdl = new wsdl('',$this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword,$this->timeout,$this->response_timeout,$this->curl_options,$this->use_curl); - $this->wsdl->setCredentials($this->username, $this->password, $this->authtype, $this->certRequest); - $this->wsdl->fetchWSDL($this->wsdlFile); - $this->checkWSDL(); - } - - /** - * get available data pertaining to an operation - * - * @param string $operation operation name - * @return array array of data pertaining to the operation - * @access public - */ - function getOperationData($operation){ - if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { - $this->loadWSDL(); - if ($this->getError()) - return false; - } - if(isset($this->operations[$operation])){ - return $this->operations[$operation]; - } - $this->debug("No data for operation: $operation"); - } - - /** - * send the SOAP message - * - * Note: if the operation has multiple return values - * the return value of this method will be an array - * of those values. - * - * @param string $msg a SOAPx4 soapmsg object - * @param string $soapaction SOAPAction value - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @return mixed native PHP types. - * @access private - */ - function send($msg, $soapaction = '', $timeout=0, $response_timeout=30) { - $this->checkCookies(); - // detect transport - switch(true){ - // http(s) - case preg_match('/^http/',$this->endpoint): - $this->debug('transporting via HTTP'); - if($this->persistentConnection == true && is_object($this->persistentConnection)){ - $http =& $this->persistentConnection; - } else { - $http = new soap_transport_http($this->endpoint, $this->curl_options, $this->use_curl); - if ($this->persistentConnection) { - $http->usePersistentConnection(); - } - } - $http->setContentType($this->getHTTPContentType(), $this->getHTTPContentTypeCharset()); - $http->setSOAPAction($soapaction); - if($this->proxyhost && $this->proxyport){ - $http->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword); - } - if($this->authtype != '') { - $http->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest); - } - if($this->http_encoding != ''){ - $http->setEncoding($this->http_encoding); - } - $this->debug('sending message, length='.strlen($msg)); - if(preg_match('/^http:/',$this->endpoint)){ - //if(strpos($this->endpoint,'http:')){ - $this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies); - } elseif(preg_match('/^https/',$this->endpoint)){ - //} elseif(strpos($this->endpoint,'https:')){ - //if(phpversion() == '4.3.0-dev'){ - //$response = $http->send($msg,$timeout,$response_timeout); - //$this->request = $http->outgoing_payload; - //$this->response = $http->incoming_payload; - //} else - $this->responseData = $http->sendHTTPS($msg,$timeout,$response_timeout,$this->cookies); - } else { - $this->setError('no http/s in endpoint url'); - } - $this->request = $http->outgoing_payload; - $this->response = $http->incoming_payload; - $this->appendDebug($http->getDebug()); - $this->UpdateCookies($http->incoming_cookies); - - // save transport object if using persistent connections - if ($this->persistentConnection) { - $http->clearDebug(); - if (!is_object($this->persistentConnection)) { - $this->persistentConnection = $http; - } - } - - if($err = $http->getError()){ - $this->setError('HTTP Error: '.$err); - return false; - } elseif($this->getError()){ - return false; - } else { - $this->debug('got response, length='. strlen($this->responseData).' type='.$http->incoming_headers['content-type']); - return $this->parseResponse($http->incoming_headers, $this->responseData); - } - break; - default: - $this->setError('no transport found, or selected transport is not yet supported!'); - return false; - break; - } - } - - /** - * processes SOAP message returned from server - * - * @param array $headers The HTTP headers - * @param string $data unprocessed response data from server - * @return mixed value of the message, decoded into a PHP type - * @access private - */ - function parseResponse($headers, $data) { - $this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' headers:'); - $this->appendDebug($this->varDump($headers)); - if (!isset($headers['content-type'])) { - $this->setError('Response not of type text/xml (no content-type header)'); - return false; - } - if (!strstr($headers['content-type'], 'text/xml')) { - $this->setError('Response not of type text/xml: ' . $headers['content-type']); - return false; - } - if (strpos($headers['content-type'], '=')) { - $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1)); - $this->debug('Got response encoding: ' . $enc); - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser'); - $parser = new nusoap_parser($data,$this->xml_encoding,$this->operation,$this->decode_utf8); - // add parser debug data to our debug - $this->appendDebug($parser->getDebug()); - // if parse errors - if($errstr = $parser->getError()){ - $this->setError( $errstr); - // destroy the parser object - unset($parser); - return false; - } else { - // get SOAP headers - $this->responseHeaders = $parser->getHeaders(); - // get SOAP headers - $this->responseHeader = $parser->get_soapheader(); - // get decoded message - $return = $parser->get_soapbody(); - // add document for doclit support - $this->document = $parser->document; - // destroy the parser object - unset($parser); - // return decode message - return $return; - } - } - - /** - * sets user-specified cURL options - * - * @param mixed $option The cURL option (always integer?) - * @param mixed $value The cURL option value - * @access public - */ - function setCurlOption($option, $value) { - $this->debug("setCurlOption option=$option, value="); - $this->appendDebug($this->varDump($value)); - $this->curl_options[$option] = $value; - } - - /** - * sets the SOAP endpoint, which can override WSDL - * - * @param string $endpoint The endpoint URL to use, or empty string or false to prevent override - * @access public - */ - function setEndpoint($endpoint) { - $this->debug("setEndpoint(\"$endpoint\")"); - $this->forceEndpoint = $endpoint; - } - - /** - * set the SOAP headers - * - * @param mixed $headers String of XML with SOAP header content, or array of soapval objects for SOAP headers - * @access public - */ - function setHeaders($headers){ - $this->debug("setHeaders headers="); - $this->appendDebug($this->varDump($headers)); - $this->requestHeaders = $headers; - } - - /** - * get the SOAP response headers (namespace resolution incomplete) - * - * @return string - * @access public - */ - function getHeaders(){ - return $this->responseHeaders; - } - - /** - * get the SOAP response Header (parsed) - * - * @return mixed - * @access public - */ - function getHeader(){ - return $this->responseHeader; - } - - /** - * set proxy info here - * - * @param string $proxyhost - * @param string $proxyport - * @param string $proxyusername - * @param string $proxypassword - * @access public - */ - function setHTTPProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '') { - $this->proxyhost = $proxyhost; - $this->proxyport = $proxyport; - $this->proxyusername = $proxyusername; - $this->proxypassword = $proxypassword; - } - - /** - * if authenticating, set user credentials here - * - * @param string $username - * @param string $password - * @param string $authtype (basic|digest|certificate|ntlm) - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) - * @access public - */ - function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) { - $this->debug("setCredentials username=$username authtype=$authtype certRequest="); - $this->appendDebug($this->varDump($certRequest)); - $this->username = $username; - $this->password = $password; - $this->authtype = $authtype; - $this->certRequest = $certRequest; - } - - /** - * use HTTP encoding - * - * @param string $enc HTTP encoding - * @access public - */ - function setHTTPEncoding($enc='gzip, deflate'){ - $this->debug("setHTTPEncoding(\"$enc\")"); - $this->http_encoding = $enc; - } - - /** - * Set whether to try to use cURL connections if possible - * - * @param boolean $use Whether to try to use cURL - * @access public - */ - function setUseCURL($use) { - $this->debug("setUseCURL($use)"); - $this->use_curl = $use; - } - - /** - * use HTTP persistent connections if possible - * - * @access public - */ - function useHTTPPersistentConnection(){ - $this->debug("useHTTPPersistentConnection"); - $this->persistentConnection = true; - } - - /** - * gets the default RPC parameter setting. - * If true, default is that call params are like RPC even for document style. - * Each call() can override this value. - * - * This is no longer used. - * - * @return boolean - * @access public - * @deprecated - */ - function getDefaultRpcParams() { - return $this->defaultRpcParams; - } - - /** - * sets the default RPC parameter setting. - * If true, default is that call params are like RPC even for document style - * Each call() can override this value. - * - * This is no longer used. - * - * @param boolean $rpcParams - * @access public - * @deprecated - */ - function setDefaultRpcParams($rpcParams) { - $this->defaultRpcParams = $rpcParams; - } - - /** - * dynamically creates an instance of a proxy class, - * allowing user to directly call methods from wsdl - * - * @return object soap_proxy object - * @access public - */ - function getProxy() { - $r = rand(); - $evalStr = $this->_getProxyClassCode($r); - //$this->debug("proxy class: $evalStr"); - if ($this->getError()) { - $this->debug("Error from _getProxyClassCode, so return NULL"); - return null; - } - // eval the class - eval($evalStr); - // instantiate proxy object - eval("\$proxy = new nusoap_proxy_$r('');"); - // transfer current wsdl data to the proxy thereby avoiding parsing the wsdl twice - $proxy->endpointType = 'wsdl'; - $proxy->wsdlFile = $this->wsdlFile; - $proxy->wsdl = $this->wsdl; - $proxy->operations = $this->operations; - $proxy->defaultRpcParams = $this->defaultRpcParams; - // transfer other state - $proxy->soap_defencoding = $this->soap_defencoding; - $proxy->username = $this->username; - $proxy->password = $this->password; - $proxy->authtype = $this->authtype; - $proxy->certRequest = $this->certRequest; - $proxy->requestHeaders = $this->requestHeaders; - $proxy->endpoint = $this->endpoint; - $proxy->forceEndpoint = $this->forceEndpoint; - $proxy->proxyhost = $this->proxyhost; - $proxy->proxyport = $this->proxyport; - $proxy->proxyusername = $this->proxyusername; - $proxy->proxypassword = $this->proxypassword; - $proxy->http_encoding = $this->http_encoding; - $proxy->timeout = $this->timeout; - $proxy->response_timeout = $this->response_timeout; - $proxy->persistentConnection = &$this->persistentConnection; - $proxy->decode_utf8 = $this->decode_utf8; - $proxy->curl_options = $this->curl_options; - $proxy->bindingType = $this->bindingType; - $proxy->use_curl = $this->use_curl; - return $proxy; - } - - /** - * dynamically creates proxy class code - * - * @return string PHP/NuSOAP code for the proxy class - * @access private - */ - function _getProxyClassCode($r) { - $this->debug("in getProxy endpointType=$this->endpointType"); - $this->appendDebug("wsdl=" . $this->varDump($this->wsdl)); - if ($this->endpointType != 'wsdl') { - $evalStr = 'A proxy can only be created for a WSDL client'; - $this->setError($evalStr); - $evalStr = "echo \"$evalStr\";"; - return $evalStr; - } - if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { - $this->loadWSDL(); - if ($this->getError()) { - return "echo \"" . $this->getError() . "\";"; - } - } - $evalStr = ''; - foreach ($this->operations as $operation => $opData) { - if ($operation != '') { - // create param string and param comment string - if (sizeof($opData['input']['parts']) > 0) { - $paramStr = ''; - $paramArrayStr = ''; - $paramCommentStr = ''; - foreach ($opData['input']['parts'] as $name => $type) { - $paramStr .= "\$$name, "; - $paramArrayStr .= "'$name' => \$$name, "; - $paramCommentStr .= "$type \$$name, "; - } - $paramStr = substr($paramStr, 0, strlen($paramStr)-2); - $paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr)-2); - $paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr)-2); - } else { - $paramStr = ''; - $paramArrayStr = ''; - $paramCommentStr = 'void'; - } - $opData['namespace'] = !isset($opData['namespace']) ? 'http://testuri.com' : $opData['namespace']; - $evalStr .= "// $paramCommentStr - function " . str_replace('.', '__', $operation) . "($paramStr) { - \$params = array($paramArrayStr); - return \$this->call('$operation', \$params, '".$opData['namespace']."', '".(isset($opData['soapAction']) ? $opData['soapAction'] : '')."'); - } - "; - unset($paramStr); - unset($paramCommentStr); - } - } - $evalStr = 'class nusoap_proxy_'.$r.' extends nusoap_client { - '.$evalStr.' -}'; - return $evalStr; - } - - /** - * dynamically creates proxy class code - * - * @return string PHP/NuSOAP code for the proxy class - * @access public - */ - function getProxyClassCode() { - $r = rand(); - return $this->_getProxyClassCode($r); - } - - /** - * gets the HTTP body for the current request. - * - * @param string $soapmsg The SOAP payload - * @return string The HTTP body, which includes the SOAP payload - * @access private - */ - function getHTTPBody($soapmsg) { - return $soapmsg; - } - - /** - * gets the HTTP content type for the current request. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type for the current request. - * @access private - */ - function getHTTPContentType() { - return 'text/xml'; - } - - /** - * gets the HTTP content type charset for the current request. - * returns false for non-text content types. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type charset for the current request. - * @access private - */ - function getHTTPContentTypeCharset() { - return $this->soap_defencoding; - } - - /* - * whether or not parser should decode utf8 element content - * - * @return always returns true - * @access public - */ - function decodeUTF8($bool){ - $this->decode_utf8 = $bool; - return true; - } - - /** - * adds a new Cookie into $this->cookies array - * - * @param string $name Cookie Name - * @param string $value Cookie Value - * @return boolean if cookie-set was successful returns true, else false - * @access public - */ - function setCookie($name, $value) { - if (strlen($name) == 0) { - return false; - } - $this->cookies[] = array('name' => $name, 'value' => $value); - return true; - } - - /** - * gets all Cookies - * - * @return array with all internal cookies - * @access public - */ - function getCookies() { - return $this->cookies; - } - - /** - * checks all Cookies and delete those which are expired - * - * @return boolean always return true - * @access private - */ - function checkCookies() { - if (sizeof($this->cookies) == 0) { - return true; - } - $this->debug('checkCookie: check ' . sizeof($this->cookies) . ' cookies'); - $curr_cookies = $this->cookies; - $this->cookies = array(); - foreach ($curr_cookies as $cookie) { - if (! is_array($cookie)) { - $this->debug('Remove cookie that is not an array'); - continue; - } - if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) { - if (strtotime($cookie['expires']) > time()) { - $this->cookies[] = $cookie; - } else { - $this->debug('Remove expired cookie ' . $cookie['name']); - } - } else { - $this->cookies[] = $cookie; - } - } - $this->debug('checkCookie: '.sizeof($this->cookies).' cookies left in array'); - return true; - } - - /** - * updates the current cookies with a new set - * - * @param array $cookies new cookies with which to update current ones - * @return boolean always return true - * @access private - */ - function UpdateCookies($cookies) { - if (sizeof($this->cookies) == 0) { - // no existing cookies: take whatever is new - if (sizeof($cookies) > 0) { - $this->debug('Setting new cookie(s)'); - $this->cookies = $cookies; - } - return true; - } - if (sizeof($cookies) == 0) { - // no new cookies: keep what we've got - return true; - } - // merge - foreach ($cookies as $newCookie) { - if (!is_array($newCookie)) { - continue; - } - if ((!isset($newCookie['name'])) || (!isset($newCookie['value']))) { - continue; - } - $newName = $newCookie['name']; - - $found = false; - for ($i = 0; $i < count($this->cookies); $i++) { - $cookie = $this->cookies[$i]; - if (!is_array($cookie)) { - continue; - } - if (!isset($cookie['name'])) { - continue; - } - if ($newName != $cookie['name']) { - continue; - } - $newDomain = isset($newCookie['domain']) ? $newCookie['domain'] : 'NODOMAIN'; - $domain = isset($cookie['domain']) ? $cookie['domain'] : 'NODOMAIN'; - if ($newDomain != $domain) { - continue; - } - $newPath = isset($newCookie['path']) ? $newCookie['path'] : 'NOPATH'; - $path = isset($cookie['path']) ? $cookie['path'] : 'NOPATH'; - if ($newPath != $path) { - continue; - } - $this->cookies[$i] = $newCookie; - $found = true; - $this->debug('Update cookie ' . $newName . '=' . $newCookie['value']); - break; - } - if (! $found) { - $this->debug('Add cookie ' . $newName . '=' . $newCookie['value']); - $this->cookies[] = $newCookie; - } - } - return true; - } -} - -if (!extension_loaded('soap')) { - /** - * For backwards compatiblity, define soapclient unless the PHP SOAP extension is loaded. - */ - class soapclient extends nusoap_client { - } -} -?> diff --git a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/nusoapmime.php b/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/nusoapmime.php deleted file mode 100755 index 12534e6d8..000000000 --- a/modules/mondialrelay/kit_mondialrelay/tools/nusoap/lib/nusoapmime.php +++ /dev/null @@ -1,501 +0,0 @@ - -* @author Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list -* @version $Id: nusoapmime.php 6844 2011-06-03 14:46:51Z dMetzger $ -* @access public -*/ -class nusoap_client_mime extends nusoap_client { - /** - * @var array Each array element in the return is an associative array with keys - * data, filename, contenttype, cid - * @access private - */ - var $requestAttachments = array(); - /** - * @var array Each array element in the return is an associative array with keys - * data, filename, contenttype, cid - * @access private - */ - var $responseAttachments; - /** - * @var string - * @access private - */ - var $mimeContentType; - - /** - * adds a MIME attachment to the current request. - * - * If the $data parameter contains an empty string, this method will read - * the contents of the file named by the $filename parameter. - * - * If the $cid parameter is false, this method will generate the cid. - * - * @param string $data The data of the attachment - * @param string $filename The filename of the attachment (default is empty string) - * @param string $contenttype The MIME Content-Type of the attachment (default is application/octet-stream) - * @param string $cid The content-id (cid) of the attachment (default is false) - * @return string The content-id (cid) of the attachment - * @access public - */ - function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) { - if (! $cid) { - $cid = md5(uniqid(time())); - } - - $info['data'] = $data; - $info['filename'] = $filename; - $info['contenttype'] = $contenttype; - $info['cid'] = $cid; - - $this->requestAttachments[] = $info; - - return $cid; - } - - /** - * clears the MIME attachments for the current request. - * - * @access public - */ - function clearAttachments() { - $this->requestAttachments = array(); - } - - /** - * gets the MIME attachments from the current response. - * - * Each array element in the return is an associative array with keys - * data, filename, contenttype, cid. These keys correspond to the parameters - * for addAttachment. - * - * @return array The attachments. - * @access public - */ - function getAttachments() { - return $this->responseAttachments; - } - - /** - * gets the HTTP body for the current request. - * - * @param string $soapmsg The SOAP payload - * @return string The HTTP body, which includes the SOAP payload - * @access private - */ - function getHTTPBody($soapmsg) { - if (count($this->requestAttachments) > 0) { - $params['content_type'] = 'multipart/related; type="text/xml"'; - $mimeMessage = new Mail_mimePart('', $params); - unset($params); - - $params['content_type'] = 'text/xml'; - $params['encoding'] = '8bit'; - $params['charset'] = $this->soap_defencoding; - $mimeMessage->addSubpart($soapmsg, $params); - - foreach ($this->requestAttachments as $att) { - unset($params); - - $params['content_type'] = $att['contenttype']; - $params['encoding'] = 'base64'; - $params['disposition'] = 'attachment'; - $params['dfilename'] = $att['filename']; - $params['cid'] = $att['cid']; - - if ($att['data'] == '' && $att['filename'] <> '') { - if ($fd = fopen($att['filename'], 'rb')) { - $data = fread($fd, filesize($att['filename'])); - fclose($fd); - } else { - $data = ''; - } - $mimeMessage->addSubpart($data, $params); - } else { - $mimeMessage->addSubpart($att['data'], $params); - } - } - - $output = $mimeMessage->encode(); - $mimeHeaders = $output['headers']; - - foreach ($mimeHeaders as $k => $v) { - $this->debug("MIME header $k: $v"); - if (strtolower($k) == 'content-type') { - // PHP header() seems to strip leading whitespace starting - // the second line, so force everything to one line - $this->mimeContentType = str_replace("\r\n", " ", $v); - } - } - - return $output['body']; - } - - return parent::getHTTPBody($soapmsg); - } - - /** - * gets the HTTP content type for the current request. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type for the current request. - * @access private - */ - function getHTTPContentType() { - if (count($this->requestAttachments) > 0) { - return $this->mimeContentType; - } - return parent::getHTTPContentType(); - } - - /** - * gets the HTTP content type charset for the current request. - * returns false for non-text content types. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type charset for the current request. - * @access private - */ - function getHTTPContentTypeCharset() { - if (count($this->requestAttachments) > 0) { - return false; - } - return parent::getHTTPContentTypeCharset(); - } - - /** - * processes SOAP message returned from server - * - * @param array $headers The HTTP headers - * @param string $data unprocessed response data from server - * @return mixed value of the message, decoded into a PHP type - * @access private - */ - function parseResponse($headers, $data) { - $this->debug('Entering parseResponse() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']); - $this->responseAttachments = array(); - if (strstr($headers['content-type'], 'multipart/related')) { - $this->debug('Decode multipart/related'); - $input = ''; - foreach ($headers as $k => $v) { - $input .= "$k: $v\r\n"; - } - $params['input'] = $input . "\r\n" . $data; - $params['include_bodies'] = true; - $params['decode_bodies'] = true; - $params['decode_headers'] = true; - - $structure = Mail_mimeDecode::decode($params); - - foreach ($structure->parts as $part) { - if (!isset($part->disposition) && (strstr($part->headers['content-type'], 'text/xml'))) { - $this->debug('Have root part of type ' . $part->headers['content-type']); - $root = $part->body; - $return = parent::parseResponse($part->headers, $part->body); - } else { - $this->debug('Have an attachment of type ' . $part->headers['content-type']); - $info['data'] = $part->body; - $info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : ''; - $info['contenttype'] = $part->headers['content-type']; - $info['cid'] = $part->headers['content-id']; - $this->responseAttachments[] = $info; - } - } - - if (isset($return)) { - $this->responseData = $root; - return $return; - } - - $this->setError('No root part found in multipart/related content'); - return ''; - } - $this->debug('Not multipart/related'); - return parent::parseResponse($headers, $data); - } -} - -/* - * For backwards compatiblity, define soapclientmime unless the PHP SOAP extension is loaded. - */ -if (!extension_loaded('soap')) { - class soapclientmime extends nusoap_client_mime { - } -} - -/** -* nusoap_server_mime server supporting MIME attachments defined at -* http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library. -* -* @author Scott Nichol -* @author Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list -* @version $Id: nusoapmime.php 6844 2011-06-03 14:46:51Z dMetzger $ -* @access public -*/ -class nusoap_server_mime extends nusoap_server { - /** - * @var array Each array element in the return is an associative array with keys - * data, filename, contenttype, cid - * @access private - */ - var $requestAttachments = array(); - /** - * @var array Each array element in the return is an associative array with keys - * data, filename, contenttype, cid - * @access private - */ - var $responseAttachments; - /** - * @var string - * @access private - */ - var $mimeContentType; - - /** - * adds a MIME attachment to the current response. - * - * If the $data parameter contains an empty string, this method will read - * the contents of the file named by the $filename parameter. - * - * If the $cid parameter is false, this method will generate the cid. - * - * @param string $data The data of the attachment - * @param string $filename The filename of the attachment (default is empty string) - * @param string $contenttype The MIME Content-Type of the attachment (default is application/octet-stream) - * @param string $cid The content-id (cid) of the attachment (default is false) - * @return string The content-id (cid) of the attachment - * @access public - */ - function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) { - if (! $cid) { - $cid = md5(uniqid(time())); - } - - $info['data'] = $data; - $info['filename'] = $filename; - $info['contenttype'] = $contenttype; - $info['cid'] = $cid; - - $this->responseAttachments[] = $info; - - return $cid; - } - - /** - * clears the MIME attachments for the current response. - * - * @access public - */ - function clearAttachments() { - $this->responseAttachments = array(); - } - - /** - * gets the MIME attachments from the current request. - * - * Each array element in the return is an associative array with keys - * data, filename, contenttype, cid. These keys correspond to the parameters - * for addAttachment. - * - * @return array The attachments. - * @access public - */ - function getAttachments() { - return $this->requestAttachments; - } - - /** - * gets the HTTP body for the current response. - * - * @param string $soapmsg The SOAP payload - * @return string The HTTP body, which includes the SOAP payload - * @access private - */ - function getHTTPBody($soapmsg) { - if (count($this->responseAttachments) > 0) { - $params['content_type'] = 'multipart/related; type="text/xml"'; - $mimeMessage = new Mail_mimePart('', $params); - unset($params); - - $params['content_type'] = 'text/xml'; - $params['encoding'] = '8bit'; - $params['charset'] = $this->soap_defencoding; - $mimeMessage->addSubpart($soapmsg, $params); - - foreach ($this->responseAttachments as $att) { - unset($params); - - $params['content_type'] = $att['contenttype']; - $params['encoding'] = 'base64'; - $params['disposition'] = 'attachment'; - $params['dfilename'] = $att['filename']; - $params['cid'] = $att['cid']; - - if ($att['data'] == '' && $att['filename'] <> '') { - if ($fd = fopen($att['filename'], 'rb')) { - $data = fread($fd, filesize($att['filename'])); - fclose($fd); - } else { - $data = ''; - } - $mimeMessage->addSubpart($data, $params); - } else { - $mimeMessage->addSubpart($att['data'], $params); - } - } - - $output = $mimeMessage->encode(); - $mimeHeaders = $output['headers']; - - foreach ($mimeHeaders as $k => $v) { - $this->debug("MIME header $k: $v"); - if (strtolower($k) == 'content-type') { - // PHP header() seems to strip leading whitespace starting - // the second line, so force everything to one line - $this->mimeContentType = str_replace("\r\n", " ", $v); - } - } - - return $output['body']; - } - - return parent::getHTTPBody($soapmsg); - } - - /** - * gets the HTTP content type for the current response. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type for the current response. - * @access private - */ - function getHTTPContentType() { - if (count($this->responseAttachments) > 0) { - return $this->mimeContentType; - } - return parent::getHTTPContentType(); - } - - /** - * gets the HTTP content type charset for the current response. - * returns false for non-text content types. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type charset for the current response. - * @access private - */ - function getHTTPContentTypeCharset() { - if (count($this->responseAttachments) > 0) { - return false; - } - return parent::getHTTPContentTypeCharset(); - } - - /** - * processes SOAP message received from client - * - * @param array $headers The HTTP headers - * @param string $data unprocessed request data from client - * @return mixed value of the message, decoded into a PHP type - * @access private - */ - function parseRequest($headers, $data) { - $this->debug('Entering parseRequest() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']); - $this->requestAttachments = array(); - if (strstr($headers['content-type'], 'multipart/related')) { - $this->debug('Decode multipart/related'); - $input = ''; - foreach ($headers as $k => $v) { - $input .= "$k: $v\r\n"; - } - $params['input'] = $input . "\r\n" . $data; - $params['include_bodies'] = true; - $params['decode_bodies'] = true; - $params['decode_headers'] = true; - - $structure = Mail_mimeDecode::decode($params); - - foreach ($structure->parts as $part) { - if (!isset($part->disposition) && (strstr($part->headers['content-type'], 'text/xml'))) { - $this->debug('Have root part of type ' . $part->headers['content-type']); - $return = parent::parseRequest($part->headers, $part->body); - } else { - $this->debug('Have an attachment of type ' . $part->headers['content-type']); - $info['data'] = $part->body; - $info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : ''; - $info['contenttype'] = $part->headers['content-type']; - $info['cid'] = $part->headers['content-id']; - $this->requestAttachments[] = $info; - } - } - - if (isset($return)) { - return $return; - } - - $this->setError('No root part found in multipart/related content'); - return; - } - $this->debug('Not multipart/related'); - return parent::parseRequest($headers, $data); - } -} - -/* - * For backwards compatiblity - */ -class nusoapservermime extends nusoap_server_mime { -} - -?> diff --git a/modules/mondialrelay/logo_hd.png b/modules/mondialrelay/logo_hd.png new file mode 100755 index 0000000000000000000000000000000000000000..e919c703f91a80962c6881200cd46bfe9d88be0c GIT binary patch literal 2996 zcmV;l3rqBgP)5ng_9^+>js=47caI*|W3nyL+=Yckj8s@6684-g|a8XFuos&hK~5 z*|RzEc$|ez%{j}ebi4Y$C-ZHADS1@gQlSoY)2oGV{kr`|@kd4cKx5eMWzJXv=HQ|_ zAW;)Ad`6fYim3%bUm!$b>EH#SBVz%pwJ)LqyUGNVWVH_1I@N*@3)%`K4Oj&!YTY7& zm=gGhgf&POyl221C_t{^+iIJ3kTfW!J%X@U8?0~l#+F-R;s!9rzysA2J zA^6G{m9!G8N(|VD8Z1S-n_qo{_q59w%U+8WraAv)OQZbrlngn#qG_YA^p`3(%MQ5= zHMk~g1B)e7WzS&^09R)%;1dI~=dc=pr5PDQ800JMyF;=AUI4(-3?#&xj;17S1}l;) zQ*MS|c#E;V_Y)`NX_T~CAgKVuaU|mmO$fbp@MLxsXk)xQ^vbnCO^x;H_rXw*PSj?iCwXdpiH6hRp;xU0`Q!x|>a{ zzMV|8Oqt1xew>y3@D4U(IKD%C-NJo;?L}S`3W=S5cT%pXnB1zf?4;_xNwu;BeY|HLsk=f1yFPhA@ zRZ=g6h6mKLT6xI2puEtq@5Sj6 z%Ma#Fn!wJ!-ZZj)WD?g-bgc<1t~TsnXzKQSjF;z~#JZS4pEqq`5*9?6wP}O4k6tDH zLt^p-*UV0R>;^V_v+*5Wh-XjS@nhHHKCyeHVRbt^boS0o_bI(xPO69>FnZkl zn9d*loSk|0&4kA^=PXMIcYf2W+W(K9HaB@aZ`w>W;!Oef^q!X$m;$cY#|m^%@@%%4Kuzz(zF10y3BNF7Ge3{8-HVw#fz22 z&CVZdXG5pXu(`XR)XZ~+IOvYt!INBC&K|4?>j&(JKuWT)4r47?36rTtF59l)ZNRvo_WPJ+)4IY zdaHou0T#q9MDk)uuACQD(qLr)QBd$%c=L@~`)rq&_ItPUNTJ8z7$P5`ii1hv6m?Y+ zU{WS4|mwqAMm^)9SQ_)qS6=a za~0WC3tqk5s`3bH@S9nkkL*%_8uEv}abDn^;&8k3W7*>%;^5q%;o=1uej#BnA*@UD z&scr8uipUW^h>YUrnT#to4H|)Boe)kVEr~i65_Mz*p()Eg=P3;) z-J5GM#+J=v+o;9=-E&ZL{OoEk@*U*Be_(*8EWOe8`}U1>26NNHj84z^PtLI%6P5+M zBTE*0Ok?dzMV@CqY@GCfT8wupw%6=*ZhHe>{x~objkkN+flAbt6qFWQYv-}{w8Mo( zGMi^iCcx&!ObbWJa$fFXD=*KqslD*bgPyh%7+|}$Dw9`Qx3ft9`P1vlW>(Ri_8u|{ zw_Q_%Q8K&Q+qo(D=c)oR(dG$kUfNJMDe>%H=igKPf(>}P2!qTzyKf{Ew|uV=rk$^Xk*uIPWl|ak%b>{eYpuOX+%y9KHnW*_ItGHtO;p&GA<;*6r6ex| z*rR#w-SwKmRC{$Y6-V>IEw0x?+?=ZCs0gq}^NhLHW>al7)Am!0Q0rlWooX-Q=2R(^ z?@dbd+Br;aPnD+K|9M*oc+065)9w^CVB!KoDzh_+csZ3%L531AroN`@Z7Fs$AkFiu zoK$@8a!0_Z#dt}G`8*dp-%n|Nq&CrhXG)4GugNN%vnN9f81t^o5|iLZ?JO;+@-_7~ zhzaWHoa7!#6W#yj5zF`~1|I=eNsh9GxKjLuO_(or+G2 zj5N_s!-VYrPs%^)9$*-TKIT@ar1DUIz6VXTpXGj91153-Hv!NaMa<|{$6GD z$~+e9Bz-(9o=DIObEW+h63tB4-bR4ULVJqY{7S7EO#apD2vhKEFba&@%6FpcQJ81D z=0M-M;iZu1n-`oj45Eqek_$DsgKmSgY60Lzx({*#K1BCHS{*_gjJ~zAbT6b-VQxkI z09?s>x);)^9&AOJR7dwiI@M`$FeeR9dK=vnX|zpcYUt>wqmW4ob?7a!23T#2Yw7-E zylPdJ%v^&3xrKkMrF)dITB|Z-wt!X0^#nO%;aZ}hoOs;6E4n#nSrz}l?D7cRyHG2p zn&n2jA00=N)C0=+)T3ET z^`~sE`7sqDQz44|4nMUr6o5Sx00CMQ1Zchvex|kejXH=&O{O(wj!(x*X#<>OVPG!s quhJEiAlkf67lp0000\ \ @@ -110,8 +126,9 @@ function checkSucceedGenerateTickets(json) \ \ '); - else - { + } + else + { $('#detailHistory_' + id_order).children('#URLA4_' + id_order).html(''); $('#detailHistory_' + id_order).children('#URLA5_' + id_order).html(''); $('#detailHistory_' + id_order).children('#expeditionNumber_' + id_order).html(''); @@ -184,9 +201,6 @@ function generateTicketsAjax() function displayDeletedHistoryInformation() { - :x - - $('input[name="history_id_list[]"]:checked').each(function() { $(this).parent().parent().css('background-color', '#FFE2E3'); @@ -194,13 +208,16 @@ function displayDeletedHistoryInformation() displayBackHistoriesSubmitButton(); } +/* +** Manage the removed histories id +*/ function checkDeletedHistoriesId(json) { if (json && json.success) { // Allow to wait the end of the loop to manage unremoved item i = 0; - for (numberHistoryId in json.success.deletedListId) + for (numberHistoryId in json.success.deletedListId) { $('#PS_MRHistoryId_' + json.success.deletedListId[numberHistoryId]).parent().parent().fadeOut('fast', function() { @@ -218,6 +235,9 @@ function checkDeletedHistoriesId(json) displayBackHistoriesSubmitButton(); } +/* +** Delete the histories selected by the merchant +*/ function deleteSelectedHistories() { var history_id_list = new Array(); @@ -252,6 +272,471 @@ function deleteSelectedHistories() }); } +/* +** Display a fancy box displaying details about the +** backup of the database +*/ +function PS_MRGetUninstallDetail() +{ + $.ajax( + { + type: 'POST', + url: _PS_MR_MODULE_DIR_ + 'ajax.php', + data: {'method' : 'uninstallDetail', + 'action' : 'showFancy', + 'href' : targetButton, + 'mrtoken' : mrtoken}, + dataType: 'json', + success: function(json) + { + ((json.html.length) ? + $.fancybox(json.html, + { + 'autoDimensions' : false, + 'width' : 450, + 'height' : 'auto', + 'transitionIn' : 'none', + 'transitionOut' : 'none', + 'onComplete' : function() + { + PS_MRHandleUninstallButton(); + + // Rewrite some css properties of Fancybox + $('#fancybox-wrap').css('width', ''); + $('#fancybox-content').css('background-color', ''); + $('#fancybox-content').css('border', ''); + } + }) + : ''); + }, + error: function(xhr, ajaxOptions, thrownError) + { + //console.log(thrownError); + // Put debug to see error detail + } + }); + return false; +} + +/* +** Handle the button when a user clicked on the uninstall button +*/ +function PS_MRHandleUninstallButton() +{ + $('#PS_MR_BackupAction').click(function() + { + $.fancybox.close(); + PS_MRBackupDatabase(); + }); + + $('#PS_MR_UninstallAction').click(function() + { + window.location.href = targetButton; + $.fancybox.close(); + return true; + }); + + $('#PS_MR_StopUninstall').click(function() + { + $.fancybox.close(); + return false; + }); +} + +/* +** ajax call to keep the database of the module safe +*/ +function PS_MRBackupDatabase() +{ + $.ajax( + { + type: 'POST', + url: _PS_MR_MODULE_DIR_ + 'ajax.php', + data: {'method' : 'uninstallDetail', + 'action' : 'backupAndUninstall', + 'mrtoken' : mrtoken}, + dataType: 'json', + success: function(json) + { + targetButton += '&keepDatabase=true'; + window.location.href = targetButton; + }, + error: function(xhr, ajaxOptions, thrownError) + { + //console.log(thrownError); + // Put debug to see error detail + } + }); +} + +/* +** Add / update a entry to the selected carrier to the mr_selected table +** with the selected relay point information +*/ +function PS_MRAddSelectedRelayPointInDB(relayPointNumber, id_carrier) +{ + // Ajax call to add the selection in the database (compatibility for 1.3) + // But keep this way to add a selection better that the hook + $.ajax({ + type: 'POST', + url: _PS_MR_MODULE_DIR_ + 'ajax.php', + data: {'method' : 'addSelectedCarrierToDB', + 'relayPointInfo' : relayPointDataContainers[relayPointNumber], + 'id_carrier' : id_carrier, + 'id_mr_method' : PS_MRCarrierMethodList[id_carrier], + 'mrtoken' : mrtoken}, + success: function(json) + { + // console.log(json); + }, + error: function(xhr, ajaxOptions, thrownError) + { + //console.log(xhr); + //console.log(thrownError); + //console.log(ajaxOptions); + } + }); +} + +/* +** Add / update a entry to the selected carrier to the mr_selected table +** Without relay point information +*/ +function PS_MRAddSelectedCarrierInDB(id_carrier) +{ + PS_MRHideLastRelayPointList(); + // Make the request + $.ajax({ + type: 'POST', + url: _PS_MR_MODULE_DIR_ + 'ajax.php', + data: {'method' : 'addSelectedCarrierToDB', + 'id_carrier' : id_carrier, + 'id_mr_method' : PS_MRCarrierMethodList[id_carrier], + 'mrtoken' : mrtoken}, + success: function(json) + { + //console.log(json); + }, + error: function(xhr, ajaxOptions, thrownError) + { + //console.log(xhr); + //console.log(thrownError); + //console.log(ajaxOptions); + } + }); +} + +function PS_MRCarrierSelectedProcess(carrierSelected, id_carrier, MRLivraisonType) +{ + if (MRLivraisonType != 'LD1' && MRLivraisonType != 'LDS') + // Seek Relay point if it doesn't a home delivery mode + PS_MRGetRelayPoint(carrierSelected); + else + // Simply add the selected carrier to the db, relay information will be empty + PS_MRAddSelectedCarrierInDB(id_carrier); +} + +/* +** Hide the last displayed relay point list +*/ +function PS_MRHideLastRelayPointList() +{ + $('.PS_MRSelectedCarrier').fadeOut('fast'); +} + +/* +** Link the generated relay point to an handle click +** Allow to add the selected relay point in the database +*/ +function PS_MRHandleSelectedRelayPoint() +{ + // Link all new generated relay point Selected button to an action + $('.PS_MRSelectRelayPointButton').click(function() + { + // Unselect all previous selection (normaly juste one) + $('.PS_MRFloatRelayPointSelected').each(function() + { + $(this).attr('class', 'PS_MRFloatRelayPointSelecteIt'); + $(this).children('a').text(PS_MRTranslationList['Select']); + }); + // Make the Selection + $(this).text(PS_MRTranslationList['Selected']); + $(this).parent().attr('class', 'PS_MRFloatRelayPointSelected'); + + // Get the info about the relay point (relayPoint_RelayPointNumber_IdCarrier) + tab = $(this).parent().parent().attr('id').split('_'); + + // Store Separated data for the ajax query + if (tab.length == 3) + { + relayPointNumber = tab[1]; + id_carrier = tab[2]; + PS_MRAddSelectedRelayPointInDB(relayPointNumber, id_carrier); + } + }); +} + + +// Display the relay point fetched +function PS_MRDisplayRelayPoint(json, blockContent, carrier_id) +{ + if (typeof json != 'undefined' && typeof blockContent != 'undefined') + { + numberDisplayed = 0; + + PS_MRCreateGmap(carrier_id); + blockContent.fadeOut('fast', function() + { + $(this).children('td').html(''); + for (relayPoint in json.success) + { + // Check if the the content wasn't already displayed + contentBlockid = 'relayPoint_' + json.success[relayPoint].Num + '_' + carrier_id; + if (!$('#' + contentBlockid).size()) + { + $('
    \ + \ +

    ' + json.success[relayPoint].LgAdr1 + '
    ' + json.success[relayPoint].LgAdr3 + + ' - ' + json.success[relayPoint].CP + ' - ' + json.success[relayPoint].Ville + + ' ' + json.success[relayPoint].Pays + '

    \ + \ +
    ').appendTo($(this).children('td')); + + // Store all the object content to prevent an ajax request + relayPointDataContainers[json.success[relayPoint].Num] = json.success[relayPoint]; + ++numberDisplayed; + PS_MRAddGMapMarker(carrier_id, json.success[relayPoint].Num, contentBlockid); + } + } + PS_MRHandleSelectedRelayPoint(); + $(this).fadeIn('fast'); + }); + } +} + +// Fetch the relay point +function PS_MRFetchRelayPoint(carrierSelected) +{ + carrier_id = carrierSelected.val(); + + // Block is an input, we need the 'tr' element + blockTR = carrierSelected.parent().parent(); + // Add a new line to the table after the clicked parent element + blockTR.after(' \ + \ +
    \ + \ +
    \ + '); + + fetchingRelayPoint[carrier_id] = $('#PS_MRSelectedCarrier_' + carrier_id); + $.ajax( + { + type: 'POST', + url: _PS_MR_MODULE_DIR_ + 'ajax.php', + data: {'method' : 'MRGetRelayPoint', + 'id_carrier' : carrier_id, + 'mrtoken' : mrtoken}, + dataType: 'json', + success: function(json) + { + if (json && json.success) + PS_MRDisplayRelayPoint(json, $('#PS_MRSelectedCarrier_' + carrier_id), carrier_id); + }, + error: function(xhr, ajaxOptions, thrownError) + { + //console.log(thrownError); + // Put debug to see error detail + } + }); +} + +// Display the relay point of a selected Carrier and keep fetched data +// in the html page (cache) +function PS_MRGetRelayPoint(carrierSelected) +{ + carrier_id = carrierSelected.val(); + + // Init back the inital view, hide existing element, (keep cached) + element = 0; + totalElement = $('.PS_MRSelectedCarrier').size(); + + // Check if the element has already been fetched + if (totalElement) + // It Works like a foreach + $('.PS_MRSelectedCarrier').fadeOut('fast', function() + { + if ((element + 1) >= totalElement) + { + // Check if the user already clicked and if the process is done + if (typeof fetchingRelayPoint[carrier_id] != 'undefined') + { + fetchingRelayPoint[carrier_id].fadeIn('fast'); + return ; + } + // If the element isn't cached, we fetch it + PS_MRFetchRelayPoint(carrierSelected); + } + ++element; + }); + else + PS_MRFetchRelayPoint(carrierSelected); +} + +/* +** Create the Gmap Block and cache the js object for the carrier +*/ +function PS_MRCreateGmap(id_carrier) +{ + $('body').prepend('\ + \ + \ +
    \ +
    '); + $('#PS_MRGmap_' + id_carrier).gmap3( + { + action: 'init', + callback: function(result) + { + GmapList[id_carrier] = $(this); + // Can't set the display to none by default (bug due to + // navigator that tell to google that content size = 0 + //$(this).toggle('fast'); + } + } + ); +} + +/* +** Resize the map when the div got changement about dimension / position and displaying +*/ +function PS_MRGmapResizeEvent($map) +{ + gmap = $map.gmap3({action:'get'}); + google.maps.event.trigger(gmap, 'resize'); +} + +/* +** Move the view of the gmap to a marker +** liable to the relay point +*/ +function PS_MRGmapPlaceViewOnMarker($map, marker) +{ + $map.gmap3( + { + action:'panTo', + args:[marker.position], + callback: function() + { + (function(m) + { + setTimeout(function() + { + m.setAnimation(google.maps.Animation.BOUNCE); + }, 200); + })(marker); + // marker.setAnimation(google.maps.Animation.BOUNCE); + } + }); +} + +/* +** Stop all dancing marker of the current selected carrier +*/ +function PS_MRStopDancingMarkers(currentMarkerList) +{ + for (markerNumber in currentMarkerList) + if (currentMarkerList[markerNumber] != undefined) + if (currentMarkerList[markerNumber].getAnimation() != null) + currentMarkerList[markerNumber].setAnimation(null); +} + +/* +** Display the Gmap of the selected relay point +*/ +function PS_MRDisplayGmap(contentBlockid, $map) +{ + tab = contentBlockid.split('_'); + relayPointNumber = tab[1]; + id_carrier = tab[2]; + + // Stop the dancing marker of the current carrier + PS_MRStopDancingMarkers(markerList[id_carrier]); + if ($('#PS_MRGmap_' + id_carrier).css('display') == 'none') + { + $('#' + contentBlockid).after($('#PS_MRGmap_' + id_carrier)); + $('#PS_MRGmap_' + id_carrier).slideDown('fast', function() + { + PS_MRGmapResizeEvent($map); + PS_MRGmapPlaceViewOnMarker($map, markerList[id_carrier][relayPointNumber]); + }); + } + else + { + previousElem = $('#PS_MRGmap_' + id_carrier).prev(); + //$('#' + contentBlockid).after($('#PS_MRGmap_' + id_carrier)); + $('#PS_MRGmap_' + id_carrier).toggle('fast', function() + { + if (previousElem.attr('id') != contentBlockid) + { + $('#' + contentBlockid).after($(this)); + $('#PS_MRGmap_' + id_carrier).slideDown('fast', function() + { + PS_MRGmapPlaceViewOnMarker($map, markerList[id_carrier][relayPointNumber]); + }); + } + }); + } +} + +/* +** Add a new Marker to a Gmap for a carrier using the +** relay point information +*/ +function PS_MRAddGMapMarker(id_carrier, relayPointNumber, contentBlockid) +{ + // Check if the gmap has been properly created + if (GmapList[id_carrier] == undefined) + return ; + relayInfo = relayPointDataContainers[relayPointNumber]; + + // Add Marker to the map + fullFormatedAddress = relayInfo.LgAdr1 + ' ' + relayInfo.LgAdr3 + ' ' + + relayInfo.CP + ' ' + relayInfo.Ville + ' ' + relayInfo.Pays; + GmapList[id_carrier].gmap3( + { + action: 'addMarker', + address: fullFormatedAddress, + map: + { + center: true, + zoom: 14 + }, + callback: function(marker) + { + if (marker) + { + // Check if the a marker list exist for the carrier, + if (markerList[id_carrier] == undefined) + markerList[id_carrier] = new Object(); + + // Store the marker in the markerList of the carrier + markerList[id_carrier][relayPointNumber] = marker; + + // Link all relay point line info to an action + $('#' + contentBlockid).children('p').click(function() + { + PS_MRDisplayGmap($(this).parent().attr('id'), GmapList[id_carrier]); + }); + return true; + } + } + }); + return false; +} + $(document).ready(function() { $('#toggleStatusOrderList').click(function() @@ -271,3 +756,5 @@ $(document).ready(function() deleteSelectedHistories(); }); }); + + diff --git a/modules/mondialrelay/mondialrelay.php b/modules/mondialrelay/mondialrelay.php index aa9745189..b2db68dfd 100755 --- a/modules/mondialrelay/mondialrelay.php +++ b/modules/mondialrelay/mondialrelay.php @@ -24,10 +24,12 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ + if (!defined('_CAN_LOAD_FILES_')) exit; require_once(_PS_MODULE_DIR_.'mondialrelay/classes/MondialRelayClass.php'); +require_once(_PS_MODULE_DIR_.'mondialrelay/classes/MRTools.php'); class MondialRelay extends Module { @@ -37,6 +39,7 @@ class MondialRelay extends Module public static $modulePath = ''; public static $moduleURL = ''; + static public $MRToken = ''; // Added for 1.3 compatibility const ONLY_PRODUCTS = 1; @@ -47,11 +50,15 @@ class MondialRelay extends Module const ONLY_WRAPPING = 6; const ONLY_PRODUCTS_WITHOUT_SHIPPING = 7; + // SQL FILTER ORDER + const NO_FILTER = 0; + const WITHOUT_HOME_DELIVERY = 1; + public function __construct() { $this->name = 'mondialrelay'; $this->tab = 'shipping_logistics'; - $this->version = '1.6'; + $this->version = '1.7'; parent::__construct(); @@ -61,7 +68,7 @@ class MondialRelay extends Module self::initModuleAccess(); - // Call everytime if the merchant make a replace file update + // Call everytime to prevent the changement of the module by a recent one $this->_updateProcess(); } @@ -105,7 +112,6 @@ class MondialRelay extends Module if (!$result) { /*tab install */ - $result = Db::getInstance()->getRow(' SELECT position FROM `' . _DB_PREFIX_ . 'tab` @@ -135,11 +141,13 @@ class MondialRelay extends Module (`id_profile`,`id_tab`,`view`,`add`,`edit`,`delete`) VALUES('.$profile['id_profile'].', '.(int)($id_tab).', 1, 1, 1, 1)'); - @copy(_PS_MODULE_DIR_.'mondialrelay/AdminMondialRelay.gif', _PS_IMG_DIR_.'t/AdminMondialRelay.gif'); + @copy(_PS_MODULE_DIR_.'mondialrelay/AdminMondialRelay.gif', _PS_IMG_DIR_.'/AdminMondialRelay.gif'); } - Configuration::updateValue('MONDIAL_RELAY_1_4', '1'); - Configuration::updateValue('MONDIAL_RELAY_INSTALL_UPDATE_1', 1); + // If module isn't installed, set default value + if (!Configuration::get('MONDIAL_RELAY')) + { + Configuration::updateValue('MONDIAL_RELAY', $this->version); Configuration::updateValue('MONDIAL_RELAY_ORDER_STATE', 3); Configuration::updateValue('MONDIAL_RELAY_SECURE_KEY', md5(time().rand(0,10))); Configuration::updateValue('MR_GOOGLE_MAP', '1'); @@ -149,6 +157,17 @@ class MondialRelay extends Module Configuration::updateValue('MR_LANGUAGE', ''); Configuration::updateValue('MR_WEIGHT_COEF', ''); Configuration::updateValue('PS_MR_SHOP_NAME', Configuration::get('PS_SHOP_NAME')); + } + else + { + // Reactive transport if database wasn't remove at the last uninstall + Db::getInstance()->ExecuteS(' + UPDATE `'._DB_PREFIX_.'carrier` c, `'._DB_PREFIX_.'mr_method` m + SET `deleted` = 0 + WHERE c.id_carrier = m.id_carrier'); + if (Configuration::get('MONDIAL_RELAY') < $this->version) + ;// TODO : ADD upgrade process depending of the last and new version + } return true; } @@ -173,25 +192,62 @@ class MondialRelay extends Module return true; } - public function uninstall() + public function uninstallCommonData() { - if (!parent::uninstall()) - return false; + // Tab uninstall + $result = Db::getInstance()->getRow(' + SELECT id_tab + FROM `' . _DB_PREFIX_ . 'tab` + WHERE class_name="AdminMondialRelay"'); - /* Tab uninstallation */ - $result = Db::getInstance()->getRow('SELECT id_tab FROM `'._DB_PREFIX_.'tab` WHERE class_name = "AdminMondialRelay"'); if ($result) { $id_tab = $result['id_tab']; if (isset($id_tab) && !empty($id_tab)) { - Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'tab WHERE id_tab = '.(int)$id_tab); - Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'tab_lang WHERE id_tab = '.(int)$id_tab); - Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'access WHERE id_tab = '.(int)$id_tab); + Db::getInstance()->Execute('DELETE FROM ' . _DB_PREFIX_ . 'tab WHERE id_tab = '.(int)($id_tab)); + Db::getInstance()->Execute('DELETE FROM ' . _DB_PREFIX_ . 'tab_lang WHERE id_tab = '.(int)($id_tab)); + Db::getInstance()->Execute('DELETE FROM ' . _DB_PREFIX_ . 'access WHERE id_tab = '.(int)($id_tab)); } } - if (!Configuration::deleteByName('MONDIAL_RELAY_1_4') || + if (_PS_VERSION_ >= '1.4' && + !Db::getInstance()->Execute(' + UPDATE '._DB_PREFIX_ .'carrier + SET `active` = 0, `deleted` = 1 + WHERE `external_module_name` = "mondialrelay"')) + return false; + else if (!Db::getInstance()->Execute(' + UPDATE '._DB_PREFIX_ .'carrier + SET `active` = 0, `deleted` = 1 + WHERE `name` = "mondialrelay"')) + return false; + return true; + } + + public function uninstall() + { + if (!parent::uninstall()) + return false; + + // Uninstall data that doesn't need to be keep + if (!$this->uninstallCommonData()) + return false; + + if (Tools::getValue('keepDatabase')) + { + // Retro Compatibility for older Version than 1.7 + if (Configuration::get('MONDIAL_RELAY_1_4')) + { + Configuration::updateValue('MONDIAL_RELAY', '1.6'); + Configuration::deleteByName('MONDIAL_RELAY_1_4'); + Configuration::deleteByName('MONDIAL_RELAY_INSTALL_UPDATE_1'); + } + return true; + } + + // MondialRelay Configuration + if (!Configuration::deleteByName('MONDIAL_RELAY') || !Configuration::deleteByName('MONDIAL_RELAY_INSTALL_UPDATE') || !Configuration::deleteByName('MONDIAL_RELAY_SECURE_KEY') || !Configuration::deleteByName('MONDIAL_RELAY_ORDER_STATE') || @@ -200,11 +256,15 @@ class MondialRelay extends Module !Configuration::deleteByName('MR_CODE_MARQUE') || !Configuration::deleteByName('MR_KEY_WEBSERVICE') || !Configuration::deleteByName('MR_WEIGHT_COEF') || - !Configuration::deleteByName('PS_MR_SHOP_NAME') || - !Db::getInstance()->Execute('DROP TABLE '._DB_PREFIX_ .'mr_historique, '._DB_PREFIX_ .'mr_method, '._DB_PREFIX_ .'mr_selected')) + !Configuration::deleteByName('PS_MR_SHOP_NAME')) return false; - if (_PS_VERSION_ >= '1.4' && !Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'carrier SET `active` = 0, `deleted` = 1 WHERE `external_module_name` = "mondialrelay"')) + // Drop databases + if (!Db::getInstance()->Execute(' + DROP TABLE + '._DB_PREFIX_ .'mr_historique, + '._DB_PREFIX_ .'mr_method, + '._DB_PREFIX_ .'mr_selected')) return false; else if (!Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'carrier SET `active` = 0, `deleted` = 1 WHERE `name` = "mondialrelay"')) return false; @@ -212,18 +272,37 @@ class MondialRelay extends Module return true; } + /* + ** UpdateProcess if merchant update the module without a + ** normal installation + */ private function _updateProcess() { + if (Module::isInstalled('mondialrelay') && + (($installedVersion = Configuration::get('MONDIAL_RELAY')) || + $installedVersion = Configuration::get('MONDIAL_RELAY_1_4')) + && $installedVersion < $this->version) + { + if ($installedVersion < '1.4') $this->_update_v1_4(); + if ($installedVersion < '1.4.2') $this->_update_v1_4_2(); } + // Process update done just try to update the new configuration value + if (Configuration::get('MONDIAL_RELAY_1_4')) + { + Configuration::updateValue('MONDIAL_RELAY', $this->version); + Configuration::deleteByName('MONDIAL_RELAY_1_4'); + } + } + + /* + ** Use if the mechant was using Prestashop 1.3 and + ** now use 1.4 or more recent + */ private function _update_v1_4() { - if (Module::isInstalled('mondialrelay') && - !Configuration::get('MONDIAL_RELAY_1_4')) - { - Configuration::updateValue('MONDIAL_RELAY_1_4', 1); Db::getInstance()->Execute(' UPDATE `'._DB_PREFIX_.'carrier` SET @@ -232,12 +311,14 @@ class MondialRelay extends Module `external_module_name` = "mondialrelay", `shipping_method` = 1 - WHERE `id_carrier` IN (SELECT `id_mr_method` FROM `'._DB_PREFIX_.'mr_method`)'); - return true; + WHERE `id_carrier` + IN (SELECT `id_mr_method` + FROM `'._DB_PREFIX_.'mr_method`)'); } - return false; - } + /* + ** Add new Hook for the last recent version >= 1.4.2 + */ private function _update_v1_4_2() { if (!$this->isRegisteredInHook('newOrder')) @@ -246,6 +327,38 @@ class MondialRelay extends Module $this->registerHook('BackOfficeHeader'); } + /* + ** Get the content to ask for a backup of the database + */ + private function askForBackup($href) + { + return 'targetButton = \''.$href.'\'; + PS_MRGetUninstallDetail();'; + } + + /* + ** OnClick for input fields under the module list fields action + */ + public function onclickOption($type, $href = false) + { + $content = ''; + + switch($type) + { + case 'desactive': + break; + case 'reset': + break; + case 'delete': + break; + case 'uninstall': + $content = $this->askForBackup($href); + break; + default: + } + return $content; + } + /* ** Init the access directory module for URL and file system ** Allow a compatibility for Presta < 1.4 @@ -253,6 +366,7 @@ class MondialRelay extends Module public static function initModuleAccess() { self::$modulePath = _PS_MODULE_DIR_. 'mondialrelay/'; + self::$MRToken = sha1('mr'._COOKIE_KEY_.'mrAgain'); $protocol = (Configuration::get('PS_SSL_ENABLED') || (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://' : 'http://'; @@ -282,21 +396,20 @@ class MondialRelay extends Module { DB::getInstance()->Execute(' UPDATE `'._DB_PREFIX_.'mr_selected` - SET `id_order` = '.(int)$params['order']->id.' - WHERE `id_cart` = '.(int)$params['cart']->id); + SET `id_order` = '.$params['order']->id.' + WHERE `id_cart` = '.$params['cart']->id); } public function hookBackOfficeHeader() { $cssFilePath = $this->_path.'style.css'; $jsFilePath= $this->_path.'mondialrelay.js'; - $mrtoken = sha1('mr'._COOKIE_KEY_.'mrAgain'); return ' '; } @@ -372,34 +485,7 @@ class MondialRelay extends Module $this->_html .= '
    '.$this->l('Settings updated').'
    '; } } - - public function getmrth($id_lang, $active = false, $id_zone = false, $id_iso_code = false) - { - if (!Validate::isBool($active)) - die(Tools::displayError()); - $carriers = Db::getInstance()->ExecuteS(' - SELECT c.*, cl.delay - FROM `'._DB_PREFIX_.'mr_method` m - LEFT JOIN `'._DB_PREFIX_.'carrier` c ON (c.`id_carrier` = m.`id_carrier` and c.`deleted` = 0) - LEFT JOIN `'._DB_PREFIX_.'carrier_lang` cl ON (c.`id_carrier` = cl.`id_carrier` AND cl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->sqlLang('cl').') - LEFT JOIN `'._DB_PREFIX_.'carrier_zone` cz ON (cz.`id_carrier` = c.`id_carrier`)'. - ($id_zone ? 'LEFT JOIN `'._DB_PREFIX_.'zone` z ON (z.`id_zone` = '.(int)$id_zone.')' : '').' - WHERE 1 '. - ($id_iso_code ? ' AND m.`mr_Pays_list` LIKE \'%'.pSQL($id_iso_code).'%\'' : ''). - ($active ? ' AND c.`active` = 1' : ''). - ($id_zone ? ' AND cz.`id_zone` = '.(int)$id_zone.' - AND z.`active` = 1' : '').' - GROUP BY c.`id_carrier`'); - - if (!is_array($carriers)) - $carriers = array(); - foreach ($carriers as $key => $carrier) - if ($carrier['name'] == '0') - $carriers[$key]['name'] = Configuration::get('PS_SHOP_NAME'); - return $carriers; - } - public function hookOrderDetail($params) { $carrier = $params['carrier']; @@ -428,52 +514,11 @@ class MondialRelay extends Module return $this->display(__FILE__, 'orderDetail.tpl'); } - public function hookProcessCarrier($params, $redirect = true) + /* + ** No need anymore + */ + public function hookProcessCarrier($params) { - $cart = $params['cart']; - $result_MR = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'mr_method` WHERE `id_carrier` = '.(int)($cart->id_carrier)); - if (count($result_MR) > 0) - { - $mr_mode_liv = $result_MR[0]['mr_ModeLiv']; - if ($mr_mode_liv == 'LDS' || $mr_mode_liv == 'LD1') - { - $deliveryAddressLDS = new Address((int)($cart->id_address_delivery)); - if (Validate::isLoadedObject($deliveryAddressLDS) AND ($deliveryAddressLDS->id_customer == $cart->id_customer)) - { - Db::getInstance()->delete(_DB_PREFIX_.'mr_selected','id_cart = "'.(int)($cart->id).'"'); - $mrselected = new MondialRelayClass(); - $mrselected->id_customer = $cart->id_customer; - $mrselected->id_method = $result_MR[0]['id_mr_method']; - $mrselected->id_cart = $cart->id; - $mrselected->MR_Selected_Num = $mr_mode_liv; - $mrselected->save(); - } - } - else if (!Configuration::get('PS_ORDER_PROCESS_TYPE')) - { - // Redirect is set to false in Presta 1.3 for compatibility - // when this method is called under an ajax process - if (empty($_POST['MR_Selected_Num_'.$cart->id_carrier]) && $redirect) // Case error : the customer didn't choose a 'relais' but selected Relais Colis TNT as a carrier - Tools::redirect('index.php?controller=order&step=2&mr_null'); - else - { - Db::getInstance()->delete(_DB_PREFIX_.'mr_selected','id_cart = "'.(int)($cart->id).'"'); - $mrselected = new MondialRelayClass(); - $mrselected->id_customer = $cart->id_customer; - $mrselected->id_method = $result_MR[0]['id_mr_method']; - $mrselected->id_cart = $cart->id; - $mrselected->MR_Selected_Num = $_POST['MR_Selected_Num_'.$cart->id_carrier]; - $mrselected->MR_Selected_LgAdr1 = $_POST['MR_Selected_LgAdr1_'.$cart->id_carrier]; - $mrselected->MR_Selected_LgAdr2 = $_POST['MR_Selected_LgAdr2_'.$cart->id_carrier]; - $mrselected->MR_Selected_LgAdr3 = $_POST['MR_Selected_LgAdr3_'.$cart->id_carrier]; - $mrselected->MR_Selected_LgAdr4 = $_POST['MR_Selected_LgAdr4_'.$cart->id_carrier]; - $mrselected->MR_Selected_CP = $_POST['MR_Selected_CP_'.$cart->id_carrier]; - $mrselected->MR_Selected_Ville = $_POST['MR_Selected_Ville_'.$cart->id_carrier]; - $mrselected->MR_Selected_Pays = $_POST['MR_Selected_Pays_'.$cart->id_carrier]; - $mrselected->save(); - } - } - } } public function hookupdateCarrier($params) @@ -501,92 +546,82 @@ class MondialRelay extends Module } } + /* + ** Get a carrier list liable to the module + */ + public function _getCarriers() + { + global $cookie; + + $id_lang = (int)$cookie->id_lang; + + // Query don't use the external_module_name to keep the + // 1.3 compatibility + $carriers = Db::getInstance()->ExecuteS(' + SELECT + c.id_carrier, + c.range_behavior, + m.id_mr_method, + m.mr_ModeLiv, + cl.delay + FROM `'._DB_PREFIX_.'mr_method` m + LEFT JOIN `'._DB_PREFIX_.'carrier` c + ON c.`id_carrier` = m.`id_carrier` + LEFT JOIN `'._DB_PREFIX_.'carrier_lang` cl + ON c.`id_carrier` = cl.`id_carrier` + WHERE c.`deleted` = 0 + AND c.active = 1'); + + if (!is_array($carriers)) + $carriers = array(); + return $carriers; + } + public function hookextraCarrier($params) { global $nbcarriers; - if (Configuration::get('MR_ENSEIGNE_WEBSERVICE') == '' OR - Configuration::get('MR_CODE_MARQUE') == '' OR - Configuration::get('MR_KEY_WEBSERVICE') == '' OR + if (Configuration::get('MR_ENSEIGNE_WEBSERVICE') == '' || + Configuration::get('MR_CODE_MARQUE') == '' || + Configuration::get('MR_KEY_WEBSERVICE') == '' || Configuration::get('MR_LANGUAGE') == '') return ''; - $totalweight = Configuration::get('MR_WEIGHT_COEF') * $this->context->cart->getTotalWeight(); - - if (Validate::isUnsignedInt($this->context->cart->id_carrier)) - { - $carrier = new Carrier((int)($this->context->cart->id_carrier)); - if ($carrier->active AND !$carrier->deleted) - $checked = (int)($this->context->cart->id_carrier); - } - if (!isset($checked) OR $checked == 0) - $checked = (int)(Configuration::get('PS_CARRIER_DEFAULT')); - $address = new Address((int)($this->context->cart->id_address_delivery)); $id_zone = Address::getZoneById((int)($address->id)); - $country = new Country((int)($address->id_country)); + //$country = new Country((int)($address->id_country)); + $carriersList = self::_getCarriers(); - $query = self::getmrth($this->context->language->id, true, (int)($country->id_zone), $country->iso_code); - - $resultsArray = array(); - $i = 0; - foreach ($query AS $k => $row) + // Check if the defined carrier are ok + foreach ($carriersList as $k => $row) { $carrier = new Carrier((int)($row['id_carrier'])); - if ((Configuration::get('PS_SHIPPING_METHOD') AND $carrier->getMaxDeliveryPriceByWeight($id_zone) === false) OR + if ((Configuration::get('PS_SHIPPING_METHOD') AND $carrier->getMaxDeliveryPriceByWeight($id_zone) === false) || (!Configuration::get('PS_SHIPPING_METHOD') AND $carrier->getMaxDeliveryPriceByPrice($id_zone) === false)) - { - unset($result[$k]); - continue ; - } - - if ($row['range_behavior']) + unset($carriersList[$k]); + else if ($row['range_behavior']) { // Get id zone - if (isset($this->context->cart->id_address_delivery) AND $this->context->cart->id_address_delivery) - $id_zone = Address::getZoneById((int)($this->context->cart->id_address_delivery)); - else - $id_zone = (int)$this->context->country->id_zone; + $id_zone = (isset($this->context->cart->id_address_delivery) AND $this->context->cart->id_address_delivery) ? + Address::getZoneById((int)$this->context->cart->id_address_delivery) : + (int)$this->context->country->id_zone; if ((Configuration::get('PS_SHIPPING_METHOD') AND (!Carrier::checkDeliveryPriceByWeight($row['id_carrier'], $this->context->cart->getTotalWeight(), $id_zone))) OR (!Configuration::get('PS_SHIPPING_METHOD') AND (!Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $this->context->cart->getOrderTotal(true, self::BOTH_WITHOUT_SHIPPING), $id_zone, $this->context->cart->id_currency)))) - { - unset($result[$k]); - continue ; + unset($carriersList[$k]); } } - $settings = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'mr_method` WHERE `id_carrier` = '.(int)($row['id_carrier'])); - $row['name'] = $settings[0]['mr_Name']; - $row['col'] = $settings[0]['mr_ModeCol']; - $row['liv'] = $settings[0]['mr_ModeLiv']; - $row['ass'] = $settings[0]['mr_ModeAss']; - $row['price'] = $this->context->cart->getOrderShippingCost((int)($row['id_carrier'])); - $row['img'] = file_exists(_PS_SHIP_IMG_DIR_.(int)($row['id_carrier']).'.jpg') ? _THEME_SHIP_DIR_.(int)($row['id_carrier']).'.jpg' : ''; - - $resultsArray[] = $row; - $i++; - } - - if ($i > 0) - { - include_once(_PS_MODULE_DIR_.'mondialrelay/page_iso.php'); + // $address_map = $address->address1.', '.$address->postcode.', '. + // MRTools::replaceAccentedCharacters($address->city).', '.$country->iso_code; $this->context->smarty->assign( array( - 'address_map' => $address->address1.', '.$address->postcode.', '.ote_accent($address->city).', '.$country->iso_code, - 'input_cp' => $address->postcode, - 'input_ville' => ote_accent($address->city), - 'input_pays' => $country->iso_code, - 'input_poids' => Configuration::get('MR_WEIGHT_COEF') * $this->context->cart->getTotalWeight(), - 'nbcarriers' => $nbcarriers, - 'checked' => (int)($checked), - 'google_api_key' => Configuration::get('MR_GOOGLE_MAP'), 'one_page_checkout' => (Configuration::get('PS_ORDER_PROCESS_TYPE') ? Configuration::get('PS_ORDER_PROCESS_TYPE') : 0), 'new_base_dir' => self::$moduleURL, - 'carriersextra' => $resultsArray)); - $nbcarriers = $nbcarriers + $i; + 'MRToken' => self::$MRToken, + 'carriersextra' => $carriersList)); + return $this->display(__FILE__, 'mondialrelay.tpl'); } - } public function getContent() { @@ -1133,7 +1168,7 @@ class MondialRelay extends Module return self::ordersSQLQuery1_3($id_order_state); } - public static function getOrders($orderIdList = array()) + public static function getOrders($orderIdList = array(), $filterEntries = self::NO_FILTER) { $id_order_state = Configuration::get('MONDIAL_RELAY_ORDER_STATE'); $sql = self::getBaseOrdersSQLQuery($id_order_state); @@ -1145,6 +1180,14 @@ class MondialRelay extends Module $sql .= (int)$id_order.', '; $sql = rtrim($sql, ', ').')'; } + switch($filterEntries) + { + case self::WITHOUT_HOME_DELIVERY: + $sql .= 'AND mr.mr_ModeLiv != "LD1" AND mr.mr_ModeLiv != "LDS"'; + break; + default: + break; + } $sql .= ' GROUP BY o.`id_order` ORDER BY o.`date_add` ASC'; diff --git a/modules/mondialrelay/mondialrelay.tpl b/modules/mondialrelay/mondialrelay.tpl index 881d9c315..ec367f369 100755 --- a/modules/mondialrelay/mondialrelay.tpl +++ b/modules/mondialrelay/mondialrelay.tpl @@ -24,72 +24,46 @@ * International Registered Trademark & Property of PrestaShop SA *} - - - + + -{foreach from=$carriersextra item=carrier name=myLoop} + + + - - - - - - - - - - - {$carrier.delay|escape:'htmlall':'UTF-8'} - - {if $carrier.price} - - {if $priceDisplay == 1}{convertPrice price=$carrier.price_tax_exc}{else}{convertPrice price=$carrier.price}{/if} - - {if $priceDisplay == 1} {l s='(tax excl.)' mod='mondialrelay'}{else} {l s='(tax incl.)' mod='mondialrelay'}{/if} - {else} - {l s='Free!' mod='mondialrelay'} - {/if} - - - {if $carrier.liv !='LDR' && $carrier.liv != 'LD1' && $carrier.liv != 'LDS'} - - - - {if ($google_api_key)} - - {/if} - - - - - {/if} - -{/foreach} - diff --git a/modules/mondialrelay/style.css b/modules/mondialrelay/style.css index bf7c16566..5a6c73ec0 100755 --- a/modules/mondialrelay/style.css +++ b/modules/mondialrelay/style.css @@ -174,3 +174,138 @@ div.PS_MRLoader { display:none; } + +div#PS_MRAskBackupContent +{ + border:1px solid #000; + background: url(logo_hd.png) no-repeat 10px 50px #BEBEBE; + line-height:18px; + font-size:14px; + height:190px; +} + +div#PS_MRAskBackupContent div +{ + width:290px; + float:right; + margin-right:20px; + text-align: center; +} + +div#PS_MRAskBackupContent div > p +{ + line-height: 30px; +} + +div#PS_MRAskBackupContent h2 +{ + padding-top:10px; +} + +tr.PS_MRSelectedCarrier > td +{ + text-align: center; + border-bottom: 1px black; +} + +.PS_MRWarn +{ + border: 1px solid #D3C200; + background-color: #FFFAC6; + line-height: 20px; +} + +.PS_MRRelayPointInfo +{ + text-align: left; + vertical-align: top; + margin: 10px 0; + cursor: pointer; +} + +.PS_MRRelayPointInfo:hover +{ + background-color: #f4f4f4; +} + +.PS_MRRelayPointInfo img +{ + height: 40px; + float:left; +} + +.PS_MRRelayPointInfo p +{ + float:left; + width:380px; + text-align: justify; +} + +.PS_MRFloatRelayPointSelecteIt +{ + display:none; +} + +.PS_MRRelayPointInfo:hover .PS_MRFloatRelayPointSelecteIt +{ + display:block; +} + +.PS_MRRelayPointInfo .PS_MRFloatRelayPointSelected +{ + color:#333333; + background:url(images/selectRelayPoint.png) no-repeat 0px -25px; +} + +.PS_MRFloatRelayPointSelected +{ + display:block; +} + +.PS_MRFloatRelayPointSelecteIt a.PS_MRSelectRelayPointButton +{ + float:right; + display: block; + width: 60px; + height: 20px; + padding: 5px 20px 0px 25px; + color:#666666; + text-decoration: none; + margin-top: 8px; + background:url(images/selectRelayPoint.png) no-repeat 0px 0px; +} + +.PS_MRFloatRelayPointSelected a.PS_MRSelectRelayPointButton +{ + float:right; + display: block; + width: 60px; + height: 20px; + padding: 5px 20px 0px 25px; + text-decoration: none; + margin-top: 8px; + color:#333333; + background:url(images/selectRelayPoint.png) no-repeat 0px -25px; +} + +a.PS_MRSelectRelayPointButton:hover +{ + color:#333333; + background:url(images/selectRelayPoint.png) no-repeat 0px -25px; +} + +.PS_MRGmapDefaultPosition +{ +} + +.PS_MRGmapDefaultPosition +{ + display:none; +} + +div.PS_MRGmapStyle +{ + width: 550px; + height:250px; + display: none; +} \ No newline at end of file diff --git a/modules/moneybookers/es.php b/modules/moneybookers/es.php index 09a8f1dcc..a5d2ad983 100644 --- a/modules/moneybookers/es.php +++ b/modules/moneybookers/es.php @@ -15,6 +15,7 @@ $_MODULE['<{moneybookers}prestashop>moneybookers_6861a58e2be4956b3f2fd6420fe6c28 $_MODULE['<{moneybookers}prestashop>moneybookers_a356736cbcf740f8648d71067fca090d'] = 'Acepta pagos por Moneybookers'; $_MODULE['<{moneybookers}prestashop>moneybookers_fa214007826415a21a8456e3e09f999d'] = '¿Está seguro de que quiere eliminar sus datos?'; $_MODULE['<{moneybookers}prestashop>moneybookers_088b74050a381d98fca38d5990b097be'] = 'Actualmente utiliza la dirección por defecto del módulo Moneybookers. Debe utilizar sus parámetros.'; +$_MODULE['<{moneybookers}prestashop>moneybookers_7593ded970377fe25371c952eb944770'] = 'Imposible recuperar los datos distantes'; $_MODULE['<{moneybookers}prestashop>moneybookers_b863542eebcb27fa230b647b5dd07819'] = 'Error durante la validación de la cuenta, su correo electrónico podría estar equivocado'; $_MODULE['<{moneybookers}prestashop>moneybookers_d70c5b5767846906e0abe68498db887b'] = 'Activación correcta de su dirección email, ya puede validar su palabra secreta'; $_MODULE['<{moneybookers}prestashop>moneybookers_87ef564ed1574eda7e77b4012eef0b85'] = 'Imposible contactar con el servidor de activación, por favor inténtelo más tarde'; @@ -23,11 +24,19 @@ $_MODULE['<{moneybookers}prestashop>moneybookers_aa1c444c2ee2f620d5b349fedfa68ba $_MODULE['<{moneybookers}prestashop>moneybookers_cdbef58d093e0ff38e13686a669e9fee'] = 'Error durante la validación de la palabra secreta, su palabra secreta podría estar equivocada'; $_MODULE['<{moneybookers}prestashop>moneybookers_cd1dfa342c3c11c17ede212e6429ca01'] = 'Activación de su cuenta con éxito, palabra secreta correcta'; $_MODULE['<{moneybookers}prestashop>moneybookers_2e531f9ad978a2a1a88a00ae0d4dc78e'] = 'El campo palabra secreta es obligatorio'; +$_MODULE['<{moneybookers}prestashop>moneybookers_bcfaccebf745acfd5e75351095a5394a'] = 'Inhabilitar'; +$_MODULE['<{moneybookers}prestashop>moneybookers_e4abb55720e3790fe55982fec858d213'] = 'Columna de la izquierda'; +$_MODULE['<{moneybookers}prestashop>moneybookers_f16072c370ef52db2e329a87b5e7177a'] = 'Columna de la derecha'; $_MODULE['<{moneybookers}prestashop>moneybookers_a9dd80641753cafc9c967e317ba92a28'] = 'Sobre Moneybookers'; $_MODULE['<{moneybookers}prestashop>moneybookers_8342dda89e8c20bb92916fbe052c583a'] = 'Disfrute de las tarifas especiales que PrestaShop Moneybookers frece a los comerciantes '; $_MODULE['<{moneybookers}prestashop>moneybookers_4f4c1b5e5d775709e08ccc3afad1a5c3'] = 'Moneybookers, controlado por Holdings Skrill, es uno de los más importantes sistemas de pago en línea en Europa, y propone más de 100 opciones de pago y 41 divisas en más de 200 países y territorios. Más de 80.000 comerciantes ya utilizan esta solución entre los que se encuentran eBay.com, Skype y Thomas Cook.'; $_MODULE['<{moneybookers}prestashop>moneybookers_acf2b73b741f10cd1e0d075ed43fed39'] = 'Con más de 17 millones de usuarios y más de 15.000 nuevas cuentas creadas cada día, Moneybookers también ofrece uno de los mayores monedero electrónico en el mundo. Sus clientes también pueden pagar por medio de su e-mail y contraseña gracias a la solución de e-Wallet.'; $_MODULE['<{moneybookers}prestashop>moneybookers_76264fd7352f803c63396bc27b0ee893'] = '¡Moneybookers cambia de nombre y se convierte en Skrill!'; +$_MODULE['<{moneybookers}prestashop>moneybookers_f4f70727dc34561dfde1a3c529b6205c'] = 'Configuración'; +$_MODULE['<{moneybookers}prestashop>moneybookers_e86e85752dd7a7b31bb935c862480cee'] = 'Seleccione la posición del logotipo'; +$_MODULE['<{moneybookers}prestashop>moneybookers_239d45036930947dbf41506d27fa1aa7'] = 'Cambie de posición del logotipo en el Front Office. Funciona con'; +$_MODULE['<{moneybookers}prestashop>moneybookers_81149af5698332fdf2d6869a66b6ad12'] = 'Live edit'; +$_MODULE['<{moneybookers}prestashop>moneybookers_708c440d8915f957ee6717efc426a863'] = 'Enviar'; $_MODULE['<{moneybookers}prestashop>moneybookers_5138738b54f0d4bdf7c72780db651abc'] = 'Abrir una cuenta'; $_MODULE['<{moneybookers}prestashop>moneybookers_41992c760318e60740f7a9b2819af191'] = 'Comience por abrir'; $_MODULE['<{moneybookers}prestashop>moneybookers_c0302a6fbca061af831bc12f06cadb2f'] = 'una cuenta gratis'; diff --git a/modules/moneybookers/moneybookers.php b/modules/moneybookers/moneybookers.php index a58d0301d..c2f9d9790 100644 --- a/modules/moneybookers/moneybookers.php +++ b/modules/moneybookers/moneybookers.php @@ -150,7 +150,7 @@ class MoneyBookers extends PaymentModule */ private function _fetchWebContent($url, $timeout = 5, $contextOptions = array()) { - $context = NULL; + $stream_context = NULL; $defaultContextOptions = array( 'http' => array( 'user_agent' => $_SERVER['HTTP_USER_AGENT'], @@ -177,14 +177,14 @@ class MoneyBookers extends PaymentModule $contextOptions = $defaultContextOptions; // Create a stream context - $context = stream_context_create($contextOptions); + $stream_context = stream_context_create($contextOptions); - if (($fp = @fopen($url, $mode, false, $context))) + if (($fp = @fopen($url, $mode, false, $stream_context))) { $content = fgets($fp, 4096); fclose($fp); } - else if (!($content = @file_get_contents($url, false, $context))) + else if (!($content = @file_get_contents($url, false, $stream_context))) if (($fp = @fsockopen($url, 80, $errnom, $errstr, $timeout))) { preg_match('@^(?:http://)?([^/]+)@i', $url, $matches); @@ -339,9 +339,9 @@ class MoneyBookers extends PaymentModule $iso_img = 'en'; $manual_links = array( - 'en' => 'http://www.prestashop.com/partner/Activation_Manual_Prestashop_EN.pdf', - 'es' => 'http://www.prestashop.com/partner/Manual%20de%20Activacion%20Prestashop_ES.pdf', - 'fr' => 'http://www.prestashop.com/partner/Manuel_Activation_Prestashop_FR.pdf'); + 'en' => 'http://moneybookers.com/creatives/integrationmanual/MB-Prestashop-Integration_en.pdf', + 'es' => 'http://www.moneybookers.com/creatives/integrationmanual/MB-Prestashop-Integration_es.pdf', + 'fr' => 'http://www.moneybookers.com/creatives/integrationmanual/MB-Prestashop-Integration_fr.pdf'); $iso_manual = $lang->iso_code; if (!array_key_exists($iso_manual, $manual_links)) diff --git a/modules/pagesnotfound/fr.php b/modules/pagesnotfound/fr.php index 8cfe72302..3ab8dc4be 100644 --- a/modules/pagesnotfound/fr.php +++ b/modules/pagesnotfound/fr.php @@ -11,6 +11,7 @@ $_MODULE['<{pagesnotfound}prestashop>pagesnotfound_b6f05e5ddde1ec63d992d61144452 $_MODULE['<{pagesnotfound}prestashop>pagesnotfound_64d129224a5377b63e9727479ec987d9'] = 'Compteur'; $_MODULE['<{pagesnotfound}prestashop>pagesnotfound_d372ffc9065cb7d2ea24df137927d060'] = 'Aucune page enregistrée'; $_MODULE['<{pagesnotfound}prestashop>pagesnotfound_d8847bc418fc4f5a3e37c2e8390bb9ed'] = 'Suppression'; +$_MODULE['<{pagesnotfound}prestashop>pagesnotfound_190d2527535602ceed273f097040bef8'] = 'Supprimer toutes les pages introuvables sur cette période'; $_MODULE['<{pagesnotfound}prestashop>pagesnotfound_254b5e94768b90388cc7002d362351f0'] = 'Supprimer toutes les pages introuvables'; $_MODULE['<{pagesnotfound}prestashop>pagesnotfound_6602bbeb2956c035fb4cb5e844a4861b'] = 'Guide'; $_MODULE['<{pagesnotfound}prestashop>pagesnotfound_3604249130acf7fda296e16edc996e5b'] = 'Erreurs 404'; diff --git a/modules/pagesnotfound/pagesnotfound.php b/modules/pagesnotfound/pagesnotfound.php index 531fead24..efeb80ce9 100644 --- a/modules/pagesnotfound/pagesnotfound.php +++ b/modules/pagesnotfound/pagesnotfound.php @@ -99,6 +99,13 @@ class Pagesnotfound extends Module Db::getInstance()->Execute('TRUNCATE `'._DB_PREFIX_.'pagenotfound`'); $this->_html .= '
    '.$this->l('Pages not found has been emptied.').'
    '; } + elseif (Tools::isSubmit('submitDeletePNF')) + { + Db::getInstance()->Execute(' + DELETE FROM `'._DB_PREFIX_.'pagenotfound` + WHERE date_add BETWEEN '.ModuleGraph::getDateBetween()); + $this->_html .= '
    '.$this->l('Pages not found have been deleted.').'
    '; + } $this->_html .= '
    '.$this->displayName.''; if (!file_exists(dirname(__FILE__).'/../../.htaccess')) @@ -133,7 +140,10 @@ class Pagesnotfound extends Module if (sizeof($pages)) $this->_html .= '
     
    '.$this->l('Empty database').' -
    +
    + + +
    '; $this->_html .= '
     
    '.$this->l('Guide').' diff --git a/modules/paypal/paypal.php b/modules/paypal/paypal.php index 84f2d4a50..ef7f507ee 100644 --- a/modules/paypal/paypal.php +++ b/modules/paypal/paypal.php @@ -57,8 +57,9 @@ class PayPal extends PaymentModule if (file_exists(_PS_ROOT_DIR_.'/modules/paypalapi/paypalapi.php') AND $this->active) $this->warning = $this->l('All features of Paypal API module are be include in the new Paypal module. In order to don\'t have any conflict, please don\'t use and remove PayPalAPI module.'); - $context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5))); - $content = @file_get_contents('https://www.prestashop.com/partner/preactivation/preactivation-warnings.php?version=1.0&partner=paypal&iso_country='.Tools::strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))).'&iso_lang='.Tools::strtolower($this->context->language->iso_code).'&id_lang='.(int)$this->context->language->id.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $context); + $stream_context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5))); + $content = @file_get_contents('https://www.prestashop.com/partner/preactivation/preactivation-warnings.php?version=1.0&partner=paypal&iso_country='.Tools::strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))).'&iso_lang='.Tools::strtolower($this->context->language->iso_code).'&id_lang='.(int)$this->context->language->id.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context); + $content = explode('|', $content); if ($content[0] == 'OK') { diff --git a/modules/paypal/standard/paypal.tpl b/modules/paypal/standard/paypal.tpl index 781e749a8..0bab6ae31 100644 --- a/modules/paypal/standard/paypal.tpl +++ b/modules/paypal/standard/paypal.tpl @@ -25,7 +25,7 @@ *}

    - + {l s='Pay with PayPal' mod='paypal'} {l s='Pay with PayPal' mod='paypal'} diff --git a/modules/prestafraud/prestafraud.php b/modules/prestafraud/prestafraud.php index 388580ece..433520787 100644 --- a/modules/prestafraud/prestafraud.php +++ b/modules/prestafraud/prestafraud.php @@ -582,8 +582,8 @@ class PrestaFraud extends Module } elseif (function_exists('file_get_contents')) { - $context = stream_context_create(array('http' => array('timeout' => 5))); - return file_get_contents($this->_trustUrl.'?xml='.urlencode(str_replace("\r", "\n", '', $datas)), $context); + $stream_context = stream_context_create(array('http' => array('timeout' => 5))); + return file_get_contents($this->_trustUrl.'?xml='.urlencode(str_replace("\r", "\n", '', $datas)), $stream_context); } else return false; diff --git a/modules/shopimporter/es.php b/modules/shopimporter/es.php index b14739277..d2b9c37e2 100644 --- a/modules/shopimporter/es.php +++ b/modules/shopimporter/es.php @@ -61,10 +61,13 @@ $_MODULE['<{shopimporter}prestashop>shopimporter_05f4be265d59ea66f3a1fb12ba10358 $_MODULE['<{shopimporter}prestashop>shopimporter_961f2247a2070bedff9f9cd8d64e2650'] = 'Elegir'; $_MODULE['<{shopimporter}prestashop>shopimporter_151a0fbfcc4894aa53335091c2512de5'] = 'No hay ningún módulo de importación instalado'; $_MODULE['<{shopimporter}prestashop>shopimporter_9aa1b03934893d7134a660af4204f2a9'] = 'Servidor'; +$_MODULE['<{shopimporter}prestashop>shopimporter_770b2f7556eecbe5000cfcbddc9f9885'] = '(Por ejemplo: mysql.mydomain.com)'; $_MODULE['<{shopimporter}prestashop>shopimporter_8f9bfe9d1345237cb3b2b205864da075'] = 'Usuario'; $_MODULE['<{shopimporter}prestashop>shopimporter_dc647eb65e6711e155375218212b3964'] = 'Contraseña'; +$_MODULE['<{shopimporter}prestashop>shopimporter_14ae0ea02f571a833786d13d9ca6a897'] = '(La contraseña puede estar vacía)'; $_MODULE['<{shopimporter}prestashop>shopimporter_e307db07b3975fef922a80d07455ee5e'] = 'Base de datos'; $_MODULE['<{shopimporter}prestashop>shopimporter_dac130bdd2c5492a8108a4145bd9f04a'] = 'Prefijo de la base de datos'; +$_MODULE['<{shopimporter}prestashop>shopimporter_6bdc02625540b5264cffe801c37a82dd'] = '(El prefijo es opcional. Si todas las tablas de su base de datos comienzan con \"pref_\", el prefijo es \"pref_\")'; $_MODULE['<{shopimporter}prestashop>shopimporter_2bb4cbbf4c51025867d47131e79ad05f'] = 'Etapa siguiente'; $_MODULE['<{shopimporter}prestashop>shopimporter_72dd98a453e92ccc01697f29bb5dbeb9'] = 'Opción de import'; $_MODULE['<{shopimporter}prestashop>shopimporter_9dfc5d5738312210c3c75e68a468691d'] = 'Opciones avanzadas'; diff --git a/modules/socolissimo/es.php b/modules/socolissimo/es.php index 634d6ab12..2a4542a58 100644 --- a/modules/socolissimo/es.php +++ b/modules/socolissimo/es.php @@ -58,7 +58,7 @@ $_MODULE['<{socolissimo}prestashop>socolissimo_00d23a76e43b46dae9ec7aa9dcbebb32' $_MODULE['<{socolissimo}prestashop>socolissimo_b9f5c797ebbf55adccdd8539a65a0241'] = 'Desactivado'; $_MODULE['<{socolissimo}prestashop>socolissimo_fdd526b84abc0b8fc17060e62d022b84'] = 'Autorizar o no la comprobación de la disponiblidad de los servicios SoColissimo'; $_MODULE['<{socolissimo}prestashop>socolissimo_32996bdf4214d6cb8bf7fa02273813c8'] = 'Dirección de comprobación'; -$_MODULE['<{socolissimo}prestashop>socolissimo_995a56aecac4198b9bc0a17a976561b5'] = 'Dirección de comprobación de disponibilidad'; +$_MODULE['<{socolissimo}prestashop>socolissimo_947d84460ad5676c9d79fa05727f1e8a'] = 'La dirección URL de supervisión asegura la disponibilidad del servicio socolissimo. No se recomienda desactivarla: '; $_MODULE['<{socolissimo}prestashop>socolissimo_c9cc8cce247e49bae79f15173ce97354'] = 'Guardar'; $_MODULE['<{socolissimo}prestashop>socolissimo_a82be0f551b8708bc08eb33cd9ded0cf'] = 'Información'; $_MODULE['<{socolissimo}prestashop>socolissimo_3e387f5ebd657c6372f0594c8226863e'] = 'Aquí tiene las dos direcciones que debe indicar en su Back-Office Coliposte'; diff --git a/modules/themeinstallator/es.php b/modules/themeinstallator/es.php index 1a7effe2a..6d91b3d69 100644 --- a/modules/themeinstallator/es.php +++ b/modules/themeinstallator/es.php @@ -4,7 +4,6 @@ global $_MODULE; $_MODULE = array(); $_MODULE['<{themeinstallator}prestashop>themeinstallator_fff01a1de50e0559f82501a927654d1b'] = 'Importar / exportar un tema'; $_MODULE['<{themeinstallator}prestashop>themeinstallator_83ebbd7865677d356ffde5ad7e12784f'] = 'Exportar o importar un tema y sus módulos en su tienda'; -$_MODULE['<{themeinstallator}prestashop>themeinstallator_e10ed1f81b51bd4c7f86eeb84bcd1359'] = 'Zip no está instalado en su servidor. Contacte con su hosting'; $_MODULE['<{themeinstallator}prestashop>themeinstallator_25b9e1d82d8200d70be2b22a1a283957'] = 'Se ha producido un error durante el envío del archivo.'; $_MODULE['<{themeinstallator}prestashop>themeinstallator_050991b5b76aad0be75563b7cb93a33e'] = 'Solo están autorizados los archivos zip'; $_MODULE['<{themeinstallator}prestashop>themeinstallator_57c1ed81b02e5d3361323c7930897295'] = 'Se ha producido un error durante la copia del archivo.'; diff --git a/modules/themeinstallator/fr.php b/modules/themeinstallator/fr.php index 536e6d173..fa7916e67 100644 --- a/modules/themeinstallator/fr.php +++ b/modules/themeinstallator/fr.php @@ -4,7 +4,6 @@ global $_MODULE; $_MODULE = array(); $_MODULE['<{themeinstallator}prestashop>themeinstallator_fff01a1de50e0559f82501a927654d1b'] = 'Importer / Exporter un thème'; $_MODULE['<{themeinstallator}prestashop>themeinstallator_83ebbd7865677d356ffde5ad7e12784f'] = 'Exporter ou importer un thème et ses modules sur votre boutique'; -$_MODULE['<{themeinstallator}prestashop>themeinstallator_e10ed1f81b51bd4c7f86eeb84bcd1359'] = 'Zip n\'est pas installé sur votre serveur. Contactez votre hébergeur pour plus d\'informations.'; $_MODULE['<{themeinstallator}prestashop>themeinstallator_25b9e1d82d8200d70be2b22a1a283957'] = 'Une erreur est survenue durant l\'envoi du fichier.'; $_MODULE['<{themeinstallator}prestashop>themeinstallator_050991b5b76aad0be75563b7cb93a33e'] = 'Seuls les fichiers zip sont autorisés'; $_MODULE['<{themeinstallator}prestashop>themeinstallator_57c1ed81b02e5d3361323c7930897295'] = 'Une erreur est survenue durant la copie du fichier.'; diff --git a/modules/trustedshops/es.php b/modules/trustedshops/es.php index 58bc677fd..1605639bf 100644 --- a/modules/trustedshops/es.php +++ b/modules/trustedshops/es.php @@ -4,7 +4,9 @@ global $_MODULE; $_MODULE = array(); $_MODULE['<{trustedshops}prestashop>display_products_02ecb4a4709d9bcc590f1a25fc82c0e2'] = 'Trusted Shops protección comprador (recomendado)'; $_MODULE['<{trustedshops}prestashop>display_products_b55aab8932a39ca85bb0a1b6eb83f83f'] = 'Protección comprador hasta'; -$_MODULE['<{trustedshops}prestashop>display_products_536a056b710e94b16169efd17a4a657b'] = 'guardado'; +$_MODULE['<{trustedshops}prestashop>display_products_69db1ddc2a15253abb0a11beb1eae734'] = 'incl. IVA'; +$_MODULE['<{trustedshops}prestashop>display_products_b3c25d2f94cf87ece3dbb2907318520c'] = 'La protección del comprador Trusted Shops hace segura su compra en línea. Añado mi dirección de correo electrónico que se transfiere y '; +$_MODULE['<{trustedshops}prestashop>display_products_536a056b710e94b16169efd17a4a657b'] = 'la guarda'; $_MODULE['<{trustedshops}prestashop>display_products_2dc4be4d5564180e6df95d5a5a679195'] = 'para el tratamiento de la protección comprador por Trusted Shops.'; $_MODULE['<{trustedshops}prestashop>display_products_229eb04083e06f419f9ac494329f957d'] = 'Condiciones'; $_MODULE['<{trustedshops}prestashop>display_products_4ccaceceffe4b5e58f6a7a7ed3ced4c4'] = 'para la protección del comprador.'; @@ -14,6 +16,8 @@ $_MODULE['<{trustedshops}prestashop>order-confirmation-tsbp-classic_f975f4236262 $_MODULE['<{trustedshops}prestashop>seal_of_approval_ee9ae315b086e1b1a0c8fdc6078f9add'] = 'Cuño Trusted Shops- Pulse aquí para comprobar'; $_MODULE['<{trustedshops}prestashop>seal_of_approval_750bea678eeb1d07f21fe86173288e2e'] = 'es un sitio de venta en línea certificado con la garantía de reembolso de Trusted Shops. '; $_MODULE['<{trustedshops}prestashop>trustedshops_0aa7ce92297d05fc09fb9fdbe5da6be6'] = 'Este módulo requiere la extensión PHP SOAP para funcionar correctamente.'; +$_MODULE['<{trustedshops}prestashop>trustedshops_8b61f54775adf535d4da32eb434309ea'] = 'Soluciones de confianza Trusted Shop'; +$_MODULE['<{trustedshops}prestashop>trustedshops_f3607bb2fb5f04aa4937e7846c560faa'] = 'Fomente la confianza en su tienda en línea con el sello de calidad Trusted Shops, la protección al comprador y la puntuación de los usuarios.'; $_MODULE['<{trustedshops}prestashop>trustedshops_968e0f78caa7d3245c8f6f858de993d8'] = '¿Está seguro de que desea suprimir esta configuración?'; $_MODULE['<{trustedshops}prestashop>tsbpexception_79fc246c2b70963d27ebb0e9ebaab349'] = 'Póngase en contacto con Trusted Shops en la siguiente dirección service@trustedshop.fr'; $_MODULE['<{trustedshops}prestashop>tsbpexception_3a2a06b3a1f05cde765219211bf2e9bd'] = 'El nombre de usuario o contrasea no son válidos.'; @@ -61,6 +65,7 @@ $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_982830b027a279fdc4b4b7993f $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_7e1795d054242cf7c546c1491a7c467d'] = 'DIRECTebanking.com'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_37554cc43c645833d6713b9cddda909b'] = 'moneybookers.com'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_9203aec73d2ea1770f66f065c4069816'] = 'Otros modos de pago'; +$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_743a602a92e214f08c05442217332938'] = 'Trusted Shops sello de calidad y protección al comprador'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_f51dabfce0c8ccc01734ed38d8afe27a'] = 'Las aplicaciones Json deben ser implementadas en la versión de PHP'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_b1801eaadecfddd04529313a1e929262'] = 'El certificado es válido'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_ce323cb3453812434f9abc007ba7a952'] = 'El certificado ha caducado'; @@ -125,10 +130,15 @@ $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_23a58bf9274bedb19375e527a0 $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_fd5291d7f0624933870702ff183bb14e'] = 'módulo de pago'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_b3b1a406e097bc87c8745db26e11904e'] = 'Actualizar'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_c9ba5f6e6d58162530424afaa68bf496'] = 'Configuración del cron'; +$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_12a4fc31ae8a9e4038df56961a5aec9b'] = 'Si está utilizando un certificado de EXCELENCIA Trusted Shops en su tienda, cree una tarea programada en el servidor web.'; +$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_f811271eb84f3df1a430c3c78b6e7640'] = 'Ejecute el archivo'; +$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_06ec9154ce96a389f7b1d884e021818b'] = 'con un intervalo de 10 minutos.'; +$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_f89b7100efcc136900c909690e43f008'] = 'La línea correspondiente en el archivo de cron puede tener este aspecto:'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_b40495f7999e31d4abed3183d2e3cd25'] = 'La protección comprador de Trusted Shops requiere un login para funcionar. '; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_9d36bad327b052a9bdec7003f95ce4bd'] = 'Se ha producido un error con su idioma:'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_03e9e3ceaf5769311c57b5903a958e94'] = 'Un comprador no puede comprar varios productos de protección comprador'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_26a7019f9c88a24e63ebc690e9527f31'] = 'Va a recibir un email de Trusted Shops con su número de garantía.'; +$_MODULE['<{trustedshops}prestashop>trustedshopsrating_2b83e3a2e08203b9892ad8801d6b2543'] = 'Trusted Shops evaluación de los usuarios'; $_MODULE['<{trustedshops}prestashop>trustedshopsrating_b20a16afda98421bbf7457ccfa50e311'] = 'Este módulo necesita los derechos de lectura y de escritura en el repertorio cache del módulo.'; $_MODULE['<{trustedshops}prestashop>trustedshopsrating_0aa7ce92297d05fc09fb9fdbe5da6be6'] = 'Este módulo necesita la extensión PHP SOAP para funcionar correctamente.'; $_MODULE['<{trustedshops}prestashop>trustedshopsrating_1097e2b0ee70e248749f0d0a9292df56'] = 'ID Trusted Shops no válido'; diff --git a/modules/upscarrier/es.php b/modules/upscarrier/es.php index e151fd445..0f1445cda 100644 --- a/modules/upscarrier/es.php +++ b/modules/upscarrier/es.php @@ -11,6 +11,8 @@ $_MODULE['<{upscarrier}prestashop>upscarrier_f795d6b3e974858bb6720cfc2b4d22d6'] $_MODULE['<{upscarrier}prestashop>upscarrier_fe4ee8226f826b73619fc422ca5b7382'] = 'Contraseña UPS'; $_MODULE['<{upscarrier}prestashop>upscarrier_5e20501e9384bef70cc36012e20c49a1'] = 'MyUps ID'; $_MODULE['<{upscarrier}prestashop>upscarrier_70620de307a173fe781d1a9a575346cb'] = 'Clave API UPS'; +$_MODULE['<{upscarrier}prestashop>upscarrier_20449d3f0b6c6b9265a5cd2a470a6451'] = 'Peso del paquete'; +$_MODULE['<{upscarrier}prestashop>upscarrier_bfc00de34bc04366e7fee516adf7dca5'] = 'Gastos de gastión'; $_MODULE['<{upscarrier}prestashop>upscarrier_3d2c007374b08d6999fa43e037d54b53'] = 'Método de recogida'; $_MODULE['<{upscarrier}prestashop>upscarrier_ead6e6f6c0c0be25f6275464f2ae0d3c'] = 'Tipo de paquete'; $_MODULE['<{upscarrier}prestashop>upscarrier_885d2a3462e6b8b6ab763b95a0ce3a63'] = 'Zonas de tarifas'; @@ -60,6 +62,8 @@ $_MODULE['<{upscarrier}prestashop>upscarrier_32b02316cc0c3e871dd2ba4451abbb23'] $_MODULE['<{upscarrier}prestashop>upscarrier_c4906d203203052c2119c2c27e7cef65'] = 'Su login MyUps ID'; $_MODULE['<{upscarrier}prestashop>upscarrier_e75761482891a9ad8c6a1339dd143119'] = 'Su UPS API key'; $_MODULE['<{upscarrier}prestashop>upscarrier_bdfcb5fba4c72a81163a0b403a25338d'] = 'Pulse aquí para obtener su UPS API Key'; +$_MODULE['<{upscarrier}prestashop>upscarrier_db06a2900c66a3a2cb78fe3a470f1b85'] = 'Peso del paquete'; +$_MODULE['<{upscarrier}prestashop>upscarrier_0274f749472f365e7d48a501e14793e6'] = 'Gastos de gestión'; $_MODULE['<{upscarrier}prestashop>upscarrier_83ad4fdaf06650e6d9d7ca18f82fb975'] = 'Configuración de localización'; $_MODULE['<{upscarrier}prestashop>upscarrier_f489118ea95c746d648d36bb50c226f0'] = 'Unidad de peso'; $_MODULE['<{upscarrier}prestashop>upscarrier_659c95668841b7d6602ead454b28d4ba'] = 'La unidad de peso de su tienda (ej: kg o Ibs)'; @@ -87,7 +91,7 @@ $_MODULE['<{upscarrier}prestashop>upscarrier_da42caf26ef85de3d7e48e16ca60b891'] $_MODULE['<{upscarrier}prestashop>upscarrier_8d2ee0603dfce09b57d60db628cde269'] = 'Elija el tipo de paquete…'; $_MODULE['<{upscarrier}prestashop>upscarrier_795de10b1bdcb843b3703c63ad577fc6'] = 'Elija en la lista de tipos de paquete el que desea seleccionar por defecto.'; $_MODULE['<{upscarrier}prestashop>upscarrier_8d6bd50f3fe3ee2f4513066c25e5fb4a'] = 'Modo de cálculo'; -$_MODULE['<{upscarrier}prestashop>upscarrier_37fa4a1a7af70286d9067ac63555cbf4'] = 'Usando el modo de cálculo \"Todos los artículos en un solo paquete\", automáticamente usará el tamaño por defecto de embalaje, tipo de embalaje y entrega. Configuraciones específicas para las categorías de productos no se utilizarán.'; +$_MODULE['<{upscarrier}prestashop>upscarrier_3169c5057093f8e6c2750f1949a0900d'] = 'Utilizando el modo de cálculo \"Todos los artículos en un solo paquete\" utilizará automáticamente el tamaño por defecto de embalaje, tipo de embalaje y entrega. No se utilizarán las configuraciones específicas de las categorías y de los productos.'; $_MODULE['<{upscarrier}prestashop>upscarrier_5cdd307ba6e260beb4801c0c10e22a3a'] = 'Servicio de entrega'; $_MODULE['<{upscarrier}prestashop>upscarrier_78945de8de090e90045d299651a68a9b'] = 'Disponible '; $_MODULE['<{upscarrier}prestashop>upscarrier_2d25c72c1b18e562f6654fff8e11711e'] = 'No disponible'; diff --git a/modules/uspscarrier/es.php b/modules/uspscarrier/es.php index efb0f5261..469d06ed9 100644 --- a/modules/uspscarrier/es.php +++ b/modules/uspscarrier/es.php @@ -8,6 +8,8 @@ $_MODULE['<{uspscarrier}prestashop>uspscarrier_883fa0069f4b0454e2277dd567ab3991' $_MODULE['<{uspscarrier}prestashop>uspscarrier_5a3ceec65d417f5d92c26dbf0dccc00d'] = '\"Unidad de medida (cm o in)\"'; $_MODULE['<{uspscarrier}prestashop>uspscarrier_4d470fde8487e755a50e9235e3dc13ab'] = 'debe estar configurado para funcionar correctamente'; $_MODULE['<{uspscarrier}prestashop>uspscarrier_d2d22fe4f85d971b090bcbacec8f0123'] = 'ID del usuario USPS '; +$_MODULE['<{uspscarrier}prestashop>uspscarrier_20449d3f0b6c6b9265a5cd2a470a6451'] = 'Peso del paquete'; +$_MODULE['<{uspscarrier}prestashop>uspscarrier_bfc00de34bc04366e7fee516adf7dca5'] = 'Gastos de gestión'; $_MODULE['<{uspscarrier}prestashop>uspscarrier_761c02f2b956cac5abe5539c6d908508'] = 'Tamaño de los paquetes USPS'; $_MODULE['<{uspscarrier}prestashop>uspscarrier_ca9df8a12e7558c34bcf7b88aab5cba5'] = 'Tipo de paquete USPS'; $_MODULE['<{uspscarrier}prestashop>uspscarrier_f347d2e6d32688d9174b7aa1fc0124b1'] = 'Puede ser tratado por una máquina'; @@ -40,6 +42,8 @@ $_MODULE['<{uspscarrier}prestashop>uspscarrier_6a26f548831e6a8c26bfbbd9f6ec61e0' $_MODULE['<{uspscarrier}prestashop>uspscarrier_d2126da975d5b9a5b846efaf57d3fd53'] = 'Configuración general'; $_MODULE['<{uspscarrier}prestashop>uspscarrier_b150f21f4d216c6c275de3d69dffac68'] = 'Su login USPS'; $_MODULE['<{uspscarrier}prestashop>uspscarrier_ebbbab87d3a60b18f370b76f59dab31e'] = 'Pulse aquí para obtener su clave API USPS'; +$_MODULE['<{uspscarrier}prestashop>uspscarrier_db06a2900c66a3a2cb78fe3a470f1b85'] = 'Peso del paquete'; +$_MODULE['<{uspscarrier}prestashop>uspscarrier_0274f749472f365e7d48a501e14793e6'] = 'Gastos de gestión'; $_MODULE['<{uspscarrier}prestashop>uspscarrier_83ad4fdaf06650e6d9d7ca18f82fb975'] = 'Configuración de ubicación'; $_MODULE['<{uspscarrier}prestashop>uspscarrier_f489118ea95c746d648d36bb50c226f0'] = 'Unidad de peso'; $_MODULE['<{uspscarrier}prestashop>uspscarrier_659c95668841b7d6602ead454b28d4ba'] = 'La unidad de peso de su tienda (ej: kg o Ibs)'; @@ -66,7 +70,7 @@ $_MODULE['<{uspscarrier}prestashop>uspscarrier_795de10b1bdcb843b3703c63ad577fc6' $_MODULE['<{uspscarrier}prestashop>uspscarrier_93c8645dbbc33cf8d126266a827a5501'] = 'Machinable'; $_MODULE['<{uspscarrier}prestashop>uspscarrier_67cd0f5256c40c16a6cfd6effe3ab06b'] = 'Elija si puede ser tratado por una máquina por defecto o no.'; $_MODULE['<{uspscarrier}prestashop>uspscarrier_8d6bd50f3fe3ee2f4513066c25e5fb4a'] = 'Modo de cálculo'; -$_MODULE['<{uspscarrier}prestashop>uspscarrier_37fa4a1a7af70286d9067ac63555cbf4'] = 'Usando el modo de cálculo \"Todos los artículos en un solo paquete\", automáticamente usará el tamaño por defecto de embalaje, tipo de embalaje y entrega. Configuraciones específicas para las categorías de productos no se utilizarán.'; +$_MODULE['<{uspscarrier}prestashop>uspscarrier_3169c5057093f8e6c2750f1949a0900d'] = 'Utilizando el modo de cálculo \"Todos los artículos en un solo paquete\" utilizará automáticamente el tamaño por defecto de embalaje, tipo de embalaje y entrega. No se utilizarán las configuraciones específicas de las categorías y de los productos.'; $_MODULE['<{uspscarrier}prestashop>uspscarrier_5cdd307ba6e260beb4801c0c10e22a3a'] = 'Servicio de entrega'; $_MODULE['<{uspscarrier}prestashop>uspscarrier_78945de8de090e90045d299651a68a9b'] = 'Disponible'; $_MODULE['<{uspscarrier}prestashop>uspscarrier_2d25c72c1b18e562f6654fff8e11711e'] = 'No disponible'; diff --git a/readme_de.txt b/readme_de.txt index 8d5fc8ce1..7c23c4624 100644 --- a/readme_de.txt +++ b/readme_de.txt @@ -27,15 +27,15 @@ VERSION: 1.5.0.0 VORBEREITUNG =========== -Zur Installation von PrestaShop bentigen Sie einen Remote-Web-Server oder +Zur Installation von PrestaShop ben�tigen Sie einen Remote-Web-Server oder Ihren Computer (MAMP) mit Zugriff auf eine Datenbank wie MySQL. -Sie bentigen Zugriff auf phpMyAdmin, um eine Datenbank zu erstellen und die +Sie ben�tigen Zugriff auf phpMyAdmin, um eine Datenbank zu erstellen und die Informationen in der Datenbank im Installer anzuzeigen. Wenn Sie keinen Hosting-Provider haben und Ihren Shop selbst nicht erstellen -knnen, bieten wir einen schlsselfertigen Shop, mit dem Sie Ihren eigenen +k�nnen, bieten wir einen schl�sselfertigen Shop, mit dem Sie Ihren eigenen Online-Shop in weniger als 10 Minuten ohne jegliche technische Kenntnisse -erstellen knnen. +erstellen k�nnen. Besuchen Sie: http://www.prestabox.com/ @@ -45,9 +45,9 @@ INSTALLATION Gehen Sie einfach zu Ihrem PrestaShop Web-Verzeichnis und verwenden Sie den Installer :-) -Falls ein PHP-Fehler auftritt, haben Sie vielleicht kein PHP5 oder mssen es +Falls ein PHP-Fehler auftritt, haben Sie vielleicht kein PHP5 oder m�ssen es auf Ihrem Web-Host aktivieren. -Die Vorinstallationseinstellungen (PHP 5, htaccess) fr bestimmte +Die Vorinstallationseinstellungen (PHP 5, htaccess) f�r bestimmte Hosting-Dienste (1&1, Free, Lycos, OVH, Infomaniak, Amen, GoDaddy, etc.) finden Sie in unserem Forum. @@ -55,26 +55,26 @@ Spezifische englische Webhosting-Einstellungen: http://www.prestashop.com/forums/viewthread/2946/installation_configuration___upgrade/preinstallation_settings_php_5_htaccess_for_certain_hosting_servi ces -Wenn Sie keine Lsung zum Starten des Installers finden, posten Sie bitte +Wenn Sie keine L�sung zum Starten des Installers finden, posten Sie bitte Ihr Problem in unserem Forum: http://www.prestashop.com/forums/viewforum/7/installation_configuration___upgrade -Es gibt immer Lsungen fr Ihre Fragen ;-) +Es gibt immer L�sungen f�r Ihre Fragen ;-) DOKUMENTATION ============= -Fr zustzliche Benutzerhinweise (how-to), lesen Sie bitte unser Wiki: +F�r zus�tzliche Benutzerhinweise (how-to), lesen Sie bitte unser Wiki: http://www.prestashop.com/wiki/ FOREN ====== -Sie knnen auerdem mit der PrestaShop Community in unseren Foren -diskutieren, Hilfe finden und eigene Beitrge liefern unter: +Sie k�nnen au�erdem mit der PrestaShop Community in unseren Foren +diskutieren, Hilfe finden und eigene Beitr�ge liefern unter: http://www.prestashop.com/forums/ -Danke fr Ihren Download und die Nutzung der PrestaShop E-Commerce-Open-Source-Lsung! +Danke f�r Ihren Download und die Nutzung der PrestaShop E-Commerce-Open-Source-L�sung! ========================== = The PrestaTeam' = diff --git a/readme_it.txt b/readme_it.txt index cb8b85c8b..0315325b7 100644 --- a/readme_it.txt +++ b/readme_it.txt @@ -30,7 +30,7 @@ PREPARAZIONE Per installare PrestaShop, hai bisogno di un server remoto o nel tuo computer (MAMP), con accesso ad un database come MySQL. Dovrai accedere a phpMyAdmin per creare un database e per indicare le informazioni nel database all'installatore. -Sei non hai un host e non sai come creare il tuo negozio, ti offriamo un negozio gi pronto che ti far realizzare il tuo negozio online in meno di 10 minuti senza nessun bisogno di competenze tecniche. +Sei non hai un host e non sai come creare il tuo negozio, ti offriamo un negozio gi� pronto che ti far� realizzare il tuo negozio online in meno di 10 minuti senza nessun bisogno di competenze tecniche. Ti invitiamo a visitare: http://www.prestabox.com/ diff --git a/themes/prestashop/css/comparator.css b/themes/prestashop/css/comparator.css index 136688c8a..ded41433d 100644 --- a/themes/prestashop/css/comparator.css +++ b/themes/prestashop/css/comparator.css @@ -1,61 +1,50 @@ -.comparison_feature_value -{ +.comparison_feature_value { padding: 5px; margin-top: 5px } -.comparison_feature -{ +.comparison_feature { padding: 5px; color: red; font-weight: bold } -.comparison_feature_odd -{ +.comparison_feature_odd { background-color: #F1F2F4; - padding: 3px; + padding: 3px } -.comparison_feature_even -{ - padding: 3px; +.comparison_feature_even { + padding: 3px } -.comparison_infos -{ +.comparison_infos { border-left: 1px dotted #595A5E; - vertical-align: top; + vertical-align: top } -.comparison_infos_first -{ +.comparison_infos_first { border-left: 1px dotted #595A5E; border-right: 1px dotted #595A5E } -#product_comparison -{ - border-collapse: collapse; +#product_comparison { + border-collapse: collapse } -tr.comparison_header td -{ +tr.comparison_header td { background-color: #595A5E; color: #FFFFFF; font-weight: bold; padding: 3px } -.product_desc a -{ - text-decoration: none; +.product_desc a { + text-decoration: none } -.comparison_comment -{ - background-color: #FFFFFF; - +.comparison_comment { + background-color: #FFFFFF } @@ -69,14 +58,12 @@ tr.comparison_header td width: 430px } -.comment .customer_name -{ - font-weight: bold; +.comment .customer_name { + font-weight: bold } -.cmp_remove -{ +.cmp_remove { margin: auto; text-align: center; display: block; @@ -85,37 +72,36 @@ tr.comparison_header td display: block; line-height: 22px; height: 22px; - background: url('../../../../img/admin/delete.gif') no-repeat; + background: url('../../../../img/admin/delete.gif') no-repeat } -.comparison_availability_statut -{ - height: 27px; +.comparison_availability_statut { + height: 27px } -.comparison_old_price -{ - height: 13px; +.comparison_old_price { + height: 13px } -.comparison_product_infos -{ +.comparison_product_infos { width: 100%; - text-align: center; + text-align: center } -.comparison_unit_price -{ +#center_column .products_block .comparison_product_infos a.product_image { + margin: 0px auto +} + +.comparison_unit_price { color:gray; - font-size:0.75em; + font-size:0.75em } -.product_discount -{ +.product_discount { height: 13px; color:#DA0F00; font-weight:bold; - text-transform:uppercase; + text-transform:uppercase } diff --git a/themes/prestashop/css/global.css b/themes/prestashop/css/global.css index 64310cf40..dde760504 100644 --- a/themes/prestashop/css/global.css +++ b/themes/prestashop/css/global.css @@ -1221,7 +1221,8 @@ span.view_scroll_spacer { background: #d0d3d8 url('../img/block_category_item_bg.jpg') repeat-x; border: solid 1px #d0d3d8; padding: 0.6em; - margin-bottom: 1.5em + margin-bottom: 1.5em; + height: 84px; } #suppliers_list li a, #manufacturers_list li a { text-decoration: none; diff --git a/themes/prestashop/lang/es.php b/themes/prestashop/lang/es.php index 242b810f5..91a41b282 100644 --- a/themes/prestashop/lang/es.php +++ b/themes/prestashop/lang/es.php @@ -95,7 +95,7 @@ $_LANG['authentication_6335a00a08fde0fbb8f6d6630cdadd92'] = 'Datos personales'; $_LANG['authentication_1e884e3078d9978e216a027ecd57fb34'] = 'Correo electrónico'; $_LANG['authentication_bf2957630c4209f61a388a08c2154915'] = '(5 caracteres min.)'; $_LANG['authentication_455175f3f5be6306247babb349c0515a'] = 'Su dirección'; -$_LANG['authentication_6a1fdb6502fefe71937a62c4d03a810e'] = 'Dirección, apartado de correos, el nombre de compañia'; +$_LANG['authentication_ae47812e00631626815f5f75ad1abbbd'] = 'Calle, código postal, nombre de empresa, c / o'; $_LANG['authentication_846a54955f32846032981f8fe48c35ff'] = 'Dirección (2)'; $_LANG['authentication_092daa39d2b825e4a7fe9b31c2080ecb'] = 'Apartamento, suite, unidad, edificio, piso, etc'; $_LANG['authentication_0f68b904e33d9ac04605aecc958bcf52'] = 'Información adicional'; diff --git a/themes/prestashop/order-opc-new-account.tpl b/themes/prestashop/order-opc-new-account.tpl index a69f8a6a9..cf1b9c3b3 100644 --- a/themes/prestashop/order-opc-new-account.tpl +++ b/themes/prestashop/order-opc-new-account.tpl @@ -225,7 +225,7 @@ *

    {elseif $field_name eq "address2"} -

    +

    diff --git a/themes/prestashop/products-comparison.tpl b/themes/prestashop/products-comparison.tpl index 4bdcbea8b..8dfa8ad26 100644 --- a/themes/prestashop/products-comparison.tpl +++ b/themes/prestashop/products-comparison.tpl @@ -44,11 +44,9 @@
    {$product->name|truncate:27:'...'|escape:'htmlall':'UTF-8'}
    -
    {$product->name|escape:html:'UTF-8'} -
    {if isset($product->show_price) && $product->show_price && !isset($restricted_country_mode) && !$PS_CATALOG_MODE}

    {convertPrice price=$product->getPrice($taxes_behavior)}

    diff --git a/translations/en/admin.php b/translations/en/admin.php index beeb19c21..bc09bfe5c 100644 --- a/translations/en/admin.php +++ b/translations/en/admin.php @@ -2890,7 +2890,7 @@ $_LANGADM['index8642a2f37a5d42b54ce53b1fbdd1583f'] = 'carts'; $_LANGADM['index13348442cc6a27032d2b4aa28b75a5d3'] = 'Search'; $_LANGADM['index4f32a32dea642737580dd71cdfd8d3c0'] = 'Quick Access'; $_LANGADM['index53cd939ae14e33855274e17a3c411fdd'] = 'For security reasons, you must also:'; -$_LANGADM['index362b56674d07160fab60725a927bbf13'] = 'deleted the /install folder'; +$_LANGADM['index362b56674d07160fab60725a927bbf13'] = 'delete the /install folder'; $_LANGADM['index7286baef44d09300636a4b99c533523c'] = 'Load time:'; $_LANGADM['indexeed2839c1e3e5f7069ed03b2f6d4c6dd'] = 'Back Office'; $_LANGADM['indexdb26e10564e958809d798e8048fcbc0a'] = 'Invalid security token'; diff --git a/translations/es/admin.php b/translations/es/admin.php index 2b94a430b..155ca376e 100644 --- a/translations/es/admin.php +++ b/translations/es/admin.php @@ -69,6 +69,9 @@ $_LANGADM['AdminAttachmentsd0042a700e9bdf79689d63ee6846dc0e'] = 'Descripción:'; $_LANGADM['AdminAttachmentsab335fe79ef8a5e26c0dbc23332a7148'] = 'Subir archivo desde su ordenador'; $_LANGADM['AdminAttachments38fb7d24e0d60a048f540ecb18e13376'] = 'Guardar'; $_LANGADM['AdminAttachments19f823c6453c2b1ffd09cb715214813d'] = 'Campo obligatorio'; +$_LANGADM['AdminAttachmentsf2a6c498fb90ee345d997f888fce3b18'] = 'Borrar'; +$_LANGADM['AdminAttachments0071aa279bd1583754a544277740f047'] = 'Borrar objeto #'; +$_LANGADM['AdminAttachments4a21a191879a23aa2a27829300da95f5'] = 'Este documento adjunto es utilizado por los siguientes productos:'; $_LANGADM['AdminAttributeGenerator233c543a23378c4ffd0e1efb17408510'] = 'Impacto en el precio'; $_LANGADM['AdminAttributeGenerator792467936100838046f749e63dadfbdb'] = 'Impacto en el peso'; $_LANGADM['AdminAttributeGenerator42dc1497090b299a41c64d1389e6ca8c'] = 'sin IVA.:'; @@ -420,6 +423,7 @@ $_LANGADM['AdminCountries00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activado'; $_LANGADM['AdminCountries5252b12033d3181aa8270eea2fd4c4d4'] = 'Opciones de Países '; $_LANGADM['AdminCountriesd14d3384847c11b0708990b3343c8dbf'] = 'País por defecto:'; $_LANGADM['AdminCountriesb017db41a29dff4007de058af406341e'] = 'El país por defecto utilizado en la tienda'; +$_LANGADM['AdminCountries91bb198c336e8b4a82bed07cffd78891'] = 'Mostrará de nuevo el diseño registrado por última vez'; $_LANGADM['AdminCountriesa86a021f16a103f44a8aa1c06e484831'] = 'Mostrará un diseño por defecto para este país'; $_LANGADM['AdminCountriesfc6bff84b96cbd12e8b2acb2cbe4c979'] = 'Mostrará'; $_LANGADM['AdminCountries96cddc4940425c2e51164e6f53ca3acf'] = 'Eliminará el actual diseño'; @@ -621,6 +625,7 @@ $_LANGADM['AdminCustomers24a23d787190f2c4812ff9ab11847a72'] = 'Estado:'; $_LANGADM['AdminCustomers125cf762f473a17738b97ee3fabe4e8b'] = 'Este cliente está registrado como'; $_LANGADM['AdminCustomers084e0343a0486ff05530df6c705c8bb4'] = 'invitado'; $_LANGADM['AdminCustomers80e915c39ca9254655d2802979aa698b'] = 'Convertir en cliente'; +$_LANGADM['AdminCustomers450a7392b73a4b434634f8fe0e3f13c8'] = 'Esta característica genera una contraseña aleatoria y envía un e-mail al cliente'; $_LANGADM['AdminCustomers81fe7d0c685ca9f1829f5ff52370d06e'] = 'Una cuenta cliente ya existe con el mismo correo electrónico'; $_LANGADM['AdminCustomersa7136d956fbff49c3912e44722dbf000'] = 'Añada una nota privada'; $_LANGADM['AdminCustomersac7ba2fb36727fd3fcbf967c27cd9dc0'] = 'Esta nota será visible para los empleados pero no para los clientes'; @@ -898,6 +903,8 @@ $_LANGADM['AdminGenerator15970c4fdbca1fc48c5b412d94e798c0'] = 'Optimización'; $_LANGADM['AdminGenerator32d593fb52ab5e4ae3f16844b576867d'] = 'Esto añadirá indicaciones al archivo. htaccess que deberían mejorar el almacenamiento en caché y la compresión.'; $_LANGADM['AdminGenerator1dec4f55522b828fe5dacf8478021a9e'] = 'URL amigables'; $_LANGADM['AdminGenerator223cf855cfa657eeb99550e1acd8eaa3'] = 'Active esta opción únicamente si el modo rewrite se encuentra activado en su servidor.'; +$_LANGADM['AdminGeneratoracaa02ab1d800ce9a0b3df2e4ab8909a'] = 'Desactivar apache MultiViews'; +$_LANGADM['AdminGenerator7dc12aaf3ebf9e01ef5b2ec91761c26a'] = 'Activar esta opción sólo si tiene problemas con algunas páginas URL en reescritura.'; $_LANGADM['AdminGenerator8b1fa347125449d64bb72e2c723cd8bf'] = 'Confuguración específica'; $_LANGADM['AdminGeneratord59b3e143646e3f3e28005adccdb36a3'] = 'Añadir aquí las directivas específicas de su hosting (SetEnv PHP_VER 5, AddType x-mapp-php5 .php...).'; $_LANGADM['AdminGeneratorb696dfaf5a833f70d71d26d052c6eaa3'] = 'Generar el \". Htaccess\" haciendo clic en el siguiente botón:'; @@ -1077,6 +1084,21 @@ $_LANGADM['AdminImagesed13a29f9258d2b988ea7ba9d11de98b'] = 'Desmarcar esta casil $_LANGADM['AdminImages729a51874fe901b092899e9e8b31c97a'] = '¿Está seguro?'; $_LANGADM['AdminImages874d3deed67e503cac1d8bc00417794a'] = 'Mover las imágenes'; $_LANGADM['AdminImages0be9bdbde253c5d649e8667c0bae6754'] = 'Un nuevo sistema de almacenamiento de imágenes de los productos ahora es utilizado por PrestaShop. Ofrece un mejor rendimiento si su tienda tiene un número muy grande de productos.'; +$_LANGADM['AdminImages0fb0d96026cc27f8a45d6cb909289903'] = 'Usted puede optar por mantener sus imágenes almacenadas en el sistema anterior - lo cual no supone ningún problema.'; +$_LANGADM['AdminImages6e9b08be274aa15f116c641e4c9b8599'] = 'También puede decidir desplazar las imágenes al nuevo sistema de almacenamiento: en este caso, pulse en \"Mover las imágenes\" botón de abajo. Por favor, sea paciente, ya que esto puede tardar varios minutos.'; +$_LANGADM['AdminImages1bd266b7c30df50f9b77b0e0f55f2878'] = 'Después de desplazar todas las imágenes de su producto, para un rendimiento óptimo vaya a la'; +$_LANGADM['AdminImagese686877843ac3c9f4c45aaea265fe59c'] = 'preferencia producto'; +$_LANGADM['AdminImages8b82bc51644c14c234bb3b635b2e2d1c'] = 'y midifique \"Activar la compatibilidad con las antiguas imágenes\" en NO.'; +$_LANGADM['AdminImagesff17d73fa2731689640e8afa0f591b0f'] = 'Las imágenes JPEG tienen un tamaño de archivo pequeño y calidad normal. Las imágenes PNG tienen un tamaño de archivo más grande, una mayor calidad y mayor transparencia. Tenga en cuenta que en todos los casos, los archivos de imagen tendrán la extensión. Jpg.'; +$_LANGADM['AdminImagesff167676b1516b34e7f9be0fea5349d6'] = 'ADVERTENCIA: Esta característica puede no ser compatible con su tema o con algunos módulos. En particular, el modo de PNG no es compatible con el módulo de marca de agua. Si encuentra algún problema, desactívelo seleccionando la opción \"Use JPEG\".'; +$_LANGADM['AdminImages42ceb344b0aaf896b362b0db70b46f98'] = 'Calidad de la imagen'; +$_LANGADM['AdminImages2a911eb0d71d1b707a3f9d722a5935c2'] = 'Use JPEG'; +$_LANGADM['AdminImagesb8d0be967a9105f094abc811656ee660'] = 'Use PNG si la imagen de base está en formato PNG'; +$_LANGADM['AdminImages718e1e271056782b288616e916511980'] = 'Usar PNG para todas las imágenes'; +$_LANGADM['AdminImagesd46bafd645c490bd4be22c4226619db9'] = 'Calidad JPEG'; +$_LANGADM['AdminImagesb73770b303fc0f331eee23ad7add197c'] = 'El rango va de 0 (a peor calidad, archivo más pequeño) a 100 (a mejor calidad, archivo más grande)'; +$_LANGADM['AdminImagesc5e26b2211d5ecbbeac96ea6e1cbb7c2'] = 'Calidad PNG'; +$_LANGADM['AdminImages2c1bbb0a5ff08c8011d6ea83084277ff'] = 'El rango va de 9 (a peor calidad, el archivo más pequeño) a 0 (a mejor calidad, el archivo más grande)'; $_LANGADM['AdminImportaf1b98adf7f686b84cd0b443e022b7a0'] = 'Categorías'; $_LANGADM['AdminImport068f80c7519d0528fb08e82137a72131'] = 'Productos'; $_LANGADM['AdminImportb9208b03bcc9eb4a336258dcdcb66207'] = 'Declinaciones'; @@ -1097,6 +1119,8 @@ $_LANGADM['AdminImporte92cfa244b5eb9025d07522080468445'] = 'Ecotasa'; $_LANGADM['AdminImport694e8d1f2ee056f98ee488bdc4982d73'] = 'Cantidad'; $_LANGADM['AdminImport8c489d0946f66d17d73f26366a4bf620'] = 'Peso'; $_LANGADM['AdminImport7a1920d61156abc05a60135aefe8bc67'] = 'Por defecto'; +$_LANGADM['AdminImport9b93b45649ec5961b8cc84e905964683'] = 'Posición de la imagen'; +$_LANGADM['AdminImport9c163d2934fbdd2775356db804d451fc'] = 'Posición de la imagen del producto para el uso de esta combinación. Si utiliza este campo, dejar URL de la imagen vacía.'; $_LANGADM['AdminImport427b6d816d7fdd86cabe48d8180a3cc9'] = 'imagen URL'; $_LANGADM['AdminImportb718adec73e04ce3ec720dd11a06a308'] = 'ID'; $_LANGADM['AdminImportfd0dcc6233b026d257763713c133cf72'] = 'Activo (0/1)'; @@ -1124,6 +1148,9 @@ $_LANGADM['AdminImportc1069a480848e06782b81b8bea9c0c94'] = 'Descripción breve'; $_LANGADM['AdminImportbede52f418b34b1ab0db65f9450bdfc3'] = 'Etiquetas (x,y,z...)'; $_LANGADM['AdminImport927f1f2b947a6e113e98af5ae86fcc49'] = 'Texto cuando haya disponible'; $_LANGADM['AdminImport77493578c6e0675711fe7355a8457668'] = 'Texto si se permiten pedidos en espera'; +$_LANGADM['AdminImportf2149c422ab7577f063b69a2884d17f0'] = 'Disponible para pedidos'; +$_LANGADM['AdminImportb1a2a959c20b1bd847895e73a5fddbc9'] = 'Fecha en la que se añadieron productos'; +$_LANGADM['AdminImporte1a5e653bc356ed6745d6814d50213eb'] = 'Mostrar precios'; $_LANGADM['AdminImport4d2589e1bcd4263cb99927b59f0f88d2'] = 'URL\'s de las imágenes (x,y,z...)'; $_LANGADM['AdminImport14913d7e9d486e77b5c8d085e3797f94'] = 'Elimine las imágenes existentes (0 = no, 1 = si)'; $_LANGADM['AdminImporte6691747add3b37b9c381b8d9476fd4c'] = 'Si no se especifica esta columna y especifica las imágenes de la columna, todas las imágenes del producto se sustituirán por las que se especifican en el archivo de importación'; @@ -1181,6 +1208,9 @@ $_LANGADM['AdminImportb0b5ccb4a195a07fd3eed14affb8695f'] = 'categorías'; $_LANGADM['AdminImport74b997703c3e7fc1db960f1366ba03ab'] = '¿antes de importar?'; $_LANGADM['AdminImportc290a5941ad6eb0d5fe8752c15c5fd78'] = 'Próximo paso'; $_LANGADM['AdminImport651463c8be1ff45540a213cfcae30cfc'] = 'Tenga en cuenta que la importación de categoría no es compatible con las categorías del mismo nombre'; +$_LANGADM['AdminImport6fa9eb1f1c5bd853188d93953b6e92b2'] = 'El archivo CSV no está disponible, por favor, cargue uno.'; +$_LANGADM['AdminImport6a84219217279f2f1ad80deda1c512d8'] = 'Puede obtener muchas informaciones sobre la importación CSV en la siguiente dirección:'; +$_LANGADM['AdminImport950770fc8c228bda83a28836b467df5d'] = 'Más información sobre el formato CSV en:'; $_LANGADM['AdminImportc78474e0acad6beccb0671eacf904543'] = 'Campos disponibles'; $_LANGADM['AdminImport1522206cca1be4bf77fff2ea9838ec2c'] = '* Campos obligatorios'; $_LANGADM['AdminImporte6fe8dc743bfea4d45a4d582e3f86150'] = 'Por favor, elija un nombre para seleccionar'; @@ -1254,6 +1284,7 @@ $_LANGADM['AdminInvoices23bf11ceb4fb51647fd977aba60246d3'] = 'Activar o desactiv $_LANGADM['AdminInvoices832d6a06e91e49828a89fb1ca4651d37'] = 'Prefijo de factura:'; $_LANGADM['AdminInvoices0df35f41ce9f64e7f14819bd4145a2be'] = 'Prefijo utilizado para las facturas'; $_LANGADM['AdminInvoicesdb2d9ca9b008f4cdb2c5902adaa84fdc'] = 'Número de factura:'; +$_LANGADM['AdminInvoicesd07d0f209cc31af1d743ea84d572c77a'] = 'La siguiente factura se iniciará con este número, y luego aumentará con cada factura adicional. Establecer en 0 si desea mantener el número actual (#'; $_LANGADM['AdminInvoicesc491f71acb93db711c341417e8c6be9e'] = 'Imprimir facturas en PDF'; $_LANGADM['AdminInvoices9a0a4f0869ab12a21407047290750e7a'] = 'Por fecha'; $_LANGADM['AdminInvoices1e6d57e813355689e9c77e947d73ad8f'] = 'Desde:'; @@ -1303,7 +1334,12 @@ $_LANGADM['AdminLanguagesc907a021c935ae6144fa2ccadfe9360d'] = 'Bandera:'; $_LANGADM['AdminLanguages581e03e07411d053e8c0f275f90fcabc'] = 'Subir bandera del país desde su ordenador'; $_LANGADM['AdminLanguages70212b3d97d23361e0ec0bc567d7ea30'] = 'Imagen \"Sin Imagen\":'; $_LANGADM['AdminLanguages2426cdf3330e330b60bb7004015207ba'] = 'Imagen para mostrar cuando \"no se encuentra la imagen\"'; +$_LANGADM['AdminLanguagesaff03422ee7ccc83301ebd200479efc1'] = '¿Es el lenguaje RTL?:'; +$_LANGADM['AdminLanguages93cba07454f06a4a960172bbd6e2a435'] = 'Sí'; $_LANGADM['AdminLanguagesb9f5c797ebbf55adccdd8539a65a0241'] = 'Desactivado'; +$_LANGADM['AdminLanguagesbafd7322c6e97d25b6299b5d6fe8920b'] = 'No'; +$_LANGADM['AdminLanguagese6ced2c612d5024c1a2331cdf96e1c33'] = 'Activar si el idioma se escribe de derecha a izquierda.'; +$_LANGADM['AdminLanguages886815cb03a02e29a28906c196292ba0'] = '(Experimental: el tema debe ser compatible con el lenguaje RTL)'; $_LANGADM['AdminLanguages24a23d787190f2c4812ff9ab11847a72'] = 'Estado:'; $_LANGADM['AdminLanguages4c85fb98bf7cfd94c638d0f4e4e39b92'] = 'Permitir o no que el cliente seleccione este idioma'; $_LANGADM['AdminLanguages6ed8662bd9b7b3f59b193010be0c0f4a'] = 'Compruebe si un paquete de idiomas se encuentra disponible para este código ISO...'; @@ -1736,6 +1772,8 @@ $_LANGADM['AdminPPreferences048a517fd1781ed314402df592f2ea68'] = 'Ancho de la im $_LANGADM['AdminPPreferencesc9c4e9c1a92d9b15e0cdefc7ddb1bbd5'] = 'El ancho máximo de imágenes cargable por los clientes'; $_LANGADM['AdminPPreferences9a61f5ce3180789a8455f536681cabc1'] = 'Altura de la imagen del artículo'; $_LANGADM['AdminPPreferencesdde6c96bcb0af50f18f37572267d904a'] = 'La altura máxima de imágenes cargable por los clientes'; +$_LANGADM['AdminPPreferences044a77653804fe33652d68098d98121e'] = 'Activar la compatibilidad con las imágenes antiguas'; +$_LANGADM['AdminPPreferencese7ed00268dc16aecaac5a60aeb6f4c73'] = 'Debe permanecer en \"Sí\" a menos que haya desplazado con éxito las imágens a la pestaña Preferencias>Imagen'; $_LANGADM['AdminPPreferences068f80c7519d0528fb08e82137a72131'] = 'Productos'; $_LANGADM['AdminPaymenta75b01d1ff66cd0a327bda1effa71dec'] = 'Lista de los módulos de pago'; $_LANGADM['AdminPayment1f3a05f7b45df8e5c5cafaf0485eedd5'] = 'Pulsar para ver la lista de los módulos de pago'; @@ -1823,6 +1861,9 @@ $_LANGADM['AdminPreferences1656072e927c8d3acd24359cbb648bb5'] = 'Activar SSL'; $_LANGADM['AdminPreferences8de64d6b49cebd2306af6ddbcd268700'] = 'Si su hosting permite SSL, puede activar la encripción del SSL (https://) para la identificación de la cuenta del usuario y el proceso de pedido '; $_LANGADM['AdminPreferencesed5454727fb14b9800ead242d0972184'] = 'Comprobar IP de la cookie'; $_LANGADM['AdminPreferences9cfc2e28ebe44b3e14f9d780d2150650'] = 'Compruebe la dirección IP del cookie afin de evitar el robo de cookies'; +$_LANGADM['AdminPreferencesc87330f475e4384552c0077927d26e1a'] = 'Duración de vida del cookie de Front Office'; +$_LANGADM['AdminPreferences6d964e25aa6aa88c8353880e00202cf4'] = 'Indique el número de horas'; +$_LANGADM['AdminPreferencese673b146824251548feecf1f3929aceb'] = 'Duración del cookie de Back Office'; $_LANGADM['AdminPreferencese12874163bcb256726ddfe643aa53a63'] = 'Incrementar la seguridad del Front Office'; $_LANGADM['AdminPreferencescce43372fe8624c0edf870f417557b84'] = 'Activar o desactivar el modo en el Front Office con el fin de mejorar la seguridad de PrestaShop'; $_LANGADM['AdminPreferences16c390c0fd1efc4f493a6a861aa22d2f'] = 'Burbujas de ayuda Back-Office'; @@ -1867,6 +1908,7 @@ $_LANGADM['AdminPreferences432eb00cc8aace97c632fea212575b51'] = 'Importar el tem $_LANGADM['AdminPreferences2b5bde814a5f94ea73f447cdbcfb49fd'] = 'Tema instalador'; $_LANGADM['AdminPreferences64915993f11c4fbd47d8a6465f44125c'] = 'Cuando haya importado el tema, por favor selecciónelo en esta página'; $_LANGADM['AdminPreferences21034ae6d01a83e702839a72ba8a77b0'] = '(tasas no incluídas)'; +$_LANGADM['AdminPreferencesc770d8e0d1d1943ce239c64dbd6acc20'] = 'Añadir a mi IP'; $_LANGADM['AdminPreferences6a7a397c4d4b5842440eb4eab1f7af8c'] = 'Si modifica el tema, el archivo settings.inc.php debe ser accesible en escritura (chmod 755 / 777)'; $_LANGADM['AdminPreferences38fb7d24e0d60a048f540ecb18e13376'] = 'Guardar'; $_LANGADM['AdminPreferences19f823c6453c2b1ffd09cb715214813d'] = 'Campos obligatorios'; @@ -2087,8 +2129,15 @@ $_LANGADM['AdminProductse5f7f63d66023847e693fd34bea09d41'] = 'Por defecto:'; $_LANGADM['AdminProducts0871f875dff8224be3247ccedea01024'] = 'marcar como'; $_LANGADM['AdminProductsd0834fcec6337785ee749c8f5464f6f6'] = 'Preferencias'; $_LANGADM['AdminProducts9d9aa88574c4dab04ddd8356c377357d'] = 'Categoría por defecto:'; +$_LANGADM['AdminProducts3faccbfcb5f35451302dcaff3af6cd3f'] = 'Por favor marque una categoría para seleccionar la categoría predeterminada.'; +$_LANGADM['AdminProducts8cf04a9734132302f96da8e113e80ce5'] = 'Inicio'; +$_LANGADM['AdminProductsef7de3f485174ff47f061ad27d83d0ee'] = 'seleccionado'; +$_LANGADM['AdminProductsb56c3bda503a8dc4be356edb0cc31793'] = 'Contraer todos'; +$_LANGADM['AdminProducts5ffd7a335dd836b3373f5ec570a58bdc'] = 'Desplegar todo'; +$_LANGADM['AdminProducts5e9df908eafa83cb51c0a3720e8348c7'] = 'Marcar todos'; +$_LANGADM['AdminProducts9747d23c8cc358c5ef78c51e59cd6817'] = 'Desmarcar todos'; $_LANGADM['AdminProductsd88946b678e4c2f251d4e292e8142291'] = 'SEO'; -$_LANGADM['AdminProducts2651608f8f1c6f391f919be228a6ee62'] = 'Haga clic aquí para mejorar su presencia en los buscadores (SEO)'; +$_LANGADM['AdminProducts2651608f8f1c6f391f919be228a6ee62'] = 'Pulse aquí para mejorar su presencia en los buscadores (SEO)'; $_LANGADM['AdminProducts7b250cb374c12c42a75227ba75df7779'] = 'Meta título:'; $_LANGADM['AdminProducts18a2ecd7e67529945cf93821d3fc438f'] = 'Título de la página del producto; dejar en blanco para usar el nombre del producto'; $_LANGADM['AdminProductsa6bb76858f8b4b61c050ad7a7ac57e06'] = 'Meta descripción:'; @@ -2098,6 +2147,7 @@ $_LANGADM['AdminProducts6d3adfeed355509b6aee5588e66d0157'] = 'Palabras clave par $_LANGADM['AdminProducts02fa003c38fefcda498b876f67f4cac7'] = 'URL amigables:'; $_LANGADM['AdminProducts03a1790c522058303088150cfb8b7353'] = 'Sólo se autorizan letras y símbolos \"menos\"'; $_LANGADM['AdminProducts32b919d18cfaca89383f6000dcc9c031'] = 'Generar'; +$_LANGADM['AdminProductsb06f68603b4cf2f867480c4d1eb6a611'] = 'url amigable basada en el nombre del producto.'; $_LANGADM['AdminProducts92ab5edf4194cb5a84d6808cb8d8b696'] = 'El enlace del producto aparecerá como:'; $_LANGADM['AdminProducts234078adec0a64008b6ae77653776cfa'] = 'Breve descripción:'; $_LANGADM['AdminProducts83d4043f36afbc6c2549ec9309d9aee8'] = 'aparecerá en el resultado de las búsquedas'; @@ -2191,6 +2241,8 @@ $_LANGADM['AdminProductsd1a1006c2d7ebf87d5e4d934a138e5a5'] = 'Debe guardar el pr $_LANGADM['AdminProducts4492081ca02b059f9e8af4ddaf0f7292'] = 'Paquete'; $_LANGADM['AdminProducts2811dedc85918c3e3ed0becd87cbb336'] = 'No se puede añadir productos descargables a un paquete.'; $_LANGADM['AdminProductsc7a915a59b56dc898c0ae52b64bed0c5'] = 'Añadir un elemento al pack'; +$_LANGADM['AdminProducts126ddccbd9f946b8cd46d88b304a2020'] = 'Por favor, seleccione al menos un producto.'; +$_LANGADM['AdminProductsd764262872a3bfe2b0944d1826f43a88'] = 'Por favor, indique una cantidad para añadir un producto.'; $_LANGADM['AdminProducts10cbdb4839f838ce30409739435a6070'] = 'Catálogo'; $_LANGADM['AdminProductsb61bd19699eab41bbcdabc42f83af268'] = 'Considere la posibilidad de cambiar la categoría predeterminada.'; $_LANGADM['AdminProducts74645ed4e5e25461a664d5f68ff19098'] = 'Marcar la o las categorías en las que aparecen el o los productos'; @@ -2738,6 +2790,7 @@ $_LANGADM['AdminTaxesb718adec73e04ce3ec720dd11a06a308'] = 'ID'; $_LANGADM['AdminTaxes49ee3087348e8d44e1feda1917443987'] = 'Nombre'; $_LANGADM['AdminTaxesdcb66ff6e4a2517ade22183779939c9d'] = 'Conversión'; $_LANGADM['AdminTaxes00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activado'; +$_LANGADM['AdminTaxes5f7d9a7f76dba4bc86062ea848255f2f'] = 'Si se desactiva la ecotasa, el impuesto ecológico para todos los productos se establece en 0'; $_LANGADM['AdminTaxes1c669d037f8bc785f0e1a9aeb7070367'] = 'Opciones de impuestos'; $_LANGADM['AdminTaxes50068b9a709a0e2da6f25210de57bb85'] = 'Activar impuestos'; $_LANGADM['AdminTaxes7c9ad104937545220eb5ac67fb1ee9d9'] = 'Seleccione si incluye o no los impuestos en las compras'; @@ -2894,58 +2947,150 @@ $_LANGADM['AdminTranslations52d83d7ed502b33d300a8c0af2c5b455'] = 'Lista de los t $_LANGADM['AdminTranslationsc21f969b5f03d33d43e04f8f136e7682'] = 'defecto'; $_LANGADM['AdminTranslationsa9e4402481bd9b8e36752bf731f67eb6'] = 'Tema'; $_LANGADM['AdminTranslations53b3cae42737979c884275593a01f468'] = 'Módulo:'; -$_LANGADM['AdminUpgrade19f823c6453c2b1ffd09cb715214813d'] = 'Los campos obligatorios'; +$_LANGADM['AdminUpgrade875b8a59022d232837491c0fdfacb4ab'] = 'No guardar las imágenes'; +$_LANGADM['AdminUpgrade8ec641624329d6ff15d8c4c9e8e6c2c8'] = 'Puede excluir el directorio de imágenes de copia de seguridad si ya lo salvó de otra forma. (No recomendado)'; +$_LANGADM['AdminUpgradeaf98608eaedd4ba7ffd47a0204e84b23'] = 'Mantener el tema \"prestashop\"'; +$_LANGADM['AdminUpgrade6e9e9426b91777a0d15f2b730277ed9f'] = 'Si ha personalizado el tema prestashop por defecto, puede protegerlo de una actualización (no recomendado)'; +$_LANGADM['AdminUpgrade9377a7cc364ce06c1830eeb7a31202bb'] = 'No mantener las traducciones'; +$_LANGADM['AdminUpgrade51bbcf7afb0f8d35501d0a7b28979b06'] = 'Si establece \"sí\", mantendrá todas sus traducciones'; +$_LANGADM['AdminUpgrade8c8194a465f0163a6724907755ac1b82'] = 'El modo manual'; +$_LANGADM['AdminUpgradedd9dbd4916653d683244119a067ca467'] = 'Seleccione esta opción si desea que se detenga después de cada paso'; +$_LANGADM['AdminUpgradee7b6d601ff4e9069e726927e211274ea'] = 'El uso de Subversion'; +$_LANGADM['AdminUpgradea15b09729294cf7fea1096f970a0fed4'] = 'Seleccione esta opción si desea utilizar una versión inestable en lugar de lanzamiento oficial'; +$_LANGADM['AdminUpgrade36be1130454bc8c4e0a41d36fa062a8b'] = 'no puede crear el directorio% s'; +$_LANGADM['AdminUpgrade6824d57b7af37f605bd97d34defc3761'] = 'Svn export terminada. Eliminación de archivos de ejemplo ...'; +$_LANGADM['AdminUpgradef70307d8297e48a8783d41e6f3313d51'] = 'error al exportar svn'; +$_LANGADM['AdminUpgrade4eecd9c195e46c054ef7da6d9d1a738b'] = 'Extracción terminada. Eliminación de archivos de ejemplo ...'; +$_LANGADM['AdminUpgrade0929f38eaac3ca38801f08b7269574e0'] = 'imposible extraer% 1 $ s en% 2 $ s ...'; +$_LANGADM['AdminUpgrade6b2d0404b7faba0e791e15a52586a149'] = 'cambiar a svn checkout (use Svn establece en true)'; +$_LANGADM['AdminUpgradef0e38ac0c558a7f216ae98382b9e58f5'] = 'Tienda desactivada. Descarga en curso (esto puede tomar algún tiempo) ...'; +$_LANGADM['AdminUpgrade4f7c02592a962e40a920f32f3a24f2df'] = 'filesToUpgrade no es una matriz'; +$_LANGADM['AdminUpgrade3f10faa8b44a7175ae8fc5dcb8dec5de'] = 'Todos los archivos actualizados. Actualización de bases de datos en curso.'; +$_LANGADM['AdminUpgrade1ad932e3b85eb2907a817cd3e3e6907e'] = 'error al intentar actualizar% s'; +$_LANGADM['AdminUpgrade078a325fbcc1dbd50bd9f969ce954965'] = '% 2 $ s archivos que quedan por actualizar..'; +$_LANGADM['AdminUpgrade62740df131433ec9d45bf1810eefb19b'] = 'error durante la actualización Db'; +$_LANGADM['AdminUpgrade9a2f2cf276ea9f79b31a815897c0e3e6'] = '% S ignorada'; +$_LANGADM['AdminUpgrade63ded4905ba41ac4bf00373df2739576'] = 'creación de dir% 2 $ s. Quedan aún % 3 $ s archivos por actualizar..'; +$_LANGADM['AdminUpgrade11978affb3b0dbb16c50d571fd05de6d'] = 'error al crear directorio% s'; +$_LANGADM['AdminUpgrade1b854285afc1988b6f83414fde5943ab'] = '% 1 $s copiado en% 2 $ s. Quedan aún % 3 $ s archivos por actualizar.'; +$_LANGADM['AdminUpgrade0e06ce0972ad338e1d96e8589dc21b9c'] = 'error de copia% 1 $ s en% 2 $ s'; +$_LANGADM['AdminUpgrade0511620a3a1d6036d3fbe47b131d7c4b'] = 'Archivos restaurados, restauración de la base de datos en curso.'; +$_LANGADM['AdminUpgrade791403f158965a3e19f8627c7b744126'] = 'Base de datos restaurada'; +$_LANGADM['AdminUpgrade5f7f50973696d0a42c1efcc07f7820a0'] = 'Su sitio web ya está restaurado...'; +$_LANGADM['AdminUpgrade28517b8a291c50d80aa53a078407065b'] = 'directorio raíz limpio'; +$_LANGADM['AdminUpgradebb71892737d721949538d6e1c4d3d22d'] = 'Archivos restaurados. No se ha encontrado ninguna copia de seguridad de base de datos.. Restauración terminada.'; +$_LANGADM['AdminUpgradecb7dce5f6a1934d54c0d3335c7ffe841'] = 'Archivos restaurados.'; +$_LANGADM['AdminUpgrade8efc36d230f76fbfd9e4d758964e9414'] = 'imposible extraer $ 1 $ s en% 2 $ s.'; +$_LANGADM['AdminUpgraded7624db09c15d46cd37d7709ae05e44b'] = 'no se conoce copia de seguridad. nada que restaurar.'; +$_LANGADM['AdminUpgrade09a362e2dd3800f8fbc55d3446513f65'] = 'No hay nada que restaurar (ninguna solicitud encontrada)'; +$_LANGADM['AdminUpgrade66c4cbfb21f294b233692b67356db647'] = 'Copia de seguridad de base de datos realizada en% s. Actualización de los archivos en curso.'; +$_LANGADM['AdminUpgrade48f95ff09327408a578e91655ed872a1'] = 'Archivos de% s para copia de seguridad.'; +$_LANGADM['AdminUpgrade70960f2aa87d307170d3a1bc3e06d904'] = 'los archivos de copia de seguridad se inician en% s'; +$_LANGADM['AdminUpgrade8cf728d701c50a59ef78b7c55fc27cd4'] = 'Los archivos de copia de seguridad en curso. Archivos% s izquierda'; +$_LANGADM['AdminUpgrade15b353ca964fe816547e67e1508ff85d'] = 'Todos los archivos guardados. Base de datos de seguridad en curso.'; +$_LANGADM['AdminUpgradea25c4f085558c5f6e519e56257af531f'] = 'todos los ficheros se han agregado al archivo.'; +$_LANGADM['AdminUpgrade91f805cf850500bda66426aea042602f'] = '% 1 $ s añadió al archivo. % 2 $ s izquierda.'; +$_LANGADM['AdminUpgradef79479c0de75d568def0afdc1e5de04e'] = 'error al intentar agregar% 1 $ s en% 2 $ s. el archivo'; +$_LANGADM['AdminUpgradeb9a2db69065827812dd4b7a7f9ffc0b1'] = 'no se puede abrir archivo'; +$_LANGADM['AdminUpgrade2589a25910cd3d7fab7e45361c4cb39d'] = '% 1 $ s eliminado. % 2 $ s elementos de la izquierda'; +$_LANGADM['AdminUpgraded82eef1ba081c54686767c555670c0fe'] = 'error al eliminar% 1 $ s,% 2 $ s elementos de la izquierda'; +$_LANGADM['AdminUpgrade344c592d141604c614c219fad3fa0dae'] = 'A partir de eliminar% 1 $ s archivos de ejemplo'; +$_LANGADM['AdminUpgrade0baf8c94d1d03d1621c17cd6eabf7b9f'] = 'Todos los archivos de muestra extraídos. Archivos de copia de seguridad en curso.'; +$_LANGADM['AdminUpgrade84e31682487d5a0937f9184ebcf594ba'] = 'copia de trabajo ya% s hasta a la fecha. ahora exportar a más dir'; +$_LANGADM['AdminUpgrade762ab46f0b1e4eae1526ca7d637926f3'] = 'Actualización de SVN hecho por s de trabajo copy%. ahora exportar a más ...'; +$_LANGADM['AdminUpgradedcefd261c0dea53fdb159b218503009e'] = 'SVN Checkout hecho de% s. ahora exportar a más ...'; +$_LANGADM['AdminUpgrade8f4c8c87daa3bc0311cfb61b7d36e27b'] = 'SVN Checkout error ...'; +$_LANGADM['AdminUpgrade0e81132066d433d212e237678e1193a3'] = 'no se permite usar svn'; +$_LANGADM['AdminUpgradeb0d51f91a1118b7c39ee1835cc6c926a'] = 'Descarga completa. En curso la extracción'; +$_LANGADM['AdminUpgrade0c0db54fe8212c1a7215005fef75d7dd'] = 'Error durante la descarga'; +$_LANGADM['AdminUpgrade93120c07d8c5cee44042627cd493e0e0'] = 'necesita allow_url_fopen para descarga automática. También puede cargar manualmente en% s'; +$_LANGADM['AdminUpgrade19f823c6453c2b1ffd09cb715214813d'] = 'Campo obligatorio'; $_LANGADM['AdminUpgrade760c4026bc5a0bd5378e6efc3f1370b4'] = '¡Demasiado largo!'; $_LANGADM['AdminUpgrade4f2e28904946a09d8c7f36dd3ee72457'] = '¡Los campos son diferentes!'; -$_LANGADM['AdminUpgrade43b01d1a6c5065545c65f42003b0ab5c'] = '¡Dirección no válida!'; -$_LANGADM['AdminUpgrade2e170dfd78c2171a25605ececc0950a4'] = '¡No se puede enviar un correo electrónico!'; -$_LANGADM['AdminUpgrade6deee80e4bdb8894331994116818558e'] = 'Error en la creación del archivo de configuración, si el archivo /config/settings.inc.php existe, por favor dele derechos púplicos deescritura; si no, cree un archivo settings.inc.php en el repertorio de configuración (/config/)'; -$_LANGADM['AdminUpgradeaa946cb00b1c23ff6553b6f9e05da151'] = 'El archivo de parámetros no pudo escribirse, cree un archivo llamado settings.inc.php en su repertorio de configuración.'; -$_LANGADM['AdminUpgradee930e2474c664a3a7e89ecfb8793694b'] = '¡No se puede enviar el archivo!'; -$_LANGADM['AdminUpgrade774fc7a0f56391abc5d8856f2436ca07'] = 'La integridad de los datos no está validada.'; -$_LANGADM['AdminUpgrade8fd007bf08e0717537825a3e91cb4fcc'] = 'No se puede leer el contenido de un archivo *.sql.'; -$_LANGADM['AdminUpgradec71e825f6873f64b91efc26313614eab'] = 'No se puede acceder al contenido de un archivo *.sql.'; -$_LANGADM['AdminUpgrade3d5c8f1d29b1a1dc4ea0673122e0d277'] = 'Error al insertar en la base de datos:'; -$_LANGADM['AdminUpgrade17e1581d01152347bfaacd153b961379'] = 'Contraseña incorrecta (alfa-cadena numérica de al menos 8 caracteres)'; -$_LANGADM['AdminUpgrade9b9f3b2f8a4dffcad9188c8fc4b468c8'] = 'Ya existe una base de datos PrestaShop con este prefijo, debe eliminarla manualmente o cambiar el prefijo.'; -$_LANGADM['AdminUpgradebc5e1163a15106f9e941a7603124709d'] = 'Esto no es un nombre válido.'; -$_LANGADM['AdminUpgradea9d82945b8603f0c8807958d7db9a24d'] = 'Esto no es una imagen válida.'; +$_LANGADM['AdminUpgrade43b01d1a6c5065545c65f42003b0ab5c'] = '¡Esta dirección de correo electrónico es incorrecta!'; +$_LANGADM['AdminUpgrade2e170dfd78c2171a25605ececc0950a4'] = '¡Imposible enviar el correo electrónico!'; +$_LANGADM['AdminUpgrade6deee80e4bdb8894331994116818558e'] = 'No se puede crear el archivo de configuración, si / config / settings.inc.php existe, por favor, dar los permisos de escritura pública de este archivo, de lo contrario por favor, cree un archivo llamado settings.inc.php en el directorio config.'; +$_LANGADM['AdminUpgradeaa946cb00b1c23ff6553b6f9e05da151'] = 'No se puede escribir archivo de configuración, por favor, cree un archivo llamado settings.inc.php en el directorio config.'; +$_LANGADM['AdminUpgradee930e2474c664a3a7e89ecfb8793694b'] = '¡Imposible cargar el archivo!'; +$_LANGADM['AdminUpgrade8fd007bf08e0717537825a3e91cb4fcc'] = 'Imposible leer el contenido de un archivo de contenido MySQL.'; +$_LANGADM['AdminUpgradec71e825f6873f64b91efc26313614eab'] = 'Imposible el acceso al contenido de un archivo de MySQL.'; +$_LANGADM['AdminUpgrade3d5c8f1d29b1a1dc4ea0673122e0d277'] = 'Error al insertar datos en la base de datos:'; +$_LANGADM['AdminUpgrade17e1581d01152347bfaacd153b961379'] = 'La contraseña es incorrecta (cadena alfanumérica de 8 caracteres como mínimo).'; +$_LANGADM['AdminUpgradebc5e1163a15106f9e941a7603124709d'] = 'Esto no es un nombre de archivo válido.'; +$_LANGADM['AdminUpgradea9d82945b8603f0c8807958d7db9a24d'] = 'Esto no es un archivo de imagen válido.'; $_LANGADM['AdminUpgradeb37eef07b764ea58eec9afe624e20a40'] = 'Error al crear el archivo /config/settings.inc.php.'; $_LANGADM['AdminUpgrade3d9f514d46849760ef1b1412e314fd99'] = 'Error :'; -$_LANGADM['AdminUpgrade504053ab4c6d648edf11624f1bea4bb4'] = 'Esta base de datos ya existe PrestaShop, por favor, valide de nuevo sus credenciales en la base de datos.'; +$_LANGADM['AdminUpgrade504053ab4c6d648edf11624f1bea4bb4'] = 'Esta base de datos PrestaShop ya existe. Por favor, vuelva a validar su información de autenticación para la base de datos.'; $_LANGADM['AdminUpgraded7a99f61bb284d096ea4f221784af85a'] = 'Se ha producido un error al cambiar el tamaño de la imagen.'; -$_LANGADM['AdminUpgrade428c933bafbf262d693fbf1c22c03e5d'] = '¡La base de datos se ha encontrado!'; -$_LANGADM['AdminUpgrade76bd190129b7aefb90fdf42f09ec3ec7'] = 'La base de datos del servidor está disponible, pero la base de datos no se ha encontrado '; -$_LANGADM['AdminUpgrade045f4b5c3f990e5a26e2837495d68259'] = 'La base de datos de servidor no se ha encontrado, por favor, compruebe sus datos de acceso o el nombre de servidor.'; -$_LANGADM['AdminUpgrade757fc72e8d69106dd2cf9da22cc7adb1'] = 'Se ha producido un error al enviar el correo electrónico, gracias por verificar la configuración.'; -$_LANGADM['AdminUpgraded18ad19290b3bfc3cd0d7badbb6cb6a3'] = 'No se puede escribir la imagen /img/logo.jpg. Si ya existe, por favor, suprímala manualmente.'; -$_LANGADM['AdminUpgrade2368e33e3e01d53abb9b60061ab83903'] = 'El archivo enviado supera el tamaño máximo permitido.'; -$_LANGADM['AdminUpgradea10ef376d9f4c877ac86d8e4350116bf'] = 'El archivo enviado supera el tamaño máximo permitido.'; -$_LANGADM['AdminUpgradef8fe8cba1625eaf8e5c253b041d57dbd'] = 'El archivo fue parcialmente enviado.'; -$_LANGADM['AdminUpgrade8c9067e52e4440d8a20e74fdc745b0c6'] = 'No se ha enviado ningún archivo'; -$_LANGADM['AdminUpgrade2384d693d9af53b4727c092af7570a19'] = 'Carece de la carpeta temporal para recibir su archivo de correo. ¡Por favor consulte su administrador de sistema!'; -$_LANGADM['AdminUpgradef5985b2c059d5cc36968baab7585baba'] = 'No se pueden escribir archivos en el disco'; -$_LANGADM['AdminUpgrade9e54dfe54e03b0010c1fe70bd65cd5e6'] = 'Carga de archivos interrumpido a causa de la extensión incorrecta'; -$_LANGADM['AdminUpgrade32af3a59b50e98d254d6c03c5b320a94'] = 'No se pueden convertir los datos de su base de datos en UTF-8.'; -$_LANGADM['AdminUpgrade989a45a4ca01ee222f4370172bf8850d'] = 'Nombre de la tienda no válido'; -$_LANGADM['AdminUpgrade68499acecfba9d3bf0ca8711f300d3ed'] = 'Su nombre contiene caracteres no válidos'; +$_LANGADM['AdminUpgrade428c933bafbf262d693fbf1c22c03e5d'] = '¡Conexión a la base de datos disponible!'; +$_LANGADM['AdminUpgrade76bd190129b7aefb90fdf42f09ec3ec7'] = 'El servidor de base de datos está disponible, pero la base de datos no se encuentra'; +$_LANGADM['AdminUpgrade045f4b5c3f990e5a26e2837495d68259'] = 'El servidor de base de datos no se encuentra. Por favor, compruebe los campos de login, contraseña y servidor.'; +$_LANGADM['AdminUpgrade757fc72e8d69106dd2cf9da22cc7adb1'] = 'Se ha producido un error al enviar el correo, por favor verifique sus parámetros.'; +$_LANGADM['AdminUpgraded18ad19290b3bfc3cd0d7badbb6cb6a3'] = 'Imposible escribir la imagen / img / logo.jpg. Si esta imagen ya existe, bórrela.'; +$_LANGADM['AdminUpgrade2368e33e3e01d53abb9b60061ab83903'] = 'El archivo subido excede la directiva upload_max_filesize en php.ini'; +$_LANGADM['AdminUpgradef8fe8cba1625eaf8e5c253b041d57dbd'] = 'El archivo subido fue sólo parcialmente cargado'; +$_LANGADM['AdminUpgrade8c9067e52e4440d8a20e74fdc745b0c6'] = 'No existe el fichero que se ha subido.'; +$_LANGADM['AdminUpgrade2384d693d9af53b4727c092af7570a19'] = 'Falta una carpeta temporal'; +$_LANGADM['AdminUpgradef5985b2c059d5cc36968baab7585baba'] = 'No se pudo escribir el archivo en el disco'; +$_LANGADM['AdminUpgrade32af3a59b50e98d254d6c03c5b320a94'] = 'Imposible convertir los datos de su base de datos a utf-8.'; +$_LANGADM['AdminUpgrade989a45a4ca01ee222f4370172bf8850d'] = 'Nombre de tienda no válido'; +$_LANGADM['AdminUpgrade68499acecfba9d3bf0ca8711f300d3ed'] = 'Sunombre de pila contiene caracteres no válidos'; $_LANGADM['AdminUpgrade2399cf4ca7b49f2706f6e147a32efa78'] = 'Su apellido contiene caracteres no válidos'; -$_LANGADM['AdminUpgrade7d72600fcff52fb3a2d2f73572117311'] = 'La base de datos del servidor no es compatible con UTF-8.'; -$_LANGADM['AdminUpgrade5b9bbadcf96f15e7f112c13a9e5f076e'] = 'El soporte de este motor de base de datos no se puede soportar, elija otro como por ejemplo MyISAM'; -$_LANGADM['AdminUpgrade24b481455c1b72b0c2539e7d516b9582'] = 'El archivo /img/logo.jpg no tiene derechos de escritura, por favor efectúe un CHMOD 755 o 777 en el archivo'; -$_LANGADM['AdminUpgrade5746b74663148afffd1350c97d4fcdfe'] = 'Campo modo catálogo no válido'; -$_LANGADM['AdminUpgradedafe44b99256a7783bc37f4f949da373'] = 'Este instalador es demasiado viejo.'; -$_LANGADM['AdminUpgrade37ce0f29c7377c827e7247fe5645a782'] = 'Ya está en posesión de la versión %s'; -$_LANGADM['AdminUpgrade89928a14f2090aec4fd7aff9ea983f95'] = 'Ninguna versión anterior detectada. ¿Puede borrar o renombrar el archivo de configuración settings.inc.php archivo?'; -$_LANGADM['AdminUpgrade5276a8cbd9e3e467396089b267564f51'] = 'Config/settings.inc.php no se ha encontrado. ¿Ha eliminado o cambiado de nombre?'; -$_LANGADM['AdminUpgrade24784d9e80638781b74c017b33d8ca0c'] = 'Imposible encontrar uno de los archivos de puesta al día SQL. Por favor, compruebe que el archivo /install/sql/upgrade no está vacío.'; -$_LANGADM['AdminUpgrade580e4b216e324f675f0237cdb34b6c2d'] = 'No existe actualización'; -$_LANGADM['AdminUpgradef15e7e7292b0c72894cf45a893e0d497'] = 'Error al abrir el archivo SQL'; -$_LANGADM['AdminUpgradeb8286438fbb6c7df9129fadc5316c19f'] = 'Error al insertar en la base de datos'; -$_LANGADM['AdminUpgrade229ee8046cafc09ddaf46fb9db710e91'] = 'Desgraciadamente,'; -$_LANGADM['AdminUpgradee805a556799b7cef40e9760c81d99218'] = 'Han aparecido errores de SQL.'; -$_LANGADM['AdminUpgrade5627353fd6ac678497af3ece05087068'] = 'El archivo config/defines.inc.php no se ha encontrado. ¿Dónde se encuentra?'; +$_LANGADM['AdminUpgrade7d72600fcff52fb3a2d2f73572117311'] = 'Su base de datos no es compatible con el juego de caracteres UTF-8.'; +$_LANGADM['AdminUpgrade5b9bbadcf96f15e7f112c13a9e5f076e'] = 'El servidor MySQL no es compatible con este motor, por favor utilice otro como MyISAM'; +$_LANGADM['AdminUpgrade24b481455c1b72b0c2539e7d516b9582'] = 'El archivo / img / logo.jpg no se puede escribir, por favor, CHMOD 755 el archivo o 777 CHMOD'; +$_LANGADM['AdminUpgrade5746b74663148afffd1350c97d4fcdfe'] = 'Modo de catálogo no válido'; +$_LANGADM['AdminUpgrade9e5459c4deb20b7842ac01e97390b334'] = 'No dispone de código de error'; +$_LANGADM['AdminUpgradedafe44b99256a7783bc37f4f949da373'] = 'Este instalador es demasiado antiguo.'; +$_LANGADM['AdminUpgrade37ce0f29c7377c827e7247fe5645a782'] = 'Usted ya tiene el % s de la versión.'; +$_LANGADM['AdminUpgrade89928a14f2090aec4fd7aff9ea983f95'] = 'No hay ninguna versión anterior. ¿Sabe borrar o renombrar el fichero de configuración / settings.inc.php?'; +$_LANGADM['AdminUpgrade5276a8cbd9e3e467396089b267564f51'] = 'El archivo de configuración / settings.inc.php no fue encontrado. ¿Sabe borrar o renombrar este archivo?'; +$_LANGADM['AdminUpgrade24784d9e80638781b74c017b33d8ca0c'] = 'No se puede encontrar los archivos de actualización de SQL. Por favor, verifique que la instalación / / sql / carpeta de actualización no está vacía)'; +$_LANGADM['AdminUpgrade580e4b216e324f675f0237cdb34b6c2d'] = 'No hay posibilidad de cambio.'; +$_LANGADM['AdminUpgradef15e7e7292b0c72894cf45a893e0d497'] = 'Error al cargar el archivo de actualizaciones de SQL.'; +$_LANGADM['AdminUpgradeb8286438fbb6c7df9129fadc5316c19f'] = 'Error al insertar el contenido en la base de datos'; +$_LANGADM['AdminUpgrade229ee8046cafc09ddaf46fb9db710e91'] = 'Por desgracia,'; +$_LANGADM['AdminUpgradee805a556799b7cef40e9760c81d99218'] = 'Se han producido errores de SQL.'; +$_LANGADM['AdminUpgrade5627353fd6ac678497af3ece05087068'] = 'El archivo de configuración / defines.inc.php no fue encontrado. ¿A dónde lo ha desplazado?'; +$_LANGADM['AdminUpgrade446c9e952debe114c86bbd9e5eea7d61'] = 'Rollback'; +$_LANGADM['AdminUpgrade4879913b16fa23f723f70a5067bda8d4'] = 'No dispone de rollback'; +$_LANGADM['AdminUpgradefff66e9b3d962fa319c8068b5c1997cd'] = 'rollback'; +$_LANGADM['AdminUpgradeebdabc2d40aa563aabbb3ee57915a7a9'] = 'Pulse para restaurar% s'; +$_LANGADM['AdminUpgradee9c57c7fbc335e66282a32617b01b9be'] = 'Su configuración actual'; +$_LANGADM['AdminUpgrade8d93c2da70e3baf49fe03ecbc19ac608'] = 'el directorio raíz'; +$_LANGADM['AdminUpgrade2fc4ab825ce2ce9476e8a1c2211ac9b8'] = 'El directorio raíz'; +$_LANGADM['AdminUpgradeede62c591a867451227643268f5b40af'] = 'el directorio raíz es totalmente modificable'; +$_LANGADM['AdminUpgrade3e992446a190ccfadbebcce061984025'] = 'el directorio raíz no se puede escribir en forma recursiva'; +$_LANGADM['AdminUpgrade31a962ffeb06a6cc6d58ef3ba5fae2b7'] = 'Autoactualización permitida'; +$_LANGADM['AdminUpgrade9c30a74657158984997cca4930d6075b'] = 'Este lanzamiento permitirá autoactualización.'; +$_LANGADM['AdminUpgradeaf566be1636d11ecc8ddb728a15520b8'] = 'Este comunicado no permite autoactualización'; +$_LANGADM['AdminUpgrade4d3d769b812b6faa6b76e1a8abaece2d'] = 'Activo'; +$_LANGADM['AdminUpgrade3cab03c00dbd11bc3569afa0748013f0'] = 'Inactivo'; +$_LANGADM['AdminUpgradeb2e1c91a22797b8d78f9c4adb01a8f17'] = 'Estado de la tienda '; +$_LANGADM['AdminUpgrade0a08c84bcebc299204970d219acc54c0'] = 'php plazo'; +$_LANGADM['AdminUpgrade075ae3d2fc31640504f814f60e5ef713'] = 'inhabilitado'; $_LANGADM['AdminUpgrade783e8e29e6a8c3e22baa58a19420eb4f'] = 'segundos'; +$_LANGADM['AdminUpgrade0855d08a7348a201e2fdc454c4ee42a0'] = 'puede escribir de forma recursiva'; +$_LANGADM['AdminUpgrade039552aa1d74b68f01a73821f3078158'] = 'no puede escribir de forma recursiva'; +$_LANGADM['AdminUpgrade342299aeb786a06533ba00d9a04794dd'] = 'Modificar las opciones de'; +$_LANGADM['AdminUpgrade06933067aafd48425d67bcb01bba5cb6'] = 'Actualización'; +$_LANGADM['AdminUpgrade5d8b77b69c92370ec4e175a638019ca7'] = 'Su versión de prestashop actual:% s'; +$_LANGADM['AdminUpgrade80e3d093272bc011b6bc661e408c7423'] = 'La última versión es% 1 $ s (% 2 $ s)'; +$_LANGADM['AdminUpgradeb47ba7568788e46dbc7fe81e525db863'] = 'La última versión disponible es Prestashop:'; +$_LANGADM['AdminUpgradec97dcfb0df6daa46292a0def8a567822'] = 'Base de datos de copia de seguridad, copias de seguridad y actualizar en este momento y con un clic!'; +$_LANGADM['AdminUpgradea60ab62ed99ef0358b2efae592be0cdd'] = '¡Actualizar PrestaShop ahora!'; +$_LANGADM['AdminUpgrade943f41a7241dc56c3fbc488f015a4e6a'] = 'Su tienda ya está en marcha'; +$_LANGADM['AdminUpgrade48c7c41b72e1d678923ce3571aa65b2d'] = 'Paso'; +$_LANGADM['AdminUpgradeeeb5a49c38d2d8c2baa51ed09beccf88'] = 'Pasos de actualización'; +$_LANGADM['AdminUpgradec5d769685704e7ddcd70e74a6ebe50b7'] = 'Su configuración actual no permite la actualización.'; +$_LANGADM['AdminUpgrade3a3a651c9a67bca9ac902da789466b93'] = 'Actualización inestable'; +$_LANGADM['AdminUpgradea22eff458b4f4bce6d3232e367ff0138'] = 'Su configuración actual indica que desea actualizar el sistema desde la rama de desarrollo inestable, sin número de versión. Si la actualiza, no será capaz de seguir el proceso de lanzamiento oficial'; +$_LANGADM['AdminUpgradedae8ace18bdcbcc6ae5aece263e14fe8'] = 'Opciones'; +$_LANGADM['AdminUpgrade6b3930a184368a458be6e4429f409877'] = 'actualización completa. Por favor, consulte su front-office (tratar de hacer un pedido, ver el tema)'; +$_LANGADM['AdminUpgrade91195bbbacc2147a736c849c46368ed8'] = '¿Quiere deshacer?'; +$_LANGADM['AdminUpgradea498f9476a893d51ee02b3601678d318'] = 'Pulse para restaurar la base de datos'; +$_LANGADM['AdminUpgradef34d5debb2bba76aa3e077937a07e373'] = 'Pulse para restaurar archivos'; +$_LANGADM['AdminUpgrade6ef7ebe46f6d16cdbf9e2169e3dd048e'] = 'Por favor, vaya manualmente al botón de retroceso'; $_LANGADM['AdminWebservice897356954c2cd3d41b221e3f24f99bba'] = 'Clave'; $_LANGADM['AdminWebservice00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activado'; $_LANGADM['AdminWebservice52699c78843b98f98620186a59b0a3fa'] = 'Descripción de la clave'; @@ -2978,6 +3123,7 @@ $_LANGADM['AdminWebservice028f42454a71f86007a79664b2a35882'] = 'Vista (HEAD)'; $_LANGADM['AdminWebservice38fb7d24e0d60a048f540ecb18e13376'] = 'Guardar'; $_LANGADM['AdminWebservice19f823c6453c2b1ffd09cb715214813d'] = 'Campos necesarios'; $_LANGADM['AdminWebservicef19ee162cdc3717e4e58af2ebc837b5a'] = 'La clave debe constar de 32 caracteres'; +$_LANGADM['AdminWebservice73f872e92f8bee93f070d13e2339a410'] = 'Esta clave ya existe'; $_LANGADM['AdminZonesb718adec73e04ce3ec720dd11a06a308'] = 'ID'; $_LANGADM['AdminZonesb3ff996fe5c77610359114835baf9b38'] = 'Zona'; $_LANGADM['AdminZones00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activado'; diff --git a/translations/es/errors.php b/translations/es/errors.php index c91614641..9a30d202a 100644 --- a/translations/es/errors.php +++ b/translations/es/errors.php @@ -26,6 +26,7 @@ $_ERRORS['8eccd648c123a09bcf8520fea052861d'] = 'se ha producido un error mientra $_ERRORS['bc33aa1314e7dcd3472db72472b909b2'] = 'se ha producido un error al borrar'; $_ERRORS['472266472e3353d32d8a8ffa25c60154'] = 'se ha producido un error mientras se borraba la imagen'; $_ERRORS['7f2673e88a2cf04ce4e559cdf1b30277'] = 'se ha producido un error mientras se borraba la imagen'; +$_ERRORS['50289ca189ede3317209fcb9ecce167c'] = 'Se ha producido un error durante la creación de nueva carpeta'; $_ERRORS['0c300ba32ddee555c4ba9c81b74c64a3'] = 'Se ha producido un error durante la descarga del archivo ZIP'; $_ERRORS['1275c7249de2c2446cad46a5e894ae01'] = 'Se ha producido un error al enviar una imagen'; $_ERRORS['f8700fd851876c5adbffa7eddaaaf163'] = 'Se ha producido un error al enviar una imagen'; @@ -188,8 +189,10 @@ $_ERRORS['13fb39e33c882585065d2d636602e96f'] = 'Error: el parámetro \"templateV $_ERRORS['e4a6b1931fbfc9ef4531cab37c84c39f'] = 'Error: el parámetro \"a\" está corrupto'; $_ERRORS['1c188f7466ede1cee857741eb5aa3ac5'] = 'Error: Por favor, elija un transportista'; $_ERRORS['ff5a229e566831ea38a2ba5fb739df9f'] = 'Error: Por favor, elija una dirección'; +$_ERRORS['8f3d9ee281e1abb9111486bcbda6804e'] = 'Error: algunas o todas las imágenes no se han podido mover.'; $_ERRORS['70bdff077d0b2aaf90e35c0523b1d58c'] = 'Error: el transportista no es válido'; $_ERRORS['7d3f071e2825ec56f80c881d56fb3c7c'] = 'Error: esta pedido ya está validado'; +$_ERRORS['491c8c1d25f97843f6edfdc81d021f4d'] = 'Error: la configuración del servidor no es compatible con el sistema de la nueva imagen. No se movieron las imágenes'; $_ERRORS['b2b367f1201bb55f41e0688955f4f1a1'] = 'Estimado cliente, ha sobrepasado la fecha de expiración'; $_ERRORS['45ebc64529137a007889ee445d64611c'] = 'Falló la actualización de posición'; $_ERRORS['5fe3a5b7465abb742a1b93a6037384fa'] = 'Error fatal: id_transacción es nulo'; @@ -218,6 +221,8 @@ $_ERRORS['b417662bce6671781c5285afe872056a'] = 'imagen demasiado grande'; $_ERRORS['f09e308b66fdd005a754757de9f29b95'] = 'el objeto del cliente es incorrecto.'; $_ERRORS['8b978fa2ad857b185bc61dc5acb10927'] = 'Objeto con descuento incorrecto.'; $_ERRORS['da393a0fcc28b1678ba1f8f59ea94b50'] = 'El objeto pedido es incorrecto'; +$_ERRORS['c99348e30ef9822b53fce9b9f0c198c9'] = 'Valor incorrecto para una calidad de imagen JPEG.'; +$_ERRORS['75e3bbc53d0a62d319235ffebf9e219c'] = 'Valor incorrecto para una calidad de imagen PNG.'; $_ERRORS['259f417808483b6dc18a10510fd8d3cc'] = 'Condado de propiedades no válido'; $_ERRORS['c1c8a564c10a0efe07bb4e4b20d88cc9'] = 'ID no válida'; $_ERRORS['bfd99559857dfcfc40cb0d0e6c8aee1b'] = 'Nombre no válido'; @@ -297,12 +302,13 @@ $_ERRORS['1b599bf89c1bf4f8640ef31f3acb9f40'] = 'archivo no especificado'; $_ERRORS['298883b17e36ee3a18d73e835c0b44fc'] = 'No fichero se ha subido'; $_ERRORS['cb20447a4bf5ff9bec717ec68a357a93'] = 'Motor de gráfico no seleccionado'; $_ERRORS['ccacacd12f75e1ab3f9ce3e234ed5777'] = 'Motor de cuadro no seleccionado'; +$_ERRORS['7adf1dee74b60e40ce882532ab33122e'] = 'No hay imagen que se encuentra en combinación con id_product = \'. $ Product-> id. " y posición de la imagen = \'. (int) $ info [\' image_position\'].\'.'; $_ERRORS['6a8f39c3861bfa5111a88d9c76df6993'] = 'No hay factura disponible'; $_ERRORS['0e63e5844a0255aeb0cee434263552ae'] = 'ninguna factura encontrada con este ID:'; $_ERRORS['e21c3c406358073b38d481fd3d88221c'] = 'No se ha encontrado factura'; $_ERRORS['f59b67acbc1ca8ecad71a742f5e43b09'] = 'Ningún pedido encontrado con este ID:'; $_ERRORS['083d9cdf06cdc52892e3bbf7ff5494b6'] = 'No Id de la devolución del pedido'; -$_ERRORS['d107b93e0404a9ec3a24c3b797b63fff'] = 'No se ha encontrado orde de pedido'; +$_ERRORS['d107b93e0404a9ec3a24c3b797b63fff'] = 'No se ha encontrado orden de pedido'; $_ERRORS['e3ac5a39682f9b3a09f6063f714ffc48'] = 'No hay modo de pago disponble'; $_ERRORS['8912e1863fe81af9cabd76f5de9e7495'] = 'No hay producto o cantidad seleccionados'; $_ERRORS['b7d99b30df0aade1e4d459fab8c7078f'] = 'No hay perfil'; @@ -363,6 +369,7 @@ $_ERRORS['edeb9e20655b946e4bee4ac44a6c0a7f'] = 'El servidor no dispone de permis $_ERRORS['5d7cc18ef21285f980cbada9adb9df5c'] = 'La conexión al servidor expiró, la filigrana no se ha podido aplicar a todas las imígenes.'; $_ERRORS['721b2acc2e54e77e36654bbc42a0747a'] = 'Lo sentimos, actualmente las copias de seguridad solo soportan bases de datos MySQL. Usted esta usando'; $_ERRORS['c45319ee556dc43ba15523c539c7e9d4'] = 'Lo sentimos, no es posible renovar su pedido'; +$_ERRORS['ea68586346b9b9f8ca43827cb3341ffd'] = 'Este proveedor no existe.'; $_ERRORS['35f55f4e657f542d5f27853332c46f80'] = 'Error de sintaxis con este motivo'; $_ERRORS['19a99b7aed449fbbedc3ce65483d6a3a'] = 'La pestaña no se puede encontrar'; $_ERRORS['cae059a6bd57c0b7d289ce097c060ba6'] = 'El archivo de la pestaña no puede encontrarse'; @@ -396,6 +403,7 @@ $_ERRORS['baafbb73bdf562b2dcbd2c4b807f758e'] = 'esa dirección no se encuentra e $_ERRORS['29e1ca45338b1e4861bb4a9bdc5d4387'] = 'Esta dirección no es la suya.'; $_ERRORS['b8ab75688d5796c2e61d3047b91acc17'] = 'Esta asociación contiene ya demasiadas claves'; $_ERRORS['71f4f008985ea6abc73e89a668e15197'] = 'Este atributo ya existe'; +$_ERRORS['a46eb4d38ea045e90273d51d8166529f'] = 'Esta clase depende de varios archivos modificados en la versión 1.4.4.0 y no debe ser usada en una versión anterior'; $_ERRORS['e49f206b6d8f0e5e2a6cb13d96b44ed2'] = 'Este nombre de clase no existe'; $_ERRORS['e22a6ea51eb74bee7acaa4acf2846c7b'] = 'Esta combinación ya existe.'; $_ERRORS['044ef92a14ceaaba24382a72ca0267ae'] = 'este país requiere la selección de un Estado'; @@ -405,6 +413,7 @@ $_ERRORS['350e5d76b60ae887c90d55e2fb23fdc5'] = 'Este descuento no es aplicable a $_ERRORS['f8279a73d35437427d4c77e28828c5fc'] = 'este email no está registrado'; $_ERRORS['e0a602c130d12d57cd4ca2a8b9240917'] = 'Este archivo puede ser escrito:'; $_ERRORS['c9615dc36879116ef8c5f1ab08543191'] = 'Este archivo ya no existe'; +$_ERRORS['7baf3ad7518c99fa132c3f5954edbff0'] = 'Esta clave se utiliza muchas veces (solo una permitida'; $_ERRORS['b60be6e4c0df15343a7cdafccb174159'] = 'Este módulo no puede ser trasplantado a este hook.'; $_ERRORS['a44f9463879b845e1ad2c45e75aebd18'] = 'Este módulo ya ha sido instalado:'; $_ERRORS['aa508f3bd17074b8941571083de1350e'] = 'este módulo ya está copiado en este hook'; @@ -412,6 +421,7 @@ $_ERRORS['ae38c419414887fa47b7f5a811e5f42d'] = 'Este módulo ya ha sido desinsta $_ERRORS['e8be55bf3a30501aef09d2e74de97976'] = 'este nombre ya existe'; $_ERRORS['b74c118d823d908d653cfbf1c877ae55'] = 'esta nombre ya está utilizado por otra lista'; $_ERRORS['d312d5c57aff77e76cab1b5981bc5606'] = 'este nombre no está permitido'; +$_ERRORS['e2b7dec8fa4b498156dfee6e4c84b156'] = 'Esta forma de pago no está disponible.'; $_ERRORS['1347119d36ae31564a89763f21476c1a'] = 'Este producto no existe en nuestra tienda.'; $_ERRORS['38d5595927b80b331239ef904341b07c'] = 'Este producto ha sido eliminado'; $_ERRORS['edd62dfcf50e7a6dea932ca1eca167b2'] = 'Esta propiedad no existe en la clase o esta prohibida'; diff --git a/translations/es/fields.php b/translations/es/fields.php index d98318efb..bb8fb1455 100644 --- a/translations/es/fields.php +++ b/translations/es/fields.php @@ -36,12 +36,14 @@ $_FIELDS['Attribute_b068931cc450442b63f5b3d276ea4297'] = 'nombre'; $_FIELDS['AttributeGroup_b968105336252e3b3a42fe9e4e06b9d5'] = 'id_grupo_color'; $_FIELDS['AttributeGroup_b068931cc450442b63f5b3d276ea4297'] = 'nombre'; $_FIELDS['AttributeGroup_161b4814c78bb4d03d3c140d66031c93'] = 'nombre público'; +$_FIELDS['CMS_7ea9f9960499fd722b9c07d732f08fc8'] = 'id_cms_categoría'; $_FIELDS['CMS_daed73073d15e0baf1cdfaea3b5e28ab'] = 'meta descripción'; $_FIELDS['CMS_69a2fc764784fa41975b85e0aa96ded3'] = 'meta palabras clave'; $_FIELDS['CMS_493c8b960a4aca4d102deaf489d5b3f4'] = 'meta título'; $_FIELDS['CMS_a2c6a4f5547c18f5b19a2a89569ab4e5'] = 'url simplificada'; $_FIELDS['CMS_9a0364b9e99bb480dd25e1f0284c8555'] = 'contenido'; $_FIELDS['CMSCategory_c76a5e84e4bdee527e274ea30c680d79'] = 'activo'; +$_FIELDS['CMSCategory_672070865d6470b0b9c251e275faaa30'] = 'id_parent'; $_FIELDS['CMSCategory_b068931cc450442b63f5b3d276ea4297'] = 'nombre'; $_FIELDS['CMSCategory_a2c6a4f5547c18f5b19a2a89569ab4e5'] = 'reescritura del link'; $_FIELDS['CMSCategory_67daf92c833c41c95db874e18fcb2786'] = 'descripción'; @@ -71,6 +73,8 @@ $_FIELDS['Category_67b0a9d199d15a739bdd15669524442d'] = 'nizquierda'; $_FIELDS['Category_4ac3932004533d3f5ab93626f9fafe82'] = 'nderecha'; $_FIELDS['Category_86a0401bd5e7f72df7db32747c7d9391'] = 'rehabilitar_nivel'; $_FIELDS['Category_c76a5e84e4bdee527e274ea30c680d79'] = 'activo'; +$_FIELDS['Category_672070865d6470b0b9c251e275faaa30'] = 'id_parent'; +$_FIELDS['Category_040cda1c8fded7f318fa5bd195e23f73'] = 'GroupBox'; $_FIELDS['Category_b068931cc450442b63f5b3d276ea4297'] = 'nombre'; $_FIELDS['Category_a2c6a4f5547c18f5b19a2a89569ab4e5'] = 'URL simplificada'; $_FIELDS['Category_67daf92c833c41c95db874e18fcb2786'] = 'descripción'; @@ -87,6 +91,9 @@ $_FIELDS['Combination_ae10d61c45ba89be06639c38776f612d'] = 'ecotasa'; $_FIELDS['Combination_221d2a4bfdae13dbd5aeff3b02adb8c1'] = 'cantidad'; $_FIELDS['Combination_7edabf994b76a00cbc60c95af337db8f'] = 'peso'; $_FIELDS['Combination_95164b54cc582f9051b417977072113b'] = 'activación'; +$_FIELDS['CompareProduct_120faea10923bec533179a806fa925c3'] = 'id_producto'; +$_FIELDS['CompareProduct_3d434574fc60866176e072048e1f6109'] = 'id_invitado'; +$_FIELDS['CompareProduct_71581233bcc121fcc409ecce9317fbde'] = 'id_cliente'; $_FIELDS['Configuration_b068931cc450442b63f5b3d276ea4297'] = 'nombre'; $_FIELDS['Connection_3d434574fc60866176e072048e1f6109'] = 'id_invitado'; $_FIELDS['Connection_a03d02efb705d34236ec7f3f92f28a83'] = 'id_página'; @@ -220,6 +227,7 @@ $_FIELDS['Language_b068931cc450442b63f5b3d276ea4297'] = 'nombre'; $_FIELDS['Language_213ecf1210f43736b6d4997fcfa27954'] = 'código_iso'; $_FIELDS['Language_60716c2f59efe423380e2faeb03472d5'] = 'código_idioma'; $_FIELDS['Language_c76a5e84e4bdee527e274ea30c680d79'] = 'activo'; +$_FIELDS['Language_72297458b7dd56f4fed7ad50f8f92528'] = 'is_rtl'; $_FIELDS['Logger_e8518eafba242330636c5bdb532d5c88'] = 'id_log'; $_FIELDS['Logger_f6cdd8562435f8dc36b4c5a221a11d7c'] = 'gravedad'; $_FIELDS['Logger_8e95bd427d65fbeeedb980f640074ea2'] = 'código_error'; @@ -449,6 +457,8 @@ $_FIELDS['Referrer_c93c16c8b6567ba130440474e41fd35e'] = 'ventas_caché'; $_FIELDS['Referrer_47bab46b2a3a00f6b00f8e1ea6ee6ee9'] = 'tase_registro_caché'; $_FIELDS['Referrer_52bbdb0184807a144502919e9c605671'] = 'tasa_pedido_caché'; $_FIELDS['Scene_c76a5e84e4bdee527e274ea30c680d79'] = 'activo'; +$_FIELDS['Scene_26f94136f5db8afd4e9df1e512f7fdc5'] = 'zonas'; +$_FIELDS['Scene_b0b5ccb4a195a07fd3eed14affb8695f'] = 'categorías'; $_FIELDS['Scene_b068931cc450442b63f5b3d276ea4297'] = 'nombre'; $_FIELDS['SearchEngine_cf1e8c14e54505f60aa10ceb8d5d8ab3'] = 'servidor'; $_FIELDS['SearchEngine_bc81247c714b35efcaeb70c972043c3b'] = 'getvar'; diff --git a/translations/es/pdf.php b/translations/es/pdf.php index 2a6f4f2c4..a71876238 100644 --- a/translations/es/pdf.php +++ b/translations/es/pdf.php @@ -35,6 +35,7 @@ $_LANGPDF['PDF_invoice396124314c5fd1fa5bf463274896dc80'] = 'No se ha definido ni $_LANGPDF['PDF_invoice065ab3a28ca4f16f55f103adc7d0226f'] = 'Entrega'; $_LANGPDF['PDF_invoice6bdf2efe1a99072849d4e87baee37dbe'] = 'Facturación'; $_LANGPDF['PDF_invoice60da3bd6867e3952ef0057a0772ea885'] = 'id del impuesto'; +$_LANGPDF['PDF_invoice7b13afd12d6d91d52aa9f857d23f96ef'] = 'Proyecto de factura'; $_LANGPDF['PDF_invoiced1228f5476d15142b1358ae4b5fa2454'] = 'Pedido nº '; $_LANGPDF['PDF_invoicef8617a92ba0a0a4eabee724eab7c9f48'] = 'Transportista:'; $_LANGPDF['PDF_invoicec1f6368d15f7c13c4e5e8f70c68c747f'] = 'Modo de pago:'; diff --git a/translations/fr/admin.php b/translations/fr/admin.php index 6d672c6a0..96ef8ebd8 100644 --- a/translations/fr/admin.php +++ b/translations/fr/admin.php @@ -427,6 +427,7 @@ $_LANGADM['AdminCountries00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activé'; $_LANGADM['AdminCountries5252b12033d3181aa8270eea2fd4c4d4'] = 'Préférences pays'; $_LANGADM['AdminCountriesd14d3384847c11b0708990b3343c8dbf'] = 'Pays par défaut :'; $_LANGADM['AdminCountriesb017db41a29dff4007de058af406341e'] = 'Pays par défaut utilisé dans la boutique'; +$_LANGADM['AdminCountries13feb6ab1a436929f78c13ec405ce215'] = 'Restreindre les pays en FO par ceux délivrés par les transporteurs actifs'; $_LANGADM['AdminCountries91bb198c336e8b4a82bed07cffd78891'] = 'Ré-affichera votre dernière mise en page enregistrer'; $_LANGADM['AdminCountriesa86a021f16a103f44a8aa1c06e484831'] = 'Ré-affichera une mise en page par défaut pour ce pays'; $_LANGADM['AdminCountriesfc6bff84b96cbd12e8b2acb2cbe4c979'] = 'Ré-affichera votre dernière édition de mise en page '; @@ -1908,7 +1909,8 @@ $_LANGADM['AdminPreferencesc173252856179a44a9506a968359de8b'] = 'Fixe un prix po $_LANGADM['AdminPreferences0d8bdbe98feb696dd76760ee1374a740'] = 'Tax des emballages cadeaux'; $_LANGADM['AdminPreferences9311ccba175a9f2fc72e7c6a3dfb6078'] = 'Fixe une taxe pour le prix de l\'emballage cadeau'; $_LANGADM['AdminPreferences3aadb5e86b174ecada1174e22f5a6368'] = 'Poids maximum des fichiers joints'; -$_LANGADM['AdminPreferences0550caa9a256c7672bda5f09a45c9334'] = 'Configurer la limite de tailles des fichiers téléchargeables (en MegaOctets)'; +$_LANGADM['AdminPreferences2ca89cca013873c7f841e1acf242b3d6'] = 'Taille maximale des pièces jointes (en Megaoctet)'; +$_LANGADM['AdminPreferences12cbe1a4645659457808631047989afb'] = 'Maximum:'; $_LANGADM['AdminPreferencesb667478ccafce4bff6d427a6bca06269'] = 'Proposer des emballages recyclés'; $_LANGADM['AdminPreferencese84eed89f38f20639431d99ad2f5ee8a'] = 'Le client choisit de recevoir un colis recyclé'; $_LANGADM['AdminPreferencese6b03a6bdf49d1cd0655e0f7a3d990cb'] = 'Ré-afficher le panier après identification'; @@ -2084,7 +2086,7 @@ $_LANGADM['AdminProductsed51222f31afbf17ca5f3b0654db8969'] = 'Etat :'; $_LANGADM['AdminProducts03c2e7e41ffc181a4e84080b4710e81e'] = 'Neuf'; $_LANGADM['AdminProducts019d1ca7d50cc54b995f60d456435e87'] = 'Occasion'; $_LANGADM['AdminProducts6da03a74721a0554b7143254225cc08a'] = 'Reconditionné'; -$_LANGADM['AdminProductsf4a275a931b82e5058bc8ffad8b8e5bd'] = 'Fabricant :'; +$_LANGADM['AdminProductsf4a275a931b82e5058bc8ffad8b8e5bd'] = 'Marque :'; $_LANGADM['AdminProducts7825865597f0b1673524f56e335f3675'] = 'Choisir (optionnel)'; $_LANGADM['AdminProducts4cf86e65aa090f9e3acbfaba9f6af9a4'] = 'Vous êtes sur le point de perdre vos modifications, souhaitez vous continuer?'; $_LANGADM['AdminProducts686e697538050e4664636337cc3b834f'] = 'Créer'; @@ -2161,8 +2163,8 @@ $_LANGADM['AdminProducts9d9aa88574c4dab04ddd8356c377357d'] = 'Catégorie par dé $_LANGADM['AdminProducts3faccbfcb5f35451302dcaff3af6cd3f'] = 'Merci de cocher une catégorie afin de sélectionner la catégorie par défaut.'; $_LANGADM['AdminProducts8cf04a9734132302f96da8e113e80ce5'] = 'Accueil'; $_LANGADM['AdminProductsef7de3f485174ff47f061ad27d83d0ee'] = 'sélectionnée(s)'; -$_LANGADM['AdminProductsb56c3bda503a8dc4be356edb0cc31793'] = 'Tout étendre'; -$_LANGADM['AdminProducts5ffd7a335dd836b3373f5ec570a58bdc'] = 'Tout déplier'; +$_LANGADM['AdminProductsb56c3bda503a8dc4be356edb0cc31793'] = 'Tout replier'; +$_LANGADM['AdminProducts5ffd7a335dd836b3373f5ec570a58bdc'] = 'Tout étendre'; $_LANGADM['AdminProducts5e9df908eafa83cb51c0a3720e8348c7'] = 'Tout cocher'; $_LANGADM['AdminProducts9747d23c8cc358c5ef78c51e59cd6817'] = 'Tout décocher'; $_LANGADM['AdminProductsd88946b678e4c2f251d4e292e8142291'] = 'SEO'; @@ -3043,10 +3045,9 @@ $_LANGADM['AdminTranslationsc21f969b5f03d33d43e04f8f136e7682'] = 'defaut'; $_LANGADM['AdminTranslationsa9e4402481bd9b8e36752bf731f67eb6'] = 'Thème'; $_LANGADM['AdminTranslations53b3cae42737979c884275593a01f468'] = 'Module :'; $_LANGADM['AdminUpgrade875b8a59022d232837491c0fdfacb4ab'] = 'Ne pas sauver les images'; -$_LANGADM['AdminUpgrade8ec641624329d6ff15d8c4c9e8e6c2c8'] = 'Vous pouvez exclure le dossier image de la sauvegarde si vous les avez déjà sauvé d\'une autre manière (non recommandé)'; +$_LANGADM['AdminUpgradea8d6c6734da0083021561b23f2fa88cc'] = 'Vous pouvez exclure le dossier image de la sauvegarde si vous l\'avez déjà sauvegardé d\'une autre manière (non recommandé)'; $_LANGADM['AdminUpgradeaf98608eaedd4ba7ffd47a0204e84b23'] = 'Conserver le thème \"prestashop\" actuel'; -$_LANGADM['AdminUpgrade6e9e9426b91777a0d15f2b730277ed9f'] = 'Si vous avez directement personnalisé le thème par défaut, vous pouvez le protéger de la mise à jour (non recommandé)'; -$_LANGADM['AdminUpgrade9377a7cc364ce06c1830eeb7a31202bb'] = 'Ne pas conserver les traductions'; +$_LANGADM['AdminUpgrade8413c63a6ef3717a974094785fd0b588'] = 'Garder les traductions'; $_LANGADM['AdminUpgrade51bbcf7afb0f8d35501d0a7b28979b06'] = 'Si \"oui\", vous conserverez toutes vos traductions'; $_LANGADM['AdminUpgrade8c8194a465f0163a6724907755ac1b82'] = 'Mode manuel'; $_LANGADM['AdminUpgradedd9dbd4916653d683244119a067ca467'] = 'Choisissze \"oui\" si vous voulez vous '; @@ -3091,11 +3092,13 @@ $_LANGADM['AdminUpgraded82eef1ba081c54686767c555670c0fe'] = 'erreur lors de la s $_LANGADM['AdminUpgrade344c592d141604c614c219fad3fa0dae'] = '%1$s fichiers exemple à supprimer'; $_LANGADM['AdminUpgrade0baf8c94d1d03d1621c17cd6eabf7b9f'] = 'Tous les exemples de fichiers supprimés. Sauvegarde des fichiers en cours...'; $_LANGADM['AdminUpgrade84e31682487d5a0937f9184ebcf594ba'] = 'copie de travail déjà %s à jour. exportation vers le répertoire latest'; +$_LANGADM['AdminUpgrade8f4c8c87daa3bc0311cfb61b7d36e27b'] = 'Erreur d\'extraction du SVN'; +$_LANGADM['AdminUpgrade0e81132066d433d212e237678e1193a3'] = 'non authorisé à utiliser SVN'; $_LANGADM['AdminUpgradeb0d51f91a1118b7c39ee1835cc6c926a'] = 'Téléchargement terminé. Extraction ...'; $_LANGADM['AdminUpgrade0c0db54fe8212c1a7215005fef75d7dd'] = 'Erreur pendant le téléchargement'; $_LANGADM['AdminUpgrade93120c07d8c5cee44042627cd493e0e0'] = 'vous avez besoin allow_url_fopen pour le téléchargement automatique. Vous pouvez également placer le fichier manuellement dans %s'; $_LANGADM['AdminUpgrade3bb38e7d0bfd5a02f7c06cae446fee86'] = 'l\'action %s ignorée'; -$_LANGADM['AdminUpgradee82d249d3743a90bb02e6dafd4788979'] = 'action \"%1$s\" non trouvée'; +$_LANGADM['AdminUpgradeb4302e98d94591ee9afa09e769b2ee63'] = 'l\'action %s non trouvée'; $_LANGADM['AdminUpgrade19f823c6453c2b1ffd09cb715214813d'] = 'Champs requis'; $_LANGADM['AdminUpgrade760c4026bc5a0bd5378e6efc3f1370b4'] = 'Trop long !'; $_LANGADM['AdminUpgrade4f2e28904946a09d8c7f36dd3ee72457'] = 'Les champs sont différents !'; @@ -3153,21 +3156,19 @@ $_LANGADM['AdminUpgrade4879913b16fa23f723f70a5067bda8d4'] = 'Aucune restauration $_LANGADM['AdminUpgradefff66e9b3d962fa319c8068b5c1997cd'] = 'restaurer'; $_LANGADM['AdminUpgradeebdabc2d40aa563aabbb3ee57915a7a9'] = 'cliquer pour restaurer %s'; $_LANGADM['AdminUpgradee9c57c7fbc335e66282a32617b01b9be'] = 'Votre configuration actuelle'; -$_LANGADM['AdminUpgrade8d93c2da70e3baf49fe03ecbc19ac608'] = 'dossier racine'; $_LANGADM['AdminUpgrade2fc4ab825ce2ce9476e8a1c2211ac9b8'] = 'Dossier racine'; -$_LANGADM['AdminUpgradeede62c591a867451227643268f5b40af'] = 'PHP a les droits d\'écriture du dossier racine récursivement'; -$_LANGADM['AdminUpgrade3e992446a190ccfadbebcce061984025'] = 'PHP n\'a pas les droits d\'écriture du dossier racine récursivement'; +$_LANGADM['AdminUpgrade8786f48d9cf9618cd2f5c37312ab7e50'] = 'Statut du dossier racine'; +$_LANGADM['AdminUpgraded16d80ca66261afba43f5736f6cec7e6'] = 'droits complets en écriture'; +$_LANGADM['AdminUpgrade039552aa1d74b68f01a73821f3078158'] = 'pas de droits d\'écriture récursif'; $_LANGADM['AdminUpgrade31a962ffeb06a6cc6d58ef3ba5fae2b7'] = 'Autoupgrade autorisé'; $_LANGADM['AdminUpgrade9c30a74657158984997cca4930d6075b'] = 'Cette version autorise la mise à jour automatique'; $_LANGADM['AdminUpgradeaf566be1636d11ecc8ddb728a15520b8'] = 'Cette version n\'autorise pas la mise à jour automatique'; $_LANGADM['AdminUpgrade4d3d769b812b6faa6b76e1a8abaece2d'] = 'Actif'; $_LANGADM['AdminUpgrade3cab03c00dbd11bc3569afa0748013f0'] = 'Inactif'; $_LANGADM['AdminUpgradeb2e1c91a22797b8d78f9c4adb01a8f17'] = 'Statut de la boutique'; -$_LANGADM['AdminUpgrade0a08c84bcebc299204970d219acc54c0'] = 'limite de temps php'; +$_LANGADM['AdminUpgrade94af5df6182efd3591d0ccccaa04bd5c'] = 'Limite de temps PHP'; $_LANGADM['AdminUpgrade075ae3d2fc31640504f814f60e5ef713'] = 'désactivée'; $_LANGADM['AdminUpgrade783e8e29e6a8c3e22baa58a19420eb4f'] = 'secondes'; -$_LANGADM['AdminUpgrade0855d08a7348a201e2fdc454c4ee42a0'] = 'droits d\'écriture récursif'; -$_LANGADM['AdminUpgrade039552aa1d74b68f01a73821f3078158'] = 'pas de droits d\'écriture récursif'; $_LANGADM['AdminUpgrade342299aeb786a06533ba00d9a04794dd'] = 'Modifiez vos options'; $_LANGADM['AdminUpgrade06933067aafd48425d67bcb01bba5cb6'] = 'Mettre à jour'; $_LANGADM['AdminUpgrade5d8b77b69c92370ec4e175a638019ca7'] = 'La version actuelle de votre boutique est : %s'; @@ -3179,7 +3180,9 @@ $_LANGADM['AdminUpgrade943f41a7241dc56c3fbc488f015a4e6a'] = 'Votre boutique est $_LANGADM['AdminUpgrade48c7c41b72e1d678923ce3571aa65b2d'] = 'Etape'; $_LANGADM['AdminUpgradeeeb5a49c38d2d8c2baa51ed09beccf88'] = 'Etape de mise à jour'; $_LANGADM['AdminUpgradec5d769685704e7ddcd70e74a6ebe50b7'] = 'Votre configuration actuelle n\'autorise pas la mise à jour.'; +$_LANGADM['AdminUpgrade7f786b903ea8045f5b5b7e3c5a4e0385'] = 'Cette fonction est expérimentale. Il est hautement recommandé de faire une sauvegarde de vos fichiers et de votre base de données avant de commencer le processus de mise à jour.'; $_LANGADM['AdminUpgrade3a3a651c9a67bca9ac902da789466b93'] = 'Mise à jour instable'; +$_LANGADM['AdminUpgradea22eff458b4f4bce6d3232e367ff0138'] = 'Votre configuration actuelle indique que vous voulez mettre à jour votre système à partir d\'une branche de développement instable, sans numéro de version. Si vous mettez à jour, vous ne pourrez plus appliquer le processus de versions stables officiel.'; $_LANGADM['AdminUpgradedae8ace18bdcbcc6ae5aece263e14fe8'] = 'Options'; $_LANGADM['AdminUpgrade6b3930a184368a458be6e4429f409877'] = 'Mise à jour terminée. Vérifiez votre boutique (essayez de faire une commande, vérifier le thème)'; $_LANGADM['AdminUpgrade91195bbbacc2147a736c849c46368ed8'] = 'Voulez vous restaurer votre boutique'; @@ -3219,6 +3222,7 @@ $_LANGADM['AdminWebservice028f42454a71f86007a79664b2a35882'] = 'Aperçu (HEAD)'; $_LANGADM['AdminWebservice38fb7d24e0d60a048f540ecb18e13376'] = 'Enregistrer'; $_LANGADM['AdminWebservice19f823c6453c2b1ffd09cb715214813d'] = 'Champs requis'; $_LANGADM['AdminWebservicef19ee162cdc3717e4e58af2ebc837b5a'] = 'La clé doit être composé de 32 caractères '; +$_LANGADM['AdminWebservice73f872e92f8bee93f070d13e2339a410'] = 'La clé existe déjà'; $_LANGADM['AdminZonesb718adec73e04ce3ec720dd11a06a308'] = 'ID'; $_LANGADM['AdminZonesb3ff996fe5c77610359114835baf9b38'] = 'Zone'; $_LANGADM['AdminZones00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activé';