- Timestamp:
- Jun 8, 2009, 11:46:24 AM (15 years ago)
- Location:
- trunk/xpressme_integration_kit
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/xpressme_integration_kit/class/xpressD3commentContent.class.php
r257 r261 272 272 function sync_to_wp_comment( $mode , $link_id , $forum_id , $topic_id , $post_id = 0 ){ 273 273 274 $mydirname = basename( dirname( dirname( __FILE__ ) ) );274 $mydirname = $this->mydirname ; 275 275 $xpress_prefix = $mydirname; 276 276 if ($xpress_prefix == 'wordpress') $xpress_prefix = 'wp'; … … 330 330 $comment_approved = "'" . $d3f_row['approval'] . "'"; 331 331 require_once (XOOPS_ROOT_PATH . '/modules/'.$mydirname . '/include/general_functions.php'); 332 $user_ID = xoops_uid_to_wp_uid($d3f_row['uid'] );332 $user_ID = xoops_uid_to_wp_uid($d3f_row['uid'],$mydirname); 333 333 $comment_date_gmt = "'" . gmdate('Y-m-d H:i:s' , $d3f_row['post_time']) . "'"; 334 334 $comment_type = ''; -
trunk/xpressme_integration_kit/include/data.inc.php
r257 r261 92 92 $ret[$i]['cat_name'] = $row2['cat_name']; 93 93 94 $ret[$i]['uid'] = wp_uid_to_xoops_uid($row1['post_author'] );94 $ret[$i]['uid'] = wp_uid_to_xoops_uid($row1['post_author'],$mydirname); 95 95 $ret[$i]['replies'] = $row1['comment_count']; 96 96 -
trunk/xpressme_integration_kit/include/general_functions.php
r257 r261 8 8 * @package module::xpress 9 9 */ 10 if (!function_exists('wp_uid_to_xoops_uid')){ 11 function wp_uid_to_xoops_uid($wp_uid = '',$mydirname){ 12 global $xoopsDB,$xoops_db; 13 if (empty($mydirname)) 14 $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ; 10 15 11 function wp_uid_to_xoops_uid($wp_uid = ''){ 12 global $xoopsDB,$xoops_db; 13 $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ; 16 if ($mydirname == 'wordpress'){ 17 $wp_prefix = 'wp'; 18 } else { 19 $wp_prefix = $mydirname; 20 } 14 21 15 if ($mydirname == 'wordpress'){ 16 $wp_prefix = 'wp'; 17 } else { 18 $wp_prefix = $mydirname; 22 if (empty($xoops_db)) { // not load XPressME 23 $xoops_user_tbl = $xoopsDB->prefix('users'); 24 $wp_user_tbl = $xoopsDB->prefix($wp_prefix . "_users"); 25 26 $wp_user_SQL ="SELECT user_login FROM $wp_user_tbl WHERE ID = $wp_uid "; 27 $wp_user_Res = $xoopsDB->query($wp_user_SQL, 0, 0); 28 if ($xoopsDB->getRowsNum($wp_user_Res) > 0){ 29 $wp_user_Row = $xoopsDB->fetchArray($wp_user_Res); 30 $wp_user_name = $wp_user_Row['user_login']; 31 32 $xoops_user_SQL ="SELECT uid FROM $xoops_user_tbl WHERE uname LIKE '$wp_user_name'"; 33 $xoops_user_Res = $xoopsDB->query($xoops_user_SQL, 0, 0); 34 if ($xoopsDB->getRowsNum($xoops_user_Res) > 0){ 35 $xoops_user_Row = $xoopsDB->fetchArray($xoops_user_Res); 36 $xoops_uid = $xoops_user_Row['uid']; 37 return $xoops_uid; 38 } 39 } 40 return 0; 41 } else { // load XPressME or not Load XOOPS 42 $xoops_user_tbl = get_xoops_prefix() . 'users'; 43 $wp_user_tbl = get_wp_prefix() . 'users'; 44 $wp_user_name = $xoops_db->get_var("SELECT user_login FROM $wp_user_tbl WHERE ID = $wp_uid "); 45 if (empty($wp_user_name)) return 0; 46 $xoops_uid = $xoops_db->get_var("SELECT uid FROM $xoops_user_tbl WHERE uname LIKE '$wp_user_name'"); 47 if (!empty($xoops_uid)) return $xoops_uid; else return 0; 48 } 19 49 } 50 } 20 51 21 if (empty($xoops_db)) { // not load XPressME 22 $xoops_user_tbl = $xoopsDB->prefix('users'); 23 $wp_user_tbl = $xoopsDB->prefix($wp_prefix . "_users"); 52 if (!function_exists('xoops_uid_to_wp_uid')){ 53 function xoops_uid_to_wp_uid($xoops_uid = '',$mydirname){ 54 global $xoopsDB,$xoops_db; 55 if (empty($mydirname)) 56 $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ; 24 57 25 $wp_user_SQL ="SELECT user_login FROM $wp_user_tbl WHERE ID = $wp_uid "; 26 $wp_user_Res = $xoopsDB->query($wp_user_SQL, 0, 0); 27 if ($xoopsDB->getRowsNum($wp_user_Res) > 0){ 28 $wp_user_Row = $xoopsDB->fetchArray($wp_user_Res); 29 $wp_user_name = $wp_user_Row['user_login']; 30 31 $xoops_user_SQL ="SELECT uid FROM $xoops_user_tbl WHERE uname LIKE '$wp_user_name'"; 58 if ($mydirname == 'wordpress'){ 59 $wp_prefix = 'wp'; 60 } else { 61 $wp_prefix = $mydirname; 62 } 63 64 if (empty($xoops_db)) { // not load XPressME 65 $xoops_user_tbl = $xoopsDB->prefix('users'); 66 $wp_user_tbl = $xoopsDB->prefix($wp_prefix . "_users"); 67 68 $xoops_user_SQL ="SELECT uname FROM $xoops_user_tbl WHERE uid = $xoops_uid"; 32 69 $xoops_user_Res = $xoopsDB->query($xoops_user_SQL, 0, 0); 33 70 if ($xoopsDB->getRowsNum($xoops_user_Res) > 0){ 34 71 $xoops_user_Row = $xoopsDB->fetchArray($xoops_user_Res); 35 $xoops_uid = $xoops_user_Row['uid']; 36 return $xoops_uid; 72 $xoops_user_name = $xoops_user_Row['uname']; 73 74 $wp_user_SQL ="SELECT ID FROM $wp_user_tbl WHERE user_login LIKE '$xoops_user_name'"; 75 $wp_user_Res = $xoopsDB->query($wp_user_SQL, 0, 0); 76 if ($xoopsDB->getRowsNum($wp_user_Res) > 0){ 77 $wp_user_Row = $xoopsDB->fetchArray($wp_user_Res); 78 $wp_user_id = $wp_user_Row['ID']; 79 return $wp_user_id; 80 } 37 81 } 38 }39 return 0;40 } else { // load XPressME or not Load XOOPS41 $xoops_user_tbl = get_xoops_prefix() . 'users';42 $wp_user_tbl = get_wp_prefix() . 'users';43 $wp_user_name = $xoops_db->get_var("SELECT user_login FROM $wp_user_tbl WHERE ID = $wp_uid ");44 if (empty($wp_user_name)) return 0;45 $xoops_uid = $xoops_db->get_var("SELECT uid FROM $xoops_user_tbl WHERE uname LIKE '$wp_user_name'");46 if (!empty($xoops_uid)) return $xoops_uid; else return 0;82 return 0; 83 } else { // load XPressME or not Load XOOPS 84 $xoops_user_tbl = get_xoops_prefix() . 'users'; 85 $wp_user_tbl = get_wp_prefix() . 'users'; 86 $xoops_user_name = $xoops_db->get_var("SELECT uname FROM $xoops_user_tbl WHERE uid = $xoops_uid"); 87 if (empty($xoops_user_name)) return 0; 88 $wp_user_id = $xoops_db->get_var("SELECT ID FROM $wp_user_tbl WHERE user_login LIKE '$xoops_user_name'"); 89 if (!empty($wp_user_id)) return $wp_user_id; else return 0; 90 } 47 91 } 48 92 } 49 function xoops_uid_to_wp_uid($xoops_uid = ''){50 global $xoopsDB,$xoops_db;51 $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;52 53 if ($mydirname == 'wordpress'){54 $wp_prefix = 'wp';55 } else {56 $wp_prefix = $mydirname;57 }58 59 if (empty($xoops_db)) { // not load XPressME60 $xoops_user_tbl = $xoopsDB->prefix('users');61 $wp_user_tbl = $xoopsDB->prefix($wp_prefix . "_users");62 63 $xoops_user_SQL ="SELECT uname FROM $xoops_user_tbl WHERE uid = $xoops_uid";64 $xoops_user_Res = $xoopsDB->query($xoops_user_SQL, 0, 0);65 if ($xoopsDB->getRowsNum($xoops_user_Res) > 0){66 $xoops_user_Row = $xoopsDB->fetchArray($xoops_user_Res);67 $xoops_user_name = $xoops_user_Row['uname'];68 69 $wp_user_SQL ="SELECT ID FROM $wp_user_tbl WHERE user_login LIKE '$xoops_user_name'";70 $wp_user_Res = $xoopsDB->query($wp_user_SQL, 0, 0);71 if ($xoopsDB->getRowsNum($wp_user_Res) > 0){72 $wp_user_Row = $xoopsDB->fetchArray($wp_user_Res);73 $wp_user_id = $wp_user_Row['ID'];74 return $wp_user_id;75 }76 }77 return 0;78 } else { // load XPressME or not Load XOOPS79 $xoops_user_tbl = get_xoops_prefix() . 'users';80 $wp_user_tbl = get_wp_prefix() . 'users';81 $xoops_user_name = $xoops_db->get_var("SELECT uname FROM $xoops_user_tbl WHERE uid = $xoops_uid");82 if (empty($xoops_user_name)) return 0;83 $wp_user_id = $xoops_db->get_var("SELECT ID FROM $wp_user_tbl WHERE user_login LIKE '$xoops_user_name'");84 if (!empty($wp_user_id)) return $wp_user_id; else return 0;85 }86 87 }88 93 ?> -
trunk/xpressme_integration_kit/include/search.php
r257 r261 34 34 } 35 35 if ($userid) { 36 $userid = xoops_uid_to_wp_uid(intval($userid) );36 $userid = xoops_uid_to_wp_uid(intval($userid),$mydirname); 37 37 $where .= " AND (post_author=".$userid.")"; 38 38 } … … 72 72 $ss = substr($date_str,17,2); 73 73 $ret[$i]['time'] = mktime( $hh,$nn,$ss,$mm,$dd,$yyyy); 74 $ret[$i]['uid'] = wp_uid_to_xoops_uid($myrow['post_author'] );74 $ret[$i]['uid'] = wp_uid_to_xoops_uid($myrow['post_author'],$mydirname); 75 75 // $ret[$i]['page'] = $myts->htmlSpecialChars($myrow['post_title']); 76 76 -
trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/d3forum_comment_synchro.php
r257 r261 458 458 // The content is reflected in the D3Forum comment when there is a change in the WordPress comment. 459 459 function wp_comment_sync_to_d3forum($comment_ID = 0,$sync_mode){ 460 global $xpress_config,$xoops_db ;460 global $xpress_config,$xoops_db,$xoops_config; 461 461 462 462 if (!is_d3forum_setting()) die('The setting of the D3Forum comment integration is wrong. '); 463 $mydirname = $xoops_config->module_name; 463 464 464 465 $d3f_forum_id = $xpress_config->d3forum_forum_id; … … 494 495 $modified_time = strtotime($row->comment_date); // or $row2['comment_date_gmt'] 495 496 require_once (get_xpress_dir_path() . 'include/general_functions.php'); 496 $uid = wp_uid_to_xoops_uid($row->user_id );497 $uid = wp_uid_to_xoops_uid($row->user_id,$mydirname); 497 498 $poster_ip = "'" . addslashes($row->comment_author_IP ). "'"; 498 499 $modifier_ip = "'" . addslashes($row->comment_author_IP) . "'";
Note: See TracChangeset
for help on using the changeset viewer.