function cimy_uef_mail_fields($user = false, $activation_data = false) { global $wp_hidden_fields, $cimy_uef_domain, $fields_name_prefix, $wp_fields_name_prefix; $message = ""; $meta = false; if (empty($user) && empty($activation_data)) { return $message; } if (empty($user)) { $user_login = $activation_data["user_login"]; // $user_email = $activation_data["user_email"]; if (!is_array($activation_data["meta"])) { $meta = unserialize($activation_data["meta"]); } else { $meta = $activation_data["meta"]; } // neet to do it here, otherwise I pick up main options instead of blog's ones cimy_switch_to_blog($meta); $options = cimy_get_options(); restore_current_blog(); if (!$options["mail_include_fields"]) { return $message; } $user = new WP_User($user_login); } if (empty($meta)) { // normal fields foreach ($wp_hidden_fields as $field) { if (!empty($user->{$field["post_name"]}) && $field["type"] != "password") { $message .= sprintf(__('%s: %s', $cimy_uef_domain), $field["label"], $user->{$field["post_name"]}) . "\r\n"; } } } else { $fields = get_cimyFields(true); foreach ($fields as $field) { if (!empty($meta[$wp_fields_name_prefix . $field["NAME"]]) && $field["TYPE"] != "password") { $message .= sprintf(__('%s: %s', $cimy_uef_domain), $field["LABEL"], $meta[$wp_fields_name_prefix . $field["NAME"]]) . "\r\n"; } } } $message .= "\r\n"; // extra fields; if (empty($meta)) { $ef_data = get_cimyFieldValue($user->ID, false); foreach ($ef_data as $field) { if (!empty($field["VALUE"])) { $message .= sprintf(__('%s: %s', $cimy_uef_domain), $field["LABEL"], $field["VALUE"]) . "\r\n"; } } } else { $extra_fields = get_cimyFields(false, true); foreach ($extra_fields as $field) { if (!empty($meta[$fields_name_prefix . $field["NAME"]])) { $message .= sprintf(__('%s: %s', $cimy_uef_domain), $field["LABEL"], $meta[$fields_name_prefix . $field["NAME"]]) . "\r\n"; } } } return $message; }
function cimy_manage_db($command) { global $wpdb, $wpdb_data_table, $wpdb_wp_fields_table, $wpdb_fields_table, $cimy_uef_options, $cimy_uef_version, $cimy_uef_domain; if (!cimy_check_admin('activate_plugins')) { return; } $options = array('extra_fields_title' => __("Extra Fields", $cimy_uef_domain), 'users_per_page' => 50, 'aue_hidden_fields' => array('website', 'posts', 'email'), 'wp_hidden_fields' => array(), 'fieldset_title' => '', 'captcha' => 'none'); switch ($command) { case 'new_options': $options['version'] = $cimy_uef_version; cimy_set_options($options); break; case 'default_options': $old_options = cimy_get_options(); if (isset($old_options['version'])) { $options['version'] = $old_options['version']; } else { $options['version'] = $cimy_uef_version; } cimy_set_options($options); break; case 'drop_options': if (is_multisite()) { delete_site_option($cimy_uef_options); } else { delete_option($cimy_uef_options); } break; case 'empty_wp_fields': if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb_wp_fields_table}'") == $wpdb_wp_fields_table) { $sql = "TRUNCATE TABLE " . $wpdb_wp_fields_table; $wpdb->query($sql); } break; case 'empty_extra_fields': if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb_fields_table}'") == $wpdb_fields_table) { $sql = "TRUNCATE TABLE " . $wpdb_fields_table; $wpdb->query($sql); } break; case 'empty_data': if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb_data_table}'") == $wpdb_data_table) { $sql = "TRUNCATE TABLE " . $wpdb_data_table; $wpdb->query($sql); } break; case 'drop_wp_fields': if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb_wp_fields_table}'") == $wpdb_wp_fields_table) { $sql = "DROP TABLE " . $wpdb_wp_fields_table; $wpdb->query($sql); } break; case 'drop_extra_fields': if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb_fields_table}'") == $wpdb_fields_table) { $sql = "DROP TABLE " . $wpdb_fields_table; $wpdb->query($sql); } break; case 'drop_data': if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb_data_table}'") == $wpdb_data_table) { $sql = "DROP TABLE " . $wpdb_data_table; $wpdb->query($sql); } break; } }
function cimy_uef_activate_signup($key) { global $wpdb, $current_site, $cimy_uef_domain; // seems no more required since WP 3.1 // require_once( ABSPATH . WPINC . '/registration.php'); $signup = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "signups WHERE activation_key = %s", $key)); if (empty($signup)) { return new WP_Error('invalid_key', __('Invalid activation key.', $cimy_uef_domain)); } if ($signup->active) { return new WP_Error('already_active', __('The site is already active.', $cimy_uef_domain), $signup); } $meta = unserialize($signup->meta); $user_login = $wpdb->escape($signup->user_login); $user_email = $wpdb->escape($signup->user_email); if (!empty($meta["cimy_uef_wp_PASSWORD"])) { $password = $meta["cimy_uef_wp_PASSWORD"]; } else { $password = wp_generate_password(); } $user_id = username_exists($user_login); if (!$user_id) { $user_id = wp_create_user($user_login, $password, $user_email); } else { $user_already_exists = true; } if (!$user_id) { return new WP_Error('create_user', __('Could not create user'), $signup); } else { cimy_register_user_extra_fields($user_id, $password, $meta); } if (empty($meta["cimy_uef_wp_PASSWORD"]) && $user_already_exists) { update_user_option($user_id, 'default_password_nag', true, true); } //Set up the Password change nag. $now = current_time('mysql', true); $wpdb->update($wpdb->prefix . "signups", array('active' => 1, 'activated' => $now), array('activation_key' => $key)); if (isset($user_already_exists)) { return new WP_Error('user_already_exists', __('That username is already activated.', $cimy_uef_domain), $signup); } $options = cimy_get_options(); wp_new_user_notification_original($user_id, $password, $options["mail_include_fields"], $meta, $options["welcome_email"]); return array('user_id' => $user_id, 'password' => $password, 'meta' => $meta); }
function cimy_uef_init_javascripts($rule_name) { global $cuef_plugin_dir, $cuef_css_webpath, $cuef_js_webpath; $options = cimy_get_options(); if ($options['image_fields'][$rule_name] > 0) { wp_enqueue_script('imgareaselect', "", array("jquery")); wp_enqueue_style('imgareaselect'); wp_register_script('cimy_uef_img_selection', $cuef_js_webpath . "/img_selection.js", array(), false); wp_enqueue_script('cimy_uef_img_selection'); } if ($options['file_fields'][$rule_name] > 0) { cimy_uef_init_upload_js(); } if ($rule_name == "show_in_profile") { if ($options['tinymce_fields'][$rule_name] > 0 && function_exists("wp_editor")) { wp_register_style("cimy_uef_tinymce", $cuef_css_webpath . "/cimy_uef_tinymce.css", false, false); wp_enqueue_style('cimy_uef_tinymce'); } } if ($rule_name == "show_in_reg") { // This is needed for registration form on WordPress >= 3.3 if ($options['tinymce_fields'][$rule_name] > 0 && function_exists("wp_editor")) { wp_enqueue_script('jquery'); wp_enqueue_script('utils'); } if ($options['password_meter']) { wp_register_script("cimy_uef_password_strength_meter", $cuef_js_webpath . "/password_strength_meter.js", array("password-strength-meter"), false); wp_enqueue_script('cimy_uef_password_strength_meter'); } // damn WordPress bugs if (is_multisite()) { wp_print_scripts(); } } }
function cimy_show_options($results, $embedded) { global $wpdb, $wpdb_wp_fields_table, $wpdb_fields_table, $wpdb_data_table, $max_length_fieldset_value, $cimy_uef_name, $cimy_uef_url, $cimy_project_url, $cimy_uef_version, $cimy_uef_domain, $cimy_top_menu, $max_length_extra_fields_title, $cuef_upload_path, $cuef_plugin_dir; if (!cimy_check_admin('manage_options')) { return; } // save options engine if (isset($_POST['cimy_options']) && isset($cimy_top_menu)) { $results = cimy_save_options(); } $options = cimy_get_options(); wp_print_scripts("cimy_uef_upload_file"); $warning_msg = $wpdb->escape(__("Please upload an image with one of the following extensions", $cimy_uef_domain)); if ($options) { if (!is_dir($cuef_upload_path) && is_writable(WP_CONTENT_DIR)) { if (defined("FS_CHMOD_DIR")) { @mkdir($cuef_upload_path, FS_CHMOD_DIR); } else { @mkdir($cuef_upload_path, 0777); } } $options['fieldset_title'] = esc_attr($options['fieldset_title']); $welcome_email = $options['welcome_email']; isset($options['recaptcha_public_key']) ? $recaptcha_public_key = $options['recaptcha_public_key'] : ($recaptcha_public_key = ''); isset($options['recaptcha_private_key']) ? $recaptcha_private_key = $options['recaptcha_private_key'] : ($recaptcha_private_key = ''); $db_options = true; } else { $db_options = false; $options['fieldset_title'] = ""; $welcome_email = ''; $recaptcha_public_key = ''; $recaptcha_private_key = ''; } if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb_wp_fields_table}'") == $wpdb_wp_fields_table) { $sql = "SELECT id, COUNT(*) FROM " . $wpdb_wp_fields_table . " GROUP BY id"; $db_wp_fields = $wpdb->query($sql); } else { $db_wp_fields = -1; } if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb_fields_table}'") == $wpdb_fields_table) { $sql = "SELECT id, COUNT(*) FROM " . $wpdb_fields_table . " GROUP BY id"; $db_extra_fields = $wpdb->query($sql); } else { $db_extra_fields = -1; } if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb_data_table}'") == $wpdb_data_table) { $db_users_data = true; } else { $db_users_data = false; } $ret = array(); $ret['db_options'] = $db_options; $ret['db_extra_fields'] = $db_extra_fields; $ret['db_wp_fields'] = count($options['wp_hidden_fields']); $ret['db_users_data'] = $db_users_data; if (isset($cimy_top_menu) && $embedded) { return $ret; } $update_db_label = $wpdb->escape(__("This operation will create/update all missing tables/options, do you want to proceed?", $cimy_uef_domain)); ?> <div class="wrap" id="options"> <?php if (function_exists("screen_icon")) { screen_icon("options-general"); } ?> <h2><?php _e("Options"); if (!isset($cimy_top_menu)) { ?> - <a href="#addfield"><?php _e("Add a new Field", $cimy_uef_domain); ?> </a> - <a href="#extrafields"><?php _e("Extra Fields", $cimy_uef_domain); ?> </a><?php } ?> </h2> <table class="form-table"> <tr> <th scope="row" width="40%"> <strong><a href="<?php echo $cimy_project_url; ?> "><?php _e("Support the Cimy Project", $cimy_uef_domain); ?> </a></strong> </th> <td width="60%"> <form style="text-align: left;" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input name="cmd" type="hidden" value="_s-xclick" /> <input name="hosted_button_id" type="hidden" value="8774924" /> <input alt="PayPal - The safer, easier way to pay online." name="submit" src="https://www.paypal.com/en_US/GB/i/btn/btn_donateCC_LG.gif" type="image" /> <img src="https://www.paypal.com/it_IT/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /> </form> <?php _e("This plug-in is the results of hours of development to add new features, support new WordPress versions and fix bugs, please donate money if saved you from spending all these hours!", $cimy_uef_domain); ?> </td> </tr> </table> <?php // print successes if there are some if (count($results) > 0) { ?> <div class="updated"> <h3><?php _e("SUCCESSFUL", $cimy_uef_domain); ?> </h3> <ul> <?php foreach ($results as $result) { echo "<li>" . $result . "</li>"; } ?> </ul> <br /> </div> <?php } ?> <form method="post" action="#options" id="cimy_uef_options"> <?php wp_nonce_field('cimy_uef_options', 'cimy_uef_optionsnonce', false); ?> <p class="submit" style="border-width: 0px;"><input class="button-primary" type="submit" name="Submit" value="<?php _e('Save Changes'); ?> " /></p> <h3><?php _e("General"); ?> </h3> <table class="form-table"> <tr> <th scope="row" width="40%"> <strong><a href="<?php echo $cimy_uef_url; ?> "><?php echo $cimy_uef_name; ?> </a></strong> </th> <td width="60%">v<?php echo $options['version']; if ($cimy_uef_version != $options['version']) { ?> (<?php _e("installed is", $cimy_uef_domain); ?> v<?php echo $cimy_uef_version; ?> )<?php } if (!$db_options) { ?> <br /><h4><?php _e("OPTIONS DELETED!", $cimy_uef_domain); ?> </h4> <input type="hidden" name="do_not_save_options" value="1" /> <p class="submit" style="border-width: 0px;"><input class="button-primary" type="submit" name="force_activation" value="<?php _e("Fix the problem", $cimy_uef_domain); ?> " onclick="return confirm('<?php echo $update_db_label; ?> ');" /></p><?php } else { if ($cimy_uef_version != $options['version']) { ?> <br /><h4><?php _e("VERSIONS MISMATCH! This because you haven't de-activated and re-activated the plug-in after the update! This could give problems...", $cimy_uef_domain); ?> </h4> <p class="submit" style="border-width: 0px;"><input class="button-primary" type="submit" name="force_activation" value="<?php _e("Fix the problem", $cimy_uef_domain); ?> " onclick="return confirm('<?php echo $update_db_label; ?> ');" /></p><?php } } ?> </td> </tr> <tr> <th scope="row"><?php _e("Picture/Avatar upload", $cimy_uef_domain); ?> </th> <td> <?php if (is_writable($cuef_upload_path)) { echo "<em>" . $cuef_upload_path . "</em><br />" . __("is created and writable", $cimy_uef_domain); } else { echo "<em>" . $cuef_upload_path . "</em><br />" . __("is NOT created or webserver does NOT have permission to write on it", $cimy_uef_domain); } ?> </td> </tr> <tr> <th scope="row"> <input type="checkbox" name="mail_include_fields" value="1"<?php checked(true, $options['mail_include_fields'], true); ?> /> <?php _e("Show all fields in the welcome email", $cimy_uef_domain); ?> </th> <td> <?php _e("the email sent to the admin and to the user upon registration will have all fields", $cimy_uef_domain); ?> </td> </tr> <?php if (!is_multisite()) { ?> <tr> <th scope="row"> <input type="checkbox" name="confirm_email" value="1"<?php checked(true, $options['confirm_email'], true); ?> /> <?php _e("Enable email confirmation", $cimy_uef_domain); ?> </th> <td> <?php _e("user that registers should confirm its email address via a link click", $cimy_uef_domain); echo "<br />"; _e("<strong>note:</strong> this option turned on will automatically disable (only during the registration) all upload fields: file, picture, avatar", $cimy_uef_domain); ?> </td> </tr> <tr> <th scope="row"> <input type="checkbox" name="confirm_form" value="1"<?php checked(true, $options['confirm_form'], true); ?> /> <?php _e("Enable form confirmation", $cimy_uef_domain); ?> </th> <td> <?php _e("a summary of the registration form will be presented to the user", $cimy_uef_domain); ?> </td> </tr> <tr> <th scope="row"> <?php _e("Customize welcome email sent to the new user", $cimy_uef_domain); ?> </th> <td> <textarea name="welcome_email" rows="6" cols="50"><?php echo esc_html($welcome_email); ?> </textarea><br /> <?php _e("if you change or remove the placeholders then the email won't have the correct information", $cimy_uef_domain); ?> </td> </tr> <tr> <th scope="row"> <input type="checkbox" name="redirect_to" value="source"<?php checked("source", $options['redirect_to'], true); ?> /> <?php _e("Redirect to the source", $cimy_uef_domain); ?> </th> <td> <?php _e("after the registration or confirmation the user will be redirected to the address where was exactly before clicking on the registration link", $cimy_uef_domain); ?> </td> </tr> <?php } ?> <tr> <th scope="row"> <input type="radio" name="captcha" value="none"<?php checked("none", $options['captcha'], true); ?> /> <?php _e('No captcha', $cimy_uef_domain); ?> </a> </th> <td> </td> </tr> <tr> <th scope="row"> <input type="radio" name="captcha" value="recaptcha"<?php checked("recaptcha", $options['captcha'], true); ?> /> <?php _e('Enable <a href="http://www.google.com/recaptcha" target="_blank">reCAPTCHA</a>', $cimy_uef_domain); ?> </a> </th> <td> <?php _e("Public KEY", $cimy_uef_domain); ?> <input type="text" name="recaptcha_public_key" value="<?php echo esc_attr($recaptcha_public_key); ?> " size="40" /><br /> <?php _e("Private KEY", $cimy_uef_domain); ?> <input type="text" name="recaptcha_private_key" value="<?php echo esc_attr($recaptcha_private_key); ?> " size="40" /> </td> </tr> <tr> <th scope="row"> <input type="radio" name="captcha" value="securimage"<?php checked("securimage", $options['captcha'], true); ?> /> <?php _e('Enable <a href="http://www.phpcaptcha.org/" target="_blank">Securimage Captcha</a>', $cimy_uef_domain); ?> </a> </th> <td> <?php _e('This captcha is probably weaker, but is easier for users', $cimy_uef_domain); ?> <?php if (!is_file($cuef_plugin_dir . '/securimage/securimage.php')) { echo "<br />"; printf(__('<strong>WARNING: to activate this captcha download <a href="http://www.phpcaptcha.org/latest.zip" target="_blank">this package</a> and unpack it under %s</strong>', $cimy_uef_domain), $cuef_plugin_dir . '/recaptcha/'); } ?> </td> </tr> <?php if (!is_multisite()) { ?> <tr> <th scope="row"><?php _e("Change login/registration page logo", $cimy_uef_domain); ?> </th> <td> <?php if (!empty($options["registration-logo"])) { ?> <input type="hidden" name="registration_logo_oldfile" value="<?php echo basename($options["registration-logo"]); ?> " /> <?php echo esc_html(basename($options["registration-logo"])) . '<br />'; ?> <input type="checkbox" name="registration_logo_del" value="1" /> <?php echo " " . __("Delete the picture", $cimy_uef_domain); ?> <br /><br /><?php } ?> <input type="file" id="registration_logo" name="registration_logo" onchange="uploadFile('cimy_uef_options', 'registration_logo', '<?php echo $warning_msg; ?> ', Array('gif', 'png', 'jpg', 'jpeg', 'tiff'))" /> <?php _e("Maximum recommended logo width is 328px, but any height should work.", $cimy_uef_domain); ?> </td> </tr> <?php } ?> </table> <br /> <h3><?php _e("Database", $cimy_uef_domain); ?> </h3> <table class="form-table"> <tr> <th scope="row" width="40%"><input type="checkbox" name="db_options_check" value="1" /> Cimy User Extra Fields <?php _e("Options"); ?> </th> <td width="60%"> <?php if ($db_options) { ?> <select name="db_options"> <option value="none">- <?php _e("select action", $cimy_uef_domain); ?> -</option> <option value="default"><?php _e("Default values", $cimy_uef_domain); ?> </option> <option value="delete"><?php _e("Delete"); ?> </option> </select><?php } else { echo "<strong>" . __("NOT PRESENT", $cimy_uef_domain) . "</strong>"; } ?> </td> </tr> <tr> <th scope="row"><input type="checkbox" name="db_wp_fields_check" value="1" /> <?php _e("WordPress Fields table", $cimy_uef_domain); ?> </th> <td> <?php if ($db_wp_fields >= 0) { ?> <select name="db_wp_fields"> <option value="none">- <?php _e("select action", $cimy_uef_domain); ?> -</option> <option value="empty"><?php _e("Empty", $cimy_uef_domain); ?> </option> <option value="delete"><?php _e("Delete"); ?> </option> </select><?php } else { echo "<strong>" . __("NOT PRESENT", $cimy_uef_domain) . "</strong>"; } ?> </td> </tr> <tr> <th scope="row"><input type="checkbox" name="db_extra_fields_check" value="1" /> <?php _e("Extra Fields table", $cimy_uef_domain); ?> </th> <td> <?php if ($db_extra_fields >= 0) { ?> <select name="db_extra_fields"> <option value="none">- <?php _e("select action", $cimy_uef_domain); ?> -</option> <option value="empty"><?php _e("Empty", $cimy_uef_domain); ?> </option> <option value="delete"><?php _e("Delete"); ?> </option> </select><?php } else { echo "<strong>" . __("NOT PRESENT", $cimy_uef_domain) . "</strong>"; } ?> </td> </tr> <tr> <th scope="row"><input type="checkbox" name="db_data_check" value="1" /> <?php _e("Users Data table", $cimy_uef_domain); ?> </th> <td> <?php if ($db_users_data) { ?> <select name="db_data"> <option value="none">- <?php _e("select action", $cimy_uef_domain); ?> -</option> <option value="empty"><?php _e("Empty", $cimy_uef_domain); ?> </option> <option value="delete"><?php _e("Delete"); ?> </option> </select> <?php _e("all data inserted by users in all and only extra fields", $cimy_uef_domain); } else { echo "<strong>" . __("NOT PRESENT", $cimy_uef_domain) . "</strong>"; } ?> </td> </tr> <tr> <th scope="row"><input type="checkbox" name="force_activation" value="1" /> <?php _e("Force tables creation", $cimy_uef_domain); ?> </th> <td> <?php _e("equivalent to de-activate and activate the plug-in; no other operation will be performed", $cimy_uef_domain); ?> </td> </tr> </table> <br /> <h3><?php _e("User Profile", $cimy_uef_domain); ?> </h3> <table class="form-table"> <tr> <th scope="row" width="40%"><?php _e("Extra Fields section title", $cimy_uef_domain); ?> </th> <td width="60%"><input type="text" name="extra_fields_title" value="<?php echo esc_attr($options['extra_fields_title']); ?> " size="35" maxlength="<?php echo $max_length_extra_fields_title; ?> " /></td> </tr> <tr> <th scope="row"><?php _e("Fieldset's titles, separates with comma", $cimy_uef_domain); ?> <br /><?php _e("example: title1,title2,title3", $cimy_uef_domain); ?> </th> <td><input type="text" name="fieldset_title" value="<?php echo esc_attr($options['fieldset_title']); ?> " size="35" maxlength="<?php echo $max_length_fieldset_value; ?> " /> <?php _e("<strong>note:</strong> if you change order or remove fieldsets you may need to set all extra fields' fieldset assigment again", $cimy_uef_domain); ?> </td> </tr> </table> <br /> <h3><?php _e("Authors & Users Extended", $cimy_uef_domain); ?> </h3> <table class="form-table"> <tr> <th scope="row" width="40%"> <input type="checkbox" name="hide_username" value="1"<?php checked(true, in_array('username', $options['aue_hidden_fields']), true); ?> /> <?php _e("Hide username field", $cimy_uef_domain); ?> </th> <td width="60%"></td> </tr> <tr> <th> <input type="checkbox" name="hide_name" value="1"<?php checked(true, in_array('name', $options['aue_hidden_fields']), true); ?> /> <?php _e("Hide name field", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th scope="row"><input type="checkbox" name="hide_email" value="1"<?php checked(true, in_array('email', $options['aue_hidden_fields']), true); ?> /> <?php _e("Hide email field", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th scope="row"><input type="checkbox" name="hide_role" value="1"<?php checked(true, in_array('role', $options['aue_hidden_fields']), true); ?> /> <?php _e("Hide role field", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th scope="row"><input type="checkbox" name="hide_website" value="1"<?php checked(true, in_array('website', $options['aue_hidden_fields']), true); ?> /> <?php _e("Hide website field", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th><input type="checkbox" name="hide_posts" value="1"<?php checked(true, in_array('posts', $options['aue_hidden_fields']), true); ?> /> <?php _e("Hide n. posts field", $cimy_uef_domain); ?> </th> <td></td> </tr> </table> <br /> <h3><?php _e("WordPress hidden fields", $cimy_uef_domain); ?> </h3> <table class="form-table"> <tr> <th scope="row" width="40%"><input type="checkbox" name="show_wp_password" value="1"<?php checked(true, in_array('password', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show password", $cimy_uef_domain); ?> </th> <td width="60%"></td> </tr> <tr> <th> <input type="checkbox" name="show_wp_password2" value="1"<?php checked(true, in_array('password2', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show confirmation password", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th> <input type="checkbox" name="show_wp_password_meter" value="1"<?php checked(true, $options['password_meter'], true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show password strength meter", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th><input type="checkbox" name="show_wp_firstname" value="1"<?php checked(true, in_array('firstname', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show first name", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th><input type="checkbox" name="show_wp_lastname" value="1"<?php checked(true, in_array('lastname', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show last name", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th><input type="checkbox" name="show_wp_nickname" value="1"<?php checked(true, in_array('nickname', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show nickname", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th scope="row"><input type="checkbox" name="show_wp_website" value="1"<?php checked(true, in_array('website', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show website", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th scope="row"><input type="checkbox" name="show_wp_aim" value="1"<?php checked(true, in_array('aim', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show AIM", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th scope="row"><input type="checkbox" name="show_wp_yahoo" value="1"<?php checked(true, in_array('yahoo', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show Yahoo IM", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th scope="row"><input type="checkbox" name="show_wp_jgt" value="1"<?php checked(true, in_array('jgt', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show Jabber / Google Talk", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th scope="row"><input type="checkbox" name="show_wp_bio-info" value="1"<?php checked(true, in_array('bio-info', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show Biographical Info", $cimy_uef_domain); ?> </th> <td></td> </tr> </table> <input type="hidden" name="cimy_options" value="1" /> <p class="submit"><input class="button-primary" type="submit" name="Submit" value="<?php _e('Save Changes'); ?> " /></p> </form> </div> <br /> <?php return $ret; }
function cimy_change_login_registration_logo() { $options = cimy_get_options(); if (!empty($options["registration-logo"])) { global $cuef_upload_webpath; list($logo_width, $logo_height, $logo_type, $logo_attr) = getimagesize($options["registration-logo"]); ?> <style type="text/css"> #login h1:first-child a:first-child { background: url(<?php echo esc_url($cuef_upload_webpath . basename($options["registration-logo"])); ?> ) no-repeat top center; background-position: center top; background-size: <?php echo $logo_width; ?> px <?php echo $logo_height; ?> px; width: <?php echo max(328, $logo_width); ?> px; height: <?php echo $logo_height; ?> px; text-indent: -9999px; overflow: hidden; padding-bottom: 15px; display: block; } </style> <?php } }
function cimy_uef_init_javascripts($rule_name) { global $cuef_plugin_dir, $cuef_css_webpath, $cuef_js_webpath; $options = cimy_get_options(); if ($options['image_fields'][$rule_name] > 0) { wp_enqueue_style('imgareaselect'); wp_register_script('cimy_uef_img_selection', $cuef_js_webpath . "/img_selection.js", array("imgareaselect", "jquery"), false); wp_enqueue_script('cimy_uef_img_selection'); } if ($options['file_fields'][$rule_name] > 0) { cimy_uef_init_upload_js(); } if ($options['date_fields'][$rule_name] > 0) { wp_register_script("cimy_uef_datepicker", $cuef_js_webpath . "/datepicker.js", array("jquery-ui-core", "jquery-ui-datepicker"), false, true); wp_enqueue_script('cimy_uef_datepicker'); // Themes list: http://blog.jqueryui.com/ wp_register_style('jquery-ui-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/smoothness/jquery-ui.css', array()); wp_enqueue_style('jquery-ui-style'); // Fix for the following bug: http://forum.jquery.com/topic/jquery-ui-datepicker-initial-display-none-fixup wp_register_style('cimy_uef_datepicker', $cuef_css_webpath . '/cimy_uef_datepicker.css', array()); wp_enqueue_style('cimy_uef_datepicker'); // Pass the array to the enqueued JS wp_localize_script('cimy_uef_datepicker', 'datepickerL10n', cimy_uef_date_picker_l10n()); } if ($rule_name == "show_in_profile") { if ($options['tinymce_fields'][$rule_name] > 0 && function_exists("wp_editor")) { wp_register_style("cimy_uef_tinymce", $cuef_css_webpath . "/cimy_uef_tinymce.css", array(), false); wp_enqueue_style('cimy_uef_tinymce'); } } if ($rule_name == "show_in_reg") { // This is needed for registration form on WordPress >= 3.3 if ($options['tinymce_fields'][$rule_name] > 0 && function_exists("wp_editor")) { wp_enqueue_script('jquery'); wp_enqueue_script('utils'); } if ($options['password_meter']) { wp_register_script("cimy_uef_password_strength_meter", $cuef_js_webpath . "/password_strength_meter.js", array("password-strength-meter"), false); wp_enqueue_script('cimy_uef_password_strength_meter'); } // damn WordPress bugs if (is_multisite()) { wp_print_scripts(); } } }
function cimy_extract_ExtraFields() { global $wpdb, $user_ID, $wpdb_data_table, $start_cimy_uef_comment, $end_cimy_uef_comment, $rule_profile_value, $cimy_uef_options, $rule_maxlen_needed, $fields_name_prefix, $cuef_upload_path, $cimy_uef_domain, $cuef_plugin_dir, $cimy_uef_file_types, $cimy_uef_textarea_types, $user_level; // if editing a different user (only admin) if (isset($_GET['user_id'])) { $get_user_id = $_GET['user_id']; if (!current_user_can('edit_user', $get_user_id)) { return; } } else { if (isset($_POST['user_id'])) { $get_user_id = $_POST['user_id']; if (!current_user_can('edit_user', $get_user_id)) { return; } } else { if (!isset($user_ID)) { return; } $get_user_id = $user_ID; } } $get_user_id = intval($get_user_id); $options = cimy_get_options(); $extra_fields = get_cimyFields(false, true); if (cimy_uef_is_multisite_per_blog_installation()) { echo "<input type=\"hidden\" name=\"from_blog_id\" value=\"" . strval(get_current_blog_id()) . "\" />\n"; } if (!empty($extra_fields)) { $upload_image_function = false; echo $start_cimy_uef_comment; if ($options['extra_fields_title'] != "") { echo "<br clear=\"all\" />\n"; echo "<h2>" . esc_html(cimy_wpml_translate_string("a_opt_extra_fields_title", $options['extra_fields_title'])) . "</h2>\n"; } foreach ($extra_fields as $thisField) { $field_id = $thisField['ID']; cimy_insert_ExtraFields_if_not_exist($get_user_id, $field_id); } // $ef_db = $wpdb->get_results("SELECT FIELD_ID, VALUE FROM ".$wpdb_data_table." WHERE USER_ID = ".$get_user_id, ARRAY_A); $radio_checked = array(); $current_fieldset = -1; $tiny_mce_objects = ""; if (!empty($options['fieldset_title'])) { $fieldset_titles = explode(',', $options['fieldset_title']); } else { $fieldset_titles = array(); } $close_table = false; echo '<table class="form-table">'; echo "\n"; foreach ($extra_fields as $thisField) { $value = ""; $old_value = ""; $field_id = $thisField['ID']; $name = $thisField['NAME']; $rules = $thisField['RULES']; $type = $thisField['TYPE']; $label = cimy_wpml_translate_string($name . "_label", $thisField["LABEL"]); $description = cimy_uef_sanitize_content(cimy_wpml_translate_string($name . "_desc", $thisField["DESCRIPTION"])); $fieldset = $thisField['FIELDSET']; $unique_id = $fields_name_prefix . $field_id; $input_name = $fields_name_prefix . esc_attr($name); $field_id_data = $input_name . "_" . $field_id . "_data"; $advanced_options = cimy_uef_parse_advanced_options($rules["advanced_options"]); // if the current user LOGGED IN has not enough permissions to see the field, skip it // apply only for EXTRA FIELDS if ($rules['show_level'] == 'view_cimy_extra_fields') { if (!current_user_can($rules['show_level'])) { continue; } } else { if ($user_level < $rules['show_level']) { continue; } } // if show_level == anonymous then do NOT ovverride other show_xyz rules if ($rules['show_level'] == -1) { // if flag to show the field in the profile is NOT activated, skip it if (!$rules['show_in_profile']) { continue; } } // foreach ($ef_db as $d_field) { // if ($d_field['FIELD_ID'] == $field_id) // $value = $d_field['VALUE']; // } $value = $wpdb->get_var($wpdb->prepare("SELECT VALUE FROM " . $wpdb_data_table . " WHERE USER_ID=%d AND FIELD_ID=%d", $get_user_id, $field_id)); $old_value = $value; if ($type == "radio" && empty($radio_checked[$name])) { $radio_checked[$name] = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM " . $wpdb_data_table . " WHERE USER_ID=%d AND FIELD_ID=%d AND VALUE=\"selected\"", $get_user_id, $field_id)); } // if nothing is inserted and field admin default value then assign it if (in_array($type, $rule_profile_value)) { if (empty($value)) { $value = $thisField['VALUE']; } } if ($fieldset > $current_fieldset && isset($fieldset_titles[$fieldset])) { $current_fieldset = $fieldset; // do not close the table if it is the first iteration if ($close_table) { echo "</table>\n"; } else { $close_table = true; } if (isset($fieldset_titles[$current_fieldset])) { echo "\n\t<h3>" . esc_html(cimy_wpml_translate_string("a_opt_fieldset_title_" . $current_fieldset, $fieldset_titles[$current_fieldset])) . "</h3>\n"; } echo '<table class="form-table">'; echo "\n"; } echo "\t"; echo "<tr>"; echo "\n\t"; // if you use it you need to escape it! $non_escaped_value = $value; $value = esc_attr($value); $old_value = esc_attr($old_value); $obj_class = ''; if ($rules['can_be_empty']) { $required = ''; } else { $required = ' <span class="description">' . __("(required)") . '</span>'; } switch ($type) { case "picture-url": case "password": case "text": $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . $required . '</label>'; $obj_name = ' name="' . $input_name . '"'; if ($type == "picture-url") { $obj_type = ' type="text"'; } else { $obj_type = ' type="' . $type . '"'; } $obj_value = ' value="' . $value . '"'; $obj_value2 = ""; $obj_checked = ""; $obj_tag = "input"; $obj_closing_tag = false; $obj_style = ' class="regular-text"'; if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value)) { $obj_disabled = ' disabled="disabled"'; } else { $obj_disabled = ""; } break; case "textarea": $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . $required . '</label>'; $obj_name = ' name="' . $input_name . '"'; $obj_type = ""; $obj_value = ""; $obj_value2 = $value; $obj_checked = ""; $obj_tag = "textarea"; $obj_closing_tag = true; $obj_style = ""; $obj_class = ' class="cimy_uef_textarea"'; if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value)) { $obj_disabled = ' disabled="disabled"'; } else { $obj_disabled = ""; } break; case "textarea-rich": if ($tiny_mce_objects == "") { $tiny_mce_objects = $unique_id; } else { $tiny_mce_objects .= "," . $unique_id; } $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . $required . '</label>'; $obj_name = ' name="' . $input_name . '"'; $obj_type = ""; $obj_value = ""; $obj_value2 = $value; $obj_checked = ""; $obj_tag = "textarea"; $obj_closing_tag = true; $obj_style = ""; $obj_class = ' class="cimy_uef_textarea"'; if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value)) { $obj_disabled = ' disabled="disabled"'; } else { $obj_disabled = ""; } break; case "dropdown-multi": case "dropdown": // cimy_dropDownOptions uses cimy_uef_sanitize_content and esc_attr by itself $ret = cimy_dropDownOptions($label, $non_escaped_value); $label = $ret['label']; $html = $ret['html']; $obj_label = '<label for="' . $unique_id . '">' . $label . $required . '</label>'; if ($type == "dropdown-multi") { $obj_name = ' name="' . $input_name . '[]" multiple="multiple" size="5"'; $obj_style = ' style="height: 11em;"'; } else { $obj_name = ' name="' . $input_name . '"'; $obj_style = ''; } $obj_type = ''; $obj_value = ''; $obj_value2 = $html; $obj_checked = ""; $obj_tag = "select"; $obj_closing_tag = true; if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value)) { $obj_disabled = ' disabled="disabled"'; } else { $obj_disabled = ""; } break; case "checkbox": $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . '</label>'; $obj_name = ' name="' . $input_name . '"'; $obj_type = ' type="' . $type . '"'; $obj_value = ' value="1"'; $obj_value2 = ""; $value == "YES" ? $obj_checked = ' checked="checked"' : ($obj_checked = ''); $obj_tag = "input"; $obj_closing_tag = false; $obj_style = ' style="width:auto; border:0; background:white;"'; if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value)) { $obj_disabled = ' disabled="disabled"'; } else { $obj_disabled = ""; } break; case "radio": $obj_label = '<label for="' . $unique_id . '"> ' . cimy_uef_sanitize_content($label) . '</label>'; $obj_name = ' name="' . $input_name . '"'; $obj_type = ' type="' . $type . '"'; $obj_value = ' value="' . $field_id . '"'; $obj_value2 = ""; $obj_tag = "input"; $obj_closing_tag = false; $obj_style = ' style="width:auto; border:0; background:white;"'; if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value)) { $obj_disabled = ' disabled="disabled"'; } else { $obj_disabled = ""; } if ($value == "selected" || $value == "YES" && $radio_checked[$name] == 0) { $radio_checked[$name] = 1; $obj_checked = ' checked="checked"'; } else { $obj_checked = ''; } break; case "avatar": case "picture": case "file": $allowed_exts = ''; if (isset($rules['equal_to'])) { if (!empty($rules['equal_to'])) { $allowed_exts = "'" . implode("', '", explode(",", $rules['equal_to'])) . "'"; } } $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . $required . '</label>'; $obj_class = ''; $obj_name = ' name="' . $input_name . '"'; $obj_type = ' type="file"'; $obj_value = ' value=""'; $obj_value2 = ''; $obj_checked = ""; $obj_tag = "input"; $obj_closing_tag = false; if ($type == "file") { // if we do not escape then some translations can break $warning_msg = $wpdb->escape(__("Please upload a file with one of the following extensions", $cimy_uef_domain)); $obj_style = ' onchange="uploadFile(\'your-profile\', \'' . $unique_id . '\', \'' . $warning_msg . '\', Array(' . $allowed_exts . '));"'; } else { // if we do not escape then some translations can break $warning_msg = $wpdb->escape(__("Please upload an image with one of the following extensions", $cimy_uef_domain)); $allowed_exts = "'" . implode("','", cimy_uef_get_allowed_image_extensions()) . "'"; $obj_style = ' onchange="uploadFile(\'your-profile\', \'' . $unique_id . '\', \'' . $warning_msg . '\', Array(' . $allowed_exts . '));"'; } if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value)) { $obj_disabled = ' disabled="disabled"'; } else { $obj_disabled = ""; } break; case "registration-date": $value = cimy_get_registration_date($get_user_id, $value); if (isset($rules['equal_to'])) { $obj_value = cimy_get_formatted_date($value, $rules['equal_to']); } else { $obj_value = cimy_get_formatted_date($value); } $obj_label = '<label>' . cimy_uef_sanitize_content($label) . '</label>'; break; } $obj_id = ' id="' . $unique_id . '"'; $obj_maxlen = ""; if (in_array($type, $rule_maxlen_needed) && !in_array($type, $cimy_uef_file_types)) { if (isset($rules['max_length'])) { $obj_maxlen = ' maxlength="' . $rules['max_length'] . '"'; } else { if (isset($rules['exact_length'])) { $obj_maxlen = ' maxlength="' . $rules['exact_length'] . '"'; } } } if (in_array($type, $cimy_uef_textarea_types)) { $obj_rowscols = ' rows="3" cols="25"'; } else { $obj_rowscols = ''; } echo "\t"; $form_object = '<' . $obj_tag . $obj_id . $obj_class . $obj_name . $obj_type . $obj_value . $obj_checked . $obj_maxlen . $obj_rowscols . $obj_style . $obj_disabled; if ($obj_closing_tag) { $form_object .= ">" . $obj_value2 . "</" . $obj_tag . ">"; } else { $form_object .= " />"; } echo "<th>"; echo $obj_label; echo "</th>\n"; echo "\t\t<td>"; if (!empty($description) && ($type == "picture" || $type == "picture-url")) { echo "<span class='description'>" . $description . "</span><br />"; } if (in_array($type, $cimy_uef_file_types)) { $profileuser = get_user_to_edit($get_user_id); } if ($type == "avatar") { $user_email = $profileuser->user_email; $img_avatar = get_avatar($user_email, $size = '128'); $img_avatar = str_replace("<img", "<img id='{$field_id_data}'", $img_avatar); echo '<div id="profpic">' . $img_avatar . "</div>\n\t\t"; } if (in_array($type, $cimy_uef_file_types) && !empty($value)) { $old_value = basename($old_value); $user_login = $profileuser->user_login; if ($type == "picture") { $value_thumb = cimy_get_thumb_path($value); $file_on_server = cimy_uef_get_dir_or_filename($user_login, $value, false); $file_thumb = cimy_uef_get_dir_or_filename($user_login, $value, true); if (!empty($advanced_options["no-thumb"]) && is_file($file_thumb)) { rename($file_thumb, $file_on_server); } echo "\n\t\t"; if (is_file($file_thumb)) { echo '<a target="_blank" href="' . $value . '"><img id="' . $field_id_data . '" src="' . $value_thumb . '" alt="picture" /></a><br />'; echo "\n\t\t"; } else { if (is_file($file_on_server)) { echo '<img id="' . $field_id_data . '" src="' . $value . '" alt="picture" /><br />'; echo "\n\t\t"; } } } if ($type == "file") { echo '<a target="_blank" href="' . $value . '">'; echo basename($value); echo '</a><br />'; echo "\n\t\t"; } // if there is no image or there is the default one then disable delete button if (empty($old_value)) { $dis_delete_img = ' disabled="disabled"'; } else { // take the "can be modified" rule just set before $dis_delete_img = $obj_disabled; // echo '<input type="hidden" name="'.$input_name.'_oldfile" value="'.basename($value).'" />'; // echo "\n\t\t"; } if (($type == "picture" || $type == "avatar") && (empty($rules["equal_to"]) || !empty($advanced_options["no-thumb"]))) { echo "<input type=\"hidden\" name=\"" . $field_id_data . "_x1\" id=\"" . $field_id_data . "_x1\" value=\"\" />"; echo "<input type=\"hidden\" name=\"" . $field_id_data . "_y1\" id=\"" . $field_id_data . "_y1\" value=\"\" />"; echo "<input type=\"hidden\" name=\"" . $field_id_data . "_x2\" id=\"" . $field_id_data . "_x2\" value=\"\" />"; echo "<input type=\"hidden\" name=\"" . $field_id_data . "_y2\" id=\"" . $field_id_data . "_y2\" value=\"\" />"; echo "<input type=\"hidden\" name=\"" . $field_id_data . "_w\" id=\"" . $field_id_data . "_w\" value=\"\" />"; echo "<input type=\"hidden\" name=\"" . $field_id_data . "_h\" id=\"" . $field_id_data . "_h\" value=\"\" />"; // echo "<p class=\"submit\"><input type=\"submit\" name=\"".$field_id_data."_button\" class=\"button-primary\" value=\"".__("Edit Image")."\" /></p>"; echo "<input type=\"hidden\" name=\"" . $field_id_data . "_button\" id=\"" . $field_id_data . "_button\" value=\"1\" />"; $imgarea_options = "handles: true, fadeSpeed: 200, onSelectChange: preview"; if (isset($advanced_options["crop_x1"]) && isset($advanced_options["crop_y1"]) && isset($advanced_options["crop_x2"]) && isset($advanced_options["crop_y2"])) { $imgarea_options .= ", x1: " . intval($advanced_options["crop_x1"]); $imgarea_options .= ", y1: " . intval($advanced_options["crop_y1"]); $imgarea_options .= ", x2: " . intval($advanced_options["crop_x2"]); $imgarea_options .= ", y2: " . intval($advanced_options["crop_y2"]); } if (!empty($advanced_options["crop_ratio"])) { $imgarea_options .= ", aspectRatio: '" . esc_js($advanced_options["crop_ratio"]) . "'"; } else { if ($type == "avatar") { $imgarea_options .= ", aspectRatio: '1:1'"; } } echo "<script type='text/javascript'>jQuery(document).ready(function () { jQuery('#" . esc_js($field_id_data) . "').imgAreaSelect({ " . $imgarea_options . " }); });</script>"; } echo '<input type="checkbox" name="' . $input_name . '_del" value="1" style="width:auto; border:0; background:white;"' . $dis_delete_img . ' />'; if ($type == "file") { echo " " . __("Delete the file", $cimy_uef_domain) . "<br /><br />"; echo "\n\t\t" . __("Update the file", $cimy_uef_domain) . "<br />"; } else { echo " " . __("Delete the picture", $cimy_uef_domain) . "<br /><br />"; echo "\n\t\t" . __("Update the picture", $cimy_uef_domain) . "<br />"; } echo "\n\t\t"; } if ($type == "picture-url") { if (!empty($value)) { if (intval($rules['equal_to'])) { echo '<a target="_blank" href="' . $value . '">'; echo '<img src="' . $value . '" alt="picture"' . $size . ' width="' . intval($rules['equal_to']) . '" height="*" />'; echo "</a>"; } else { echo '<img src="' . $value . '" alt="picture" />'; } echo "<br />"; echo "\n\t\t"; } echo "<br />" . __("Picture URL:", $cimy_uef_domain) . "<br />\n\t\t"; } // write previous value echo "<input type=\"hidden\" name=\"" . $input_name . "_" . $field_id . "_prev_value\" value=\"" . $old_value . "\" />\n\t\t"; // TinceMCE needed and we have WordPress >= 3.3 yummy! if ($type == "textarea-rich" && function_exists("wp_editor")) { $quicktags_settings = array('buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close'); $editor_settings = array('textarea_name' => $input_name, 'teeny' => false, 'textarea_rows' => '10', 'dfw' => false, 'media_buttons' => true, 'tinymce' => true, 'quicktags' => $quicktags_settings); wp_editor($non_escaped_value, $unique_id, $editor_settings); } else { if ($type != "registration-date") { echo $form_object; } else { echo $obj_value; } } if (!empty($description) && $type != "picture" && $type != "picture-url") { if ($type == "textarea" || $type == "textarea-rich") { echo "<br />"; } else { echo " "; } echo "<span class='description'>" . $description . "</span>"; } echo "</td>"; echo "\n\t</tr>\n"; } echo "</table>"; // WP 3.2 or lower (N) if (!empty($tiny_mce_objects) && !function_exists("wp_editor")) { require_once $cuef_plugin_dir . '/cimy_uef_init_mce.php'; } echo $end_cimy_uef_comment; } }
function cimy_manage_db($command) { global $wpdb, $wpdb_data_table, $wpdb_wp_fields_table, $wpdb_fields_table, $cimy_uef_options, $cimy_uef_version, $cimy_uef_domain; if (!cimy_check_admin('activate_plugins')) { return; } $welcome_email = sprintf(__('Username: %s'), "USERNAME") . "\r\n"; $welcome_email .= sprintf(__('Password: %s'), "PASSWORD") . "\r\n"; $welcome_email .= "LOGINLINK" . "\r\n"; $options = array('extra_fields_title' => __("Extra Fields", $cimy_uef_domain), 'users_per_page' => 50, 'aue_hidden_fields' => array('website', 'posts', 'email'), 'wp_hidden_fields' => array('username'), 'fieldset_title' => '', 'registration-logo' => '', 'captcha' => 'none', 'welcome_email' => $welcome_email, 'confirm_form' => false, 'confirm_email' => false, 'password_meter' => false, 'mail_include_fields' => false, 'redirect_to' => '', 'file_fields' => array('show_in_reg' => 0, 'show_in_profile' => 0, 'show_in_aeu' => 0, 'show_in_blog' => 0, 'show_in_search' => 0), 'image_fields' => array('show_in_reg' => 0, 'show_in_profile' => 0, 'show_in_aeu' => 0, 'show_in_blog' => 0, 'show_in_search' => 0), 'tinymce_fields' => array('show_in_reg' => 0, 'show_in_profile' => 0, 'show_in_aeu' => 0, 'show_in_blog' => 0, 'show_in_search' => 0)); switch ($command) { case 'new_options': $options['version'] = $cimy_uef_version; cimy_set_options($options); break; case 'default_options': $old_options = cimy_get_options(); if (isset($old_options['version'])) { $options['version'] = $old_options['version']; } else { $options['version'] = $cimy_uef_version; } cimy_set_options($options); break; case 'drop_options': if (is_multisite()) { delete_site_option($cimy_uef_options); } else { delete_option($cimy_uef_options); } break; case 'empty_wp_fields': if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb_wp_fields_table}'") == $wpdb_wp_fields_table) { $sql = "TRUNCATE TABLE " . $wpdb_wp_fields_table; $wpdb->query($sql); } break; case 'empty_extra_fields': if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb_fields_table}'") == $wpdb_fields_table) { $sql = "TRUNCATE TABLE " . $wpdb_fields_table; $wpdb->query($sql); } break; case 'empty_data': if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb_data_table}'") == $wpdb_data_table) { $sql = "TRUNCATE TABLE " . $wpdb_data_table; $wpdb->query($sql); } break; case 'drop_wp_fields': if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb_wp_fields_table}'") == $wpdb_wp_fields_table) { $sql = "DROP TABLE " . $wpdb_wp_fields_table; $wpdb->query($sql); } break; case 'drop_extra_fields': if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb_fields_table}'") == $wpdb_fields_table) { $sql = "DROP TABLE " . $wpdb_fields_table; $wpdb->query($sql); } break; case 'drop_data': if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb_data_table}'") == $wpdb_data_table) { $sql = "DROP TABLE " . $wpdb_data_table; $wpdb->query($sql); } break; } }
function cimy_fieldsetOptions($selected = 0, $order = "", $select_all = false) { global $cimy_uef_domain; if (!cimy_check_admin('manage_options')) { return; } $options = cimy_get_options(); $i = 0; $html = "<select name=\"fieldset[" . $order . "]\">\n"; if (empty($options['fieldset_title']) && !$select_all) { $html .= "\t<option value=\"{$i}\" selected=\"selected\">" . __("no fieldset", $cimy_uef_domain) . "</option>\n"; } else { if ($select_all) { $html .= "\t<option value=\"-1\"" . selected(-1, $selected, false) . ">" . __("All") . "</option>\n"; } if (!empty($options['fieldset_title'])) { $fieldset_titles = explode(',', $options['fieldset_title']); foreach ($fieldset_titles as $fieldset) { $html .= "\t<option value=\"{$i}\"" . selected($i, $selected, false) . ">" . esc_html($fieldset) . "</option>\n"; $i++; } } } $html .= "</select>"; return $html; }
function cimy_fieldsetOptions($selected = 0, $order = "") { global $cimy_uef_domain; if (!cimy_check_admin('manage_options')) { return; } $options = cimy_get_options(); $i = 0; $html = "<select name=\"fieldset[" . $order . "]\">\n"; if ($options['fieldset_title'] == "") { $html .= "\t<option value=\"{$i}\" selected=\"selected\">" . __("no fieldset", $cimy_uef_domain) . "</option>\n"; } else { $fieldset_titles = explode(',', $options['fieldset_title']); foreach ($fieldset_titles as $fieldset) { if ($i == $selected) { $selected_txt = " selected=\"selected\""; } else { $selected_txt = ""; } $html .= "\t<option value=\"{$i}\"" . $selected_txt . ">" . $fieldset . "</option>\n"; $i++; } } $html .= "</select>"; return $html; }
function cimy_admin_users_list_page() { global $wpdb, $wp_roles, $wpdb_data_table, $cimy_uef_options, $cuef_upload_path, $cimy_uef_domain; if (!cimy_check_admin('edit_users')) { return; } $options = cimy_get_options(); if (isset($_POST["cimy_uef_users_per_page"])) { $users_per_page = $_POST["cimy_uef_users_per_page"]; $options["users_per_page"] = $users_per_page; cimy_set_options($options); } else { $users_per_page = $options["users_per_page"]; } $dropdown_first_item = '--- ' . __("select", $cimy_uef_domain) . ' ---'; $extra_fields = get_cimyFields(); if (isset($_POST["submit_new_values"])) { foreach ($_POST["users"] as $user_id) { foreach ($_POST["ef_write_type"] as $ef_name => $ef_type) { if (!isset($_POST["ef_write_sel"][$ef_name])) { continue; } if (isset($_POST["ef_write"][$ef_name])) { $ef_value = $_POST["ef_write"][$ef_name]; // if it is selected the "--- select ---" item then skip this check if (($ef_type == "dropdown" || $ef_type == "dropdown-multi") && $ef_value == $dropdown_first_item) { continue; } set_cimyFieldValue($user_id, $ef_name, $ef_value); } else { if ($ef_type == "checkbox") { $ef_value = "NO"; set_cimyFieldValue($user_id, $ef_name, ""); } } } } } // yes stupid WP_User_Search doesn't support custom $users_per_page support, lets add it! class Cimy_User_Search extends WP_User_Search { function Cimy_User_Search($search_term = '', $page = '', $role = '', $users_per_page = 50) { $this->search_term = $search_term; $this->raw_page = '' == $page ? false : (int) $page; $this->page = (int) ('' == $page) ? 1 : $page; $this->role = $role; $this->users_per_page = intval($users_per_page); $this->prepare_query(); $this->query(); $this->prepare_vars_for_template_usage(); // paging will be done after Cimy search has filtered out items //$this->do_paging(); } function page_links() { echo str_replace("?", "?page=au_extended&", $this->paging_text); } } // Query the users $wp_user_search = new Cimy_User_Search($_POST['usersearch'], $_GET['userspage'], $_GET['role'], $users_per_page); $search_result = $wp_user_search->get_results(); // search into extra field engine $i = 0; foreach ($search_result as $userid) { foreach ($extra_fields as $ef) { $ef_id = $ef["ID"]; $ef_type = $ef["TYPE"]; $ef_name = $ef["NAME"]; $ef_search = ""; if (isset($_POST["ef_search"][$ef_name])) { $ef_search = $_POST["ef_search"][$ef_name]; } if ($ef_search != "") { $remove = false; $ef_value = $wpdb->get_var("SELECT VALUE FROM " . $wpdb_data_table . " WHERE USER_ID=" . $userid . " AND FIELD_ID=" . $ef_id); if ($ef_type == "text" || $ef_type == "textarea" || $ef_type == "textarea-rich" || $ef_type == "picture" || $ef_type == "picture-url" || $ef_type == "file") { if (stristr($ef_value, $ef_search) === FALSE) { $remove = true; } } else { if ($ef_type == "checkbox") { if ($ef_search == "1" and $ef_value != "YES") { $remove = true; } } else { if ($ef_type == "radio") { if ($ef_search == $ef_id and $ef_value != "selected") { $remove = true; } } else { if ($ef_type == "dropdown") { // if it is selected the "--- select ---" item then skip this check if ($ef_search == $dropdown_first_item) { continue; } if ($ef_search != $ef_value) { $remove = true; } } else { if ($ef_type == "dropdown-multi") { // if it is selected the "--- select ---" item then remove it if ($ef_search[0] == $dropdown_first_item) { unset($ef_search[0]); } if (count(array_diff($ef_search, explode(",", $ef_value))) != 0) { $remove = true; } } } } } } if ($remove) { unset($wp_user_search->results[$i]); $wp_user_search->total_users_for_query--; break; } } } $i++; } $wp_user_search->paging_text = ""; // oh yeah baby, now it's time for paging! $wp_user_search->do_paging(); ?> <div class="wrap"> <?php if (function_exists("screen_icon")) { screen_icon("users"); } ?> <?php if ($wp_user_search->is_search()) { ?> <h2><?php printf(__('Users Matching "%s"'), wp_specialchars($wp_user_search->search_term)); ?> </h2> <?php } else { ?> <h2><?php if (is_multisite()) { _e("Users Extended List", $cimy_uef_domain); } else { _e("Authors & Users Extended List", $cimy_uef_domain); } ?> </h2> <?php } ?> <form id="posts-filter" action="" method="post"> <ul class="subsubsub"> <?php $role_links = array(); $avail_roles = array(); $users_of_blog = get_users_of_blog(); $total_users = count($users_of_blog); //var_dump($users_of_blog); foreach ((array) $users_of_blog as $b_user) { $b_roles = unserialize($b_user->meta_value); foreach ((array) $b_roles as $b_role => $val) { if (!isset($avail_roles[$b_role])) { $avail_roles[$b_role] = 0; } $avail_roles[$b_role]++; } } unset($users_of_blog); $current_role = false; $class = empty($_GET['role']) ? ' class="current"' : ''; $role_links[] = "<li><a href='users.php?page=au_extended'{$class}>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users'), number_format_i18n($total_users)) . '</a>'; foreach ($wp_roles->get_names() as $this_role => $name) { if (!isset($avail_roles[$this_role])) { continue; } $class = ''; if ($this_role == $_GET['role']) { $current_role = $_GET['role']; $class = ' class="current"'; } $name = translate_user_role($name); $name = sprintf(__('%1$s <span class="count">(%2$s)</span>'), $name, $avail_roles[$this_role]); $tmp_link = esc_url(add_query_arg('role', $this_role)); $role_links[] = "<li><a href=\"{$tmp_link}\"{$class}>" . $name . '</a>'; } echo implode(' |</li>', $role_links) . '</li>'; unset($role_links); ?> </ul> <p id="post-search" class="search-box"> <input type="text" class="search-input" id="post-search-input" name="usersearch" value="<?php echo esc_attr($wp_user_search->search_term); ?> " /> <input type="submit" value="<?php _e('Search Users'); ?> " class="button" /> </p> <div class="tablenav"> <?php if ($wp_user_search->results_are_paged()) { ?> <div class="tablenav-pages"><?php $wp_user_search->page_links(); ?> </div> <?php } ?> <br class="clear" /> <br class="clear" /> <?php if (is_wp_error($wp_user_search->search_errors)) { ?> <div class="error"> <ul> <?php foreach ($wp_user_search->search_errors->get_error_messages() as $message) { echo "<li>{$message}</li>"; } ?> </ul> </div> <?php } ?> <?php if ($wp_user_search->get_results()) { ?> <?php if ($wp_user_search->is_search()) { ?> <p><a href="users.php?page=au_extended"><?php _e('« Back to All Users'); ?> </a></p> <?php } wp_print_scripts('admin-forms'); ?> <div class="alignleft actions"> <?php _e("Users per page", $cimy_uef_domain); ?> <select name="cimy_uef_users_per_page"> <?php $users_per_page_list = array(10, 50, 100, 500, 1000, 5000); foreach ($users_per_page_list as $item) { echo "<option"; if ($item == $users_per_page) { echo ' selected="selected"'; } echo ">" . $item . "</option>"; } ?> </select> <input class="button" type="submit" name="submit" value="<?php _e("Apply"); ?> " /> </div> </div> <table class="widefat" cellpadding="3" cellspacing="3" width="100%"> <?php $thead_str = '<tr class="thead">'; $thead_str .= '<th id="cb" scope="col" class="manage-column column-cb check-column" style=""><input type="checkbox" /> </th>'; $tfoot_str = '<tr class="thead">'; $tfoot_str .= '<th scope="col" class="manage-column column-cb check-column" style=""><input type="checkbox" /> </th>'; if (!in_array("username", $options['aue_hidden_fields'])) { $thead_str .= '<th id="username" scope="col" class="manage-column column-username" style="">' . __("Username") . '</th>'; $tfoot_str .= '<th scope="col" class="manage-column column-username" style="">' . __("Username") . '</th>'; } if (!in_array("name", $options['aue_hidden_fields'])) { $thead_str .= '<th id="name" scope="col" class="manage-column column-name" style="">' . __("Name") . '</th>'; $tfoot_str .= '<th scope="col" class="manage-column column-name" style="">' . __("Name") . '</th>'; } if (!in_array("email", $options['aue_hidden_fields'])) { $thead_str .= '<th id="email" scope="col" class="manage-column column-email" style="">' . __("E-mail") . '</th>'; $tfoot_str .= '<th scope="col" class="manage-column column-email" style="">' . __("E-mail") . '</th>'; } if (!in_array("role", $options['aue_hidden_fields'])) { $thead_str .= '<th id="role" scope="col" class="manage-column column-role" style="">' . __("Role") . '</th>'; $tfoot_str .= '<th scope="col" class="manage-column column-role" style="">' . __("Role") . '</th>'; } if (!in_array("website", $options['aue_hidden_fields'])) { $thead_str .= '<th scope="col" class="manage-column" style="">' . __("Website") . '</th>'; $tfoot_str .= '<th scope="col" class="manage-column" style="">' . __("Website") . '</th>'; } if (!in_array("posts", $options['aue_hidden_fields'])) { $thead_str .= '<th id="posts" scope="col" class="manage-column column-posts num" style="">' . __("Posts") . '</th>'; $tfoot_str .= '<th scope="col" class="manage-column column-posts num" style="">' . __("Posts") . '</th>'; } $i = 0; $write_inputs = array(); $write_input_checkbox = array(); if (count($extra_fields) > 0) { foreach ($extra_fields as $thisField) { $rules = $thisField['RULES']; if ($rules['show_in_aeu']) { $i++; $label = $thisField['LABEL']; $id = $thisField['ID']; $name = $thisField['NAME']; $type = $thisField['TYPE']; if ($type == "avatar") { continue; } $search_input = ""; $search_value = ""; if (!empty($_POST["ef_search"][$name])) { if ($type == "dropdown-multi") { $search_value = esc_attr(stripslashes(implode(",", $_POST["ef_search"][$name]))); } else { $search_value = esc_attr(stripslashes($_POST["ef_search"][$name])); } } $thead_str .= "<th scope=\"col\" class=\"manage-column\" style=\"\">"; $tfoot_str .= "<th scope=\"col\" class=\"manage-column\" style=\"\">"; switch ($type) { case "dropdown": $ret = cimy_dropDownOptions($label, $search_value); $ret2 = str_ireplace(' selected="selected"', '', $ret['html']); $label = $ret['label']; $search_input = '<select name="ef_search[' . $name . ']"><option>' . $dropdown_first_item . '</option>' . $ret['html'] . '</select>'; $write_input[$i] = '<td>' . $label . '</td><td><select name="ef_write[' . $name . ']"><option>' . $dropdown_first_item . '</option>' . $ret2 . '</select>'; break; case "dropdown-multi": $ret = cimy_dropDownOptions($label, $search_value); $ret2 = str_ireplace(' selected="selected"', '', $ret['html']); $label = $ret['label']; $search_input = '<select name="ef_search[' . $name . '][]" multiple="multiple" style="height: 6em;"><option>' . $dropdown_first_item . '</option>' . $ret['html'] . '</select>'; $write_input[$i] = '<td>' . $label . '</td><td><select name="ef_write[' . $name . '][]" multiple="multiple" style="height: 6em;"><option>' . $dropdown_first_item . '</option>' . $ret2 . '</select>'; break; case "text": case "textarea": case "textarea-rich": case "picture-url": $search_input = '<input type="text" name="ef_search[' . $name . ']" value="' . $search_value . '" size="6" />'; $write_input[$i] = '<td>' . $label . '</td><td><input type="text" name="ef_write[' . $name . ']" value="" size="40" />'; break; case "picture": case "file": $search_input = '<input type="text" name="ef_search[' . $name . ']" value="' . $search_value . '" size="6" />'; break; case "checkbox": if ($search_value != "") { $checkbox_selected = ' checked="checked"'; } else { $checkbox_selected = ""; } $search_input = '<input type="checkbox" name="ef_search[' . $name . ']" value="1"' . $checkbox_selected . ' />'; $write_input[$i] = '<td>' . $label . '</td><td><input type="checkbox" name="ef_write[' . $name . ']" value="1" />'; break; case "radio": if ($search_value == $id) { $radio_selected = ' checked="checked"'; } else { $radio_selected = ""; } $search_input = '<input type="radio" name="ef_search[' . $name . ']" value="' . $id . '"' . $radio_selected . ' />'; $write_input[$i] = '<td>' . $label . '</td><td><input type="radio" name="ef_write[' . $name . ']" value="' . $label . '" />'; break; } if (isset($write_input[$i])) { if (empty($write_input_checkbox[$name])) { $write_input[$i] = '<td><input type="checkbox" name="ef_write_sel[' . $name . ']" value="1" /></td>' . $write_input[$i]; $write_input_checkbox[$name] = true; } else { $write_input[$i] = '<td> </td>' . $write_input[$i]; } $write_input[$i] .= '<input type="hidden" name="ef_write_type[' . $name . ']" value="' . $type . '" /></td>'; } $thead_str .= "{$label}<br />{$search_input}</th>"; $tfoot_str .= "{$label}</th>"; } } } $thead_str .= '</tr>'; $tfoot_str .= '</tr>'; ?> <thead> <?php echo $thead_str; ?> </thead> <tfoot> <?php echo $tfoot_str; ?> </tfoot> <?php $style = ''; foreach ($wp_user_search->get_results() as $userid) { $user_object = new WP_User($userid); $roles = $user_object->roles; $role = array_shift($roles); $email = $user_object->user_email; $url = $user_object->user_url; $short_url = str_replace('http://', '', $url); $short_url = str_replace('www.', '', $short_url); if ('/' == substr($short_url, -1)) { $short_url = substr($short_url, 0, -1); } if (strlen($short_url) > 35) { $short_url = substr($short_url, 0, 32) . '...'; } $style = 'class="alternate"' == $style ? '' : 'class="alternate"'; $numposts = count_user_posts($user_object->ID); if (0 < $numposts) { $numposts = "<a href='edit.php?author={$user_object->ID}' title='" . __('View posts by this author') . "'>{$numposts}</a>"; } echo "\n\t\t\t<tr {$style}>\n\t\t\t\n\t\t\t<th scope='row' class='check-column'><input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='{$role}' value='{$user_object->ID}' /></th>"; if (!in_array("username", $options['aue_hidden_fields'])) { // produce username clickable if (current_user_can('edit_user', $user_object->ID)) { $current_user = wp_get_current_user(); if ($current_user->ID == $user_object->ID) { $edit = 'profile.php'; } else { $edit = esc_url(add_query_arg('wp_http_referer', urlencode(esc_url(stripslashes($_SERVER['REQUEST_URI']))), "user-edit.php?user_id={$user_object->ID}")); } $edit = "<a href=\"{$edit}\">{$user_object->user_login}</a>"; } else { $edit = $user_object->user_login; } $avatar = get_avatar($user_object->user_email, 32); echo "<td class=\"username column-username\"><strong>{$avatar} {$edit}</strong></td>"; } if (!in_array("name", $options['aue_hidden_fields'])) { echo "<td class=\"name column-name\"><label for='user_{$user_object->ID}'>{$user_object->first_name} {$user_object->last_name}</label></td>"; } if (!in_array("email", $options['aue_hidden_fields'])) { echo "<td class=\"email column-email\"><a href='mailto:{$email}' title='" . sprintf(__('e-mail: %s'), $email) . "'>{$email}</a></td>"; } if (!in_array("role", $options['aue_hidden_fields'])) { $role_name = translate_user_role($wp_roles->role_names[$role]); echo "<td class=\"role column-role\">"; echo $role_name; echo '</td>'; } if (!in_array("website", $options['aue_hidden_fields'])) { echo "<td ><a href='{$url}' title='website: {$url}'>{$short_url}</a></td>"; } if (!in_array("posts", $options['aue_hidden_fields'])) { echo "<td class=\"posts column-posts num\">{$numposts}</td>"; } // print all the content of extra fields if there are some if (count($extra_fields) > 0) { foreach ($extra_fields as $thisField) { $field_id = $thisField['ID']; // if user has not yet fields in the data table then create them cimy_insert_ExtraFields_if_not_exist($user_object->ID, $field_id); } // retrieve extra fields data from DB $ef_db = $wpdb->get_results("SELECT FIELD_ID, VALUE FROM " . $wpdb_data_table . " WHERE USER_ID = " . $user_object->ID, ARRAY_A); foreach ($extra_fields as $thisField) { $rules = $thisField['RULES']; $type = $thisField['TYPE']; $value = $thisField['VALUE']; if ($type == "avatar") { continue; } if ($rules['show_in_aeu']) { $field_id = $thisField['ID']; foreach ($ef_db as $d_field) { if ($d_field['FIELD_ID'] == $field_id) { $field = cimy_uef_sanitize_content($d_field['VALUE']); //$field = esc_attr($d_field['VALUE']); } } echo "<td>"; if ($type == "picture-url") { if ($field == "") { $field = $value; } if ($field != "") { if (intval($rules['equal_to'])) { echo '<a target="_blank" href="' . $field . '">'; echo '<img src="' . $field . '" alt="picture"' . $size . ' width="' . intval($rules['equal_to']) . '" height="*" />'; echo "</a>"; } else { echo '<img src="' . $field . '" alt="picture" />'; } echo "<br />"; echo "\n\t\t"; } } else { if ($type == "picture") { if ($field == "") { $field = $value; } if ($field != "") { //$profileuser = get_user_to_edit($user_object->ID); //$user_login = $profileuser->user_login; $user_login = $user_object->user_login; $value_thumb = cimy_get_thumb_path($field); $file_thumb = $cuef_upload_path . $user_login . "/" . cimy_get_thumb_path(basename($field)); $file_on_server = $cuef_upload_path . $user_login . "/" . basename($field); echo "\n\t\t"; if (is_file($file_thumb)) { echo '<a target="_blank" href="' . $field . '"><img src="' . $value_thumb . '" alt="picture" /></a><br />'; echo "\n\t\t"; } else { if (is_file($file_on_server)) { echo '<img src="' . $field . '" alt="picture" /><br />'; echo "\n\t\t"; } } } } else { if ($type == "file") { echo '<a target="_blank" href="' . $field . '">'; echo basename($field); echo '</a>'; } else { if ($type == "registration-date") { if (isset($rules['equal_to'])) { $registration_date = cimy_get_formatted_date($field, $rules['equal_to']); } else { $registration_date = cimy_get_formatted_date($field); } echo $registration_date; } else { echo $field; } } } } echo " " . "</td>"; } } } echo '</tr>'; } ?> </table> <div class="tablenav"> <?php if ($wp_user_search->results_are_paged()) { ?> <div class="tablenav-pages"><?php $wp_user_search->page_links(); ?> </div> <?php } ?> <br class="clear" /> </div> <?php } ?> <?php if (!empty($write_input)) { ?> <h2><?php _e("Update selected users", $cimy_uef_domain); ?> </h2> <table class="widefat" cellpadding="3" cellspacing="3"> <thead> <tr class="thead"> <th class="manage-column column-name" style="" width="10px"> </th><th class="manage-column column-name" style="" width="200px"><?php _e("Extra Fields", $cimy_uef_domain); ?> </th><th class="manage-column column-name" style=""><?php _e("Value"); ?> </th> </tr> </thead> <tfoot> <tr class="thead"> <th class="manage-column column-name" style="" width="10px"> </th><th class="manage-column column-name" style="" width="200px"><?php _e("Extra Fields", $cimy_uef_domain); ?> </th><th class="manage-column column-name" style=""><?php _e("Value"); ?> </th> </tr> </tfoot> <tbody> <?php foreach ($write_input as $input) { echo '<tr>' . $input . '</tr>'; } ?> </tbody> </table> <br /> <input class="button" type="submit" name="submit_new_values" value="<?php _e("Update"); ?> " /> <?php } ?> </form> </div> <?php }
function cimy_registration_form($errors = null, $show_type = 0) { global $wpdb, $start_cimy_uef_comment, $end_cimy_uef_comment, $rule_maxlen_needed, $fields_name_prefix, $wp_fields_name_prefix, $cuef_plugin_dir, $cimy_uef_file_types, $cimy_uef_textarea_types, $user_level, $cimy_uef_domain; // cimy_switch_to_blog(); // if not set, set to -1 == anonymous if (!isset($user_level)) { $user_level = -1; } // needed by cimy_uef_init_mce.php $cimy_uef_register_page = true; $extra_fields = get_cimyFields(false, true); $wp_fields = get_cimyFields(true); if (is_multisite()) { $input_class = "cimy_uef_input_mu"; } else { $input_class = "cimy_uef_input_27"; } $options = cimy_get_options(); $tabindex = 21; echo $start_cimy_uef_comment; echo "\t"; // needed to apply default values only first time and not in case of errors echo '<input type="hidden" name="cimy_post" value="1" />'; echo "\n"; $radio_checked = array(); $i = 1; $upload_image_function = false; // do first the WP fields then the EXTRA fields while ($i <= 2) { if ($i == 1) { $fields = $wp_fields; $prefix = $wp_fields_name_prefix; } else { $fields = $extra_fields; $prefix = $fields_name_prefix; $current_fieldset = -1; if ($options['fieldset_title'] != "") { $fieldset_titles = explode(',', $options['fieldset_title']); } else { $fieldset_titles = array(); } } $tiny_mce_objects = ""; foreach ($fields as $thisField) { $field_id = $thisField['ID']; $name = $thisField['NAME']; $rules = $thisField['RULES']; $type = $thisField['TYPE']; $label = $thisField['LABEL']; $description = $thisField['DESCRIPTION']; $fieldset = $thisField['FIELDSET']; $input_name = $prefix . esc_attr($name); $post_input_name = $prefix . $wpdb->escape($name); $maxlen = 0; $unique_id = $prefix . $field_id; // showing the search then there is no need to upload buttons if ($show_type == 1) { if ($type == "password") { continue; } if ($type == "avatar" || $type == "picture" || $type == "file") { $type = "text"; } } // if the current user LOGGED IN has not enough permissions to see the field, skip it // apply only for EXTRA FIELDS if ($user_level < $rules['show_level'] && $i == 2) { continue; } // if show_level == anonymous then do NOT ovverride other show_xyz rules if ($rules['show_level'] == -1) { if ($show_type == 0) { // if flag to show the field in the registration is NOT activated, skip it if (!$rules['show_in_reg']) { continue; } } else { if ($show_type == 1) { // if flag to show the field in the blog is NOT activated, skip it if (!$rules['show_in_search']) { continue; } } } } // uploading a file is not supported when confirmation email is enabled (on MS is turned on by default yes) if ((is_multisite() || $options["confirm_email"]) && in_array($type, $cimy_uef_file_types)) { continue; } if (isset($_POST[$post_input_name])) { if ($type == "dropdown-multi") { $value = stripslashes(implode(",", $_POST[$post_input_name])); } else { $value = stripslashes($_POST[$post_input_name]); } } else { if (isset($_GET[$name])) { if ($type == "dropdown-multi") { $value = stripslashes(implode(",", $_GET[$name])); } else { $value = stripslashes($_GET[$name]); } } else { if (!isset($_POST["cimy_post"])) { $value = $thisField['VALUE']; switch ($type) { case "radio": if ($value == "YES") { $value = $field_id; } else { $value = ""; } break; case "checkbox": if ($value == "YES") { $value = "1"; } else { $value = ""; } break; } } else { $value = ""; } } } $value = esc_attr($value); if ($fieldset > $current_fieldset && isset($fieldset_titles[$fieldset]) && $i != 1) { $current_fieldset = $fieldset; if (isset($fieldset_titles[$current_fieldset])) { echo "\n\t<h2>" . $fieldset_titles[$current_fieldset] . "</h2>\n"; } } if ($description != "" && $type != "registration-date") { echo "\t"; echo '<p id="' . $prefix . 'p_desc_' . $field_id . '" class="desc"><br />' . $description . '</p>'; echo "\n"; } echo "\t"; echo '<p id="' . $prefix . 'p_field_' . $field_id . '">'; echo "\n\t"; switch ($type) { case "picture-url": case "password": case "text": $obj_label = '<label for="' . $unique_id . '">' . $label . '</label>'; $obj_class = ' class="' . $input_class . '"'; $obj_name = ' name="' . $input_name . '"'; if ($type == "picture-url") { $obj_type = ' type="text"'; } else { $obj_type = ' type="' . $type . '"'; } $obj_value = ' value="' . $value . '"'; $obj_value2 = ""; $obj_checked = ""; $obj_tag = "input"; $obj_closing_tag = false; break; case "dropdown": case "dropdown-multi": $ret = cimy_dropDownOptions($label, $value); $label = $ret['label']; $html = $ret['html']; if ($type == "dropdown-multi") { $obj_name = ' name="' . $input_name . '[]" multiple="multiple" size="6"'; } else { $obj_name = ' name="' . $input_name . '"'; } $obj_label = '<label for="' . $unique_id . '">' . $label . '</label>'; $obj_class = ' class="' . $input_class . '"'; $obj_type = ''; $obj_value = ''; $obj_value2 = $html; $obj_checked = ""; $obj_tag = "select"; $obj_closing_tag = true; break; case "textarea": $obj_label = '<label for="' . $unique_id . '">' . $label . '</label>'; $obj_class = ' class="' . $input_class . '"'; $obj_name = ' name="' . $input_name . '"'; $obj_type = ""; $obj_value = ""; $obj_value2 = $value; $obj_checked = ""; $obj_tag = "textarea"; $obj_closing_tag = true; break; case "textarea-rich": if ($tiny_mce_objects == "") { $tiny_mce_objects = $fields_name_prefix . $field_id; } else { $tiny_mce_objects .= "," . $fields_name_prefix . $field_id; } $obj_label = '<label for="' . $unique_id . '">' . $label . '</label>'; $obj_class = ' class="' . $input_class . '"'; $obj_name = ' name="' . $input_name . '"'; $obj_type = ""; $obj_value = ""; $obj_value2 = $value; $obj_checked = ""; $obj_tag = "textarea"; $obj_closing_tag = true; break; case "checkbox": $obj_label = '<label class="cimy_uef_label_checkbox" for="' . $unique_id . '"> ' . $label . '</label><br />'; $obj_class = ' class="cimy_uef_checkbox"'; $obj_name = ' name="' . $input_name . '"'; $obj_type = ' type="' . $type . '"'; $obj_value = ' value="1"'; $obj_value2 = ""; $value == "1" ? $obj_checked = ' checked="checked"' : ($obj_checked = ''); $obj_tag = "input"; $obj_closing_tag = false; break; case "radio": $obj_label = '<label class="cimy_uef_label_radio" for="' . $unique_id . '"> ' . $label . '</label>'; $obj_class = ' class="cimy_uef_radio"'; $obj_name = ' name="' . $input_name . '"'; $obj_type = ' type="' . $type . '"'; $obj_value = ' value="' . $field_id . '"'; $obj_value2 = ""; $obj_tag = "input"; $obj_closing_tag = false; // do not check if another check was done if (intval($value) == intval($field_id) && !in_array($name, $radio_checked)) { $obj_checked = ' checked="checked"'; $radio_checked += array($name => true); } else { $obj_checked = ''; } break; case "avatar": case "picture": case "file": $allowed_exts = ''; if (isset($rules['equal_to'])) { if ($rules['equal_to'] != "") { $allowed_exts = "'" . implode("', '", explode(",", $rules['equal_to'])) . "'"; } } if ($type == "file") { // if we do not escape then some translations can break $warning_msg = $wpdb->escape(__("Please upload a file with one of the following extensions", $cimy_uef_domain)); $obj_checked = ' onchange="uploadFile(\'registerform\', \'' . $unique_id . '\', \'' . $warning_msg . '\', Array(' . $allowed_exts . '));"'; } else { // if we do not escape then some translations can break $warning_msg = $wpdb->escape(__("Please upload an image with one of the following extensions", $cimy_uef_domain)); $obj_checked = ' onchange="uploadFile(\'registerform\', \'' . $unique_id . '\', \'' . $warning_msg . '\', Array(\'gif\', \'png\', \'jpg\', \'jpeg\', \'tiff\'));"'; } // javascript will be added later $upload_file_function = true; $obj_label = '<label for="' . $unique_id . '">' . $label . ' </label>'; $obj_class = ' class="cimy_uef_picture"'; $obj_name = ' name="' . $input_name . '"'; $obj_type = ' type="file"'; $obj_value = ' value="' . $value . '"'; $obj_value2 = ""; $obj_tag = "input"; $obj_closing_tag = false; break; case "registration-date": $obj_label = ''; $obj_class = ''; $obj_name = ' name="' . $input_name . '"'; $obj_type = ' type="hidden"'; $obj_value = ' value="' . $value . '"'; $obj_value2 = ""; $obj_checked = ""; $obj_tag = "input"; $obj_closing_tag = false; break; } $obj_id = ' id="' . $unique_id . '"'; // tabindex not used in MU, dropping... if (is_multisite()) { $obj_tabindex = ""; } else { $obj_tabindex = ' tabindex="' . strval($tabindex) . '"'; $tabindex++; } $obj_maxlen = ""; if (in_array($type, $rule_maxlen_needed) && !in_array($type, $cimy_uef_file_types)) { if (isset($rules['max_length'])) { $obj_maxlen = ' maxlength="' . $rules['max_length'] . '"'; } else { if (isset($rules['exact_length'])) { $obj_maxlen = ' maxlength="' . $rules['exact_length'] . '"'; } } } if (in_array($type, $cimy_uef_textarea_types)) { $obj_rowscols = ' rows="3" cols="25"'; } else { $obj_rowscols = ''; } echo "\t"; $form_object = '<' . $obj_tag . $obj_type . $obj_name . $obj_id . $obj_class . $obj_value . $obj_checked . $obj_maxlen . $obj_rowscols . $obj_tabindex; if ($obj_closing_tag) { $form_object .= ">" . $obj_value2 . "</" . $obj_tag . ">"; } else { $form_object .= " />"; } if ($type != "radio" && $type != "checkbox") { echo $obj_label; } if (is_multisite()) { if ($errmsg = $errors->get_error_message($unique_id)) { echo '<p class="error">' . $errmsg . '</p>'; } } // write to the html the form object built echo $form_object; if ($i == 1 && $options['password_meter']) { if ($input_name == $prefix . "PASSWORD") { $pass1_id = $unique_id; } if ($input_name == $prefix . "PASSWORD2") { echo "\n\t\t<div id=\"pass-strength-result\">" . __('Strength indicator') . "</div>"; echo "\n\t\t<p class=\"description indicator-hint\">" . __('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! \\" ? $ % ^ & ).') . "</p><br />"; $pass2_id = $unique_id; } } if (!($type != "radio" && $type != "checkbox")) { echo $obj_label; } echo "\n\t</p>\n"; if ($type == "textarea-rich" || in_array($type, $cimy_uef_file_types)) { echo "\t<br />\n"; } } $i++; } if ($tiny_mce_objects != "") { $mce_skin = ""; require_once $cuef_plugin_dir . '/cimy_uef_init_mce.php'; } if ($options['password_meter']) { ?> <script type='text/javascript' src='<?php trailingslashit(get_option('siteurl')); ?> wp-includes/js/jquery/jquery.js?ver=1.2.3'></script> <?php require_once $cuef_plugin_dir . '/cimy_uef_init_strength_meter.php'; } if ($options['captcha'] == "securimage") { global $cuef_securimage_webpath; ?> <div style="width: 278px; float: left; height: 80px; vertical-align: text-top;"> <img id="captcha" align="left" style="padding-right: 5px; border: 0" src="<?php echo $cuef_securimage_webpath; ?> securimage_show_captcha.php" alt="CAPTCHA Image" /> <object type="application/x-shockwave-flash" data="<?php echo $cuef_securimage_webpath; ?> securimage_play.swf?audio=<?php echo $cuef_securimage_webpath; ?> securimage_play.php&bgColor1=#fff&bgColor2=#fff&iconColor=#777&borderWidth=1&borderColor=#000" height="19" width="19"><param name="movie" value="<?php echo $cuef_securimage_webpath; ?> securimage_play.swf?audio=<?php echo $cuef_securimage_webpath; ?> securimage_play.php&bgColor1=#fff&bgColor2=#fff&iconColor=#777&borderWidth=1&borderColor=#000" /></object> <br /><br /><br /><br /> <a align="right" tabindex="<?php echo $tabindex; $tabindex++; ?> " style="border-style: none" href="#" onclick="document.getElementById('captcha').src = '<?php echo $cuef_securimage_webpath; ?> securimage_show_captcha.php?' + Math.random(); return false"><img src="<?php echo $cuef_securimage_webpath; ?> /images/refresh.gif" alt="<?php _e("Change image", $cimy_uef_domain); ?> " border="0" onclick="this.blur()" align="bottom" /></a> </div> <div style="width: 278px; float: left; height: 50px; vertical-align: bottom; padding: 5px;"> <?php _e("Insert the code:", $cimy_uef_domain); ?> <input type="text" name="securimage_response_field" size="10" maxlength="6" tabindex="<?php echo $tabindex; $tabindex++; ?> " /> </div> <?php } if ($options['captcha'] == "recaptcha" && !empty($options['recaptcha_public_key']) && !empty($options['recaptcha_private_key'])) { require_once $cuef_plugin_dir . '/recaptcha/recaptchalib.php'; ?> <script type='text/javascript'> var RecaptchaOptions = { lang: '<?php echo substr(get_locale(), 0, 2); ?> ', tabindex : <?php echo strval($tabindex); $tabindex++; ?> }; </script> <?php // no need if Tiny MCE is present already if ($tiny_mce_objects == "") { ?> <script type='text/javascript'> var login_div = document.getElementById("login"); login_div.style.width = "375px"; </script> <?php } echo recaptcha_get_html($options['recaptcha_public_key']); } if ($upload_file_function) { wp_print_scripts("cimy_uef_upload_file"); } cimy_switch_current_blog(true); echo $end_cimy_uef_comment; }
function cimy_extract_ExtraFields() { global $wpdb, $user_ID, $wpdb_data_table, $start_cimy_uef_comment, $end_cimy_uef_comment, $rule_profile_value, $cimy_uef_options, $rule_maxlen_needed, $fields_name_prefix, $cuef_upload_path, $cimy_uef_domain, $cuef_plugin_dir, $cimy_uef_file_types, $cimy_uef_textarea_types, $user_level; // if editing a different user (only admin) if (isset($_GET['user_id'])) { $get_user_id = $_GET['user_id']; if (!current_user_can('edit_user', $get_user_id)) { return; } } else { if (isset($_POST['user_id'])) { $get_user_id = $_POST['user_id']; if (!current_user_can('edit_user', $get_user_id)) { return; } } else { if (!isset($user_ID)) { return; } $get_user_id = $user_ID; } } $get_user_id = intval($get_user_id); $options = cimy_get_options(); $extra_fields = get_cimyFields(false, true); if (!empty($extra_fields)) { $upload_image_function = false; echo $start_cimy_uef_comment; if ($options['extra_fields_title'] != "") { echo "<br clear=\"all\" />\n"; echo "<h2>" . $options['extra_fields_title'] . "</h2>\n"; } foreach ($extra_fields as $thisField) { $field_id = $thisField['ID']; cimy_insert_ExtraFields_if_not_exist($get_user_id, $field_id); } // $ef_db = $wpdb->get_results("SELECT FIELD_ID, VALUE FROM ".$wpdb_data_table." WHERE USER_ID = ".$get_user_id, ARRAY_A); $radio_checked = array(); $current_fieldset = -1; $tiny_mce_objects = ""; if ($options['fieldset_title'] != "") { $fieldset_titles = explode(',', $options['fieldset_title']); } else { $fieldset_titles = array(); } $close_table = false; echo '<table class="form-table">'; echo "\n"; foreach ($extra_fields as $thisField) { $value = ""; $old_value = ""; $field_id = $thisField['ID']; $name = $thisField['NAME']; $rules = $thisField['RULES']; $type = $thisField['TYPE']; $label = $thisField['LABEL']; $description = $thisField['DESCRIPTION']; $fieldset = $thisField['FIELDSET']; $input_name = $fields_name_prefix . esc_attr($name); // if the current user LOGGED IN has not enough permissions to see the field, skip it // apply only for EXTRA FIELDS if ($user_level < $rules['show_level']) { continue; } // if show_level == anonymous then do NOT ovverride other show_xyz rules if ($rules['show_level'] == -1) { // if flag to show the field in the profile is NOT activated, skip it if (!$rules['show_in_profile']) { continue; } } // foreach ($ef_db as $d_field) { // if ($d_field['FIELD_ID'] == $field_id) // $value = $d_field['VALUE']; // } $value = $wpdb->get_var($wpdb->prepare("SELECT VALUE FROM " . $wpdb_data_table . " WHERE USER_ID=" . $get_user_id . " AND FIELD_ID=" . $field_id)); $old_value = $value; // if nothing is inserted and field admin default value then assign it if (in_array($type, $rule_profile_value)) { if ($value == "") { $value = $thisField['VALUE']; } } if ($fieldset > $current_fieldset && isset($fieldset_titles[$fieldset])) { $current_fieldset = $fieldset; // do not close the table if it is the first iteration if ($close_table) { echo "</table>\n"; } else { $close_table = true; } if (isset($fieldset_titles[$current_fieldset])) { echo "\n\t<h3>" . $fieldset_titles[$current_fieldset] . "</h3>\n"; } echo '<table class="form-table">'; echo "\n"; } echo "\t"; echo "<tr>"; echo "\n\t"; $value = esc_attr($value); switch ($type) { case "picture-url": case "password": case "text": $obj_label = '<label for="' . $fields_name_prefix . $field_id . '">' . $label . '</label>'; $obj_name = ' name="' . $input_name . '"'; if ($type == "picture-url") { $obj_type = ' type="text"'; } else { $obj_type = ' type="' . $type . '"'; } $obj_value = ' value="' . $value . '"'; $obj_value2 = ""; $obj_checked = ""; $obj_tag = "input"; $obj_closing_tag = false; $obj_style = ' class="regular-text"'; if ($old_value != "" && $rules['edit'] == 'edit_only_if_empty' || $old_value != "" && !current_user_can('edit_users') && $rules['edit'] == 'edit_only_by_admin_or_if_empty' || $rules['edit'] == 'no_edit' || $rules['edit'] == 'edit_only_by_admin' && !current_user_can('edit_users')) { $obj_disabled = ' disabled="disabled"'; } else { $obj_disabled = ""; } break; case "textarea": $obj_label = '<label for="' . $fields_name_prefix . $field_id . '">' . $label . '</label>'; $obj_name = ' name="' . $input_name . '"'; $obj_type = ""; $obj_value = ""; $obj_value2 = $value; $obj_checked = ""; $obj_tag = "textarea"; $obj_closing_tag = true; $obj_style = ""; if ($old_value != "" && $rules['edit'] == 'edit_only_if_empty' || $old_value != "" && !current_user_can('edit_users') && $rules['edit'] == 'edit_only_by_admin_or_if_empty' || $rules['edit'] == 'no_edit' || $rules['edit'] == 'edit_only_by_admin' && !current_user_can('edit_users')) { $obj_disabled = ' disabled="disabled"'; } else { $obj_disabled = ""; } break; case "textarea-rich": if ($tiny_mce_objects == "") { $tiny_mce_objects = $fields_name_prefix . $field_id; } else { $tiny_mce_objects .= "," . $fields_name_prefix . $field_id; } $obj_label = '<label for="' . $fields_name_prefix . $field_id . '">' . $label . '</label>'; $obj_name = ' name="' . $input_name . '"'; $obj_type = ""; $obj_value = ""; $obj_value2 = $value; $obj_checked = ""; $obj_tag = "textarea"; $obj_closing_tag = true; $obj_style = ""; if ($old_value != "" && $rules['edit'] == 'edit_only_if_empty' || $old_value != "" && !current_user_can('edit_users') && $rules['edit'] == 'edit_only_by_admin_or_if_empty' || $rules['edit'] == 'no_edit' || $rules['edit'] == 'edit_only_by_admin' && !current_user_can('edit_users')) { $obj_disabled = ' disabled="disabled"'; } else { $obj_disabled = ""; } break; case "dropdown-multi": case "dropdown": $ret = cimy_dropDownOptions($label, $value); $label = $ret['label']; $html = $ret['html']; $obj_label = '<label for="' . $fields_name_prefix . $field_id . '">' . $label . '</label>'; if ($type == "dropdown-multi") { $obj_name = ' name="' . $input_name . '[]" multiple="multiple" size="5"'; $obj_style = ' style="height: 11em;"'; } else { $obj_name = ' name="' . $input_name . '"'; $obj_style = ''; } $obj_type = ''; $obj_value = ''; $obj_value2 = $html; $obj_checked = ""; $obj_tag = "select"; $obj_closing_tag = true; if ($old_value != "" && $rules['edit'] == 'edit_only_if_empty' || $old_value != "" && !current_user_can('edit_users') && $rules['edit'] == 'edit_only_by_admin_or_if_empty' || $rules['edit'] == 'no_edit' || $rules['edit'] == 'edit_only_by_admin' && !current_user_can('edit_users')) { $obj_disabled = ' disabled="disabled"'; } else { $obj_disabled = ""; } break; case "checkbox": $obj_label = '<label for="' . $fields_name_prefix . $field_id . '">' . $label . '</label>'; $obj_name = ' name="' . $input_name . '"'; $obj_type = ' type="' . $type . '"'; $obj_value = ' value="1"'; $obj_value2 = ""; $value == "YES" ? $obj_checked = ' checked="checked"' : ($obj_checked = ''); $obj_tag = "input"; $obj_closing_tag = false; $obj_style = ' style="width:auto; border:0; background:white;"'; if ($rules['edit'] == 'no_edit' || ($rules['edit'] == 'edit_only_by_admin' || $rules['edit'] == 'edit_only_by_admin_or_if_empty') && !current_user_can('edit_users')) { $obj_disabled = ' disabled="disabled"'; } else { $obj_disabled = ""; } break; case "radio": $obj_label = '<label for="' . $fields_name_prefix . $field_id . '"> ' . $label . '</label>'; $obj_name = ' name="' . $input_name . '"'; $obj_type = ' type="' . $type . '"'; $obj_value = ' value="' . $field_id . '"'; $obj_value2 = ""; $obj_tag = "input"; $obj_closing_tag = false; $obj_style = ' style="width:auto; border:0; background:white;"'; if ($rules['edit'] == 'no_edit' || ($rules['edit'] == 'edit_only_by_admin' || $rules['edit'] == 'edit_only_by_admin_or_if_empty') && !current_user_can('edit_users')) { $obj_disabled = ' disabled="disabled"'; } else { $obj_disabled = ""; } if ($value == "") { $obj_checked = ''; } else { $obj_checked .= ' checked="checked"'; } break; case "avatar": case "picture": case "file": $allowed_exts = ''; if (isset($rules['equal_to'])) { if ($rules['equal_to'] != "") { $allowed_exts = "'" . implode("', '", explode(",", $rules['equal_to'])) . "'"; } } // javascript will be added later $upload_file_function = true; $obj_label = '<label for="' . $fields_name_prefix . $field_id . '">' . $label . '</label>'; $obj_class = ''; $obj_name = ' name="' . $input_name . '"'; $obj_type = ' type="file"'; $obj_value = ' value=""'; $obj_value2 = ''; $obj_checked = ""; $obj_tag = "input"; $obj_closing_tag = false; if ($type == "file") { // if we do not escape then some translations can break $warning_msg = $wpdb->escape(__("Please upload a file with one of the following extensions", $cimy_uef_domain)); $obj_style = ' onchange="uploadFile(\'your-profile\', \'' . $fields_name_prefix . $field_id . '\', \'' . $warning_msg . '\', Array(' . $allowed_exts . '));"'; } else { // if we do not escape then some translations can break $warning_msg = $wpdb->escape(__("Please upload an image with one of the following extensions", $cimy_uef_domain)); $obj_style = ' onchange="uploadFile(\'your-profile\', \'' . $fields_name_prefix . $field_id . '\', \'' . $warning_msg . '\', Array(\'gif\', \'png\', \'jpg\', \'jpeg\', \'tiff\'));"'; } if ($old_value != "" && $rules['edit'] == 'edit_only_if_empty' || $old_value != "" && !current_user_can('edit_users') && $rules['edit'] == 'edit_only_by_admin_or_if_empty' || $rules['edit'] == 'no_edit' || $rules['edit'] == 'edit_only_by_admin' && !current_user_can('edit_users')) { $obj_disabled = ' disabled="disabled"'; } else { $obj_disabled = ""; } break; case "registration-date": if (isset($rules['equal_to'])) { $obj_value = cimy_get_formatted_date($value, $rules['equal_to']); } else { $obj_value = cimy_get_formatted_date($value); } $obj_label = '<label>' . $label . '</label>'; break; } $obj_id = ' id="' . $fields_name_prefix . $field_id . '"'; $obj_class = ''; $obj_maxlen = ""; if (in_array($type, $rule_maxlen_needed) && !in_array($type, $cimy_uef_file_types)) { if (isset($rules['max_length'])) { $obj_maxlen = ' maxlength="' . $rules['max_length'] . '"'; } else { if (isset($rules['exact_length'])) { $obj_maxlen = ' maxlength="' . $rules['exact_length'] . '"'; } } } if (in_array($type, $cimy_uef_textarea_types)) { $obj_rowscols = ' rows="3" cols="25"'; } else { $obj_rowscols = ''; } echo "\t"; $form_object = '<' . $obj_tag . $obj_id . $obj_class . $obj_name . $obj_type . $obj_value . $obj_checked . $obj_maxlen . $obj_rowscols . $obj_style . $obj_disabled; if ($obj_closing_tag) { $form_object .= ">" . $obj_value2 . "</" . $obj_tag . ">"; } else { $form_object .= " />"; } echo "<th>"; echo $obj_label; echo "</th>\n"; echo "\t\t<td>"; if ($description != "" && ($type == "picture" || $type == "picture-url")) { echo $description . "<br />"; } if (in_array($type, $cimy_uef_file_types)) { $profileuser = get_user_to_edit($get_user_id); } if ($type == "avatar") { $user_email = $profileuser->user_email; echo '<div id="profpic">' . get_avatar($user_email, $size = '128') . "</div>\n\t\t"; } if (in_array($type, $cimy_uef_file_types) && $value != "") { global $cimy_uef_plugins_dir; $blog_path = $cuef_upload_path; if ($cimy_uef_plugins_dir == "plugins" && is_multisite()) { global $blog_id; $blog_path .= $blog_id . "/"; } $user_login = $profileuser->user_login; if ($type == "picture") { $value_thumb = cimy_get_thumb_path($value); $file_thumb = $blog_path . $user_login . "/" . cimy_get_thumb_path(basename($value)); $file_on_server = $blog_path . $user_login . "/" . basename($value); echo "\n\t\t"; if (is_file($file_thumb)) { echo '<a target="_blank" href="' . $value . '"><img src="' . $value_thumb . '" alt="picture" /></a><br />'; echo "\n\t\t"; } else { if (is_file($file_on_server)) { echo '<img src="' . $value . '" alt="picture" /><br />'; echo "\n\t\t"; } } } if ($type == "file") { echo '<a target="_blank" href="' . $value . '">'; echo basename($value); echo '</a><br />'; echo "\n\t\t"; } // if there is no image or there is the default one then disable delete button if ($old_value == "") { $dis_delete_img = ' disabled="disabled"'; } else { // take the "can be modified" rule just set before $dis_delete_img = $obj_disabled; echo '<input type="hidden" name="' . $input_name . '_oldfile" value="' . basename($value) . '" />'; echo "\n\t\t"; } echo '<input type="checkbox" name="' . $input_name . '_del" value="1" style="width:auto; border:0; background:white;"' . $dis_delete_img . ' />'; if ($type == "file") { echo " " . __("Delete the file", $cimy_uef_domain) . "<br /><br />"; echo "\n\t\t" . __("Update the file", $cimy_uef_domain) . "<br />"; } else { echo " " . __("Delete the picture", $cimy_uef_domain) . "<br /><br />"; echo "\n\t\t" . __("Update the picture", $cimy_uef_domain) . "<br />"; } echo "\n\t\t"; } if ($type == "picture-url") { if ($value != "") { if (intval($rules['equal_to'])) { echo '<a target="_blank" href="' . $value . '">'; echo '<img src="' . $value . '" alt="picture"' . $size . ' width="' . intval($rules['equal_to']) . '" height="*" />'; echo "</a>"; } else { echo '<img src="' . $value . '" alt="picture" />'; } echo "<br />"; echo "\n\t\t"; } echo "<br />" . __("Picture URL:", $cimy_uef_domain) . "<br />\n\t\t"; } // write to the html the form object built if ($type != "registration-date") { echo $form_object; } else { echo $obj_value; } if ($description != "" && $type != "picture" && $type != "picture-url") { if ($type == "textarea" || $type == "textarea-rich") { echo "<br />"; } else { echo " "; } echo $description; } echo "</td>"; echo "\n\t</tr>\n"; } echo "</table>"; if ($tiny_mce_objects != "") { $mce_skin = 'skin : "wp_theme",'; require_once $cuef_plugin_dir . '/cimy_uef_init_mce.php'; } if ($upload_file_function) { wp_print_scripts("cimy_uef_upload_file"); } echo $end_cimy_uef_comment; } }
function cimy_registration_form($errors = null, $show_type = 0) { global $wpdb, $start_cimy_uef_comment, $end_cimy_uef_comment, $rule_maxlen_needed, $fields_name_prefix, $wp_fields_name_prefix, $cuef_plugin_dir, $cimy_uef_file_types, $cimy_uef_textarea_types, $user_level, $cimy_uef_domain; // cimy_switch_to_blog(); $my_user_level = $user_level; // -1 == anonymous if (!is_user_logged_in()) { $my_user_level = -1; } // needed by cimy_uef_init_mce.php $cimy_uef_register_page = true; $extra_fields = get_cimyFields(false, true); $wp_fields = get_cimyFields(true); if (is_multisite()) { $input_class = "cimy_uef_input_mu"; } else { $input_class = "cimy_uef_input_27"; } $options = cimy_get_options(); $tabindex = 21; echo $start_cimy_uef_comment; // needed to apply default values only first time and not in case of errors echo "\t<input type=\"hidden\" name=\"cimy_post\" value=\"1\" />\n"; if ($options['confirm_form']) { if ($show_type == 0) { echo "\t<input type=\"hidden\" name=\"register_confirmation\" value=\"1\" />\n"; } else { if ($show_type == 2) { echo "\t<input type=\"hidden\" name=\"register_confirmation\" value=\"2\" />\n"; } } } $radio_checked = array(); $i = 1; $upload_file_function = false; $is_jquery_added = false; $crop_image_function = false; // confirmation page, all fields are plain text + hidden fields to carry over values if ($show_type == 2) { $upload_dir = cimy_uef_get_dir_or_filename(""); $dirs = glob($upload_dir . ".cimytemp_*.tmp"); if (is_array($dirs)) { foreach ($dirs as $dir) { $diff = current_time('timestamp', true) - filemtime($dir); // If older than two days delete! if ($diff > 172800) { cimy_rfr($dir . "/", "*"); if (is_dir($dir)) { rmdir($dir); } } } } $temp_user_login = "******" . sanitize_user($_POST['user_login']) . '_' . rand() . '.tmp'; ?> <input type="hidden" name="temp_user_login" value="<?php echo esc_attr($temp_user_login); ?> " /> <p id="user_login_p"> <label for="user_login"><?php _e("Username"); ?> </label><input type="hidden" name="user_login" id="user_login" value="<?php echo esc_attr($_POST["user_login"]); ?> " /><?php echo esc_html($_POST["user_login"]); ?> </p> <p id="user_email_p"> <label for="user_email"><?php _e("E-mail"); ?> </label><input type="hidden" name="user_email" id="user_email" value="<?php echo esc_attr($_POST["user_email"]); ?> " /><?php echo esc_html($_POST["user_email"]); ?> </p> <br /> <?php } // do first the WP fields then the EXTRA fields while ($i <= 2) { if ($i == 1) { $fields = $wp_fields; $prefix = $wp_fields_name_prefix; } else { $fields = $extra_fields; $prefix = $fields_name_prefix; $current_fieldset = -1; if (!empty($options['fieldset_title'])) { $fieldset_titles = explode(',', $options['fieldset_title']); } else { $fieldset_titles = array(); } } $tiny_mce_objects = ""; foreach ($fields as $thisField) { $field_id = $thisField['ID']; $name = $thisField['NAME']; $rules = $thisField['RULES']; $type = $thisField['TYPE']; $old_type = $type; $label = $thisField['LABEL']; $description = cimy_uef_sanitize_content($thisField['DESCRIPTION']); $fieldset = empty($thisField['FIELDSET']) ? 0 : $thisField['FIELDSET']; $input_name = $prefix . esc_attr($name); $post_input_name = $prefix . $wpdb->escape($name); $maxlen = 0; $unique_id = $prefix . $field_id; $field_id_data = $input_name . "_" . $field_id . "_data"; $advanced_options = cimy_uef_parse_advanced_options($rules["advanced_options"]); // showing the search then there is no need to upload buttons if ($show_type == 1) { if ($type == "password") { continue; } if ($type == "avatar" || $type == "picture" || $type == "file") { $type = "text"; } } else { if ($show_type == 2) { $type = "hidden"; } } // if the current user LOGGED IN has not enough permissions to see the field, skip it if ($rules['show_level'] == 'view_cimy_extra_fields') { if (!current_user_can($rules['show_level'])) { continue; } } else { if ($my_user_level < $rules['show_level']) { continue; } } // if show_level == anonymous then do NOT ovverride other show_xyz rules if ($rules['show_level'] == -1) { if ($show_type == 0) { // if flag to show the field in the registration is NOT activated, skip it if (!$rules['show_in_reg']) { continue; } } else { if ($show_type == 1) { // if flag to show the field in the blog is NOT activated, skip it if (!$rules['show_in_search']) { continue; } } } } // uploading a file is not supported when confirmation email is enabled (on MS is turned on by default yes) if ((is_multisite() || $options["confirm_email"]) && in_array($type, $cimy_uef_file_types)) { continue; } if (isset($_POST[$post_input_name])) { if ($type == "dropdown-multi" || $old_type == "dropdown-multi") { $value = stripslashes(implode(",", $_POST[$post_input_name])); } else { $value = stripslashes($_POST[$post_input_name]); } } else { if (isset($_GET[$name])) { if ($type == "dropdown-multi" || $old_type == "dropdown-multi") { $value = stripslashes(implode(",", $_GET[$name])); } else { $value = stripslashes($_GET[$name]); } } else { if (!isset($_POST["cimy_post"])) { $value = $thisField['VALUE']; switch ($type) { case "radio": if ($value == "YES") { $value = $field_id; } else { $value = ""; } break; case "checkbox": if ($value == "YES") { $value = "1"; } else { $value = ""; } break; } } else { $value = ""; } } } if ($i != 1 && $fieldset > $current_fieldset && isset($fieldset_titles[$fieldset])) { $current_fieldset = $fieldset; if (isset($fieldset_titles[$current_fieldset])) { echo "\n\t<h2>" . esc_html($fieldset_titles[$current_fieldset]) . "</h2>\n"; } } if (!empty($description) && $type != "registration-date") { echo "\t"; echo '<p id="' . $prefix . 'p_desc_' . $field_id . '" class="desc"><br />' . $description . '</p>'; echo "\n"; } echo "\t"; echo '<p id="' . $prefix . 'p_field_' . $field_id . '">'; echo "\n\t"; switch ($type) { case "picture-url": case "password": case "text": $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . '</label>'; $obj_class = ' class="' . $input_class . '"'; $obj_name = ' name="' . $input_name . '"'; if ($type == "picture-url") { $obj_type = ' type="text"'; } else { $obj_type = ' type="' . $type . '"'; } $obj_value = ' value="' . esc_attr($value) . '"'; $obj_value2 = ""; $obj_checked = ""; $obj_tag = "input"; $obj_closing_tag = false; break; case "dropdown": case "dropdown-multi": // cimy_dropDownOptions uses cimy_uef_sanitize_content and esc_attr by itself $ret = cimy_dropDownOptions($label, $value); $label = $ret['label']; $html = $ret['html']; if ($type == "dropdown-multi") { $obj_name = ' name="' . $input_name . '[]" multiple="multiple" size="6"'; } else { $obj_name = ' name="' . $input_name . '"'; } $obj_label = '<label for="' . $unique_id . '">' . $label . '</label>'; $obj_class = ' class="' . $input_class . '"'; $obj_type = ''; $obj_value = ''; $obj_value2 = $html; $obj_checked = ""; $obj_tag = "select"; $obj_closing_tag = true; break; case "textarea": $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . '</label>'; $obj_class = ' class="' . $input_class . '"'; $obj_name = ' name="' . $input_name . '"'; $obj_type = ""; $obj_value = ""; $obj_value2 = esc_html($value); $obj_checked = ""; $obj_tag = "textarea"; $obj_closing_tag = true; break; case "textarea-rich": if ($tiny_mce_objects == "") { $tiny_mce_objects = $fields_name_prefix . $field_id; } else { $tiny_mce_objects .= "," . $fields_name_prefix . $field_id; } $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . '</label>'; $obj_class = ' class="' . $input_class . '"'; $obj_name = ' name="' . $input_name . '"'; $obj_type = ""; $obj_value = ""; $obj_value2 = esc_html($value); $obj_checked = ""; $obj_tag = "textarea"; $obj_closing_tag = true; break; case "checkbox": $obj_label = '<label class="cimy_uef_label_checkbox" for="' . $unique_id . '"> ' . cimy_uef_sanitize_content($label) . '</label><br />'; $obj_class = ' class="cimy_uef_checkbox"'; $obj_name = ' name="' . $input_name . '"'; $obj_type = ' type="' . $type . '"'; $obj_value = ' value="1"'; $obj_value2 = ""; $value == "1" ? $obj_checked = ' checked="checked"' : ($obj_checked = ''); $obj_tag = "input"; $obj_closing_tag = false; break; case "radio": $obj_label = '<label class="cimy_uef_label_radio" for="' . $unique_id . '"> ' . cimy_uef_sanitize_content($label) . '</label>'; $obj_class = ' class="cimy_uef_radio"'; $obj_name = ' name="' . $input_name . '"'; $obj_type = ' type="' . $type . '"'; $obj_value = ' value="' . $field_id . '"'; $obj_value2 = ""; $obj_tag = "input"; $obj_closing_tag = false; // do not check if another check was done if (intval($value) == intval($field_id) && !in_array($name, $radio_checked)) { $obj_checked = ' checked="checked"'; $radio_checked += array($name => true); } else { $obj_checked = ''; } break; case "avatar": case "picture": case "file": $allowed_exts = ''; if (isset($rules['equal_to'])) { if ($rules['equal_to'] != "") { $allowed_exts = "'" . implode("', '", explode(",", $rules['equal_to'])) . "'"; } } if ($type == "file") { // if we do not escape then some translations can break $warning_msg = $wpdb->escape(__("Please upload a file with one of the following extensions", $cimy_uef_domain)); $obj_checked = ' onchange="uploadFile(\'registerform\', \'' . $unique_id . '\', \'' . $warning_msg . '\', Array(' . $allowed_exts . '));"'; } else { // if we do not escape then some translations can break $warning_msg = $wpdb->escape(__("Please upload an image with one of the following extensions", $cimy_uef_domain)); $obj_checked = ' onchange="uploadFile(\'registerform\', \'' . $unique_id . '\', \'' . $warning_msg . '\', Array(\'gif\', \'png\', \'jpg\', \'jpeg\', \'tiff\'));"'; } // javascript will be added later $upload_file_function = true; $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . ' </label>'; $obj_class = ' class="cimy_uef_picture"'; $obj_name = ' name="' . $input_name . '"'; $obj_type = ' type="file"'; $obj_value = ' value="' . esc_attr($value) . '"'; $obj_value2 = ""; $obj_tag = "input"; $obj_closing_tag = false; break; case "hidden": $obj_label = ""; $obj_value2 = ""; switch ($old_type) { case 'checkbox': $value == 1 ? $obj_value2 = __("YES", $cimy_uef_domain) : ($obj_value2 = __("NO", $cimy_uef_domain)); break; case 'radio': intval($value) == intval($field_id) ? $obj_value2 = __("YES", $cimy_uef_domain) : ($obj_value2 = __("NO", $cimy_uef_domain)); break; case 'dropdown': case 'dropdown-multi': $ret = cimy_dropDownOptions($label, $value); $label = $ret['label']; break; case 'picture': case 'avatar': case 'file': $value = cimy_manage_upload($input_name, $temp_user_login, $rules, false, false, $type, !empty($advanced_options["filename"]) ? $advanced_options["filename"] : ""); $file_on_server = cimy_uef_get_dir_or_filename($temp_user_login, $value, false); $file_thumb = cimy_uef_get_dir_or_filename($temp_user_login, $value, true); if ($advanced_options["no-thumb"] && is_file($file_thumb)) { rename($file_thumb, $file_on_server); } // yea little trick $obj_value2 = " "; break; } if ($old_type != "password") { $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . ' </label>'; if (empty($obj_value2)) { $obj_value2 = cimy_uef_sanitize_content($value); } } $obj_class = ''; $obj_name = ' name="' . $input_name . '"'; $obj_type = ' type="hidden"'; $obj_value = ' value="' . esc_attr($value) . '"'; $obj_checked = ""; $obj_tag = "input"; $obj_closing_tag = false; break; case "registration-date": $obj_label = ''; $obj_class = ''; $obj_name = ' name="' . $input_name . '"'; $obj_type = ' type="hidden"'; $obj_value = ' value="' . esc_attr($value) . '"'; $obj_value2 = ""; $obj_checked = ""; $obj_tag = "input"; $obj_closing_tag = false; break; } $obj_id = ' id="' . $unique_id . '"'; // tabindex not used in MU, dropping... if (is_multisite()) { $obj_tabindex = ""; } else { $obj_tabindex = ' tabindex="' . strval($tabindex) . '"'; $tabindex++; } $obj_maxlen = ""; if (in_array($type, $rule_maxlen_needed) && !in_array($type, $cimy_uef_file_types)) { if (isset($rules['max_length'])) { $obj_maxlen = ' maxlength="' . $rules['max_length'] . '"'; } else { if (isset($rules['exact_length'])) { $obj_maxlen = ' maxlength="' . $rules['exact_length'] . '"'; } } } if (in_array($type, $cimy_uef_textarea_types)) { $obj_rowscols = ' rows="3" cols="25"'; } else { $obj_rowscols = ''; } echo "\t"; $form_object = '<' . $obj_tag . $obj_type . $obj_name . $obj_id . $obj_class . $obj_value . $obj_checked . $obj_maxlen . $obj_rowscols . $obj_tabindex; if ($obj_closing_tag) { $form_object .= ">" . $obj_value2 . "</" . $obj_tag . ">"; } else { if ($type == "hidden") { $form_object .= " />" . $obj_value2; if (in_array($old_type, $cimy_uef_file_types)) { echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_size\" id=\"" . esc_attr($field_id_data) . "_size\" value=\"" . strval($_FILES[$input_name]['size'] / 1024) . "\" />"; echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_type\" id=\"" . esc_attr($field_id_data) . "_type\" value=\"" . strval($_FILES[$input_name]['type']) . "\" />"; } if (($old_type == "picture" || $old_type == "avatar") && is_file($file_on_server)) { if (!$is_jquery_added) { wp_print_scripts("jquery"); $is_jquery_added = true; } $crop_image_function = true; echo '<img id="' . esc_attr($field_id_data) . '" src="' . esc_attr($value) . '" alt="picture" /><br />'; echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_button\" id=\"" . esc_attr($field_id_data) . "_button\" value=\"1\" />"; echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_x1\" id=\"" . esc_attr($field_id_data) . "_x1\" value=\"\" />"; echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_y1\" id=\"" . esc_attr($field_id_data) . "_y1\" value=\"\" />"; echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_x2\" id=\"" . esc_attr($field_id_data) . "_x2\" value=\"\" />"; echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_y2\" id=\"" . esc_attr($field_id_data) . "_y2\" value=\"\" />"; echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_w\" id=\"" . esc_attr($field_id_data) . "_w\" value=\"\" />"; echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_h\" id=\"" . esc_attr($field_id_data) . "_h\" value=\"\" />"; $imgarea_options = "handles: true, fadeSpeed: 200, onSelectChange: preview"; if (isset($advanced_options["crop_x1"]) && isset($advanced_options["crop_y1"]) && isset($advanced_options["crop_x2"]) && isset($advanced_options["crop_y2"])) { $imgarea_options .= ", x1: " . intval($advanced_options["crop_x1"]); $imgarea_options .= ", y1: " . intval($advanced_options["crop_y1"]); $imgarea_options .= ", x2: " . intval($advanced_options["crop_x2"]); $imgarea_options .= ", y2: " . intval($advanced_options["crop_y2"]); } if (!empty($advanced_options["crop_ratio"])) { $imgarea_options .= ", aspectRatio: '" . esc_js($advanced_options["crop_ratio"]) . "'"; } else { if ($type == "avatar") { $imgarea_options .= ", aspectRatio: '1:1'"; } } echo "<script type='text/javascript'>jQuery(document).ready(function () { jQuery('#" . esc_js($field_id_data) . "').imgAreaSelect({ " . $imgarea_options . " }); });</script>"; } } else { $form_object .= " />"; } } if ($type != "radio" && $type != "checkbox") { echo $obj_label; } if (is_multisite()) { if ($errmsg = $errors->get_error_message($unique_id)) { echo '<p class="error">' . $errmsg . '</p>'; } } // write to the html the form object built echo $form_object; if ($show_type == 0 && $i == 1 && $options['password_meter']) { if ($input_name == $prefix . "PASSWORD") { $pass1_id = $unique_id; } if ($input_name == $prefix . "PASSWORD2") { echo "\n\t\t<div id=\"pass-strength-result\">" . __('Strength indicator') . "</div>"; echo "\n\t\t<p class=\"description indicator-hint\">" . __('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ & ).') . "</p><br />"; $pass2_id = $unique_id; } } if (!($type != "radio" && $type != "checkbox")) { echo $obj_label; } echo "\n\t</p>\n"; if ($type == "textarea-rich" || in_array($type, $cimy_uef_file_types)) { echo "\t<br />\n"; } } $i++; } echo "\t<br />"; if ($show_type == 0) { if (!empty($tiny_mce_objects)) { require_once $cuef_plugin_dir . '/cimy_uef_init_mce.php'; } if ($options['password_meter']) { if (!$is_jquery_added) { wp_print_scripts("jquery"); $is_jquery_added = true; } require_once $cuef_plugin_dir . '/cimy_uef_init_strength_meter.php'; } } if ($crop_image_function) { wp_print_scripts('imgareaselect'); wp_print_styles('imgareaselect'); wp_print_scripts('cimy_uef_img_selection'); } if ($show_type != 2 && $options['captcha'] == "securimage") { global $cuef_securimage_webpath; ?> <div style="width: 278px; float: left; height: 80px; vertical-align: text-top;"> <img id="captcha" align="left" style="padding-right: 5px; border: 0" src="<?php echo $cuef_securimage_webpath; ?> /securimage_show_captcha.php" alt="CAPTCHA Image" /> <object type="application/x-shockwave-flash" data="<?php echo $cuef_securimage_webpath; ?> /securimage_play.swf?audio=<?php echo $cuef_securimage_webpath; ?> /securimage_play.php&bgColor1=#fff&bgColor2=#fff&iconColor=#777&borderWidth=1&borderColor=#000" height="19" width="19"><param name="movie" value="<?php echo $cuef_securimage_webpath; ?> /securimage_play.swf?audio=<?php echo $cuef_securimage_webpath; ?> /securimage_play.php&bgColor1=#fff&bgColor2=#fff&iconColor=#777&borderWidth=1&borderColor=#000" /></object> <br /><br /><br /><br /> <a align="right" tabindex="<?php echo $tabindex; $tabindex++; ?> " style="border-style: none" href="#" onclick="document.getElementById('captcha').src = '<?php echo $cuef_securimage_webpath; ?> /securimage_show_captcha.php?' + Math.random(); return false"><img src="<?php echo $cuef_securimage_webpath; ?> /images/refresh.gif" alt="<?php _e("Change image", $cimy_uef_domain); ?> " border="0" onclick="this.blur()" align="bottom" /></a> </div> <div style="width: 278px; float: left; height: 50px; vertical-align: bottom; padding: 5px;"> <?php _e("Insert the code:", $cimy_uef_domain); ?> <input type="text" name="securimage_response_field" size="10" maxlength="6" tabindex="<?php echo $tabindex; $tabindex++; ?> " /> </div> <?php } if ($show_type != 2 && $options['captcha'] == "recaptcha" && !empty($options['recaptcha_public_key']) && !empty($options['recaptcha_private_key'])) { require_once $cuef_plugin_dir . '/recaptcha/recaptchalib.php'; ?> <script type='text/javascript'> var RecaptchaOptions = { lang: '<?php echo substr(get_locale(), 0, 2); ?> ', tabindex : <?php echo strval($tabindex); $tabindex++; ?> }; </script> <?php // no need if Tiny MCE is present already if ($tiny_mce_objects == "") { ?> <script type='text/javascript'> var login_div = document.getElementById("login"); login_div.style.width = "375px"; </script> <?php } echo recaptcha_get_html($options['recaptcha_public_key']); } if ($upload_file_function) { wp_print_scripts("cimy_uef_upload_file"); } cimy_switch_current_blog(true); echo $end_cimy_uef_comment; }