Changeset 147

Show
Ignore:
Timestamp:
2008-05-14 17:02:15 (8 months ago)
Author:
hannes
Message:

fixing search for member's posts when using MySQL (ticket #79)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/classes/misc/Format.php

    r127 r147  
    7979    public function post($str, $simple = FALSE) { 
    8080        // language 
    81         global $LANG, $F
     81        global $LANG, $F, $C, $SETTINGS
    8282        /* debugging messages; 
    8383         * printed out directly on the screen, so incompatible with general board structure; 
     
    187187                        break; 
    188188                        case '[quote=': 
    189                             // get poster and date of post this quote comes from 
    190                             $p = new Post($_attr); 
    191                             $_attr = str_replace(Array('%poster%', '%date%'), Array($p->getPoster(), $F->datetime($p->getPosttime())), $LANG['quote_from']); 
     189                            if (isset($C) && $C) { 
     190                                // get poster and date of post this quote comes from 
     191                                $p = new Post($_attr); 
     192                                $_attr = str_replace(Array('%poster%', '%date%'), Array($p->getPoster(), $F->datetime($p->getPosttime())), $LANG['quote_from']); 
     193                            } else { $_attr = ''; } 
    192194                        break; 
    193195                        default: 
     
    255257        if ($simple) { 
    256258            // strip quotes completely 
    257             $str = preg_replace('/<div class="quote1">' . $LANG['Quote'] . ':<\/div><div class="quote">(.*?)<\/div>/si', '', $str); 
     259            $str = preg_replace('/<div class="quote1">(.*?)<\/div><div class="quote">(.*?)<\/div>/si', '', $str); 
    258260            // remove all other HTML tags apart from line breaks 
    259261            $str = strip_tags($str, '<br>'); 
  • trunk/classes/pages/Search.php

    r125 r147  
    194194                            $table->addHeaderRow(Array('<th colspan="2">' . $LANG['Results'] . '</th>')); 
    195195                            $n = 0; 
    196                             while ($row = $q2->fetchObject()) { 
     196                            $rows3 = $q2->fetchAll(); 
     197                            $q2 = NULL; 
     198                            foreach ($rows3 as $row) { 
    197199                                // topic title 
    198200                                // format post preview 
    199                                 $postpreview = substr($F->post($row->post, TRUE), 0, 200); 
     201                                $postpreview = substr($F->post($row['post'], TRUE), 0, 200); 
    200202                                // remove incomplete words at the end of post preview 
    201203                                if (strrpos($postpreview, ' ') !== FALSE) { 
     
    207209                                } 
    208210                                // add it to table 
    209                                 $table->addRow(Array('<td><a href="' . $F->link('topic') . 'id=' . $row->topic . '"><strong>' . $row->topictitle . '</strong></a><br />' . $postpreview . '...<br /></td>', '<td nowrap="nowrap">' . $LANG['Posted'] . ' ' . $LANG['by'] . ' ' . $row->poster . '<br />' . $LANG['at'] . ' ' . $F->datetime($row->posttime, FALSE, TRUE) . '<br />' . $LANG['on'] . ' ' . $F->datetime($row->posttime, TRUE, FALSE) . '</td>')); 
     211                                $table->addRow(Array('<td><a href="' . $F->link('topic') . 'id=' . $row['topic'] . '"><strong>' . $row['topictitle'] . '</strong></a><br />' . $postpreview . '...<br /></td>', '<td nowrap="nowrap">' . $LANG['Posted'] . ' ' . $LANG['by'] . ' ' . $row['poster'] . '<br />' . $LANG['at'] . ' ' . $F->datetime($row['posttime'], FALSE, TRUE) . '<br />' . $LANG['on'] . ' ' . $F->datetime($row['posttime'], TRUE, FALSE) . '</td>')); 
    210212                                $n++; 
    211213                            } 
    212                             $q2 = NULL; 
    213214                            if ($n === 0) { 
    214215                                // no results