Changeset 1316

Show
Ignore:
Timestamp:
08/29/08 06:40:46 (3 months ago)
Author:
_ck_
Message:

1.6.1 attempted fix at unreproducible error in 1.0

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • bb-topic-views/trunk/bb-topic-views.php

    r1312 r1316  
    11<?php 
    22/* 
    3 Plugin Name: bb-Topic-Views 
     3Plugin Name: bb Topic Views 
    44Plugin URI: http://bbpress.org/plugins/topic/bb-topic-views/ 
    55Description: Counts the number of times a topic has been viewed, and allows the administrator to display the count in various places. 
    66Author: Mike Wittmann, _ck_ 
    77Author URI: http://blog.wittmania.com/ 
    8 Version: 1.6.0 
     8Version: 1.6.1 
    99*/ 
    1010 
     
    107107        global $bbdb, $topic, $topic_id; 
    108108         
    109         if (is_topic()) { 
     109        if (is_topic()) {                        
     110                if (empty($topic_id)) {if (empty($topic)) {return;} else {$topic_id=$topic->topic_id;}} // should never happen in bb_head but does for some reason in 1.0 ? 
     111         
    110112                if (empty($topic->views)) {$view_count=0;} else {$view_count=$topic->views;} 
    111          
     113 
    112114                if ($view_count>=1) { 
    113115                         
     
    120122                                if (bb_get_option('bb_db_version')>1600) { // bbPress 1.0 
    121123                         
    122                                 @$bbdb->query("UPDATE $bbdb->meta SET meta_value=meta_value+1 WHERE object_type='bb_topic' AND object_id=$topic_id AND meta_key='views' LIMIT 1"); 
     124                                @$bbdb->query("UPDATE $bbdb->meta SET meta_value=meta_value+1 WHERE object_type = 'bb_topic' AND object_id = $topic_id AND meta_key='views' LIMIT 1"); 
    123125                         
    124126                                } else { // 0.7 - 0.9 
    125127                         
    126                                 @$bbdb->query("UPDATE $bbdb->topicmeta SET meta_value=meta_value+1 WHERE topic_id=$topic_id AND meta_key='views' LIMIT 1"); 
     128                                @$bbdb->query("UPDATE $bbdb->topicmeta SET meta_value=meta_value+1 WHERE topic_id = $topic_id AND meta_key='views' LIMIT 1"); 
    127129                         
    128130                                }