Source for file target.inc.php

Documentation is available at target.inc.php

  1. <?php
  2.  
  3. /*
  4. Program E related AIML knowledgebase tools
  5. Copyright 2004, Anne Kootstra [anne@aiml.info]
  6. http://www.AIML.info
  7. Program E is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. Program E is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Program E; if not, write to the Free Software
  19. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21.  
  22.  
  23. /**
  24. * Retrieve the GMcache record.
  25. *
  26. * Get the record using it's unique ID.
  27. *
  28. * @param integer $id ID of the GMcache entry to be retrieved
  29. *
  30. * @return array [pattern] pattern of the category that
  31. * matched the user's input and [input] the
  32. * actual input of the user.
  33. */
  34. function findtarget($id){
  35.  
  36. $query="select patternmatched, inputmatched from gmcache where id='$id'";
  37.  
  38. $selectcode = mysql_query($query);
  39. if ($selectcode){
  40. if(!mysql_numrows($selectcode)){
  41. return "";
  42. }
  43. else{
  44. while ($q = mysql_fetch_array($selectcode)){
  45. $matched['pattern'] = $q[0];
  46. $matched['input'] = $q[1];
  47. return $matched;
  48. }
  49. }
  50. }
  51. return "";
  52.  
  53. }
  54.  
  55.  
  56. /**
  57. * Retrieve the first GMcache record.
  58. *
  59. * Retrieve the ID of the first record in the GMcache table. To be used when
  60. * no targetID was selected for editing.
  61. *
  62. * @param string $botid the bot's ID, in case there are more than one bot.
  63. *
  64. * @return integer id of the First record
  65. *
  66. */
  67. function findFirsttarget($botid){
  68.  
  69. $query="select id from gmcache where bot='".$botid."' order by id asc limit 0,1";
  70.  
  71. debugger($query,2);
  72. $selectcode = mysql_query($query);
  73. if ($selectcode){
  74. if(!mysql_numrows($selectcode)){
  75. return "";
  76. }
  77. else{
  78. while ($q = mysql_fetch_array($selectcode)){
  79. return $q[0];
  80. }
  81. }
  82. }
  83.  
  84. return "";
  85. }
  86.  
  87. /**
  88. * Delete GMcached record.
  89. *
  90. * Delete the GMcache record that has that particular ID.
  91. *
  92. * @uses debugger()
  93. *
  94. * @param interger $id the ID of the GMcache record to be deleted.
  95. *
  96. * @return void
  97. */
  98. function deletetarget($id){
  99.  
  100. $query = "delete from gmcache where id='".$id."'";
  101. debugger($query,2);
  102. $selectcode = mysql_query($query);
  103. return "";
  104. }
  105.  
  106.  
  107.  
  108. ?>

Documentation generated on Tue, 11 Jan 2005 18:41:11 +0100 by phpDocumentor 1.3.0RC3