[geeklog-devel] Web Services minutia (and some story stuff)

Joe Mucchiello joe at ThrowingDice.com
Sun Dec 23 02:20:23 EST 2007


Should the Webservices API call COM_hits? Currently COM_hits (or its 
equivalent) is called in COM_siteFooter but the WS stuff doesn't use 
the siteHeader/siteFooter calls.

Shouldn't service_get_story update the number of hits on the story? 
Looking at hits of class Story, shouldn't there be a "hit()" function 
that article.php would call rather than having article.php update the 
database directly. The benefit of having it in class story is that it 
could ensure only one hit is registered per system hit:

class Story {
   function hit() {
         if (!empty($this->_sid) && !$this->_alreadyHit && 
!$this->_draftFlag) {
             $this->_alreadyHit = true; // need to default this to false
             DB_change($_TABLES['stories'], 'hits', 'hits + 1', 
'sid', $this->getSid(true), true);
             $this->_hits = DB_getItem($_TABLES['stories'], 'hits', 
'sid = '\'' . $this->getSid(true) .'\''); // in case of simultaneous hits
         }
     }
}

And while I was kicking around in lib-story, shouldn't 
STORY_extractLinks use the MBYTE_substr here:

         if ( ( $maxlength > 0 ) && ( MBYTE_strlen( $matches[2][$i] 
) > $maxlength ) )
         {
             $matches[2][$i] = substr( $matches[2][$i], 0, $maxlength 
- 3 ) . '...';
         }



----
Joe Mucchiello
Throwing Dice Games
http://www.throwingdice.com 




More information about the geeklog-devel mailing list