Code Duplication    Length = 85-85 lines in 2 locations

index.php 1 location

@@ 29-113 (lines=85) @@
26
27
$op = ( isset( $_POST['op'] ) && $_POST['op'] == 'submit' ) ? 'submit' : 'form';
28
29
if ( $op == 'form' ) {
30
    $xoopsOption['template_main'] = 'xoopsmembers_searchform.tpl';
31
    include XOOPS_ROOT_PATH . '/header.php';
32
33
    $member_handler = &xoops_gethandler( 'member' );
34
    $total = $member_handler->getUserCount( new Criteria( 'level', 0, '>' ) );
35
36
    include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
37
38
    $form = new XoopsThemeForm( '', 'searchform', 'index.php' );
39
    $uname_text = new XoopsFormText( '', 'user_uname', 30, 60 );
40
    $uname_match = new XoopsFormSelectMatchOption( '', 'user_uname_match' );
41
    $uname_tray = new XoopsFormElementTray( _MD_XM_UNAME, ' ' );
42
    $uname_tray->addElement( $uname_match );
43
    $uname_tray->addElement( $uname_text );
44
    $form->addElement( $uname_tray );
45
46
    $name_text = new XoopsFormText( '', 'user_name', 30, 60 );
47
    $name_match = new XoopsFormSelectMatchOption( '', 'user_name_match' );
48
    $name_tray = new XoopsFormElementTray( _MD_XM_REALNAME, ' ' );
49
    $name_tray->addElement( $name_match );
50
    $name_tray->addElement( $name_text );
51
    $form->addElement( $name_tray );
52
53
    $email_text = new XoopsFormText( '', 'user_email', 30, 60 );
54
    $email_match = new XoopsFormSelectMatchOption( '', 'user_email_match' );
55
    $email_tray = new XoopsFormElementTray( _MD_XM_EMAIL, ' ' );
56
    $email_tray->addElement( $email_match );
57
    $email_tray->addElement( $email_text );
58
    $form->addElement( $email_tray );
59
60
    $form->addElement( new XoopsFormText( _MD_XM_URLC, 'user_url', 30, 100 ) );
61
62
    $icq_text = new XoopsFormText( '', 'user_icq', 30, 100 );
63
    $icq_match = new XoopsFormSelectMatchOption( '', 'user_icq_match' );
64
    $icq_tray = new XoopsFormElementTray( _MD_XM_ICQ, ' ' );
65
    $icq_tray->addElement( $icq_match );
66
    $icq_tray->addElement( $icq_text );
67
    $form->addElement( $icq_tray );
68
69
    $aim_text = new XoopsFormText( '', 'user_aim', 30, 100 );
70
    $aim_match = new XoopsFormSelectMatchOption( '', 'user_aim_match' );
71
    $aim_tray = new XoopsFormElementTray( _MD_XM_AIM, ' ' );
72
    $aim_tray->addElement( $aim_match );
73
    $aim_tray->addElement( $aim_text );
74
    $form->addElement( $aim_tray );
75
76
    $yim_text = new XoopsFormText( '', 'user_yim', 30, 100 );
77
    $yim_match = new XoopsFormSelectMatchOption( '', 'user_yim_match' );
78
    $yim_tray = new XoopsFormElementTray( _MD_XM_YIM, ' ' );
79
    $yim_tray->addElement( $yim_match );
80
    $yim_tray->addElement( $yim_text );
81
    $form->addElement( $yim_tray );
82
83
    $msnm_text = new XoopsFormText( '', 'user_msnm', 30, 100 );
84
    $msnm_match = new XoopsFormSelectMatchOption( '', 'user_msnm_match' );
85
    $msnm_tray = new XoopsFormElementTray( _MD_XM_MSNM, ' ' );
86
    $msnm_tray->addElement( $msnm_match );
87
    $msnm_tray->addElement( $msnm_text );
88
    $form->addElement( $msnm_tray );
89
90
    $form->addElement( new XoopsFormText( _MD_XM_LOCATION, 'user_from', 30, 100 ) );
91
    $form->addElement( new XoopsFormText( _MD_XM_OCCUPATION, 'user_occ', 30, 100 ) );
92
    $form->addElement( new XoopsFormText( _MD_XM_INTEREST, 'user_intrest', 30, 100 ) );
93
    $form->addElement( new XoopsFormText( _MD_XM_LASTLOGMORE, 'user_lastlog_more', 10, 5 ) );
94
    $form->addElement( new XoopsFormText( _MD_XM_LASTLOGLESS, 'user_lastlog_less', 10, 5 ) );
95
    $form->addElement( new XoopsFormText( _MD_XM_REGMORE, 'user_reg_more', 10, 5 ) );
96
    $form->addElement( new XoopsFormText( _MD_XM_REGLESS, 'user_reg_less', 10, 5 ) );
97
    $form->addElement( new XoopsFormText( _MD_XM_POSTSMORE, 'user_posts_more', 10, 5 ) );
98
    $form->addElement( new XoopsFormText( _MD_XM_POSTSLESS, 'user_posts_less', 10, 5 ) );
99
100
    $sort_select = new XoopsFormSelect( _MD_XM_SORT, 'user_sort' );
101
    $sort_select->addOptionArray( array( 'uname' => _MD_XM_UNAME, 'email' => _MD_XM_EMAIL, 'last_login' => _MD_XM_LASTLOGIN, 'user_regdate' => _MD_XM_REGDATE, 'posts' => _MD_XM_POSTS ) );
102
    $form->addElement( $sort_select );
103
104
    $order_select = new XoopsFormSelect( _MD_XM_ORDER, 'user_order' );
105
    $order_select->addOptionArray( array( 'ASC' => _MD_XM_ASC, 'DESC' => _MD_XM_DESC ) );
106
    $form->addElement( $order_select );
107
108
    $form->addElement( new XoopsFormText( _MD_XM_LIMIT, 'limit', 6, 2 ) );
109
    $form->addElement( new XoopsFormHidden( 'op', 'submit' ) );
110
    $form->addElement( new XoopsFormButton( '', 'user_submit', _SUBMIT, 'submit' ) );
111
    $form->assign( $xoopsTpl );
112
    $xoopsTpl->assign( 'totalmember', $total );
113
}
114
115
if ( $op == 'submit' ) {
116
    $xoopsOption['template_main'] = 'xoopsmembers_searchresults.tpl';

searchmembers.php 1 location

@@ 29-113 (lines=85) @@
26
27
$op = ( isset( $_POST['op'] ) && $_POST['op'] == 'submit' ) ? 'submit' : 'form';
28
29
if ( $op == 'form' ) {
30
    $xoopsOption['template_main'] = 'xoopsmembers_searchform.tpl';
31
    include XOOPS_ROOT_PATH . '/header.php';
32
33
    $member_handler = &xoops_gethandler( 'member' );
34
    $total = $member_handler->getUserCount( new Criteria( 'level', 0, '>' ) );
35
36
    include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
37
38
    $form = new XoopsThemeForm( '', 'searchform', 'index.php' );
39
    $uname_text = new XoopsFormText( '', 'user_uname', 30, 60 );
40
    $uname_match = new XoopsFormSelectMatchOption( '', 'user_uname_match' );
41
    $uname_tray = new XoopsFormElementTray( _MD_XM_UNAME, ' ' );
42
    $uname_tray->addElement( $uname_match );
43
    $uname_tray->addElement( $uname_text );
44
    $form->addElement( $uname_tray );
45
46
    $name_text = new XoopsFormText( '', 'user_name', 30, 60 );
47
    $name_match = new XoopsFormSelectMatchOption( '', 'user_name_match' );
48
    $name_tray = new XoopsFormElementTray( _MD_XM_REALNAME, ' ' );
49
    $name_tray->addElement( $name_match );
50
    $name_tray->addElement( $name_text );
51
    $form->addElement( $name_tray );
52
53
    $email_text = new XoopsFormText( '', 'user_email', 30, 60 );
54
    $email_match = new XoopsFormSelectMatchOption( '', 'user_email_match' );
55
    $email_tray = new XoopsFormElementTray( _MD_XM_EMAIL, ' ' );
56
    $email_tray->addElement( $email_match );
57
    $email_tray->addElement( $email_text );
58
    $form->addElement( $email_tray );
59
60
    $form->addElement( new XoopsFormText( _MD_XM_URLC, 'user_url', 30, 100 ) );
61
62
    $icq_text = new XoopsFormText( '', 'user_icq', 30, 100 );
63
    $icq_match = new XoopsFormSelectMatchOption( '', 'user_icq_match' );
64
    $icq_tray = new XoopsFormElementTray( _MD_XM_ICQ, ' ' );
65
    $icq_tray->addElement( $icq_match );
66
    $icq_tray->addElement( $icq_text );
67
    $form->addElement( $icq_tray );
68
69
    $aim_text = new XoopsFormText( '', 'user_aim', 30, 100 );
70
    $aim_match = new XoopsFormSelectMatchOption( '', 'user_aim_match' );
71
    $aim_tray = new XoopsFormElementTray( _MD_XM_AIM, ' ' );
72
    $aim_tray->addElement( $aim_match );
73
    $aim_tray->addElement( $aim_text );
74
    $form->addElement( $aim_tray );
75
76
    $yim_text = new XoopsFormText( '', 'user_yim', 30, 100 );
77
    $yim_match = new XoopsFormSelectMatchOption( '', 'user_yim_match' );
78
    $yim_tray = new XoopsFormElementTray( _MD_XM_YIM, ' ' );
79
    $yim_tray->addElement( $yim_match );
80
    $yim_tray->addElement( $yim_text );
81
    $form->addElement( $yim_tray );
82
83
    $msnm_text = new XoopsFormText( '', 'user_msnm', 30, 100 );
84
    $msnm_match = new XoopsFormSelectMatchOption( '', 'user_msnm_match' );
85
    $msnm_tray = new XoopsFormElementTray( _MD_XM_MSNM, ' ' );
86
    $msnm_tray->addElement( $msnm_match );
87
    $msnm_tray->addElement( $msnm_text );
88
    $form->addElement( $msnm_tray );
89
90
    $form->addElement( new XoopsFormText( _MD_XM_LOCATION, 'user_from', 30, 100 ) );
91
    $form->addElement( new XoopsFormText( _MD_XM_OCCUPATION, 'user_occ', 30, 100 ) );
92
    $form->addElement( new XoopsFormText( _MD_XM_INTEREST, 'user_intrest', 30, 100 ) );
93
    $form->addElement( new XoopsFormText( _MD_XM_LASTLOGMORE, 'user_lastlog_more', 10, 5 ) );
94
    $form->addElement( new XoopsFormText( _MD_XM_LASTLOGLESS, 'user_lastlog_less', 10, 5 ) );
95
    $form->addElement( new XoopsFormText( _MD_XM_REGMORE, 'user_reg_more', 10, 5 ) );
96
    $form->addElement( new XoopsFormText( _MD_XM_REGLESS, 'user_reg_less', 10, 5 ) );
97
    $form->addElement( new XoopsFormText( _MD_XM_POSTSMORE, 'user_posts_more', 10, 5 ) );
98
    $form->addElement( new XoopsFormText( _MD_XM_POSTSLESS, 'user_posts_less', 10, 5 ) );
99
100
    $sort_select = new XoopsFormSelect( _MD_XM_SORT, 'user_sort' );
101
    $sort_select->addOptionArray( array( 'uname' => _MD_XM_UNAME, 'email' => _MD_XM_EMAIL, 'last_login' => _MD_XM_LASTLOGIN, 'user_regdate' => _MD_XM_REGDATE, 'posts' => _MD_XM_POSTS ) );
102
    $form->addElement( $sort_select );
103
104
    $order_select = new XoopsFormSelect( _MD_XM_ORDER, 'user_order' );
105
    $order_select->addOptionArray( array( 'ASC' => _MD_XM_ASC, 'DESC' => _MD_XM_DESC ) );
106
    $form->addElement( $order_select );
107
108
    $form->addElement( new XoopsFormText( _MD_XM_LIMIT, 'limit', 6, 2 ) );
109
    $form->addElement( new XoopsFormHidden( 'op', 'submit' ) );
110
    $form->addElement( new XoopsFormButton( '', 'user_submit', _SUBMIT, 'submit' ) );
111
    $form->assign( $xoopsTpl );
112
    $xoopsTpl->assign( 'totalmember', $total );
113
}
114
115
if ( $op == 'submit' ) {
116
    $xoopsOption['template_main'] = 'xoopsmembers_searchresults.tpl';