~ubuntu-branches/ubuntu/utopic/fusionforge/utopic

« back to all changes in this revision

Viewing changes to www/admin/search.php

  • Committer: Bazaar Package Importer
  • Author(s): Roland Mas
  • Date: 2010-06-18 13:14:11 UTC
  • mfrom: (1.3.1 upstream) (4.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100618131411-o2kc5nsdnvqhnm5r
Tags: 5.0.1+svn10088-1
New snapshot from upstream SVN (Branch_5_0).

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
        Main code
62
62
*/
63
63
if ($usersearch) {
64
 
 
65
 
        $sql = "
66
 
                SELECT DISTINCT * 
67
 
                FROM users WHERE ";
68
 
        
69
64
        if (is_numeric($search)) {
70
65
                $result = db_query_params ('SELECT DISTINCT * FROM users
71
66
WHERE user_id = $1
122
117
if (getStringFromRequest('groupsearch')) {
123
118
        $status = getStringFromRequest('status');
124
119
        $is_public = getIntFromRequest('is_public', -1);
125
 
        $crit_desc = getStringFromRequest('crit_desc');
126
 
        $crit_sql = '';
 
120
        $crit_desc = '' ;
 
121
        $qpa = db_construct_qpa () ;
 
122
        
 
123
        if(is_numeric($search)) {
 
124
                $qpa = db_construct_qpa ($qpa, 'SELECT DISTINCT * FROM groups
 
125
WHERE (group_id=$1 OR lower (unix_group_name) LIKE $2 OR lower (group_name) LIKE $2)',
 
126
                                            array ($search,
 
127
                                                   strtolower ("%$search%"))) ;
 
128
        } else {
 
129
                $qpa = db_construct_qpa ($qpa, 'SELECT DISTINCT * FROM groups WHERE (lower (unix_group_name) LIKE $1 OR lower (group_name) LIKE $1)',
 
130
                                            array (strtolower ("%$search%"))) ;
 
131
        }
127
132
 
128
133
        if ($status) {
129
 
                $crit_sql  .= " AND status='$status'";
 
134
                $qpa = db_construct_qpa ($qpa, ' AND status=$1', array ($status)) ;
130
135
                $crit_desc .= " status=$status";
131
136
        }
132
 
        if ($is_public !== -1) {
133
 
                $crit_sql  .= " AND is_public='$is_public'";
 
137
        if ($is_public != -1) {
 
138
                $qpa = db_construct_qpa ($qpa, ' AND is_public=$1', array ($is_public)) ;
134
139
                $crit_desc .= " is_public=$is_public";
135
140
        }
136
141
 
137
 
        $sql = "
138
 
                SELECT DISTINCT *
139
 
                FROM groups WHERE (";
140
 
        
141
 
        if(is_numeric($search)) {
142
 
                $result = db_query_params ('SELECT DISTINCT * FROM groups
143
 
WHERE group_id=$1
144
 
OR lower (unix_group_name) LIKE $2
145
 
OR lower (group_name) LIKE $2',
146
 
                                           array ($search,
147
 
                                                  strtolower ("%$search%"))) ;
148
 
        } else {
149
 
                $result = db_query_params ('SELECT DISTINCT * FROM groups
150
 
WHERE lower (unix_group_name) LIKE $2
151
 
OR lower (group_name) LIKE $2',
152
 
                                           array (strtolower ("%$search%"))) ;
153
 
        }
154
 
 
155
142
        if ($crit_desc) {
156
 
                $crit_desc = "($crit_desc )";
 
143
                $crit_desc = "(".trim($crit_desc).")";
157
144
        }
 
145
 
 
146
        $result = db_query_qpa ($qpa) ;
158
147
        print '<p><strong>'.sprintf(ngettext('Group search with criteria <em>%s</em>: %d match', 'Group search with criteria <em>%s</em>: %d matches', db_numrows($result)), $crit_desc, db_numrows($result)).'</strong></p>';
159
148
        
160
149
        if (db_numrows($result) < 1) {