Cimy User Extra Fields - Version 2.3.0

Version Description

Download this release

Release Info

Developer Cimmo
Plugin Icon wp plugin Cimy User Extra Fields
Version 2.3.0
Comparing to
See all releases

Code changes from version 2.2.0 to 2.3.0

README_OFFICIAL.txt CHANGED
@@ -606,6 +606,13 @@ A lot of times I cannot reproduce the problem and I need more details, so if you
606
 
607
 
608
  CHANGELOG:
 
 
 
 
 
 
 
609
  v2.2.0 - 04/09/2011
610
  - Added textarea and textarea-rich class in the profile area (thanks to Evaluator)
611
  - Added case sensitive check for regex equalTo rules (thanks to Juliette for the patch)
606
 
607
 
608
  CHANGELOG:
609
+ v2.3.0 - 28/11/2011
610
+ - Fixed security issue where reCAPTCHA and Securimage Captcha could be by-passed (thanks to corij)
611
+ - Fixed tinyMCE was not working anymore since WP 3.3
612
+ - Fixed all JavaScripts inclusion to be as requested by WordPress APIs
613
+ - Fixed file, picture and avatar extra fields were not styled on registration page
614
+ - Code cleanup
615
+
616
  v2.2.0 - 04/09/2011
617
  - Added textarea and textarea-rich class in the profile area (thanks to Evaluator)
618
  - Added case sensitive check for regex equalTo rules (thanks to Juliette for the patch)
cimy_uef_admin.php CHANGED
@@ -295,37 +295,37 @@ function cimy_admin_define_extra_fields() {
295
  $email_admin == "1" ? $store_rule['email_admin'] = true : $store_rule['email_admin'] = false;
296
 
297
  // START CHECKING FOR ERRORS
298
- if ($name == "")
299
  $errors['name'] = __("Name not specified", $cimy_uef_domain);
300
  else if (!stristr($name, " ") === false)
301
  $errors['name'] = __("Name cannot contains spaces", $cimy_uef_domain);
302
 
303
- if ($label == "")
304
  $errors['label'] = __("Label not specified", $cimy_uef_domain);
305
 
306
  // max or exact length rule is needed for this type
307
  if (in_array($type, $rule_maxlen_needed)) {
308
- if (($maxlen == "") && ($exactlen == ""))
309
  $errors['maxlength1'] = $exact_or_max_length_capton." ".__("not selected (with this type is necessary)", $cimy_uef_domain);
310
  }
311
 
312
  // max or exact length rule is not needed but it's available for this type
313
  if (in_array($type, $rule_maxlen)) {
314
- if ((($maxlen != "") || ($minlen != "")) && ($exactlen != ""))
315
  $errors['exactlength1'] = __("If you select", $cimy_uef_domain)." ".$exact_length_caption." ".__("you cannot select Min or Max", $cimy_uef_domain);
316
 
317
  // MIN LEN
318
- if ($minlen != "")
319
  if (($store_rule['min_length'] < $minLen) || ($store_rule['min_length'] > $maxLen))
320
  $errors['minlength3'] = $min_length_caption." ".__("should be in the range of", $cimy_uef_domain)." ".$minLen. "-".$maxLen;
321
 
322
  // EXACT LEN
323
- if ($exactlen != "")
324
  if (($store_rule['exact_length'] < $minLen) || ($store_rule['exact_length'] > $maxLen))
325
  $errors['exactlength3'] = $exact_length_caption." ".__("should be in the range of", $cimy_uef_domain)." ".$minLen. "-".$maxLen;
326
 
327
  // MAX LEN
328
- if ($maxlen != "")
329
  if (($store_rule['max_length'] < $minLen) || ($store_rule['max_length'] > $maxLen))
330
  $errors['maxlength3'] = $max_length_caption." ".__("should be in the range of", $cimy_uef_domain)." ".$minLen. "-".$maxLen;
331
  }
@@ -383,7 +383,6 @@ function cimy_admin_define_extra_fields() {
383
 
384
  // SEARCH THE NAME IN THE DATABASE, GO ON ONLY IF DURING EDIT IT WAS THE SAME FIELD
385
  if ((count($exist) == 0) || (($action == "edit") && ($oldname == $name))) {
386
-
387
  // MIN LEN
388
  if (!in_array($type, $rule_maxlen))
389
  unset($store_rule['min_length']);
@@ -455,20 +454,19 @@ function cimy_admin_define_extra_fields() {
455
  if ($store_rule['max_length'] == 0)
456
  unset($store_rule['max_length']);
457
 
458
- // SHOW LEVEL
459
- $show_anonymous = ' selected="selected"';
460
- $show_subscriber = '';
461
- $show_contributor = '';
462
- $show_author = '';
463
- $show_editor = '';
464
- $show_admin = '';
465
- $show_view_cimy_extra_fields = '';
466
 
467
  (empty($label)) ? $selected_input["label"] = '' : $selected_input["label"] = $label;
468
  (empty($value)) ? $selected_input["value"] = '' : $selected_input["value"] = $value;
469
  $selected_input["name"] = '';
470
  $selected_input["desc"] = '';
471
- $selected_input["text"] = ' selected="selected"';
472
  $selected_input["min_length"] = '';
473
  $selected_input["exact_length"] = '';
474
  $selected_input["max_length"] = '';
@@ -478,16 +476,12 @@ function cimy_admin_define_extra_fields() {
478
  $selected_input["equal_to_regex"] = '';
479
  $selected_input["email"] = '';
480
  $selected_input["email_admin"] = '';
481
- $selected_input["ok_edit"] = ' selected="selected"';
482
  $selected_input["minlen"] = '';
483
  $selected_input["exactlen"] = '';
484
  $selected_input["maxlen"] = '';
485
  $selected_input["advanced_options"] = '';
486
 
487
  if ($action == "add") {
488
- // CAN BE MODIFIED OR NOT
489
- $selected_input[$store_rule['edit']] = ' selected="selected"';
490
-
491
  // NAME
492
  if (!empty($name))
493
  $selected_input["name"] = $name;
@@ -496,10 +490,6 @@ function cimy_admin_define_extra_fields() {
496
  if (!empty($desc))
497
  $selected_input["desc"] = $desc;
498
 
499
- // TYPE
500
- if (!empty($type))
501
- $selected_input[$type] = ' selected="selected"';
502
-
503
  // MIN LEN
504
  if (!empty($minlen))
505
  $selected_input["minlen"] = ' checked="checked"';
@@ -542,31 +532,6 @@ function cimy_admin_define_extra_fields() {
542
  if (isset($store_rule['advanced_options']))
543
  $selected_input["advanced_options"] = $store_rule['advanced_options'];
544
 
545
- // SHOW LEVEL
546
- switch ($store_rule['show_level']) {
547
- case '-1':
548
- $show_anonymous = ' selected="selected"';
549
- break;
550
- case '0':
551
- $show_subscriber = ' selected="selected"';
552
- break;
553
- case '1':
554
- $show_contributor = ' selected="selected"';
555
- break;
556
- case '2':
557
- $show_author = ' selected="selected"';
558
- break;
559
- case '5':
560
- $show_editor = ' selected="selected"';
561
- break;
562
- case '8':
563
- $show_admin = ' selected="selected"';
564
- break;
565
- case 'view_cimy_extra_fields':
566
- $show_view_cimy_extra_fields = ' selected="selected"';
567
- break;
568
- }
569
-
570
  // EMAIL ADMIN
571
  if ($store_rule['email_admin'] == true)
572
  $selected_input["email_admin"] = ' checked="checked"';
@@ -599,18 +564,6 @@ function cimy_admin_define_extra_fields() {
599
  else
600
  $selected_input["show_in_aeu"] = '';
601
 
602
- // SHOW IN THE SEARCH
603
- if ((!isset($store_rule['show_in_search'])) || ($store_rule['show_in_search'] == true) || ($action != "add"))
604
- $selected_input["show_in_search"] = ' checked="checked"';
605
- else
606
- $selected_input["show_in_search"] = '';
607
-
608
- // SHOW IN THE BLOG
609
- if ((!isset($store_rule['show_in_blog'])) || ($store_rule['show_in_blog'] == true) || ($action != "add"))
610
- $selected_input["show_in_blog"] = ' checked="checked"';
611
- else
612
- $selected_input["show_in_blog"] = '';
613
-
614
  $selected_input["name"] = esc_attr($selected_input["name"]);
615
  $selected_input["value"] = esc_attr($selected_input["value"]);
616
  $selected_input["label"] = esc_attr($selected_input["label"]);
@@ -653,11 +606,8 @@ function cimy_admin_define_extra_fields() {
653
  <select name="type[0]">
654
  <?php
655
  foreach($available_types as $this_type) {
656
- echo '<option value="'.$this_type.'"'.$selected_input[$this_type].'>'.$this_type.'</option>';
657
  echo "\n";
658
-
659
- if (isset($selected_input[$this_type]))
660
- unset($selected_input[$this_type]);
661
  }
662
  ?>
663
  </select>
@@ -685,15 +635,11 @@ function cimy_admin_define_extra_fields() {
685
  <input type="checkbox" name="email[0]" value="1"<?php echo $selected_input["email"]; ?> /> <?php _e("Check for E-mail syntax", $cimy_uef_domain); ?><br />
686
 
687
  <select name="edit[0]">
688
- <option value="ok_edit"<?php echo $selected_input["ok_edit"]; ?>><?php _e("Can be modified", $cimy_uef_domain); ?></option>
689
- <option value="edit_only_if_empty"<?php echo $selected_input["edit_only_if_empty"]; ?>><?php _e("Can be modified only if empty", $cimy_uef_domain); ?></option>
690
- <option value="edit_only_by_admin"<?php echo $selected_input["edit_only_by_admin"]; ?>><?php _e("Can be modified only by admin", $cimy_uef_domain); ?></option>
691
- <option value="edit_only_by_admin_or_if_empty"<?php echo $selected_input["edit_only_by_admin_or_if_empty"]; ?>><?php _e("Can be modified only by admin or if empty", $cimy_uef_domain); ?></option>
692
- <option value="no_edit"<?php echo $selected_input["no_edit"]; ?>><?php _e("Cannot be modified", $cimy_uef_domain); ?></option>
693
- <?php
694
- if (isset($selected_input[$edit]))
695
- unset($selected_input[$edit]);
696
- ?>
697
  </select>
698
  <br />
699
  <!-- EQUAL TO -->
@@ -714,21 +660,21 @@ function cimy_admin_define_extra_fields() {
714
  <input type="checkbox" name="show_in_aeu[0]" value="1"<?php echo $selected_input["show_in_aeu"]; ?> /> <?php _e("Show the field in Users Extended section", $cimy_uef_domain); ?><br />
715
 
716
  <!-- SHOW IN THE SEARCH ENGINE -->
717
- <input type="checkbox" name="show_in_search[0]" value="1"<?php echo $selected_input["show_in_search"]; ?> /> <?php _e("Show the field in the search engine", $cimy_uef_domain); ?><br />
718
 
719
  <!-- SHOW IN THE BLOG -->
720
- <input type="checkbox" name="show_in_blog[0]" value="1"<?php echo $selected_input["show_in_blog"]; ?> /> <?php _e("Show the field in the blog", $cimy_uef_domain); ?><br />
721
 
722
  <!-- SHOW SECURITY LEVEL -->
723
  <?php _e("Show the field if the role is at least:", $cimy_uef_domain)." "; ?>
724
  <select name="show_level[0]">
725
- <option value="-1"<?php echo $show_anonymous ?>><?php _e("Anonymous"); ?></option>
726
- <option value="0"<?php echo $show_subscriber ?>><?php echo translate_user_role("Subscriber"); ?></option>
727
- <option value="1"<?php echo $show_contributor ?>><?php echo translate_user_role("Contributor"); ?></option>
728
- <option value="2"<?php echo $show_author ?>><?php echo translate_user_role("Author"); ?></option>
729
- <option value="5"<?php echo $show_editor ?>><?php echo translate_user_role("Editor"); ?></option>
730
- <option value="8"<?php echo $show_admin ?>><?php echo translate_user_role("Administrator"); ?></option>
731
- <option value="view_cimy_extra_fields"<?php echo $show_view_cimy_extra_fields ?>><?php _e("User has 'view_cimy_extra_fields' capability", $cimy_uef_domain); ?></option>
732
  </select>
733
  <br />
734
 
@@ -762,7 +708,6 @@ function changeFormAction(form_id, tr_id) {
762
  </script>
763
 
764
  <?php
765
- wp_print_scripts("cimy_uef_invert_sel");
766
  $wp_fields = get_cimyFields(true);
767
 
768
  cimy_admin_show_extra_fields($wp_fields, $submit_msgs, true, $errors, $results, $wp_fields_post, $field_order);
@@ -777,7 +722,7 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields, $err
777
 
778
  if ((count($allFields) == 0) && ($wp_fields))
779
  return;
780
-
781
  if ($wp_fields) {
782
  $field_anchor = "field_wp_";
783
  $div_id = "wp_extrafields";
@@ -787,6 +732,29 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields, $err
787
  $field_anchor = "field_";
788
  $div_id = "extrafields";
789
  $form_id = "form_extra_fields";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
790
  }
791
 
792
  $add_caption = $submit_msgs['add_caption'];
@@ -847,7 +815,6 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields, $err
847
  <?php
848
 
849
  $style = "";
850
-
851
  foreach ($allFields as $field) {
852
  $id = $field['ID'];
853
  $order = $field['F_ORDER'];
@@ -858,6 +825,13 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields, $err
858
  $type = $field['TYPE'];
859
  $rules = $field['RULES'];
860
  $fieldset = $field["FIELDSET"];
 
 
 
 
 
 
 
861
 
862
  // MIN LEN
863
  if (isset($rules['min_length']))
@@ -1037,7 +1011,7 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields, $err
1037
  </td>
1038
  </tr>
1039
  <?php
1040
- }
1041
  ?>
1042
  </tbody>
1043
  </table>
@@ -1051,7 +1025,7 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields, $err
1051
  </p>
1052
  <br />
1053
  <?php
1054
- }
1055
 
1056
  ?>
1057
  </form>
@@ -1059,6 +1033,14 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields, $err
1059
  </div>
1060
 
1061
  <?php
 
 
 
 
 
 
 
 
1062
  }
1063
 
1064
  function cimy_uef_print_messages($errors, $results) {
@@ -1098,7 +1080,7 @@ function cimy_uef_print_messages($errors, $results) {
1098
  }
1099
 
1100
  function cimy_admin_users_list_page() {
1101
- global $wpdb, $wp_roles, $wpdb_data_table, $cimy_uef_options, $cuef_upload_path, $cimy_uef_domain, $cimy_uef_file_types;
1102
 
1103
  if (!cimy_check_admin('list_users'))
1104
  return;
295
  $email_admin == "1" ? $store_rule['email_admin'] = true : $store_rule['email_admin'] = false;
296
 
297
  // START CHECKING FOR ERRORS
298
+ if (empty($name))
299
  $errors['name'] = __("Name not specified", $cimy_uef_domain);
300
  else if (!stristr($name, " ") === false)
301
  $errors['name'] = __("Name cannot contains spaces", $cimy_uef_domain);
302
 
303
+ if (empty($label))
304
  $errors['label'] = __("Label not specified", $cimy_uef_domain);
305
 
306
  // max or exact length rule is needed for this type
307
  if (in_array($type, $rule_maxlen_needed)) {
308
+ if (empty($maxlen) && empty($exactlen))
309
  $errors['maxlength1'] = $exact_or_max_length_capton." ".__("not selected (with this type is necessary)", $cimy_uef_domain);
310
  }
311
 
312
  // max or exact length rule is not needed but it's available for this type
313
  if (in_array($type, $rule_maxlen)) {
314
+ if ((!empty($maxlen) || !empty($minlen)) && !empty($exactlen))
315
  $errors['exactlength1'] = __("If you select", $cimy_uef_domain)." ".$exact_length_caption." ".__("you cannot select Min or Max", $cimy_uef_domain);
316
 
317
  // MIN LEN
318
+ if (!empty($minlen))
319
  if (($store_rule['min_length'] < $minLen) || ($store_rule['min_length'] > $maxLen))
320
  $errors['minlength3'] = $min_length_caption." ".__("should be in the range of", $cimy_uef_domain)." ".$minLen. "-".$maxLen;
321
 
322
  // EXACT LEN
323
+ if (!empty($exactlen))
324
  if (($store_rule['exact_length'] < $minLen) || ($store_rule['exact_length'] > $maxLen))
325
  $errors['exactlength3'] = $exact_length_caption." ".__("should be in the range of", $cimy_uef_domain)." ".$minLen. "-".$maxLen;
326
 
327
  // MAX LEN
328
+ if (!empty($maxlen))
329
  if (($store_rule['max_length'] < $minLen) || ($store_rule['max_length'] > $maxLen))
330
  $errors['maxlength3'] = $max_length_caption." ".__("should be in the range of", $cimy_uef_domain)." ".$minLen. "-".$maxLen;
331
  }
383
 
384
  // SEARCH THE NAME IN THE DATABASE, GO ON ONLY IF DURING EDIT IT WAS THE SAME FIELD
385
  if ((count($exist) == 0) || (($action == "edit") && ($oldname == $name))) {
 
386
  // MIN LEN
387
  if (!in_array($type, $rule_maxlen))
388
  unset($store_rule['min_length']);
454
  if ($store_rule['max_length'] == 0)
455
  unset($store_rule['max_length']);
456
 
457
+ if (!isset($store_rule['show_level']))
458
+ $store_rule['show_level'] = "-1";
459
+
460
+ if (!isset($store_rule['edit']))
461
+ $store_rule['edit'] = "ok_edit";
462
+
463
+ if (empty($type))
464
+ $type = "text";
465
 
466
  (empty($label)) ? $selected_input["label"] = '' : $selected_input["label"] = $label;
467
  (empty($value)) ? $selected_input["value"] = '' : $selected_input["value"] = $value;
468
  $selected_input["name"] = '';
469
  $selected_input["desc"] = '';
 
470
  $selected_input["min_length"] = '';
471
  $selected_input["exact_length"] = '';
472
  $selected_input["max_length"] = '';
476
  $selected_input["equal_to_regex"] = '';
477
  $selected_input["email"] = '';
478
  $selected_input["email_admin"] = '';
 
479
  $selected_input["minlen"] = '';
480
  $selected_input["exactlen"] = '';
481
  $selected_input["maxlen"] = '';
482
  $selected_input["advanced_options"] = '';
483
 
484
  if ($action == "add") {
 
 
 
485
  // NAME
486
  if (!empty($name))
487
  $selected_input["name"] = $name;
490
  if (!empty($desc))
491
  $selected_input["desc"] = $desc;
492
 
 
 
 
 
493
  // MIN LEN
494
  if (!empty($minlen))
495
  $selected_input["minlen"] = ' checked="checked"';
532
  if (isset($store_rule['advanced_options']))
533
  $selected_input["advanced_options"] = $store_rule['advanced_options'];
534
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
535
  // EMAIL ADMIN
536
  if ($store_rule['email_admin'] == true)
537
  $selected_input["email_admin"] = ' checked="checked"';
564
  else
565
  $selected_input["show_in_aeu"] = '';
566
 
 
 
 
 
 
 
 
 
 
 
 
 
567
  $selected_input["name"] = esc_attr($selected_input["name"]);
568
  $selected_input["value"] = esc_attr($selected_input["value"]);
569
  $selected_input["label"] = esc_attr($selected_input["label"]);
606
  <select name="type[0]">
607
  <?php
608
  foreach($available_types as $this_type) {
609
+ echo '<option value="'.$this_type.'"'.selected($this_type, $type, false).'>'.$this_type.'</option>';
610
  echo "\n";
 
 
 
611
  }
612
  ?>
613
  </select>
635
  <input type="checkbox" name="email[0]" value="1"<?php echo $selected_input["email"]; ?> /> <?php _e("Check for E-mail syntax", $cimy_uef_domain); ?><br />
636
 
637
  <select name="edit[0]">
638
+ <option value="ok_edit"<?php selected('ok_edit', $store_rule['edit'], true); ?>><?php _e("Can be modified", $cimy_uef_domain); ?></option>
639
+ <option value="edit_only_if_empty"<?php selected('edit_only_if_empty', $store_rule['edit'], true); ?>><?php _e("Can be modified only if empty", $cimy_uef_domain); ?></option>
640
+ <option value="edit_only_by_admin"<?php selected('edit_only_by_admin', $store_rule['edit'], true); ?>><?php _e("Can be modified only by admin", $cimy_uef_domain); ?></option>
641
+ <option value="edit_only_by_admin_or_if_empty"<?php selected('edit_only_by_admin_or_if_empty', $store_rule['edit'], true); ?>><?php _e("Can be modified only by admin or if empty", $cimy_uef_domain); ?></option>
642
+ <option value="no_edit"<?php selected('no_edit', $store_rule['edit'], true); ?>><?php _e("Cannot be modified", $cimy_uef_domain); ?></option>
 
 
 
 
643
  </select>
644
  <br />
645
  <!-- EQUAL TO -->
660
  <input type="checkbox" name="show_in_aeu[0]" value="1"<?php echo $selected_input["show_in_aeu"]; ?> /> <?php _e("Show the field in Users Extended section", $cimy_uef_domain); ?><br />
661
 
662
  <!-- SHOW IN THE SEARCH ENGINE -->
663
+ <input type="checkbox" name="show_in_search[0]" value="1"<?php checked(empty($store_rule['show_in_search']), false, true); ?> /> <?php _e("Show the field in the search engine", $cimy_uef_domain); ?><br />
664
 
665
  <!-- SHOW IN THE BLOG -->
666
+ <input type="checkbox" name="show_in_blog[0]" value="1"<?php checked(empty($store_rule['show_in_blog']), false, true); ?> /> <?php _e("Show the field in the blog", $cimy_uef_domain); ?><br />
667
 
668
  <!-- SHOW SECURITY LEVEL -->
669
  <?php _e("Show the field if the role is at least:", $cimy_uef_domain)." "; ?>
670
  <select name="show_level[0]">
671
+ <option value="-1"<?php selected("-1", $store_rule['show_level'], true); ?>><?php _e("Anonymous"); ?></option>
672
+ <option value="0"<?php selected("0", $store_rule['show_level'], true); ?>><?php echo translate_user_role("Subscriber"); ?></option>
673
+ <option value="1"<?php selected("1", $store_rule['show_level'], true); ?>><?php echo translate_user_role("Contributor"); ?></option>
674
+ <option value="2"<?php selected("2", $store_rule['show_level'], true); ?>><?php echo translate_user_role("Author"); ?></option>
675
+ <option value="5"<?php selected("5", $store_rule['show_level'], true); ?>><?php echo translate_user_role("Editor"); ?></option>
676
+ <option value="8"<?php selected("8", $store_rule['show_level'], true); ?>><?php echo translate_user_role("Administrator"); ?></option>
677
+ <option value="view_cimy_extra_fields"<?php selected("view_cimy_extra_fields", $store_rule['show_level'], true); ?>><?php _e("User has 'view_cimy_extra_fields' capability", $cimy_uef_domain); ?></option>
678
  </select>
679
  <br />
680
 
708
  </script>
709
 
710
  <?php
 
711
  $wp_fields = get_cimyFields(true);
712
 
713
  cimy_admin_show_extra_fields($wp_fields, $submit_msgs, true, $errors, $results, $wp_fields_post, $field_order);
722
 
723
  if ((count($allFields) == 0) && ($wp_fields))
724
  return;
725
+
726
  if ($wp_fields) {
727
  $field_anchor = "field_wp_";
728
  $div_id = "wp_extrafields";
732
  $field_anchor = "field_";
733
  $div_id = "extrafields";
734
  $form_id = "form_extra_fields";
735
+
736
+ $javascripts_dep = array(
737
+ 'file_fields' => array(
738
+ 'show_in_reg' => 0,
739
+ 'show_in_profile' => 0,
740
+ 'show_in_aeu' => 0,
741
+ 'show_in_blog' => 0,
742
+ 'show_in_search' => 0
743
+ ),
744
+ 'image_fields' => array(
745
+ 'show_in_reg' => 0,
746
+ 'show_in_profile' => 0,
747
+ 'show_in_aeu' => 0,
748
+ 'show_in_blog' => 0,
749
+ 'show_in_search' => 0
750
+ ),
751
+ 'tinymce_fields' => array(
752
+ 'show_in_reg' => 0,
753
+ 'show_in_profile' => 0,
754
+ 'show_in_aeu' => 0,
755
+ 'show_in_blog' => 0,
756
+ 'show_in_search' => 0
757
+ ));
758
  }
759
 
760
  $add_caption = $submit_msgs['add_caption'];
815
  <?php
816
 
817
  $style = "";
 
818
  foreach ($allFields as $field) {
819
  $id = $field['ID'];
820
  $order = $field['F_ORDER'];
825
  $type = $field['TYPE'];
826
  $rules = $field['RULES'];
827
  $fieldset = $field["FIELDSET"];
828
+ if (!$wp_fields) {
829
+ $javascripts_dep = cimy_uef_set_javascript_dependencies($javascripts_dep, $type, "show_in_reg", $rules["show_in_reg"]);
830
+ $javascripts_dep = cimy_uef_set_javascript_dependencies($javascripts_dep, $type, "show_in_profile", $rules["show_in_profile"]);
831
+ $javascripts_dep = cimy_uef_set_javascript_dependencies($javascripts_dep, $type, "show_in_aeu", $rules["show_in_aeu"]);
832
+ $javascripts_dep = cimy_uef_set_javascript_dependencies($javascripts_dep, $type, "show_in_blog", $rules["show_in_blog"]);
833
+ $javascripts_dep = cimy_uef_set_javascript_dependencies($javascripts_dep, $type, "show_in_search", $rules["show_in_search"]);
834
+ }
835
 
836
  // MIN LEN
837
  if (isset($rules['min_length']))
1011
  </td>
1012
  </tr>
1013
  <?php
1014
+ } // end of foreach ($allFields as $field)
1015
  ?>
1016
  </tbody>
1017
  </table>
1025
  </p>
1026
  <br />
1027
  <?php
1028
+ } // end of count($allFields) > 0
1029
 
1030
  ?>
1031
  </form>
1033
  </div>
1034
 
1035
  <?php
1036
+ // this will help me to track down the javascript dependencies without looping through all fields too many times
1037
+ if (!$wp_fields) {
1038
+ $options = cimy_get_options();
1039
+ $options['file_fields'] = $javascripts_dep['file_fields'];
1040
+ $options['image_fields'] = $javascripts_dep['image_fields'];
1041
+ $options['tinymce_fields'] = $javascripts_dep['tinymce_fields'];
1042
+ cimy_set_options($options);
1043
+ }
1044
  }
1045
 
1046
  function cimy_uef_print_messages($errors, $results) {
1080
  }
1081
 
1082
  function cimy_admin_users_list_page() {
1083
+ global $wpdb, $wp_roles, $wpdb_data_table, $cuef_upload_path, $cimy_uef_domain, $cimy_uef_file_types;
1084
 
1085
  if (!cimy_check_admin('list_users'))
1086
  return;
cimy_uef_db.php CHANGED
@@ -216,6 +216,48 @@ function cimy_plugin_install () {
216
  $options["welcome_email"] = $welcome_email;
217
  }
218
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  $options['version'] = $cimy_uef_version;
220
 
221
  cimy_set_options($options);
@@ -244,6 +286,7 @@ function cimy_plugin_install () {
244
  require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
245
  dbDelta($sql);
246
  }
 
247
  }
248
 
249
  function cimy_force_signup_table_creation() {
@@ -298,6 +341,27 @@ function cimy_manage_db($command) {
298
  'fieldset_title' => '',
299
  'captcha' => 'none',
300
  'welcome_email' => $welcome_email,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
  );
302
 
303
  switch ($command) {
216
  $options["welcome_email"] = $welcome_email;
217
  }
218
 
219
+ if (version_compare($options['version'], "2.2.0", "<=") === true) {
220
+ $javascripts_dep = array(
221
+ 'file_fields' => array(
222
+ 'show_in_reg' => 0,
223
+ 'show_in_profile' => 0,
224
+ 'show_in_aeu' => 0,
225
+ 'show_in_blog' => 0,
226
+ 'show_in_search' => 0
227
+ ),
228
+ 'image_fields' => array(
229
+ 'show_in_reg' => 0,
230
+ 'show_in_profile' => 0,
231
+ 'show_in_aeu' => 0,
232
+ 'show_in_blog' => 0,
233
+ 'show_in_search' => 0
234
+ ),
235
+ 'tinymce_fields' => array(
236
+ 'show_in_reg' => 0,
237
+ 'show_in_profile' => 0,
238
+ 'show_in_aeu' => 0,
239
+ 'show_in_blog' => 0,
240
+ 'show_in_search' => 0
241
+ ));
242
+ $sql = "SELECT TYPE, RULES FROM ".$wpdb_fields_table;
243
+ $all_rules = $wpdb->get_results($sql, ARRAY_A);
244
+
245
+ if (isset($all_rules)) {
246
+ foreach ($all_rules as $rule) {
247
+ $rules = unserialize($rule["RULES"]);
248
+ $type = $rule["TYPE"];
249
+ $javascripts_dep = cimy_uef_set_javascript_dependencies($javascripts_dep, $type, "show_in_reg", $rules["show_in_reg"]);
250
+ $javascripts_dep = cimy_uef_set_javascript_dependencies($javascripts_dep, $type, "show_in_profile", $rules["show_in_profile"]);
251
+ $javascripts_dep = cimy_uef_set_javascript_dependencies($javascripts_dep, $type, "show_in_aeu", $rules["show_in_aeu"]);
252
+ $javascripts_dep = cimy_uef_set_javascript_dependencies($javascripts_dep, $type, "show_in_blog", $rules["show_in_blog"]);
253
+ $javascripts_dep = cimy_uef_set_javascript_dependencies($javascripts_dep, $type, "show_in_search", $rules["show_in_search"]);
254
+ }
255
+ }
256
+ $options['file_fields'] = $javascripts_dep['file_fields'];
257
+ $options['image_fields'] = $javascripts_dep['image_fields'];
258
+ $options['tinymce_fields'] = $javascripts_dep['tinymce_fields'];
259
+ }
260
+
261
  $options['version'] = $cimy_uef_version;
262
 
263
  cimy_set_options($options);
286
  require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
287
  dbDelta($sql);
288
  }
289
+ return $options;
290
  }
291
 
292
  function cimy_force_signup_table_creation() {
341
  'fieldset_title' => '',
342
  'captcha' => 'none',
343
  'welcome_email' => $welcome_email,
344
+ 'file_fields' => array(
345
+ 'show_in_reg' => 0,
346
+ 'show_in_profile' => 0,
347
+ 'show_in_aeu' => 0,
348
+ 'show_in_blog' => 0,
349
+ 'show_in_search' => 0
350
+ ),
351
+ 'image_fields' => array(
352
+ 'show_in_reg' => 0,
353
+ 'show_in_profile' => 0,
354
+ 'show_in_aeu' => 0,
355
+ 'show_in_blog' => 0,
356
+ 'show_in_search' => 0
357
+ ),
358
+ 'tinymce_fields' => array(
359
+ 'show_in_reg' => 0,
360
+ 'show_in_profile' => 0,
361
+ 'show_in_aeu' => 0,
362
+ 'show_in_blog' => 0,
363
+ 'show_in_search' => 0
364
+ )
365
  );
366
 
367
  switch ($command) {
cimy_uef_functions.php CHANGED
@@ -607,4 +607,25 @@ function cimy_uef_get_dir_or_filename($user_login, $url="", $is_thumbnail=false)
607
  return $blog_path.$user_login."/".basename($url);
608
  }
609
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
610
  ?>
607
  return $blog_path.$user_login."/".basename($url);
608
  }
609
 
610
+ function cimy_uef_set_javascript_dependencies($javascripts_dep, $type, $rule_name, $rule) {
611
+ switch ($type) {
612
+ case "avatar":
613
+ case "picture":
614
+ if ($rule)
615
+ $javascripts_dep['image_fields'][$rule_name] += 1;
616
+ // no break we want to count as a file too!
617
+ case "file":
618
+ if ($rule)
619
+ $javascripts_dep['file_fields'][$rule_name] += 1;
620
+ break;
621
+ case "textarea-rich":
622
+ if ($rule)
623
+ $javascripts_dep['tinymce_fields'][$rule_name] += 1;
624
+ break;
625
+ default:
626
+ break;
627
+ }
628
+ return $javascripts_dep;
629
+ }
630
+
631
  ?>
cimy_uef_init_mce.php CHANGED
@@ -70,7 +70,7 @@ if (!empty($cimy_uef_register_page)) {
70
  'theme_advanced_toolbar_location' => "top",
71
  'theme_advanced_toolbar_align' => "left",
72
  'theme_advanced_statusbar_location' => "bottom",
73
- 'extended_valid_elements' => "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
74
  'theme_advanced_buttons1' => $mce_buttons,
75
  'theme_advanced_buttons2' => $mce_buttons_2,
76
  'theme_advanced_buttons3' => $mce_buttons_3,
70
  'theme_advanced_toolbar_location' => "top",
71
  'theme_advanced_toolbar_align' => "left",
72
  'theme_advanced_statusbar_location' => "bottom",
73
+ 'extended_valid_elements' => "article[*],aside[*],audio[*],canvas[*],command[*],datalist[*],details[*],embed[*],figcaption[*],figure[*],footer[*],header[*],hgroup[*],keygen[*],mark[*],meter[*],nav[*],output[*],progress[*],section[*],source[*],summary,time[*],video[*],wbr",
74
  'theme_advanced_buttons1' => $mce_buttons,
75
  'theme_advanced_buttons2' => $mce_buttons_2,
76
  'theme_advanced_buttons3' => $mce_buttons_3,
cimy_uef_init_strength_meter.php DELETED
@@ -1,56 +0,0 @@
1
- <script type='text/javascript' src='<?php trailingslashit(get_option('siteurl'));?>wp-admin/js/password-strength-meter.dev.js?ver=20070405'></script>
2
- <script type="text/javascript">
3
- function check_pass_strength() {
4
- var pass1 = jQuery('#<?php echo $pass1_id; ?>').val(), pass2 = jQuery('#<?php echo $pass2_id; ?>').val(), user = jQuery('#<?php if (is_multisite()) echo "user_name"; else echo "user_login"; ?>').val(), strength;
5
-
6
- jQuery('#pass-strength-result').removeClass('short bad good strong');
7
- if ( ! pass1 ) {
8
- jQuery('#pass-strength-result').html( pwsL10n.empty );
9
- return;
10
- }
11
-
12
- strength = passwordStrength(pass1, user, pass2);
13
-
14
- switch ( strength ) {
15
- case 2:
16
- jQuery('#pass-strength-result').addClass('bad').html( pwsL10n['bad'] );
17
- break;
18
- case 3:
19
- jQuery('#pass-strength-result').addClass('good').html( pwsL10n['good'] );
20
- break;
21
- case 4:
22
- jQuery('#pass-strength-result').addClass('strong').html( pwsL10n['strong'] );
23
- break;
24
- case 5:
25
- jQuery('#pass-strength-result').addClass('short').html( pwsL10n['mismatch'] );
26
- break;
27
- default:
28
- jQuery('#pass-strength-result').addClass('short').html( pwsL10n['short'] );
29
- }
30
- }
31
-
32
- jQuery(document).ready( function() {
33
- jQuery('#<?php echo $pass1_id; ?>,').val('').keyup( check_pass_strength );
34
- jQuery('#<?php echo $pass2_id; ?>,').val('').keyup( check_pass_strength );
35
- jQuery('.color-palette').click(function(){$(this).siblings('input[name=admin_color]').attr('checked', 'checked')});
36
- check_pass_strength();
37
- });
38
- </script>
39
-
40
- <script type='text/javascript'>
41
- /* <![CDATA[ */
42
- var commonL10n = {
43
- warnDelete: "<?php echo esc_js(__("You are about to permanently delete the selected items.\n 'Cancel' to stop, 'OK' to delete.")); ?>"
44
- };
45
- try{convertEntities(commonL10n);}catch(e){};
46
- var pwsL10n = {
47
- empty: "<?php echo esc_js( __( 'Strength indicator' ) ); ?>",
48
- short: "<?php echo esc_js( __( 'Very weak' ) ); ?>",
49
- bad: "<?php echo esc_js( __( 'Weak' ) ); ?>",
50
- good: "<?php echo esc_js( _x( 'Medium', 'password strength' ) ); ?>",
51
- strong: "<?php echo esc_js( __( 'Strong' ) ); ?>",
52
- mismatch: "<?php echo esc_js( __( 'Mismatch' ) ); ?>"
53
- };
54
- try{convertEntities(pwsL10n);}catch(e){};
55
- /* ]]> */
56
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cimy_uef_options.php CHANGED
@@ -262,12 +262,15 @@ function cimy_show_options($results, $embedded) {
262
 
263
  if (!cimy_check_admin('manage_options'))
264
  return;
265
-
266
  // save options engine
267
  if ((isset($_POST['cimy_options'])) && (isset($cimy_top_menu)))
268
  $results = cimy_save_options();
269
-
270
  $options = cimy_get_options();
 
 
 
271
  wp_print_scripts("cimy_uef_upload_file");
272
  $warning_msg = $wpdb->escape(__("Please upload an image with one of the following extensions", $cimy_uef_domain));
273
 
262
 
263
  if (!cimy_check_admin('manage_options'))
264
  return;
265
+
266
  // save options engine
267
  if ((isset($_POST['cimy_options'])) && (isset($cimy_top_menu)))
268
  $results = cimy_save_options();
269
+
270
  $options = cimy_get_options();
271
+ if (!empty($options['version']) && $cimy_uef_version != $options['version'])
272
+ $options = cimy_plugin_install();
273
+
274
  wp_print_scripts("cimy_uef_upload_file");
275
  $warning_msg = $wpdb->escape(__("Please upload an image with one of the following extensions", $cimy_uef_domain));
276
 
cimy_uef_profile.php CHANGED
@@ -49,8 +49,6 @@ function cimy_extract_ExtraFields() {
49
  // $ef_db = $wpdb->get_results("SELECT FIELD_ID, VALUE FROM ".$wpdb_data_table." WHERE USER_ID = ".$get_user_id, ARRAY_A);
50
 
51
  $radio_checked = array();
52
- $upload_file_function = false;
53
- $crop_image_function = false;
54
  $current_fieldset = -1;
55
  $tiny_mce_objects = "";
56
 
@@ -74,7 +72,11 @@ function cimy_extract_ExtraFields() {
74
  $label = $thisField['LABEL'];
75
  $description = cimy_uef_sanitize_content($thisField['DESCRIPTION']);
76
  $fieldset = $thisField['FIELDSET'];
77
- $input_name = $fields_name_prefix.esc_attr($name);
 
 
 
 
78
  $field_id_data = $input_name."_".$field_id."_data";
79
  $advanced_options = cimy_uef_parse_advanced_options($rules["advanced_options"]);
80
 
@@ -141,7 +143,7 @@ function cimy_extract_ExtraFields() {
141
  case "picture-url":
142
  case "password":
143
  case "text":
144
- $obj_label = '<label for="'.$fields_name_prefix.$field_id.'">'.cimy_uef_sanitize_content($label).'</label>';
145
  $obj_name = ' name="'.$input_name.'"';
146
 
147
  if ($type == "picture-url")
@@ -164,7 +166,7 @@ function cimy_extract_ExtraFields() {
164
  break;
165
 
166
  case "textarea":
167
- $obj_label = '<label for="'.$fields_name_prefix.$field_id.'">'.cimy_uef_sanitize_content($label).'</label>';
168
  $obj_name = ' name="'.$input_name.'"';
169
  $obj_type = "";
170
  $obj_value = "";
@@ -184,11 +186,11 @@ function cimy_extract_ExtraFields() {
184
 
185
  case "textarea-rich":
186
  if ($tiny_mce_objects == "")
187
- $tiny_mce_objects = $fields_name_prefix.$field_id;
188
  else
189
- $tiny_mce_objects .= ",".$fields_name_prefix.$field_id;
190
 
191
- $obj_label = '<label for="'.$fields_name_prefix.$field_id.'">'.cimy_uef_sanitize_content($label).'</label>';
192
  $obj_name = ' name="'.$input_name.'"';
193
  $obj_type = "";
194
  $obj_value = "";
@@ -212,7 +214,7 @@ function cimy_extract_ExtraFields() {
212
  $label = $ret['label'];
213
  $html = $ret['html'];
214
 
215
- $obj_label = '<label for="'.$fields_name_prefix.$field_id.'">'.$label.'</label>';
216
 
217
 
218
  if ($type == "dropdown-multi") {
@@ -239,7 +241,7 @@ function cimy_extract_ExtraFields() {
239
  break;
240
 
241
  case "checkbox":
242
- $obj_label = '<label for="'.$fields_name_prefix.$field_id.'">'.cimy_uef_sanitize_content($label).'</label>';
243
  $obj_name = ' name="'.$input_name.'"';
244
  $obj_type = ' type="'.$type.'"';
245
  $obj_value = ' value="1"';
@@ -257,7 +259,7 @@ function cimy_extract_ExtraFields() {
257
  break;
258
 
259
  case "radio":
260
- $obj_label = '<label for="'.$fields_name_prefix.$field_id.'"> '.cimy_uef_sanitize_content($label).'</label>';
261
  $obj_name = ' name="'.$input_name.'"';
262
  $obj_type = ' type="'.$type.'"';
263
  $obj_value = ' value="'.$field_id.'"';
@@ -282,16 +284,13 @@ function cimy_extract_ExtraFields() {
282
 
283
  case "avatar":
284
  case "picture":
285
- $crop_image_function = true;
286
  case "file":
287
  $allowed_exts = '';
288
  if (isset($rules['equal_to']))
289
  if (!empty($rules['equal_to']))
290
  $allowed_exts = "'".implode("', '", explode(",", $rules['equal_to']))."'";
291
 
292
- // javascript will be added later
293
- $upload_file_function = true;
294
- $obj_label = '<label for="'.$fields_name_prefix.$field_id.'">'.cimy_uef_sanitize_content($label).'</label>';
295
  $obj_class = '';
296
  $obj_name = ' name="'.$input_name.'"';
297
  $obj_type = ' type="file"';
@@ -305,13 +304,13 @@ function cimy_extract_ExtraFields() {
305
  // if we do not escape then some translations can break
306
  $warning_msg = $wpdb->escape(__("Please upload a file with one of the following extensions", $cimy_uef_domain));
307
 
308
- $obj_style = ' onchange="uploadFile(\'your-profile\', \''.$fields_name_prefix.$field_id.'\', \''.$warning_msg.'\', Array('.$allowed_exts.'));"';
309
  }
310
  else {
311
  // if we do not escape then some translations can break
312
  $warning_msg = $wpdb->escape(__("Please upload an image with one of the following extensions", $cimy_uef_domain));
313
 
314
- $obj_style = ' onchange="uploadFile(\'your-profile\', \''.$fields_name_prefix.$field_id.'\', \''.$warning_msg.'\', Array(\'gif\', \'png\', \'jpg\', \'jpeg\', \'tiff\'));"';
315
  }
316
 
317
  if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value))
@@ -334,7 +333,7 @@ function cimy_extract_ExtraFields() {
334
  }
335
 
336
 
337
- $obj_id = ' id="'.$fields_name_prefix.$field_id.'"';
338
  $obj_maxlen = "";
339
 
340
  if ((in_array($type, $rule_maxlen_needed)) && (!in_array($type, $cimy_uef_file_types))) {
@@ -477,8 +476,22 @@ function cimy_extract_ExtraFields() {
477
 
478
  // write previous value
479
  echo "<input type=\"hidden\" name=\"".$input_name."_".$field_id."_prev_value\" value=\"".$old_value."\" />\n\t\t";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
480
  // write to the html the form object built
481
- if ($type != "registration-date")
482
  echo $form_object;
483
  else
484
  echo $obj_value;
@@ -497,19 +510,11 @@ function cimy_extract_ExtraFields() {
497
  }
498
 
499
  echo "</table>";
500
-
501
- if (!empty($tiny_mce_objects)) {
 
502
  require_once($cuef_plugin_dir.'/cimy_uef_init_mce.php');
503
  }
504
- if ($crop_image_function) {
505
- wp_print_scripts('imgareaselect');
506
- wp_print_styles('imgareaselect');
507
- wp_print_scripts('cimy_uef_img_selection');
508
- }
509
-
510
- if ($upload_file_function)
511
- wp_print_scripts("cimy_uef_upload_file");
512
-
513
  echo $end_cimy_uef_comment;
514
  }
515
  }
@@ -548,7 +553,11 @@ function cimy_update_ExtraFields() {
548
  $type = $thisField["TYPE"];
549
  $label = $thisField["LABEL"];
550
  $rules = $thisField["RULES"];
551
- $input_name = $fields_name_prefix.$wpdb->escape($name);
 
 
 
 
552
  $field_id_data = $input_name."_".$field_id."_data";
553
  $advanced_options = cimy_uef_parse_advanced_options($rules["advanced_options"]);
554
 
49
  // $ef_db = $wpdb->get_results("SELECT FIELD_ID, VALUE FROM ".$wpdb_data_table." WHERE USER_ID = ".$get_user_id, ARRAY_A);
50
 
51
  $radio_checked = array();
 
 
52
  $current_fieldset = -1;
53
  $tiny_mce_objects = "";
54
 
72
  $label = $thisField['LABEL'];
73
  $description = cimy_uef_sanitize_content($thisField['DESCRIPTION']);
74
  $fieldset = $thisField['FIELDSET'];
75
+ $unique_id = $fields_name_prefix.$field_id;
76
+ if ($type == "textarea-rich")
77
+ $input_name = $unique_id;
78
+ else
79
+ $input_name = $fields_name_prefix.esc_attr($name);
80
  $field_id_data = $input_name."_".$field_id."_data";
81
  $advanced_options = cimy_uef_parse_advanced_options($rules["advanced_options"]);
82
 
143
  case "picture-url":
144
  case "password":
145
  case "text":
146
+ $obj_label = '<label for="'.$unique_id.'">'.cimy_uef_sanitize_content($label).'</label>';
147
  $obj_name = ' name="'.$input_name.'"';
148
 
149
  if ($type == "picture-url")
166
  break;
167
 
168
  case "textarea":
169
+ $obj_label = '<label for="'.$unique_id.'">'.cimy_uef_sanitize_content($label).'</label>';
170
  $obj_name = ' name="'.$input_name.'"';
171
  $obj_type = "";
172
  $obj_value = "";
186
 
187
  case "textarea-rich":
188
  if ($tiny_mce_objects == "")
189
+ $tiny_mce_objects = $unique_id;
190
  else
191
+ $tiny_mce_objects .= ",".$unique_id;
192
 
193
+ $obj_label = '<label for="'.$unique_id.'">'.cimy_uef_sanitize_content($label).'</label>';
194
  $obj_name = ' name="'.$input_name.'"';
195
  $obj_type = "";
196
  $obj_value = "";
214
  $label = $ret['label'];
215
  $html = $ret['html'];
216
 
217
+ $obj_label = '<label for="'.$unique_id.'">'.$label.'</label>';
218
 
219
 
220
  if ($type == "dropdown-multi") {
241
  break;
242
 
243
  case "checkbox":
244
+ $obj_label = '<label for="'.$unique_id.'">'.cimy_uef_sanitize_content($label).'</label>';
245
  $obj_name = ' name="'.$input_name.'"';
246
  $obj_type = ' type="'.$type.'"';
247
  $obj_value = ' value="1"';
259
  break;
260
 
261
  case "radio":
262
+ $obj_label = '<label for="'.$unique_id.'"> '.cimy_uef_sanitize_content($label).'</label>';
263
  $obj_name = ' name="'.$input_name.'"';
264
  $obj_type = ' type="'.$type.'"';
265
  $obj_value = ' value="'.$field_id.'"';
284
 
285
  case "avatar":
286
  case "picture":
 
287
  case "file":
288
  $allowed_exts = '';
289
  if (isset($rules['equal_to']))
290
  if (!empty($rules['equal_to']))
291
  $allowed_exts = "'".implode("', '", explode(",", $rules['equal_to']))."'";
292
 
293
+ $obj_label = '<label for="'.$unique_id.'">'.cimy_uef_sanitize_content($label).'</label>';
 
 
294
  $obj_class = '';
295
  $obj_name = ' name="'.$input_name.'"';
296
  $obj_type = ' type="file"';
304
  // if we do not escape then some translations can break
305
  $warning_msg = $wpdb->escape(__("Please upload a file with one of the following extensions", $cimy_uef_domain));
306
 
307
+ $obj_style = ' onchange="uploadFile(\'your-profile\', \''.$unique_id.'\', \''.$warning_msg.'\', Array('.$allowed_exts.'));"';
308
  }
309
  else {
310
  // if we do not escape then some translations can break
311
  $warning_msg = $wpdb->escape(__("Please upload an image with one of the following extensions", $cimy_uef_domain));
312
 
313
+ $obj_style = ' onchange="uploadFile(\'your-profile\', \''.$unique_id.'\', \''.$warning_msg.'\', Array(\'gif\', \'png\', \'jpg\', \'jpeg\', \'tiff\'));"';
314
  }
315
 
316
  if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value))
333
  }
334
 
335
 
336
+ $obj_id = ' id="'.$unique_id.'"';
337
  $obj_maxlen = "";
338
 
339
  if ((in_array($type, $rule_maxlen_needed)) && (!in_array($type, $cimy_uef_file_types))) {
476
 
477
  // write previous value
478
  echo "<input type=\"hidden\" name=\"".$input_name."_".$field_id."_prev_value\" value=\"".$old_value."\" />\n\t\t";
479
+
480
+ // TinceMCE needed and we have WordPress >= 3.3 yummy!
481
+ if ($type == "textarea-rich" && function_exists("wp_editor")) {
482
+ $quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close' );
483
+ $editor_settings = array(
484
+ 'teeny' => false,
485
+ 'textarea_rows' => '10',
486
+ 'dfw' => false,
487
+ 'media_buttons' => true,
488
+ 'tinymce' => true,
489
+ 'quicktags' => $quicktags_settings,
490
+ );
491
+ wp_editor($non_escaped_value, $unique_id, $editor_settings);
492
+ }
493
  // write to the html the form object built
494
+ else if ($type != "registration-date")
495
  echo $form_object;
496
  else
497
  echo $obj_value;
510
  }
511
 
512
  echo "</table>";
513
+
514
+ // WP 3.2 or lower (N)
515
+ if (!empty($tiny_mce_objects) && !function_exists("wp_editor")) {
516
  require_once($cuef_plugin_dir.'/cimy_uef_init_mce.php');
517
  }
 
 
 
 
 
 
 
 
 
518
  echo $end_cimy_uef_comment;
519
  }
520
  }
553
  $type = $thisField["TYPE"];
554
  $label = $thisField["LABEL"];
555
  $rules = $thisField["RULES"];
556
+ $unique_id = $fields_name_prefix.$field_id;
557
+ if ($type == "textarea-rich")
558
+ $input_name = $unique_id;
559
+ else
560
+ $input_name = $fields_name_prefix.esc_attr($name);
561
  $field_id_data = $input_name."_".$field_id."_data";
562
  $advanced_options = cimy_uef_parse_advanced_options($rules["advanced_options"]);
563
 
cimy_uef_register.php CHANGED
@@ -71,7 +71,7 @@ function cimy_register_overwrite_password($password) {
71
  }
72
 
73
  function cimy_register_user_extra_fields($user_id, $password="", $meta=array()) {
74
- global $wpdb_data_table, $wpdb, $max_length_value, $fields_name_prefix, $wp_fields_name_prefix, $wp_hidden_fields, $cimy_uef_file_types, $user_level;
75
 
76
  if (isset($meta["blog_id"]))
77
  cimy_switch_to_blog($meta);
@@ -127,7 +127,11 @@ function cimy_register_user_extra_fields($user_id, $password="", $meta=array())
127
  $field_id = $thisField["ID"];
128
  $label = $thisField["LABEL"];
129
  $rules = $thisField["RULES"];
130
- $input_name = $prefix.$wpdb->escape($name);
 
 
 
 
131
  $field_id_data = $input_name."_".$field_id."_data";
132
  $advanced_options = cimy_uef_parse_advanced_options($rules["advanced_options"]);
133
 
@@ -178,7 +182,7 @@ function cimy_register_user_extra_fields($user_id, $password="", $meta=array())
178
  $data = str_replace("/".$temp_user_login."/", "/".$user_login_sanitized."/", $data);
179
  $file_on_server = cimy_uef_get_dir_or_filename($user_login_sanitized, $data, false);
180
 
181
- if (($type == "picture") || ($type == "avatar"))
182
  cimy_uef_crop_image($file_on_server, $field_id_data);
183
  }
184
  else
@@ -288,7 +292,7 @@ function cimy_profile_check_wrapper($errors, $update, $user) {
288
  }
289
 
290
  function cimy_registration_check($user_login, $user_email, $errors) {
291
- global $wpdb, $rule_canbeempty, $rule_email, $rule_maxlen, $fields_name_prefix, $wp_fields_name_prefix, $rule_equalto_case_sensitive, $apply_equalto_rule, $cimy_uef_domain, $cimy_uef_file_types, $rule_equalto_regex, $user_level;
292
 
293
  // cimy_switch_to_blog();
294
  $options = cimy_get_options();
@@ -334,8 +338,11 @@ function cimy_registration_check($user_login, $user_email, $errors) {
334
  $type = $thisField['TYPE'];
335
  $label = esc_html($thisField['LABEL']);
336
  $description = $thisField['DESCRIPTION'];
337
- $input_name = $prefix.$wpdb->escape($name);
338
  $unique_id = $prefix.$field_id;
 
 
 
 
339
  $field_id_data = $input_name."_".$field_id."_data";
340
 
341
  // if the current user LOGGED IN has not enough permissions to see the field, skip it
@@ -465,14 +472,14 @@ function cimy_registration_check($user_login, $user_email, $errors) {
465
  if ($type == "password")
466
  $equalmsg = " ".__("isn&#8217;t correct", $cimy_uef_domain);
467
  else
468
- $equalmsg = ' '.__("should be", $cimy_uef_domain).' '.$equalTo;
469
 
470
  $errors->add($unique_id, '<strong>'.__("ERROR", $cimy_uef_domain).'</strong>: '.$label.$equalmsg.'.');
471
  }
472
  }
473
 
474
  // CHECK IF IT IS A REAL PICTURE
475
- if (($type == "picture") || ($type == "avatar")) {
476
  if ((stristr($file_type, "image/") === false) && (!empty($value))) {
477
  $errors->add($unique_id, '<strong>'.__("ERROR", $cimy_uef_domain).'</strong>: '.$label.' '.__('should be an image.', $cimy_uef_domain));
478
  }
@@ -536,7 +543,7 @@ function cimy_registration_check($user_login, $user_email, $errors) {
536
  $i++;
537
  }
538
 
539
- if (isset($_POST["securimage_response_field"])) {
540
  global $cuef_plugin_dir;
541
  require_once($cuef_plugin_dir.'/securimage/securimage.php');
542
  $securimage = new Securimage();
@@ -545,10 +552,10 @@ function cimy_registration_check($user_login, $user_email, $errors) {
545
  }
546
  }
547
 
548
- if ((isset($_POST["recaptcha_response_field"])) && ($options['captcha'] == "recaptcha") && (!empty($options['recaptcha_private_key']))) {
549
  $recaptcha_code_ok = false;
550
 
551
- if ($_POST["recaptcha_response_field"]) {
552
  global $cuef_plugin_dir;
553
  require_once($cuef_plugin_dir.'/recaptcha/recaptchalib.php');
554
 
@@ -579,7 +586,7 @@ function cimy_registration_check($user_login, $user_email, $errors) {
579
  // show_type == 1 - search form, all fields are text, password fields are skipped
580
  // show_type == 2 - confirmation form, all fields are plain text, images can be cropped
581
  function cimy_registration_form($errors=null, $show_type=0) {
582
- 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;
583
 
584
  // cimy_switch_to_blog();
585
 
@@ -614,9 +621,6 @@ function cimy_registration_form($errors=null, $show_type=0) {
614
  $radio_checked = array();
615
 
616
  $i = 1;
617
- $upload_file_function = false;
618
- $is_jquery_added = false;
619
- $crop_image_function = false;
620
 
621
  // confirmation page, all fields are plain text + hidden fields to carry over values
622
  if ($show_type == 2) {
@@ -675,19 +679,21 @@ function cimy_registration_form($errors=null, $show_type=0) {
675
  $label = $thisField['LABEL'];
676
  $description = cimy_uef_sanitize_content($thisField['DESCRIPTION']);
677
  $fieldset = empty($thisField['FIELDSET']) ? 0 : $thisField['FIELDSET'];
678
- $input_name = $prefix.esc_attr($name);
679
- $post_input_name = $prefix.$wpdb->escape($name);
680
  $maxlen = 0;
681
  $unique_id = $prefix.$field_id;
 
 
 
 
682
  $field_id_data = $input_name."_".$field_id."_data";
683
  $advanced_options = cimy_uef_parse_advanced_options($rules["advanced_options"]);
684
 
685
- // showing the search then there is no need to upload buttons
686
  if ($show_type == 1) {
687
  if ($type == "password")
688
  continue;
689
 
690
- if (($type == "avatar") || ($type == "picture") || ($type == "file"))
691
  $type = "text";
692
  }
693
  else if ($show_type == 2) {
@@ -720,11 +726,11 @@ function cimy_registration_form($errors=null, $show_type=0) {
720
  if (((is_multisite()) || ($options["confirm_email"])) && (in_array($type, $cimy_uef_file_types)))
721
  continue;
722
 
723
- if (isset($_POST[$post_input_name])) {
724
  if (($type == "dropdown-multi") || ($old_type == "dropdown-multi"))
725
- $value = stripslashes(implode(",", $_POST[$post_input_name]));
726
  else
727
- $value = stripslashes($_POST[$post_input_name]);
728
  }
729
  else if (isset($_GET[$name])) {
730
  if (($type == "dropdown-multi") || ($old_type == "dropdown-multi"))
@@ -831,7 +837,7 @@ function cimy_registration_form($errors=null, $show_type=0) {
831
  break;
832
 
833
  case "textarea-rich":
834
- if ($tiny_mce_objects == "")
835
  $tiny_mce_objects = $fields_name_prefix.$field_id;
836
  else
837
  $tiny_mce_objects .= ",".$fields_name_prefix.$field_id;
@@ -890,19 +896,17 @@ function cimy_registration_form($errors=null, $show_type=0) {
890
 
891
  if ($type == "file") {
892
  // if we do not escape then some translations can break
893
- $warning_msg = $wpdb->escape(__("Please upload a file with one of the following extensions", $cimy_uef_domain));
894
 
895
  $obj_checked = ' onchange="uploadFile(\'registerform\', \''.$unique_id.'\', \''.$warning_msg.'\', Array('.$allowed_exts.'));"';
896
  }
897
  else {
898
  // if we do not escape then some translations can break
899
- $warning_msg = $wpdb->escape(__("Please upload an image with one of the following extensions", $cimy_uef_domain));
900
 
901
  $obj_checked = ' onchange="uploadFile(\'registerform\', \''.$unique_id.'\', \''.$warning_msg.'\', Array(\'gif\', \'png\', \'jpg\', \'jpeg\', \'tiff\'));"';
902
  }
903
 
904
- // javascript will be added later
905
- $upload_file_function = true;
906
  $obj_label = '<label for="'.$unique_id.'">'.cimy_uef_sanitize_content($label).' </label>';
907
  $obj_class = ' class="cimy_uef_picture"';
908
  $obj_name = ' name="'.$input_name.'"';
@@ -1004,12 +1008,7 @@ function cimy_registration_form($errors=null, $show_type=0) {
1004
  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)."\" />";
1005
  echo "<input type=\"hidden\" name=\"".esc_attr($field_id_data)."_type\" id=\"".esc_attr($field_id_data)."_type\" value=\"".strval($_FILES[$input_name]['type'])."\" />";
1006
  }
1007
- if ((($old_type == "picture") || ($old_type == "avatar")) && (is_file($file_on_server))) {
1008
- if (!$is_jquery_added) {
1009
- wp_print_scripts("jquery");
1010
- $is_jquery_added = true;
1011
- }
1012
- $crop_image_function = true;
1013
  echo '<img id="'.esc_attr($field_id_data).'" src="'.esc_attr($value).'" alt="picture" /><br />';
1014
  echo "<input type=\"hidden\" name=\"".esc_attr($field_id_data)."_button\" id=\"".esc_attr($field_id_data)."_button\" value=\"1\" />";
1015
  echo "<input type=\"hidden\" name=\"".esc_attr($field_id_data)."_x1\" id=\"".esc_attr($field_id_data)."_x1\" value=\"\" />";
@@ -1045,8 +1044,30 @@ function cimy_registration_form($errors=null, $show_type=0) {
1045
  }
1046
  }
1047
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1048
  // write to the html the form object built
1049
- echo $form_object;
 
1050
 
1051
  if (($show_type == 0) && ($i == 1) && ($options['password_meter'])) {
1052
  if ($input_name == ($prefix."PASSWORD"))
@@ -1073,24 +1094,10 @@ function cimy_registration_form($errors=null, $show_type=0) {
1073
  echo "\t<br />";
1074
 
1075
  if ($show_type == 0) {
1076
- if (!empty($tiny_mce_objects)) {
 
1077
  require_once($cuef_plugin_dir.'/cimy_uef_init_mce.php');
1078
  }
1079
-
1080
- if ($options['password_meter']) {
1081
- if (!$is_jquery_added) {
1082
- wp_print_scripts("jquery");
1083
- $is_jquery_added = true;
1084
- }
1085
-
1086
- require_once($cuef_plugin_dir.'/cimy_uef_init_strength_meter.php');
1087
- }
1088
- }
1089
-
1090
- if ($crop_image_function) {
1091
- wp_print_scripts('imgareaselect');
1092
- wp_print_styles('imgareaselect');
1093
- wp_print_scripts('cimy_uef_img_selection');
1094
  }
1095
 
1096
  if (($show_type != 2) && ($options['captcha'] == "securimage")) {
@@ -1121,7 +1128,7 @@ function cimy_registration_form($errors=null, $show_type=0) {
1121
  <?php
1122
 
1123
  // no need if Tiny MCE is present already
1124
- if ($tiny_mce_objects == "") {
1125
  ?>
1126
  <script type='text/javascript'>
1127
  var login_div = document.getElementById("login");
@@ -1132,9 +1139,6 @@ function cimy_registration_form($errors=null, $show_type=0) {
1132
  echo recaptcha_get_html($options['recaptcha_public_key']);
1133
  }
1134
 
1135
- if ($upload_file_function)
1136
- wp_print_scripts("cimy_uef_upload_file");
1137
-
1138
  cimy_switch_current_blog(true);
1139
 
1140
  echo $end_cimy_uef_comment;
71
  }
72
 
73
  function cimy_register_user_extra_fields($user_id, $password="", $meta=array()) {
74
+ global $wpdb_data_table, $wpdb, $max_length_value, $fields_name_prefix, $wp_fields_name_prefix, $wp_hidden_fields, $cimy_uef_file_types, $user_level, $cimy_uef_file_images_types;
75
 
76
  if (isset($meta["blog_id"]))
77
  cimy_switch_to_blog($meta);
127
  $field_id = $thisField["ID"];
128
  $label = $thisField["LABEL"];
129
  $rules = $thisField["RULES"];
130
+ $unique_id = $prefix.$field_id;
131
+ if ($type == "textarea-rich")
132
+ $input_name = $unique_id;
133
+ else
134
+ $input_name = $prefix.esc_attr($name);
135
  $field_id_data = $input_name."_".$field_id."_data";
136
  $advanced_options = cimy_uef_parse_advanced_options($rules["advanced_options"]);
137
 
182
  $data = str_replace("/".$temp_user_login."/", "/".$user_login_sanitized."/", $data);
183
  $file_on_server = cimy_uef_get_dir_or_filename($user_login_sanitized, $data, false);
184
 
185
+ if (in_array($type, $cimy_uef_file_images_types))
186
  cimy_uef_crop_image($file_on_server, $field_id_data);
187
  }
188
  else
292
  }
293
 
294
  function cimy_registration_check($user_login, $user_email, $errors) {
295
+ global $wpdb, $rule_canbeempty, $rule_email, $rule_maxlen, $fields_name_prefix, $wp_fields_name_prefix, $rule_equalto_case_sensitive, $apply_equalto_rule, $cimy_uef_domain, $cimy_uef_file_types, $rule_equalto_regex, $user_level, $cimy_uef_file_images_types;
296
 
297
  // cimy_switch_to_blog();
298
  $options = cimy_get_options();
338
  $type = $thisField['TYPE'];
339
  $label = esc_html($thisField['LABEL']);
340
  $description = $thisField['DESCRIPTION'];
 
341
  $unique_id = $prefix.$field_id;
342
+ if ($type == "textarea-rich")
343
+ $input_name = $unique_id;
344
+ else
345
+ $input_name = $prefix.esc_attr($name);
346
  $field_id_data = $input_name."_".$field_id."_data";
347
 
348
  // if the current user LOGGED IN has not enough permissions to see the field, skip it
472
  if ($type == "password")
473
  $equalmsg = " ".__("isn&#8217;t correct", $cimy_uef_domain);
474
  else
475
+ $equalmsg = ' '.__("should be", $cimy_uef_domain).' '.esc_html($equalTo);
476
 
477
  $errors->add($unique_id, '<strong>'.__("ERROR", $cimy_uef_domain).'</strong>: '.$label.$equalmsg.'.');
478
  }
479
  }
480
 
481
  // CHECK IF IT IS A REAL PICTURE
482
+ if (in_array($type, $cimy_uef_file_images_types)) {
483
  if ((stristr($file_type, "image/") === false) && (!empty($value))) {
484
  $errors->add($unique_id, '<strong>'.__("ERROR", $cimy_uef_domain).'</strong>: '.$label.' '.__('should be an image.', $cimy_uef_domain));
485
  }
543
  $i++;
544
  }
545
 
546
+ if ($options['captcha'] == "securimage") {
547
  global $cuef_plugin_dir;
548
  require_once($cuef_plugin_dir.'/securimage/securimage.php');
549
  $securimage = new Securimage();
552
  }
553
  }
554
 
555
+ if (($options['captcha'] == "recaptcha") && (!empty($options['recaptcha_private_key']))) {
556
  $recaptcha_code_ok = false;
557
 
558
+ if (!empty($_POST["recaptcha_response_field"])) {
559
  global $cuef_plugin_dir;
560
  require_once($cuef_plugin_dir.'/recaptcha/recaptchalib.php');
561
 
586
  // show_type == 1 - search form, all fields are text, password fields are skipped
587
  // show_type == 2 - confirmation form, all fields are plain text, images can be cropped
588
  function cimy_registration_form($errors=null, $show_type=0) {
589
+ 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_uef_file_images_types;
590
 
591
  // cimy_switch_to_blog();
592
 
621
  $radio_checked = array();
622
 
623
  $i = 1;
 
 
 
624
 
625
  // confirmation page, all fields are plain text + hidden fields to carry over values
626
  if ($show_type == 2) {
679
  $label = $thisField['LABEL'];
680
  $description = cimy_uef_sanitize_content($thisField['DESCRIPTION']);
681
  $fieldset = empty($thisField['FIELDSET']) ? 0 : $thisField['FIELDSET'];
 
 
682
  $maxlen = 0;
683
  $unique_id = $prefix.$field_id;
684
+ if ($type == "textarea-rich")
685
+ $input_name = $unique_id;
686
+ else
687
+ $input_name = $prefix.esc_attr($name);
688
  $field_id_data = $input_name."_".$field_id."_data";
689
  $advanced_options = cimy_uef_parse_advanced_options($rules["advanced_options"]);
690
 
691
+ // showing the search then there is no need for upload buttons
692
  if ($show_type == 1) {
693
  if ($type == "password")
694
  continue;
695
 
696
+ if (in_array($type, $cimy_uef_file_types))
697
  $type = "text";
698
  }
699
  else if ($show_type == 2) {
726
  if (((is_multisite()) || ($options["confirm_email"])) && (in_array($type, $cimy_uef_file_types)))
727
  continue;
728
 
729
+ if (isset($_POST[$input_name])) {
730
  if (($type == "dropdown-multi") || ($old_type == "dropdown-multi"))
731
+ $value = stripslashes(implode(",", $_POST[$input_name]));
732
  else
733
+ $value = stripslashes($_POST[$input_name]);
734
  }
735
  else if (isset($_GET[$name])) {
736
  if (($type == "dropdown-multi") || ($old_type == "dropdown-multi"))
837
  break;
838
 
839
  case "textarea-rich":
840
+ if (empty($tiny_mce_objects))
841
  $tiny_mce_objects = $fields_name_prefix.$field_id;
842
  else
843
  $tiny_mce_objects .= ",".$fields_name_prefix.$field_id;
896
 
897
  if ($type == "file") {
898
  // if we do not escape then some translations can break
899
+ $warning_msg = esc_js(__("Please upload a file with one of the following extensions", $cimy_uef_domain));
900
 
901
  $obj_checked = ' onchange="uploadFile(\'registerform\', \''.$unique_id.'\', \''.$warning_msg.'\', Array('.$allowed_exts.'));"';
902
  }
903
  else {
904
  // if we do not escape then some translations can break
905
+ $warning_msg = esc_js(__("Please upload an image with one of the following extensions", $cimy_uef_domain));
906
 
907
  $obj_checked = ' onchange="uploadFile(\'registerform\', \''.$unique_id.'\', \''.$warning_msg.'\', Array(\'gif\', \'png\', \'jpg\', \'jpeg\', \'tiff\'));"';
908
  }
909
 
 
 
910
  $obj_label = '<label for="'.$unique_id.'">'.cimy_uef_sanitize_content($label).' </label>';
911
  $obj_class = ' class="cimy_uef_picture"';
912
  $obj_name = ' name="'.$input_name.'"';
1008
  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)."\" />";
1009
  echo "<input type=\"hidden\" name=\"".esc_attr($field_id_data)."_type\" id=\"".esc_attr($field_id_data)."_type\" value=\"".strval($_FILES[$input_name]['type'])."\" />";
1010
  }
1011
+ if ((in_array($old_type, $cimy_uef_file_images_types)) && (is_file($file_on_server))) {
 
 
 
 
 
1012
  echo '<img id="'.esc_attr($field_id_data).'" src="'.esc_attr($value).'" alt="picture" /><br />';
1013
  echo "<input type=\"hidden\" name=\"".esc_attr($field_id_data)."_button\" id=\"".esc_attr($field_id_data)."_button\" value=\"1\" />";
1014
  echo "<input type=\"hidden\" name=\"".esc_attr($field_id_data)."_x1\" id=\"".esc_attr($field_id_data)."_x1\" value=\"\" />";
1044
  }
1045
  }
1046
 
1047
+ // TinceMCE needed and we have WordPress >= 3.3 yummy!
1048
+ if ($type == "textarea-rich" && function_exists("wp_editor")) {
1049
+ ?>
1050
+ <script type='text/javascript'>
1051
+ var login_div = document.getElementById("login");
1052
+ login_div.style.width = "535px";
1053
+ </script>
1054
+ <?php
1055
+ $quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close' );
1056
+ $editor_settings = array(
1057
+ 'teeny' => false,
1058
+ 'textarea_rows' => '10',
1059
+ 'dfw' => false,
1060
+ 'media_buttons' => true,
1061
+ 'tinymce' => true,
1062
+ 'quicktags' => $quicktags_settings,
1063
+ );
1064
+ if (!empty($obj_tabindex))
1065
+ $editor_settings['tabindex'] = $tabindex;
1066
+ wp_editor($value, $unique_id, $editor_settings);
1067
+ }
1068
  // write to the html the form object built
1069
+ else
1070
+ echo $form_object;
1071
 
1072
  if (($show_type == 0) && ($i == 1) && ($options['password_meter'])) {
1073
  if ($input_name == ($prefix."PASSWORD"))
1094
  echo "\t<br />";
1095
 
1096
  if ($show_type == 0) {
1097
+ // WP 3.2 or lower (N)
1098
+ if (!empty($tiny_mce_objects) && !function_exists("wp_editor")) {
1099
  require_once($cuef_plugin_dir.'/cimy_uef_init_mce.php');
1100
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1101
  }
1102
 
1103
  if (($show_type != 2) && ($options['captcha'] == "securimage")) {
1128
  <?php
1129
 
1130
  // no need if Tiny MCE is present already
1131
+ if (empty($tiny_mce_objects)) {
1132
  ?>
1133
  <script type='text/javascript'>
1134
  var login_div = document.getElementById("login");
1139
  echo recaptcha_get_html($options['recaptcha_public_key']);
1140
  }
1141
 
 
 
 
1142
  cimy_switch_current_blog(true);
1143
 
1144
  echo $end_cimy_uef_comment;
cimy_user_extra_fields.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Cimy User Extra Fields
4
  Plugin URI: http://www.marcocimmino.net/cimy-wordpress-plugins/cimy-user-extra-fields/
5
  Description: Add some useful fields to registration and user's info
6
- Version: 2.2.0
7
  Author: Marco Cimmino
8
  Author URI: mailto:cimmino.marco@gmail.com
9
  License: GPL2
@@ -158,13 +158,10 @@ $cuef_css_webpath = plugins_url($cimy_uef_plugins_dirprefix."css", __FILE__);
158
  $cuef_js_webpath = plugins_url($cimy_uef_plugins_dirprefix."js", __FILE__);
159
  $cuef_securimage_webpath = plugins_url($cimy_uef_plugins_dirprefix."securimage", __FILE__);
160
 
161
- wp_register_script("cimy_uef_upload_file", $cuef_js_webpath."/upload_file.js", false, false);
162
- wp_register_script("cimy_uef_img_selection", $cuef_js_webpath."/img_selection.js", false, false);
163
-
164
  function cimy_uef_admin_init() {
165
  global $cuef_js_webpath;
166
- wp_register_script("cimy_uef_invert_sel", $cuef_js_webpath."/invert_sel.js", false, false);
167
- wp_register_script("cimy_uef_ajax_new_value", $cuef_js_webpath."/ajax_new_value.js", false, false);
168
  }
169
 
170
  add_action('admin_init', 'cimy_uef_admin_init');
@@ -178,7 +175,7 @@ require_once($cuef_plugin_dir.'/cimy_uef_options.php');
178
  require_once($cuef_plugin_dir.'/cimy_uef_admin.php');
179
 
180
  $cimy_uef_name = "Cimy User Extra Fields";
181
- $cimy_uef_version = "2.2.0";
182
  $cimy_uef_url = "http://www.marcocimmino.net/cimy-wordpress-plugins/cimy-user-extra-fields/";
183
  $cimy_project_url = "http://www.marcocimmino.net/cimy-wordpress-plugins/support-the-cimy-project-paypal/";
184
 
@@ -257,8 +254,8 @@ $wp_hidden_fields = array(
257
  'show_in_reg' => true,
258
  'show_in_profile' => true,
259
  'show_in_aeu' => true,
260
- 'show_in_search' => true,
261
- 'show_in_blog' => true,
262
  'show_level' => -1,
263
  ),
264
  ),
@@ -277,8 +274,8 @@ $wp_hidden_fields = array(
277
  'show_in_reg' => true,
278
  'show_in_profile' => true,
279
  'show_in_aeu' => true,
280
- 'show_in_search' => true,
281
- 'show_in_blog' => true,
282
  'show_level' => -1,
283
  ),
284
  ),
@@ -297,8 +294,8 @@ $wp_hidden_fields = array(
297
  'show_in_reg' => true,
298
  'show_in_profile' => true,
299
  'show_in_aeu' => true,
300
- 'show_in_search' => true,
301
- 'show_in_blog' => true,
302
  'show_level' => -1,
303
  ),
304
  ),
@@ -317,8 +314,8 @@ $wp_hidden_fields = array(
317
  'show_in_reg' => true,
318
  'show_in_profile' => true,
319
  'show_in_aeu' => true,
320
- 'show_in_search' => true,
321
- 'show_in_blog' => true,
322
  'show_level' => -1,
323
  ),
324
  ),
@@ -337,8 +334,8 @@ $wp_hidden_fields = array(
337
  'show_in_reg' => true,
338
  'show_in_profile' => true,
339
  'show_in_aeu' => true,
340
- 'show_in_search' => true,
341
- 'show_in_blog' => true,
342
  'show_level' => -1,
343
  ),
344
  ),
@@ -357,8 +354,8 @@ $wp_hidden_fields = array(
357
  'show_in_reg' => true,
358
  'show_in_profile' => true,
359
  'show_in_aeu' => true,
360
- 'show_in_search' => true,
361
- 'show_in_blog' => true,
362
  'show_level' => -1,
363
  ),
364
  ),
@@ -377,8 +374,8 @@ $wp_hidden_fields = array(
377
  'show_in_reg' => true,
378
  'show_in_profile' => true,
379
  'show_in_aeu' => true,
380
- 'show_in_search' => true,
381
- 'show_in_blog' => true,
382
  'show_level' => -1,
383
  ),
384
  ),
@@ -397,8 +394,8 @@ $wp_hidden_fields = array(
397
  'show_in_reg' => true,
398
  'show_in_profile' => true,
399
  'show_in_aeu' => true,
400
- 'show_in_search' => true,
401
- 'show_in_blog' => true,
402
  'show_level' => -1,
403
  ),
404
  ),
@@ -440,6 +437,9 @@ $rule_equalto_regex = array("text", "textarea", "textarea-rich", "password", "d
440
  // types that are file to be uploaded
441
  $cimy_uef_file_types = array("picture", "avatar", "file");
442
 
 
 
 
443
  // types that are textarea and needs rows and cols attributes
444
  $cimy_uef_textarea_types = array("textarea", "textarea-rich");
445
 
@@ -524,7 +524,7 @@ else {
524
  add_action('register_form', 'cimy_registration_form', 1);
525
 
526
  // add custom login/registration css
527
- add_action('login_head', 'cimy_uef_register_css');
528
 
529
  // add custom login/registration logo
530
  add_action('login_head', 'cimy_change_login_registration_logo');
@@ -706,13 +706,67 @@ function cimy_uef_avatar_filter($avatar, $id_or_email, $size, $default, $alt="")
706
  return $avatar;
707
  }
708
 
 
 
 
 
 
 
 
 
 
 
 
709
  function cimy_uef_register_css() {
710
  global $cuef_css_webpath;
711
  wp_register_style("cimy_uef_register", $cuef_css_webpath."/cimy_uef_register.css", false, false);
712
  wp_enqueue_style("cimy_uef_register");
 
 
713
  wp_print_styles();
714
  }
715
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
716
  function cimy_change_login_registration_logo() {
717
  $options = cimy_get_options();
718
 
@@ -765,15 +819,20 @@ function cimy_admin_menu_custom() {
765
 
766
  // Since WP 3.1 we have network admin and everything seems changed
767
  $aue_page = add_submenu_page('users.php', __("Users Extended", $cimy_uef_domain), __("Users Extended", $cimy_uef_domain), 'list_users', "users_extended", 'cimy_admin_users_list_page');
768
- add_submenu_page('settings.php', $cimy_uef_name, $cimy_uef_name, 'manage_options', "user_extra_fields", 'cimy_admin_define_extra_fields');
769
  }
770
  else {
771
- add_options_page($cimy_uef_name, $cimy_uef_name, 'manage_options', "user_extra_fields", 'cimy_admin_define_extra_fields');
772
  $aue_page = add_submenu_page('profile.php', __('Users Extended', $cimy_uef_domain), __('Users Extended', $cimy_uef_domain), 'list_users', "users_extended", 'cimy_admin_users_list_page');
773
  }
774
  }
775
  if (!empty($aue_page))
776
  add_action('admin_print_scripts-'.$aue_page, 'cimy_uef_admin_ajax_edit');
 
 
 
 
 
777
  }
778
 
779
  function cimy_manage_upload($input_name, $user_login, $rules, $old_file=false, $delete_file=false, $type="", $new_filename="") {
3
  Plugin Name: Cimy User Extra Fields
4
  Plugin URI: http://www.marcocimmino.net/cimy-wordpress-plugins/cimy-user-extra-fields/
5
  Description: Add some useful fields to registration and user's info
6
+ Version: 2.3.0
7
  Author: Marco Cimmino
8
  Author URI: mailto:cimmino.marco@gmail.com
9
  License: GPL2
158
  $cuef_js_webpath = plugins_url($cimy_uef_plugins_dirprefix."js", __FILE__);
159
  $cuef_securimage_webpath = plugins_url($cimy_uef_plugins_dirprefix."securimage", __FILE__);
160
 
 
 
 
161
  function cimy_uef_admin_init() {
162
  global $cuef_js_webpath;
163
+ wp_register_script("cimy_uef_invert_sel", $cuef_js_webpath."/invert_sel.js", array(), false);
164
+ wp_register_script("cimy_uef_ajax_new_value", $cuef_js_webpath."/ajax_new_value.js", array(), false);
165
  }
166
 
167
  add_action('admin_init', 'cimy_uef_admin_init');
175
  require_once($cuef_plugin_dir.'/cimy_uef_admin.php');
176
 
177
  $cimy_uef_name = "Cimy User Extra Fields";
178
+ $cimy_uef_version = "2.3.0";
179
  $cimy_uef_url = "http://www.marcocimmino.net/cimy-wordpress-plugins/cimy-user-extra-fields/";
180
  $cimy_project_url = "http://www.marcocimmino.net/cimy-wordpress-plugins/support-the-cimy-project-paypal/";
181
 
254
  'show_in_reg' => true,
255
  'show_in_profile' => true,
256
  'show_in_aeu' => true,
257
+ 'show_in_search' => false,
258
+ 'show_in_blog' => false,
259
  'show_level' => -1,
260
  ),
261
  ),
274
  'show_in_reg' => true,
275
  'show_in_profile' => true,
276
  'show_in_aeu' => true,
277
+ 'show_in_search' => false,
278
+ 'show_in_blog' => false,
279
  'show_level' => -1,
280
  ),
281
  ),
294
  'show_in_reg' => true,
295
  'show_in_profile' => true,
296
  'show_in_aeu' => true,
297
+ 'show_in_search' => false,
298
+ 'show_in_blog' => false,
299
  'show_level' => -1,
300
  ),
301
  ),
314
  'show_in_reg' => true,
315
  'show_in_profile' => true,
316
  'show_in_aeu' => true,
317
+ 'show_in_search' => false,
318
+ 'show_in_blog' => false,
319
  'show_level' => -1,
320
  ),
321
  ),
334
  'show_in_reg' => true,
335
  'show_in_profile' => true,
336
  'show_in_aeu' => true,
337
+ 'show_in_search' => false,
338
+ 'show_in_blog' => false,
339
  'show_level' => -1,
340
  ),
341
  ),
354
  'show_in_reg' => true,
355
  'show_in_profile' => true,
356
  'show_in_aeu' => true,
357
+ 'show_in_search' => false,
358
+ 'show_in_blog' => false,
359
  'show_level' => -1,
360
  ),
361
  ),
374
  'show_in_reg' => true,
375
  'show_in_profile' => true,
376
  'show_in_aeu' => true,
377
+ 'show_in_search' => false,
378
+ 'show_in_blog' => false,
379
  'show_level' => -1,
380
  ),
381
  ),
394
  'show_in_reg' => true,
395
  'show_in_profile' => true,
396
  'show_in_aeu' => true,
397
+ 'show_in_search' => false,
398
+ 'show_in_blog' => false,
399
  'show_level' => -1,
400
  ),
401
  ),
437
  // types that are file to be uploaded
438
  $cimy_uef_file_types = array("picture", "avatar", "file");
439
 
440
+ // types that are images to be uploaded
441
+ $cimy_uef_file_images_types = array("picture", "avatar");
442
+
443
  // types that are textarea and needs rows and cols attributes
444
  $cimy_uef_textarea_types = array("textarea", "textarea-rich");
445
 
524
  add_action('register_form', 'cimy_registration_form', 1);
525
 
526
  // add custom login/registration css
527
+ add_action('login_enqueue_scripts', 'cimy_uef_register_css');
528
 
529
  // add custom login/registration logo
530
  add_action('login_head', 'cimy_change_login_registration_logo');
706
  return $avatar;
707
  }
708
 
709
+ function cimy_uef_admin_init_js() {
710
+ wp_enqueue_script("cimy_uef_invert_sel");
711
+ cimy_uef_init_upload_js();
712
+ }
713
+
714
+ function cimy_uef_init_upload_js() {
715
+ global $cuef_js_webpath;
716
+ wp_register_script("cimy_uef_upload_file", $cuef_js_webpath."/upload_file.js", array(), false);
717
+ wp_enqueue_script('cimy_uef_upload_file');
718
+ }
719
+
720
  function cimy_uef_register_css() {
721
  global $cuef_css_webpath;
722
  wp_register_style("cimy_uef_register", $cuef_css_webpath."/cimy_uef_register.css", false, false);
723
  wp_enqueue_style("cimy_uef_register");
724
+ cimy_uef_init_javascripts("show_in_reg");
725
+ // needed till they fix this bug: http://core.trac.wordpress.org/ticket/17916#comment:18
726
  wp_print_styles();
727
  }
728
 
729
+ function cimy_uef_admin_profile_init_js() {
730
+ cimy_uef_init_javascripts("show_in_profile");
731
+ }
732
+
733
+ function cimy_uef_init_javascripts($rule_name) {
734
+ global $cuef_plugin_dir, $cuef_css_webpath, $cuef_js_webpath;
735
+
736
+ $options = cimy_get_options();
737
+ if ($options['image_fields'][$rule_name] > 0) {
738
+ wp_enqueue_script('imgareaselect', "", array("jquery"));
739
+ wp_enqueue_style('imgareaselect');
740
+ wp_register_script('cimy_uef_img_selection', $cuef_js_webpath."/img_selection.js", array(), false);
741
+ wp_enqueue_script('cimy_uef_img_selection');
742
+ }
743
+
744
+ if ($options['file_fields'][$rule_name] > 0) {
745
+ cimy_uef_init_upload_js();
746
+ }
747
+
748
+ if ($rule_name == "show_in_profile") {
749
+ if ($options['tinymce_fields'][$rule_name] > 0 && function_exists("wp_editor")) {
750
+ wp_register_style("cimy_uef_tinymce", $cuef_css_webpath."/cimy_uef_tinymce.css", false, false);
751
+ wp_enqueue_style('cimy_uef_tinymce');
752
+ }
753
+ }
754
+ if ($rule_name == "show_in_reg" && (empty($_POST['register_confirmation']) || $_POST['register_confirmation'] != "1")) {
755
+ // This is needed for registration form on WordPress >= 3.3
756
+ if ($options['tinymce_fields'][$rule_name] > 0 && function_exists("wp_editor"))
757
+ wp_enqueue_script('utils');
758
+
759
+ if ($options['password_meter']) {
760
+ wp_register_script("cimy_uef_password_strength_meter", $cuef_js_webpath."/password_strength_meter.js", array("password-strength-meter"), false);
761
+ wp_enqueue_script('cimy_uef_password_strength_meter');
762
+ }
763
+
764
+ // damn WordPress bugs
765
+ if (is_multisite())
766
+ wp_print_scripts();
767
+ }
768
+ }
769
+
770
  function cimy_change_login_registration_logo() {
771
  $options = cimy_get_options();
772
 
819
 
820
  // Since WP 3.1 we have network admin and everything seems changed
821
  $aue_page = add_submenu_page('users.php', __("Users Extended", $cimy_uef_domain), __("Users Extended", $cimy_uef_domain), 'list_users', "users_extended", 'cimy_admin_users_list_page');
822
+ $admin = add_submenu_page('settings.php', $cimy_uef_name, $cimy_uef_name, 'manage_options', "user_extra_fields", 'cimy_admin_define_extra_fields');
823
  }
824
  else {
825
+ $admin = add_options_page($cimy_uef_name, $cimy_uef_name, 'manage_options', "user_extra_fields", 'cimy_admin_define_extra_fields');
826
  $aue_page = add_submenu_page('profile.php', __('Users Extended', $cimy_uef_domain), __('Users Extended', $cimy_uef_domain), 'list_users', "users_extended", 'cimy_admin_users_list_page');
827
  }
828
  }
829
  if (!empty($aue_page))
830
  add_action('admin_print_scripts-'.$aue_page, 'cimy_uef_admin_ajax_edit');
831
+ if (!empty($admin))
832
+ add_action('admin_print_scripts-'.$admin, 'cimy_uef_admin_init_js');
833
+
834
+ add_action('admin_print_scripts-user-edit.php', 'cimy_uef_admin_profile_init_js');
835
+ add_action('admin_print_scripts-profile.php', 'cimy_uef_admin_profile_init_js');
836
  }
837
 
838
  function cimy_manage_upload($input_name, $user_login, $rules, $old_file=false, $delete_file=false, $type="", $new_filename="") {
css/cimy_uef_register.css CHANGED
@@ -1,4 +1,4 @@
1
- #login .cimy_uef_input_27 {
2
  font-size: 24px;
3
  width: 97%;
4
  padding: 3px;
@@ -38,5 +38,6 @@
38
  border-right-style: solid;
39
  border-bottom-style: solid;
40
  border-left-style: solid;
41
- display:block;
 
42
  }
1
+ #login .cimy_uef_input_27, .cimy_uef_picture {
2
  font-size: 24px;
3
  width: 97%;
4
  padding: 3px;
38
  border-right-style: solid;
39
  border-bottom-style: solid;
40
  border-left-style: solid;
41
+ display: block;
42
+ width: 93%;
43
  }
css/cimy_uef_tinymce.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .wp-editor-wrap {
2
+ width: 535px;
3
+ }
js/password_strength_meter.js ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function check_pass_strength() {
2
+ var pass1 = jQuery('[name=cimy_uef_wp_PASSWORD]').val(), pass2 = jQuery('[name=cimy_uef_wp_PASSWORD2]').val(), user, strength;
3
+
4
+ if (jQuery('#user_login').length)
5
+ user = jQuery('#user_login').val();
6
+ else
7
+ user = jQuery('#user_name').val();
8
+
9
+ jQuery('#pass-strength-result').removeClass('short bad good strong');
10
+ if ( ! pass1 ) {
11
+ jQuery('#pass-strength-result').html( pwsL10n.empty );
12
+ return;
13
+ }
14
+
15
+ strength = passwordStrength(pass1, user, pass2);
16
+
17
+ switch ( strength ) {
18
+ case 2:
19
+ jQuery('#pass-strength-result').addClass('bad').html( pwsL10n['bad'] );
20
+ break;
21
+ case 3:
22
+ jQuery('#pass-strength-result').addClass('good').html( pwsL10n['good'] );
23
+ break;
24
+ case 4:
25
+ jQuery('#pass-strength-result').addClass('strong').html( pwsL10n['strong'] );
26
+ break;
27
+ case 5:
28
+ jQuery('#pass-strength-result').addClass('short').html( pwsL10n['mismatch'] );
29
+ break;
30
+ default:
31
+ jQuery('#pass-strength-result').addClass('short').html( pwsL10n['short'] );
32
+ }
33
+ }
34
+
35
+ jQuery(document).ready( function() {
36
+ jQuery('[name=cimy_uef_wp_PASSWORD]').val('').keyup( check_pass_strength );
37
+ jQuery('[name=cimy_uef_wp_PASSWORD2]').val('').keyup( check_pass_strength );
38
+ check_pass_strength();
39
+ });
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: http://www.marcocimmino.net/cimy-wordpress-plugins/support-the-cimy
4
  Website link: http://www.marcocimmino.net/cimy-wordpress-plugins/cimy-user-extra-fields/
5
  Tags: cimy, admin, registration, profile, extra fields, avatar, gravatar, recaptcha, captcha
6
  Requires at least: 3.1
7
- Tested up to: 3.2
8
- Stable tag: 2.2.0
9
 
10
  Add some useful fields to registration and user's info
11
 
4
  Website link: http://www.marcocimmino.net/cimy-wordpress-plugins/cimy-user-extra-fields/
5
  Tags: cimy, admin, registration, profile, extra fields, avatar, gravatar, recaptcha, captcha
6
  Requires at least: 3.1
7
+ Tested up to: 3.3
8
+ Stable tag: 2.3.0
9
 
10
  Add some useful fields to registration and user's info
11