diff options
-rw-r--r-- | classes/Memcached_DataObject.php | 5 | ||||
-rw-r--r-- | lib/util.php | 12 | ||||
-rw-r--r-- | plugins/TwitterBridge/twitter.php | 9 |
3 files changed, 21 insertions, 5 deletions
diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index 70e9e351d..d8b0db5a6 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -107,6 +107,11 @@ class Memcached_DataObject extends DB_DataObject } static function cacheKey($cls, $k, $v) { + if (is_object($cls) || is_object($j) || is_object($v)) { + $e = new Exception(); + common_log(LOG_ERR, __METHOD__ . ' object in param: ' . + str_replace("\n", " ", $e->getTraceAsString())); + } return common_cache_key(strtolower($cls).':'.$k.':'.$v); } diff --git a/lib/util.php b/lib/util.php index af4885f40..ed81aeba1 100644 --- a/lib/util.php +++ b/lib/util.php @@ -91,8 +91,16 @@ function common_language() if (_have_config() && common_logged_in()) { $user = common_current_user(); $user_language = $user->language; - if ($user_language) - return $user_language; + + if ($user->language) { + // Validate -- we don't want to end up with a bogus code + // left over from some old junk. + foreach (common_config('site', 'languages') as $code => $info) { + if ($info['lang'] == $user_language) { + return $user_language; + } + } + } } // Otherwise, find the best match for the languages requested by the diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php index 003b52682..e133ce6f7 100644 --- a/plugins/TwitterBridge/twitter.php +++ b/plugins/TwitterBridge/twitter.php @@ -170,8 +170,6 @@ function broadcast_twitter($notice) function broadcast_oauth($notice, $flink) { $user = $flink->getUser(); $statustxt = format_status($notice); - // Convert !groups to #hashes - $statustxt = preg_replace('/(^|\s)!([A-Za-z0-9]{1,64})/', "\\1#\\2", $statustxt); $token = TwitterOAuthClient::unpackToken($flink->credentials); $client = new TwitterOAuthClient($token->key, $token->secret); $status = null; @@ -290,7 +288,12 @@ function process_error($e, $flink, $notice) function format_status($notice) { // XXX: Hack to get around PHP cURL's use of @ being a a meta character - return preg_replace('/^@/', ' @', $notice->content); + $statustxt = preg_replace('/^@/', ' @', $notice->content); + + // Convert !groups to #hashes + $statustxt = preg_replace('/(^|\s)!([A-Za-z0-9]{1,64})/', "\\1#\\2", $statustxt); + + return $statustxt; } function remove_twitter_link($flink) |