[ Index ] |
PHP Cross Reference of phpwcms V1.4.7 _r403 (01.11.10) |
[Summary view] [Print] [Text view]
1 <?php 2 /************************************************************************************* 3 Copyright notice 4 5 (c) 2002-2010 Oliver Georgi (oliver@phpwcms.de) // All rights reserved. 6 7 This script is part of PHPWCMS. The PHPWCMS web content management system is 8 free software; you can redistribute it and/or modify it under the terms of 9 the GNU General Public License as published by the Free Software Foundation; 10 either version 2 of the License, or (at your option) any later version. 11 12 The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html 13 A copy is found in the textfile GPL.txt and important notices to the license 14 from the author is found in LICENSE.txt distributed with these scripts. 15 16 This script is distributed in the hope that it will be useful, but WITHOUT ANY 17 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 18 PARTICULAR PURPOSE. See the GNU General Public License for more details. 19 20 This copyright notice MUST APPEAR in all copies of the script! 21 *************************************************************************************/ 22 23 // ---------------------------------------------------------------- 24 // obligate check for phpwcms constants 25 if (!defined('PHPWCMS_ROOT')) { 26 die("You Cannot Access This Script Directly, Have a Nice Day."); 27 } 28 // ---------------------------------------------------------------- 29 30 31 if($action == 'edit') { 32 33 if( isset($_POST['save']) ) { 34 35 $plugin['data']['shop_pref_currency'] = clean_slweg($_POST['pref_currency']); 36 $plugin['data']['shop_pref_unit_weight'] = clean_slweg($_POST['pref_unit_weight']); 37 38 $plugin['data']['shop_pref_terms'] = slweg($_POST['pref_terms']); 39 $plugin['data']['shop_pref_terms_format'] = empty($_POST['pref_terms_format']) ? 0 : 1; 40 41 $plugin['data']['shop_pref_id_shop'] = slweg($_POST['pref_shop_id']); 42 $plugin['data']['shop_pref_id_cart'] = slweg($_POST['pref_cart_id']); 43 44 $plugin['data']['shop_pref_vat'] = clean_slweg($_POST['pref_vat']); 45 $plugin['data']['shop_pref_vat'] = str_replace($BLM['thousands_sep'], '', $plugin['data']['shop_pref_vat']); 46 $plugin['data']['shop_pref_vat'] = str_replace($BLM['dec_point'], '.', $plugin['data']['shop_pref_vat']); 47 $plugin['data']['shop_pref_vat'] = explode(LF, $plugin['data']['shop_pref_vat']); 48 $plugin['data']['shop_pref_vat'] = array_map('roundAll', $plugin['data']['shop_pref_vat']); 49 natsort($plugin['data']['shop_pref_vat']); 50 $plugin['data']['shop_pref_vat'] = array_unique($plugin['data']['shop_pref_vat']); 51 52 $plugin['data']['shop_pref_email_to'] = convertStringToArray( sanitize_multiple_emails( clean_slweg($_POST['pref_email_to']) ), ';'); 53 $plugin['data']['shop_pref_email_from'] = clean_slweg($_POST['pref_email_from']); 54 $plugin['data']['shop_pref_email_paypal'] = clean_slweg($_POST['pref_email_paypal']); 55 56 // check if multiple emails 57 foreach( $plugin['data']['shop_pref_email_to'] as $key => $value ) { 58 if(! is_valid_email($value) ) { 59 unset( $plugin['data']['shop_pref_email_to'][$key] ); 60 } 61 } 62 $plugin['data']['shop_pref_email_to'] = strtolower( implode(';', $plugin['data']['shop_pref_email_to'] ) ); 63 64 if(! is_valid_email($plugin['data']['shop_pref_email_from']) ) $plugin['data']['shop_pref_email_from'] = ''; 65 if(! is_valid_email($plugin['data']['shop_pref_email_paypal']) ) $plugin['data']['shop_pref_email_paypal'] = ''; 66 67 for( $x = 0; $x <= 4; $x++ ) { 68 69 $plugin['data']['shop_pref_shipping'][$x]['weight'] = clean_slweg($_POST['pref_shipping_weight'][$x]); 70 $plugin['data']['shop_pref_shipping'][$x]['net'] = clean_slweg($_POST['pref_shipping_net'][$x]); 71 $plugin['data']['shop_pref_shipping'][$x]['vat'] = clean_slweg($_POST['pref_shipping_vat'][$x]); 72 73 $plugin['data']['shop_pref_shipping'][$x]['weight'] = str_replace($BLM['thousands_sep'], '', $plugin['data']['shop_pref_shipping'][$x]['weight']); 74 $plugin['data']['shop_pref_shipping'][$x]['weight'] = round(str_replace($BLM['dec_point'], '.', $plugin['data']['shop_pref_shipping'][$x]['weight']), 3); 75 76 $plugin['data']['shop_pref_shipping'][$x]['net'] = str_replace($BLM['thousands_sep'], '', $plugin['data']['shop_pref_shipping'][$x]['net']); 77 $plugin['data']['shop_pref_shipping'][$x]['net'] = round(str_replace($BLM['dec_point'], '.', $plugin['data']['shop_pref_shipping'][$x]['net']), 3); 78 79 $plugin['data']['shop_pref_shipping'][$x]['vat'] = str_replace($BLM['thousands_sep'], '', $plugin['data']['shop_pref_shipping'][$x]['vat']); 80 $plugin['data']['shop_pref_shipping'][$x]['vat'] = round(str_replace($BLM['dec_point'], '.', $plugin['data']['shop_pref_shipping'][$x]['vat']), 2); 81 82 } 83 84 85 $plugin['data']['shop_pref_payment'] = array( 86 'paypal' => empty($_POST['pref_payment_paypal']) ? 0 : 1, 87 'prepay' => empty($_POST['pref_payment_prepay']) ? 0 : 1, 88 'pod' => empty($_POST['pref_payment_pod']) ? 0 : 1, 89 'onbill' => empty($_POST['pref_payment_onbill']) ? 0 : 1, 90 'ccard' => empty($_POST['pref_payment_ccard']) ? 0 : 1, 91 'accepted_ccard' => ( is_array($_POST['pref_supported_ccard']) ? $_POST['pref_supported_ccard'] : array() ) 92 ); 93 94 95 96 if( empty($plugin['error'] )) { 97 98 _setConfig('shop_pref_currency', $plugin['data']['shop_pref_currency'], 'module_shop'); 99 _setConfig('shop_pref_unit_weight', $plugin['data']['shop_pref_unit_weight'], 'module_shop'); 100 _setConfig('shop_pref_vat', $plugin['data']['shop_pref_vat'], 'module_shop'); 101 _setConfig('shop_pref_email_to', $plugin['data']['shop_pref_email_to'], 'module_shop'); 102 _setConfig('shop_pref_email_from', $plugin['data']['shop_pref_email_from'], 'module_shop'); 103 _setConfig('shop_pref_email_paypal', $plugin['data']['shop_pref_email_paypal'], 'module_shop'); 104 _setConfig('shop_pref_shipping', $plugin['data']['shop_pref_shipping'], 'module_shop'); 105 _setConfig('shop_pref_payment', $plugin['data']['shop_pref_payment'], 'module_shop'); 106 _setConfig('shop_pref_terms', $plugin['data']['shop_pref_terms'], 'module_shop'); 107 _setConfig('shop_pref_terms_format', $plugin['data']['shop_pref_terms_format'], 'module_shop'); 108 _setConfig('shop_pref_id_shop', $plugin['data']['shop_pref_id_shop'], 'module_shop'); 109 _setConfig('shop_pref_id_cart', $plugin['data']['shop_pref_id_cart'], 'module_shop'); 110 111 // save and back to listing mode 112 headerRedirect( shop_url('controller=pref', '') ); 113 114 } 115 116 } 117 118 $_checkPref = array( 119 120 'shop_pref_currency' => '€', 121 'shop_pref_unit_weight' => 'kg', 122 'shop_pref_vat' => array( '0.00', '7.00', '19.00' ), 123 'shop_pref_email_to' => '', 124 'shop_pref_email_from' => '', 125 'shop_pref_email_paypal' => '', 126 'shop_pref_id_shop' => 0, 127 'shop_pref_id_cart' => 0, 128 'shop_pref_shipping' => array( 0 => array('weight'=>'50', 'net'=>0, 'vat'=>0), 129 1 => array('weight'=>'', 'net'=>0, 'vat'=>0), 130 2 => array('weight'=>'', 'net'=>0, 'vat'=>0), 131 3 => array('weight'=>'', 'net'=>0, 'vat'=>0), 132 4 => array('weight'=>'', 'net'=>0, 'vat'=>0) 133 ), 134 'shop_pref_payment' => array( 'paypal' => 1, 135 'prepay'=> 1, 136 'pod' => 1, 137 'onbill' => 1, 138 'ccard' => 1, 139 'accepted_ccard' => array('americanexpress', 'mastercard', 'visa') 140 ), 141 'shop_pref_terms' => '', 142 'shop_pref_terms_format' => 0 143 144 ); 145 146 // retrieve all settings 147 foreach( $_checkPref as $key => $value ) { 148 if( false === ( $plugin['data'][ $key ] = _getConfig( $key ) ) ) { 149 $plugin['data'][ $key ] = $value; 150 _setConfig( $key , $plugin['data'][ $key ], 'module_shop'); 151 } 152 } 153 154 } 155 156 157 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Nov 16 22:51:00 2010 | Cross-referenced by PHPXref 0.7 |