function deal_expire_process($postid) { global $wpdb, $transection_db_table_name, $deal_db_table_name; $deal_db_table_name = $wpdb->prefix . "posts"; $recent_posts = get_post($postid); $store_name = get_option('blogname'); $sellsql = "select count(*) from {$transection_db_table_name} where post_id=" . $postid . " and status=1"; $sellsqlinfo = $wpdb->get_var($sellsql); if (get_post_meta($postid, 'coupon_end_date_time', true) != "") { if (date("Y-m-d H:i:s") >= date("Y-m-d H:i:s", get_post_meta($postid, 'coupon_end_date_time', true))) { if (get_post_meta($postid, 'is_expired', true) == '0') { $recent_posts = update_post_meta($postid, 'is_expired', 1); $fromEmail = get_site_emailId(); $fromEmailName = get_site_emailName(); $deal_link = get_permalink($postid); $loginurl = get_option('siteurl') . '/?ptype=login'; $siteurl = get_option('siteurl'); $post_detail = get_post($postid); $to_seller_email = get_post_meta($postid, 'owner_email', true); $to_seller_name = get_post_meta($postid, 'owner_name', true); $user_log_details = get_userdata($post_detail->post_author); if (get_post_meta($postid, 'coupon_end_date_time', true) != '') { $post_date = date('Y-m-d H:i:s', get_post_meta($postid, 'coupon_end_date_time', true)); } if (get_option('ptthemes_deal_expire_notify_seller') == 'Yes' || get_option('ptthemes_deal_expire_notify_seller') == '') { global $wpdb; $expire_email_subject = get_option('deal_exp_success_email_subject'); $expire_email_content = get_option('deal_exp_success_email_content'); $search_expire_array = array('[#to_name#]', '[#deal_link#]', '[#deal_title#]', '[#login_url#]', '[#user_login#]', '[#user_email#]', '[#site_url#]', '[#from_name#]', '[#post_date#]'); $replace_expire_array = array($to_seller_name, $deal_link, $post_detail->post_title, $loginurl, $user_log_details->user_login, $user_log_details->user_email, $siteurl, $fromEmailName, $post_date); $expire_email_content = str_replace($search_expire_array, $replace_expire_array, $expire_email_content); templ_sendEmail($to_seller_email, $to_seller_name, $fromEmail, $fromEmailName, $expire_email_subject, $expire_email_content, $extra = ''); } if (get_option('ptthemes_deal_expire_notify_admin') == 'Yes' || get_option('ptthemes_deal_expire_notify_admin') == '') { global $wpdb; $expire_email_subject = get_option('deal_expadmin_success_email_subject'); $expire_email_content = get_option('deal_expadmin_success_email_content'); $search_expire_array = array('[#to_name#]', '[#deal_link#]', '[#deal_title#]', '[#site_url#]', '[#from_name#]', '[#post_date#]'); $replace_expire_array = array($fromEmailName, $deal_link, $post_detail->post_title, $siteurl, $fromEmailName, $post_date); $expire_email_content = str_replace($search_expire_array, $replace_expire_array, $expire_email_content); $search_expire_sub_array = array('[#site_name#]'); $replace_expire_sub_array = array($store_name); $expire_email_subject = str_replace($search_expire_sub_array, $replace_expire_sub_array, $expire_email_subject); if (get_option('pttthemes_send_mail') == 'Enable' || get_option('pttthemes_send_mail') == '') { templ_sendEmail($fromEmail, $fromEmailName, $to_seller_email, $to_seller_name, $expire_email_subject, $expire_email_content, $extra = ''); } } } } } }
<?php global $wpdb, $transection_db_table_name; foreach ($_POST as $field => $value) { $ipnData["{$field}"] = $value; } $transid = intval($ipnData['x_invoice_num']); $pnref = $ipnData['x_trans_id']; $amount = doubleval($ipnData['x_amount']); $result = intval($ipnData['x_response_code']); $respmsg = $ipnData['x_response_reason_text']; $customer_email = $ipnData['x_email']; $customer_name = $ipnData['x_first_name']; $item_name = $ipnData['c_name']; $fromEmail = get_site_emailId(); $fromEmailName = get_site_emailName(); if ($result == '1') { // Valid IPN transaction. $transifo = get_deal_trans_info($transid); $postid = $transifo['post_id']; if ($transifo['deal_type'] == '3' || $transifo['deal_type'] == '4' || $transifo['deal_type'] == '5') { $coupon_code_arr = explode(",", get_post_meta($postid, 'coupon_code', true)); $coup = array_shift($coupon_code_arr); update_post_meta($postid, "coupon_code", implode(",", $coupon_code_arr)); if (get_post_meta($postid, 'used_coupon_code', true) == "") { update_post_meta($postid, "used_coupon_code", $coup); } else { $old_used_coupon = get_post_meta($postid, 'used_coupon_code', true); $coupon = $old_used_coupon . "," . $coup; update_post_meta($postid, "used_coupon_code", $coupon); }
function widget_retrieve_password() { global $wpdb; $errors = new WP_Error(); if (empty($_POST['user_login']) && empty($_POST['user_email'])) { $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'templatic')); } if (strpos($_POST['user_login'], '@')) { $user_data = get_user_by_email(trim($_POST['user_login'])); if (empty($user_data)) { $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'templatic')); } } else { $login = trim($_POST['user_login']); $user_data = get_userdatabylogin($login); } do_action('lostpassword_post'); if ($errors->get_error_code()) { return $errors; } if (!$user_data) { $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.', 'templatic')); return $errors; } // redefining user_login ensures we return the right case in the email $user_login = $user_data->user_login; $user_email = $user_data->user_email; do_action('retreive_password', $user_login); // Misspelled and deprecated do_action('retrieve_password', $user_login); //////////////////////////////////// $user_email = $_POST['user_email']; $user_login = $_POST['user_login']; $user = $wpdb->get_row("SELECT * FROM {$wpdb->users} WHERE user_login like \"{$user_login}\" or user_email like \"{$user_login}\""); if (empty($user)) { return new WP_Error('invalid_key', __('Invalid key', 'templatic')); } $new_pass = wp_generate_password(12, false); do_action('password_reset', $user, $new_pass); wp_set_password($new_pass, $user->ID); update_usermeta($user->ID, 'default_password_nag', true); //Set up the Password change nag. $message = '<p><b>' . __('Your login Information :', 'templatic') . '</b></p>'; $message .= '<p>' . sprintf(__('Username: %s', 'templatic'), $user->user_login) . "</p>"; $message .= '<p>' . sprintf(__('Password: %s', 'templatic'), $new_pass) . "</p>"; $message .= '<p>You can login to : <a href="' . get_option('siteurl') . '/' . "\">Login</a> or the URL is : " . get_option('siteurl') . "/?ptype=login</p>"; $message .= '<p>Thank You,<br> ' . get_option('blogname') . '</p>'; $user_email = $user_data->user_email; $user_name = $user_data->user_nicename; $fromEmail = get_site_emailId(); $fromEmailName = get_site_emailName(); $title = sprintf(__('[%s] Your new password', 'templatic'), get_option('blogname')); $title = apply_filters('password_reset_title', $title); $message = apply_filters('password_reset_message', $message, $new_pass); templ_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = ''); ///forgot password email return true; }
/** * Handles registering a new user. * * @param string $user_login User's username for logging in * @param string $user_email User's email address to send password and add * @return int|WP_Error Either user's ID or error on failure. */ function register_new_user($user_login, $user_email) { global $wpdb; $errors = new WP_Error(); $user_login = sanitize_user($user_login); $user_email = apply_filters('user_registration_email', $user_email); // Check the username if ($user_login == '') { $errors->add('empty_username', __('ERROR: Please enter a username.', 'templatic')); } elseif (!validate_username($user_login)) { $errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid. Please enter a valid username.', 'templatic')); $user_login = ''; } elseif (username_exists($user_login)) { $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'templatic')); } // Check the e-mail address if ($user_email == '') { $errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.', 'templatic')); } elseif (!is_email($user_email)) { $errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn’t correct.', 'templatic')); $user_email = ''; } elseif (email_exists($user_email)) { $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'templatic')); } do_action('register_post', $user_login, $user_email, $errors); $errors = apply_filters('registration_errors', $errors); if ($errors->get_error_code()) { return $errors; } $user_pass = wp_generate_password(12, false); $user_id = wp_create_user($user_login, $user_pass, $user_email); global $upload_folder_path; global $form_fields_usermeta; foreach ($form_fields_usermeta as $fkey => $fval) { $fldkey = "{$fkey}"; ${$fldkey} = $_POST["{$fkey}"]; if ($fval['type'] == 'upload') { if ($_FILES[$fkey]['name'] && $_FILES[$fkey]['size'] > 0) { $dirinfo = wp_upload_dir(); $path = $dirinfo['path']; $url = $dirinfo['url']; $destination_path = $path . "/"; $destination_url = $url . "/"; $src = $_FILES[$fkey]['tmp_name']; $file_ame = date('Ymdhis') . "_" . $_FILES[$fkey]['name']; $target_file = $destination_path . $file_ame; if (move_uploaded_file($_FILES[$fkey]["tmp_name"], $target_file)) { $image_path = $destination_url . $file_ame; } else { $image_path = ''; } $_POST[$fkey] = $image_path; ${$fldkey} = $image_path; } } update_usermeta($user_id, $fkey, ${$fldkey}); // User Custom Metadata Here } $userName = $_POST['user_fname']; update_usermeta($user_id, 'first_name', $_POST['user_fname']); // User First Name Information Here update_usermeta($user_id, 'last_name', $_POST['user_lname']); // User Last Name Information Here $user_nicename = get_user_nice_name($_POST['user_fname'], $_POST['user_lname']); //generate nice name $updateUsersql = "update {$wpdb->users} set user_url=\"{$user_web}\", user_nicename=\"{$user_nicename}\", display_name=\"{$userName}\" where ID=\"{$user_id}\""; $wpdb->query($updateUsersql); if ($user_id) { ///////REGISTRATION EMAIL START////// $fromEmail = get_site_emailId(); $fromEmailName = get_site_emailName(); $store_name = get_option('blogname'); $client_message = get_option('registration_success_email_content'); if ($client_message == "") { $client_message = "<p>Dear [#user_name#],</p>\n<p>Your registration completed successfully. You can now login here [#site_login_url#] using the following credentials:</p><p>Username: [#user_login#]</p><p>Password: [#user_password#]</p>\n<p>Or using the URL: [#site_login_url_link#] .</p><br /><p>Thanks!</p>\n<p>[#site_name#]</p>"; } $subject = get_option('registration_success_email_subject'); if ($subject == "") { $subject = "Registration completed successfully"; } $store_login = '******' . site_url() . '/?ptype=login">' . site_url() . '/?ptype=login</a>'; $store_login_link = site_url() . '/?ptype=login'; /////////////customer email////////////// $search_array = array('[#user_name#]', '[#user_login#]', '[#user_password#]', '[#site_name#]', '[#site_login_url#]', '[#site_login_url_link#]'); $replace_array = array($userName, $user_login, $user_pass, $store_name, $store_login, $store_login_link); $client_message = str_replace($search_array, $replace_array, $client_message); if (get_option('pttthemes_send_mail') == 'Enable') { templ_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, $subject, $client_message, $extra = ''); } ///To clidne email $redirect_to = wp_redirect(site_url() . '/?reg=1&ptype=login'); //////REGISTRATION EMAIL END//////// } if (!$user_id) { $errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !', 'templatic'), get_option('admin_email'))); return $errors; } else { $redirect_to = wp_redirect(site_url() . '/?reg=1&ptype=login'); } return array($user_id, $user_pass); }
<?php /* Template Name: Page - Contact Us */ if ($_POST) { if ($_POST['your-email']) { $toEmailName = get_option('blogname'); $toEmail = get_site_emailId(); $subject = $_POST['your-subject']; $message = ''; $message .= '<p>' . DEAR . $toEmailName . ',</p>'; $message .= '<p>' . NAME . ' : ' . $_POST['your-name'] . ',</p>'; $message .= '<p>' . EMAIL . ' : ' . $_POST['your-email'] . ',</p>'; $message .= '<p>' . MESSAGE . ' : ' . nl2br($_POST['your-message']) . '</p>'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; // Additional headers $headers .= 'To: ' . $toEmailName . ' <' . $toEmail . '>' . "\r\n"; $headers .= 'From: ' . $_POST['your-name'] . ' <' . $_POST['your-email'] . '>' . "\r\n"; // Mail it wp_mail($toEmail, $subject, $message, $headers); if (strstr($_REQUEST['request_url'], '?')) { $url = $_REQUEST['request_url'] . '&msg=success'; } else { $url = $_REQUEST['request_url'] . '?msg=success'; } echo "<script type='text/javascript'>location.href='" . $url . "';</script>"; } } ?>
function save_deal($post_id) { global $post; if (!wp_verify_nonce($_POST['mytheme_meta_box_nonce'], 'deal_panel')) { return $post_id; } $uploadpath = wp_upload_dir(); $tmpfolder = $uploadpath['baseurl'] . '/tmp/'; $imgstr = ''; if ($_POST["file_info"] != '') { foreach ($_POST["file_info"] as $key => $val) { $imagepath = $tmpfolder . $key . '.jpg'; $imgstr .= '<a href="' . $imagepath . '" target="_blank" ><img src="' . $imagepath . '" height="100" width="100" alt="" /></a> '; } } $user_fname = $_POST['owner_name']; $user_email = $_POST['owner_email']; $deal_title = '<a href="' . $_POST['link_url'] . '">' . $_POST['post_title'] . '</a>'; $deal_desc = $_POST['post_content']; $coupon_website = $_POST['coupon_website']; $no_of_coupon = $_POST['no_of_coupon']; $our_price = $_POST['our_price']; $current_price = $_POST['current_price']; $coupon_type = $_POST['coupon_type']; if ($_POST['coupon_entry'] == 'coupon_entry_0') { $single_coupon_code = $_POST['coupon_code1']; } else { $coupon_code = $_POST['coupon_code']; } //echo $coupon_code= $_POST['coupon_code']; $coupon_address = $_POST['coupon_address']; $coupon_link = $_POST['coupon_link']; $mediafilename = $_POST['media_file']; if ($coupon_type == '1') { $coupon_type = 'Custom Link Deal'; } elseif ($coupon_type == '2') { $coupon_type = 'Fixed Deal'; } elseif ($coupon_type == '3') { $coupon_type = 'Custom Generated Deal'; } elseif ($coupon_type == '4') { $coupon_type = 'Physical Barcode Deal'; } elseif ($coupon_type == '5') { $coupon_type = 'Physical Product Deal'; } // Start All Transection Details With Deal if ($coupon_type == '4' || $coupon_type == '5') { if ($coupon_address != "") { $transaction_details = sprintf(__("\n\t\t\t<p><h3>Deal Details</h3> \r</p>\n\t\t\t<p><strong>Deal Title: </strong>%s \r\t</p>\n\t\t\t<p><strong>Deal Desc: </strong>%s \r\t</p>\n\t\t\t<p><strong>Deal Type: </strong>%s \r\t</p>\n\t\t\t<p><strong>Original Price: </strong>%s \r\t</p>\n\t\t\t<p><strong>Current Price: </strong>%s \r\t</p>\n\t\t\t<p><strong>Store Address:</strong> %s \r\t</p>\n\t\t\t", 'templatic'), $deal_title, $deal_desc, $coupon_code, get_currency_sym() . $current_price, get_currency_sym() . $our_price, $current_price, $coupon_address); } else { $transaction_details = sprintf(__("\n\t\t\t<p><h3>Deal Details </h3> \r</p>\n\t\t\t<p><strong>Deal Title:</strong> %s \r</p>\n\t\t\t<p><strong>Deal Desc:</strong> %s \r\t</p>\n\t\t\t<p><strong>Deal Type: </strong>%s \r\t</p>\n\t\t\t<p><strong>Original Price: </strong>%s \r\t</p>\n\t\t\t<p><strong>Current Price: </strong>%s \r\t</p>\n\t\t\t", 'templatic'), $deal_title, $deal_desc, $coupon_code, $coupon_type, get_currency_sym() . $current_price, get_currency_sym() . $our_price); } } else { $transaction_details = sprintf(__("\n\t\t<p><h3>Deal Details </h3>\r</p>\n\t\t<p><strong>Deal Title:</strong> %s \r</p>\n\t\t<p><strong>Deal Coupon:</strong> %s \r\t</p>\n\t\t<p><strong>Deal Type:</strong> %s \r\t</p>\n\t\t<p><strong>Original Price: </strong>%s \r\t</p>\n\t\t<p><strong>Current Price: </strong>%s \r\t</p>\n\t\t", 'templatic'), $deal_title, $single_coupon_code, $coupon_type, get_currency_sym() . $current_price, get_currency_sym() . $our_price); } // End All Transection Details With Deal $fromEmail = get_site_emailId(); $fromEmailName = get_site_emailName(); $store_name = get_option('blogname'); if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post_id; } if ($_POST["status"] != "") { global $post; $pre = get_post_meta($post->ID, 'status', true); if ($pre != $_POST["status"]) { update_post_meta($post->ID, "status", $_POST["status"]); if ($_POST["status"] == '2') { update_post_meta($post->ID, "is_show", '1'); } if ($_POST["status"] == '1' || $_POST["status"] == '2') { $client_message = get_option('req_accept_success_email_content'); $users_details = sprintf(__("\n\t\t\t\t\t\t<p><h3>Seller Details</h3> \r</p>\n\t\t\t\t\t\t<p><strong>Name:</strong> %s \r\t</p>\n\t\t\t\t\t\t<p><strong>Email:</strong> %s \r\t</p>", 'templatic'), $user_fname, $user_email); $subject = get_option('req_accept_success_email_subject'); $search_array = array('[#to_name#]', '[#site_name#]', '[#deal_details#]', '[#seller_details#]'); $replace_array = array($user_fname . ",", $store_name, $transaction_details, $users_details); $email_seller_content = str_replace($search_array, $replace_array, $client_message); if (get_option('pttthemes_send_mail') == 'Enable' || get_option('pttthemes_send_mail') == '') { templ_sendEmail($fromEmail, $fromEmailName, $user_email, $user_fname, $subject, $email_seller_content, $extra = ''); } } else { if ($_POST["status"] == '3') { $fromEmail = get_site_emailId(); $fromEmailName = get_site_emailName(); $store_name = get_option('blogname'); $client_message = get_option('req_reject_success_email_content'); $subject = get_option('req_reject_success_email_subject'); $search_array = array('[#to_name#]', '[#site_name#]'); $replace_array = array($user_fname . ",", $store_name); $email_seller_content = str_replace($search_array, $replace_array, $client_message); if (get_option('pttthemes_send_mail') == 'Enable' || get_option('pttthemes_send_mail') == '') { templ_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, $subject, $email_seller_content, $extra = ''); } } else { // Do nothing } } } else { if ($_POST["status"] == '2') { update_post_meta($post->ID, "is_show", '1'); } } } else { delete_post_meta($post->ID, "status", $_POST["status"]); } if ($_POST["owner_name"] != "") { update_post_meta($post->ID, "owner_name", $_POST["owner_name"]); } else { delete_post_meta($post->ID, "owner_name", $_POST["owner_name"]); } if ($_POST["_wp_attached_file"] != "") { update_post_meta($post->ID, "_wp_attached_file", $_POST["_wp_attached_file"]); } else { delete_post_meta($post->ID, "_wp_attached_file", $_POST["_wp_attached_file"]); } if ($_POST["owner_email"] != "") { update_post_meta($post->ID, "owner_email", $_POST["owner_email"]); } else { delete_post_meta($post->ID, "owner_email", $_POST["owner_email"]); } if ($_POST["thankyou_page_url"] != "") { update_post_meta($post->ID, "thankyou_page_url", $_POST["thankyou_page_url"]); } else { delete_post_meta($post->ID, "thankyou_page_url", $_POST["thankyou_page_url"]); } if ($_POST["coupon_website"] != "") { update_post_meta($post->ID, "coupon_website", $_POST["coupon_website"]); } else { delete_post_meta($post->ID, "coupon_website", $_POST["coupon_website"]); } if ($_POST["no_of_coupon"] != "") { update_post_meta($post->ID, "no_of_coupon", $_POST["no_of_coupon"]); } else { delete_post_meta($post->ID, "no_of_coupon", $_POST["no_of_coupon"]); } if ($_POST["coupon_type"] != "") { update_post_meta($post->ID, "coupon_type", $_POST["coupon_type"]); } else { delete_post_meta($post->ID, "coupon_type", $_POST["coupon_type"]); } if ($_POST["coupon_entry"] != "") { update_post_meta($post->ID, "coupon_entry", $_POST["coupon_entry"]); if ($_POST["coupon_entry"] == "coupon_entry_0") { update_post_meta($post->ID, "coupon_code", $_POST["coupon_code1"]); } else { update_post_meta($post->ID, "coupon_code", $_POST["coupon_code"]); } } else { delete_post_meta($post->ID, "coupon_entry", $_POST["coupon_entry"]); delete_post_meta($post->ID, "coupon_code", $_POST["coupon_code"]); } if ($_POST["min_purchases"] != "") { update_post_meta($post->ID, "min_purchases", $_POST["min_purchases"]); } else { delete_post_meta($post->ID, "min_purchases", $_POST["min_purchases"]); } if ($_POST["max_purchases_user"] != "") { update_post_meta($post->ID, "max_purchases_user", $_POST["max_purchases_user"]); } else { delete_post_meta($post->ID, "max_purchases_user", $_POST["max_purchases_user"]); } if ($_POST["shhiping_address"] != "") { update_post_meta($post->ID, "shhiping_address", $_POST["shhiping_address"]); } else { delete_post_meta($post->ID, "shhiping_address", $_POST["shhiping_address"]); } if ($_POST["shipping_cost"] != "") { update_post_meta($post->ID, "shipping_cost", $_POST["shipping_cost"]); } else { delete_post_meta($post->ID, "shipping_cost", $_POST["shipping_cost"]); } if ($_POST["geo_latitude"] != "") { update_post_meta($post->ID, "geo_latitude", $_POST["geo_latitude"]); } else { delete_post_meta($post->ID, "geo_latitude", $_POST["geo_latitude"]); } if ($_POST["geo_longitude"] != "") { update_post_meta($post->ID, "geo_longitude", $_POST["geo_longitude"]); } else { delete_post_meta($post->ID, "geo_longitude", $_POST["geo_longitude"]); } if ($_POST["coupon_type"] == "3" || $_POST["coupon_type"] == "4") { if ($_POST["coupon_code"] == "") { $sys_gen_coupon = ''; if ($single_coupon_code == '') { for ($c = 0; $c < $_POST["no_of_coupon"]; $c++) { $user_coup = wp_generate_password(3, false); $sys_gen_coupon .= $post->ID . $user_coup . ","; } $sys_gen_coupon = trim($sys_gen_coupon, ","); } else { $sys_gen_coupon = $single_coupon_code; } update_post_meta($post->ID, "coupon_code", $sys_gen_coupon); } else { $totcop = $_POST["coupon_code"]; if ($_POST["used_coupon_code"] != "") { $totcop .= "," . $_POST["used_coupon_code"]; } $totalcpoarr = explode(",", $totcop); if (sizeof($totalcpoarr) == $_POST["no_of_coupon"]) { } elseif ($_POST["no_of_coupon"] > sizeof($totalcpoarr)) { $totorigcop = $_POST["coupon_code"]; $extra_coupon = $_POST["no_of_coupon"] - sizeof($totalcpoarr); for ($c = 0; $c < $extra_coupon; $c++) { $user_coup = wp_generate_password(3, false); $sys_gen_coupon .= $post->ID . $user_coup . ","; } $sys_gen_coupon = trim($sys_gen_coupon, ","); $addextra = $totorigcop . "," . $sys_gen_coupon; update_post_meta($post->ID, "coupon_code", $addextra); } } } if ($_POST["used_coupon_code"] != "") { update_post_meta($post->ID, "used_coupon_code", $_POST["used_coupon_code"]); } else { delete_post_meta($post->ID, "used_coupon_code", $_POST["used_coupon_code"]); } if ($_POST["coupon_address"] != "") { update_post_meta($post->ID, "coupon_address", $_POST["coupon_address"]); } else { delete_post_meta($post->ID, "coupon_address", $_POST["coupon_address"]); } if ($_POST["coupon_link"] != "") { update_post_meta($post->ID, "coupon_link", $_POST["coupon_link"]); } else { delete_post_meta($post->ID, "coupon_link", $_POST["coupon_link"]); } if ($_POST["file_name"] != "") { update_post_meta($post->ID, "file_name", $_POST["file_name"]); } else { delete_post_meta($post->ID, "file_name", $_POST["file_name"]); } if ($_POST["coupon_start_date"] != "" && $_POST["coupon_start_time_hh"] != "" && $_POST["coupon_start_time_mm"] != "" && $_POST["coupon_start_time_ss"] != "") { //echo $_POST["coupon_start_date"]." ".$_POST["coupon_start_time_hh"].":".$_POST["coupon_start_time_mm"].":".$_POST["coupon_start_time_ss"]; $coupon_start_date_time = strtotime($_POST["coupon_start_date"] . " " . $_POST["coupon_start_time_hh"] . ":" . $_POST["coupon_start_time_mm"] . ":" . $_POST["coupon_start_time_ss"]); update_post_meta($post->ID, "coupon_start_date_time", $coupon_start_date_time); } else { delete_post_meta($post->ID, "coupon_start_date_time", $coupon_start_date_time); } if ($_POST["enddate"] != "" || isset($_POST["enddate"])) { update_post_meta($post->ID, "coupon_end_date_time", ''); update_post_meta($post->ID, "enddate", '0'); if (get_post_meta($post->ID, 'is_expired', true) != '0') { update_post_meta($post->ID, "is_expired", '0'); } } else { if ($_POST["coupon_end_date"] != "" && $_POST["coupon_end_time_hh"] != "" && $_POST["coupon_end_time_mm"] != "" && $_POST["coupon_end_time_ss"] != "") { $_POST["coupon_end_date"] . " " . $_POST["coupon_end_time_hh"] . ":" . $_POST["coupon_end_time_mm"] . ":" . $_POST["coupon_end_time_ss"]; $coupon_end_date_time = strtotime($_POST["coupon_end_date"] . " " . $_POST["coupon_end_time_hh"] . ":" . $_POST["coupon_end_time_mm"] . ":" . $_POST["coupon_end_time_ss"]); update_post_meta($post->ID, "coupon_end_date_time", $coupon_end_date_time); if (get_post_meta($post->ID, 'is_expired', true) != '0') { update_post_meta($post->ID, "is_expired", '0'); } } else { update_post_meta($post->ID, "coupon_end_date_time", ""); } update_post_meta($post->ID, "enddate", ''); } //update_post_meta($post->ID, "is_expired", $_POST["is_expired"]); if ($_POST["is_expired"] != "") { //update_post_meta($post->ID, "is_expired", $_POST["is_expired"]); } else { //update_post_meta($post->ID, "is_expired", '0'); } if ($_POST["our_price"] != "") { update_post_meta($post->ID, "our_price", $_POST["our_price"]); } else { delete_post_meta($post->ID, "our_price", $_POST["our_price"]); } if ($_POST["current_price"] != "") { update_post_meta($post->ID, "current_price", $_POST["current_price"]); } else { delete_post_meta($post->ID, "current_price", $_POST["current_price"]); } global $post, $meta_boxes, $key; if (!wp_verify_nonce($_POST[$key . '_wpnonce'], plugin_basename(__FILE__))) { return $post_id; } if (!current_user_can('edit_post', $post_id)) { return $post_id; } foreach ($meta_boxes as $meta_box) { update_post_meta($post_id, $meta_box['name'], $_POST[$meta_box['name']]); } }
function widget($args, $instance) { // prints the widget extract($args, EXTR_SKIP); $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']); $desc1 = empty($instance['desc1']) ? '' : apply_filters('widget_desc1', $instance['desc1']); ?> <div class="widget contact_widget" id="contact_widget"> <?php if ($title) { ?> <h3><?php echo $title; ?> </h3><?php } ?> <?php if ($_POST && $_POST['contact_widget']) { if ($_POST['your-email']) { $toEmailName = get_option('blogname'); $toEmail = get_site_emailId(); $subject = $_POST['your-subject']; $message = ''; $message .= '<p>Dear ' . $toEmailName . ',</p>'; $message .= '<p>Name : ' . $_POST['your-name'] . ',</p>'; $message .= '<p>Email : ' . $_POST['your-email'] . ',</p>'; $message .= '<p>Message : ' . nl2br($_POST['your-message']) . '</p>'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; // Additional headers $headers .= 'To: ' . $toEmailName . ' <' . $toEmail . '>' . "\r\n"; $headers .= 'From: ' . $_POST['your-name'] . ' <' . $_POST['your-email'] . '>' . "\r\n"; // Mail it templ_sendEmail($_POST['your-email'], $_POST['your-name'], $toEmail, $toEmailName, $subject, $message); if (strstr($_REQUEST['request_url'], '?')) { $url = $_REQUEST['request_url'] . '&msg=success'; } else { $url = $_REQUEST['request_url'] . '?msg=success'; } echo "<script type='text/javascript'>location.href='" . $url . "#contact_widget';</script>"; } else { if (strstr($_REQUEST['request_url'], '?')) { $url = $_REQUEST['request_url'] . '&err=empty'; } else { $url = $_REQUEST['request_url'] . '?err=empty'; } echo "<script type='text/javascript'>location.href='" . $url . "#contact_widget';</script>"; } } if ($_REQUEST['msg'] == 'success') { ?> <p class="success_msg"><?php echo apply_filters('templ_contact_widget_successmsg_filter', __('Thank you, your information is sent successfully.', 'templatic')); ?> </p> <?php } elseif ($_REQUEST['err'] == 'empty') { ?> <p class="error_msg"><?php echo apply_filters('templ_contact_widget_errormsg_filter', __('Please fill out all the fields before submitting.', 'templatic')); ?> </p> <?php } ?> <form action="<?php echo $_SERVER['REQUEST_URI']; ?> " method="post" id="contact_widget_frm" name="contact_frm" class="wpcf7-form"> <input type="hidden" name="contact_widget" value="1" /> <input type="hidden" name="request_url" value="<?php echo $_SERVER['REQUEST_URI']; ?> " /> <div class="form_row "> <label> <?php _e('Name', 'templatic'); ?> <span class="indicates">*</span></label> <input type="text" name="your-name" id="widget_your-name" value="" class="textfield" size="40" /> <span id="widget_your_name_Info" class="error"></span> </div> <div class="form_row "><label><?php _e('Email', 'templatic'); ?> <span class="indicates">*</span></label> <input type="text" name="your-email" id="widget_your-email" value="" class="textfield" size="40" /> <span id="widget_your_emailInfo" class="error"></span> </div> <div class="form_row "><label><?php _e('Subject', 'templatic'); ?> <span class="indicates">*</span></label> <input type="text" name="your-subject" id="widget_your-subject" value="" size="40" class="textfield" /> <span id="widget_your_subjectInfo"></span> </div> <div class="form_row"><label><?php _e('Message', 'templatic'); ?> <span class="indicates">*</span></label> <textarea name="your-message" id="widget_your-message" cols="40" class="textarea textarea2" rows="10"></textarea> <span id="widget_your_messageInfo" class="error"></span> </div> <input type="submit" value="<?php _e('Send', 'templatic'); ?> " class="b_submit" /> </form> <script type="text/javascript" src="<?php echo TT_WIDGETS_FOLDER_URL; ?> contact/contact_validation1.js"></script> </div> <?php }