public function execute($id = '', $startdate = '', $enddate = '', $submit_date = '', $submitter_ip = '', $username = '', $useremail = '', $form_fields = '', $show = '')
 {
     require_once WD_FM_DIR . '/framework/WDW_FM_Library.php';
     $task = WDW_FM_Library::get('action');
     if (method_exists($this, $task) && $task != 'display') {
         return $this->{$task}();
     } else {
         return $this->display((int) $id, $startdate, $enddate, $submit_date, $submitter_ip, $username, $useremail, $form_fields, $show);
     }
 }
 public function delete_all()
 {
     global $wpdb;
     $flag = FALSE;
     $ips_id_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . 'formmaker_blocked');
     foreach ($ips_id_col as $ip_id) {
         if (isset($_POST['check_' . $ip_id])) {
             $flag = TRUE;
             $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'formmaker_blocked WHERE id="%d"', $ip_id));
         }
     }
     if ($flag) {
         $message = 5;
     } else {
         $message = 2;
     }
     // $this->display();
     $page = WDW_FM_Library::get('page');
     WDW_FM_Library::fm_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
 }
Ejemplo n.º 3
0
    public function form_options($id)
    {
        $row = $this->model->get_row_data($id);
        $themes = $this->model->get_theme_rows_data();
        $queries = $this->model->get_queries_rows_data($id);
        $userGroups = get_editable_roles();
        $page_title = $row->title . ' form options';
        $label_id = array();
        $label_label = array();
        $label_type = array();
        $label_all = explode('#****#', $row->label_order_current);
        $label_all = array_slice($label_all, 0, count($label_all) - 1);
        foreach ($label_all as $key => $label_each) {
            $label_id_each = explode('#**id**#', $label_each);
            array_push($label_id, $label_id_each[0]);
            $label_order_each = explode('#**label**#', $label_id_each[1]);
            array_push($label_label, $label_order_each[0]);
            array_push($label_type, $label_order_each[1]);
        }
        $fields = explode('*:*id*:*type_submitter_mail*:*type*:*', $row->form_fields);
        $fields_count = count($fields);
        ?>
    <script>
      gen = "<?php 
        echo $row->counter;
        ?>
";
      form_view_max = 20;
      function set_preview() {
        jQuery("#preview_form").attr("href", '<?php 
        echo add_query_arg(array('action' => 'FormMakerPreview', 'form_id' => $row->id), admin_url('admin-ajax.php'));
        ?>
&test_theme=' + jQuery("#theme").val() + '&width=1000&height=500&TB_iframe=1');
        jQuery("#edit_css").attr("href", '<?php 
        echo add_query_arg(array('action' => 'FormMakerEditCSS', 'form_id' => $row->id), admin_url('admin-ajax.php'));
        ?>
&id=' + jQuery("#theme").val() + '&width=800&height=500&TB_iframe=1');
      }
		function set_condition() {
			field_condition = '';
			for(i=0;i<500;i++) {
				conditions = '';
				if(document.getElementById("condition"+i)) {
					field_condition+=document.getElementById("show_hide"+i).value+"*:*show_hide*:*";
					field_condition+=document.getElementById("fields"+i).value+"*:*field_label*:*";
					field_condition+=document.getElementById("all_any"+i).value+"*:*all_any*:*";
					for(k=0;k<500;k++) {
						if(document.getElementById("condition_div"+i+"_"+k)) {
							conditions+=document.getElementById("field_labels"+i+"_"+k).value+"***";
							conditions+=document.getElementById("is_select"+i+"_"+k).value+"***";
							if(document.getElementById("field_value"+i+"_"+k).tagName=="SELECT" ) {
								if(document.getElementById("field_value"+i+"_"+k).getAttribute('multiple')) {
									var sel = document.getElementById("field_value"+i+"_"+k);
									var selValues = '';
									for(m=0; m < sel.length; m++) {
										if(sel.options[m].selected)
										
										selValues += sel.options[m].value+"@@@";
									}
									conditions+=selValues;
								} else {
									conditions+=document.getElementById("field_value"+i+"_"+k).value;
								}								
							}
							else
								conditions+=document.getElementById("field_value"+i+"_"+k).value;
							conditions+="*:*next_condition*:*";
						}
					}
					field_condition+=conditions;
					field_condition+="*:*new_condition*:*";
				}
			}
			document.getElementById('condition').value = field_condition;
		}      
    
		function show_verify_options(s){
			if(s){
				jQuery(".verification_div").removeAttr( "style" );
				jQuery(".expire_link").removeAttr( "style" );
					
			} else{
				jQuery(".verification_div").css( 'display', 'none' );
				jQuery(".expire_link").css( 'display', 'none' );
			}
		}      
    </script>
    <style>
    .CodeMirror {
      border: 1px solid #ccc;
      font-size: 12px;
      margin-bottom: 6px;
      background: white;
    }
    </style>
    <div style="clear: both; float: left; width: 99%;">
      <div style="float:left; font-size: 14px; font-weight: bold;">
        This section allows you to edit form options.
        <a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-3.html">Read More in User Manual</a>
      </div>
      <div style="float: right; text-align: right;">
        <a style="text-decoration: none;" target="_blank" href="https://web-dorado.com/files/fromFormMaker.php">
          <img width="215" border="0" alt="web-dorado.com" src="<?php 
        echo WD_FM_URL . '/images/wd_logo.png';
        ?>
" />
        </a>
      </div>
    </div>
    <form class="wrap" method="post" action="admin.php?page=manage_fm" style="float: left; width: 99%;" name="adminForm" id="adminForm">
      <?php 
        wp_nonce_field('nonce_fm', 'nonce_fm');
        ?>
      <h2><?php 
        echo $page_title;
        ?>
</h2>
      <div style="float: right; margin: 0 5px 0 0;">
        <input class="button-secondary" type="submit" onclick="if (fm_check_email('mailToAdd') ||
                                                                   fm_check_email('from_mail') ||
                                                                   fm_check_email('reply_to') ||
                                                                   fm_check_email('mail_from_user') ||
                                                                   fm_check_email('reply_to_user') ||
                                                                   fm_check_email('mail_from_other') ||
                                                                   fm_check_email('reply_to_other') ||
                                                                   fm_check_email('paypal_email')) {return false;}; set_condition(); fm_set_input_value('task', 'save_options')" value="Save"/>
        <input class="button-secondary" type="submit" onclick="if (fm_check_email('mailToAdd') ||
                                                                   fm_check_email('from_mail') ||
                                                                   fm_check_email('reply_to') ||
                                                                   fm_check_email('mail_from_user') ||
                                                                   fm_check_email('reply_to_user') ||
                                                                   fm_check_email('mail_from_other') ||
                                                                   fm_check_email('reply_to_other') ||
                                                                   fm_check_email('paypal_email')) {return false;}; set_condition(); fm_set_input_value('task', 'apply_options')" value="Apply"/>
        <input class="button-secondary" type="submit" onclick="fm_set_input_value('task', 'cancel_options')" value="Cancel"/>
      </div>
      <div class="submenu-box" style="width: 99%; float: left; margin: 15px 0 0 0;">
        <div class="submenu-pad">
          <ul id="submenu" class="configuration">
            <li>
              <a id="general" class="fm_fieldset_tab" onclick="form_maker_options_tabs('general')" href="#">General Options</a>
            </li>
            <li>
              <a id="custom" class="fm_fieldset_tab" onclick="form_maker_options_tabs('custom')" href="#">Email Options</a>
            </li>
            <li>
              <a id="actions" class="fm_fieldset_tab" onclick="form_maker_options_tabs('actions')" href="#">Actions after Submission</a>
            </li>
            <li>
              <a id="payment" class="fm_fieldset_tab" onclick="form_maker_options_tabs('payment')" href="#">Payment Options</a>
            </li>
            <li>
              <a id="javascript" class="fm_fieldset_tab" onclick="form_maker_options_tabs('javascript'); codemirror_for_javascript();" href="#">JavaScript</a>
            </li>
            <li>
              <a id="conditions" class="fm_fieldset_tab" onclick="form_maker_options_tabs('conditions')" href="#">Conditional Fields</a>
            </li>
            <li>
              <a id="mapping" class="fm_fieldset_tab" onclick="form_maker_options_tabs('mapping')" href="#" >MySQL Mapping</a>
            </li>
          </ul>
        </div>
      </div>
      <fieldset id="general_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color:#0B55C4;font-weight: bold;">General Options</legend>
        <table class="admintable">
          <tr valign="top">
            <td class="fm_options_label">
              <label>Published</label>
            </td>
            <td class="fm_options_value">
              <input type="radio" name="published" id="published_yes" value="1" <?php 
        echo $row->published ? "checked" : "";
        ?>
 /><label for="published_yes">Yes</label>
              <input type="radio" name="published" id="published_no" value="0" <?php 
        echo !$row->published ? "checked" : "";
        ?>
 /><label for="published_no">No</label>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label>Save data(to database)</label>
            </td>
            <td class="fm_options_value">
              <input type="radio" name="savedb" id="savedb_yes" value="1" <?php 
        echo $row->savedb ? "checked" : "";
        ?>
 /><label for="savedb_yes">Yes</label>
              <input type="radio" name="savedb" id="savedb_no" value="0" <?php 
        echo !$row->savedb ? "checked" : "";
        ?>
 /><label for="savedb_no">No</label>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label for="theme">Theme</label>
            </td>
            <td class="fm_options_value">
              <select id="theme" name="theme" style="width:260px;" onChange="set_preview()">
                <?php 
        foreach ($themes as $theme) {
            ?>
                  <option value="<?php 
            echo $theme->id;
            ?>
" <?php 
            echo $theme->id == $row->theme ? 'selected' : '';
            ?>
><?php 
            echo $theme->title;
            ?>
</option>
                  <?php 
        }
        ?>
              </select>
              
              <a href="<?php 
        echo add_query_arg(array('action' => 'FormMakerEditCSS', 'id' => $row->theme, 'form_id' => $row->id, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
        ?>
" class="button-secondary thickbox thickbox-preview" id="edit_css" title="Edit CSS" onclick="return false;">
                Edit CSS
              </a>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label for="requiredmark">Required fields mark</label>
            </td>
            <td class="fm_options_value">
              <input type="text" id="requiredmark" name="requiredmark" value="<?php 
        echo $row->requiredmark;
        ?>
" style="width:250px;" />
            </td>
          </tr>
        </table>
        <div class="error_fm" style="padding: 5px; font-size: 14px;">Front end submissions are disabled in free version.</div>
        <fieldset class="adminform">
          <legend style="color:#0B55C4;font-weight: bold;">Front end submissions access level</legend>
          <table>
            <tr>
              <td class="key">
                <label for="name">
                  Allow User to see submissions:
                </label>
              </td>
              <td>
                <?php 
        $checked_UserGroup = explode(',', $row->user_id_wd);
        $i = 0;
        foreach ($userGroups as $val => $uG) {
            echo '<input disabled="disabled" type="checkbox" value="' . $val . '"  id="user_' . $i . '"';
            if (in_array($val, $checked_UserGroup)) {
                echo 'checked="checked"';
            }
            echo 'onchange="acces_level(' . count($userGroups) . ')"/><label for="user_' . $i . '">' . $uG["name"] . '</label><br>';
            $i++;
        }
        ?>
                <input disabled="disabled" type="checkbox" value="guest"  id="user_<?php 
        echo $i;
        ?>
" onchange="acces_level(<?php 
        echo count($userGroups);
        ?>
)"<?php 
        echo in_array('guest', $checked_UserGroup) ? 'checked="checked"' : '';
        ?>
/><label for="user_<?php 
        echo $i;
        ?>
">Guest</label>
                <input disabled="disabled" type="hidden" name="user_id_wd" value="<?php 
        echo $row->user_id_wd;
        ?>
" id="user_id_wd" />
              </td>
            </tr>              
          </table>
        </fieldset>
        <?php 
        $labels_for_submissions = $this->model->get_labels($id);
        $payment_info = $this->model->is_paypal($id);
        $labels_id_for_submissions = array();
        $label_titles_for_submissions = array();
        $labels_type_for_submissions = array();
        if ($labels_for_submissions) {
            $label_id_for_submissions = array();
            $label_order_original_for_submissions = array();
            $label_type_for_submissions = array();
            if (strpos($row->label_order, 'type_paypal_')) {
                $row->label_order = $row->label_order . "item_total#**id**#Item Total#**label**#type_paypal_payment_total#****#total#**id**#Total#**label**#type_paypal_payment_total#****#0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
            }
            $label_all_for_submissions = explode('#****#', $row->label_order);
            $label_all_for_submissions = array_slice($label_all_for_submissions, 0, count($label_all_for_submissions) - 1);
            foreach ($label_all_for_submissions as $key => $label_each) {
                $label_id_each = explode('#**id**#', $label_each);
                array_push($label_id_for_submissions, $label_id_each[0]);
                $label_order_each = explode('#**label**#', $label_id_each[1]);
                array_push($label_order_original_for_submissions, $label_order_each[0]);
                array_push($label_type_for_submissions, $label_order_each[1]);
            }
            foreach ($label_id_for_submissions as $key => $label) {
                if (in_array($label, $labels_for_submissions)) {
                    array_push($labels_type_for_submissions, $label_type_for_submissions[$key]);
                    array_push($labels_id_for_submissions, $label);
                    array_push($label_titles_for_submissions, $label_order_original_for_submissions[$key]);
                }
            }
        }
        $stats_labels = array();
        $stats_labels_ids = array();
        foreach ($labels_type_for_submissions as $key => $label_type_cur) {
            if ($label_type_cur == "type_checkbox" || $label_type_cur == "type_radio" || $label_type_cur == "type_own_select" || $label_type_cur == "type_country" || $label_type_cur == "type_paypal_select" || $label_type_cur == "type_paypal_radio" || $label_type_cur == "type_paypal_checkbox" || $label_type_cur == "type_paypal_shipping") {
                $stats_labels_ids[] = $labels_id_for_submissions[$key];
                $stats_labels[] = $label_titles_for_submissions[$key];
            }
        }
        ?>
        <script type="text/javascript">
          function inArray(needle, myarray) {
            var length = myarray.length;
            for(var i = 0; i < length; i++) {
                if(myarray[i] == needle) return true;
            }
            return false;
          }

          function checked_labels(class_name) {
            var checked_ids ='';            
            jQuery('.'+class_name).each(function() {
              if(this.checked) {
                checked_ids += this.value+',';		
              }
            });              
            if(class_name == 'filed_label') {
              document.getElementById("frontend_submit_fields").value = checked_ids ;
              if(checked_ids == document.getElementById("all_fields").value)
                document.getElementById("all_fields").checked = true;
              else
                document.getElementById("all_fields").checked = false;
            }
            else {
              document.getElementById("frontend_submit_stat_fields").value = checked_ids ;
              if(checked_ids == document.getElementById("all_stats_fields").value)
                document.getElementById("all_stats_fields").checked = true;
              else
                document.getElementById("all_stats_fields").checked = false;
            }
          }
          
          jQuery(document).ready(function () {
            jQuery('.filed_label').each(function() {
              if(document.getElementById("frontend_submit_fields").value == document.getElementById("all_fields").value)
                document.getElementById("all_fields").checked = true;
              if(inArray(this.value, document.getElementById("frontend_submit_fields").value.split(","))) {
                this.checked = true;
              }
            });

            jQuery('.stats_filed_label').each(function() {
              if(document.getElementById("frontend_submit_stat_fields").value == document.getElementById("all_stats_fields").value)
                document.getElementById("all_stats_fields").checked = true;          
              if(inArray(this.value, document.getElementById("frontend_submit_stat_fields").value.split(","))) {
                this.checked = true;		
              }              
            });
              
            jQuery(document).on('change','input[name="all_fields"]',function() {
                jQuery('.filed_label').prop("checked" , this.checked);
            });

            jQuery(document).on('change','input[name="all_stats_fields"]',function() {
                jQuery('.stats_filed_label').prop("checked" , this.checked);
            });
          });
        </script>

        <style>
          li{
          list-style-type: none;
          }

          .simple_table
          {
          padding-left: 0px !important;
          }

          .simple_table input, .simple_table label, .simple_table img
          {
          display:inline-block !important;
          float:none !important;
          }
        </style>
        <fieldset class="adminform">
          <legend style="color:#0B55C4;font-weight: bold;">Fields to hide in frontend submissions</legend>
          <?php 
        if (count($label_titles_for_submissions)) {
            ?>
            <table style="margin-left:-3px;">
              <tr>
                <td> 
                  <label>Select fields:</label>
                </td>
                <td  class="simple_table">
                  <ul id="form_fields">
                    <li>
                    <input disabled="disabled" type="checkbox" name="all_fields" id="all_fields" value="submit_id,<?php 
            echo implode(',', $labels_id_for_submissions) . "," . ($payment_info ? "payment_info" : "");
            ?>
" onclick="checked_labels('filed_label')"/>
                    <label for="all_fields">Select All</label>
                    </li>
                    <?php 
            echo "<li><input disabled=\"disabled\" type=\"checkbox\" id=\"submit_id\" name=\"submit_id\" value=\"submit_id\" class=\"filed_label\"  onclick=\"checked_labels('filed_label')\"><label for=\"submit_id\">ID</label></li>";
            for ($i = 0, $n = count($label_titles_for_submissions); $i < $n; $i++) {
                $field_label = $label_titles_for_submissions[$i];
                echo "<li><input disabled=\"disabled\" type=\"checkbox\" id=\"filed_label" . $i . "\" name=\"filed_label" . $i . "\" value=\"" . $labels_id_for_submissions[$i] . "\" class=\"filed_label\" onclick=\"checked_labels('filed_label')\"><label for=\"filed_label" . $i . "\">" . (strlen($field_label) > 80 ? substr($field_label, 0, 80) . '...' : $field_label) . "</label></li>";
            }
            if ($payment_info) {
                echo "<li><input disabled=\"disabled\" type=\"checkbox\" id=\"payment_info\" name=\"payment_info\" value=\"payment_info\" class=\"filed_label\" onclick=\"checked_labels('filed_label')\"><label for=\"payment_info\">Payment Info</label></li>";
            }
            ?>
                  </ul>
                  <input type="hidden" name="frontend_submit_fields" value="<?php 
            echo $row->frontend_submit_fields;
            ?>
" id="frontend_submit_fields" />
                </td>	
              </tr>
              <?php 
            if ($stats_labels) {
                ?>
              <tr id="stats">
                <td> 
                  <label>Stats fields:</label>
                </td>
                <td class="simple_table">
                  <ul id="stats_fields">
                    <li>
                    <input disabled="disabled" type="checkbox" name="all_stats_fields" id="all_stats_fields" value="<?php 
                echo implode(',', $stats_labels_ids) . ",";
                ?>
" onclick="checked_labels('stats_filed_label')">
                    <label for="all_stats_fields">Select All</label>
                    </li>
                    <?php 
                for ($i = 0, $n = count($stats_labels); $i < $n; $i++) {
                    $field_label = $stats_labels[$i];
                    echo "<li><input disabled=\"disabled\" type=\"checkbox\" id=\"stats_filed_label" . $i . "\" name=\"stats_filed_label" . $i . "\" value=\"" . $stats_labels_ids[$i] . "\" class=\"stats_filed_label\" onclick=\"checked_labels('stats_filed_label')\" ><label for=\"stats_filed_label" . $i . "\">" . (strlen($field_label) > 80 ? substr($field_label, 0, 80) . '...' : $field_label) . "</label></li>";
                }
                ?>
                  </ul>
                  <input type="hidden" name="frontend_submit_stat_fields" value="<?php 
                echo $row->frontend_submit_stat_fields;
                ?>
" id="frontend_submit_stat_fields" />
                </td>	
              </tr>
              <?php 
            }
            ?>
            </table>
          <?php 
        }
        ?>
        </fieldset>
      </fieldset>
      <fieldset id="custom_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color: #0B55C4; font-weight: bold;">Email Options</legend>
        <table class="admintable">
          <tr valign="top">
            <td style="padding: 15px; width:75px;">
              <label>Send E-mail</label>
            </td>
            <td style="padding: 15px;">
              <input type="radio" name="sendemail" id="sendemail_yes" value="1" <?php 
        echo $row->sendemail ? "checked" : "";
        ?>
 /><label for="sendemail_yes">Yes</label>
              <input type="radio" name="sendemail" id="sendemail_no" value="0" <?php 
        echo !$row->sendemail ? "checked" : "";
        ?>
 /><label for="sendemail_no">No</label>
            </td>
          </tr>
        </table>
        <fieldset class="fm_mail_options">
          <legend style="color:#0B55C4;font-weight: bold;">Email to Administrator</legend>
          <table class="admintable">
            <tr valign="top">
              <td class="fm_options_label">
                <label for="mailToAdd">Email to send submissions to</label>
              </td>
              <td class="fm_options_value">
                <input type="text" id="mailToAdd" name="mailToAdd" style="width: 250px;" />
                <input type="hidden" id="mail" name="mail" value="<?php 
        echo $row->mail . ($row->mail && substr($row->mail, -1) != ',' ? ',' : '');
        ?>
" />
                <img src="<?php 
        echo WD_FM_URL . '/images/add.png';
        ?>
"
                     style="vertical-align: middle; cursor: pointer;"
                     title="Add more emails"
                     onclick="if (fm_check_email('mailToAdd')) {return false;};cfm_create_input('mail', 'mailToAdd', 'cfm_mail_div', '<?php 
        echo WD_FM_URL;
        ?>
')" />
                <div id="cfm_mail_div">
                  <?php 
        $mail_array = explode(',', $row->mail);
        foreach ($mail_array as $mail) {
            if ($mail && $mail != ',') {
                ?>
                      <div class="fm_mail_input">
                        <?php 
                echo $mail;
                ?>
                        <img src="<?php 
                echo WD_FM_URL;
                ?>
/images/delete.png" class="fm_delete_img" onclick="fm_delete_mail(this, '<?php 
                echo $mail;
                ?>
')" title="Delete Email" />
                      </div>
                      <?php 
            }
        }
        ?>
                </div>
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="from_mail">Email From</label>
              </td>
              <td class="fm_options_value">
                <!--<input id="from_mail" name="from_mail" value="<?php 
        echo $row->from_mail;
        ?>
" style="width:250px;" />-->
                <?php 
        $is_other = TRUE;
        for ($i = 0; $i < $fields_count - 1; $i++) {
            ?>
                  <div>
                    <input type="radio" name="from_mail" id="from_mail<?php 
            echo $i;
            ?>
" value="<?php 
            echo strlen($fields[$i]) != 1 ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) : $fields[$i];
            ?>
"  <?php 
            echo (strlen($fields[$i]) != 1 ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) : $fields[$i]) == $row->from_mail ? 'checked="checked"' : '';
            ?>
 onclick="wdhide('mail_from_other')" />
                    <label for="from_mail<?php 
            echo $i;
            ?>
"><?php 
            echo substr($fields[$i + 1], 0, strpos($fields[$i + 1], '*:*w_field_label*:*'));
            ?>
</label>
                  </div>
                  <?php 
            if (strlen($fields[$i]) != 1) {
                if (substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) == $row->from_mail) {
                    $is_other = FALSE;
                }
            } else {
                if ($fields[$i] == $row->from_mail) {
                    $is_other = false;
                }
            }
        }
        ?>
                <div style="<?php 
        echo $fields_count == 1 ? 'display:none;' : '';
        ?>
">
                  <input type="radio" id="other" name="from_mail" value="other" <?php 
        echo $is_other ? 'checked="checked"' : '';
        ?>
 onclick="wdshow('mail_from_other')" />
                  <label for="other">Other</label>
                </div>
								<input type="text" style="width: <?php 
        echo $fields_count == 1 ? '250px' : '235px; margin-left: 15px';
        ?>
; display: <?php 
        echo $is_other ? 'block;' : 'none;';
        ?>
" id="mail_from_other" name="mail_from_other" value="<?php 
        echo $is_other ? $row->from_mail : '';
        ?>
" />
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="from_name">From Name</label>
              </td>
              <td class="fm_options_value">
                <input type="text" id="from_name" name="from_name" value="<?php 
        echo $row->from_name;
        ?>
" style="width: 250px;" />
                <img src="<?php 
        echo WD_FM_URL . '/images/add.png';
        ?>
" onclick="document.getElementById('mail_from_labels').style.display='block';" style="vertical-align: middle; cursor: pointer;display:inline-block; margin:0px; float:none;">
								<?php 
        $choise = "document.getElementById('from_name')";
        echo '<div style="position:relative; top:-3px;"><div id="mail_from_labels" class="email_labels" style="display:none;">';
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'username'); document.getElementById('mail_from_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
        for ($i = 0; $i < count($label_label); $i++) {
            if ($label_type[$i] == "type_submit_reset" || $label_type[$i] == "type_editor" || $label_type[$i] == "type_map" || $label_type[$i] == "type_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_file_upload" || $label_type[$i] == "type_send_copy" || $label_type[$i] == "type_matrix") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            echo "<a onClick=\"insertAtCursor(" . $choise . ",'" . $param . "'); document.getElementById('mail_from_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">" . $fld_label . "</a>";
        }
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'username'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
        echo '</div></div>';
        ?>
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="reply_to">Reply to<br/>(if different from "Email From") </label>
              </td>
              <td class="fm_options_value">
                <!--<input id="reply_to" name="reply_to" value="<?php 
        echo $row->reply_to;
        ?>
" style="width:250px;"/>-->
                <?php 
        $is_other = TRUE;
        for ($i = 0; $i < $fields_count - 1; $i++) {
            ?>
                  <div>
                    <input type="radio" name="reply_to" id="reply_to<?php 
            echo $i;
            ?>
" value="<?php 
            echo strlen($fields[$i]) != 1 ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) : $fields[$i];
            ?>
"  <?php 
            echo (strlen($fields[$i]) != 1 ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) : $fields[$i]) == $row->reply_to ? 'checked="checked"' : '';
            ?>
 onclick="wdhide('reply_to_other')" />
                    <label for="reply_to<?php 
            echo $i;
            ?>
"><?php 
            echo substr($fields[$i + 1], 0, strpos($fields[$i + 1], '*:*w_field_label*:*'));
            ?>
</label>
                  </div>
                  <?php 
            if (strlen($fields[$i]) != 1) {
                if (substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) == $row->reply_to) {
                    $is_other = FALSE;
                }
            } else {
                if ($fields[$i] == $row->reply_to) {
                    $is_other = false;
                }
            }
        }
        ?>
								<div style="<?php 
        echo $fields_count == 1 ? 'display: none;' : '';
        ?>
">
                  <input type="radio" id="other1" name="reply_to" value="other" <?php 
        echo $is_other ? 'checked="checked"' : '';
        ?>
 onclick="wdshow('reply_to_other')" />
                  <label for="other1">Other</label>
                </div>
								<input type="text" style="width: <?php 
        echo $fields_count == 1 ? '250px' : '235px; margin-left: 15px';
        ?>
; display: <?php 
        echo $is_other ? 'block;' : 'none;';
        ?>
" id="reply_to_other" name="reply_to_other" value="<?php 
        echo $is_other && $row->reply_to ? $row->reply_to : '';
        ?>
" />
              </td>
            </tr>
            <tr valign="top">
							<td class="fm_options_label">
								<label> CC: </label>
							</td>
							<td class="fm_options_value">
								<input  type="text" id="mail_cc" name="mail_cc" value="<?php 
        echo $row->mail_cc;
        ?>
" style="width:250px;" />
							</td>
						</tr>
						<tr valign="top">
							<td class="fm_options_label">
								<label> BCC: </label>
							</td>
							<td class="fm_options_value">
								<input type="text" id="mail_bcc" name="mail_bcc" value="<?php 
        echo $row->mail_bcc;
        ?>
" style="width:250px;" />
							</td>
						</tr>
						<tr valign="top">
							<td class="fm_options_label">
								<label> Subject: </label>
							</td>
							<td class="fm_options_value">
								<input type="text" id="mail_subject" name="mail_subject" value="<?php 
        echo $row->mail_subject;
        ?>
" style="width:250px;" />
								<img src="<?php 
        echo WD_FM_URL . '/images/add.png';
        ?>
" onclick="document.getElementById('mail_subject_labels').style.display='block';" style="vertical-align: middle;cursor: pointer; display:inline-block; margin:0px; float:none;">
								<?php 
        $choise = "document.getElementById('mail_subject')";
        echo '<div style="position:relative; top:-3px;"><div id="mail_subject_labels" class="email_labels" style="display:none;">';
        for ($i = 0; $i < count($label_label); $i++) {
            if ($label_type[$i] == "type_submit_reset" || $label_type[$i] == "type_editor" || $label_type[$i] == "type_map" || $label_type[$i] == "type_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_file_upload" || $label_type[$i] == "type_send_copy" || $label_type[$i] == "type_matrix") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            echo "<a onClick=\"insertAtCursor(" . $choise . ",'" . $param . "'); document.getElementById('mail_subject_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">" . $fld_label . "</a>";
        }
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'username'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
        echo '</div></div>';
        ?>
							</td>
						</tr>
						<tr valign="top">
              <td class="fm_options_label" style="vertical-align: middle;">
                <label> Mode: </label>
              </td>
              <td class="fm_options_value">
                <input type="radio" name="mail_mode" id="htmlmode" value="1" <?php 
        if ($row->mail_mode == 1) {
            echo "checked";
        }
        ?>
 /> <label for="htmlmode">HTML</label>
                <input type="radio" name="mail_mode" id="textmode" value="0" <?php 
        if ($row->mail_mode == 0) {
            echo "checked";
        }
        ?>
 /> <label for="textmode">Text</label>
              </td>
              </tr>
              <tr valign="top">
              <td class="fm_options_label" style="vertical-align: middle;">
                <label> Attach File: </label>
              </td>
              <td class="fm_options_value">
                <input type="radio" disabled="disabled" name="mail_attachment"  value="1" id="en_attach" <?php 
        if ($row->mail_attachment == 1) {
            echo "checked";
        }
        ?>
 /> <label for="en_attach">Yes</label>
                <input type="radio" disabled="disabled" name="mail_attachment" id="dis_attach" value="0" <?php 
        if ($row->mail_attachment == 0) {
            echo "checked";
        }
        ?>
 /> <label for="dis_attach">No</label>
                <div class="error_fm" style="padding: 5px; font-size: 14px;">File attach is disabled in free version.</div>
              </td>
            </tr>
			<tr valign="top">
              <td class="fm_options_label" style="vertical-align: middle;">
                <label> Email empty fields: </label>
              </td>
              <td class="fm_options_value">
                <input type="radio" name="mail_emptyfields"  value="1" id="en_mail_emptyfields" <?php 
        if ($row->mail_emptyfields == 1) {
            echo "checked";
        }
        ?>
 /> <label for="en_mail_emptyfields">Yes</label>
                <input type="radio" name="mail_emptyfields" id="dis_mail_emptyfields" value="0" <?php 
        if ($row->mail_emptyfields == 0) {
            echo "checked";
        }
        ?>
 /> <label for="dis_mail_emptyfields">No</label>
              </td>
            </tr>
            <tr>
              <td class="fm_options_label" valign="top">
                <label>Custom Text in Email For Administrator</label>
              </td>
              <td class="fm_options_value">
                <div style="margin-bottom:5px">
                  <?php 
        $choise = "document.getElementById('script_mail')";
        for ($i = 0; $i < count($label_label); $i++) {
            if ($label_type[$i] == "type_submit_reset" || $label_type[$i] == "type_editor" || $label_type[$i] == "type_map" || $label_type[$i] == "type_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_send_copy") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            if ($label_type[$i] == "type_file_upload") {
                $fld_label .= '(as image)';
            }
            ?>
                    <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php 
            echo $fld_label;
            ?>
" onClick="insertAtCursor(<?php 
            echo $choise;
            ?>
, '<?php 
            echo $param;
            ?>
')" />
                    <?php 
        }
        ?>
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Submission ID" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'subid')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Ip" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'ip')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Username" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'username')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="User Email" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'useremail')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="All fields list" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
, 'all')" />
                </div>
                <?php 
        if (user_can_richedit()) {
            wp_editor($row->script_mail, 'script_mail', array('teeny' => FALSE, 'textarea_name' => 'script_mail', 'media_buttons' => FALSE, 'textarea_rows' => 5));
        } else {
            ?>
                  <textarea name="script_mail" id="script_mail" cols="20" rows="10" style="width:300px; height:450px;"><?php 
            echo $row->script_mail;
            ?>
</textarea>
                  <?php 
        }
        ?>
              </td>
            </tr>
          </table>
        </fieldset>
        <fieldset class="fm_mail_options">
          <legend style="color: #0B55C4; font-weight: bold;">Email to User</legend>
          <table class="admintable">
            <tr valign="top">
              <td class="fm_options_label">
                <label for="mail">Send to</label>
              </td>
              <td class="fm_options_value">
                <?php 
        $fields = explode('*:*id*:*type_submitter_mail*:*type*:*', $row->form_fields);
        $fields_count = count($fields);
        if ($fields_count == 1) {
            ?>
                  There is no email field
                  <?php 
        } else {
            for ($i = 0; $i < $fields_count - 1; $i++) {
                ?>
                    <div>
                     <input type="checkbox" name="send_to<?php 
                echo $i;
                ?>
" id="send_to<?php 
                echo $i;
                ?>
" value="<?php 
                echo strlen($fields[$i]) != 1 ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) : $fields[$i];
                ?>
"  <?php 
                echo is_numeric(strpos($row->send_to, '*' . (strlen($fields[$i]) != 1 ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) : $fields[$i]) . '*')) ? 'checked="checked"' : '';
                ?>
 style="margin: 0px 5px 0px 0px;" />
                      <label for="send_to<?php 
                echo $i;
                ?>
"><?php 
                echo substr($fields[$i + 1], 0, strpos($fields[$i + 1], '*:*w_field_label*:*'));
                ?>
</label>
                    </div>
                    <?php 
            }
        }
        ?>
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="mail_from_user">Email From</label>
              </td>
              <td class="fm_options_value">
                <input type="text" id="mail_from_user" name="mail_from_user" value="<?php 
        echo $row->mail_from_user;
        ?>
" style="width: 250px;" />
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="mail_from_name_user">From Name</label>
              </td>
              <td class="fm_options_value">
                <input type="text" id="mail_from_name_user" name="mail_from_name_user" value="<?php 
        echo $row->mail_from_name_user;
        ?>
" style="width: 250px;"/>
                <img src="<?php 
        echo WD_FM_URL . '/images/add.png';
        ?>
" onclick="document.getElementById('mail_from_name_user_labels').style.display='block';" style="vertical-align: middle;cursor: pointer; display:inline-block; margin:0px; float:none;">
                <?php 
        $choise = "document.getElementById('mail_from_name_user')";
        echo '<div style="position:relative; top:-3px;"><div id="mail_from_name_user_labels" class="email_labels" style="display:none;">';
        for ($i = 0; $i < count($label_label); $i++) {
            if ($label_type[$i] == "type_submit_reset" || $label_type[$i] == "type_editor" || $label_type[$i] == "type_map" || $label_type[$i] == "type_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_file_upload" || $label_type[$i] == "type_send_copy") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            echo "<a onClick=\"insertAtCursor(" . $choise . ",'" . $param . "'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">" . $fld_label . "</a>";
        }
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'username'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
        echo '</div></div>';
        ?>
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label">
                <label for="reply_to_user">Reply to<br />(if different from "Email Form")</label>
              </td>
              <td class="fm_options_value">
                <input type="text" id="reply_to_user" name="reply_to_user" value="<?php 
        echo $row->reply_to_user;
        ?>
" style="width:250px;"/>
              </td>
            </tr>
            <tr valign="top">
							<td class="fm_options_label">
								<label> CC: </label>
							</td>
							<td class="fm_options_value">
								<input type="text" id="mail_cc_user" name="mail_cc_user" value="<?php 
        echo $row->mail_cc_user;
        ?>
" style="width:250px;" />
							</td>
						</tr>
						<tr valign="top">
							<td class="fm_options_label">
								<label> BCC: </label>
							</td>
							<td class="fm_options_value">
								<input type="text" id="mail_bcc_user" name="mail_bcc_user" value="<?php 
        echo $row->mail_bcc_user;
        ?>
" style="width:250px;" />
							</td>
						</tr>
						<tr valign="top">
							<td class="fm_options_label">
								<label> Subject: </label>
							</td>
							<td class="fm_options_value">
								<input type="text" id="mail_subject_user" name="mail_subject_user" value="<?php 
        echo $row->mail_subject_user;
        ?>
" style="width:250px;" />
								<img src="<?php 
        echo WD_FM_URL . '/images/add.png';
        ?>
" onclick="document.getElementById('mail_subject_user_labels').style.display='block';" style="vertical-align: middle; cursor: pointer; display:inline-block; margin:0px; float:none;">
								<?php 
        $choise = "document.getElementById('mail_subject_user')";
        echo '<div style="position:relative; top:-3px;"><div id="mail_subject_user_labels" class="email_labels" style="display:none;">';
        for ($i = 0; $i < count($label_label); $i++) {
            if ($label_type[$i] == "type_submit_reset" || $label_type[$i] == "type_editor" || $label_type[$i] == "type_map" || $label_type[$i] == "type_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_file_upload" || $label_type[$i] == "type_send_copy") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            echo "<a onClick=\"insertAtCursor(" . $choise . ",'" . $param . "'); document.getElementById('mail_subject_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">" . $fld_label . "</a>";
        }
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
        echo "<a onClick=\"insertAtCursor(" . $choise . ",'username'); \t\t\tdocument.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
        echo '</div></div>';
        ?>
							</td>
						</tr>
						<tr valign="top">
              <td class="fm_options_label" style="vertical-align: middle;">
                <label> Mode: </label>
              </td>
              <td class="fm_options_value">
                <input type="radio" name="mail_mode_user" id="htmlmode_user" value="1" <?php 
        if ($row->mail_mode_user == 1) {
            echo "checked";
        }
        ?>
 /> <label for="htmlmode_user">HTML</label>
                <input type="radio" name="mail_mode_user" id="textmode_user" value="0" <?php 
        if ($row->mail_mode_user == 0) {
            echo "checked";
        }
        ?>
 /> <label for="textmode_user">Text</label>
              </td>
            </tr>
            <tr valign="top">
              <td class="fm_options_label" style="vertical-align: middle;">
                <label> Attach File: </label>
              </td>
              <td class="fm_options_value">
                <input type="radio" disabled="disabled" name="mail_attachment_user"  value="1" id="en_attach_user" <?php 
        if ($row->mail_attachment_user == 1) {
            echo "checked";
        }
        ?>
 /> <label for="en_attach_user">Yes</label>
                <input type="radio" disabled="disabled" name="mail_attachment_user" id="dis_attach_user" value="0" <?php 
        if ($row->mail_attachment_user == 0) {
            echo "checked";
        }
        ?>
 /> <label for="dis_attach_user">No</label>
                <div class="error_fm" style="padding: 5px; font-size: 14px;">File attach is disabled in free version.</div>
              </td>
            </tr>
			<tr valign="top">
				<td class="fm_options_label" style="vertical-align: middle;">
					<label> Email verification: </label>
				</td>
				<td class="fm_options_value">
					<input type="radio" name="mail_verify"  value="1" id="en_mail_verify" <?php 
        if ($row->mail_verify == 1) {
            echo "checked";
        }
        ?>
 onClick = "show_verify_options(true)" /> <label for="en_mail_verify">Yes</label>
					<input type="radio" name="mail_verify" id="dis_mail_verify" value="0" <?php 
        if ($row->mail_verify == 0) {
            echo "checked";
        }
        ?>
 onClick = "show_verify_options(false)"/> <label for="dis_mail_verify">No</label>
				</td>
            </tr>
			<tr valign="top" class="expire_link" <?php 
        echo $row->mail_verify == 0 ? 'style="display:none;"' : '';
        ?>
>
				<td class="fm_options_label" valign="top">
					<label> Verification link expires in: </label>
				</td>
				<td class="fm_options_value">
					<input class="inputbox" type="text" name="mail_verify_expiretime" maxlength="10"  value = "<?php 
        echo $row->mail_verify_expiretime ? $row->mail_verify_expiretime : 0;
        ?>
" style="width:95px;" onkeypress="return check_isnum_point(event)"/><small> -- hours (0 - never expires).</small>
				</td>
			</tr>
            <tr>
              <td class="fm_options_label" valign="top">
                <label>Custom Text in Email For User</label>
              </td>
              <td class="fm_options_value">
                <div style="margin-bottom:5px">
                  <?php 
        $choise = "document.getElementById('script_mail_user')";
        for ($i = 0; $i < count($label_label); $i++) {
            if ($label_type[$i] == "type_submit_reset" || $label_type[$i] == "type_editor" || $label_type[$i] == "type_map" || $label_type[$i] == "type_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_file_upload" || $label_type[$i] == "type_send_copy") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            if ($label_type[$i] == "type_file_upload") {
                $fld_label .= '(as image)';
            }
            ?>
                    <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php 
            echo htmlspecialchars(addslashes($label_label[$i]));
            ?>
" onClick="insertAtCursor(<?php 
            echo $choise;
            ?>
, '<?php 
            echo $param;
            ?>
')" />
                    <?php 
        }
        ?>
				  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Submission ID" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'subid')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Ip" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'ip')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Username" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'username')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="User Email" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'useremail')" />
                  <input style="border: 1px solid silver; font-size: 10px; margin:3px;" type="button" value="All fields list" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
, 'all')" />
				  <div class="verification_div" <?php 
        echo $row->mail_verify == 0 ? 'style="display:none;"' : '';
        ?>
><input style="border: 1px solid silver; font-size: 10px; margin:3px;" type="button" value="Verification link" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'Verification link')" /> </div>
                </div>
                <?php 
        if (user_can_richedit()) {
            wp_editor($row->script_mail_user, 'script_mail_user', array('teeny' => FALSE, 'textarea_name' => 'script_mail_user', 'media_buttons' => FALSE, 'textarea_rows' => 5));
        } else {
            ?>
                  <textarea name="script_mail_user" id="script_mail_user" cols="20" rows="10" style="width:300px; height:450px;"><?php 
            echo $row->script_mail_user;
            ?>
</textarea>
                  <?php 
        }
        ?>
              </td>
            </tr>
          </table>
        </fieldset>
      </fieldset>
      <fieldset id="actions_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color:#0B55C4;font-weight: bold;">Actions after submission</legend>
        <table class="admintable">
          <tr valign="top">
            <td class="fm_options_label">
              <label>Action type</label>
            </td>
            <td class="fm_options_value">
              <div><input type="radio" name="submit_text_type" id="text_type_none" onclick="set_type('none')" value="1" <?php 
        echo $row->submit_text_type != 2 && $row->submit_text_type != 3 && $row->submit_text_type != 4 && $row->submit_text_type != 5 ? "checked" : "";
        ?>
 /><label for="text_type_none">Stay on Form</label></div>
              <div><input type="radio" name="submit_text_type" id="text_type_post" onclick="set_type('post')" value="2" <?php 
        echo $row->submit_text_type == 2 ? "checked" : "";
        ?>
 /><label for="text_type_post">Post</label></label></div>
              <div><input type="radio" name="submit_text_type" id="text_type_page" onclick="set_type('page')" value="5" <?php 
        echo $row->submit_text_type == 5 ? "checked" : "";
        ?>
 /><label for="text_type_page">Page</label></label></div>
              <div><input type="radio" name="submit_text_type" id="text_type_custom_text" onclick="set_type('custom_text')" value="3" <?php 
        echo $row->submit_text_type == 3 ? "checked" : "";
        ?>
 /><label for="text_type_custom_text">Custom Text</label></label></div>
              <div><input type="radio" name="submit_text_type" id="text_type_url" onclick="set_type('url')" value="4" <?php 
        echo $row->submit_text_type == 4 ? "checked" : "";
        ?>
 /><label for="text_type_url">URL</div>
            </td>
          </tr>
          <tr id="none" <?php 
        echo $row->submit_text_type == 2 || $row->submit_text_type == 3 || $row->submit_text_type == 4 || $row->submit_text_type == 5 ? 'style="display:none"' : '';
        ?>
>
            <td class="fm_options_label">
              <label>Stay on Form</label>
            </td>
            <td class="fm_options_value">
              <img src="<?php 
        echo WD_FM_URL . '/images/tick.png';
        ?>
" border="0">
            </td>
          </tr>
          <tr id="post" <?php 
        echo $row->submit_text_type != 2 ? 'style="display:none"' : '';
        ?>
>
            <td class="fm_options_label">
              <label for="post_name">Post</label>
            </td>
            <td class="fm_options_value">
              <select id="post_name" name="post_name" style="width: 153px; font-size: 11px;">
                <option value="0">- Select Post -</option>
                <?php 
        // The Query.
        $args = array('posts_per_page' => 10000);
        query_posts($args);
        // The Loop.
        while (have_posts()) {
            the_post();
            ?>
                <option value="<?php 
            $x = get_permalink(get_the_ID());
            echo $x;
            ?>
" <?php 
            echo $row->article_id == $x ? 'selected="selected"' : '';
            ?>
><?php 
            the_title();
            ?>
</option>
                <?php 
        }
        // Reset Query.
        wp_reset_query();
        ?>
              </select>
            </td>
          </tr>
          <tr id="page" <?php 
        echo $row->submit_text_type != 5 ? 'style="display:none"' : '';
        ?>
>
            <td class="fm_options_label">
              <label for="page_name">Page</label>
            </td>
            <td class="fm_options_value">
              <select id="page_name" name="page_name" style="width: 153px; font-size: 11px;">
                <option value="0">- Select Page -</option>
                <?php 
        // The Query.
        $pages = get_pages();
        // The Loop.
        foreach ($pages as $page) {
            $page_id = get_page_link($page->ID);
            ?>
                <option value="<?php 
            echo $page_id;
            ?>
" <?php 
            echo $row->article_id == $page_id ? 'selected="selected"' : '';
            ?>
><?php 
            echo $page->post_title;
            ?>
</option>
                  <?php 
        }
        // Reset Query.
        wp_reset_query();
        ?>
              </select>
            </td>
          </tr>
          <tr id="custom_text" <?php 
        echo $row->submit_text_type != 3 ? 'style="display: none;"' : '';
        ?>
>
            <td class="fm_options_label">
              <label for="submit_text">Text</label>
            </td>
            <td class="fm_options_value">
				<?php 
        $choise = "document.getElementById('submit_text')";
        for ($i = 0; $i < count($label_label); $i++) {
            if ($label_type[$i] == "type_submit_reset" || $label_type[$i] == "type_editor" || $label_type[$i] == "type_map" || $label_type[$i] == "type_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_send_copy" || $label_type[$i] == "type_file_upload") {
                continue;
            }
            $param = htmlspecialchars(addslashes($label_label[$i]));
            $fld_label = $param;
            if (strlen($fld_label) > 30) {
                $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
                $fld_label = explode("\n", $fld_label);
                $fld_label = $fld_label[0] . ' ...';
            }
            ?>
                    <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php 
            echo $fld_label;
            ?>
" onClick="insertAtCursor(<?php 
            echo $choise;
            ?>
, '<?php 
            echo $param;
            ?>
')" />
                    <?php 
        }
        ?>
				<input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Submission ID" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'subid')" />
                <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Ip" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'ip')" />
				<input style="border: 1px solid silver; font-size: 10px; margin:3px;" type="button" value="User Id" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
, 'userid')" />
                <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Username" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'username')" />
                <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="User Email" onClick="insertAtCursor(<?php 
        echo $choise;
        ?>
,'useremail')" />
              <?php 
        if (user_can_richedit()) {
            wp_editor($row->submit_text, 'submit_text', array('teeny' => FALSE, 'textarea_name' => 'submit_text', 'media_buttons' => FALSE, 'textarea_rows' => 5));
        } else {
            ?>
                <textarea cols="36" rows="5" id="submit_text" name="submit_text" style="resize: vertical;">
                  <?php 
            echo $row->submit_text;
            ?>
                </textarea>
                <?php 
        }
        ?>
            </td>
          </tr>
          <tr id="url" <?php 
        echo $row->submit_text_type != 4 ? 'style="display:none"' : '';
        ?>
>
            <td class="fm_options_label">
              <label for="url">URL</label>
            </td>
            <td class="fm_options_value">
              <input type="text" id="url" name="url" style="width:300px" value="<?php 
        echo $row->url;
        ?>
" />
            </td>
          </tr>
        </table>
      </fieldset>
      <fieldset id="payment_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color:#0B55C4;font-weight: bold;">Payment Options</legend>
        <table class="admintable">
          <tr>
            <td colspan="2">
              <div class="error_fm" style="padding: 5px; font-size: 14px;">Paypal Options are disabled in free version.</div>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label>Turn Paypal On</label>
            </td>
            <td class="fm_options_value">
              <div><input disabled="disabled" type="radio" name="paypal_mode" id="paypal_mode1" value="1" <?php 
        echo $row->paypal_mode == "1" ? "checked" : "";
        ?>
 /><label for="paypal_mode1">On</label></div>
              <div><input disabled="disabled" type="radio" name="paypal_mode" id="paypal_mode2" value="0" <?php 
        echo $row->paypal_mode != "1" ? "checked" : "";
        ?>
 /><label for="paypal_mode2">Off</label></div>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label>Checkout Mode</label>
            </td>
            <td class="fm_options_value">
              <div><input disabled="disabled" type="radio" name="checkout_mode" id="checkout_mode1" value="production" <?php 
        echo $row->checkout_mode == "production" ? "checked" : "";
        ?>
 /><label for="checkout_mode1">Production</label></div>
              <div><input disabled="disabled" type="radio" name="checkout_mode" id="checkout_mode2" value="testmode" <?php 
        echo $row->checkout_mode != "production" ? "checked" : "";
        ?>
 /><label for="checkout_mode2">Testmode</label></div>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label for="paypal_email">Paypal email</label>
            </td>
            <td class="fm_options_value">
              <input disabled="disabled" type="text" name="paypal_email" id="paypal_email" value="<?php 
        echo $row->paypal_email;
        ?>
" class="text_area" style="width:250px">
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label for="payment_currency">Payment Currency</label>
            </td>
            <td class="fm_options_value">
              <select disabled="disabled" id="payment_currency" name="payment_currency" style="width:253px">
                <option value="USD" <?php 
        echo $row->payment_currency == 'USD' ? 'selected' : '';
        ?>
>$ &#8226; U.S. Dollar</option>
                <option value="EUR" <?php 
        echo $row->payment_currency == 'EUR' ? 'selected' : '';
        ?>
>&#8364; &#8226; Euro</option>
                <option value="GBP" <?php 
        echo $row->payment_currency == 'GBP' ? 'selected' : '';
        ?>
>&#163; &#8226; Pound Sterling</option>
                <option value="JPY" <?php 
        echo $row->payment_currency == 'JPY' ? 'selected' : '';
        ?>
>&#165; &#8226; Japanese Yen</option>
                <option value="CAD" <?php 
        echo $row->payment_currency == 'CAD' ? 'selected' : '';
        ?>
>C$ &#8226; Canadian Dollar</option>
                <option value="MXN" <?php 
        echo $row->payment_currency == 'MXN' ? 'selected' : '';
        ?>
>Mex$ &#8226; Mexican Peso</option>
                <option value="HKD" <?php 
        echo $row->payment_currency == 'HKD' ? 'selected' : '';
        ?>
>HK$ &#8226; Hong Kong Dollar</option>
                <option value="HUF" <?php 
        echo $row->payment_currency == 'HUF' ? 'selected' : '';
        ?>
>Ft &#8226; Hungarian Forint</option>
                <option value="NOK" <?php 
        echo $row->payment_currency == 'NOK' ? 'selected' : '';
        ?>
>kr &#8226; Norwegian Kroner</option>
                <option value="NZD" <?php 
        echo $row->payment_currency == 'NZD' ? 'selected' : '';
        ?>
>NZ$ &#8226; New Zealand Dollar</option>
                <option value="SGD" <?php 
        echo $row->payment_currency == 'SGD' ? 'selected' : '';
        ?>
>S$ &#8226; Singapore Dollar</option>
                <option value="SEK" <?php 
        echo $row->payment_currency == 'SEK' ? 'selected' : '';
        ?>
>kr &#8226; Swedish Kronor</option>
                <option value="PLN" <?php 
        echo $row->payment_currency == 'PLN' ? 'selected' : '';
        ?>
>zl &#8226; Polish Zloty</option>
                <option value="AUD" <?php 
        echo $row->payment_currency == 'AUD' ? 'selected' : '';
        ?>
>A$ &#8226; Australian Dollar</option>
                <option value="DKK" <?php 
        echo $row->payment_currency == 'DKK' ? 'selected' : '';
        ?>
>kr &#8226; Danish Kroner</option>
                <option value="CHF" <?php 
        echo $row->payment_currency == 'CHF' ? 'selected' : '';
        ?>
>CHF &#8226; Swiss Francs</option>
                <option value="CZK" <?php 
        echo $row->payment_currency == 'CZK' ? 'selected' : '';
        ?>
>Kc &#8226; Czech Koruny</option>
                <option value="ILS" <?php 
        echo $row->payment_currency == 'ILS' ? 'selected' : '';
        ?>
>&#8362; &#8226; Israeli Sheqel</option>
                <option value="BRL" <?php 
        echo $row->payment_currency == 'BRL' ? 'selected' : '';
        ?>
>R$ &#8226; Brazilian Real</option>
                <option value="TWD" <?php 
        echo $row->payment_currency == 'TWD' ? 'selected' : '';
        ?>
>NT$ &#8226; Taiwan New Dollars</option>
                <option value="MYR" <?php 
        echo $row->payment_currency == 'MYR' ? 'selected' : '';
        ?>
>RM &#8226; Malaysian Ringgit</option>
                <option value="PHP" <?php 
        echo $row->payment_currency == 'PHP' ? 'selected' : '';
        ?>
>&#8369; &#8226; Philippine Peso</option>
                <option value="THB" <?php 
        echo $row->payment_currency == 'THB' ? 'selected' : '';
        ?>
>&#xe3f; &#8226; Thai Bahtv</option>
              </select>
            </td>
          </tr>
          <tr valign="top">
            <td class="fm_options_label">
              <label for="tax">Tax</label>
            </td>
            <td class="fm_options_value">
              <input type="text" name="tax" id="tax" value="<?php 
        echo $row->tax;
        ?>
" class="text_area" style="width: 40px;" onKeyPress="return check_isnum_point(event)"> %
            </td>
          </tr>
        </table>
      </fieldset>
      <fieldset id="javascript_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color:#0B55C4;font-weight: bold;">JavaScript</legend>
        <table class="admintable">
          <tr valign="top">
            <td class="fm_options_label">
              <label for="javascript">Javascript</label>
            </td>
            <td class="fm_options_value" style="width:650px;">
              <textarea style="margin: 0px; height: 400px; width: 600px;" cols="60" rows="30" name="javascript" id="form_javascript"><?php 
        echo $row->javascript;
        ?>
</textarea>
            </td>
          </tr>
        </table>
      </fieldset>
      <fieldset id="conditions_fieldset" class="adminform fm_fieldset_deactive">
				<legend style="color:#0B55C4;font-weight: bold;">Conditional Fields</legend>
				<?php 
        $ids = array();
        $types = array();
        $labels = array();
        $paramss = array();
        $all_ids = array();
        $all_labels = array();
        $select_and_input = array("type_text", "type_password", "type_textarea", "type_name", "type_number", "type_phone", "type_submitter_mail", "type_address", "type_spinner", "type_checkbox", "type_radio", "type_own_select", "type_paypal_price", "type_paypal_select", "type_paypal_checkbox", "type_paypal_radio", "type_paypal_shipping");
        $select_type_fields = array("type_address", "type_checkbox", "type_radio", "type_own_select", "type_paypal_select", "type_paypal_checkbox", "type_paypal_radio", "type_paypal_shipping");
        $fields = explode('*:*new_field*:*', $row->form_fields);
        $fields = array_slice($fields, 0, count($fields) - 1);
        foreach ($fields as $field) {
            $temp = explode('*:*id*:*', $field);
            array_push($ids, $temp[0]);
            array_push($all_ids, $temp[0]);
            $temp = explode('*:*type*:*', $temp[1]);
            array_push($types, $temp[0]);
            $temp = explode('*:*w_field_label*:*', $temp[1]);
            array_push($labels, $temp[0]);
            array_push($all_labels, $temp[0]);
            array_push($paramss, $temp[1]);
        }
        foreach ($types as $key => $value) {
            if (!in_array($types[$key], $select_and_input)) {
                unset($ids[$key]);
                unset($labels[$key]);
                unset($types[$key]);
                unset($paramss[$key]);
            }
        }
        $ids = array_values($ids);
        $labels = array_values($labels);
        $types = array_values($types);
        $paramss = array_values($paramss);
        $chose_ids = implode('@@**@@', $ids);
        $chose_labels = implode('@@**@@', $labels);
        $chose_types = implode('@@**@@', $types);
        $chose_paramss = implode('@@**@@', $paramss);
        $all_ids_cond = implode('@@**@@', $all_ids);
        $all_labels_cond = implode('@@**@@', $all_labels);
        $show_hide = array();
        $field_label = array();
        $all_any = array();
        $condition_params = array();
        $count_of_conditions = 0;
        if ($row->condition != "") {
            $conditions = explode('*:*new_condition*:*', $row->condition);
            $conditions = array_slice($conditions, 0, count($conditions) - 1);
            $count_of_conditions = count($conditions);
            foreach ($conditions as $condition) {
                $temp = explode('*:*show_hide*:*', $condition);
                array_push($show_hide, $temp[0]);
                $temp = explode('*:*field_label*:*', $temp[1]);
                array_push($field_label, $temp[0]);
                $temp = explode('*:*all_any*:*', $temp[1]);
                array_push($all_any, $temp[0]);
                array_push($condition_params, $temp[1]);
            }
        } else {
            $show_hide[0] = 1;
            $all_any[0] = 'and';
            $condition_params[0] = '';
            if ($all_ids) {
                $field_label[0] = $all_ids[0];
            }
        }
        ?>
					<div>
					<span style="font-size:13px;">Add Condition<span/>
					<img src="<?php 
        echo WD_FM_URL . '/images/add_condition.png';
        ?>
" title="add" onclick="add_condition('<?php 
        echo $chose_ids;
        ?>
', '<?php 
        echo htmlspecialchars(addslashes($chose_labels));
        ?>
', '<?php 
        echo $chose_types;
        ?>
', '<?php 
        echo htmlspecialchars(addslashes($chose_paramss));
        ?>
', '<?php 
        echo $all_ids_cond;
        ?>
', '<?php 
        echo htmlspecialchars(addslashes($all_labels_cond));
        ?>
')" style="cursor: pointer; vertical-align: middle; margin-left:15px;">
					</div>
					<?php 
        for ($k = 0; $k < $count_of_conditions; $k++) {
            if (in_array($field_label[$k], $all_ids)) {
                ?>
					<div id="condition<?php 
                echo $k;
                ?>
" >
						<div id="conditional_fileds<?php 
                echo $k;
                ?>
">
							<select id="show_hide<?php 
                echo $k;
                ?>
" name="show_hide<?php 
                echo $k;
                ?>
" style="width:80px; ">
							<option value="1" <?php 
                if ($show_hide[$k] == 1) {
                    echo 'selected="selected"';
                }
                ?>
>show</option>
							<option value="0" <?php 
                if ($show_hide[$k] == 0) {
                    echo 'selected="selected"';
                }
                ?>
>hide</option>
							</select> 
							
							<select id="fields<?php 
                echo $k;
                ?>
" name="fields<?php 
                echo $k;
                ?>
" style="width:400px; " onChange="" >
							<?php 
                foreach ($all_labels as $key => $value) {
                    if ($field_label[$k] == $all_ids[$key]) {
                        $selected = 'selected="selected"';
                    } else {
                        $selected = '';
                    }
                    echo '<option value="' . $all_ids[$key] . '" ' . $selected . '>' . $value . '</option>';
                }
                ?>
							</select> 
							<span>if</span>
							
							<select id="all_any<?php 
                echo $k;
                ?>
" name="all_any<?php 
                echo $k;
                ?>
" style="width:60px; ">
							<option value="and" <?php 
                if ($all_any[$k] == "and") {
                    echo 'selected="selected"';
                }
                ?>
>all</option>
							<option value="or" <?php 
                if ($all_any[$k] == "or") {
                    echo 'selected="selected"';
                }
                ?>
>any</option>
							</select> 
							
							<span>of the following match:</span>	
							<img src="<?php 
                echo WD_FM_URL . '/images/add.png';
                ?>
" title="add" onclick="add_condition_fields(<?php 
                echo $k;
                ?>
,'<?php 
                echo $chose_ids;
                ?>
', '<?php 
                echo htmlspecialchars(addslashes($chose_labels));
                ?>
', '<?php 
                echo $chose_types;
                ?>
', '<?php 
                echo htmlspecialchars(addslashes($chose_paramss));
                ?>
')" style="cursor: pointer; vertical-align: middle;">
							
							<img src="<?php 
                echo WD_FM_URL . '/images/page_delete.png';
                ?>
" onclick="delete_condition('<?php 
                echo $k;
                ?>
')" style="cursor: pointer; vertical-align: middle;">
						</div>
						
						<?php 
                if ($condition_params[$k]) {
                    $_params = explode('*:*next_condition*:*', $condition_params[$k]);
                    $_params = array_slice($_params, 0, count($_params) - 1);
                    foreach ($_params as $key => $_param) {
                        $key_select_or_input = '';
                        $param_values = explode('***', $_param);
                        $multiselect = explode('@@@', $param_values[2]);
                        if (in_array($param_values[0], $ids)) {
                            ?>
								<div id="condition_div<?php 
                            echo $k;
                            ?>
_<?php 
                            echo $key;
                            ?>
">
								<select id="field_labels<?php 
                            echo $k;
                            ?>
_<?php 
                            echo $key;
                            ?>
" onchange="change_choices(this.options[this.selectedIndex].id+'_<?php 
                            echo $key;
                            ?>
','<?php 
                            echo $chose_ids;
                            ?>
', '<?php 
                            echo $chose_types;
                            ?>
', '<?php 
                            echo htmlspecialchars(addslashes($chose_paramss));
                            ?>
')" style="width:350px;"/>
									<?php 
                            foreach ($labels as $key1 => $value) {
                                if ($param_values[0] == $ids[$key1]) {
                                    $selected = 'selected="selected"';
                                    if ($types[$key1] == "type_checkbox" || $types[$key1] == "type_paypal_checkbox") {
                                        $multiple = 'multiple="multiple" class="multiple_select"';
                                    } else {
                                        $multiple = '';
                                    }
                                    $key_select_or_input = $key1;
                                } else {
                                    $selected = '';
                                }
                                if ($field_label[$k] != $ids[$key1]) {
                                    echo '<option id="' . $k . '_' . $key1 . '" value="' . $ids[$key1] . '" ' . $selected . '>' . $value . '</option>';
                                }
                            }
                            ?>
	
								</select>
								
								<select id="is_select<?php 
                            echo $k;
                            ?>
_<?php 
                            echo $key;
                            ?>
" style="vertical-align: top;">
								<option value="==" <?php 
                            if ($param_values[1] == "==") {
                                echo 'selected="selected"';
                            }
                            ?>
>is</option>
								<option value="!=" <?php 
                            if ($param_values[1] == "!=") {
                                echo 'selected="selected"';
                            }
                            ?>
>is not</option>
								<option value="%" <?php 
                            if ($param_values[1] == "%") {
                                echo 'selected="selected"';
                            }
                            ?>
>like</option>

								<option value="!%" <?php 
                            if ($param_values[1] == "!%") {
                                echo 'selected="selected"';
                            }
                            ?>
>not like</option>

								<option value="=" <?php 
                            if ($param_values[1] == "=") {
                                echo 'selected="selected"';
                            }
                            ?>
>empty</option>

								<option value="!" <?php 
                            if ($param_values[1] == "!") {
                                echo 'selected="selected"';
                            }
                            ?>
>not empty</option>

								</select>
								
								<?php 
                            if ($key_select_or_input !== '' && in_array($types[$key_select_or_input], $select_type_fields)) {
                                ?>
								<select id="field_value<?php 
                                echo $k;
                                ?>
_<?php 
                                echo $key;
                                ?>
" <?php 
                                echo $multiple;
                                ?>
 style="vertical-align: top; width: 200px;">
								<?php 
                                switch ($types[$key_select_or_input]) {
                                    case "type_own_select":
                                    case "type_paypal_select":
                                        $w_size = explode('*:*w_size*:*', $paramss[$key_select_or_input]);
                                        break;
                                    case "type_radio":
                                    case "type_checkbox":
                                    case "type_paypal_radio":
                                    case "type_paypal_checkbox":
                                    case "type_paypal_shipping":
                                        $w_size = explode('*:*w_flow*:*', $paramss[$key_select_or_input]);
                                        break;
                                }
                                $w_choices = explode('*:*w_choices*:*', $w_size[1]);
                                $w_choices_array = explode('***', $w_choices[0]);
                                $w_choices_price = explode('*:*w_choices_price*:*', $w_choices[1]);
                                $w_choices_price_array = explode('***', $w_choices_price[0]);
                                for ($m = 0; $m < count($w_choices_array); $m++) {
                                    if ($types[$key_select_or_input] == "type_paypal_checkbox" || $types[$key_select_or_input] == "type_paypal_radio" || $types[$key_select_or_input] == "type_paypal_shipping" || $types[$key_select_or_input] == "type_paypal_select") {
                                        $w_choice = $w_choices_array[$m] . '*:*value*:*' . $w_choices_price_array[$m];
                                    } else {
                                        $w_choice = $w_choices_array[$m];
                                    }
                                    if (in_array(esc_html($w_choice), $multiselect)) {
                                        $selected = 'selected="selected"';
                                    } else {
                                        $selected = '';
                                    }
                                    if (strpos($w_choices_array[$m], '[') === false && strpos($w_choices_array[$m], ']') === false && strpos($w_choices_array[$m], ':') === false) {
                                        echo '<option id="choise_' . $k . '_' . $m . '" value="' . $w_choice . '" ' . $selected . '>' . $w_choices_array[$m] . '</option>';
                                    }
                                }
                                if ($types[$key_select_or_input] == "type_address") {
                                    $w_countries = array("", "Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda", "Argentina", "Armenia", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Brazil", "Brunei", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Central African Republic", "Chad", "Chile", "China", "Colombia", "Comoros", "Congo (Brazzaville)", "Congo", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor (Timor Timur)", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Fiji", "Finland", "France", "Gabon", "Gambia, The", "Georgia", "Germany", "Ghana", "Greece", "Grenada", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Honduras", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, North", "Korea, South", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal", "Qatar", "Romania", "Russia", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia and Montenegro", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Togo", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "Uruguay", "Uzbekistan", "Vanuatu", "Vatican City", "Venezuela", "Vietnam", "Yemen", "Zambia", "Zimbabwe");
                                    $w_options = '';
                                    foreach ($w_countries as $w_country) {
                                        if (in_array($w_country, $multiselect)) {
                                            $selected = 'selected="selected"';
                                        } else {
                                            $selected = '';
                                        }
                                        echo '<option value="' . $w_country . '" ' . $selected . '>' . $w_country . '</option>';
                                    }
                                }
                                ?>
	
								</select>
								<?php 
                            } else {
                                if ($key_select_or_input != '' && ($types[$key_select_or_input] == "type_number" || $types[$key_select_or_input] == "type_phone")) {
                                    $onkeypress_function = "onkeypress='return check_isnum_space(event)'";
                                } else {
                                    if ($key_select_or_input != '' && $types[$key_select_or_input] == "type_paypal_price") {
                                        $onkeypress_function = "onkeypress='return check_isnum_point(event)'";
                                    } else {
                                        $onkeypress_function = "";
                                    }
                                }
                                ?>
								<input id="field_value<?php 
                                echo $k;
                                ?>
_<?php 
                                echo $key;
                                ?>
" type="text" value="<?php 
                                echo $param_values[2];
                                ?>
" <?php 
                                echo $onkeypress_function;
                                ?>
 style="vertical-align: top; width: 200px;"><?php 
                            }
                            ?>
								
								<img src="<?php 
                            echo WD_FM_URL . '/images/delete.png';
                            ?>
" id="delete_condition<?php 
                            echo $k;
                            ?>
_<?php 
                            echo $key;
                            ?>
" onclick="delete_field_condition('<?php 
                            echo $k;
                            ?>
_<?php 
                            echo $key;
                            ?>
')" style="vertical-align: top;">
								</div>
								<?php 
                        }
                    }
                }
                ?>
					</div>
					<?php 
            }
        }
        ?>
				<input type="hidden" id="condition" name="condition" value="<?php 
        echo $row->condition;
        ?>
" />	
				
			</fieldset>
      
      <fieldset id="mapping_fieldset" class="adminform fm_fieldset_deactive">
        <legend style="color:#0B55C4;font-weight: bold;">MySQL Mapping</legend>
        <div>
          <a href="<?php 
        echo add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => 0, 'form_id' => $row->id, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
        ?>
" class="button-secondary thickbox thickbox-preview" id="add_query" title="Add Query" onclick="return false;">
            Add Query
          </a>
          <button class="button-primary thickbox thickbox-preview" onclick="if (fm_check_email('mailToAdd') ||
                           fm_check_email('from_mail') ||
                           fm_check_email('reply_to') ||
                           fm_check_email('mail_from_user') ||
                           fm_check_email('reply_to_user') ||
                           fm_check_email('mail_from_other') ||
                           fm_check_email('reply_to_other') ||
                           fm_check_email('paypal_email')) {return false;}; set_condition(); fm_set_input_value('task', 'remove_query')">Delete</button>
        </div>
				<?php 
        if ($queries) {
            ?>
				<table class="wp-list-table widefat fixed posts table_content">
					<thead>
						<tr>
							<th style="width:4%;" class="table_small_col count_col sub-align">#</th>
							<th style="width:4%;" class="table_small_col count_col sub-align">ID</th>
							<th style="width:6%;" class="manage-column column-cb check-column table_small_col sub-align form_check">
                <input id="check_all" type="checkbox" style="margin:0;">
              </th>
							<th style="width:86%;" class="table_large_col">Query</th>
						</tr>
					</thead>
					<?php 
            $k = 0;
            for ($i = 0, $n = count($queries); $i < $n; $i++) {
                $query = $queries[$i];
                $checked = '<input type="checkbox" id="' . $i . '" name="cid[]" value="' . $query->id . '" />';
                $link = add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => $query->id, 'form_id' => $row->id, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
                ?>
						<tr <?php 
                if ($k) {
                    echo "class=\"alternate\"";
                }
                ?>
>
							<td align="center" class="table_small_col"><?php 
                echo $i + 1;
                ?>
</td>
							<td align="center" class="table_small_col"><?php 
                echo $query->id;
                ?>
</td>
							<td align="center" class="table_small_col check-column"><?php 
                echo $checked;
                ?>
</td>
							<td align="center"><a href="<?php 
                echo $link;
                ?>
" class="thickbox thickbox-preview" onclick="return false;"><?php 
                echo $query->query;
                ?>
</a></td>
						</tr>
						<?php 
                $k = 1 - $k;
            }
            ?>
				</table>
				<?php 
        }
        ?>
			</fieldset>
      <input type="hidden" name="boxchecked" value="0">
      <input type="hidden" name="fieldset_id" id="fieldset_id" value="<?php 
        echo WDW_FM_Library::get('fieldset_id', 'general');
        ?>
" />

      <input type="hidden" id="task" name="task" value=""/>
      <input type="hidden" id="current_id" name="current_id" value="<?php 
        echo $row->id;
        ?>
" />
    </form>
    <script>
      jQuery(window).load(function () {
        form_maker_options_tabs(jQuery("#fieldset_id").val());
        fm_popup();
        function hide_email_labels(event) {
          var e = event.toElement || event.relatedTarget;
          if (e.parentNode == this || e == this) {
             return;
          }
          this.style.display="none";
        }
        if(document.getElementById('mail_from_labels')) {
          document.getElementById('mail_from_labels').addEventListener('mouseout',hide_email_labels,true);
        }
        if(document.getElementById('mail_subject_labels')) {
          document.getElementById('mail_subject_labels').addEventListener('mouseout',hide_email_labels,true);
        }
        if(document.getElementById('mail_from_name_user_labels')) {
          document.getElementById('mail_from_name_user_labels').addEventListener('mouseout',hide_email_labels,true);
        }
        if(document.getElementById('mail_subject_user_labels')) {
          document.getElementById('mail_subject_user_labels').addEventListener('mouseout',hide_email_labels,true);
        }
      });
      function wd_fm_apply_options() {
        set_condition();
        fm_set_input_value('task', 'apply_options');
        document.getElementById('adminForm').submit();
      }
    </script>
    <?php 
    }
Ejemplo n.º 4
0
function form_maker_ajax()
{
    require_once WD_FM_DIR . '/framework/WDW_FM_Library.php';
    $page = WDW_FM_Library::get('action');
    if ($page != 'formmakerwdcaptcha') {
        if (function_exists('current_user_can')) {
            if (!current_user_can('manage_options')) {
                die('Access Denied');
            }
        } else {
            die('Access Denied');
        }
    }
    if ($page != '') {
        require_once WD_FM_DIR . '/admin/controllers/FMController' . ucfirst($page) . '.php';
        $controller_class = 'FMController' . ucfirst($page);
        $controller = new $controller_class();
        $controller->execute();
    }
}
 public function setdefault($id)
 {
     global $wpdb;
     $wpdb->update($wpdb->prefix . 'formmaker_themes', array('default' => 0), array('default' => 1));
     $save = $wpdb->update($wpdb->prefix . 'formmaker_themes', array('default' => 1), array('id' => $id));
     if ($save !== FALSE) {
         $message = 7;
     } else {
         $message = 2;
     }
     // $this->display();
     $page = WDW_FM_Library::get('page');
     WDW_FM_Library::spider_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => $message), admin_url('admin.php')));
 }