/**
  * init one social by condition
  *
  * @return  Mixed
  */
 public function initOMbqEtSocial($row, $mbqOpt)
 {
     if ($mbqOpt['case'] == 'alert') {
         global $db;
         $notification = $row->__get('notification_data');
         $lang = array('reply_to_you' => "%s replied to \"%s\"", 'quote_to_you' => '%s quoted your post in thread "%s"', 'tag_to_you' => '%s mentioned you in thread "%s"', 'post_new_topic' => '%s started a new thread "%s"', 'like_your_thread' => '%s liked your post in thread "%s"', 'pm_to_you' => '%s sent you a message "%s"');
         $oMbqEtAlert = MbqMain::$oClk->newObj('MbqEtAlert');
         switch ($row->__get('notification_type_name')) {
             case 'notification.type.topic':
                 $oMbqEtAlert->userId->setOriValue($notification['poster_id']);
                 $oMbqEtAlert->message->setOriValue(sprintf($lang['post_new_topic'], $oMbqEtAlert->username->oriValue, $notification['topic_title']));
                 $oMbqEtAlert->contentType->setOriValue('newtopic');
                 $oMbqEtAlert->topicId->setOriValue($row->__get('item_id'));
                 $sql = 'SELECT topic_first_post_id
                 FROM ' . TOPICS_TABLE . ' t
                 WHERE t.forum_id = ' . $row->__get('item_parent_id') . '
                 AND t.topic_id = ' . $row->__get('item_id');
                 $result = $db->sql_query($sql);
                 $topic_first_post_id = (int) $db->sql_fetchfield('topic_first_post_id');
                 $db->sql_freeresult($result);
                 $oMbqEtAlert->contentId->setOriValue($topic_first_post_id);
                 break;
             case 'notification.type.quote':
                 $oMbqEtAlert->userId->setOriValue($notification['poster_id']);
                 $oMbqEtAlert->message->setOriValue(sprintf($lang['quote_to_you'], $oMbqEtAlert->username->oriValue, $notification['topic_title']));
                 $oMbqEtAlert->contentType->setOriValue('quote');
                 $oMbqEtAlert->contentId->setOriValue($row->__get('item_id'));
                 $oMbqEtAlert->topicId->setOriValue($row->__get('item_parent_id'));
                 break;
             case 'notification.type.post':
                 $oMbqEtAlert->userId->setOriValue($notification['poster_id']);
                 $oMbqEtAlert->message->setOriValue(sprintf($lang['reply_to_you'], $oMbqEtAlert->username->oriValue, $notification['topic_title']));
                 $oMbqEtAlert->contentType->setOriValue('sub');
                 $oMbqEtAlert->contentId->setOriValue($row->__get('item_id'));
                 $oMbqEtAlert->topicId->setOriValue($row->__get('item_parent_id'));
                 break;
             case 'notification.type.pm':
                 $oMbqEtAlert->userId->setOriValue($notification['from_user_id']);
                 $oMbqEtAlert->message->setOriValue(sprintf($lang['pm_to_you'], $oMbqEtAlert->username->oriValue, $notification['message_subject']));
                 $oMbqEtAlert->contentType->setOriValue('pm');
                 $oMbqEtAlert->contentId->setOriValue($row->__get('item_id'));
                 break;
         }
         $oMbqEtAlert->username->setOriValue(get_name_by_userid($oMbqEtAlert->userId->oriValue));
         $avatars = get_user_avatars($oMbqEtAlert->userId->oriValue);
         if (sizeof($avatars) == 1) {
             $oMbqEtAlert->iconUrl->setOriValue($avatars[$oMbqEtAlert->userId->oriValue]);
         }
         $oMbqEtAlert->timestamp->setOriValue($row->__get('notification_time'));
         $oMbqEtAlert->isUnread->setOriValue($row->__get('notification_read') == 0);
         return $oMbqEtAlert;
     } else {
         MbqError::alert('', __METHOD__ . ',line:' . __LINE__ . '.' . MBQ_ERR_INFO_UNKNOWN_CASE);
     }
 }
function get_participated_user_avatars($tids)
{
    global $db, $topic_users, $user_avatar;
    $topic_users = array();
    $user_avatar = array();
    if (!empty($tids)) {
        $posters = array();
        foreach ($tids as $tid) {
            $sql = 'SELECT poster_id, count(post_id) as num FROM ' . POSTS_TABLE . '
                    WHERE topic_id=' . $tid . '
                    GROUP BY poster_id
                    ORDER BY num DESC';
            $result = $db->sql_query_limit($sql, 10);
            while ($row = $db->sql_fetchrow($result)) {
                $posters[$row['poster_id']] = $row['num'];
                $topic_users[$tid][] = $row['poster_id'];
            }
            $db->sql_freeresult($result);
        }
        if (!empty($posters)) {
            $user_avatar = get_user_avatars(array_keys($posters));
        }
    }
}