phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: phpbrain/inc class.sokb.inc.php,1.13,1.14


From: Dave Hall <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpbrain/inc class.sokb.inc.php,1.13,1.14
Date: Sun, 18 May 2003 03:24:35 -0400

Update of /cvsroot/phpgroupware/phpbrain/inc
In directory subversions:/tmp/cvs-serv21812

Modified Files:
        class.sokb.inc.php 
Log Message:
search fix (workaround)

Index: class.sokb.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpbrain/inc/class.sokb.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** class.sokb.inc.php  30 Apr 2003 21:42:56 -0000      1.13
--- class.sokb.inc.php  18 May 2003 07:24:33 -0000      1.14
***************
*** 5,10 ****
        * Written by Dave Hall [skwashd AT phpgroupware DOT org]                
   *
        * 
------------------------------------------------------------------------ *
!       * Started off as a port of phpBrain - http://vrotvrot.com/phpBrain/     
         *
!       *  but quickly became a full rewrite                                    
                                         *
        * 
------------------------------------------------------------------------ *
        *  This program is free software; you can redistribute it and/or modify 
it *
--- 5,10 ----
        * Written by Dave Hall [skwashd AT phpgroupware DOT org]                
   *
        * 
------------------------------------------------------------------------ *
!       * Started off as a port of phpBrain - http://vrotvrot.com/phpBrain/     
 *
!       *  but quickly became a full rewrite                                    
 *
        * 
------------------------------------------------------------------------ *
        *  This program is free software; you can redistribute it and/or modify 
it *
***************
*** 71,88 ****
                {       
                        $stats = array();
!       /* how many faqs*/
!       $this->db->query('SELECT COUNT(*) FROM phpgw_kb_faq WHERE published = 1 
AND is_faq = 0', __LINE__, __FILE__);
!       $this->db->next_record();
!       $stats['num_faqs'] = $this->db->f(0);
      
!       /* how many tutorials? */
!       $this->db->query('SELECT COUNT(*) FROM phpgw_kb_faq WHERE published = 1 
AND is_faq = 1', __LINE__, __FILE__);
!       $this->db->next_record();
!       $stats['num_tutes'] = $this->db->f(0);
      
!       /* how many open questions? */
!       $this->db->query('SELECT COUNT(*) FROM phpgw_kb_questions WHERE pending 
= 0', __LINE__, __FILE__);
                        $this->db->next_record();
!       $stats['num_open'] = $this->db->f(0);
                        
                        return $stats;
--- 71,88 ----
                {       
                        $stats = array();
!                       /* how many faqs*/
!                       $this->db->query('SELECT COUNT(*) FROM phpgw_kb_faq 
WHERE published = 1 AND is_faq = 0', __LINE__, __FILE__);
!                       $this->db->next_record();
!                       $stats['num_faqs'] = $this->db->f(0);
      
!                       /* how many tutorials? */
!                       $this->db->query('SELECT COUNT(*) FROM phpgw_kb_faq 
WHERE published = 1 AND is_faq = 1', __LINE__, __FILE__);
!                       $this->db->next_record();
!                       $stats['num_tutes'] = $this->db->f(0);
      
!                       /* how many open questions? */
!                       $this->db->query('SELECT COUNT(*) FROM 
phpgw_kb_questions WHERE pending = 0', __LINE__, __FILE__);
                        $this->db->next_record();
!                       $stats['num_open'] = $this->db->f(0);
                        
                        return $stats;
***************
*** 91,102 ****
                function get_latest()
                {
!       /* latest questions */
!       $this->db->limit_query('SELECT * FROM phpgw_kb_questions WHERE pending 
= 0 ORDER BY question_id DESC', 0, __LINE__, __FILE__, 3);
  
                        $questions = array();
!       while($this->db->next_record())
                        {
!               $questions[$this->db->f('question_id')] = 
$this->db->f('question', true);
!       }
                        return $questions;
        }//end get latest
--- 91,102 ----
                function get_latest()
                {
!                       /* latest questions */
!                       $this->db->limit_query('SELECT * FROM 
phpgw_kb_questions WHERE pending = 0 ORDER BY question_id DESC', 0, __LINE__, 
__FILE__, 3);
  
                        $questions = array();
!                       while($this->db->next_record())
                        {
!                               $questions[$this->db->f('question_id')] = 
$this->db->f('question', true);
!                       }
                        return $questions;
        }//end get latest
***************
*** 104,108 ****
                function get_faq_list($cat_id = '', $unpublished = false)
                {
!       $where  = ((strlen($cat_id) != 0) ? "cat_id = $cat_id " : '');
                        $where .= ((strlen($where) > 0) ? 'AND ' : '');
                        $where .= ($unpublished ? 'published = 0' : 'published 
= 1'); 
--- 104,108 ----
                function get_faq_list($cat_id = '', $unpublished = false)
                {
!                       $where  = ((strlen($cat_id) != 0) ? "cat_id = $cat_id " 
: '');
                        $where .= ((strlen($where) > 0) ? 'AND ' : '');
                        $where .= ($unpublished ? 'published = 0' : 'published 
= 1'); 
***************
*** 111,120 ****
                        {
                                $faqs[$this->db->f('faq_id')] = array('title'   
=> $this->db->f('title', true),
!                                                                       'text'  
        => substr($this->db->f('text', true),0,50) . ' ...',
!                                                                       
'modified'      => $this->db->f('modified'),
!                                                                       'views' 
        => $this->db->f('views'),
!                                                                       'votes' 
        => $this->db->f('votes'),
!                                                                       'total' 
        => $this->db->f('total')
!                                                                               
                );
                        }
                        return $faqs;
--- 111,120 ----
                        {
                                $faqs[$this->db->f('faq_id')] = array('title'   
=> $this->db->f('title', true),
!                                                               'text'          
=> substr($this->db->f('text', true),0,50) . ' ...',
!                                                               'modified'      
=> $this->db->f('modified'),
!                                                               'views'         
=> $this->db->f('views'),
!                                                               'votes'         
=> $this->db->f('votes'),
!                                                               'total'         
=> $this->db->f('total')
!                                                               );
                        }
                        return $faqs;
***************
*** 127,143 ****
                        {
                                $item = array('faq_id'          => 
$this->db->f('faq_id'),
!                                               'title'                 => 
$this->db->f('title', true),
!                                               'text'                  => 
$this->db->f('text', true),
!                                               'cat_id'                => 
(int) $this->db->f('cat_id', true),
!                                               'published'             => 
$this->db->f('published'),
!                                               'keywords'              => 
$this->db->f('keywords', true),
!                                               'user_id'               => 
(int) $this->db->f('user_id'),
!                                               'views'                 => 
(int) $this->db->f('views'),
!                                               'modified'              => 
(int) $this->db->f('modified'),
!                                               'type'                  => 
(int) $this->db->f('type'),
!                                               'url'                   => 
$this->db->f('url', true),
!                                               'votes'                 => 
(int) $this->db->f('votes'),
!                                               'total'                 => 
(int) $this->db->f('total')
!                                                       );
  
                                if($count_view)
--- 127,143 ----
                        {
                                $item = array('faq_id'          => 
$this->db->f('faq_id'),
!                                       'title'                 => 
$this->db->f('title', true),
!                                       'text'                  => 
$this->db->f('text', true),
!                                       'cat_id'                => (int) 
$this->db->f('cat_id', true),
!                                       'published'             => 
$this->db->f('published'),
!                                       'keywords'              => 
$this->db->f('keywords', true),
!                                       'user_id'               => (int) 
$this->db->f('user_id'),
!                                       'views'                 => (int) 
$this->db->f('views'),
!                                       'modified'              => (int) 
$this->db->f('modified'),
!                                       'type'                  => (int) 
$this->db->f('type'),
!                                       'url'                   => 
$this->db->f('url', true),
!                                       'votes'                 => (int) 
$this->db->f('votes'),
!                                       'total'                 => (int) 
$this->db->f('total')
!                                       );
  
                                if($count_view)
***************
*** 155,161 ****
                        {
                                $comment[$this->db->f('comment_id')] = 
array('user_id'  => $this->db->f('user_id'),
!                                                                               
'comment_text'                  => $this->db->f('comment', true),
!                                                                               
'entered'                       => $this->db->f('entered')
!                                                                               
                        );
                        }
                        return $comment;
--- 155,161 ----
                        {
                                $comment[$this->db->f('comment_id')] = 
array('user_id'  => $this->db->f('user_id'),
!                                                                       
'comment_text'  => $this->db->f('comment', true),
!                                                                       
'entered'       => $this->db->f('entered')
!                                                                       );
                        }
                        return $comment;
***************
*** 190,193 ****
--- 190,194 ----
                        switch 
(trim($GLOBALS['phpgw_info']['server']['db_type']))
                        {
+                               /* This is not working - not sure why
                                case 'mysql':
                                        $ver = explode('-', 
mysql_get_server_info());
***************
*** 202,205 ****
--- 203,207 ----
                                        }
                                        break;
+                               */
                                //case 'pgsql': - //future use
                                //case 'mssql': - //future use
***************
*** 316,320 ****
                                $select .= "AND is_faq = $show ";
                        }
!                       $search_words = expode(' ', $search);
                        $cycle = 0;
                        foreach($search_words as $id => $word)
--- 318,322 ----
                                $select .= "AND is_faq = $show ";
                        }
!                       $search_words = explode(' ', $search);
                        $cycle = 0;
                        foreach($search_words as $id => $word)
***************
*** 347,354 ****
                }//end search ansisql
  
!               function search_mysql($search)
                {
                        $sql  = 'SELECT *, ';
!                       $sql .= "MATCH text,keywords,title AGAINST('" . 
addslashes($search) ."') AS score ";
                        $sql .= 'FROM phpgw_kb_faq ';
                        $sql .= 'WHERE published = 1 ';
--- 349,356 ----
                }//end search ansisql
  
!               function search_mysql($search, $show)
                {
                        $sql  = 'SELECT *, ';
!                       $sql .= "MATCH text,keywords,title AGAINST('" . 
$this->db->db_addslashes($search) ."') AS score ";
                        $sql .= 'FROM phpgw_kb_faq ';
                        $sql .= 'WHERE published = 1 ';
***************
*** 357,361 ****
                                $sql .= "AND is_faq = $show ";
                        }
!                       //$sql .= 'HAVING (score > 0) '; //- this isn't working 
properly afaik
                        $sql .= 'ORDER BY score DESC';
                        $this->db->query($sql, __LINE__, __FILE__);
--- 359,363 ----
                                $sql .= "AND is_faq = $show ";
                        }
!                       //$sql .= 'HAVING (score > 0.25) '; //- this isn't 
working properly afaik
                        $sql .= 'ORDER BY score DESC';
                        $this->db->query($sql, __LINE__, __FILE__);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]