| 1 |
<?php |
| 2 |
class usc_e_shop |
| 3 |
{ |
| 4 |
|
| 5 |
var $page; //page action |
| 6 |
var $cart; //cart object |
| 7 |
var $use_ssl; //ssl flag |
| 8 |
var $action, $action_status, $error_status; |
| 9 |
var $action_message, $error_message; |
| 10 |
var $itemskus, $itemsku, $itemopts, $itemopt, $item; |
| 11 |
var $zaiko_status, $payment_structure, $display_mode, $shipping_rule; |
| 12 |
var $member_status; |
| 13 |
var $options, $mail_para; |
| 14 |
var $login_mail, $current_member, $member_form; |
| 15 |
var $payment_results, $log_flg, $delim, $use_js; |
| 16 |
|
| 17 |
function usc_e_shop() |
| 18 |
{ |
| 19 |
//20110331ysk start |
| 20 |
//global $post, $usces_settings; |
| 21 |
global $wpdb, $post, $usces_settings, $usces_states; |
| 22 |
//20110331ysk end |
| 23 |
do_action('usces_construct'); |
| 24 |
add_action('after_setup_theme', array(&$this, 'usces_session_start')); |
| 25 |
|
| 26 |
if ( is_admin() ){ |
| 27 |
clean_term_cache( get_option('usces_item_cat_parent_id'), 'category' ); |
| 28 |
} |
| 29 |
|
| 30 |
$locales = usces_locales(); |
| 31 |
foreach($locales as $l){ |
| 32 |
$usces_settings['language'][$l] = $l; |
| 33 |
} |
| 34 |
$usces_settings['language']['others'] = __('Follow config.php', 'usces'); |
| 35 |
|
| 36 |
$this->options = get_option('usces'); |
| 37 |
if(!isset($this->options['smtp_hostname']) || empty($this->options['smtp_hostname'])){ $this->options['smtp_hostname'] = 'localhost';} |
| 38 |
if(!isset($this->options['delivery_method']) || !is_array($this->options['delivery_method'])) $this->options['delivery_method'] = array(); |
| 39 |
if(!isset($this->options['shipping_charge']) || !is_array($this->options['shipping_charge'])) $this->options['shipping_charge'] = array(); |
| 40 |
if(!isset($this->options['membersystem_state'])) $this->options['membersystem_state'] = 'activate'; |
| 41 |
if(!isset($this->options['membersystem_point'])) $this->options['membersystem_point'] = 'activate'; |
| 42 |
if(!isset($this->options['use_ssl'])) $this->options['use_ssl'] = 0; |
| 43 |
if(!isset($this->options['point_coverage'])) $this->options['point_coverage'] = 0; |
| 44 |
if(!isset($this->options['use_javascript'])) $this->options['use_javascript'] = 1; |
| 45 |
if(!isset($this->options['privilege_discount'])) $this->options['privilege_discount'] = ''; |
| 46 |
if(!isset($this->options['privilege_point'])) $this->options['privilege_point'] = ''; |
| 47 |
if(!isset($this->options['campaign_privilege'])) $this->options['campaign_privilege'] = ''; |
| 48 |
if(!isset($this->options['campaign_category'])) $this->options['campaign_category'] = 0; |
| 49 |
if(!isset($this->options['campaign_schedule']['start'])) $this->options['campaign_schedule']['start'] = array(); |
| 50 |
if(!isset($this->options['campaign_schedule']['end'])) $this->options['campaign_schedule']['end'] = array(); |
| 51 |
if(!isset($this->options['acting_settings']['paypal']['ec_activate'])) $this->options['acting_settings']['paypal']['ec_activate'] = ''; |
| 52 |
if(!isset($this->options['purchase_limit'])) $this->options['purchase_limit'] = ''; |
| 53 |
if(!isset($this->options['point_rate'])) $this->options['point_rate'] = ''; |
| 54 |
if(!isset($this->options['shipping_rule'])) $this->options['shipping_rule'] = ''; |
| 55 |
if(!isset($this->options['company_name'])) $this->options['company_name'] = ''; |
| 56 |
if(!isset($this->options['address1'])) $this->options['address1'] = ''; |
| 57 |
if(!isset($this->options['address2'])) $this->options['address2'] = ''; |
| 58 |
if(!isset($this->options['zip_code'])) $this->options['zip_code'] = ''; |
| 59 |
if(!isset($this->options['tel_number'])) $this->options['tel_number'] = ''; |
| 60 |
if(!isset($this->options['fax_number'])) $this->options['fax_number'] = ''; |
| 61 |
if(!isset($this->options['order_mail'])) $this->options['order_mail'] = ''; |
| 62 |
if(!isset($this->options['inquiry_mail'])) $this->options['inquiry_mail'] = ''; |
| 63 |
if(!isset($this->options['sender_mail'])) $this->options['sender_mail'] = ''; |
| 64 |
if(!isset($this->options['error_mail'])) $this->options['error_mail'] = ''; |
| 65 |
if(!isset($this->options['copyright'])) $this->options['copyright'] = ''; |
| 66 |
if(!isset($this->options['postage_privilege'])) $this->options['postage_privilege'] = ''; |
| 67 |
if(!isset($this->options['shipping_rule'])) $this->options['shipping_rule'] = ''; |
| 68 |
if(!isset($this->options['tax_rate'])) $this->options['tax_rate'] = ''; |
| 69 |
if(!isset($this->options['tax_method'])) $this->options['tax_method'] = 'cutting'; |
| 70 |
if(!isset($this->options['transferee'])) $this->options['transferee'] = ''; |
| 71 |
if(!isset($this->options['membersystem_state'])) $this->options['membersystem_state'] = 'activate'; |
| 72 |
if(!isset($this->options['membersystem_point'])) $this->options['membersystem_point'] = ''; |
| 73 |
if(!isset($this->options['point_rate'])) $this->options['point_rate'] = ''; |
| 74 |
if(!isset($this->options['start_point'])) $this->options['start_point'] = ''; |
| 75 |
if(!isset($this->options['point_coverage'])) $this->options['point_coverage'] = 1; |
| 76 |
if(!isset($this->options['point_assign'])) $this->options['point_assign'] = 1;//20120919ysk 0000573 |
| 77 |
if(!isset($this->options['cod_type'])) $this->options['cod_type'] = 'fix'; |
| 78 |
if(!isset($this->options['newmem_admin_mail'])) $this->options['newmem_admin_mail'] = 0; |
| 79 |
if(!isset($this->options['delmem_admin_mail'])) $this->options['delmem_admin_mail'] = 1; |
| 80 |
if(!isset($this->options['delmem_customer_mail'])) $this->options['delmem_customer_mail'] = 1; |
| 81 |
if(!isset($this->options['mail_data']['title'])) $this->options['mail_data']['title'] = array('thankyou'=>'','order'=>'','inquiry'=>'','returninq'=>'','membercomp'=>'','completionmail'=>'', 'ordermail'=>'','changemail'=>'','receiptmail'=>'','mitumorimail'=>'','cancelmail'=>'','othermail'=>''); |
| 82 |
if(!isset($this->options['mail_data']['header'])) $this->options['mail_data']['header'] = array('thankyou'=>'','order'=>'','inquiry'=>'','returninq'=>'','membercomp'=>'','completionmail'=>'', 'ordermail'=>'','changemail'=>'','receiptmail'=>'','mitumorimail'=>'','cancelmail'=>'','othermail'=>''); |
| 83 |
if(!isset($this->options['mail_data']['footer'])) $this->options['mail_data']['footer'] = array('thankyou'=>'','order'=>'','inquiry'=>'','returninq'=>'','membercomp'=>'','completionmail'=>'', 'ordermail'=>'','changemail'=>'','receiptmail'=>'','mitumorimail'=>'','cancelmail'=>'','othermail'=>''); |
| 84 |
if(!isset($this->options['cart_page_data']['header'])) $this->options['cart_page_data']['header'] = array('cart'=>'','customer'=>'','delivery'=>'','confirm'=>'','completion'=>''); |
| 85 |
if(!isset($this->options['cart_page_data']['footer'])) $this->options['cart_page_data']['footer'] = array('cart'=>'','customer'=>'','delivery'=>'','confirm'=>'','completion'=>''); |
| 86 |
if(!isset($this->options['member_page_data']['header'])) $this->options['member_page_data']['header'] = array('login'=>'','newmember'=>'','newpass'=>'','changepass'=>'','memberinfo'=>'','completion'=>''); |
| 87 |
if(!isset($this->options['member_page_data']['footer'])) $this->options['member_page_data']['footer'] = array('login'=>'','newmember'=>'','newpass'=>'','changepass'=>'','memberinfo'=>'','completion'=>''); |
| 88 |
|
| 89 |
if(!isset($this->options['shortest_delivery_time'])) $this->options['shortest_delivery_time'] = '0'; |
| 90 |
if(!isset($this->options['delivery_after_days'])) $this->options['delivery_after_days'] = 15; |
| 91 |
if(!isset($this->options['delivery_days'])) $this->options['delivery_days'] = array(); |
| 92 |
if(!isset($this->options['delivery_time_limit']['hour'])) $this->options['delivery_time_limit']['hour'] = '00'; |
| 93 |
if(!isset($this->options['delivery_time_limit']['min'])) $this->options['delivery_time_limit']['min'] = '00'; |
| 94 |
|
| 95 |
if(!isset($this->options['divide_item'])) $this->options['divide_item'] = 0; |
| 96 |
if(!isset($this->options['itemimg_anchor_rel'])) $this->options['itemimg_anchor_rel'] = ''; |
| 97 |
if(!isset($this->options['fukugo_category_orderby'])) $this->options['fukugo_category_orderby'] = 'ID'; |
| 98 |
if(!isset($this->options['fukugo_category_order'])) $this->options['fukugo_category_order'] = 'ASC'; |
| 99 |
if(!isset($this->options['settlement_path'])) $this->options['settlement_path'] = USCES_PLUGIN_DIR . '/settlement/'; |
| 100 |
if(!isset($this->options['logs_path'])) $this->options['logs_path'] = ''; |
| 101 |
if(!isset($this->options['use_ssl'])) $this->options['use_ssl'] = 0; |
| 102 |
if(!isset($this->options['ssl_url'])) $this->options['ssl_url'] = ''; |
| 103 |
if(!isset($this->options['ssl_url_admin'])) $this->options['ssl_url_admin'] = ''; |
| 104 |
if(!isset($this->options['inquiry_id'])) $this->options['inquiry_id'] = ''; |
| 105 |
if(!isset($this->options['system']['orderby_itemsku'])) $this->options['system']['orderby_itemsku'] = 0; |
| 106 |
if(!isset($this->options['system']['orderby_itemopt'])) $this->options['system']['orderby_itemopt'] = 0; |
| 107 |
if(!isset($this->options['system']['front_lang'])) $this->options['system']['front_lang'] = usces_get_local_language(); |
| 108 |
if(!isset($this->options['system']['currency'])) $this->options['system']['currency'] = usces_get_base_country(); |
| 109 |
if(!isset($this->options['system']['addressform'])) $this->options['system']['addressform'] = usces_get_local_addressform(); |
| 110 |
if(!isset($this->options['system']['target_market'])) $this->options['system']['target_market'] = usces_get_local_target_market(); |
| 111 |
if(!isset($this->options['system']['no_cart_css'])) $this->options['system']['no_cart_css'] = 0; |
| 112 |
if(!isset($this->options['system']['dec_orderID_flag'])) $this->options['system']['dec_orderID_flag'] = 0; |
| 113 |
if(!isset($this->options['system']['dec_orderID_prefix'])) $this->options['system']['dec_orderID_prefix'] = ''; |
| 114 |
if(!isset($this->options['system']['dec_orderID_digit'])) $this->options['system']['dec_orderID_digit'] = 8; |
| 115 |
if(!isset($this->options['system']['subimage_rule'])) $this->options['system']['subimage_rule'] = 1; |
| 116 |
if(!isset($this->options['system']['pdf_delivery'])) $this->options['system']['pdf_delivery'] = 0; |
| 117 |
if(!isset($this->options['system']['member_pass_rule_min']) || empty($this->options['system']['member_pass_rule_min'])) $this->options['system']['member_pass_rule_min'] = 6; |
| 118 |
if(!isset($this->options['system']['member_pass_rule_max']) || empty($this->options['system']['member_pass_rule_max'])) $this->options['system']['member_pass_rule_max'] = ''; |
| 119 |
if(!isset($this->options['system']['csv_encode_type'])) $this->options['system']['csv_encode_type'] = 0; |
| 120 |
if(!isset($this->options['acting_settings']['zeus'])) $this->options['acting_settings']['zeus'] = array('activate'=>'','card_activate'=>'','clientip'=>'','authkey'=>'','connection'=>'','3dsecure'=>'','security'=>'','quickcharge'=>'', 'howpay'=>'','bank_activate'=>'','clientip_bank'=>'','testid_bank'=>'','conv_activate'=>'','clientip_conv'=>'','testid_conv'=>'','test_type_conv'=>''); |
| 121 |
if(!isset($this->options['acting_settings']['zeus']['connection'])) $this->options['acting_settings']['zeus']['connection'] = '1'; |
| 122 |
if(!isset($this->options['acting_settings']['zeus']['3dsecur'])) $this->options['acting_settings']['zeus']['3dsecur'] = '2'; |
| 123 |
if(!isset($this->options['acting_settings']['zeus']['security'])) $this->options['acting_settings']['zeus']['security'] = '2'; |
| 124 |
if(!isset($this->options['acting_settings']['remise'])) $this->options['acting_settings']['remise'] = array('activate'=>'','plan'=>'','SHOPCO'=>'','HOSTID'=>'','card_activate'=>'','card_jb'=>'', 'payquick'=>'','howpay'=>'','continuation'=>'','card_pc_ope'=>'','send_url_pc'=>'','conv_activate'=>'','S_PAYDATE'=>'','conv_pc_ope'=>'','send_url_cvs_pc'=>''); |
| 125 |
if(!isset($this->options['acting_settings']['jpayment'])) $this->options['acting_settings']['jpayment'] = array('activate'=>'','aid'=>'','card_activate'=>'','card_jb'=>'','conv_activate'=>'','webm_activate'=>'', 'bitc_activate'=>'','suica_activate'=>'','bank_activate'=>''); |
| 126 |
if(!isset($this->options['acting_settings']['paypal'])) $this->options['acting_settings']['paypal'] = array('activate'=>'','ec_activate'=>'','sandbox'=>'','user'=>'','pwd'=>'','signature'=>'', 'continuation'=>''); |
| 127 |
|
| 128 |
//20010420ysk start |
| 129 |
//if(!isset($this->options['system']['base_country'])) $this->options['system']['base_country'] = usces_get_base_country(); |
| 130 |
$this->options['system']['base_country'] = usces_get_base_country(); |
| 131 |
//20010420ysk end |
| 132 |
//20110331ysk start |
| 133 |
if(!isset($this->options['province'])) $this->options['province'][$this->options['system']['base_country']] = $usces_states[$this->options['system']['base_country']]; |
| 134 |
//20110331ysk end |
| 135 |
if(!isset($this->options['system']['pointreduction'])) $this->options['system']['pointreduction'] = usces_get_pointreduction($this->options['system']['currency']); |
| 136 |
if(!isset($this->options['indi_item_name'])){ |
| 137 |
$this->options['indi_item_name']['item_name'] = 1; |
| 138 |
$this->options['indi_item_name']['item_code'] = 1; |
| 139 |
$this->options['indi_item_name']['sku_name'] = 1; |
| 140 |
$this->options['indi_item_name']['sku_code'] = 1; |
| 141 |
$this->options['pos_item_name']['item_name'] = 1; |
| 142 |
$this->options['pos_item_name']['item_code'] = 2; |
| 143 |
$this->options['pos_item_name']['sku_name'] = 3; |
| 144 |
$this->options['pos_item_name']['sku_code'] = 4; |
| 145 |
} |
| 146 |
update_option('usces', $this->options); |
| 147 |
|
| 148 |
$this->check_display_mode(); |
| 149 |
$this->error_message = ''; |
| 150 |
$this->login_mail = ''; |
| 151 |
$this->get_current_member(); |
| 152 |
$this->page = ''; |
| 153 |
$this->payment_results = array(); |
| 154 |
$this->use_js = $this->options['use_javascript']; |
| 155 |
|
| 156 |
//admin_ssl options |
| 157 |
// $this->use_ssl = get_option("admin_ssl_use_ssl") === "1" ? true : false; |
| 158 |
// $use_shared = get_option("admin_ssl_use_shared") === "1" && $this->use_ssl ? true : false; |
| 159 |
// $shared_url = get_option("admin_ssl_shared_url"); |
| 160 |
|
| 161 |
$this->use_ssl = $this->options['use_ssl']; |
| 162 |
// if ( $use_shared ) { |
| 163 |
// $ssl_url = str_replace('/wp-admin/', '', $shared_url); |
| 164 |
// } else { |
| 165 |
// $ssl_url = str_replace('http://', 'https://', get_option('home')); |
| 166 |
// } |
| 167 |
define('USCES_CART_NUMBER', get_option('usces_cart_number')); |
| 168 |
define('USCES_MEMBER_NUMBER', get_option('usces_member_number')); |
| 169 |
|
| 170 |
if ( $this->use_ssl ) { |
| 171 |
$ssl_url = $this->options['ssl_url']; |
| 172 |
$ssl_url_admin = $this->options['ssl_url_admin']; |
| 173 |
if( $this->is_cart_or_member_page($_SERVER['REQUEST_URI']) || $this->is_inquiry_page($_SERVER['REQUEST_URI']) ){ |
| 174 |
define('USCES_FRONT_PLUGIN_URL', $ssl_url_admin . '/wp-content/plugins/' . USCES_PLUGIN_FOLDER); |
| 175 |
define('USCES_COOKIEPATH', preg_replace('|https?://[^/]+|i', '', $ssl_url . '/' ) ); |
| 176 |
}else{ |
| 177 |
define('USCES_FRONT_PLUGIN_URL', USCES_WP_CONTENT_URL . '/plugins/' . USCES_PLUGIN_FOLDER); |
| 178 |
define('USCES_COOKIEPATH', COOKIEPATH); |
| 179 |
} |
| 180 |
define('USCES_SSL_URL', $ssl_url); |
| 181 |
define('USCES_SSL_URL_ADMIN', $ssl_url_admin); |
| 182 |
}else{ |
| 183 |
define('USCES_FRONT_PLUGIN_URL', USCES_WP_CONTENT_URL . '/plugins/' . USCES_PLUGIN_FOLDER); |
| 184 |
define('USCES_SSL_URL', get_option('home')); |
| 185 |
define('USCES_SSL_URL_ADMIN', site_url()); |
| 186 |
define('USCES_COOKIEPATH', COOKIEPATH); |
| 187 |
} |
| 188 |
// if($this->use_ssl) { |
| 189 |
// define('USCES_CART_URL', $ssl_url . '/?page_id=' . USCES_CART_NUMBER . '&usces=' . $this->get_uscesid()); |
| 190 |
// define('USCES_MEMBER_URL', $ssl_url . '/?page_id=' . USCES_MEMBER_NUMBER . '&usces=' . $this->get_uscesid()); |
| 191 |
// define('USCES_INQUIRY_URL', $ssl_url . '/?page_id=' . $this->options['inquiry_id'] . '&usces=' . $this->get_uscesid()); |
| 192 |
// add_filter('home_url', array($this, 'usces_ssl_page_link')); |
| 193 |
// add_filter('wp_get_attachment_url', array($this, 'usces_ssl_attachment_link')); |
| 194 |
// add_filter('stylesheet_directory_uri', array($this, 'usces_ssl_contents_link')); |
| 195 |
// add_filter('template_directory_uri', array($this, 'usces_ssl_contents_link')); |
| 196 |
// add_filter('script_loader_src', array($this, 'usces_ssl_script_link')); |
| 197 |
// add_filter('style_loader_src', array($this, 'usces_ssl_script_link')); |
| 198 |
// } else { |
| 199 |
// define('USCES_CART_URL', get_option('home') . '/?page_id=' . USCES_CART_NUMBER); |
| 200 |
// define('USCES_MEMBER_URL', get_option('home') . '/?page_id=' . USCES_MEMBER_NUMBER); |
| 201 |
// define('USCES_INQUIRY_URL', get_option('home') . '/?page_id=' . $this->options['inquiry_id']); |
| 202 |
// } |
| 203 |
define('USCES_ITEM_CAT_PARENT_ID', get_option('usces_item_cat_parent_id')); |
| 204 |
|
| 205 |
$this->zaiko_status = get_option('usces_zaiko_status'); |
| 206 |
$this->member_status = get_option('usces_customer_status'); |
| 207 |
$this->payment_structure = get_option('usces_payment_structure'); |
| 208 |
$this->display_mode = get_option('usces_display_mode'); |
| 209 |
define('USCES_MYSQL_VERSION', $wpdb->db_version()); |
| 210 |
define('USCES_JP', ('ja' === get_locale() ? true : false)); |
| 211 |
|
| 212 |
} |
| 213 |
|
| 214 |
function get_default_post_to_edit30( $post_type = 'post', $create_in_db = false ) { |
| 215 |
global $wpdb; |
| 216 |
|
| 217 |
$post_title = ''; |
| 218 |
if ( !empty( $_REQUEST['post_title'] ) ) |
| 219 |
$post_title = esc_html( stripslashes( $_REQUEST['post_title'] )); |
| 220 |
|
| 221 |
$post_content = ''; |
| 222 |
if ( !empty( $_REQUEST['content'] ) ) |
| 223 |
$post_content = esc_html( stripslashes( $_REQUEST['content'] )); |
| 224 |
|
| 225 |
$post_excerpt = ''; |
| 226 |
if ( !empty( $_REQUEST['excerpt'] ) ) |
| 227 |
$post_excerpt = esc_html( stripslashes( $_REQUEST['excerpt'] )); |
| 228 |
|
| 229 |
if ( $create_in_db ) { |
| 230 |
// Cleanup old auto-drafts more than 7 days old |
| 231 |
$old_posts = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) > post_date" ); |
| 232 |
foreach ( (array) $old_posts as $delete ) |
| 233 |
wp_delete_post( $delete, true ); // Force delete |
| 234 |
$post = get_post( wp_insert_post( array( 'post_title' => __( 'Auto Draft' ), 'post_type' => $post_type, 'post_status' => 'auto-draft' ) ) ); |
| 235 |
} else { |
| 236 |
$post->ID = 0; |
| 237 |
$post->post_author = ''; |
| 238 |
$post->post_date = ''; |
| 239 |
$post->post_date_gmt = ''; |
| 240 |
$post->post_password = ''; |
| 241 |
$post->post_type = $post_type; |
| 242 |
$post->post_status = 'draft'; |
| 243 |
$post->to_ping = ''; |
| 244 |
$post->pinged = ''; |
| 245 |
$post->comment_status = get_option( 'default_comment_status' ); |
| 246 |
$post->ping_status = get_option( 'default_ping_status' ); |
| 247 |
$post->post_pingback = get_option( 'default_pingback_flag' ); |
| 248 |
$post->post_category = get_option( 'default_category' ); |
| 249 |
$post->page_template = 'default'; |
| 250 |
$post->post_parent = 0; |
| 251 |
$post->menu_order = 0; |
| 252 |
} |
| 253 |
|
| 254 |
$post->post_content = apply_filters( 'default_content', $post_content, $post ); |
| 255 |
$post->post_title = apply_filters( 'default_title', $post_title, $post ); |
| 256 |
$post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt, $post ); |
| 257 |
$post->post_name = ''; |
| 258 |
|
| 259 |
return $post; |
| 260 |
} |
| 261 |
|
| 262 |
function get_default_post_to_edit() { |
| 263 |
global $post; |
| 264 |
|
| 265 |
$post_title = ''; |
| 266 |
if ( !empty( $_REQUEST['post_title'] ) ) |
| 267 |
$post_title = esc_html( stripslashes( $_REQUEST['post_title'] )); |
| 268 |
|
| 269 |
$post_content = ''; |
| 270 |
if ( !empty( $_REQUEST['content'] ) ) |
| 271 |
$post_content = esc_html( stripslashes( $_REQUEST['content'] )); |
| 272 |
|
| 273 |
$post_excerpt = ''; |
| 274 |
if ( !empty( $_REQUEST['excerpt'] ) ) |
| 275 |
$post_excerpt = esc_html( stripslashes( $_REQUEST['excerpt'] )); |
| 276 |
|
| 277 |
$post->ID = 0; |
| 278 |
$post->post_name = ''; |
| 279 |
$post->post_author = ''; |
| 280 |
$post->post_date = ''; |
| 281 |
$post->post_date_gmt = ''; |
| 282 |
$post->post_password = ''; |
| 283 |
$post->post_status = 'draft'; |
| 284 |
$post->post_type = 'post'; |
| 285 |
$post->to_ping = ''; |
| 286 |
$post->pinged = ''; |
| 287 |
$post->comment_status = get_option( 'default_comment_status' ); |
| 288 |
$post->ping_status = get_option( 'default_ping_status' ); |
| 289 |
$post->post_pingback = get_option( 'default_pingback_flag' ); |
| 290 |
$post->post_category = get_option( 'default_category' ); |
| 291 |
$post->post_content = apply_filters( 'default_content', $post_content); |
| 292 |
$post->post_title = apply_filters( 'default_title', $post_title ); |
| 293 |
$post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt); |
| 294 |
$post->page_template = 'default'; |
| 295 |
$post->post_parent = 0; |
| 296 |
$post->menu_order = 0; |
| 297 |
|
| 298 |
return $post; |
| 299 |
} |
| 300 |
function is_cart_or_member_page($link) |
| 301 |
{ |
| 302 |
$search = array(('page_id='.USCES_CART_NUMBER), '/usces-cart', ('page_id='.USCES_MEMBER_NUMBER), '/usces-member'); |
| 303 |
$flag = false; |
| 304 |
foreach($search as $value){ |
| 305 |
$parts = array(); |
| 306 |
if( false !== strpos($link, $value) ){ |
| 307 |
if( $value == ('page_id='.USCES_CART_NUMBER) || $value == ('page_id='.USCES_MEMBER_NUMBER) ){ |
| 308 |
$parts = parse_url($link); |
| 309 |
parse_str($parts['query'], $query); |
| 310 |
if( $query['page_id'] == USCES_CART_NUMBER || $query['page_id'] == USCES_MEMBER_NUMBER ){ |
| 311 |
$flag = true; |
| 312 |
} |
| 313 |
}else{ |
| 314 |
$flag = true; |
| 315 |
} |
| 316 |
} |
| 317 |
} |
| 318 |
return $flag; |
| 319 |
} |
| 320 |
|
| 321 |
function is_cart_page($link) |
| 322 |
{ |
| 323 |
$search = array(('page_id='.USCES_CART_NUMBER), '/usces-cart' ); |
| 324 |
$flag = false; |
| 325 |
foreach($search as $value){ |
| 326 |
if( false !== strpos($link, $value) ){ |
| 327 |
if( $value == ('page_id='.USCES_CART_NUMBER) ){ |
| 328 |
$parts = parse_url($link); |
| 329 |
parse_str($parts['query'], $query); |
| 330 |
if( $query['page_id'] == USCES_CART_NUMBER ){ |
| 331 |
$flag = true; |
| 332 |
} |
| 333 |
}else{ |
| 334 |
$flag = true; |
| 335 |
} |
| 336 |
} |
| 337 |
} |
| 338 |
return $flag; |
| 339 |
} |
| 340 |
|
| 341 |
function is_member_page($link) |
| 342 |
{ |
| 343 |
$search = array(('page_id='.USCES_MEMBER_NUMBER), '/usces-member' ); |
| 344 |
$flag = false; |
| 345 |
foreach($search as $value){ |
| 346 |
if( false !== strpos($link, $value) ){ |
| 347 |
if( $value == ('page_id='.USCES_MEMBER_NUMBER) ){ |
| 348 |
$parts = parse_url($link); |
| 349 |
parse_str($parts['query'], $query); |
| 350 |
if( $query['page_id'] == USCES_MEMBER_NUMBER ){ |
| 351 |
$flag = true; |
| 352 |
} |
| 353 |
}else{ |
| 354 |
$flag = true; |
| 355 |
} |
| 356 |
} |
| 357 |
} |
| 358 |
return $flag; |
| 359 |
} |
| 360 |
|
| 361 |
function is_inquiry_page($link) |
| 362 |
{ |
| 363 |
if( empty($this->options['inquiry_id']) ) |
| 364 |
return false; |
| 365 |
|
| 366 |
$search = array(('page_id='.$this->options['inquiry_id']), '/usces-inquiry' ); |
| 367 |
$flag = false; |
| 368 |
foreach($search as $value){ |
| 369 |
if( false !== strpos($link, $value) ){ |
| 370 |
if( $value == ('page_id='.$this->options['inquiry_id']) ){ |
| 371 |
$parts = parse_url($link); |
| 372 |
parse_str($parts['query'], $query); |
| 373 |
if( $query['page_id'] == $this->options['inquiry_id'] ){ |
| 374 |
$flag = true; |
| 375 |
} |
| 376 |
}else{ |
| 377 |
$flag = true; |
| 378 |
} |
| 379 |
} |
| 380 |
} |
| 381 |
return $flag; |
| 382 |
} |
| 383 |
|
| 384 |
function usces_ssl_page_link($link) |
| 385 |
{ |
| 386 |
$parts = parse_url($link); |
| 387 |
|
| 388 |
if( isset($parts['query']) ){ |
| 389 |
parse_str($parts['query'], $query); |
| 390 |
} |
| 391 |
|
| 392 |
if( false !== strpos($link, '/usces-cart') || (isset( $query['page_id']) && $query['page_id'] == USCES_CART_NUMBER) ){ |
| 393 |
$link = USCES_CART_URL; |
| 394 |
|
| 395 |
}elseif( false !== strpos($link, '/usces-member') || (isset( $query['page_id']) && $query['page_id'] == USCES_MEMBER_NUMBER) ){ |
| 396 |
$link = USCES_MEMBER_URL; |
| 397 |
|
| 398 |
}elseif( !empty($this->options['inquiry_id']) && (false !== strpos($link, '/usces-inquiry') || (isset( $query['page_id']) && $query['page_id'] == $this->options['inquiry_id'])) ){ |
| 399 |
$link = USCES_INQUIRY_URL; |
| 400 |
|
| 401 |
}else{ |
| 402 |
$link = str_replace('https://', 'http://', $link); |
| 403 |
$link = apply_filters('usces_ssl_page_link', $link); |
| 404 |
} |
| 405 |
|
| 406 |
return $link; |
| 407 |
} |
| 408 |
function usces_ssl_contents_link($link) |
| 409 |
{ |
| 410 |
if( $this->is_cart_or_member_page($_SERVER['REQUEST_URI']) || $this->is_inquiry_page($_SERVER['REQUEST_URI'])){ |
| 411 |
$req = explode('/wp-content/',$link); |
| 412 |
$link = USCES_SSL_URL_ADMIN . '/wp-content/' . $req[1]; |
| 413 |
}else{ |
| 414 |
$link = apply_filters('usces_ssl_contents_link', $link); |
| 415 |
} |
| 416 |
return $link; |
| 417 |
} |
| 418 |
|
| 419 |
function ssl_admin_ajax_url(){ |
| 420 |
$path = '/wp-admin/admin-ajax.php'; |
| 421 |
if( $this->use_ssl && ($this->is_cart_or_member_page($_SERVER['REQUEST_URI']) || $this->is_inquiry_page($_SERVER['REQUEST_URI'])) ){ |
| 422 |
$link = USCES_SSL_URL_ADMIN . '/wp-admin/admin-ajax.php'; |
| 423 |
}else{ |
| 424 |
$link = site_url( $path ); |
| 425 |
} |
| 426 |
$link = apply_filters('ssl_admin_ajax_url', $link); |
| 427 |
return $link; |
| 428 |
} |
| 429 |
|
| 430 |
function usces_ssl_attachment_link($link) |
| 431 |
{ |
| 432 |
if( $this->is_cart_or_member_page($_SERVER['REQUEST_URI']) || $this->is_inquiry_page($_SERVER['REQUEST_URI']) ){ |
| 433 |
$link = str_replace(site_url(), USCES_SSL_URL_ADMIN, $link); |
| 434 |
}else{ |
| 435 |
$link = apply_filters('usces_ssl_attachment_link', $link); |
| 436 |
} |
| 437 |
return $link; |
| 438 |
} |
| 439 |
|
| 440 |
function usces_ssl_icon_dir_uri($uri) |
| 441 |
{ |
| 442 |
if( $this->is_cart_or_member_page($_SERVER['REQUEST_URI']) || $this->is_inquiry_page($_SERVER['REQUEST_URI']) ){ |
| 443 |
$uri = USCES_SSL_URL_ADMIN. '/' . WPINC . '/images/crystal'; |
| 444 |
}else{ |
| 445 |
$link = apply_filters('usces_ssl_icon_dir_uri', $uri); |
| 446 |
} |
| 447 |
return $uri; |
| 448 |
} |
| 449 |
|
| 450 |
function usces_ssl_script_link($link) |
| 451 |
{ |
| 452 |
if( $this->is_cart_or_member_page($_SERVER['REQUEST_URI']) || $this->is_inquiry_page($_SERVER['REQUEST_URI']) ){ |
| 453 |
if(strpos($link, '/wp-content/') !== false){ |
| 454 |
$req = explode('/wp-content/',$link, 2); |
| 455 |
$link = USCES_SSL_URL_ADMIN . '/wp-content/' . $req[1]; |
| 456 |
}else if(strpos($link, '/wp-includes/') !== false){ |
| 457 |
$req = explode('/wp-includes/',$link, 2); |
| 458 |
$link = USCES_SSL_URL_ADMIN . '/wp-includes/' . $req[1]; |
| 459 |
}else if(strpos($link, '/wp-admin/') !== false){ |
| 460 |
$req = explode('/wp-admin/',$link, 2); |
| 461 |
$link = USCES_SSL_URL_ADMIN . '/wp-admin/' . $req[1]; |
| 462 |
} |
| 463 |
}else{ |
| 464 |
$link = apply_filters('usces_ssl_script_link', $link); |
| 465 |
} |
| 466 |
return $link; |
| 467 |
} |
| 468 |
|
| 469 |
function set_action_status($status, $message) |
| 470 |
{ |
| 471 |
$this->action_status = $status; |
| 472 |
$this->action_message = $message; |
| 473 |
} |
| 474 |
|
| 475 |
|
| 476 |
/******************************************************************************/ |
| 477 |
function add_pages() { |
| 478 |
|
| 479 |
add_object_page('Welcart Shop', 'Welcart Shop', 'level_6', USCES_PLUGIN_BASENAME, array($this, 'admin_top_page')); |
| 480 |
add_submenu_page(USCES_PLUGIN_BASENAME, __('Home','usces'), __('Home','usces'), 'level_6', USCES_PLUGIN_BASENAME, array($this, 'admin_top_page')); |
| 481 |
add_submenu_page(USCES_PLUGIN_BASENAME, __('Master Items','usces'), __('Master Items','usces'), 'level_6', 'usces_itemedit', array($this, 'item_master_page')); |
| 482 |
add_submenu_page(USCES_PLUGIN_BASENAME, __('Add New Item','usces'), __('Add New Item','usces'), 'level_6', 'usces_itemnew', array($this, 'item_master_page')); |
| 483 |
add_submenu_page(USCES_PLUGIN_BASENAME, __('General Setting','usces'), __('General Setting','usces'), 'level_6', 'usces_initial', array($this, 'admin_setup_page')); |
| 484 |
add_submenu_page(USCES_PLUGIN_BASENAME, __('Business Days Setting','usces'), __('Business Days Setting','usces'), 'level_6', 'usces_schedule', array($this, 'admin_schedule_page')); |
| 485 |
add_submenu_page(USCES_PLUGIN_BASENAME, __('Shipping Setting','usces'), __('Shipping Setting','usces'), 'level_6', 'usces_delivery', array($this, 'admin_delivery_page')); |
| 486 |
add_submenu_page(USCES_PLUGIN_BASENAME, __('E-mail Setting','usces'), __('E-mail Setting','usces'), 'level_6', 'usces_mail', array($this, 'admin_mail_page')); |
| 487 |
add_submenu_page(USCES_PLUGIN_BASENAME, __('Cart Page Setting','usces'), __('Cart Page Setting','usces'), 'level_6', 'usces_cart', array($this, 'admin_cart_page')); |
| 488 |
add_submenu_page(USCES_PLUGIN_BASENAME, __('Member Page Setting','usces'), __('Member Page Setting','usces'), 'level_6', 'usces_member', array($this, 'admin_member_page')); |
| 489 |
add_submenu_page(USCES_PLUGIN_BASENAME, __('System Setting','usces'), __('System Setting','usces'), 'administrator', 'usces_system', array($this, 'admin_system_page')); |
| 490 |
add_submenu_page(USCES_PLUGIN_BASENAME, __('Settlement Setting','usces'), __('Settlement Setting','usces'), 'administrator', 'usces_settlement', array($this, 'admin_settlement_page')); |
| 491 |
//add_submenu_page(USCES_PLUGIN_BASENAME, __('Backup','usces'), __('Backup','usces'), 'level_6', 'usces_backup', array($this, 'admin_backup_page')); |
| 492 |
do_action('usces_action_shop_admin_menue'); |
| 493 |
|
| 494 |
add_object_page('Welcart Management', 'Welcart Management', 'level_6', 'usces_orderlist', array($this, 'order_list_page')); |
| 495 |
add_submenu_page('usces_orderlist', __('Order List','usces'), __('Order List','usces'), 'level_6', 'usces_orderlist', array($this, 'order_list_page')); |
| 496 |
add_submenu_page('usces_orderlist', __('New Order or Estimate','usces'), __('New Order or Estimate','usces'), 'level_6', 'usces_ordernew', array($this, 'order_list_page')); |
| 497 |
add_submenu_page('usces_orderlist', __('List of Members','usces'), __('List of Members','usces'), 'level_6', 'usces_memberlist', array($this, 'member_list_page')); |
| 498 |
//add_submenu_page('usces_orderlist', __('New Member','usces'), __('New Member','usces'), 'level_6', 'usces_membernew', array($this, 'member_list_page')); |
| 499 |
do_action('usces_action_management_admin_menue'); |
| 500 |
} |
| 501 |
|
| 502 |
|
| 503 |
/* Item Master Page */ |
| 504 |
function item_master_page() { |
| 505 |
global $wpdb, $wp_locale; |
| 506 |
global $wp_query; |
| 507 |
|
| 508 |
if(empty($this->action_message) || WCUtils::is_blank($this->action_message) ) { |
| 509 |
$this->action_status = 'none'; |
| 510 |
$this->action_message = ''; |
| 511 |
} |
| 512 |
|
| 513 |
if($_REQUEST['page'] == 'usces_itemnew'){ |
| 514 |
$action = 'new'; |
| 515 |
}else{ |
| 516 |
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; |
| 517 |
} |
| 518 |
do_action( 'usces_action_item_master_page', $action ); |
| 519 |
switch ( $action ) { |
| 520 |
case 'dlitemlist': |
| 521 |
usces_download_item_list(); |
| 522 |
break; |
| 523 |
case 'upload_register': |
| 524 |
require_once(USCES_PLUGIN_DIR . '/includes/usces_item_master_upload_register.php'); |
| 525 |
break; |
| 526 |
case 'delete': |
| 527 |
case 'new': |
| 528 |
case 'editpost': |
| 529 |
case 'edit': |
| 530 |
global $current_user; |
| 531 |
require_once(USCES_PLUGIN_DIR . '/includes/usces_item_master_edit.php'); |
| 532 |
break; |
| 533 |
default: |
| 534 |
require_once(USCES_PLUGIN_DIR . '/includes/usces_item_master_list.php'); |
| 535 |
break; |
| 536 |
} |
| 537 |
} |
| 538 |
|
| 539 |
/* order list page */ |
| 540 |
function order_list_page() { |
| 541 |
$order_edit_form = apply_filters( 'usces_admin_order_edit_form', USCES_PLUGIN_DIR . '/includes/order_edit_form.php' ); |
| 542 |
$order_list = apply_filters( 'usces_admin_order_list', USCES_PLUGIN_DIR . '/includes/order_list.php' ); |
| 543 |
|
| 544 |
if(empty($this->action_message) || WCUtils::is_blank($this->action_message) ) { |
| 545 |
$this->action_status = 'none'; |
| 546 |
$this->action_message = ''; |
| 547 |
} |
| 548 |
if($_REQUEST['page'] == 'usces_ordernew'){ |
| 549 |
$order_action = 'new'; |
| 550 |
}else{ |
| 551 |
$order_action = isset($_REQUEST['order_action']) ? $_REQUEST['order_action'] : ''; |
| 552 |
} |
| 553 |
do_action('usces_action_order_list_page', $order_action); |
| 554 |
switch ($order_action) { |
| 555 |
//20100908ysk start |
| 556 |
case 'dlproductlist': |
| 557 |
usces_download_product_list(); |
| 558 |
break; |
| 559 |
case 'dlorderlist': |
| 560 |
usces_download_order_list(); |
| 561 |
break; |
| 562 |
//20100908ysk end |
| 563 |
// case 'printpdf': |
| 564 |
// require_once(USCES_PLUGIN_DIR . '/includes/order_print.php'); |
| 565 |
// break; |
| 566 |
case 'editpost': |
| 567 |
do_action('usces_pre_update_orderdata', $_REQUEST['order_id']); |
| 568 |
$res = usces_update_orderdata(); |
| 569 |
if ( 1 === $res ) { |
| 570 |
$this->set_action_status('success', __('order date is updated','usces').' <a href="'.stripslashes( $_POST['usces_referer'] ).'">'.__('back to the summary','usces').'</a>'); |
| 571 |
} elseif ( 0 === $res ) { |
| 572 |
$this->set_action_status('none', ''); |
| 573 |
} else { |
| 574 |
$this->set_action_status('error', 'ERROR : '.__('failure in update','usces')); |
| 575 |
} |
| 576 |
do_action('usces_after_update_orderdata', $_REQUEST['order_id'], $res); |
| 577 |
require_once($order_edit_form); |
| 578 |
break; |
| 579 |
case 'newpost': |
| 580 |
do_action('usces_pre_new_orderdata'); |
| 581 |
$res = usces_new_orderdata(); |
| 582 |
if ( 1 === $res ) { |
| 583 |
$this->set_action_status('success', __('New date is add','usces')); |
| 584 |
} elseif ( 0 === $res ) { |
| 585 |
$this->set_action_status('none', ''); |
| 586 |
} else { |
| 587 |
$this->set_action_status('error', 'ERROR : '.__('failure in addition','usces')); |
| 588 |
} |
| 589 |
do_action('usces_after_new_orderdata', $res); |
| 590 |
$_REQUEST['order_action'] = 'edit'; |
| 591 |
$order_action = $_REQUEST['order_action']; |
| 592 |
require_once($order_edit_form); |
| 593 |
break; |
| 594 |
case 'new': |
| 595 |
case 'edit': |
| 596 |
require_once($order_edit_form); |
| 597 |
break; |
| 598 |
case 'delete': |
| 599 |
do_action('usces_pre_delete_orderdata', $_REQUEST['order_id']); |
| 600 |
$res = usces_delete_orderdata(); |
| 601 |
if ( 1 === $res ) { |
| 602 |
$this->set_action_status('success', __('the order date is deleted','usces')); |
| 603 |
} elseif ( 0 === $res ) { |
| 604 |
$this->set_action_status('none', ''); |
| 605 |
} else { |
| 606 |
$this->set_action_status('error', 'ERROR : '.__('failure in delete','usces')); |
| 607 |
} |
| 608 |
do_action('usces_after_delete_orderdata', $_REQUEST['order_id'], $res); |
| 609 |
default: |
| 610 |
require_once($order_list); |
| 611 |
} |
| 612 |
} |
| 613 |
|
| 614 |
/* member list page */ |
| 615 |
function member_list_page() { |
| 616 |
$member_edit_form = apply_filters( 'usces_admin_member_edit_form', USCES_PLUGIN_DIR . '/includes/member_edit_form.php' ); |
| 617 |
$member_list = apply_filters( 'usces_admin_member_list', USCES_PLUGIN_DIR . '/includes/member_list.php' ); |
| 618 |
|
| 619 |
if(empty($this->action_message) || WCUtils::is_blank($this->action_message) ) { |
| 620 |
$this->action_status = 'none'; |
| 621 |
$this->action_message = ''; |
| 622 |
} |
| 623 |
$member_action = isset($_REQUEST['member_action']) ? $_REQUEST['member_action'] : ''; |
| 624 |
switch ($member_action) { |
| 625 |
//20100908ysk start |
| 626 |
case 'dlmemberlist': |
| 627 |
usces_download_member_list(); |
| 628 |
break; |
| 629 |
//20100908ysk end |
| 630 |
case 'editpost': |
| 631 |
$this->error_message = $this->admin_member_check(); |
| 632 |
if( WCUtils::is_blank($this->error_message) ){ |
| 633 |
$res = usces_update_memberdata(); |
| 634 |
if ( 1 === $res ) { |
| 635 |
$this->set_action_status('success', __('Membership information is updated','usces')); |
| 636 |
} elseif ( 0 === $res ) { |
| 637 |
$this->set_action_status('none', ''); |
| 638 |
} else { |
| 639 |
$this->set_action_status('error', 'ERROR : '.__('failure in update','usces')); |
| 640 |
} |
| 641 |
} |
| 642 |
require_once($member_edit_form); |
| 643 |
break; |
| 644 |
case 'new': |
| 645 |
case 'edit': |
| 646 |
require_once($member_edit_form); |
| 647 |
break; |
| 648 |
case 'delete': |
| 649 |
$res = usces_delete_memberdata(); |
| 650 |
if ( 1 === $res ) { |
| 651 |
$this->set_action_status('success', __('The member data is deleted','usces')); |
| 652 |
} elseif ( 0 === $res ) { |
| 653 |
$this->set_action_status('none', ''); |
| 654 |
} else { |
| 655 |
$this->set_action_status('error', 'ERROR : '.__('failure in delete','usces')); |
| 656 |
} |
| 657 |
default: |
| 658 |
require_once($member_list); |
| 659 |
} |
| 660 |
|
| 661 |
} |
| 662 |
|
| 663 |
/* admin backup page */ |
| 664 |
function admin_backup_page() { |
| 665 |
|
| 666 |
if(empty($this->action_message) || WCUtils::is_blank($this->action_message) ) { |
| 667 |
$this->action_status = 'none'; |
| 668 |
$this->action_message = ''; |
| 669 |
} |
| 670 |
require_once(USCES_PLUGIN_DIR . '/includes/admin_backup.php'); |
| 671 |
|
| 672 |
} |
| 673 |
|
| 674 |
/* Shop Top Page */ |
| 675 |
function admin_top_page() { |
| 676 |
$path = apply_filters( 'usces_filter_admin_top_page', USCES_PLUGIN_DIR . '/includes/admin_top.php'); |
| 677 |
require_once($path); |
| 678 |
|
| 679 |
} |
| 680 |
|
| 681 |
/* Shop Setup Page */ |
| 682 |
function admin_setup_page() { |
| 683 |
$this->options = get_option('usces'); |
| 684 |
//$this->options = array(); |
| 685 |
|
| 686 |
|
| 687 |
if(isset($_POST['usces_option_update'])) { |
| 688 |
|
| 689 |
$_POST = $this->stripslashes_deep_post($_POST); |
| 690 |
$this->options['display_mode'] = isset($_POST['display_mode']) ? trim($_POST['display_mode']) : ''; |
| 691 |
$this->options['campaign_category'] = empty($_POST['cat']) ? USCES_ITEM_CAT_PARENT_ID : $_POST['cat']; |
| 692 |
$this->options['campaign_privilege'] = isset($_POST['cat_privilege']) ? trim($_POST['cat_privilege']) : ''; |
| 693 |
$this->options['privilege_point'] = isset($_POST['point_num']) ? (int)$_POST['point_num'] : ''; |
| 694 |
$this->options['privilege_discount'] = isset($_POST['discount_num']) ? (int)$_POST['discount_num'] : ''; |
| 695 |
$this->options['company_name'] = isset($_POST['company_name']) ? trim($_POST['company_name']) : ''; |
| 696 |
$this->options['zip_code'] = isset($_POST['zip_code']) ? trim($_POST['zip_code']) : ''; |
| 697 |
$this->options['address1'] = isset($_POST['address1']) ? trim($_POST['address1']) : ''; |
| 698 |
$this->options['address2'] = isset($_POST['address2']) ? trim($_POST['address2']) : ''; |
| 699 |
$this->options['tel_number'] = isset($_POST['tel_number']) ? trim($_POST['tel_number']) : ''; |
| 700 |
$this->options['fax_number'] = isset($_POST['fax_number']) ? trim($_POST['fax_number']) : ''; |
| 701 |
$this->options['order_mail'] = isset($_POST['order_mail']) ? trim($_POST['order_mail']) : ''; |
| 702 |
$this->options['inquiry_mail'] = isset($_POST['inquiry_mail']) ? trim($_POST['inquiry_mail']) : ''; |
| 703 |
$this->options['sender_mail'] = isset($_POST['sender_mail']) ? trim($_POST['sender_mail']) : ''; |
| 704 |
$this->options['error_mail'] = isset($_POST['error_mail']) ? trim($_POST['error_mail']) : ''; |
| 705 |
$this->options['postage_privilege'] = isset($_POST['postage_privilege']) ? trim($_POST['postage_privilege']) : ''; |
| 706 |
$this->options['purchase_limit'] = isset($_POST['purchase_limit']) ? trim($_POST['purchase_limit']) : ''; |
| 707 |
$this->options['point_rate'] = isset($_POST['point_rate']) ? (int)$_POST['point_rate'] : 1; |
| 708 |
$this->options['start_point'] = isset($_POST['start_point']) ? (int)$_POST['start_point'] : ''; |
| 709 |
$this->options['shipping_rule'] = isset($_POST['shipping_rule']) ? trim($_POST['shipping_rule']) : ''; |
| 710 |
$this->options['tax_rate'] = isset($_POST['tax_rate']) ? (int)$_POST['tax_rate'] : ''; |
| 711 |
$this->options['tax_method'] = isset($_POST['tax_method']) ? trim($_POST['tax_method']) : ''; |
| 712 |
$this->options['cod_type'] = isset($this->options['cod_type']) ? $this->options['cod_type'] : 'fix'; |
| 713 |
$this->options['transferee'] = isset($_POST['transferee']) ? trim($_POST['transferee']) : ''; |
| 714 |
$this->options['copyright'] = isset($_POST['copyright']) ? trim($_POST['copyright']) : ''; |
| 715 |
$this->options['membersystem_state'] = isset($_POST['membersystem_state']) ? trim($_POST['membersystem_state']) : ''; |
| 716 |
$this->options['membersystem_point'] = isset($_POST['membersystem_point']) ? trim($_POST['membersystem_point']) : ''; |
| 717 |
$this->options['point_coverage'] = isset($_POST['point_coverage']) ? (int)$_POST['point_coverage'] : 0; |
| 718 |
$this->options['point_assign'] = isset($_POST['point_assign']) ? (int)$_POST['point_assign'] : 1;//20120919ysk 0000573 |
| 719 |
|
| 720 |
$this->options = apply_filters( 'usces_filter_admin_setup_options', $this->options ); |
| 721 |
|
| 722 |
update_option('usces', $this->options); |
| 723 |
|
| 724 |
$this->action_status = 'success'; |
| 725 |
$this->action_message = __('options are updated','usces'); |
| 726 |
|
| 727 |
} else { |
| 728 |
$this->action_status = 'none'; |
| 729 |
$this->action_message = ''; |
| 730 |
} |
| 731 |
|
| 732 |
require_once(USCES_PLUGIN_DIR . '/includes/admin_setup.php'); |
| 733 |
|
| 734 |
} |
| 735 |
|
| 736 |
/* Shop Schedule Page */ |
| 737 |
function admin_schedule_page() { |
| 738 |
|
| 739 |
$this->options = get_option('usces'); |
| 740 |
|
| 741 |
if(isset($_POST['usces_option_update'])) { |
| 742 |
$_POST = $this->stripslashes_deep_post($_POST); |
| 743 |
|
| 744 |
$this->options['campaign_schedule'] = isset($_POST['campaign_schedule']) ? $_POST['campaign_schedule'] : '0'; |
| 745 |
if(isset($_POST['business_days'])) |
| 746 |
$this->options['business_days'] = $_POST['business_days']; |
| 747 |
|
| 748 |
update_option('usces', $this->options); |
| 749 |
|
| 750 |
do_action( 'usces_action_admin_schedule_update' ); |
| 751 |
|
| 752 |
$this->action_status = 'success'; |
| 753 |
$this->action_message = __('options are updated','usces'); |
| 754 |
} else { |
| 755 |
$this->action_status = 'none'; |
| 756 |
$this->action_message = ''; |
| 757 |
} |
| 758 |
|
| 759 |
require_once(USCES_PLUGIN_DIR . '/includes/admin_schedule.php'); |
| 760 |
|
| 761 |
} |
| 762 |
|
| 763 |
/* Shop Delivery Page */ |
| 764 |
function admin_delivery_page() { |
| 765 |
|
| 766 |
$this->options = get_option('usces'); |
| 767 |
|
| 768 |
if(isset($_POST['usces_option_update'])) { |
| 769 |
$_POST = $this->stripslashes_deep_post($_POST); |
| 770 |
|
| 771 |
//20101208ysk start |
| 772 |
if(isset($_POST['delivery_time_limit'])) $this->options['delivery_time_limit'] = $_POST['delivery_time_limit']; |
| 773 |
if(isset($_POST['shortest_delivery_time'])) $this->options['shortest_delivery_time'] = $_POST['shortest_delivery_time']; |
| 774 |
if(isset($_POST['delivery_after_days'])) $this->options['delivery_after_days'] = $_POST['delivery_after_days']; |
| 775 |
//20101208ysk end |
| 776 |
|
| 777 |
update_option('usces', $this->options); |
| 778 |
|
| 779 |
$this->action_status = 'success'; |
| 780 |
$this->action_message = __('options are updated','usces'); |
| 781 |
} else { |
| 782 |
$this->action_status = 'none'; |
| 783 |
$this->action_message = ''; |
| 784 |
} |
| 785 |
|
| 786 |
require_once(USCES_PLUGIN_DIR . '/includes/admin_delivery.php'); |
| 787 |
|
| 788 |
} |
| 789 |
|
| 790 |
/* Shop Mail Page */ |
| 791 |
function admin_mail_page() { |
| 792 |
global $allowedposttags; |
| 793 |
|
| 794 |
$this->options = get_option('usces'); |
| 795 |
|
| 796 |
if(isset($_POST['usces_option_update'])) { |
| 797 |
$_POST = $this->stripslashes_deep_post($_POST); |
| 798 |
|
| 799 |
$this->options['smtp_hostname'] = trim($_POST['smtp_hostname']); |
| 800 |
$this->options['newmem_admin_mail'] = (int)$_POST['newmem_admin_mail']; |
| 801 |
$this->options['delmem_admin_mail'] = (int)$_POST['delmem_admin_mail']; |
| 802 |
$this->options['delmem_customer_mail'] = (int)$_POST['delmem_customer_mail']; |
| 803 |
|
| 804 |
foreach ( $_POST['title'] as $key => $value ) { |
| 805 |
if( WCUtils::is_blank($value) ) { |
| 806 |
$this->options['mail_data']['title'][$key] = $this->options['mail_default']['title'][$key]; |
| 807 |
}else{ |
| 808 |
$this->options['mail_data']['title'][$key] = trim($value); |
| 809 |
} |
| 810 |
} |
| 811 |
foreach ( $_POST['header'] as $key => $value ) { |
| 812 |
if( WCUtils::is_blank($value) ) { |
| 813 |
$this->options['mail_data']['header'][$key] = $this->options['mail_default']['header'][$key]; |
| 814 |
}else{ |
| 815 |
$this->options['mail_data']['header'][$key] = $value; |
| 816 |
} |
| 817 |
} |
| 818 |
foreach ( $_POST['footer'] as $key => $value ) { |
| 819 |
if( WCUtils::is_blank($value) ) { |
| 820 |
$this->options['mail_data']['footer'][$key] = $this->options['mail_default']['footer'][$key]; |
| 821 |
}else{ |
| 822 |
$this->options['mail_data']['footer'][$key] = $value; |
| 823 |
} |
| 824 |
} |
| 825 |
|
| 826 |
|
| 827 |
$this->action_status = 'success'; |
| 828 |
$this->action_message = __('options are updated','usces'); |
| 829 |
|
| 830 |
} else { |
| 831 |
|
| 832 |
foreach ( (array)$this->options['mail_data']['title'] as $key => $value ) { |
| 833 |
if( WCUtils::is_blank($value) ) { |
| 834 |
$this->options['mail_data']['title'][$key] = $this->options['mail_default']['title'][$key]; |
| 835 |
} |
| 836 |
} |
| 837 |
foreach ( (array)$this->options['mail_data']['header'] as $key => $value ) { |
| 838 |
if( WCUtils::is_blank($value) ) { |
| 839 |
$this->options['mail_data']['header'][$key] = $this->options['mail_default']['header'][$key]; |
| 840 |
} |
| 841 |
} |
| 842 |
foreach ( (array)$this->options['mail_data']['footer'] as $key => $value ) { |
| 843 |
if( WCUtils::is_blank($value) ) { |
| 844 |
$this->options['mail_data']['footer'][$key] = $this->options['mail_default']['footer'][$key]; |
| 845 |
} |
| 846 |
} |
| 847 |
|
| 848 |
$this->action_status = 'none'; |
| 849 |
$this->action_message = ''; |
| 850 |
|
| 851 |
} |
| 852 |
|
| 853 |
update_option('usces', $this->options); |
| 854 |
do_action( 'usces_action_admin_mail_page' ); |
| 855 |
|
| 856 |
require_once(USCES_PLUGIN_DIR . '/includes/admin_mail.php'); |
| 857 |
|
| 858 |
} |
| 859 |
|
| 860 |
/* Admin Cart Page */ |
| 861 |
function admin_cart_page() { |
| 862 |
global $allowedposttags; |
| 863 |
$this->options = get_option('usces'); |
| 864 |
|
| 865 |
if(isset($_POST['usces_option_update'])) { |
| 866 |
$_POST = $this->stripslashes_deep_post($_POST); |
| 867 |
|
| 868 |
foreach ( $this->options['indi_item_name'] as $key => $value ) { |
| 869 |
$this->options['indi_item_name'][$key] = isset($_POST['indication'][$key]) ? 1 : 0; |
| 870 |
} |
| 871 |
foreach ( $_POST['position'] as $key => $value ) { |
| 872 |
$this->options['pos_item_name'][$key] = $value; |
| 873 |
} |
| 874 |
foreach ( $_POST['header'] as $key => $value ) { |
| 875 |
$this->options['cart_page_data']['header'][$key] = addslashes(wp_kses($value, $allowedposttags)); |
| 876 |
} |
| 877 |
foreach ( $_POST['footer'] as $key => $value ) { |
| 878 |
$this->options['cart_page_data']['footer'][$key] = addslashes(wp_kses($value, $allowedposttags)); |
| 879 |
} |
| 880 |
|
| 881 |
update_option('usces', $this->options); |
| 882 |
|
| 883 |
$this->action_status = 'success'; |
| 884 |
$this->action_message = __('options are updated','usces'); |
| 885 |
} else { |
| 886 |
|
| 887 |
$this->action_status = 'none'; |
| 888 |
$this->action_message = ''; |
| 889 |
} |
| 890 |
|
| 891 |
|
| 892 |
|
| 893 |
require_once(USCES_PLUGIN_DIR . '/includes/admin_cart.php'); |
| 894 |
|
| 895 |
} |
| 896 |
|
| 897 |
/* Admin Member Page */ |
| 898 |
function admin_member_page() { |
| 899 |
|
| 900 |
$this->options = get_option('usces'); |
| 901 |
|
| 902 |
if(isset($_POST['usces_option_update'])) { |
| 903 |
$_POST = $this->stripslashes_deep_post($_POST); |
| 904 |
|
| 905 |
foreach ( $_POST['header'] as $key => $value ) { |
| 906 |
$this->options['member_page_data']['header'][$key] = $value; |
| 907 |
} |
| 908 |
foreach ( $_POST['footer'] as $key => $value ) { |
| 909 |
$this->options['member_page_data']['footer'][$key] = $value; |
| 910 |
} |
| 911 |
|
| 912 |
update_option('usces', $this->options); |
| 913 |
|
| 914 |
$this->action_status = 'success'; |
| 915 |
$this->action_message = __('options are updated','usces'); |
| 916 |
} else { |
| 917 |
|
| 918 |
$this->action_status = 'none'; |
| 919 |
$this->action_message = ''; |
| 920 |
} |
| 921 |
|
| 922 |
|
| 923 |
|
| 924 |
require_once(USCES_PLUGIN_DIR . '/includes/admin_member.php'); |
| 925 |
|
| 926 |
} |
| 927 |
|
| 928 |
|
| 929 |
/* Admin System Page */ |
| 930 |
function admin_system_page() { |
| 931 |
//20110331ysk start |
| 932 |
global $usces_states; |
| 933 |
//20110331ysk end |
| 934 |
$action_status = '';//20120511ysk 0000470 |
| 935 |
|
| 936 |
$this->options = get_option('usces'); |
| 937 |
|
| 938 |
if(isset($_POST['usces_option_update'])) { |
| 939 |
$_POST = $this->stripslashes_deep_post($_POST); |
| 940 |
|
| 941 |
$this->options['divide_item'] = isset($_POST['divide_item']) ? 1 : 0; |
| 942 |
$this->options['itemimg_anchor_rel'] = isset($_POST['itemimg_anchor_rel']) ? trim($_POST['itemimg_anchor_rel']) : ''; |
| 943 |
$this->options['fukugo_category_orderby'] = isset($_POST['fukugo_category_orderby']) ? $_POST['fukugo_category_orderby'] : ''; |
| 944 |
$this->options['fukugo_category_order'] = isset($_POST['fukugo_category_order']) ? $_POST['fukugo_category_order'] : ''; |
| 945 |
$this->options['settlement_path'] = isset($_POST['settlement_path']) ? $_POST['settlement_path'] : ''; |
| 946 |
if( WCUtils::is_blank($this->options['settlement_path']) ) $this->options['settlement_path'] = USCES_PLUGIN_DIR . '/settlement/'; |
| 947 |
$sl = substr($this->options['settlement_path'], -1); |
| 948 |
if($sl != '/' && $sl != '\\') $this->options['settlement_path'] .= '/'; |
| 949 |
$this->options['logs_path'] = isset($_POST['logs_path']) ? $_POST['logs_path'] : ''; |
| 950 |
if( !WCUtils::is_blank($this->options['logs_path']) ){ |
| 951 |
$sl = substr($this->options['logs_path'], -1); |
| 952 |
if($sl == '/' || $sl == '\\') $this->options['logs_path'] = substr($this->options['logs_path'], 0, -1); |
| 953 |
} |
| 954 |
$this->options['use_ssl'] = isset($_POST['use_ssl']) ? 1 : 0; |
| 955 |
$this->options['ssl_url'] = isset($_POST['ssl_url']) ? rtrim($_POST['ssl_url'], '/') : ''; |
| 956 |
$this->options['ssl_url_admin'] = isset($_POST['ssl_url_admin']) ? rtrim($_POST['ssl_url_admin'], '/') : ''; |
| 957 |
if( WCUtils::is_blank($this->options['ssl_url']) || WCUtils::is_blank($this->options['ssl_url_admin']) ) $this->options['use_ssl'] = 0; |
| 958 |
$this->options['inquiry_id'] = isset($_POST['inquiry_id']) ? esc_html(rtrim($_POST['inquiry_id'])) : ''; |
| 959 |
$this->options['use_javascript'] = isset($_POST['use_javascript']) ? (int)$_POST['use_javascript'] : 1; |
| 960 |
$this->options['system']['front_lang'] = (isset($_POST['front_lang']) && 'others' != $_POST['front_lang']) ? $_POST['front_lang'] : usces_get_local_language(); |
| 961 |
$this->options['system']['currency'] = (isset($_POST['currency']) && 'others' != $_POST['currency']) ? $_POST['currency'] : usces_get_base_country(); |
| 962 |
$this->options['system']['addressform'] = (isset($_POST['addressform']) ) ? $_POST['addressform'] : usces_get_local_addressform(); |
| 963 |
$this->options['system']['target_market'] = (isset($_POST['target_market']) ) ? $_POST['target_market'] : usces_get_local_target_market(); |
| 964 |
$this->options['system']['no_cart_css'] = isset($_POST['no_cart_css']) ? 1 : 0; |
| 965 |
$this->options['system']['dec_orderID_flag'] = isset($_POST['dec_orderID_flag']) ? (int)$_POST['dec_orderID_flag'] : 0; |
| 966 |
$this->options['system']['dec_orderID_prefix'] = isset($_POST['dec_orderID_prefix']) ? esc_html(rtrim($_POST['dec_orderID_prefix'])) : ''; |
| 967 |
$this->options['system']['pdf_delivery'] = isset($_POST['pdf_delivery']) ? (int)$_POST['pdf_delivery'] : 0; |
| 968 |
$this->options['system']['member_pass_rule_min'] = isset($_POST['member_pass_rule_min']) ? (int)$_POST['member_pass_rule_min'] : 6; |
| 969 |
$this->options['system']['member_pass_rule_max'] = isset($_POST['member_pass_rule_max']) && !empty($_POST['member_pass_rule_max']) ? (int)$_POST['member_pass_rule_max'] : ''; |
| 970 |
$this->options['system']['csv_encode_type'] = isset($_POST['csv_encode_type']) ? (int)$_POST['csv_encode_type'] : 0; |
| 971 |
|
| 972 |
if( isset($_POST['dec_orderID_digit']) ){ |
| 973 |
$dec_orderID_digit = (int)rtrim($_POST['dec_orderID_digit']); |
| 974 |
if( 6 > $dec_orderID_digit ){ |
| 975 |
$this->options['system']['dec_orderID_digit'] = 6; |
| 976 |
}else{ |
| 977 |
$this->options['system']['dec_orderID_digit'] = $dec_orderID_digit; |
| 978 |
} |
| 979 |
}else{ |
| 980 |
$this->options['system']['dec_orderID_digit'] = 6; |
| 981 |
} |
| 982 |
$this->options['system']['subimage_rule'] = isset($_POST['subimage_rule']) ? (int)$_POST['subimage_rule'] : 0; |
| 983 |
//20110331ysk start |
| 984 |
unset($this->options['province']); |
| 985 |
//$action_status = '';//20120511ysk 0000470 |
| 986 |
foreach((array)$this->options['system']['target_market'] as $target_market) { |
| 987 |
$province = array(); |
| 988 |
if(!empty($_POST['province_'.$target_market])) { |
| 989 |
$temp_pref = explode("\n", $_POST['province_'.$target_market]); |
| 990 |
//20120123ysk start 0000386 |
| 991 |
//$province[] = __('-- Select --', 'usces'); |
| 992 |
$province[] = '-- Select --'; |
| 993 |
//20120123ysk end |
| 994 |
//20120725ysk start 0000537 |
| 995 |
//for($i = 0; $i < count($temp_pref); $i++) { |
| 996 |
//$province[] = trim($temp_pref[$i]); |
| 997 |
foreach( $temp_pref as $pref ) { |
| 998 |
if( !WCUtils::is_blank($pref) ) |
| 999 |
$province[] = trim($pref); |
| 1000 |
} |
| 1001 |
if( 1 == count($province) ) |
| 1002 |
$action_status = 'error'; |
| 1003 |
//20120725ysk end |
| 1004 |
} else { |
| 1005 |
if(isset($usces_states[$target_market]) && is_array($usces_states[$target_market])) { |
| 1006 |
$province = $usces_states[$target_market]; |
| 1007 |
} else { |
| 1008 |
$action_status = 'error'; |
| 1009 |
} |
| 1010 |
} |
| 1011 |
$this->options['province'][$target_market] = $province; |
| 1012 |
} |
| 1013 |
|
| 1014 |
if($action_status != '') { |
| 1015 |
$this->action_status = 'error'; |
| 1016 |
$this->action_message = __('Data have deficiency.','usces'); |
| 1017 |
} else { |
| 1018 |
$this->action_status = 'success'; |
| 1019 |
$this->action_message = __('options are updated','usces'); |
| 1020 |
} |
| 1021 |
//20110331ysk end |
| 1022 |
} else { |
| 1023 |
|
| 1024 |
if( !isset($this->options['province']) || empty($this->options['province']) ){ |
| 1025 |
//20110331ysk start |
| 1026 |
//$this->options['province'] = get_option('usces_pref'); |
| 1027 |
$this->options['province'][$this->options['system']['base_country']] = $usces_states[$this->options['system']['base_country']]; |
| 1028 |
//20110331ysk end |
| 1029 |
} |
| 1030 |
$this->action_status = 'none'; |
| 1031 |
$this->action_message = ''; |
| 1032 |
} |
| 1033 |
|
| 1034 |
if($action_status != 'error') //20120511ysk 0000470 |
| 1035 |
update_option('usces', $this->options); |
| 1036 |
|
| 1037 |
require_once(USCES_PLUGIN_DIR . '/includes/admin_system.php'); |
| 1038 |
|
| 1039 |
} |
| 1040 |
|
| 1041 |
/* Settlement Setting Page */ |
| 1042 |
function admin_settlement_page() { |
| 1043 |
|
| 1044 |
$this->action_status = 'none'; |
| 1045 |
$this->action_message = ''; |
| 1046 |
|
| 1047 |
$options = get_option('usces'); |
| 1048 |
|
| 1049 |
if( isset($_POST['usces_option_update']) ) { |
| 1050 |
$_POST = $this->stripslashes_deep_post($_POST); |
| 1051 |
$mes = ''; |
| 1052 |
|
| 1053 |
switch( $_POST['acting'] ){ |
| 1054 |
case 'zeus': |
| 1055 |
unset( $options['acting_settings']['zeus'] ); |
| 1056 |
$options['acting_settings']['zeus']['card_url'] = isset($_POST['card_url']) ? $_POST['card_url'] : ''; |
| 1057 |
$options['acting_settings']['zeus']['card_secureurl'] = isset($_POST['card_secureurl']) ? $_POST['card_secureurl'] : ''; |
| 1058 |
$options['acting_settings']['zeus']['ipaddrs'] = isset($_POST['ipaddrs']) ? $_POST['ipaddrs'] : ''; |
| 1059 |
$options['acting_settings']['zeus']['pay_cvs'] = isset($_POST['pay_cvs']) ? $_POST['pay_cvs'] : ''; |
| 1060 |
$options['acting_settings']['zeus']['card_activate'] = isset($_POST['card_activate']) ? $_POST['card_activate'] : ''; |
| 1061 |
$options['acting_settings']['zeus']['connection'] = isset($_POST['connection']) ? $_POST['connection'] : 1; |
| 1062 |
$options['acting_settings']['zeus']['3dsecur'] = isset($_POST['3dsecur']) ? $_POST['3dsecur'] : 2; |
| 1063 |
$options['acting_settings']['zeus']['security'] = isset($_POST['security']) ? $_POST['security'] : 2; |
| 1064 |
if( isset($_POST['authkey']) ){ |
| 1065 |
$options['acting_settings']['zeus']['authkey'] = $_POST['authkey']; |
| 1066 |
} |
| 1067 |
// if( 1 == $options['acting_settings']['zeus']['security'] ){ |
| 1068 |
// $options['acting_settings']['zeus']['quickcharge'] = '2'; |
| 1069 |
// }else{ |
| 1070 |
$options['acting_settings']['zeus']['quickcharge'] = isset($_POST['quickcharge']) ? $_POST['quickcharge'] : ''; |
| 1071 |
// } |
| 1072 |
$options['acting_settings']['zeus']['batch'] = isset($_POST['batch']) ? $_POST['batch'] : ''; |
| 1073 |
$options['acting_settings']['zeus']['clientip'] = isset($_POST['clientip']) ? trim($_POST['clientip']) : ''; |
| 1074 |
$options['acting_settings']['zeus']['howpay'] = isset($_POST['howpay']) ? $_POST['howpay'] : ''; |
| 1075 |
$options['acting_settings']['zeus']['bank_activate'] = isset($_POST['bank_activate']) ? $_POST['bank_activate'] : ''; |
| 1076 |
$options['acting_settings']['zeus']['bank_ope'] = isset($_POST['bank_ope']) ? $_POST['bank_ope'] : ''; |
| 1077 |
$options['acting_settings']['zeus']['clientip_bank'] = isset($_POST['clientip_bank']) ? trim($_POST['clientip_bank']) : ''; |
| 1078 |
$options['acting_settings']['zeus']['testid_bank'] = isset($_POST['testid_bank']) ? trim($_POST['testid_bank']) : ''; |
| 1079 |
$options['acting_settings']['zeus']['bank_url'] = isset($_POST['bank_url']) ? $_POST['bank_url'] : ''; |
| 1080 |
$options['acting_settings']['zeus']['conv_activate'] = isset($_POST['conv_activate']) ? $_POST['conv_activate'] : ''; |
| 1081 |
$options['acting_settings']['zeus']['conv_ope'] = isset($_POST['conv_ope']) ? $_POST['conv_ope'] : ''; |
| 1082 |
$options['acting_settings']['zeus']['clientip_conv'] = isset($_POST['clientip_conv']) ? trim($_POST['clientip_conv']) : ''; |
| 1083 |
$options['acting_settings']['zeus']['testid_conv'] = isset($_POST['testid_conv']) ? trim($_POST['testid_conv']) : ''; |
| 1084 |
$options['acting_settings']['zeus']['test_type_conv'] = ( (isset($_POST['testid_conv']) && WCUtils::is_blank($_POST['testid_conv'])) || !isset($_POST['test_type']) ) ? 0 : $_POST['test_type']; |
| 1085 |
$options['acting_settings']['zeus']['conv_url'] = isset($_POST['conv_url']) ? $_POST['conv_url'] : ''; |
| 1086 |
|
| 1087 |
if( WCUtils::is_blank($_POST['clientip']) && isset($_POST['card_activate']) && 'on' == $_POST['card_activate']) |
| 1088 |
$mes .= '※カード決済IPコードを� |
| 1089 |
�力して下さい<br />'; |
| 1090 |
if( isset($_POST['authkey']) && WCUtils::is_blank($_POST['authkey']) && isset($_POST['security']) && 3 == $_POST['security']) |
| 1091 |
$mes .= '※認証キーを� |
| 1092 |
�力して下さい<br />'; |
| 1093 |
if( WCUtils::is_blank($_POST['clientip_bank']) && isset($_POST['bank_activate']) && 'on' == $_POST['bank_activate'] ) |
| 1094 |
$mes .= '※� |
| 1095 |
�金お任せIPコードを� |
| 1096 |
�力して下さい<br />'; |
| 1097 |
if( WCUtils::is_blank($_POST['testid_bank']) && isset($_POST['bank_ope']) && 'test' == $_POST['bank_ope'] ) |
| 1098 |
$mes .= '※� |
| 1099 |
�金お任せテストIDを� |
| 1100 |
�力して下さい<br />'; |
| 1101 |
if( WCUtils::is_blank($_POST['clientip_conv']) && isset($_POST['conv_activate']) && 'on' == $_POST['conv_activate'] ) |
| 1102 |
$mes .= '※コンビニ決済IPコードを� |
| 1103 |
�力して下さい<br />'; |
| 1104 |
if( WCUtils::is_blank($_POST['testid_conv']) && isset($_POST['conv_ope']) && 'test' == $_POST['conv_ope'] ) |
| 1105 |
$mes .= '※コンビニ決済テストIDを� |
| 1106 |
�力して下さい<br />'; |
| 1107 |
if( isset($_POST['batch']) && 'on' == $_POST['batch'] ) { |
| 1108 |
if( isset($_POST['quickcharge']) && 'on' == $_POST['quickcharge'] ) { |
| 1109 |
} else { |
| 1110 |
$mes .= '※バッチ処理を利用する場合は、クイックチャージを利用するにして下さい<br />'; |
| 1111 |
$options['acting_settings']['zeus']['quickcharge'] = 'on'; |
| 1112 |
} |
| 1113 |
} |
| 1114 |
if( !isset($_POST['card_url']) || empty($_POST['card_url']) || !isset($_POST['ipaddrs']) || empty($_POST['ipaddrs']) || !isset($_POST['bank_url']) || empty($_POST['bank_url']) || !isset($_POST['conv_url']) || empty($_POST['conv_url']) ) |
| 1115 |
$mes .= '※設定が不正です!<br />'; |
| 1116 |
|
| 1117 |
if( WCUtils::is_blank($mes) ){ |
| 1118 |
$this->action_status = 'success'; |
| 1119 |
$this->action_message = __('options are updated','usces'); |
| 1120 |
$options['acting_settings']['zeus']['activate'] = 'on'; |
| 1121 |
if( 'on' == $options['acting_settings']['zeus']['card_activate'] ){ |
| 1122 |
$this->payment_structure['acting_zeus_card'] = 'カード決済(ZEUS)'; |
| 1123 |
}else{ |
| 1124 |
unset($this->payment_structure['acting_zeus_card']); |
| 1125 |
} |
| 1126 |
if( 'on' == $options['acting_settings']['zeus']['bank_activate'] ){ |
| 1127 |
$this->payment_structure['acting_zeus_bank'] = '� |
| 1128 |
�金お任せ(ZEUS)'; |
| 1129 |
}else{ |
| 1130 |
unset($this->payment_structure['acting_zeus_bank']); |
| 1131 |
} |
| 1132 |
if( 'on' == $options['acting_settings']['zeus']['conv_activate'] ){ |
| 1133 |
$this->payment_structure['acting_zeus_conv'] = 'コンビニ決済(ZEUS)'; |
| 1134 |
}else{ |
| 1135 |
unset($this->payment_structure['acting_zeus_conv']); |
| 1136 |
} |
| 1137 |
$options['acting_settings']['zeus']['vercheck'] = '115'; |
| 1138 |
update_option( 'usces', $options ); |
| 1139 |
if( 'on' != $options['acting_settings']['zeus']['quickcharge'] ) { |
| 1140 |
usces_clear_quickcharge( 'zeus_pcid' ); |
| 1141 |
} |
| 1142 |
}else{ |
| 1143 |
$this->action_status = 'error'; |
| 1144 |
$this->action_message = __('Data have deficiency.','usces'); |
| 1145 |
$options['acting_settings']['zeus']['activate'] = 'off'; |
| 1146 |
unset($this->payment_structure['acting_zeus_card'], $this->payment_structure['acting_zeus_bank'], $this->payment_structure['acting_zeus_conv']); |
| 1147 |
} |
| 1148 |
ksort($this->payment_structure); |
| 1149 |
update_option('usces_payment_structure',$this->payment_structure); |
| 1150 |
break; |
| 1151 |
|
| 1152 |
case 'remise': |
| 1153 |
unset( $options['acting_settings']['remise'] ); |
| 1154 |
$options['acting_settings']['remise']['plan'] = isset($_POST['plan']) ? $_POST['plan'] : ''; |
| 1155 |
$options['acting_settings']['remise']['SHOPCO'] = isset($_POST['SHOPCO']) ? $_POST['SHOPCO'] : ''; |
| 1156 |
$options['acting_settings']['remise']['HOSTID'] = isset($_POST['HOSTID']) ? $_POST['HOSTID'] : ''; |
| 1157 |
$options['acting_settings']['remise']['card_activate'] = isset($_POST['card_activate']) ? $_POST['card_activate'] : ''; |
| 1158 |
$options['acting_settings']['remise']['card_jb'] = isset($_POST['card_jb']) ? $_POST['card_jb'] : ''; |
| 1159 |
$options['acting_settings']['remise']['card_pc_ope'] = isset($_POST['card_pc_ope']) ? $_POST['card_pc_ope'] : ''; |
| 1160 |
$options['acting_settings']['remise']['payquick'] = isset($_POST['payquick']) ? $_POST['payquick'] : ''; |
| 1161 |
$options['acting_settings']['remise']['howpay'] = isset($_POST['howpay']) ? $_POST['howpay'] : ''; |
| 1162 |
$options['acting_settings']['remise']['continuation'] = isset($_POST['continuation']) ? $_POST['continuation'] : ''; |
| 1163 |
$options['acting_settings']['remise']['conv_activate'] = isset($_POST['conv_activate']) ? $_POST['conv_activate'] : ''; |
| 1164 |
$options['acting_settings']['remise']['conv_pc_ope'] = isset($_POST['conv_pc_ope']) ? $_POST['conv_pc_ope'] : ''; |
| 1165 |
$options['acting_settings']['remise']['S_PAYDATE'] = isset($_POST['S_PAYDATE']) ? $_POST['S_PAYDATE'] : ''; |
| 1166 |
$options['acting_settings']['remise']['send_url_mbl'] = isset($_POST['send_url_mbl']) ? $_POST['send_url_mbl'] : ''; |
| 1167 |
$options['acting_settings']['remise']['send_url_pc'] = isset($_POST['send_url_pc']) ? $_POST['send_url_pc'] : ''; |
| 1168 |
$options['acting_settings']['remise']['send_url_cvs_mbl'] = isset($_POST['send_url_cvs_mbl']) ? $_POST['send_url_cvs_mbl'] : ''; |
| 1169 |
$options['acting_settings']['remise']['send_url_cvs_pc'] = isset($_POST['send_url_cvs_pc']) ? $_POST['send_url_cvs_pc'] : ''; |
| 1170 |
$options['acting_settings']['remise']['send_url_mbl_test'] = isset($_POST['send_url_mbl_test']) ? $_POST['send_url_mbl_test'] : ''; |
| 1171 |
$options['acting_settings']['remise']['send_url_pc_test'] = isset($_POST['send_url_pc_test']) ? $_POST['send_url_pc_test'] : ''; |
| 1172 |
$options['acting_settings']['remise']['send_url_cvs_mbl_test'] = isset($_POST['send_url_cvs_mbl_test']) ? $_POST['send_url_cvs_mbl_test'] : ''; |
| 1173 |
$options['acting_settings']['remise']['send_url_cvs_pc_test'] = isset($_POST['send_url_cvs_pc_test']) ? $_POST['send_url_cvs_pc_test'] : ''; |
| 1174 |
$options['acting_settings']['remise']['REMARKS3'] = isset($_POST['REMARKS3']) ? $_POST['REMARKS3'] : ''; |
| 1175 |
|
| 1176 |
if( isset($_POST['plan_remise']) && WCUtils::is_zero($_POST['plan_remise']) ) |
| 1177 |
$mes .= '※サービスプランを選択してください<br />'; |
| 1178 |
if( WCUtils::is_blank($_POST['SHOPCO']) ) |
| 1179 |
$mes .= '※加盟店コードを� |
| 1180 |
�力して下さい<br />'; |
| 1181 |
if( WCUtils::is_blank($_POST['HOSTID']) ) |
| 1182 |
$mes .= '※ホスト番号を� |
| 1183 |
�力して下さい<br />'; |
| 1184 |
if( isset($_POST['conv_activate']) && 'on' == $_POST['conv_activate'] && empty($_POST['S_PAYDATE']) ) |
| 1185 |
$mes .= '※支払期限を� |
| 1186 |
�力して下さい<br />'; |
| 1187 |
if( isset($_POST['card_pc_ope']) && 'public' == $_POST['card_pc_ope'] && empty($_POST['send_url_pc']) ) |
| 1188 |
$mes .= '※クレジットカード決済の本番URLを� |
| 1189 |
�力して下さい<br />'; |
| 1190 |
if( isset($_POST['conv_pc_ope']) && 'public' == $_POST['conv_pc_ope'] && empty($_POST['send_url_cvs_pc']) ) |
| 1191 |
$mes .= '※コンビニ・電子マネー決済の本番URLを� |
| 1192 |
�力して下さい<br />'; |
| 1193 |
if( !isset($_POST['REMARKS3']) || empty($_POST['REMARKS3']) ) |
| 1194 |
$mes .= '※設定が不正です!<br />'; |
| 1195 |
|
| 1196 |
if( WCUtils::is_blank($mes) ){ |
| 1197 |
//$this->zaction_status = 'success'; |
| 1198 |
$this->action_status = 'success'; |
| 1199 |
$this->action_message = __('options are updated','usces'); |
| 1200 |
$options['acting_settings']['remise']['activate'] = 'on'; |
| 1201 |
if( 'on' == $options['acting_settings']['remise']['card_activate'] ){ |
| 1202 |
$this->payment_structure['acting_remise_card'] = 'カード決済(ルミーズ)'; |
| 1203 |
}else{ |
| 1204 |
unset($this->payment_structure['acting_remise_card']); |
| 1205 |
} |
| 1206 |
if( 'on' == $options['acting_settings']['remise']['conv_activate'] ){ |
| 1207 |
$this->payment_structure['acting_remise_conv'] = 'コンビニ決済(ルミーズ)'; |
| 1208 |
}else{ |
| 1209 |
unset($this->payment_structure['acting_remise_conv']); |
| 1210 |
} |
| 1211 |
update_option('usces', $options); |
| 1212 |
if( 'on' != $options['acting_settings']['remise']['payquick'] ) { |
| 1213 |
usces_clear_quickcharge( 'remise_pcid' ); |
| 1214 |
} |
| 1215 |
|
| 1216 |
}else{ |
| 1217 |
$this->action_status = 'error'; |
| 1218 |
$this->action_message = __('Data have deficiency.','usces'); |
| 1219 |
$options['acting_settings']['remise']['activate'] = 'off'; |
| 1220 |
unset($this->payment_structure['acting_remise_card']); |
| 1221 |
unset($this->payment_structure['acting_remise_conv']); |
| 1222 |
} |
| 1223 |
ksort($this->payment_structure); |
| 1224 |
update_option('usces_payment_structure',$this->payment_structure); |
| 1225 |
break; |
| 1226 |
//20101018ysk start |
| 1227 |
case 'jpayment': |
| 1228 |
unset( $options['acting_settings']['jpayment'] ); |
| 1229 |
$options['acting_settings']['jpayment']['aid'] = isset($_POST['aid']) ? $_POST['aid'] : ''; |
| 1230 |
$options['acting_settings']['jpayment']['card_activate'] = isset($_POST['card_activate']) ? $_POST['card_activate'] : ''; |
| 1231 |
$options['acting_settings']['jpayment']['card_jb'] = isset($_POST['card_jb']) ? $_POST['card_jb'] : ''; |
| 1232 |
$options['acting_settings']['jpayment']['conv_activate'] = isset($_POST['conv_activate']) ? $_POST['conv_activate'] : ''; |
| 1233 |
//$options['acting_settings']['jpayment']['webm_activate'] = isset($_POST['webm_activate']) ? $_POST['webm_activate'] : ''; |
| 1234 |
//$options['acting_settings']['jpayment']['bitc_activate'] = isset($_POST['bitc_activate']) ? $_POST['bitc_activate'] : ''; |
| 1235 |
//$options['acting_settings']['jpayment']['suica_activate'] = isset($_POST['suica_activate']) ? $_POST['suica_activate'] : ''; |
| 1236 |
$options['acting_settings']['jpayment']['bank_activate'] = isset($_POST['bank_activate']) ? $_POST['bank_activate'] : ''; |
| 1237 |
$options['acting_settings']['jpayment']['send_url'] = isset($_POST['send_url']) ? $_POST['send_url'] : ''; |
| 1238 |
|
| 1239 |
if( WCUtils::is_blank($_POST['aid']) ) |
| 1240 |
$mes .= '※店舗IDコードを� |
| 1241 |
�力して下さい<br />'; |
| 1242 |
if( isset($_POST['card_activate']) && 'on' == $_POST['card_activate'] && empty($_POST['card_jb']) ) |
| 1243 |
$mes .= '※ジョブタイプを指定して下さい<br />'; |
| 1244 |
|
| 1245 |
if( WCUtils::is_blank($mes) ){ |
| 1246 |
$this->action_status = 'success'; |
| 1247 |
$this->action_message = __('options are updated','usces'); |
| 1248 |
$options['acting_settings']['jpayment']['activate'] = 'on'; |
| 1249 |
if( 'on' == $options['acting_settings']['jpayment']['card_activate'] ){ |
| 1250 |
$this->payment_structure['acting_jpayment_card'] = 'カード決済(J-Payment)'; |
| 1251 |
}else{ |
| 1252 |
unset($this->payment_structure['acting_jpayment_card']); |
| 1253 |
} |
| 1254 |
if( 'on' == $options['acting_settings']['jpayment']['conv_activate'] ){ |
| 1255 |
$this->payment_structure['acting_jpayment_conv'] = 'コンビニ決済(J-Payment)'; |
| 1256 |
}else{ |
| 1257 |
unset($this->payment_structure['acting_jpayment_conv']); |
| 1258 |
} |
| 1259 |
//if( 'on' == $options['acting_settings']['jpayment']['webm_activate'] ){ |
| 1260 |
// $this->payment_structure['acting_jpayment_webm'] = 'WebMoney決済(J-Payment)'; |
| 1261 |
//}else{ |
| 1262 |
// unset($this->payment_structure['acting_jpayment_webm']); |
| 1263 |
//} |
| 1264 |
//if( 'on' == $options['acting_settings']['jpayment']['bitc_activate'] ){ |
| 1265 |
// $this->payment_structure['acting_jpayment_bitc'] = 'BitCash決済(J-Payment)'; |
| 1266 |
//}else{ |
| 1267 |
// unset($this->payment_structure['acting_jpayment_bitc']); |
| 1268 |
//} |
| 1269 |
//if( 'on' == $options['acting_settings']['jpayment']['suica_activate'] ){ |
| 1270 |
// $this->payment_structure['acting_jpayment_suica'] = 'モバイルSuica決済(J-Payment)'; |
| 1271 |
//}else{ |
| 1272 |
// unset($this->payment_structure['acting_jpayment_suica']); |
| 1273 |
//} |
| 1274 |
if( 'on' == $options['acting_settings']['jpayment']['bank_activate'] ){ |
| 1275 |
$this->payment_structure['acting_jpayment_bank'] = 'バンクチェック決済(J-Payment)'; |
| 1276 |
}else{ |
| 1277 |
unset($this->payment_structure['acting_jpayment_bank']); |
| 1278 |
} |
| 1279 |
update_option('usces', $options); |
| 1280 |
}else{ |
| 1281 |
$this->action_status = 'error'; |
| 1282 |
$this->action_message = __('Data have deficiency.', 'usces'); |
| 1283 |
$options['acting_settings']['jpayment']['activate'] = 'off'; |
| 1284 |
unset($this->payment_structure['acting_jpayment_card']); |
| 1285 |
unset($this->payment_structure['acting_jpayment_conv']); |
| 1286 |
//unset($this->payment_structure['acting_jpayment_webm']); |
| 1287 |
//unset($this->payment_structure['acting_jpayment_bitc']); |
| 1288 |
//unset($this->payment_structure['acting_jpayment_suica']); |
| 1289 |
unset($this->payment_structure['acting_jpayment_bank']); |
| 1290 |
} |
| 1291 |
ksort($this->payment_structure); |
| 1292 |
update_option('usces_payment_structure', $this->payment_structure); |
| 1293 |
break; |
| 1294 |
//20101018ysk end |
| 1295 |
//20110208ysk start |
| 1296 |
case 'paypal': |
| 1297 |
unset( $options['acting_settings']['paypal'] ); |
| 1298 |
$options['acting_settings']['paypal']['ec_activate'] = isset($_POST['ec_activate']) ? $_POST['ec_activate'] : ''; |
| 1299 |
$options['acting_settings']['paypal']['sandbox'] = isset($_POST['sandbox']) ? $_POST['sandbox'] : ''; |
| 1300 |
$options['acting_settings']['paypal']['user'] = isset($_POST['user']) ? $_POST['user'] : ''; |
| 1301 |
$options['acting_settings']['paypal']['pwd'] = isset($_POST['pwd']) ? $_POST['pwd'] : ''; |
| 1302 |
$options['acting_settings']['paypal']['signature'] = isset($_POST['signature']) ? $_POST['signature'] : ''; |
| 1303 |
//20110412ysk start |
| 1304 |
$options['acting_settings']['paypal']['continuation'] = isset($_POST['continuation']) ? $_POST['continuation'] : ''; |
| 1305 |
//20110412ysk end |
| 1306 |
$options['acting_settings']['paypal']['logoimg'] = isset($_POST['logoimg']) ? $_POST['logoimg'] : ''; |
| 1307 |
$options['acting_settings']['paypal']['set_cartbordercolor'] = isset($_POST['set_cartbordercolor']) ? $_POST['set_cartbordercolor'] : 'off'; |
| 1308 |
$options['acting_settings']['paypal']['cartbordercolor'] = ( 'on' == $options['acting_settings']['paypal']['set_cartbordercolor'] ) ? $_POST['cartbordercolor'] : ''; |
| 1309 |
|
| 1310 |
if( !isset($_POST['sandbox']) || empty($_POST['sandbox']) ) |
| 1311 |
$mes .= '※動作環境が不正です<br />'; |
| 1312 |
if( WCUtils::is_blank($_POST['user']) ) |
| 1313 |
$mes .= '※APIユーザー名を� |
| 1314 |
�力して下さい<br />'; |
| 1315 |
if( WCUtils::is_blank($_POST['pwd']) ) |
| 1316 |
$mes .= '※APIパスワードを� |
| 1317 |
�力して下さい<br />'; |
| 1318 |
if( WCUtils::is_blank($_POST['signature']) ) |
| 1319 |
$mes .= '※署名を� |
| 1320 |
�力して下さい<br />'; |
| 1321 |
|
| 1322 |
if( WCUtils::is_blank($mes) ){ |
| 1323 |
$this->action_status = 'success'; |
| 1324 |
$this->action_message = __('options are updated','usces'); |
| 1325 |
if($options['acting_settings']['paypal']['sandbox'] == 1) { |
| 1326 |
$options['acting_settings']['paypal']['api_host'] = 'api-3t.sandbox.paypal.com'; |
| 1327 |
$options['acting_settings']['paypal']['api_endpoint'] = 'https://api-3t.sandbox.paypal.com/nvp'; |
| 1328 |
$options['acting_settings']['paypal']['paypal_url'] = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; |
| 1329 |
} else { |
| 1330 |
$options['acting_settings']['paypal']['api_host'] = 'api-3t.paypal.com'; |
| 1331 |
$options['acting_settings']['paypal']['api_endpoint'] = 'https://api-3t.paypal.com/nvp'; |
| 1332 |
$options['acting_settings']['paypal']['paypal_url'] = 'https://www.paypal.com/cgi-bin/webscr'; |
| 1333 |
} |
| 1334 |
$options['acting_settings']['paypal']['activate'] = 'on'; |
| 1335 |
if( 'on' == $options['acting_settings']['paypal']['ec_activate'] ){ |
| 1336 |
$this->payment_structure['acting_paypal_ec'] = 'PayPal決済'; |
| 1337 |
}else{ |
| 1338 |
unset($this->payment_structure['acting_paypal_ec']); |
| 1339 |
} |
| 1340 |
update_option('usces', $options); |
| 1341 |
}else{ |
| 1342 |
$this->action_status = 'error'; |
| 1343 |
$this->action_message = __('Data have deficiency.', 'usces'); |
| 1344 |
$options['acting_settings']['paypal']['activate'] = 'off'; |
| 1345 |
unset($this->payment_structure['acting_paypal_ec']); |
| 1346 |
} |
| 1347 |
ksort($this->payment_structure); |
| 1348 |
update_option('usces_payment_structure', $this->payment_structure); |
| 1349 |
break; |
| 1350 |
//20110208ysk end |
| 1351 |
//20120413ysk start |
| 1352 |
case 'sbps': |
| 1353 |
unset( $options['acting_settings']['sbps'] ); |
| 1354 |
$options['acting_settings']['sbps']['merchant_id'] = isset($_POST['merchant_id']) ? $_POST['merchant_id'] : ''; |
| 1355 |
$options['acting_settings']['sbps']['service_id'] = isset($_POST['service_id']) ? $_POST['service_id'] : ''; |
| 1356 |
$options['acting_settings']['sbps']['hash_key'] = isset($_POST['hash_key']) ? $_POST['hash_key'] : ''; |
| 1357 |
$options['acting_settings']['sbps']['ope'] = isset($_POST['ope']) ? $_POST['ope'] : ''; |
| 1358 |
//$options['acting_settings']['sbps']['send_url'] = isset($_POST['send_url']) ? $_POST['send_url'] : ''; |
| 1359 |
$options['acting_settings']['sbps']['send_url_check'] = isset($_POST['send_url_check']) ? $_POST['send_url_check'] : ''; |
| 1360 |
$options['acting_settings']['sbps']['send_url_test'] = isset($_POST['send_url_test']) ? $_POST['send_url_test'] : ''; |
| 1361 |
$options['acting_settings']['sbps']['card_activate'] = isset($_POST['card_activate']) ? $_POST['card_activate'] : ''; |
| 1362 |
$options['acting_settings']['sbps']['3d_secure'] = isset($_POST['3d_secure']) ? $_POST['3d_secure'] : ''; |
| 1363 |
$options['acting_settings']['sbps']['cust'] = isset($_POST['cust']) ? $_POST['cust'] : ''; |
| 1364 |
$options['acting_settings']['sbps']['continuation'] = isset($_POST['continuation']) ? $_POST['continuation'] : ''; |
| 1365 |
$options['acting_settings']['sbps']['conv_activate'] = isset($_POST['conv_activate']) ? $_POST['conv_activate'] : ''; |
| 1366 |
$options['acting_settings']['sbps']['payeasy_activate'] = isset($_POST['payeasy_activate']) ? $_POST['payeasy_activate'] : ''; |
| 1367 |
$options['acting_settings']['sbps']['wallet_yahoowallet'] = isset($_POST['wallet_yahoowallet']) ? $_POST['wallet_yahoowallet'] : ''; |
| 1368 |
$options['acting_settings']['sbps']['wallet_rakuten'] = isset($_POST['wallet_rakuten']) ? $_POST['wallet_rakuten'] : ''; |
| 1369 |
$options['acting_settings']['sbps']['wallet_paypal'] = isset($_POST['wallet_paypal']) ? $_POST['wallet_paypal'] : ''; |
| 1370 |
$options['acting_settings']['sbps']['wallet_netmile'] = isset($_POST['wallet_netmile']) ? $_POST['wallet_netmile'] : ''; |
| 1371 |
$options['acting_settings']['sbps']['wallet_alipay'] = isset($_POST['wallet_alipay']) ? $_POST['wallet_alipay'] : ''; |
| 1372 |
$options['acting_settings']['sbps']['mobile_docomo'] = isset($_POST['mobile_docomo']) ? $_POST['mobile_docomo'] : ''; |
| 1373 |
$options['acting_settings']['sbps']['mobile_softbank'] = isset($_POST['mobile_softbank']) ? $_POST['mobile_softbank'] : ''; |
| 1374 |
$options['acting_settings']['sbps']['mobile_auone'] = isset($_POST['mobile_auone']) ? $_POST['mobile_auone'] : ''; |
| 1375 |
$options['acting_settings']['sbps']['mobile_mysoftbank'] = isset($_POST['mobile_mysoftbank']) ? $_POST['mobile_mysoftbank'] : ''; |
| 1376 |
$options['acting_settings']['sbps']['mobile_softbank2'] = isset($_POST['mobile_softbank2']) ? $_POST['mobile_softbank2'] : ''; |
| 1377 |
|
| 1378 |
if( WCUtils::is_blank($_POST['merchant_id']) ) |
| 1379 |
$mes .= '※マーチャントIDを� |
| 1380 |
�力して下さい<br />'; |
| 1381 |
if( WCUtils::is_blank($_POST['service_id']) ) |
| 1382 |
$mes .= '※サービスIDを� |
| 1383 |
�力して下さい<br />'; |
| 1384 |
if( WCUtils::is_blank($_POST['hash_key']) ) |
| 1385 |
$mes .= '※Hash KEYを� |
| 1386 |
�力して下さい<br />'; |
| 1387 |
//if( isset($_POST['ope']) && 'public' == $_POST['ope'] && empty($_POST['send_url']) ) |
| 1388 |
// $mes .= '※本番URLを� |
| 1389 |
�力して下さい<br />'; |
| 1390 |
|
| 1391 |
if( WCUtils::is_blank($mes) ){ |
| 1392 |
$this->action_status = 'success'; |
| 1393 |
$this->action_message = __('options are updated','usces'); |
| 1394 |
$options['acting_settings']['sbps']['activate'] = 'on'; |
| 1395 |
if( isset($_POST['ope']) && 'public' == $_POST['ope'] ) { |
| 1396 |
$options['acting_settings']['sbps']['send_url'] = 'https://fep.sps-system.com/f01/FepBuyInfoReceive.do'; |
| 1397 |
} |
| 1398 |
if( 'on' == $options['acting_settings']['sbps']['card_activate'] ){ |
| 1399 |
$this->payment_structure['acting_sbps_card'] = 'カード決済(ソフトバンク・ペイメント)'; |
| 1400 |
}else{ |
| 1401 |
unset($this->payment_structure['acting_sbps_card']); |
| 1402 |
} |
| 1403 |
if( 'on' == $options['acting_settings']['sbps']['conv_activate'] ){ |
| 1404 |
$this->payment_structure['acting_sbps_conv'] = 'コンビニ決済(ソフトバンク・ペイメント)'; |
| 1405 |
}else{ |
| 1406 |
unset($this->payment_structure['acting_sbps_conv']); |
| 1407 |
} |
| 1408 |
if( 'on' == $options['acting_settings']['sbps']['payeasy_activate'] ){ |
| 1409 |
$this->payment_structure['acting_sbps_payeasy'] = 'ペイジー決済(ソフトバンク・ペイメント)'; |
| 1410 |
}else{ |
| 1411 |
unset($this->payment_structure['acting_sbps_payeasy']); |
| 1412 |
} |
| 1413 |
if( ( 'on' == $options['acting_settings']['sbps']['wallet_yahoowallet'] ) || |
| 1414 |
( 'on' == $options['acting_settings']['sbps']['wallet_rakuten'] ) || |
| 1415 |
( 'on' == $options['acting_settings']['sbps']['wallet_paypal'] ) || |
| 1416 |
( 'on' == $options['acting_settings']['sbps']['wallet_netmile'] ) || |
| 1417 |
( 'on' == $options['acting_settings']['sbps']['wallet_alipay'] ) ) { |
| 1418 |
$options['acting_settings']['sbps']['wallet_activate'] = 'on'; |
| 1419 |
} else { |
| 1420 |
$options['acting_settings']['sbps']['wallet_activate'] = 'off'; |
| 1421 |
} |
| 1422 |
if( 'on' == $options['acting_settings']['sbps']['wallet_activate'] ){ |
| 1423 |
$this->payment_structure['acting_sbps_wallet'] = 'ウォレット決済(ソフトバンク・ペイメント)'; |
| 1424 |
}else{ |
| 1425 |
unset($this->payment_structure['acting_sbps_wallet']); |
| 1426 |
} |
| 1427 |
if( ( 'on' == $options['acting_settings']['sbps']['mobile_docomo'] ) || |
| 1428 |
( 'on' == $options['acting_settings']['sbps']['mobile_softbank'] ) || |
| 1429 |
( 'on' == $options['acting_settings']['sbps']['mobile_auone'] ) || |
| 1430 |
( 'on' == $options['acting_settings']['sbps']['mobile_mysoftbank'] ) || |
| 1431 |
( 'on' == $options['acting_settings']['sbps']['mobile_softbank2'] ) ) { |
| 1432 |
$options['acting_settings']['sbps']['mobile_activate'] = 'on'; |
| 1433 |
} else { |
| 1434 |
$options['acting_settings']['sbps']['mobile_activate'] = 'off'; |
| 1435 |
} |
| 1436 |
if( 'on' == $options['acting_settings']['sbps']['mobile_activate'] ){ |
| 1437 |
$this->payment_structure['acting_sbps_mobile'] = '携帯キャリア決済(ソフトバンク・ペイメント)'; |
| 1438 |
}else{ |
| 1439 |
unset($this->payment_structure['acting_sbps_mobile']); |
| 1440 |
} |
| 1441 |
update_option('usces', $options); |
| 1442 |
}else{ |
| 1443 |
$this->action_status = 'error'; |
| 1444 |
$this->action_message = __('Data have deficiency.','usces'); |
| 1445 |
$options['acting_settings']['sbps']['activate'] = 'off'; |
| 1446 |
unset($this->payment_structure['acting_sbps_card']); |
| 1447 |
unset($this->payment_structure['acting_sbps_conv']); |
| 1448 |
unset($this->payment_structure['acting_sbps_payeasy']); |
| 1449 |
unset($this->payment_structure['acting_sbps_wallet']); |
| 1450 |
unset($this->payment_structure['acting_sbps_mobile']); |
| 1451 |
} |
| 1452 |
ksort($this->payment_structure); |
| 1453 |
update_option('usces_payment_structure', $this->payment_structure); |
| 1454 |
break; |
| 1455 |
//20120413ysk end |
| 1456 |
//20120618ysk start |
| 1457 |
case 'telecom': |
| 1458 |
unset( $options['acting_settings']['telecom'] ); |
| 1459 |
$options['acting_settings']['telecom']['clientip'] = isset($_POST['clientip']) ? $_POST['clientip'] : ''; |
| 1460 |
$options['acting_settings']['telecom']['stype'] = isset($_POST['stype']) ? $_POST['stype'] : ''; |
| 1461 |
$options['acting_settings']['telecom']['card_activate'] = isset($_POST['card_activate']) ? $_POST['card_activate'] : ''; |
| 1462 |
$options['acting_settings']['telecom']['edy_activate'] = isset($_POST['edy_activate']) ? $_POST['edy_activate'] : ''; |
| 1463 |
|
| 1464 |
if( WCUtils::is_blank($_POST['clientip']) ) |
| 1465 |
$mes .= '※クライアントIPを� |
| 1466 |
�力して下さい<br />'; |
| 1467 |
if( WCUtils::is_blank($_POST['stype']) ) |
| 1468 |
$mes .= '※決済タイプを� |
| 1469 |
�力して下さい<br />'; |
| 1470 |
|
| 1471 |
if( WCUtils::is_blank($mes) ){ |
| 1472 |
$this->action_status = 'success'; |
| 1473 |
$this->action_message = __('options are updated','usces'); |
| 1474 |
$options['acting_settings']['telecom']['activate'] = 'on'; |
| 1475 |
if( 'on' == $options['acting_settings']['telecom']['card_activate'] ){ |
| 1476 |
if( 'E' == $options['acting_settings']['telecom']['stype'][0] ) { |
| 1477 |
$options['acting_settings']['telecom']['send_url'] = "https://www.credit-cgiserver.com/inetcredit/secure/order.pl"; |
| 1478 |
} else { |
| 1479 |
$options['acting_settings']['telecom']['send_url'] = "https://secure.telecomcredit.co.jp/inetcredit/secure/order.pl"; |
| 1480 |
} |
| 1481 |
$this->payment_structure['acting_telecom_card'] = 'カード決済(テレコムクレジット)'; |
| 1482 |
}else{ |
| 1483 |
unset($this->payment_structure['acting_telecom_card']); |
| 1484 |
} |
| 1485 |
if( 'on' == $options['acting_settings']['telecom']['edy_activate'] ){ |
| 1486 |
$options['acting_settings']['telecom']['send_url_edy'] = "https://secure.telecomcredit.co.jp/payment/edy/order.pl"; |
| 1487 |
$this->payment_structure['acting_telecom_edy'] = 'Edy決済(テレコムクレジット)'; |
| 1488 |
}else{ |
| 1489 |
unset($this->payment_structure['acting_telecom_edy']); |
| 1490 |
} |
| 1491 |
update_option('usces', $options); |
| 1492 |
}else{ |
| 1493 |
$this->action_status = 'error'; |
| 1494 |
$this->action_message = __('Data have deficiency.','usces'); |
| 1495 |
$options['acting_settings']['telecom']['activate'] = 'off'; |
| 1496 |
unset($this->payment_structure['acting_telecom_card']); |
| 1497 |
unset($this->payment_structure['acting_telecom_edy']); |
| 1498 |
} |
| 1499 |
ksort($this->payment_structure); |
| 1500 |
update_option('usces_payment_structure', $this->payment_structure); |
| 1501 |
break; |
| 1502 |
//20120618ysk end |
| 1503 |
//20121206ysk start |
| 1504 |
case 'digitalcheck': |
| 1505 |
unset( $options['acting_settings']['digitalcheck'] ); |
| 1506 |
$options['acting_settings']['digitalcheck']['card_activate'] = isset($_POST['card_activate']) ? $_POST['card_activate'] : ''; |
| 1507 |
$options['acting_settings']['digitalcheck']['card_ip'] = isset($_POST['card_ip']) ? $_POST['card_ip'] : ''; |
| 1508 |
$options['acting_settings']['digitalcheck']['card_pass'] = isset($_POST['card_pass']) ? $_POST['card_pass'] : ''; |
| 1509 |
$options['acting_settings']['digitalcheck']['card_kakutei'] = isset($_POST['card_kakutei']) ? $_POST['card_kakutei'] : ''; |
| 1510 |
$options['acting_settings']['digitalcheck']['card_user_id'] = isset($_POST['card_user_id']) ? $_POST['card_user_id'] : ''; |
| 1511 |
$options['acting_settings']['digitalcheck']['conv_activate'] = isset($_POST['conv_activate']) ? $_POST['conv_activate'] : ''; |
| 1512 |
$options['acting_settings']['digitalcheck']['conv_ip'] = isset($_POST['conv_ip']) ? $_POST['conv_ip'] : ''; |
| 1513 |
$options['acting_settings']['digitalcheck']['conv_store'] = isset($_POST['conv_store']) ? $_POST['conv_store'] : array(); |
| 1514 |
$options['acting_settings']['digitalcheck']['conv_kigen'] = isset($_POST['conv_kigen']) ? $_POST['conv_kigen'] : '14'; |
| 1515 |
|
| 1516 |
if( 'on' == $options['acting_settings']['digitalcheck']['card_activate'] ) { |
| 1517 |
if( '' == trim($_POST['card_ip']) ) |
| 1518 |
$mes .= '※加盟店コードを� |
| 1519 |
�力して下さい<br />'; |
| 1520 |
if( 'on' == $options['acting_settings']['digitalcheck']['card_user_id'] ) { |
| 1521 |
if( '' == trim($_POST['card_pass']) ) |
| 1522 |
$mes .= '※加盟店パスワードを� |
| 1523 |
�力して下さい<br />'; |
| 1524 |
} |
| 1525 |
} |
| 1526 |
if( 'on' == $options['acting_settings']['digitalcheck']['conv_activate'] ) { |
| 1527 |
if( '' == trim($_POST['conv_ip']) ) |
| 1528 |
$mes .= '※加盟店コードを� |
| 1529 |
�力して下さい<br />'; |
| 1530 |
if( empty($_POST['conv_store']) ) |
| 1531 |
$mes .= '※利用コンビニを選択して下さい<br />'; |
| 1532 |
} |
| 1533 |
|
| 1534 |
if( '' == $mes ){ |
| 1535 |
$this->action_status = 'success'; |
| 1536 |
$this->action_message = __('options are updated','usces'); |
| 1537 |
$options['acting_settings']['digitalcheck']['activate'] = 'on'; |
| 1538 |
if( 'on' == $options['acting_settings']['digitalcheck']['card_activate'] ){ |
| 1539 |
$options['acting_settings']['digitalcheck']['send_url_card'] = "https://www.paydesign.jp/settle/settle3/bp3.dll"; |
| 1540 |
if( 'on' == $options['acting_settings']['digitalcheck']['card_user_id'] ) { |
| 1541 |
$options['acting_settings']['digitalcheck']['send_url_user_id'] = "https://www.paydesign.jp/settle/settlex/credit2.dll"; |
| 1542 |
} else { |
| 1543 |
$options['acting_settings']['digitalcheck']['send_url_user_id'] = ""; |
| 1544 |
} |
| 1545 |
$this->payment_structure['acting_digitalcheck_card'] = 'カード決済(ペイデザイン)'; |
| 1546 |
}else{ |
| 1547 |
unset($this->payment_structure['acting_digitalcheck_card']); |
| 1548 |
} |
| 1549 |
if( 'on' == $options['acting_settings']['digitalcheck']['conv_activate'] ){ |
| 1550 |
$options['acting_settings']['digitalcheck']['send_url_conv'] = "https://www.paydesign.jp/settle/settle3/bp3.dll"; |
| 1551 |
$this->payment_structure['acting_digitalcheck_conv'] = 'コンビニ決済(ペイデザイン)'; |
| 1552 |
}else{ |
| 1553 |
unset($this->payment_structure['acting_digitalcheck_conv']); |
| 1554 |
} |
| 1555 |
update_option('usces', $options); |
| 1556 |
if( 'on' != $options['acting_settings']['digitalcheck']['card_user_id'] ) { |
| 1557 |
usces_clear_quickcharge( 'digitalcheck_ip_user_id' ); |
| 1558 |
} |
| 1559 |
}else{ |
| 1560 |
$this->action_status = 'error'; |
| 1561 |
$this->action_message = __('Data have deficiency.','usces'); |
| 1562 |
$options['acting_settings']['digitalcheck']['activate'] = 'off'; |
| 1563 |
unset($this->payment_structure['acting_digitalcheck_card']); |
| 1564 |
unset($this->payment_structure['acting_digitalcheck_conv']); |
| 1565 |
} |
| 1566 |
ksort($this->payment_structure); |
| 1567 |
update_option('usces_payment_structure', $this->payment_structure); |
| 1568 |
break; |
| 1569 |
//20121206ysk end |
| 1570 |
//20130225ysk start |
| 1571 |
case 'mizuho': |
| 1572 |
unset( $options['acting_settings']['mizuho'] ); |
| 1573 |
$options['acting_settings']['mizuho']['shopid'] = isset($_POST['shopid']) ? $_POST['shopid'] : ''; |
| 1574 |
$options['acting_settings']['mizuho']['cshopid'] = isset($_POST['cshopid']) ? $_POST['cshopid'] : ''; |
| 1575 |
$options['acting_settings']['mizuho']['hash_pass'] = isset($_POST['hash_pass']) ? $_POST['hash_pass'] : ''; |
| 1576 |
$options['acting_settings']['mizuho']['ope'] = isset($_POST['ope']) ? $_POST['ope'] : ''; |
| 1577 |
$options['acting_settings']['mizuho']['send_url'] = isset($_POST['send_url']) ? $_POST['send_url'] : ''; |
| 1578 |
$options['acting_settings']['mizuho']['send_url_mbl'] = isset($_POST['send_url_mbl']) ? $_POST['send_url_mbl'] : ''; |
| 1579 |
$options['acting_settings']['mizuho']['card_activate'] = isset($_POST['card_activate']) ? $_POST['card_activate'] : ''; |
| 1580 |
$options['acting_settings']['mizuho']['conv1_activate'] = isset($_POST['conv1_activate']) ? $_POST['conv1_activate'] : ''; |
| 1581 |
$options['acting_settings']['mizuho']['conv2_activate'] = isset($_POST['conv2_activate']) ? $_POST['conv2_activate'] : ''; |
| 1582 |
|
| 1583 |
//if( 'on' == $options['acting_settings']['mizuho']['card_activate'] or 'on' == $options['acting_settings']['mizuho']['conv_activate'] ) { |
| 1584 |
if( '' == trim($_POST['shopid']) ) |
| 1585 |
$mes .= '※加盟店コードを� |
| 1586 |
�力して下さい<br />'; |
| 1587 |
if( '' == trim($_POST['cshopid']) ) |
| 1588 |
$mes .= '※加盟店サブコードを� |
| 1589 |
�力して下さい<br />'; |
| 1590 |
if( '' == trim($_POST['hash_pass']) ) |
| 1591 |
$mes .= '※ハッシュ用パスワードを� |
| 1592 |
�力して下さい<br />'; |
| 1593 |
//} |
| 1594 |
if( isset($_POST['ope']) && 'public' == $_POST['ope'] && empty($_POST['send_url']) ) |
| 1595 |
$mes .= '※本番URLを� |
| 1596 |
�力して下さい<br />'; |
| 1597 |
if( defined('WCEX_MOBILE') and isset($_POST['ope']) && 'public' == $_POST['ope'] && empty($_POST['send_url_mbl']) ) |
| 1598 |
$mes .= '※本番URL(携帯)を� |
| 1599 |
�力して下さい<br />'; |
| 1600 |
|
| 1601 |
if( '' == $mes ) { |
| 1602 |
$this->action_status = 'success'; |
| 1603 |
$this->action_message = __('options are updated','usces'); |
| 1604 |
$options['acting_settings']['mizuho']['activate'] = 'on'; |
| 1605 |
$options['acting_settings']['mizuho']['send_url_test'] = "https://210.161.141.207/mltbank/MBWebFrontPayment"; |
| 1606 |
if( defined('WCEX_MOBILE') ) $options['acting_settings']['mizuho']['send_url_mbl_test'] = "https://210.161.141.207/mltbank/iMBWebFrontPayment"; |
| 1607 |
if( 'on' == $options['acting_settings']['mizuho']['card_activate'] ) { |
| 1608 |
$this->payment_structure['acting_mizuho_card'] = 'カード決済(みずほファクター)'; |
| 1609 |
} else { |
| 1610 |
unset($this->payment_structure['acting_mizuho_card']); |
| 1611 |
} |
| 1612 |
if( 'on' == $options['acting_settings']['mizuho']['conv1_activate'] ) { |
| 1613 |
$this->payment_structure['acting_mizuho_conv1'] = 'コンビニ・ウェルネット決済(みずほファクター)'; |
| 1614 |
} else { |
| 1615 |
unset($this->payment_structure['acting_mizuho_conv1']); |
| 1616 |
} |
| 1617 |
if( 'on' == $options['acting_settings']['mizuho']['conv2_activate'] ) { |
| 1618 |
$this->payment_structure['acting_mizuho_conv2'] = 'コンビニ・セブンイレブン決済(みずほファクター)'; |
| 1619 |
} else { |
| 1620 |
unset($this->payment_structure['acting_mizuho_conv2']); |
| 1621 |
} |
| 1622 |
update_option('usces', $options); |
| 1623 |
} else { |
| 1624 |
$this->action_status = 'error'; |
| 1625 |
$this->action_message = __('Data have deficiency.','usces'); |
| 1626 |
$options['acting_settings']['mizuho']['activate'] = 'off'; |
| 1627 |
unset($this->payment_structure['acting_mizuho_card']); |
| 1628 |
unset($this->payment_structure['acting_mizuho_conv1']); |
| 1629 |
unset($this->payment_structure['acting_mizuho_conv2']); |
| 1630 |
} |
| 1631 |
ksort($this->payment_structure); |
| 1632 |
update_option('usces_payment_structure', $this->payment_structure); |
| 1633 |
break; |
| 1634 |
//20130225ysk end |
| 1635 |
//20131220ysk start |
| 1636 |
case 'anotherlane': |
| 1637 |
unset( $options['acting_settings']['anotherlane'] ); |
| 1638 |
$options['acting_settings']['anotherlane']['siteid'] = isset($_POST['siteid']) ? $_POST['siteid'] : ''; |
| 1639 |
$options['acting_settings']['anotherlane']['sitepass'] = isset($_POST['sitepass']) ? $_POST['sitepass'] : ''; |
| 1640 |
$options['acting_settings']['anotherlane']['quickcharge'] = isset($_POST['quickcharge']) ? $_POST['quickcharge'] : ''; |
| 1641 |
$options['acting_settings']['anotherlane']['card_activate'] = isset($_POST['card_activate']) ? $_POST['card_activate'] : ''; |
| 1642 |
|
| 1643 |
if( WCUtils::is_blank($_POST['siteid']) ) |
| 1644 |
$mes .= '※サイトIDを� |
| 1645 |
�力して下さい<br />'; |
| 1646 |
if( WCUtils::is_blank($_POST['sitepass']) ) |
| 1647 |
$mes .= '※サイトパスワードを� |
| 1648 |
�力して下さい<br />'; |
| 1649 |
|
| 1650 |
if( WCUtils::is_blank($mes) ) { |
| 1651 |
$this->action_status = 'success'; |
| 1652 |
$this->action_message = __('options are updated','usces'); |
| 1653 |
$options['acting_settings']['anotherlane']['activate'] = 'on'; |
| 1654 |
if( 'on' == $options['acting_settings']['anotherlane']['card_activate'] ) { |
| 1655 |
$options['acting_settings']['anotherlane']['send_url'] = "https://credit.alij.ne.jp/service/credit/input.html"; |
| 1656 |
$this->payment_structure['acting_anotherlane_card'] = 'カード決済(アナザーレーン)'; |
| 1657 |
} else { |
| 1658 |
unset( $this->payment_structure['acting_anotherlane_card'] ); |
| 1659 |
} |
| 1660 |
update_option( 'usces', $options ); |
| 1661 |
} else { |
| 1662 |
$this->action_status = 'error'; |
| 1663 |
$this->action_message = __('Data have deficiency.','usces'); |
| 1664 |
$options['acting_settings']['anotherlane']['activate'] = 'off'; |
| 1665 |
unset( $this->payment_structure['acting_anotherlane_card'] ); |
| 1666 |
} |
| 1667 |
ksort( $this->payment_structure ); |
| 1668 |
update_option( 'usces_payment_structure', $this->payment_structure ); |
| 1669 |
break; |
| 1670 |
//20131220ysk end |
| 1671 |
//20140206ysk start |
| 1672 |
case 'veritrans': |
| 1673 |
unset( $options['acting_settings']['veritrans'] ); |
| 1674 |
$options['acting_settings']['veritrans']['merchant_id'] = isset($_POST['merchant_id']) ? $_POST['merchant_id'] : ''; |
| 1675 |
$options['acting_settings']['veritrans']['merchanthash'] = isset($_POST['merchanthash']) ? $_POST['merchanthash'] : ''; |
| 1676 |
$options['acting_settings']['veritrans']['ope'] = isset($_POST['ope']) ? $_POST['ope'] : ''; |
| 1677 |
$options['acting_settings']['veritrans']['card_activate'] = isset($_POST['card_activate']) ? $_POST['card_activate'] : ''; |
| 1678 |
$options['acting_settings']['veritrans']['card_capture_flag'] = isset($_POST['card_capture_flag']) ? $_POST['card_capture_flag'] : ''; |
| 1679 |
$options['acting_settings']['veritrans']['conv_activate'] = isset($_POST['conv_activate']) ? $_POST['conv_activate'] : ''; |
| 1680 |
|
| 1681 |
if( WCUtils::is_blank($_POST['merchant_id']) ) |
| 1682 |
$mes .= '※マーチャントIDを� |
| 1683 |
�力して下さい<br />'; |
| 1684 |
if( WCUtils::is_blank($_POST['merchanthash']) ) |
| 1685 |
$mes .= '※マーチャントハッシュキーを� |
| 1686 |
�力して下さい<br />'; |
| 1687 |
if( WCUtils::is_blank($_POST['ope']) ) |
| 1688 |
$mes .= '※稼働環境を選択して下さい<br />'; |
| 1689 |
if( 'on' == $options['acting_settings']['veritrans']['card_activate'] ) { |
| 1690 |
if( WCUtils::is_blank($_POST['card_capture_flag']) ) |
| 1691 |
$mes .= '※カード売上フラグを選択して下さい<br />'; |
| 1692 |
} |
| 1693 |
|
| 1694 |
if( WCUtils::is_blank($mes) ) { |
| 1695 |
$this->action_status = 'success'; |
| 1696 |
$this->action_message = __('options are updated','usces'); |
| 1697 |
$options['acting_settings']['veritrans']['activate'] = 'on'; |
| 1698 |
$options['acting_settings']['veritrans']['regist_url'] = "https://air.veritrans.co.jp/web/commodityRegist.action"; |
| 1699 |
$options['acting_settings']['veritrans']['payment_url'] = "https://air.veritrans.co.jp/web/paymentStart.action"; |
| 1700 |
if( 'on' == $options['acting_settings']['veritrans']['card_activate'] ) { |
| 1701 |
$this->payment_structure['acting_veritrans_card'] = 'カード決済(ベリトランス)'; |
| 1702 |
} else { |
| 1703 |
unset($this->payment_structure['acting_veritrans_card']); |
| 1704 |
} |
| 1705 |
if( 'on' == $options['acting_settings']['veritrans']['conv_activate'] ) { |
| 1706 |
$this->payment_structure['acting_veritrans_conv'] = 'コンビニ決済(ベリトランス)'; |
| 1707 |
} else { |
| 1708 |
unset($this->payment_structure['acting_veritrans_conv']); |
| 1709 |
} |
| 1710 |
update_option('usces', $options); |
| 1711 |
} else { |
| 1712 |
$this->action_status = 'error'; |
| 1713 |
$this->action_message = __('Data have deficiency.','usces'); |
| 1714 |
$options['acting_settings']['veritrans']['activate'] = 'off'; |
| 1715 |
unset($this->payment_structure['acting_veritrans_card']); |
| 1716 |
unset($this->payment_structure['acting_veritrans_conv']); |
| 1717 |
} |
| 1718 |
ksort($this->payment_structure); |
| 1719 |
update_option('usces_payment_structure', $this->payment_structure); |
| 1720 |
break; |
| 1721 |
//20140206ysk end |
| 1722 |
} |
| 1723 |
|
| 1724 |
} |
| 1725 |
|
| 1726 |
$this->options = get_option('usces'); |
| 1727 |
|
| 1728 |
require_once(USCES_PLUGIN_DIR . '/includes/admin_settlement.php'); |
| 1729 |
} |
| 1730 |
|
| 1731 |
/********************************************************************************/ |
| 1732 |
function selected( $selected, $current) { |
| 1733 |
if ( $selected == $current) |
| 1734 |
echo ' selected="selected"'; |
| 1735 |
} |
| 1736 |
/********************************************************************************/ |
| 1737 |
|
| 1738 |
function usces_session_start() { |
| 1739 |
$options = get_option('usces'); |
| 1740 |
if( !isset($options['usces_key']) || empty($options['usces_key']) ){ |
| 1741 |
$options['usces_key'] = uniqid('uk'); |
| 1742 |
update_option('usces', $options); |
| 1743 |
} |
| 1744 |
|
| 1745 |
if(defined( 'USCES_KEY' )){ |
| 1746 |
if( is_admin() || preg_match('/\/wp-login\.php/', $_SERVER['REQUEST_URI']) ){ |
| 1747 |
session_name( 'adm'.USCES_KEY ); |
| 1748 |
}else{ |
| 1749 |
session_name( USCES_KEY ); |
| 1750 |
} |
| 1751 |
}else{ |
| 1752 |
if( is_admin() || preg_match('/\/wp-login\.php/', $_SERVER['REQUEST_URI']) ){ |
| 1753 |
session_name( 'adm'.$options['usces_key'] ); |
| 1754 |
}else{ |
| 1755 |
session_name( $options['usces_key'] ); |
| 1756 |
} |
| 1757 |
} |
| 1758 |
if(isset($_GET['uscesid']) && !WCUtils::is_blank($_GET['uscesid'])) { |
| 1759 |
$sessid = $_GET['uscesid']; |
| 1760 |
$sessid = $this->uscesdc($sessid); |
| 1761 |
session_id($sessid); |
| 1762 |
} |
| 1763 |
|
| 1764 |
@session_start(); |
| 1765 |
|
| 1766 |
//20111222ysk start 0000367 |
| 1767 |
//if ( !isset($_SESSION['usces_member']) ){ |
| 1768 |
if ( !isset($_SESSION['usces_member']) || $options['membersystem_state'] != 'activate' ){ |
| 1769 |
//20111222ysk end |
| 1770 |
$_SESSION['usces_member'] = array(); |
| 1771 |
} |
| 1772 |
|
| 1773 |
if(!isset($_SESSION['usces_checked_business_days'])) |
| 1774 |
$this->update_business_days(); |
| 1775 |
} |
| 1776 |
|
| 1777 |
function usces_cookie() { |
| 1778 |
if(is_admin()) return; |
| 1779 |
|
| 1780 |
$actionflag = false; |
| 1781 |
$sess = NULL; |
| 1782 |
$addr = NULL; |
| 1783 |
$rckid = NULL; |
| 1784 |
$none = NULL; |
| 1785 |
$cookie = $this->get_cookie(); |
| 1786 |
|
| 1787 |
if( isset($_GET['uscesid']) && !WCUtils::is_blank($_GET['uscesid']) ){ |
| 1788 |
$sessid = base64_decode(urldecode($_GET['uscesid'])); |
| 1789 |
list($sess, $addr, $rckid, $none) = explode('_', $sessid, 4); |
| 1790 |
} |
| 1791 |
if('acting' == $addr) return; |
| 1792 |
|
| 1793 |
if( apply_filters( 'usces_filter_cookie', false) ) return; |
| 1794 |
|
| 1795 |
//There is a need to consider. |
| 1796 |
return; |
| 1797 |
|
| 1798 |
if( $this->use_ssl && ($this->is_cart_or_member_page($_SERVER['REQUEST_URI']) || $this->is_inquiry_page($_SERVER['REQUEST_URI']))){ |
| 1799 |
|
| 1800 |
$refer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL; |
| 1801 |
$sslid = isset($cookie['sslid']) ? $cookie['sslid'] : NULL; |
| 1802 |
$option = get_option('usces'); |
| 1803 |
$parsed = parse_url(get_option('home')); |
| 1804 |
$home = $parsed['host'] . (isset($parsed['path']) ? $parsed['path'] : ''); |
| 1805 |
$parsed = parse_url($option['ssl_url']); |
| 1806 |
$sslhome = $parsed['host'] . (isset($parsed['path']) ? $parsed['path'] : ''); |
| 1807 |
|
| 1808 |
//usces_log('refer : '.$refer, 'acting_transaction.log'); |
| 1809 |
// usces_log('sslid : '.$sslid, 'acting_transaction.log'); |
| 1810 |
// usces_log('rckid : '.$rckid, 'acting_transaction.log'); |
| 1811 |
// usces_log('usces_cookieid : '.$_SESSION['usces_cookieid'], 'acting_transaction.log'); |
| 1812 |
// usces_log('request : '.print_r($_SERVER['REQUEST_URI'],true), 'acting_transaction.log'); |
| 1813 |
|
| 1814 |
if( empty($refer) || (false === strpos($refer, $home) && false === strpos($refer, $sslhome)) ){ |
| 1815 |
if( !empty($sslid) && !empty($rckid) && $sslid === $rckid ){ |
| 1816 |
$actionflag = true; |
| 1817 |
}else{ |
| 1818 |
$actionflag = false; |
| 1819 |
} |
| 1820 |
}else{ |
| 1821 |
if( !empty($sslid) && $sslid !== $rckid ){ |
| 1822 |
$actionflag = false; |
| 1823 |
}else{ |
| 1824 |
$actionflag = true; |
| 1825 |
} |
| 1826 |
} |
| 1827 |
|
| 1828 |
|
| 1829 |
if( $actionflag ){ |
| 1830 |
$values = array( |
| 1831 |
'id' => $rckid, |
| 1832 |
'sslid' => $rckid, |
| 1833 |
'name' => '', |
| 1834 |
'rme' => '' |
| 1835 |
); |
| 1836 |
if( 'acting' !== $rckid ){ |
| 1837 |
$this->set_cookie($values); |
| 1838 |
} |
| 1839 |
}else{ |
| 1840 |
if( 'acting' !== $rckid ){ |
| 1841 |
unset($_SESSION['usces_member'], $_SESSION['usces_cart'], $_SESSION['usces_entry'] ); |
| 1842 |
wp_redirect( 'http://'.$home ); |
| 1843 |
} |
| 1844 |
} |
| 1845 |
}else{ |
| 1846 |
if( !isset($cookie['id']) || WCUtils::is_blank($cookie['id']) ) { |
| 1847 |
$values = array( |
| 1848 |
'id' => md5(uniqid(rand(), true)), |
| 1849 |
'name' => '', |
| 1850 |
'rme' => '' |
| 1851 |
); |
| 1852 |
$this->set_cookie($values); |
| 1853 |
$_SESSION['usces_cookieid'] = $values['id']; |
| 1854 |
} else { |
| 1855 |
if( !isset($_SESSION['usces_cookieid']) || $_SESSION['usces_cookieid'] != $cookie['id']) |
| 1856 |
$_SESSION['usces_cookieid'] = $cookie['id']; |
| 1857 |
} |
| 1858 |
|
| 1859 |
$actionflag = true; |
| 1860 |
} |
| 1861 |
|
| 1862 |
} |
| 1863 |
|
| 1864 |
function set_cookie($values){ |
| 1865 |
$value = serialize($values); |
| 1866 |
$timeout = time()+7*86400; |
| 1867 |
$domain = $_SERVER['SERVER_NAME']; |
| 1868 |
$res = setcookie('usces_cookie', $value, $timeout, USCES_COOKIEPATH, $domain); |
| 1869 |
} |
| 1870 |
|
| 1871 |
function get_cookie() { |
| 1872 |
$values = isset($_COOKIE['usces_cookie']) ? unserialize(stripslashes($_COOKIE['usces_cookie'])) : NULL; |
| 1873 |
return $values; |
| 1874 |
} |
| 1875 |
|
| 1876 |
function get_access( $key, $type, $date ) { |
| 1877 |
global $wpdb; |
| 1878 |
$table_name = $wpdb->prefix . "usces_access"; |
| 1879 |
|
| 1880 |
$query = $wpdb->prepare("SELECT acc_value FROM $table_name WHERE acc_key = %s AND acc_type = %s AND acc_date = %s", $key, $type, $date); |
| 1881 |
$value = $wpdb->get_var( $query ); |
| 1882 |
if( !$value ){ |
| 1883 |
$res = NULL; |
| 1884 |
}else{ |
| 1885 |
$res = unserialize($value); |
| 1886 |
} |
| 1887 |
|
| 1888 |
return $res; |
| 1889 |
} |
| 1890 |
|
| 1891 |
function get_access_piriod( $key, $type, $startday, $endday ) { |
| 1892 |
global $wpdb; |
| 1893 |
$table_name = $wpdb->prefix . "usces_access"; |
| 1894 |
//$wpdb->show_errors(); |
| 1895 |
$query = $wpdb->prepare("SELECT acc_type, acc_value, acc_date FROM $table_name WHERE acc_key = %s AND acc_type = %s AND (acc_date >= %s AND acc_date <= %s)", $key, $type, $startday, $endday); |
| 1896 |
$res = $wpdb->get_results( $query, ARRAY_A ); |
| 1897 |
|
| 1898 |
return $res; |
| 1899 |
} |
| 1900 |
|
| 1901 |
function update_access( $array ) { |
| 1902 |
global $wpdb; |
| 1903 |
$table_name = $wpdb->prefix . "usces_access"; |
| 1904 |
|
| 1905 |
$query = $wpdb->prepare("SELECT ID FROM $table_name WHERE acc_key = %s AND acc_type = %s AND acc_date = %s", $array['acc_key'], $array['acc_type'], $array['acc_date']); |
| 1906 |
$res = $wpdb->get_var( $query ); |
| 1907 |
//$wpdb->show_errors(); |
| 1908 |
if(empty($res)){ |
| 1909 |
$query = $wpdb->prepare("INSERT INTO $table_name (acc_key, acc_type, acc_value, acc_date) VALUES(%s, %s, %s, %s)", $array['acc_key'], $array['acc_type'], serialize($array['acc_value']), $array['acc_date']); |
| 1910 |
$wpdb->query( $query ); |
| 1911 |
}else{ |
| 1912 |
$query = $wpdb->prepare("UPDATE $table_name SET acc_value = %s WHERE acc_key = %s AND acc_type = %s AND acc_date = %s", serialize($array['acc_value']), $array['acc_key'], $array['acc_type'], $array['acc_date']); |
| 1913 |
$wpdb->query( $query ); |
| 1914 |
} |
| 1915 |
} |
| 1916 |
|
| 1917 |
function get_uscesid( $flag = true) { |
| 1918 |
|
| 1919 |
$sessname = session_name(); |
| 1920 |
$sessid = session_id(); |
| 1921 |
$sessid = $this->uscescv($sessid, $flag); |
| 1922 |
return $sessid; |
| 1923 |
} |
| 1924 |
|
| 1925 |
function shop_head() { |
| 1926 |
global $post; |
| 1927 |
$this->item = $post; |
| 1928 |
$no_cart_css = isset($this->options['system']['no_cart_css']) ? $this->options['system']['no_cart_css'] : 0; |
| 1929 |
|
| 1930 |
if( $this->is_cart_or_member_page($_SERVER['REQUEST_URI']) || $this->is_inquiry_page($_SERVER['REQUEST_URI']) ){ |
| 1931 |
$css_url = USCES_FRONT_PLUGIN_URL . '/css/usces_cart.css'; |
| 1932 |
}else{ |
| 1933 |
$css_url = USCES_WP_CONTENT_URL . '/plugins/' . USCES_PLUGIN_FOLDER . '/css/usces_cart.css'; |
| 1934 |
} |
| 1935 |
if( $this->is_cart_or_member_page($_SERVER['REQUEST_URI']) ){ |
| 1936 |
echo " <meta name='robots' content='noindex,nofollow' />\n"; |
| 1937 |
wp_print_scripts( array( 'sack' )); |
| 1938 |
} |
| 1939 |
if( !$no_cart_css ){ |
| 1940 |
echo '<link href="' . $css_url . '" rel="stylesheet" type="text/css" />'; |
| 1941 |
} |
| 1942 |
if( file_exists(get_stylesheet_directory() . '/usces_cart.css') ){ |
| 1943 |
echo '<link href="' . get_stylesheet_directory_uri() . '/usces_cart.css" rel="stylesheet" type="text/css" />'; |
| 1944 |
} |
| 1945 |
} |
| 1946 |
|
| 1947 |
function shop_foot() { |
| 1948 |
global $current_user; |
| 1949 |
$item = $this->item; |
| 1950 |
if( empty($item) ){ |
| 1951 |
$item->ID = 0; |
| 1952 |
$item->post_mime_type = ''; |
| 1953 |
} |
| 1954 |
get_currentuserinfo(); |
| 1955 |
if( $this->is_cart_or_member_page($_SERVER['REQUEST_URI']) || $this->is_inquiry_page($_SERVER['REQUEST_URI']) ){ |
| 1956 |
$javascript_url = USCES_FRONT_PLUGIN_URL . '/js/usces_cart.js'; |
| 1957 |
}else{ |
| 1958 |
$javascript_url = USCES_WP_CONTENT_URL . '/plugins/' . USCES_PLUGIN_FOLDER . '/js/usces_cart.js'; |
| 1959 |
} |
| 1960 |
// $this->member_name = ( is_user_logged_in() ) ? esc_js(get_user_meta($current_user->ID,'first_name').get_user_meta($current_user->ID,'last_name')) : ''; |
| 1961 |
$this->previous_url = isset($_SESSION['usces_previous_url']) ? $_SESSION['usces_previous_url'] : get_home_url(); |
| 1962 |
|
| 1963 |
// usces_log('post_type : '.$item->post_mime_type, 'test.log'); |
| 1964 |
// usces_log('is_single : '.(is_single() ? 'true' : 'false'), 'test.log'); |
| 1965 |
|
| 1966 |
if( $this->use_js && empty($this->item) && !is_admin() ) : |
| 1967 |
?> |
| 1968 |
<script type='text/javascript'> |
| 1969 |
/* <![CDATA[ */ |
| 1970 |
uscesL10n = { |
| 1971 |
<?php echo apply_filters('usces_filter_uscesL10n', NULL, $item->ID); ?> |
| 1972 |
'ajaxurl': "<?php echo $this->ssl_admin_ajax_url(); ?>" |
| 1973 |
} |
| 1974 |
/* ]]> */ |
| 1975 |
</script> |
| 1976 |
<?php elseif( $this->use_js && !empty($this->item) ) : |
| 1977 |
|
| 1978 |
$ioptkeys = $this->get_itemOptionKey( $item->ID ); |
| 1979 |
$mes_opts_str = ""; |
| 1980 |
$key_opts_str = ""; |
| 1981 |
$opt_means = ""; |
| 1982 |
$opt_esse = ""; |
| 1983 |
if($ioptkeys){ |
| 1984 |
foreach($ioptkeys as $key => $value){ |
| 1985 |
$optValues = $this->get_itemOptions( $value, $item->ID ); |
| 1986 |
if($optValues['means'] < 2){ |
| 1987 |
$mes_opts_str .= "'" . sprintf(__("Chose the %s", 'usces'), esc_js($value)) . "',"; |
| 1988 |
}else{ |
| 1989 |
$mes_opts_str .= "'" . sprintf(__("Input the %s", 'usces'), esc_js($value)) . "',"; |
| 1990 |
} |
| 1991 |
$key_opts_str .= "'" . urlencode(esc_js($value)) . "',"; |
| 1992 |
$opt_means .= "'" . esc_js($optValues['means']) . "',"; |
| 1993 |
$opt_esse .= "'" . esc_js($optValues['essential']) . "',"; |
| 1994 |
} |
| 1995 |
$mes_opts_str = rtrim($mes_opts_str, ','); |
| 1996 |
$key_opts_str = rtrim($key_opts_str, ','); |
| 1997 |
$opt_means = rtrim($opt_means, ','); |
| 1998 |
$opt_esse = rtrim($opt_esse, ','); |
| 1999 |
} |
| 2000 |
//$itemRestriction = get_post_custom_values('_itemRestriction', $item->ID); |
| 2001 |
$itemRestriction = get_post_meta($item->ID, '_itemRestriction', true); |
| 2002 |
|
| 2003 |
?> |
| 2004 |
<script type='text/javascript'> |
| 2005 |
/* <![CDATA[ */ |
| 2006 |
uscesL10n = { |
| 2007 |
<?php echo apply_filters('usces_filter_uscesL10n', NULL, $item->ID); ?> |
| 2008 |
'ajaxurl': "<?php echo $this->ssl_admin_ajax_url(); ?>", |
| 2009 |
'post_id': "<?php echo $item->ID; ?>", |
| 2010 |
'cart_number': "<?php echo get_option('usces_cart_number'); ?>", |
| 2011 |
'is_cart_row': <?php echo ( (0 < $this->cart->num_row()) ? 'true' : 'false'); ?>, |
| 2012 |
'opt_esse': new Array( <?php echo $opt_esse; ?> ), |
| 2013 |
'opt_means': new Array( <?php echo $opt_means; ?> ), |
| 2014 |
'mes_opts': new Array( <?php echo $mes_opts_str; ?> ), |
| 2015 |
'key_opts': new Array( <?php echo $key_opts_str; ?> ), |
| 2016 |
'previous_url': "<?php echo $this->previous_url; ?>", |
| 2017 |
'itemRestriction': "<?php echo $itemRestriction; ?>" |
| 2018 |
} |
| 2019 |
/* ]]> */ |
| 2020 |
</script> |
| 2021 |
<script type='text/javascript' src='<?php echo $javascript_url; ?>'></script> |
| 2022 |
<?php endif; ?> |
| 2023 |
<?php //if( !is_home() && !is_front_page() && $this->use_js && (is_page(USCES_CART_NUMBER) || $this->is_cart_page($_SERVER['REQUEST_URI']) || ('item' == $item->post_mime_type)) ) : ?> |
| 2024 |
<?php if( $this->use_js && (is_page(USCES_CART_NUMBER) || $this->is_cart_page($_SERVER['REQUEST_URI']) || (is_singular() && 'item' == $item->post_mime_type)) ) : ?> |
| 2025 |
<script type='text/javascript'> |
| 2026 |
(function($) { |
| 2027 |
uscesCart = { |
| 2028 |
intoCart : function (post_id, sku) { |
| 2029 |
|
| 2030 |
var zaikonum = document.getElementById("zaikonum["+post_id+"]["+sku+"]").value; |
| 2031 |
var zaiko = document.getElementById("zaiko["+post_id+"]["+sku+"]").value; |
| 2032 |
if( (zaiko != '0' && zaiko != '1') || parseInt(zaikonum) == 0 ){ |
| 2033 |
alert('<?php _e('temporaly out of stock now', 'usces'); ?>'); |
| 2034 |
return false; |
| 2035 |
} |
| 2036 |
|
| 2037 |
var mes = ''; |
| 2038 |
if(document.getElementById("quant["+post_id+"]["+sku+"]")){ |
| 2039 |
var quant = document.getElementById("quant["+post_id+"]["+sku+"]").value; |
| 2040 |
if( quant == '0' || quant == '' || !(uscesCart.isNum(quant))){ |
| 2041 |
mes += "<?php _e('enter the correct amount', 'usces'); ?>\n"; |
| 2042 |
} |
| 2043 |
var checknum = ''; |
| 2044 |
var checkmode = ''; |
| 2045 |
if( parseInt(uscesL10n.itemRestriction) <= parseInt(zaikonum) && uscesL10n.itemRestriction != '' && uscesL10n.itemRestriction != '0' && zaikonum != '' ) { |
| 2046 |
checknum = uscesL10n.itemRestriction; |
| 2047 |
checkmode ='rest'; |
| 2048 |
} else if( parseInt(uscesL10n.itemRestriction) > parseInt(zaikonum) && uscesL10n.itemRestriction != '' && uscesL10n.itemRestriction != '0' && zaikonum != '' ) { |
| 2049 |
checknum = zaikonum; |
| 2050 |
checkmode ='zaiko'; |
| 2051 |
} else if( (uscesL10n.itemRestriction == '' || uscesL10n.itemRestriction == '0') && zaikonum != '' ) { |
| 2052 |
checknum = zaikonum; |
| 2053 |
checkmode ='zaiko'; |
| 2054 |
} else if( uscesL10n.itemRestriction != '' && uscesL10n.itemRestriction != '0' && zaikonum == '' ) { |
| 2055 |
checknum = uscesL10n.itemRestriction; |
| 2056 |
checkmode ='rest'; |
| 2057 |
} |
| 2058 |
|
| 2059 |
|
| 2060 |
if( parseInt(quant) > parseInt(checknum) && checknum != '' ){ |
| 2061 |
if(checkmode == 'rest'){ |
| 2062 |
mes += <?php _e("'This article is limited by '+checknum+' at a time.'", 'usces'); ?>+"\n"; |
| 2063 |
}else{ |
| 2064 |
mes += <?php _e("'Stock is remainder '+checknum+'.'", 'usces'); ?>+"\n"; |
| 2065 |
} |
| 2066 |
} |
| 2067 |
} |
| 2068 |
for(i=0; i<uscesL10n.key_opts.length; i++){ |
| 2069 |
var skuob = document.getElementById("itemOption["+post_id+"]["+sku+"]["+uscesL10n.key_opts[i]+"]"); |
| 2070 |
if( uscesL10n.opt_esse[i] == '1' ){ |
| 2071 |
|
| 2072 |
if( uscesL10n.opt_means[i] < 2 && skuob.value == '#NONE#' ){ |
| 2073 |
mes += uscesL10n.mes_opts[i]+"\n"; |
| 2074 |
}else if( uscesL10n.opt_means[i] >= 2 && skuob.value == '' ){ |
| 2075 |
mes += uscesL10n.mes_opts[i]+"\n"; |
| 2076 |
} |
| 2077 |
} |
| 2078 |
} |
| 2079 |
|
| 2080 |
<?php apply_filters( 'usces_filter_inCart_js_check', $item->ID ); //Unavailable ?> |
| 2081 |
<?php do_action( 'usces_action_inCart_js_check', $item->ID ); ?> |
| 2082 |
|
| 2083 |
if( mes != '' ){ |
| 2084 |
alert( mes ); |
| 2085 |
return false; |
| 2086 |
}else{ |
| 2087 |
<?php echo apply_filters('usces_filter_js_intoCart', "return true;\n", $item->ID, NULL); ?> |
| 2088 |
} |
| 2089 |
}, |
| 2090 |
|
| 2091 |
upCart : function () { |
| 2092 |
|
| 2093 |
var zaikoob = $("input[name*='zaikonum']"); |
| 2094 |
var quantob = $("input[name*='quant']"); |
| 2095 |
var postidob = $("input[name*='itempostid']"); |
| 2096 |
var skuob = $("input[name*='itemsku']"); |
| 2097 |
|
| 2098 |
var zaikonum = ''; |
| 2099 |
var zaiko = ''; |
| 2100 |
var quant = ''; |
| 2101 |
var mes = ''; |
| 2102 |
var checknum = ''; |
| 2103 |
var post_id = ''; |
| 2104 |
var sku = ''; |
| 2105 |
var itemRestriction = ''; |
| 2106 |
|
| 2107 |
var ct = zaikoob.length; |
| 2108 |
for(var i=0; i< ct; i++){ |
| 2109 |
post_id = postidob[i].value; |
| 2110 |
sku = skuob[i].value; |
| 2111 |
itemRestriction = $("input[name='itemRestriction\[" + i + "\]']").val(); |
| 2112 |
zaikonum = $("input[name='zaikonum\[" + i + "\]\[" + post_id + "\]\[" + sku + "\]']").val(); |
| 2113 |
|
| 2114 |
quant = $("input[name='quant\[" + i + "\]\[" + post_id + "\]\[" + sku + "\]']").val(); |
| 2115 |
if( $("input[name='quant\[" + i + "\]\[" + post_id + "\]\[" + sku + "\]']") ){ |
| 2116 |
if( quant == '0' || quant == '' || !(uscesCart.isNum(quant))){ |
| 2117 |
mes += <?php _e("'enter the correct amount for the No.' + (i+1) + ' item'", 'usces'); ?>+"\n"; |
| 2118 |
} |
| 2119 |
var checknum = ''; |
| 2120 |
var checkmode = ''; |
| 2121 |
if( parseInt(itemRestriction) <= parseInt(zaikonum) && itemRestriction != '' && itemRestriction != '0' && zaikonum != '' ) { |
| 2122 |
checknum = itemRestriction; |
| 2123 |
checkmode ='rest'; |
| 2124 |
} else if( parseInt(itemRestriction) > parseInt(zaikonum) && itemRestriction != '' && itemRestriction != '0' && zaikonum != '' ) { |
| 2125 |
checknum = zaikonum; |
| 2126 |
checkmode ='zaiko'; |
| 2127 |
} else if( (itemRestriction == '' || itemRestriction == '0') && zaikonum != '' ) { |
| 2128 |
checknum = zaikonum; |
| 2129 |
checkmode ='zaiko'; |
| 2130 |
} else if( itemRestriction != '' && itemRestriction != '0' && zaikonum == '' ) { |
| 2131 |
checknum = itemRestriction; |
| 2132 |
checkmode ='rest'; |
| 2133 |
} |
| 2134 |
if( parseInt(quant) > parseInt(checknum) && checknum != '' ){ |
| 2135 |
if(checkmode == 'rest'){ |
| 2136 |
mes += <?php _e("'This article is limited by '+checknum+' at a time for the No.' + (i+1) + ' item.'", 'usces'); ?>+"\n"; |
| 2137 |
}else{ |
| 2138 |
mes += <?php _e("'Stock of No.' + (i+1) + ' item is remainder '+checknum+'.'", 'usces'); ?>+"\n"; |
| 2139 |
} |
| 2140 |
} |
| 2141 |
} |
| 2142 |
} |
| 2143 |
|
| 2144 |
<?php apply_filters( 'usces_filter_upCart_js_check', $item->ID ); //Unavailable ?> |
| 2145 |
<?php do_action( 'usces_action_upCart_js_check', $item->ID ); ?> |
| 2146 |
|
| 2147 |
if( mes != '' ){ |
| 2148 |
alert( mes ); |
| 2149 |
return false; |
| 2150 |
}else{ |
| 2151 |
<?php echo apply_filters('usces_filter_js_upCart', "return true;\n", $item->ID, NULL); ?> |
| 2152 |
} |
| 2153 |
}, |
| 2154 |
|
| 2155 |
cartNext : function () { |
| 2156 |
|
| 2157 |
var zaikoob = $("input[name*='zaikonum']"); |
| 2158 |
var quantob = $("input[name*='quant']"); |
| 2159 |
var postidob = $("input[name*='itempostid']"); |
| 2160 |
var skuob = $("input[name*='itemsku']"); |
| 2161 |
|
| 2162 |
var zaikonum = ''; |
| 2163 |
var zaiko = ''; |
| 2164 |
var quant = ''; |
| 2165 |
var mes = ''; |
| 2166 |
var checknum = ''; |
| 2167 |
var post_id = ''; |
| 2168 |
var sku = ''; |
| 2169 |
var itemRestriction = ''; |
| 2170 |
|
| 2171 |
var ct = zaikoob.length; |
| 2172 |
for(var i=0; i< ct; i++){ |
| 2173 |
post_id = postidob[i].value; |
| 2174 |
sku = skuob[i].value; |
| 2175 |
itemRestriction = $("input[name='itemRestriction\[" + i + "\]']").val(); |
| 2176 |
zaikonum = $("input[name='zaikonum\[" + i + "\]\[" + post_id + "\]\[" + sku + "\]']").val(); |
| 2177 |
|
| 2178 |
quant = $("input[name='quant\[" + i + "\]\[" + post_id + "\]\[" + sku + "\]']").val(); |
| 2179 |
if( $("input[name='quant\[" + i + "\]\[" + post_id + "\]\[" + sku + "\]']") ){ |
| 2180 |
if( quant == '0' || quant == '' || !(uscesCart.isNum(quant))){ |
| 2181 |
mes += <?php _e("'enter the correct amount for the No.' + (i+1) + ' item'", 'usces'); ?>+"\n"; |
| 2182 |
} |
| 2183 |
var checknum = ''; |
| 2184 |
var checkmode = ''; |
| 2185 |
if( parseInt(itemRestriction) <= parseInt(zaikonum) && itemRestriction != '' && itemRestriction != '0' && zaikonum != '' ) { |
| 2186 |
checknum = itemRestriction; |
| 2187 |
checkmode ='rest'; |
| 2188 |
} else if( parseInt(itemRestriction) > parseInt(zaikonum) && itemRestriction != '' && itemRestriction != '0' && zaikonum != '' ) { |
| 2189 |
checknum = zaikonum; |
| 2190 |
checkmode ='zaiko'; |
| 2191 |
} else if( (itemRestriction == '' || itemRestriction == '0') && zaikonum != '' ) { |
| 2192 |
checknum = zaikonum; |
| 2193 |
checkmode ='zaiko'; |
| 2194 |
} else if( itemRestriction != '' && itemRestriction != '0' && zaikonum == '' ) { |
| 2195 |
checknum = itemRestriction; |
| 2196 |
checkmode ='rest'; |
| 2197 |
} |
| 2198 |
|
| 2199 |
if( parseInt(quant) > parseInt(checknum) && checknum != '' ){ |
| 2200 |
if(checkmode == 'rest'){ |
| 2201 |
mes += <?php _e("'This article is limited by '+checknum+' at a time for the No.' + (i+1) + ' item.'", 'usces'); ?>+"\n"; |
| 2202 |
}else{ |
| 2203 |
mes += <?php _e("'Stock of No.' + (i+1) + ' item is remainder '+checknum+'.'", 'usces'); ?>+"\n"; |
| 2204 |
} |
| 2205 |
} |
| 2206 |
} |
| 2207 |
} |
| 2208 |
if( mes != '' ){ |
| 2209 |
alert( mes ); |
| 2210 |
return false; |
| 2211 |
}else{ |
| 2212 |
return true; |
| 2213 |
} |
| 2214 |
}, |
| 2215 |
|
| 2216 |
previousCart : function () { |
| 2217 |
location.href = uscesL10n.previous_url; |
| 2218 |
}, |
| 2219 |
|
| 2220 |
settings: { |
| 2221 |
url: uscesL10n.ajaxurl, |
| 2222 |
type: 'POST', |
| 2223 |
cache: false, |
| 2224 |
success: function(data, dataType){ |
| 2225 |
//$("tbody#item-opt-list").html( data ); |
| 2226 |
}, |
| 2227 |
error: function(msg){ |
| 2228 |
//$("#ajax-response").html(msg); |
| 2229 |
} |
| 2230 |
}, |
| 2231 |
|
| 2232 |
changeStates : function( country ) { |
| 2233 |
var s = this.settings; |
| 2234 |
s.data = "action=change_states_ajax&country=" + country; |
| 2235 |
s.success = function(data, dataType){ |
| 2236 |
if( 'error' == data ){ |
| 2237 |
alert('error'); |
| 2238 |
}else{ |
| 2239 |
$("select#pref").html( data ); |
| 2240 |
} |
| 2241 |
}; |
| 2242 |
s.error = function(msg){ |
| 2243 |
alert("error"); |
| 2244 |
}; |
| 2245 |
$.ajax( s ); |
| 2246 |
return false; |
| 2247 |
}, |
| 2248 |
|
| 2249 |
isNum : function (num) { |
| 2250 |
if (num.match(/[^0-9]/g)) { |
| 2251 |
return false; |
| 2252 |
} |
| 2253 |
return true; |
| 2254 |
}, |
| 2255 |
purchase : 0 |
| 2256 |
}; |
| 2257 |
$("#country").change(function () { |
| 2258 |
var country = $("#country option:selected").val(); |
| 2259 |
$("#newcharging_type option:selected").val() |
| 2260 |
uscesCart.changeStates( country ); |
| 2261 |
}); |
| 2262 |
$("#purchase_form").submit(function () { |
| 2263 |
if( 0 == uscesCart.purchase ){ |
| 2264 |
uscesCart.purchase = 1; |
| 2265 |
return true; |
| 2266 |
}else{ |
| 2267 |
$("#purchase_button").attr("disabled", "disabled"); |
| 2268 |
$("#back_button").attr("disabled", "disabled"); |
| 2269 |
return false; |
| 2270 |
} |
| 2271 |
}); |
| 2272 |
|
| 2273 |
})(jQuery); |
| 2274 |
</script> |
| 2275 |
<?php endif; ?> |
| 2276 |
<?php |
| 2277 |
usces_states_form_js(); |
| 2278 |
} |
| 2279 |
|
| 2280 |
function admin_head() { |
| 2281 |
global $wp_version; |
| 2282 |
$payments_str = ''; |
| 2283 |
$payments = usces_get_system_option( 'usces_payment_method', 'sort' ); |
| 2284 |
foreach ( (array)$payments as $id => $array ) { |
| 2285 |
$payments_str .= "'" . esc_js($array['name']) . "': '" . esc_js($array['settlement']) . "', "; |
| 2286 |
} |
| 2287 |
$payments_str .= "'" . __('Transfer (prepayment)', 'usces') . "': 'transferAdvance', "; |
| 2288 |
$payments_str .= "'" . __('Transfer (postpay)', 'usces') . "': 'transferDeferred', "; |
| 2289 |
$payments_str .= "'" . __('COD', 'usces') . "': 'COD', "; |
| 2290 |
$payments_str = rtrim($payments_str, ', '); |
| 2291 |
$wcex_str = ''; |
| 2292 |
$wcex = usces_get_wcex(); |
| 2293 |
foreach ( (array)$wcex as $key => $values ) { |
| 2294 |
$wcex_str .= "'" . esc_js($key) . "-" . esc_js($values['version']) . "', "; |
| 2295 |
} |
| 2296 |
$wcex_str = rtrim($wcex_str, ', '); |
| 2297 |
if ( version_compare($wp_version, '3.4', '>=') ){ |
| 2298 |
$theme_ob = wp_get_theme(); |
| 2299 |
$theme['Name'] = esc_js($theme_ob->get('Name')); |
| 2300 |
$theme['Version'] = esc_js($theme_ob->get('Version')); |
| 2301 |
}else{ |
| 2302 |
$theme = get_theme_data( get_stylesheet_directory().'/style.css' );//20120618ysk |
| 2303 |
} |
| 2304 |
?> |
| 2305 |
|
| 2306 |
<link href="<?php echo USCES_PLUGIN_URL; ?>/css/admin_style.css" rel="stylesheet" type="text/css" media="all" /> |
| 2307 |
<script type='text/javascript'> |
| 2308 |
/* <![CDATA[ */ |
| 2309 |
uscesL10n = { |
| 2310 |
'requestFile': "<?php echo site_url(); ?>/wp-admin/admin-ajax.php", |
| 2311 |
'USCES_PLUGIN_URL': "<?php echo USCES_PLUGIN_URL; ?>", |
| 2312 |
'version': "<?php echo USCES_VERSION; ?>", |
| 2313 |
'wcid': "<?php echo get_option('usces_wcid'); ?>", |
| 2314 |
'locale': '<?php echo get_locale(); ?>', |
| 2315 |
'cart_number': "<?php echo get_option('usces_cart_number'); ?>", |
| 2316 |
'purchase_limit': "<?php echo $this->options['purchase_limit']; ?>", |
| 2317 |
'point_rate': "<?php echo $this->options['point_rate']; ?>", |
| 2318 |
'shipping_rule': "<?php echo $this->options['shipping_rule']; ?>", |
| 2319 |
'theme': "<?php echo $theme['Name'] . '-' . $theme['Version']; ?>", |
| 2320 |
'wcex': new Array( <?php echo $wcex_str; ?> ), |
| 2321 |
'now_loading': "<?php _e('now loading', 'usces'); ?>" |
| 2322 |
}; |
| 2323 |
uscesPayments = {<?php echo $payments_str; ?>}; |
| 2324 |
/* ]]> */ |
| 2325 |
</script> |
| 2326 |
<script type='text/javascript' src='<?php echo USCES_PLUGIN_URL; ?>/js/usces_admin.js'></script> |
| 2327 |
<?php |
| 2328 |
if($this->action_status == 'edit' || $this->action_status == 'editpost'){ |
| 2329 |
?> |
| 2330 |
<link rel='stylesheet' href='<?php echo site_url(); ?>/wp-includes/js/thickbox/thickbox.css' type='text/css' media='all' /> |
| 2331 |
<?php |
| 2332 |
} |
| 2333 |
if( isset($_REQUEST['page']) ){ |
| 2334 |
switch( $_REQUEST['page'] ){ |
| 2335 |
case 'usces_initial': |
| 2336 |
?> |
| 2337 |
<script type='text/javascript'> |
| 2338 |
/* <![CDATA[ */ |
| 2339 |
usces_ini = { |
| 2340 |
'cod_type': "<?php if( 'change' == $this->options['cod_type'] ) {echo 'change';}else{echo 'fix';} ?>", |
| 2341 |
'cod_type_fix': "<?php echo esc_js(__('Fixation C.O.D.', 'usces')); ?>", |
| 2342 |
'cod_type_change': "<?php echo esc_js(__('Variable C.O.D.', 'usces')); ?>", |
| 2343 |
'cod_unit': "<?php echo esc_js(__('dollars', 'usces')); ?>", |
| 2344 |
'cod_failure': "<?php echo esc_js(__('failure in update', 'usces')); ?>", |
| 2345 |
'cod_updated': "<?php echo esc_js(__('options are updated', 'usces')); ?>", |
| 2346 |
'cod_limit': "<?php echo esc_js(__('A value of the amount of upper limit is dirty.', 'usces')); ?>" |
| 2347 |
}; |
| 2348 |
/* ]]> */ |
| 2349 |
</script> |
| 2350 |
<?php |
| 2351 |
break; |
| 2352 |
case 'usces_itemnew': |
| 2353 |
case 'usces_itemedit': |
| 2354 |
?> |
| 2355 |
<style type="text/css"> |
| 2356 |
<!-- |
| 2357 |
#usces_mess { |
| 2358 |
color: #FF0000; |
| 2359 |
font-weight: bold; |
| 2360 |
} |
| 2361 |
--> |
| 2362 |
</style> |
| 2363 |
<?php |
| 2364 |
break; |
| 2365 |
} |
| 2366 |
} |
| 2367 |
?> |
| 2368 |
<?php |
| 2369 |
if( is_admin() && ( (isset($_GET['order_action']) && 'newpost' == $_GET['order_action']) |
| 2370 |
|| (isset($_GET['page']) && 'usces_ordernew' == $_GET['page']) |
| 2371 |
|| (isset($_GET['order_action']) && 'edit' == $_GET['order_action']) |
| 2372 |
|| (isset($_GET['order_action']) && 'editpost' == $_GET['order_action']) |
| 2373 |
|| (isset($_GET['member_action']) && 'edit' == $_GET['member_action']) |
| 2374 |
|| (isset($_GET['member_action']) && 'editpost' == $_GET['member_action'])) ) : |
| 2375 |
switch( $_GET['page'] ){ |
| 2376 |
case 'usces_ordernew': |
| 2377 |
case 'usces_orderlist': |
| 2378 |
$admin_page = 'order'; |
| 2379 |
break; |
| 2380 |
case 'usces_memberlist': |
| 2381 |
$admin_page = 'member'; |
| 2382 |
break; |
| 2383 |
} |
| 2384 |
?> |
| 2385 |
<script type='text/javascript'> |
| 2386 |
jQuery(function($) { |
| 2387 |
uscesForm = { |
| 2388 |
settings: { |
| 2389 |
url: uscesL10n.requestFile, |
| 2390 |
type: 'POST', |
| 2391 |
cache: false, |
| 2392 |
success: function(data, dataType){ |
| 2393 |
//$("tbody#item-opt-list").html( data ); |
| 2394 |
}, |
| 2395 |
error: function(msg){ |
| 2396 |
//$("#ajax-response").html(msg); |
| 2397 |
} |
| 2398 |
}, |
| 2399 |
|
| 2400 |
changeStates : function( country, type ) { |
| 2401 |
var s = this.settings; |
| 2402 |
s.data = "action=change_states_ajax&country=" + country; |
| 2403 |
s.success = function(data, dataType){ |
| 2404 |
if( 'error' == data ){ |
| 2405 |
alert('error'); |
| 2406 |
}else{ |
| 2407 |
$("select#" + type + "_pref").html( data ); |
| 2408 |
if( customercountry == country && 'customer' == type ){ |
| 2409 |
$("#" + type + "_pref").attr({selectedIndex:customerstate}); |
| 2410 |
}else if( deliverycountry == country && 'delivery' == type ){ |
| 2411 |
$("#" + type + "_pref").attr({selectedIndex:deliverystate}); |
| 2412 |
}else if( customercountry == country && 'member' == type ){ |
| 2413 |
$("#" + type + "_pref").attr({selectedIndex:customerstate}); |
| 2414 |
} |
| 2415 |
} |
| 2416 |
}; |
| 2417 |
s.error = function(msg){ |
| 2418 |
alert("error"); |
| 2419 |
}; |
| 2420 |
$.ajax( s ); |
| 2421 |
return false; |
| 2422 |
}, |
| 2423 |
|
| 2424 |
isNum : function (num) { |
| 2425 |
if (num.match(/[^0-9]/g)) { |
| 2426 |
return false; |
| 2427 |
} |
| 2428 |
return true; |
| 2429 |
} |
| 2430 |
}; |
| 2431 |
<?php |
| 2432 |
if( 'order' == $admin_page ){ |
| 2433 |
?> |
| 2434 |
if( undefined != $("#customer_pref").get(0) && undefined != $("#delivery_country").get(0) ) { |
| 2435 |
var customerstate = $("#customer_pref").get(0).selectedIndex; |
| 2436 |
var customercountry = $("#customer_country").val(); |
| 2437 |
var deliverystate = $("#delivery_pref").get(0).selectedIndex; |
| 2438 |
var deliverycountry = $("#delivery_country").val(); |
| 2439 |
|
| 2440 |
$("#customer_country").change(function () { |
| 2441 |
var country = $("#customer_country option:selected").val(); |
| 2442 |
uscesForm.changeStates( country, 'customer' ); |
| 2443 |
}); |
| 2444 |
$("#delivery_country").change(function () { |
| 2445 |
var country = $("#delivery_country option:selected").val(); |
| 2446 |
uscesForm.changeStates( country, 'delivery' ); |
| 2447 |
}); |
| 2448 |
} |
| 2449 |
<?php |
| 2450 |
}else if( 'member' == $admin_page ){ |
| 2451 |
?> |
| 2452 |
if( undefined != $("#member_pref").get(0) ) { |
| 2453 |
var customerstate = $("#member_pref").get(0).selectedIndex; |
| 2454 |
var customercountry = $("#member_country").val(); |
| 2455 |
var deliverystate = ''; |
| 2456 |
var deliverycountry = ''; |
| 2457 |
|
| 2458 |
$("#member_country").change(function () { |
| 2459 |
var country = $("#member_country option:selected").val(); |
| 2460 |
uscesForm.changeStates( country, 'member' ); |
| 2461 |
}); |
| 2462 |
} |
| 2463 |
<?php |
| 2464 |
} |
| 2465 |
?> |
| 2466 |
}); |
| 2467 |
</script> |
| 2468 |
<?php |
| 2469 |
endif; |
| 2470 |
} |
| 2471 |
|
| 2472 |
function main() { |
| 2473 |
global $wpdb, $wp_locale, $wp_version, $post_ID; |
| 2474 |
global $wp_query, $usces_action, $post, $action, $editing; |
| 2475 |
|
| 2476 |
update_option('usces_shipping_rule', apply_filters('usces_filter_shipping_rule', get_option('usces_shipping_rule'))); |
| 2477 |
$this->shipping_rule = get_option('usces_shipping_rule'); |
| 2478 |
|
| 2479 |
// $_wp_http_referer = isset($_POST['_wp_http_referer']) ? $_POST['_wp_http_referer'] : 'a'; |
| 2480 |
// if( isset($_POST) && 1 !== preg_match('/(?:plugin|theme)-editor\.php/', $_wp_http_referer) ){ |
| 2481 |
// $_POST = $this->stripslashes_deep_post($_POST); |
| 2482 |
// } |
| 2483 |
|
| 2484 |
if( !is_admin() ){ |
| 2485 |
$this->usces_cookie(); |
| 2486 |
} |
| 2487 |
$this->make_url(); |
| 2488 |
|
| 2489 |
//usces_log('HTTP_REFERER : '.$_SERVER['HTTP_REFERER'], 'acting_transaction.log'); |
| 2490 |
//usces_log('REQUEST_URI : '.$_SERVER['REQUEST_URI'], 'acting_transaction.log'); |
| 2491 |
|
| 2492 |
do_action('usces_main'); |
| 2493 |
$this->update_table(); |
| 2494 |
|
| 2495 |
|
| 2496 |
// if( ( !isset( $_POST['confirm'] ) && $this->is_cart_page( $_SERVER['REQUEST_URI'] ) ) && !is_admin() ){ |
| 2497 |
// header('Expires:-1'); |
| 2498 |
// header('Cache-Control:'); |
| 2499 |
// header('Pragma:'); |
| 2500 |
// } |
| 2501 |
|
| 2502 |
//var_dump($_REQUEST); |
| 2503 |
require_once(USCES_PLUGIN_DIR . '/classes/cart.class.php'); |
| 2504 |
$this->cart = new usces_cart(); |
| 2505 |
|
| 2506 |
do_action('usces_after_cart_instant'); |
| 2507 |
|
| 2508 |
if( isset($_REQUEST['page']) && $_REQUEST['page'] == 'usces_itemedit' && isset($_REQUEST['action']) && $_REQUEST['action'] == 'duplicate' ){ |
| 2509 |
$post_id = (int)$_GET['post']; |
| 2510 |
$new_id = usces_item_dupricate($post_id); |
| 2511 |
$ref = isset($_REQUEST['usces_referer']) ? urlencode($_REQUEST['usces_referer']) : ''; |
| 2512 |
$url = USCES_ADMIN_URL . '?page=usces_itemedit&action=edit&post=' . $new_id . '&usces_referer=' . $ref; |
| 2513 |
wp_redirect($url); |
| 2514 |
exit; |
| 2515 |
}else if( isset($_REQUEST['page']) && $_REQUEST['page'] == 'usces_itemedit' && isset($_REQUEST['action']) && $_REQUEST['action'] == 'itemcsv' ){ |
| 2516 |
$filename = usces_item_uploadcsv(); |
| 2517 |
$url = USCES_ADMIN_URL . '?page=usces_itemedit&usces_status=none&usces_message=&action=upload_register®file='.$filename; |
| 2518 |
wp_redirect($url); |
| 2519 |
exit; |
| 2520 |
} |
| 2521 |
//20110208ysk start |
| 2522 |
if( isset($this->options['acting_settings']['paypal']) and 'on' == $this->options['acting_settings']['paypal']['ec_activate'] ) { |
| 2523 |
require_once( USCES_PLUGIN_DIR.'/classes/paymentPaypal.class.php' ); |
| 2524 |
$this->paypal = new usces_paypal(); |
| 2525 |
} |
| 2526 |
//20110208ysk end |
| 2527 |
|
| 2528 |
$this->ad_controller(); |
| 2529 |
//$this->controller(); |
| 2530 |
|
| 2531 |
|
| 2532 |
|
| 2533 |
if( isset($_GET['page']) && $_GET['page'] == 'usces_itemnew'){ |
| 2534 |
$itemnew = 'new'; |
| 2535 |
}else{ |
| 2536 |
$itemnew = ''; |
| 2537 |
} |
| 2538 |
|
| 2539 |
wp_enqueue_script('jquery'); |
| 2540 |
|
| 2541 |
if( is_admin() && isset($_REQUEST['page']) && ((isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit') || $itemnew == 'new' || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'editpost'))) { |
| 2542 |
|
| 2543 |
if(isset($_REQUEST['action']) && $_REQUEST['action'] != 'editpost' && $itemnew == 'new'){ |
| 2544 |
if ( version_compare($wp_version, '3.0-beta', '>') ){ |
| 2545 |
if ( !isset($_GET['post_type']) ) |
| 2546 |
$post_type = 'post'; |
| 2547 |
elseif ( in_array( $_GET['post_type'], get_post_types( array('public' => true ) ) ) ) |
| 2548 |
$post_type = $_GET['post_type']; |
| 2549 |
else |
| 2550 |
wp_die( __('Invalid post type') ); |
| 2551 |
$post_type_object = get_post_type_object($post_type); |
| 2552 |
$editing = true; |
| 2553 |
// if ( current_user_can($post_type_object->edit_type_cap) ) { |
| 2554 |
$post = $this->get_default_post_to_edit30( $post_type, true ); |
| 2555 |
$post_ID = $post->ID; |
| 2556 |
// } |
| 2557 |
|
| 2558 |
}else{ |
| 2559 |
$post = $this->get_default_post_to_edit(); |
| 2560 |
} |
| 2561 |
}else{ |
| 2562 |
if ( version_compare($wp_version, '3.0-beta', '>') ){ |
| 2563 |
if ( isset($_GET['post']) ) |
| 2564 |
$post_id = (int) $_GET['post']; |
| 2565 |
elseif ( isset($_POST['post_ID']) ) |
| 2566 |
$post_id = (int) $_POST['post_ID']; |
| 2567 |
else |
| 2568 |
$post_id = 0; |
| 2569 |
$post_ID = $post_id; |
| 2570 |
$post = null; |
| 2571 |
$post_type_object = null; |
| 2572 |
$post_type = null; |
| 2573 |
if ( $post_id ) { |
| 2574 |
$post = get_post($post_id); |
| 2575 |
if ( $post ) { |
| 2576 |
$post_type_object = get_post_type_object($post->post_type); |
| 2577 |
if ( $post_type_object ) { |
| 2578 |
$post_type = $post->post_type; |
| 2579 |
if( !isset($current_screen) ){ |
| 2580 |
$current_screen = new stdClass(); |
| 2581 |
} |
| 2582 |
$current_screen->post_type = $post->post_type; |
| 2583 |
$current_screen->id = $current_screen->post_type; |
| 2584 |
} |
| 2585 |
} |
| 2586 |
} elseif ( isset($_POST['post_type']) ) { |
| 2587 |
$post_type_object = get_post_type_object($_POST['post_type']); |
| 2588 |
if ( $post_type_object ) { |
| 2589 |
$post_type = $post_type_object->name; |
| 2590 |
$current_screen->post_type = $post_type; |
| 2591 |
$current_screen->id = $current_screen->post_type; |
| 2592 |
} |
| 2593 |
} |
| 2594 |
|
| 2595 |
|
| 2596 |
// $post = get_post( $post_id, OBJECT, 'edit' ); |
| 2597 |
// if ( $post->post_type == 'page' ) |
| 2598 |
// $post->page_template = get_post_meta( $id, '_wp_page_template', true ); |
| 2599 |
|
| 2600 |
}else{ |
| 2601 |
if(isset($_GET['post'])){ |
| 2602 |
$post_ID = (int) $_GET['post']; |
| 2603 |
$post = get_post($post_ID); |
| 2604 |
}else{ |
| 2605 |
$post_ID = isset($_REQUEST['post_ID']) ? (int) $_REQUEST['post_ID'] : 0; |
| 2606 |
if(!empty($post_ID)) |
| 2607 |
$post = get_post($post_ID); |
| 2608 |
} |
| 2609 |
} |
| 2610 |
// global $wp_query, $usces_action, $post; |
| 2611 |
|
| 2612 |
} |
| 2613 |
$editing = true; |
| 2614 |
wp_enqueue_script('autosave'); |
| 2615 |
wp_enqueue_script('post'); |
| 2616 |
//if ( user_can_richedit() ) |
| 2617 |
//wp_enqueue_script('editor'); |
| 2618 |
add_thickbox(); |
| 2619 |
wp_enqueue_script('media-upload'); |
| 2620 |
wp_enqueue_script('word-count'); |
| 2621 |
wp_enqueue_script( 'admin-comments' ); |
| 2622 |
|
| 2623 |
if ( version_compare($wp_version, '3.3', '<') ) |
| 2624 |
add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 ); |
| 2625 |
wp_enqueue_script('quicktags'); |
| 2626 |
|
| 2627 |
} |
| 2628 |
|
| 2629 |
|
| 2630 |
if( is_admin() && isset($_REQUEST['page']) ){ |
| 2631 |
|
| 2632 |
wp_enqueue_script('jquery-color'); |
| 2633 |
|
| 2634 |
switch( $_REQUEST['page'] ){ |
| 2635 |
|
| 2636 |
case 'usces_initial': |
| 2637 |
$js = USCES_FRONT_PLUGIN_URL.'/js/usces_initial.js'; |
| 2638 |
wp_enqueue_script('usces_initial.js', $js, array('jquery-ui-dialog', 'jquery-ui-sortable')); |
| 2639 |
//wp_enqueue_script('jquery-ui-sortable'); |
| 2640 |
break; |
| 2641 |
case 'usces_settlement': |
| 2642 |
wp_enqueue_script('jquery-ui-tabs', array('jquery-ui-core')); |
| 2643 |
$jquery_cookieUrl = USCES_FRONT_PLUGIN_URL.'/js/jquery/jquery.cookie.js'; |
| 2644 |
wp_enqueue_script( 'jquery-cookie', $jquery_cookieUrl, array('jquery') ); |
| 2645 |
$jquery_colorUrl = USCES_FRONT_PLUGIN_URL.'/js/jquery/color/jscolor.js'; |
| 2646 |
wp_enqueue_script( 'jquery-jscolor', $jquery_colorUrl, array('jquery-color') ); |
| 2647 |
break; |
| 2648 |
case 'usces_cart': |
| 2649 |
wp_enqueue_script('jquery-ui-tabs', array('jquery-ui-core')); |
| 2650 |
$jquery_cookieUrl = USCES_FRONT_PLUGIN_URL.'/js/jquery/jquery.cookie.js'; |
| 2651 |
wp_enqueue_script( 'jquery-cookie', $jquery_cookieUrl, array('jquery') ); |
| 2652 |
break; |
| 2653 |
case 'usces_member': |
| 2654 |
wp_enqueue_script('jquery-ui-tabs', array('jquery-ui-core')); |
| 2655 |
$jquery_cookieUrl = USCES_FRONT_PLUGIN_URL.'/js/jquery/jquery.cookie.js'; |
| 2656 |
wp_enqueue_script( 'jquery-cookie', $jquery_cookieUrl, array('jquery') ); |
| 2657 |
break; |
| 2658 |
case 'usces_orderlist': |
| 2659 |
case 'usces_ordernew': |
| 2660 |
wp_enqueue_script('jquery-ui-dialog'); |
| 2661 |
break; |
| 2662 |
case 'usces_memberlist': |
| 2663 |
wp_enqueue_script('jquery-ui-dialog'); |
| 2664 |
break; |
| 2665 |
case 'usces_itemnew': |
| 2666 |
wp_enqueue_script('jquery-ui-sortable'); |
| 2667 |
break; |
| 2668 |
case 'usces_itemedit': |
| 2669 |
if( isset($_REQUEST['action']) && 'upload_register' == $_REQUEST['action'] ){ |
| 2670 |
@ob_end_clean(); |
| 2671 |
ob_start(); |
| 2672 |
}else{ |
| 2673 |
wp_enqueue_script('jquery-ui-sortable'); |
| 2674 |
wp_enqueue_script('jquery-ui-dialog'); |
| 2675 |
} |
| 2676 |
break; |
| 2677 |
case 'usces_delivery': |
| 2678 |
wp_enqueue_script('jquery-ui-tabs', array('jquery-ui-core')); |
| 2679 |
$jquery_cookieUrl = USCES_FRONT_PLUGIN_URL.'/js/jquery/jquery.cookie.js'; |
| 2680 |
wp_enqueue_script( 'jquery-cookie', $jquery_cookieUrl, array('jquery') ); |
| 2681 |
break; |
| 2682 |
case 'usces_system': |
| 2683 |
wp_enqueue_script('jquery-ui-tabs', array('jquery-ui-core')); |
| 2684 |
$jquery_cookieUrl = USCES_FRONT_PLUGIN_URL.'/js/jquery/jquery.cookie.js'; |
| 2685 |
wp_enqueue_script( 'jquery-cookie', $jquery_cookieUrl, array('jquery') ); |
| 2686 |
break; |
| 2687 |
} |
| 2688 |
} |
| 2689 |
|
| 2690 |
if( isset($_REQUEST['order_action']) && $_REQUEST['order_action'] == 'pdfout' ){ |
| 2691 |
$this->get_current_member(); |
| 2692 |
$mid = $this->current_member['id']; |
| 2693 |
$oid = $_GET['order_id']; |
| 2694 |
if( !is_user_logged_in() && !$this->is_order($mid, $oid) ) |
| 2695 |
die('No permission'); |
| 2696 |
require_once( apply_filters('usces_filter_orderpdf_path', USCES_PLUGIN_DIR . '/includes/order_print.php') ); |
| 2697 |
} |
| 2698 |
|
| 2699 |
do_action( 'usces_after_main' ); |
| 2700 |
} |
| 2701 |
|
| 2702 |
function stripslashes_deep_post( $array ){ |
| 2703 |
$res = array(); |
| 2704 |
foreach( $array as $key => $value ){ |
| 2705 |
$key = stripslashes($key); |
| 2706 |
if( is_array($value) ){ |
| 2707 |
$value = $this->stripslashes_deep_post( $value ); |
| 2708 |
}else{ |
| 2709 |
$value = stripslashes($value); |
| 2710 |
} |
| 2711 |
$res[$key] = $value; |
| 2712 |
} |
| 2713 |
return $res; |
| 2714 |
} |
| 2715 |
|
| 2716 |
function make_url(){ |
| 2717 |
|
| 2718 |
$permalink_structure = get_option('permalink_structure'); |
| 2719 |
//usces_log('use_ssl : '.$this->use_ssl, 'acting_transaction.log'); |
| 2720 |
if($this->use_ssl) { |
| 2721 |
if( $permalink_structure ){ |
| 2722 |
$this->delim = '&'; |
| 2723 |
$home_perse = parse_url(get_option('home')); |
| 2724 |
$home_perse_path = isset($home_perse['path']) ? $home_perse['path'] : ''; |
| 2725 |
$home_path = $home_perse['host'].$home_perse_path; |
| 2726 |
$ssl_perse = parse_url($this->options['ssl_url']); |
| 2727 |
$ssl_perse_path = isset($ssl_perse['path']) ? $ssl_perse['path'] : ''; |
| 2728 |
$ssl_path = $ssl_perse['host'].$ssl_perse_path; |
| 2729 |
if( $home_perse_path != $ssl_perse_path ){ |
| 2730 |
if( ! defined('USCES_CUSTOMER_URL') ) |
| 2731 |
define('USCES_CUSTOMER_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_CART_NUMBER . '&customerinfo=1&uscesid=' . $this->get_uscesid()); |
| 2732 |
if( ! defined('USCES_CART_URL') ) |
| 2733 |
define('USCES_CART_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_CART_NUMBER . '&uscesid=' . $this->get_uscesid()); |
| 2734 |
if( ! defined('USCES_LOSTMEMBERPASSWORD_URL') ) |
| 2735 |
define('USCES_LOSTMEMBERPASSWORD_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid() . '&page=lostmemberpassword'); |
| 2736 |
if( ! defined('USCES_NEWMEMBER_URL') ) |
| 2737 |
define('USCES_NEWMEMBER_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid() . '&page=newmember'); |
| 2738 |
if( ! defined('USCES_LOGIN_URL') ) |
| 2739 |
define('USCES_LOGIN_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid() . '&page=login'); |
| 2740 |
if( ! defined('USCES_LOGOUT_URL') ) |
| 2741 |
define('USCES_LOGOUT_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid() . '&page=logout'); |
| 2742 |
if( ! defined('USCES_MEMBER_URL') ) |
| 2743 |
define('USCES_MEMBER_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid()); |
| 2744 |
$inquiry_url = empty( $this->options['inquiry_id'] ) ? '' : $this->options['ssl_url'] . '/index.php?page_id=' . $this->options['inquiry_id'] . '&uscesid=' . $this->get_uscesid(); |
| 2745 |
if( ! defined('USCES_INQUIRY_URL') ) |
| 2746 |
define('USCES_INQUIRY_URL', $inquiry_url); |
| 2747 |
if( ! defined('USCES_CART_NONSESSION_URL') ) |
| 2748 |
define('USCES_CART_NONSESSION_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_CART_NUMBER); |
| 2749 |
//20110208ysk start |
| 2750 |
//define('USCES_PAYPAL_NOTIFY_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_CART_NUMBER . '&acting_return=paypal_ipn&uscesid=' . $this->get_uscesid(false)); |
| 2751 |
if( ! defined('USCES_PAYPAL_NOTIFY_URL') ) |
| 2752 |
define('USCES_PAYPAL_NOTIFY_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_CART_NUMBER . '&acting=paypal_ipn&uscesid=' . $this->get_uscesid(false)); |
| 2753 |
//20110208ysk end |
| 2754 |
}else{ |
| 2755 |
$ssl_plink_cart = str_replace('http://','https://', str_replace( $home_path, $ssl_path, get_page_link(USCES_CART_NUMBER) )); |
| 2756 |
$ssl_plink_member = str_replace('http://','https://', str_replace( $home_path, $ssl_path, get_page_link(USCES_MEMBER_NUMBER) )); |
| 2757 |
if( ! defined('USCES_CUSTOMER_URL') ) |
| 2758 |
define('USCES_CUSTOMER_URL', $ssl_plink_cart . '?uscesid=' . $this->get_uscesid() . '&customerinfo=1'); |
| 2759 |
if( ! defined('USCES_CART_URL') ) |
| 2760 |
define('USCES_CART_URL', $ssl_plink_cart . '?uscesid=' . $this->get_uscesid()); |
| 2761 |
if( ! defined('USCES_LOSTMEMBERPASSWORD_URL') ) |
| 2762 |
define('USCES_LOSTMEMBERPASSWORD_URL', $ssl_plink_member . '?uscesid=' . $this->get_uscesid() . '&page=lostmemberpassword'); |
| 2763 |
if( ! defined('USCES_NEWMEMBER_URL') ) |
| 2764 |
define('USCES_NEWMEMBER_URL', $ssl_plink_member . '?uscesid=' . $this->get_uscesid(). '&page=newmember'); |
| 2765 |
if( ! defined('USCES_LOGIN_URL') ) |
| 2766 |
define('USCES_LOGIN_URL', $ssl_plink_member . '?uscesid=' . $this->get_uscesid() . '&page=login'); |
| 2767 |
if( ! defined('USCES_LOGOUT_URL') ) |
| 2768 |
define('USCES_LOGOUT_URL', $ssl_plink_member . '?uscesid=' . $this->get_uscesid() . '&page=logout'); |
| 2769 |
if( ! defined('USCES_MEMBER_URL') ) |
| 2770 |
define('USCES_MEMBER_URL', $ssl_plink_member . '?uscesid=' . $this->get_uscesid()); |
| 2771 |
if( !isset($this->options['inquiry_id']) || !( (int)$this->options['inquiry_id'] ) ){ |
| 2772 |
$inquiry_url = get_home_url(); |
| 2773 |
}else{ |
| 2774 |
$ssl_plink_inquiry = str_replace('http://','https://', str_replace( $home_path, $ssl_path, get_page_link($this->options['inquiry_id']) )); |
| 2775 |
$inquiry_url = empty( $this->options['inquiry_id'] ) ? '' : $ssl_plink_inquiry . '?uscesid=' . $this->get_uscesid(); |
| 2776 |
} |
| 2777 |
if( ! defined('USCES_INQUIRY_URL') ) |
| 2778 |
define('USCES_INQUIRY_URL', $inquiry_url); |
| 2779 |
if( ! defined('USCES_CART_NONSESSION_URL') ) |
| 2780 |
define('USCES_CART_NONSESSION_URL', $ssl_plink_cart); |
| 2781 |
//20110208ysk start |
| 2782 |
//define('USCES_PAYPAL_NOTIFY_URL', $ssl_plink_cart . '?acting_return=paypal_ipn&uscesid=' . $this->get_uscesid(false)); |
| 2783 |
if( ! defined('USCES_PAYPAL_NOTIFY_URL') ) |
| 2784 |
define('USCES_PAYPAL_NOTIFY_URL', $ssl_plink_cart . '?acting=paypal_ipn&uscesid=' . $this->get_uscesid(false)); |
| 2785 |
//20110208ysk end |
| 2786 |
} |
| 2787 |
}else{ |
| 2788 |
$this->delim = '&'; |
| 2789 |
if( ! defined('USCES_CUSTOMER_URL') ) |
| 2790 |
define('USCES_CUSTOMER_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_CART_NUMBER . '&customerinfo=1&uscesid=' . $this->get_uscesid()); |
| 2791 |
if( ! defined('USCES_CART_URL') ) |
| 2792 |
define('USCES_CART_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_CART_NUMBER . '&uscesid=' . $this->get_uscesid()); |
| 2793 |
if( ! defined('USCES_LOSTMEMBERPASSWORD_URL') ) |
| 2794 |
define('USCES_LOSTMEMBERPASSWORD_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid() . '&page=lostmemberpassword'); |
| 2795 |
if( ! defined('USCES_NEWMEMBER_URL') ) |
| 2796 |
define('USCES_NEWMEMBER_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid() . '&page=newmember'); |
| 2797 |
if( ! defined('USCES_LOGIN_URL') ) |
| 2798 |
define('USCES_LOGIN_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid() . '&page=login'); |
| 2799 |
if( ! defined('USCES_LOGOUT_URL') ) |
| 2800 |
define('USCES_LOGOUT_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid() . '&page=logout'); |
| 2801 |
if( ! defined('USCES_MEMBER_URL') ) |
| 2802 |
define('USCES_MEMBER_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid()); |
| 2803 |
$inquiry_url = empty( $this->options['inquiry_id'] ) ? '' : $this->options['ssl_url'] . '/?page_id=' . $this->options['inquiry_id'] . '&uscesid=' . $this->get_uscesid(); |
| 2804 |
if( ! defined('USCES_INQUIRY_URL') ) |
| 2805 |
define('USCES_INQUIRY_URL', $inquiry_url); |
| 2806 |
if( ! defined('USCES_CART_NONSESSION_URL') ) |
| 2807 |
define('USCES_CART_NONSESSION_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_CART_NUMBER); |
| 2808 |
//20110208ysk start |
| 2809 |
//define('USCES_PAYPAL_NOTIFY_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_CART_NUMBER . '&acting_return=paypal_ipn&uscesid=' . $this->get_uscesid(false)); |
| 2810 |
if( ! defined('USCES_PAYPAL_NOTIFY_URL') ) |
| 2811 |
define('USCES_PAYPAL_NOTIFY_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_CART_NUMBER . '&acting=paypal_ipn&uscesid=' . $this->get_uscesid(false)); |
| 2812 |
//20110208ysk end |
| 2813 |
} |
| 2814 |
if( !is_admin() ){ |
| 2815 |
add_filter('home_url', array($this, 'usces_ssl_page_link')); |
| 2816 |
add_filter('wp_get_attachment_url', array($this, 'usces_ssl_attachment_link')); |
| 2817 |
add_filter('icon_dir_uri', array($this, 'usces_ssl_icon_dir_uri')); |
| 2818 |
add_filter('stylesheet_directory_uri', array($this, 'usces_ssl_contents_link')); |
| 2819 |
add_filter('template_directory_uri', array($this, 'usces_ssl_contents_link')); |
| 2820 |
add_filter('script_loader_src', array($this, 'usces_ssl_script_link')); |
| 2821 |
add_filter('style_loader_src', array($this, 'usces_ssl_script_link')); |
| 2822 |
} |
| 2823 |
} else { |
| 2824 |
if( $permalink_structure ){ |
| 2825 |
$this->delim = '?'; |
| 2826 |
if( ! defined('USCES_CUSTOMER_URL') ) |
| 2827 |
define('USCES_CUSTOMER_URL', get_page_link(USCES_CART_NUMBER) . '?customerinfo=1'); |
| 2828 |
if( ! defined('USCES_CART_URL') ) |
| 2829 |
define('USCES_CART_URL', get_page_link(USCES_CART_NUMBER)); |
| 2830 |
if( ! defined('USCES_LOSTMEMBERPASSWORD_URL') ) |
| 2831 |
define('USCES_LOSTMEMBERPASSWORD_URL', get_page_link(USCES_MEMBER_NUMBER) . '?page=lostmemberpassword'); |
| 2832 |
if( ! defined('USCES_NEWMEMBER_URL') ) |
| 2833 |
define('USCES_NEWMEMBER_URL', get_page_link(USCES_MEMBER_NUMBER) . '?page=newmember'); |
| 2834 |
if( ! defined('USCES_LOGIN_URL') ) |
| 2835 |
define('USCES_LOGIN_URL', get_page_link(USCES_MEMBER_NUMBER) . '?page=login'); |
| 2836 |
if( ! defined('USCES_LOGOUT_URL') ) |
| 2837 |
define('USCES_LOGOUT_URL', get_page_link(USCES_MEMBER_NUMBER) . '?page=logout'); |
| 2838 |
if( ! defined('USCES_MEMBER_URL') ) |
| 2839 |
define('USCES_MEMBER_URL', get_page_link(USCES_MEMBER_NUMBER)); |
| 2840 |
$inquiry_url = ( !isset( $this->options['inquiry_id'] ) || !( (int)$this->options['inquiry_id'] )) ? get_home_url() : get_page_link($this->options['inquiry_id']); |
| 2841 |
if( ! defined('USCES_INQUIRY_URL') ) |
| 2842 |
define('USCES_INQUIRY_URL', $inquiry_url); |
| 2843 |
if( ! defined('USCES_CART_NONSESSION_URL') ) |
| 2844 |
define('USCES_CART_NONSESSION_URL', get_page_link(USCES_CART_NUMBER)); |
| 2845 |
//20110208ysk start |
| 2846 |
//define('USCES_PAYPAL_NOTIFY_URL', get_page_link(USCES_CART_NUMBER) . '?acting_return=paypal_ipn&uscesid=' . $this->get_uscesid(false)); |
| 2847 |
if( ! defined('USCES_PAYPAL_NOTIFY_URL') ) |
| 2848 |
define('USCES_PAYPAL_NOTIFY_URL', get_page_link(USCES_CART_NUMBER) . '?acting=paypal_ipn&uscesid=' . $this->get_uscesid(false)); |
| 2849 |
//20110208ysk end |
| 2850 |
}else{ |
| 2851 |
$this->delim = '&'; |
| 2852 |
if( ! defined('USCES_CUSTOMER_URL') ) |
| 2853 |
define('USCES_CUSTOMER_URL', get_option('home') . '/?page_id=' . USCES_CART_NUMBER . '&customerinfo=1'); |
| 2854 |
if( ! defined('USCES_CART_URL') ) |
| 2855 |
define('USCES_CART_URL', get_option('home') . '/?page_id=' . USCES_CART_NUMBER); |
| 2856 |
if( ! defined('USCES_LOSTMEMBERPASSWORD_URL') ) |
| 2857 |
define('USCES_LOSTMEMBERPASSWORD_URL', get_option('home') . '/?page_id=' . USCES_MEMBER_NUMBER . '&page=lostmemberpassword'); |
| 2858 |
if( ! defined('USCES_NEWMEMBER_URL') ) |
| 2859 |
define('USCES_NEWMEMBER_URL', get_option('home') . '/?page_id=' . USCES_MEMBER_NUMBER . '&page=newmember'); |
| 2860 |
if( ! defined('USCES_LOGIN_URL') ) |
| 2861 |
define('USCES_LOGIN_URL', get_option('home') . '/?page_id=' . USCES_MEMBER_NUMBER . '&page=login'); |
| 2862 |
if( ! defined('USCES_LOGOUT_URL') ) |
| 2863 |
define('USCES_LOGOUT_URL', get_option('home') . '/?page_id=' . USCES_MEMBER_NUMBER . '&page=logout'); |
| 2864 |
if( ! defined('USCES_CART_NONSESSION_URL') ) |
| 2865 |
define('USCES_CART_NONSESSION_URL', get_option('home') . '/?page_id=' . USCES_MEMBER_NUMBER . '&page=logout'); |
| 2866 |
if( ! defined('USCES_MEMBER_URL') ) |
| 2867 |
define('USCES_MEMBER_URL', get_option('home') . '/?page_id=' . USCES_MEMBER_NUMBER); |
| 2868 |
$inquiry_url = empty( $this->options['inquiry_id'] ) ? '' : get_option('home') . '/?page_id=' . $this->options['inquiry_id']; |
| 2869 |
if( ! defined('USCES_INQUIRY_URL') ) |
| 2870 |
define('USCES_INQUIRY_URL', $inquiry_url); |
| 2871 |
if( ! defined('USCES_CART_NONSESSION_URL') ) |
| 2872 |
define('USCES_CART_NONSESSION_URL', get_option('home') . '/?page_id=' . USCES_CART_NUMBER); |
| 2873 |
//20110208ysk start |
| 2874 |
//define('USCES_PAYPAL_NOTIFY_URL', get_option('home') . '/?page_id=' . USCES_CART_NUMBER . '&acting_return=paypal_ipn&uscesid=' . $this->get_uscesid(false)); |
| 2875 |
if( ! defined('USCES_PAYPAL_NOTIFY_URL') ) |
| 2876 |
define('USCES_PAYPAL_NOTIFY_URL', get_option('home') . '/?page_id=' . USCES_CART_NUMBER . '&acting=paypal_ipn&uscesid=' . $this->get_uscesid(false)); |
| 2877 |
//20110208ysk end |
| 2878 |
} |
| 2879 |
} |
| 2880 |
} |
| 2881 |
|
| 2882 |
function regist_action(){ |
| 2883 |
usces_register_action('inCart', 'post', 'inCart', NULL, 'inCart'); |
| 2884 |
usces_register_action('upButton', 'post', 'upButton', NULL, 'upButton'); |
| 2885 |
usces_register_action('delButton', 'post', 'delButton', NULL, 'delButton'); |
| 2886 |
usces_register_action('backCart', 'post', 'backCart', NULL, 'backCart'); |
| 2887 |
usces_register_action('customerinfo', 'request', 'customerinfo', NULL, 'customerinfo'); |
| 2888 |
usces_register_action('backCustomer', 'post', 'backCustomer', NULL, 'backCustomer'); |
| 2889 |
usces_register_action('customerlogin', 'post', 'customerlogin', NULL, 'customerlogin'); |
| 2890 |
usces_register_action('reganddeliveryinfo', 'post', 'reganddeliveryinfo', NULL, 'reganddeliveryinfo'); |
| 2891 |
usces_register_action('deliveryinfo', 'post', 'deliveryinfo', NULL, 'deliveryinfo'); |
| 2892 |
usces_register_action('backDelivery', 'post', 'backDelivery', NULL, 'backDelivery'); |
| 2893 |
usces_register_action('confirm', 'request', 'confirm', NULL, 'confirm'); |
| 2894 |
usces_register_action('use_point', 'post', 'use_point', NULL, 'use_point'); |
| 2895 |
usces_register_action('backConfirm', 'post', 'backConfirm', NULL, 'backConfirm'); |
| 2896 |
usces_register_action('purchase', 'request', 'purchase', NULL, 'purchase'); |
| 2897 |
usces_register_action('acting_return', 'request', 'acting_return', NULL, 'acting_return'); |
| 2898 |
usces_register_action('settlement_epsilon', 'request', 'settlement', 'epsilon', 'settlement_epsilon'); |
| 2899 |
usces_register_action('inquiry_button', 'post', 'inquiry_button', NULL, 'inquiry_button'); |
| 2900 |
usces_register_action('member_login', 'request', 'member_login', NULL, 'member_login_page'); |
| 2901 |
usces_register_action('regmember', 'request', 'regmember', NULL, 'regmember'); |
| 2902 |
usces_register_action('editmember', 'request', 'editmember', NULL, 'editmember'); |
| 2903 |
usces_register_action('deletemember', 'request', 'deletemember', NULL, 'deletemember'); |
| 2904 |
usces_register_action('page_login', 'get', 'page', 'login', 'member_login_page'); |
| 2905 |
usces_register_action('page_logout', 'get', 'page', 'logout', 'page_logout'); |
| 2906 |
usces_register_action('page_lostmemberpassword', 'get', 'page', 'lostmemberpassword', 'page_lostmemberpassword'); |
| 2907 |
usces_register_action('lostpassword', 'request', 'lostpassword', NULL, 'lostpassword'); |
| 2908 |
usces_register_action('uscesmode_changepassword', 'request', 'uscesmode', 'changepassword', 'uscesmode_changepassword'); |
| 2909 |
usces_register_action('changepassword', 'request', 'changepassword', NULL, 'changepassword_page'); |
| 2910 |
usces_register_action('page_newmember', 'get', 'page', 'newmember', 'page_newmember'); |
| 2911 |
usces_register_action('usces_export', 'post', 'usces_export', NULL, 'usces_export'); |
| 2912 |
usces_register_action('usces_import', 'post', 'usces_import', NULL, 'usces_import'); |
| 2913 |
usces_register_action('page_search_item', 'get', 'page', 'search_item', 'page_search_item'); |
| 2914 |
usces_register_action('front_ajax', 'post', 'usces_ajax_action', NULL, 'front_ajax'); |
| 2915 |
} |
| 2916 |
|
| 2917 |
function ad_controller(){ |
| 2918 |
global $usces_action; |
| 2919 |
ksort($usces_action); |
| 2920 |
//if($this->is_maintenance()){ |
| 2921 |
if($this->is_maintenance() and !is_user_logged_in()){//0000651 |
| 2922 |
$this->maintenance(); |
| 2923 |
}else{ |
| 2924 |
$action_array = array('inCart', 'upButton', 'delButton', 'backCart', 'customerinfo', 'backCustomer', |
| 2925 |
'customerlogin', 'reganddeliveryinfo', 'deliveryinfo', 'backDelivery', 'confirm', 'use_point', |
| 2926 |
'backConfirm', 'purchase', 'acting_return', 'settlement_epsilon', 'inquiry_button', 'member_login', |
| 2927 |
'regmember', 'editmember', 'deletemember', 'page_login', 'page_logout', 'page_lostmemberpassword', 'lostpassword', |
| 2928 |
'uscesmode_changepassword', 'changepassword', 'page_newmember', 'usces_export', 'usces_import', |
| 2929 |
'page_search_item', 'front_ajax'); |
| 2930 |
$flg = 0; |
| 2931 |
$res = true; |
| 2932 |
foreach( $usces_action as $handle => $action ){ |
| 2933 |
extract($action); |
| 2934 |
switch($type){ |
| 2935 |
case 'post': |
| 2936 |
if( empty($value) ){ |
| 2937 |
if( isset($_POST[$key]) ){ |
| 2938 |
if(in_array($handle, $action_array)){ |
| 2939 |
$res = call_user_func(array($this, $function)); |
| 2940 |
}else{ |
| 2941 |
$res = call_user_func($function); |
| 2942 |
} |
| 2943 |
$flg = 1; |
| 2944 |
} |
| 2945 |
}else{ |
| 2946 |
if( isset($_POST[$key]) && $_POST[$key] == $value ){ |
| 2947 |
if(in_array($handle, $action_array)){ |
| 2948 |
$res = call_user_func(array($this, $function)); |
| 2949 |
}else{ |
| 2950 |
$res = call_user_func($function); |
| 2951 |
} |
| 2952 |
$flg = 1; |
| 2953 |
} |
| 2954 |
} |
| 2955 |
break; |
| 2956 |
case 'get': |
| 2957 |
if( empty($value) ){ |
| 2958 |
if( isset($_GET[$key]) ){ |
| 2959 |
if(in_array($handle, $action_array)){ |
| 2960 |
$res = call_user_func(array($this, $function)); |
| 2961 |
}else{ |
| 2962 |
$res = call_user_func($function); |
| 2963 |
} |
| 2964 |
$flg = 1; |
| 2965 |
} |
| 2966 |
}else{ |
| 2967 |
if( isset($_GET[$key]) && $_GET[$key] == $value ){ |
| 2968 |
if(in_array($handle, $action_array)){ |
| 2969 |
$res = call_user_func(array($this, $function)); |
| 2970 |
}else{ |
| 2971 |
$res = call_user_func($function); |
| 2972 |
} |
| 2973 |
$flg = 1; |
| 2974 |
} |
| 2975 |
} |
| 2976 |
break; |
| 2977 |
case 'request': |
| 2978 |
if( empty($value) ){ |
| 2979 |
if( isset($_REQUEST[$key]) ){ |
| 2980 |
if(in_array($handle, $action_array)){ |
| 2981 |
$res = call_user_func(array($this, $function)); |
| 2982 |
}else{ |
| 2983 |
$res = call_user_func($function); |
| 2984 |
} |
| 2985 |
$flg = 1; |
| 2986 |
} |
| 2987 |
}else{ |
| 2988 |
if( isset($_REQUEST[$key]) && $_REQUEST[$key] == $value ){ |
| 2989 |
if(in_array($handle, $action_array)){ |
| 2990 |
$res = call_user_func(array($this, $function)); |
| 2991 |
}else{ |
| 2992 |
$res = call_user_func($function); |
| 2993 |
} |
| 2994 |
$flg = 1; |
| 2995 |
} |
| 2996 |
} |
| 2997 |
break; |
| 2998 |
} |
| 2999 |
if( ! $res ) break; |
| 3000 |
} |
| 3001 |
if( !$flg ) $this->default_page(); |
| 3002 |
} |
| 3003 |
} |
| 3004 |
|
| 3005 |
//action function------------------------------------------------------------ |
| 3006 |
function front_ajax(){ |
| 3007 |
switch ($_POST['usces_ajax_action']){ |
| 3008 |
case 'change_states': |
| 3009 |
change_states_ajax(); |
| 3010 |
break; |
| 3011 |
} |
| 3012 |
do_action('usces_front_ajax'); |
| 3013 |
} |
| 3014 |
|
| 3015 |
function maintenance(){ |
| 3016 |
$this->page = 'maintenance'; |
| 3017 |
add_action('the_post', array($this, 'action_cartFilter')); |
| 3018 |
} |
| 3019 |
|
| 3020 |
function inCart(){ |
| 3021 |
global $wp_query; |
| 3022 |
$this->page = 'cart'; |
| 3023 |
$this->incart_check(); |
| 3024 |
$this->cart->inCart(); |
| 3025 |
add_action('the_post', array($this, 'action_cartFilter')); |
| 3026 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_cart'); |
| 3027 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3028 |
} |
| 3029 |
|
| 3030 |
function upButton(){ |
| 3031 |
global $wp_query; |
| 3032 |
$this->page = 'cart'; |
| 3033 |
$this->cart->upCart(); |
| 3034 |
$this->error_message = $this->zaiko_check(); |
| 3035 |
add_action('the_post', array($this, 'action_cartFilter')); |
| 3036 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_cart'); |
| 3037 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3038 |
} |
| 3039 |
|
| 3040 |
function delButton(){ |
| 3041 |
global $wp_query; |
| 3042 |
$this->page = 'cart'; |
| 3043 |
$this->cart->del_row(); |
| 3044 |
add_action('the_post', array($this, 'action_cartFilter')); |
| 3045 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_cart'); |
| 3046 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3047 |
} |
| 3048 |
|
| 3049 |
function backCart(){ |
| 3050 |
global $wp_query; |
| 3051 |
$this->page = 'cart'; |
| 3052 |
add_action('the_post', array($this, 'action_cartFilter')); |
| 3053 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_cart'); |
| 3054 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3055 |
} |
| 3056 |
|
| 3057 |
function customerinfo(){ |
| 3058 |
global $wp_query; |
| 3059 |
if( false === $this->cart->num_row() ){ |
| 3060 |
header('location: ' . get_option('home')); |
| 3061 |
exit; |
| 3062 |
} |
| 3063 |
do_action( 'usces_action_customerinfo' ); |
| 3064 |
$this->cart->entry(); |
| 3065 |
$this->error_message = $this->zaiko_check(); |
| 3066 |
$this->error_message = apply_filters( 'usces_filter_cart_check', $this->error_message ); |
| 3067 |
if( WCUtils::is_blank($this->error_message) ){ |
| 3068 |
if($this->is_member_logged_in()){ |
| 3069 |
//20100818ysk start |
| 3070 |
//$this->page = 'delivery'; |
| 3071 |
$this->error_message = has_custom_customer_field_essential(); |
| 3072 |
$this->page = ( WCUtils::is_blank($this->error_message) ) ? 'delivery' : 'customer'; |
| 3073 |
//20100818ysk end |
| 3074 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_delivery'); |
| 3075 |
}else{ |
| 3076 |
$this->page = 'customer'; |
| 3077 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_customer'); |
| 3078 |
} |
| 3079 |
}else{ |
| 3080 |
$this->page = 'cart'; |
| 3081 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_cart'); |
| 3082 |
} |
| 3083 |
if ( !$this->cart->is_order_condition() ) { |
| 3084 |
$order_conditions = $this->get_condition(); |
| 3085 |
$this->cart->set_order_condition($order_conditions); |
| 3086 |
} |
| 3087 |
add_action('the_post', array($this, 'action_cartFilter')); |
| 3088 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3089 |
} |
| 3090 |
|
| 3091 |
function backCustomer(){ |
| 3092 |
global $wp_query; |
| 3093 |
if( false === $this->cart->num_row() ){ |
| 3094 |
header('location: ' . get_option('home')); |
| 3095 |
exit; |
| 3096 |
} |
| 3097 |
$this->page = apply_filters( 'usces_filter_backCustomer_page', 'customer' ); |
| 3098 |
add_action('the_post', array($this, 'action_cartFilter')); |
| 3099 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_customer'); |
| 3100 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3101 |
// $this->cart->entry(); |
| 3102 |
// $this->error_message = $this->delivery_check(); |
| 3103 |
// $this->page = ($this->error_message == '') ? 'customer' : 'delivery'; |
| 3104 |
} |
| 3105 |
|
| 3106 |
function customerlogin(){ |
| 3107 |
global $wp_query; |
| 3108 |
if( false === $this->cart->num_row() ){ |
| 3109 |
header('location: ' . get_option('home')); |
| 3110 |
exit; |
| 3111 |
} |
| 3112 |
//20100818ysk start |
| 3113 |
//$this->cart->entry(); |
| 3114 |
//$this->page = ($this->member_login() == 'member') ? 'delivery' : 'customer'; |
| 3115 |
if($this->member_login() == 'member') { |
| 3116 |
$this->cart->entry(); |
| 3117 |
$this->error_message = has_custom_customer_field_essential(); |
| 3118 |
if( WCUtils::is_blank($this->error_message) ){ |
| 3119 |
$this->page = 'delivery'; |
| 3120 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_delivery'); |
| 3121 |
}else{ |
| 3122 |
$this->page = 'customer'; |
| 3123 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_customer'); |
| 3124 |
} |
| 3125 |
} else { |
| 3126 |
$this->cart->entry(); |
| 3127 |
$this->page = 'customer'; |
| 3128 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_customer'); |
| 3129 |
} |
| 3130 |
//20100818ysk end |
| 3131 |
add_action('the_post', array($this, 'action_cartFilter')); |
| 3132 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3133 |
} |
| 3134 |
|
| 3135 |
function reganddeliveryinfo(){ |
| 3136 |
global $wp_query; |
| 3137 |
if( false === $this->cart->num_row() ){ |
| 3138 |
header('location: ' . get_option('home')); |
| 3139 |
exit; |
| 3140 |
} |
| 3141 |
$this->cart->entry(); |
| 3142 |
//20110715ysk start 0000203 |
| 3143 |
//$_POST['member_regmode'] = 'newmemberfromcart'; |
| 3144 |
if(empty($_POST['member_regmode']) or $_POST['member_regmode'] != 'editmemberfromcart') $_POST['member_regmode'] = 'newmemberfromcart'; |
| 3145 |
//20110715ysk end |
| 3146 |
|
| 3147 |
if( $this->regist_member() == 'newcompletion' ){ |
| 3148 |
$this->page = 'delivery'; |
| 3149 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_delivery'); |
| 3150 |
}else{ |
| 3151 |
$this->page = 'customer'; |
| 3152 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_customer'); |
| 3153 |
} |
| 3154 |
add_action('the_post', array($this, 'action_cartFilter')); |
| 3155 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3156 |
} |
| 3157 |
|
| 3158 |
function deliveryinfo(){ |
| 3159 |
global $wp_query; |
| 3160 |
if( false === $this->cart->num_row() ){ |
| 3161 |
header('location: ' . get_option('home')); |
| 3162 |
exit; |
| 3163 |
} |
| 3164 |
$this->cart->entry(); |
| 3165 |
$this->error_message = $this->customer_check(); |
| 3166 |
|
| 3167 |
if( WCUtils::is_blank($this->error_message) ){ |
| 3168 |
$this->page = 'delivery'; |
| 3169 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_delivery'); |
| 3170 |
}else{ |
| 3171 |
$this->page = 'customer'; |
| 3172 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_customer'); |
| 3173 |
} |
| 3174 |
add_action('the_post', array($this, 'action_cartFilter')); |
| 3175 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3176 |
} |
| 3177 |
|
| 3178 |
function backDelivery(){ |
| 3179 |
global $wp_query; |
| 3180 |
if( false === $this->cart->num_row() ){ |
| 3181 |
header('location: ' . get_option('home')); |
| 3182 |
exit; |
| 3183 |
} |
| 3184 |
$this->page = 'delivery'; |
| 3185 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_delivery'); |
| 3186 |
add_action('the_post', array($this, 'action_cartFilter')); |
| 3187 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3188 |
} |
| 3189 |
|
| 3190 |
function confirm(){ |
| 3191 |
global $wpdb, $wp_query; |
| 3192 |
if( false === $this->cart->num_row() ){ |
| 3193 |
header('location: ' . get_option('home')); |
| 3194 |
exit; |
| 3195 |
} |
| 3196 |
|
| 3197 |
$this->cart->entry(); |
| 3198 |
$this->error_message = $this->zaiko_check(); |
| 3199 |
if( $this->error_message != '' ){ |
| 3200 |
$this->page = 'cart'; |
| 3201 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_cart'); |
| 3202 |
add_action('the_post', array($this, 'action_cartFilter')); |
| 3203 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3204 |
return; |
| 3205 |
} |
| 3206 |
|
| 3207 |
$this->set_reserve_pre_order_id(); |
| 3208 |
if(isset($_POST['confirm'])){ |
| 3209 |
$this->error_message = $this->delivery_check(); |
| 3210 |
} |
| 3211 |
$this->page = ( WCUtils::is_blank($this->error_message) ) ? 'confirm' : 'delivery'; |
| 3212 |
if( WCUtils::is_blank($this->error_message) ){ |
| 3213 |
//20120919ysk start 0000573 |
| 3214 |
if( usces_is_member_system() && usces_is_member_system_point() && $this->is_member_logged_in() ) { |
| 3215 |
$member_table = $wpdb->prefix."usces_member"; |
| 3216 |
$query = $wpdb->prepare("SELECT mem_point FROM $member_table WHERE ID = %d", $_SESSION['usces_member']['ID']); |
| 3217 |
$mem_point = $wpdb->get_var( $query ); |
| 3218 |
$_SESSION['usces_member']['point'] = $mem_point; |
| 3219 |
} |
| 3220 |
//20120919ysk end |
| 3221 |
$this->page = 'confirm'; |
| 3222 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_confirm'); |
| 3223 |
}else{ |
| 3224 |
$this->page = 'delivery'; |
| 3225 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_delivery'); |
| 3226 |
} |
| 3227 |
add_action('the_post', array($this, 'action_cartFilter')); |
| 3228 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3229 |
} |
| 3230 |
|
| 3231 |
function use_point(){ |
| 3232 |
global $wp_query; |
| 3233 |
$this->error_message = $this->point_check( $this->cart->get_entry() ); |
| 3234 |
if( empty($this->error_message) ) |
| 3235 |
$this->cart->entry(); |
| 3236 |
$this->page = 'confirm'; |
| 3237 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_confirm'); |
| 3238 |
add_action('the_post', array($this, 'action_cartFilter')); |
| 3239 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3240 |
} |
| 3241 |
|
| 3242 |
function backConfirm(){ |
| 3243 |
global $wp_query; |
| 3244 |
if( false === $this->cart->num_row() ){ |
| 3245 |
header('location: ' . get_option('home')); |
| 3246 |
exit; |
| 3247 |
} |
| 3248 |
$this->page = 'confirm'; |
| 3249 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_confirm'); |
| 3250 |
add_action('the_post', array($this, 'action_cartFilter')); |
| 3251 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3252 |
} |
| 3253 |
|
| 3254 |
function purchase(){ |
| 3255 |
global $wp_query; |
| 3256 |
if( false === $this->cart->num_row() ){ |
| 3257 |
header('location: ' . get_option('home')); |
| 3258 |
exit; |
| 3259 |
} |
| 3260 |
|
| 3261 |
if( !apply_filters('usces_purchase_check', true) ) return; |
| 3262 |
|
| 3263 |
do_action('usces_purchase_validate'); |
| 3264 |
$entry = $this->cart->get_entry(); |
| 3265 |
$this->error_message = $this->zaiko_check(); |
| 3266 |
if( WCUtils::is_blank($this->error_message) && 0 < $this->cart->num_row()){ |
| 3267 |
$acting_status = ''; |
| 3268 |
$payments = $this->getPayments( $entry['order']['payment_name'] ); |
| 3269 |
if( substr($payments['settlement'], 0, 6) == 'acting' && $entry['order']['total_full_price'] > 0 ){ |
| 3270 |
$acting_flg = ( 'acting' == $payments['settlement'] ) ? $payments['module'] : $payments['settlement']; |
| 3271 |
//$query = ''; |
| 3272 |
//foreach($_POST as $key => $value){ |
| 3273 |
// if($key != 'purchase') |
| 3274 |
// $query .= '&' . $key . '=' . urlencode(maybe_serialize($value)); |
| 3275 |
//} |
| 3276 |
unset( $_POST['purchase'] ); |
| 3277 |
$query = '&'.http_build_query( $_POST ); |
| 3278 |
$acting_status = $this->acting_processing($acting_flg, $query); |
| 3279 |
} |
| 3280 |
|
| 3281 |
if($acting_status == 'error'){ |
| 3282 |
$this->page = 'error'; |
| 3283 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_error'); |
| 3284 |
}else{ |
| 3285 |
$res = $this->order_processing(); |
| 3286 |
if( 'ordercompletion' == $res ){ |
| 3287 |
$this->page = 'ordercompletion'; |
| 3288 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_ordercompletion'); |
| 3289 |
}else{ |
| 3290 |
$this->page = 'error'; |
| 3291 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_error'); |
| 3292 |
} |
| 3293 |
} |
| 3294 |
}else{ |
| 3295 |
$this->page = 'cart'; |
| 3296 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_cart'); |
| 3297 |
} |
| 3298 |
add_action('the_post', array($this, 'action_cartFilter')); |
| 3299 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3300 |
} |
| 3301 |
|
| 3302 |
function acting_return(){ |
| 3303 |
global $wp_query; |
| 3304 |
$entry = $this->cart->get_entry(); |
| 3305 |
|
| 3306 |
//20110208ysk start |
| 3307 |
/* if( 'paypal_ipn' == $_REQUEST['acting_return'] ){ |
| 3308 |
usces_log('paypal_ipn in ', 'acting_transaction.log'); |
| 3309 |
require_once($this->options['settlement_path'] . 'paypal.php'); |
| 3310 |
$ipn_res = paypal_ipn_check($usces_paypal_url); |
| 3311 |
if( $ipn_res[0] === true ){ |
| 3312 |
$res = $this->order_processing( $ipn_res ); |
| 3313 |
if( 'ordercompletion' == $res ){ |
| 3314 |
$this->cart->crear_cart(); |
| 3315 |
}else{ |
| 3316 |
usces_log('paypal_ipn regorder error (acting_return) : '.print_r($entry, true), 'acting_transaction.log'); |
| 3317 |
} |
| 3318 |
} |
| 3319 |
exit; |
| 3320 |
}*/ |
| 3321 |
//20110208ysk end |
| 3322 |
if( isset($_GET['acting']) and 'anotherlane_card' != $_GET['acting'] ) {//20131220ysk |
| 3323 |
if( false === $this->cart->num_row() && ('paypal' != $_GET['acting'] && 1 !== (int)$_GET['acting_return']) ){ |
| 3324 |
header('location: ' . get_option('home')); |
| 3325 |
exit; |
| 3326 |
} |
| 3327 |
}//20131220ysk |
| 3328 |
|
| 3329 |
$this->payment_results = usces_check_acting_return(); |
| 3330 |
|
| 3331 |
if( isset($this->payment_results[0]) && $this->payment_results[0] === 'duplicate' ){ |
| 3332 |
|
| 3333 |
header('location: ' . get_option('home')); |
| 3334 |
exit; |
| 3335 |
|
| 3336 |
}else if( isset($this->payment_results[0]) && $this->payment_results[0] ){//result OK |
| 3337 |
|
| 3338 |
if( ! $this->payment_results['reg_order'] ){//without Registration Order |
| 3339 |
$this->page = 'ordercompletion'; |
| 3340 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_ordercompletion'); |
| 3341 |
|
| 3342 |
}else{ |
| 3343 |
$res = $this->order_processing( $this->payment_results ); |
| 3344 |
|
| 3345 |
if( 'ordercompletion' == $res ){ |
| 3346 |
if( isset($_REQUEST['wctid']) ){ |
| 3347 |
usces_ordered_acting_data($_REQUEST['wctid']); |
| 3348 |
} |
| 3349 |
$this->page = 'ordercompletion'; |
| 3350 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_ordercompletion'); |
| 3351 |
}else{ |
| 3352 |
$this->page = 'error'; |
| 3353 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_error'); |
| 3354 |
} |
| 3355 |
} |
| 3356 |
|
| 3357 |
}else{//result NG |
| 3358 |
$this->page = 'error'; |
| 3359 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_error'); |
| 3360 |
} |
| 3361 |
|
| 3362 |
add_action('the_post', array($this, 'action_cartFilter')); |
| 3363 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3364 |
} |
| 3365 |
|
| 3366 |
function settlement_epsilon(){ |
| 3367 |
global $wp_query; |
| 3368 |
require_once($this->options['settlement_path'] . 'epsilon.php'); |
| 3369 |
} |
| 3370 |
|
| 3371 |
function inquiry_button(){ |
| 3372 |
if( isset($_POST['inq_name']) && !WCUtils::is_blank($_POST['inq_name']) && isset($_POST['inq_mailaddress']) && is_email( trim($_POST['inq_mailaddress']) ) && !WCUtils::is_blank($_POST['inq_contents']) ){ |
| 3373 |
$res = $this->inquiry_processing(); |
| 3374 |
}else{ |
| 3375 |
$res = 'deficiency'; |
| 3376 |
} |
| 3377 |
|
| 3378 |
$this->page = $res; |
| 3379 |
} |
| 3380 |
|
| 3381 |
function member_login_page(){ |
| 3382 |
global $wp_query; |
| 3383 |
$res = $this->member_login(); |
| 3384 |
if( 'member' == $res ){ |
| 3385 |
$this->page = 'member'; |
| 3386 |
do_action('usces_action_member_logined'); |
| 3387 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_member'); |
| 3388 |
}elseif( 'login' == $res ){ |
| 3389 |
$this->page = 'login'; |
| 3390 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_login'); |
| 3391 |
} |
| 3392 |
add_action('the_post', array($this, 'action_memberFilter')); |
| 3393 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3394 |
} |
| 3395 |
|
| 3396 |
function regmember(){ |
| 3397 |
global $wp_query; |
| 3398 |
$res = $this->regist_member(); |
| 3399 |
if( 'editmemberform' == $res ){ |
| 3400 |
$this->page = 'editmemberform'; |
| 3401 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_editmemberform'); |
| 3402 |
}elseif( 'newcompletion' == $res ){ |
| 3403 |
$this->page = 'newcompletion'; |
| 3404 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_newcompletion'); |
| 3405 |
}else{ |
| 3406 |
$this->page = $res; |
| 3407 |
} |
| 3408 |
add_action('the_post', array($this, 'action_memberFilter')); |
| 3409 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3410 |
} |
| 3411 |
|
| 3412 |
function editmember(){ |
| 3413 |
global $wp_query; |
| 3414 |
$res = $this->regist_member(); |
| 3415 |
if( 'editmemberform' == $res ){ |
| 3416 |
$this->page = 'editmemberform'; |
| 3417 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_editmemberform'); |
| 3418 |
}elseif( 'newcompletion' == $res ){ |
| 3419 |
$this->page = 'newcompletion'; |
| 3420 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_newcompletion'); |
| 3421 |
}else{ |
| 3422 |
$this->page = $res; |
| 3423 |
} |
| 3424 |
add_action('the_post', array($this, 'action_memberFilter')); |
| 3425 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3426 |
} |
| 3427 |
|
| 3428 |
function deletemember(){ |
| 3429 |
$res = $this->delete_member(); |
| 3430 |
if( $res ){ |
| 3431 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_deletemember'); |
| 3432 |
$this->member_logout(); |
| 3433 |
}else{ |
| 3434 |
$this->page = 'editmemberform'; |
| 3435 |
add_action('the_post', array($this, 'action_memberFilter')); |
| 3436 |
} |
| 3437 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3438 |
} |
| 3439 |
|
| 3440 |
function page_logout(){ |
| 3441 |
global $wp_query; |
| 3442 |
$this->member_logout(); |
| 3443 |
add_action('the_post', array($this, 'action_memberFilter')); |
| 3444 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3445 |
} |
| 3446 |
|
| 3447 |
function page_lostmemberpassword(){ |
| 3448 |
global $wp_query; |
| 3449 |
$this->page = 'lostmemberpassword'; |
| 3450 |
add_action('the_post', array($this, 'action_memberFilter')); |
| 3451 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3452 |
} |
| 3453 |
|
| 3454 |
function lostpassword(){ |
| 3455 |
global $wp_query; |
| 3456 |
$this->error_message = $this->lostpass_mailaddcheck(); |
| 3457 |
if ( $this->error_message != '' ) { |
| 3458 |
$this->page = 'lostmemberpassword'; |
| 3459 |
} else { |
| 3460 |
$res = $this->lostmail(); |
| 3461 |
$this->page = $res;//'lostcompletion'; |
| 3462 |
} |
| 3463 |
add_action('the_post', array($this, 'action_memberFilter')); |
| 3464 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3465 |
} |
| 3466 |
|
| 3467 |
function uscesmode_changepassword(){ |
| 3468 |
global $wp_query; |
| 3469 |
$this->page = 'changepassword'; |
| 3470 |
add_action('the_post', array($this, 'action_memberFilter')); |
| 3471 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3472 |
} |
| 3473 |
|
| 3474 |
function changepassword_page(){ |
| 3475 |
global $wp_query; |
| 3476 |
$this->error_message = $this->changepass_check(); |
| 3477 |
if ( $this->error_message != '' ) { |
| 3478 |
$this->page = 'changepassword'; |
| 3479 |
} else { |
| 3480 |
$res = $this->changepassword(); |
| 3481 |
$this->page = $res;//'changepasscompletion'; |
| 3482 |
} |
| 3483 |
add_action('the_post', array($this, 'action_memberFilter')); |
| 3484 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3485 |
} |
| 3486 |
|
| 3487 |
function page_newmember(){ |
| 3488 |
|
| 3489 |
global $wp_query; |
| 3490 |
$this->page = 'newmemberform'; |
| 3491 |
add_filter('yoast-ga-push-after-pageview', 'usces_trackPageview_newmemberform'); |
| 3492 |
add_action('the_post', array($this, 'action_memberFilter')); |
| 3493 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3494 |
} |
| 3495 |
|
| 3496 |
function usces_export(){ |
| 3497 |
$this->export(); |
| 3498 |
} |
| 3499 |
|
| 3500 |
function usces_import(){ |
| 3501 |
$this->import(); |
| 3502 |
} |
| 3503 |
|
| 3504 |
function page_search_item(){ |
| 3505 |
global $wp_query; |
| 3506 |
$this->page = 'search_item'; |
| 3507 |
//add_action('template_redirect', array($this, 'action_search_item')); |
| 3508 |
add_action('the_post', array($this, 'action_cartFilter')); |
| 3509 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3510 |
} |
| 3511 |
|
| 3512 |
function default_page(){ |
| 3513 |
global $wp_query; |
| 3514 |
add_action('the_post', array($this, 'goDefaultPage')); |
| 3515 |
add_action('template_redirect', array($this, 'template_redirect')); |
| 3516 |
} |
| 3517 |
//-------------------------------------------------------------------------------------- |
| 3518 |
|
| 3519 |
|
| 3520 |
function goDefaultPage(){ |
| 3521 |
global $post; |
| 3522 |
|
| 3523 |
if( $post->ID == USCES_CART_NUMBER ) { |
| 3524 |
|
| 3525 |
$this->page = 'cart'; |
| 3526 |
add_filter('the_content', array($this, 'filter_cartContent'),20); |
| 3527 |
|
| 3528 |
}else if( $post->ID == USCES_MEMBER_NUMBER ) { |
| 3529 |
|
| 3530 |
$this->page = 'member'; |
| 3531 |
add_filter('the_content', array($this, 'filter_memberContent'),20); |
| 3532 |
|
| 3533 |
}else if( !is_singular() ) { |
| 3534 |
$this->page = 'wp_search'; |
| 3535 |
add_filter('the_excerpt', array($this, 'filter_cartContent'),20); |
| 3536 |
add_filter('the_content', array($this, 'filter_cartContent'),20); |
| 3537 |
|
| 3538 |
}else{ |
| 3539 |
add_filter('the_content', array(&$this, 'filter_itemPage')); |
| 3540 |
|
| 3541 |
} |
| 3542 |
} |
| 3543 |
|
| 3544 |
function template_redirect () { |
| 3545 |
global $post, $usces_entries, $usces_carts, $usces_members, $usces_gp, $member_regmode; |
| 3546 |
|
| 3547 |
if( apply_filters('usces_action_template_redirect', false) ) return;//Deprecated |
| 3548 |
if( apply_filters('usces_filter_template_redirect', false) ) return; |
| 3549 |
|
| 3550 |
if( is_single() && 'item' == $post->post_mime_type ) { |
| 3551 |
if( file_exists(get_stylesheet_directory() . '/wc_templates/wc_item_single.php') ){ |
| 3552 |
if( !post_password_required($post) ){ |
| 3553 |
include(get_stylesheet_directory() . '/wc_templates/wc_item_single.php'); |
| 3554 |
exit; |
| 3555 |
} |
| 3556 |
} |
| 3557 |
}elseif( isset($_REQUEST['page']) && ('search_item' == $_REQUEST['page'] || 'usces_search' == $_REQUEST['page']) && $this->is_cart_page($_SERVER['REQUEST_URI']) ){ |
| 3558 |
if( file_exists(get_stylesheet_directory() . '/wc_templates/wc_search_page.php') ){ |
| 3559 |
include(get_stylesheet_directory() . '/wc_templates/wc_search_page.php'); |
| 3560 |
exit; |
| 3561 |
} |
| 3562 |
|
| 3563 |
}else if( $this->is_cart_page($_SERVER['REQUEST_URI']) ){ |
| 3564 |
switch( $this->page ){ |
| 3565 |
case 'customer': |
| 3566 |
if( file_exists(get_stylesheet_directory() . '/wc_templates/cart/wc_customer_page.php') ){ |
| 3567 |
usces_get_entries(); |
| 3568 |
usces_get_member_regmode(); |
| 3569 |
include(get_stylesheet_directory() . '/wc_templates/cart/wc_customer_page.php'); |
| 3570 |
exit; |
| 3571 |
} |
| 3572 |
break; |
| 3573 |
case 'delivery': |
| 3574 |
if( file_exists(get_stylesheet_directory() . '/wc_templates/cart/wc_delivery_page.php') ){ |
| 3575 |
usces_get_entries(); |
| 3576 |
usces_get_carts(); |
| 3577 |
include(get_stylesheet_directory() . '/wc_templates/cart/wc_delivery_page.php'); |
| 3578 |
exit; |
| 3579 |
} |
| 3580 |
break; |
| 3581 |
case 'confirm': |
| 3582 |
if( file_exists(get_stylesheet_directory() . '/wc_templates/cart/wc_confirm_page.php') ){ |
| 3583 |
usces_get_entries(); |
| 3584 |
usces_get_carts(); |
| 3585 |
usces_get_members(); |
| 3586 |
include(get_stylesheet_directory() . '/wc_templates/cart/wc_confirm_page.php'); |
| 3587 |
exit; |
| 3588 |
} |
| 3589 |
break; |
| 3590 |
case 'ordercompletion': |
| 3591 |
if( file_exists(get_stylesheet_directory() . '/wc_templates/cart/wc_completion_page.php') ){ |
| 3592 |
usces_get_entries(); |
| 3593 |
usces_get_carts(); |
| 3594 |
include(get_stylesheet_directory() . '/wc_templates/cart/wc_completion_page.php'); |
| 3595 |
exit; |
| 3596 |
} |
| 3597 |
break; |
| 3598 |
case 'error': |
| 3599 |
if( file_exists(get_stylesheet_directory() . '/wc_templates/cart/wc_cart_error_page.php') ){ |
| 3600 |
include(get_stylesheet_directory() . '/wc_templates/cart/wc_cart_error_page.php'); |
| 3601 |
exit; |
| 3602 |
} |
| 3603 |
break; |
| 3604 |
case 'cart': |
| 3605 |
default: |
| 3606 |
if( file_exists(get_stylesheet_directory() . '/wc_templates/cart/wc_cart_page.php') ){ |
| 3607 |
include(get_stylesheet_directory() . '/wc_templates/cart/wc_cart_page.php'); |
| 3608 |
exit; |
| 3609 |
} |
| 3610 |
|
| 3611 |
} |
| 3612 |
}else if($this->is_inquiry_page($_SERVER['REQUEST_URI']) ){ |
| 3613 |
|
| 3614 |
}else if( $this->is_member_page($_SERVER['REQUEST_URI']) ){ |
| 3615 |
if($this->options['membersystem_state'] != 'activate') return; |
| 3616 |
|
| 3617 |
if( $this->is_member_logged_in() ) { |
| 3618 |
$member_regmode = 'editmemberform'; |
| 3619 |
if( file_exists(get_stylesheet_directory() . '/wc_templates/member/wc_member_page.php') ){ |
| 3620 |
include(get_stylesheet_directory() . '/wc_templates/member/wc_member_page.php'); |
| 3621 |
exit; |
| 3622 |
} |
| 3623 |
|
| 3624 |
} else { |
| 3625 |
|
| 3626 |
switch( $this->page ){ |
| 3627 |
case 'login': |
| 3628 |
if( file_exists(get_stylesheet_directory() . '/wc_templates/member/wc_login_page.php') ){ |
| 3629 |
include(get_stylesheet_directory() . '/wc_templates/member/wc_login_page.php'); |
| 3630 |
exit; |
| 3631 |
} |
| 3632 |
break; |
| 3633 |
case 'newmemberform': |
| 3634 |
if( file_exists(get_stylesheet_directory() . '/wc_templates/member/wc_new_member_page.php') ){ |
| 3635 |
$member_regmode = 'newmemberform'; |
| 3636 |
include(get_stylesheet_directory() . '/wc_templates/member/wc_new_member_page.php'); |
| 3637 |
exit; |
| 3638 |
} |
| 3639 |
break; |
| 3640 |
case 'lostmemberpassword': |
| 3641 |
if( file_exists(get_stylesheet_directory() . '/wc_templates/member/wc_lostpassword_page.php') ){ |
| 3642 |
include(get_stylesheet_directory() . '/wc_templates/member/wc_lostpassword_page.php'); |
| 3643 |
exit; |
| 3644 |
} |
| 3645 |
break; |
| 3646 |
case 'changepassword': |
| 3647 |
if( file_exists(get_stylesheet_directory() . '/wc_templates/member/wc_changepassword_page.php') ){ |
| 3648 |
include(get_stylesheet_directory() . '/wc_templates/member/wc_changepassword_page.php'); |
| 3649 |
exit; |
| 3650 |
} |
| 3651 |
break; |
| 3652 |
case 'newcompletion': |
| 3653 |
case 'editcompletion': |
| 3654 |
case 'lostcompletion': |
| 3655 |
case 'changepasscompletion': |
| 3656 |
if( file_exists(get_stylesheet_directory() . '/wc_templates/member/wc_member_completion_page.php') ){ |
| 3657 |
include(get_stylesheet_directory() . '/wc_templates/member/wc_member_completion_page.php'); |
| 3658 |
exit; |
| 3659 |
} |
| 3660 |
break; |
| 3661 |
default: |
| 3662 |
if( file_exists(get_stylesheet_directory() . '/wc_templates/member/wc_login_page.php') ){ |
| 3663 |
include(get_stylesheet_directory() . '/wc_templates/member/wc_login_page.php'); |
| 3664 |
exit; |
| 3665 |
} |
| 3666 |
} |
| 3667 |
} |
| 3668 |
|
| 3669 |
}else{ |
| 3670 |
// remove_action('the_post', array(&$this, 'goDefaultPage')); |
| 3671 |
} |
| 3672 |
} |
| 3673 |
|
| 3674 |
function import() { |
| 3675 |
$res = usces_import_xml(); |
| 3676 |
if ( $res === false ) : |
| 3677 |
$this->action_status = 'error'; |
| 3678 |
//$this->action_message = __('Import was not completed.', 'usces'); |
| 3679 |
else : |
| 3680 |
$this->action_status = 'success'; |
| 3681 |
$this->action_message = __('Import is cmpleted', 'usces'); |
| 3682 |
endif; |
| 3683 |
|
| 3684 |
// require_once(USCES_PLUGIN_DIR . '/includes/admin_backup.php'); |
| 3685 |
} |
| 3686 |
|
| 3687 |
function export() { |
| 3688 |
$filename = 'usces.' . substr(get_date_from_gmt(gmdate('Y-m-d H:i:s', time())), 0, 10) . '.xml'; |
| 3689 |
|
| 3690 |
header('Content-Description: File Transfer'); |
| 3691 |
header("Content-Disposition: attachment; filename=$filename"); |
| 3692 |
header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); |
| 3693 |
|
| 3694 |
usces_export_xml(); |
| 3695 |
die(); |
| 3696 |
|
| 3697 |
} |
| 3698 |
|
| 3699 |
|
| 3700 |
function changepassword() { |
| 3701 |
global $wpdb; |
| 3702 |
|
| 3703 |
if ( !isset($_SESSION['usces_lostmail']) ) : |
| 3704 |
$this->error_message = __('Failed in update due to time-out', 'usces'); |
| 3705 |
return 'login'; |
| 3706 |
else : |
| 3707 |
|
| 3708 |
$member_table = $wpdb->prefix . "usces_member"; |
| 3709 |
|
| 3710 |
$query = $wpdb->prepare("UPDATE $member_table SET mem_pass = %s WHERE mem_email = %s", |
| 3711 |
md5(trim($_POST['loginpass1'])), $_SESSION['usces_lostmail']); |
| 3712 |
$res = $wpdb->query( $query ); |
| 3713 |
//$res = $wpdb->last_results; |
| 3714 |
|
| 3715 |
if ( $res === false ) : |
| 3716 |
$this->error_message = __('Error: failure in updating password', 'usces'); |
| 3717 |
return 'login'; |
| 3718 |
else : |
| 3719 |
return 'changepasscompletion'; |
| 3720 |
endif; |
| 3721 |
|
| 3722 |
endif; |
| 3723 |
} |
| 3724 |
|
| 3725 |
function lostmail() { |
| 3726 |
$delim = apply_filters( 'usces_filter_delim', $this->delim ); |
| 3727 |
|
| 3728 |
$_SESSION['usces_lostmail'] = trim($_POST['loginmail']); |
| 3729 |
$id = session_id(); |
| 3730 |
$uri = USCES_MEMBER_URL . $delim . 'uscesmode=changepassword'; |
| 3731 |
$res = usces_lostmail($uri); |
| 3732 |
return $res; |
| 3733 |
|
| 3734 |
} |
| 3735 |
|
| 3736 |
function regist_member() { |
| 3737 |
global $wpdb; |
| 3738 |
$_POST = $this->stripslashes_deep_post($_POST); |
| 3739 |
|
| 3740 |
$member = $this->get_member(); |
| 3741 |
$mode = $_POST['member_regmode']; |
| 3742 |
$member_table = $wpdb->prefix . "usces_member"; |
| 3743 |
$member_meta_table = $wpdb->prefix . "usces_member_meta"; |
| 3744 |
|
| 3745 |
//20110715ysk start 0000203 |
| 3746 |
//$error_mes = ( $_POST['member_regmode'] == 'newmemberfromcart' ) ? $this->member_check_fromcart() : $this->member_check(); |
| 3747 |
$error_mes = ( $_POST['member_regmode'] == 'newmemberfromcart' or $_POST['member_regmode'] == 'editmemberfromcart' ) ? $this->member_check_fromcart() : $this->member_check(); |
| 3748 |
//20110715ysk end |
| 3749 |
|
| 3750 |
if ( $error_mes != '' ) { |
| 3751 |
|
| 3752 |
$this->error_message = $error_mes; |
| 3753 |
return $mode; |
| 3754 |
|
| 3755 |
} elseif ( $_POST['member_regmode'] == 'editmemberform' ) { |
| 3756 |
|
| 3757 |
$this->get_current_member(); |
| 3758 |
$mem_id = $this->current_member['id']; |
| 3759 |
do_action('usces_action_pre_edit_memberdata', $_POST['member'], $mem_id); |
| 3760 |
|
| 3761 |
//20130802ysk start 0000741 |
| 3762 |
$query = $wpdb->prepare("SELECT ID FROM $member_table WHERE mem_email = %s", trim($_POST['member']['mailaddress1'])); |
| 3763 |
$id = $wpdb->get_var( $query ); |
| 3764 |
if ( !empty($id) and $id != $mem_id ) { |
| 3765 |
$this->error_message = __('This e-mail address has been already registered.', 'usces'); |
| 3766 |
return $mode; |
| 3767 |
} |
| 3768 |
//20130802ysk end |
| 3769 |
|
| 3770 |
$query = $wpdb->prepare("SELECT mem_pass FROM $member_table WHERE ID = %d", $mem_id); |
| 3771 |
$pass = $wpdb->get_var( $query ); |
| 3772 |
|
| 3773 |
$password = ( !empty($_POST['member']['password1']) && trim($_POST['member']['password1']) == trim($_POST['member']['password2']) ) ? md5(trim($_POST['member']['password1'])) : $pass; |
| 3774 |
$query = $wpdb->prepare("UPDATE $member_table SET |
| 3775 |
mem_pass = %s, mem_name1 = %s, mem_name2 = %s, mem_name3 = %s, mem_name4 = %s, |
| 3776 |
mem_zip = %s, mem_pref = %s, mem_address1 = %s, mem_address2 = %s, |
| 3777 |
mem_address3 = %s, mem_tel = %s, mem_fax = %s, mem_email = %s WHERE ID = %d", |
| 3778 |
$password, |
| 3779 |
trim($_POST['member']['name1']), |
| 3780 |
trim($_POST['member']['name2']), |
| 3781 |
trim($_POST['member']['name3']), |
| 3782 |
trim($_POST['member']['name4']), |
| 3783 |
trim($_POST['member']['zipcode']), |
| 3784 |
trim($_POST['member']['pref']), |
| 3785 |
trim($_POST['member']['address1']), |
| 3786 |
trim($_POST['member']['address2']), |
| 3787 |
trim($_POST['member']['address3']), |
| 3788 |
trim($_POST['member']['tel']), |
| 3789 |
trim($_POST['member']['fax']), |
| 3790 |
trim($_POST['member']['mailaddress1']), |
| 3791 |
$mem_id |
| 3792 |
); |
| 3793 |
$res = $wpdb->query( $query ); |
| 3794 |
|
| 3795 |
if( $res !== false ){ |
| 3796 |
$this->set_member_meta_value('customer_country', $_POST['member']['country'], $mem_id); |
| 3797 |
//20100818ysk start |
| 3798 |
$res = $this->reg_custom_member($mem_id); |
| 3799 |
//20100818ysk end |
| 3800 |
do_action('usces_action_edit_memberdata', $_POST['member'], $mem_id); |
| 3801 |
//$meta_keys = apply_filters( 'usces_filter_delete_member_pcid', "'zeus_pcid', 'remise_pcid', 'digitalcheck_ip_user_id'" ); |
| 3802 |
$meta_keys = apply_filters( 'usces_filter_delete_member_pcid', "'remise_pcid', 'digitalcheck_ip_user_id'" ); |
| 3803 |
$query = $wpdb->prepare("DELETE FROM $member_meta_table WHERE member_id = %d AND meta_key IN( $meta_keys )", |
| 3804 |
$mem_id |
| 3805 |
); |
| 3806 |
$res = $wpdb->query( $query ); |
| 3807 |
|
| 3808 |
$this->get_current_member(); |
| 3809 |
return 'editmemberform'; |
| 3810 |
|
| 3811 |
} else { |
| 3812 |
$this->error_message = __('Error:failure in update', 'usces'); |
| 3813 |
return $mode; |
| 3814 |
} |
| 3815 |
|
| 3816 |
} elseif ( $_POST['member_regmode'] == 'newmemberform' ) { |
| 3817 |
|
| 3818 |
$query = $wpdb->prepare("SELECT ID FROM $member_table WHERE mem_email = %s", trim($_POST['member']['mailaddress1'])); |
| 3819 |
$id = $wpdb->get_var( $query ); |
| 3820 |
if ( !empty($id) ) { |
| 3821 |
$this->error_message = __('This e-mail address has been already registered.', 'usces'); |
| 3822 |
return $mode; |
| 3823 |
} else { |
| 3824 |
|
| 3825 |
$point = $this->options['start_point']; |
| 3826 |
$pass = md5(trim($_POST['member']['password1'])); |
| 3827 |
$query = $wpdb->prepare("INSERT INTO $member_table |
| 3828 |
(mem_email, mem_pass, mem_status, mem_cookie, mem_point, |
| 3829 |
mem_name1, mem_name2, mem_name3, mem_name4, mem_zip, mem_pref, |
| 3830 |
mem_address1, mem_address2, mem_address3, mem_tel, mem_fax, |
| 3831 |
mem_delivery_flag, mem_delivery, mem_registered, mem_nicename) |
| 3832 |
VALUES (%s, %s, %d, %s, %d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d, %s, %s, %s)", |
| 3833 |
trim($_POST['member']['mailaddress1']), |
| 3834 |
$pass, |
| 3835 |
0, |
| 3836 |
"", |
| 3837 |
$point, |
| 3838 |
trim($_POST['member']['name1']), |
| 3839 |
trim($_POST['member']['name2']), |
| 3840 |
trim($_POST['member']['name3']), |
| 3841 |
trim($_POST['member']['name4']), |
| 3842 |
trim($_POST['member']['zipcode']), |
| 3843 |
trim($_POST['member']['pref']), |
| 3844 |
trim($_POST['member']['address1']), |
| 3845 |
trim($_POST['member']['address2']), |
| 3846 |
trim($_POST['member']['address3']), |
| 3847 |
trim($_POST['member']['tel']), |
| 3848 |
trim($_POST['member']['fax']), |
| 3849 |
'', |
| 3850 |
'', |
| 3851 |
get_date_from_gmt(gmdate('Y-m-d H:i:s', time())), |
| 3852 |
''); |
| 3853 |
$res = $wpdb->query( $query ); |
| 3854 |
|
| 3855 |
//$_SESSION['usces_member']['ID'] = $wpdb->insert_id; |
| 3856 |
//$this->get_current_member(); |
| 3857 |
if($res !== false) { |
| 3858 |
$user = $_POST['member']; |
| 3859 |
$user['ID'] = $wpdb->insert_id; |
| 3860 |
$this->set_member_meta_value('customer_country', $_POST['member']['country'], $user['ID']); |
| 3861 |
//20110714ysk start 0000207 |
| 3862 |
//20100818ysk start |
| 3863 |
//$res = $this->reg_custom_member($wpdb->insert_id); |
| 3864 |
$res = $this->reg_custom_member($user['ID']); |
| 3865 |
//20100818ysk end |
| 3866 |
//20110714ysk end |
| 3867 |
$mser = usces_send_regmembermail($user); |
| 3868 |
|
| 3869 |
do_action('usces_action_member_registered', $_POST['member'], $user['ID']); |
| 3870 |
|
| 3871 |
return 'newcompletion'; |
| 3872 |
|
| 3873 |
} else { |
| 3874 |
$this->error_message = __('Error:failure in update', 'usces'); |
| 3875 |
return $mode; |
| 3876 |
} |
| 3877 |
} |
| 3878 |
|
| 3879 |
} elseif ( $_POST['member_regmode'] == 'newmemberfromcart' ) { |
| 3880 |
|
| 3881 |
$query = $wpdb->prepare("SELECT ID FROM $member_table WHERE mem_email = %s", trim($_POST['customer']['mailaddress1'])); |
| 3882 |
$id = $wpdb->get_var( $query ); |
| 3883 |
if ( !empty($id) ) { |
| 3884 |
$this->error_message = __('This e-mail address has been already registered.', 'usces'); |
| 3885 |
return $mode; |
| 3886 |
} else { |
| 3887 |
|
| 3888 |
$point = $this->options['start_point']; |
| 3889 |
$pass = md5(trim($_POST['customer']['password1'])); |
| 3890 |
$query = $wpdb->prepare("INSERT INTO $member_table |
| 3891 |
(mem_email, mem_pass, mem_status, mem_cookie, mem_point, |
| 3892 |
mem_name1, mem_name2, mem_name3, mem_name4, mem_zip, mem_pref, |
| 3893 |
mem_address1, mem_address2, mem_address3, mem_tel, mem_fax, |
| 3894 |
mem_delivery_flag, mem_delivery, mem_registered, mem_nicename) |
| 3895 |
VALUES (%s, %s, %d, %s, %d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d, %s, %s, %s)", |
| 3896 |
trim($_POST['customer']['mailaddress1']), |
| 3897 |
$pass, |
| 3898 |
0, |
| 3899 |
"", |
| 3900 |
$point, |
| 3901 |
trim($_POST['customer']['name1']), |
| 3902 |
trim($_POST['customer']['name2']), |
| 3903 |
trim($_POST['customer']['name3']), |
| 3904 |
trim($_POST['customer']['name4']), |
| 3905 |
trim($_POST['customer']['zipcode']), |
| 3906 |
trim($_POST['customer']['pref']), |
| 3907 |
trim($_POST['customer']['address1']), |
| 3908 |
trim($_POST['customer']['address2']), |
| 3909 |
trim($_POST['customer']['address3']), |
| 3910 |
trim($_POST['customer']['tel']), |
| 3911 |
trim($_POST['customer']['fax']), |
| 3912 |
'', |
| 3913 |
'', |
| 3914 |
get_date_from_gmt(gmdate('Y-m-d H:i:s', time())), |
| 3915 |
''); |
| 3916 |
$res = $wpdb->query( $query ); |
| 3917 |
|
| 3918 |
//$_SESSION['usces_member']['ID'] = $wpdb->insert_id; |
| 3919 |
//$this->get_current_member(); |
| 3920 |
if($res !== false) { |
| 3921 |
//20110714ysk start 0000207 |
| 3922 |
$member_id = $wpdb->insert_id; |
| 3923 |
//$this->set_member_meta_value('customer_country', $_POST['member']['country'], $wpdb->insert_id); |
| 3924 |
$this->set_member_meta_value('customer_country', $_POST['customer']['country'], $member_id); |
| 3925 |
//20100818ysk start |
| 3926 |
//$res = $this->reg_custom_member($wpdb->insert_id); |
| 3927 |
$res = $this->reg_custom_member($member_id); |
| 3928 |
//20100818ysk end |
| 3929 |
//20110714ysk end |
| 3930 |
//usces_send_regmembermail(); |
| 3931 |
do_action('usces_action_member_registered', $_POST['customer'], $member_id); |
| 3932 |
$user = $_POST['customer']; |
| 3933 |
$user['ID'] = $member_id; |
| 3934 |
$mser = usces_send_regmembermail($user); |
| 3935 |
$_POST['loginmail'] = trim($_POST['customer']['mailaddress1']); |
| 3936 |
$_POST['loginpass'] = trim($_POST['customer']['password1']); |
| 3937 |
if( $this->member_login() == 'member' ){ |
| 3938 |
$_SESSION['usces_entry']['member_regmode'] = 'editmemberfromcart'; |
| 3939 |
return 'newcompletion'; |
| 3940 |
} |
| 3941 |
|
| 3942 |
} else { |
| 3943 |
$this->error_message = __('Error:failure in update', 'usces'); |
| 3944 |
return $mode; |
| 3945 |
} |
| 3946 |
} |
| 3947 |
|
| 3948 |
//20110715ysk start 0000203 |
| 3949 |
} elseif ( $_POST['member_regmode'] == 'editmemberfromcart' ) { |
| 3950 |
|
| 3951 |
$this->get_current_member(); |
| 3952 |
$mem_id = $this->current_member['id']; |
| 3953 |
do_action('usces_action_pre_edit_memberdata', $_POST['customer'], $mem_id); |
| 3954 |
|
| 3955 |
$query = $wpdb->prepare("SELECT mem_pass FROM $member_table WHERE ID = %d", $mem_id); |
| 3956 |
$pass = $wpdb->get_var( $query ); |
| 3957 |
|
| 3958 |
$password = ( !empty($_POST['customer']['password1']) && trim($_POST['customer']['password1']) == trim($_POST['customer']['password2']) ) ? md5(trim($_POST['customer']['password1'])) : $pass; |
| 3959 |
$query = $wpdb->prepare("UPDATE $member_table SET |
| 3960 |
mem_pass = %s, mem_name1 = %s, mem_name2 = %s, mem_name3 = %s, mem_name4 = %s, |
| 3961 |
mem_zip = %s, mem_pref = %s, mem_address1 = %s, mem_address2 = %s, |
| 3962 |
mem_address3 = %s, mem_tel = %s, mem_fax = %s, mem_email = %s WHERE ID = %d", |
| 3963 |
$password, |
| 3964 |
trim($_POST['customer']['name1']), |
| 3965 |
trim($_POST['customer']['name2']), |
| 3966 |
trim($_POST['customer']['name3']), |
| 3967 |
trim($_POST['customer']['name4']), |
| 3968 |
trim($_POST['customer']['zipcode']), |
| 3969 |
trim($_POST['customer']['pref']), |
| 3970 |
trim($_POST['customer']['address1']), |
| 3971 |
trim($_POST['customer']['address2']), |
| 3972 |
trim($_POST['customer']['address3']), |
| 3973 |
trim($_POST['customer']['tel']), |
| 3974 |
trim($_POST['customer']['fax']), |
| 3975 |
trim($_POST['customer']['mailaddress1']), |
| 3976 |
$mem_id |
| 3977 |
); |
| 3978 |
$res = $wpdb->query( $query ); |
| 3979 |
if( $res !== false ){ |
| 3980 |
$this->set_member_meta_value('customer_country', $_POST['customer']['country'], $mem_id); |
| 3981 |
$res = $this->reg_custom_member($mem_id); |
| 3982 |
do_action('usces_action_edit_memberdata', $_POST['customer'], $mem_id); |
| 3983 |
unset($_SESSION['usces_member']); |
| 3984 |
$this->member_just_login(trim($_POST['customer']['mailaddress1']), trim($_POST['customer']['password1'])); |
| 3985 |
return 'newcompletion'; |
| 3986 |
|
| 3987 |
} else { |
| 3988 |
$this->error_message = __('Error:failure in update', 'usces'); |
| 3989 |
return $mode; |
| 3990 |
} |
| 3991 |
//20110715ysk end |
| 3992 |
} |
| 3993 |
} |
| 3994 |
|
| 3995 |
function delete_member() { |
| 3996 |
if( ! $this->is_member_logged_in() ) |
| 3997 |
return false; |
| 3998 |
$mem = $this->get_member(); |
| 3999 |
if( ! $mem['ID'] ) |
| 4000 |
return false; |
| 4001 |
|
| 4002 |
$res = usces_delete_memberdata( $mem['ID'] ); |
| 4003 |
if( $res ) { |
| 4004 |
usces_send_delmembermail( $mem ); |
| 4005 |
} |
| 4006 |
|
| 4007 |
return $res; |
| 4008 |
} |
| 4009 |
|
| 4010 |
function is_member_logged_in( $id = false ) { |
| 4011 |
if( $id === false ){ |
| 4012 |
if( !empty($_SESSION['usces_member']['ID']) ) |
| 4013 |
return true; |
| 4014 |
else |
| 4015 |
return false; |
| 4016 |
}else{ |
| 4017 |
if( !empty($_SESSION['usces_member']['ID']) && $_SESSION['usces_member']['ID'] == $id ) |
| 4018 |
return true; |
| 4019 |
else |
| 4020 |
return false; |
| 4021 |
} |
| 4022 |
} |
| 4023 |
|
| 4024 |
function is_member($email) { |
| 4025 |
global $wpdb; |
| 4026 |
|
| 4027 |
$member_table = $wpdb->prefix . "usces_member"; |
| 4028 |
$query = $wpdb->prepare("SELECT mem_email FROM $member_table WHERE mem_email = %s", $email); |
| 4029 |
$member = $wpdb->get_row( $query, ARRAY_A ); |
| 4030 |
if ( empty($member) ) { |
| 4031 |
return false; |
| 4032 |
}else{ |
| 4033 |
return true; |
| 4034 |
} |
| 4035 |
} |
| 4036 |
|
| 4037 |
function member_login() { |
| 4038 |
global $wpdb; |
| 4039 |
$_POST = $this->stripslashes_deep_post($_POST); |
| 4040 |
|
| 4041 |
$cookie = $this->get_cookie(); |
| 4042 |
|
| 4043 |
|
| 4044 |
if ( isset($cookie['rme']) && $cookie['rme'] == 'forever' && !isset($_POST['rememberme']) && !isset($_POST['loginmail'])) { |
| 4045 |
$email = $cookie['name']; |
| 4046 |
$member_table = $wpdb->prefix . "usces_member"; |
| 4047 |
|
| 4048 |
$query = $wpdb->prepare("SELECT ID FROM $member_table WHERE mem_email = %s", $email); |
| 4049 |
$id = $wpdb->get_var( $query ); |
| 4050 |
|
| 4051 |
if ( !$id ) { |
| 4052 |
$this->current_member['email'] = htmlspecialchars($email); |
| 4053 |
$this->error_message = __('<b>Error:</b> E-mail address is not correct.', 'usces'); |
| 4054 |
return 'login'; |
| 4055 |
} else { |
| 4056 |
$query = $wpdb->prepare("SELECT * FROM $member_table WHERE mem_email = %s", $email); |
| 4057 |
$member = $wpdb->get_row( $query, ARRAY_A ); |
| 4058 |
if ( empty($member) ) { |
| 4059 |
$this->current_member['email'] = htmlspecialchars($email); |
| 4060 |
$this->error_message = __('<b>Error:</b> Password is not correct.', 'usces'); |
| 4061 |
return 'login'; |
| 4062 |
} else { |
| 4063 |
$_SESSION['usces_member']['ID'] = $member['ID']; |
| 4064 |
$_SESSION['usces_member']['mailaddress1'] = $member['mem_email']; |
| 4065 |
$_SESSION['usces_member']['mailaddress2'] = $member['mem_email']; |
| 4066 |
$_SESSION['usces_member']['point'] = $member['mem_point']; |
| 4067 |
$_SESSION['usces_member']['name1'] = $member['mem_name1']; |
| 4068 |
$_SESSION['usces_member']['name2'] = $member['mem_name2']; |
| 4069 |
$_SESSION['usces_member']['name3'] = $member['mem_name3']; |
| 4070 |
$_SESSION['usces_member']['name4'] = $member['mem_name4']; |
| 4071 |
$_SESSION['usces_member']['zipcode'] = $member['mem_zip']; |
| 4072 |
$_SESSION['usces_member']['pref'] = $member['mem_pref']; |
| 4073 |
$_SESSION['usces_member']['address1'] = $member['mem_address1']; |
| 4074 |
$_SESSION['usces_member']['address2'] = $member['mem_address2']; |
| 4075 |
$_SESSION['usces_member']['address3'] = $member['mem_address3']; |
| 4076 |
$_SESSION['usces_member']['tel'] = $member['mem_tel']; |
| 4077 |
$_SESSION['usces_member']['fax'] = $member['mem_fax']; |
| 4078 |
$_SESSION['usces_member']['delivery_flag'] = $member['mem_delivery_flag']; |
| 4079 |
$_SESSION['usces_member']['delivery'] = !empty($member['mem_delivery']) ? unserialize($member['mem_delivery']) : ''; |
| 4080 |
$_SESSION['usces_member']['registered'] = $member['mem_registered']; |
| 4081 |
$_SESSION['usces_member']['nicename'] = $member['mem_nicename']; |
| 4082 |
$_SESSION['usces_member']['country'] = $this->get_member_meta_value('customer_country', $member['ID']); |
| 4083 |
$_SESSION['usces_member']['status'] = $member['mem_status']; |
| 4084 |
//20100818ysk start |
| 4085 |
$this->set_session_custom_member($member['ID']); |
| 4086 |
//20100818ysk end |
| 4087 |
$this->get_current_member(); |
| 4088 |
|
| 4089 |
do_action( 'usces_action_after_login' ); |
| 4090 |
return apply_filters( 'usces_filter_member_login', 'member', $member ); |
| 4091 |
} |
| 4092 |
} |
| 4093 |
} else if ( isset($_POST['loginmail']) && WCUtils::is_blank($_POST['loginmail']) && isset($_POST['loginpass']) && WCUtils::is_blank($_POST['loginpass']) && isset($cookie['rme']) && $cookie['rme'] != 'forever' ) { |
| 4094 |
return 'login'; |
| 4095 |
} else if ( isset($_POST['loginmail']) && WCUtils::is_blank($_POST['loginpass']) && isset($cookie['rme']) && $cookie['rme'] != 'forever' ) { |
| 4096 |
$this->current_member['email'] = trim($_POST['loginmail']); |
| 4097 |
$this->error_message = __('<b>Error:</b> Enter the password.', 'usces'); |
| 4098 |
return 'login'; |
| 4099 |
} else if ( !isset($_POST['loginmail']) ){ |
| 4100 |
return 'login'; |
| 4101 |
} else { |
| 4102 |
$email = isset($_POST['loginmail']) ? trim($_POST['loginmail']) : ''; |
| 4103 |
$pass = isset($_POST['loginpass']) ? md5(trim($_POST['loginpass'])) : ''; |
| 4104 |
$member_table = $wpdb->prefix . "usces_member"; |
| 4105 |
|
| 4106 |
$query = $wpdb->prepare("SELECT ID FROM $member_table WHERE mem_email = %s", $email); |
| 4107 |
$id = $wpdb->get_var( $query ); |
| 4108 |
|
| 4109 |
if ( !$id ) { |
| 4110 |
$this->current_member['email'] = htmlspecialchars($email); |
| 4111 |
$this->error_message = __('<b>Error:</b> E-mail address is not correct.', 'usces'); |
| 4112 |
return 'login'; |
| 4113 |
} else { |
| 4114 |
$query = $wpdb->prepare("SELECT * FROM $member_table WHERE mem_email = %s AND mem_pass = %s", $email, $pass); |
| 4115 |
$member = $wpdb->get_row( $query, ARRAY_A ); |
| 4116 |
if ( empty($member) ) { |
| 4117 |
$this->current_member['email'] = htmlspecialchars($email); |
| 4118 |
$this->error_message = __('<b>Error:</b> Password is not correct.', 'usces'); |
| 4119 |
return 'login'; |
| 4120 |
} else { |
| 4121 |
$_SESSION['usces_member']['ID'] = $member['ID']; |
| 4122 |
$_SESSION['usces_member']['mailaddress1'] = $member['mem_email']; |
| 4123 |
$_SESSION['usces_member']['mailaddress2'] = $member['mem_email']; |
| 4124 |
$_SESSION['usces_member']['point'] = $member['mem_point']; |
| 4125 |
$_SESSION['usces_member']['name1'] = $member['mem_name1']; |
| 4126 |
$_SESSION['usces_member']['name2'] = $member['mem_name2']; |
| 4127 |
$_SESSION['usces_member']['name3'] = $member['mem_name3']; |
| 4128 |
$_SESSION['usces_member']['name4'] = $member['mem_name4']; |
| 4129 |
$_SESSION['usces_member']['zipcode'] = $member['mem_zip']; |
| 4130 |
$_SESSION['usces_member']['pref'] = $member['mem_pref']; |
| 4131 |
$_SESSION['usces_member']['address1'] = $member['mem_address1']; |
| 4132 |
$_SESSION['usces_member']['address2'] = $member['mem_address2']; |
| 4133 |
$_SESSION['usces_member']['address3'] = $member['mem_address3']; |
| 4134 |
$_SESSION['usces_member']['tel'] = $member['mem_tel']; |
| 4135 |
$_SESSION['usces_member']['fax'] = $member['mem_fax']; |
| 4136 |
$_SESSION['usces_member']['delivery_flag'] = $member['mem_delivery_flag']; |
| 4137 |
$_SESSION['usces_member']['delivery'] = !empty($member['mem_delivery']) ? unserialize($member['mem_delivery']) : ''; |
| 4138 |
$_SESSION['usces_member']['registered'] = $member['mem_registered']; |
| 4139 |
$_SESSION['usces_member']['nicename'] = $member['mem_nicename']; |
| 4140 |
$_SESSION['usces_member']['country'] = $this->get_member_meta_value('customer_country', $member['ID']); |
| 4141 |
$_SESSION['usces_member']['status'] = $member['mem_status']; |
| 4142 |
//20100818ysk start |
| 4143 |
$this->set_session_custom_member($member['ID']); |
| 4144 |
//20100818ysk end |
| 4145 |
$this->get_current_member(); |
| 4146 |
|
| 4147 |
if( isset($_POST['rememberme']) ){ |
| 4148 |
$cookie['name'] = $email; |
| 4149 |
$cookie['rme'] = 'forever'; |
| 4150 |
$this->set_cookie($cookie); |
| 4151 |
}else{ |
| 4152 |
$cookie['name'] = ''; |
| 4153 |
$cookie['rme'] = ''; |
| 4154 |
$this->set_cookie($cookie); |
| 4155 |
} |
| 4156 |
|
| 4157 |
do_action( 'usces_action_after_login' ); |
| 4158 |
return apply_filters( 'usces_filter_member_login', 'member', $member ); |
| 4159 |
} |
| 4160 |
} |
| 4161 |
} |
| 4162 |
} |
| 4163 |
|
| 4164 |
function member_just_login($email, $pass) { |
| 4165 |
global $wpdb; |
| 4166 |
$pass = md5($pass); |
| 4167 |
$member_table = $wpdb->prefix . "usces_member"; |
| 4168 |
|
| 4169 |
$query = $wpdb->prepare("SELECT * FROM $member_table WHERE mem_email = %s AND mem_pass = %s", $email, $pass); |
| 4170 |
$member = $wpdb->get_row( $query, ARRAY_A ); |
| 4171 |
if ( empty($member) ) { |
| 4172 |
$this->current_member['email'] = htmlspecialchars($email); |
| 4173 |
$this->error_message = __('<b>Error:</b> Password is not correct.', 'usces'); |
| 4174 |
return 'login'; |
| 4175 |
} else { |
| 4176 |
$_SESSION['usces_member']['ID'] = $member['ID']; |
| 4177 |
$_SESSION['usces_member']['mailaddress1'] = $member['mem_email']; |
| 4178 |
$_SESSION['usces_member']['mailaddress2'] = $member['mem_email']; |
| 4179 |
$_SESSION['usces_member']['point'] = $member['mem_point']; |
| 4180 |
$_SESSION['usces_member']['name1'] = $member['mem_name1']; |
| 4181 |
$_SESSION['usces_member']['name2'] = $member['mem_name2']; |
| 4182 |
$_SESSION['usces_member']['name3'] = $member['mem_name3']; |
| 4183 |
$_SESSION['usces_member']['name4'] = $member['mem_name4']; |
| 4184 |
$_SESSION['usces_member']['zipcode'] = $member['mem_zip']; |
| 4185 |
$_SESSION['usces_member']['pref'] = $member['mem_pref']; |
| 4186 |
$_SESSION['usces_member']['address1'] = $member['mem_address1']; |
| 4187 |
$_SESSION['usces_member']['address2'] = $member['mem_address2']; |
| 4188 |
$_SESSION['usces_member']['address3'] = $member['mem_address3']; |
| 4189 |
$_SESSION['usces_member']['tel'] = $member['mem_tel']; |
| 4190 |
$_SESSION['usces_member']['fax'] = $member['mem_fax']; |
| 4191 |
$_SESSION['usces_member']['delivery_flag'] = $member['mem_delivery_flag']; |
| 4192 |
$_SESSION['usces_member']['delivery'] = !empty($member['mem_delivery']) ? unserialize($member['mem_delivery']) : ''; |
| 4193 |
$_SESSION['usces_member']['registered'] = $member['mem_registered']; |
| 4194 |
$_SESSION['usces_member']['nicename'] = $member['mem_nicename']; |
| 4195 |
$_SESSION['usces_member']['country'] = $this->get_member_meta_value('customer_country', $member['ID']); |
| 4196 |
$_SESSION['usces_member']['status'] = $member['mem_status']; |
| 4197 |
//20100818ysk start |
| 4198 |
$this->set_session_custom_member($member['ID']); |
| 4199 |
//20100818ysk end |
| 4200 |
$this->get_current_member(); |
| 4201 |
|
| 4202 |
// $cookie = $this->get_cookie(); |
| 4203 |
// if(isset($_POST['rememberme']) && $cookie){ |
| 4204 |
// $cookie['name'] = $email; |
| 4205 |
// $cookie['pass'] = trim($_POST['loginpass']); |
| 4206 |
// $this->set_cookie($cookie); |
| 4207 |
// }else{ |
| 4208 |
// $cookie['name'] = ''; |
| 4209 |
// $cookie['pass'] = ''; |
| 4210 |
// $this->set_cookie($cookie); |
| 4211 |
// } |
| 4212 |
|
| 4213 |
do_action( 'usces_action_after_login' ); |
| 4214 |
return apply_filters( 'usces_filter_member_login', 'member', $member ); |
| 4215 |
} |
| 4216 |
} |
| 4217 |
|
| 4218 |
function member_logout() { |
| 4219 |
unset($_SESSION['usces_member'], $_SESSION['usces_entry']); |
| 4220 |
do_action('usces_action_member_logout'); |
| 4221 |
wp_redirect(get_option('home')); |
| 4222 |
exit; |
| 4223 |
} |
| 4224 |
|
| 4225 |
function get_current_member() { |
| 4226 |
|
| 4227 |
if ( isset($_SESSION['usces_member']['ID']) ) { |
| 4228 |
$this->current_member['id'] = $_SESSION['usces_member']['ID']; |
| 4229 |
$this->current_member['name'] = usces_localized_name( $_SESSION['usces_member']['name1'], $_SESSION['usces_member']['name2'], 'return'); |
| 4230 |
} else { |
| 4231 |
$this->current_member['id'] = 0; |
| 4232 |
$this->current_member['name'] = __('guest', 'usces'); |
| 4233 |
} |
| 4234 |
} |
| 4235 |
|
| 4236 |
function get_member() { |
| 4237 |
$res = array( |
| 4238 |
'ID' => '', |
| 4239 |
'registered' => '', |
| 4240 |
'mailaddress1' => '', |
| 4241 |
'mailaddress2' => '', |
| 4242 |
'password1' => '', |
| 4243 |
'password2' => '', |
| 4244 |
'point' => '', |
| 4245 |
'name1' => '', |
| 4246 |
'name2' => '', |
| 4247 |
'name3' => '', |
| 4248 |
'name4' => '', |
| 4249 |
'zipcode' => '', |
| 4250 |
'address1' => '', |
| 4251 |
'address2' => '', |
| 4252 |
'address3' => '', |
| 4253 |
'tel' => '', |
| 4254 |
'fax' => '', |
| 4255 |
'country' => '', |
| 4256 |
'pref' => '', |
| 4257 |
'status' => '' |
| 4258 |
); |
| 4259 |
if(!empty($_SESSION['usces_member'])) { |
| 4260 |
foreach ( $_SESSION['usces_member'] as $key => $value ) { |
| 4261 |
//20100818ysk start |
| 4262 |
if(is_array($_SESSION['usces_member'][$key])) |
| 4263 |
$res[$key] = stripslashes_deep($value); |
| 4264 |
else |
| 4265 |
//20100818ysk end |
| 4266 |
$res[$key] = stripslashes($value); |
| 4267 |
} |
| 4268 |
} |
| 4269 |
return $res; |
| 4270 |
} |
| 4271 |
|
| 4272 |
function get_member_info( $mid ) { |
| 4273 |
global $wpdb; |
| 4274 |
$infos = array(); |
| 4275 |
|
| 4276 |
//if( !current_user_can('activate_plugins') ) return array(); |
| 4277 |
|
| 4278 |
$table = $wpdb->prefix . "usces_member"; |
| 4279 |
$query = $wpdb->prepare("SELECT * FROM $table WHERE ID = %d", $mid); |
| 4280 |
$datas = $wpdb->get_results( $query, ARRAY_A ); |
| 4281 |
if( $datas ) { |
| 4282 |
$infos = $datas[0]; |
| 4283 |
|
| 4284 |
$table = $wpdb->prefix . "usces_member_meta"; |
| 4285 |
$query = $wpdb->prepare("SELECT meta_key, meta_value FROM $table WHERE member_id = %d", $mid); |
| 4286 |
$metas = $wpdb->get_results( $query, ARRAY_A ); |
| 4287 |
|
| 4288 |
foreach( $metas as $meta ){ |
| 4289 |
$infos[$meta['meta_key']] = maybe_unserialize($meta['meta_value']); |
| 4290 |
} |
| 4291 |
} |
| 4292 |
return $infos; |
| 4293 |
} |
| 4294 |
|
| 4295 |
function set_member_info( $data=array(), $mid ) { |
| 4296 |
global $wpdb; |
| 4297 |
|
| 4298 |
$table = $wpdb->prefix . "usces_member"; |
| 4299 |
$res = $wpdb->update( $table, $data, array('ID'=>$mid), NULL, array('%d')); |
| 4300 |
return $res; |
| 4301 |
} |
| 4302 |
|
| 4303 |
function is_order($mid, $oid) { |
| 4304 |
global $wpdb; |
| 4305 |
|
| 4306 |
$table = $wpdb->prefix . "usces_order"; |
| 4307 |
$query = $wpdb->prepare("SELECT ID FROM $table WHERE ID = %d AND mem_id = %d", $oid, $mid); |
| 4308 |
$mem_id = $wpdb->get_var( $query ); |
| 4309 |
if ( empty($mem_id) ) { |
| 4310 |
return false; |
| 4311 |
}else{ |
| 4312 |
return true; |
| 4313 |
} |
| 4314 |
} |
| 4315 |
|
| 4316 |
function is_purchased_item($mid, $post_id, $sku = NULL) { |
| 4317 |
global $wpdb; |
| 4318 |
$res = false; |
| 4319 |
|
| 4320 |
$history = $this->get_member_history($mid); |
| 4321 |
foreach ( $history as $umhs ) { |
| 4322 |
$cart = $umhs['cart']; |
| 4323 |
$status = $umhs['order_status']; |
| 4324 |
for($i=0; $i<count($cart); $i++) { |
| 4325 |
$cart_row = $cart[$i]; |
| 4326 |
$sku_code = urldecode($cart_row['sku']); |
| 4327 |
if( empty($sku) ){ |
| 4328 |
if( $cart_row['post_id'] == $post_id && (false === strpos($status, 'noreceipt') && false === strpos($status, 'pending')) ){ |
| 4329 |
$res = true; |
| 4330 |
break 2; |
| 4331 |
}elseif( $cart_row['post_id'] == $post_id && (false !== strpos($status, 'noreceipt') || false !== strpos($status, 'pending')) ){ |
| 4332 |
$res = 'noreceipt'; |
| 4333 |
break 2; |
| 4334 |
} |
| 4335 |
}else{ |
| 4336 |
if( $cart_row['post_id'] == $post_id && $sku_code == $sku && (false === strpos($status, 'noreceipt') && false === strpos($status, 'pending')) ){ |
| 4337 |
$res = true; |
| 4338 |
break 2; |
| 4339 |
}elseif( $cart_row['post_id'] == $post_id && $sku_code == $sku && (false !== strpos($status, 'noreceipt') || false !== strpos($status, 'pending')) ){ |
| 4340 |
$res = 'noreceipt'; |
| 4341 |
break 2; |
| 4342 |
} |
| 4343 |
} |
| 4344 |
} |
| 4345 |
|
| 4346 |
} |
| 4347 |
return $res; |
| 4348 |
} |
| 4349 |
|
| 4350 |
function get_order_data($order_id, $mode = '' ) { |
| 4351 |
global $wpdb, $usces; |
| 4352 |
$order_table = $wpdb->prefix . "usces_order"; |
| 4353 |
|
| 4354 |
$query = $wpdb->prepare("SELECT * FROM $order_table WHERE ID = %d", $order_id); |
| 4355 |
|
| 4356 |
if( 'direct' == $mode ){ |
| 4357 |
$value = $wpdb->get_row( $query, ARRAY_A ); |
| 4358 |
return $value; |
| 4359 |
} |
| 4360 |
|
| 4361 |
$value = $wpdb->get_row( $query ); |
| 4362 |
|
| 4363 |
if( $value == NULL ) { |
| 4364 |
return false; |
| 4365 |
}else{ |
| 4366 |
$res =array(); |
| 4367 |
} |
| 4368 |
if(strpos($value->order_status, 'cancel') !== false || strpos($value->order_status, 'estimate') !== false){ |
| 4369 |
return false; |
| 4370 |
} |
| 4371 |
|
| 4372 |
$res = array( |
| 4373 |
'ID' => $value->ID, |
| 4374 |
'mem_id' => $value->mem_id, |
| 4375 |
'cart' => unserialize($value->order_cart), |
| 4376 |
'condition' => unserialize($value->order_condition), |
| 4377 |
'getpoint' => $value->order_getpoint, |
| 4378 |
'usedpoint' => $value->order_usedpoint, |
| 4379 |
'discount' => $value->order_discount, |
| 4380 |
'payment_name' => $value->order_payment_name, |
| 4381 |
'shipping_charge' => $value->order_shipping_charge, |
| 4382 |
'cod_fee' => $value->order_cod_fee, |
| 4383 |
'tax' => $value->order_tax, |
| 4384 |
'end_price' => $value->order_item_total_price - $value->order_usedpoint + $value->order_discount + $value->order_shipping_charge + $value->order_cod_fee + $value->order_tax, |
| 4385 |
'status' => $value->order_status, |
| 4386 |
'date' => mysql2date(__('Y/m/d'), $value->order_date), |
| 4387 |
'modified' => mysql2date(__('Y/m/d'), $value->order_modified) |
| 4388 |
); |
| 4389 |
|
| 4390 |
return $res; |
| 4391 |
} |
| 4392 |
|
| 4393 |
function get_orderIDs_by_postID($mem_id, $post_id) { |
| 4394 |
global $wpdb; |
| 4395 |
$order_table = $wpdb->prefix . "usces_order"; |
| 4396 |
|
| 4397 |
$query = $wpdb->prepare("SELECT ID, order_cart, order_status FROM $order_table WHERE mem_id = %d ORDER BY order_modified DESC, order_date DESC", $mem_id); |
| 4398 |
$rows = $wpdb->get_query( $query, ARRAY_A ); |
| 4399 |
|
| 4400 |
if( $value == NULL ) { |
| 4401 |
return false; |
| 4402 |
}else{ |
| 4403 |
foreach($rows as $row){ |
| 4404 |
if(strpos($row['order_status'], 'cancel') !== false || strpos($row['order_status'], 'estimate') !== false){ |
| 4405 |
continue; |
| 4406 |
}else{ |
| 4407 |
$carts = unserialize($row['order_cart']); |
| 4408 |
foreach($carts as $cart){ |
| 4409 |
if( $post_id == $cart['post_id'] ){ |
| 4410 |
$res[] = $row['ID']; |
| 4411 |
break; |
| 4412 |
} |
| 4413 |
} |
| 4414 |
} |
| 4415 |
} |
| 4416 |
} |
| 4417 |
return $res; |
| 4418 |
} |
| 4419 |
|
| 4420 |
function incart_check() { |
| 4421 |
//$_POST = $this->stripslashes_deep_post($_POST); |
| 4422 |
$mes = array(); |
| 4423 |
|
| 4424 |
$ids = array_keys($_POST['inCart']); |
| 4425 |
$post_id = $ids[0]; |
| 4426 |
$skus = array_keys($_POST['inCart'][$post_id]); |
| 4427 |
$sku = $skus[0]; |
| 4428 |
$quant = isset($_POST['quant'][$post_id][$sku]) ? (int)$_POST['quant'][$post_id][$sku] : 1; |
| 4429 |
$stock = $this->getItemZaikoNum($post_id, $sku); |
| 4430 |
$zaiko_id = (int)$this->getItemZaikoStatusId($post_id, $sku); |
| 4431 |
$itemRestriction = get_post_meta($post_id, '_itemRestriction',true ); |
| 4432 |
|
| 4433 |
if( 1 > $quant ){ |
| 4434 |
$mes[$post_id][$sku] = __('enter the correct amount', 'usces') . "<br />"; |
| 4435 |
}else if( $quant > (int)$itemRestriction && !WCUtils::is_blank($itemRestriction) && !WCUtils::is_zero($itemRestriction) ){ |
| 4436 |
$mes[$post_id][$sku] = sprintf(__("This article is limited by %d at a time.", 'usces'), $itemRestriction) . "<br />"; |
| 4437 |
}else if( $quant > (int)$stock && !WCUtils::is_blank($stock) ){ |
| 4438 |
$mes[$post_id][$sku] = __('Sorry, stock is insufficient.', 'usces') . ' ' . __('Current stock', 'usces') . $stock . "<br />"; |
| 4439 |
}else if( 1 < $zaiko_id ){ |
| 4440 |
$mes[$post_id][$sku] = __('Sorry, this item is sold out.', 'usces') . "<br />"; |
| 4441 |
} |
| 4442 |
|
| 4443 |
$ioptkeys = $this->get_itemOptionKey( $post_id, true ); |
| 4444 |
if($ioptkeys){ |
| 4445 |
foreach($ioptkeys as $key => $value){ |
| 4446 |
$optValues = $this->get_itemOptions( urldecode($value), $post_id ); |
| 4447 |
if( 0 == $optValues['means'] ){ //case of select |
| 4448 |
if( $optValues['essential'] && '#NONE#' == $_POST['itemOption'][$post_id][$sku][$value] ){ |
| 4449 |
$mes[$post_id][$sku] .= sprintf(__("Chose the %s", 'usces'), urldecode($value)) . "<br />"; |
| 4450 |
} |
| 4451 |
}elseif( 1 == $optValues['means'] ){ //case of multiselect |
| 4452 |
if( $optValues['essential'] ){ |
| 4453 |
$mselect = 0; |
| 4454 |
foreach((array)$_POST['itemOption'][$post_id][$sku][$value] as $mvalue){ |
| 4455 |
if(!empty($mvalue) and '#NONE#' != $mvalue) $mselect++; |
| 4456 |
} |
| 4457 |
if( $mselect == 0 ){ |
| 4458 |
$mes[$post_id][$sku] .= sprintf(__("Chose the %s", 'usces'), urldecode($value)) . "<br />"; |
| 4459 |
} |
| 4460 |
} |
| 4461 |
}else{ //case of text |
| 4462 |
if( $optValues['essential'] && WCUtils::is_blank($_POST['itemOption'][$post_id][$sku][$value]) ){ |
| 4463 |
$mes[$post_id][$sku] .= sprintf(__("Input the %s", 'usces'), urldecode($value)) . "<br />"; |
| 4464 |
} |
| 4465 |
} |
| 4466 |
} |
| 4467 |
} |
| 4468 |
|
| 4469 |
$mes = apply_filters('usces_filter_incart_check', $mes, $post_id, $sku); |
| 4470 |
|
| 4471 |
if( isset($mes[$post_id]) && is_array($mes[$post_id]) ){ |
| 4472 |
foreach( $mes[$post_id] as $skukey => $skuvalue ){ |
| 4473 |
$mes[$post_id][$skukey] = rtrim($skuvalue, "<br />"); |
| 4474 |
} |
| 4475 |
} |
| 4476 |
|
| 4477 |
if( !empty($mes) ){ |
| 4478 |
$_SESSION['usces_singleitem']['itemOption'] = $_POST['itemOption']; |
| 4479 |
$_SESSION['usces_singleitem']['quant'] = $_POST['quant']; |
| 4480 |
$_SESSION['usces_singleitem']['error_message'] = $mes; |
| 4481 |
if( false === strpos($_POST['usces_referer'], 'http') ){ |
| 4482 |
$parse_url = parse_url(get_home_url()); |
| 4483 |
header('location: ' . $parse_url['scheme'] . '://' . $parse_url['host'] . $_POST['usces_referer'] . '#cart_button'); |
| 4484 |
}else{ |
| 4485 |
header('location: ' . $_POST['usces_referer'] . '#cart_button'); |
| 4486 |
} |
| 4487 |
exit; |
| 4488 |
} |
| 4489 |
|
| 4490 |
do_action('usces_action_incart_checked', $mes, $post_id, $sku); |
| 4491 |
} |
| 4492 |
|
| 4493 |
function zaiko_check() { |
| 4494 |
$mes = ''; |
| 4495 |
$cart = $this->cart->get_cart(); |
| 4496 |
$stocks = array(); |
| 4497 |
|
| 4498 |
for($i=0; $i<count($cart); $i++) { |
| 4499 |
$cart_row = $cart[$i]; |
| 4500 |
$post_id = $cart_row['post_id']; |
| 4501 |
$sku = $cart_row['sku']; |
| 4502 |
$sku_code = urldecode($cart_row['sku']); |
| 4503 |
|
| 4504 |
$quant = ( isset($_POST['quant']) ) ? trim($_POST['quant'][$i][$post_id][$sku]) : $cart_row['quantity']; |
| 4505 |
//$zaiko_status = $this->getItemZaiko($post_id, $sku); |
| 4506 |
$zaiko_id = (int)$this->getItemZaikoStatusId($post_id, $sku_code); |
| 4507 |
$stock = $this->getItemZaikoNum($post_id, $sku_code); |
| 4508 |
if( !isset($stocks[$post_id][$sku]) ){ |
| 4509 |
if( !WCUtils::is_blank($stock) ){ |
| 4510 |
$stocks[$post_id][$sku] = $stock; |
| 4511 |
}else{ |
| 4512 |
$stocks[$post_id][$sku] = NULL; |
| 4513 |
} |
| 4514 |
} |
| 4515 |
$checkstock = $stocks[$post_id][$sku]; |
| 4516 |
$stocks[$post_id][$sku] = $stocks[$post_id][$sku] - $quant; |
| 4517 |
$itemRestriction = get_post_meta($post_id, '_itemRestriction', true); |
| 4518 |
|
| 4519 |
//$red = (in_array($zaiko_status, array(__('Sold Out', 'usces'), __('Out Of Stock', 'usces'), __('Out of print', 'usces')))) ? 'red' : ''; |
| 4520 |
|
| 4521 |
if( 1 > (int)$quant ){ |
| 4522 |
$mes .= sprintf(__("Enter the correct amount for the No.%d item.", 'usces'), ($i+1)) . "<br />"; |
| 4523 |
}else if( 1 < $zaiko_id || WCUtils::is_zero($stock) ){ |
| 4524 |
$mes .= sprintf(__('Sorry, No.%d item is sold out.', 'usces'), ($i+1)) . "<br />"; |
| 4525 |
}else if( $quant > (int)$itemRestriction && !WCUtils::is_blank($itemRestriction) && !WCUtils::is_zero($itemRestriction) ){ |
| 4526 |
$mes .= sprintf(__('This article is limited by %1$d at a time for the No.%2$d item.', 'usces'), $itemRestriction, ($i+1)) . "<br />"; |
| 4527 |
}else if( 0 > $stocks[$post_id][$sku] && !WCUtils::is_blank($stock) ){ |
| 4528 |
$mes .= sprintf(__('Stock of No.%1$d item is remainder %2$d.', 'usces'), ($i+1), $checkstock) . "<br />"; |
| 4529 |
} |
| 4530 |
} |
| 4531 |
$mes = apply_filters('usces_filter_zaiko_check', $mes, $cart); |
| 4532 |
return $mes; |
| 4533 |
} |
| 4534 |
|
| 4535 |
function member_check() { |
| 4536 |
$mes = ''; |
| 4537 |
foreach ( $_POST['member'] as $key => $vlue ) { |
| 4538 |
$_SESSION['usces_member'][$key] = trim($vlue); |
| 4539 |
} |
| 4540 |
//0000526 |
| 4541 |
$member_pass_rule_min = $this->options['system']['member_pass_rule_min']; |
| 4542 |
$member_pass_rule_max = $this->options['system']['member_pass_rule_max']; |
| 4543 |
|
| 4544 |
if ( !WCUtils::is_blank($_POST['member']['password1']) || !WCUtils::is_blank($_POST['member']['password2']) ){ |
| 4545 |
if( !empty( $member_pass_rule_max ) ){ |
| 4546 |
if( $member_pass_rule_min > strlen( trim($_POST['member']['password1']) ) || strlen( trim($_POST['member']['password1']) ) > $member_pass_rule_max ){ |
| 4547 |
$mes .= sprintf(__('Please enter %2$s characters a minimum of %1$s characters and a maximum password.', 'usces'), $member_pass_rule_min, $member_pass_rule_max ) . "<br />"; |
| 4548 |
} |
| 4549 |
}else{ |
| 4550 |
if( $member_pass_rule_min > strlen( trim($_POST['member']['password1']) ) ){ |
| 4551 |
$mes .= sprintf(__('Please enter at least %s characters password.', 'usces'), $member_pass_rule_min) . "<br />"; |
| 4552 |
} |
| 4553 |
} |
| 4554 |
} |
| 4555 |
if ( $_POST['member_regmode'] == 'editmemberform' ) { |
| 4556 |
if ( (!WCUtils::is_blank($_POST['member']['password1']) || !WCUtils::is_blank($_POST['member']['password2']) ) && trim($_POST['member']['password1']) != trim($_POST['member']['password2']) ) |
| 4557 |
$mes .= __('Password is not correct.', 'usces') . "<br />"; |
| 4558 |
|
| 4559 |
if ( !is_email($_POST['member']['mailaddress1']) || WCUtils::is_blank($_POST['member']['mailaddress1']) ) |
| 4560 |
$mes .= __('e-mail address is not correct', 'usces') . "<br />"; |
| 4561 |
|
| 4562 |
} else { |
| 4563 |
if ( WCUtils::is_blank($_POST['member']['password1']) || WCUtils::is_blank($_POST['member']['password2']) || trim($_POST['member']['password1']) != trim($_POST['member']['password2']) ) |
| 4564 |
$mes .= __('Password is not correct.', 'usces') . "<br />"; |
| 4565 |
if ( !is_email($_POST['member']['mailaddress1']) || WCUtils::is_blank($_POST['member']['mailaddress1']) || WCUtils::is_blank($_POST['member']['mailaddress2']) || trim($_POST['member']['mailaddress1']) != trim($_POST['member']['mailaddress2']) ) |
| 4566 |
$mes .= __('e-mail address is not correct', 'usces') . "<br />"; |
| 4567 |
|
| 4568 |
} |
| 4569 |
if ( WCUtils::is_blank($_POST["member"]["name1"]) ) |
| 4570 |
$mes .= __('Name is not correct', 'usces') . "<br />";//20111116ysk 0000299 |
| 4571 |
// if ( trim($_POST["member"]["name3"]) == "" && USCES_JP ) |
| 4572 |
// $mes .= __('Invalid CANNAT pretend.', 'usces') . "<br />"; |
| 4573 |
if ( WCUtils::is_blank($_POST["member"]["zipcode"]) ) |
| 4574 |
$mes .= __('postal code is not correct', 'usces') . "<br />"; |
| 4575 |
if ( $_POST["member"]["pref"] == __('-- Select --', 'usces') ) |
| 4576 |
$mes .= __('enter the prefecture', 'usces') . "<br />"; |
| 4577 |
if ( WCUtils::is_blank($_POST["member"]["address1"]) ) |
| 4578 |
$mes .= __('enter the city name', 'usces') . "<br />"; |
| 4579 |
if ( WCUtils::is_blank($_POST["member"]["address2"]) ) |
| 4580 |
$mes .= __('enter house numbers', 'usces') . "<br />"; |
| 4581 |
if ( WCUtils::is_blank($_POST["member"]["tel"]) ) |
| 4582 |
$mes .= __('enter phone numbers', 'usces') . "<br />"; |
| 4583 |
if( !WCUtils::is_blank($_POST['member']["tel"]) && preg_match("/[^\d-]/", trim($_POST["member"]["tel"])) ) |
| 4584 |
$mes .= __('Please input a phone number with a half size number.', 'usces') . "<br />"; |
| 4585 |
|
| 4586 |
$mes = apply_filters('usces_filter_member_check', $mes); |
| 4587 |
|
| 4588 |
return $mes; |
| 4589 |
} |
| 4590 |
|
| 4591 |
function member_check_fromcart() { |
| 4592 |
$mes = ''; |
| 4593 |
//0000526 |
| 4594 |
$member_pass_rule_min = $this->options['system']['member_pass_rule_min']; |
| 4595 |
$member_pass_rule_max = $this->options['system']['member_pass_rule_max']; |
| 4596 |
|
| 4597 |
if ( !WCUtils::is_blank($_POST['customer']['password1']) || !WCUtils::is_blank($_POST['customer']['password2']) ){ |
| 4598 |
if( !empty( $member_pass_rule_max ) ){ |
| 4599 |
if( $member_pass_rule_min > strlen( trim($_POST['customer']['password1']) ) || strlen( trim($_POST['customer']['password1']) ) > $member_pass_rule_max ) |
| 4600 |
$mes .= sprintf(__('Please enter %2$s characters a minimum of %1$s characters and a maximum password.', 'usces'), $member_pass_rule_min, $member_pass_rule_max ) . "<br />"; |
| 4601 |
}else{ |
| 4602 |
if( $member_pass_rule_min > strlen( trim($_POST['customer']['password1']) ) ) |
| 4603 |
$mes .= sprintf(__('Please enter at least %s characters password.', 'usces'), $member_pass_rule_min) . "<br />"; |
| 4604 |
} |
| 4605 |
} |
| 4606 |
if ( WCUtils::is_blank($_POST['customer']['password1']) || WCUtils::is_blank($_POST['customer']['password2']) || trim($_POST['customer']['password1']) != trim($_POST['customer']['password2']) ) |
| 4607 |
$mes .= __('Password is not correct.', 'usces') . "<br />"; |
| 4608 |
if ( !is_email($_POST['customer']['mailaddress1']) || WCUtils::is_blank($_POST['customer']['mailaddress1']) || WCUtils::is_blank($_POST['customer']['mailaddress2']) || trim($_POST['customer']['mailaddress1']) != trim($_POST['customer']['mailaddress2']) ) |
| 4609 |
$mes .= __('e-mail address is not correct', 'usces') . "<br />"; |
| 4610 |
if ( WCUtils::is_blank($_POST["customer"]["name1"]) ) |
| 4611 |
$mes .= __('Name is not correct', 'usces') . "<br />";//20111116ysk 0000299 |
| 4612 |
// if ( trim($_POST["customer"]["name3"]) == "" && USCES_JP ) |
| 4613 |
// $mes .= __('Invalid CANNAT pretend.', 'usces') . "<br />"; |
| 4614 |
if ( WCUtils::is_blank($_POST["customer"]["zipcode"]) ) |
| 4615 |
$mes .= __('postal code is not correct', 'usces') . "<br />"; |
| 4616 |
if ( $_POST["customer"]["pref"] == __('-- Select --', 'usces') ) |
| 4617 |
$mes .= __('enter the prefecture', 'usces') . "<br />"; |
| 4618 |
if ( WCUtils::is_blank($_POST["customer"]["address1"]) ) |
| 4619 |
$mes .= __('enter the city name', 'usces') . "<br />"; |
| 4620 |
if ( WCUtils::is_blank($_POST["customer"]["address2"]) ) |
| 4621 |
$mes .= __('enter house numbers', 'usces') . "<br />"; |
| 4622 |
if ( WCUtils::is_blank($_POST["customer"]["tel"]) ) |
| 4623 |
$mes .= __('enter phone numbers', 'usces') . "<br />"; |
| 4624 |
if( !WCUtils::is_blank($_POST['customer']["tel"]) && preg_match("/[^\d-]/", trim($_POST["customer"]["tel"])) ) |
| 4625 |
$mes .= __('Please input a phone number with a half size number.', 'usces') . "<br />"; |
| 4626 |
|
| 4627 |
$mes = apply_filters('usces_filter_member_check_fromcart', $mes); |
| 4628 |
|
| 4629 |
return $mes; |
| 4630 |
} |
| 4631 |
|
| 4632 |
function admin_member_check() { |
| 4633 |
global $wpdb; |
| 4634 |
$mes = ''; |
| 4635 |
if ( !is_email( trim($_POST['member']["email"]) ) ){ |
| 4636 |
$mes .= __('e-mail address is not correct', 'usces') . "<br />"; |
| 4637 |
}else{ |
| 4638 |
$member_table = $wpdb->prefix . "usces_member"; |
| 4639 |
$mem_email = $wpdb->get_var( $wpdb->prepare("SELECT mem_email FROM $member_table WHERE ID = %d LIMIT 1", trim($_POST['member_id'])) ); |
| 4640 |
if( trim($_POST['member']["email"]) != $mem_email ){ |
| 4641 |
$mem_ID = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $member_table WHERE mem_email = %s LIMIT 1", trim($_POST['member']["email"])) ); |
| 4642 |
if( !empty($mem_ID) ) |
| 4643 |
$mes .= __('This e-mail address has been already registered.', 'usces') . "<br />"; |
| 4644 |
} |
| 4645 |
} |
| 4646 |
if ( WCUtils::is_blank($_POST['member']["name1"]) ) |
| 4647 |
$mes .= __('Name is not correct', 'usces') . "<br />"; |
| 4648 |
// if ( trim($_POST["mem_name3"]) == "" && USCES_JP ) |
| 4649 |
// $mes .= __('Invalid CANNAT pretend.', 'usces') . "<br />"; |
| 4650 |
// if ( trim($_POST['member']["zipcode"]) == "" ) |
| 4651 |
// $mes .= __('postal code is not correct', 'usces') . "<br />"; |
| 4652 |
// if ( $_POST['member']["pref"] == __('-- Select --', 'usces') ) |
| 4653 |
// $mes .= __('enter the prefecture', 'usces') . "<br />"; |
| 4654 |
// if ( trim($_POST['member']["address1"]) == "" ) |
| 4655 |
// $mes .= __('enter the city name', 'usces') . "<br />"; |
| 4656 |
// if ( trim($_POST['member']["address2"]) == "" ) |
| 4657 |
// $mes .= __('enter house numbers', 'usces') . "<br />"; |
| 4658 |
// if ( trim($_POST['member']["tel"]) == "" ) |
| 4659 |
// $mes .= __('enter phone numbers', 'usces') . "<br />"; |
| 4660 |
if( !WCUtils::is_blank($_POST['member']["tel"]) && preg_match("/[^\d-]/", trim($_POST["member"]["tel"])) ) |
| 4661 |
$mes .= __('Please input a phone number with a half size number.', 'usces') . "<br />"; |
| 4662 |
|
| 4663 |
$mes = apply_filters('usces_filter_admin_member_check', $mes); |
| 4664 |
|
| 4665 |
return $mes; |
| 4666 |
} |
| 4667 |
|
| 4668 |
function customer_check() { |
| 4669 |
$mes = ''; |
| 4670 |
if ( !is_email($_POST['customer']['mailaddress1']) || WCUtils::is_blank($_POST['customer']['mailaddress1']) || WCUtils::is_blank($_POST['customer']['mailaddress2']) || trim($_POST['customer']['mailaddress1']) != trim($_POST['customer']['mailaddress2']) ) |
| 4671 |
$mes .= __('e-mail address is not correct', 'usces') . "<br />"; |
| 4672 |
if ( WCUtils::is_blank($_POST["customer"]["name1"]) ) |
| 4673 |
$mes .= __('Name is not correct', 'usces') . "<br />";//20111116ysk 0000299 |
| 4674 |
// if ( trim($_POST["customer"]["name3"]) == "" && USCES_JP ) |
| 4675 |
// $mes .= __('Invalid CANNAT pretend.', 'usces') . "<br />"; |
| 4676 |
if ( WCUtils::is_blank($_POST["customer"]["zipcode"]) ) |
| 4677 |
$mes .= __('postal code is not correct', 'usces') . "<br />"; |
| 4678 |
if ( $_POST["customer"]["pref"] == __('-- Select --', 'usces') ) |
| 4679 |
$mes .= __('enter the prefecture', 'usces') . "<br />"; |
| 4680 |
if ( WCUtils::is_blank($_POST["customer"]["address1"]) ) |
| 4681 |
$mes .= __('enter the city name', 'usces') . "<br />"; |
| 4682 |
if ( WCUtils::is_blank($_POST["customer"]["address2"]) ) |
| 4683 |
$mes .= __('enter house numbers', 'usces') . "<br />"; |
| 4684 |
if ( WCUtils::is_blank($_POST["customer"]["tel"]) ) |
| 4685 |
$mes .= __('enter phone numbers', 'usces') . "<br />"; |
| 4686 |
if( !WCUtils::is_blank($_POST['customer']["tel"]) && preg_match("/[^\d-]/", trim($_POST["customer"]["tel"])) ) |
| 4687 |
$mes .= __('Please input a phone number with a half size number.', 'usces') . "<br />"; |
| 4688 |
|
| 4689 |
$mes = apply_filters('usces_filter_customer_check', $mes); |
| 4690 |
|
| 4691 |
return $mes; |
| 4692 |
} |
| 4693 |
|
| 4694 |
function delivery_check() { |
| 4695 |
$mes = ''; |
| 4696 |
if ( isset($_POST['delivery']['delivery_flag']) && $_POST['delivery']['delivery_flag'] == 1 ) { |
| 4697 |
if ( WCUtils::is_blank($_POST["delivery"]["name1"]) ) |
| 4698 |
$mes .= __('Name is not correct', 'usces') . "<br />";//20111116ysk 0000299 |
| 4699 |
// if ( trim($_POST["delivery"]["name3"]) == "" && USCES_JP ) |
| 4700 |
// $mes .= __('Invalid CANNAT pretend.', 'usces') . "<br />"; |
| 4701 |
if ( WCUtils::is_blank($_POST["delivery"]["zipcode"]) ) |
| 4702 |
$mes .= __('postal code is not correct', 'usces') . "<br />"; |
| 4703 |
if ( $_POST["delivery"]["pref"] == __('-- Select --', 'usces') ) |
| 4704 |
$mes .= __('enter the prefecture', 'usces') . "<br />"; |
| 4705 |
if ( WCUtils::is_blank($_POST["delivery"]["address1"]) ) |
| 4706 |
$mes .= __('enter the city name', 'usces') . "<br />"; |
| 4707 |
if ( WCUtils::is_blank($_POST["delivery"]["address2"]) ) |
| 4708 |
$mes .= __('enter house numbers', 'usces') . "<br />"; |
| 4709 |
if ( WCUtils::is_blank($_POST["delivery"]["tel"]) ) |
| 4710 |
$mes .= __('enter phone numbers', 'usces') . "<br />"; |
| 4711 |
} |
| 4712 |
if ( !isset($_POST['offer']['delivery_method']) || (empty($_POST['offer']['delivery_method']) && !WCUtils::is_zero($_POST['offer']['delivery_method'])) ) |
| 4713 |
$mes .= __('chose one from delivery method.', 'usces') . "<br />"; |
| 4714 |
if ( !isset($_POST['offer']['payment_name']) ){ |
| 4715 |
$mes .= __('chose one from payment options.', 'usces') . "<br />"; |
| 4716 |
}else{ |
| 4717 |
$payments = $this->getPayments($_POST['offer']['payment_name']); |
| 4718 |
if('COD' == $payments['settlement']){ |
| 4719 |
$total_items_price = $this->get_total_price(); |
| 4720 |
$tax = $this->getTax( $total_items_price ); |
| 4721 |
$total_items_price = $total_items_price + $tax; |
| 4722 |
$cod_limit_amount = ( isset($this->options['cod_limit_amount']) && 0 < (int)$this->options['cod_limit_amount'] ) ? $this->options['cod_limit_amount'] : 0; |
| 4723 |
if( 0 < $cod_limit_amount && $total_items_price > $cod_limit_amount ) |
| 4724 |
$mes .= sprintf(__('A total products amount of money surpasses the upper limit(%s) that I can purchase in C.O.D.', 'usces'), usces_crform($this->options['cod_limit_amount'], true, false, 'return')) . "<br />"; |
| 4725 |
|
| 4726 |
} elseif( 'acting_zeus_conv' == $payments['settlement'] ) { |
| 4727 |
if( WCUtils::is_blank($_POST['username_conv']) ) { |
| 4728 |
$mes .= "お名前を� |
| 4729 |
�力してください。<br />"; |
| 4730 |
} elseif( !preg_match( "/^[ァ-ヶー]+$/u", $_POST['username_conv'] ) ) { |
| 4731 |
$mes .= "お名前は� |
| 4732 |
�角カタカナで� |
| 4733 |
�力してください。<br />"; |
| 4734 |
} |
| 4735 |
} |
| 4736 |
} |
| 4737 |
//20101119ysk start |
| 4738 |
if(isset($_POST['offer']['delivery_method']) and isset($_POST['offer']['payment_name'])) { |
| 4739 |
$d_method_index = $this->get_delivery_method_index((int)$_POST['offer']['delivery_method']); |
| 4740 |
if($this->options['delivery_method'][$d_method_index]['nocod'] == 1) { |
| 4741 |
$payments = $this->getPayments($_POST['offer']['payment_name']); |
| 4742 |
if('COD' == $payments['settlement']) |
| 4743 |
$mes .= __('COD is not available.', 'usces') . "<br />"; |
| 4744 |
} |
| 4745 |
} |
| 4746 |
//20101119ysk end |
| 4747 |
//20110317ysk start |
| 4748 |
if(isset($_POST['offer']['delivery_method'])) { |
| 4749 |
$d_method_index = $this->get_delivery_method_index((int)$_POST['offer']['delivery_method']); |
| 4750 |
$country = $_SESSION['usces_entry']["delivery"]["country"]; |
| 4751 |
$local_country = usces_get_base_country(); |
| 4752 |
if($country == $local_country) { |
| 4753 |
if($this->options['delivery_method'][$d_method_index]['intl'] == 1) { |
| 4754 |
$mes .= __('Delivery method is incorrect. Can not specify an international flight.', 'usces') . "<br />"; |
| 4755 |
} |
| 4756 |
} else { |
| 4757 |
if( WCUtils::is_zero($this->options['delivery_method'][$d_method_index]['intl']) ) { |
| 4758 |
$mes .= __('Delivery method is incorrect. Specify the international flights.', 'usces') . "<br />"; |
| 4759 |
} |
| 4760 |
} |
| 4761 |
} |
| 4762 |
//20110317ysk end |
| 4763 |
|
| 4764 |
$mes = apply_filters('usces_filter_delivery_check', $mes); |
| 4765 |
|
| 4766 |
return $mes; |
| 4767 |
} |
| 4768 |
|
| 4769 |
function point_check( $entries ) { |
| 4770 |
$member = $this->get_member(); |
| 4771 |
$this->set_cart_fees( $member, $entries ); |
| 4772 |
$mes = ''; |
| 4773 |
if( isset($_POST['offer']["usedpoint"]) ) { |
| 4774 |
if ( WCUtils::is_blank($_POST['offer']["usedpoint"]) || !preg_match("/^[0-9]+$/", $_POST['offer']["usedpoint"]) || (int)$_POST['offer']["usedpoint"] < 0 ) { |
| 4775 |
$mes .= __('Invalid value. Please enter in the numbers.', 'usces') . "<br />"; |
| 4776 |
} else { |
| 4777 |
/* if ( trim($_POST['offer']["usedpoint"]) > $member['point'] ){ |
| 4778 |
$mes .= __('You have exceeded the maximum available.', 'usces') . "max".$member['point']."pt<br />"; |
| 4779 |
$_POST['offer']["usedpoint"] = 0; |
| 4780 |
$array = array( |
| 4781 |
'usedpoint' => 0 |
| 4782 |
); |
| 4783 |
$this->cart->set_order_entry( $array ); |
| 4784 |
}elseif($this->options['point_coverage'] && trim($_POST['offer']["usedpoint"]) > ($entries['order']['total_items_price'] + $entries['order']['discount'] + $entries['order']['shipping_charge'] + $entries['order']['cod_fee'])){ |
| 4785 |
$mes .= __('You have exceeded the maximum available.', 'usces') . "max".($entries['order']['total_items_price'] + $entries['order']['discount'] + $entries['order']['shipping_charge'] + $entries['order']['cod_fee'])."pt<br />"; |
| 4786 |
$_POST['offer']["usedpoint"] = 0; |
| 4787 |
$array = array( |
| 4788 |
'usedpoint' => 0 |
| 4789 |
); |
| 4790 |
$this->cart->set_order_entry( $array ); |
| 4791 |
}elseif(!$this->options['point_coverage'] && trim($_POST['offer']["usedpoint"]) > ($entries['order']['total_items_price'] + $entries['order']['discount'])){ |
| 4792 |
$mes .= __('You have exceeded the maximum available.', 'usces') . "max".($entries['order']['total_items_price'] + $entries['order']['discount'])."pt<br />"; |
| 4793 |
$_POST['offer']["usedpoint"] = 0; |
| 4794 |
$array = array( |
| 4795 |
'usedpoint' => 0 |
| 4796 |
); |
| 4797 |
$this->cart->set_order_entry( $array ); |
| 4798 |
} |
| 4799 |
*/ if( trim($_POST['offer']["usedpoint"]) > $member['point'] ) { |
| 4800 |
$mes .= __('You have exceeded the maximum available.', 'usces')."max".$member['point']."pt<br />"; |
| 4801 |
} elseif( $this->options['point_coverage'] && trim($_POST['offer']["usedpoint"]) > ($entries['order']['total_items_price'] + $entries['order']['discount'] + $entries['order']['shipping_charge'] + $entries['order']['cod_fee']) ) { |
| 4802 |
$mes .= __('You have exceeded the maximum available.', 'usces')."max".($entries['order']['total_items_price'] + $entries['order']['discount'] + $entries['order']['shipping_charge'] + $entries['order']['cod_fee'])."pt<br />"; |
| 4803 |
} elseif( !$this->options['point_coverage'] && trim($_POST['offer']["usedpoint"]) > ($entries['order']['total_items_price'] + $entries['order']['discount']) ) { |
| 4804 |
$mes .= __('You have exceeded the maximum available.', 'usces')."max".($entries['order']['total_items_price'] + $entries['order']['discount'])."pt<br />"; |
| 4805 |
} |
| 4806 |
$mes = apply_filters( 'usces_filter_point_check', $mes ); |
| 4807 |
if( '' != $mes ) { |
| 4808 |
$_POST['offer']["usedpoint"] = 0; |
| 4809 |
$array = array( |
| 4810 |
'usedpoint' => 0 |
| 4811 |
); |
| 4812 |
$this->cart->set_order_entry( $array ); |
| 4813 |
} |
| 4814 |
} |
| 4815 |
} |
| 4816 |
$mes = apply_filters('usces_filter_point_check_last', $mes); |
| 4817 |
return $mes; |
| 4818 |
} |
| 4819 |
|
| 4820 |
function lostpass_mailaddcheck() { |
| 4821 |
$mes = ''; |
| 4822 |
if ( !is_email($_POST['loginmail']) || WCUtils::is_blank($_POST['loginmail']) ) { |
| 4823 |
$mes .= __('e-mail address is not correct', 'usces') . "<br />"; |
| 4824 |
}elseif( !$this->is_member($_POST['loginmail']) ){ |
| 4825 |
$mes .= __('It is the e-mail address that there is not.', 'usces') . "<br />"; |
| 4826 |
} |
| 4827 |
|
| 4828 |
return $mes; |
| 4829 |
} |
| 4830 |
|
| 4831 |
function changepass_check() { |
| 4832 |
$mes = ''; |
| 4833 |
if ( WCUtils::is_blank($_POST['loginpass1']) || WCUtils::is_blank($_POST['loginpass2']) || (trim($_POST['loginpass1']) != trim($_POST['loginpass2']))) |
| 4834 |
$mes .= __('Password is not correct.', 'usces') . "<br />"; |
| 4835 |
|
| 4836 |
return $mes; |
| 4837 |
} |
| 4838 |
|
| 4839 |
function get_page() { |
| 4840 |
return $this->page; |
| 4841 |
} |
| 4842 |
|
| 4843 |
function check_display_mode() { |
| 4844 |
$options = get_option('usces'); |
| 4845 |
if( isset($options['display_mode']) && $options['display_mode'] == 'Maintenancemode' ) return; |
| 4846 |
|
| 4847 |
$start['hour'] = empty($options['campaign_schedule']['start']['hour']) ? 0 : $options['campaign_schedule']['start']['hour']; |
| 4848 |
$start['min'] = empty($options['campaign_schedule']['start']['min']) ? 0 : $options['campaign_schedule']['start']['min']; |
| 4849 |
$start['month'] = empty($options['campaign_schedule']['start']['month']) ? 0 : $options['campaign_schedule']['start']['month']; |
| 4850 |
$start['day'] = empty($options['campaign_schedule']['start']['day']) ? 0 : $options['campaign_schedule']['start']['day']; |
| 4851 |
$start['year'] = empty($options['campaign_schedule']['start']['year']) ? 0 : $options['campaign_schedule']['start']['year']; |
| 4852 |
$end['hour'] = empty($options['campaign_schedule']['end']['hour']) ? 0 : $options['campaign_schedule']['end']['hour']; |
| 4853 |
$end['min'] = empty($options['campaign_schedule']['end']['min']) ? 0 : $options['campaign_schedule']['end']['min']; |
| 4854 |
$end['month'] = empty($options['campaign_schedule']['end']['month']) ? 0 : $options['campaign_schedule']['end']['month']; |
| 4855 |
$end['day'] = empty($options['campaign_schedule']['end']['day']) ? 0 : $options['campaign_schedule']['end']['day']; |
| 4856 |
$end['year'] = empty($options['campaign_schedule']['end']['year']) ? 0 : $options['campaign_schedule']['end']['year']; |
| 4857 |
$starttime = mktime($start['hour'], $start['min'], 0, $start['month'], $start['day'], $start['year']); |
| 4858 |
$endtime = mktime($end['hour'], $end['min'], 0, $end['month'], $end['day'], $end['year']); |
| 4859 |
$current_time = current_time('timestamp'); |
| 4860 |
|
| 4861 |
if( ($current_time >= $starttime) && ($current_time <= $endtime) ) |
| 4862 |
$options['display_mode'] = 'Promotionsale'; |
| 4863 |
else |
| 4864 |
$options['display_mode'] = 'Usualsale'; |
| 4865 |
|
| 4866 |
update_option('usces', $options); |
| 4867 |
|
| 4868 |
} |
| 4869 |
|
| 4870 |
function update_business_days() { |
| 4871 |
$options = get_option('usces'); |
| 4872 |
$datetimestr = get_date_from_gmt(gmdate('Y-m-d H:i:s', time())); |
| 4873 |
$dhour = (int)substr($datetimestr, 11, 2); |
| 4874 |
$dminute = (int)substr($datetimestr, 14, 2); |
| 4875 |
$dsecond = (int)substr($datetimestr, 17, 2); |
| 4876 |
$dmonth = (int)substr($datetimestr, 5, 2); |
| 4877 |
$dday = (int)substr($datetimestr, 8, 2); |
| 4878 |
$dyear = (int)substr($datetimestr, 0, 4); |
| 4879 |
$dtimestamp = mktime($dhour, $dminute, $dsecond, $dmonth, $dday, $dyear); |
| 4880 |
$datenow = getdate($dtimestamp); |
| 4881 |
//list($year, $mon, $mday) = getBeforeMonth($datenow['year'], $datenow['mon'], $datenow['mday'], 1); |
| 4882 |
list($year, $mon, $mday) = getBeforeMonth($datenow['year'], $datenow['mon'], 1, 1); |
| 4883 |
|
| 4884 |
if(isset($options['business_days'][$year][$mon][1])) |
| 4885 |
unset($options['business_days'][$year][$mon]); |
| 4886 |
|
| 4887 |
for($i=0; $i<12; $i++){ |
| 4888 |
//list($year, $mon, $mday) = getAfterMonth($datenow['year'], $datenow['mon'], $datenow['mday'], $i); |
| 4889 |
list($year, $mon, $mday) = getAfterMonth($datenow['year'], $datenow['mon'], 1, $i); |
| 4890 |
$last = getLastDay($year, $mon); |
| 4891 |
for($j=1; $j<=$last; $j++){ |
| 4892 |
if(!isset($options['business_days'][$year][$mon][$j])) |
| 4893 |
$options['business_days'][$year][$mon][$j] = 1; |
| 4894 |
} |
| 4895 |
} |
| 4896 |
update_option('usces', $options); |
| 4897 |
$this->options = get_option('usces'); |
| 4898 |
$_SESSION['usces_checked_business_days'] = ''; |
| 4899 |
} |
| 4900 |
|
| 4901 |
function display_cart() { |
| 4902 |
if($this->cart->num_row() > 0) { |
| 4903 |
include (USCES_PLUGIN_DIR . '/includes/cart_table.php'); |
| 4904 |
} else { |
| 4905 |
echo "<div class='no_cart'>" . __('There are no items in your cart.', 'usces') . "</div>\n"; |
| 4906 |
} |
| 4907 |
} |
| 4908 |
|
| 4909 |
function display_cart_confirm() { |
| 4910 |
if($this->cart->num_row() > 0) { |
| 4911 |
include (USCES_PLUGIN_DIR . '/includes/cart_confirm.php'); |
| 4912 |
} else { |
| 4913 |
echo "<div class='no_cart'>" . __('There are no items in your cart.', 'usces') . "</div>\n"; |
| 4914 |
} |
| 4915 |
} |
| 4916 |
|
| 4917 |
function set_initial() { |
| 4918 |
|
| 4919 |
usces_log('set_initial : OK', 'database_error.log'); |
| 4920 |
$rets07 = usces_upgrade_07(); |
| 4921 |
$rets11 = usces_upgrade_11(); |
| 4922 |
usces_log('rets11 : ' . print_r($rets11,true), 'database_error.log'); |
| 4923 |
$this->set_default_theme(); |
| 4924 |
$this->set_default_page(); |
| 4925 |
$this->set_default_categories(); |
| 4926 |
$this->create_table(); |
| 4927 |
$this->update_table(); |
| 4928 |
$this->update_options();//20120710ysk 0000472 |
| 4929 |
} |
| 4930 |
|
| 4931 |
function create_table() { |
| 4932 |
global $wpdb; |
| 4933 |
|
| 4934 |
if ( ! empty($wpdb->charset) ) |
| 4935 |
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
| 4936 |
if ( ! empty($wpdb->collate) ) |
| 4937 |
$charset_collate .= " COLLATE $wpdb->collate"; |
| 4938 |
|
| 4939 |
$access_table = $wpdb->prefix . "usces_access"; |
| 4940 |
$member_table = $wpdb->prefix . "usces_member"; |
| 4941 |
$member_meta_table = $wpdb->prefix . "usces_member_meta"; |
| 4942 |
$order_table = $wpdb->prefix . "usces_order"; |
| 4943 |
$order_meta_table = $wpdb->prefix . "usces_order_meta"; |
| 4944 |
|
| 4945 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
| 4946 |
|
| 4947 |
if($wpdb->get_var("show tables like '$member_table'") != $member_table) { |
| 4948 |
|
| 4949 |
$sql = "CREATE TABLE " . $access_table . " ( |
| 4950 |
ID BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , |
| 4951 |
acc_key VARCHAR( 50 ) NOT NULL , |
| 4952 |
acc_type VARCHAR( 50 ) NULL , |
| 4953 |
acc_value LONGTEXT NULL , |
| 4954 |
acc_date DATE NOT NULL DEFAULT '0000-00-00', |
| 4955 |
acc_num1 INT( 11 ) NOT NULL DEFAULT 0, |
| 4956 |
acc_num2 INT( 11 ) NOT NULL DEFAULT 0, |
| 4957 |
acc_str1 VARCHAR( 200 ) NULL , |
| 4958 |
acc_str2 VARCHAR( 200 ) NULL , |
| 4959 |
KEY acc_key ( acc_key ), |
| 4960 |
KEY acc_type ( acc_type ), |
| 4961 |
KEY acc_date ( acc_date ), |
| 4962 |
KEY acc_num1 ( acc_num1 ), |
| 4963 |
KEY acc_num2 ( acc_num2 ) |
| 4964 |
) ENGINE = MYISAM AUTO_INCREMENT=0 $charset_collate;"; |
| 4965 |
|
| 4966 |
dbDelta($sql); |
| 4967 |
add_option("usces_db_access", USCES_DB_ACCESS); |
| 4968 |
} |
| 4969 |
if($wpdb->get_var("show tables like '$member_table'") != $member_table) { |
| 4970 |
|
| 4971 |
$sql = "CREATE TABLE " . $member_table . " ( |
| 4972 |
ID BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , |
| 4973 |
mem_email VARCHAR( 100 ) NOT NULL , |
| 4974 |
mem_pass VARCHAR( 64 ) NOT NULL , |
| 4975 |
mem_status INT( 11 ) NOT NULL DEFAULT '0', |
| 4976 |
mem_cookie VARCHAR( 13 ) NULL , |
| 4977 |
mem_point INT( 11 ) NOT NULL DEFAULT '0', |
| 4978 |
mem_name1 VARCHAR( 100 ) NOT NULL , |
| 4979 |
mem_name2 VARCHAR( 100 ) NULL , |
| 4980 |
mem_name3 VARCHAR( 100 ) NULL , |
| 4981 |
mem_name4 VARCHAR( 100 ) NULL , |
| 4982 |
mem_zip VARCHAR( 50 ) NULL , |
| 4983 |
mem_pref VARCHAR( 100 ) NOT NULL , |
| 4984 |
mem_address1 VARCHAR( 100 ) NOT NULL , |
| 4985 |
mem_address2 VARCHAR( 100 ) NULL , |
| 4986 |
mem_address3 VARCHAR( 100 ) NULL , |
| 4987 |
mem_tel VARCHAR( 100 ) NOT NULL , |
| 4988 |
mem_fax VARCHAR( 100 ) NULL , |
| 4989 |
mem_delivery_flag TINYINT ( 1 ) NULL , |
| 4990 |
mem_delivery LONGTEXT, |
| 4991 |
mem_registered DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 4992 |
mem_nicename VARCHAR( 50 ) NULL , |
| 4993 |
KEY mem_email ( mem_email ) , |
| 4994 |
KEY mem_pass ( mem_pass ) |
| 4995 |
) ENGINE = MYISAM AUTO_INCREMENT=1000 $charset_collate;"; |
| 4996 |
|
| 4997 |
dbDelta($sql); |
| 4998 |
add_option("usces_db_member", USCES_DB_MEMBER); |
| 4999 |
} |
| 5000 |
if($wpdb->get_var("show tables like '$member_meta_table'") != $member_meta_table) { |
| 5001 |
|
| 5002 |
$sql = "CREATE TABLE " . $member_meta_table . " ( |
| 5003 |
mmeta_id bigint(20) NOT NULL auto_increment, |
| 5004 |
member_id bigint(20) NOT NULL default '0', |
| 5005 |
meta_key varchar(255) default NULL, |
| 5006 |
meta_value longtext, |
| 5007 |
PRIMARY KEY (mmeta_id), |
| 5008 |
KEY order_id (member_id), |
| 5009 |
KEY meta_key (meta_key) |
| 5010 |
) ENGINE = MYISAM $charset_collate;"; |
| 5011 |
|
| 5012 |
dbDelta($sql); |
| 5013 |
add_option("usces_db_member_meta", USCES_DB_MEMBER_META); |
| 5014 |
} |
| 5015 |
if($wpdb->get_var("show tables like '$order_table'") != $order_table) { |
| 5016 |
|
| 5017 |
$sql = "CREATE TABLE " . $order_table . " ( |
| 5018 |
ID BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , |
| 5019 |
mem_id BIGINT( 20 ) UNSIGNED NULL , |
| 5020 |
order_email VARCHAR( 100 ) NOT NULL , |
| 5021 |
order_name1 VARCHAR( 100 ) NOT NULL , |
| 5022 |
order_name2 VARCHAR( 100 ) NULL , |
| 5023 |
order_name3 VARCHAR( 100 ) NULL , |
| 5024 |
order_name4 VARCHAR( 100 ) NULL , |
| 5025 |
order_zip VARCHAR( 50 ) NULL , |
| 5026 |
order_pref VARCHAR( 100 ) NOT NULL , |
| 5027 |
order_address1 VARCHAR( 100 ) NOT NULL , |
| 5028 |
order_address2 VARCHAR( 100 ) NULL , |
| 5029 |
order_address3 VARCHAR( 100 ) NULL , |
| 5030 |
order_tel VARCHAR( 100 ) NOT NULL , |
| 5031 |
order_fax VARCHAR( 100 ) NULL , |
| 5032 |
order_delivery LONGTEXT, |
| 5033 |
order_cart LONGTEXT, |
| 5034 |
order_note TEXT, |
| 5035 |
order_delivery_time VARCHAR( 100 ) NOT NULL , |
| 5036 |
order_payment_name VARCHAR( 100 ) NOT NULL , |
| 5037 |
order_condition TEXT, |
| 5038 |
order_item_total_price DECIMAL( 10, 2 ) NOT NULL DEFAULT '0.00', |
| 5039 |
order_getpoint INT( 10 ) NOT NULL DEFAULT '0', |
| 5040 |
order_usedpoint INT( 10 ) NOT NULL DEFAULT '0', |
| 5041 |
order_discount DECIMAL( 10, 2 ) NOT NULL DEFAULT '0.00', |
| 5042 |
order_shipping_charge DECIMAL( 10, 2 ) NOT NULL DEFAULT '0.00', |
| 5043 |
order_cod_fee DECIMAL( 10, 2 ) NOT NULL DEFAULT '0.00', |
| 5044 |
order_tax DECIMAL( 10, 2 ) NOT NULL DEFAULT '0.00', |
| 5045 |
order_date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 5046 |
order_modified VARCHAR( 20 ) NULL , |
| 5047 |
order_status VARCHAR( 255 ) NULL , |
| 5048 |
order_check VARCHAR( 255 ) NULL , |
| 5049 |
order_delidue_date VARCHAR( 30 ) NULL , |
| 5050 |
order_delivery_method INT( 10 ) NOT NULL DEFAULT -1, |
| 5051 |
order_delivery_date VARCHAR( 100 ) NULL, |
| 5052 |
KEY order_email ( order_email ) , |
| 5053 |
KEY order_name1 ( order_name1 ) , |
| 5054 |
KEY order_name2 ( order_name2 ) , |
| 5055 |
KEY order_pref ( order_pref ) , |
| 5056 |
KEY order_address1 ( order_address1 ) , |
| 5057 |
KEY order_tel ( order_tel ) , |
| 5058 |
KEY order_date ( order_date ) |
| 5059 |
) ENGINE = MYISAM AUTO_INCREMENT=1000 $charset_collate;"; |
| 5060 |
|
| 5061 |
dbDelta($sql); |
| 5062 |
add_option("usces_db_order", USCES_DB_ORDER); |
| 5063 |
} |
| 5064 |
if($wpdb->get_var("show tables like '$order_meta_table'") != $order_meta_table) { |
| 5065 |
|
| 5066 |
$sql = "CREATE TABLE " . $order_meta_table . " ( |
| 5067 |
ometa_id bigint(20) NOT NULL auto_increment, |
| 5068 |
order_id bigint(20) NOT NULL default '0', |
| 5069 |
meta_key varchar(255) default NULL, |
| 5070 |
meta_value longtext, |
| 5071 |
PRIMARY KEY (ometa_id), |
| 5072 |
KEY order_id (order_id), |
| 5073 |
KEY meta_key (meta_key) |
| 5074 |
) ENGINE = MYISAM $charset_collate;"; |
| 5075 |
|
| 5076 |
dbDelta($sql); |
| 5077 |
add_option("usces_db_order_meta", USCES_DB_ORDER_META); |
| 5078 |
} |
| 5079 |
|
| 5080 |
} |
| 5081 |
|
| 5082 |
function update_table() |
| 5083 |
{ |
| 5084 |
global $wpdb; |
| 5085 |
$access_table = $wpdb->prefix . "usces_access"; |
| 5086 |
$member_table = $wpdb->prefix . "usces_member"; |
| 5087 |
$member_meta_table = $wpdb->prefix . "usces_member_meta"; |
| 5088 |
$order_table = $wpdb->prefix . "usces_order"; |
| 5089 |
$order_meta_table = $wpdb->prefix . "usces_order_meta"; |
| 5090 |
|
| 5091 |
$access_ver = get_option( "usces_db_access" ); |
| 5092 |
$member_ver = get_option( "usces_db_member" ); |
| 5093 |
$member_meta_ver = get_option( "usces_db_member_meta" ); |
| 5094 |
$order_ver = get_option( "usces_db_order" ); |
| 5095 |
$order_meta_ver = get_option( "usces_db_order_meta" ); |
| 5096 |
|
| 5097 |
if( $access_ver != USCES_DB_ACCESS ) { |
| 5098 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
| 5099 |
$sql = "CREATE TABLE " . $access_table . " ( |
| 5100 |
ID BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , |
| 5101 |
acc_key VARCHAR( 50 ) NOT NULL , |
| 5102 |
acc_type VARCHAR( 50 ) NULL , |
| 5103 |
acc_value LONGTEXT NULL , |
| 5104 |
acc_date DATE NOT NULL DEFAULT '0000-00-00', |
| 5105 |
acc_num1 INT( 11 ) NOT NULL DEFAULT 0, |
| 5106 |
acc_num2 INT( 11 ) NOT NULL DEFAULT 0, |
| 5107 |
acc_str1 VARCHAR( 200 ) NULL , |
| 5108 |
acc_str2 VARCHAR( 200 ) NULL , |
| 5109 |
KEY acc_key ( acc_key ), |
| 5110 |
KEY acc_type ( acc_type ), |
| 5111 |
KEY acc_date ( acc_date ), |
| 5112 |
KEY acc_num1 ( acc_num1 ), |
| 5113 |
KEY acc_num2 ( acc_num2 ) |
| 5114 |
) ENGINE = MYISAM;"; |
| 5115 |
|
| 5116 |
dbDelta($sql); |
| 5117 |
update_option( "usces_db_access", USCES_DB_ACCESS ); |
| 5118 |
} |
| 5119 |
if( $member_ver != USCES_DB_MEMBER ) { |
| 5120 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
| 5121 |
$sql = "CREATE TABLE " . $member_table . " ( |
| 5122 |
ID BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , |
| 5123 |
mem_email VARCHAR( 100 ) NOT NULL , |
| 5124 |
mem_pass VARCHAR( 64 ) NOT NULL , |
| 5125 |
mem_status INT( 11 ) NOT NULL DEFAULT '0', |
| 5126 |
mem_cookie VARCHAR( 13 ) NULL , |
| 5127 |
mem_point INT( 11 ) NOT NULL DEFAULT '0', |
| 5128 |
mem_name1 VARCHAR( 100 ) NOT NULL , |
| 5129 |
mem_name2 VARCHAR( 100 ) NULL , |
| 5130 |
mem_name3 VARCHAR( 100 ) NULL , |
| 5131 |
mem_name4 VARCHAR( 100 ) NULL , |
| 5132 |
mem_zip VARCHAR( 50 ) NULL , |
| 5133 |
mem_pref VARCHAR( 100 ) NOT NULL , |
| 5134 |
mem_address1 VARCHAR( 100 ) NOT NULL , |
| 5135 |
mem_address2 VARCHAR( 100 ) NULL , |
| 5136 |
mem_address3 VARCHAR( 100 ) NULL , |
| 5137 |
mem_tel VARCHAR( 100 ) NOT NULL , |
| 5138 |
mem_fax VARCHAR( 100 ) NULL , |
| 5139 |
mem_delivery_flag TINYINT ( 1 ) NULL , |
| 5140 |
mem_delivery LONGTEXT, |
| 5141 |
mem_registered DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 5142 |
mem_nicename VARCHAR( 50 ) NULL , |
| 5143 |
KEY mem_email ( mem_email ) , |
| 5144 |
KEY mem_pass ( mem_pass ) |
| 5145 |
) ENGINE = MYISAM;"; |
| 5146 |
|
| 5147 |
dbDelta($sql); |
| 5148 |
update_option( "usces_db_member", USCES_DB_MEMBER ); |
| 5149 |
} |
| 5150 |
if( $member_meta_ver != USCES_DB_MEMBER_META ) { |
| 5151 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
| 5152 |
$sql = "CREATE TABLE " . $member_meta_table . " ( |
| 5153 |
mmeta_id bigint(20) NOT NULL auto_increment, |
| 5154 |
member_id bigint(20) NOT NULL default '0', |
| 5155 |
meta_key varchar(255) default NULL, |
| 5156 |
meta_value longtext, |
| 5157 |
PRIMARY KEY (mmeta_id), |
| 5158 |
KEY order_id (member_id), |
| 5159 |
KEY meta_key (meta_key) |
| 5160 |
) ENGINE = MYISAM;"; |
| 5161 |
|
| 5162 |
dbDelta($sql); |
| 5163 |
update_option("usces_db_member_meta", USCES_DB_MEMBER_META); |
| 5164 |
} |
| 5165 |
if( $order_ver != USCES_DB_ORDER ) { |
| 5166 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
| 5167 |
$sql = "CREATE TABLE " . $order_table . " ( |
| 5168 |
ID BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , |
| 5169 |
mem_id BIGINT( 20 ) UNSIGNED NULL , |
| 5170 |
order_email VARCHAR( 100 ) NOT NULL , |
| 5171 |
order_name1 VARCHAR( 100 ) NOT NULL , |
| 5172 |
order_name2 VARCHAR( 100 ) NULL , |
| 5173 |
order_name3 VARCHAR( 100 ) NULL , |
| 5174 |
order_name4 VARCHAR( 100 ) NULL , |
| 5175 |
order_zip VARCHAR( 50 ) NULL , |
| 5176 |
order_pref VARCHAR( 100 ) NOT NULL , |
| 5177 |
order_address1 VARCHAR( 100 ) NOT NULL , |
| 5178 |
order_address2 VARCHAR( 100 ) NULL , |
| 5179 |
order_address3 VARCHAR( 100 ) NULL , |
| 5180 |
order_tel VARCHAR( 100 ) NOT NULL , |
| 5181 |
order_fax VARCHAR( 100 ) NULL , |
| 5182 |
order_delivery LONGTEXT, |
| 5183 |
order_cart LONGTEXT, |
| 5184 |
order_note TEXT, |
| 5185 |
order_delivery_time VARCHAR( 100 ) NOT NULL , |
| 5186 |
order_payment_name VARCHAR( 100 ) NOT NULL , |
| 5187 |
order_condition TEXT, |
| 5188 |
order_item_total_price DECIMAL( 10, 2 ) NOT NULL DEFAULT '0.00', |
| 5189 |
order_getpoint INT( 10 ) NOT NULL DEFAULT '0', |
| 5190 |
order_usedpoint INT( 10 ) NOT NULL DEFAULT '0', |
| 5191 |
order_discount DECIMAL( 10, 2 ) NOT NULL DEFAULT '0.00', |
| 5192 |
order_shipping_charge DECIMAL( 10, 2 ) NOT NULL DEFAULT '0.00', |
| 5193 |
order_cod_fee DECIMAL( 10, 2 ) NOT NULL DEFAULT '0.00', |
| 5194 |
order_tax DECIMAL( 10, 2 ) NOT NULL DEFAULT '0.00', |
| 5195 |
order_date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 5196 |
order_modified VARCHAR( 20 ) NULL , |
| 5197 |
order_status VARCHAR( 255 ) NULL , |
| 5198 |
order_check VARCHAR( 255 ) NULL , |
| 5199 |
order_delidue_date VARCHAR( 30 ) NULL , |
| 5200 |
order_delivery_method INT( 10 ) NOT NULL DEFAULT -1, |
| 5201 |
order_delivery_date VARCHAR( 100 ) NULL, |
| 5202 |
KEY order_email ( order_email ) , |
| 5203 |
KEY order_name1 ( order_name1 ) , |
| 5204 |
KEY order_name2 ( order_name2 ) , |
| 5205 |
KEY order_pref ( order_pref ) , |
| 5206 |
KEY order_address1 ( order_address1 ) , |
| 5207 |
KEY order_tel ( order_tel ) , |
| 5208 |
KEY order_date ( order_date ) |
| 5209 |
) ENGINE = MYISAM;"; |
| 5210 |
|
| 5211 |
dbDelta($sql); |
| 5212 |
update_option("usces_db_order", USCES_DB_ORDER); |
| 5213 |
} |
| 5214 |
if( $order_meta_ver != USCES_DB_ORDER_META ) { |
| 5215 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
| 5216 |
$sql = "CREATE TABLE " . $order_meta_table . " ( |
| 5217 |
ometa_id bigint(20) NOT NULL auto_increment, |
| 5218 |
order_id bigint(20) NOT NULL default '0', |
| 5219 |
meta_key varchar(255) default NULL, |
| 5220 |
meta_value longtext, |
| 5221 |
PRIMARY KEY (ometa_id), |
| 5222 |
KEY order_id (order_id), |
| 5223 |
KEY meta_key (meta_key) |
| 5224 |
) ENGINE = MYISAM;"; |
| 5225 |
|
| 5226 |
dbDelta($sql); |
| 5227 |
update_option("usces_db_order_meta", USCES_DB_ORDER_META); |
| 5228 |
} |
| 5229 |
} |
| 5230 |
|
| 5231 |
function set_default_theme() |
| 5232 |
{ |
| 5233 |
$themepath = USCES_WP_CONTENT_DIR.'/themes/welcart_default'; |
| 5234 |
$resourcepath = USCES_WP_CONTENT_DIR.'/plugins/usc-e-shop/theme/welcart_default'; |
| 5235 |
if( file_exists($themepath) ) return false; |
| 5236 |
if(!file_exists($resourcepath) ) return false; |
| 5237 |
|
| 5238 |
mkdir($themepath, 0775); |
| 5239 |
$this->dir_copy($resourcepath, $themepath); |
| 5240 |
|
| 5241 |
} |
| 5242 |
|
| 5243 |
function dir_copy($source, $dest){ |
| 5244 |
if ($res = opendir($source)) { |
| 5245 |
while (($file = readdir($res)) !== false) { |
| 5246 |
$sorce_path = $source . '/' . $file; |
| 5247 |
$dest_path = $dest . '/' . $file; |
| 5248 |
$filetype = @filetype($sorce_path); |
| 5249 |
if( $filetype == 'file' ) { |
| 5250 |
copy($sorce_path, $dest_path); |
| 5251 |
}elseif( $filetype == 'dir' && $file != '..' && $file != '.' ){ |
| 5252 |
mkdir($dest_path); |
| 5253 |
$this->dir_copy($sorce_path, $dest_path); |
| 5254 |
} |
| 5255 |
} |
| 5256 |
closedir($res); |
| 5257 |
} |
| 5258 |
} |
| 5259 |
|
| 5260 |
function set_default_page() |
| 5261 |
{ |
| 5262 |
global $wpdb; |
| 5263 |
$datetime = get_date_from_gmt(gmdate('Y-m-d H:i:s', time())); |
| 5264 |
$datetime_gmt = gmdate('Y-m-d H:i:s', time()); |
| 5265 |
|
| 5266 |
//cart_page |
| 5267 |
$query = $wpdb->prepare("SELECT ID from $wpdb->posts where post_name = %s", USCES_CART_FOLDER); |
| 5268 |
$cart_number = $wpdb->get_var( $query ); |
| 5269 |
if( $cart_number === NULL ) { |
| 5270 |
$query = $wpdb->prepare("INSERT INTO $wpdb->posts |
| 5271 |
(post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, |
| 5272 |
comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, |
| 5273 |
post_content_filtered, post_parent, guid, menu_order, post_type, post_mime_type, comment_count) |
| 5274 |
VALUES (%d, %s, %s, %s, %s, %s, %s, |
| 5275 |
%s, %s, %s, %s, %s, %s, %s, %s, |
| 5276 |
%s, %d, %s, %d, %s, %s, %d)", |
| 5277 |
1, $datetime, $datetime_gmt, '', __('Cart', 'usces'), '', 'publish', |
| 5278 |
'closed', 'closed', '', USCES_CART_FOLDER, '', '', $datetime, $datetime_gmt, |
| 5279 |
'', 0, '', 0, 'page', '', 0); |
| 5280 |
$wpdb->query($query); |
| 5281 |
$cart_number = $wpdb->insert_id; |
| 5282 |
if( $cart_number !== NULL ) { |
| 5283 |
$query = $wpdb->prepare("INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES (%d, %s, %s)", |
| 5284 |
$cart_number, '_wp_page_template', 'uscescart.php'); |
| 5285 |
$wpdb->query($query); |
| 5286 |
} |
| 5287 |
} |
| 5288 |
update_option('usces_cart_number', $cart_number); |
| 5289 |
|
| 5290 |
//member_page |
| 5291 |
$query = $wpdb->prepare("SELECT ID from $wpdb->posts where post_name = %s", USCES_MEMBER_FOLDER); |
| 5292 |
$member_number = $wpdb->get_var( $query ); |
| 5293 |
if( $member_number === NULL ) { |
| 5294 |
$query = $wpdb->prepare("INSERT INTO $wpdb->posts |
| 5295 |
(post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, |
| 5296 |
comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, |
| 5297 |
post_content_filtered, post_parent, guid, menu_order, post_type, post_mime_type, comment_count) |
| 5298 |
VALUES (%d, %s, %s, %s, %s, %s, %s, |
| 5299 |
%s, %s, %s, %s, %s, %s, %s, %s, |
| 5300 |
%s, %d, %s, %d, %s, %s, %d)", |
| 5301 |
1, $datetime, $datetime_gmt, '', __('Membership', 'usces'), '', 'publish', |
| 5302 |
'closed', 'closed', '', USCES_MEMBER_FOLDER, '', '', $datetime, $datetime_gmt, |
| 5303 |
'', 0, '', 0, 'page', '', 0); |
| 5304 |
$wpdb->query($query); |
| 5305 |
$member_number = $wpdb->insert_id; |
| 5306 |
if( $member_number !== NULL ) { |
| 5307 |
$query = $wpdb->prepare("INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES (%d, %s, %s)", |
| 5308 |
$member_number, '_wp_page_template', 'uscesmember.php'); |
| 5309 |
$wpdb->query($query); |
| 5310 |
} |
| 5311 |
} |
| 5312 |
update_option('usces_member_number', $member_number); |
| 5313 |
|
| 5314 |
} |
| 5315 |
|
| 5316 |
function set_default_categories() |
| 5317 |
{ |
| 5318 |
global $wpdb; |
| 5319 |
|
| 5320 |
$idObj = get_category_by_slug('item'); |
| 5321 |
if( empty($idObj) ) { |
| 5322 |
$item_cat = array('cat_name' => __('Items', 'usces'), 'category_description' => '', 'category_nicename' => 'item', 'category_parent' => 0); |
| 5323 |
$item_cat_id = wp_insert_category($item_cat); |
| 5324 |
update_option('usces_item_cat_parent_id', $item_cat_id); |
| 5325 |
} |
| 5326 |
|
| 5327 |
$idObj = get_category_by_slug('itemreco'); |
| 5328 |
if( empty($idObj) && isset($item_cat_id) ) { |
| 5329 |
$itemreco_cat = array('cat_name' => __('Items recommended', 'usces'), 'category_description' => '', 'category_nicename' => 'itemreco', 'category_parent' => $item_cat_id); |
| 5330 |
$itemreco_cat_id = wp_insert_category($itemreco_cat); |
| 5331 |
} |
| 5332 |
|
| 5333 |
$idObj = get_category_by_slug('itemnew'); |
| 5334 |
if( empty($idObj) && isset($item_cat_id) ) { |
| 5335 |
$itemnew_cat = array('cat_name' => __('New items', 'usces'), 'category_description' => '', 'category_nicename' => 'itemnew', 'category_parent' => $item_cat_id); |
| 5336 |
$itemnew_cat_id = wp_insert_category($itemnew_cat); |
| 5337 |
} |
| 5338 |
|
| 5339 |
$idObj = get_category_by_slug('itemgenre'); |
| 5340 |
if( empty($idObj) && isset($item_cat_id) ) { |
| 5341 |
$itemgenre_cat = array('cat_name' => __('Item genre', 'usces'), 'category_description' => '', 'category_nicename' => 'itemgenre', 'category_parent' => $item_cat_id); |
| 5342 |
$itemgenre_cat_id = wp_insert_category($itemgenre_cat); |
| 5343 |
} |
| 5344 |
} |
| 5345 |
//20120710ysk start 0000472 |
| 5346 |
function update_options() { |
| 5347 |
$target_market = $this->options['system']['target_market']; |
| 5348 |
|
| 5349 |
$update_shipping_charge = false; |
| 5350 |
$shipping_charge = isset($this->options['shipping_charge']) ? $this->options['shipping_charge'] : array(); |
| 5351 |
foreach( (array)$target_market as $tm ) { |
| 5352 |
for( $i = 0; $i < count($shipping_charge); $i++ ) { |
| 5353 |
if( isset($shipping_charge[$i]['country']) and $shipping_charge[$i]['country'] == $tm ) { |
| 5354 |
foreach( $shipping_charge[$i]['value'] as $pref => $value ) { |
| 5355 |
$shipping_charge[$i][$tm][$pref] = $value; |
| 5356 |
} |
| 5357 |
unset($shipping_charge[$i]['country']); |
| 5358 |
unset($shipping_charge[$i]['value']); |
| 5359 |
$update_shipping_charge = true; |
| 5360 |
} |
| 5361 |
} |
| 5362 |
} |
| 5363 |
if( $update_shipping_charge ) $this->options['shipping_charge'] = $shipping_charge; |
| 5364 |
|
| 5365 |
$update_delivery_days = false; |
| 5366 |
$delivery_days = isset($this->options['delivery_days']) ? $this->options['delivery_days'] : array(); |
| 5367 |
foreach( (array)$target_market as $tm ) { |
| 5368 |
for( $i = 0; $i < count($delivery_days); $i++ ) { |
| 5369 |
if( isset($delivery_days[$i]['country']) and $delivery_days[$i]['country'] == $tm ) { |
| 5370 |
foreach( $delivery_days[$i]['value'] as $pref => $value ) { |
| 5371 |
$delivery_days[$i][$tm][$pref] = $value; |
| 5372 |
} |
| 5373 |
unset($delivery_days[$i]['country']); |
| 5374 |
unset($delivery_days[$i]['value']); |
| 5375 |
$update_delivery_days = true; |
| 5376 |
} |
| 5377 |
} |
| 5378 |
} |
| 5379 |
if( $update_delivery_days ) $this->options['delivery_days'] = $delivery_days; |
| 5380 |
|
| 5381 |
//20140131ysk start |
| 5382 |
$update_acting_settings_sbps = false; |
| 5383 |
if( isset($this->options['acting_settings']['sbps']['card_activate']) and 'on' == $this->options['acting_settings']['sbps']['card_activate'] ) { |
| 5384 |
if( empty($this->options['acting_settings']['sbps']['send_url']) or 'https://fep.sps-system.com/f01/FepBuyInfoReceive.do' != $this->options['acting_settings']['sbps']['send_url'] ) { |
| 5385 |
$this->options['acting_settings']['sbps']['send_url'] = 'https://fep.sps-system.com/f01/FepBuyInfoReceive.do'; |
| 5386 |
$update_acting_settings_sbps = true; |
| 5387 |
} |
| 5388 |
} |
| 5389 |
|
| 5390 |
$update_acting_settings_paydesign = false; |
| 5391 |
if( isset($this->options['acting_settings']['digitalcheck']['card_activate']) and 'on' == $this->options['acting_settings']['digitalcheck']['card_activate'] ) { |
| 5392 |
$pos = strpos( $this->options['acting_settings']['digitalcheck']['send_url_card'], 'paydesign' ); |
| 5393 |
if( $pos === false ) { |
| 5394 |
$this->options['acting_settings']['digitalcheck']['send_url_card'] = "https://www.paydesign.jp/settle/settle3/bp3.dll"; |
| 5395 |
$this->payment_structure['acting_digitalcheck_card'] = 'カード決済(ペイデザイン)'; |
| 5396 |
$update_acting_settings_paydesign = true; |
| 5397 |
} |
| 5398 |
if( isset($this->options['acting_settings']['digitalcheck']['card_user_id']) and 'on' == $this->options['acting_settings']['digitalcheck']['card_user_id'] ) { |
| 5399 |
$pos = strpos( $this->options['acting_settings']['digitalcheck']['send_url_user_id'], 'paydesign' ); |
| 5400 |
if( $pos === false ) { |
| 5401 |
$this->options['acting_settings']['digitalcheck']['send_url_user_id'] = "https://www.paydesign.jp/settle/settlex/credit2.dll"; |
| 5402 |
$update_acting_settings_paydesign = true; |
| 5403 |
} |
| 5404 |
} |
| 5405 |
} |
| 5406 |
if( isset($this->options['acting_settings']['digitalcheck']['conv_activate']) and 'on' == $this->options['acting_settings']['digitalcheck']['conv_activate'] ) { |
| 5407 |
$pos = strpos( $this->options['acting_settings']['digitalcheck']['send_url_conv'], 'paydesign' ); |
| 5408 |
if( $pos === false ) { |
| 5409 |
$this->options['acting_settings']['digitalcheck']['send_url_conv'] = "https://www.paydesign.jp/settle/settle3/bp3.dll"; |
| 5410 |
$this->payment_structure['acting_digitalcheck_conv'] = 'コンビニ決済(ペイデザイン)'; |
| 5411 |
$update_acting_settings_paydesign = true; |
| 5412 |
} |
| 5413 |
} |
| 5414 |
|
| 5415 |
if( $update_shipping_charge or $update_delivery_days or $update_acting_settings_sbps or $update_acting_settings_paydesign ) |
| 5416 |
update_option( 'usces', $this->options ); |
| 5417 |
|
| 5418 |
if( $update_acting_settings_paydesign ) |
| 5419 |
update_option( 'usces_payment_structure', $this->payment_structure ); |
| 5420 |
//20140131ysk end |
| 5421 |
} |
| 5422 |
//20120710ysk end |
| 5423 |
function get_item_cat_ids(){ |
| 5424 |
$args = array('child_of' => USCES_ITEM_CAT_PARENT_ID, 'hide_empty' => 0, 'hierarchical' => 0); |
| 5425 |
$categories = get_categories( $args ); |
| 5426 |
foreach($categories as $category){ |
| 5427 |
$ids[] = $category->term_id; |
| 5428 |
} |
| 5429 |
return $ids; |
| 5430 |
} |
| 5431 |
|
| 5432 |
function get_item_post_ids(){ |
| 5433 |
global $wpdb; |
| 5434 |
$query = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_mime_type = %s", 'item'); |
| 5435 |
$ids = $wpdb->get_col( $query ); |
| 5436 |
|
| 5437 |
return $ids; |
| 5438 |
} |
| 5439 |
|
| 5440 |
function get_item_cat_genre_ids( $post_id ){ |
| 5441 |
$ids = array(); |
| 5442 |
$all_ids = array(); |
| 5443 |
$genre = get_category_by_slug( 'itemgenre' ); |
| 5444 |
$genre_id = $genre->term_id; |
| 5445 |
$args = array('child_of' => $genre_id, 'hide_empty' => 0, 'hierarchical' => 0); |
| 5446 |
$categories = get_categories( $args ); |
| 5447 |
foreach($categories as $category){ |
| 5448 |
$ids[] = $category->term_id; |
| 5449 |
} |
| 5450 |
$allcats = get_the_category( $post_id ); |
| 5451 |
foreach($allcats as $cat){ |
| 5452 |
$all_ids[] = $cat->term_id; |
| 5453 |
} |
| 5454 |
//$all_ids = |
| 5455 |
$results = array_intersect($ids, $all_ids); |
| 5456 |
|
| 5457 |
return $results; |
| 5458 |
} |
| 5459 |
|
| 5460 |
function set_item_mime($post_id, $str) |
| 5461 |
{ |
| 5462 |
global $wpdb; |
| 5463 |
if( WCUtils::is_blank($str) ) return; |
| 5464 |
|
| 5465 |
$query = $wpdb->prepare("UPDATE $wpdb->posts SET post_mime_type = %s WHERE ID = %s", $str, $post_id); |
| 5466 |
$results = $wpdb->query( $query ); |
| 5467 |
return $results; |
| 5468 |
} |
| 5469 |
|
| 5470 |
function isAdnminSSL() |
| 5471 |
{ |
| 5472 |
$plugins = get_option('active_plugins'); |
| 5473 |
foreach($plugins as $plugin) { |
| 5474 |
if( false !== strpos($plugin, USCES_ADMIN_SSL_BASE_NAME) ) |
| 5475 |
return true; |
| 5476 |
} |
| 5477 |
return false; |
| 5478 |
} |
| 5479 |
|
| 5480 |
function getGuidTax() { |
| 5481 |
$tax_rate = (int)$this->options['tax_rate']; |
| 5482 |
if ( 0 < $tax_rate ) |
| 5483 |
$str = '<em class="tax">'.__('(Excl. Tax)', 'usces').'</em>'; |
| 5484 |
else |
| 5485 |
$str = '<em class="tax">'.__('(Incl. Tax)', 'usces').'</em>'; |
| 5486 |
|
| 5487 |
return apply_filters('usces_filter_tax_guid', $str, $tax_rate); |
| 5488 |
} |
| 5489 |
|
| 5490 |
function getItemCode($post_id) { |
| 5491 |
$str = get_post_meta($post_id, '_itemCode', true); |
| 5492 |
return $str; |
| 5493 |
} |
| 5494 |
|
| 5495 |
function getItemName($post_id) { |
| 5496 |
$str = get_post_meta($post_id, '_itemName', true); |
| 5497 |
return $str; |
| 5498 |
} |
| 5499 |
|
| 5500 |
function getItemRestriction($post_id) { |
| 5501 |
$str = get_post_meta($post_id, '_itemRestriction', true); |
| 5502 |
return $str; |
| 5503 |
} |
| 5504 |
|
| 5505 |
function getItemPointrate($post_id) { |
| 5506 |
$str = get_post_meta($post_id, '_itemPointrate', true); |
| 5507 |
return $str; |
| 5508 |
} |
| 5509 |
|
| 5510 |
function getItemShipping($post_id) { |
| 5511 |
$str = get_post_meta($post_id, '_itemShipping', true); |
| 5512 |
return $str; |
| 5513 |
} |
| 5514 |
|
| 5515 |
function getItemShippingCharge($post_id) { |
| 5516 |
$str = get_post_meta($post_id, '_itemShippingCharge', true); |
| 5517 |
return (float)$str; |
| 5518 |
} |
| 5519 |
|
| 5520 |
function getItemDeliveryMethod($post_id) { |
| 5521 |
$str = get_post_meta($post_id, '_itemDeliveryMethod', true); |
| 5522 |
if( empty($str) ) |
| 5523 |
return array(); |
| 5524 |
else |
| 5525 |
return $str; |
| 5526 |
} |
| 5527 |
|
| 5528 |
function getItemIndividualSCharge($post_id) { |
| 5529 |
$str = get_post_meta($post_id, '_itemIndividualSCharge', true); |
| 5530 |
return $str; |
| 5531 |
} |
| 5532 |
|
| 5533 |
function getItemGpNum1($post_id) { |
| 5534 |
$str = get_post_meta($post_id, '_itemGpNum1', true); |
| 5535 |
return $str; |
| 5536 |
} |
| 5537 |
|
| 5538 |
function getItemGpNum2($post_id) { |
| 5539 |
$str = get_post_meta($post_id, '_itemGpNum2', true); |
| 5540 |
return $str; |
| 5541 |
} |
| 5542 |
|
| 5543 |
function getItemGpNum3($post_id) { |
| 5544 |
$str = get_post_meta($post_id, '_itemGpNum3', true); |
| 5545 |
return $str; |
| 5546 |
} |
| 5547 |
|
| 5548 |
function getItemGpDis1($post_id) { |
| 5549 |
$str = get_post_meta($post_id, '_itemGpDis1', true); |
| 5550 |
return $str; |
| 5551 |
} |
| 5552 |
|
| 5553 |
function getItemGpDis2($post_id) { |
| 5554 |
$str = get_post_meta($post_id, '_itemGpDis2', true); |
| 5555 |
return $str; |
| 5556 |
} |
| 5557 |
|
| 5558 |
function getItemGpDis3($post_id) { |
| 5559 |
$str = get_post_meta($post_id, '_itemGpDis3', true); |
| 5560 |
return $str; |
| 5561 |
} |
| 5562 |
|
| 5563 |
function getItemSku($post_id, $index = '') { |
| 5564 |
$array = array(); |
| 5565 |
$skus = $this->get_skus($post_id, 'sort'); |
| 5566 |
foreach((array)$skus as $sku){ |
| 5567 |
$array[] = $sku['code']; |
| 5568 |
} |
| 5569 |
if(!$array) return false; |
| 5570 |
if($index == ''){ |
| 5571 |
return $array; |
| 5572 |
}else if(isset($array[$index])){ |
| 5573 |
return $array[$index]; |
| 5574 |
}else{ |
| 5575 |
return false; |
| 5576 |
} |
| 5577 |
} |
| 5578 |
|
| 5579 |
function getItemPrice($post_id, $skukey = '') { |
| 5580 |
$array = array(); |
| 5581 |
$skus = $this->get_skus($post_id, 'code'); |
| 5582 |
foreach((array)$skus as $key => $sku){ |
| 5583 |
$array[$key] = (float)str_replace('.', '', $sku['price']); |
| 5584 |
} |
| 5585 |
if(!$array) return false; |
| 5586 |
if($skukey == ''){ |
| 5587 |
return $array; |
| 5588 |
}else if(isset($array[$skukey])){ |
| 5589 |
return $array[$skukey]; |
| 5590 |
}else{ |
| 5591 |
return false; |
| 5592 |
} |
| 5593 |
} |
| 5594 |
|
| 5595 |
function getItemDiscount($post_id, $skukey = '') { |
| 5596 |
$display_mode = $this->options['display_mode']; |
| 5597 |
$array = array(); |
| 5598 |
$skus = $this->get_skus($post_id, 'code'); |
| 5599 |
foreach((array)$skus as $key => $sku){ |
| 5600 |
$price = (float)str_replace(',', '', $sku['price']); |
| 5601 |
if ( $display_mode == 'Promotionsale' ) { |
| 5602 |
if ( $this->options['campaign_privilege'] == 'discount' ){ |
| 5603 |
if( 0 === (int)$this->options['campaign_category'] || in_category((int)$this->options['campaign_category'], $post_id) ){ |
| 5604 |
$discount = $price * $this->options['privilege_discount'] / 100; |
| 5605 |
}else{ |
| 5606 |
$discount = 0; |
| 5607 |
} |
| 5608 |
}else if ( $this->options['campaign_privilege'] == 'point' ){ |
| 5609 |
$discount = 0; |
| 5610 |
} |
| 5611 |
} |
| 5612 |
|
| 5613 |
$discount = ceil($discount); |
| 5614 |
$array[$key] = $discount; |
| 5615 |
} |
| 5616 |
if(!$array) return false; |
| 5617 |
if($skukey == ''){ |
| 5618 |
return $array; |
| 5619 |
}else if(isset($array[$skukey])){ |
| 5620 |
return $array[$skukey]; |
| 5621 |
}else{ |
| 5622 |
return false; |
| 5623 |
} |
| 5624 |
} |
| 5625 |
|
| 5626 |
function getItemZaiko($post_id, $skukey = '') { |
| 5627 |
$array = array(); |
| 5628 |
$skus = $this->get_skus($post_id, 'code'); |
| 5629 |
foreach((array)$skus as $key => $sku){ |
| 5630 |
$num = $sku['stock']; |
| 5631 |
$array[$key] = $this->zaiko_status[$num]; |
| 5632 |
} |
| 5633 |
if(!$array) return false; |
| 5634 |
if($skukey == ''){ |
| 5635 |
return $array; |
| 5636 |
}else if(isset($array[$skukey])){ |
| 5637 |
return $array[$skukey]; |
| 5638 |
}else{ |
| 5639 |
return false; |
| 5640 |
} |
| 5641 |
} |
| 5642 |
|
| 5643 |
function getItemZaikoStatusId($post_id, $skukey = '') { |
| 5644 |
$array = array(); |
| 5645 |
$skus = $this->get_skus($post_id, 'code'); |
| 5646 |
foreach((array)$skus as $key => $sku){ |
| 5647 |
$num = $sku['stock']; |
| 5648 |
$array[$key] = $num; |
| 5649 |
} |
| 5650 |
if(!$array) return false; |
| 5651 |
if($skukey == ''){ |
| 5652 |
return $array; |
| 5653 |
}else if(isset($array[$skukey])){ |
| 5654 |
return $array[$skukey]; |
| 5655 |
}else{ |
| 5656 |
return false; |
| 5657 |
} |
| 5658 |
} |
| 5659 |
|
| 5660 |
function updateItemZaiko($post_id, $skucode, $value) { |
| 5661 |
$res = usces_update_sku( $post_id, $skucode, 'stock', $value ); |
| 5662 |
if( !$res ){ |
| 5663 |
return false; |
| 5664 |
}else{ |
| 5665 |
return true; |
| 5666 |
} |
| 5667 |
} |
| 5668 |
|
| 5669 |
function getItemZaikoNum($post_id, $skukey = '') { |
| 5670 |
$array = array(); |
| 5671 |
$skus = $this->get_skus($post_id, 'code'); |
| 5672 |
foreach((array)$skus as $key => $sku){ |
| 5673 |
$array[$key] = $sku['stocknum']; |
| 5674 |
} |
| 5675 |
if(!$array) return false; |
| 5676 |
if($skukey == ''){ |
| 5677 |
return $array; |
| 5678 |
}else if(isset($array[$skukey])){ |
| 5679 |
return $array[$skukey]; |
| 5680 |
}else{ |
| 5681 |
return false; |
| 5682 |
} |
| 5683 |
} |
| 5684 |
|
| 5685 |
function updateItemZaikoNum($post_id, $skucode, $value) { |
| 5686 |
$res = usces_update_sku( $post_id, $skucode, 'stocknum', $value ); |
| 5687 |
if( !$res ){ |
| 5688 |
return false; |
| 5689 |
}else{ |
| 5690 |
return true; |
| 5691 |
} |
| 5692 |
} |
| 5693 |
//20120629ysk start 0000520 |
| 5694 |
function getItemDivision( $post_id ){ |
| 5695 |
if( usces_is_item($post_id) ){ |
| 5696 |
$item_division = get_post_meta($post_id, '_item_division', true); |
| 5697 |
$division = empty($item_division) ? 'shipped' : $item_division; |
| 5698 |
}else{ |
| 5699 |
$division = NULL; |
| 5700 |
} |
| 5701 |
return $division; |
| 5702 |
} |
| 5703 |
//20120629ysk end |
| 5704 |
function getItemChargingType( $post_id, $cart = array() ){ |
| 5705 |
if( usces_is_item($post_id) ){ |
| 5706 |
$charging = get_post_meta($post_id, '_item_charging_type', true); |
| 5707 |
//if( !defined('WCEX_DLSELLER') ) |
| 5708 |
if( !defined('WCEX_DLSELLER') and !defined('WCEX_AUTO_DELIVERY') ) |
| 5709 |
$charging = NULL; |
| 5710 |
}else{ |
| 5711 |
$charging = NULL; |
| 5712 |
} |
| 5713 |
switch( $charging ){ |
| 5714 |
case 0: |
| 5715 |
$type = 'once'; |
| 5716 |
break; |
| 5717 |
case 1: |
| 5718 |
$type = 'continue'; |
| 5719 |
break; |
| 5720 |
case 2: |
| 5721 |
$type = 'regular'; |
| 5722 |
if( !empty($cart) ) { |
| 5723 |
if( empty($cart['advance']) ) { |
| 5724 |
$type = 'once'; |
| 5725 |
} else { |
| 5726 |
$advance = $this->cart->wc_unserialize( $cart['advance'] ); |
| 5727 |
$sku = urldecode( $cart['sku'] ); |
| 5728 |
$regular = $advance[$post_id][$sku]['regular']; |
| 5729 |
$unit = isset( $regular['unit'] ) ? $regular['unit'] : ''; |
| 5730 |
$interval = isset( $regular['interval'] ) ? (int)$regular['interval'] : 0; |
| 5731 |
if( empty($unit) or 1 > $interval ) //通常課金扱い |
| 5732 |
$type = 'once'; |
| 5733 |
} |
| 5734 |
} |
| 5735 |
break; |
| 5736 |
default: |
| 5737 |
$type = NULL; |
| 5738 |
} |
| 5739 |
return $type; |
| 5740 |
} |
| 5741 |
|
| 5742 |
function getItemFrequency( $post_id ){ |
| 5743 |
$frequency = get_post_meta($post_id, '_item_frequency',true ); |
| 5744 |
return $frequency; |
| 5745 |
} |
| 5746 |
|
| 5747 |
function getItemChargingDay( $post_id ){ |
| 5748 |
$array = get_post_meta($post_id, '_item_chargingday',true ); |
| 5749 |
$day = (int)$array; |
| 5750 |
$chargingday = empty($day) ? 1 : $day; |
| 5751 |
return $chargingday; |
| 5752 |
} |
| 5753 |
|
| 5754 |
function getItemSkuDisp($post_id, $skukey = '') { |
| 5755 |
$array = array(); |
| 5756 |
$skus = $this->get_skus($post_id, 'code'); |
| 5757 |
foreach((array)$skus as $key => $sku){ |
| 5758 |
$array[$key] = $sku['name']; |
| 5759 |
} |
| 5760 |
if(!$array) return false; |
| 5761 |
if($skukey == ''){ |
| 5762 |
return $array; |
| 5763 |
}else if(isset($array[$skukey])){ |
| 5764 |
return $array[$skukey]; |
| 5765 |
}else{ |
| 5766 |
return false; |
| 5767 |
} |
| 5768 |
} |
| 5769 |
|
| 5770 |
// function getItemSkuChargingType($post_id, $skukey = '') { |
| 5771 |
// $fields = get_post_custom($post_id); |
| 5772 |
// $skus = array(); |
| 5773 |
// foreach((array)$fields as $key => $value){ |
| 5774 |
// if( preg_match('/^_isku_/', $key, $match) ){ |
| 5775 |
// $key = substr($key, 6); |
| 5776 |
// $values = maybe_unserialize($value[0]); |
| 5777 |
// if( isset($values['charging_type']) && "undefined" != $values['charging_type'] && !empty($values['charging_type']) ){ |
| 5778 |
// $skus[$key] = $values['charging_type']; |
| 5779 |
// }else{ |
| 5780 |
// continue; |
| 5781 |
// } |
| 5782 |
// } |
| 5783 |
// } |
| 5784 |
// if( empty($skus) ) return false; |
| 5785 |
// if($skukey == ''){ |
| 5786 |
// return $skus; |
| 5787 |
// }elseif( isset($skus[$skukey]) ){ |
| 5788 |
// return $skus[$skukey]; |
| 5789 |
// }else{ |
| 5790 |
// return false; |
| 5791 |
// } |
| 5792 |
// } |
| 5793 |
|
| 5794 |
function getItemSkuUnit($post_id, $skukey = '') { |
| 5795 |
$array = array(); |
| 5796 |
$skus = $this->get_skus($post_id, 'code'); |
| 5797 |
foreach((array)$skus as $key => $sku){ |
| 5798 |
$array[$key] = $sku['unit']; |
| 5799 |
} |
| 5800 |
if(!$array) return false; |
| 5801 |
if($skukey == ''){ |
| 5802 |
return $array; |
| 5803 |
}else if(isset($array[$skukey])){ |
| 5804 |
return $array[$skukey]; |
| 5805 |
}else{ |
| 5806 |
return false; |
| 5807 |
} |
| 5808 |
} |
| 5809 |
|
| 5810 |
function get_item( $post_id ) { |
| 5811 |
$usces_item['post_id'] = $post_id; |
| 5812 |
$usces_item['itemCode'] = $this->getItemCode($post_id); |
| 5813 |
$usces_item['itemName'] = $this->getItemName($post_id); |
| 5814 |
|
| 5815 |
$skus = $this->get_skus($post_id, 'code'); |
| 5816 |
foreach((array)$skus as $key => $sku){ |
| 5817 |
$usces_item['skuCodes'][] = $key; |
| 5818 |
$usces_item['skuValues'][] = $sku; |
| 5819 |
} |
| 5820 |
|
| 5821 |
$usces_item = apply_filters('usces_filter_get_item', $usces_item, $post_id); |
| 5822 |
|
| 5823 |
return $usces_item; |
| 5824 |
} |
| 5825 |
|
| 5826 |
function get_itemOptionKey( $post_id, $enc = false ) { |
| 5827 |
$opts = usces_get_opts( $post_id ); |
| 5828 |
if(empty($opts)) return; |
| 5829 |
|
| 5830 |
$res = array(); |
| 5831 |
foreach ( (array)$opts as $opt ) { |
| 5832 |
if( $enc ) |
| 5833 |
$res[] = urlencode($opt['name']); |
| 5834 |
else |
| 5835 |
$res[] = $opt['name']; |
| 5836 |
} |
| 5837 |
return $res; |
| 5838 |
} |
| 5839 |
|
| 5840 |
function get_itemOptions( $key, $post_id ) { |
| 5841 |
$opts = usces_get_opts( $post_id, 'name' ); |
| 5842 |
if(empty($opts[$key])) |
| 5843 |
return; |
| 5844 |
else |
| 5845 |
return $opts[$key]; |
| 5846 |
} |
| 5847 |
|
| 5848 |
function get_postIDbyCode( $itemcode ) { |
| 5849 |
global $wpdb; |
| 5850 |
|
| 5851 |
$query = $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s AND meta_value = %s LIMIT 1", '_itemCode', $itemcode); |
| 5852 |
$res = $wpdb->get_var( $query ); |
| 5853 |
return $res; |
| 5854 |
} |
| 5855 |
|
| 5856 |
function get_pictids($item_code) { |
| 5857 |
global $wpdb, $usces; |
| 5858 |
|
| 5859 |
if( empty($item_code) ) |
| 5860 |
return false; |
| 5861 |
|
| 5862 |
if( !$usces->options['system']['subimage_rule'] ){ |
| 5863 |
$codestr = $item_code.'%'; |
| 5864 |
$query = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title LIKE %s AND post_title <> %s AND post_type = 'attachment' ORDER BY post_title", $codestr, $item_code); |
| 5865 |
}else{ |
| 5866 |
$codestr = $item_code.'--%'; |
| 5867 |
$query = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title LIKE %s AND post_type = 'attachment' ORDER BY post_title", $codestr); |
| 5868 |
} |
| 5869 |
$results = $wpdb->get_col( $query ); |
| 5870 |
return $results; |
| 5871 |
} |
| 5872 |
|
| 5873 |
function get_mainpictid($item_code) { |
| 5874 |
global $wpdb; |
| 5875 |
$query = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type = 'attachment' LIMIT 1", $item_code); |
| 5876 |
$id = $wpdb->get_var( $query ); |
| 5877 |
$id = apply_filters( 'usces_filter_get_mainpictid', $id, $item_code ); |
| 5878 |
return $id; |
| 5879 |
} |
| 5880 |
|
| 5881 |
function get_skus( $post_id, $keyflag = 'sort' ) { |
| 5882 |
if( !$post_id ) |
| 5883 |
return array(); |
| 5884 |
|
| 5885 |
$skus = array(); |
| 5886 |
$metas = usces_get_post_meta($post_id, '_isku_'); |
| 5887 |
if( empty($metas) ) return $skus; |
| 5888 |
|
| 5889 |
foreach( $metas as $rows ){ |
| 5890 |
$values = unserialize($rows['meta_value']); |
| 5891 |
$key = isset($values[$keyflag]) ? $values[$keyflag] : $values['sort']; |
| 5892 |
$skus[$key] = array( |
| 5893 |
'meta_id' => $rows['meta_id'], |
| 5894 |
'code' => $values['code'], |
| 5895 |
'name' => $values['name'], |
| 5896 |
'cprice' => $values['cprice'], |
| 5897 |
'price' => $values['price'], |
| 5898 |
'unit' => $values['unit'], |
| 5899 |
'stocknum' => $values['stocknum'], |
| 5900 |
'stock' => $values['stock'], |
| 5901 |
'gp' => $values['gp'], |
| 5902 |
'sort' => $values['sort'], |
| 5903 |
'advance' => isset($values['advance']) ? $values['advance'] : '' |
| 5904 |
); |
| 5905 |
} |
| 5906 |
$skus = apply_filters( 'usces_filter_get_skus', $skus, $post_id, $keyflag ); |
| 5907 |
ksort($skus); |
| 5908 |
|
| 5909 |
return $skus; |
| 5910 |
} |
| 5911 |
|
| 5912 |
function is_item( $post ) { |
| 5913 |
|
| 5914 |
if( $post->post_mime_type == 'item' ) |
| 5915 |
return true; |
| 5916 |
else |
| 5917 |
return false; |
| 5918 |
} |
| 5919 |
|
| 5920 |
function getItemIds( $end_type ) { |
| 5921 |
global $wpdb; |
| 5922 |
if( 'front' == $end_type ) |
| 5923 |
$query = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_status = %s AND post_mime_type = %s", 'publish', 'item'); |
| 5924 |
if( 'back' == $end_type ) |
| 5925 |
$query = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_mime_type = %s", 'item'); |
| 5926 |
$ids = $wpdb->get_col( $query ); |
| 5927 |
if( empty($ids) ) $ids = array(); |
| 5928 |
return $ids; |
| 5929 |
} |
| 5930 |
|
| 5931 |
function getNotItemIds() { |
| 5932 |
global $wpdb; |
| 5933 |
$query = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_status = %s AND post_mime_type <> %s", 'publish', 'item'); |
| 5934 |
$ids = $wpdb->get_col( $query ); |
| 5935 |
if( empty($ids) ) $ids = array(); |
| 5936 |
return $ids; |
| 5937 |
} |
| 5938 |
|
| 5939 |
function getPaymentMethod( $name ) { |
| 5940 |
$res = array(); |
| 5941 |
$payments = $this->options['payment_method']; |
| 5942 |
foreach ( (array)$payments as $payment ) { |
| 5943 |
if($name = $payment['name']) { |
| 5944 |
$res = $payment; |
| 5945 |
break; |
| 5946 |
} |
| 5947 |
} |
| 5948 |
return $res; |
| 5949 |
} |
| 5950 |
|
| 5951 |
function order_processing( $results = array() ) { |
| 5952 |
do_action('usces_pre_reg_orderdata'); |
| 5953 |
//db(function.php) |
| 5954 |
//20110203ysk start |
| 5955 |
$res = usces_check_acting_return_duplicate( $results ); |
| 5956 |
if($res != NULL) { |
| 5957 |
usces_log('order processing duplicate : acting='.$_REQUEST['acting'].', order_id='.$res, 'acting_transaction.log'); |
| 5958 |
return 'ordercompletion'; |
| 5959 |
} |
| 5960 |
if(isset($_REQUEST['acting']) && ('jpayment_card' == $_REQUEST['acting'] || 'jpayment_conv' == $_REQUEST['acting'] || 'jpayment_bank' == $_REQUEST['acting'])) { |
| 5961 |
usces_log($_REQUEST['acting'].' transaction : '.$_REQUEST['gid'], 'acting_transaction.log');//OK |
| 5962 |
} |
| 5963 |
//20110203ysk end |
| 5964 |
//20110621ysk start 0000184 |
| 5965 |
if(isset($_REQUEST['acting']) && ('paypal_ec' == $_REQUEST['acting'])) { |
| 5966 |
if( !usces_paypal_doecp( $results ) ) |
| 5967 |
return 'error'; |
| 5968 |
} |
| 5969 |
//20110621ysk end |
| 5970 |
$order_id = usces_reg_orderdata( $results ); |
| 5971 |
do_action('usces_post_reg_orderdata', $order_id, $results); |
| 5972 |
|
| 5973 |
if ( $order_id ) { |
| 5974 |
//mail(function.php) |
| 5975 |
$mail_res = usces_send_ordermail( $order_id ); |
| 5976 |
return 'ordercompletion'; |
| 5977 |
|
| 5978 |
} else { |
| 5979 |
return 'error'; |
| 5980 |
} |
| 5981 |
|
| 5982 |
} |
| 5983 |
|
| 5984 |
function acting_processing($acting_flg, $query) { |
| 5985 |
global $wpdb; |
| 5986 |
$entry = $this->cart->get_entry(); |
| 5987 |
$delim = apply_filters( 'usces_filter_delim', $this->delim ); |
| 5988 |
$acting_flg = trim($acting_flg); |
| 5989 |
//$usces_entries = $this->cart->get_entry(); |
| 5990 |
|
| 5991 |
if( empty($acting_flg) ) return 'error'; |
| 5992 |
|
| 5993 |
|
| 5994 |
//include(USCES_PLUGIN_DIR . '/settlement/' . $acting_flg); |
| 5995 |
if($acting_flg == 'paypal.php'){ |
| 5996 |
// if( !file_exists($this->options['settlement_path'] . $acting_flg) ) |
| 5997 |
// return 'error'; |
| 5998 |
// |
| 5999 |
// require_once($this->options['settlement_path'] . "paypal.php"); |
| 6000 |
// paypal_submit(); |
| 6001 |
|
| 6002 |
}else if($acting_flg == 'epsilon.php'){ |
| 6003 |
if( !file_exists($this->options['settlement_path'] . $acting_flg) ) |
| 6004 |
return 'error'; |
| 6005 |
|
| 6006 |
if ( $this->use_ssl ) { |
| 6007 |
$redirect = str_replace('http://', 'https://', USCES_CART_URL); |
| 6008 |
}else{ |
| 6009 |
$redirect = USCES_CART_URL; |
| 6010 |
} |
| 6011 |
usces_log('epsilon card entry data (acting_processing) : '.print_r($entry, true), 'acting_transaction.log'); |
| 6012 |
$query .= '&settlement=epsilon&redirect_url=' . urlencode($redirect); |
| 6013 |
$query = $delim . ltrim($query, '&'); |
| 6014 |
header("location: " . $redirect . $query); |
| 6015 |
exit; |
| 6016 |
|
| 6017 |
}else if($acting_flg == 'acting_zeus_card' && 2 == $this->options['acting_settings']['zeus']['connection'] ){ |
| 6018 |
if( 1 == $this->options['acting_settings']['zeus']['3dsecur'] ){ |
| 6019 |
if( !isset($_REQUEST['PaRes'])){ |
| 6020 |
|
| 6021 |
usces_log('zeus card 3dsecure entry data (acting_processing) : '.print_r($entry, true), 'acting_transaction.log'); |
| 6022 |
usces_zeus_3dsecure_enrol(); |
| 6023 |
|
| 6024 |
}else{ |
| 6025 |
|
| 6026 |
usces_log('zeus card 3dsecure : auth', 'acting_transaction.log'); |
| 6027 |
usces_zeus_3dsecure_auth(); |
| 6028 |
} |
| 6029 |
}else{ |
| 6030 |
usces_log('zeus card no3d entry data (acting_processing) : '.print_r($entry, true), 'acting_transaction.log'); |
| 6031 |
$res = usces_zeus_secure_payreq(); |
| 6032 |
return $res; |
| 6033 |
} |
| 6034 |
}else if($acting_flg == 'acting_zeus_card' && 1 == $this->options['acting_settings']['zeus']['connection'] ){ |
| 6035 |
|
| 6036 |
$acting_opts = $this->options['acting_settings']['zeus']; |
| 6037 |
$interface = parse_url($acting_opts['card_url']); |
| 6038 |
|
| 6039 |
usces_log('zeus card securelink entry data (acting_processing) : '.print_r($entry, true), 'acting_transaction.log'); |
| 6040 |
|
| 6041 |
$vars = 'send=mall'; |
| 6042 |
$vars .= '&clientip=' . $acting_opts['clientip']; |
| 6043 |
$vars .= '&cardnumber=' . $_POST['cardnumber']; |
| 6044 |
if( 1 == $this->options['acting_settings']['zeus']['security'] ){ |
| 6045 |
$vars .= '&seccode=' . $_POST['securecode']; |
| 6046 |
} |
| 6047 |
$vars .= '&expyy=' . substr($_POST['expyy'], 2); |
| 6048 |
$vars .= '&expmm=' . $_POST['expmm']; |
| 6049 |
$vars .= '&telno=' . str_replace('-', '', $_POST['telno']); |
| 6050 |
$vars .= '&email=' . $_POST['email']; |
| 6051 |
$vars .= '&sendid=' . $_POST['sendid']; |
| 6052 |
$vars .= '&username=' . $_POST['username']; |
| 6053 |
$vars .= '&money=' . $_POST['money']; |
| 6054 |
$vars .= '&sendpoint=' . $_POST['sendpoint']; |
| 6055 |
$vars .= '&printord=' . $_POST['printord']; |
| 6056 |
$vars .= '&return_value=yes'; |
| 6057 |
if( isset($_POST['howpay']) && WCUtils::is_zero($_POST['howpay']) ){ |
| 6058 |
$vars .= '&div=' . $_POST['div']; |
| 6059 |
} |
| 6060 |
|
| 6061 |
//usces_log('zeus card *****vars : '.print_r($vars, true), 'acting_transaction.log'); |
| 6062 |
|
| 6063 |
$header = "POST " . $interface['path'] . " HTTP/1.1\r\n"; |
| 6064 |
$header .= "Host: " . $_SERVER['HTTP_HOST'] . "\r\n"; |
| 6065 |
//$header .= "Host: usctest.securesites.com\r\n"; |
| 6066 |
$header .= "User-Agent: PHP Script\r\n"; |
| 6067 |
$header .= "Content-Type: application/x-www-form-urlencoded\r\n"; |
| 6068 |
$header .= "Content-Length: " . strlen($vars) . "\r\n"; |
| 6069 |
$header .= "Connection: close\r\n\r\n"; |
| 6070 |
$header .= $vars; |
| 6071 |
$fp = fsockopen('ssl://'.$interface['host'],443,$errno,$errstr,30); |
| 6072 |
|
| 6073 |
if ($fp){ |
| 6074 |
fwrite($fp, $header); |
| 6075 |
while ( !feof($fp) ) { |
| 6076 |
$scr = fgets($fp, 1024); |
| 6077 |
$page .= $scr; |
| 6078 |
} |
| 6079 |
fclose($fp); |
| 6080 |
|
| 6081 |
//usces_log('zeus card *****2 : '.print_r($page, true), 'acting_transaction.log'); |
| 6082 |
if( false !== strpos( $page, 'Success_order') ){ |
| 6083 |
usces_auth_order_acting_data($_POST['sendpoint']); |
| 6084 |
usces_log('zeus card : Success_order ', 'acting_transaction.log'); |
| 6085 |
$ordd = usces_get_order_number( $page ); |
| 6086 |
//20120904ysk start 0000541 |
| 6087 |
if ( !isset($_POST['cbrand']) || (isset($_POST['howpay']) && 1 == $_POST['howpay']) ) { |
| 6088 |
$args = ''; |
| 6089 |
} else { |
| 6090 |
$div = 'div_'.$_POST['cbrand']; |
| 6091 |
$args = '&cbrand='.$_POST['cbrand'].'&howpay='.$_POST['howpay'].'&'.$div.'='.$_POST[$div]; |
| 6092 |
} |
| 6093 |
$args .= '&order_number='.$ordd.'&wctid='.$_POST['sendpoint']; |
| 6094 |
header("Location: " . USCES_CART_URL . $delim . 'acting=zeus_card&acting_return=1'.$args); |
| 6095 |
//20120904ysk end |
| 6096 |
exit; |
| 6097 |
}else{ |
| 6098 |
$err_code = usces_get_err_code( $page ); |
| 6099 |
usces_log('zeus card : Certification Error : '.$err_code, 'acting_transaction.log'); |
| 6100 |
header("Location: " . USCES_CART_URL . $delim . 'acting=zeus_card&acting_return=0&err_code='.substr( $err_code, -3 ) ); |
| 6101 |
exit; |
| 6102 |
} |
| 6103 |
}else{ |
| 6104 |
usces_log('zeus card : Socket Error', 'acting_transaction.log'); |
| 6105 |
header("Location: " . USCES_CART_URL . $delim . 'acting=zeus_card&acting_return=0'); |
| 6106 |
} |
| 6107 |
exit; |
| 6108 |
|
| 6109 |
}else if($acting_flg == 'acting_zeus_conv'){ |
| 6110 |
|
| 6111 |
$acting_opts = $this->options['acting_settings']['zeus']; |
| 6112 |
$interface = parse_url($acting_opts['conv_url']); |
| 6113 |
|
| 6114 |
$vars .= 'clientip=' . $acting_opts['clientip_conv']; |
| 6115 |
$vars .= '&act=' . $_POST['act']; |
| 6116 |
$vars .= '&money=' . $_POST['money']; |
| 6117 |
$vars .= '&username=' . mb_convert_encoding($_POST['username'], 'SJIS', 'UTF-8'); |
| 6118 |
$vars .= '&telno=' . str_replace('-', '', $_POST['telno']); |
| 6119 |
$vars .= '&email=' . $_POST['email']; |
| 6120 |
$vars .= '&pay_cvs=' . $_POST['pay_cvs']; |
| 6121 |
$vars .= '&sendid=' . $_POST['sendid']; |
| 6122 |
$vars .= '&sendpoint=' . $_POST['sendpoint']; |
| 6123 |
if( isset($acting_opts['conv_ope']) && 'test' == $acting_opts['conv_ope'] ) { |
| 6124 |
$vars .= '&testid=' . $acting_opts['testid_conv']; |
| 6125 |
$vars .= '&test_type=' . $acting_opts['test_type_conv']; |
| 6126 |
} |
| 6127 |
|
| 6128 |
$header = "POST " . $interface['path'] . " HTTP/1.1\r\n"; |
| 6129 |
$header .= "Host: " . $_SERVER['HTTP_HOST'] . "\r\n"; |
| 6130 |
$header .= "User-Agent: PHP Script\r\n"; |
| 6131 |
$header .= "Content-Type: application/x-www-form-urlencoded\r\n"; |
| 6132 |
$header .= "Content-Length: " . strlen($vars) . "\r\n"; |
| 6133 |
$header .= "Connection: close\r\n\r\n"; |
| 6134 |
$header .= $vars; |
| 6135 |
//usces_log('zeus conv header : '.print_r($header, true), 'acting_transaction.log'); |
| 6136 |
$fp = fsockopen('ssl://'.$interface['host'],443,$errno,$errstr,30); |
| 6137 |
|
| 6138 |
if ($fp){ |
| 6139 |
fwrite($fp, $header); |
| 6140 |
while ( !feof($fp) ) { |
| 6141 |
$scr = fgets($fp, 1024); |
| 6142 |
$page .= $scr; |
| 6143 |
if( false !== strpos( $scr, 'order_no') ) |
| 6144 |
$qstr .= trim($scr) . '&'; |
| 6145 |
if( false !== strpos( $scr, 'pay_no1') ) |
| 6146 |
$qstr .= trim($scr) . '&'; |
| 6147 |
if( false !== strpos( $scr, 'pay_no2') ) |
| 6148 |
$qstr .= trim($scr) . '&'; |
| 6149 |
if( false !== strpos( $scr, 'pay_limit') ) |
| 6150 |
$qstr .= trim($scr) . '&'; |
| 6151 |
if( false !== strpos( $scr, 'pay_url') ) |
| 6152 |
$qstr .= trim($scr) . '&'; |
| 6153 |
if( false !== strpos( $scr, 'error_code') ) |
| 6154 |
$qstr .= trim($scr) . '&'; |
| 6155 |
if( false !== strpos( $scr, 'sendpoint') ) |
| 6156 |
$qstr .= trim($scr) . '&'; |
| 6157 |
} |
| 6158 |
$qstr .= 'pay_cvs=' . $_POST['pay_cvs'].'&wctid='.$_POST['sendpoint']; |
| 6159 |
fclose($fp); |
| 6160 |
//usces_log('zeus page : '.$page, 'acting_transaction.log'); |
| 6161 |
|
| 6162 |
if( false !== strpos( $page, 'Success_order') ){ |
| 6163 |
usces_log('zeus conv entry data (acting_processing) : '.print_r($entry, true), 'acting_transaction.log'); |
| 6164 |
header("Location: " . USCES_CART_URL . $delim . 'acting=zeus_conv&acting_return=1&' . $qstr); |
| 6165 |
exit; |
| 6166 |
}else{ |
| 6167 |
usces_log('zeus data NG : '.$page, 'acting_transaction.log'); |
| 6168 |
header("Location: " . USCES_CART_URL . $delim . 'acting=zeus_conv&acting_return=0'); |
| 6169 |
exit; |
| 6170 |
} |
| 6171 |
}else{ |
| 6172 |
usces_log('zeus : sockopen NG', 'acting_transaction.log'); |
| 6173 |
header("Location: " . USCES_CART_URL . $delim . 'acting=zeus_conv&acting_return=0'); |
| 6174 |
} |
| 6175 |
exit; |
| 6176 |
|
| 6177 |
//20110208ysk start |
| 6178 |
}else if($acting_flg == 'acting_paypal_ec') { |
| 6179 |
$acting_opts = $this->options['acting_settings']['paypal']; |
| 6180 |
$currency_code = $this->get_currency_code(); |
| 6181 |
$addroverride = '1'; |
| 6182 |
if( isset( $_POST['PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE'] ) ) { |
| 6183 |
if( 'US' == $_POST['PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE'] or 'CA' == $_POST['PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE'] ) $addroverride = '0'; |
| 6184 |
} else { |
| 6185 |
$addroverride = '0'; |
| 6186 |
} |
| 6187 |
|
| 6188 |
$nvpstr = $query; |
| 6189 |
$nvpstr .= '&SESSION_ID='.$currency_code; |
| 6190 |
$nvpstr .= '&CURRENCYCODE='.$currency_code; |
| 6191 |
$nvpstr .= '&ADDROVERRIDE='.$addroverride; |
| 6192 |
$nvpstr .= '&PAYMENTACTION=' . apply_filters('usces_filter_paypal_ec_paymentaction', 'Sale'); |
| 6193 |
|
| 6194 |
//The returnURL is the location where buyers return to when a payment has been succesfully authorized. |
| 6195 |
$nvpstr .= '&RETURNURL='.urlencode(USCES_CART_URL.$delim.'acting=paypal_ec&acting_return=1'); |
| 6196 |
|
| 6197 |
//The cancelURL is the location buyers are sent to when they hit the cancel button during authorization of payment during the PayPal flow |
| 6198 |
$nvpstr .= '&CANCELURL='.apply_filters( 'usces_filter_paypal_ec_cancelurl', urlencode(USCES_CART_URL.$delim.'confirm=1'), $query ); |
| 6199 |
|
| 6200 |
$nvpstr .= '&NOTIFYURL='.urlencode(USCES_PAYPAL_NOTIFY_URL); |
| 6201 |
|
| 6202 |
$this->paypal->setMethod('SetExpressCheckout'); |
| 6203 |
$this->paypal->setData($nvpstr); |
| 6204 |
$res = $this->paypal->doExpressCheckout(); |
| 6205 |
$resArray = $this->paypal->getResponse(); |
| 6206 |
$ack = strtoupper($resArray["ACK"]); |
| 6207 |
if($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") { |
| 6208 |
$token = urldecode($resArray["TOKEN"]); |
| 6209 |
$payPalURL = $acting_opts['paypal_url'].'?cmd=_express-checkout&token='.$token.'&useraction=commit'; |
| 6210 |
header("Location: ".$payPalURL); |
| 6211 |
|
| 6212 |
} else { |
| 6213 |
//Display a user friendly Error on the page using any of the following error information returned by PayPal |
| 6214 |
$ErrorCode = urldecode($resArray["L_ERRORCODE0"]); |
| 6215 |
$ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]); |
| 6216 |
$ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]); |
| 6217 |
$ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]); |
| 6218 |
usces_log('PayPal : SetExpressCheckout API call failed. Error Code:['.$ErrorCode.'] Error Severity Code:['.$ErrorSeverityCode.'] Short Error Message:'.$ErrorShortMsg.' Detailed Error Message:'.$ErrorLongMsg, 'acting_transaction.log'); |
| 6219 |
header("Location: ".USCES_CART_URL.$delim.'acting=paypal_ec&acting_return=0'); |
| 6220 |
} |
| 6221 |
exit; |
| 6222 |
//20110208ysk end |
| 6223 |
//20121030ysk start |
| 6224 |
} elseif( $acting_flg == 'acting_telecom_edy' ) { |
| 6225 |
$table_meta_name = $wpdb->prefix."usces_order_meta"; |
| 6226 |
$value = array(); |
| 6227 |
$value['usces_cart'] = $_SESSION['usces_cart']; |
| 6228 |
$value['usces_entry'] = $_SESSION['usces_entry']; |
| 6229 |
$value['usces_member'] = $_SESSION['usces_member']; |
| 6230 |
$mvalue = serialize( $value ); |
| 6231 |
$mquery = $wpdb->prepare( "INSERT INTO $table_meta_name (order_id, meta_key, meta_value) VALUES (%d, %s, %s)", $_POST['option'], $_POST['option'], $mvalue ); |
| 6232 |
$res = $wpdb->query( $mquery ); |
| 6233 |
|
| 6234 |
unset( $_SESSION['usces_cart'] ); |
| 6235 |
unset( $_SESSION['usces_entry'] ); |
| 6236 |
|
| 6237 |
$acting_opts = $this->options['acting_settings']['telecom']; |
| 6238 |
header( "location: ".$acting_opts['send_url_edy'].'?acting=telecom_edy'.$query ); |
| 6239 |
exit; |
| 6240 |
//20121030ysk end |
| 6241 |
//20121206ysk start |
| 6242 |
} else if( $acting_flg == 'acting_digitalcheck_card' ) { |
| 6243 |
$acting_opts = $this->options['acting_settings']['digitalcheck']; |
| 6244 |
$interface = parse_url($acting_opts['send_url_user_id']); |
| 6245 |
$kakutei = ( empty($acting_opts['card_kakutei']) ) ? '0' : $acting_opts['card_kakutei']; |
| 6246 |
|
| 6247 |
$vars = 'IP='.$acting_opts['card_ip']; |
| 6248 |
$vars .= '&PASS='.$acting_opts['card_pass']; |
| 6249 |
$vars .= '&IP_USER_ID='.$_POST['IP_USER_ID']; |
| 6250 |
$vars .= '&SID='.$_POST['SID']; |
| 6251 |
$vars .= '&STORE=51'; |
| 6252 |
$vars .= '&N1='.$_POST['N1']; |
| 6253 |
$vars .= '&K1='.$_POST['K1']; |
| 6254 |
$vars .= '&KAKUTEI='.$kakutei; |
| 6255 |
$vars .= '&FUKA='.$acting_flg; |
| 6256 |
|
| 6257 |
$header = "POST ".$interface['path']." HTTP/1.1\r\n"; |
| 6258 |
$header .= "Host: ".$_SERVER['HTTP_HOST']."\r\n"; |
| 6259 |
$header .= "User-Agent: PHP Script\r\n"; |
| 6260 |
$header .= "Content-Type: application/x-www-form-urlencoded\r\n"; |
| 6261 |
$header .= "Content-Length: ".strlen($vars)."\r\n"; |
| 6262 |
$header .= "Connection: close\r\n\r\n"; |
| 6263 |
$header .= $vars; |
| 6264 |
$fp = fsockopen('ssl://'.$interface['host'],443,$errno,$errstr,30); |
| 6265 |
|
| 6266 |
if( $fp ) { |
| 6267 |
fwrite( $fp, $header ); |
| 6268 |
$page = ''; |
| 6269 |
while( !feof($fp) ) { |
| 6270 |
$line = fgets( $fp, 1024 ); |
| 6271 |
if( strcmp($line, "\r\n") == 0 ) { |
| 6272 |
$headerdone = true; |
| 6273 |
} elseif( $headerdone ) { |
| 6274 |
$page .= $line; |
| 6275 |
} |
| 6276 |
} |
| 6277 |
fclose($fp); |
| 6278 |
$lines = explode("\n", $page); |
| 6279 |
if( false !== strpos( $lines[0], 'OK') ) { |
| 6280 |
usces_log('digitalcheck card entry data (acting_processing) : '.print_r($entry, true), 'acting_transaction.log'); |
| 6281 |
//$args = '&SID='.$lines[1]; |
| 6282 |
$args = '&SID='.$_POST['SID'].'&FUKA='.$acting_flg; |
| 6283 |
header( "location: ".USCES_CART_URL.$delim.'acting=digitalcheck_card&acting_return=1'.$args ); |
| 6284 |
} else { |
| 6285 |
usces_log('digitalcheck card : Certification Error : '.$page, 'acting_transaction.log'); |
| 6286 |
header( "location: ".USCES_CART_URL.$delim.'acting=digitalcheck_card&acting_return=0' ); |
| 6287 |
} |
| 6288 |
} else { |
| 6289 |
usces_log('digitalcheck card : Socket Error', 'acting_transaction.log'); |
| 6290 |
header( "location: ".USCES_CART_URL.$delim.'acting=digitalcheck_card&acting_return=0' ); |
| 6291 |
} |
| 6292 |
exit; |
| 6293 |
} else if( $acting_flg == 'acting_digitalcheck_conv' ) { |
| 6294 |
if( isset($_REQUEST['STORE']) and '99' != $_REQUEST['STORE'] ) { |
| 6295 |
$res = $this->order_processing(); |
| 6296 |
if( 'ordercompletion' == $res ) { |
| 6297 |
$table_meta_name = $wpdb->prefix."usces_order_meta"; |
| 6298 |
$mquery = $wpdb->prepare("SELECT order_id FROM $table_meta_name WHERE meta_key = %s AND meta_value = %s", 'SID', $_REQUEST['SID'] ); |
| 6299 |
$order_id = $wpdb->get_var($mquery); |
| 6300 |
if( $order_id ) { |
| 6301 |
$data = array( "settltment_status" => __("Failure",'usces'), "settltment_errmsg" => __("Settlement was not completed.",'usces') ); |
| 6302 |
$this->set_order_meta_value( 'acting_digitalcheck_conv', serialize( $data ), $order_id ); |
| 6303 |
} |
| 6304 |
$this->cart->crear_cart(); |
| 6305 |
$acting_opts = $this->options['acting_settings']['digitalcheck']; |
| 6306 |
header( "location: ".$acting_opts['send_url_conv'].'?acting=digitalcheck_conv'.$query ); |
| 6307 |
exit; |
| 6308 |
} else { |
| 6309 |
usces_log('digitalcheck conv : order processing error', 'acting_transaction.log'); |
| 6310 |
header( "location: ".USCES_CART_URL.$delim.'acting=digitalcheck_conv&acting_return=0' ); |
| 6311 |
} |
| 6312 |
} else { |
| 6313 |
$acting_opts = $this->options['acting_settings']['digitalcheck']; |
| 6314 |
header( "location: ".$acting_opts['send_url_conv'].'?acting=digitalcheck_conv'.$query ); |
| 6315 |
exit; |
| 6316 |
} |
| 6317 |
//20121206ysk end |
| 6318 |
//20140206ysk start |
| 6319 |
} else if( $acting_flg == 'acting_veritrans_card' or $acting_flg == 'acting_veritrans_conv' ) { |
| 6320 |
$acting_opts = $this->options['acting_settings']['veritrans']; |
| 6321 |
$acting = substr( $acting_flg, 7 ); |
| 6322 |
$dummy_payment_flag = ( 'public' == $acting_opts['ope'] ) ? '0' : '1'; |
| 6323 |
$order_id = isset( $_POST['ORDER_ID'] ) ? $_POST['ORDER_ID'] : ''; |
| 6324 |
$url = parse_url( $acting_opts['regist_url'] ); |
| 6325 |
$path = empty($url['path']) ? '/' : $url['path']; |
| 6326 |
|
| 6327 |
$postdata = $query; |
| 6328 |
if( 'acting_veritrans_card' == $acting_flg ) { |
| 6329 |
$card_capture_flag = ( 'capture' == $acting_opts['card_capture_flag'] ) ? '1' : '0'; |
| 6330 |
$postdata .= '&CARD_CAPTURE_FLAG='.$card_capture_flag; |
| 6331 |
} |
| 6332 |
if( 'acting_veritrans_conv' == $acting_flg ) { |
| 6333 |
$postdata .= '&NAME1='.urlencode( mb_substr( mb_convert_kana( $entry['customer']['name1'], 'ASKV', 'UTF-8' ), 0, 10 ) ); |
| 6334 |
$postdata .= '&NAME2='.urlencode( mb_substr( mb_convert_kana( $entry['customer']['name2'], 'ASKV', 'UTF-8' ), 0, 10 ) ); |
| 6335 |
if( empty($entry['customer']['name3']) ) { |
| 6336 |
$kana1 = mb_substr( mb_convert_kana( $entry['customer']['name3'], 'ASKV', 'UTF-8' ), 0, 10 ); |
| 6337 |
if( mb_ereg("^[ア-ン゛゜ァ-ォャ-ョー]+$", $kana1) ) |
| 6338 |
$postdata .= '&KANA1='.urlencode( $kana1 ); |
| 6339 |
} |
| 6340 |
if( empty($entry['customer']['name4']) ) { |
| 6341 |
$kana2 = mb_substr( mb_convert_kana( $entry['customer']['name4'], 'ASKV', 'UTF-8' ), 0, 10 ); |
| 6342 |
if( mb_ereg("^[ア-ン゛゜ァ-ォャ-ョー]+$", $kana2) ) |
| 6343 |
$postdata .= '&KANA2='.urlencode( $kana2 ); |
| 6344 |
} |
| 6345 |
$postdata .= '&TELEPHONE_NO='.str_replace( '-', '', $entry['customer']['tel'] ); |
| 6346 |
} |
| 6347 |
$postdata .= '&MERCHANT_ID='.$acting_opts['merchant_id']; |
| 6348 |
$postdata .= '&SESSION_ID='.session_id(); |
| 6349 |
$postdata .= '&FINISH_PAYMENT_RETURN_URL='.urlencode( USCES_CART_URL.$delim.'acting='.$acting.'&acting_return=1&result=1' ); |
| 6350 |
$postdata .= '&UNFINISH_PAYMENT_RETURN_URL='.urlencode( USCES_CART_URL.$delim.'acting='.$acting.'&confirm=1' ); |
| 6351 |
$postdata .= '&ERROR_PAYMENT_RETURN_URL='.urlencode( USCES_CART_URL.$delim.'acting='.$acting.'&acting_return=0' ); |
| 6352 |
$postdata .= '&FINISH_PAYMENT_ACCESS_URL='.urlencode( USCES_CART_URL.$delim.'acting='.$acting ); |
| 6353 |
$postdata .= '&DUMMY_PAYMENT_FLAG='.$dummy_payment_flag; |
| 6354 |
|
| 6355 |
$postlength = strlen( $postdata ); |
| 6356 |
|
| 6357 |
$request = "POST ".$path." HTTP/1.1"."\r\n"; |
| 6358 |
$request .= "Host: ".$url['host']."\r\n"; |
| 6359 |
$request .= "User-Agent: HttpRequest Powered by ".phpversion()."\r\n"; |
| 6360 |
$request .= "Connection: close"."\r\n"; |
| 6361 |
$request .= "Accept-Language: ja"."\r\n"; |
| 6362 |
$request .= "Content-Type: application/x-www-form-urlencoded"."\r\n"; |
| 6363 |
$request .= "Content-Length: ".$postlength."\r\n\r\n"; |
| 6364 |
$request .= $postdata; |
| 6365 |
|
| 6366 |
$code = 0; |
| 6367 |
$resBody = ""; |
| 6368 |
$con = @fsockopen( 'ssl://'.$url['host'], 443 ); |
| 6369 |
|
| 6370 |
if( $con ) { |
| 6371 |
$ret = fwrite( $con, $request ); |
| 6372 |
if( $ret == strlen($request) ) { |
| 6373 |
$res = $this->readResponse( $con ); |
| 6374 |
//usces_log( print_r($res,true), "veritrans.log" ); |
| 6375 |
$code = $res['Code']; |
| 6376 |
$resBody = $res['Body']; |
| 6377 |
|
| 6378 |
} else { |
| 6379 |
usces_log( 'Veritrans Write NG: Sent:'.strlen($request).' Send:'.$ret, "acting_transaction.log" ); |
| 6380 |
} |
| 6381 |
fclose( $con ); |
| 6382 |
|
| 6383 |
} else { |
| 6384 |
usces_log( "Veritrans Connect NG: ".$url['host'], "acting_transaction.log" ); |
| 6385 |
header( "location: ".USCES_CART_URL.$delim.'acting='.$acting_flg.'&acting_return=0' ); |
| 6386 |
exit; |
| 6387 |
} |
| 6388 |
|
| 6389 |
// 正常終了(200 OK)が返ったか |
| 6390 |
if( intval($code) == 200 ) { |
| 6391 |
$merchantKey = null; |
| 6392 |
$browserKey = null; |
| 6393 |
$scd = null; |
| 6394 |
$error_message = null; |
| 6395 |
|
| 6396 |
// レスポンスデータからマーチャントキー、ブラウザキーを取得 |
| 6397 |
$bodyLine = explode( "\n", $resBody ); |
| 6398 |
foreach( $bodyLine as $line ) { |
| 6399 |
if( preg_match( '/^MERCHANT_ENCRYPTION_KEY=(.+)/', $line, $match ) ) { |
| 6400 |
$merchantKey = $match[1]; |
| 6401 |
} elseif( preg_match( '/^BROWSER_ENCRYPTION_KEY=(.+)/', $line, $match ) ) { |
| 6402 |
$browserKey = $match[1]; |
| 6403 |
} elseif( preg_match('/^SCD=(.+)/', $line, $match ) ) { |
| 6404 |
$scd = $match[1]; |
| 6405 |
} elseif( preg_match( '/^ERROR_MESSAGE=(.+)/', $line, $match ) ) { |
| 6406 |
$error_message = $match[1]; |
| 6407 |
} |
| 6408 |
} |
| 6409 |
|
| 6410 |
// 両方取れたらOK。SCDはカードでセキュリティコードが� |
| 6411 |
�力された場合のみ |
| 6412 |
if( !is_null($merchantKey) && !is_null($browserKey) ) { |
| 6413 |
$getdata = '?MERCHANT_ID='.$acting_opts['merchant_id']; |
| 6414 |
$getdata .= '&ORDER_ID='.$order_id; |
| 6415 |
$getdata .= '&BROWSER_ENCRYPTION_KEY='.urlencode($browserKey); |
| 6416 |
header( "location: ".$acting_opts['payment_url'].$getdata ); |
| 6417 |
|
| 6418 |
} else { |
| 6419 |
if( !is_null($error_message) ) |
| 6420 |
usces_log( "Veritrans AWeb:".$error_message, "acting_transaction.log" ); |
| 6421 |
header( "location: ".USCES_CART_URL.$delim.'acting='.$acting_flg.'&acting_return=0' ); |
| 6422 |
} |
| 6423 |
|
| 6424 |
} else { |
| 6425 |
usces_log( "Veritrans Response NG: ".$resBody, "acting_transaction.log" ); |
| 6426 |
header( "location: ".USCES_CART_URL.$delim.'acting='.$acting_flg.'&acting_return=0' ); |
| 6427 |
} |
| 6428 |
exit; |
| 6429 |
//20140206ysk end |
| 6430 |
} |
| 6431 |
do_action('usces_action_acting_processing', $acting_flg, $query); |
| 6432 |
} |
| 6433 |
|
| 6434 |
private function readResponse( $fp ) { |
| 6435 |
$res = array( 'Status'=>'', 'Version'=>'', 'Code'=>0, 'Message'=>'', 'Headers'=>array(), 'Body'=>'' ); |
| 6436 |
|
| 6437 |
// HTTPステータスの読み込み |
| 6438 |
$line = $this->readLine( $fp ); |
| 6439 |
if( preg_match( '/^(HTTP\/1\.[0-9x]+)\s+([0-9]+)\s+(.+)/i', $line, $match ) == 0 ) { |
| 6440 |
return $res; |
| 6441 |
} |
| 6442 |
$res['Status'] = $line; |
| 6443 |
$res['Version'] = $match[1]; |
| 6444 |
$res['Code'] = $match[2]; |
| 6445 |
$res['Message'] = $match[3]; |
| 6446 |
|
| 6447 |
// レスポンスヘッダの読み込み |
| 6448 |
while( !feof($fp) ) { |
| 6449 |
$line = $this->readLine( $fp ); |
| 6450 |
if( $line != '' ) { |
| 6451 |
list( $hname, $hvalue ) = explode( ':', $line, 2 ); |
| 6452 |
$res['Headers'][strtolower($hname)] = ltrim($hvalue); |
| 6453 |
} else { |
| 6454 |
break; |
| 6455 |
} |
| 6456 |
} |
| 6457 |
// レスポンスデータの読み込み |
| 6458 |
while( !feof($fp) ) { |
| 6459 |
$data = $this->readLine( $fp )."\n"; |
| 6460 |
if( '' == $data ) { |
| 6461 |
break; |
| 6462 |
} |
| 6463 |
$res['Body'] .= $data; |
| 6464 |
} |
| 6465 |
return $res; |
| 6466 |
} |
| 6467 |
|
| 6468 |
private function readLine( $fp ) { |
| 6469 |
if( !$fp ) { |
| 6470 |
return ''; |
| 6471 |
} |
| 6472 |
// レスポンスデータを受信 |
| 6473 |
$line = null; |
| 6474 |
while( !feof($fp) ) { |
| 6475 |
$line .= @fgets( $fp, 4096 ); |
| 6476 |
if( substr($line, -1) == "\n" ) { |
| 6477 |
return rtrim( $line, "\r\n" ); |
| 6478 |
} |
| 6479 |
} |
| 6480 |
return $line; |
| 6481 |
} |
| 6482 |
|
| 6483 |
function inquiry_processing() { |
| 6484 |
|
| 6485 |
$mail_res = usces_send_inquirymail(); |
| 6486 |
|
| 6487 |
if ( $mail_res ) |
| 6488 |
return 'inquiry_comp'; |
| 6489 |
else |
| 6490 |
return 'inquiry_error'; |
| 6491 |
} |
| 6492 |
|
| 6493 |
function lastprocessing() { |
| 6494 |
|
| 6495 |
if ( $this->page == 'ordercompletion' ) |
| 6496 |
$this->cart->crear_cart(); |
| 6497 |
|
| 6498 |
unset($_SESSION['usces_singleitem']); |
| 6499 |
|
| 6500 |
} |
| 6501 |
|
| 6502 |
function is_item_zaiko( $post_id, $sku ){ |
| 6503 |
$status_num = (int)$this->getItemZaikoStatusId($post_id, $sku); |
| 6504 |
$zaiko_num = $this->getItemZaikoNum($post_id, $sku); |
| 6505 |
|
| 6506 |
if( false !== $zaiko_num |
| 6507 |
&& ( 0 < (int)$zaiko_num || WCUtils::is_blank($zaiko_num) ) |
| 6508 |
&& false !== $status_num |
| 6509 |
&& 2 > $status_num |
| 6510 |
){ |
| 6511 |
return true; |
| 6512 |
}else{ |
| 6513 |
return false; |
| 6514 |
} |
| 6515 |
} |
| 6516 |
|
| 6517 |
// function for the cart *********************************************************** |
| 6518 |
function get_total_price( $cart = array() ) { |
| 6519 |
if( empty($cart) ) |
| 6520 |
$cart = $this->cart->get_cart(); |
| 6521 |
|
| 6522 |
$total_price = 0; |
| 6523 |
|
| 6524 |
if( !empty($cart) ) { |
| 6525 |
for($i=0; $i<count($cart); $i++) { |
| 6526 |
$quantity = $cart[$i]['quantity']; |
| 6527 |
$skuPrice = $cart[$i]['price']; |
| 6528 |
|
| 6529 |
$total_price += ($skuPrice * $quantity); |
| 6530 |
} |
| 6531 |
} |
| 6532 |
return apply_filters( 'usces_filter_get_total_price', $total_price, $cart); |
| 6533 |
} |
| 6534 |
|
| 6535 |
function get_total_quantity( $cart = array() ) { |
| 6536 |
if( empty($cart) ) |
| 6537 |
$cart = $this->cart->get_cart(); |
| 6538 |
|
| 6539 |
$total_quantity = 0; |
| 6540 |
|
| 6541 |
if( !empty($cart) ) { |
| 6542 |
for($i=0; $i<count($cart); $i++) { |
| 6543 |
$total_quantity += $cart[$i]['quantity']; |
| 6544 |
} |
| 6545 |
} |
| 6546 |
return $total_quantity; |
| 6547 |
} |
| 6548 |
|
| 6549 |
function get_order_point( $mem_id = '', $display_mode = '', $cart = array() ) { |
| 6550 |
if( $mem_id == '' || $this->options['membersystem_state'] == 'deactivate' || $this->options['membersystem_point'] == 'deactivate') return 0; |
| 6551 |
|
| 6552 |
if ( empty($cart) ) |
| 6553 |
$cart = $this->cart->get_cart(); |
| 6554 |
|
| 6555 |
if ( empty($display_mode) ) |
| 6556 |
$display_mode = $this->options['display_mode']; |
| 6557 |
|
| 6558 |
$point = 0; |
| 6559 |
$total = $this->get_total_price( $cart ); |
| 6560 |
if ( $display_mode == 'Promotionsale' ) { |
| 6561 |
if ( $this->options['campaign_privilege'] == 'discount' ) { |
| 6562 |
foreach ( $cart as $rows ) { |
| 6563 |
$cats = $this->get_post_term_ids($rows['post_id'], 'category'); |
| 6564 |
if ( !in_array($this->options['campaign_category'], $cats) ){ |
| 6565 |
$rate = get_post_meta($rows['post_id'], '_itemPointrate', true); |
| 6566 |
$price = $rows['price'] * $rows['quantity']; |
| 6567 |
$point += $price * $rate / 100; |
| 6568 |
} |
| 6569 |
} |
| 6570 |
} elseif ( $this->options['campaign_privilege'] == 'point' ) { |
| 6571 |
foreach ( $cart as $rows ) { |
| 6572 |
$rate = get_post_meta($rows['post_id'], '_itemPointrate', true); |
| 6573 |
//$price = $this->getItemPrice($rows['post_id'], $rows['sku']) * $rows['quantity']; |
| 6574 |
$price = $rows['price'] * $rows['quantity']; |
| 6575 |
$cats = $this->get_post_term_ids($rows['post_id'], 'category'); |
| 6576 |
if ( in_array($this->options['campaign_category'], $cats) ) |
| 6577 |
$point += $price * $rate / 100 * $this->options['privilege_point']; |
| 6578 |
else |
| 6579 |
$point += $price * $rate / 100; |
| 6580 |
} |
| 6581 |
} |
| 6582 |
} else { |
| 6583 |
foreach ( $cart as $rows ) { |
| 6584 |
$rate = get_post_meta($rows['post_id'], '_itemPointrate', true); |
| 6585 |
//$price = $this->getItemPrice($rows['post_id'], $rows['sku']) * $rows['quantity']; |
| 6586 |
$price = $rows['price'] * $rows['quantity']; |
| 6587 |
$point += $price * $rate / 100; |
| 6588 |
} |
| 6589 |
} |
| 6590 |
|
| 6591 |
//20130425ysk start 0000699 |
| 6592 |
if( 0 < $point ) $point = ceil( $point ); |
| 6593 |
|
| 6594 |
$entry = $this->cart->get_entry(); |
| 6595 |
$use_point = isset( $entry['order']['usedpoint'] ) ? (int)$entry['order']['usedpoint'] : 0; |
| 6596 |
if( 0 < $use_point ) { |
| 6597 |
$point = ceil( $point - ( $point * $use_point / $total ) ); |
| 6598 |
if( 0 > $point ) |
| 6599 |
$point = 0; |
| 6600 |
} |
| 6601 |
|
| 6602 |
return apply_filters( 'usces_filter_get_order_point', $point, $mem_id, $display_mode, $cart ); |
| 6603 |
//20130425ysk end |
| 6604 |
} |
| 6605 |
|
| 6606 |
function get_order_discount( $display_mode = '', $cart = array() ) { |
| 6607 |
if ( empty($cart) ) |
| 6608 |
$cart = $this->cart->get_cart(); |
| 6609 |
|
| 6610 |
if ( empty($display_mode) ) |
| 6611 |
$display_mode = $this->options['display_mode']; |
| 6612 |
|
| 6613 |
$discount = 0; |
| 6614 |
$total = $this->get_total_price( $cart ); |
| 6615 |
if ( $display_mode == 'Promotionsale' ) { |
| 6616 |
if ( $this->options['campaign_privilege'] == 'discount' ){ |
| 6617 |
if( 0 === (int)$this->options['campaign_category'] ){ |
| 6618 |
$discount = $total * $this->options['privilege_discount'] / 100; |
| 6619 |
}else{ |
| 6620 |
foreach($cart as $cart_row){ |
| 6621 |
if( in_category((int)$this->options['campaign_category'], $cart_row['post_id']) ){ |
| 6622 |
$discount += $cart_row['price'] * $cart_row['quantity'] * $this->options['privilege_discount'] / 100; |
| 6623 |
} |
| 6624 |
} |
| 6625 |
} |
| 6626 |
}else if ( $this->options['campaign_privilege'] == 'point' ){ |
| 6627 |
$discount = 0; |
| 6628 |
} |
| 6629 |
} |
| 6630 |
|
| 6631 |
$discount = ceil($discount * -1); |
| 6632 |
$discount = apply_filters('usces_order_discount', $discount, $cart); |
| 6633 |
return $discount; |
| 6634 |
} |
| 6635 |
|
| 6636 |
function getShippingCharge( $pref, $cart = array(), $entry = array() ) { |
| 6637 |
if( empty($cart) ) |
| 6638 |
$cart = $this->cart->get_cart(); |
| 6639 |
if( empty($entry) ) |
| 6640 |
$entry = $this->cart->get_entry(); |
| 6641 |
if( function_exists('dlseller_have_shipped') && !dlseller_have_shipped() ){ |
| 6642 |
$charge = 0; |
| 6643 |
$charge = apply_filters('usces_filter_getShippingCharge', $charge, $cart, $entry); |
| 6644 |
return $charge; |
| 6645 |
} |
| 6646 |
|
| 6647 |
//� |
| 6648 |
�送方法ID |
| 6649 |
$d_method_id = $entry['order']['delivery_method']; |
| 6650 |
//� |
| 6651 |
�送方法index |
| 6652 |
$d_method_index = $this->get_delivery_method_index($d_method_id); |
| 6653 |
//送料ID |
| 6654 |
$fixed_charge_id = ( isset($this->options['delivery_method'][$d_method_index]['charge']) ) ? $this->options['delivery_method'][$d_method_index]['charge'] : -1; |
| 6655 |
$individual_quant = 0; |
| 6656 |
$total_quant = 0; |
| 6657 |
$charges = array(); |
| 6658 |
$individual_charges = array(); |
| 6659 |
$country = (isset($entry['delivery']['country']) && !empty($entry['delivery']['country'])) ? $entry['delivery']['country'] : $entry['customer']['country'];//20120710ysk 0000472 |
| 6660 |
|
| 6661 |
foreach ( $cart as $rows ) { |
| 6662 |
|
| 6663 |
if( -1 == $fixed_charge_id ){ |
| 6664 |
//商品送料ID |
| 6665 |
$s_charge_id = $this->getItemShippingCharge($rows['post_id']); |
| 6666 |
//商品送料index |
| 6667 |
$s_charge_index = $this->get_shipping_charge_index($s_charge_id); |
| 6668 |
//20120710ysk start 0000472 |
| 6669 |
//$charge = isset($this->options['shipping_charge'][$s_charge_index]['value'][$pref]) ? $this->options['shipping_charge'][$s_charge_index]['value'][$pref] : 0; |
| 6670 |
$charge = isset($this->options['shipping_charge'][$s_charge_index][$country][$pref]) ? $this->options['shipping_charge'][$s_charge_index][$country][$pref] : 0; |
| 6671 |
//20120710ysk end |
| 6672 |
}else{ |
| 6673 |
|
| 6674 |
$s_charge_index = $this->get_shipping_charge_index($fixed_charge_id); |
| 6675 |
//20120710ysk start 0000472 |
| 6676 |
//$charge = isset($this->options['shipping_charge'][$s_charge_index]['value'][$pref]) ? $this->options['shipping_charge'][$s_charge_index]['value'][$pref] : 0; |
| 6677 |
$charge = isset($this->options['shipping_charge'][$s_charge_index][$country][$pref]) ? $this->options['shipping_charge'][$s_charge_index][$country][$pref] : 0; |
| 6678 |
//20120710ysk end |
| 6679 |
} |
| 6680 |
|
| 6681 |
if($this->getItemIndividualSCharge($rows['post_id'])){ |
| 6682 |
$individual_quant += $rows['quantity']; |
| 6683 |
$individual_charges[] = $rows['quantity'] * $charge; |
| 6684 |
}else{ |
| 6685 |
$charges[] = $charge; |
| 6686 |
} |
| 6687 |
$total_quant += $rows['quantity']; |
| 6688 |
} |
| 6689 |
|
| 6690 |
if( count($charges) > 0 ){ |
| 6691 |
rsort($charges); |
| 6692 |
$max_charge = $charges[0]; |
| 6693 |
$charge = $max_charge + array_sum($individual_charges); |
| 6694 |
}else{ |
| 6695 |
$charge = array_sum($individual_charges); |
| 6696 |
} |
| 6697 |
|
| 6698 |
$charge = apply_filters('usces_filter_getShippingCharge', $charge, $cart, $entry); |
| 6699 |
|
| 6700 |
return $charge; |
| 6701 |
} |
| 6702 |
|
| 6703 |
function getCODFee($payment_name, $amount_by_cod) { |
| 6704 |
$payments = $this->getPayments($payment_name); |
| 6705 |
if( 'COD' != $payments['settlement'] ){ |
| 6706 |
$fee = 0; |
| 6707 |
|
| 6708 |
}else if( 'change' != $this->options['cod_type'] ){ |
| 6709 |
//$fee = isset($this->options['cod_fee']) ? $this->options['cod_fee'] : ''; |
| 6710 |
$fee = isset($this->options['cod_fee']) ? $this->options['cod_fee'] : 0; |
| 6711 |
|
| 6712 |
}else{ |
| 6713 |
$price = $amount_by_cod + $this->getTax( $amount_by_cod ); |
| 6714 |
if( $price <= $this->options['cod_first_amount'] ){ |
| 6715 |
$fee = $this->options['cod_first_fee']; |
| 6716 |
|
| 6717 |
}else if( isset($this->options['cod_amounts']) ){ |
| 6718 |
$last = count( $this->options['cod_amounts'] ) - 1; |
| 6719 |
if( $price > $this->options['cod_amounts'][$last] ){ |
| 6720 |
$fee = $this->options['cod_end_fee']; |
| 6721 |
|
| 6722 |
}else{ |
| 6723 |
$fee = 0; |
| 6724 |
foreach( $this->options['cod_amounts'] as $key => $value ){ |
| 6725 |
if( $price <= $value ){ |
| 6726 |
$fee = $this->options['cod_fees'][$key]; |
| 6727 |
break; |
| 6728 |
} |
| 6729 |
} |
| 6730 |
} |
| 6731 |
}else{ |
| 6732 |
$fee = $this->options['cod_end_fee']; |
| 6733 |
} |
| 6734 |
} |
| 6735 |
$fee = apply_filters('usces_filter_getCODFee', $fee, $payment_name, $amount_by_cod); |
| 6736 |
return $fee; |
| 6737 |
} |
| 6738 |
|
| 6739 |
function getTax( $total ) { |
| 6740 |
if( empty($this->options['tax_rate']) ) |
| 6741 |
return 0; |
| 6742 |
|
| 6743 |
if( $this->options['tax_method'] == 'cutting' ) |
| 6744 |
$tax = floor($total * $this->options['tax_rate'] / 100); |
| 6745 |
elseif($this->options['tax_method'] == 'bring') |
| 6746 |
$tax = ceil($total * $this->options['tax_rate'] / 100); |
| 6747 |
elseif($this->options['tax_method'] == 'rounding') |
| 6748 |
$tax = round($total * $this->options['tax_rate'] / 100); |
| 6749 |
|
| 6750 |
return $tax; |
| 6751 |
} |
| 6752 |
|
| 6753 |
function set_cart_fees( $member, $entries ) { |
| 6754 |
$carts = $this->cart->get_cart(); |
| 6755 |
$total_items_price = $this->get_total_price(); |
| 6756 |
if ( empty($this->options['postage_privilege']) || $total_items_price < $this->options['postage_privilege'] ) { |
| 6757 |
$shipping_charge = $this->getShippingCharge( $entries['delivery']['pref'] ); |
| 6758 |
} else { |
| 6759 |
$shipping_charge = 0; |
| 6760 |
} |
| 6761 |
$shipping_charge = apply_filters('usces_filter_set_cart_fees_shipping_charge', $shipping_charge, $carts, $entries); |
| 6762 |
$payments = $this->getPayments( $entries['order']['payment_name'] ); |
| 6763 |
$discount = $this->get_order_discount(); |
| 6764 |
$use_point = $entries['order']['usedpoint']; |
| 6765 |
$amount_by_cod = $total_items_price - $use_point + $discount + $shipping_charge; |
| 6766 |
$amount_by_cod = apply_filters('usces_filter_set_cart_fees_amount_by_cod', $amount_by_cod, $entries, $total_items_price, $use_point, $discount, $shipping_charge); |
| 6767 |
$cod_fee = $this->getCODFee($entries['order']['payment_name'], $amount_by_cod); |
| 6768 |
$cod_fee = apply_filters('usces_filter_set_cart_fees_cod', $cod_fee, $entries, $total_items_price, $use_point, $discount, $shipping_charge); |
| 6769 |
$total_price = $total_items_price - $use_point + $discount + $shipping_charge + $cod_fee; |
| 6770 |
$total_price = apply_filters('usces_filter_set_cart_fees_total_price', $total_price, $total_items_price, $use_point, $discount, $shipping_charge, $cod_fee); |
| 6771 |
$tax = $this->getTax( $total_price ); |
| 6772 |
$total_full_price = $total_price + $tax; |
| 6773 |
$total_full_price = apply_filters('usces_filter_set_cart_fees_total_full_price', $total_full_price, $total_items_price, $use_point, $discount, $shipping_charge, $cod_fee); |
| 6774 |
$get_point = $this->get_order_point( $member['ID'] ); |
| 6775 |
//20130425ysk start 0000699 |
| 6776 |
//if(0 < (int)$use_point){ |
| 6777 |
// $get_point = ceil( $get_point - ($get_point * $use_point / $total_items_price) ); |
| 6778 |
// if(0 > $get_point) |
| 6779 |
// $get_point = 0; |
| 6780 |
//} |
| 6781 |
//20130425ysk end |
| 6782 |
|
| 6783 |
$array = array( |
| 6784 |
'total_items_price' => $total_items_price, |
| 6785 |
'total_price' => $total_price, |
| 6786 |
'total_full_price' => $total_full_price, |
| 6787 |
'getpoint' => $get_point, |
| 6788 |
'usedpoint' => $use_point, |
| 6789 |
'discount' => $discount, |
| 6790 |
'shipping_charge' => $shipping_charge, |
| 6791 |
'cod_fee' => $cod_fee, |
| 6792 |
'tax' => $tax |
| 6793 |
); |
| 6794 |
$this->cart->set_order_entry( $array ); |
| 6795 |
//$entries = $this->cart->get_entry(); |
| 6796 |
//var_dump($entries); |
| 6797 |
} |
| 6798 |
|
| 6799 |
function getPayments( $payment_name ) { |
| 6800 |
if( '#none#' == $payment_name ) |
| 6801 |
return NULL; |
| 6802 |
|
| 6803 |
$payments = usces_get_system_option( 'usces_payment_method', 'name' ); |
| 6804 |
if( isset($payments[$payment_name]) ) |
| 6805 |
return $payments[$payment_name]; |
| 6806 |
return NULL; |
| 6807 |
} |
| 6808 |
|
| 6809 |
function is_maintenance() { |
| 6810 |
if ( $this->options['display_mode'] == 'Maintenancemode' ) |
| 6811 |
return true; |
| 6812 |
else |
| 6813 |
return false; |
| 6814 |
} |
| 6815 |
|
| 6816 |
// function maintenance_mode() { |
| 6817 |
// if ( $this->is_maintenance() && !is_user_logged_in() && (!strstr($_SERVER['REQUEST_URI'], 'wp-admin') || !strstr($_SERVER['REQUEST_URI'], 'wp-login') ) ) { |
| 6818 |
// include ( TEMPLATEPATH . '/maintenance.php '); |
| 6819 |
// exit; |
| 6820 |
// } elseif ( isset($_GET['uscesmode']) && $_GET['uscesmode'] == 'lostpassword' ) { |
| 6821 |
// $error = isset($_GET['error']) ? '?error='.$_GET['error'] : ''; |
| 6822 |
// include ( TEMPLATEPATH . '/member/changepassword.php '); |
| 6823 |
// exit; |
| 6824 |
// } |
| 6825 |
// } |
| 6826 |
|
| 6827 |
function get_member_history($mem_id) { |
| 6828 |
global $wpdb; |
| 6829 |
$order_table = $wpdb->prefix . "usces_order"; |
| 6830 |
|
| 6831 |
$query = $wpdb->prepare("SELECT * FROM $order_table WHERE mem_id = %d ORDER BY order_date DESC", $mem_id); |
| 6832 |
$query = apply_filters( 'usces_filter_member_history_query', $query, $mem_id ); |
| 6833 |
// $query = $wpdb->prepare("SELECT ID, order_cart, order_condition, order_date, order_usedpoint, order_getpoint, |
| 6834 |
// order_discount, order_shipping_charge, order_cod_fee, order_tax, order_status |
| 6835 |
// FROM $order_table WHERE mem_id = %d ORDER BY order_date DESC", $mem_id); |
| 6836 |
$results = $wpdb->get_results( $query ); |
| 6837 |
|
| 6838 |
$i=0; |
| 6839 |
$res = array(); |
| 6840 |
foreach ( $results as $value ) { |
| 6841 |
if(strpos($value->order_status, 'cancel') === false && strpos($value->order_status, 'estimate') === false){ |
| 6842 |
|
| 6843 |
$res[] = array( |
| 6844 |
'ID' => $value->ID, |
| 6845 |
'cart' => unserialize($value->order_cart), |
| 6846 |
'condition' => unserialize($value->order_condition), |
| 6847 |
'getpoint' => $value->order_getpoint, |
| 6848 |
'usedpoint' => $value->order_usedpoint, |
| 6849 |
'discount' => $value->order_discount, |
| 6850 |
'shipping_charge' => $value->order_shipping_charge, |
| 6851 |
'payment_name' => $value->order_payment_name, |
| 6852 |
'cod_fee' => $value->order_cod_fee, |
| 6853 |
'tax' => $value->order_tax, |
| 6854 |
'order_status' => $value->order_status, |
| 6855 |
'date' => mysql2date(__('Y/m/d'), $value->order_date), |
| 6856 |
'order_date' => $value->order_date |
| 6857 |
); |
| 6858 |
$i++; |
| 6859 |
|
| 6860 |
} |
| 6861 |
} |
| 6862 |
|
| 6863 |
return $res; |
| 6864 |
|
| 6865 |
} |
| 6866 |
|
| 6867 |
function get_post_term_ids( $post_id, $taxonomy ){ |
| 6868 |
global $wpdb; |
| 6869 |
$query = $wpdb->prepare("SELECT tt.term_id FROM $wpdb->term_relationships AS tr |
| 6870 |
INNER JOIN $wpdb->term_taxonomy AS tt ON tt.term_taxonomy_id = tr.term_taxonomy_id |
| 6871 |
WHERE tt.taxonomy = %s AND tr.object_id = %d", $taxonomy, $post_id); |
| 6872 |
$ids = $wpdb->get_col( $query ); |
| 6873 |
|
| 6874 |
return $ids; |
| 6875 |
|
| 6876 |
} |
| 6877 |
|
| 6878 |
function get_tag_names($post_id) { |
| 6879 |
global $wpdb; |
| 6880 |
$tag = 'post_tag'; |
| 6881 |
$query = $wpdb->prepare("SELECT t.name FROM $wpdb->term_relationships AS tr |
| 6882 |
INNER JOIN $wpdb->term_taxonomy AS tt ON tt.term_taxonomy_id = tr.term_taxonomy_id |
| 6883 |
INNER JOIN $wpdb->terms AS t ON t.term_id = tt.term_id |
| 6884 |
WHERE tt.taxonomy = %s AND tr.object_id = %d", $tag, $post_id); |
| 6885 |
$names = $wpdb->get_col( $query ); |
| 6886 |
|
| 6887 |
return apply_filters('usces_filter_get_tag_names', $names, $post_id); |
| 6888 |
|
| 6889 |
} |
| 6890 |
|
| 6891 |
function get_ID_byItemName($itemname, $status = 'publish') { |
| 6892 |
global $wpdb; |
| 6893 |
$meta_key = '_itemCode'; |
| 6894 |
$query = $wpdb->prepare("SELECT p.ID FROM $wpdb->posts AS p |
| 6895 |
INNER JOIN $wpdb->postmeta AS pm ON p.ID = pm.post_id |
| 6896 |
WHERE p.post_status = %s AND pm.meta_key = %s AND meta_value = %s ", $status, $meta_key, $itemname); |
| 6897 |
$id = $wpdb->get_var( $query ); |
| 6898 |
|
| 6899 |
// $wpdb->show_errors(); |
| 6900 |
// $wpdb->print_error(); |
| 6901 |
|
| 6902 |
return $id; |
| 6903 |
|
| 6904 |
} |
| 6905 |
|
| 6906 |
function uscescv( $sessid, $flag ) { |
| 6907 |
|
| 6908 |
$chars = ''; |
| 6909 |
$i=0; |
| 6910 |
$h=0; |
| 6911 |
$usces_cookie = $this->get_cookie(); |
| 6912 |
if( isset($usces_cookie['id']) && !empty($usces_cookie['id']) ){ |
| 6913 |
$cid = $usces_cookie['id']; |
| 6914 |
}elseif( isset($_SESSION['usces_cookieid']) && !empty($_SESSION['usces_cookieid']) ){ |
| 6915 |
$cid = $_SESSION['usces_cookieid']; |
| 6916 |
}else{ |
| 6917 |
$cid = 0; |
| 6918 |
} |
| 6919 |
while($h<strlen($sessid)){ |
| 6920 |
if(0 == $i % 3){ |
| 6921 |
$chars .= substr($i, -1); |
| 6922 |
}else{ |
| 6923 |
$chars .= substr($sessid, $h, 1); |
| 6924 |
$h++; |
| 6925 |
} |
| 6926 |
$i++; |
| 6927 |
} |
| 6928 |
if( $flag ){ |
| 6929 |
$postfix = ( isset($_SERVER['REMOTE_ADDR']) && !empty($_SERVER['REMOTE_ADDR']) ) ? $_SERVER['REMOTE_ADDR'] : 'REMOTE_ADDR'; |
| 6930 |
$postfix = apply_filters('usces_sessid_force', $postfix); |
| 6931 |
$sessid = $chars . '_' . $postfix . '_' . $cid . '_A'; |
| 6932 |
}else{ |
| 6933 |
$sessid = $chars . '_' . apply_filters('usces_sessid_flag', 'acting') . '_' . $cid . '_A'; |
| 6934 |
} |
| 6935 |
$sessid = urlencode(base64_encode($sessid)); |
| 6936 |
//usces_log('sessid2 : '.$sessid, 'acting_transaction.log'); |
| 6937 |
|
| 6938 |
return $sessid; |
| 6939 |
} |
| 6940 |
|
| 6941 |
function uscesdc( $sessid ) { |
| 6942 |
// $usces_cookie = $this->get_cookie(); |
| 6943 |
// if( $this->use_ssl && ($this->is_cart_or_member_page($_SERVER['REQUEST_URI']) || $this->is_inquiry_page($_SERVER['REQUEST_URI']))){ |
| 6944 |
// if( isset($usces_cookie['sslid']) && !empty($usces_cookie['sslid']) ){ |
| 6945 |
// $cid = $usces_cookie['sslid']; |
| 6946 |
// }else{ |
| 6947 |
// $cid = 0; |
| 6948 |
// } |
| 6949 |
// }else{ |
| 6950 |
// if( isset($usces_cookie['id']) && !empty($usces_cookie['id']) ){ |
| 6951 |
// $cid = $usces_cookie['id']; |
| 6952 |
// }else{ |
| 6953 |
// $cid = 0; |
| 6954 |
// } |
| 6955 |
// } |
| 6956 |
$sessid = base64_decode(urldecode($sessid)); |
| 6957 |
list($sess, $addr, $cookieid, $none) = explode('_', $sessid, 4); |
| 6958 |
$postfix = ( isset($_SERVER['REMOTE_ADDR']) && !empty($_SERVER['REMOTE_ADDR']) ) ? $_SERVER['REMOTE_ADDR'] : 'REMOTE_ADDR'; |
| 6959 |
$postfix = apply_filters('usces_sessid_force', $postfix); |
| 6960 |
//usces_log('cid : '.$cid, 'acting_transaction.log'); |
| 6961 |
//usces_log('cookieid : '.$cookieid, 'acting_transaction.log'); |
| 6962 |
//usces_log('postfix : '.$postfix, 'acting_transaction.log'); |
| 6963 |
//usces_log('addr : '.$addr, 'acting_transaction.log'); |
| 6964 |
if( 'acting' !== $addr && 'mobile' !== $addr && $postfix !== $addr ) { |
| 6965 |
$sessid = ''; |
| 6966 |
return NULL; |
| 6967 |
} |
| 6968 |
$chars = ''; |
| 6969 |
$h=0; |
| 6970 |
while($h<strlen($sess)){ |
| 6971 |
if(0 != $h % 3){ |
| 6972 |
$chars .= substr($sess, $h, 1); |
| 6973 |
} |
| 6974 |
$h++; |
| 6975 |
} |
| 6976 |
$sessid = $chars; |
| 6977 |
|
| 6978 |
return $sessid; |
| 6979 |
|
| 6980 |
} |
| 6981 |
|
| 6982 |
function get_visiter( $period ) { |
| 6983 |
global $wpdb; |
| 6984 |
$datestr = substr(get_date_from_gmt(gmdate('Y-m-d H:i:s', time())), 0, 10); |
| 6985 |
$yearstr = substr($datestr, 0, 4); |
| 6986 |
$monthstr = substr($datestr, 5, 2); |
| 6987 |
$daystr = substr($datestr, 8, 2); |
| 6988 |
if($period == 'today') { |
| 6989 |
$date = $datestr; |
| 6990 |
$today = $datestr; |
| 6991 |
}else if($period == 'thismonth') { |
| 6992 |
$date = date('Y-m-01'); |
| 6993 |
$today = $datestr; |
| 6994 |
}else if($period == 'lastyear') { |
| 6995 |
$date = date('Y-m-01', mktime(0, 0, 0, (int)$monthstr, 1, (int)$yearstr-1)); |
| 6996 |
$today = date('Y-m-01', mktime(0, 0, 0, (int)$monthstr, (int)$daystr, (int)$yearstr-1)); |
| 6997 |
} |
| 6998 |
$table_name = $wpdb->prefix . 'usces_access'; |
| 6999 |
|
| 7000 |
$query = $wpdb->prepare("SELECT SUM(acc_num1) AS ct1, SUM(acc_num2) AS ct2 FROM $table_name WHERE acc_date >= %s AND acc_date <= %s", $date, $today); |
| 7001 |
$res = $wpdb->get_row($query, ARRAY_A); |
| 7002 |
|
| 7003 |
if( $res == NULL ) |
| 7004 |
return 0; |
| 7005 |
else |
| 7006 |
return $res['ct1']+$res['ct2']; |
| 7007 |
} |
| 7008 |
|
| 7009 |
function get_fvisiter( $period ) { |
| 7010 |
global $wpdb; |
| 7011 |
$datestr = substr(get_date_from_gmt(gmdate('Y-m-d H:i:s', time())), 0, 10); |
| 7012 |
$yearstr = substr($datestr, 0, 4); |
| 7013 |
$monthstr = substr($datestr, 5, 2); |
| 7014 |
$daystr = substr($datestr, 8, 2); |
| 7015 |
if($period == 'today') { |
| 7016 |
$date = $datestr; |
| 7017 |
$today = $datestr; |
| 7018 |
}else if($period == 'thismonth') { |
| 7019 |
$date = date('Y-m-01'); |
| 7020 |
$today = $datestr; |
| 7021 |
}else if($period == 'lastyear') { |
| 7022 |
$date = date('Y-m-01', mktime(0, 0, 0, (int)$monthstr, 1, (int)$yearstr-1)); |
| 7023 |
$today = date('Y-m-01', mktime(0, 0, 0, (int)$monthstr, (int)$daystr, (int)$yearstr-1)); |
| 7024 |
} |
| 7025 |
$table_name = $wpdb->prefix . 'usces_access'; |
| 7026 |
|
| 7027 |
$query = $wpdb->prepare("SELECT SUM(acc_num2) AS ct FROM $table_name WHERE acc_date >= %s AND acc_date <= %s", $date, $today); |
| 7028 |
$res = $wpdb->get_var($query); |
| 7029 |
|
| 7030 |
if( $res == NULL ) |
| 7031 |
return 0; |
| 7032 |
else |
| 7033 |
return $res; |
| 7034 |
} |
| 7035 |
|
| 7036 |
function get_order_num( $period ) { |
| 7037 |
global $wpdb; |
| 7038 |
$datestr = substr(get_date_from_gmt(gmdate('Y-m-d H:i:s', time())), 0, 10); |
| 7039 |
$yearstr = substr($datestr, 0, 4); |
| 7040 |
$monthstr = substr($datestr, 5, 2); |
| 7041 |
$daystr = substr($datestr, 8, 2); |
| 7042 |
if($period == 'today') { |
| 7043 |
$date = date('Y-m-d 00:00:00', current_time('timestamp')); |
| 7044 |
$today = date('Y-m-d 23:59:59', current_time('timestamp')); |
| 7045 |
}else if($period == 'thismonth') { |
| 7046 |
$date = date('Y-m-01 00:00:00', current_time('timestamp')); |
| 7047 |
$today = date('Y-m-d 23:59:59', current_time('timestamp')); |
| 7048 |
}else if($period == 'lastyear') { |
| 7049 |
$date = date('Y-m-01 00:00:00', mktime(0, 0, 0, (int)$monthstr, 1, (int)$yearstr-1)); |
| 7050 |
$today = date('Y-m-d 23:59:59', mktime(0, 0, 0, (int)$monthstr+1, 0, (int)$yearstr-1)); |
| 7051 |
} |
| 7052 |
$table_name = $wpdb->prefix . 'usces_order'; |
| 7053 |
|
| 7054 |
$query = $wpdb->prepare("SELECT COUNT(ID) AS ct FROM $table_name WHERE order_date >= %s AND order_date <= %s AND 0 = LOCATE(%s, order_status) AND 0 = LOCATE(%s, order_status)", $date, $today, 'cancel', 'estimate'); |
| 7055 |
$res = $wpdb->get_var($query); |
| 7056 |
|
| 7057 |
if( $res == NULL ) |
| 7058 |
return 0; |
| 7059 |
else |
| 7060 |
return $res; |
| 7061 |
} |
| 7062 |
|
| 7063 |
function get_order_amount( $period ) { |
| 7064 |
global $wpdb; |
| 7065 |
$datestr = substr(get_date_from_gmt(gmdate('Y-m-d H:i:s', time())), 0, 10); |
| 7066 |
$yearstr = substr($datestr, 0, 4); |
| 7067 |
$monthstr = substr($datestr, 5, 2); |
| 7068 |
$daystr = substr($datestr, 8, 2); |
| 7069 |
if($period == 'today') { |
| 7070 |
$date = date('Y-m-d 00:00:00', current_time('timestamp')); |
| 7071 |
$today = date('Y-m-d 23:59:59', current_time('timestamp')); |
| 7072 |
}else if($period == 'thismonth') { |
| 7073 |
$date = date('Y-m-01 00:00:00', current_time('timestamp')); |
| 7074 |
$today = date('Y-m-d 23:59:59', current_time('timestamp')); |
| 7075 |
}else if($period == 'lastyear') { |
| 7076 |
$date = date('Y-m-01 00:00:00', mktime(0, 0, 0, (int)$monthstr, 1, (int)$yearstr-1)); |
| 7077 |
$today = date('Y-m-d 23:59:59', mktime(0, 0, 0, (int)$monthstr+1, 0, (int)$yearstr-1)); |
| 7078 |
} |
| 7079 |
$table_name = $wpdb->prefix . 'usces_order'; |
| 7080 |
|
| 7081 |
$query = $wpdb->prepare("SELECT |
| 7082 |
SUM(order_item_total_price) AS price, |
| 7083 |
SUM(order_usedpoint) AS point, |
| 7084 |
SUM(order_discount) AS discount, |
| 7085 |
SUM(order_shipping_charge) AS shipping, |
| 7086 |
SUM(order_cod_fee) AS cod, |
| 7087 |
SUM(order_tax) AS tax |
| 7088 |
FROM $table_name WHERE order_date >= %s AND order_date <= %s AND 0 = LOCATE(%s, order_status) AND 0 = LOCATE(%s, order_status)", $date, $today, 'cancel', 'estimate'); |
| 7089 |
$res = $wpdb->get_row($query, ARRAY_A); |
| 7090 |
|
| 7091 |
if( $res == NULL ) |
| 7092 |
return 0; |
| 7093 |
else |
| 7094 |
return $res['price'] - $res['point'] + $res['discount'] + $res['shipping'] + $res['cod'] + $res['tax']; |
| 7095 |
} |
| 7096 |
|
| 7097 |
function is_status($need, $str){ |
| 7098 |
$array = explode(',', $str); |
| 7099 |
return in_array($need, $array); |
| 7100 |
} |
| 7101 |
|
| 7102 |
function make_status( $taio='', $receipt='', $admin='' ){ |
| 7103 |
$str = ''; |
| 7104 |
if($taio != '' && $taio != '#none#') |
| 7105 |
$str .= $taio . ','; |
| 7106 |
if($receipt != '' && $receipt != '#none#') |
| 7107 |
$str .= $receipt . ','; |
| 7108 |
if($admin != '' && $admin != '#none#') |
| 7109 |
$str .= $admin . ','; |
| 7110 |
return $str; |
| 7111 |
} |
| 7112 |
|
| 7113 |
function get_memberid_by_email($email){ |
| 7114 |
global $wpdb; |
| 7115 |
$table_name = $wpdb->prefix . "usces_member"; |
| 7116 |
$query = $wpdb->prepare("SELECT ID FROM $table_name WHERE mem_email = %s", $email); |
| 7117 |
$res = $wpdb->get_var($query); |
| 7118 |
return $res; |
| 7119 |
} |
| 7120 |
|
| 7121 |
function get_condition(){ |
| 7122 |
//20120807ysk start 0000544 |
| 7123 |
$order_conditions = array( |
| 7124 |
'display_mode' => $this->options['display_mode'], |
| 7125 |
'campaign_privilege' => $this->options['campaign_privilege'], |
| 7126 |
'campaign_category' => $this->options['campaign_category'], |
| 7127 |
'privilege_point' => $this->options['privilege_point'], |
| 7128 |
'privilege_discount' => $this->options['privilege_discount']); |
| 7129 |
return $order_conditions; |
| 7130 |
//20120807ysk end |
| 7131 |
} |
| 7132 |
|
| 7133 |
function get_bestseller_ids( $days = "" ){ |
| 7134 |
global $wpdb; |
| 7135 |
$datestr = substr(get_date_from_gmt(gmdate('Y-m-d H:i:s', time())), 0, 10); |
| 7136 |
$yearstr = substr($datestr, 0, 4); |
| 7137 |
$monthstr = substr($datestr, 5, 2); |
| 7138 |
$daystr = substr($datestr, 8, 2); |
| 7139 |
$res = array(); |
| 7140 |
$order_table_name = $wpdb->prefix . "usces_order"; |
| 7141 |
$where = ""; |
| 7142 |
if( empty($days) ){ |
| 7143 |
$days = 30; |
| 7144 |
} |
| 7145 |
$order_date = date('Y-m-d H:i:s', mktime(0, 0, 0, (int)$monthstr, ((int)$daystr-$days), (int)$yearstr)); |
| 7146 |
$where = " WHERE order_date >= '{$order_date}'"; |
| 7147 |
$query = "SELECT order_cart FROM {$order_table_name}" . $where; |
| 7148 |
$dbres = $wpdb->get_col($query); |
| 7149 |
if(!$dbres) return false; |
| 7150 |
|
| 7151 |
foreach((array)$dbres as $carts){ |
| 7152 |
$rows = unserialize($carts); |
| 7153 |
foreach((array)$rows as $carts){ |
| 7154 |
if( 'publish' != get_post_status($carts['post_id']) ) |
| 7155 |
continue; |
| 7156 |
|
| 7157 |
$id = $carts['post_id']; |
| 7158 |
$qu = $carts['quantity']; |
| 7159 |
if(array_key_exists($id, $res)){ |
| 7160 |
$res[$id] = $res[$id] + $qu; |
| 7161 |
}else{ |
| 7162 |
$res[$id] = $qu; |
| 7163 |
} |
| 7164 |
} |
| 7165 |
} |
| 7166 |
arsort($res); |
| 7167 |
$results = array_keys($res); |
| 7168 |
return $results; |
| 7169 |
} |
| 7170 |
|
| 7171 |
function get_items_num(){ |
| 7172 |
global $wpdb; |
| 7173 |
$query = $wpdb->prepare("SELECT COUNT(ID) AS ct FROM {$wpdb->posts} |
| 7174 |
WHERE post_mime_type = %s AND post_type = %s AND post_status <> %s", |
| 7175 |
'item', 'post', 'trush'); |
| 7176 |
$res = $wpdb->get_var($query); |
| 7177 |
|
| 7178 |
return $res; |
| 7179 |
} |
| 7180 |
|
| 7181 |
function is_gptekiyo( $post_id, $sku, $quant ) { |
| 7182 |
$skus = $this->get_skus( $post_id, 'code' ); |
| 7183 |
if( !isset($skus[$sku]['gp']) || !$skus[$sku]['gp'] ) return false; |
| 7184 |
|
| 7185 |
$GpN1 = $this->getItemGpNum1($post_id); |
| 7186 |
$GpN2 = $this->getItemGpNum2($post_id); |
| 7187 |
$GpN3 = $this->getItemGpNum3($post_id); |
| 7188 |
|
| 7189 |
if( empty($GpN1) ) { |
| 7190 |
|
| 7191 |
return false; |
| 7192 |
|
| 7193 |
}else if( !empty($GpN1) && empty($GpN2) ) { |
| 7194 |
|
| 7195 |
if( $quant >= $GpN1 ) { |
| 7196 |
return true; |
| 7197 |
}else{ |
| 7198 |
return false; |
| 7199 |
} |
| 7200 |
|
| 7201 |
}else if( !empty($GpN1) && !empty($GpN2) && empty($GpN3) ) { |
| 7202 |
|
| 7203 |
if( $quant >= $GpN2 ) { |
| 7204 |
return true; |
| 7205 |
}else if( $quant >= $GpN1 && $quant < $GpN2 ) { |
| 7206 |
return true; |
| 7207 |
}else{ |
| 7208 |
return false; |
| 7209 |
} |
| 7210 |
|
| 7211 |
}else if( !empty($GpN1) && !empty($GpN2) && !empty($GpN3) ) { |
| 7212 |
|
| 7213 |
if( $quant >= $GpN3 ) { |
| 7214 |
return true; |
| 7215 |
}else if( $quant >= $GpN2 && $quant < $GpN3 ) { |
| 7216 |
return true; |
| 7217 |
}else if( $quant >= $GpN1 && $quant < $GpN2 ) { |
| 7218 |
return true; |
| 7219 |
}else{ |
| 7220 |
return false; |
| 7221 |
} |
| 7222 |
} |
| 7223 |
} |
| 7224 |
|
| 7225 |
function get_available_delivery_method() { |
| 7226 |
if($this->cart->num_row() > 0) { |
| 7227 |
$cart = $this->cart->get_cart(); |
| 7228 |
$before_deli = array(); |
| 7229 |
$intersect = array(); |
| 7230 |
$integration = array(); |
| 7231 |
$temp = array(); |
| 7232 |
$in = 0; |
| 7233 |
foreach($cart as $key => $row){ |
| 7234 |
$deli = $this->getItemDeliveryMethod($row['post_id']); |
| 7235 |
//usces_p($deli); |
| 7236 |
if( empty($deli)) |
| 7237 |
continue; |
| 7238 |
|
| 7239 |
//usces_log('deli : '.print_r($deli, true), 'acting_transaction.log'); |
| 7240 |
if( 0 === $in ){ |
| 7241 |
$intersect = $deli; |
| 7242 |
} |
| 7243 |
$intersect = array_intersect($deli, $intersect); |
| 7244 |
$before_deli = $deli; |
| 7245 |
foreach($deli as $value){ |
| 7246 |
$integration[] = $value; |
| 7247 |
} |
| 7248 |
$in++; |
| 7249 |
} |
| 7250 |
$integration = array_unique($integration); |
| 7251 |
foreach($integration as $id){ |
| 7252 |
$index = $this->get_delivery_method_index($id); |
| 7253 |
$temp[$index] = $id; |
| 7254 |
} |
| 7255 |
ksort($temp); |
| 7256 |
//20120820ysk start 0000546 |
| 7257 |
//$force = array($temp[0]); |
| 7258 |
$force = array(array_shift($temp)); |
| 7259 |
//20120820ysk end |
| 7260 |
|
| 7261 |
if( empty($intersect) ){ |
| 7262 |
return $force; |
| 7263 |
}else{ |
| 7264 |
return $intersect; |
| 7265 |
} |
| 7266 |
} |
| 7267 |
return array(); |
| 7268 |
} |
| 7269 |
|
| 7270 |
function get_delivery_method_index($id) { |
| 7271 |
$index = false; |
| 7272 |
for($i=0; $i<count($this->options['delivery_method']); $i++){ |
| 7273 |
if( $this->options['delivery_method'][$i]['id'] === (int)$id ){ |
| 7274 |
$index = $i; |
| 7275 |
} |
| 7276 |
} |
| 7277 |
if($index === false) |
| 7278 |
return -1; |
| 7279 |
else |
| 7280 |
return $index; |
| 7281 |
} |
| 7282 |
|
| 7283 |
function get_shipping_charge_index($id) { |
| 7284 |
$index = false; |
| 7285 |
for($i=0; $i<count($this->options['shipping_charge']); $i++){ |
| 7286 |
//20120710ysk start 0000472 |
| 7287 |
//if( $this->options['shipping_charge'][$i]['id'] === $id ){ |
| 7288 |
if( (int)$this->options['shipping_charge'][$i]['id'] == (int)$id ){ |
| 7289 |
//20120710ysk end |
| 7290 |
$index = $i; |
| 7291 |
} |
| 7292 |
} |
| 7293 |
if($index === false) |
| 7294 |
return -1; |
| 7295 |
else |
| 7296 |
return $index; |
| 7297 |
} |
| 7298 |
|
| 7299 |
function get_initial_data($xml){ |
| 7300 |
$buf = file_get_contents($xml); |
| 7301 |
preg_match_all('@<page>.*?<post_title>(.*?)</post_title>.*?<post_status>(.*?)</post_status>.*?<post_name>(.*?)</post_name>.*?<post_content>(.*?)</post_content>.*?</page>@s', $buf, $match, PREG_SET_ORDER); |
| 7302 |
return $match; |
| 7303 |
} |
| 7304 |
|
| 7305 |
function getCurrencySymbol(){ |
| 7306 |
global $usces_settings; |
| 7307 |
$cr = $this->options['system']['currency']; |
| 7308 |
list($code, $decimal, $point, $seperator, $symbol) = $usces_settings['currency'][$cr]; |
| 7309 |
return $symbol; |
| 7310 |
} |
| 7311 |
|
| 7312 |
function getCartItemName($post_id, $sku){ |
| 7313 |
$name_arr = array(); |
| 7314 |
$name_str = ''; |
| 7315 |
|
| 7316 |
foreach($this->options['indi_item_name'] as $key => $value){ |
| 7317 |
if($value){ |
| 7318 |
$pos = (int)$this->options['pos_item_name'][$key]; |
| 7319 |
$ind = ($pos === 0) ? 'A' : $pos; |
| 7320 |
switch($key){ |
| 7321 |
case 'item_name': |
| 7322 |
$name_arr[$ind][$key] = $this->getItemName($post_id); |
| 7323 |
break; |
| 7324 |
case 'item_code': |
| 7325 |
$name_arr[$ind][$key] = $this->getItemCode($post_id); |
| 7326 |
break; |
| 7327 |
case 'sku_name': |
| 7328 |
$name_arr[$ind][$key] = $this->getItemSkuDisp($post_id, $sku); |
| 7329 |
break; |
| 7330 |
case 'sku_code': |
| 7331 |
$name_arr[$ind][$key] = $sku; |
| 7332 |
break; |
| 7333 |
} |
| 7334 |
} |
| 7335 |
|
| 7336 |
} |
| 7337 |
ksort($name_arr); |
| 7338 |
foreach($name_arr as $vals){ |
| 7339 |
foreach($vals as $key => $value){ |
| 7340 |
|
| 7341 |
$name_str .= $value . ' '; |
| 7342 |
} |
| 7343 |
} |
| 7344 |
|
| 7345 |
$name_str = apply_filters('usces_admin_order_item_name_filter', $name_str, $post_id, $sku); |
| 7346 |
|
| 7347 |
return trim($name_str); |
| 7348 |
} |
| 7349 |
|
| 7350 |
function set_reserve_pre_order_id(){ |
| 7351 |
$entry = $this->cart->get_entry(); |
| 7352 |
$id = ( isset($entry['reserve']['pre_order_id']) && !empty($entry['reserve']['pre_order_id']) ) ? $entry['reserve']['pre_order_id'] : uniqid(''); |
| 7353 |
$this->cart->set_pre_order_id($id); |
| 7354 |
} |
| 7355 |
|
| 7356 |
function get_current_pre_order_id(){ |
| 7357 |
$entry = $this->cart->get_entry(); |
| 7358 |
$id = ( isset($entry['reserve']['pre_order_id']) && !empty($entry['reserve']['pre_order_id']) ) ? $entry['reserve']['pre_order_id'] : NULL; |
| 7359 |
return $id; |
| 7360 |
} |
| 7361 |
|
| 7362 |
function get_reserve($order_id, $key){ |
| 7363 |
global $wpdb; |
| 7364 |
$order_meta_table_name = $wpdb->prefix . "usces_order_meta"; |
| 7365 |
$query = $wpdb->prepare("SELECT meta_value FROM $order_meta_table_name WHERE order_id = %d AND meta_key = %s", |
| 7366 |
$order_id, $key); |
| 7367 |
$res = $wpdb->get_var($query); |
| 7368 |
return $res; |
| 7369 |
} |
| 7370 |
|
| 7371 |
//20100818ysk start |
| 7372 |
//20100816ysk start |
| 7373 |
//function get_order_meta($order_id, $key) { |
| 7374 |
function get_order_meta_value($key, $order_id) { |
| 7375 |
global $wpdb; |
| 7376 |
$order_meta_table_name = $wpdb->prefix . "usces_order_meta"; |
| 7377 |
$query = $wpdb->prepare("SELECT meta_value FROM $order_meta_table_name WHERE order_id = %d AND meta_key = %s", |
| 7378 |
$order_id, $key); |
| 7379 |
$res = $wpdb->get_var($query); |
| 7380 |
return $res; |
| 7381 |
} |
| 7382 |
//20100816ysk end |
| 7383 |
function set_order_meta_value($key, $meta_value, $order_id) { |
| 7384 |
global $wpdb; |
| 7385 |
|
| 7386 |
//if( empty($meta_value) ) return; |
| 7387 |
if( empty($order_id) ) return; |
| 7388 |
|
| 7389 |
$table_name = $wpdb->prefix . "usces_order_meta"; |
| 7390 |
$query = $wpdb->prepare("SELECT count(*) FROM $table_name WHERE order_id = %d AND meta_key = %s", |
| 7391 |
$order_id, $key); |
| 7392 |
$res = $wpdb->get_var($query); |
| 7393 |
if(0 < $res) { |
| 7394 |
$query = $wpdb->prepare("UPDATE $table_name SET meta_value = %s WHERE order_id = %d AND meta_key = %s", |
| 7395 |
$meta_value, |
| 7396 |
$order_id, |
| 7397 |
$key |
| 7398 |
); |
| 7399 |
$res2 = $wpdb->query($query); |
| 7400 |
} else { |
| 7401 |
$query = $wpdb->prepare("INSERT INTO $table_name (order_id, meta_key, meta_value) |
| 7402 |
VALUES(%d, %s, %s)", |
| 7403 |
$order_id, |
| 7404 |
$key, |
| 7405 |
$meta_value |
| 7406 |
); |
| 7407 |
$res2 = $wpdb->query($query); |
| 7408 |
} |
| 7409 |
return $res2; |
| 7410 |
} |
| 7411 |
//20130524ysk start |
| 7412 |
function del_order_meta( $key, $order_id ) { |
| 7413 |
global $wpdb; |
| 7414 |
$table_name = $wpdb->prefix."usces_order_meta"; |
| 7415 |
$query = $wpdb->prepare( "DELETE FROM $table_name WHERE order_id = %d AND meta_key = %s", $order_id, $key ); |
| 7416 |
$res = $wpdb->query( $query ); |
| 7417 |
return $res; |
| 7418 |
} |
| 7419 |
//20130524ysk end |
| 7420 |
function set_session_custom_member($member_id) { |
| 7421 |
unset($_SESSION['usces_member']['custom_member']); |
| 7422 |
$meta = usces_has_custom_field_meta('member'); |
| 7423 |
if(is_array($meta)) { |
| 7424 |
$keys = array_keys($meta); |
| 7425 |
foreach($keys as $key) { |
| 7426 |
$csmb_key = 'csmb_'.$key; |
| 7427 |
$_SESSION['usces_member']['custom_member'][$key] = maybe_unserialize($this->get_member_meta_value($csmb_key, $member_id)); |
| 7428 |
} |
| 7429 |
} |
| 7430 |
} |
| 7431 |
|
| 7432 |
function reg_custom_member($member_id) { |
| 7433 |
//20130524ysk start 0000712 |
| 7434 |
$csmb_meta = usces_has_custom_field_meta( 'member' ); |
| 7435 |
if( is_array($csmb_meta) ) { |
| 7436 |
foreach( $csmb_meta as $key => $entry ) { |
| 7437 |
if( '4' == $entry['means'] ) { |
| 7438 |
$this->del_member_meta( 'csmb_'.$key, $member_id ); |
| 7439 |
} |
| 7440 |
} |
| 7441 |
} |
| 7442 |
//20130524ysk end |
| 7443 |
if( !empty($_POST['custom_member']) ) { |
| 7444 |
foreach( $_POST['custom_member'] as $key => $value ) { |
| 7445 |
$csmb_key = 'csmb_'.$key; |
| 7446 |
if( is_array($value) ) |
| 7447 |
$value = serialize($value); |
| 7448 |
$res = $this->set_member_meta_value($csmb_key, $value, $member_id); |
| 7449 |
if(false === $res) |
| 7450 |
return false; |
| 7451 |
} |
| 7452 |
}elseif( isset($_POST['custom_customer']) ){ |
| 7453 |
foreach( $_POST['custom_customer'] as $key => $value ) { |
| 7454 |
$csmb_key = 'csmb_'.$key; |
| 7455 |
if( is_array($value) ) |
| 7456 |
$value = serialize($value); |
| 7457 |
$res = $this->set_member_meta_value($csmb_key, $value, $member_id); |
| 7458 |
if(false === $res) |
| 7459 |
return false; |
| 7460 |
} |
| 7461 |
} |
| 7462 |
} |
| 7463 |
//20100818ysk end |
| 7464 |
|
| 7465 |
function save_order_acting_data($rand){ |
| 7466 |
global $wpdb; |
| 7467 |
$data = serialize(array( 'cart' => $this->cart->get_cart(), 'entry' => $this->cart->get_entry() )); |
| 7468 |
$table_name = $wpdb->prefix . "usces_access"; |
| 7469 |
$query = $wpdb->prepare("INSERT INTO $table_name (acc_type, acc_str1, acc_date, acc_key, acc_value) |
| 7470 |
VALUES(%s, %s, now(), %s, %s)", |
| 7471 |
'acting_data', |
| 7472 |
$this->get_uscesid(false), |
| 7473 |
$rand, |
| 7474 |
$data |
| 7475 |
); |
| 7476 |
$res = $wpdb->query($query); |
| 7477 |
return $res; |
| 7478 |
} |
| 7479 |
|
| 7480 |
//20100818ysk start |
| 7481 |
function set_member_meta_value($key, $meta_value, $member_id = ''){ |
| 7482 |
global $wpdb; |
| 7483 |
|
| 7484 |
//if( empty($meta_value) ) return; |
| 7485 |
if( WCUtils::is_blank($member_id) ) { |
| 7486 |
if( !$this->is_member_logged_in() ) return; |
| 7487 |
$member = $this->get_member(); |
| 7488 |
$member_id = $member['ID']; |
| 7489 |
} |
| 7490 |
|
| 7491 |
$table_name = $wpdb->prefix . "usces_member_meta"; |
| 7492 |
//$query = $wpdb->prepare("SELECT meta_value FROM $table_name WHERE member_id = %d AND meta_key = %s", |
| 7493 |
$query = $wpdb->prepare("SELECT count(*) FROM $table_name WHERE member_id = %d AND meta_key = %s", |
| 7494 |
$member_id, $key); |
| 7495 |
$res = $wpdb->get_var($query); |
| 7496 |
//if($res != NULL){ |
| 7497 |
if(0 < $res){ |
| 7498 |
$query = $wpdb->prepare("UPDATE $table_name SET meta_value = %s WHERE member_id = %d AND meta_key = %s", |
| 7499 |
$meta_value, |
| 7500 |
$member_id, |
| 7501 |
$key |
| 7502 |
); |
| 7503 |
$res2 = $wpdb->query($query); |
| 7504 |
}else{ |
| 7505 |
$query = $wpdb->prepare("INSERT INTO $table_name (member_id, meta_key, meta_value) |
| 7506 |
VALUES(%d, %s, %s)", |
| 7507 |
$member_id, |
| 7508 |
$key, |
| 7509 |
$meta_value |
| 7510 |
); |
| 7511 |
$res2 = $wpdb->query($query); |
| 7512 |
} |
| 7513 |
return $res2; |
| 7514 |
} |
| 7515 |
//20100818ysk end |
| 7516 |
|
| 7517 |
function get_member_meta_value($key, $member_id){ |
| 7518 |
global $wpdb; |
| 7519 |
$table_name = $wpdb->prefix . "usces_member_meta"; |
| 7520 |
$query = $wpdb->prepare("SELECT meta_value FROM $table_name WHERE member_id = %d AND meta_key = %s", |
| 7521 |
$member_id, $key); |
| 7522 |
$res = $wpdb->get_var($query); |
| 7523 |
return $res; |
| 7524 |
} |
| 7525 |
|
| 7526 |
function del_member_meta($key, $member_id){ |
| 7527 |
global $wpdb; |
| 7528 |
$table_name = $wpdb->prefix . "usces_member_meta"; |
| 7529 |
$query = $wpdb->prepare("DELETE FROM $table_name WHERE member_id = %d AND meta_key = %s", |
| 7530 |
$member_id, $key); |
| 7531 |
$res = $wpdb->query($query); |
| 7532 |
return $res; |
| 7533 |
} |
| 7534 |
|
| 7535 |
function get_member_meta($member_id){ |
| 7536 |
global $wpdb; |
| 7537 |
$table_name = $wpdb->prefix . "usces_member_meta"; |
| 7538 |
$query = $wpdb->prepare("SELECT * FROM $table_name WHERE member_id = %d AND meta_key <> 'customer_country' AND meta_key NOT LIKE %s", $member_id, 'csmb_%'); |
| 7539 |
$res = $wpdb->get_results($query, ARRAY_A); |
| 7540 |
return $res; |
| 7541 |
} |
| 7542 |
|
| 7543 |
function get_settle_info_field( $order_id ){ |
| 7544 |
global $wpdb; |
| 7545 |
$fields = array(); |
| 7546 |
$table_name = $wpdb->prefix . "usces_order_meta"; |
| 7547 |
$query = $wpdb->prepare("SELECT meta_key, meta_value FROM $table_name WHERE order_id = %d AND (meta_key LIKE %s OR meta_key = %s OR meta_key = %s OR meta_key = %s OR meta_key = %s OR meta_key = %s)", |
| 7548 |
$order_id, 'acting_%', 'settlement_id', 'order_number', 'res_tracking_id', 'SID', 'TransactionId'); |
| 7549 |
$res = $wpdb->get_results($query, ARRAY_A); |
| 7550 |
if( !$res ) |
| 7551 |
return $fields; |
| 7552 |
|
| 7553 |
foreach( $res as $value ){ |
| 7554 |
if( 'settlement_id' == $value['meta_key'] ){ |
| 7555 |
$meta_values = maybe_unserialize($value['meta_value']); |
| 7556 |
if( is_array($meta_values) ){ |
| 7557 |
foreach( $meta_values as $key => $meta_value ){ |
| 7558 |
$fields[$key] = $meta_value; |
| 7559 |
} |
| 7560 |
}else{ |
| 7561 |
$fields['settlement_id'] = $meta_values; |
| 7562 |
} |
| 7563 |
}elseif( 'order_number' == $value['meta_key'] ){ |
| 7564 |
$fields['order_number'] = $value['meta_value']; |
| 7565 |
}elseif( 'res_tracking_id' == $value['meta_key'] ){ |
| 7566 |
$fields['res_tracking_id'] = $value['meta_value']; |
| 7567 |
}elseif( 'SID' == $value['meta_key'] ){ |
| 7568 |
$fields['SID'] = $value['meta_value']; |
| 7569 |
}elseif( 'TransactionId' == $value['meta_key'] ){ |
| 7570 |
$fields['TransactionId'] = $value['meta_value']; |
| 7571 |
}elseif( 'acting_' == substr($value['meta_key'], 0, 7) ){ |
| 7572 |
$meta_values = unserialize($value['meta_value']); |
| 7573 |
if(is_array($meta_values)){ |
| 7574 |
foreach( $meta_values as $key => $meta_value ){ |
| 7575 |
$fields[$key] = $meta_value; |
| 7576 |
} |
| 7577 |
} |
| 7578 |
} |
| 7579 |
} |
| 7580 |
return $fields; |
| 7581 |
} |
| 7582 |
|
| 7583 |
function get_post_custom($post_id, $orderby='meta_id', $order='ASC'){ |
| 7584 |
global $wpdb; |
| 7585 |
$table = $wpdb->prefix . "postmeta"; |
| 7586 |
$meta_list = $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value FROM $table WHERE post_id = %d ORDER BY $orderby $order", |
| 7587 |
$post_id), ARRAY_A ); |
| 7588 |
|
| 7589 |
if ( !empty($meta_list) ) { |
| 7590 |
foreach ( $meta_list as $metarow) { |
| 7591 |
$mkey = $metarow['meta_key']; |
| 7592 |
$mval = $metarow['meta_value']; |
| 7593 |
$res[$mkey][] = $mval; |
| 7594 |
} |
| 7595 |
} |
| 7596 |
return $res; |
| 7597 |
} |
| 7598 |
|
| 7599 |
function get_post_user_custom($post_id, $orderby='meta_id', $order='ASC'){ |
| 7600 |
global $wpdb; |
| 7601 |
$res = array(); |
| 7602 |
$table = $wpdb->prefix . "postmeta"; |
| 7603 |
$meta_list = $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value FROM $table WHERE post_id = %d ORDER BY $orderby $order", |
| 7604 |
$post_id), ARRAY_A ); |
| 7605 |
|
| 7606 |
if ( !empty($meta_list) ) { |
| 7607 |
foreach ( $meta_list as $metarow) { |
| 7608 |
if( 0 === strpos($metarow['meta_key'], '_') ) |
| 7609 |
continue; |
| 7610 |
|
| 7611 |
$mkey = $metarow['meta_key']; |
| 7612 |
$mval = $metarow['meta_value']; |
| 7613 |
if( array_key_exists($mkey, $res) ){ |
| 7614 |
$cval = $res[$mkey]; |
| 7615 |
$cval = (array)$cval; |
| 7616 |
$cval[] = $mval; |
| 7617 |
$res[$mkey] = $cval; |
| 7618 |
}else{ |
| 7619 |
$res[$mkey] = $mval; |
| 7620 |
} |
| 7621 |
} |
| 7622 |
} |
| 7623 |
return $res; |
| 7624 |
} |
| 7625 |
|
| 7626 |
function get_currency($amount, $symbol_pre = false, $symbol_post = false, $seperator_flag = true ){ |
| 7627 |
global $usces_settings; |
| 7628 |
$cr = $this->options['system']['currency']; |
| 7629 |
list($code, $decimal, $point, $seperator, $symbol) = $usces_settings['currency'][$cr]; |
| 7630 |
if( !$seperator_flag ){ |
| 7631 |
$seperator = ''; |
| 7632 |
} |
| 7633 |
$price = number_format((double)$amount, $decimal, $point, $seperator);//0000652 |
| 7634 |
|
| 7635 |
if( $symbol_pre ) |
| 7636 |
$price = ( usces_is_entity($symbol) ? mb_convert_encoding($symbol, 'UTF-8', 'HTML-ENTITIES') : $symbol ) . $price; |
| 7637 |
|
| 7638 |
if( $symbol_post ) |
| 7639 |
$price = $price . __($code, 'usces'); |
| 7640 |
|
| 7641 |
return $price; |
| 7642 |
} |
| 7643 |
|
| 7644 |
function get_currency_code(){ |
| 7645 |
global $usces_settings; |
| 7646 |
$cr = $this->options['system']['currency']; |
| 7647 |
list($code, $decimal, $point, $seperator, $symbol) = $usces_settings['currency'][$cr]; |
| 7648 |
return $code; |
| 7649 |
} |
| 7650 |
|
| 7651 |
//shortcode----------------------------------------------------------------------------- |
| 7652 |
function sc_company_name() { |
| 7653 |
return htmlspecialchars($this->options['company_name']); |
| 7654 |
} |
| 7655 |
function sc_zip_code() { |
| 7656 |
return htmlspecialchars($this->options['zip_code']); |
| 7657 |
} |
| 7658 |
function sc_address1() { |
| 7659 |
return htmlspecialchars($this->options['address1']); |
| 7660 |
} |
| 7661 |
function sc_address2() { |
| 7662 |
return htmlspecialchars($this->options['address2']); |
| 7663 |
} |
| 7664 |
function sc_tel_number() { |
| 7665 |
return htmlspecialchars($this->options['tel_number']); |
| 7666 |
} |
| 7667 |
function sc_fax_number() { |
| 7668 |
return htmlspecialchars($this->options['fax_number']); |
| 7669 |
} |
| 7670 |
function sc_inquiry_mail() { |
| 7671 |
return htmlspecialchars($this->options['inquiry_mail']); |
| 7672 |
} |
| 7673 |
function sc_payment() { |
| 7674 |
$payments = usces_get_system_option( 'usces_payment_method', 'sort' ); |
| 7675 |
$htm = "<ul>\n"; |
| 7676 |
foreach ( (array)$payments as $payment ) { |
| 7677 |
$htm .= "<li>" . htmlspecialchars($payment['name']) . "<br />\n"; |
| 7678 |
$htm .= nl2br(htmlspecialchars($payment['explanation'])) . "</li>\n"; |
| 7679 |
} |
| 7680 |
$htm .= "</ul>\n"; |
| 7681 |
return $htm; |
| 7682 |
} |
| 7683 |
function sc_payment_title() { |
| 7684 |
$payments = $this->options['payment_method']; |
| 7685 |
$htm = "<ul>\n"; |
| 7686 |
foreach ( (array)$payments as $payment ) { |
| 7687 |
$htm .= "<li>" . esc_html($payment['name']) . "</li>\n"; |
| 7688 |
} |
| 7689 |
$htm .= "</ul>\n"; |
| 7690 |
return $htm; |
| 7691 |
} |
| 7692 |
function sc_cod_fee() { |
| 7693 |
return number_format($this->options['cod_fee']); |
| 7694 |
} |
| 7695 |
function sc_start_point() { |
| 7696 |
return number_format($this->options['start_point']); |
| 7697 |
} |
| 7698 |
function sc_postage_privilege() { |
| 7699 |
if(empty($this->options['postage_privilege'])) |
| 7700 |
return; |
| 7701 |
return number_format($this->options['postage_privilege']); |
| 7702 |
} |
| 7703 |
function sc_shipping_charge() { |
| 7704 |
//20120710ysk start 0000472 |
| 7705 |
$entry = $this->cart->get_entry(); |
| 7706 |
$country = (isset($entry['delivery']['country']) && !empty($entry['delivery']['country'])) ? $entry['delivery']['country'] : $entry['customer']['country'];//20120710ysk 0000472 |
| 7707 |
//20120710ysk end |
| 7708 |
$arr = array(); |
| 7709 |
foreach ( (array)$this->options['shipping_charge'] as $charges ) { |
| 7710 |
//20120710ysk start 0000472 |
| 7711 |
//foreach ( (array)$charges['value'] as $value ) { |
| 7712 |
foreach ( (array)$charges[$country] as $value ) { |
| 7713 |
//20120710ysk end |
| 7714 |
$arr[] = $value; |
| 7715 |
} |
| 7716 |
} |
| 7717 |
sort($arr); |
| 7718 |
$min = $arr[0]; |
| 7719 |
rsort($arr); |
| 7720 |
$max = $arr[0]; |
| 7721 |
if($min == $max){ |
| 7722 |
$res = number_format($min); |
| 7723 |
}else{ |
| 7724 |
$res = number_format($min) . __(' - ', 'usces') . number_format($max); |
| 7725 |
} |
| 7726 |
return $res; |
| 7727 |
} |
| 7728 |
function sc_site_url() { |
| 7729 |
return get_option('home'); |
| 7730 |
} |
| 7731 |
function sc_button_to_cart($atts) { |
| 7732 |
extract(shortcode_atts(array( |
| 7733 |
'item' => '', |
| 7734 |
'sku' => '', |
| 7735 |
'value' => __('to the cart', 'usces'), |
| 7736 |
'force' => 0, |
| 7737 |
'quant' => 0, |
| 7738 |
'opt' => 1, |
| 7739 |
), $atts)); |
| 7740 |
|
| 7741 |
$post_id = $this->get_ID_byItemName($item); |
| 7742 |
$datas = $this->get_skus( $post_id, 'code' ); |
| 7743 |
$zaikonum = $datas[$sku]['stocknum']; |
| 7744 |
$zaiko = $datas[$sku]['stock']; |
| 7745 |
$gptekiyo = $datas[$sku]['gp']; |
| 7746 |
$skuPrice = $datas[$sku]['price']; |
| 7747 |
$sku_enc = urlencode($sku); |
| 7748 |
$mats = compact('item','sku','value','force','quant','post_id','datas','zaikonum','zaiko','gptekiyo','skuPrice','sku_enc'); |
| 7749 |
if( ! $this->is_item_zaiko( $post_id, $sku ) ){ |
| 7750 |
return '<div class="button_status">' . esc_html($this->zaiko_status[$zaiko]) . '</div>'; |
| 7751 |
} |
| 7752 |
|
| 7753 |
$html = "<form action=\"" . USCES_CART_URL . "\" method=\"post\">\n"; |
| 7754 |
$html .= "<input name=\"zaikonum[{$post_id}][{$sku_enc}]\" type=\"hidden\" id=\"zaikonum[{$post_id}][{$sku_enc}]\" value=\"{$zaikonum}\" />\n"; |
| 7755 |
$html .= "<input name=\"zaiko[{$post_id}][{$sku_enc}]\" type=\"hidden\" id=\"zaiko[{$post_id}][{$sku_enc}]\" value=\"{$zaiko}\" />\n"; |
| 7756 |
$html .= "<input name=\"gptekiyo[{$post_id}][{$sku_enc}]\" type=\"hidden\" id=\"gptekiyo[{$post_id}][{$sku_enc}]\" value=\"{$gptekiyo}\" />\n"; |
| 7757 |
$html .= "<input name=\"skuPrice[{$post_id}][{$sku_enc}]\" type=\"hidden\" id=\"skuPrice[{$post_id}][{$sku_enc}]\" value=\"{$skuPrice}\" />\n"; |
| 7758 |
if( 1 == $opt ){ |
| 7759 |
$html .= usces_item_option_fileds( $post_id, $sku, 1, 'return' ); |
| 7760 |
}elseif( 2 == $opt ){ |
| 7761 |
$html .= usces_item_option_fileds( $post_id, $sku, 0, 'return' ); |
| 7762 |
} |
| 7763 |
if( $quant ){ |
| 7764 |
$quant_field = "<input name=\"quant[{$post_id}][" . $sku_enc . "]\" type=\"text\" id=\"quant[{$post_id}][" . $sku_enc . "]\" class=\"skuquantity\" value=\"\" onKeyDown=\"if (event.keyCode == 13) {return false;}\" />"; |
| 7765 |
$html .= apply_filters('usces_filter_sc_itemQuant', $quant_field, $mats); |
| 7766 |
} |
| 7767 |
$html .= "<input name=\"inCart[{$post_id}][{$sku_enc}]\" type=\"submit\" id=\"inCart[{$post_id}][{$sku_enc}]\" class=\"skubutton\" value=\"{$value}\" " . apply_filters('usces_filter_direct_intocart_button', NULL, $post_id, $sku, $force, $options) . " />"; |
| 7768 |
$html .= "<input name=\"usces_referer\" type=\"hidden\" value=\"" . $_SERVER['REQUEST_URI'] . "\" />\n"; |
| 7769 |
if( $force ) |
| 7770 |
$html .= "<input name=\"usces_force\" type=\"hidden\" value=\"incart\" />\n"; |
| 7771 |
$html = apply_filters('usces_filter_single_item_inform', $html); |
| 7772 |
$html .= "</form>"; |
| 7773 |
$html .= '<div class="error_message">' . usces_singleitem_error_message($post_id, $sku, 'return') . '</div>'."\n"; |
| 7774 |
|
| 7775 |
return $html; |
| 7776 |
} |
| 7777 |
|
| 7778 |
function filter_itemPage($content){ |
| 7779 |
global $post; |
| 7780 |
$html = ''; |
| 7781 |
|
| 7782 |
if( ($post->post_mime_type != 'item' || !is_single()) ) return $content; |
| 7783 |
if( post_password_required($post) ) return $content; |
| 7784 |
|
| 7785 |
$temp_path = apply_filters('usces_template_path_single_item', USCES_PLUGIN_DIR . '/templates/single_item.php'); |
| 7786 |
include( $temp_path ); |
| 7787 |
|
| 7788 |
$content = apply_filters('usces_filter_itemPage', $html, $post->ID); |
| 7789 |
|
| 7790 |
return $content; |
| 7791 |
} |
| 7792 |
|
| 7793 |
function filter_cartContent($content) { |
| 7794 |
global $post; |
| 7795 |
$html = ''; |
| 7796 |
|
| 7797 |
switch($this->page){ |
| 7798 |
case 'cart': |
| 7799 |
$temp_path = apply_filters('usces_template_path_cart', USCES_PLUGIN_DIR . '/templates/cart/cart.php'); |
| 7800 |
include( $temp_path ); |
| 7801 |
break; |
| 7802 |
case 'customer': |
| 7803 |
$temp_path = apply_filters('usces_template_path_customer', USCES_PLUGIN_DIR . '/templates/cart/customer_info.php'); |
| 7804 |
include( $temp_path ); |
| 7805 |
break; |
| 7806 |
case 'delivery': |
| 7807 |
$temp_path = apply_filters('usces_template_path_delivery', USCES_PLUGIN_DIR . '/templates/cart/delivery_info.php'); |
| 7808 |
include( $temp_path ); |
| 7809 |
break; |
| 7810 |
case 'confirm': |
| 7811 |
$temp_path = apply_filters('usces_template_path_confirm', USCES_PLUGIN_DIR . '/templates/cart/confirm.php'); |
| 7812 |
include( $temp_path ); |
| 7813 |
break; |
| 7814 |
case 'ordercompletion': |
| 7815 |
$temp_path = apply_filters('usces_template_path_ordercompletion', USCES_PLUGIN_DIR . '/templates/cart/completion.php'); |
| 7816 |
include( $temp_path ); |
| 7817 |
break; |
| 7818 |
case 'error': |
| 7819 |
$temp_path = apply_filters('usces_template_path_carterror', USCES_PLUGIN_DIR . '/templates/cart/error.php'); |
| 7820 |
include( $temp_path ); |
| 7821 |
break; |
| 7822 |
case 'maintenance': |
| 7823 |
$temp_path = apply_filters('usces_template_path_maintenance', USCES_PLUGIN_DIR . '/templates/cart/maintenance.php'); |
| 7824 |
include( $temp_path ); |
| 7825 |
break; |
| 7826 |
case 'search_item': |
| 7827 |
$temp_path = apply_filters('usces_template_path_search_item', USCES_PLUGIN_DIR . '/templates/search_item.php'); |
| 7828 |
include( $temp_path ); |
| 7829 |
break; |
| 7830 |
case 'wp_search': |
| 7831 |
if($post->post_mime_type == 'item'){ |
| 7832 |
$temp_path = apply_filters('usces_template_path_wp_search', USCES_PLUGIN_DIR . '/templates/wp_search_item.php'); |
| 7833 |
include( $temp_path ); |
| 7834 |
}else{ |
| 7835 |
$html = $content; |
| 7836 |
} |
| 7837 |
break; |
| 7838 |
default: |
| 7839 |
$html = $content; |
| 7840 |
} |
| 7841 |
|
| 7842 |
if( $this->use_ssl && ($this->is_cart_or_member_page($_SERVER['REQUEST_URI']) || $this->is_inquiry_page($_SERVER['REQUEST_URI'])) ) |
| 7843 |
$html = str_replace('src="'.site_url(), 'src="'.USCES_SSL_URL_ADMIN, $html); |
| 7844 |
|
| 7845 |
$html = apply_filters('usces_filter_cartContent', $html); |
| 7846 |
|
| 7847 |
$content = $html; |
| 7848 |
|
| 7849 |
remove_filter('the_title', array($this, 'filter_cartTitle')); |
| 7850 |
|
| 7851 |
return $content; |
| 7852 |
} |
| 7853 |
|
| 7854 |
function filter_cartTitle($title) { |
| 7855 |
|
| 7856 |
if( $title == 'Cart' || $title == __('Cart', 'usces') ){ |
| 7857 |
switch($this->page){ |
| 7858 |
case 'cart': |
| 7859 |
$newtitle = apply_filters('usces_filter_title_cart', __('In the cart', 'usces')); |
| 7860 |
break; |
| 7861 |
case 'customer': |
| 7862 |
$newtitle = apply_filters('usces_filter_title_customer', __('Customer Information', 'usces')); |
| 7863 |
break; |
| 7864 |
case 'delivery': |
| 7865 |
$newtitle = apply_filters('usces_filter_title_delivery', __('Shipping / Payment options', 'usces')); |
| 7866 |
break; |
| 7867 |
case 'confirm': |
| 7868 |
$newtitle = apply_filters('usces_filter_title_confirm', __('Confirmation', 'usces')); |
| 7869 |
break; |
| 7870 |
case 'ordercompletion': |
| 7871 |
$newtitle = apply_filters('usces_filter_title_ordercompletion', __('Completion', 'usces')); |
| 7872 |
break; |
| 7873 |
case 'error': |
| 7874 |
$newtitle = apply_filters('usces_filter_title_carterror', __('Error', 'usces')); |
| 7875 |
break; |
| 7876 |
case 'search_item': |
| 7877 |
$newtitle = apply_filters('usces_filter_title_search_item', __("'AND' search by categories", 'usces')); |
| 7878 |
break; |
| 7879 |
case 'maintenance': |
| 7880 |
$newtitle = apply_filters('usces_filter_title_maintenance', __('Under Maintenance', 'usces')); |
| 7881 |
break; |
| 7882 |
case 'login': |
| 7883 |
$newtitle = apply_filters('usces_filter_title_login', __('Log-in for members', 'usces')); |
| 7884 |
break; |
| 7885 |
default: |
| 7886 |
$newtitle = apply_filters('usces_filter_title_cart_default', $title); |
| 7887 |
} |
| 7888 |
}else{ |
| 7889 |
$newtitle = $title; |
| 7890 |
} |
| 7891 |
|
| 7892 |
$newtitle = apply_filters('usces_filter_cartTitle', $newtitle); |
| 7893 |
return $newtitle; |
| 7894 |
} |
| 7895 |
|
| 7896 |
function action_cartFilter(){ |
| 7897 |
add_filter('the_title', array($this, 'filter_cartTitle'),20); |
| 7898 |
add_filter('the_content', array($this, 'filter_cartContent'),20); |
| 7899 |
} |
| 7900 |
|
| 7901 |
function action_search_item(){ |
| 7902 |
include(TEMPLATEPATH . '/page.php'); |
| 7903 |
exit; |
| 7904 |
} |
| 7905 |
|
| 7906 |
function filter_memberContent($content) { |
| 7907 |
global $post; |
| 7908 |
$html = ''; |
| 7909 |
|
| 7910 |
if($this->options['membersystem_state'] == 'activate'){ |
| 7911 |
|
| 7912 |
if( $this->is_member_logged_in() ) { |
| 7913 |
|
| 7914 |
$member_regmode = 'editmemberform'; |
| 7915 |
$temp_path = apply_filters('usces_template_path_member', USCES_PLUGIN_DIR . '/templates/member/member.php'); |
| 7916 |
include( $temp_path ); |
| 7917 |
|
| 7918 |
} else { |
| 7919 |
|
| 7920 |
switch($this->page){ |
| 7921 |
case 'login': |
| 7922 |
$temp_path = apply_filters('usces_template_path_login', USCES_PLUGIN_DIR . '/templates/member/login.php'); |
| 7923 |
include( $temp_path ); |
| 7924 |
break; |
| 7925 |
case 'lostmemberpassword': |
| 7926 |
$temp_path = apply_filters('usces_template_path_lostpassword', USCES_PLUGIN_DIR . '/templates/member/lostpassword.php'); |
| 7927 |
include( $temp_path ); |
| 7928 |
break; |
| 7929 |
case 'changepassword': |
| 7930 |
$temp_path = apply_filters('usces_template_path_changepassword', USCES_PLUGIN_DIR . '/templates/member/changepassword.php'); |
| 7931 |
include( $temp_path ); |
| 7932 |
break; |
| 7933 |
case 'newcompletion': |
| 7934 |
case 'editcompletion': |
| 7935 |
case 'lostcompletion': |
| 7936 |
case 'changepasscompletion': |
| 7937 |
$temp_path = apply_filters('usces_template_path_membercompletion', USCES_PLUGIN_DIR . '/templates/member/completion.php'); |
| 7938 |
include( $temp_path ); |
| 7939 |
break; |
| 7940 |
case 'newmemberform': |
| 7941 |
$member_form_title = apply_filters('usces_filter_title_newmemberform', __('New enrollment form', 'usces')); |
| 7942 |
$member_regmode = 'newmemberform'; |
| 7943 |
$temp_path = apply_filters('usces_template_path_member_form', USCES_PLUGIN_DIR . '/templates/member/member_form.php'); |
| 7944 |
include( $temp_path ); |
| 7945 |
break; |
| 7946 |
default: |
| 7947 |
$temp_path = apply_filters('usces_template_path_login', USCES_PLUGIN_DIR . '/templates/member/login.php'); |
| 7948 |
include( $temp_path ); |
| 7949 |
} |
| 7950 |
|
| 7951 |
} |
| 7952 |
}else{ |
| 7953 |
$html .= "<p>".__('Member Services is not running currently.','usces')."</p>"; |
| 7954 |
} |
| 7955 |
|
| 7956 |
$content = $html; |
| 7957 |
|
| 7958 |
remove_filter('the_title', array($this, 'filter_memberTitle')); |
| 7959 |
|
| 7960 |
return $content; |
| 7961 |
} |
| 7962 |
|
| 7963 |
function filter_memberTitle($title) { |
| 7964 |
|
| 7965 |
if( $this->options['membersystem_state'] == 'activate' && ($title == 'Member' || $title == __('Membership', 'usces')) ){ |
| 7966 |
switch($this->page){ |
| 7967 |
case 'login': |
| 7968 |
$newtitle = apply_filters('usces_filter_title_login', __('Log-in for members', 'usces')); |
| 7969 |
break; |
| 7970 |
case 'newmemberform': |
| 7971 |
$newtitle = apply_filters('usces_filter_title_newmemberform', __('New enrollment form', 'usces')); |
| 7972 |
break; |
| 7973 |
case 'lostmemberpassword': |
| 7974 |
$newtitle = apply_filters('usces_filter_title_lostmemberpassword', __('The new password acquisition', 'usces')); |
| 7975 |
break; |
| 7976 |
case 'changepassword': |
| 7977 |
$newtitle = apply_filters('usces_filter_title_changepassword', __('Change password', 'usces')); |
| 7978 |
break; |
| 7979 |
case 'newcompletion': |
| 7980 |
case 'editcompletion': |
| 7981 |
case 'lostcompletion': |
| 7982 |
case 'changepasscompletion': |
| 7983 |
$newtitle = apply_filters('usces_filter_title_changepasscompletion', __('Completion', 'usces')); |
| 7984 |
break; |
| 7985 |
case 'error': |
| 7986 |
$newtitle = apply_filters('usces_filter_title_membererror', __('Error', 'usces')); |
| 7987 |
break; |
| 7988 |
default: |
| 7989 |
$newtitle = apply_filters('usces_filter_title_member_default', $title); |
| 7990 |
} |
| 7991 |
}else{ |
| 7992 |
$newtitle = $title; |
| 7993 |
} |
| 7994 |
|
| 7995 |
$newtitle = apply_filters('usces_filter_memberTitle', $newtitle); |
| 7996 |
return $newtitle; |
| 7997 |
} |
| 7998 |
|
| 7999 |
function action_memberFilter(){ |
| 8000 |
add_filter('the_title', array($this, 'filter_memberTitle'),20); |
| 8001 |
add_filter('the_content', array($this, 'filter_memberContent'),20); |
| 8002 |
} |
| 8003 |
|
| 8004 |
function filter_usces_cart_css(){ |
| 8005 |
$path = get_stylesheet_directory_uri() . '/usces_cart.css'; |
| 8006 |
return $path; |
| 8007 |
} |
| 8008 |
|
| 8009 |
function filter_divide_item(){ |
| 8010 |
global $wp_query; |
| 8011 |
|
| 8012 |
|
| 8013 |
if( ($this->options['divide_item'] && !is_category() && !is_search() && !is_singular() && !is_admin()) ){ |
| 8014 |
$ids = $this->getItemIds( 'front' ); |
| 8015 |
$wp_query->query_vars['post__not_in'] = $ids; |
| 8016 |
|
| 8017 |
} |
| 8018 |
if( is_admin() ){ |
| 8019 |
$ids = $this->getItemIds( 'back' ); |
| 8020 |
//$wp_query->query_vars['category__not_in'] = array(USCES_ITEM_CAT_PARENT_ID); |
| 8021 |
$wp_query->query_vars['post__not_in'] = $ids; |
| 8022 |
} |
| 8023 |
do_action( 'usces_action_divide_item'); |
| 8024 |
} |
| 8025 |
|
| 8026 |
function load_upload_template(){ |
| 8027 |
$post_id = $_POST['post_id']; |
| 8028 |
$file = 'upload_template01.php'; |
| 8029 |
include(TEMPLATEPATH . '/' . $file); |
| 8030 |
exit; |
| 8031 |
} |
| 8032 |
|
| 8033 |
function filter_itemimg_anchor_rel($html){ |
| 8034 |
|
| 8035 |
if( is_single() ){ |
| 8036 |
$str = ' rel="' . $this->options['itemimg_anchor_rel'] . '"'; |
| 8037 |
}else{ |
| 8038 |
$str = ''; |
| 8039 |
} |
| 8040 |
return $html . $str; |
| 8041 |
} |
| 8042 |
|
| 8043 |
function filter_permalink( $link ) { |
| 8044 |
|
| 8045 |
if(false !== strpos('?page_id=4', $link) || false !== strpos('?page_id=3', $link) || false !== strpos('usces-cart', $link) || false !== strpos('usces-member', $link) ) |
| 8046 |
$link = str_replace('http://', 'https://', $link); |
| 8047 |
|
| 8048 |
return $link; |
| 8049 |
} |
| 8050 |
|
| 8051 |
function filter_cart_page_header($html){ |
| 8052 |
if( !empty($this->options['cart_page_data']['header']['cart']) ){ |
| 8053 |
$html = $this->options['cart_page_data']['header']['cart']; |
| 8054 |
} |
| 8055 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8056 |
} |
| 8057 |
|
| 8058 |
function filter_cart_page_footer($html){ |
| 8059 |
if( !empty($this->options['cart_page_data']['footer']['cart']) ){ |
| 8060 |
$html = $this->options['cart_page_data']['footer']['cart']; |
| 8061 |
} |
| 8062 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8063 |
} |
| 8064 |
|
| 8065 |
function filter_customer_page_header($html){ |
| 8066 |
if( !empty($this->options['cart_page_data']['header']['customer']) ){ |
| 8067 |
$html = $this->options['cart_page_data']['header']['customer']; |
| 8068 |
} |
| 8069 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8070 |
} |
| 8071 |
|
| 8072 |
function filter_customer_page_footer($html){ |
| 8073 |
if( !empty($this->options['cart_page_data']['footer']['customer']) ){ |
| 8074 |
$html = $this->options['cart_page_data']['footer']['customer']; |
| 8075 |
} |
| 8076 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8077 |
} |
| 8078 |
|
| 8079 |
function filter_delivery_page_header($html){ |
| 8080 |
if( !empty($this->options['cart_page_data']['header']['delivery']) ){ |
| 8081 |
$html = $this->options['cart_page_data']['header']['delivery']; |
| 8082 |
} |
| 8083 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8084 |
} |
| 8085 |
|
| 8086 |
function filter_delivery_page_footer($html){ |
| 8087 |
if( !empty($this->options['cart_page_data']['footer']['delivery']) ){ |
| 8088 |
$html = $this->options['cart_page_data']['footer']['delivery']; |
| 8089 |
} |
| 8090 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8091 |
} |
| 8092 |
|
| 8093 |
function filter_confirm_page_header($html){ |
| 8094 |
if( !empty($this->options['cart_page_data']['header']['confirm']) ){ |
| 8095 |
$html = $this->options['cart_page_data']['header']['confirm']; |
| 8096 |
} |
| 8097 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8098 |
} |
| 8099 |
|
| 8100 |
function filter_confirm_page_footer($html){ |
| 8101 |
if( !empty($this->options['cart_page_data']['footer']['confirm']) ){ |
| 8102 |
$html = $this->options['cart_page_data']['footer']['confirm']; |
| 8103 |
} |
| 8104 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8105 |
} |
| 8106 |
|
| 8107 |
function filter_cartcompletion_page_header($html){ |
| 8108 |
if( !empty($this->options['cart_page_data']['header']['completion']) ){ |
| 8109 |
$html = $this->options['cart_page_data']['header']['completion']; |
| 8110 |
} |
| 8111 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8112 |
} |
| 8113 |
|
| 8114 |
function filter_cartcompletion_page_footer($html){ |
| 8115 |
if( !empty($this->options['cart_page_data']['footer']['completion']) ){ |
| 8116 |
$html = $this->options['cart_page_data']['footer']['completion']; |
| 8117 |
} |
| 8118 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8119 |
} |
| 8120 |
|
| 8121 |
function filter_login_page_header($html){ |
| 8122 |
if( !empty($this->options['member_page_data']['header']['login']) ){ |
| 8123 |
$html = $this->options['member_page_data']['header']['login']; |
| 8124 |
} |
| 8125 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8126 |
} |
| 8127 |
|
| 8128 |
function filter_login_page_footer($html){ |
| 8129 |
if( !empty($this->options['member_page_data']['footer']['login']) ){ |
| 8130 |
$html = $this->options['member_page_data']['footer']['login']; |
| 8131 |
} |
| 8132 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8133 |
} |
| 8134 |
|
| 8135 |
function filter_newmember_page_header($html){ |
| 8136 |
if( !empty($this->options['member_page_data']['header']['newmember']) ){ |
| 8137 |
$html = $this->options['member_page_data']['header']['newmember']; |
| 8138 |
} |
| 8139 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8140 |
} |
| 8141 |
|
| 8142 |
function filter_newmember_page_footer($html){ |
| 8143 |
if( !empty($this->options['member_page_data']['footer']['newmember']) ){ |
| 8144 |
$html = $this->options['member_page_data']['footer']['newmember']; |
| 8145 |
} |
| 8146 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8147 |
} |
| 8148 |
|
| 8149 |
function filter_newpass_page_header($html){ |
| 8150 |
if( !empty($this->options['member_page_data']['header']['newpass']) ){ |
| 8151 |
$html = $this->options['member_page_data']['header']['newpass']; |
| 8152 |
} |
| 8153 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8154 |
} |
| 8155 |
|
| 8156 |
function filter_newpass_page_footer($html){ |
| 8157 |
if( !empty($this->options['member_page_data']['footer']['newpass']) ){ |
| 8158 |
$html = $this->options['member_page_data']['footer']['newpass']; |
| 8159 |
} |
| 8160 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8161 |
} |
| 8162 |
|
| 8163 |
function filter_changepass_page_header($html){ |
| 8164 |
if( !empty($this->options['member_page_data']['header']['changepass']) ){ |
| 8165 |
$html = $this->options['member_page_data']['header']['changepass']; |
| 8166 |
} |
| 8167 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8168 |
} |
| 8169 |
|
| 8170 |
function filter_changepass_page_footer($html){ |
| 8171 |
if( !empty($this->options['member_page_data']['footer']['changepass']) ){ |
| 8172 |
$html = $this->options['member_page_data']['footer']['changepass']; |
| 8173 |
} |
| 8174 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8175 |
} |
| 8176 |
|
| 8177 |
function filter_memberinfo_page_header($html){ |
| 8178 |
if( !empty($this->options['member_page_data']['header']['memberinfo']) ){ |
| 8179 |
$html = $this->options['member_page_data']['header']['memberinfo']; |
| 8180 |
} |
| 8181 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8182 |
} |
| 8183 |
|
| 8184 |
function filter_memberinfo_page_footer($html){ |
| 8185 |
if( !empty($this->options['member_page_data']['footer']['memberinfo']) ){ |
| 8186 |
$html = $this->options['member_page_data']['footer']['memberinfo']; |
| 8187 |
} |
| 8188 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8189 |
} |
| 8190 |
|
| 8191 |
function filter_membercompletion_page_header($html){ |
| 8192 |
if( !empty($this->options['member_page_data']['header']['completion']) ){ |
| 8193 |
$html = $this->options['member_page_data']['header']['completion']; |
| 8194 |
} |
| 8195 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8196 |
} |
| 8197 |
|
| 8198 |
function filter_membercompletion_page_footer($html){ |
| 8199 |
if( !empty($this->options['member_page_data']['footer']['completion']) ){ |
| 8200 |
$html = $this->options['member_page_data']['footer']['completion']; |
| 8201 |
} |
| 8202 |
return do_shortcode( stripslashes(nl2br($html)) ); |
| 8203 |
} |
| 8204 |
|
| 8205 |
function action_cart_page_header(){ |
| 8206 |
if( !empty($this->options['cart_page_data']['header']['cart']) ){ |
| 8207 |
$html = $this->options['cart_page_data']['header']['cart']; |
| 8208 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8209 |
} |
| 8210 |
} |
| 8211 |
|
| 8212 |
function action_cart_page_footer(){ |
| 8213 |
if( !empty($this->options['cart_page_data']['footer']['cart']) ){ |
| 8214 |
$html = $this->options['cart_page_data']['footer']['cart']; |
| 8215 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8216 |
} |
| 8217 |
} |
| 8218 |
|
| 8219 |
function action_customer_page_header(){ |
| 8220 |
if( !empty($this->options['cart_page_data']['header']['customer']) ){ |
| 8221 |
$html = $this->options['cart_page_data']['header']['customer']; |
| 8222 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8223 |
} |
| 8224 |
} |
| 8225 |
|
| 8226 |
function action_customer_page_footer(){ |
| 8227 |
if( !empty($this->options['cart_page_data']['footer']['customer']) ){ |
| 8228 |
$html = $this->options['cart_page_data']['footer']['customer']; |
| 8229 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8230 |
} |
| 8231 |
} |
| 8232 |
|
| 8233 |
function action_delivery_page_header(){ |
| 8234 |
if( !empty($this->options['cart_page_data']['header']['delivery']) ){ |
| 8235 |
$html = $this->options['cart_page_data']['header']['delivery']; |
| 8236 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8237 |
} |
| 8238 |
} |
| 8239 |
|
| 8240 |
function action_delivery_page_footer(){ |
| 8241 |
if( !empty($this->options['cart_page_data']['footer']['delivery']) ){ |
| 8242 |
$html = $this->options['cart_page_data']['footer']['delivery']; |
| 8243 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8244 |
} |
| 8245 |
} |
| 8246 |
|
| 8247 |
function action_confirm_page_header(){ |
| 8248 |
if( !empty($this->options['cart_page_data']['header']['confirm']) ){ |
| 8249 |
$html = $this->options['cart_page_data']['header']['confirm']; |
| 8250 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8251 |
} |
| 8252 |
} |
| 8253 |
|
| 8254 |
function action_confirm_page_footer(){ |
| 8255 |
if( !empty($this->options['cart_page_data']['footer']['confirm']) ){ |
| 8256 |
$html = $this->options['cart_page_data']['footer']['confirm']; |
| 8257 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8258 |
} |
| 8259 |
} |
| 8260 |
|
| 8261 |
function action_cartcompletion_page_header(){ |
| 8262 |
if( !empty($this->options['cart_page_data']['header']['completion']) ){ |
| 8263 |
$html = $this->options['cart_page_data']['header']['completion']; |
| 8264 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8265 |
} |
| 8266 |
} |
| 8267 |
|
| 8268 |
function action_cartcompletion_page_footer(){ |
| 8269 |
if( !empty($this->options['cart_page_data']['footer']['completion']) ){ |
| 8270 |
$html = $this->options['cart_page_data']['footer']['completion']; |
| 8271 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8272 |
} |
| 8273 |
} |
| 8274 |
|
| 8275 |
function action_login_page_header(){ |
| 8276 |
if( !empty($this->options['member_page_data']['header']['login']) ){ |
| 8277 |
$html = $this->options['member_page_data']['header']['login']; |
| 8278 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8279 |
} |
| 8280 |
} |
| 8281 |
|
| 8282 |
function action_login_page_footer(){ |
| 8283 |
if( !empty($this->options['member_page_data']['footer']['login']) ){ |
| 8284 |
$html = $this->options['member_page_data']['footer']['login']; |
| 8285 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8286 |
} |
| 8287 |
} |
| 8288 |
|
| 8289 |
function action_newmember_page_header(){ |
| 8290 |
if( !empty($this->options['member_page_data']['header']['newmember']) ){ |
| 8291 |
$html = $this->options['member_page_data']['header']['newmember']; |
| 8292 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8293 |
} |
| 8294 |
} |
| 8295 |
|
| 8296 |
function action_newmember_page_footer(){ |
| 8297 |
if( !empty($this->options['member_page_data']['footer']['newmember']) ){ |
| 8298 |
$html = $this->options['member_page_data']['footer']['newmember']; |
| 8299 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8300 |
} |
| 8301 |
} |
| 8302 |
|
| 8303 |
function action_newpass_page_header(){ |
| 8304 |
if( !empty($this->options['member_page_data']['header']['newpass']) ){ |
| 8305 |
$html = $this->options['member_page_data']['header']['newpass']; |
| 8306 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8307 |
} |
| 8308 |
} |
| 8309 |
|
| 8310 |
function action_newpass_page_footer(){ |
| 8311 |
if( !empty($this->options['member_page_data']['footer']['newpass']) ){ |
| 8312 |
$html = $this->options['member_page_data']['footer']['newpass']; |
| 8313 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8314 |
} |
| 8315 |
} |
| 8316 |
|
| 8317 |
function action_changepass_page_header(){ |
| 8318 |
if( !empty($this->options['member_page_data']['header']['changepass']) ){ |
| 8319 |
$html = $this->options['member_page_data']['header']['changepass']; |
| 8320 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8321 |
} |
| 8322 |
} |
| 8323 |
|
| 8324 |
function action_changepass_page_footer(){ |
| 8325 |
if( !empty($this->options['member_page_data']['footer']['changepass']) ){ |
| 8326 |
$html = $this->options['member_page_data']['footer']['changepass']; |
| 8327 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8328 |
} |
| 8329 |
} |
| 8330 |
|
| 8331 |
function action_memberinfo_page_header(){ |
| 8332 |
if( !empty($this->options['member_page_data']['header']['memberinfo']) ){ |
| 8333 |
$html = $this->options['member_page_data']['header']['memberinfo']; |
| 8334 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8335 |
} |
| 8336 |
} |
| 8337 |
|
| 8338 |
function action_memberinfo_page_footer(){ |
| 8339 |
if( !empty($this->options['member_page_data']['footer']['memberinfo']) ){ |
| 8340 |
$html = $this->options['member_page_data']['footer']['memberinfo']; |
| 8341 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8342 |
} |
| 8343 |
} |
| 8344 |
|
| 8345 |
function action_membercompletion_page_header(){ |
| 8346 |
if( !empty($this->options['member_page_data']['header']['completion']) ){ |
| 8347 |
$html = $this->options['member_page_data']['header']['completion']; |
| 8348 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8349 |
} |
| 8350 |
} |
| 8351 |
|
| 8352 |
function action_membercompletion_page_footer(){ |
| 8353 |
if( !empty($this->options['member_page_data']['footer']['completion']) ){ |
| 8354 |
$html = $this->options['member_page_data']['footer']['completion']; |
| 8355 |
echo do_shortcode( stripslashes(nl2br($html)) ); |
| 8356 |
} |
| 8357 |
} |
| 8358 |
} |
| 8359 |
|
| 8360 |
|
| 8361 |
|
| 8362 |
?> |
| 8363 |
|