public static function set_otp() { global $wpdb; $basic_options = new crf_basic_options(); $response = new stdClass(); $response->error = false; $response->show = "#crf_otp_kcontact"; $response->hide = "#crf_otp_kcontact"; $response->reload = false; if (isset($_POST['crf_otp_email'])) { $email = $_POST['crf_otp_email']; } if (isset($_POST['crf_otp_key'])) { $key = $_POST['crf_otp_key']; } // Validate request parameters if (!isset($_POST['security_key'])) { // Validate key if (isset($key)) { $sql = $wpdb->prepare("select * from " . $wpdb->prefix . "crf_users where otp_code=%s", array($key)); $crf_user = $wpdb->get_row($sql); if (empty($crf_user)) { $response->error = true; $response->msg = __('The OTP you entered is invalid. Please enter correct OTP code from the email we sent you, or you can generate a new OTP.', self::$textdomain); } else { self::set_auth_params($key, $crf_user->email); $response->error = false; $response->msg = __('You have successfully logged in using OTP.', self::$textdomain); $response->reload = true; } } else { // Validate email if (is_email($email)) { if (self::is_user($email)) { $basic_options->crf_generate_otp($_POST['crf_otp_email']); $response->msg = __('Success! an email with one time password (OTP) was sent to your email address.', self::$textdomain); } else { $response->error = true; $response->msg = __('Oops! We could not find this email address in our submissions database.', self::$textdomain); } } else { $response->error = true; $response->msg = __('Invalid email format. Please correct and try again.', self::$textdomain); } } } echo json_encode($response); exit; }
<?php /*Controls custom field creation in the dashboard area*/ global $wpdb; $textdomain = 'custom-registration-form-builder-with-submission-manager'; $crf_option = $wpdb->prefix . "crf_option"; $path = plugin_dir_url(__FILE__); $autoresponder_options = new crf_basic_options(); if (isset($_REQUEST['saveoption'])) { $retrieved_nonce = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($retrieved_nonce, 'save_crf_auto_responder_setting')) { die('Failed security check'); } if (!isset($_REQUEST['admin_notification'])) { $_REQUEST['admin_notification'] = 'no'; } $autoresponder_options->crf_add_option('adminnotification', $_REQUEST['admin_notification']); //echo implode(',',$_REQUEST['optionvalue']);die; $autoresponder_options->crf_add_option('adminemail', rtrim(implode(',', $_REQUEST['optionvalue']), ',')); $autoresponder_options->crf_add_option('from_email', $_REQUEST['from_email']); wp_redirect('admin.php?page=crf_settings'); exit; } $admin_email = $autoresponder_options->crf_get_global_option_value('adminemail'); $from_email = $autoresponder_options->crf_get_global_option_value('from_email'); ?> <div class="crf-main-form"> <div class="crf-form-heading"> <h1><?php _e('Email Notification', $textdomain); ?>
<?php /*Controls custom field creation in the dashboard area*/ global $wpdb; $textdomain = 'custom-registration-form-builder-with-submission-manager'; $crf_option = $wpdb->prefix . "crf_option"; $path = plugin_dir_url(__FILE__); $thirdparty_options = new crf_basic_options(); if (isset($_REQUEST['saveoption'])) { $retrieved_nonce = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($retrieved_nonce, 'save_crf_thirdparty_setting')) { die('Failed security check'); } if (!isset($_REQUEST['enable_mailchimp'])) { $_REQUEST['enable_mailchimp'] = 'no'; } if (!isset($_REQUEST['enable_facebook'])) { $_REQUEST['enable_facebook'] = 'no'; } $thirdparty_options->crf_add_option('enable_facebook', $_REQUEST['enable_facebook']); $thirdparty_options->crf_add_option('facebook_app_id', $_REQUEST['facebook_app_id']); $thirdparty_options->crf_add_option('facebook_app_secret', $_REQUEST['facebook_app_secret']); $thirdparty_options->crf_add_option('enable_mailchimp', $_REQUEST['enable_mailchimp']); $thirdparty_options->crf_add_option('mailchimp_key', $_REQUEST['mailchimp_key']); wp_redirect('admin.php?page=crf_settings'); exit; } $facebook_app_id = $thirdparty_options->crf_get_global_option_value('facebook_app_id'); $facebook_app_secret = $thirdparty_options->crf_get_global_option_value('facebook_app_secret'); $mailchimp_key = $thirdparty_options->crf_get_global_option_value('mailchimp_key'); ?>
<?php if (isset($_POST['form_id']) && isset($_POST['submission_id']) && isset($_POST['print_pdf'])) { global $wpdb; global $current_user; $s_id = $_POST['submission_id']; $f_id = $_POST['form_id']; include ABSPATH . 'wp-includes/pluggable.php'; include_once plugin_dir_path(__FILE__) . "classes/class_front_utility.php"; include_once plugin_dir_path(__FILE__) . "classes/class_basic_options.php"; $basic_options = new crf_basic_options(); $from_email = $basic_options->crf_get_from_email(); $form = Front_Utility::get_form_by_submission($s_id); $form_name = strtolower(str_replace(' ', '_', $form->form_name)); $pdf_name = $form_name . ".pdf"; $results = $wpdb->get_results("select `field`,`value` FROM `" . $wpdb->prefix . "crf_submissions` where form_id = '" . $f_id . "' and submission_id = '" . $s_id . "'"); $content = '<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"> <link rel="stylesheet" type="text/css" href="' . plugin_dir_url(__FILE__) . 'css/crf_front.css"> <style> body { font-family:dejavusans;} .crf_f_msg{text-align: center;width:50%} </style> </head> <body>'; require_once "dompdf/dompdf_config.inc.php"; $content .= '<div id="crf_submission_container" class="crf_containers">'; $content .= '<h2 class = "crf_f_title">' . ucwords($form->form_name) . '<br/></h2><hr/>'; foreach ($results as $result) {
<?php global $current_user; $submissions = Front_Utility::get_submissions_by_email(); $basic_options = new crf_basic_options(); if (isset($_COOKIE['crf_autorized_email'])) { $email = $_COOKIE['crf_autorized_email']; } get_currentuserinfo(); if (!empty($current_user->user_email)) { $email = $current_user->user_email; } if (empty($submissions)) { ?> <div id='crf_f_empty'><?php _e('We have no submission records from your email address.', Front_Utility::$textdomain); ?> </div> <?php } else { ?> <div id="crf_f_submissions_container" class="crf_containers"> <div id="crf_f_tabs"> <div id="tab_titles"><!--tabs to toggle between submission and payment--><!----> <div id="crf_f_head1" class="crf_f_tab"> <div class="crf_tabHeadTitle"> <?php _e('My Submissions', Front_Utility::$textdomain); ?> </div> </div>
<?php /*Controls custom field creation in the dashboard area*/ global $wpdb; $textdomain = 'custom-registration-form-builder-with-submission-manager'; $crf_option = $wpdb->prefix . "crf_option"; $path = plugin_dir_url(__FILE__); $useraccount_options = new crf_basic_options(); if (isset($_REQUEST['saveoption'])) { $retrieved_nonce = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($retrieved_nonce, 'save_crf_user_account_setting')) { die('Failed security check'); } if (!isset($_REQUEST['send_password'])) { $_REQUEST['send_password'] = '******'; } if (!isset($_REQUEST['autogenerate_pass'])) { $_REQUEST['autogenerate_pass'] = '******'; } $useraccount_options->crf_add_option('autogeneratedepass', $_REQUEST['autogenerate_pass']); $useraccount_options->crf_add_option('send_password', $_REQUEST['send_password']); wp_redirect('admin.php?page=crf_settings'); exit; } ?> <div class="crf-main-form"> <div class="crf-form-heading"> <h1><?php _e('User Accounts', $textdomain); ?> </h1>
<?php global $wpdb; $textdomain = 'custom-registration-form-builder-with-submission-manager'; $crf_forms = $wpdb->prefix . "crf_forms"; $crf_fields = $wpdb->prefix . "crf_fields"; $path = plugin_dir_url(__FILE__); $crf_basic_options = new crf_basic_options(); $qrylastrow = "select count(*) from {$crf_fields} where Form_Id = '" . $_REQUEST['formid'] . "'"; $lastrow = $wpdb->get_var($qrylastrow); $ordering = $lastrow + 1; if (isset($_REQUEST['type'])) { $str = $_REQUEST['type']; } if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') { $retrieved_nonce = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($retrieved_nonce, 'delete_crf_field')) { die('Failed security check'); } $qry = "delete from {$crf_fields} where Id=" . $_REQUEST['id']; $reg = $wpdb->query($qry); wp_redirect('admin.php?page=crf_manage_form_fields&form_id=' . $_REQUEST['formid']); exit; } if (isset($_REQUEST['id'])) { $qry = "select * from {$crf_fields} where Id=" . $_REQUEST['id']; $reg = $wpdb->get_row($qry); $str = $reg->Type; } if (isset($_POST['field_submit']) && empty($_POST['field_id'])) { $retrieved_nonce = $_REQUEST['_wpnonce'];
<?php /*Controls custom field creation in the dashboard area*/ global $wpdb; $textdomain = 'custom-registration-form-builder-with-submission-manager'; $crf_option = $wpdb->prefix . "crf_option"; $path = plugin_dir_url(__FILE__); $anti_spam_options = new crf_basic_options(); if (isset($_REQUEST['saveoption'])) { $retrieved_nonce = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($retrieved_nonce, 'save_crf_antispam_setting')) { die('Failed security check'); } if (!isset($_REQUEST['enable_captcha'])) { $_REQUEST['enable_captcha'] = 'no'; } $anti_spam_options->crf_add_option('enable_captcha', $_REQUEST['enable_captcha']); $anti_spam_options->crf_add_option('public_key', $_REQUEST['publickey']); $anti_spam_options->crf_add_option('private_key', $_REQUEST['privatekey']); update_option('ucf_enable_captcha_login', $_POST['enable_captcha_login']); update_option('crf_recaptcha_lang', $_POST['crf_recaptcha_lang']); wp_redirect('admin.php?page=crf_settings'); exit; } $public_key = $anti_spam_options->crf_get_global_option_value('public_key'); $private_key = $anti_spam_options->crf_get_global_option_value('private_key'); ?> <div class="crf-main-form"> <div class="crf-form-heading"> <h1> <?php
function crf_update_db_check() { global $crf_db_version; global $wpdb; $crf_option = $wpdb->prefix . "crf_option"; $crf_users = $wpdb->prefix . "crf_users"; $crf_submissions = $wpdb->prefix . "crf_submissions"; $save_db_version = floatval(get_site_option('crf_db_version', '1.0')); if ($save_db_version < $crf_db_version) { update_option('crf_whatsnewpage', 0); $insert = "INSERT IGNORE INTO {$crf_option} VALUES\r\n\t\t(6, 'adminemail', ''),\r\n\t\t(7, 'adminnotification', 'no')"; $wpdb->query($insert); $insert = "INSERT IGNORE INTO {$crf_option} VALUES\r\n\t\t(8, 'from_email', '')"; $wpdb->query($insert); $insert = "INSERT IGNORE INTO {$crf_option} VALUES\r\n\t\t(9, 'userip', 'no')"; $wpdb->query($insert); $qry = "select `value` from {$crf_option} where fieldname='crf_theme'"; $crf_theme = $wpdb->get_var($qry); if (isset($crf_theme) && $crf_theme != "") { if ($crf_theme == 'default') { $wpdb->query("update {$crf_option} set value='classic' where fieldname='crf_theme'"); } else { $wpdb->query("update {$crf_option} set value='default' where fieldname='crf_theme'"); } } $insert = "INSERT IGNORE INTO {$crf_option} VALUES\r\n\t\t(10, 'crf_theme', 'default')"; $wpdb->query($insert); $insert = "INSERT IGNORE INTO {$crf_option} VALUES\r\n\t\t(11, 'enable_social', 'no')"; $wpdb->query($insert); $insert = "INSERT IGNORE INTO {$crf_option} VALUES\r\n\t\t(12, 'facebook_app_id', '')"; $wpdb->query($insert); $insert = "INSERT IGNORE INTO {$crf_option} VALUES\r\n\t\t(13, 'facebook_app_secret', '')"; $wpdb->query($insert); $insert = "INSERT IGNORE INTO {$crf_option} VALUES\r\n\t\t(14, 'enable_facebook', 'no')"; $wpdb->query($insert); $insert = "INSERT IGNORE INTO {$crf_option} VALUES\r\n\t\t(15, 'enable_twitter', 'no')"; $wpdb->query($insert); $insert = "INSERT IGNORE INTO {$crf_option} VALUES\r\n\t\t(16, 'consumer_key', '')"; $wpdb->query($insert); $insert = "INSERT IGNORE INTO {$crf_option} VALUES\r\n\t\t(17, 'consumer_secret', '')"; $wpdb->query($insert); $insert = "INSERT IGNORE INTO {$crf_option} VALUES\r\n\t\t(18, 'send_password', 'yes')"; $wpdb->query($insert); $insert = "INSERT IGNORE INTO {$crf_option} VALUES\r\n\t\t(19, 'enable_mailchimp', 'no')"; $wpdb->query($insert); $insert = "INSERT IGNORE INTO {$crf_option} VALUES\r\n\t\t(20, 'mailchimp_key', '')"; $wpdb->query($insert); require_once ABSPATH . 'wp-admin/includes/upgrade.php'; $crf_stats = $wpdb->prefix . "crf_stats"; $sqlcreate = "CREATE TABLE IF NOT EXISTS {$crf_stats}\r\n\t\t(\r\n\t\t\t`id` int NOT NULL AUTO_INCREMENT,\r\n\t\t\t`form_id` int(11),\r\n\t\t\t`stats_key` varchar(255),\r\n\t\t\t`details` longtext,\r\n\t\t\tPRIMARY KEY(id)\r\n\t\t)"; dbDelta($sqlcreate); $sqlcreate = "CREATE TABLE IF NOT EXISTS {$crf_users} (\r\n\t\t\t\t \t\t`Id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t \t\t`email` varchar(255) NOT\t NULL,\r\n\t\t\t\t \t\t`otp_code` varchar(255) NOT NULL,\r\n\t\t\t \t\t`last_activity_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\r\n\t\t\t \t\t`created_date` timestamp, \r\n\t\t\t\t \t\tPRIMARY KEY (`Id`))"; dbDelta($sqlcreate); crf_f_create_sub_page(); $sqlcreate = "CREATE TABLE IF NOT EXISTS {$crf_submissions} (\r\n\t\t\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\r\n \t\t\t\t\t\t`submission_id` int(11),\r\n \t\t\t\t\t\t`form_id` int(11),\r\n \t\t\t\t\t\t`field` text,\r\n \t\t\t\t\t\t`value` longtext,\r\n\t\t\t\t\t\tPRIMARY KEY(id)\r\n\t\t\t\t\t\t)"; dbDelta($sqlcreate); $crf_paypal_fields = $wpdb->prefix . "crf_paypal_fields"; $sqlcreate = "CREATE TABLE IF NOT EXISTS {$crf_paypal_fields} (\r\n\t\t `Id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t `Type` varchar(50) DEFAULT NULL,\r\n\t\t `Name` varchar(256) NOT NULL,\r\n\t\t `Value` longtext DEFAULT NULL,\r\n\t\t `Class` varchar(256) DEFAULT NULL,\r\n\t\t `Option_Label` longtext DEFAULT NULL,\r\n\t\t `Option_Price` longtext DEFAULT NULL,\r\n\t\t `Option_Value` longtext DEFAULT NULL,\r\n\t\t `Description` longtext DEFAULT NULL,\r\n\t\t `Require` varchar(256) DEFAULT NULL,\r\n\t\t `Ordering` int(11) DEFAULT NULL,\r\n\t\t `extra_options` longtext DEFAULT NULL,\r\n\t\t PRIMARY KEY (`Id`))"; dbDelta($sqlcreate); $crf_paypal_log = $wpdb->prefix . "crf_paypal_log"; $crf_purchases = $wpdb->prefix . "crf_purchases"; $sqlcreate = "CREATE TABLE IF NOT EXISTS {$crf_purchases} (\r\n\t `id` int(11) NOT NULL auto_increment,\r\n\t `invoice` varchar(300) NOT NULL,\r\n\t `trasaction_id` varchar(600) NOT NULL,\r\n\t `log_id` int(10) NOT NULL,\r\n\t `product_id` varchar(300) NOT NULL,\r\n\t `product_name` varchar(300) NOT NULL,\r\n\t `product_quantity` varchar(300) NOT NULL,\r\n\t `product_amount` varchar(300) NOT NULL,\r\n\t `payer_fname` varchar(300) NOT NULL,\r\n\t `payer_lname` varchar(300) NOT NULL,\r\n\t `payer_address` varchar(300) NOT NULL,\r\n\t `payer_city` varchar(300) NOT NULL,\r\n\t `payer_state` varchar(300) NOT NULL,\r\n\t `payer_zip` varchar(300) NOT NULL,\r\n\t `payer_country` varchar(300) NOT NULL,\r\n\t `payer_email` text NOT NULL,\r\n\t `payment_status` varchar(300) NOT NULL,\r\n\t `posted_date` datetime NOT NULL,\r\n\t PRIMARY KEY (`Id`))"; dbDelta($sqlcreate); $sqlcreate = "CREATE TABLE IF NOT EXISTS {$crf_paypal_log} (\r\n\t `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t `txn_id` varchar(600) NOT NULL,\r\n\t `log` longtext NOT NULL,\r\n\t `posted_date` datetime NOT NULL,\r\n\t PRIMARY KEY (`Id`))"; dbDelta($sqlcreate); $crf_notes = $wpdb->prefix . "crf_notes"; $sqlcreate = "CREATE TABLE IF NOT EXISTS {$crf_notes} (\r\n\t `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t `submission_id` int(11) NOT NULL,\r\n\t `userid` int(11) DEFAULT NULL,\r\n\t `useremail` varchar(255) DEFAULT NULL,\r\n\t `type` longtext NOT NULL,\r\n\t `status` varchar(255) DEFAULT NULL,\r\n\t `publish_date` datetime NOT NULL,\r\n\t `last_edit_date` datetime DEFAULT NULL,\r\n\t `last_edited_by` varchar(255) DEFAULT NULL,\r\n `notes` longtext DEFAULT NULL,\r\n\t `bg_color` varchar(255) DEFAULT NULL,\r\n\t `extra_option` longtext DEFAULT NULL, \r\n\t PRIMARY KEY (`Id`))"; dbDelta($sqlcreate); $crf_forms = $wpdb->prefix . "crf_forms"; $crf_fields = $wpdb->prefix . "crf_fields"; $crfform = $wpdb->get_row("SELECT * FROM {$crf_forms}"); //Add column if not present. if (!isset($crfform->form_option)) { $wpdb->query("ALTER TABLE {$crf_forms} ADD form_option longtext"); } //Add column if not present. if (!isset($crf_fields->Field_Key)) { $wpdb->query("ALTER TABLE {$crf_fields} ADD Field_Key varchar(256) DEFAULT NULL"); $crf_basic_options = new crf_basic_options(); $crf_basic_options->crf_assign_key_for_previous_field(); } $wpdb->query("ALTER TABLE {$crf_forms} CHANGE `success_message` `success_message` LONGTEXT"); $wpdb->query("ALTER TABLE {$crf_paypal_fields} CHANGE `Option_Label` `Option_Label` LONGTEXT"); $wpdb->query("ALTER TABLE {$crf_paypal_fields} CHANGE `Option_Price` `Option_Price` LONGTEXT"); $wpdb->query("ALTER TABLE {$crf_paypal_fields} CHANGE `Option_Value` `Option_Value` LONGTEXT"); $wpdb->query("ALTER TABLE {$crf_fields} CHANGE `Option_Value` `Option_Value` LONGTEXT"); $submissions = get_site_option('crf_migrate_submission', 'no'); if ($submissions == 'no') { update_option("crf_db_version", $crf_db_version); wp_redirect('admin.php?page=crf_migrate_submission'); exit; } else { update_option("crf_db_version", $crf_db_version); } } $whatsnew = get_site_option('crf_whatsnewpage', 0); if ($whatsnew == 0) { update_option('crf_whatsnewpage', 1); wp_redirect('admin.php?page=crf_whats_new'); exit; } }
<?php /*Controls custom field creation in the dashboard area*/ global $wpdb; $textdomain = 'custom-registration-form-builder-with-submission-manager'; $crf_option = $wpdb->prefix . "crf_option"; $path = plugin_dir_url(__FILE__); $general_options = new crf_basic_options(); if (isset($_REQUEST['saveoption'])) { $retrieved_nonce = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($retrieved_nonce, 'save_crf_general_setting')) { die('Failed security check'); } if (!isset($_REQUEST['send_password'])) { $_REQUEST['send_password'] = '******'; } if (!isset($_REQUEST['userip'])) { $_REQUEST['userip'] = 'no'; } $general_options->crf_add_option('userip', $_REQUEST['userip']); $general_options->crf_add_option('crf_theme', $_REQUEST['crf_theme']); update_option('ucf_default_Registration_url', $_POST['default_registration_url']); update_option('ucf_redirect_after_login', $_POST['redirect_after_login']); wp_redirect('admin.php?page=crf_settings'); exit; } $crf_theme = $general_options->crf_get_global_option_value('crf_theme'); ?> <div class="crf-main-form"> <div class="crf-form-heading"> <h1>
<?php /*Controls custom field creation in the dashboard area*/ global $wpdb; $textdomain = 'custom-registration-form-builder-with-submission-manager'; $crf_forms = $wpdb->prefix . "crf_forms"; $path = plugin_dir_url(__FILE__); require_once 'crf_functions.php'; $crf_basic_options = new crf_basic_options(); if (isset($_POST['submit_form']) && trim($_POST['form_name']) != "") { $retrieved_nonce = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($retrieved_nonce, 'save_crf_add_form')) { die('Failed security check'); } $formoptions = array(); $formoptions['submit_button_label'] = $_POST['submit_button_label']; $formoptions['submit_button_color'] = $_POST['submit_button_color']; $formoptions['submit_button_bgcolor'] = $_POST['submit_button_bgcolor']; $formoptions['mailchimp_list'] = $_POST['mailchimp_list']; $formoptions['auto_expires'] = $_POST['auto_expires']; $formoptions['expiry_type'] = $_POST['expiry_type']; $formoptions['submission_limit'] = $_POST['submission_limit']; $formoptions['expiry_date'] = $_POST['expiry_date']; $formoptions['expiry_message'] = $_POST['expiry_message']; $formoptions['mailchimp_emailfield'] = $_POST['mailchimp_emailfield']; $formoptions['mailchimp_firstfield'] = $_POST['mailchimp_firstfield']; $formoptions['mailchimp_lastfield'] = $_POST['mailchimp_lastfield']; $formoptions['optin_box'] = $_POST['optin_box']; $formoptions['optin_box_text'] = $_POST['optin_box_text']; if (isset($_POST['form_type'])) { $formtype = $_POST['form_type'];