From: Chris S. <san...@us...> - 2005-06-15 20:07:18
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30180/scripts Modified Files: Tag: frontend_dev stackDatabase.php Log Message: Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.16.2.1 retrieving revision 1.16.2.2 diff -C2 -d -r1.16.2.1 -r1.16.2.2 *** stackDatabase.php 15 Jun 2005 16:39:53 -0000 1.16.2.1 --- stackDatabase.php 15 Jun 2005 20:07:09 -0000 1.16.2.2 *************** *** 109,116 **** global $_PHP_SELF; if ('try' == $action) { ! $filter = 'demo'; } $query = 'SELECT questionID, questionName, questionDescription, questionKeywords, DATE_FORMAT(questionDateLastEdited,"%k:%i, %d/%m/%y"), questionGUID --- 109,131 ---- global $_PHP_SELF; + // Sort out how we are going to filter questions. + $filter_kw = ''; + $filter_name = ''; + if ('try' == $action) { ! $filter_kw = 'demo'; ! $filter_name = ''; ! } else { ! if (is_array($filter)) { ! if (array_key_exists('kw',$filter)) { ! $filter_kw = $filter['kw']; ! } ! if (array_key_exists('name',$filter)) { ! $filter_name = $filter['name']; ! } ! } } + // Build the query to the database. $query = 'SELECT questionID, questionName, questionDescription, questionKeywords, DATE_FORMAT(questionDateLastEdited,"%k:%i, %d/%m/%y"), questionGUID *************** *** 137,141 **** echo "<th><a href=\"javascript:SelectQs('questionbank_screen');\">Filter</a></th>"; } ! echo "<th></th><th></th> <th> <input type='text' name='bank_filter' value='$filter' /> </th></tr></thead><tbody>"; } --- 152,157 ---- echo "<th><a href=\"javascript:SelectQs('questionbank_screen');\">Filter</a></th>"; } ! echo "<th></th><th><input type='text' name='bank_filter[name]' value='$filter_name' /> ! </th> <th> <input type='text' name='bank_filter[kw]' value='$filter_kw' /> </th></tr></thead><tbody>"; } *************** *** 144,160 **** $qkeywords = stripslashes($row[3]); $dispQ = TRUE; ! if ('' != $filter) { ! $dispQ = strpos($qkeywords,$filter); } if (FALSE !== $dispQ) { - if ('' == $row[1]) { - $qname = ''; - } - else - { - $qname = stripslashes($row[1]); - } $guid = $row[5]; --- 160,180 ---- $qkeywords = stripslashes($row[3]); + if ('' == $row[1]) { + $qname = ''; + } else { + $qname = stripslashes($row[1]); + } + + // Decide how to filter questions $dispQ = TRUE; ! if ('' != $filter_kw) { ! $dispQ = strpos($qkeywords,$filter_kw); } + if ('' != $filter_name) { + $dispQ = $dispQ OR strpos($qname,$filter_name); + } + if (FALSE !== $dispQ) { $guid = $row[5]; |