I found two bugs in search.php

Are you responsible for making OCS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, michael, John

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

I found two bugs in search.php

Postby panthergirl » Thu Apr 21, 2005 3:36 pm

The first bug was that the search query string that gets passed to search.php when it is re-invoked was being displayed on the page. Not fatal, but sloppy looking -- there's no reason the user needs to see that. This code corrects the problem:

Code: Select all

   // show next and prev page links, if applicable
   if($page>1) {
      $prev_page = $page-1;
      $prev_url = "search.php?$string&page=$prev_page";
      if($sort) {
         $prev_url .= "&sort=$sort";
      $prev_link = "<a href=\"".print_url($prev_url)."\">&lt;&lt; Previous Results</a>";
   if($num_records>($page*$max_records)) {
      $next_page = $page+1;
      $next_url = "search.php?$string&page=$next_page";
      if($sort) {
         $next_url .= "&sort=$sort";
      $next_link .= "<a href=\"".print_url($next_url)."\">Next Results &gt;&gt;</a>";
   if($next_link || $prev_link) {
      echo "<p>";
      echo $prev_link;
      if($prev_link && $next_link) {
         echo " | ";
      echo $next_link;
      echo "</p>";

(Where I have $next_url and $prev_url, the original code had $next_link and $prev_link, respectively. But there needs to be a different string variable for the URLs or we get the display problem).

The second bug is that db->data_seek is called by search.php, but data_seek is not defined in any of the files in ocs/include/db (i.e., the files that are named db.*.inc.php). So, for example, db.mysql.inc.php needs to have the following code added to it:

Code: Select all

   // move internal result pointer to the specified row number
   function data_seek($result, $row_number) {
      return mysql_data_seek($result, $row_number);

Sorry if I've used odd words to explain these bugs -- I'm not as familiar with PHP as I should be.

Now if someone can help me with my room_id problem, that would be great! (see my previous post).

Return to “OCS Technical Support”

Who is online

Users browsing this forum: No registered users and 1 guest