function logged_in()
 {
     if (qa_is_logged_in()) {
         // output user avatar to login bar
         $this->output('<div class="qa-logged-in-avatar">', QA_FINAL_EXTERNAL_USERS ? qa_get_external_avatar_html(qa_get_logged_in_userid(), 24, true) : qa_get_user_avatar_html(qa_get_logged_in_flags(), qa_get_logged_in_email(), qa_get_logged_in_handle(), qa_get_logged_in_user_field('avatarblobid'), qa_get_logged_in_user_field('avatarwidth'), qa_get_logged_in_user_field('avatarheight'), 24, true), '</div>');
     }
     qa_html_theme_base::logged_in();
     if (qa_is_logged_in()) {
         // adds points count after logged in username
         $userpoints = qa_get_logged_in_points();
         $pointshtml = $userpoints == 1 ? qa_lang_html_sub('main/1_point', '1', '1') : qa_lang_html_sub('main/x_points', qa_html(number_format($userpoints)));
         $this->output('<span class="qa-logged-in-points">', '(' . $pointshtml . ')', '</span>');
     }
 }
Esempio n. 2
0
function qw_get_avatar($handle, $size = 40, $html = true)
{
    $userid = qa_handle_to_userid($handle);
    if (defined('QA_WORDPRESS_INTEGRATE_PATH')) {
        $img_html = get_avatar(qa_get_user_email($userid), $size);
    } else {
        if (QA_FINAL_EXTERNAL_USERS) {
            $img_html = qa_get_external_avatar_html($userid, $size, false);
        } else {
            if (!isset($handle)) {
                if (qa_opt('avatar_allow_upload') && qa_opt('avatar_default_show') && strlen(qa_opt('avatar_default_blobid'))) {
                    $img = qa_opt('avatar_default_blobid');
                } else {
                    $img = '';
                }
            } else {
                $f = ra_user_data($handle);
                if (empty($f['account']['avatarblobid'])) {
                    if (qa_opt('avatar_allow_upload') && qa_opt('avatar_default_show') && strlen(qa_opt('avatar_default_blobid'))) {
                        $img = qa_opt('avatar_default_blobid');
                    } else {
                        $img = '';
                    }
                } else {
                    $img = $f['account']['avatarblobid'];
                }
            }
        }
    }
    if (empty($img)) {
        return;
    }
    if ($html) {
        return '<a href="' . qa_path_absolute('user/' . $handle) . '"><img src="' . qa_path_absolute('', array('qa' => 'image', 'qa_blobid' => $img, 'qa_size' => $size)) . '" /></a>';
    } elseif (!empty($img)) {
        return qa_path_absolute('', array('qa' => 'image', 'qa_blobid' => $img, 'qa_size' => $size));
    }
}
Esempio n. 3
0
require_once QA_INCLUDE_DIR . 'app/format.php';
//	Get list of all users
$start = qa_get_start();
$users = qa_db_select_with_pending(qa_db_top_users_selectspec($start, qa_opt_if_loaded('page_size_users')));
$usercount = qa_opt('cache_userpointscount');
$pagesize = qa_opt('page_size_users');
$users = array_slice($users, 0, $pagesize);
$usershtml = qa_userids_handles_html($users);
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('main/highest_users');
$qa_content['ranking'] = array('items' => array(), 'rows' => ceil($pagesize / qa_opt('columns_users')), 'type' => 'users');
if (count($users)) {
    foreach ($users as $userid => $user) {
        if (QA_FINAL_EXTERNAL_USERS) {
            $avatarhtml = qa_get_external_avatar_html($user['userid'], qa_opt('avatar_users_size'), true);
        } else {
            $avatarhtml = qa_get_user_avatar_html($user['flags'], $user['email'], $user['handle'], $user['avatarblobid'], $user['avatarwidth'], $user['avatarheight'], qa_opt('avatar_users_size'), true);
        }
        // avatar and handle now listed separately for use in themes
        $qa_content['ranking']['items'][] = array('avatar' => $avatarhtml, 'label' => $usershtml[$user['userid']], 'score' => qa_html(number_format($user['points'])), 'raw' => $user);
    }
} else {
    $qa_content['title'] = qa_lang_html('main/no_active_users');
}
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $usercount, qa_opt('pages_prev_next'));
$qa_content['navigation']['sub'] = qa_users_sub_navigation();
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
Esempio n. 4
0
function cs_get_post_avatar($post, $userid, $size = 40, $html = false)
{
    if (defined('QA_WORDPRESS_INTEGRATE_PATH')) {
        $avatar = get_avatar(qa_get_user_email($userid), $size);
    }
    if (QA_FINAL_EXTERNAL_USERS) {
        $avatar = qa_get_external_avatar_html($post['userid'], $size, false);
    } else {
        $avatar = qa_get_user_avatar_html($post['flags'], $post['email'], $post['handle'], $post['avatarblobid'], $post['avatarwidth'], $post['avatarheight'], $size);
    }
    if ($html) {
        return '<div class="avatar" data-id="' . $userid . '" data-handle="' . $post['handle'] . '">' . $avatar . '</div>';
    }
    return $avatar;
}
Esempio n. 5
0
function qa_other_to_q_html_fields($question, $userid, $cookieid, $usershtml, $dummy, $options)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    require_once QA_INCLUDE_DIR . 'app/updates.php';
    $fields = qa_post_html_fields($question, $userid, $cookieid, $usershtml, null, $options);
    switch ($question['obasetype'] . '-' . @$question['oupdatetype']) {
        case 'Q-':
            $langstring = 'main/asked';
            break;
        case 'Q-' . QA_UPDATE_VISIBLE:
            if (@$question['opersonal']) {
                $langstring = $question['hidden'] ? 'misc/your_q_hidden' : 'misc/your_q_reshown';
            } else {
                $langstring = $question['hidden'] ? 'main/hidden' : 'main/reshown';
            }
            break;
        case 'Q-' . QA_UPDATE_CLOSED:
            if (@$question['opersonal']) {
                $langstring = isset($question['closedbyid']) ? 'misc/your_q_closed' : 'misc/your_q_reopened';
            } else {
                $langstring = isset($question['closedbyid']) ? 'main/closed' : 'main/reopened';
            }
            break;
        case 'Q-' . QA_UPDATE_TAGS:
            $langstring = @$question['opersonal'] ? 'misc/your_q_retagged' : 'main/retagged';
            break;
        case 'Q-' . QA_UPDATE_CATEGORY:
            $langstring = @$question['opersonal'] ? 'misc/your_q_recategorized' : 'main/recategorized';
            break;
        case 'A-':
            $langstring = @$question['opersonal'] ? 'misc/your_q_answered' : 'main/answered';
            break;
        case 'A-' . QA_UPDATE_SELECTED:
            $langstring = @$question['opersonal'] ? 'misc/your_a_selected' : 'main/answer_selected';
            break;
        case 'A-' . QA_UPDATE_VISIBLE:
            if (@$question['opersonal']) {
                $langstring = $question['ohidden'] ? 'misc/your_a_hidden' : 'misc/your_a_reshown';
            } else {
                $langstring = $question['ohidden'] ? 'main/hidden' : 'main/answer_reshown';
            }
            break;
        case 'A-' . QA_UPDATE_CONTENT:
            $langstring = @$question['opersonal'] ? 'misc/your_a_edited' : 'main/answer_edited';
            break;
        case 'Q-' . QA_UPDATE_FOLLOWS:
            $langstring = @$question['opersonal'] ? 'misc/your_a_questioned' : 'main/asked_related_q';
            break;
        case 'C-':
            $langstring = 'main/commented';
            break;
        case 'C-' . QA_UPDATE_C_FOR_Q:
            $langstring = @$question['opersonal'] ? 'misc/your_q_commented' : 'main/commented';
            break;
        case 'C-' . QA_UPDATE_C_FOR_A:
            $langstring = @$question['opersonal'] ? 'misc/your_a_commented' : 'main/commented';
            break;
        case 'C-' . QA_UPDATE_FOLLOWS:
            $langstring = @$question['opersonal'] ? 'misc/your_c_followed' : 'main/commented';
            break;
        case 'C-' . QA_UPDATE_TYPE:
            $langstring = @$question['opersonal'] ? 'misc/your_c_moved' : 'main/comment_moved';
            break;
        case 'C-' . QA_UPDATE_VISIBLE:
            if (@$question['opersonal']) {
                $langstring = $question['ohidden'] ? 'misc/your_c_hidden' : 'misc/your_c_reshown';
            } else {
                $langstring = $question['ohidden'] ? 'main/hidden' : 'main/comment_reshown';
            }
            break;
        case 'C-' . QA_UPDATE_CONTENT:
            $langstring = @$question['opersonal'] ? 'misc/your_c_edited' : 'main/comment_edited';
            break;
        case 'Q-' . QA_UPDATE_CONTENT:
        default:
            $langstring = @$question['opersonal'] ? 'misc/your_q_edited' : 'main/edited';
            break;
    }
    $fields['what'] = qa_lang_html($langstring);
    if (@$question['opersonal']) {
        $fields['what_your'] = true;
    }
    if ($question['obasetype'] != 'Q' || @$question['oupdatetype'] == QA_UPDATE_FOLLOWS) {
        $fields['what_url'] = qa_q_path_html($question['postid'], $question['title'], false, $question['obasetype'], $question['opostid']);
    }
    if (@$options['contentview'] && !empty($question['ocontent'])) {
        $viewer = qa_load_viewer($question['ocontent'], $question['oformat']);
        $fields['content'] = $viewer->get_html($question['ocontent'], $question['oformat'], array('blockwordspreg' => @$options['blockwordspreg'], 'showurllinks' => @$options['showurllinks'], 'linksnewwindow' => @$options['linksnewwindow']));
    }
    if (@$options['whenview']) {
        $fields['when'] = qa_when_to_html($question['otime'], @$options['fulldatedays']);
    }
    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, @$question['oname']);
        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'] && @$question['oflagcount']) {
        $fields['flags'] = $question['oflagcount'] == 1 ? qa_lang_html_sub_split('main/1_flag', '1', '1') : qa_lang_html_sub_split('main/x_flags', $question['oflagcount']);
    }
    unset($fields['avatar']);
    if (@$options['avatarsize'] > 0) {
        if (QA_FINAL_EXTERNAL_USERS) {
            $fields['avatar'] = qa_get_external_avatar_html($question['ouserid'], $options['avatarsize'], false);
        } else {
            $fields['avatar'] = qa_get_user_avatar_html($question['oflags'], $question['oemail'], $question['ohandle'], $question['oavatarblobid'], $question['oavatarwidth'], $question['oavatarheight'], $options['avatarsize']);
        }
    }
    return $fields;
}
Esempio n. 6
0
 /**
  * User account navigation item. This will return based on login information.
  * If user is logged in, it will populate user avatar and account links.
  * If user is guest, it will populate login form and registration link.
  *
  * @since Snow 1.4
  */
 private function qam_user_account()
 {
     if (qa_is_logged_in()) {
         // get logged-in user avatar
         $handle = qa_get_logged_in_user_field('handle');
         $toggleClass = 'qam-logged-in';
         if (QA_FINAL_EXTERNAL_USERS) {
             $tobar_avatar = qa_get_external_avatar_html(qa_get_logged_in_user_field('userid'), $this->nav_bar_avatar_size, true);
         } else {
             $tobar_avatar = qa_get_user_avatar_html(qa_get_logged_in_user_field('flags'), qa_get_logged_in_user_field('email'), $handle, qa_get_logged_in_user_field('avatarblobid'), qa_get_logged_in_user_field('avatarwidth'), qa_get_logged_in_user_field('avatarheight'), $this->nav_bar_avatar_size, false);
         }
         $auth_icon = strip_tags($tobar_avatar, '<img>');
     } else {
         // display login icon and label
         $handle = $this->content['navigation']['user']['login']['label'];
         $toggleClass = 'qam-logged-out';
         $auth_icon = '<i class="icon-key qam-auth-key"></i>';
     }
     // finally output avatar with div tag
     $this->output('<div id="qam-account-toggle" class="' . $toggleClass . '">', $auth_icon, '<div class="qam-account-handle">' . qa_html($handle) . '</div>', '</div>');
 }
Esempio n. 7
0
    // don't allow this page to be requested directly from browser
    header('Location: ../');
    exit;
}
require_once QA_INCLUDE_DIR . 'qa-db-users.php';
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
//	Get list of all users
$start = qa_get_start();
$users = qa_db_select_with_pending(qa_db_top_users_selectspec($start, qa_opt_if_loaded('page_size_users')));
$usercount = qa_opt('cache_userpointscount');
$pagesize = qa_opt('page_size_users');
$users = array_slice($users, 0, $pagesize);
$usershtml = qa_userids_handles_html($users);
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('main/highest_users');
$qa_content['ranking'] = array('items' => array(), 'rows' => ceil($pagesize / qa_opt('columns_users')), 'type' => 'users');
if (count($users)) {
    foreach ($users as $userid => $user) {
        $qa_content['ranking']['items'][] = array('label' => (QA_FINAL_EXTERNAL_USERS ? qa_get_external_avatar_html($user['userid'], qa_opt('avatar_users_size'), true) : qa_get_user_avatar_html($user['flags'], $user['email'], $user['handle'], $user['avatarblobid'], $user['avatarwidth'], $user['avatarheight'], qa_opt('avatar_users_size'), true)) . ' ' . $usershtml[$user['userid']], 'score' => qa_html(number_format($user['points'])));
    }
} else {
    $qa_content['title'] = qa_lang_html('main/no_active_users');
}
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $usercount, qa_opt('pages_prev_next'));
$qa_content['navigation']['sub'] = qa_users_sub_navigation();
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
Esempio n. 8
0
 function ra_user_avatar()
 {
     if (qw_hook_exist(__FUNCTION__)) {
         $args = func_get_args();
         array_unshift($args, $this);
         return qw_event_hook(__FUNCTION__, $args, NULL);
     }
     if (qa_is_logged_in()) {
         // output user avatar to login bar
         $img_html = QA_FINAL_EXTERNAL_USERS ? qa_get_external_avatar_html(qa_get_logged_in_userid(), 24, true) : qa_get_user_avatar_html(qa_get_logged_in_flags(), qa_get_logged_in_email(), qa_get_logged_in_handle(), qa_get_logged_in_user_field('avatarblobid'), qa_get_logged_in_user_field('avatarwidth'), qa_get_logged_in_user_field('avatarheight'), 24, true);
         preg_match('@src="([^"]+)"@', $img_html, $match);
         $this->output($match[1]);
     }
 }
Esempio n. 9
0
 function site_top()
 {
     $this->output('<div id="site-top" class="container">');
     $this->page_title_error();
     if (qa_is_logged_in()) {
         // output user avatar to login bar
         $this->output('<div class="qa-logged-in-avatar">', QA_FINAL_EXTERNAL_USERS ? qa_get_external_avatar_html(qa_get_logged_in_userid(), 24, true) : qa_get_user_avatar_html(qa_get_logged_in_flags(), qa_get_logged_in_email(), qa_get_logged_in_handle(), qa_get_logged_in_user_field('avatarblobid'), qa_get_logged_in_user_field('avatarwidth'), qa_get_logged_in_user_field('avatarheight'), 24, true), '</div>');
     } else {
         $this->output('<ul class="pull-right top-buttons clearfix">', '<li><a href="#" class="btn">' . qa_lang_html('cleanstrap/login') . '</a></li>', '<li><a href="#" class="btn">' . qa_lang_html('cleanstrap/register') . '</a></li>', '</ul>');
     }
     $this->output('</div>');
 }
Esempio n. 10
0
    function ranking($ranking)
    {
        $class = @$ranking['type'] == 'users' ? 'qa-top-users' : 'qa-top-tags';
        $item_count = min($ranking['rows'], count($ranking['items']));
        if (@$ranking['type'] == 'users') {
            if (count($ranking['items'])) {
                $this->output('<div class="page-users-list clearfix"><div class="row">');
                $columns = qa_opt('columns_users');
                $pagesize = qa_opt('page_size_users');
                $start = qa_get_start();
                $users = qa_db_select_with_pending(qa_db_top_users_selectspec($start, qa_opt_if_loaded('page_size_users')));
                $users = array_slice($users, 0, $pagesize);
                $usershtml = qa_userids_handles_html($users);
                foreach ($ranking['items'] as $user) {
                    $this->output('<div class="user-box col-sm-' . ceil(12 / $columns) . ' col-xs-12">');
                    $user_raw = !empty($user['raw']) ? $user['raw'] : $user;
                    $handle = @$user_raw['handle'];
                    $handle_html = @$usershtml[$user_raw['userid']];
                    if (defined('QA_WORDPRESS_INTEGRATE_PATH')) {
                        $level_html = $user['score'];
                        unset($user['score']);
                    } else {
                        if (is_numeric($user['score'])) {
                            $user_level = donut_get_user_level($user_raw['userid']);
                            $level_html = qa_user_level_string($user_level);
                        } else {
                            $level_html = $user['score'];
                            unset($user['score']);
                        }
                    }
                    if (empty($handle_html)) {
                        $handle_html = $user['label'];
                    }
                    $avatar = QA_FINAL_EXTERNAL_USERS ? qa_get_external_avatar_html(@$user_raw['userid'], qa_opt('avatar_users_size'), true) : qa_get_user_avatar_html(@$user_raw['flags'], @$user_raw['email'], @$user_raw['handle'], @$user_raw['avatarblobid'], @$user_raw['avatarwidth'], @$user_raw['avatarheight'], 70, true);
                    if (isset($user['score'])) {
                        $userpoints = $user['score'];
                        $pointshtml = $userpoints === 1 ? qa_lang_html_sub('main/1_point', '1', '1') : qa_lang_html_sub('main/x_points', qa_html($userpoints));
                        if (!empty($pointshtml)) {
                            $pointshtml = '<p class="score">' . $pointshtml . '</p>';
                        }
                    }
                    $this->output('
								<div class="user-box-inner">
									<div class="user-avatar">
										' . $avatar . '
									</div>
									<div class="user-data">
										' . $handle_html . '
										<div class="user-level">
											' . $level_html . '
										</div>
										<div class="counts clearfix">
											' . @$pointshtml . '
										</div>
								</div>');
                    if (qa_opt('badge_active') && function_exists('qa_get_badge_list')) {
                        $this->output('<div class="badge-list">' . donut_user_badge($handle) . '</div>');
                    }
                    $this->output('</div>');
                    $this->output('</div>');
                }
                $this->output('</div>');
                $this->output('</div>');
            } else {
                $title = isset($this->content['ranking_users']['title']) ? $this->content['ranking_users']['title'] : @$this->content['title'];
                $this->output('
								<div class="no-items">
									<div class="alert alert-info"><span class="fa fa-warning"></span> ' . $title . '</div>
								</div>');
            }
        } elseif (@$ranking['type'] == 'tags') {
            if (count($ranking['items'])) {
                $this->output('<div id="tags-list" class="row ' . $class . '">');
                $columns = qa_opt('columns_tags');
                for ($column = 0; $column < $columns; $column++) {
                    $this->set_context('ranking_column', $column);
                    $this->output('<div class="col-md-' . ceil(12 / $columns) . ' col-xs-12" >');
                    $this->output('<ul class="donut-tags-list">');
                    for ($row = 0; $row < $item_count; $row++) {
                        $this->set_context('ranking_row', $row);
                        $this->donut_tags_item(@$ranking['items'][$column * $item_count + $row], $class, $column > 0);
                    }
                    $this->clear_context('ranking_column');
                    $this->output('</ul>');
                    $this->output('</div>');
                }
                $this->clear_context('ranking_row');
                $this->output('</div>');
            } else {
                $this->output('
						<div class="no-items">
						<div class="alert alert-info"><span class="fa fa-warning"></span> ' . $this->content['ranking_tags']['title'] . '</div>
						</div>');
            }
        } else {
            parent::ranking($ranking);
        }
    }
    function ranking($ranking)
    {
        $class = @$ranking['type'] == 'users' ? 'qa-top-users' : 'qa-top-tags';
        $rows = min($ranking['rows'], count($ranking['items']));
        if (!$rows) {
            $rows = 1;
        }
        if (@$ranking['type'] == 'users') {
            $this->output('<div class="page-users-list clearfix"><div class="row">');
            if (isset($ranking['items'])) {
                $columns = ceil(count($ranking['items']) / $rows);
            }
            if (isset($ranking['items'])) {
                $pagesize = qa_opt('page_size_users');
                $start = qa_get_start();
                $users = qa_db_select_with_pending(qa_db_top_users_selectspec($start, qa_opt_if_loaded('page_size_users')));
                $users = array_slice($users, 0, $pagesize);
                $usershtml = qa_userids_handles_html($users);
                foreach ($ranking['items'] as $user) {
                    $this->output('<div class="user-box col-sm-' . ceil(12 / $columns) . ' col-xs-12">');
                    $user_raw = !empty($user['raw']) ? $user['raw'] : $user;
                    $handle = @$user_raw['handle'];
                    $handle_html = @$usershtml[$user_raw['userid']];
                    if (isset($user_raw['userid'])) {
                        $user_rank = qa_db_select_with_pending(qa_db_user_rank_selectspec($user_raw['userid'], true));
                        $level_html = qa_user_level_string($user_rank);
                    } else {
                        $level_html = $user['score'];
                        unset($user['score']);
                    }
                    if (empty($handle_html)) {
                        $handle_html = $user['label'];
                    }
                    $avatar = QA_FINAL_EXTERNAL_USERS ? qa_get_external_avatar_html(@$user_raw['userid'], qa_opt('avatar_users_size'), true) : qa_get_user_avatar_html(@$user_raw['flags'], @$user_raw['email'], @$user_raw['handle'], @$user_raw['avatarblobid'], @$user_raw['avatarwidth'], @$user_raw['avatarheight'], 70, true);
                    if (isset($user['score'])) {
                        $userpoints = $user['score'];
                        $pointshtml = $userpoints === 1 ? qa_lang_html_sub('main/1_point', '1', '1') : qa_lang_html_sub('main/x_points', qa_html($userpoints));
                        if (!empty($pointshtml)) {
                            $pointshtml = '<p class="score">' . $pointshtml . '</p>';
                        }
                    }
                    $this->output('
								<div class="user-box-inner">
									<div class="user-avatar">
										' . $avatar . '
									</div>
									<div class="user-data">
										' . $handle_html . '
										<div class="user-level">
											' . $level_html . '
										</div>
										<div class="counts clearfix">
											' . @$pointshtml . '
										</div>
								</div>');
                    if (qa_opt('badge_active') && function_exists('qa_get_badge_list')) {
                        $this->output('<div class="badge-list">' . donut_user_badge($handle) . '</div>');
                    }
                    $this->output('</div>');
                    $this->output('</div>');
                }
            } else {
                $this->output('
								<div class="no-items">
									<h3 class="">' . qa_lang_html('main/no_active_users') . '</h3>
								</div>');
            }
            $this->output('</div>');
            $this->output('</div>');
        } elseif (@$ranking['type'] == 'tags') {
            if ($rows > 0) {
                $this->output('<div id="tags-list" class="row ' . $class . '">');
                $tags = array();
                foreach (@$ranking['items'] as $item) {
                    $tags[] = strip_tags($item['label']);
                }
                $columns = ceil(count($ranking['items']) / $rows);
                for ($column = 0; $column < $columns; $column++) {
                    $this->set_context('ranking_column', $column);
                    $this->output('<div class="col-md-' . ceil(12 / $columns) . ' col-xs-12" >');
                    $this->output('<ul class="donut-tags-list">');
                    for ($row = 0; $row < $rows; $row++) {
                        $this->set_context('ranking_row', $row);
                        $this->donut_tags_item(@$ranking['items'][$column * $rows + $row], $class, $column > 0);
                    }
                    $this->clear_context('ranking_column');
                    $this->output('</ul>');
                    $this->output('</div>');
                }
                $this->clear_context('ranking_row');
                $this->output('</div>');
            } else {
                $this->output('
						<div class="no-items">
						<h3 class="icon-warning">' . qa_lang('cleanstrap/no_tags') . '</h3>
						<p>' . qa_lang('cleanstrap/no_results_detail') . '</p>
						</div>');
            }
        } else {
            if ($rows > 0) {
                $this->output('<table class="' . $class . '-table">');
                $columns = ceil(count($ranking['items']) / $rows);
                for ($row = 0; $row < $rows; $row++) {
                    $this->set_context('ranking_row', $row);
                    $this->output('<tr>');
                    for ($column = 0; $column < $columns; $column++) {
                        $this->set_context('ranking_column', $column);
                        $this->ranking_item(@$ranking['items'][$column * $rows + $row], $class, $column > 0);
                    }
                    $this->clear_context('ranking_column');
                    $this->output('</tr>');
                }
                $this->clear_context('ranking_row');
                $this->output('</table>');
            } else {
                $this->output('
							<div class="no-items">
								<h3 class="icon-warning">' . qa_lang_html('cleanstrap/no_results') . '</h3>
								<p>' . qa_lang_html('cleanstrap/no_results_detail') . '</p>
							</div>');
            }
        }
    }
Esempio n. 12
0
function donut_get_post_avatar($post, $size = 40, $html = false)
{
    if (!isset($post['raw'])) {
        $post['raw']['userid'] = $post['userid'];
        $post['raw']['flags'] = $post['flags'];
        $post['raw']['email'] = $post['email'];
        $post['raw']['handle'] = $post['handle'];
        $post['raw']['avatarblobid'] = $post['avatarblobid'];
        $post['raw']['avatarwidth'] = $post['avatarwidth'];
        $post['raw']['avatarheight'] = $post['avatarheight'];
    }
    if (defined('QA_WORDPRESS_INTEGRATE_PATH')) {
        $avatar = get_avatar(qa_get_user_email($post['raw']['userid']), $size);
    }
    if (QA_FINAL_EXTERNAL_USERS) {
        $avatar = qa_get_external_avatar_html($post['raw']['userid'], $size, false);
    } else {
        $avatar = qa_get_user_avatar_html($post['raw']['flags'], $post['raw']['email'], $post['raw']['handle'], $post['raw']['avatarblobid'], $post['raw']['avatarwidth'], $post['raw']['avatarheight'], $size);
    }
    if (empty($avatar)) {
        // if the default avatar is not set by the admin , then take the default
        $avatar = donut_get_default_avatar($size);
    }
    if ($html) {
        return '<div class="avatar" data-id="' . $post['raw']['userid'] . '" data-handle="' . $post['raw']['handle'] . '">' . $avatar . '</div>';
    }
    return $avatar;
}
Esempio n. 13
0
 function doctype()
 {
     if (strpos($this->request, 'user/') !== false && strpos($this->request, 'articles') !== false) {
         $this->request = 'user-articles';
     }
     /*
     	ADAPT USER PAGES AND SUBPAGES
     */
     if ($this->template == 'user' || $this->template == 'user-wall' || $this->template == 'user-activity' || $this->template == 'user-questions' || $this->template == 'user-answers' || $this->request == 'user-articles') {
         $handle = qa_request_part(1);
         if (!strlen($handle)) {
             $handle = qa_get_logged_in_handle();
             qa_redirect(isset($handle) ? 'user/' . $handle : 'users');
         }
         $identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle;
         list($useraccount, $userprofile, $userfields, $usermessages, $userpoints, $userlevels, $navcategories, $userrank) = qa_db_select_with_pending(QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_account_selectspec($handle, false), QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_profile_selectspec($handle, false), QA_FINAL_EXTERNAL_USERS ? null : qa_db_userfields_selectspec(), QA_FINAL_EXTERNAL_USERS ? null : qa_db_recent_messages_selectspec(null, null, $handle, false, qa_opt_if_loaded('page_size_wall')), qa_db_user_points_selectspec($identifier), qa_db_user_levels_selectspec($identifier, QA_FINAL_EXTERNAL_USERS, true), qa_db_category_nav_selectspec(null, true), qa_db_user_rank_selectspec($identifier));
         $userid = $useraccount['userid'];
         $loginuserid = qa_get_logged_in_userid();
         if ($this->template == 'user') {
             // ADAPT FORM CONTENTS
             /*$this->content['form_activity']['fields']['activity'] = array('type'=>'static', 
             		'label'=>'Recent Activity',
             		'value'=>'<a href="'.$handle.'/activity">show</a>');*/
             // ADD PRIVATE MESSAGE LINK AFTER MEMBERSHIP DURATION
             if (qa_opt('allow_private_messages') && isset($loginuserid) && $loginuserid != $userid && !($useraccount['flags'] & QA_USER_FLAGS_NO_MESSAGES)) {
                 $this->content['form_profile']['fields']['duration']['value'] .= strtr(qa_lang_html('profile/send_private_message'), array('^1' => '<a href="' . qa_path_html('message/' . $handle) . '">', '^2' => '</a>'));
             }
         }
         $site_url = qa_opt('site_url');
         // RENEW THE SUB-NAVIGATION
         unset($this->content['navigation']['sub']);
         $this->content['navigation']['sub']['account'] = array('label' => 'User ' . $handle, 'url' => $site_url . '/user/' . $handle, 'selected' => $this->template == 'user' ? 1 : 0);
         $this->content['navigation']['sub']['wall'] = array('label' => $handle . '\'s Wall', 'url' => $site_url . '/user/' . $handle . '/wall', 'selected' => $this->template == 'user-wall' ? 1 : 0);
         $this->content['navigation']['sub']['activity'] = array('label' => qa_lang('qa_blog_lang/nav_activity'), 'url' => $site_url . '/user/' . $handle . '/activity', 'selected' => $this->template == 'user-activity' ? 1 : 0);
         $this->content['navigation']['sub']['questions'] = array('label' => qa_lang('qa_blog_lang/nav_questions'), 'url' => $site_url . '/user/' . $handle . '/questions', 'selected' => $this->template == 'user-questions' ? 1 : 0);
         $this->content['navigation']['sub']['answers'] = array('label' => qa_lang('qa_blog_lang/nav_answers'), 'url' => $site_url . '/user/' . $handle . '/answers', 'selected' => $this->template == 'user-answers' ? 1 : 0);
         $this->content['navigation']['sub']['articles'] = array('label' => qa_lang('qa_blog_lang/nav_articles'), 'url' => $site_url . '/user/' . $handle . '/articles', 'selected' => $this->request == 'user-articles' ? 1 : 0);
         $this->content['navigation']['sub']['newarticles'] = array('label' => qa_lang('qa_blog_lang/new_articles'), 'url' => $site_url . '/articles', 'selected' => $this->request == 'articles' ? 1 : 0);
         if ($this->request == 'user-articles') {
             unset($this->content['title']);
             $this->content['title'] = qa_lang('qa_blog_lang/title_recent') . " {$handle}";
             unset($this->content['suggest_next']);
             unset($this->content['error']);
             if ($this->request == 'user-articles') {
                 $qa_content['custom'] = "";
                 $html = "";
                 $result = qa_db_query_sub("SELECT * FROM ^blog_posts WHERE userid =  '{$userid}' ORDER BY posted DESC");
                 $i = 0;
                 while ($article = mysqli_fetch_array($result)) {
                     $i++;
                     $html .= article_item($article['title'], $site_url . '/blog/' . $article['postid'] . '/' . seoUrl2($article['title']) . '/', $article['posted'], $article['views']);
                 }
                 if ($i == 0) {
                     $html = "<h3>" . qa_lang('qa_blog_lang/oops') . " {$handle} " . qa_lang('qa_blog_lang/no_post') . "</h3>";
                 }
                 $this->content['custom'] = $html;
             }
         }
     } else {
         if ($this->template == 'account' || $this->template == 'favorites' || $this->template == 'updates' || $this->request == 'gallery' || $this->request == 'articles') {
             // ADAPT FORM FOR DETAILS SUBPAGE
             // RENEW THE SUB-NAVIGATION
             unset($this->content['navigation']['sub']);
             $this->content['navigation']['sub']['account'] = array('label' => 'My Details', 'url' => './account', 'selected' => $this->template == 'account' ? 1 : 0);
             $this->content['navigation']['sub']['favorites'] = array('label' => 'My Favorites', 'url' => './favorites', 'selected' => $this->template == 'favorites' ? 1 : 0);
             $this->content['navigation']['sub']['updates'] = array('label' => 'My Updates', 'url' => './updates', 'selected' => $this->template == 'updates' ? 1 : 0);
             $this->content['navigation']['sub']['articles'] = array('label' => 'My Articles', 'url' => './articles', 'selected' => $this->request == 'articles' ? 1 : 0);
         } else {
             if ($this->template == 'users') {
                 require_once QA_INCLUDE_DIR . 'qa-db-users.php';
                 require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
                 require_once QA_INCLUDE_DIR . 'qa-app-format.php';
                 $start = qa_get_start();
                 $users = qa_db_select_with_pending(qa_db_top_users_selectspec($start, qa_opt_if_loaded('page_size_users')));
                 $usercount = qa_opt('cache_userpointscount');
                 $pagesize = qa_opt('page_size_users');
                 $users = array_slice($users, 0, $pagesize);
                 $usershtml = qa_userids_handles_html($users);
                 // CHANGE TITLE
                 $this->content['title'] = 'Users';
                 $this->content['ranking'] = array('items' => array(), 'rows' => ceil($pagesize / qa_opt('columns_users')), 'type' => 'users');
                 if (count($users)) {
                     foreach ($users as $userid => $user) {
                         $this->content['ranking']['items'][] = array('label' => (QA_FINAL_EXTERNAL_USERS ? qa_get_external_avatar_html($user['userid'], qa_opt('avatar_users_size'), true) : qa_get_user_avatar_html($user['flags'], $user['email'], $user['handle'], $user['avatarblobid'], $user['avatarwidth'], $user['avatarheight'], qa_opt('avatar_users_size'), true)) . ' ' . $usershtml[$user['userid']], 'score' => qa_html(number_format($user['points'])));
                     }
                 } else {
                     $this->content['title'] = qa_lang_html('main/no_active_users');
                 }
                 $this->content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $usercount, qa_opt('pages_prev_next'));
                 // EMPTY SUB-NAVIGATION
                 $this->content['navigation']['sub'] = null;
             }
         }
     }
     if ($this->template == 'questions') {
         unset($this->content['navigation']['sub']);
         $this->content['navigation']['sub']['account'] = array('label' => 'My Details', 'url' => './account', 'selected' => 0);
         //print_r ($this->content['navigation']);
     }
     if ($this->request == 'login') {
         $this->content['form']['fields']['password']['note'] = '<a href="/forgot">I forgot my password</a> - <a href="/register">Register</a>';
     }
     qa_html_theme_base::doctype();
 }