From 9aa229641a99ff829ca44692eb07b4529e876761 Mon Sep 17 00:00:00 2001 From: Nick Palmer Date: Tue, 22 Dec 2009 14:12:41 +0000 Subject: Lookup board email address using LOWER since we lowercase the address from the email. --- admin/boardsync_inc.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/admin/boardsync_inc.php b/admin/boardsync_inc.php index 3dcc3d8..690fac4 100644 --- a/admin/boardsync_inc.php +++ b/admin/boardsync_inc.php @@ -188,17 +188,19 @@ function board_sync_get_user( $pFrom ) { return $gBitUser->getUserInfo( array( 'user_id'=>-1 ) ); } -function cache_check_content_prefs( $pName, $pValue ) { +function cache_check_content_prefs( $pName, $pValue, $pLower = FALSE ) { global $gBitDb, $gBitSystem; static $prefs; - if( empty($prefs[$pName]) ) { + if( empty($prefs[$pLower][$pName]) ) { $bindVars = array( $pName ); - $prefs[$pName] = $gBitDb->getAssoc( "SELECT `pref_value`, `content_id` FROM `".BIT_DB_PREFIX."liberty_content_prefs` WHERE `pref_name`=?", $bindVars ); + $prefs[$pLower][$pName] = $gBitDb->getAssoc( "SELECT " . + ($pLower ? 'LOWER(`pref_value`)' : '`pref_value`'). + ", `content_id` FROM `".BIT_DB_PREFIX."liberty_content_prefs` WHERE `pref_name`=?", $bindVars ); } - if( !empty($prefs[$pName][$pValue]) ) { - return $prefs[$pName][$pValue]; + if( !empty($prefs[$pLower][$pName][$pValue]) ) { + return $prefs[$pLower][$pName][$pValue]; } return NULL; @@ -272,7 +274,7 @@ function board_sync_process_message( $pMbox, $pMsgNum, $pMsgHeader, $pMsgStructu foreach( $toAddresses AS $to ) { if ($pLog) print( " Processing email: " . strtolower($to['email']) . "\n"); // get a board match for the email address - if( $boardContentId = cache_check_content_prefs( 'board_sync_list_address', strtolower($to['email']) ) ) { + if( $boardContentId = cache_check_content_prefs( 'board_sync_list_address', strtolower($to['email']), TRUE ) ) { if ($pLog) print "Found Board Content $boardContentId for $to[email]\n"; if( !empty( $in_reply_to ) ) { if( $parent = $gBitDb->GetRow( "SELECT `content_id`, `root_id` FROM `".BIT_DB_PREFIX."liberty_comments` WHERE `message_guid`=?", array( $in_reply_to ) ) ) { -- cgit v1.3