Example #1
0
function ra_ajax_user_popover()
{
    $handle_id = qa_post_text('handle');
    $handle = qa_post_text('handle');
    require_once QA_INCLUDE_DIR . 'qa-db-users.php';
    if (isset($handle)) {
        $userid = qa_handle_to_userid($handle);
        $badges = ra_user_badge($handle);
        if (defined('QA_WORDPRESS_INTEGRATE_PATH')) {
            $userid = qa_handle_to_userid($handle);
            $cover = get_user_meta($userid, 'cover');
            $cover = $cover[0];
        } else {
            $profile = ra_user_profile($handle);
            $cover = @$profile['cover'];
        }
        if (isset($cover)) {
            $image_file = explode('.', $cover);
            $cover = 'style="background:url(' . qa_opt('site_url') . 'images/' . @$image_file[0] . '_s.' . $image_file[1] . ') no-repeat scroll 0 0 / cover;"';
        }
        ?>
		<div id="<?php 
        echo $userid;
        ?>
_popover" class="user-popover">
			<div class="cover" <?php 
        echo @$cover;
        ?>
>
				<div class="avatar pull-left"><?php 
        echo ra_get_avatar($handle, 50);
        ?>
</div>
			</div>
			<div class="bar">		
				<span class="followers-count pull-right icon-star btn btn-warning"><?php 
        echo ra_user_followers_count($handle);
        ?>
</span>
				<h3 class="name"><?php 
        echo ra_name($handle);
        ?>
</h3>				
			</div>
			<div class="extra clearfix">
				<div class="points">
					<?php 
        echo '<span>' . ra_user_points($handle) . '</span>' . _ra_lang('P');
        ?>
				</div>
				<div class="badges">
					<?php 
        echo $badges;
        ?>
				</div>
			</div>
		</div>	
		<?php 
    }
    die;
}
Example #2
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 #3
0
 function message_item($message)
 {
     if (qw_hook_exist(__FUNCTION__)) {
         $args = func_get_args();
         array_unshift($args, $this);
         return qw_event_hook(__FUNCTION__, $args, NULL);
     }
     $handle = @$message['raw']['fromhandle'];
     $this->output('<div class="message-item" ' . @$message['tags'] . '>');
     $this->output('<div class="message-inner">');
     $this->output('<div class="message-head clearfix">');
     $this->message_buttons($message);
     if (isset($handle)) {
         $this->output('<div class="avatar pull-left">' . ra_get_avatar($handle, 40) . '</div>');
     }
     $this->output('<div class="user-detail">');
     if (isset($handle)) {
         $this->output('<h5 class="handle">' . $handle . '</h5>');
     }
     $this->post_meta($message, 'qa-message');
     $this->output('</div>');
     $this->output('</div>');
     $this->message_content($message);
     $this->output('</div></div>', '');
 }
Example #4
0
?>
<div class="answer-form">
	<div class="answer-form-right" <?php 
echo isset($a_form['id']) ? 'id="' . $a_form['id'] . '"' : '';
?>
 >
		<?php 
if (isset($handle)) {
    ?>
			<div class="avatar pull-left">
				<a class="avatar-wrap" href="<?php 
    echo qa_path_html('user/' . $handle);
    ?>
">
					<img src="<?php 
    echo ra_get_avatar($handle, 40, false);
    ?>
" />
				</a>
			</div>	
		<?php 
}
$context->form($a_form);
$context->c_list(@$a_form['c_list'], 'qa-a-item');
?>
	
		
		<h3 class="know-someone"><?php 
ra_lang('Know someone who can answer? Share a link to this');
?>
</h3>
Example #5
0
function ra_post_list($type, $limit)
{
    require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
    $post = qa_db_query_sub('SELECT * FROM ^posts WHERE ^posts.type=$ ORDER BY ^posts.created DESC LIMIT #', $type, $limit);
    $output = '<ul class="question-list">';
    while ($p = mysql_fetch_array($post)) {
        $p['title'] = qa_block_words_replace($p['title'], qa_get_block_words_preg(), '*');
        $p['content'] = qa_block_words_replace($p['content'], qa_get_block_words_preg(), '*');
        if ($type == 'Q') {
            $what = _ra_lang('asked');
        } elseif ($type == 'A') {
            $what = _ra_lang('answered');
        } elseif ('C') {
            $what = _ra_lang('commented');
        }
        $handle = qa_post_userid_to_handle($p['userid']);
        $output .= '<li id="q-list-' . $p['postid'] . '" class="question-item">';
        $output .= '<div class="pull-left avatar" data-handle="' . $handle . '" data-id="' . qa_handle_to_userid($handle) . '">' . ra_get_avatar($handle, 40) . '</div>';
        $output .= '<div class="list-right">';
        $output .= '<h5><a href="' . qa_path_html('user/' . $handle) . '">' . ra_name($handle) . '</a> ' . $what . '</h5>';
        if ($type == 'Q') {
            $output .= '<p><a href="' . qa_q_path_html($p['postid'], $p['title']) . '" title="' . $p['title'] . '">' . qa_html($p['title']) . '</a></p>';
        } elseif ($type == 'A') {
            $output .= '<p><a href="' . ra_post_link($p['parentid']) . '#a' . $p['postid'] . '">' . substr(strip_tags($p['content']), 0, 50) . '</a></p>';
        } else {
            $output .= '<p><a href="' . ra_post_link($p['parentid']) . '#c' . $p['postid'] . '">' . substr(strip_tags($p['content']), 0, 50) . '</a></p>';
        }
        if ($type == 'Q') {
            $output .= '<div class="counts"><div class="vote-count icon-chevron-up"><span>' . $p['netvotes'] . '</span></div>';
            $output .= '<div class="ans-count icon-chat-4"><span>' . $p['acount'] . '</span></div></div>';
        } elseif ($type == 'A') {
            $output .= '<div class="counts"><div class="vote-count icon-chevron-up"><span>' . $p['netvotes'] . '</span></div>';
        }
        $output .= '</div>';
        $output .= '</li>';
    }
    $output .= '</ul>';
    echo $output;
}
Example #6
0
function qw_get_email_template($parms)
{
    $logo = qa_opt('logo_url');
    $subs = array('{handle}' => $parms['handle'], '{base_url}' => get_base_url(), '{site_title}' => qa_opt('site_title'), '{logo}' => !!$logo ? '<img class="navbar-site-logo" src="' . $logo . '">' : '<img class="navbar-site-logo" src="' . Q_THEME_URL . '/images/logo.png">', '{avatar}' => ra_get_avatar($parms['handle'], 40), '{body}' => $parms['body']);
    $email_body = '';
    $email_body = qa_get_email_template_head($parms, $subs);
    $email_body .= qa_get_email_template_body($parms, $subs);
    $email_body .= qa_get_email_template_footer($parms, $subs);
    return $email_body;
}
Example #7
0
if (qa_is_logged_in()) {
    ?>
		<ul class="nav-userbox nav pull-right">
			<li>
				<?php 
    echo $context->qw_notification_btn();
    ?>
			</li>
			<li id="user-nag">
				<a class="profile" href="<?php 
    echo qa_path_html('user/' . qa_get_logged_in_handle());
    ?>
">
				
					<img src="<?php 
    echo ra_get_avatar(qa_get_logged_in_handle(), 20, false);
    ?>
" />	
					<span><?php 
    echo ra_name(qa_get_logged_in_handle());
    ?>
</span>
					<span class="points"><?php 
    echo qa_get_logged_in_points();
    ?>
</span>
				</a>				
			</li>
			<li class="dropdown" id="menuLogin">
				<a class="dropdown-toggle user-tools" data-toggle="dropdown" href="#">
					<i class="icon-cog"></i>