function shortcode_reg() { //return "This is a test for signup-builder"; global $wpdb, $signup_builder_table, $user_ID; if ($user_ID) { echo "<p>You are already logged in</p>"; } else { if (!get_option('users_can_register')) { echo "<p>User registration is disabled at the moment</p>"; } else { $signup_builder_table = $wpdb->prefix . "signup_builder"; $use_sql = "SELECT * FROM " . $signup_builder_table . " ORDER BY field_order ASC"; $table_Details = $wpdb->get_results($use_sql); $max = count($table_Details); ?> <script> function login_ajax(type){ if(type =='ajax'){ var_form_data = $('#sb_login_form').serialize(); $("#stylized").fadeOut(); $.ajax({ type: "POST", url: "<?php echo plugins_url('signup-builder/signup-builder-ajax.php'); ?> ", data: var_form_data, success: function(data){ var str=data; var n=str.indexOf("successful"); if(n > 0){ $("#sb_result_login").html(""); window.location.href='<?php echo home_url(); ?> '; }else{ var str=data; var n=str.indexOf("logged in"); if(n > 0){ $("#stylized").addClass("sb_success"); $("#stylized").html("<h3>Oops!<br />You are already logged in. Go <a href=<?php echo home_url(); ?> >home</a></h3>"); }else{ $("#sb_result_login").addClass('sb_error'); $("#sb_result_login").css({padding:"5px"}); //alert( "Data Saved: " + data ); $("#sb_result_login").html(data); } } } }); $("#stylized").fadeIn(); }else{ document.sb_login_form.submit(); } } function reg_ajax(type){ if(type =='ajax'){ var_form_data = $('#sb_reg_form').serialize(); $("#stylized").fadeOut(); $.ajax({ type: "POST", url: "<?php echo plugins_url('signup-builder/signup-builder-ajax.php'); ?> ", data: var_form_data, success: function(data){ var str=data; var n=str.indexOf("successful"); if(n > 0){ $("#sb_result").html(""); $("#stylized").addClass("sb_success"); $("#stylized").html(data); }else{ var str=data; var n=str.indexOf("already"); if(n > 0){ $("#stylized").addClass("sb_success"); $("#stylized").html("<h3>Oops!<br />You are already logged in. Go <a href=<?php echo home_url(); ?> >home</a></h3>"); }else{ $("#sb_result").addClass('sb_error'); $("#sb_result").css({padding:"5px"}); //alert( "Data Saved: " + data ); $("#sb_result").html(data); } } } }); $("#stylized").fadeIn(); }else{ document.sb_reg_form.submit(); } } function submit_data(type){ if( type == "signup"){ reg_ajax('ajax'); } if( type == "login"){ login_ajax('ajax'); } } function cv(id){ //alert (object.val()); if($('#'+ id).attr('checked') == true){ ($('#'+ id).val('true')); }else{ ($('#'+ id).val('false')); } } function hide_login(){ $('#sb_login_form').css({display:'none'}); $('#sb_reg_form').css({display:'block'}); } function hide_signup(){ $('#sb_login_form').css({display:'block'}); $('#sb_reg_form').css({display:'none'}); } <?php if ($_REQUEST['type'] == "login") { ?> hide_signup(); <?php } if ($_REQUEST['type'] == "reg") { ?> hide_login(); <?php } ?> <?php if (get_option('sb_show_value') != "top") { ?> $(document).ready(function(){ $('#sb_login_form').css({display:'block'}); $('#sb_reg_form').css({display:'none'}) }); <?php } ?> </script> <div id="stylized" class="myform" style="height:display:block;clear:both;" > <form method="POST" action="<?php echo plugins_url('signup-builder/signup-builder-ajax.php'); ?> " id="sb_login_form" name="sb_login_form"><?php //echo $_SERVER['REQUEST_URI']; ?> <div><h2 class="widget-title">Login <span id="sb_result_login"></span></h2></div> <!--<h3>Login by filling the form below</h3>--> <hr /> <?php foreach ($table_Details as $builder_list) { $i++; $a = $builder_list->id; //$field_id = "sb_input_" . (string)$i; $field_id = "sb_input_" . (string) $a; #Do not generate ids for these if ($builder_list->field_name == "password" or $builder_list->field_name == "username") { $field_id = $builder_list->field_name; ?> <div class="field"><label for="<?php echo $field_id; ?> "><?php echo $builder_list->field_label; ?> :<em>*</em> <span class="small" id="small_<?php echo $field_id; ?> "><?php echo $builder_list->field_sub_label; ?> </span></label> <?php echo build_input($builder_list->field_type, $field_id . "_login", $required, $builder_list->field_values, $builder_list->field_max_value); ?> <span id="<?php echo $field_id; ?> _login_info"></span> </div> <?php } } ?> <div class="field"><label for="<?php echo $field_id; ?> ">Remember me:</em> <span class="small"></span></label> <?php echo build_input('checkbox', 'remember', 'class="required"', '', 1); ?> <span id="remember_info"></span> </div> <div class="field"><label for="<?php echo $field_id; ?> "> </label> <?php _e(build_input('button_login', 'login_btn', 'sb_default', 'Login Now', '')); ?> </div> <input type="hidden" name="action" id="action" value="login" /> </form> <div class="spacer"></div> <form method="POST" action="<?php echo plugins_url('signup-builder/signup-builder-ajax.php'); ?> " id="sb_reg_form" name="sb_reg_form"><?php //echo $_SERVER['REQUEST_URI']; ?> <div><h2 class="widget-title">Signup <span id="sb_result"></span></h2></div> <hr /> <?php foreach ($table_Details as $builder_list) { $i++; $a = $builder_list->id; $field_id = "sb_input_" . (string) $a; if ($builder_list->field_name == "password" or $builder_list->field_name == "username" or $builder_list->field_name == "email") { $field_id = $builder_list->field_name; $i--; } else { //$myinputs[] = "'". $field_id ."'"; $myinputs[] = $field_id; //$myinputs .= $field_id . ','; } //} if (get_option('sb_key_option') == "no_auth" and $builder_list->field_name == "password") { //}else if(get_option('sb_key_option') =="basic_auth" and $builder_list->field_name == "password" ){ } else { ?> <div class="field"><label for="<?php echo $field_id; ?> "><?php echo $builder_list->field_label; ?> : <?php if ($builder_list->field_isEmpty == 1) { $required = "required"; ?> <em>*</em> <?php } ?> <span class="small" id="small_<?php echo $field_id; ?> "><?php echo $builder_list->field_sub_label; ?> </span></label> <?php echo build_input($builder_list->field_type, $field_id, $required, $builder_list->field_values, $builder_list->field_max_value); ?> <span id="<?php echo $field_id; ?> _info"></span> </div> <input type="hidden" name="<?php echo $field_id; ?> _validate" id="<?php echo $field_id; ?> _validate" value="<?php echo $builder_list->field_isEmpty; ?> " /> <?php } if (get_option('sb_key_option') == "no_auth" and $builder_list->field_name == "password") { $i--; } else { if ($builder_list->field_type == "password") { $i--; ?> <div class="field"><label for="<?php echo $field_id; ?> ">Retype Password:<em>*</em> <span class="small">Retype</span></label> <?php echo build_input('password', 'retype', 'class=""', '', $builder_list->field_max_value); ?> <span id="retype_info"></span> </div> <input type="hidden" name="retype_validate" id="retype_validate" value="1" /> <?php } } } ?> <div class="field"><label for="<?php echo $field_id; ?> "> </label><?php _e(build_input('button_signup', 'submit_btn', 'sb_default', 'Signup Now', '')); ?> </div> <input type="hidden" name="total" id="total" value="<?php echo $i; ?> " /> <input type="hidden" name="myinputs" id="myinputs" value="<?php echo implode(',', $myinputs); ?> " /> <input type="hidden" name="action" id="action" value="signup" /> </form> <div class="spacer"></div> </div> <?php } } }
function show_signup() { //NB Always set wpdb globally! global $wpdb, $signup_builder_table, $user_ID, $update_message, $disable_text; $signup_builder_table = $wpdb->prefix . "signup_builder"; ?> <style> </style> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <!-- --> <script src="<?php echo plugins_url('signup-builder/3rdparty/farbtastic/farbtastic.js'); ?> "></script> <link href="<?php echo plugins_url('signup-builder/3rdparty/farbtastic/farbtastic.css'); ?> " rel="stylesheet" type="text/css" /> <script> jQuery(document).ready(function() { jQuery('#ilctabscolorpicker_bg').hide(); jQuery('#ilctabscolorpicker_bg').farbtastic("#color_bg"); jQuery("#color_bg").click(function(){jQuery('#ilctabscolorpicker_bg').slideToggle()}); jQuery('#ilctabscolorpicker_text').hide(); jQuery('#ilctabscolorpicker_text').farbtastic("#color_text"); jQuery("#color_text").click(function(){jQuery('#ilctabscolorpicker_text').slideToggle()}); }); function change_layout(value){ if(value == "checkbox"){ //alert(value); marker = $('<span />').insertBefore('#fm_field_values'); $('#fm_field_values').detach().attr('type', 'checkbox').insertAfter(marker); $("#fm_field_values").attr("checked", "checked"); $("#fm_field_values").attr("value", "checked"); $('#checkbox_info').detach(); $("#fm_field_values").after("<span id='checkbox_info' style='font-size:11px;color:#999;'> Choose to have this checked or unchecked by default</span>"); marker.remove(); } if(value == "text" || value == "textarea"){ marker = $('<span />').insertBefore('#fm_field_values'); $('#fm_field_values').detach().attr('type', 'text').insertAfter(marker); $("#fm_field_values").attr("value", ""); //$('#checkbox_info').detach() $('#checkbox_info').html("<span id='checkbox_info' style='font-size:11px;color:#999'> Initial default value (Will dissapear once user starts typing)</span>") marker.remove(); } if(value == "dropdown"){ marker = $('<span />').insertBefore('#fm_field_values'); $('#fm_field_values').detach().attr('type', 'text').insertAfter(marker); $("#fm_field_values").attr("value", ""); $('#checkbox_info').html("<span id='checkbox_info' style='font-size:11px;color:#999'> Use comma to seperate dropdown items. (i.e Red,blue,black etc)</span>") marker.remove(); } } </script> <div class='wrap' id="main_body" style="height:1400px;border:0 solid red"> <div id="icon-options-general" class="icon32"><br /></div> <h2><?php echo DISPLAY_NAME; ?> </h2> <?php //if (file_exists( dirname(__FILE__).'/signup-builder-access.php') ){ echo premium_msg(); //} if ($update_message != "") { ?> <div class="updated">   <?php _e($update_message); ?> </div> <?php } ?> <style> .selected_auth{ background:#eee; } .textarea_email{ border:1px solid #999; width:95%; } wrap label {font-size:11px;color:#999;} .hide{display:none;} .show{display:block;} .wrap textarea{font-size:11px;color:#999; height:100px} </style> <script> function hide_show(thisa){ $('#email_basic_auth_div').css({display:'none'}); $('#email_no_auth_div').css({display:'none'}); $('#email_yes_auth_div').css({display:'none'}); $('#'+thisa).css({display:'block'}); } </script> <h3>Registration Type</h3> <div class="tablenav" style="height:240px;width:95%"> <form method="post" action="" id="reg_type" name="reg_type"> <input type="hidden" value="auth_type" id="action" name="action" /> <input type="hidden" value="<?php echo $user_ID; ?> " id="user_id" name="user_id" /> <table class="widefat post fixed" cellspacing="0"> <thead> <tr> <th width=""><label> Basic</label></th> <th width=""><label> Direct</label></th> <th width=""><label> Authentication</label></th> </tr> </thead> <tr> <?php $no_auth_class = 'hide'; $yes_auth_class = 'hide'; $basic_auth_class = 'hide'; $sc = 'Possible values %USER%, %PASS%, %HOME_URL%'; $sc_1 = 'Possible values %USER%, %PASS%, %LINK'; $meta_key = "sb_key_option"; //$checked = get_user_meta($user_ID, $meta_key, true); $checked = get_option($meta_key); if ($checked == "no_auth") { $no_auth_class = "show"; $checked_direct = "checked='checked'"; } else { if ($checked == "yes_auth") { $yes_auth_class = "show"; $checked_auth = "checked='checked'"; } else { if ($checked == "basic_auth" || $checked == "") { $checked_basic = "checked='checked'"; $basic_auth_class = "show"; } } } ?> <th class=""> <input onclick="hide_show('email_basic_auth_div')" id="basic_auth" type="radio" name="auth_type_value" value="basic_auth" <?php echo $checked_basic; ?> /> <label for="basic_auth" onclick="hide_show('email_basic_auth_div')"> Basic: User Active immidiately </label> </th> <th><input onclick="hide_show('email_no_auth_div')" id="no_auth" type="radio" name="auth_type_value" value="no_auth" <?php echo $checked_direct; ?> /> <label for="no_auth" onclick="hide_show('email_no_auth_div')"> Direct: Generated password sent to users email</label></th> <th> <input onclick="hide_show('email_yes_auth_div')" id="yes_auth" type="radio" name="auth_type_value" value="yes_auth" <?php echo $checked_auth; ?> /> <label for="yes_auth" onclick="hide_show('email_yes_auth_div')"> Auth: Authentication link sent to users email</label></th> </tr> <tr> <th colspan="3" > <div class="<?php echo $basic_auth_class; ?> " id="email_basic_auth_div"><label>Generated Email(Basic) <?php echo $sc; ?> <?php echo $disable_text; ?> </label><br /> <textarea name="email_basic_auth" id="email_basic_auth" class="textarea_email"><?php echo get_option('sb_email_basic_auth'); ?> </textarea></div> <div class="<?php echo $no_auth_class; ?> " id="email_no_auth_div"><label>Generated Email(Direct) <?php echo $sc; ?> <?php echo $disable_text; ?> </label><br /> <textarea name="email_no_auth" id="email_no_auth" class="textarea_email"><?php echo get_option('sb_email_no_auth'); ?> </textarea></div> <div class="<?php echo $yes_auth_class; ?> " id="email_yes_auth_div"><label>Generated Email(Authentication) <?php echo $sc_1; ?> <?php echo $disable_text; ?> </label><br /> <textarea name="email_yes_auth" id="email_yes_auth" class="textarea_email"><?php echo get_option('sb_email_yes_auth'); ?> </textarea></div> </th> </tr> </table> <div style="float:right;margin-top:10px"> <input id="reset_to_default" name="reset_to_default" type="button" value="Reset to Default" class="button-secondary" onclick="window.location.href='/wp-admin/admin.php?page=signup-builder/signup-builder.php&action=restore_default_email'"> <input id="add" name="add" type="submit" value="Save Changes" class='button-primary' /></div> </form> </div> <h3>Floating menu customisation</h3> <div class="tablenav" style="height:90px;width:95%"> <form method="post" action="" id="floating_menu" name="floating_menu"> <input type="hidden" value="floating_menu" id="action" name="action" /> <input type="hidden" value="<?php echo $user_ID; ?> " id="user_id" name="user_id" /> <table class=" widefat post fixed " cellspacing="0"> <thead> <tr> <th ><label> Top Left</label></th> <th width=""><label> Top Right</label></th> <th width=""><label> Background Color</label></th> <th width=""><label> Font Color</label></th> </tr> </thead> <tr valign="top"> <?php $meta_key = "sb_align_menu"; //$checked = get_user_meta($user_ID, $meta_key, true); //$floating_menu = get_option( $meta_key ); $checked_f = get_option($meta_key); if ($checked_f == "left" || $checked_f == "") { $checked_left = "checked='checked'"; } else { if ($checked_f == "right") { $checked_right = "checked='checked'"; } else { if ($checked_f == "center") { $checked_center = "checked='checked'"; } } } ?> <th> <input id="align_value" type="radio" name="align_value" value="left" <?php echo $checked_left; ?> /> <span style='font-size:11px;color:#999'> Align top left </span> </th> <th> <input id="align_value" type="radio" name="align_value" value="right" <?php echo $checked_right; ?> /> <span style='font-size:11px;color:#999'> Align top right</span> </th> <th> <label for="color_bg"><input type="text" id="color_bg" name="color_bg" value="<?php echo get_option('sb_menu_bg'); ?> " /> </label><span style='font-size:11px;color:#999'><?php echo $disable_text; ?> </span> <div id="ilctabscolorpicker_bg"></div> </th> <th> <label for="color_text"><input type="text" id="color_text" name="color_text" value="<?php echo get_option('sb_menu_text'); ?> " /></label><span style='font-size:11px;color:#999'><?php echo $disable_text; ?> </span> <div id="ilctabscolorpicker_text"></div> </th> </tr> </table> <div style="float:right;margin-top:10px"> <input id="reset_to_default" name="reset_to_default" type="button" value="Reset to Default" class="button-secondary" onclick="window.location.href='/wp-admin/admin.php?page=signup-builder/signup-builder.php&action=restore_default_menu'"> <input id="add" name="add" type="submit" value="Save Changes" class='button-primary' /></div> </form> </div> <div class="tablenav" style="height:90px;width:95%"> <h3>GUI Types</h3> <form method="post" action="" id="top_widget" name="top_widget"> <input type="hidden" value="top_widget" id="action" name="action" /> <input type="hidden" value="<?php echo $user_ID; ?> " id="user_id" name="user_id" /> <table class="widefat post fixed" cellspacing="0"> <thead> <tr> <th colspan="2"><label> Signup and Login GUI</label></th> </tr> </thead> <tr> <?php $meta_key = "sb_top_widget"; //$checked = get_user_meta($user_ID, $meta_key, true); $top_widget = get_option($meta_key); $meta_key = "sb_show_value"; //$checked = get_user_meta($user_ID, $meta_key, true); $checked = get_option($meta_key); if ($checked == "page" || $checked == "") { $checked_page = "checked='checked'"; } else { $checked_top = "checked='checked'"; } ?> <th> <input id="show_value" type="radio" name="show_value" value="top" <?php echo $checked_top; ?> /> <span style='font-size:11px;color:#999'> Use Jquery Overlay <?php echo $disable_text; ?> </span> </th> <th> <input id="show_value" type="radio" name="show_value" value="page" <?php echo $checked_page; ?> /> <span style='font-size:11px;color:#999'> Use Wordpress Page</span> </th> </tr> </table> <div style="float:right;margin-top:10px"><input id="add" name="add" type="submit" value="Save Changes" class='button-primary' /></div> </form> </div> <div class="tablenav" style="height:100px;width:95%"> <h3>Add Form Field</h3> <form method="post" action="" id="add_field" name="add_field"> <input type="hidden" value="add" id="action" name="action" /> <table class="widefat post fixed" cellspacing="0"> <thead> <tr> <th width="120"><label> Type</label></th> <th width="100"><label> Required</label></th> <th width="150"><label> Label name</label></th> <th width=""><label> Default Value</label></th> </tr> </thead> <tr> <th> <select id="fm_field_type" name="fm_field_type" onchange="change_layout(document.getElementById('fm_field_type').value);" > <option value="text">Textfield</option> <option value="checkbox">Checkbox</option> <option value="textarea">Textarea</option> <option value="dropdown">Dropdown</option> </select> </th> <th> <input id="fm_field_isEmpty" type="checkbox" name="fm_field_isEmpty" value="1" /> <th><input id="fm_field_label" type="text" name="fm_field_label" /></th> <th> <span><input id="fm_field_values" type="text" name="fm_field_values" /></span> </th> </tr> </table> <div style="float:right;margin-top:10px"><input id="add" name="add" type="submit" value="Add form Input" class='button-primary' /></div> </form> </div> <div class="tablenav" style="width:95%"> <h3>Form Field Lists</h3> <table class="widefat post fixed" cellspacing="0"> <thead> <tr> <th width="120"><label>Move</label></th> <th width="100"><label>Field type</label></th> <th width="150"><label>Label name</label></th> <th><label>GUI Display</label></th> </tr> </thead> <?php //Query the Twitter List Table $use_sql = "SELECT * FROM " . $signup_builder_table . " ORDER BY field_order ASC"; $table_Details = $wpdb->get_results($use_sql); $max = count($table_Details); //Loop through the $table_Details Array foreach ($table_Details as $builder_list) { $i++; $field_id = "sb_input_" . (string) $i; $a = $builder_list->id; $b = $builder_list->field_order - 1; $c = $builder_list->field_order + 1; $e = $builder_list->field_order; $can_delete = $builder_list->field_can_delete; ?> <tr> <td> <?php if ($i != 1) { ?> <a href="<?php echo '?page=signup-builder/signup-builder.php&action=order&id=' . $a . '&pos=' . $e . '&newpos=' . $b; ?> " > <img title="move up" style="cursor:pointer" src="<?php echo plugins_url('signup-builder/images/up.jpeg'); ?> " width="16" height="16" alt="Move up" /> </a> <?php } ?> <?php if ($i != $max) { ?> <a href="<?php echo '?page=signup-builder/signup-builder.php&action=order&id=' . $a . '&pos=' . $e . '&newpos=' . $c; ?> " > <img title="move down" src="<?php echo plugins_url('signup-builder/images/down.jpg'); ?> " width="16" height="16" alt="Move down" /></a> <?php } ?> <?php if ($i > 2) { ?> <a href="?page=signup-builder/signup-builder.php&action=delete&id=<?php echo $a; ?> &can_delete=<?php echo $can_delete; ?> " ><img src="<?php echo plugins_url('signup-builder/images/delete.png'); ?> " width="16" height="16" alt="delete" /> </a> <?php } ?> </td> <td><?php echo $builder_list->field_type; ?> </td> <!-- <td><?php echo $builder_list->field_name; ?> </td> <td><?php echo $builder_list->field_class; ?> </td>--> <td><?php echo $builder_list->field_label; ?> </td> <td><?php echo build_input($builder_list->field_type, $field_id, $builder_list->field_class, $builder_list->field_values, $builder_list->field_max_value); ?> </td> </tr> <?php } ?> </table> </div> </div> <?php }