Example #1
0
    public function messagelist()
    {
        $offset = (int) qa_get('offset');
        $offset = isset($offset) ? $offset * 15 : 0;
        require_once QA_INCLUDE_DIR . 'qa-db-users.php';
        // Get Events
        $message_events = array('u_message', 'u_wall_post');
        $events = "'" . implode("','", $message_events) . "'";
        $userid = qa_get_logged_in_userid();
        $eventslist = qa_db_read_all_assoc(qa_db_query_sub('SELECT id, UNIX_TIMESTAMP(datetime) AS datetime, userid, postid, effecteduserid, event, params, `read` FROM ^ra_userevent WHERE effecteduserid=# AND `read` = 0 AND event IN (' . $events . ') ORDER BY id DESC LIMIT 15 OFFSET #', $userid, $offset));
        if (count($eventslist) > 0) {
            $event = array();
            $userids = array();
            foreach ($eventslist as $event) {
                $userids[$event['userid']] = $event['userid'];
                $userids[$event['effecteduserid']] = $event['effecteduserid'];
            }
            if (QA_FINAL_EXTERNAL_USERS) {
                $handles = qa_get_public_from_userids($userids);
            } else {
                $handles = qa_db_user_get_userid_handles($userids);
            }
            // get event's: time, type, parameters
            // get post id of questions
            foreach ($eventslist as $event) {
                $title = '';
                $link = '';
                $handle = $handles[$event['userid']];
                $reciever_handle = $handles[$event['effecteduserid']];
                $reciever_link = qa_path('user/' . $reciever_handle);
                $datetime = $event['datetime'];
                $event['date'] = qa_html(qa_time_to_string(qa_opt('db_time') - $datetime));
                $event['params'] = json_decode($event['params'], true);
                $message = substr($event['params']['message'], 0, 30) . '..';
                $id = ' data-id="' . $event['id'] . '"';
                $read = $event['read'] ? ' read' : ' unread';
                $url_param = array('ra_notification' => $event['id']);
                $user_link = qa_path_html('user/' . $handle, $url_param);
                switch ($event['event']) {
                    case 'u_message':
                        // related question to an answer
                        echo '<div class="event-content clearfix' . $read . '"' . $id . '>
								<div class="avatar"><a href="' . $user_link . '">' . ra_get_avatar($handle, 32, true) . '</a></div>
								<div class="event-right">
									<a href="' . qa_path_html('message/' . $handle, $url_param, QW_BASE_URL) . '">
										<div class="head">
											<strong class="user">' . $handle . '</strong>
											<span class="what">' . qa_lang_html('dude/sent_you_a_private_message') . '</span>
											<span class="message">' . $message . '</span>
										</div>
										<div class="footer">
											<span class="event-icon icon-email"></span>
											<span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
										</div>
									</a>
								</div>
							</div>';
                        break;
                    case 'u_wall_post':
                        // user's question had been answered
                        $url = qa_path_html('user/' . $reciever_handle . '/wall', $url_param, QW_BASE_URL);
                        echo '<div class="event-content clearfix' . $read . '"' . $id . '>
								<div class="avatar"><a href="' . $user_link . '">' . ra_get_avatar($handle, 32, true) . '</a></div>
								<div class="event-right">
									<a href="' . $url . '">
										<div class="head">
											<strong class="user">' . $handle . '</strong>
											<span class="what">' . qa_lang_html('dude/posted_on_your_wall') . '</span>
											<span class="message">' . $message . '</span>
										</div>
										<div class="footer">
											<span class="event-icon icon-pin"></span>
											<span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
										</div>
									</a>
								</div>
							</div>';
                        break;
                }
            }
        } else {
            echo '<div class="no-more-activity">' . qa_lang_html('dude/no_more_messages') . '</div>';
        }
        die;
    }
Example #2
0
     }
 }
 if (count($showpermits)) {
     $qa_content['form_profile']['fields']['permits'] = array('type' => 'static', 'label' => qa_lang_html('profile/extra_privileges'), 'value' => qa_html(implode("\n", $showpermits), true), 'rows' => count($showpermits));
 }
 //	Show email address only if we're an administrator
 if ($loginlevel >= QA_USER_LEVEL_ADMIN && !qa_user_permit_error()) {
     $doconfirms = qa_opt('confirm_user_emails') && $useraccount['level'] < QA_USER_LEVEL_EXPERT;
     $isconfirmed = $useraccount['flags'] & QA_USER_FLAGS_EMAIL_CONFIRMED ? true : false;
     $qa_content['form_profile']['fields']['email'] = array('type' => $userediting ? 'text' : 'static', 'label' => qa_lang_html('users/email_label'), 'tags' => 'NAME="email"', 'value' => qa_html(isset($inemail) ? $inemail : $useraccount['email']), 'error' => qa_html(@$errors['email']), 'note' => ($doconfirms ? qa_lang_html($isconfirmed ? 'users/email_confirmed' : 'users/email_not_confirmed') . ' ' : '') . qa_lang_html('users/only_shown_admins'));
 }
 //	Show IP addresses and times for last login or write - only if we're a moderator or higher
 if ($loginlevel >= QA_USER_LEVEL_MODERATOR && !qa_user_permit_error()) {
     $qa_content['form_profile']['fields']['lastlogin'] = array('type' => 'static', 'label' => qa_lang_html('users/last_login_label'), 'value' => strtr(qa_lang_html('users/x_ago_from_y'), array('^1' => qa_time_to_string(qa_opt('db_time') - $useraccount['loggedin']), '^2' => qa_ip_anchor_html($useraccount['loginip']))), 'note' => qa_lang_html('users/only_shown_moderators'));
     if (isset($useraccount['written'])) {
         $qa_content['form_profile']['fields']['lastwrite'] = array('type' => 'static', 'label' => qa_lang_html('users/last_write_label'), 'value' => strtr(qa_lang_html('users/x_ago_from_y'), array('^1' => qa_time_to_string(qa_opt('db_time') - $useraccount['written']), '^2' => qa_ip_anchor_html($useraccount['writeip']))), 'note' => qa_lang_html('users/only_shown_moderators'));
     } else {
         unset($qa_content['form_profile']['fields']['lastwrite']);
     }
 }
 //	Show other profile fields
 $fieldsediting = $fieldseditable && $userediting;
 foreach ($userfields as $userfield) {
     if ($userfield['flags'] & QA_FIELD_FLAGS_LINK_URL && !$fieldsediting) {
         $valuehtml = qa_url_to_html_link(@$userprofile[$userfield['title']], qa_opt('links_in_new_window'));
     } else {
         $value = @$inprofile[$userfield['fieldid']];
         if (!isset($value)) {
             $value = @$userprofile[$userfield['title']];
         }
         $valuehtml = qa_html($value, $userfield['flags'] & QA_FIELD_FLAGS_MULTI_LINE && !$fieldsediting ? true : false);
        if (empty($errors)) {
            qa_db_user_set_password($userid, $innewpassword1);
            qa_db_user_set($userid, 'sessioncode', '');
            // stop old 'Remember me' style logins from still working
            qa_set_logged_in_user($userid, $useraccount['handle'], false, $useraccount['sessionsource']);
            // reinstate this specific session
            qa_report_event('u_password', $userid, $useraccount['handle'], qa_cookie_get());
            qa_redirect('account', array('state' => 'password-changed'));
        }
    }
}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('profile/my_account_title');
$qa_content['error'] = @$errors['page'];
$qa_content['form_profile'] = array('tags' => 'enctype="multipart/form-data" method="post" action="' . qa_self_html() . '"', 'style' => 'wide', 'fields' => array('duration' => array('type' => 'static', 'label' => qa_lang_html('users/member_for'), 'value' => qa_time_to_string(qa_opt('db_time') - $useraccount['created'])), 'type' => array('type' => 'static', 'label' => qa_lang_html('users/member_type'), 'value' => qa_html(qa_user_level_string($useraccount['level'])), 'note' => $isblocked ? qa_lang_html('users/user_blocked') : null), 'handle' => array('label' => qa_lang_html('users/handle_label'), 'tags' => 'name="handle"', 'value' => qa_html(isset($inhandle) ? $inhandle : $useraccount['handle']), 'error' => qa_html(@$errors['handle']), 'type' => $changehandle && !$isblocked ? 'text' : 'static'), 'email' => array('label' => qa_lang_html('users/email_label'), 'tags' => 'name="email"', 'value' => qa_html(isset($inemail) ? $inemail : $useraccount['email']), 'error' => isset($errors['email']) ? qa_html($errors['email']) : ($doconfirms && !$isconfirmed ? qa_insert_login_links(qa_lang_html('users/email_please_confirm')) : null), 'type' => $isblocked ? 'static' : 'text'), 'messages' => array('label' => qa_lang_html('users/private_messages'), 'tags' => 'name="messages"', 'type' => 'checkbox', 'value' => !($useraccount['flags'] & QA_USER_FLAGS_NO_MESSAGES), 'note' => qa_lang_html('users/private_messages_explanation')), 'wall' => array('label' => qa_lang_html('users/wall_posts'), 'tags' => 'name="wall"', 'type' => 'checkbox', 'value' => !($useraccount['flags'] & QA_USER_FLAGS_NO_WALL_POSTS), 'note' => qa_lang_html('users/wall_posts_explanation')), 'mailings' => array('label' => qa_lang_html('users/mass_mailings'), 'tags' => 'name="mailings"', 'type' => 'checkbox', 'value' => !($useraccount['flags'] & QA_USER_FLAGS_NO_MAILINGS), 'note' => qa_lang_html('users/mass_mailings_explanation')), 'avatar' => null), 'buttons' => array('save' => array('tags' => 'onclick="qa_show_waiting_after(this, false);"', 'label' => qa_lang_html('users/save_profile'))), 'hidden' => array('dosaveprofile' => '1', 'code' => qa_get_form_security_code('account')));
if (qa_get_state() == 'profile-saved') {
    $qa_content['form_profile']['ok'] = qa_lang_html('users/profile_saved');
}
if (!qa_opt('allow_private_messages')) {
    unset($qa_content['form_profile']['fields']['messages']);
}
if (!qa_opt('allow_user_walls')) {
    unset($qa_content['form_profile']['fields']['wall']);
}
if (!qa_opt('mailing_enabled')) {
    unset($qa_content['form_profile']['fields']['mailings']);
}
if ($isblocked) {
    unset($qa_content['form_profile']['buttons']['save']);
    $qa_content['error'] = qa_lang_html('users/no_permission');
        $errors['newpassword2'] = qa_lang('users/password_mismatch');
    }
    if (empty($errors)) {
        qa_db_user_set_password($userid, $innewpassword1);
        qa_db_user_set($userid, 'sessioncode', '');
        // stop old 'Remember me' style logins from still working
        qa_set_logged_in_user($userid, $useraccount['handle'], false, $useraccount['sessionsource']);
        // reinstate this specific session
        qa_report_event('u_password', $userid, $useraccount['handle'], qa_cookie_get());
        qa_redirect('account', array('state' => 'password-changed'));
    }
}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('profile/my_account_title');
$qa_content['form_profile'] = array('tags' => 'ENCTYPE="multipart/form-data" METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'wide', 'fields' => array('duration' => array('type' => 'static', 'label' => qa_lang_html('users/member_for'), 'value' => qa_time_to_string(qa_opt('db_time') - $useraccount['created'])), 'type' => array('type' => 'static', 'label' => qa_lang_html('users/member_type'), 'value' => qa_html(qa_user_level_string($useraccount['level']))), 'handle' => array('label' => qa_lang_html('users/handle_label'), 'tags' => 'NAME="handle"', 'value' => qa_html(isset($inhandle) ? $inhandle : $useraccount['handle']), 'error' => qa_html(@$errors['handle']), 'type' => $changehandle ? 'text' : 'static'), 'email' => array('label' => qa_lang_html('users/email_label'), 'tags' => 'NAME="email"', 'value' => qa_html(isset($inemail) ? $inemail : $useraccount['email']), 'error' => isset($errors['email']) ? qa_html($errors['email']) : ($doconfirms && !$isconfirmed ? qa_insert_login_links(qa_lang_html('users/email_please_confirm')) : null)), 'messages' => array('label' => qa_lang_html('users/private_messages'), 'tags' => 'NAME="messages"', 'type' => 'checkbox', 'value' => !($useraccount['flags'] & QA_USER_FLAGS_NO_MESSAGES), 'note' => qa_lang_html('users/private_messages_explanation')), 'mailings' => array('label' => qa_lang_html('users/mass_mailings'), 'tags' => 'NAME="mailings"', 'type' => 'checkbox', 'value' => !($useraccount['flags'] & QA_USER_FLAGS_NO_MAILINGS), 'note' => qa_lang_html('users/mass_mailings_explanation')), 'avatar' => null), 'buttons' => array('save' => array('label' => qa_lang_html('users/save_profile'))), 'hidden' => array('dosaveprofile' => '1'));
if (qa_get_state() == 'profile-saved') {
    $qa_content['form_profile']['ok'] = qa_lang_html('users/profile_saved');
}
if (!qa_opt('allow_private_messages')) {
    unset($qa_content['form_profile']['fields']['messages']);
}
if (!qa_opt('mailing_enabled')) {
    unset($qa_content['form_profile']['fields']['mailings']);
}
//	Avatar upload stuff
if (qa_opt('avatar_allow_gravatar') || qa_opt('avatar_allow_upload')) {
    $avataroptions = array();
    if (qa_opt('avatar_default_show') && strlen(qa_opt('avatar_default_blobid'))) {
        $avataroptions[''] = '<SPAN STYLE="margin:2px 0; display:inline-block;">' . qa_get_avatar_blob_html(qa_opt('avatar_default_blobid'), qa_opt('avatar_default_width'), qa_opt('avatar_default_height'), 32) . '</SPAN> ' . qa_lang_html('users/avatar_default');
    } else {
Example #5
0
function qa_when_to_html($timestamp, $fulldatedays)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    $interval = qa_opt('db_time') - $timestamp;
    if ($interval < 0 || isset($fulldatedays) && $interval > 86400 * $fulldatedays) {
        // full style date
        $stampyear = date('Y', $timestamp);
        $thisyear = date('Y', qa_opt('db_time'));
        return array('data' => qa_html(strtr(qa_lang($stampyear == $thisyear ? 'main/date_format_this_year' : 'main/date_format_other_years'), array('^day' => date(qa_lang('main/date_day_min_digits') == 2 ? 'd' : 'j', $timestamp), '^month' => qa_lang('main/date_month_' . date('n', $timestamp)), '^year' => date(qa_lang('main/date_year_digits') == 2 ? 'y' : 'Y', $timestamp)))));
    } else {
        // ago-style date
        return qa_lang_html_sub_split('main/x_ago', qa_html(qa_time_to_string($interval)));
    }
}
    $qa_content['error'] = qa_lang_html('users/no_permission');
    return $qa_content;
}
//	Check to see if any were approved or blocked here
$pageerror = qa_admin_check_clicks();
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('admin/approve_users_title');
$qa_content['error'] = isset($pageerror) ? $pageerror : qa_admin_page_error();
$qa_content['message_list'] = array('form' => array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('admin/click'))), 'messages' => array());
if (count($users)) {
    foreach ($users as $user) {
        $message = array();
        $message['tags'] = 'id="p' . qa_html($user['userid']) . '"';
        // use p prefix for qa_admin_click() in qa-admin.js
        $message['content'] = qa_lang_html('users/registered_label') . ' ' . strtr(qa_lang_html('users/x_ago_from_y'), array('^1' => qa_time_to_string(qa_opt('db_time') - $user['created']), '^2' => qa_ip_anchor_html($user['createip']))) . '<br/>';
        $htmlemail = qa_html($user['email']);
        $message['content'] .= qa_lang_html('users/email_label') . ' <a href="mailto:' . $htmlemail . '">' . $htmlemail . '</a>';
        if (qa_opt('confirm_user_emails')) {
            $message['content'] .= '<small> - ' . qa_lang_html($user['flags'] & QA_USER_FLAGS_EMAIL_CONFIRMED ? 'users/email_confirmed' : 'users/email_not_confirmed') . '</small>';
        }
        foreach ($userfields as $userfield) {
            if (strlen(@$user['profile'][$userfield['title']])) {
                $message['content'] .= '<br/>' . qa_html($userfield['content'] . ': ' . $user['profile'][$userfield['title']]);
            }
        }
        $message['meta_order'] = qa_lang_html('main/meta_order');
        $message['who']['data'] = qa_get_one_user_html($user['handle']);
        $message['form'] = array('style' => 'light', 'buttons' => array('approve' => array('tags' => 'name="admin_' . $user['userid'] . '_userapprove" onclick="return qa_admin_click(this);"', 'label' => qa_lang_html('question/approve_button'), 'popup' => qa_lang_html('admin/approve_user_popup')), 'block' => array('tags' => 'name="admin_' . $user['userid'] . '_userblock" onclick="return qa_admin_click(this);"', 'label' => qa_lang_html('admin/block_button'), 'popup' => qa_lang_html('admin/block_user_popup'))));
        $qa_content['message_list']['messages'][] = $message;
    }
Example #7
0
    }
}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('misc/private_message_title');
$qa_content['error'] = @$page_error;
$qa_content['form_message'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array('message' => array('type' => $messagesent ? 'static' : '', 'label' => qa_lang_html_sub('misc/message_for_x', qa_get_one_user_html($handle, false)), 'tags' => 'NAME="message" ID="message"', 'value' => qa_html(@$inmessage, $messagesent), 'rows' => 8, 'note' => qa_lang_html_sub('misc/message_explanation', qa_html(qa_opt('site_title'))), 'error' => qa_html(@$errors['message']))), 'buttons' => array('send' => array('tags' => 'onClick="qa_show_waiting_after(this, false);"', 'label' => qa_lang_html('main/send_button'))), 'hidden' => array('domessage' => '1'));
$qa_content['focusid'] = 'message';
if ($messagesent) {
    $qa_content['form_message']['ok'] = qa_lang_html('misc/message_sent');
    unset($qa_content['form_message']['fields']['message']['note']);
    unset($qa_content['form_message']['buttons']);
}
//	If relevant, show recent message history
if (qa_opt('show_message_history')) {
    $recent = array_merge($torecent, $fromrecent);
    qa_sort_by($recent, 'created');
    $showmessages = array_slice(array_reverse($recent, true), 0, QA_DB_RETRIEVE_MESSAGES);
    if (count($showmessages)) {
        $qa_content['form_recent'] = array('title' => qa_lang_html_sub('misc/message_recent_history', qa_html($toaccount['handle'])), 'style' => 'tall', 'fields' => array());
        foreach ($showmessages as $message) {
            $qa_content['form_recent']['fields'][] = array('label' => qa_lang_html_sub($message['touserid'] == $toaccount['userid'] ? 'misc/message_sent_x_ago' : 'misc/message_received_x_ago', qa_html(qa_time_to_string(qa_opt('db_time') - $message['created']))), 'type' => 'static', 'value' => qa_viewer_html($message['content'], $message['format']));
        }
    }
}
$qa_content['raw']['account'] = $toaccount;
// for plugin layers to access
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
Example #8
0
function qw_activitylist($limit)
{
    $offset = (int) qa_get('start');
    // get points for each activity
    require_once QA_INCLUDE_DIR . 'qa-db-points.php';
    require_once QA_INCLUDE_DIR . 'qa-db-users.php';
    $optionnames = qa_db_points_option_names();
    $options = qa_get_options($optionnames);
    $multi = (int) $options['points_multiple'];
    $upvote = '';
    $downvote = '';
    if (@$options['points_per_q_voted_up']) {
        $upvote = '_up';
        $downvote = '_down';
    }
    $event_point['in_q_vote_up'] = (int) $options['points_per_q_voted' . $upvote] * $multi;
    $event_point['in_q_vote_down'] = (int) $options['points_per_q_voted' . $downvote] * $multi * -1;
    $event_point['in_q_unvote_up'] = (int) $options['points_per_q_voted' . $upvote] * $multi * -1;
    $event_point['in_q_unvote_down'] = (int) $options['points_per_q_voted' . $downvote] * $multi;
    $event_point['a_vote_up'] = (int) $options['points_per_a_voted' . $upvote] * $multi;
    $event_point['in_a_vote_down'] = (int) $options['points_per_a_voted' . $downvote] * $multi * -1;
    $event_point['in_a_unvote_up'] = (int) $options['points_per_a_voted' . $upvote] * $multi * -1;
    $event_point['in_a_unvote_down'] = (int) $options['points_per_a_voted' . $downvote] * $multi;
    $event_point['in_a_select'] = (int) $options['points_a_selected'] * $multi;
    $event_point['in_a_unselect'] = (int) $options['points_a_selected'] * $multi * -1;
    $event_point['q_post'] = (int) $options['points_post_q'] * $multi;
    $event_point['a_post'] = (int) $options['points_post_a'] * $multi;
    $event_point['a_select'] = (int) $options['points_select_a'] * $multi;
    $event_point['q_vote_up'] = (int) $options['points_vote_up_q'] * $multi;
    $event_point['q_vote_down'] = (int) $options['points_vote_down_q'] * $multi;
    $event_point['a_vote_up'] = (int) $options['points_vote_up_a'] * $multi;
    $event_point['a_vote_down'] = (int) $options['points_vote_down_a'] * $multi;
    // Get Events
    $userid = qa_get_logged_in_userid();
    $eventslist = qa_db_read_all_assoc(qa_db_query_sub('SELECT id, UNIX_TIMESTAMP(datetime) AS datetime, userid, postid, effecteduserid, event, params, `read` FROM ^ra_userevent WHERE effecteduserid=# AND event NOT IN ("u_wall_post", "u_message") ORDER BY datetime DESC LIMIT # OFFSET #', $userid, $limit, $offset));
    if (count($eventslist) > 0) {
        $event = array();
        $output = '';
        $i = 0;
        //
        $userids = array();
        foreach ($eventslist as $event) {
            $userids[$event['userid']] = $event['userid'];
            $userids[$event['effecteduserid']] = $event['effecteduserid'];
        }
        if (QA_FINAL_EXTERNAL_USERS) {
            $handles = qa_get_public_from_userids($userids);
        } else {
            $handles = qa_db_user_get_userid_handles($userids);
        }
        // get event's: time, type, parameters
        // get post id of questions
        foreach ($eventslist as $event) {
            $title = '';
            $link = '';
            $vote_status = '';
            $handle = isset($handles[$event['userid']]) ? $handles[$event['userid']] : qa_lang('main/anonymous');
            $datetime = $event['datetime'];
            $event['date'] = qa_html(qa_time_to_string(qa_opt('db_time') - $datetime));
            $event['params'] = json_decode($event['params'], true);
            $id = ' data-id="' . $event['id'] . '"';
            $read = $event['read'] ? ' read' : ' unread';
            $mark_as_read = !$event['read'] ? '<span class="icon icon-tick"></span>' : '';
            $url_param = array('ra_notification' => $event['id']);
            $user_link = qa_path_html('user/' . $handle, $url_param, QW_BASE_URL);
            switch ($event['event']) {
                case 'related':
                    // related question to an answer
                    $url = qa_path_html(qa_q_request($event['postid'], $event['params']['title']), $url_param, QW_BASE_URL, null, null);
                    echo '<div class="event-content clearfix' . $read . '' . $read . '"' . $id . '>
                                                <div class="avatar"><a href="' . $user_link . '">' . qw_get_avatar($handle, 32, true) . '</a></div>
                                                <div class="event-right">
                                                      <a href="' . $url . '">
                                                            <div class="head">
                                                                  <strong class="user">' . $handle . '</strong>
                                                                  <span class="what">' . qa_lang_html('dude/asked_question_related_to_your') . '</span>
                                                                  <strong class="where">' . qa_lang_html('dude/answer') . '</strong>
                                                            </div>
                                                            <div class="footer">
                                                                  <span class="event-icon icon-link"></span>
                                                                  <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
                                                            </div>
                                                      </a>
                                                </div>
                                          </div>';
                    break;
                case 'a_post':
                    // user's question had been answered
                    $anchor = qa_anchor('A', $event['postid']);
                    $url = qa_path_html(qa_q_request($event['params']['qid'], $event['params']['qtitle']), $url_param, QW_BASE_URL, null, $anchor);
                    $title = qw_truncate($event['params']['qtitle'], 60);
                    echo '<div class="event-content clearfix' . $read . '"' . $id . '>
                                                <div class="avatar"><a href="' . $user_link . '">' . qw_get_avatar($handle, 32, true) . '</a></div>
                                                <div class="event-right">
                                                      <a href="' . $url . '">
                                                            <div class="head">
                                                                  <strong class="user">' . $handle . '</strong>
                                                                  <span class="what">' . qa_lang_html('dude/answered_your') . '</span>
                                                                  <strong class="where">' . qa_lang_html('dude/question') . '</strong>
                                                            </div>
                                                            <div class="footer">
                                                                  <span class="event-icon icon-answer"></span>
                                                                  <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
                                                            </div>
                                                      </a>
                                                </div>
                                          </div>';
                    break;
                case 'c_post':
                    // user's question had been commented
                    $anchor = qa_anchor('C', $event['postid']);
                    $url = qa_path_html(qa_q_request($event['params']['qid'], $event['params']['qtitle']), $url_param, QW_BASE_URL, null, $anchor);
                    if ($event['params']['parenttype'] == 'Q') {
                        $type = qa_lang_html('dude/question');
                    } elseif ($event['params']['parenttype'] == 'A') {
                        $type = qa_lang_html('dude/answer');
                    } else {
                        $type = qa_lang_html('dude/comment');
                    }
                    if (isset($event['params']['parent_uid']) && $event['params']['parent_uid'] != $userid) {
                        $what = qa_lang_html('dude/followup_comment');
                        $type = qa_lang_html('dude/comment');
                    } else {
                        $what = qa_lang_html('dude/replied_to_your');
                    }
                    echo '<div class="event-content clearfix' . $read . '"' . $id . '>
                                                <div class="avatar"><a href="' . $user_link . '">' . qw_get_avatar($handle, 32, true) . '</a></div>
                                                <div class="event-right">
                                                      <a href="' . $url . '">
                                                            <div class="head">
                                                                  <strong class="user">' . $handle . '</strong>
                                                                  <span class="what">' . $what . '</span>
                                                                  <strong class="where">' . $type . '</strong>
                                                            </div>
                                                            <div class="footer">
                                                                  <span class="event-icon icon-arrow-back"></span>
                                                                  <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
                                                            </div>
                                                      </a>
                                                </div>
                                          </div>';
                    break;
                case 'q_reshow':
                    $url = qa_path_html(qa_q_request($event['params']['qid'], $event['params']['qtitle']), $url_param, QW_BASE_URL, null, null);
                    echo '<div class="event-content clearfix' . $read . '"' . $id . '>
                                                <div class="avatar"><a class="icon icon-eye" href="' . $url . '"></a></div>
                                                <div class="event-right">
                                                      <a href="' . $url . '">
                                                            <div class="head">
                                                                  <span>' . qa_lang_html('dude/your') . '</span>
                                                                  <strong>' . qa_lang_html('dude/question') . '</strong>
                                                                  <span class="what">' . qa_lang_html('dude/is_visible') . '</span>
                                                            </div>
                                                            <div class="footer">
                                                                  <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
                                                            </div>
                                                      </a>
                                                </div>
                                          </div>';
                    break;
                case 'a_reshow':
                    // user's question had been answered
                    $anchor = qa_anchor('A', $event['postid']);
                    $url = qa_path_html(qa_q_request($event['params']['qid'], $event['params']['qtitle']), $url_param, QW_BASE_URL, null, $anchor);
                    echo '<div class="event-content clearfix' . $read . '"' . $id . '>
                                                <div class="avatar"><a class="icon icon-eye" href="' . $url . '"></a></div>
                                                <div class="event-right">
                                                      <a href="' . $url . '">
                                                            <div class="head">
                                                                  <span>' . qa_lang_html('dude/your') . '</span>
                                                                  <strong>' . qa_lang_html('dude/answer') . '</strong>
                                                                  <span class="what">' . qa_lang_html('dude/is_visible') . '</span>
                                                            </div>
                                                            <div class="footer">
                                                                  <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
                                                            </div>
                                                      </a>
                                                </div>
                                          </div>';
                    break;
                case 'c_reshow':
                    // user's question had been answered
                    $anchor = qa_anchor('C', $event['postid']);
                    $url = qa_path_html(qa_q_request($event['params']['qid'], $event['params']['qtitle']), $url_param, QW_BASE_URL, null, $anchor);
                    echo '<div class="event-content clearfix' . $read . '"' . $id . '>
                                                <div class="avatar"><a class="icon icon-eye" href="' . $url . '"></a></div>
                                                <div class="event-right">
                                                      <a href="' . $url . '">
                                                            <div class="head">
                                                                  <span>' . qa_lang_html('dude/your') . '</span>
                                                                  <strong>' . qa_lang_html('dude/comment') . '</strong>
                                                                  <span class="what">' . qa_lang_html('dude/is_visible') . '</span>
                                                            </div>
                                                            <div class="footer">
                                                                  <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
                                                            </div>
                                                      </a>
                                                </div>
                                          </div>';
                    break;
                case 'a_select':
                    $anchor = qa_anchor('A', $event['postid']);
                    $url = qa_path_html(qa_q_request($event['params']['qid'], $event['params']['qtitle']), $url_param, QW_BASE_URL, null, $anchor);
                    echo '<div class="event-content clearfix' . $read . '"' . $id . '>
                                                <div class="avatar"><a href="' . $user_link . '">' . qw_get_avatar($handle, 32, true) . '</a></div>
                                                <div class="event-right">
                                                      <a href="' . $url . '">
                                                            <div class="head">
                                                                  <strong class="user">' . $handle . '</strong>
                                                                  <span class="what">' . qa_lang_html('dude/selected_as_best') . '</span>
                                                            </div>
                                                            <div class="footer">
                                                                  <span class="event-icon icon-award"></span>
                                                                  <span class="points">' . qa_lang_sub('dude/you_have_earned_x_points', $event_point['a_post']) . '</span>
                                                                  <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
                                                            </div>
                                                      </a>
                                                </div>
                                          </div>';
                    break;
                case 'q_vote_up':
                    $url = qa_path_html(qa_q_request($event['params']['qid'], $event['params']['qtitle']), $url_param, QW_BASE_URL, null);
                    $title = qw_truncate($event['params']['qtitle'], 60);
                    echo '<div class="event-content clearfix' . $read . '"' . $id . '>
                                                <div class="avatar"><a href="' . $user_link . '">' . qw_get_avatar($handle, 32, true) . '</a></div>
                                                <div class="event-right">
                                                      <a href="' . $url . '">
                                                            <div class="head">
                                                                  <strong class="user">' . $handle . '</strong>
                                                                  <span class="what">' . qa_lang_html('dude/upvoted_on_your') . '</span>
                                                                  <strong class="where">' . qa_lang_html('dude/question') . '</strong>
                                                            </div>
                                                            <div class="footer">
                                                                  <span class="event-icon icon-thumb-up"></span>
                                                                  <span class="points">' . qa_lang_sub('dude/you_have_earned_x_points', $event_point['a_vote_up']) . '</span>
                                                                  <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
                                                            </div>
                                                      </a>
                                                </div>
                                          </div>';
                    break;
                case 'a_vote_up':
                    $anchor = qa_anchor('A', $event['postid']);
                    $url = qa_path_html(qa_q_request($event['params']['qid'], $event['params']['qtitle']), $url_param, QW_BASE_URL, null, $anchor);
                    echo '<div class="event-content clearfix' . $read . '"' . $id . '>
                                                <div class="avatar"><a href="' . $user_link . '">' . qw_get_avatar($handle, 32, true) . '</a></div>
                                                <div class="event-right">
                                                      <a href="' . $url . '">
                                                            <div class="head">
                                                                  <strong class="user">' . $handle . '</strong>
                                                                  <span class="what">' . qa_lang_html('dude/upvoted_on_your') . '</span>
                                                                  <strong class="where">' . qa_lang_html('dude/answer') . '</strong>
                                                            </div>
                                                            <div class="footer">
                                                                  <span class="event-icon icon-thumb-up"></span>
                                                                  <span class="points">' . qa_lang_sub('dude/you_have_earned_x_points', $event_point['a_vote_up']) . '</span>
                                                                  <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
                                                            </div>
                                                      </a>
                                                </div>
                                          </div>';
                    break;
                case 'q_approve':
                    $url = qa_path_html(qa_q_request($event['params']['qid'], $event['params']['qtitle']), $url_param, QW_BASE_URL, null);
                    echo '<div class="event-content clearfix' . $read . '"' . $id . '>
                                                <div class="avatar"><a class="icon icon-input-checked" href="' . $url . '"></a></div>
                                                <div class="event-right">
                                                      <a href="' . $url . '">
                                                            <div class="head">
                                                                  <strong class="user">' . $handle . '</strong>
                                                                  <span class="what">' . qa_lang_html('dude/approved_your') . '</span>
                                                                  <strong class="where">' . qa_lang_html('dude/question') . '</strong>
                                                            </div>
                                                            <div class="footer">
                                                                  <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
                                                            </div>
                                                      </a>
                                                </div>
                                          </div>';
                    break;
                case 'a_approve':
                    $anchor = qa_anchor('A', $event['postid']);
                    $url = qa_path_html(qa_q_request($event['params']['qid'], $event['params']['qtitle']), $url_param, QW_BASE_URL, null, $anchor);
                    echo '<div class="event-content clearfix' . $read . '"' . $id . '>
                                                <div class="avatar"><a class="icon icon-input-checked" href="' . $url . '"></a></div>
                                                <div class="event-right">
                                                      <a href="' . $url . '">
                                                            <div class="head">
                                                                  <strong class="user">' . $handle . '</strong>
                                                                  <span class="what">' . qa_lang_html('dude/approved_your') . '</span>
                                                                  <strong class="where">' . qa_lang_html('dude/answer') . '</strong>
                                                            </div>
                                                            <div class="footer">
                                                                  <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
                                                            </div>
                                                      </a>
                                                </div>
                                          </div>';
                    break;
                case 'u_favorite':
                    echo '<div class="event-content clearfix' . $read . '"' . $id . '>
                                                <div class="avatar"><a href="' . $user_link . '">' . qw_get_avatar($handle, 32, true) . '</a></div>
                                                <div class="event-right">
                                                      <a href="' . $user_link . '">
                                                            <div class="head">
                                                                  <strong class="user">' . $handle . '</strong>
                                                                  <span class="what">' . qa_lang_html('dude/added_you_to') . '</span>
                                                                  <strong class="where">' . qa_lang_html('dude/favourite') . '</strong>
                                                            </div>
                                                            <div class="footer">
                                                                  <span class="event-icon icon-heart"></span>                                                     
                                                                  <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
                                                            </div>
                                                      </a>
                                                </div>
                                          </div>';
                    break;
                case 'q_favorite':
                    echo '<div class="event-content clearfix' . $read . '"' . $id . '>
                                                <div class="avatar"><a href="' . $user_link . '">' . qw_get_avatar($handle, 32, true) . '</a></div>
                                                <div class="event-right">
                                                      <a href="' . $user_link . '">
                                                            <div class="head">
                                                                  <strong class="user">' . $handle . '</strong>
                                                                  <span class="what">' . qa_lang_html('dude/added_your_question_to') . '</span>
                                                                  <strong class="where">' . qa_lang_html('dude/favourite') . '</strong>
                                                            </div>
                                                            <div class="footer">
                                                                  <span class="event-icon icon-heart"></span>                                                     
                                                                  <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
                                                            </div>
                                                      </a>
                                                </div>
                                          </div>';
                    break;
                case 'q_vote_down':
                    $url = qa_path_html(qa_q_request($event['params']['qid'], $event['params']['qtitle']), $url_param, QW_BASE_URL, null);
                    echo '<div class="event-content clearfix' . $read . '"' . $id . '>
                                                <div class="avatar"><a class="icon icon-thumb-down" href="' . $url . '"></a></div>
                                                <div class="event-right">
                                                      <a href="' . $url . '">
                                                            <div class="head">
                                                                  <span class="what">' . qa_lang_html('dude/you_have_received_down_vote') . '</span>
                                                                  <strong class="where">' . qa_lang_html('dude/question') . '</strong>
                                                            </div>
                                                            <div class="footer">
                                                                  <span class="points">' . qa_lang_sub('dude/you_have_lost_x_points', $event_point['q_vote_down']) . '</span>
                                                                  <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
                                                            </div>
                                                      </a>
                                                </div>
                                          </div>';
                    break;
                case 'c_approve':
                    $anchor = qa_anchor('C', $event['postid']);
                    $url = qa_path_html(qa_q_request($event['params']['qid'], $event['params']['qtitle']), $url_param, QW_BASE_URL, null, $anchor);
                    echo '<div class="event-content clearfix' . $read . '"' . $id . '>
                                                <div class="avatar"><a class="icon icon-input-checked" href="' . $url . '"></a></div>
                                                <div class="event-right">
                                                      <a href="' . $url . '">
                                                            <div class="head">
                                                                  <strong class="user">' . $handle . '</strong>
                                                                  <span class="what">' . qa_lang_html('dude/approved_your') . '</span>
                                                                  <strong class="where">' . qa_lang_html('dude/comment') . '</strong>
                                                            </div>
                                                            <div class="footer">                                                    
                                                                  <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
                                                            </div>
                                                      </a>
                                                </div>
                                          </div>';
                    break;
                case 'q_reject':
                    $url = qa_path_html(qa_q_request($event['params']['qid'], $event['params']['qtitle']), $url_param, QW_BASE_URL, null);
                    echo '<div class="event-content clearfix' . $read . '"' . $id . '>
                                                <div class="avatar"><a class="icon icon-times" href="' . $url . '"></a></div>
                                                <div class="event-right">
                                                      <a href="' . $url . '">
                                                            <div class="head">
                                                                  <strong class="user">' . $handle . '</strong>
                                                                  <span class="what">' . qa_lang_html('dude/your_question_is_rejected') . '</span>
                                                            </div>
                                                            <div class="footer">
                                                                  <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
                                                            </div>
                                                      </a>
                                                </div>
                                          </div>';
                    break;
                case 'a_reject':
                    $anchor = qa_anchor('A', $event['postid']);
                    $url = qa_path_html(qa_q_request($event['params']['qid'], $event['params']['qtitle']), $url_param, QW_BASE_URL, null, $anchor);
                    echo '<div class="event-content clearfix' . $read . '"' . $id . '>
                                                <div class="avatar"><a class="icon icon-times" href="' . $url . '"></a></div>
                                                <div class="event-right">
                                                      <a href="' . $url . '">
                                                            <div class="head">
                                                                  <strong class="user">' . $handle . '</strong>
                                                                  <span class="what">' . qa_lang_html('dude/your_answer_is_rejected') . '</span>
                                                            </div>
                                                            <div class="footer">                                                    
                                                                  <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
                                                            </div>
                                                      </a>
                                                </div>
                                          </div>';
                    break;
                case 'c_reject':
                    $anchor = qa_anchor('C', $event['postid']);
                    $url = qa_path_html(qa_q_request($event['params']['qid'], $event['params']['qtitle']), $url_param, QW_BASE_URL, null, $anchor);
                    echo '<div class="event-content clearfix' . $read . '"' . $id . '>
                                                <div class="avatar"><a class="icon icon-times" href="' . $url . '"></a></div>
                                                <div class="event-right">
                                                      <a href="' . $url . '">
                                                            <div class="head">
                                                                  <strong class="user">' . $handle . '</strong>
                                                                  <span class="what">' . qa_lang_html('dude/your_comment_is_rejected') . '</span>
                                                            </div>
                                                            <div class="footer">                                                    
                                                                  <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
                                                            </div>
                                                      </a>
                                                </div>
                                          </div>';
                    break;
                case 'u_level':
                    $url = qa_path_absolute('user/' . $event['params']['handle']);
                    $old_level = $event['params']['oldlevel'];
                    $new_level = $event['params']['level'];
                    if ($new_level < $old_level) {
                        break;
                    }
                    $approved_only = "";
                    if ($new_level == QA_USER_LEVEL_APPROVED && $old_level < QA_USER_LEVEL_APPROVED) {
                        $approved_only = true;
                    } else {
                        $approved_only = false;
                    }
                    if ($approved_only === false) {
                        $new_designation = qw_get_user_desg($new_level);
                    }
                    $content = strtr(qa_lang($approved_only ? 'notification/u_level_approved_notf' : 'notification/u_level_improved_notf'), array('^new_designation' => @$new_designation));
                    echo '<div class="event-content clearfix' . $read . '"' . $id . '>
                                                <div class="avatar"><a class="icon icon-user" href="' . $url . '"></a></div>
                                                <div class="event-right">
                                                      <a href="' . $url . '">
                                                            <div class="head">
                                                                  <strong class="user">' . $handle . '</strong>
                                                                  <span class="what">' . @$content . '</span>
                                                            </div>
                                                            <div class="footer">
                                                                  <span class="points">' . qa_lang_sub('dude/you_have_earned_x_points', $event_point['a_vote_up']) . '</span>
                                                                  <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span>
                                                            </div>
                                                      </a>
                                                </div>
                                          </div>';
                    break;
            }
        }
        //code for pagination
    } else {
        echo '<div class="no-more-activity">' . qa_lang_html('dude/no_more_activity') . '</div>';
    }
}
function qa_other_to_q_html_fields($question, $userid, $cookieid, $usershtml, $dummy, $options)
{
    $fields = qa_post_html_fields($question, $userid, $cookieid, $usershtml, null, $options);
    switch ($question['obasetype']) {
        case 'Q':
            $fields['what'] = @$question['oedited'] ? qa_lang_html('main/edited') : null;
            break;
        case 'A':
            $fields['what'] = @$question['oedited'] ? qa_lang_html('main/answer_edited') : qa_lang_html('main/answered');
            break;
        case 'C':
            $fields['what'] = @$question['oedited'] ? qa_lang_html('main/comment_edited') : qa_lang_html('main/commented');
            break;
    }
    if ($question['obasetype'] != 'Q') {
        $fields['what_url'] = $fields['url'] . '#' . qa_html(urlencode(qa_anchor($question['obasetype'], $question['opostid'])));
    }
    if (@$options['whenview']) {
        $fields['when'] = qa_lang_html_sub_split('main/x_ago', qa_html(qa_time_to_string(qa_opt('db_time') - $question['otime'])));
    }
    if (@$options['whoview']) {
        $isbyuser = qa_post_is_by_user(array('userid' => $question['ouserid'], 'cookieid' => $question['ocookieid']), $userid, $cookieid);
        $fields['who'] = qa_who_to_html($isbyuser, $question['ouserid'], $usershtml, @$options['ipview'] ? $question['oip'] : null, false);
        if (isset($question['opoints'])) {
            if (@$options['pointsview']) {
                $fields['who']['points'] = $question['opoints'] == 1 ? qa_lang_html_sub_split('main/1_point', '1', '1') : qa_lang_html_sub_split('main/x_points', qa_html(number_format($question['opoints'])));
            }
            if (isset($options['pointstitle'])) {
                $fields['who']['title'] = qa_get_points_title_html($question['opoints'], $options['pointstitle']);
            }
        }
        if (isset($question['olevel'])) {
            $fields['who']['level'] = qa_html(qa_user_level_string($question['olevel']));
        }
    }
    unset($fields['flags']);
    if (@$options['flagsview'] && @$post['oflagcount']) {
        $fields['flags'] = $post['oflagcount'] == 1 ? qa_lang_html_sub_split('main/1_flag', '1', '1') : qa_lang_html_sub_split('main/x_flags', $post['oflagcount']);
    }
    unset($fields['avatar']);
    if (!QA_FINAL_EXTERNAL_USERS && @$options['avatarsize'] > 0) {
        $fields['avatar'] = qa_get_user_avatar_html($question['oflags'], $question['oemail'], $question['ohandle'], $question['oavatarblobid'], $question['oavatarwidth'], $question['oavatarheight'], $options['avatarsize']);
    }
    return $fields;
}
Example #10
0
    function messagelist()
    {
        require_once QA_INCLUDE_DIR . 'qa-db-users.php';
        // Get Events
        $message_events = array('u_message', 'u_wall_post');
        $events = "'" . implode("','", $message_events) . "'";
        $userid = qa_get_logged_in_userid();
        $eventslist = qa_db_read_all_assoc(qa_db_query_sub('SELECT UNIX_TIMESTAMP(datetime) AS datetime, userid, postid, effecteduserid, event, params FROM ^userlog WHERE effecteduserid=# AND 
				DATE_SUB(CURDATE(),INTERVAL # DAY) <= datetime AND
				event IN (' . $events . ')
				ORDER BY datetime DESC' . (qa_opt('qat_activity_number') ? ' LIMIT ' . (int) qa_opt('qat_activity_number') : ''), $userid, qa_opt('qat_activity_age')));
        $event = array();
        $output = '';
        //
        $userids = array();
        foreach ($eventslist as $event) {
            $userids[$event['userid']] = $event['userid'];
            $userids[$event['effecteduserid']] = $event['effecteduserid'];
        }
        $handles = qa_db_user_get_userid_handles($userids);
        // get event's: time, type, parameters
        // get post id of questions
        foreach ($eventslist as $event) {
            $title = '';
            $link = '';
            $handle = $handles[$event['userid']];
            $user_link = qa_path('user/' . $handle);
            $reciever_handle = $handles[$event['effecteduserid']];
            $reciever_link = qa_path('user/' . $reciever_handle);
            $datetime = $event['datetime'];
            $event['date'] = qa_html(qa_time_to_string(qa_opt('db_time') - $datetime));
            $event['params'] = json_decode($event['params'], true);
            $message = substr($event['params']['message'], 0, 20);
            $output .= '<li>';
            switch ($event['event']) {
                case 'u_message':
                    // related question to an answer
                    $url = qa_path_html(qa_path('message/' . $handle));
                    $output .= '<div class="event-icon pull-left icon-chat"></div>
								<div class="event-content">
									<p class="title"><strong class="avatar"><a href="' . $user_link . '">' . $handle . '</a></strong>
									<span class="what">left you a message</span>
									</p>
									<a class="title" href="' . $url . '">' . $message . '</a>
									<span class="date"> ' . $event['date'] . '</span>
								</div>';
                    break;
                case 'u_wall_post':
                    // user's question had been answered
                    $url = qa_path_html(qa_path('user/' . $reciever_handle . '/wall'));
                    $output .= '<div class="event-icon pull-left icon-chat"></div>
								<div class="event-content">
									<p class="title"><strong class="avatar"><a href="' . $user_link . '">' . $handle . '</a></strong>
									<span class="what">posted a message on your wall</span>
									</p>
									<a class="title" href="' . $url . '">' . $message . '</a>
									<span class="date"> ' . $event['date'] . '</span>
								</div>';
                    break;
            }
        }
        $output .= '</li>';
        return $output;
    }
    function user_activity_form()
    {
        $handle = $this->_user_handle();
        if (!$handle) {
            return;
        }
        $userid = $this->getuserfromhandle($handle);
        if (!$userid) {
            return;
        }
        // update last visit
        if ($userid == qa_get_logged_in_userid() && qa_opt('user_act_list_new')) {
            qa_db_query_sub('CREATE TABLE IF NOT EXISTS ^usermeta (
				meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
				user_id bigint(20) unsigned NOT NULL,
				meta_key varchar(255) DEFAULT NULL,
				meta_value longtext,
				PRIMARY KEY (meta_id),
				UNIQUE (user_id,meta_key)
				) ENGINE=MyISAM  DEFAULT CHARSET=utf8');
            $last_visit = qa_db_read_one_value(qa_db_query_sub('SELECT UNIX_TIMESTAMP(meta_value) FROM ^usermeta WHERE user_id=# AND meta_key=$', qa_get_logged_in_userid(), 'visited_profile'), true);
            qa_db_query_sub('INSERT INTO ^usermeta (user_id,meta_key,meta_value) VALUES(#,$,NOW()) ON DUPLICATE KEY UPDATE meta_value=NOW()', $userid, 'visited_profile');
        } else {
            $last_visit = time();
        }
        $event_query = qa_db_query_sub("SELECT \n\t\t\t\te.event, \n\t\t\t\tBINARY e.params as params, \n\t\t\t\tUNIX_TIMESTAMP(e.datetime) AS datetime\n\t\t\tFROM \n\t\t\t\t^eventlog AS e\n\t\t\tWHERE\n\t\t\t\te.userid=#\n\t\t\t\tAND\n\t\t\t\tDATE_SUB(CURDATE(),INTERVAL # DAY) <= datetime\n\t\t\tORDER BY datetime DESC" . (qa_opt('user_act_list_max') ? " LIMIT " . (int) qa_opt('user_act_list_max') : ""), $userid, qa_opt('user_act_list_age'));
        // no post
        $nopost = array('u_password', 'u_reset', 'u_save', 'u_confirmed', 'u_edit', 'u_level', 'u_block', 'u_unblock', 'u_register', 'in_u_edit', 'in_u_level', 'in_u_block', 'in_u_unblock', 'feedback', 'search');
        // points
        require_once QA_INCLUDE_DIR . 'qa-db-points.php';
        $optionnames = qa_db_points_option_names();
        $options = qa_get_options($optionnames);
        $multi = (int) $options['points_multiple'];
        // compat fudge
        $upvote = '';
        $downvote = '';
        if (@$options['points_per_q_voted_up']) {
            $upvote = '_up';
            $downvote = '_down';
        }
        $option_events['in_q_vote_up'] = (int) $options['points_per_q_voted' . $upvote] * $multi;
        $option_events['in_q_vote_down'] = (int) $options['points_per_q_voted' . $downvote] * $multi * -1;
        $option_events['in_q_unvote_up'] = (int) $options['points_per_q_voted' . $upvote] * $multi * -1;
        $option_events['in_q_unvote_down'] = (int) $options['points_per_q_voted' . $downvote] * $multi;
        $option_events['in_a_vote_up'] = (int) $options['points_per_a_voted' . $upvote] * $multi;
        $option_events['in_a_vote_down'] = (int) $options['points_per_a_voted' . $downvote] * $multi * -1;
        $option_events['in_a_unvote_up'] = (int) $options['points_per_a_voted' . $upvote] * $multi * -1;
        $option_events['in_a_unvote_down'] = (int) $options['points_per_a_voted' . $downvote] * $multi;
        $option_events['in_a_select'] = (int) $options['points_a_selected'] * $multi;
        $option_events['in_a_unselect'] = (int) $options['points_a_selected'] * $multi * -1;
        $option_events['q_post'] = (int) $options['points_post_q'] * $multi;
        $option_events['a_post'] = (int) $options['points_post_a'] * $multi;
        $option_events['a_select'] = (int) $options['points_select_a'] * $multi;
        $option_events['q_vote_up'] = (int) $options['points_vote_up_q'] * $multi;
        $option_events['q_vote_down'] = (int) $options['points_vote_down_q'] * $multi;
        $option_events['a_vote_up'] = (int) $options['points_vote_up_a'] * $multi;
        $option_events['a_vote_down'] = (int) $options['points_vote_down_a'] * $multi;
        $fields = array();
        $events = array();
        $postids = array();
        $count = 0;
        while (($event = qa_db_read_one_assoc($event_query, true)) !== null) {
            if (preg_match('/postid=([0-9]+)/', $event['params'], $m) === 1) {
                $event['postid'] = (int) $m[1];
                $postids[] = (int) $m[1];
                $events[$m[1] . '_' . $count++] = $event;
            } else {
                $events['nopost_' . $count++] = $event;
            }
        }
        // get post info, also makes sure post exists
        $posts = null;
        if (!empty($postids)) {
            $post_query = qa_db_read_all_assoc(qa_db_query_sub('SELECT postid, type, parentid, BINARY title as title FROM ^posts WHERE postid IN (' . implode(',', $postids) . ')'));
            foreach ($post_query as $post) {
                $posts[(string) $post['postid']] = $post;
            }
        }
        foreach ($events as $postid_string => $event) {
            $type = $event['event'];
            $postid = preg_replace('/_.*/', '', $postid_string);
            $post = null;
            $post = @$posts[$postid];
            // these calls allow you to deal with deleted events;
            // uncomment the first one to skip them
            // uncomment the second one to build your own routine based on whether they are deleted.
            if (!in_array($type, $nopost) && $post == null) {
                continue;
            }
            // $deleted = (!in_array($type, $nopost) && $post == null);
            // hide / show exceptions
            if (qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) {
                if ($userid != qa_get_logged_in_userid()) {
                    // show public
                    $types = explode("\n", qa_opt('user_act_list_show'));
                    if (!in_array($type, $types)) {
                        continue;
                    }
                } else {
                    // hide from owner
                    $types = explode("\n", qa_opt('user_act_list_hide'));
                    if (in_array($type, $types)) {
                        continue;
                    }
                }
            }
            if (!qa_opt('user_act_list_' . $type)) {
                continue;
            }
            $params = array();
            $paramsa = explode("\t", $event['params']);
            foreach ($paramsa as $param) {
                $parama = explode('=', $param);
                if (isset($parama[1])) {
                    $params[$parama[0]] = $parama[1];
                } else {
                    $params[$param] = $param;
                }
            }
            $link = '';
            if (in_array($type, $nopost)) {
                if ($type == 'search') {
                    if ((int) $params['start'] != 0) {
                        continue;
                    }
                    $link = '<a href="' . qa_path_html('search', array('q' => $params['query'])) . '">' . qa_html($params['query']) . '</a>';
                } else {
                    if (in_array($type, array('u_edit', 'u_level', 'u_block', 'u_unblock'))) {
                        $ohandle = $this->getHandleFromID($params['userid']);
                        $link = '<a href="' . qa_path_html('user/' . $ohandle, null, qa_opt('site_url')) . '">' . $ohandle . '</a>';
                    } else {
                        $link = '';
                    }
                }
            } else {
                if ($type == 'badge_awarded') {
                    if (!qa_opt('badge_active') || !function_exists('qa_get_badge_type')) {
                        continue;
                    }
                    if ($post != null) {
                        if (strpos($post['type'], 'Q') !== 0) {
                            $anchor = qa_anchor(strpos($post['type'], 'A') === 0 ? 'A' : 'C', $params['postid']);
                            $parent = qa_db_read_one_assoc(qa_db_query_sub('SELECT parentid,type,BINARY title as title,postid FROM ^posts WHERE postid=#', $post['parentid']), true);
                            if ($parent['type'] == 'A') {
                                $parent = qa_db_read_one_assoc(qa_db_query_sub('SELECT BINARY title as title,postid FROM ^posts WHERE postid=#', $parent['parentid']), true);
                            }
                            $activity_url = qa_path_html(qa_q_request($parent['postid'], $parent['title']), null, qa_opt('site_url'), null, $anchor);
                            $link = '<a href="' . $activity_url . '">' . $parent['title'] . '</a>';
                        } else {
                            $activity_url = qa_path_html(qa_q_request($params['postid'], $post['title']), null, qa_opt('site_url'), null, null);
                            $link = '<a href="' . $activity_url . '">' . $post['title'] . '</a>';
                        }
                    }
                } else {
                    if ($post != null && strpos($event['event'], 'q_') !== 0 && strpos($event['event'], 'in_q_') !== 0) {
                        // comment or answer
                        if (!isset($params['parentid'])) {
                            $params['parentid'] = $post['parentid'];
                        }
                        $parent = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $params['parentid']));
                        if ($parent['type'] == 'A') {
                            $parent = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $parent['parentid']));
                        }
                        $anchor = qa_anchor(strpos($event['event'], 'a_') === 0 || strpos($event['event'], 'in_a_') === 0 ? 'A' : 'C', $params['postid']);
                        $activity_url = qa_path_html(qa_q_request($parent['postid'], $parent['title']), null, qa_opt('site_url'), null, $anchor);
                        $link = '<a href="' . $activity_url . '">' . $parent['title'] . '</a>';
                    } else {
                        if ($post != null) {
                            // question
                            if (!isset($params['title'])) {
                                $params['title'] = $posts[$params['postid']]['title'];
                            }
                            if ($params['title'] !== null) {
                                $activity_url = qa_path_html(qa_q_request($params['postid'], $params['title']), null, qa_opt('site_url'));
                                $link = '<a href="' . $activity_url . '">' . $params['title'] . '</a>';
                            }
                        }
                    }
                }
            }
            $time = $event['datetime'];
            if (qa_opt('user_act_list_shading')) {
                $days = (qa_opt('db_time') - $time) / 60 / 60 / 24;
                $col = round($days / qa_opt('user_act_list_age') * 255 / 2);
                $bkg = 255 - round($days / qa_opt('user_act_list_age') * 255 / 8);
                $bkg = dechex($bkg);
                $col = dechex($col);
                if (strlen($col) == 1) {
                    $col = '0' . $col;
                }
                if (strlen($bkg) == 1) {
                    $bkg = '0' . $bkg;
                }
                $col = '#' . $col . $col . $col;
                $bkg = '#' . $bkg . $bkg . $bkg;
            }
            $whenhtml = qa_html(qa_time_to_string(qa_opt('db_time') - $time));
            $when = qa_lang_html_sub('main/x_ago', $whenhtml);
            $when = str_replace(' ', '<br/>', $when);
            $when = preg_replace('/([0-9]+)/', '<span class="qa-history-item-date-no">$1</span>', $when);
            if (strpos($type, '_vote_nil') == 4) {
                if ($params['oldvote'] == '1') {
                    // unvoting an upvote
                    $points = @$option_events[str_replace('_vote_nil', '_unvote_up', $type)];
                } else {
                    // unvoting a downvote
                    $points = @$option_events[str_replace('_vote_nil', '_unvote_down', $type)];
                }
            } else {
                $points = @$option_events[$type];
            }
            $string = qa_opt('user_act_list_' . $type);
            if ($type == 'badge_awarded') {
                $slug = $params['badge_slug'];
                $typea = qa_get_badge_type_by_slug($slug);
                if (!$typea) {
                    continue;
                }
                $types = $typea['slug'];
                $typed = $typea['name'];
                $badge_name = qa_badge_name($slug);
                if (!qa_opt('badge_' . $slug . '_name')) {
                    qa_opt('badge_' . $slug . '_name', $badge_name);
                }
                $var = qa_opt('badge_' . $slug . '_var');
                $name = qa_opt('badge_' . $slug . '_name');
                $desc = qa_badge_desc_replace($slug, $var, false);
                $string = str_replace('^badge', '<span class="badge-' . $types . '" title="' . $desc . ' (' . $typed . ')">' . qa_html($name) . '</span>', $string);
            }
            $fields[] = array('type' => 'static', 'label' => '<div class="qa-history-item-date' . ($time >= $last_visit && strpos($type, 'in_') === 0 ? ' qa-history-item-date-new' : '') . '"' . (qa_opt('user_act_list_shading') ? ' style="color:' . $col . ';background-color:' . $bkg . '"' : '') . '>' . $when . '</div>', 'value' => '<table class="qa-history-item-table"><tr><td class="qa-history-item-type-cell"><div class="qa-history-item-type qa-history-item-' . $type . '">' . $string . '</div></td><td class="qa-history-item-title-cell"><div class="qa-history-item-title">' . $link . '</div></td class="qa-history-item-points-cell"><td align="right">' . ($points ? '<div class="qa-history-item-points qa-history-item-points-' . ($points < 0 ? 'neg">' : 'pos">+') . $points . '</div>' : '&nbsp') . '</td></tr></table>');
        }
        if (empty($fields)) {
            return;
        }
        return array('style' => 'wide', 'title' => qa_opt('user_act_list_title'), 'fields' => $fields);
    }
    function process_request($request)
    {
        // we received post data, it is the ajax call!
        $transferString = qa_post_text('ajax');
        if ($transferString !== null) {
            // prevent empty userid
            $userid = qa_get_logged_in_userid();
            if (empty($userid)) {
                echo 'Userid is empty!';
                return;
            }
            // this is echoed via ajax success data
            $notifyBoxEvents = '';
            // ajax return all user events
            if (isset($userid) && $transferString == 'receiveNotify') {
                $last_visit = qa_db_read_one_value(qa_db_query_sub('SELECT UNIX_TIMESTAMP(meta_value) FROM ^usermeta WHERE user_id=# AND meta_key="visited_profile"', $userid), true);
                $maxEvents = qa_opt('q2apro_onsitenotifications_maxevshow');
                // maximal events to show
                // query all new events of user
                $event_query = qa_db_query_sub('SELECT 
							e.event, 
							e.userid, 
							BINARY e.params as params, 
							UNIX_TIMESTAMP(e.datetime) AS datetime
						FROM 
							^eventlog AS e
						WHERE
							FROM_UNIXTIME(#) <= datetime
							AND
							(e.userid=# AND e.event LIKE "in_%")
							OR ((e.event LIKE "u_message" OR e.event LIKE "u_wall_post") AND e.params LIKE "userid=#\\t%")
						ORDER BY datetime DESC
						LIMIT #', qa_opt('q2apro_onsitenotifications_maxage'), $userid, $userid, $maxEvents);
                $events = array();
                $postids = array();
                $count = 0;
                while (($event = qa_db_read_one_assoc($event_query, true)) !== null) {
                    if (preg_match('/postid=([0-9]+)/', $event['params'], $m) === 1) {
                        $event['postid'] = (int) $m[1];
                        $postids[] = (int) $m[1];
                        $events[$m[1] . '_' . $count++] = $event;
                    }
                    // private message
                    if ($event['event'] == 'u_message') {
                        // example of $event['params']: userid=1  handle=admin  messageid=4  message=hi admin, how are you?
                        $ustring = $event['params'];
                        // get messageid
                        if (preg_match('/messageid=([0-9]+)/', $ustring, $m) === 1) {
                            $event['messageid'] = (int) $m[1];
                        }
                        // needed for function qa_post_userid_to_handle()
                        require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
                        // get handle from userid, memo: userid from receiver is saved in params (the acting userid is the sender)
                        $event['handle'] = qa_post_userid_to_handle($event['userid']);
                        // get message preview by cutting out the string
                        $event['message'] = substr($ustring, strpos($ustring, 'message=') + 8, strlen($ustring) - strpos($ustring, 'message=') + 8);
                        $events[$m[1] . '_' . $count++] = $event;
                    } else {
                        if ($event['event'] == 'u_wall_post') {
                            // example of $event['params']: userid=1	handle=admin	messageid=8	content=hi admin!	format=	text=hi admin!
                            $ustring = $event['params'];
                            // get messageid
                            if (preg_match('/messageid=([0-9]+)/', $ustring, $m) === 1) {
                                $event['messageid'] = (int) $m[1];
                            }
                            // needed for function qa_post_userid_to_handle()
                            require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
                            // get handle from userid, memo: userid from receiver is saved in params (the acting userid is the sender)
                            $event['handle'] = qa_post_userid_to_handle($event['userid']);
                            // get message preview by cutting out the string
                            $event['message'] = substr($ustring, strpos($ustring, 'text=') + 5, strlen($ustring) - strpos($ustring, 'text=') + 5);
                            $events[$m[1] . '_' . $count++] = $event;
                        }
                    }
                }
                // get post info, also make sure that post exists
                $posts = null;
                if (!empty($postids)) {
                    $post_query = qa_db_read_all_assoc(qa_db_query_sub('SELECT postid, type, parentid, BINARY title as title FROM ^posts 
									WHERE postid IN (' . implode(',', $postids) . ')'));
                    foreach ($post_query as $post) {
                        // save postids as index in array $posts with the $post content
                        $posts[(string) $post['postid']] = $post;
                    }
                }
                // List all events
                $notifyBoxEvents = '<div id="nfyWrap" class="nfyWrap">
						<div class="nfyTop">' . qa_lang('q2apro_onsitenotifications_lang/my_notifications') . ' <a id="nfyReadClose">' . qa_lang('q2apro_onsitenotifications_lang/close') . ' | × |</a> </div>
						<div class="nfyContainer">
							<div id="nfyContainerInbox">
						';
                // BIG FOREACH
                foreach ($events as $postid_string => $event) {
                    // $postid_string, e.g. 32_1 (32 is postid, 1 is global event count)
                    $type = $event['event'];
                    if ($type == 'u_message') {
                        $eventName = qa_lang('q2apro_onsitenotifications_lang/you_received') . ' ';
                        $itemIcon = '<div class="nicon nmessage"></div>';
                        $activity_url = qa_path_absolute('message') . '/' . $event['handle'];
                        $linkTitle = qa_lang('q2apro_onsitenotifications_lang/message_from') . ' ' . $event['handle'];
                    } else {
                        if ($type == 'u_wall_post') {
                            $eventName = qa_lang('q2apro_onsitenotifications_lang/you_received') . ' ';
                            $itemIcon = '<div class="nicon nwallpost"></div>';
                            // create link to own wall, needs handle
                            require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
                            $userhandle = qa_post_userid_to_handle($userid);
                            // from v1.7 require_once QA_INCLUDE_DIR.'qa-app-users.php'; and qa_userid_to_handle($userid);
                            $activity_url = qa_path_absolute('user') . '/' . $userhandle . '/wall';
                            $linkTitle = qa_lang('q2apro_onsitenotifications_lang/wallpost_from') . ' ' . $event['handle'];
                        } else {
                            // a_post, c_post, q_vote_up, a_vote_up, q_vote_down, a_vote_down
                            $postid = preg_replace('/_.*/', '', $postid_string);
                            $post = null;
                            // assign post content (postid,type,parentid,title) if available
                            $post = @$posts[$postid];
                            $params = array();
                            // explode string to array with values (memo: leave "\t", '\t' will cause errors)
                            $paramsa = explode("\t", $event['params']);
                            foreach ($paramsa as $param) {
                                $parama = explode('=', $param);
                                if (isset($parama[1])) {
                                    $params[$parama[0]] = $parama[1];
                                } else {
                                    $params[$param] = $param;
                                }
                            }
                            $link = '';
                            $linkTitle = '';
                            $activity_url = '';
                            // comment or answer
                            if (isset($post) && strpos($event['event'], 'q_') !== 0 && strpos($event['event'], 'in_q_') !== 0) {
                                if (!isset($params['parentid'])) {
                                    $params['parentid'] = $post['parentid'];
                                }
                                $parent = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $params['parentid']));
                                if ($parent['type'] == 'A') {
                                    $parent = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $parent['parentid']));
                                }
                                $anchor = qa_anchor(strpos($event['event'], 'a_') === 0 || strpos($event['event'], 'in_a_') === 0 ? 'A' : 'C', $params['postid']);
                                $activity_url = qa_path_absolute(qa_q_request($parent['postid'], $parent['title']), null, $anchor);
                                $linkTitle = $parent['title'];
                                $link = '<a target="_blank" href="' . $activity_url . '">' . $parent['title'] . '</a>';
                            } else {
                                if (isset($post)) {
                                    // question
                                    if (!isset($params['title'])) {
                                        $params['title'] = $posts[$params['postid']]['title'];
                                    }
                                    if ($params['title'] !== null) {
                                        $qTitle = qa_db_read_one_value(qa_db_query_sub("SELECT title FROM `^posts` WHERE `postid` = " . $params['postid'] . " LIMIT 1"), true);
                                        if (!isset($qTitle)) {
                                            $qTitle = '';
                                        }
                                        $activity_url = qa_path_absolute(qa_q_request($params['postid'], $qTitle), null, null);
                                        $linkTitle = $qTitle;
                                        $link = '<a target="_blank" href="' . $activity_url . '">' . $qTitle . '</a>';
                                    }
                                }
                            }
                            // event name
                            $eventName = '';
                            $itemIcon = '';
                            if ($type == 'in_c_question' || $type == 'in_c_answer' || $type == 'in_c_comment') {
                                // added in_c_comment
                                $eventName = qa_lang('q2apro_onsitenotifications_lang/in_comment');
                                $itemIcon = '<div class="nicon ncomment"></div>';
                            } else {
                                if ($type == 'in_q_vote_up' || $type == 'in_a_vote_up') {
                                    $eventName = qa_lang('q2apro_onsitenotifications_lang/in_upvote');
                                    $itemIcon = '<div class="nicon nvoteup"></div>';
                                } else {
                                    if ($type == 'in_q_vote_down' || $type == 'in_a_vote_down') {
                                        $eventName = qa_lang('q2apro_onsitenotifications_lang/in_downvote');
                                        $itemIcon = '<div class="nicon nvotedown"></div>';
                                    } else {
                                        if ($type == 'in_a_question') {
                                            $eventName = qa_lang('q2apro_onsitenotifications_lang/in_answer');
                                            $itemIcon = '<div class="nicon nanswer"></div>';
                                        } else {
                                            if ($type == 'in_a_select') {
                                                $eventName = qa_lang('q2apro_onsitenotifications_lang/in_bestanswer');
                                                $itemIcon = '<div class="nicon nbestanswer"></div>';
                                            } else {
                                                // ignore other events such as in_c_flag
                                                continue;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    // end a_post, c_post, q_vote_up, a_vote_up, q_vote_down, a_vote_down
                    $eventtime = $event['datetime'];
                    $whenhtml = qa_html(qa_time_to_string(qa_opt('db_time') - $eventtime));
                    $when = qa_lang_html_sub('main/x_ago', $whenhtml);
                    // extra CSS for highlighting new events
                    $cssNewEv = '';
                    if ($eventtime > $last_visit) {
                        $cssNewEv = '-new';
                    }
                    // if post has been deleted there is no link, dont output
                    if ($activity_url == '') {
                        continue;
                    } else {
                        $notifyBoxEvents .= '<div class="itemBox' . $cssNewEv . '">
								' . $itemIcon . '
								<div class="nfyItemLine">
									<p class="nfyWhat">' . $eventName . ' 
										<a ' . ($type == 'u_message' || $type == 'u_wall_post' ? 'title="' . $event['message'] . '" ' : '') . 'href="' . $activity_url . '"' . (qa_opt('q2apro_onsitenotifications_newwindow') ? ' target="_blank"' : '') . '>' . $linkTitle . '</a>
									</p>
									<p class="nfyTime">' . $when . '</p>
								</div>
							</div>';
                    }
                }
                // END FOREACH
                $notifyBoxEvents .= '</div>
						</div>
						<div class="nfyFooter">
							<a href="http://www.q2apro.com/">by q2apro.com</a>
						</div>
					</div>
					';
                header('Access-Control-Allow-Origin: ' . qa_path(null));
                echo $notifyBoxEvents;
                // update database entry so that all user notifications are seen as read
                qa_db_query_sub('INSERT INTO ^usermeta (user_id,meta_key,meta_value) VALUES(#,$,NOW()) ON DUPLICATE KEY UPDATE meta_value=NOW()', $userid, 'visited_profile');
                exit;
            } else {
                echo 'Unexpected problem detected! No userid, no transfer string.';
                exit;
            }
        }
        /* start */
        $qa_content = qa_content_prepare();
        $qa_content['title'] = '';
        // page title
        // return if not admin!
        if (qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) {
            $qa_content['error'] = '<p>Access denied</p>';
            return $qa_content;
        } else {
            $qa_content['custom'] = '<p>Hi Admin, it actually makes no sense to call the Ajax URL directly.</p>';
        }
        return $qa_content;
    }