- Timestamp:
- May 19, 2011, 6:47:15 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Ver3.0/xpressme_integration_kit/class/xpressD3commentContent.class.php
r616 r749 10 10 // include_once dirname(dirname(__FILE__)).'/include/common_functions.php' ; 11 11 global $forum_id; 12 13 $db =& Database::getInstance() ;12 global $xoopsDB; 13 14 14 $myts =& MyTextsanitizer::getInstance() ; 15 15 … … 26 26 $blog_info = $this->get_comment_blog_info($forum_id); 27 27 // query 28 $post_row = $ db->fetchArray( $db->query( "SELECT * FROM ".$blog_info['mb_table_prefix']."posts WHERE ID=$post_id" ) ) ;28 $post_row = $xoopsDB->fetchArray( $xoopsDB->query( "SELECT * FROM ".$blog_info['mb_table_prefix']."posts WHERE ID=$post_id" ) ) ; 29 29 if( empty( $post_row ) ) return '' ; 30 30 … … 68 68 function canAddComment($external_link_id) 69 69 { 70 global $xoopsDB; 70 71 global $forum_id; 71 72 global $post; … … 80 81 } 81 82 } 82 $db =& Database::getInstance() ;83 83 $myts =& MyTextsanitizer::getInstance() ; 84 84 … … 97 97 // query 98 98 $sql = "SELECT * FROM ".$blog_info['mb_table_prefix']."posts WHERE ID=$post_id"; 99 $post_row = $ db->fetchArray( $db->query( $sql ) ) ;99 $post_row = $xoopsDB->fetchArray( $xoopsDB->query( $sql ) ) ; 100 100 if( empty( $post_row ) ) return false ; 101 101 if ($post_row['comment_status'] == 'open') … … 176 176 function validate_id( $link_id ) 177 177 { 178 global $xoopsDB; 178 179 global $forum_id; 179 180 $post_id = intval( $link_id ) ; … … 181 182 $xpress_prefix = preg_replace('/wordpress/','wp',$mydirname); 182 183 $blog_info = $this->get_comment_blog_info($forum_id); 183 $db =& Database::getInstance() ; 184 185 list( $count ) = $db->fetchRow( $db->query( "SELECT COUNT(*) FROM ".$blog_info['mb_table_prefix'] ."posts WHERE ID=$post_id AND comment_status ='open'" ) ) ; 184 185 list( $count ) = $xoopsDB->fetchRow( $xoopsDB->query( "SELECT COUNT(*) FROM ".$blog_info['mb_table_prefix'] ."posts WHERE ID=$post_id AND comment_status ='open'" ) ) ; 186 186 187 187 if( $count <= 0 ) return false ; … … 206 206 function processCommentNotifications( $mode , $link_id , $forum_id , $topic_id , $post_id ) 207 207 { 208 global $xoopsDB; 208 209 $blog_info = $this->get_comment_blog_info($forum_id); 209 210 $wp_full_prefix = $blog_info['mb_table_prefix']; 210 211 211 $db =& Database::getInstance() ;212 212 $myts =& MyTextsanitizer::getInstance() ; 213 213 … … 225 225 $table_term_taxonomy = $wp_full_prefix."term_taxonomy"; 226 226 $table_terms = $wp_full_prefix."terms"; 227 $table_categories = $ db->prefix($xpress_prefix."_categories");228 $table_post2cat = $ db->prefix($xpress_prefix."_post2cat");227 $table_categories = $xoopsDB->prefix($xpress_prefix."_categories"); 228 $table_post2cat = $xoopsDB->prefix($xpress_prefix."_post2cat"); 229 229 $wp_post = $wp_full_prefix."posts"; 230 230 $wp_options = $wp_full_prefix."options"; 231 $wp_users = $ db->prefix($xpress_prefix."_users");231 $wp_users = $xoopsDB->prefix($xpress_prefix."_users"); 232 232 233 233 $sql = "SELECT option_value FROM $wp_options WHERE option_name ='blogname'"; 234 $blog_row = $ db->fetchArray( $db->query( $sql ) ) ;234 $blog_row = $xoopsDB->fetchArray( $xoopsDB->query( $sql ) ) ; 235 235 if( empty( $blog_row ) ) return false; 236 236 $blog_name = $blog_row['option_value']; … … 239 239 // query 240 240 $sql = "SELECT * FROM ".$wp_post." WHERE ID=$link_id "; 241 $post_row = $ db->fetchArray( $db->query( $sql ) ) ;241 $post_row = $xoopsDB->fetchArray( $xoopsDB->query( $sql ) ) ; 242 242 if( empty( $post_row ) ) return false; 243 243 $post_title = $post_row['post_title']; … … 245 245 246 246 $sql = "SELECT display_name FROM $wp_users WHERE ID ='$post_author'"; 247 $blog_row = $ db->fetchArray( $db->query( $sql ) ) ;247 $blog_row = $xoopsDB->fetchArray( $xoopsDB->query( $sql ) ) ; 248 248 if( empty( $blog_row ) ) return false; 249 249 $user_name = $blog_row['display_name']; … … 263 263 $notification_handler->triggerEvent( 'post' , $link_id , 'comment' , $comment_tags , false , $not_modid ) ; 264 264 265 $post_row = $ db->fetchArray( $db->query( "SELECT * FROM ".$db->prefix($this->d3forum_dirname."_posts")." WHERE post_id=$post_id" ) ) ;265 $post_row = $xoopsDB->fetchArray( $xoopsDB->query( "SELECT * FROM ".$xoopsDB->prefix($this->d3forum_dirname."_posts")." WHERE post_id=$post_id" ) ) ; 266 266 if( !empty( $post_row ) ){ 267 267 if ( $post_row['approval'] ==0 ){ … … 279 279 $sql2 .= "WHERE ($table_term_relationships.object_id =" . $link_id.") AND ($table_term_taxonomy.taxonomy='category')"; 280 280 } 281 $res2 = $ db->query($sql2);282 while($row2 = $ db->fetchArray($res2)){281 $res2 = $xoopsDB->query($sql2); 282 while($row2 = $xoopsDB->fetchArray($res2)){ 283 283 $cat_id = $row2['cat_ID']; 284 284 $cat_name = $row2['cat_name']; … … 291 291 292 292 function sync_to_wp_comment( $mode , $link_id , $forum_id , $topic_id , $post_id = 0 ){ 293 294 global $xoopsDB; 293 295 294 296 $blog_info = $this->get_comment_blog_info($forum_id); … … 302 304 $d3f_prefix = $d3f_forum_dir; 303 305 $myts =& MyTextSanitizer::getInstance(); 304 $xoopsDB =& Database::getInstance();305 306 306 307 $wp_comments = $wp_full_prefix . 'comments'; … … 441 442 } 442 443 function get_wp_comment_ID($d3forum_post_ID){ 444 global $xoopsDB; 445 443 446 $xp_prefix = $wpdirname = basename( dirname( dirname( __FILE__ ) ) ) ; 444 447 $xp_prefix = preg_replace('/wordpress/','wp',$xp_prefix); 445 448 446 $xoopsDB =& Database::getInstance();447 449 $wp_d3forum_link = $xoopsDB->prefix($xp_prefix . '_d3forum_link'); 448 450 … … 458 460 459 461 function get_comment_blog_info($d3forum_forum_id){ 460 $xoopsDB =& Database::getInstance();462 global $xoopsDB; 461 463 $xp_prefix = $wpdirname = basename( dirname( dirname( __FILE__ ) ) ) ; 462 464 $xp_prefix = preg_replace('/wordpress/','wp',$xp_prefix);
Note: See TracChangeset
for help on using the changeset viewer.