- Timestamp:
- Mar 6, 2009, 5:16:22 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/plugins/xpressme/include/custom_functions.php
r95 r96 3 3 function xpress_credit($show = false) 4 4 { 5 global $xoopsModule,$wp_version; 6 7 $ret = '<a href="http://www.toemon.com"'. " target='_blank'" . '>XPressME Ver.' . sprintf('%.2f %s',$xoopsModule->getInfo('version'),$xoopsModule->getInfo('codename')) .'</a>'; 5 global $wp_version , $modversion; 6 7 $xpress_version = $modversion['version']; 8 $xpress_codename = $modversion['codename']; 9 $ret = '<a href="http://www.toemon.com"'. " target='_blank'" . '>XPressME Ver.' . sprintf('%.2f %s',$xpress_version,$xpress_codename) .'</a>'; 8 10 if (strstr($wp_version,'ME')){ 9 11 $ret .= '(included <a href="http://wpme.sourceforge.jp/" title="Powered by WordPress"'." target='_blank'". '>WordPress ' . $wp_version . '</a>)'; … … 192 194 // Set post views given a post ID or post object. 193 195 function post_views_counting($post_id = 0) { 196 global $xoops_db,$wpdb; 194 197 global $table_prefix; 195 198 static $views; … … 201 204 202 205 203 $views_db = $table_prefix . "views";206 $views_db = get_wp_prefix() . 'views'; 204 207 205 208 if($post_id==0 || !empty($views[$post_id])) return null; … … 212 215 213 216 $sql = "SELECT post_views FROM " . $views_db . " WHERE post_id=$post_id"; 214 $exist = false; 215 if ($result = $GLOBALS["xoopsDB"]->query($sql)) { 216 while($row = $GLOBALS["xoopsDB"]->fetchArray($result)){ 217 $exist = true; 218 break; 219 } 220 } 221 if($exist){ 217 $post_views_found = $xoops_db->get_var($sql); 218 if($post_views_found){ 222 219 $sql = "UPDATE " . $views_db . " SET post_views=post_views+1 WHERE post_id=$post_id"; 223 220 }else{ 224 221 $sql = "INSERT INTO " . $views_db . " (post_id, post_views) VALUES ($post_id, 1)"; 225 222 } 226 if ($result = $GLOBALS["xoopsDB"]->queryF($sql)) { 227 $views[$post_id] = 1; 228 } 229 223 $xoops_db->query($sql); 230 224 return true; 231 225 }
Note: See TracChangeset
for help on using the changeset viewer.