Changeset 54 for trunk/wp-content/plugins/xpressme/include
- Timestamp:
- Dec 28, 2008, 2:28:17 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/plugins/xpressme/include/custom_functions.php
r51 r54 218 218 // Retrieves post views given a post ID or post object. 219 219 function xpress_post_views_count($post_id=0,$format= '',$show = true) { 220 global $ table_prefix;220 global $xoops_db; 221 221 222 222 static $post_cache_views; … … 230 230 if($post_id==0) return null; 231 231 if(!isset($post_cache_views[$post_id])){ 232 $sql = "SELECT post_views FROM " . $table_prefix . "views" . " WHERE post_id=$post_id"; 233 if (!$result = $GLOBALS["xoopsDB"]->query($sql)) { 232 $sql = "SELECT post_views FROM " . get_xoops_prefix() . "views" . " WHERE post_id=$post_id"; 233 $post_views = $xoops_db->get_var($sql); 234 if (!$post_views) { 234 235 $post_cache_views[$post_id] = 0; 235 236 }else{ 236 $row = $GLOBALS["xoopsDB"]->fetchArray($result); 237 $post_cache_views[$post_id] = $row["post_views"]; 237 $post_cache_views[$post_id] = $post_views; 238 238 } 239 239 }
Note: See TracChangeset
for help on using the changeset viewer.